cpl-6.4.1/0000755000460300003120000000000012310333021007256 500000000000000cpl-6.4.1/cplui/0000755000460300003120000000000012310333011010371 500000000000000cpl-6.4.1/cplui/cpl_plugin.h0000644000460300003120000002304011513030756012633 00000000000000/* $Id: cpl_plugin.h,v 1.14 2011-01-11 10:33:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-01-11 10:33:18 $ * $Revision: 1.14 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_PLUGIN_H #define CPL_PLUGIN_H #include #include #include CPL_BEGIN_DECLS /** * @ingroup cpl_plugin * * @brief * Plugin API version * * @hideinitializer */ #define CPL_PLUGIN_API (1) /** * @ingroup cpl_plugin * * @brief * Definition of plugin types * * Predefined plugin types supported by the Common Pipeline Library itself. */ enum _cpl_plugin_type_ { /** * Plugin is of unknown or undefined type */ CPL_PLUGIN_TYPE_NONE = 0, /** * Plugin is a complete data reduction task, i.e. a sequence of individual * data reduction steps, turning a raw frame into a `final' product. */ CPL_PLUGIN_TYPE_RECIPE = 1 << 0, /** * Plugin is a recipe, i.e. a complete data reduction task. In addition, * this recipe version provides extra data about the required input * data. This plugin is a subclass of @c CPL_PLUGIN_TYPE_RECIPE. */ CPL_PLUGIN_TYPE_RECIPE_V2 = (1 << 1) | CPL_PLUGIN_TYPE_RECIPE }; /** * @ingroup cpl_plugin * * @brief * Data type used to store the plugin type code. */ typedef enum _cpl_plugin_type_ cpl_plugin_type; /** * @ingroup cpl_plugin * * @brief * The plugin data type. * * This defines the (public) plugin data type. */ typedef struct _cpl_plugin_ cpl_plugin; typedef int (*cpl_plugin_func)(cpl_plugin *); /** * @ingroup cpl_plugin * * @brief * The type representation of the generic plugin interface. */ struct _cpl_plugin_ { /** * @brief * The API version the Plugin complies to. * * The API version number identifies the internal layout of the plugin * interface structure. It may be used by an application calling a plugin * to setup the correct interface to communicate with the plugin or, in * the simplest case, to ignore any plugin which does not match the plugin * API an application has been buid for. */ unsigned int api; /* Must always be the first entry in the interface! */ /** * @brief * The Plugin version. * * The Plugin version number defines the version number for the plugin. * The Plugin version number is an encoded version of the * usual @b MAJOR.MINOR.MICRO form for version numbers. */ unsigned long version; /** * @brief * The Plugin type. * * The Plugin type identifies the type of plugin. The data type is not a * cpl_plugin_type in order to keep this interface as generic as possible. */ unsigned long type; /** * @brief * Plugin's unique name. * * Variable contains the unique name of the Plugin. To ensure uniqueness * across all possible Plugins one should follow the hierarchical naming * convention mentioned in the CPL documentation. */ const char *name; /** * @brief * Plugin's short help string. * * Variable contains the plugin's null-terminated short help string. * The short help string should summarize the plugin's purpose in not more * than a few lines. It may contain new line characters. If the plugin * does not provide a short help the pointer should be set * to a @c NULL pointer. */ const char *synopsis; /** * @brief * Plugin's detailed description. * * Variable contains the plugin's null-terminated detailed * description string. The description is the detailed help for the * plugin. For formatting the output the C special characters @c '\\n', * @c '\\t' maybe embedded in the returned string. If the plugin does not * provide a detailed description the pointer should be set to a @c NULL * pointer. */ const char *description; /** * @brief * Name of the plugin's author. * * Variable contains the null-terminated identifier string of * the plugins author. If the plugin does not specify an author this * pointer should be set to a @c NULL pointer. */ const char *author; /** * @brief * Author's email address. * * Variable contains the null-terminated string of the author's * email address. If the plugin does not specify an email address this * pointer should be set to a @c NULL pointer. */ const char *email; /** * @brief * Plugin's copyright. * * Variable contains the copyright and license string applying * to the plugin. The returned string must be null-terminated. If no * copyright applies this pointer should be set to a @c NULL pointer. */ const char *copyright; /** * @brief * Initalizes a plugin instance. * * @param plugin The plugin to instantiate. * * @return The function must return 0 on success, and a non-zero value * if the plugin instatiation failed. * * The function to initialize a plugin instance. This maybe NULL * if the initialization of the plugin is not needed. Otherwise it * has to be called before plugin type specific members are accessed. */ cpl_plugin_func initialize; /** * @brief * Executes a plugin instance. * * @param plugin The plugin to execute. * * @return The function must return 0 on success, and a non-zero value * if the plugin execution failed. * * The function executes the plugin instance @em plugin. */ cpl_plugin_func execute; /** * @brief * Deinitialization a plugin instance. * * @return The function must return 0 on success, and a non-zero value * if the plugin deinitalization failed. * * The function to deinitialize the plugin instance @em plugin. If this is * @c NULL no deinitialization of the plugin instance is needed. */ cpl_plugin_func deinitialize; }; /* * Create, copy and destroy operations. */ cpl_plugin *cpl_plugin_new(void) CPL_ATTR_ALLOC; cpl_error_code cpl_plugin_copy(cpl_plugin *self, const cpl_plugin *other); void cpl_plugin_delete(cpl_plugin *self); /* * Accessor Functions */ cpl_error_code cpl_plugin_set_api(cpl_plugin *self , unsigned int api); unsigned int cpl_plugin_get_api(const cpl_plugin *self); int cpl_plugin_set_version(cpl_plugin *self, unsigned long version); unsigned long cpl_plugin_get_version(const cpl_plugin *self); char *cpl_plugin_get_version_string(const cpl_plugin *self) CPL_ATTR_ALLOC; cpl_error_code cpl_plugin_set_type(cpl_plugin *self, unsigned long type); unsigned long cpl_plugin_get_type(const cpl_plugin *self); char *cpl_plugin_get_type_string(const cpl_plugin *self) CPL_ATTR_ALLOC; cpl_error_code cpl_plugin_set_name(cpl_plugin *self, const char *name); const char *cpl_plugin_get_name(const cpl_plugin *self); cpl_error_code cpl_plugin_set_synopsis(cpl_plugin *self, const char *synopsis); const char *cpl_plugin_get_synopsis(const cpl_plugin *self); cpl_error_code cpl_plugin_set_description(cpl_plugin *self, const char *description); const char *cpl_plugin_get_description(const cpl_plugin *self); cpl_error_code cpl_plugin_set_author(cpl_plugin *self, const char *author); const char *cpl_plugin_get_author(const cpl_plugin *self); cpl_error_code cpl_plugin_set_email(cpl_plugin *self, const char *email); const char *cpl_plugin_get_email(const cpl_plugin *self); cpl_error_code cpl_plugin_set_copyright(cpl_plugin *self, const char *copyright); const char *cpl_plugin_get_copyright(const cpl_plugin *self); cpl_error_code cpl_plugin_set_init(cpl_plugin *self, cpl_plugin_func); cpl_plugin_func cpl_plugin_get_init(const cpl_plugin *self); cpl_error_code cpl_plugin_set_exec(cpl_plugin *self, cpl_plugin_func); cpl_plugin_func cpl_plugin_get_exec(const cpl_plugin *self); cpl_error_code cpl_plugin_set_deinit(cpl_plugin *self, cpl_plugin_func); cpl_plugin_func cpl_plugin_get_deinit(const cpl_plugin *self); /* * Convenience Functions */ cpl_error_code cpl_plugin_init(cpl_plugin *self, unsigned int api, unsigned long version, unsigned long type, const char *name, const char *synopsis, const char *description, const char *author, const char *email, const char *copyright, cpl_plugin_func initialize, cpl_plugin_func execute, cpl_plugin_func deinitialize); /* * Debugging */ void cpl_plugin_dump(const cpl_plugin *self, FILE *stream); CPL_END_DECLS #endif /* CPL_PLUGIN_H */ cpl-6.4.1/cplui/cpl_frameset.c0000644000460300003120000020021712310072427013136 00000000000000/* $Id: cpl_frameset.c,v 1.45 2013-08-28 06:44:37 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-08-28 06:44:37 $ * $Revision: 1.45 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include #include #include #include #include "cpl_frameset.h" #include "cpl_errorstate.h" #include "cpl_error_impl.h" /** * @defgroup cpl_frameset Frame Sets * * The module implements a container type for frames. Frames can be stored * in a frame set and retrieved, either by searching for a particular * frame tag or by sequential access. Frame sets can be created, filled and * saved to a so called `set of frames' file or loaded from such a file. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * The frame set type. */ enum _cpl_frameset_cacheid { TAG, POS, ALL }; typedef enum _cpl_frameset_cacheid cpl_frameset_cacheid; struct _cpl_frameset_cache_ { cx_multimap_iterator tag; cx_multimap_iterator pos; }; typedef struct _cpl_frameset_cache_ cpl_frameset_cache; struct _cpl_frameset_ { cx_multimap *frames; cx_list *history; cpl_frameset_cache cache; }; /* * Private methods */ inline static cxbool _cpl_frameset_cache_empty(const cpl_frameset *self, cpl_frameset_cacheid id) { cxbool state; switch (id) { case TAG: state = self->cache.tag == NULL; break; case POS: state = self->cache.pos == NULL; break; case ALL: state = (self->cache.tag == NULL && self->cache.pos == NULL); break; } return state; } /* @internal @brief Reset the internal cache of the frameset @param self The frameset @param id The caching type (TAG/POS/ALL) @return void The internal modification means that even though the accessor cpl_frameset_get_next_first() has only const modifiers, the call does have side-effects, and it can thus not be subjected to optimizations applicable to 'pure' functions (e.g. to call the function fewer times than the program says). @note The internal (private) members of self are modified! The const modifier is still used, because this change is not visible outside this module. */ inline static void _cpl_frameset_cache_reset(const cpl_frameset *self, cpl_frameset_cacheid id) { cpl_frameset * myself = (cpl_frameset *)self; switch (id) { case TAG: myself->cache.tag = NULL; break; case POS: myself->cache.pos = NULL; break; case ALL: myself->cache.tag = NULL; myself->cache.pos = NULL; break; } return; } /* @internal @brief Update the internal cache of the frameset @param self The frameset @param id The caching type (TAG/POS/ALL) @param position The position to cache @return void The internal modification means that even though the accessor cpl_frameset_get_next_const() has only const modifiers, the call does have side-effects, and it can thus not be subjected to optimizations applicable to 'pure' functions (e.g. to call the function fewer times than the program says). @note The internal (private) members of self are modified! The const modifier is still used, because this change is not visible outside this module. */ inline static void _cpl_frameset_cache_push(const cpl_frameset *self, cpl_frameset_cacheid id, cx_multimap_const_iterator position) { cpl_frameset * myself = (cpl_frameset *)self; switch (id) { case TAG: myself->cache.tag = (cx_multimap_iterator)position; break; case POS: myself->cache.pos = (cx_multimap_iterator)position; break; case ALL: myself->cache.tag = (cx_multimap_iterator)position; myself->cache.pos = (cx_multimap_iterator)position; break; } return; } inline static cx_multimap_iterator _cpl_frameset_cache_get(const cpl_frameset *self, cpl_frameset_cacheid id) { cxptr entry; switch (id) { case TAG: entry = self->cache.tag; break; case POS: entry = self->cache.pos; break; default: entry = NULL; break; } return entry; } static cxbool _cpl_frameset_compare(cxcptr s, cxcptr t) { return strcmp(s, t) < 0 ? TRUE : FALSE; } /* * Get the first frame in the set with the provided tag, or NULL if such * a frame does not exist. */ inline static cpl_frame * _cpl_frameset_get(const cpl_frameset *self, const char *tag) { cx_multimap_iterator entry; entry = cx_multimap_lower_bound(self->frames, tag); if (entry == cx_multimap_upper_bound(self->frames, tag)) return NULL; return cx_multimap_get_value(self->frames, entry); } /* * Helper functions for sorting frame sets */ inline static void _cpl_frameset_history_merge(cx_list *self, cx_list *other, const cx_multimap *frames, cpl_frame_compare_func compare) { cx_assert((self != NULL) && (other != NULL)); cx_assert(frames != NULL); cx_assert(compare != NULL); if (self != other) { cx_list_iterator first1 = cx_list_begin(self); cx_list_iterator last1 = cx_list_end(self); cx_list_iterator first2 = cx_list_begin(other); cx_list_iterator last2 = cx_list_end(other); while ((first1 != last1) && (first2 != last2)) { cx_multimap_const_iterator node1 = cx_list_get(self, first1); cx_multimap_const_iterator node2 = cx_list_get(other, first2); if (compare(cx_multimap_get_value(frames, node1), cx_multimap_get_value(frames, node2)) < 0) { cx_list_iterator next = cx_list_next(other, first2); cx_list_splice(self, first1, other,first2, next); first2 = next; } else { first1 = cx_list_next(self, first1); } } if (first2 != last2) { cx_list_splice(self, last1, other, first2, last2); } } return; } inline static cpl_error_code _cpl_frameset_history_sort(cx_list *self, const cx_multimap *frames, cpl_frame_compare_func compare) { if (cx_list_size(self) > 1) { cx_list *tmp = cx_list_new(); cx_list_iterator position = cx_list_begin(self); cxsize middle = cx_list_size(self) / 2; while (middle--) { position = cx_list_next(self, position); } cx_list_splice(tmp, cx_list_begin(tmp), self, position, cx_list_end(self)); _cpl_frameset_history_sort(self, frames, compare); _cpl_frameset_history_sort(tmp, frames, compare); _cpl_frameset_history_merge(self, tmp, frames, compare); cx_assert(cx_list_empty(tmp)); cx_list_delete(tmp); } return CPL_ERROR_NONE; } inline static cpl_frame * _cpl_frameset_get_first(const cpl_frameset *self) { cx_list_iterator first; cx_multimap_iterator position; first = cx_list_begin(self->history); if (first == cx_list_end(self->history)) { return NULL; } position = cx_list_get(self->history, first); cx_assert(position != cx_multimap_end(self->frames)); /* Will modify internals of self! */ _cpl_frameset_cache_push(self, POS, position); return cx_multimap_get_value(self->frames, position); } inline static cpl_frame * _cpl_frameset_get_next(const cpl_frameset *self) { cx_list_iterator first; cx_list_iterator last; cx_multimap_iterator next; cx_assert(_cpl_frameset_cache_get(self, POS) != NULL); first = cx_list_begin(self->history); last = cx_list_end(self->history); while (first != last) { next = cx_list_get(self->history, first); if (next == _cpl_frameset_cache_get(self, POS)) { break; } first = cx_list_next(self->history, first); } first = cx_list_next(self->history, first); if (first == cx_list_end(self->history)) { return NULL; } next = cx_list_get(self->history, first); if (next == cx_multimap_end(self->frames)) { return NULL; } /* Will modify internals of self! */ _cpl_frameset_cache_push(self, POS, next); return cx_multimap_get_value(self->frames, next); } /* * Public methods */ /** * @brief * Create a new, empty frame set. * * @return * The handle for the newly created frame set. * * The function allocates the memory for the new frame set, initialises the * set to be empty and returns a handle for it. */ cpl_frameset * cpl_frameset_new(void) { cpl_frameset *self = cx_malloc(sizeof *self); self->frames = cx_multimap_new(_cpl_frameset_compare, NULL, (cx_free_func)cpl_frame_delete); self->history = cx_list_new(); _cpl_frameset_cache_reset(self, ALL); return self; } /** * @brief * Create a copy of the given frame set. * * @param other The frame set to be copied. * * @return * A handle for the created clone. The function returns @c NULL if an * error occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter other is a NULL pointer. *
* @enderror * * The function creates a deep copy, i.e. the frame set object and its * contents, of the frame set @em other. The created copy and the original * set do not share any resources. */ cpl_frameset * cpl_frameset_duplicate(const cpl_frameset *other) { const cxchar *const _id = "cpl_frameset_duplicate"; cx_list_iterator first, last; cpl_frameset *self = NULL; if (other == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } self = cpl_frameset_new(); first = cx_list_begin(other->history); last = cx_list_end(other->history); while (first != last) { cx_multimap_iterator position = cx_list_get(other->history, first); cpl_frame *frame = cx_multimap_get_value(other->frames, position); cpl_frame *tmp = cpl_frame_duplicate(frame); cxptr key = (cxptr)cpl_frame_get_tag(tmp); position = cx_multimap_insert(self->frames, key, tmp); cx_list_push_back(self->history, position); first = cx_list_next(other->history, first); } _cpl_frameset_cache_reset(self, ALL); return self; } /** * @brief * Destroy a frame set. * * @param self The frame set to destroy. * * @return Nothing. * * The function destroys the frame set @em self and its whole contents. * If @em self is @c NULL, nothing is done and no error is set. */ void cpl_frameset_delete(cpl_frameset *self) { if (self) { cx_multimap_delete(self->frames); cx_list_delete(self->history); cx_free(self); } return; } /** * @brief * Get the current size of a frame set. * * @param self A frame set. * * @return * The frame set's current size, or 0 if it is empty. The function * returns 0 if an error occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The reports the current number of frames stored in the frame set * @em self. */ cpl_size cpl_frameset_get_size(const cpl_frameset *self) { const cxchar *const _id = "cpl_frameset_get_size"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return 0; } return cx_multimap_size(self->frames); } /** * @brief * Check whether a frame set is empty. * * @param self A frame set. * * @return * The function returns 1 if the set is empty, and 0 otherwise. If an * error occurs 0 is returned and an appropriate error code is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function checks if @em self contains any frames. */ int cpl_frameset_is_empty(const cpl_frameset *self) { const cxchar *const _id = "cpl_frameset_is_empty"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return 0; } return cx_multimap_empty(self->frames); } /** * @brief * Counts the frames stored in a frame set having the given tag. * * @param self A frame set. * @param tag The frame tag. * * @return * The number of frames with tag @em tag. The function returns 0 if an * error occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or tag is a NULL * pointer. *
* @enderror * * The function scans the frame set @em self for frames with the tag @em tag * and returns the number of frames found. */ int cpl_frameset_count_tags(const cpl_frameset *self, const char *tag) { const cxchar *const _id = "cpl_frameset_count_tags"; if (self == NULL || tag == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return 0; } return cx_multimap_count(self->frames, tag); } /** * @brief * Find a frame with the given tag in a frame set. * * @param self A frame set. * @param tag The frame tag to search for. * * @return * The handle for a frame with tag @em tag, or @c NULL if no * such frame was found. The function returns @c NULL if an error * occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or tag is a NULL * pointer. *
* @enderror * * The function searches the frame set @em self for the frames with the * tag @em tag. If such a frame is present, a handle for it is returned. * If the set contains several frames with the tag @em tag the first * one is returned. The remaining frames with this tag can be accessed * sequentially by using @c NULL as tag when calling this function * repeatedly, since the most recent frame accessed is cached. This * cache is reset whenever the provided tag is not @c NULL. If no frame * with the tag @em tag is present in @em self or no more frames with * this tag are found the function returns @c NULL. */ const cpl_frame * cpl_frameset_find_const(const cpl_frameset *self, const char *tag) { const cxchar *const _id = "cpl_frameset_find_const"; cx_multimap_iterator pos; cx_multimap_iterator cached; cpl_frame *frame; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } if (tag) { /* * Find the first frame with this tag in the set. Make sure that * we really found something. */ pos = cx_multimap_lower_bound(self->frames, tag); if (pos == cx_multimap_upper_bound(self->frames, tag)) { /* Will modify internals of self! */ _cpl_frameset_cache_reset(self, TAG); return NULL; } } else { cxptr last_tag; /* * Check that the cache is not empty. */ if (_cpl_frameset_cache_empty(self, TAG)) { return NULL; } cached = _cpl_frameset_cache_get(self, TAG); /* * Get the successor of the cached entry. */ last_tag = cx_multimap_get_key(self->frames, cached); pos = cx_multimap_next(self->frames, cached); if (pos == cx_multimap_upper_bound(self->frames, last_tag)) { return NULL; } } /* Will modify internals of self! */ _cpl_frameset_cache_push(self, TAG, pos); frame = cx_multimap_get_value(self->frames, pos); return frame; } /** * @brief * Find a frame with the given tag in a frame set. * * @param self A frame set. * @param tag The frame tag to search for. * * @return * The handle for a frame with tag @em tag, or @c NULL if no * such frame was found. The function returns @c NULL if an error * occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or tag is a NULL * pointer. *
* @enderror * * The function searches the frame set @em self for the frames with the * tag @em tag. If such a frame is present, a handle for it is returned. * If the set contains several frames with the tag @em tag the first * one is returned. The remaining frames with this tag can be accessed * sequentially by using @c NULL as tag when calling this function * repeatedly, since the most recent frame accessed is cached. This * cache is reset whenever the provided tag is not @c NULL. If no frame * with the tag @em tag is present in @em self or no more frames with * this tag are found the function returns @c NULL. */ cpl_frame * cpl_frameset_find(cpl_frameset *self, const char *tag) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_frame *frame = (cpl_frame *)cpl_frameset_find_const(self, tag); if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func); return frame; } /** * @brief * Get the first frame in the given set. * * @param self A frame set. * * @return * A handle for the first frame in the set, or @c NULL if the set * is empty. The function returns @c NULL if an error occurs and * sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the first frame in the frame set @em self if it * exists. If a first frame does not exist, i.e. the frame set is empty, * @c NULL is returned. The function also updates the internal cache. * * @see cpl_frameset_get_next_const() * * @deprecated * This function will be removed from CPL version 7. Code using these * functions should be ported to make use of frame set iterators instead! */ const cpl_frame * cpl_frameset_get_first_const(const cpl_frameset *self) { const cxchar *const _id = "cpl_frameset_get_first_const"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } return (const cpl_frame *)_cpl_frameset_get_first(self); } /** * @brief * Get the first frame in the given set. * * @param self A frame set. * * @return * A handle for the first frame in the set, or @c NULL if the set * is empty. The function returns @c NULL if an error occurs and * sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the first frame in the frame set @em self if it * exists. If a first frame does not exist, i.e. the frame set is empty, * @c NULL is returned. The function also updates the internal cache. * * @see cpl_frameset_get_next() * * @deprecated * This function will be removed from CPL version 7. Code using these * functions should be ported to make use of frame set iterators instead! */ cpl_frame * cpl_frameset_get_first(cpl_frameset *self) { const cxchar *const _id = "cpl_frameset_get_first"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } return _cpl_frameset_get_first(self); } /** * @brief * Get the next frame in the given set. * * @param self A frame set. * * @return * A handle for the next frame in a set. If there are no more * frames in the set the function returns @c NULL. The function returns * @c NULL if an error occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the next frame in the frame set @em self if it * exists and otherwise @c NULL. The function uses the internal cache * to determine the most recently accessed frame. This means that the * function only works as expected if @em self has been initialised by * a call to @b cpl_frameset_get_first_const(), and if no function updating the * internal cache was called between two subsequent calls to this * function. * * @see cpl_frameset_get_first_const() * * @deprecated * This function will be removed from CPL version 7. Code using these * functions should be ported to make use of frame set iterators instead! */ const cpl_frame * cpl_frameset_get_next_const(const cpl_frameset *self) { const cxchar *const _id = "cpl_frameset_get_next_const"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } return (const cpl_frame *)_cpl_frameset_get_next(self); } /** * @brief * Get the next frame in the given set. * * @param self A frame set. * * @return * A handle for the next frame in a set. If there are no more * frames in the set the function returns @c NULL. The function returns * @c NULL if an error occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the next frame in the frame set @em self if it * exists and otherwise @c NULL. The function uses the internal cache * to determine the most recently accessed frame. This means that the * function only works as expected if @em self has been initialised by * a call to @b cpl_frameset_get_first(), and if no function updating the * internal cache was called between two subsequent calls to this * function. * * @see cpl_frameset_get_first() * * @deprecated * This function will be removed from CPL version 7. Code using these * functions should be ported to make use of frame set iterators instead! */ cpl_frame * cpl_frameset_get_next(cpl_frameset *self) { const cxchar *const _id = "cpl_frameset_get_next"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } return _cpl_frameset_get_next(self); } /** * @brief * Insert a frame into the given frame set. * * @param self A frame set. * @param frame The frame to insert. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or frame is a NULL * pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter frame has an invalid tag. *
* @enderror * * The function adds the frame @em frame to the frame set @em self using the * frame's tag as key. * * The insertion of a frame into a frameset transfers the ownership of the * frame @em frame to the frameset @em self. This means that the frame must * not be deallocated through the pointer @em frame. * * In addition, the frame pointer returned by any member function call * returning a handle to a frameset's member frame, must not be used to * insert the returned frame into another framset without prior duplication * of this frame, and, it must not be used to modify the frames tag without * removing it from the frameset first and re-inserting it with the new * tag afterwards. */ cpl_error_code cpl_frameset_insert(cpl_frameset *self, cpl_frame *frame) { const cxchar *const _id = "cpl_frameset_insert"; const cxchar *tag = NULL; cx_multimap_iterator position; if (self == NULL || frame == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } tag = cpl_frame_get_tag(frame); if (tag == NULL) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return CPL_ERROR_ILLEGAL_INPUT; } position = cx_multimap_insert(self->frames, tag, frame); cx_list_remove(self->history, position); cx_list_push_back(self->history, position); return CPL_ERROR_NONE; } /** * @brief * Erase all frames with the given tag from a frame set. * * @param self A frame set. * @param tag The tag used to locate the frames to remove. * * @return * The function returns the number of frames removed. If an error occurs * 0 is returned and an appropriate error code is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or tag is a NULL * pointer. *
* @enderror * * The function searches the frame set @em self for frames having the * tag @em tag and removes them from the set. The removed frames are * destroyed. If no frame with the tag @em tag is found the function * has no effect. */ cpl_size cpl_frameset_erase(cpl_frameset *self, const char *tag) { const cxchar *const _id = "cpl_frameset_erase"; cxsize count = 0; cx_multimap_iterator first; cx_multimap_iterator last; cx_multimap_iterator position; if (self == NULL || tag == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return count; } cx_multimap_equal_range(self->frames, tag, &first, &last); position = first; while (position != last) { cx_assert(strcmp(cx_multimap_get_key(self->frames, position), tag) == 0); if (_cpl_frameset_cache_get(self, TAG) == position) { cx_multimap_iterator p; p = cx_multimap_previous(self->frames, position); if (p == cx_multimap_end(self->frames)) { p = cx_multimap_begin(self->frames); } _cpl_frameset_cache_push(self, TAG, p); } if (_cpl_frameset_cache_get(self, POS) == position) { cx_list_iterator p = cx_list_begin(self->history); while (cx_list_get(self->history, p) != position && p != cx_list_end(self->history)) { p = cx_list_next(self->history, p); } cx_assert(p != cx_list_end(self->history)); p = cx_list_previous(self->history, p); if (p == cx_list_end(self->history)) { p = cx_list_begin(self->history); } _cpl_frameset_cache_push(self, POS, cx_list_get(self->history, p)); } ++count; cx_list_remove(self->history, position); position = cx_multimap_next(self->frames, position); } cx_multimap_erase_range(self->frames, first, last); return count; } /** * @brief * Erase the given frame from a frame set. * * @param self A frame set. * @param frame The frame to remove. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or frame is a NULL * pointer. *
* @enderror * * The function searches the frame set @em self for the first occurrance * of @em frame. If it is present, the frame is removed from the set and * destroyed. If frame is not present in @em self the function has no * effect. */ cpl_error_code cpl_frameset_erase_frame(cpl_frameset *self, cpl_frame *frame) { const cxchar *const _id = "cpl_frameset_erase_frame"; cx_multimap_iterator first, last; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } if (!frame) { return CPL_ERROR_NONE; } first = cx_multimap_lower_bound(self->frames, cpl_frame_get_tag(frame)); last = cx_multimap_upper_bound(self->frames, cpl_frame_get_tag(frame)); while (first != last) { if (cx_multimap_get_value(self->frames, first) == frame) { if (_cpl_frameset_cache_get(self, TAG) == first) { cx_multimap_iterator p; p = cx_multimap_previous(self->frames, first); if (p == cx_multimap_end(self->frames)) { p = cx_multimap_begin(self->frames); } _cpl_frameset_cache_push(self, TAG, p); } if (_cpl_frameset_cache_get(self, POS) == first) { cx_list_iterator p = cx_list_begin(self->history); while (cx_list_get(self->history, p) != first && p != cx_list_end(self->history)) { p = cx_list_next(self->history, p); } cx_assert(p != cx_list_end(self->history)); p = cx_list_previous(self->history, p); if (p == cx_list_end(self->history)) { p = cx_list_begin(self->history); } _cpl_frameset_cache_push(self, POS, cx_list_get(self->history, p)); } cx_multimap_erase_position(self->frames, first); cx_list_remove(self->history, first); break; } first = cx_multimap_next(self->frames, first); } return CPL_ERROR_NONE; } /** * @brief * Join two frame sets. * * @param self The target frame set * @param other The source frame set * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or frame is a NULL * pointer. *
* @enderror * * The function adds the contents of the frame set @em other to @em self by * inserting copies of the elements of the frame set @em other. If the source * frame set @em other is @c NULL, or if it is empty, the function has no * effect. */ cpl_error_code cpl_frameset_join(cpl_frameset *self, const cpl_frameset *other) { const cxchar *const _id = "cpl_frameset_join"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } if ((other != NULL) && (cpl_frameset_is_empty(other) != 1)) { cx_multimap_iterator position = cx_multimap_begin(other->frames); cpl_error_code status = CPL_ERROR_NONE; while (position != cx_multimap_end(other->frames)) { cpl_frame *frame = cx_multimap_get_value(other->frames, position); frame = cpl_frame_duplicate(frame); /* * Use high level insertion here, so that insertion order tracking * is handled implicitly */ status = cpl_frameset_insert(self, frame); if (status != CPL_ERROR_NONE) { cpl_frame_delete(frame); cpl_error_set(_id, status); return status; } position = cx_multimap_next(other->frames, position); } } return CPL_ERROR_NONE; } /** * @brief * Sort a frame set. * * @param self The frame set to sort. * @param compare Comparison function for frames. * * @return * The function returns @c CPL_ERROR_NONE on success, or an appropriate * CPL error code otherwise. * * @error * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or compare is a NULL * pointer. *
* @enderror * * The function replaces the existing order of the frame set @em self by * sorting its contents according to the comparison function @em compare. * * By default, the order of a frame set, i.e. the order of any newly created * frame set object, is defined by the order in which frames are inserted into * the frame set. By calling this function, this order will be lost. If this * order has to be preserved, sorting has to be done on a copy of @em self. * * The function @em compare compares two frames and must return -1, 0, or * 1 if the first frame is considered to be less than, equal or larger than * the second frame, respectively. * * @see cpl_frame_compare_func */ cpl_error_code cpl_frameset_sort(cpl_frameset *self, cpl_frame_compare_func compare) { const cxchar *const _id = "cpl_frameset_sort"; if ((self == NULL) || (compare == NULL)) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } return _cpl_frameset_history_sort(self->history, self->frames, compare); } /** * @brief * Separate a list of frames into groups, using a comparison function * * @param self Input frame set * @param compare Pointer to comparison function to use. * @param nb_labels Number of different sets or undefined on error * * @return * array of labels defining the selection or NULL on error * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, compare or nb_labels * is a NULL pointer. *
* @enderror * * This function takes a set of frames and groups the frames that are * 'identical' together. The user provided comparison function defines what * being identical means for two frames. A label (non-negative int) is associated * to each group of identical frames, these labels are returned in an array of * length equal to the size of the frameset. * * The comparison function should be commutative, must take two frames and * return 1 if they are identical, 0 if they are different, and -1 on error. * * The number of calls to the comparison functions is O(n*m), where n is the * number of frames in the set, and m is the number of different labels found * in the set. In the worst case m equals n, and the call requires n(n-1)/2 * calls to the comparison function. If all identical frames appear together * in the list, the number of required calls is only n + O(m^2). * * The returned array must be deallocated with cpl_free(). */ cpl_size * cpl_frameset_labelise(const cpl_frameset *self, int (*compare)(const cpl_frame*, const cpl_frame*), cpl_size *nb_labels) { cpl_size *labels; cpl_size *labelsinv; cpl_size nframes; cpl_size i = 0; cpl_size j = 0; cpl_size nlabels = 0; cpl_size ncomp = 0; const cpl_frame ** framelist; const cpl_frame * frame1; cpl_frameset_iterator *it = NULL; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(compare != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(nb_labels != NULL, CPL_ERROR_NULL_INPUT, NULL); nframes = cpl_frameset_get_size(self); cpl_ensure(nframes >= 1, CPL_ERROR_ILLEGAL_INPUT, NULL); labels = cx_malloc(nframes * sizeof(cpl_size)); labelsinv = cx_malloc(nframes * sizeof(cpl_size)); framelist = cx_malloc(nframes * sizeof(const cpl_frame *)); it = cpl_frameset_iterator_new(self); while ((frame1 = cpl_frameset_iterator_get(it)) != NULL) { cpl_errorstate status; cpl_size jj; for (jj = 0; jj < nlabels; jj++, j = (j == nlabels - 1) ? 0 : j + 1) { const cpl_frame *frame2 = framelist[j]; /* * Compare the frames i and j * - frame i is first compared to the frame which matched the * previous comparison. In this way only one comparison is * needed for frames tagged as the previous one */ const int comp = (*compare)(frame1, frame2); ncomp++; if (comp == 1) { /* Identical */ break; } else if (comp != 0) { /* Error */ cpl_frameset_iterator_delete(it); cx_free(framelist); cx_free(labelsinv); cx_free(labels); /* Propagate error */ (void)cpl_error_set_where_(); return NULL; } } if (jj == nlabels) { /* Labelise the newly found type of frame */ framelist[nlabels] = frame1; labelsinv[nlabels] = i; labels[i] = nlabels++; } else { /* Identical */ labels[i] = labels[labelsinv[j]]; } status = cpl_errorstate_get(); cpl_frameset_iterator_advance(it, 1); if (cpl_error_get_code() == CPL_ERROR_ACCESS_OUT_OF_RANGE) { cpl_errorstate_set(status); } ++i; } cpl_frameset_iterator_delete(it); *nb_labels = nlabels; cx_free(framelist); cx_free(labelsinv); cpl_msg_debug(cpl_func, "%" CPL_SIZE_FORMAT " frames labelized with %" CPL_SIZE_FORMAT " labels after %" CPL_SIZE_FORMAT "comparisons", nframes, nlabels, ncomp); return labels; } /** * @brief * Get a frame from a frame set. * * @param set Input frame set. * @param position The requested frame. * * @return * The function returns a handle to the frame at position @em position in * the set, or @c NULL in case an error occurs. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter position is out of range. *
* @enderror * * The function returns a handle to the frame at the index @em position in * the set. The frame position ranges from @c 0 to one less than the size of * the frame set. * * The returned frame is still owned by the frame set @em set, i.e. the * obtained frame must not be deleted through the returned handle and also * its tag must not be modified. * * As an alternative to using this function, the functions * cpl_frameset_get_first_const() and cpl_frameset_get_next_const() should be * considered, if performance is an issue. * * @see * cpl_frameset_get_size(), cpl_frameset_get_first_const(), * cpl_frameset_get_next_const() * * @deprecated * This function will be removed from CPL version 7. Code using these * functions should use cpl_frameset_get_position_const() instead! */ const cpl_frame * cpl_frameset_get_frame_const(const cpl_frameset *set, cpl_size position) { const cxchar *const _id = "cpl_frameset_get_frame_const"; if (set == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } if ((position < 0) || (position >= cpl_frameset_get_size(set))) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return NULL; } return cpl_frameset_get_position_const(set, position); } /** * @brief * Get a frame from a frame set. * * @param set Input frame set. * @param position The requested frame. * * @return * The function returns a handle to the frame at position @em position in * the set, or @c NULL in case an error occurs. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter position is out of range. *
* @enderror * * The function returns a handle to the frame at the index @em position in * the set. The frame position ranges from @c 0 to one less than the size of * the frame set. * * The returned frame is still owned by the frame set @em set, i.e. the * obtained frame must not be deleted through the returned handle and also * its tag must not be modified. * * As an alternative to using this function, the functions * cpl_frameset_get_first() and cpl_frameset_get_next() should be considered, * if performance is an issue. * * @see * cpl_frameset_get_size(), cpl_frameset_get_first(), * cpl_frameset_get_next() * * @deprecated * This function will be removed from CPL version 7. Code using these * functions should use cpl_frameset_get_position() instead! * */ cpl_frame * cpl_frameset_get_frame(cpl_frameset *set, cpl_size position) { const cxchar *const _id = "cpl_frameset_get_frame"; if (set == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } if ((position < 0) || (position >= cpl_frameset_get_size(set))) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return NULL; } return cpl_frameset_get_position(set, position); } /** * @brief * Get the frame at a given position in the frame set. * * @param self The frame set * @param position Frame position. * * @return * The function returns the frame at the given position, or @c NULL * if an error occurs. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter position is invalid, i.e. the given value is * outside of its domain. *
* @enderror * * The function retrieves the frame stored in the frame set @em self at the * index position @em position. The index positions are counted from zero, * and reach up to one less than the number of frames in the frame set. */ cpl_frame * cpl_frameset_get_position(cpl_frameset *self, cpl_size position) { const cxchar *const _id = "cpl_frameset_get_position"; cx_list_iterator _position = NULL; cx_multimap_iterator frame = NULL; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } if ((position < 0) || (position >= cpl_frameset_get_size(self))) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return NULL; } // FIXME: Should use iterators for that! _position = cx_list_begin(self->history); while (position > 0) { _position = cx_list_next(self->history, _position); --position; } frame = cx_list_get(self->history, _position); cx_assert(frame != cx_multimap_end(self->frames)); return cx_multimap_get_value(self->frames, frame); } /** * @brief * Get the frame at a given iterator position. * * @param self The iterator to dereference * @param position Iterator offset from the beginning of the frame set. * * @return * The function returns the frame at the iterator position, or @c NULL * if an error occurs. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter position is invalid, i.e. the given value is * outside of its domain. *
* @enderror * * The function retrieves the frame stored in the frame set @em self at the * index position @em position. The index positions are counted from zero, * and reach up to one less than the number of frames in the frame set. */ const cpl_frame * cpl_frameset_get_position_const(const cpl_frameset *self, cpl_size position) { const cxchar *const _id = "cpl_frameset_get_position_const"; cx_list_iterator _position = NULL; cx_multimap_iterator frame = NULL; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } if ((position < 0) || (position >= cpl_frameset_get_size(self))) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return NULL; } // FIXME: Should use iterators for that! _position = cx_list_begin(self->history); while (position > 0) { _position = cx_list_next(self->history, _position); --position; } frame = cx_list_get(self->history, _position); cx_assert(frame != cx_multimap_end(self->frames)); return cx_multimap_get_value(self->frames, frame); } /** * @brief * Extract a subset of frames from a set of frames * * @param self Input frame set * @param labels The array of labels associated to each input frame * @param desired_label The label identifying the requested frames * * @note The array of labels must have (at least) the length of the frame set * * @return * A pointer to a newly allocated frame set or NULL on error * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or labels is a NULL * pointer. *
* @enderror * * The returned object must be deallocated with cpl_frameset_delete() */ cpl_frameset * cpl_frameset_extract(const cpl_frameset *self, const cpl_size *labels, cpl_size desired_label) { cpl_frameset *selected = NULL; const cpl_frame *frame; cpl_size i = 0; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(labels != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_frameset_iterator *it = cpl_frameset_iterator_new(self); while ((frame = cpl_frameset_iterator_get_const(it))) { if (labels[i] == desired_label) { /* * Duplicate frame and insert it in the selected object */ cpl_frame *_frame = cpl_frame_duplicate(frame); if (selected == NULL) { selected = cpl_frameset_new(); } cpl_frameset_insert(selected, _frame); } cpl_errorstate status = cpl_errorstate_get(); cpl_frameset_iterator_advance(it, 1); if (cpl_error_get_code() == CPL_ERROR_ACCESS_OUT_OF_RANGE) { cpl_errorstate_set(status); } ++i; } cpl_frameset_iterator_delete(it); return selected; } /** * @brief * Dump the frameset debugging information to the given stream. * * @param self The frameset. * @param stream The output stream to use. * * @return Nothing. * * The function dumps the contents of the frameset @em self to the * output stream @em stream. If @em stream is @c NULL the function writes * to the standard output. If @em self is @c NULL or the frameset is * empty, the function does nothing. */ void cpl_frameset_dump(const cpl_frameset *self, FILE *stream) { int i = 0; int n = 0; const cpl_frame *frame; if (self == NULL) return; if (stream == NULL) stream = stdout; n = cpl_frameset_get_size(self); if (n == 0) return; fprintf (stream, "+++ Frameset at address: %p\n", (const void *)self); cpl_frameset_iterator *it = cpl_frameset_iterator_new(self); while ((frame = cpl_frameset_iterator_get_const(it))) { fprintf(stream, "%3d ", i++); cpl_frame_dump(frame, stream); cpl_errorstate status = cpl_errorstate_get(); cpl_frameset_iterator_advance(it, 1); if (cpl_error_get_code() == CPL_ERROR_ACCESS_OUT_OF_RANGE) { cpl_errorstate_set(status); } } cpl_frameset_iterator_delete(it); return; } /**@}*/ /** * @defgroup cpl_frameset_iterator Frame Set Iterators * @ingroup cpl_frameset * * @brief * Iterator support for frame sets. * * Frame set iterators allow to access the contents of a frame set sequentially, * in an ordered manner. An iterator is created for a particular frame set, * and it stays bound to that frame set until it is destroyed. However multiple * iterators can be defined for the same frame set. * * By default, the order of frames in a frame set is the order in which the * individual frames have been inserted. However, a particular sorting order * can be defined by sorting the frame set using a custom comparison function * for frames. * * Frame set iterators are supposed to be short-lived objects, and it is not * recommended to use them for keeping, or passing around references to the * frame set contents. In particular, changing the contents of the underlying * frame set by erasing, or inserting frames may invalidate all existing * iterators. */ /**@{*/ /* * Frame set iterator type */ struct _cpl_frameset_iterator_ { const cpl_frameset *parent; cx_list_iterator position; cxint direction; }; /** * @brief * Create a new frame set iterator. * * @param parent The frame set for which the iterator is created. * * @return * The newly allocated frame set iterator object, or @c NULL if an error * occurred. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter parent is a NULL pointer. *
* @enderror * * The function creates a new iterator object bound to the frame set @em * parent. The iterator is initialized such that it points to the beginning * of @em parent. * * The beginning is defined by the current ordering defined for the frame set * @em parent. * * @see cpl_frameset_sort() */ cpl_frameset_iterator * cpl_frameset_iterator_new(const cpl_frameset *parent) { const cxchar *const _id = "cpl_frameset_iterator_new"; cpl_frameset_iterator *self = NULL; if (parent == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } self = cx_malloc(sizeof *self); self->parent = parent; self->position = cx_list_begin(parent->history); self->direction = 0; return self; } /** * @brief * Create a frame set iterator from an existing frame set iterator. * * @param other The frame set iterator to clone. * * @return * A copy of the frame set iterator @em other on success, or @c NULL * otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter other is a NULL pointer. *
* @enderror * * The function creates a copy of the iterator object @em other. An iterator * copy constructed by this function is bound to the same frame set @em other * has been constructed for, and it points to the same frame that @em other * points to. */ cpl_frameset_iterator * cpl_frameset_iterator_duplicate(const cpl_frameset_iterator *other) { const cxchar *const _id = "cpl_frameset_iterator_duplicate"; cpl_frameset_iterator *self = NULL; if (other == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } self = cx_malloc(sizeof *self); self->parent = other->parent; self->position = other->position; self->direction = other->direction; return self; } /** * @brief * Destroy a frame set iterator. * * @param self The frame set to destroy. * * @return * Nothing. * * The function destroys the frame set iterator object @em self. If @em self * is @c NULL, no operation is performed. */ void cpl_frameset_iterator_delete(cpl_frameset_iterator *self) { cx_free(self); return; } /** * @brief * Assign a frame set iterator to another. * * @param self The frame set iterator to assign to. * @param other The frame set iterator to be assigned. * * @return * The function returns @c CPL_ERROR_NONE on success, or an appropriate * CPL error code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameters self or other is a NULL * pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameters self and other are not bound to the * same frame set. *
* @enderror * * The function assigns the iterator @em other to the iterator @em self. * Only iterators which are bound to the same frame set can be assigned to * each other! */ cpl_error_code cpl_frameset_iterator_assign(cpl_frameset_iterator *self, const cpl_frameset_iterator *other) { const cxchar *const _id = "cpl_frameset_iterator_assign"; if ((self == NULL) || (other == NULL)) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } if (self->parent != other->parent) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return CPL_ERROR_ILLEGAL_INPUT; } self->position = other->position; self->direction = other->direction; return CPL_ERROR_NONE; } /** * @brief * Reset a frame set iterator to the beginning of a frame set. * * @param self The iterator to reposition. * * @return * Nothing. * * The function moves the frame set iterator @em self back to the beginning * of its underlying frame set. The first frame in the frame set is defined by * the established sorting order. * * @see cpl_frameset_sort() */ void cpl_frameset_iterator_reset(cpl_frameset_iterator *self) { if (self != NULL) { self->position = cx_list_begin(self->parent->history); self->direction = 0; } return; } /** * @brief * Advance an iterator by a number of elements. * * @param self The frame set iterator to reposition. * @param distance The of number of elements by which the iterator is moved. * * @return * The function returns @c CPL_ERROR_NONE on success, or an appropriate * CPL error code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The given iterator offset would move the iterator beyond the * beginning or the end of the frame set. *
* @enderror * * The functions moves the iterator by @em distance number of elements, with * respect to its current position. The number of elements @em distance may * be negative or positive, and the iterator position will move backward and * forward respectively. * * It is an error if the given @em distance would move the iterator either * past the one-before-the-beginning position or the one-past-the-end position * of the underlying frame set. In this case the iterator is not repositioned * and an out of range error is returned. */ cpl_error_code cpl_frameset_iterator_advance(cpl_frameset_iterator *self, int distance) { const cxchar *const _id = "cpl_frameset_iterator_advance"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } else { cxint _distance = distance; cx_list_iterator position = self->position; if (_distance < 0) { if (self->direction == -1) { position = cx_list_previous(self->parent->history, position); ++_distance; } while ((_distance != 0) && (position != cx_list_end(self->parent->history))) { position = cx_list_previous(self->parent->history, position); ++_distance; } } else { if (self->direction == 1) { position = cx_list_begin(self->parent->history); --_distance; } while ((_distance != 0) && (position != cx_list_end(self->parent->history))) { position = cx_list_next(self->parent->history, position); --_distance; } } if (_distance != 0) { cpl_error_set(_id, CPL_ERROR_ACCESS_OUT_OF_RANGE); return CPL_ERROR_ACCESS_OUT_OF_RANGE; } else { if (position == cx_list_end(self->parent->history)) { self->direction = (distance < 0) ? 1 : -1; } else { self->direction = 0; } self->position = position; } } return CPL_ERROR_NONE; } /** * @brief * Calculate the distance between two iterators * * @param self First frame set iterator. * @param other Second frame set iterator. * * @return * The function returns the distance between the two input iterators. If an * error occurs, the function returns a distance of 0 and sets an * appropriate error code. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or other is a NULL * pointer. *
CPL_ERROR_ILLEGAL_INPUT * The two iterators iterators are not bound to the same frame set. *
CPL_ERROR_DATA_NOT_FOUND * At least one input iterator is invalid. *
* @enderror * * The function calculates the distance between the iterators @em self and * @em other. * * To properly detect whether this function has failed or not it is * recommended to reset the errors before it is called, since the returned * value is not a distinctive feature. */ int cpl_frameset_iterator_distance(const cpl_frameset_iterator *self, const cpl_frameset_iterator *other) { const cxchar *const _id = "cpl_frameset_iterator_distance"; int invalid = 0; if ((self == NULL) || (other == NULL)) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return invalid; } if (self->parent != other->parent) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return invalid; } /* * Nothing to be done if the iterator positions match already ... */ if (self->position != other->position) { /* * ... otherwise try forward direction first ... */ int distance = 0; cx_list_iterator position = self->position; while (position != cx_list_end(self->parent->history)) { if (position == other->position) { return distance; } ++distance; position = cx_list_next(self->parent->history, position); } /* * ... and finally the backward direction */ distance = 0; position = self->position; while (position != cx_list_end(self->parent->history)) { if (position == other->position) { return distance; } --distance; position = cx_list_previous(self->parent->history, position); } /* * Nothing was found in any direction. This should not happen! */ cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return invalid; } return 0; } /** * @brief * Get the frame from the frame set at the current position of the iterator. * * @param self The frame set iterator to dereference. * * @return * The frame stored in the frame set at the position of the iterator, or * @c NULL if an error occurs. The function also returns @cNULL if the * iterator is positioned at the sentinel element (i.e. the * one-before-the-beginning or one-past-the-end position). * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function dereferences the iterator @em self, i.e. it retrieves the frame * at the position pointed to by @em self. */ cpl_frame * cpl_frameset_iterator_get(cpl_frameset_iterator *self) { const cxchar *const _id = "cpl_frameset_iterator_get"; cx_multimap_iterator position = NULL; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } if (self->position == cx_list_end(self->parent->history)) { return NULL; } position = cx_list_get(self->parent->history, self->position); cx_assert(position != cx_multimap_end(self->parent->frames)); return cx_multimap_get_value(self->parent->frames, position); } /** * @brief * Get the frame from the frame set at the current position of the iterator. * * @param self The frame set iterator to dereference. * * @return * The frame stored in the frame set at the position of the iterator, or * @c NULL if an error occurs. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function dereferences the iterator @em self, i.e. it retrieves the frame * at the position pointed to by @em self. */ const cpl_frame * cpl_frameset_iterator_get_const(const cpl_frameset_iterator *self) { const cxchar *const _id = "cpl_frameset_iterator_get_const"; cx_multimap_iterator position = NULL; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } if (self->position == cx_list_end(self->parent->history)) { return NULL; } position = cx_list_get(self->parent->history, self->position); cx_assert(position != cx_multimap_end(self->parent->frames)); return cx_multimap_get_value(self->parent->frames, position); } /**@}*/ cpl-6.4.1/cplui/cpl_parameter.h0000644000460300003120000001620212106171221013307 00000000000000/* $Id: cpl_parameter.h,v 1.16 2013-02-11 13:30:57 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-02-11 13:30:57 $ * $Revision: 1.16 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_PARAMETER_H #define CPL_PARAMETER_H #include #include #include CPL_BEGIN_DECLS /** * @ingroup cpl_parameter * * @brief * Supported parameter modes. * * The parameter mode is used to set or get context specific parameter * attributes. */ enum _cpl_parameter_mode_ { /** * Command line mode of the parameter. * @hideinitializer */ CPL_PARAMETER_MODE_CLI = 1 << 0, /** * Environment variable mode of the parameter. * @hideinitializer */ CPL_PARAMETER_MODE_ENV = 1 << 1, /** * Configuration file mode of the parameter. * @hideinitializer */ CPL_PARAMETER_MODE_CFG = 1 << 2 }; /** * @ingroup cpl_parameter * * @brief * The parameter mode data type. */ typedef enum _cpl_parameter_mode_ cpl_parameter_mode; /** * @ingroup cpl_parameter * * @brief * Supported parameter classes. */ enum _cpl_parameter_class_ { /** * Parameter of undefined or invalid class. * @hideinitializer */ CPL_PARAMETER_CLASS_INVALID = 1 << 0, /** * Parameter representing a plain value. * @hideinitializer */ CPL_PARAMETER_CLASS_VALUE = 1 << 1, /** * Parameter representing a range of values. * @hideinitializer */ CPL_PARAMETER_CLASS_RANGE = 1 << 2, /** * Parameter representing an enumeration value. * @hideinitializer */ CPL_PARAMETER_CLASS_ENUM = 1 << 3 }; /** * @ingroup cpl_parameter * * @brief * The parameter class data type. */ typedef enum _cpl_parameter_class_ cpl_parameter_class; /** * @ingroup cpl_parameter * * @brief * The opaque parameter data type. */ typedef struct _cpl_parameter_ cpl_parameter; /* * Create and destroy operations */ cpl_parameter *cpl_parameter_new_value(const char *name, cpl_type type, const char *description, const char *context, ...) CPL_ATTR_ALLOC; cpl_parameter *cpl_parameter_new_range(const char *name, cpl_type type, const char *description, const char *context, ...) CPL_ATTR_ALLOC; cpl_parameter *cpl_parameter_new_enum(const char *name, cpl_type type, const char *description, const char *context, ...) CPL_ATTR_ALLOC; cpl_parameter *cpl_parameter_duplicate(const cpl_parameter *other) CPL_ATTR_ALLOC; void cpl_parameter_delete(cpl_parameter *self); /* * Non-modifying operations */ cpl_type cpl_parameter_get_type(const cpl_parameter *self); cpl_parameter_class cpl_parameter_get_class(const cpl_parameter *self); int cpl_parameter_is_enabled(const cpl_parameter *self, cpl_parameter_mode mode); /* * Assignment operations */ cpl_error_code cpl_parameter_set_bool(cpl_parameter *self, int value); cpl_error_code cpl_parameter_set_int(cpl_parameter *self, int value); cpl_error_code cpl_parameter_set_double(cpl_parameter *self, double value); cpl_error_code cpl_parameter_set_string(cpl_parameter *self, const char *value); cpl_error_code cpl_parameter_set_default_bool(cpl_parameter *self, int value); cpl_error_code cpl_parameter_set_default_int(cpl_parameter *self, int value); cpl_error_code cpl_parameter_set_default_double(cpl_parameter *self, double value); cpl_error_code cpl_parameter_set_default_string(cpl_parameter *self, const char *value); cpl_error_code cpl_parameter_set_default_flag(cpl_parameter *self, int status); /* * Element access */ const char *cpl_parameter_get_name(const cpl_parameter *self); const char *cpl_parameter_get_context(const cpl_parameter *self); const char *cpl_parameter_get_help(const cpl_parameter *self); int cpl_parameter_get_default_flag(const cpl_parameter *self); int cpl_parameter_get_range_min_int(const cpl_parameter *self); double cpl_parameter_get_range_min_double(const cpl_parameter *self); int cpl_parameter_get_range_max_int(const cpl_parameter *self); double cpl_parameter_get_range_max_double(const cpl_parameter *self); int cpl_parameter_get_enum_size(const cpl_parameter *self); int cpl_parameter_get_enum_int(const cpl_parameter *self, int position); double cpl_parameter_get_enum_double(const cpl_parameter *self, int position); const char *cpl_parameter_get_enum_string(const cpl_parameter *self, int position); int cpl_parameter_get_default_bool(const cpl_parameter *self); int cpl_parameter_get_default_int(const cpl_parameter *self); double cpl_parameter_get_default_double(const cpl_parameter *self); const char *cpl_parameter_get_default_string(const cpl_parameter *self); int cpl_parameter_get_bool(const cpl_parameter *self); int cpl_parameter_get_int(const cpl_parameter *self); double cpl_parameter_get_double(const cpl_parameter *self); const char *cpl_parameter_get_string(const cpl_parameter *self); /* * Miscellaneous */ cpl_error_code cpl_parameter_enable(cpl_parameter *self, cpl_parameter_mode mode); cpl_error_code cpl_parameter_disable(cpl_parameter *self, cpl_parameter_mode mode); int cpl_parameter_get_id(const cpl_parameter *self); cpl_error_code cpl_parameter_set_id(cpl_parameter *self, int id); const char *cpl_parameter_get_tag(const cpl_parameter *self); cpl_error_code cpl_parameter_set_tag(cpl_parameter *self, const char *tag); const char *cpl_parameter_get_alias(const cpl_parameter *self, cpl_parameter_mode mode); cpl_error_code cpl_parameter_set_alias(cpl_parameter *self, cpl_parameter_mode mode, const char *alias); /* * Debugging */ void cpl_parameter_dump(const cpl_parameter *self, FILE *stream); CPL_END_DECLS #endif /* CPL_PARAMETER_H */ cpl-6.4.1/cplui/cpl_parameterlist.c0000644000460300003120000006221412243412221014202 00000000000000/* $Id: cpl_parameterlist.c,v 1.16 2012-12-13 13:54:18 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-12-13 13:54:18 $ * $Revision: 1.16 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include "cpl_parameter.h" #include "cpl_parameterlist.h" #include "cpl_errorstate.h" /** * @defgroup cpl_parameterlist Parameter Lists * * The module implements a parameter list data type, a container for the * cpl_parameter type. It provides a convenient way to pass a set of * parameters, as a whole, to a function. * * It is used in the plugin interface (cf. @ref cpl_plugin), for instance, * to pass the parameters a recipe accepts from the plugin to the calling * application and vice versa. * * All functions expect a valid pointer to a parameter list as input, unless * otherwise specified. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * Parameter list data type representation */ struct _cpl_parameterlist_ { cx_slist *data; cx_slist_iterator search; }; /** * @brief * Create a new parameter list. * * @return * A pointer to the newly created parameter list. * * The function creates a new parameter list object. The created * object must be destroyed using the parameter list destructor * @b cpl_parameterlist_delete(). */ cpl_parameterlist * cpl_parameterlist_new(void) { cpl_parameterlist *list = cx_malloc(sizeof(cpl_parameterlist)); list->data = cx_slist_new(); list->search = cx_slist_begin(list->data); return list; } /** * @brief * Destroy a parameter list. * * @param self The parameter list to destroy. * * @return Nothing. * * The function destroys the parameter list object @em self and all parameters * it possibly contains. The individual parameters are destroyed using * the parameter destructor (cf. @ref cpl_parameter). If @em self is @c NULL, * nothing is done and no error is set. */ void cpl_parameterlist_delete(cpl_parameterlist *self) { if (self) { cx_slist_destroy(self->data, (cx_free_func)cpl_parameter_delete); cx_free(self); } return; } /** * @brief * Get the current size of a parameter list. * * @param self A parameter list * * @return * The parameter list's current size, or 0 if the list is empty. * If an error occurs the function returns 0 and sets an appropriate * error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function reports the current number of elements stored in the * parameter list @em self. */ cpl_size cpl_parameterlist_get_size(const cpl_parameterlist *self) { const cxchar *const _id = "cpl_parameterlist_get_size"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return 0; } return (cpl_size)cx_slist_size(self->data); } /** * @brief * Append a parameter to a parameter list. * * @param self A parameter list. * @param parameter The parameter to append. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The parameter @em parameter is appended to the parameter list @em self. */ cpl_error_code cpl_parameterlist_append(cpl_parameterlist *self, cpl_parameter *parameter) { const cxchar *const _id = "cpl_parameterlist_append"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } cx_slist_push_back(self->data, parameter); return CPL_ERROR_NONE; } /** * @brief * Get the first parameter in the given parameter list. * * @param self A parameter list. * * @return * The function returns a handle for the first parameter in the * list, or @c NULL if the list is empty. If an error occurs the * function returns @c NULL and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the first parameter in the parameter list @em self, * if it exists. If there is no first parameter, i.e. if the list is empty, * @c NULL is returned. The function updates the internal search position * cache. */ const cpl_parameter * cpl_parameterlist_get_first_const(const cpl_parameterlist *self) { const cxchar *const _id = "cpl_parameterlist_get_first_const"; cpl_parameterlist *_self = (cpl_parameterlist *)self; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } _self->search = cx_slist_begin(self->data); if (self->search == cx_slist_end(self->data)) { return NULL; } return cx_slist_get(self->data, self->search); } /** * @brief * Get the first parameter in the given parameter list. * * @param self A parameter list. * * @return * The function returns a handle for the first parameter in the * list, or @c NULL if the list is empty. If an error occurs the * function returns @c NULL and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the first parameter in the parameter list @em self, * if it exists. If there is no first parameter, i.e. if the list is empty, * @c NULL is returned. The function updates the internal search position * cache. */ cpl_parameter * cpl_parameterlist_get_first(cpl_parameterlist *self) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_parameter *par = (cpl_parameter *)cpl_parameterlist_get_first_const(self); if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func); return par; } /** * @brief * Get the next parameter in the given list. * * @param self A parameter list. * * @return * The function returns a handle for the next parameter in the * list, or @c NULL if there are no more parameters in the list. * If an error occurs the function returns @c NULL and sets an * appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the next parameter in the parameter list @em self if * it exists and @c NULL otherwise. The function uses the last cached search * position to determine the most recently accessed parameter. This means * that the function only works as expected if the @em self has been * initialised by a call to @b cpl_parameterlist_get_first_const(), and if no * function updating the internal cache was called between two subsequent calls * to this function. */ const cpl_parameter * cpl_parameterlist_get_next_const(const cpl_parameterlist *self) { const cxchar *const _id = "cpl_parameterlist_get_next_const"; cx_slist_iterator next; cpl_parameterlist *_self = (cpl_parameterlist *)self; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } next = cx_slist_next(self->data, self->search); if (next == cx_slist_end(self->data)) { _self->search = cx_slist_begin(self->data); return NULL; } _self->search = next; return cx_slist_get(self->data, next); } /** * @brief * Get the next parameter in the given list. * * @param self A parameter list. * * @return * The function returns a handle for the next parameter in the * list, or @c NULL if there are no more parameters in the list. * If an error occurs the function returns @c NULL and sets an * appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the next parameter in the parameter list @em self if * it exists and @c NULL otherwise. The function uses the last cached search * position to determine the most recently accessed parameter. This means * that the function only works as expected if the @em self has been * initialised by a call to @b cpl_parameterlist_get_first(), and if no * function updating the internal cache was called between two subsequent calls * to this function. */ cpl_parameter * cpl_parameterlist_get_next(cpl_parameterlist *self) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_parameter *par = (cpl_parameter *)cpl_parameterlist_get_next_const(self); if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func); return par; } /** * @brief * Get the last parameter in the given list. * * @param self A parameter list. * * @return * The function returns a handle for the last parameter in the * list. If an error occurs the function returns @c NULL and sets * an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter self is an empty list. *
* @enderror * * The function returns the last parameter stored in the parameter list * @em self. The list @em self @b must @b not be empty. */ const cpl_parameter * cpl_parameterlist_get_last_const(const cpl_parameterlist *self) { const cxchar *const _id = "cpl_parameterlist_get_last_const"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } if (cx_slist_empty(self->data)) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return NULL; } return cx_slist_back(self->data); } /** * @brief * Get the last parameter in the given list. * * @param self A parameter list. * * @return * The function returns a handle for the last parameter in the * list. If an error occurs the function returns @c NULL and sets * an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter self is an empty list. *
* @enderror * * The function returns the last parameter stored in the parameter list * @em self. The list @em self @b must @b not be empty. */ cpl_parameter * cpl_parameterlist_get_last(cpl_parameterlist *self) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_parameter *par = (cpl_parameter *)cpl_parameterlist_get_last_const(self); if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func); return par; } /** * @brief * Find a parameter with the given name in a parameter list. * * @param self A parameter list. * @param name The parameter name to search for. * * @return * The function returns a handle for the first parameter with the * name @em name, or @c NULL if no such parameter was found. If an * error occurs the function returns @c NULL and sets an appropriate * error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function searches the parameter list @em self for the first occurrence * of a parameter with the fully qualified name @em name. If no parameter * with this name exists, the function returns @c NULL. */ const cpl_parameter * cpl_parameterlist_find_const(const cpl_parameterlist *self, const char *name) { const cxchar *const _id = "cpl_parameterlist_find_const"; cx_slist_iterator first, last; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } first = cx_slist_begin(self->data); last = cx_slist_end(self->data); while (first != last) { cpl_parameter *p = cx_slist_get(self->data, first); if (strcmp(cpl_parameter_get_name(p), name) == 0) { return p; } first = cx_slist_next(self->data, first); } return NULL; } /** * @brief * Find a parameter with the given name in a parameter list. * * @param self A parameter list. * @param name The parameter name to search for. * * @return * The function returns a handle for the first parameter with the * name @em name, or @c NULL if no such parameter was found. If an * error occurs the function returns @c NULL and sets an appropriate * error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function searches the parameter list @em self for the first occurrence * of a parameter with the fully qualified name @em name. If no parameter * with this name exists, the function returns @c NULL. */ cpl_parameter * cpl_parameterlist_find(cpl_parameterlist *self, const char *name) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_parameter *par = (cpl_parameter *)cpl_parameterlist_find_const(self, name); if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func); return par; } /** * @brief * Find a parameter of the given type in a parameter list. * * @param self A parameter list. * @param type The parameter type to search for. * * @return * The function returns a handle for the first parameter with the * type @em type, or @c NULL if no such parameter was found. If an * error occurs the function returns @c NULL and sets an appropriate * error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL * pointer. *
* @enderror * * The function searches the parameter list @em self for the first occurrence * of a parameter whose value is of the type @em type. If no parameter * with this type exists, the function returns @c NULL. */ const cpl_parameter * cpl_parameterlist_find_type_const(const cpl_parameterlist *self, cpl_type type) { const cxchar *const _id = "cpl_parameterlist_find_type_const"; cx_slist_iterator first, last; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } first = cx_slist_begin(self->data); last = cx_slist_end(self->data); while (first != last) { cpl_parameter *p = cx_slist_get(self->data, first); if (cpl_parameter_get_type(p) == type) { return p; } first = cx_slist_next(self->data, first); } return NULL; } /** * @brief * Find a parameter of the given type in a parameter list. * * @param self A parameter list. * @param type The parameter type to search for. * * @return * The function returns a handle for the first parameter with the * type @em type, or @c NULL if no such parameter was found. If an * error occurs the function returns @c NULL and sets an appropriate * error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL * pointer. *
* @enderror * * The function searches the parameter list @em self for the first occurrence * of a parameter whose value is of the type @em type. If no parameter * with this type exists, the function returns @c NULL. */ cpl_parameter * cpl_parameterlist_find_type(cpl_parameterlist *self, cpl_type type) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_parameter *par = (cpl_parameter *)cpl_parameterlist_find_type_const(self, type); if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func); return par; } /** * @brief * Find a parameter which belongs to the given context in a parameter list. * * @param self A parameter list. * @param context The parameter context to search for. * * @return * The function returns a handle for the first parameter with the * context @em context, or @c NULL if no such parameter was found. * If an error occurs the function returns @c NULL and sets an * appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or context is a NULL * pointer. *
* @enderror * * The function searches the parameter list @em self for the first occurrence * of a parameter which belongs to the context @em context. If no parameter * with this type exists, the function returns @c NULL. */ const cpl_parameter * cpl_parameterlist_find_context_const(const cpl_parameterlist *self, const char *context) { const cxchar *const _id = "cpl_parameterlist_find_context_const"; cx_slist_iterator first, last; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } first = cx_slist_begin(self->data); last = cx_slist_end(self->data); while (first != last) { cpl_parameter *p = cx_slist_get(self->data, first); const cxchar *_context = cpl_parameter_get_context(p); if ((context == NULL) && (_context == NULL)) { return p; } else { if (context != NULL && _context != NULL) { if (strcmp(_context, context) == 0) { return p; } } } first = cx_slist_next(self->data, first); } return NULL; } /** * @brief * Find a parameter which belongs to the given context in a parameter list. * * @param self A parameter list. * @param context The parameter context to search for. * * @return * The function returns a handle for the first parameter with the * context @em context, or @c NULL if no such parameter was found. * If an error occurs the function returns @c NULL and sets an * appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or context is a NULL * pointer. *
* @enderror * * The function searches the parameter list @em self for the first occurrence * of a parameter which belongs to the context @em context. If no parameter * with this type exists, the function returns @c NULL. */ cpl_parameter * cpl_parameterlist_find_context(cpl_parameterlist *self, const char *context) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_parameter *par = (cpl_parameter *)cpl_parameterlist_find_context_const(self, context); if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func); return par; } /** * @brief * Find a parameter with the given tag in a parameter list. * * @param self A parameter list. * @param tag The parameter tag to search for. * * @return * The function returns a handle for the first parameter with the * tag @em tag, or @c NULL if no such parameter was found. If an * error occurs the function returns @c NULL and sets an * appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or tag is a NULL * pointer. *
* @enderror * * The function searches the parameter list @em self for the first occurrence * of a parameter with the user tag @em tag. If no parameter with this tag * exists, the function returns @c NULL. */ const cpl_parameter * cpl_parameterlist_find_tag_const(const cpl_parameterlist *self, const char *tag) { const cxchar *const _id = "cpl_parameterlist_find_tag_const"; cx_slist_iterator first, last; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } first = cx_slist_begin(self->data); last = cx_slist_end(self->data); while (first != last) { cpl_parameter *p = cx_slist_get(self->data, first); const cxchar *_tag = cpl_parameter_get_tag(p); if ((tag == NULL) && (_tag == NULL)) { return p; } else { if ((tag != NULL) && (_tag != NULL)) { if (strcmp(_tag, tag) == 0) { return p; } } } first = cx_slist_next(self->data, first); } return NULL; } /** * @brief * Find a parameter with the given tag in a parameter list. * * @param self A parameter list. * @param tag The parameter tag to search for. * * @return * The function returns a handle for the first parameter with the * tag @em tag, or @c NULL if no such parameter was found. If an * error occurs the function returns @c NULL and sets an * appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or tag is a NULL * pointer. *
* @enderror * * The function searches the parameter list @em self for the first occurrence * of a parameter with the user tag @em tag. If no parameter with this tag * exists, the function returns @c NULL. */ cpl_parameter * cpl_parameterlist_find_tag(cpl_parameterlist *self, const char *tag) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_parameter *par = (cpl_parameter *)cpl_parameterlist_find_tag_const(self, tag); if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func); return par; } /** * @brief * Dump the contents of a parameter list to the given stream. * * @param self The parameter list. * @param stream The output stream to use. * * @return Nothing. * * The function dumps the debugging information for each parameter found in * the parameter list @em self to the output stream @em stream. The debugging * information for each individual parameter is dumped using * @b cpl_parameter_dump(). If @em self is @c NULL the function does nothing. * * @see cpl_parameter_dump() */ void cpl_parameterlist_dump(const cpl_parameterlist *self, FILE *stream) { if (self != NULL) { cx_slist_const_iterator pos = cx_slist_begin(self->data); if (stream == NULL) { stream = stdout; } while (pos != cx_slist_end(self->data)) { const cpl_parameter *p = cx_slist_get(self->data, pos); cpl_parameter_dump(p, stream); pos = cx_slist_next(self->data, pos); } } return; } /**@}*/ cpl-6.4.1/cplui/cpl_pluginlist.h0000644000460300003120000000412411466743102013534 00000000000000/* $Id: cpl_pluginlist.h,v 1.8 2010-11-11 10:31:52 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 10:31:52 $ * $Revision: 1.8 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_PLUGINLIST_H #define CPL_PLUGINLIST_H #include #include #include #include CPL_BEGIN_DECLS /** * @ingroup cpl_pluginlist * * @brief * The opaque plugin list data type. */ typedef struct _cpl_pluginlist_ cpl_pluginlist; /* * Create, copy and destroy operations. */ cpl_pluginlist *cpl_pluginlist_new(void) CPL_ATTR_ALLOC; void cpl_pluginlist_delete(cpl_pluginlist *); /* * Accessor Functions */ cpl_error_code cpl_pluginlist_append(cpl_pluginlist *, const cpl_plugin *); cpl_error_code cpl_pluginlist_prepend(cpl_pluginlist *, const cpl_plugin *); cpl_plugin *cpl_pluginlist_get_first(cpl_pluginlist *); cpl_plugin *cpl_pluginlist_get_last(cpl_pluginlist *); cpl_plugin *cpl_pluginlist_get_next(cpl_pluginlist *); /* * Search Functions */ cpl_plugin *cpl_pluginlist_find(cpl_pluginlist *, const char *); /* * Size Functions */ int cpl_pluginlist_get_size(cpl_pluginlist *); /* * Debugging */ void cpl_pluginlist_dump(const cpl_pluginlist *self, FILE *stream); CPL_END_DECLS #endif /* CPL_PLUGINLIST_H */ cpl-6.4.1/cplui/cpl_frameset_io.c0000644000460300003120000003105212254062041013622 00000000000000/* $Id: cpl_frameset_io.c,v 1.34 2012-02-06 14:04:07 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-02-06 14:04:07 $ * $Revision: 1.34 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_frameset_io.h" #include "cpl_frame.h" #include "cpl_frame_impl.h" #include "cpl_imagelist_io.h" #include "cpl_image_io_impl.h" #include "cpl_errorstate.h" #include "cpl_error_impl.h" #include "cpl_io_fits.h" #include #include #include #include #include /** * @defgroup cpl_frameset_io Frame Sets IO functions * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * Private functions */ static cpl_error_code cpl_imagelist_append_from_file(cpl_imagelist *, cpl_size *, const char *, cpl_type, cpl_size, cpl_size); /*----------------------------------------------------------------------------*/ /** @brief Load an imagelist from a frameset @param fset The frames set @param im_type The required image type @param pnum The plane number, 1 for first, 0 for all planes @param xtnum The extension number, 0 for primary, n for nth, -1 for all @return the loaded list of images or NULL on error. @note The returned cpl_imagelist must be deallocated using cpl_imagelist_delete() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if fset is NULL - CPL_ERROR_ILLEGAL_INPUT if pnum is negative, xtnum is lower than -1 or one image cannot be loaded as specified */ /*----------------------------------------------------------------------------*/ cpl_imagelist * cpl_imagelist_load_frameset(const cpl_frameset * fset, cpl_type im_type, cpl_size pnum, cpl_size xtnum) { cpl_imagelist * self; const cpl_frame * cur_frame; cpl_size selfsize; /* Test entries */ cpl_ensure(fset != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(pnum >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(xtnum >= -1, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Create empty output image list */ self = cpl_imagelist_new(); selfsize = 0; cpl_frameset_iterator *it = cpl_frameset_iterator_new(fset); while ((cur_frame = cpl_frameset_iterator_get_const(it)) != NULL) { const char * filename = cpl_frame_get_filename(cur_frame); cpl_errorstate prestate; if (xtnum < 0) { /* Image(s) from all extensions requested. */ int nextensions, ixtnum; const cpl_size presize = selfsize; fitsfile * fptr; int error = 0; prestate = cpl_errorstate_get(); /* Initialize to indicate that they need to be read from the file */ int naxis = 0; CPL_FITSIO_TYPE naxes[3] ={0, 0, 0}; cpl_type pix_type = im_type; /* FIXME: Version 3.2 of fits_open_diskfile() seg-faults on NULL. If fixed in CFITSIO, this check should be removed */ if (filename == NULL) { cpl_frameset_iterator_delete(it); cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } if (cpl_io_fits_open_diskfile(&fptr, filename, READONLY, &error)) { (void)cpl_error_set_fits(CPL_ERROR_ILLEGAL_INPUT, error, fits_open_diskfile, "filename='%s', " "im_type=%u, pnum=%" CPL_SIZE_FORMAT ", xtnum=%" CPL_SIZE_FORMAT, filename, (unsigned)im_type, pnum, xtnum); break; } /* Get the number of extensions (the primary HDU counts as one) */ if (fits_get_num_hdus(fptr, &nextensions, &error)) { (void)cpl_error_set_fits(CPL_ERROR_ILLEGAL_INPUT, error, fits_get_num_hdus, "filename='%s', " "im_type=%u, pnum=%" CPL_SIZE_FORMAT ", xtnum=%" CPL_SIZE_FORMAT, filename, (unsigned)im_type, pnum, xtnum); /* Ensure that the file is closed below */ error = nextensions = 0; } for (ixtnum = 0; ixtnum < nextensions; ixtnum++) { /* If all planes are to be read, start with the first one */ cpl_size iplane = pnum ? pnum - 1 : pnum; /* Load 1 image from the extension. This will set naxis and naxes[] (and optionally the pixel type) for use in subsequent calls */ cpl_image * image = cpl_image_load_(fptr, &naxis, naxes, &pix_type, filename, iplane, ixtnum, CPL_FALSE, 0, 0, 0, 0); if (!cpl_errorstate_is_equal(prestate)) { if (cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND && ixtnum == 0) { /* Main HDU allowed to not have image data */ cpl_errorstate_set(prestate); continue; } break; } if (cpl_imagelist_set(self, image, selfsize)) { cpl_image_delete(image); break; } selfsize++; if (pnum == 0 && naxis == 3) { /* Handle other planes in this extension, if any */ for (iplane = 1; iplane < naxes[2]; iplane++) { image = cpl_image_load_(fptr, &naxis, naxes, &pix_type, filename, iplane, ixtnum, CPL_FALSE, 0, 0, 0, 0); if (image == NULL) break; if (cpl_imagelist_set(self, image, selfsize)) { cpl_image_delete(image); break; } selfsize++; } if (iplane < naxes[2]) break; } } if (cpl_io_fits_close_file(fptr, &error)) { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_close_file, "filename='%s', " "im_type=%u, pnum=%" CPL_SIZE_FORMAT ", xtnum=%" CPL_SIZE_FORMAT, filename, (unsigned)im_type, pnum, xtnum); } if (ixtnum < nextensions || selfsize == presize) break; } else { if (cpl_imagelist_append_from_file(self, &selfsize, filename, im_type, pnum, xtnum)) break; } prestate = cpl_errorstate_get(); cpl_frameset_iterator_advance(it, 1); if (!cpl_errorstate_is_equal(prestate)) { if (cpl_error_get_code() == CPL_ERROR_ACCESS_OUT_OF_RANGE) { cpl_errorstate_set(prestate); } } } if (cur_frame != NULL) { const char * filename = cpl_frame_get_filename(cur_frame); cpl_imagelist_delete(self); (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "file=%s, " "im_type=%u, pnum=%" CPL_SIZE_FORMAT ", xtnum=%" CPL_SIZE_FORMAT, filename ? filename : "", (unsigned)im_type, pnum, xtnum); cpl_frameset_iterator_delete(it); return NULL; } cx_assert(cpl_imagelist_get_size(self) == selfsize); /* Require created imagelist to be non-empty */ if (selfsize == 0) { const char * filename = cpl_frame_get_filename(cur_frame); cpl_imagelist_delete(self); (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "file=%s, " "im_type=%d, pnum=%" CPL_SIZE_FORMAT ", xtnum=%" CPL_SIZE_FORMAT, filename ? filename : "", im_type, pnum, xtnum); cpl_frameset_iterator_delete(it); return NULL; } cpl_frameset_iterator_delete(it); return self; } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Append the specified images to an imagelist from a file @param self The imagelist to append to @param pselfsize Increase with number of images appended @param filename The file to read from @param im_type The required image type @param pnum The plane number, 1 for first, 0 for all planes @param xtnum The extension number, 0 for primary, n for nth, -1 for all @return CPL_ERROR_NONE, or the relevant error code on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if fset is NULL - CPL_ERROR_ILLEGAL_INPUT if pnum is negative, xtnum is lower than -1 or one image cannot be loaded as specified */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_imagelist_append_from_file(cpl_imagelist * self, cpl_size * pselfsize, const char * filename, cpl_type im_type, cpl_size pnum, cpl_size xtnum) { cpl_size selfsize = cpl_imagelist_get_size(self); cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pselfsize != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(filename != NULL, CPL_ERROR_NULL_INPUT); if (pnum == 0) { /* All planes required */ cpl_imagelist * onelist = cpl_imagelist_load(filename, im_type, xtnum); const cpl_size onesize = cpl_imagelist_get_size(onelist); cpl_size j; cpl_ensure_code(onelist != NULL, CPL_ERROR_ILLEGAL_INPUT); /* Move the images from onelist to self */ for (j = 0; j < onesize; j++) { cpl_image * img = cpl_imagelist_unset(onelist, 0); if (cpl_imagelist_set(self, img, selfsize)) { /* Type or size could differ */ cpl_imagelist_delete(onelist); cpl_image_delete(img); return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } selfsize++; } cx_assert(cpl_imagelist_get_size(onelist) == 0); cpl_imagelist_delete(onelist); } else { /* Only one plane required */ cpl_image * img = cpl_image_load(filename, im_type, pnum-1, xtnum); cpl_ensure_code(img != NULL, CPL_ERROR_ILLEGAL_INPUT); if (cpl_imagelist_set(self, img, selfsize)) { /* Type or size could differ */ cpl_image_delete(img); return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } selfsize++; } cx_assert(cpl_imagelist_get_size(self) == selfsize); *pselfsize = selfsize; return CPL_ERROR_NONE; } cpl-6.4.1/cplui/cpl_frame_impl.h0000644000460300003120000000237011703310325013445 00000000000000/* $Id: cpl_frame_impl.h,v 1.3 2012-01-11 13:38:29 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-01-11 13:38:29 $ * $Revision: 1.3 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_FRAME_IMPL_H #define CPL_FRAME_IMPL_H #include "cpl_type.h" #include "cpl_frame.h" CPL_BEGIN_DECLS /* Private functions */ cpl_size cpl_frame_get_nplanes(const cpl_frame *self, cpl_size extnum); CPL_END_DECLS #endif /* CPL_MODULE_H */ cpl-6.4.1/cplui/cpl_parameterlist.h0000644000460300003120000000665311703310325014216 00000000000000/* $Id: cpl_parameterlist.h,v 1.10 2012-01-11 13:38:29 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-01-11 13:38:29 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_PARAMETERLIST_H #define CPL_PARAMETERLIST_H #include #include #include CPL_BEGIN_DECLS /** * @ingroup cpl_parameterlist * * @brief * The opaque parameter list data type. */ typedef struct _cpl_parameterlist_ cpl_parameterlist; /* * Create, copy and destroy operations */ cpl_parameterlist *cpl_parameterlist_new(void) CPL_ATTR_ALLOC; void cpl_parameterlist_delete(cpl_parameterlist *self); /* * Non modifying operations */ cpl_size cpl_parameterlist_get_size(const cpl_parameterlist *self); /* * Element insertion. */ cpl_error_code cpl_parameterlist_append(cpl_parameterlist *self, cpl_parameter *parameter); /* * Element access */ const cpl_parameter *cpl_parameterlist_get_first_const(const cpl_parameterlist *self); cpl_parameter *cpl_parameterlist_get_first(cpl_parameterlist *self); const cpl_parameter *cpl_parameterlist_get_next_const(const cpl_parameterlist *self); cpl_parameter *cpl_parameterlist_get_next(cpl_parameterlist *self); const cpl_parameter *cpl_parameterlist_get_last_const(const cpl_parameterlist *self); cpl_parameter *cpl_parameterlist_get_last(cpl_parameterlist *self); const cpl_parameter *cpl_parameterlist_find_const(const cpl_parameterlist *self, const char *name); cpl_parameter *cpl_parameterlist_find(cpl_parameterlist *self, const char *name); const cpl_parameter *cpl_parameterlist_find_type_const(const cpl_parameterlist *self, cpl_type type); cpl_parameter *cpl_parameterlist_find_type(cpl_parameterlist *self, cpl_type type); const cpl_parameter *cpl_parameterlist_find_context_const(const cpl_parameterlist *self, const char *context); cpl_parameter *cpl_parameterlist_find_context(cpl_parameterlist *self, const char *context); const cpl_parameter *cpl_parameterlist_find_tag_const(const cpl_parameterlist *self, const char *tag); cpl_parameter *cpl_parameterlist_find_tag(cpl_parameterlist *self, const char *tag); /* * Debugging */ void cpl_parameterlist_dump(const cpl_parameterlist *self, FILE *stream); CPL_END_DECLS #endif /* CPL_PARAMETERLIST_H */ cpl-6.4.1/cplui/cpl_pluginlist.c0000644000460300003120000003115511466733006013535 00000000000000/* $Id: cpl_pluginlist.c,v 1.9 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.9 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include "cpl_plugin.h" #include "cpl_pluginlist.h" /** * @defgroup cpl_pluginlist Plugin List * * This module implements a list container for plugin objects and provides * the facilities to query, to traverse and to update the container. The * purpose of this container is to be able to store references to available * plugins and to handle sets of plugins as a whole. * * Since the plugin list just stores pointers to @c cpl_plugin, a plugin * list may contain plugins of different kind at the same time, because * all context specific plugins inherit the @c cpl_plugin type (see * @ref cpl_plugin). * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ struct _cpl_pluginlist_ { cx_list *data; cx_list_iterator search; }; /** * @brief * Creates an empty plugin list. * * @return * The newly created plugin list, or @c NULL if it could not be created. * * The function allocates memory for a plugin list object and initialises it * to be empty. */ cpl_pluginlist * cpl_pluginlist_new(void) { cpl_pluginlist *self; self = cx_malloc(sizeof *self); if (self == NULL) { return NULL; } self->data = cx_list_new(); if (self->data == NULL) { cx_free(self); return NULL; } self->search = NULL; return self; } /** * @brief * Delete a plugin list. * * @param self The plugin list to delete. * * @return Nothing. * * The function deletes the plugin list @em self and destroys all plugins the * list potentially contains. If @em self is @c NULL, nothing is done and no error is set. */ void cpl_pluginlist_delete(cpl_pluginlist *self) { if (self) { if (self->data) { cx_list_destroy(self->data, (cx_free_func)cpl_plugin_delete); self->data = NULL; } self->search = NULL; cx_free(self); self = NULL; } return; } /** * @brief * Get the current size of a plugin list. * * @param self A plugin list. * * @return * The plugin list's current size, or 0 if the list is empty. The function * returns 0 if an error occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function reports the current number of plugins stored in the plugin * list @em self. If @em self does not point to a valid plugin list the * function returns 0. */ int cpl_pluginlist_get_size(cpl_pluginlist *self) { const cxchar *const _id = "cpl_pluginlist_get_size"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return 0; } cx_assert(self->data != NULL); return (int)cx_list_size(self->data); } /** * @brief * Append a plugin to a plugin list. * * @param self A plugin list. * @param plugin The plugin to append. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or plugin is a NULL * pointer. *
* @enderror * * The plugin @em plugin is inserted into the plugin list @em self after the * last element. * * If @em self does not point to a valid plugin list, or if @em plugin is not * a valid pointer the function returns immediately. */ cpl_error_code cpl_pluginlist_append(cpl_pluginlist *self, const cpl_plugin *plugin) { const cxchar *const _id = "cpl_pluginlist_append"; if (self == NULL || plugin == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } cx_list_push_back(self->data, (cxptr)plugin); return CPL_ERROR_NONE; } /** * @brief * Prepend a plugin to a plugin list. * * @param self A plugin list. * @param plugin The plugin to prepend. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or plugin is a NULL * pointer. *
* @enderror * * The plugin @em plugin is inserted into the plugin list @em self before the * first element. * * If @em self does not point to a valid plugin list, or if @em plugin is not * a valid pointer the function returns immediately. */ cpl_error_code cpl_pluginlist_prepend(cpl_pluginlist *self, const cpl_plugin *plugin) { const cxchar *const _id = "cpl_pluginlist_prepend"; if (self == NULL || plugin == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } cx_list_push_front(self->data, (cxptr)plugin); return CPL_ERROR_NONE; } /** * @brief * Get the first plugin of a plugin list. * * @param self A plugin list. * * @return * The first plugin stored in the plugin list @em self, or @c NULL * if the list is empty. The function returns @c NULL if an error * occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns a handle to the first plugin stored in the @em self. */ cpl_plugin * cpl_pluginlist_get_first(cpl_pluginlist *self) { const cxchar *const _id = "cpl_pluginlist_get_first"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } cx_assert(self->data != NULL); self->search = cx_list_begin(self->data); if (self->search == cx_list_end(self->data)) { self->search = NULL; return NULL; } return (cpl_plugin *) cx_list_get(self->data, self->search); } /** * @brief * Get the next plugin from a plugin list. * * @param self A plugin list. * * @return * The function returns the next plugin in the list, or @c NULL if * the end of the list has been reached. The function returns @c NULL * if an error occurs and sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The function was called without initialising the plugin list * self by calling @b cpl_pluginlist_first(). *
* @enderror * * The function returns the next plugin in @em self. To find the next plugin, * the plugin list caches the position of the most recently obtained plugin. * This requires a call to @b cpl_pluginlist_get_first() prior to calling this * function in order to properly initialise the internal cache. * * If the end of @em self has been reached the internal cache is reset to * the first plugin in the list. */ cpl_plugin * cpl_pluginlist_get_next(cpl_pluginlist *self) { const cxchar *const _id = "cpl_pluginlist_get_next"; cx_list_iterator next; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } if (self->search == NULL) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return NULL; } cx_assert(self->data != NULL); next = cx_list_next(self->data, self->search); if (next == cx_list_end(self->data)) { self->search = cx_list_begin(self->data); return NULL; } self->search = next; return (cpl_plugin *) cx_list_get(self->data, self->search); } /** * @brief * Get the last plugin of a plugin list. * * @param self A plugin list. * * @return The last plugin stored in the plugin list @em self, or @c NULL * if the list is empty. The function returns @c NULL if an error * occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns a pointer to the last plugin stored in the plugin * list @em self. */ cpl_plugin * cpl_pluginlist_get_last(cpl_pluginlist *self) { const cxchar *const _id = "cpl_pluginlist_get_last"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } cx_assert(self->data != NULL); if (cx_list_empty(self->data)) { return NULL; } return (cpl_plugin *) cx_list_back(self->data); } /** * @brief * Find a plugin with a given name in a plugin list. * * @param self The plugin list to query. * @param name The plugin's unique name to look for. * * @return * The first plugin with the given name @em name, or @c NULL if it * no plugin with this name could be found. The function returns * @c NULL if an error occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * This function searches the plugin list @em self for a plugin with the * unique name @em name and returns a pointer to the first one found. * If no plugin with the given name is found the function returns @c NULL. */ cpl_plugin * cpl_pluginlist_find(cpl_pluginlist *self, const char *name) { const cxchar *const _id = "cpl_pluginlist_find"; cx_list_iterator first, last; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } cx_assert(self->data != NULL); first = cx_list_begin(self->data); last = cx_list_end(self->data); while (first != last) { cpl_plugin *p = cx_list_get(self->data, first); if (strcmp(cpl_plugin_get_name(p), name) == 0) { return p; } first = cx_list_next(self->data, first); } return NULL; } /** * @brief * Dump the contents of a plugin list to the given stream. * * @param self The plugin list. * @param stream The output stream to use. * * @return Nothing. * * The function dumps the debugging information for each plugin found in * the plugin list @em self to the output stream @em stream. The debugging * information for each individual plugin is dumped using * @b cpl_plugin_dump(). If @em self is @c NULL the function does nothing. * * @see cpl_plugin_dump() */ void cpl_pluginlist_dump(const cpl_pluginlist *self, FILE *stream) { if (self != NULL) { cx_list_const_iterator pos = cx_list_begin(self->data); if (stream == NULL) { stream = stdout; } while (pos != cx_list_end(self->data)) { const cpl_plugin *p = cx_list_get(self->data, pos); cpl_plugin_dump(p, stream); pos = cx_list_next(self->data, pos); } } return; } /**@}*/ cpl-6.4.1/cplui/cpl_recipedefine.h0000644000460300003120000004257612124022612013765 00000000000000/* $Id: cpl_recipedefine.h,v 1.15 2013-03-25 10:23:06 cgarcia Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 */ /* * $Author: cgarcia $ * $Date: 2013-03-25 10:23:06 $ * $Revision: 1.15 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_RECIPEDEFINE_H #define CPL_RECIPEDEFINE_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_recipedefine @brief Generate the recipe copyright and license text (GPL v.2) @param PACKAGE_NAME The name as a string literal, e.g. from config.h @param YEAR The year(s) as a string literal @return The recipe copyright and license text as a string literal Example: @code const char * eso_gpl_license = cpl_get_license(PACKAGE_NAME, "2005, 2008"); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_get_license(PACKAGE_NAME, YEAR) \ "This file is part of the " PACKAGE_NAME "\n" \ "Copyright (C) " YEAR " European Southern Observatory\n" \ "\n" \ "This program is free software; you can redistribute it and/or modify\n" \ "it under the terms of the GNU General Public License as published by\n" \ "the Free Software Foundation; either version 2 of the License, or\n" \ "(at your option) any later version.\n" \ "\n" \ "This program is distributed in the hope that it will be useful,\n" \ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" \ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" \ "GNU General Public License for more details.\n" \ "\n" \ "You should have received a copy of the GNU General Public License\n" \ "along with this program; if not, write to the Free Software\n" \ "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, \n" \ "MA 02111-1307 USA" /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_recipedefine @brief Define a standard CPL recipe @param RECIPE_NAME The name as an identifier @param RECIPE_VERSION The binary version number @param RECIPE_AUTHOR The author as a string literal @param RECIPE_EMAIL The contact email as a string literal @param RECIPE_YEAR The copyright year as a string literal @param RECIPE_SYNOPSIS The synopsis as a string literal @param RECIPE_DESCRIPTION The man-page as a string literal A CPL-based recipe may use this macro to define its four mandatory functions: cpl_plugin_get_info(), \_create(), \_exec() and \_destroy(), as well as declaring the actual data reduction function, \() as @code static int (cpl_frameset *, const cpl_parameterlist *); @endcode The macro also declares the recipe-specific function that fills the recipe parameterlist with the supported parameters as @code static cpl_error_code _fill_parameterlist(cpl_parameterlist *self); @endcode A recipe that invokes cpl_recipe_define() must define this function. The macro cpl_recipe_define() may be used by defining a macro, e.g. in my_recipe.h: @code #define MY_RECIPE_DEFINE(NAME, SYNOPSIS, DESCRIPTION) \ cpl_recipe_define(NAME, MY_BINARY_VERSION, \ "Firstname Lastname", "2006, 2008", SYNOPSIS, DESCRIPTION) @endcode - and then by invoking this macro in each recipe: @code #include "my_recipe.h" MY_RECIPE_DEFINE(instrume_img_dark, "Dark recipe", "instrume_img_dark -- imaging dark recipe.\n" " ... recipe man-page\n"); static cpl_error_code instrume_img_dark_fill_parameterlist(cpl_parameterlist *self); { // Fill the parameterlist with the parameters supported by the recipe. retun CPL_ERROR_NONE; } @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_recipe_define(RECIPE_NAME, RECIPE_VERSION, RECIPE_AUTHOR, \ RECIPE_EMAIL, RECIPE_YEAR, \ RECIPE_SYNOPSIS, RECIPE_DESCRIPTION) \ \ /* The prototypes of the recipe create, exec and destroy functions */ \ static int CPL_CONCAT2X(RECIPE_NAME,create) (cpl_plugin * plugin); \ static int CPL_CONCAT2X(RECIPE_NAME,exec) (cpl_plugin * plugin); \ static int CPL_CONCAT2X(RECIPE_NAME,destroy)(cpl_plugin * plugin); \ \ /* The prototype of the function called by the recipe exec function */ \ static int RECIPE_NAME(cpl_frameset *, const cpl_parameterlist *); \ \ /* The prototype of the parameterlist filler function */ \ static cpl_error_code CPL_CONCAT2X(RECIPE_NAME,fill_parameterlist) \ (cpl_parameterlist *); \ \ int cpl_plugin_get_info(cpl_pluginlist * list) \ { \ /* Propagate error, if any. Return 1 on failure */ \ return cpl_recipedefine_init(list, CPL_VERSION_CODE, \ RECIPE_VERSION, \ #RECIPE_NAME, \ RECIPE_SYNOPSIS, \ RECIPE_DESCRIPTION, \ RECIPE_AUTHOR, \ RECIPE_EMAIL, \ cpl_get_license(PACKAGE_NAME, RECIPE_YEAR), \ CPL_CONCAT2X(RECIPE_NAME,create), \ CPL_CONCAT2X(RECIPE_NAME,exec), \ CPL_CONCAT2X(RECIPE_NAME,destroy)) \ ? ((void)cpl_error_set_where(cpl_func), 1) : 0; \ } \ \ /* The definition of the recipe create function */ \ static int CPL_CONCAT2X(RECIPE_NAME,create)(cpl_plugin * plugin) \ { \ cpl_recipe * recipe = (cpl_recipe *)plugin; /* Needed for the fill */ \ cpl_errorstate prestate = cpl_errorstate_get(); /* To check the fill */ \ \ /* Propagate error, if any */ \ /* - Need two function calls to ensure plugin validity before the fill */ \ return cpl_recipedefine_create(plugin) \ || cpl_recipedefine_create_is_ok(prestate, \ CPL_CONCAT2X(RECIPE_NAME,fill_parameterlist)(recipe->parameters)) \ ? (int)cpl_error_set_where(cpl_func) : 0; \ } \ \ /* The definition of the recipe exec function */ \ static int CPL_CONCAT2X(RECIPE_NAME,exec)(cpl_plugin * plugin) \ { \ /* Propagate error, if any */ \ return cpl_recipedefine_exec(plugin, RECIPE_NAME) \ ? (int)cpl_error_set_where(cpl_func) : 0; \ } \ \ /* The definition of the recipe destroy function */ \ static int CPL_CONCAT2X(RECIPE_NAME,destroy)(cpl_plugin * plugin) \ { \ /* Propagate error, if any */ \ return cpl_recipedefine_destroy(plugin) \ ? (int)cpl_error_set_where(cpl_func) : 0; \ } \ \ /* This dummy declaration requires the macro to be invoked as if it was \ a kind of function declaration, with a terminating ; */ \ extern int cpl_plugin_end /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_recipedefine @brief Define a standard CPL recipe @param RECIPE_NAME The name as an identifier @param RECIPE_VERSION The binary version number @param RECIPE_FILL_PARAMS A function call to fill the recipe parameterlist. Must evaluate to zero if and only if successful @param RECIPE_AUTHOR The author as a string literal @param RECIPE_AUTHOR_EMAIL The author email as a string literal @param RECIPE_YEAR The copyright year as a string literal @param RECIPE_SYNOPSIS The synopsis as a string literal @param RECIPE_DESCRIPTION The man-page as a string literal @deprecated Use cpl_recipe_define() */ /*----------------------------------------------------------------------------*/ #define CPL_RECIPE_DEFINE(RECIPE_NAME, RECIPE_VERSION, RECIPE_FILL_PARAMS, \ RECIPE_AUTHOR, RECIPE_AUTHOR_EMAIL, RECIPE_YEAR, \ RECIPE_SYNOPSIS, RECIPE_DESCRIPTION) \ \ /* The prototypes of the recipe create, exec and destroy functions */ \ static int CPL_CONCAT2X(RECIPE_NAME,create) (cpl_plugin * plugin); \ static int CPL_CONCAT2X(RECIPE_NAME,exec) (cpl_plugin * plugin); \ static int CPL_CONCAT2X(RECIPE_NAME,destroy)(cpl_plugin * plugin); \ \ /* The prototype of the function called by the recipe exec function */ \ static int RECIPE_NAME(cpl_frameset *, const cpl_parameterlist *); \ \ int cpl_plugin_get_info(cpl_pluginlist * list) \ { \ /* Propagate error, if any. Return 1 on failure */ \ return cpl_recipedefine_init(list, CPL_VERSION_CODE, \ RECIPE_VERSION, \ #RECIPE_NAME, \ RECIPE_SYNOPSIS, \ RECIPE_DESCRIPTION, \ RECIPE_AUTHOR, \ RECIPE_AUTHOR_EMAIL, \ cpl_get_license(PACKAGE_NAME, RECIPE_YEAR), \ CPL_CONCAT2X(RECIPE_NAME,create), \ CPL_CONCAT2X(RECIPE_NAME,exec), \ CPL_CONCAT2X(RECIPE_NAME,destroy)) \ ? ((void)cpl_error_set_where(cpl_func), 1) : 0; \ } \ \ /* The definition of the recipe create function */ \ static int CPL_CONCAT2X(RECIPE_NAME,create)(cpl_plugin * plugin) \ { \ cpl_recipe * recipe = (cpl_recipe *)plugin; /* Needed for the fill */ \ cpl_errorstate prestate = cpl_errorstate_get(); /* To check the fill */ \ \ /* Propagate error, if any */ \ /* - Need two function calls to ensure plugin validity before the fill */ \ return cpl_recipedefine_create(plugin) \ || cpl_recipedefine_create_is_ok(prestate, (RECIPE_FILL_PARAMS)) \ ? (int)cpl_error_set_where(cpl_func) : 0; \ } \ \ /* The definition of the recipe exec function */ \ static int CPL_CONCAT2X(RECIPE_NAME,exec)(cpl_plugin * plugin) \ { \ /* Propagate error, if any */ \ return cpl_recipedefine_exec(plugin, RECIPE_NAME) \ ? (int)cpl_error_set_where(cpl_func) : 0; \ } \ \ /* The definition of the recipe destroy function */ \ static int CPL_CONCAT2X(RECIPE_NAME,destroy)(cpl_plugin * plugin) \ { \ /* Propagate error, if any */ \ return cpl_recipedefine_destroy(plugin) \ ? (int)cpl_error_set_where(cpl_func) : 0; \ } \ \ /* This dummy declaration requires the macro to be invoked as if it was \ a kind of function declaration, with a terminating ; */ \ extern int cpl_plugin_end /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_error_code cpl_recipedefine_init(cpl_pluginlist *, unsigned long, unsigned long, const char *, const char *, const char *, const char *, const char *, const char *, cpl_plugin_func, cpl_plugin_func, cpl_plugin_func) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(9, 10, 11, 12))) #endif ; cpl_error_code cpl_recipedefine_create(cpl_plugin *); cpl_error_code cpl_recipedefine_create_is_ok(cpl_errorstate, cpl_error_code); cpl_error_code cpl_recipedefine_exec(cpl_plugin *, int (*)(cpl_frameset *, const cpl_parameterlist *)); cpl_error_code cpl_recipedefine_destroy(cpl_plugin *); CPL_END_DECLS #endif /* end of cpl_recipedefine.h */ cpl-6.4.1/cplui/cpl_recipeconfig.h0000644000460300003120000000623211703310325013770 00000000000000/* $Id: cpl_recipeconfig.h,v 1.5 2012-01-11 13:38:29 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-01-11 13:38:29 $ * $Revision: 1.5 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_RECIPECONFIG_H #define CPL_RECIPECONFIG_H #include #include #include CPL_BEGIN_DECLS /** * @ingroup cpl_cplrecipeconfig * * @brief * The opaque recipe configuration object type. */ typedef struct _cpl_recipeconfig_ cpl_recipeconfig; /* * Create, copy and destroy operations */ cpl_recipeconfig* cpl_recipeconfig_new(void) CPL_ATTR_ALLOC; void cpl_recipeconfig_delete(cpl_recipeconfig* self); void cpl_recipeconfig_clear(cpl_recipeconfig* self); /* * Non modifying operations */ char** cpl_recipeconfig_get_tags(const cpl_recipeconfig* self); char** cpl_recipeconfig_get_inputs(const cpl_recipeconfig* self, const char* tag); char** cpl_recipeconfig_get_outputs(const cpl_recipeconfig* self, const char* tag); cpl_size cpl_recipeconfig_get_min_count(const cpl_recipeconfig* self, const char* tag, const char* input); cpl_size cpl_recipeconfig_get_max_count(const cpl_recipeconfig* self, const char* tag, const char* input); int cpl_recipeconfig_is_required(const cpl_recipeconfig* self, const char* tag, const char* input); /* * Assignment operations */ int cpl_recipeconfig_set_tag(cpl_recipeconfig* self, const char* tag, cpl_size min_count, cpl_size max_count); int cpl_recipeconfig_set_input(cpl_recipeconfig* self, const char* tag, const char* input, cpl_size min_count, cpl_size max_count); int cpl_recipeconfig_set_output(cpl_recipeconfig* self, const char* tag, const char* output); int cpl_recipeconfig_set_tags(cpl_recipeconfig* self, const cpl_framedata* data); int cpl_recipeconfig_set_inputs(cpl_recipeconfig* self, const char* tag, const cpl_framedata* data); int cpl_recipeconfig_set_outputs(cpl_recipeconfig* self, const char* tag, const char** outputs); CPL_END_DECLS #endif /* CPL_RECIPECONFIG_H */ cpl-6.4.1/cplui/tests/0000755000460300003120000000000012310333011011533 500000000000000cpl-6.4.1/cplui/tests/cpl_parameter-test.c0000644000460300003120000001470412106171261015432 00000000000000/* $Id: cpl_parameter-test.c,v 1.10 2013-02-11 13:31:29 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-02-11 13:31:29 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_test.h" #include "cpl_parameter.h" int main(void) { const cxchar *sval1 = "abcdefghijklmnopqrstuvwxyz"; const cxchar *sval2 = "zyxwvutsrqponmlkjihgfedcba"; cxint ival = 0; cpl_error_code error = CPL_ERROR_NONE; cpl_parameter *p = NULL; cpl_parameter *q = NULL; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* * Test 1: Create a string parameter and check its validity */ p = cpl_parameter_new_value("a", CPL_TYPE_STRING, "Test parameter", "None", sval1); cpl_test_nonnull(p); cpl_test_eq_string(cpl_parameter_get_name(p), "a"); cpl_test_eq_string(cpl_parameter_get_help(p), "Test parameter"); cpl_test_eq_string(cpl_parameter_get_context(p), "None"); cpl_test_null(cpl_parameter_get_tag(p)); cpl_test_eq(cpl_parameter_get_type(p), CPL_TYPE_STRING); cpl_test_eq(cpl_parameter_get_class(p), CPL_PARAMETER_CLASS_VALUE); cpl_test_eq_string(cpl_parameter_get_string(p), sval1); cpl_test_noneq_ptr(cpl_parameter_get_string(p), sval1); /* * Test 2: Assign a new string value to the parameter and check * its validity */ error = cpl_parameter_set_string(p, sval2); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq_string(cpl_parameter_get_string(p), sval2); cpl_test_noneq_ptr(cpl_parameter_get_string(p), sval2); cpl_test_noneq_ptr(cpl_parameter_get_string(p), sval1); cpl_parameter_delete(p); /* * Test 3: Change the parameter's default value. */ p = cpl_parameter_new_value("b", CPL_TYPE_BOOL, "A boolean value.", "None", 0); cpl_test_zero(cpl_parameter_get_default_bool(p)); cpl_test_eq(cpl_parameter_get_default_bool(p), cpl_parameter_get_bool(p)); error = cpl_parameter_set_default_bool(p, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_parameter_get_default_bool(p), 1); cpl_test_noneq(cpl_parameter_get_default_bool(p), cpl_parameter_get_bool(p)); cpl_parameter_delete(p); p = cpl_parameter_new_value("c", CPL_TYPE_STRING, "A string value.", "None", sval1); cpl_test_eq_string(cpl_parameter_get_default_string(p), sval1); cpl_test_eq_string(cpl_parameter_get_default_string(p), cpl_parameter_get_string(p)); error = cpl_parameter_set_default_string(p, sval2); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq_string(cpl_parameter_get_default_string(p), sval2); cpl_test_noneq_ptr(cpl_parameter_get_default_string(p), sval2); cpl_test_noneq_string(cpl_parameter_get_default_string(p), cpl_parameter_get_string(p)); cpl_parameter_delete(p); /* * Test 3: Copy a parameter */ p = cpl_parameter_new_enum("a", CPL_TYPE_STRING, "A string enum.", "None", sval1, 2, sval1, sval2); q = cpl_parameter_duplicate(p); cpl_test_nonnull(q); cpl_test_eq(cpl_parameter_get_class(q), cpl_parameter_get_class(p)); cpl_test_eq(cpl_parameter_get_type(q), cpl_parameter_get_type(p)); cpl_test_eq_string(cpl_parameter_get_name(q), cpl_parameter_get_name(p)); cpl_test_noneq_ptr(cpl_parameter_get_name(q), cpl_parameter_get_name(p)); cpl_test_eq_string(cpl_parameter_get_context(q), cpl_parameter_get_context(p)); cpl_test_noneq_ptr(cpl_parameter_get_context(q), cpl_parameter_get_context(p)); cpl_test_eq_string(cpl_parameter_get_help(q), cpl_parameter_get_help(p)); cpl_test_noneq_ptr(cpl_parameter_get_help(q), cpl_parameter_get_help(p)); cpl_test_eq_string(cpl_parameter_get_default_string(q), cpl_parameter_get_default_string(p)); cpl_test_noneq_ptr(cpl_parameter_get_default_string(q), cpl_parameter_get_default_string(p)); cpl_test_eq_string(cpl_parameter_get_string(q), cpl_parameter_get_string(p)); cpl_test_noneq_ptr(cpl_parameter_get_string(q), cpl_parameter_get_string(p)); cpl_test_eq(cpl_parameter_get_enum_size(q), cpl_parameter_get_enum_size(p)); cpl_test_eq_string(cpl_parameter_get_enum_string(q, 0), cpl_parameter_get_enum_string(p, 0)); cpl_test_noneq_ptr(cpl_parameter_get_enum_string(q, 0), cpl_parameter_get_enum_string(p, 0)); cpl_test_eq_string(cpl_parameter_get_enum_string(q, 1), cpl_parameter_get_enum_string(p, 1)); cpl_test_noneq_ptr(cpl_parameter_get_enum_string(q, 1), cpl_parameter_get_enum_string(p, 1)); cpl_parameter_delete(q); cpl_parameter_delete(p); /* * Test 4: Test some error handling */ p = cpl_parameter_new_value("a", CPL_TYPE_STRING, "A string value.", "None", sval1); error = cpl_parameter_set_int(p, 0); cpl_test_eq_error(error, CPL_ERROR_TYPE_MISMATCH); (void)cpl_parameter_get_int(p); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); ival = cpl_parameter_get_enum_size(p); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_zero(ival); cpl_parameter_delete(p); /* * All tests finished */ return cpl_test_end(0); } cpl-6.4.1/cplui/tests/cpl_framedata-test.c0000644000460300003120000001445611466733006015413 00000000000000/* $Id: cpl_framedata-test.c,v 1.5 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.5 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_test.h" #include "cpl_framedata.h" int main(void) { const char* tags[] = {"One", "Two"}; const char* tag = NULL; cpl_error_code status; int count; cpl_framedata* framedata = NULL; cpl_framedata* _framedata = NULL; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* * Test 1: Create a framedata object, check its validity and destroy it * again. */ framedata = cpl_framedata_new(); cpl_test_nonnull(framedata); cpl_test_null(cpl_framedata_get_tag(framedata)); cpl_test_eq(cpl_framedata_get_min_count(framedata), -1); cpl_test_eq(cpl_framedata_get_max_count(framedata), -1); cpl_framedata_delete(framedata); framedata = NULL; /* * Test 2: Create a framedata object with given initializers, check * its validity and destroy it again. */ framedata = cpl_framedata_create(tags[0], 0, 5); cpl_test_nonnull(framedata); cpl_test_noneq_ptr(cpl_framedata_get_tag(framedata), tags[0]); cpl_test_eq_string(cpl_framedata_get_tag(framedata), tags[0]); cpl_test_zero(cpl_framedata_get_min_count(framedata)); cpl_test_eq(cpl_framedata_get_max_count(framedata), 5); cpl_framedata_delete(framedata); framedata = NULL; /* * Test 3: Clone a framedata object and check that both objecta are * identical. */ framedata = cpl_framedata_create(tags[1], 5, -1); cpl_test_nonnull(framedata); _framedata = cpl_framedata_duplicate(framedata); cpl_test_nonnull(_framedata); cpl_test_noneq_ptr(cpl_framedata_get_tag(framedata), cpl_framedata_get_tag(_framedata)); cpl_test_eq_string(cpl_framedata_get_tag(framedata), cpl_framedata_get_tag(_framedata)); cpl_test_eq(cpl_framedata_get_min_count(framedata), cpl_framedata_get_min_count(_framedata)); cpl_test_eq(cpl_framedata_get_max_count(framedata), cpl_framedata_get_max_count(_framedata)); cpl_framedata_delete(_framedata); _framedata = NULL; cpl_framedata_delete(framedata); framedata = NULL; /* * Test 4: Clear a framedata object and check that it is in its * default state. */ framedata = cpl_framedata_create(tags[1], 5, -1); cpl_test_nonnull(framedata); cpl_framedata_clear(framedata); cpl_test_null(cpl_framedata_get_tag(framedata)); cpl_test_eq(cpl_framedata_get_min_count(framedata), -1); cpl_test_eq(cpl_framedata_get_max_count(framedata), -1); cpl_framedata_delete(framedata); framedata = NULL; /* * Test 5: Create a framedata object modify its contents, and verify it. */ framedata = cpl_framedata_create(tags[0], 0, -1); cpl_test_nonnull(framedata); cpl_framedata_set_tag(framedata, tags[1]); cpl_test_noneq_ptr(cpl_framedata_get_tag(framedata), tags[1]); cpl_test_eq_string(cpl_framedata_get_tag(framedata), tags[1]); cpl_framedata_set_min_count(framedata, 3); cpl_test_eq(cpl_framedata_get_min_count(framedata), 3); cpl_framedata_set_max_count(framedata, 5); cpl_test_eq(cpl_framedata_get_max_count(framedata), 5); cpl_framedata_set(framedata, tags[0], 0, -1); cpl_test_noneq_ptr(cpl_framedata_get_tag(framedata), tags[0]); cpl_test_eq_string(cpl_framedata_get_tag(framedata), tags[0]); cpl_test_zero(cpl_framedata_get_min_count(framedata)); cpl_test_eq(cpl_framedata_get_max_count(framedata), -1); cpl_framedata_delete(framedata); framedata = NULL; /* * Test 5: Check error codes set by the member functions. */ framedata = cpl_framedata_create(NULL, 0, -1); cpl_test_error(CPL_ERROR_NONE); cpl_test_null(cpl_framedata_get_tag(framedata)); cpl_framedata_delete(framedata); framedata = NULL; framedata = cpl_framedata_duplicate(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(framedata); tag = cpl_framedata_get_tag(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(tag); count = cpl_framedata_get_min_count(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(count, -2); count = cpl_framedata_get_max_count(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(count, -2); framedata = cpl_framedata_new(); cpl_test_nonnull(framedata); status = cpl_framedata_set_tag(NULL, tags[0]); cpl_test_eq_error(status, CPL_ERROR_NULL_INPUT); status = cpl_framedata_set_tag(framedata, NULL); cpl_test_eq_error(status, CPL_ERROR_ILLEGAL_INPUT); status = cpl_framedata_set_tag(framedata, ""); cpl_test_eq_error(status, CPL_ERROR_ILLEGAL_INPUT); status = cpl_framedata_set_min_count(NULL, 0); cpl_test_eq_error(status, CPL_ERROR_NULL_INPUT); status = cpl_framedata_set_max_count(NULL, 0); cpl_test_eq_error(status, CPL_ERROR_NULL_INPUT); status = cpl_framedata_set(NULL, tags[0], 0, 5); cpl_test_eq_error(status, CPL_ERROR_NULL_INPUT); status = cpl_framedata_set(framedata, NULL, 0, 5); cpl_test_eq_error(status, CPL_ERROR_ILLEGAL_INPUT); status = cpl_framedata_set(framedata, "", 0, 5); cpl_test_eq_error(status, CPL_ERROR_ILLEGAL_INPUT); cpl_framedata_delete(framedata); /* * All tests succeeded */ return cpl_test_end(0); } cpl-6.4.1/cplui/tests/cpl_plugin-test.c0000644000460300003120000004110611513031114014735 00000000000000/* $Id: cpl_plugin-test.c,v 1.12 2011-01-11 10:34:52 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-01-11 10:34:52 $ * $Revision: 1.12 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_test.h" #include "cpl_memory.h" #include "cpl_plugin.h" #include int main(void) { cpl_plugin *plgn1; int ecode; const unsigned int api1 = 1; unsigned int aapi1; const unsigned long version1 = 30507L, type1 = 1L; unsigned long aversion1, atype1; char *asversion1, *astype1; const char *asnull; const char *sversion1 = "3.5.7", *stype1 = "recipe", *sname1 = "eso.cpl.test", *asname1, *ssynopsis1 = "test_synopsis", *assynopsis1, *sdescription1 = "test_description", *asdescription1, *sauthor1 = "test_author", *asauthor1, *semail1 = "test_email", *asemail1, *scopyright1 = "test_copyright", *ascopyright1; cpl_plugin_func initialize1 = (cpl_plugin_func)1, ainitialize1, execute1 = (cpl_plugin_func)1, aexecute1, deinitialize1 = (cpl_plugin_func)1, adeinitialize1; FILE * stream; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* * Test1 : Accessor Functions */ stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; cpl_test_nonnull(stream); plgn1 = cpl_plugin_new(); cpl_test_nonnull(plgn1); /* PLUGIN API */ ecode = cpl_plugin_set_api(NULL, api1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); aapi1 = cpl_plugin_get_api(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_zero(aapi1); ecode = cpl_plugin_set_api(plgn1, api1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); aapi1 = cpl_plugin_get_api(plgn1); cpl_test_eq(aapi1, api1); /* PLUGIN VERSION */ ecode = cpl_plugin_set_version(NULL, version1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); aversion1 = cpl_plugin_get_version(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_zero(aversion1); asnull = cpl_plugin_get_version_string(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(asnull); ecode = cpl_plugin_set_version(plgn1, version1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); aversion1 = cpl_plugin_get_version(plgn1); cpl_test_eq(aversion1, version1); asversion1 = cpl_plugin_get_version_string(plgn1); cpl_test_noneq_ptr(sversion1, asversion1); cpl_test_eq_string(sversion1, asversion1); cpl_free(asversion1); /* PLUGIN TYPE */ ecode = cpl_plugin_set_type(NULL, type1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); atype1 = cpl_plugin_get_type(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(atype1, CPL_PLUGIN_TYPE_NONE); asnull = cpl_plugin_get_type_string(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(asnull); ecode = cpl_plugin_set_type(plgn1, type1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); atype1 = cpl_plugin_get_type(plgn1); cpl_test_eq(atype1, type1); astype1 = cpl_plugin_get_type_string(plgn1); cpl_test_noneq_ptr(stype1, astype1); cpl_test_eq_string(stype1, astype1); cpl_free(astype1); /* PLUGIN NAME */ ecode = cpl_plugin_set_name(NULL, sname1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); ecode = cpl_plugin_set_name(plgn1, NULL); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); asnull = cpl_plugin_get_name(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(asnull); ecode = cpl_plugin_set_name(plgn1, sname1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); asname1 = cpl_plugin_get_name(plgn1); cpl_test_noneq_ptr(sname1, asname1); cpl_test_eq_string(sname1, asname1); /* PLUGIN SYNOPSIS */ ecode = cpl_plugin_set_synopsis(NULL, ssynopsis1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); asnull = cpl_plugin_get_synopsis(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(asnull); ecode = cpl_plugin_set_synopsis(plgn1, NULL); cpl_test_eq_error(ecode, CPL_ERROR_NONE); asnull = cpl_plugin_get_synopsis(plgn1); cpl_test_error(CPL_ERROR_NONE); cpl_test_null(asnull); ecode = cpl_plugin_set_synopsis(plgn1, ssynopsis1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); assynopsis1 = cpl_plugin_get_synopsis(plgn1); cpl_test_noneq_ptr(ssynopsis1, assynopsis1); cpl_test_eq_string(ssynopsis1, assynopsis1); /* PLUGIN DESCRIPTION */ ecode = cpl_plugin_set_description(NULL, sdescription1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); asnull = cpl_plugin_get_description(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(asnull); ecode = cpl_plugin_set_description(plgn1, NULL); cpl_test_eq_error(ecode, CPL_ERROR_NONE); asnull = cpl_plugin_get_description(plgn1); cpl_test_null(asnull); ecode = cpl_plugin_set_description(plgn1, sdescription1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); asdescription1 = cpl_plugin_get_description(plgn1); cpl_test_noneq_ptr(sdescription1, asdescription1); cpl_test_eq_string(sdescription1, asdescription1); /* PLUGIN AUTHOR */ ecode = cpl_plugin_set_author(NULL, sauthor1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); ecode = cpl_plugin_set_author(plgn1, NULL); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); asnull = cpl_plugin_get_author(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(asnull); ecode = cpl_plugin_set_author(plgn1, sauthor1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); asauthor1 = cpl_plugin_get_author(plgn1); cpl_test_noneq_ptr(sauthor1, asauthor1); cpl_test_eq_string(sauthor1, asauthor1); /* PLUGIN EMAIL */ ecode = cpl_plugin_set_email(NULL, semail1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); ecode = cpl_plugin_set_email(plgn1, NULL); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); asnull = cpl_plugin_get_email(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(asnull); ecode = cpl_plugin_set_email(plgn1, semail1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); asemail1 = cpl_plugin_get_email(plgn1); cpl_test_noneq_ptr(semail1, asemail1); cpl_test_eq_string(semail1, asemail1); /* PLUGIN COPYRIGHT */ ecode = cpl_plugin_set_copyright(NULL, scopyright1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); ecode = cpl_plugin_set_copyright(plgn1, NULL); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); asnull = cpl_plugin_get_copyright(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(asnull); ecode = cpl_plugin_set_copyright(plgn1, scopyright1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); ascopyright1 = cpl_plugin_get_copyright(plgn1); cpl_test_noneq_ptr(scopyright1, ascopyright1); cpl_test_eq_string(scopyright1, ascopyright1); /* PLUGIN INITIALIZE */ ecode = cpl_plugin_set_init(NULL, initialize1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); ecode = cpl_plugin_set_init(plgn1, NULL); cpl_test_eq_error(ecode, CPL_ERROR_NONE); ainitialize1 = cpl_plugin_get_init(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test(ainitialize1 == NULL); ainitialize1 = cpl_plugin_get_init(plgn1); cpl_test(ainitialize1 == NULL); ecode = cpl_plugin_set_init(plgn1, initialize1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); ainitialize1 = cpl_plugin_get_init(plgn1); cpl_test(ainitialize1 == initialize1); /* PLUGIN EXECUTE */ ecode = cpl_plugin_set_exec(NULL, execute1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); aexecute1 = cpl_plugin_get_exec(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test(aexecute1 == NULL); ecode = cpl_plugin_set_exec(plgn1, NULL); cpl_test_eq_error(ecode, CPL_ERROR_NONE); aexecute1 = cpl_plugin_get_exec(plgn1); cpl_test(aexecute1 == NULL); ecode = cpl_plugin_set_exec(plgn1, execute1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); aexecute1 = cpl_plugin_get_exec(plgn1); cpl_test(aexecute1 == execute1); /* PLUGIN DEINITIALIZE */ ecode = cpl_plugin_set_deinit(NULL, deinitialize1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); adeinitialize1 = cpl_plugin_get_deinit(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test(adeinitialize1 == NULL); ecode = cpl_plugin_set_deinit(plgn1, NULL); cpl_test_eq_error(ecode, CPL_ERROR_NONE); adeinitialize1 = cpl_plugin_get_deinit(plgn1); cpl_test(adeinitialize1 == NULL); ecode = cpl_plugin_set_deinit(plgn1, deinitialize1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); adeinitialize1 = cpl_plugin_get_deinit(plgn1); cpl_test(adeinitialize1 == deinitialize1); cpl_plugin_delete(plgn1); plgn1 = cpl_plugin_new(); cpl_test_nonnull(plgn1); /* PLUGIN INIT */ ecode = cpl_plugin_init(NULL, api1, version1, type1, sname1, ssynopsis1, sdescription1, sauthor1, semail1, scopyright1, initialize1, execute1, deinitialize1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); ecode = cpl_plugin_init(plgn1, api1, version1, type1, NULL, ssynopsis1, sdescription1, sauthor1, semail1, scopyright1, initialize1, execute1, deinitialize1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); ecode = cpl_plugin_init(plgn1, api1, version1, type1, sname1, NULL, sdescription1, sauthor1, semail1, scopyright1, initialize1, execute1, deinitialize1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); ecode = cpl_plugin_init(plgn1, api1, version1, type1, sname1, ssynopsis1, NULL, sauthor1, semail1, scopyright1, initialize1, execute1, deinitialize1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); ecode = cpl_plugin_init(plgn1, api1, version1, type1, sname1, ssynopsis1, sdescription1, NULL, semail1, scopyright1, initialize1, execute1, deinitialize1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); ecode = cpl_plugin_init(plgn1, api1, version1, type1, sname1, ssynopsis1, sdescription1, sauthor1, NULL, scopyright1, initialize1, execute1, deinitialize1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); ecode = cpl_plugin_init(plgn1, api1, version1, type1, sname1, ssynopsis1, sdescription1, sauthor1, semail1, NULL, initialize1, execute1, deinitialize1); cpl_test_eq_error(ecode, CPL_ERROR_NULL_INPUT); ecode = cpl_plugin_init(plgn1, api1, version1, type1, sname1, ssynopsis1, sdescription1, sauthor1, semail1, scopyright1, initialize1, execute1, deinitialize1); cpl_test_eq_error(ecode, CPL_ERROR_NONE); /* PLUGIN API */ aapi1 = cpl_plugin_get_api(plgn1); cpl_test_eq(aapi1, api1); /* PLUGIN VERSION */ aversion1 = cpl_plugin_get_version(plgn1); cpl_test_eq(aversion1, version1); asversion1 = cpl_plugin_get_version_string(plgn1); cpl_test_noneq_ptr(asversion1, sversion1); cpl_test_eq_string(asversion1, sversion1); cpl_free(asversion1); /* PLUGIN TYPE */ atype1 = cpl_plugin_get_type(plgn1); cpl_test_eq(atype1, type1); astype1 = cpl_plugin_get_type_string(plgn1); cpl_test_noneq_ptr(stype1,astype1); cpl_test_eq_string(stype1,astype1); cpl_free(astype1); /* PLUGIN NAME */ asname1 = cpl_plugin_get_name(plgn1); cpl_test_noneq_ptr(sname1, asname1); cpl_test_eq_string(sname1, asname1); /* PLUGIN SYNOPSIS */ assynopsis1 = cpl_plugin_get_synopsis(plgn1); cpl_test_noneq_ptr(ssynopsis1, assynopsis1); cpl_test_eq_string(ssynopsis1, assynopsis1); /* PLUGIN DESCRIPTION */ asdescription1 = cpl_plugin_get_description(plgn1); cpl_test_noneq_ptr(sdescription1, asdescription1); cpl_test_eq_string(sdescription1, asdescription1); /* PLUGIN AUTHOR */ asauthor1 = cpl_plugin_get_author(plgn1); cpl_test_noneq_ptr(sauthor1, asauthor1); cpl_test_eq_string(sauthor1, asauthor1); /* PLUGIN EMAIL */ asemail1 = cpl_plugin_get_email(plgn1); cpl_test_noneq_ptr(semail1,asemail1); cpl_test_eq_string(semail1,asemail1); /* PLUGIN COPYRIGHT */ ascopyright1 = cpl_plugin_get_copyright(plgn1); cpl_test_noneq_ptr(scopyright1, ascopyright1); cpl_test_eq_string(scopyright1, ascopyright1); /* PLUGIN INITIALIZE */ ainitialize1 = cpl_plugin_get_init(plgn1); cpl_test(ainitialize1 == initialize1); /* PLUGIN EXECUTE */ aexecute1 = cpl_plugin_get_exec(plgn1); cpl_test(aexecute1 == execute1); /* PLUGIN DEINITIALIZE */ adeinitialize1 = cpl_plugin_get_deinit(plgn1); cpl_test(adeinitialize1 == deinitialize1); cpl_plugin_dump(NULL, stream); cpl_test_error(CPL_ERROR_NONE); cpl_plugin_dump(plgn1, stream); cpl_test_error(CPL_ERROR_NONE); cpl_plugin_delete(plgn1); if (stream != stdout) cpl_test_zero( fclose(stream) ); /* * All tests succeeded */ return cpl_test_end(0); } cpl-6.4.1/cplui/tests/cpl_parameterlist-test.c0000644000460300003120000001374612243412221016327 00000000000000/* $Id: cpl_parameterlist-test.c,v 1.5 2012-12-13 14:21:29 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-12-13 14:21:29 $ * $Revision: 1.5 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_test.h" #include "cpl_parameterlist.h" int main(void) { const cpl_parameter *cq = NULL; cpl_parameter *p[4]; cpl_parameter *q = NULL; cpl_parameterlist *list = NULL; cpl_error_code error; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* * Test 1: Create a parameter list */ list = cpl_parameterlist_new(); cpl_test_nonnull(list); cpl_test_zero(cpl_parameterlist_get_size(list)); /* * Test 2: Append parameters to the list */ p[0] = cpl_parameter_new_value("a", CPL_TYPE_STRING, "parameter1", "None", "value1"); error = cpl_parameterlist_append(list, p[0]); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_parameterlist_get_size(list), 1); p[1] = cpl_parameter_new_value("b", CPL_TYPE_STRING, "parameter2", "None", "value2"); error = cpl_parameterlist_append(list, p[1]); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_parameterlist_get_size(list), 2); p[2] = cpl_parameter_new_value("c", CPL_TYPE_STRING, "parameter3", "None", "value3"); error = cpl_parameterlist_append(list, p[2]); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_parameterlist_get_size(list), 3); p[3] = cpl_parameter_new_value("d", CPL_TYPE_STRING, "parameter4", "None", "value4"); error = cpl_parameterlist_append(list, p[3]); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_parameterlist_get_size(list), 4); /* * Test 3: Verify the sequential access to the list elements. */ cpl_test_eq_ptr(p[0], cpl_parameterlist_get_first(list)); cpl_test_eq_ptr(p[1], cpl_parameterlist_get_next(list)); cpl_test_eq_ptr(p[2], cpl_parameterlist_get_next(list)); cpl_test_eq_ptr(p[3], cpl_parameterlist_get_next(list)); cpl_test_eq_ptr(p[3], cpl_parameterlist_get_last(list)); cpl_test_null(cpl_parameterlist_get_next(list)); /* * Test 4: Add a user tag to one of the parameters and check whether it * can be found by looking for the tag. */ error = cpl_parameter_set_tag(p[2], "mytag"); cpl_test_eq_error(error, CPL_ERROR_NONE); q = cpl_parameterlist_find_tag(list, "mytag"); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq_ptr(q, p[2]); q = cpl_parameterlist_find_tag(list, "notag"); cpl_test_error(CPL_ERROR_NONE); cpl_test_null(q); cpl_parameterlist_delete(list); /* * Test 5: Check cpl_parameterlist_find_tag_const handles invalid * tags (passed as argument or as member of the list to search) * gracefully. */ list = cpl_parameterlist_new(); cpl_test_nonnull(list); p[0] = cpl_parameter_new_value("a", CPL_TYPE_STRING, "parameter1", "None", "value1"); cpl_test_nonnull(p[0]); error = cpl_parameter_set_tag(p[0], "mytag"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_parameterlist_append(list, p[0]); cpl_test_eq_error(error, CPL_ERROR_NONE); cq = cpl_parameterlist_find_tag_const(list, NULL); cpl_test_null(cq); cpl_test_eq_error(error, CPL_ERROR_NONE); p[1] = cpl_parameter_new_value("b", CPL_TYPE_STRING, "parameter2", "None", "value2"); cpl_test_nonnull(p[1]); error = cpl_parameterlist_append(list, p[1]); cpl_test_eq_error(error, CPL_ERROR_NONE); cq = cpl_parameterlist_find_tag_const(list, NULL); cpl_test_eq_ptr(cq, p[1]); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_parameterlist_delete(list); /* * Test 6: Check cpl_parameterlist_find_context_const handles invalid * contexts gracefully (passed as argument or member of the list). */ list = cpl_parameterlist_new(); cpl_test_nonnull(list); p[0] = cpl_parameter_new_value("a", CPL_TYPE_STRING, "parameter1", "Context1", "value1"); cpl_test_nonnull(p[0]); error = cpl_parameterlist_append(list, p[0]); cpl_test_eq_error(error, CPL_ERROR_NONE); p[1] = cpl_parameter_new_value("b", CPL_TYPE_STRING, "parameter2", NULL, "value2"); cpl_test_nonnull(p[1]); error = cpl_parameterlist_append(list, p[1]); cpl_test_eq_error(error, CPL_ERROR_NONE); cq = cpl_parameterlist_find_context_const(list, "Context1"); cpl_test_eq_ptr(cq, p[0]); cpl_test_eq_error(error, CPL_ERROR_NONE); cq = cpl_parameterlist_find_context_const(list, "Context2"); cpl_test_null(cq); cpl_test_eq_error(error, CPL_ERROR_NONE); cq = cpl_parameterlist_find_context_const(list, NULL); cpl_test_eq_ptr(cq, p[1]); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_parameterlist_delete(list); /* * All tests succeeded */ return cpl_test_end(0); } cpl-6.4.1/cplui/tests/cpl_pluginlist-test.c0000644000460300003120000001437211466733006015656 00000000000000/* $Id: cpl_pluginlist-test.c,v 1.9 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.9 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_test.h" #include "cpl_pluginlist.h" #include "cpl_recipedefine.h" int main(void) { const char * eso_gpl_license = cpl_get_license(PACKAGE_NAME, "2005, 2008"); cpl_plugin *pl1 = NULL, *pl2 = NULL, *pl3 = NULL, *pl4 = NULL, *pl5 = NULL, *front = NULL, *back = NULL, *search = NULL; cpl_pluginlist *pllst = NULL; cpl_error_code error; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); cpl_test_nonnull(eso_gpl_license); pl1 = cpl_plugin_new(); cpl_test_nonnull(pl1); error = cpl_plugin_init(pl1, 1, 10000, (unsigned long) CPL_PLUGIN_TYPE_RECIPE, "cmdlcaller.test.plgn1", "synopsis1", "description1", "Fname Lname", PACKAGE_BUGREPORT, eso_gpl_license, NULL, NULL, NULL); cpl_test_eq_error(error, CPL_ERROR_NONE); pl2 = cpl_plugin_new(); cpl_test_nonnull(pl2); error = cpl_plugin_init(pl2, 1, 10000, (unsigned long) CPL_PLUGIN_TYPE_RECIPE, "cmdlcaller.test.plgn2", "synopsis2", "description2", "Fname Lname", PACKAGE_BUGREPORT, eso_gpl_license, NULL, NULL, NULL); cpl_test_eq_error(error, CPL_ERROR_NONE); pl3 = cpl_plugin_new(); cpl_test_nonnull(pl3); error = cpl_plugin_init(pl3, 1, 10000, (unsigned long) CPL_PLUGIN_TYPE_RECIPE, "cmdlcaller.test.plgn3", "synopsis3", "description3", "Fname Lname", PACKAGE_BUGREPORT, eso_gpl_license, NULL, NULL, NULL); cpl_test_eq_error(error, CPL_ERROR_NONE); pl4 = cpl_plugin_new(); cpl_test_nonnull(pl4); error = cpl_plugin_init(pl4, 1, 10000, (unsigned long) CPL_PLUGIN_TYPE_RECIPE, "cmdlcaller.test.plgn4", "synopsis4", "description4", "Fname Lname", PACKAGE_BUGREPORT, eso_gpl_license, NULL, NULL, NULL); cpl_test_eq_error(error, CPL_ERROR_NONE); pl5 = cpl_plugin_new(); cpl_test_nonnull(pl5); error = cpl_plugin_init(pl5, 1, 10000, (unsigned long) CPL_PLUGIN_TYPE_RECIPE, "cmdlcaller.test.plgn5", "synopsis5", "description5", "Fname Lname", PACKAGE_BUGREPORT, eso_gpl_license, NULL, NULL, NULL); cpl_test_eq_error(error, CPL_ERROR_NONE); pllst = cpl_pluginlist_new(); cpl_test_nonnull(pllst); /* * After appending and prepending the ordering of the plugins * is like this: 4 5 1 3 2 */ error = cpl_pluginlist_append(pllst, pl1); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_pluginlist_get_size(pllst), 1); error = cpl_pluginlist_append(pllst, pl3); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_pluginlist_get_size(pllst), 2); error = cpl_pluginlist_append(pllst, pl2); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_pluginlist_get_size(pllst), 3); error = cpl_pluginlist_prepend(pllst, pl5); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_pluginlist_get_size(pllst), 4); error = cpl_pluginlist_prepend(pllst, pl4); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_pluginlist_get_size(pllst), 5); /* * */ front = cpl_pluginlist_get_first(pllst); back = cpl_pluginlist_get_last(pllst); cpl_test_noneq_ptr(front, back); cpl_test_eq_string(cpl_plugin_get_name(front), "cmdlcaller.test.plgn4"); cpl_test_eq_string(cpl_plugin_get_name(back), "cmdlcaller.test.plgn2"); search = cpl_pluginlist_find(pllst, "cmdlcaller.test.plgn2"); cpl_test_eq_ptr(search, back); cpl_test_eq_string(cpl_plugin_get_description(search), "description2"); cpl_pluginlist_delete(pllst); return cpl_test_end(0); } cpl-6.4.1/cplui/tests/cpl_recipeconfig-test.c0000644000460300003120000005754111466733006016126 00000000000000/* $Id: cpl_recipeconfig-test.c,v 1.7 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.7 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_test.h" #include "cpl_recipeconfig.h" /* Needed for cx_strfreev() */ #include "cxstrutils.h" int main(void) { char** tags = NULL; int status = 0; cpl_recipeconfig* config = NULL; const cpl_framedata frames[] = { {"frameA", 1, 5}, {"frameB", 0, -1}, {NULL, 0, 0} }; const cpl_framedata inputs[] = { {"inputA", 1, -1}, {"inputB", 0, -1}, {"inputC", -1, -1}, {NULL, 0, 0} }; const cpl_framedata _inputs[] = { {"inputD", 0, 3}, {"inputE", 1, 1}, {"inputF", 1, -1}, {NULL, 0, 0} }; const char* outputs[] = {"outputA", "outputB", "outputC", NULL}; const cpl_framedata bad[] = { {"", 1, 3}, {NULL, 0, 0} }; const char* _bad[] = {"outputA", "", "outputC", NULL}; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* * Test 1: Create a recipe configuration object, check its * validity and destroy it again. */ config = cpl_recipeconfig_new(); cpl_test_nonnull(config); tags = cpl_recipeconfig_get_tags(config); cpl_test_nonnull(tags); cpl_test_null(tags[0]); cx_strfreev((cxchar**)tags); tags = NULL; cpl_recipeconfig_delete(config); config = NULL; /* * Test 2: Create a recipe configuration object, add a configuration * tag check its validity and destroy it again. */ config = cpl_recipeconfig_new(); cpl_test_nonnull(config); status = cpl_recipeconfig_set_tag(config, frames[0].tag, 1, -1); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); tags = cpl_recipeconfig_get_tags(config); cpl_test_nonnull(tags); cpl_test_eq_string(tags[0], frames[0].tag); cpl_test_null(tags[1]); cpl_test_eq(cpl_recipeconfig_get_min_count(config, frames[0].tag, frames[0].tag), 1); cpl_test_eq(cpl_recipeconfig_get_max_count(config, frames[0].tag, frames[0].tag), -1); cpl_test_eq(cpl_recipeconfig_is_required(config, frames[0].tag, frames[0].tag), 1); cx_strfreev((cxchar**)tags); tags = NULL; cpl_recipeconfig_delete(config); config = NULL; /* * Test 3: Create a recipe configuration object, add a configuration * tag, clear it and destroy it again. */ config = cpl_recipeconfig_new(); cpl_test_nonnull(config); status = cpl_recipeconfig_set_tag(config, frames[0].tag, 1, -1); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); cpl_recipeconfig_clear(config); tags = cpl_recipeconfig_get_tags(config); cpl_test_nonnull(tags); cpl_test_null(tags[0]); cx_strfreev((cxchar**)tags); tags = NULL; cpl_recipeconfig_delete(config); config = NULL; /* * Test 4: Create a recipe configuration object, add a configuration * tag, an input configuration, and an output configuration. * Verify the object and destroy it again. */ config = cpl_recipeconfig_new(); cpl_test_nonnull(config); status = cpl_recipeconfig_set_tag(config, frames[0].tag, 1, -1); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); status = cpl_recipeconfig_set_input(config, frames[0].tag, inputs[0].tag, 2, 5); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); status = cpl_recipeconfig_set_input(config, frames[0].tag, inputs[1].tag, 0, -1); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); status = cpl_recipeconfig_set_output(config, frames[0].tag, outputs[0]); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); status = cpl_recipeconfig_set_output(config, frames[0].tag, outputs[1]); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); status = cpl_recipeconfig_set_output(config, frames[0].tag, outputs[2]); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); tags = cpl_recipeconfig_get_inputs(config, frames[0].tag); cpl_test_nonnull(tags); cpl_test_eq_string(tags[0], inputs[0].tag); cpl_test_eq(cpl_recipeconfig_get_min_count(config, frames[0].tag, inputs[0].tag), 2); cpl_test_eq(cpl_recipeconfig_get_max_count(config, frames[0].tag, inputs[0].tag), 5); cpl_test_eq(cpl_recipeconfig_is_required(config, frames[0].tag, inputs[0].tag), 1); cpl_test_eq_string(tags[1], inputs[1].tag); cpl_test_zero(cpl_recipeconfig_get_min_count(config, frames[0].tag, inputs[1].tag)); cpl_test_eq(cpl_recipeconfig_get_max_count(config, frames[0].tag, inputs[1].tag), -1); cpl_test_zero(cpl_recipeconfig_is_required(config, frames[0].tag, inputs[1].tag)); cx_strfreev((cxchar**)tags); tags = NULL; tags = cpl_recipeconfig_get_outputs(config, frames[0].tag); cpl_test_nonnull(tags); cpl_test_eq_string(tags[0], outputs[0]); cpl_test_eq_string(tags[1], outputs[1]); cpl_test_eq_string(tags[2], outputs[2]); cx_strfreev((cxchar**)tags); tags = NULL; cpl_recipeconfig_delete(config); config = NULL; /* * Test 5: Create a recipe configuration object, add a configuration * tag, and check that adding the same tag properly replaces * the previous settings. */ config = cpl_recipeconfig_new(); cpl_test_nonnull(config); status = cpl_recipeconfig_set_tag(config, frames[0].tag, 1, -1); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); cpl_test_eq(cpl_recipeconfig_get_min_count(config, frames[0].tag, frames[0].tag), 1); cpl_test_eq(cpl_recipeconfig_get_max_count(config, frames[0].tag, frames[0].tag), -1); cpl_test_eq(cpl_recipeconfig_is_required(config, frames[0].tag, frames[0].tag), 1); status = cpl_recipeconfig_set_input(config, frames[0].tag, inputs[0].tag, 0, 5); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); cpl_test_zero(cpl_recipeconfig_get_min_count(config, frames[0].tag, inputs[0].tag)); cpl_test_eq(cpl_recipeconfig_get_max_count(config, frames[0].tag, inputs[0].tag), 5); cpl_test_zero(cpl_recipeconfig_is_required(config, frames[0].tag, inputs[0].tag)); status = cpl_recipeconfig_set_tag(config, frames[0].tag, 2, 5); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); cpl_test_eq(cpl_recipeconfig_get_min_count(config, frames[0].tag, frames[0].tag), 2); cpl_test_eq(cpl_recipeconfig_get_max_count(config, frames[0].tag, frames[0].tag), 5); cpl_test_eq(cpl_recipeconfig_is_required(config, frames[0].tag, frames[0].tag), 1); status = cpl_recipeconfig_set_input(config, frames[0].tag, inputs[0].tag, 1, -1); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); cpl_test_eq(cpl_recipeconfig_get_min_count(config, frames[0].tag, inputs[0].tag), 1); cpl_test_eq(cpl_recipeconfig_get_max_count(config, frames[0].tag, inputs[0].tag), -1); cpl_test_eq(cpl_recipeconfig_is_required(config, frames[0].tag, inputs[0].tag), 1); cpl_recipeconfig_delete(config); config = NULL; /* * Test 6: Create a recipe configuration object, add multiple * configurations. Check the object. */ config = cpl_recipeconfig_new(); cpl_test_nonnull(config); status = cpl_recipeconfig_set_tags(config, frames); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); tags = cpl_recipeconfig_get_tags(config); cpl_test_nonnull(tags); cpl_test_eq_string(tags[0], frames[0].tag); cpl_test_eq_string(tags[1], frames[1].tag); cpl_test_null(tags[2]); cpl_test_eq(cpl_recipeconfig_get_min_count(config, frames[0].tag, frames[0].tag), frames[0].min_count); cpl_test_eq(cpl_recipeconfig_get_max_count(config, frames[0].tag, frames[0].tag), frames[0].max_count); cpl_test_eq(cpl_recipeconfig_is_required(config, frames[0].tag, frames[0].tag), (frames[0].min_count > 0)); cpl_test_eq(cpl_recipeconfig_get_min_count(config, frames[1].tag, frames[1].tag), frames[1].min_count); cpl_test_eq(cpl_recipeconfig_get_max_count(config, frames[1].tag, frames[1].tag), frames[1].max_count); cpl_test_eq(cpl_recipeconfig_is_required(config, frames[1].tag, frames[1].tag), (frames[1].min_count > 0)); cx_strfreev((cxchar**)tags); tags = NULL; status = cpl_recipeconfig_set_inputs(config, frames[0].tag, inputs); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); tags = cpl_recipeconfig_get_inputs(config, frames[0].tag); cpl_test_nonnull(tags); cpl_test_eq_string(tags[0], inputs[0].tag); cpl_test_eq_string(tags[1], inputs[1].tag); cpl_test_eq_string(tags[2], inputs[2].tag); cpl_test_null(tags[3]); cx_strfreev((cxchar**)tags); tags = NULL; status = cpl_recipeconfig_set_outputs(config, frames[0].tag, outputs); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); tags = cpl_recipeconfig_get_outputs(config, frames[0].tag); cpl_test_nonnull(tags); cpl_test_eq_string(tags[0], outputs[0]); cpl_test_eq_string(tags[1], outputs[1]); cpl_test_eq_string(tags[2], outputs[2]); cpl_test_null(tags[3]); cx_strfreev((cxchar**)tags); tags = NULL; status = cpl_recipeconfig_set_inputs(config, frames[1].tag, _inputs); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); tags = cpl_recipeconfig_get_inputs(config, frames[1].tag); cpl_test_nonnull(tags); cpl_test_eq_string(tags[0], _inputs[0].tag); cpl_test_eq_string(tags[1], _inputs[1].tag); cpl_test_eq_string(tags[2], _inputs[2].tag); cpl_test_null(tags[3]); cx_strfreev((cxchar**)tags); tags = NULL; status = cpl_recipeconfig_set_outputs(config, frames[1].tag, outputs); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); tags = cpl_recipeconfig_get_outputs(config, frames[1].tag); cpl_test_nonnull(tags); cpl_test_eq_string(tags[0], outputs[0]); cpl_test_eq_string(tags[1], outputs[1]); cpl_test_eq_string(tags[2], outputs[2]); cpl_test_null(tags[3]); cx_strfreev((cxchar**)tags); tags = NULL; cpl_recipeconfig_delete(config); config = NULL; /* * Test 7: Create a recipe configuration object and check that * input and output configurations cannot be added without * adding the configuration tags before. */ config = cpl_recipeconfig_new(); cpl_test_nonnull(config); status = cpl_recipeconfig_set_input(config, frames[0].tag, inputs[0].tag, -1, -1); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, 1); status = cpl_recipeconfig_set_inputs(config, frames[0].tag, inputs); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, 1); status = cpl_recipeconfig_set_output(config, frames[0].tag, outputs[0]); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, 1); status = cpl_recipeconfig_set_outputs(config, frames[0].tag, outputs); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, 1); cpl_recipeconfig_delete(config); config = NULL; /* * Test 8: Create a recipe configuration object and check that * a configuration tag cannot be reused as input frame * tag. */ config = cpl_recipeconfig_new(); cpl_test_nonnull(config); status = cpl_recipeconfig_set_tag(config, frames[0].tag, -1, -1); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); status = cpl_recipeconfig_set_input(config, frames[0].tag, frames[0].tag, -1, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(status, -1); cpl_recipeconfig_delete(config); config = NULL; /* * Test 9: Check error conditions of the member functions. */ config = cpl_recipeconfig_new(); cpl_test_nonnull(config); status = cpl_recipeconfig_set_tag(config, frames[0].tag, -1, -1); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); tags = cpl_recipeconfig_get_tags(NULL); cpl_test_null(tags); cpl_test_error(CPL_ERROR_NULL_INPUT); tags = cpl_recipeconfig_get_inputs(NULL, frames[0].tag); cpl_test_null(tags); cpl_test_error(CPL_ERROR_NULL_INPUT); tags = cpl_recipeconfig_get_inputs(config, NULL); cpl_test_null(tags); cpl_test_error(CPL_ERROR_NULL_INPUT); tags = cpl_recipeconfig_get_inputs(config, ""); cpl_test_null(tags); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); tags = cpl_recipeconfig_get_inputs(config, frames[1].tag); cpl_test_null(tags); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); tags = cpl_recipeconfig_get_outputs(NULL, frames[0].tag); cpl_test_null(tags); cpl_test_error(CPL_ERROR_NULL_INPUT); tags = cpl_recipeconfig_get_outputs(config, NULL); cpl_test_null(tags); cpl_test_error(CPL_ERROR_NULL_INPUT); tags = cpl_recipeconfig_get_outputs(config, ""); cpl_test_null(tags); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); tags = cpl_recipeconfig_get_outputs(config, frames[1].tag); cpl_test_null(tags); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); status = cpl_recipeconfig_get_min_count(NULL, frames[0].tag, inputs[0].tag); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_min_count(config, NULL, inputs[0].tag); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_min_count(config, "", inputs[0].tag); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_min_count(config, frames[1].tag, inputs[0].tag); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_min_count(config, frames[0].tag, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_min_count(config, frames[0].tag, ""); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_min_count(config, frames[0].tag, inputs[1].tag); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_max_count(NULL, frames[0].tag, inputs[0].tag); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_max_count(config, NULL, inputs[0].tag); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_max_count(config, "", inputs[0].tag); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_max_count(config, frames[1].tag, inputs[0].tag); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_max_count(config, frames[0].tag, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_max_count(config, frames[0].tag, ""); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, -1); status = cpl_recipeconfig_get_max_count(config, frames[0].tag, inputs[1].tag); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, -1); status = cpl_recipeconfig_is_required(NULL, frames[0].tag, inputs[0].tag); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_is_required(config, NULL, inputs[0].tag); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_is_required(config, "", inputs[0].tag); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, -1); status = cpl_recipeconfig_is_required(config, frames[1].tag, inputs[0].tag); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, -1); status = cpl_recipeconfig_is_required(config, frames[0].tag, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_is_required(config, frames[0].tag, ""); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, -1); status = cpl_recipeconfig_is_required(config, frames[0].tag, inputs[1].tag); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_tag(NULL, frames[1].tag, -1, -1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_tag(config, NULL, -1, -1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_tag(config, "", -1, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_input(NULL, frames[0].tag, inputs[0].tag, -1, -1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_input(config, NULL, inputs[0].tag, -1, -1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_input(config, "", inputs[0].tag, -1, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_input(config, frames[1].tag, inputs[0].tag, -1, -1); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, 2); status = cpl_recipeconfig_set_input(config, frames[0].tag, NULL, -1, -1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_input(config, frames[0].tag, "", -1, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_input(config, frames[0].tag, frames[0].tag, -1, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_output(NULL, frames[0].tag, outputs[0]); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_output(config, NULL, outputs[0]); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_output(config, "", outputs[0]); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_output(config, frames[0].tag, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_output(config, frames[0].tag, ""); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_tags(NULL, frames); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_tags(config, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); status = cpl_recipeconfig_set_tags(config, bad); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(status, 1); status = cpl_recipeconfig_set_inputs(NULL, frames[0].tag, inputs); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_inputs(config, NULL, inputs); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_inputs(config, "", inputs); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_inputs(config, frames[1].tag, inputs); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, 2); status = cpl_recipeconfig_set_inputs(config, frames[0].tag, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); status = cpl_recipeconfig_set_inputs(config, frames[0].tag, bad); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(status, 3); status = cpl_recipeconfig_set_outputs(NULL, frames[0].tag, outputs); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_outputs(config, NULL, outputs); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_outputs(config, "", outputs); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(status, -1); status = cpl_recipeconfig_set_outputs(config, frames[1].tag, outputs); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_eq(status, 2); status = cpl_recipeconfig_set_outputs(config, frames[0].tag, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(status); status = cpl_recipeconfig_set_outputs(config, frames[0].tag, _bad); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(status, 3); cpl_recipeconfig_delete(config); config = NULL; /* * All tests finished */ return cpl_test_end(0); } cpl-6.4.1/cplui/tests/cpl_frameset_io-test.c0000644000460300003120000002315212252327513015751 00000000000000/* $Id: cpl_frameset_io-test.c,v 1.23 2012-07-30 18:05:38 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-07-30 18:05:38 $ * $Revision: 1.23 $ * $Name: not supported by cvs2svn $ */ #undef CX_DISABLE_ASSERT #undef CX_LOG_DOMAIN #include "cpl_test.h" #include "cpl_fits.h" #include #include #include #include #include #include #include "cpl_frameset_io.h" #include "cpl_image_io.h" #ifndef IMAGESZ #define IMAGESZ 512 #endif int main(void) { const cxchar *names[] = { "cpl_frameset-io_test1.fits", "cpl_frameset-io_test2.fits", "cpl_frameset-io_test3.fits", "cpl_frameset-io_test4.fits", }; const cxchar *tags[] = { "FLAT", "FLAT", "FLAT", "FLAT", }; cpl_frame_group groups[] = { CPL_FRAME_GROUP_RAW, CPL_FRAME_GROUP_RAW, CPL_FRAME_GROUP_RAW, CPL_FRAME_GROUP_RAW, }; cpl_frame_level levels[] = { CPL_FRAME_LEVEL_NONE, CPL_FRAME_LEVEL_NONE, CPL_FRAME_LEVEL_NONE, CPL_FRAME_LEVEL_NONE, }; cxlong i; cxlong has_primary; cpl_frameset *frameset; cpl_image *img1; cpl_imagelist *imlist; cpl_error_code error; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ /* * Test 1A: Create a frameset and check its validity. */ frameset = cpl_frameset_new(); cpl_test_nonnull(frameset); cpl_test(cpl_frameset_is_empty(frameset)); cpl_test_zero(cpl_frameset_get_size(frameset)); /* * Test 1B: Load everything from an empty frameset * - should fail, since the created imagelist may not be empty */ imlist = cpl_imagelist_load_frameset(frameset, CPL_TYPE_FLOAT, 0, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(imlist); /* * Test 2A: Test error-handling of cpl_imagelist_load_frameset() */ imlist = cpl_imagelist_load_frameset(NULL, CPL_TYPE_FLOAT, 0, -1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(imlist); /* Add frames to the frame set created in the previous test and verify the data.*/ /* The corresponding files do not exist yet */ for (i = 0; (cxsize)i < CX_N_ELEMENTS(names); i++) { cpl_frame *_frame = cpl_frame_new(); remove(names[i]); error = cpl_frame_set_filename(_frame, names[i]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_tag(_frame, tags[i]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_type(_frame, CPL_FRAME_TYPE_IMAGE); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_group(_frame, groups[i]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_level(_frame, levels[i]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frameset_insert(frameset, _frame); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_test_zero(cpl_frameset_is_empty(frameset)); cpl_test_eq(cpl_frameset_get_size(frameset), CX_N_ELEMENTS(names)); cpl_test_eq(cpl_frameset_count_tags(frameset, tags[0]), 4); /* * Test 2B: Test error-handling of cpl_imagelist_load_frameset() with missing files. */ imlist = cpl_imagelist_load_frameset(frameset, CPL_TYPE_FLOAT, 0, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(imlist); img1 = cpl_image_fill_test_create(IMAGESZ, IMAGESZ); cpl_test_nonnull(img1); /* * Test 2BB: Test error-handling of cpl_imagelist_load_frameset() on frame with a single image in primary HDU and more than one image in 1st extension. */ /* Create file, with image */ error = cpl_image_save(img1, names[0], CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); imlist = cpl_imagelist_new(); error = cpl_imagelist_set(imlist, cpl_image_duplicate(img1), 0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(imlist, cpl_image_duplicate(img1), 1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_save(imlist, names[0], CPL_TYPE_FLOAT, NULL, CPL_IO_EXTEND); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_imagelist_delete(imlist); /* Replicate the file */ for (i = 1; (cxsize)i < CX_N_ELEMENTS(names); i++) { char * cmd = cpl_sprintf("cp %s %s", names[0], names[i]); cpl_test_zero(system(cmd)); cpl_free(cmd); } imlist = cpl_imagelist_load_frameset(frameset, CPL_TYPE_FLOAT, 2, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(imlist); /* * Create images to insert into frameset * First case: primary HDU image is NULL */ for (has_primary = 0; has_primary <= 1; has_primary++) { const cxsize isave = 1; cxlong ii; /* The fits file contains three or four images */ const cxlong nimg = 3 + has_primary; cxlong iplane; cpl_msg_info(cpl_func, "Testing with %u frames and %d X %d-images, " "has_primary=%d", (unsigned)CX_N_ELEMENTS(names), IMAGESZ, IMAGESZ, (int)has_primary); /* Replicate the file */ for (ii = 0; (cxsize)ii < isave; ii++) { /* Create file, either with or without image */ error = cpl_image_save(has_primary ? img1 : NULL, names[ii], CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Append some extensions */ for (i = has_primary; i < nimg; i++) { /* Append an extension */ error = cpl_image_save(img1, names[ii], CPL_TYPE_FLOAT, NULL, CPL_IO_EXTEND); cpl_test_eq_error(error, CPL_ERROR_NONE); } } for (i = isave; (cxsize)i < CX_N_ELEMENTS(names); i++) { char * cmd = cpl_sprintf("cp %s %s", names[0], names[i]); cpl_test_zero(system(cmd)); cpl_free(cmd); } if (has_primary) { /* If the above cp'ed FITS files are cached by CPL, then the cache is dirty, so refresh it */ if (cpl_fits_get_mode() == CPL_FITS_START_CACHING) cpl_fits_set_mode(CPL_FITS_RESTART_CACHING); } /* * Test 2D: Test error-handling of cpl_imagelist_load_frameset() with invalid type. */ imlist = cpl_imagelist_load_frameset(frameset, CPL_TYPE_INVALID, 0, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(imlist); /* * Test 2E: Test error-handling of cpl_imagelist_load_frameset() with invalid plane number. */ imlist = cpl_imagelist_load_frameset(frameset, CPL_TYPE_FLOAT, 2, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(imlist); /* * Test 2F: Test error-handling of cpl_imagelist_load_frameset() with invalid extension number. */ imlist = cpl_imagelist_load_frameset(frameset, CPL_TYPE_FLOAT, 0, 1+nimg); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(imlist); /* * Test 3: Load frameset into imagelist, asking for all (1) plane(s) * in one extension. */ for (iplane = 0; iplane <= 1; iplane++) { for (i = 0; i < nimg; i++) { imlist = cpl_imagelist_load_frameset(frameset, CPL_TYPE_FLOAT, iplane, i+1-has_primary); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(imlist); cpl_test_eq(cpl_imagelist_get_size(imlist), cpl_frameset_get_size(frameset)); cpl_imagelist_delete(imlist); } } /* * Test 4: Load frameset into imagelist, asking for all (1) plane(s) in all extensions. */ for (iplane = 0; iplane <= 1; iplane++) { imlist = cpl_imagelist_load_frameset(frameset, CPL_TYPE_FLOAT, iplane, -1); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(imlist); cpl_test_eq(cpl_imagelist_get_size(imlist), nimg * cpl_frameset_get_size(frameset)); cpl_imagelist_delete(imlist); } } cpl_image_delete(img1); cpl_frameset_delete(frameset); if (!cpl_error_get_code()) { for (i = 0; (cxsize)i < CX_N_ELEMENTS(names); i++) { cpl_test_zero(remove(names[i])); } } return cpl_test_end(0); } cpl-6.4.1/cplui/tests/cpl_frameset-test.c0000644000460300003120000002536712253113101015257 00000000000000/* $Id: cpl_frameset-test.c,v 1.22 2012-01-11 13:38:29 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-01-11 13:38:29 $ * $Revision: 1.22 $ * $Name: not supported by cvs2svn $ */ #include #include #include #include #include "cpl_frameset.h" #include #include static int nframe = 0; static int frame_equal(const cpl_frame * frame1, const cpl_frame * frame2) { if (frame1 == NULL) return -1; if (frame2 == NULL) return -1; return 1; } static int frame_differ(const cpl_frame * frame1, const cpl_frame * frame2) { if (frame1 == NULL) return -1; if (frame2 == NULL) return -1; return frame1 == frame2 ? 1 : 0; } static int frame_oddeven(const cpl_frame * frame1, const cpl_frame * frame2) { if (frame1 == NULL) return -1; if (frame2 == NULL) return -1; if (frame1 == frame2) return 1; return (nframe++ & 1); } int main(void) { const char *names[] = { "flat1.fits", "flat2.fits", "flat3.fits", "bias1.fits", "bias2.fits", "bias3.fits", "mbias.fits", "mflat.fits", "science.fits", "product.fits" }; const char *tags[] = { "FLAT", "FLAT", "FLAT", "BIAS", "BIAS", "BIAS", "MASTER_BIAS", "MASTER_FLAT", "SCIENCE", "SCIENCE_CALIBRATED" }; cpl_frame_group groups[] = { CPL_FRAME_GROUP_RAW, CPL_FRAME_GROUP_RAW, CPL_FRAME_GROUP_RAW, CPL_FRAME_GROUP_RAW, CPL_FRAME_GROUP_RAW, CPL_FRAME_GROUP_RAW, CPL_FRAME_GROUP_CALIB, CPL_FRAME_GROUP_CALIB, CPL_FRAME_GROUP_RAW, CPL_FRAME_GROUP_PRODUCT }; cpl_frame_level levels[] = { CPL_FRAME_LEVEL_NONE, CPL_FRAME_LEVEL_NONE, CPL_FRAME_LEVEL_NONE, CPL_FRAME_LEVEL_NONE, CPL_FRAME_LEVEL_NONE, CPL_FRAME_LEVEL_NONE, CPL_FRAME_LEVEL_NONE, CPL_FRAME_LEVEL_NONE, CPL_FRAME_LEVEL_NONE, CPL_FRAME_LEVEL_FINAL }; long i; const char *filename1 = "cplframesetdump.txt"; cpl_frame *frame; cpl_frame *_frame; cpl_frameset *frameset; cpl_frameset *_frameset; cpl_frameset_iterator *it = NULL; cpl_frameset_iterator *_it = NULL; cpl_frameset *allframes; FILE *out; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ /* * Test 1: Create a frameset and check its validity. */ frameset = cpl_frameset_new(); cpl_test_nonnull(frameset); cpl_test(cpl_frameset_is_empty(frameset)); cpl_test_zero(cpl_frameset_get_size(frameset)); /* * Test 2: Add frames to the frame set created in the previous test * and verify the data. */ for (i = 0; (size_t)i < CX_N_ELEMENTS(names); i++) { _frame = cpl_frame_new(); cpl_frame_set_filename(_frame, names[i]); cpl_frame_set_tag(_frame, tags[i]); cpl_frame_set_type(_frame, CPL_FRAME_TYPE_IMAGE); cpl_frame_set_group(_frame, groups[i]); cpl_frame_set_level(_frame, levels[i]); cpl_frameset_insert(frameset, _frame); } cpl_test_zero(cpl_frameset_is_empty(frameset)); cpl_test_eq(cpl_frameset_get_size(frameset), CX_N_ELEMENTS(names)); cpl_test_eq(cpl_frameset_count_tags(frameset, tags[0]), 3); cpl_test_eq(cpl_frameset_count_tags(frameset, tags[3]), 3); cpl_test_eq(cpl_frameset_count_tags(frameset, tags[6]), 1); cpl_test_eq(cpl_frameset_count_tags(frameset, tags[7]), 1); cpl_test_eq(cpl_frameset_count_tags(frameset, tags[8]), 1); cpl_test_eq(cpl_frameset_count_tags(frameset, tags[9]), 1); /* * Test 2a: Dump the frameset into a file in disk */ out = fopen(filename1, "w"); cpl_frameset_dump(frameset, out); fclose (out); allframes = cpl_frameset_duplicate(frameset); /* * Test 3: Lookup frames in the set and verify that the right frames * are found. */ frame = cpl_frameset_find(frameset, tags[0]); cpl_test_eq_string(cpl_frame_get_filename(frame), names[0]); frame = cpl_frameset_find(frameset, NULL); cpl_test_eq_string(cpl_frame_get_filename(frame), names[1]); frame = cpl_frameset_find(frameset, NULL); cpl_test_eq_string(cpl_frame_get_filename(frame), names[2]); cpl_test_null(cpl_frameset_find(frameset, NULL)); /* * Test 4: Verify that the internal cache is reset correctly. */ cpl_frameset_find(frameset, tags[0]); frame = cpl_frameset_find(frameset, NULL); cpl_test_eq_string(cpl_frame_get_filename(frame), names[1]); cpl_frameset_find(frameset, tags[3]); frame = cpl_frameset_find(frameset, NULL); cpl_test_eq_string(cpl_frame_get_filename(frame), names[4]); /* * Test 5: Check side effects when mixing calls to * cpl_frameset_find with iterators. */ it = cpl_frameset_iterator_new(frameset); cpl_frameset_find(frameset, tags[3]); frame = cpl_frameset_find(frameset, NULL); cpl_test_eq_string(cpl_frame_get_filename(frame), names[4]); frame = cpl_frameset_iterator_get(it); cpl_test_eq_string(cpl_frame_get_filename(frame), names[0]); frame = cpl_frameset_find(frameset, NULL); cpl_test_eq_string(cpl_frame_get_filename(frame), names[5]); cpl_frameset_iterator_advance(it, 1); frame = cpl_frameset_iterator_get(it); cpl_test_eq_string(cpl_frame_get_filename(frame), names[1]); /* Skip to flat1.fits */ cpl_frameset_iterator_reset(it); frame = cpl_frameset_iterator_get(it); cpl_test_eq_string(cpl_frame_get_filename(frame), names[0]); cpl_frameset_find(frameset, tags[8]); cpl_frameset_iterator_advance(it, 1); frame = cpl_frameset_iterator_get(it); cpl_test_eq_string(cpl_frame_get_filename(frame), names[1]); cpl_frameset_iterator_delete(it); it = NULL; /* * Test 6: Erase frames by tag from the frame set and verify the set * structure and its contents. */ cpl_test_eq(cpl_frameset_erase(frameset, tags[0]), 3); cpl_test_eq(cpl_frameset_get_size(frameset), (CX_N_ELEMENTS(tags) - 3)); cpl_test_zero(cpl_frameset_count_tags(frameset, tags[0])); /* * Test 7: Erase frames from the frame set and verify the set * structure and its contents. */ frame = cpl_frameset_find(frameset, tags[3]); while (frame) { cpl_frame *f = frame; frame = cpl_frameset_find(frameset, NULL); cpl_frameset_erase_frame(frameset, f); }; cpl_test_eq(cpl_frameset_get_size(frameset), (CX_N_ELEMENTS(tags) - 6)); cpl_test_zero(cpl_frameset_count_tags(frameset, tags[3])); i = 6; it = cpl_frameset_iterator_new(frameset); cpl_frameset_iterator_advance(it, i); frame = cpl_frameset_iterator_get(it); while (frame) { cpl_test_eq_string(cpl_frame_get_filename(frame), names[i++]); cpl_frameset_iterator_advance(it, 1); frame = cpl_frameset_iterator_get(it); } cpl_frameset_iterator_delete(it); it = NULL; /* * Test 8: Create a copy of the frame set and verify that original and * copy are identical but do not share any resources. */ _frameset = cpl_frameset_duplicate(frameset); cpl_test_nonnull(_frameset); cpl_test_noneq_ptr(_frameset, frameset); cpl_test_eq(cpl_frameset_get_size(_frameset), cpl_frameset_get_size(frameset)); it = cpl_frameset_iterator_new(frameset); _it = cpl_frameset_iterator_new(_frameset); frame = cpl_frameset_iterator_get(it); _frame = cpl_frameset_iterator_get(_it); while (frame) { cpl_test_noneq_ptr(cpl_frame_get_filename(_frame), cpl_frame_get_filename(frame)); cpl_test_eq_string(cpl_frame_get_filename(_frame), cpl_frame_get_filename(frame)); cpl_test_noneq_ptr(cpl_frame_get_tag(_frame), cpl_frame_get_tag(frame)); cpl_test_eq_string(cpl_frame_get_tag(_frame), cpl_frame_get_tag(frame)); cpl_frameset_iterator_advance(it, 1); cpl_frameset_iterator_advance(_it, 1); frame = cpl_frameset_iterator_get(it); _frame = cpl_frameset_iterator_get(_it); } cpl_test_null(_frame); cpl_frameset_iterator_delete(_it); cpl_frameset_iterator_delete(it); /* * Test 9: Tests of cpl_frameset_labelise() and cpl_frameset_extract(). */ { cpl_size nlabs; const cpl_size *labnull = cpl_frameset_labelise(allframes, NULL, &nlabs); cpl_size *labels; const cpl_frameset * setnull; cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(labnull); setnull = cpl_frameset_extract(allframes, labnull, 0); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(setnull); /* All frames are equal */ labels = cpl_frameset_labelise(allframes, frame_equal, &nlabs); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(labels); cpl_test_eq(nlabs, 1); while (nlabs-- > 0) { cpl_test_eq(labels[nlabs], nlabs); } cpl_free(labels); /* All frames differ */ labels = cpl_frameset_labelise(allframes, frame_differ, &nlabs); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(labels); cpl_test_eq(nlabs, cpl_frameset_get_size(allframes)); while (nlabs-- > 0) { cpl_test_eq(labels[nlabs], nlabs); } cpl_free(labels); /* Two labels */ labels = cpl_frameset_labelise(allframes, frame_oddeven, &nlabs); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(labels); cpl_test_eq(nlabs, 2); cpl_free(labels); } cpl_frameset_delete(_frameset); cpl_frameset_delete(frameset); cpl_frameset_delete(allframes); /* End of tests */ return cpl_test_end(0); } cpl-6.4.1/cplui/tests/cpl_frame-test.c0000644000460300003120000001472511703310325014545 00000000000000/* $Id: cpl_frame-test.c,v 1.19 2012-01-11 13:38:29 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-01-11 13:38:29 $ * $Revision: 1.19 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #ifdef HAVE_UNISTD_H # include #endif #include #include "cpl_test.h" #include "cpl_frame.h" #include "cpl_frame_impl.h" #include "cpl_error.h" int main(void) { int i; int next; cpl_size np; int status = 0; const char *filename = "cplframetest1.fits"; const char *filename1 = "cplframeplane.fits"; const char *filename2 = "cplframedump.txt"; const long naxes[2] = {256, 256}; const long nplanes[3] = {128, 256, 64}; cpl_frame *frame, *_frame; fitsfile *file = NULL; cpl_error_code error; FILE * out; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* * Test 1: Create a frame, check its validity and destroy it * again. */ frame = cpl_frame_new(); cpl_test_nonnull(frame); cpl_test_null(cpl_frame_get_filename(frame) ); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(cpl_frame_get_tag(frame) ); cpl_test_eq(cpl_frame_get_type(frame), CPL_FRAME_TYPE_NONE); cpl_test_eq(cpl_frame_get_group(frame), CPL_FRAME_GROUP_NONE); cpl_test_eq(cpl_frame_get_level(frame), CPL_FRAME_LEVEL_NONE); cpl_test_error(CPL_ERROR_NONE); cpl_frame_delete(frame); /* * Test 2: Create a frame, set its fields and verify the settings. */ frame = cpl_frame_new(); cpl_test_nonnull(frame); error = cpl_frame_set_filename(frame, "path_to_file"); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq_string(cpl_frame_get_filename(frame), "path_to_file"); error = cpl_frame_set_tag(frame, "This is a tag"); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq_string(cpl_frame_get_tag(frame), "This is a tag"); error = cpl_frame_set_type(frame, CPL_FRAME_TYPE_MATRIX); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_frame_get_type(frame), CPL_FRAME_TYPE_MATRIX); error = cpl_frame_set_group(frame, CPL_FRAME_GROUP_PRODUCT); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_frame_get_group(frame), CPL_FRAME_GROUP_PRODUCT); error = cpl_frame_set_level(frame, CPL_FRAME_LEVEL_TEMPORARY); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_frame_get_level(frame), CPL_FRAME_LEVEL_TEMPORARY); /* * Test 3: Create a copy of the frame and verify that original * and copy are identical but do not share any resources. */ _frame = cpl_frame_duplicate(frame); cpl_test_nonnull(_frame); cpl_test(_frame != frame); cpl_test(cpl_frame_get_filename(frame) != cpl_frame_get_filename(_frame)); cpl_test(cpl_frame_get_tag(frame) != cpl_frame_get_tag(_frame)); cpl_test_eq_string(cpl_frame_get_filename(frame), cpl_frame_get_filename(_frame)); cpl_test_eq_string(cpl_frame_get_tag(frame), cpl_frame_get_tag(_frame)); cpl_test_eq(cpl_frame_get_type(frame), cpl_frame_get_type(_frame)); cpl_test_eq(cpl_frame_get_group(frame), cpl_frame_get_group(_frame)); cpl_test_eq(cpl_frame_get_level(frame), cpl_frame_get_level(_frame)); cpl_frame_delete(_frame); cpl_frame_delete(frame); (void)remove(filename); status = 0; fits_create_diskfile(&file, filename, &status); cpl_test_zero(status); /* * Create first HDU */ fits_create_img(file, 8, 0, (long*)naxes, &status); cpl_test_zero(status); /* * Create 3 extensions */ for(i = 0; i < 3; i++) { fits_insert_img(file, 16, 2, (long*)naxes, &status); cpl_test_zero(status); } fits_close_file(file, &status); cpl_test_zero(status); frame = cpl_frame_new(); cpl_test_nonnull(frame); error = cpl_frame_set_filename(frame, filename); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq_string(cpl_frame_get_filename(frame), filename); next = cpl_frame_get_nextensions(frame); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(next, 3); cpl_frame_delete(frame); /* * * Test 3: Query the number of planes */ (void)remove(filename1); status = 0; fits_create_diskfile(&file, filename1, &status); cpl_test_zero(status); /* * Create first HDU */ fits_create_img(file, 8, 0, (long*)nplanes, &status); cpl_test_zero(status); fits_insert_img(file, 8, 3, (long*)nplanes, &status); cpl_test_zero(status); fits_close_file(file, &status); cpl_test_zero(status); frame = cpl_frame_new(); cpl_test_nonnull(frame); error = cpl_frame_set_filename(frame, filename1); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq_string(cpl_frame_get_filename(frame), filename1); np = cpl_frame_get_nplanes(frame, 1); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(np, 64); /* * Test 4: Dump the frame in a file in disk */ error = cpl_frame_set_tag(frame, "CALIB"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_type(frame, CPL_FRAME_TYPE_IMAGE); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_group(frame, CPL_FRAME_GROUP_PRODUCT); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_level(frame, CPL_FRAME_LEVEL_TEMPORARY); cpl_test_eq_error(error, CPL_ERROR_NONE); out = fopen(filename2, "w"); cpl_test_nonnull(out); cpl_frame_dump(frame, out); cpl_test_zero(fclose(out)); cpl_frame_delete(frame); /* * All tests finished */ return cpl_test_end(0); } cpl-6.4.1/cplui/tests/Makefile.am0000644000460300003120000000551212127227645013537 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO Common Pipeline Library ## Copyright (C) 2001-2006 European Southern Observatory ## 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 2 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 02111-1307 USA AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ if MAINTAINER_MODE MAINTAINERCLEANFILES = $(srcdir)/Makefile.in endif LDADD = $(LIBCPLUI) $(LIBCPLCORE) $(LIBCFITSIO) $(LIBCEXT) AM_CPPFLAGS = $(CPLUI_INCLUDES) $(CPLCORE_INCLUDES) $(CX_INCLUDES) \ $(CFITSIO_INCLUDES) AM_LDFLAGS = $(CFITSIO_LDFLAGS) check_PROGRAMS = cpl_frame-test \ cpl_frameset-test \ cpl_frameset_io-test \ cpl_parameter-test \ cpl_parameterlist-test \ cpl_plugin-test \ cpl_pluginlist-test \ cpl_framedata-test \ cpl_recipedefine-test \ cpl_recipeconfig-test cpl_frame_test_SOURCES = cpl_frame-test.c cpl_frameset_test_SOURCES = cpl_frameset-test.c cpl_frameset_io_test_SOURCES = cpl_frameset_io-test.c cpl_parameter_test_SOURCES = cpl_parameter-test.c cpl_parameterlist_test_SOURCES = cpl_parameterlist-test.c cpl_plugin_test_SOURCES = cpl_plugin-test.c cpl_pluginlist_test_SOURCES = cpl_pluginlist-test.c cpl_framedata_test_SOURCES = cpl_framedata-test.c cpl_recipedefine_test_SOURCES = cpl_recipedefine-test.c cpl_recipeconfig_test_SOURCES = cpl_recipeconfig-test.c # Be sure to reexport important environment variables. TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" TESTS = cpl_frame-test \ cpl_frameset-test \ cpl_frameset_io-test \ cpl_parameter-test \ cpl_parameterlist-test \ cpl_plugin-test \ cpl_pluginlist-test \ cpl_framedata-test \ cpl_recipedefine-test \ cpl_recipeconfig-test XFAIL_TESTS = # We need to remove any files that the above tests created. clean-local: $(RM) *.fits *.tfits *.log if USE_PURIFY include $(top_builddir)/Makefile.purify endif cpl-6.4.1/cplui/tests/Makefile.in0000644000460300003120000012463012310332724013540 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = cpl_frame-test$(EXEEXT) cpl_frameset-test$(EXEEXT) \ cpl_frameset_io-test$(EXEEXT) cpl_parameter-test$(EXEEXT) \ cpl_parameterlist-test$(EXEEXT) cpl_plugin-test$(EXEEXT) \ cpl_pluginlist-test$(EXEEXT) cpl_framedata-test$(EXEEXT) \ cpl_recipedefine-test$(EXEEXT) cpl_recipeconfig-test$(EXEEXT) TESTS = cpl_frame-test$(EXEEXT) cpl_frameset-test$(EXEEXT) \ cpl_frameset_io-test$(EXEEXT) cpl_parameter-test$(EXEEXT) \ cpl_parameterlist-test$(EXEEXT) cpl_plugin-test$(EXEEXT) \ cpl_pluginlist-test$(EXEEXT) cpl_framedata-test$(EXEEXT) \ cpl_recipedefine-test$(EXEEXT) cpl_recipeconfig-test$(EXEEXT) XFAIL_TESTS = subdir = cplui/tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/admin/depcomp $(top_srcdir)/admin/test-driver ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/cpl.m4 $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/omp.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_cpl_frame_test_OBJECTS = cpl_frame-test.$(OBJEXT) cpl_frame_test_OBJECTS = $(am_cpl_frame_test_OBJECTS) cpl_frame_test_LDADD = $(LDADD) am__DEPENDENCIES_1 = cpl_frame_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_cpl_framedata_test_OBJECTS = cpl_framedata-test.$(OBJEXT) cpl_framedata_test_OBJECTS = $(am_cpl_framedata_test_OBJECTS) cpl_framedata_test_LDADD = $(LDADD) cpl_framedata_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_frameset_test_OBJECTS = cpl_frameset-test.$(OBJEXT) cpl_frameset_test_OBJECTS = $(am_cpl_frameset_test_OBJECTS) cpl_frameset_test_LDADD = $(LDADD) cpl_frameset_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_frameset_io_test_OBJECTS = cpl_frameset_io-test.$(OBJEXT) cpl_frameset_io_test_OBJECTS = $(am_cpl_frameset_io_test_OBJECTS) cpl_frameset_io_test_LDADD = $(LDADD) cpl_frameset_io_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_parameter_test_OBJECTS = cpl_parameter-test.$(OBJEXT) cpl_parameter_test_OBJECTS = $(am_cpl_parameter_test_OBJECTS) cpl_parameter_test_LDADD = $(LDADD) cpl_parameter_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_parameterlist_test_OBJECTS = cpl_parameterlist-test.$(OBJEXT) cpl_parameterlist_test_OBJECTS = $(am_cpl_parameterlist_test_OBJECTS) cpl_parameterlist_test_LDADD = $(LDADD) cpl_parameterlist_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_plugin_test_OBJECTS = cpl_plugin-test.$(OBJEXT) cpl_plugin_test_OBJECTS = $(am_cpl_plugin_test_OBJECTS) cpl_plugin_test_LDADD = $(LDADD) cpl_plugin_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_pluginlist_test_OBJECTS = cpl_pluginlist-test.$(OBJEXT) cpl_pluginlist_test_OBJECTS = $(am_cpl_pluginlist_test_OBJECTS) cpl_pluginlist_test_LDADD = $(LDADD) cpl_pluginlist_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_recipeconfig_test_OBJECTS = cpl_recipeconfig-test.$(OBJEXT) cpl_recipeconfig_test_OBJECTS = $(am_cpl_recipeconfig_test_OBJECTS) cpl_recipeconfig_test_LDADD = $(LDADD) cpl_recipeconfig_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_recipedefine_test_OBJECTS = cpl_recipedefine-test.$(OBJEXT) cpl_recipedefine_test_OBJECTS = $(am_cpl_recipedefine_test_OBJECTS) cpl_recipedefine_test_LDADD = $(LDADD) cpl_recipedefine_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(cpl_frame_test_SOURCES) $(cpl_framedata_test_SOURCES) \ $(cpl_frameset_test_SOURCES) $(cpl_frameset_io_test_SOURCES) \ $(cpl_parameter_test_SOURCES) \ $(cpl_parameterlist_test_SOURCES) $(cpl_plugin_test_SOURCES) \ $(cpl_pluginlist_test_SOURCES) \ $(cpl_recipeconfig_test_SOURCES) \ $(cpl_recipedefine_test_SOURCES) DIST_SOURCES = $(cpl_frame_test_SOURCES) $(cpl_framedata_test_SOURCES) \ $(cpl_frameset_test_SOURCES) $(cpl_frameset_io_test_SOURCES) \ $(cpl_parameter_test_SOURCES) \ $(cpl_parameterlist_test_SOURCES) $(cpl_plugin_test_SOURCES) \ $(cpl_pluginlist_test_SOURCES) \ $(cpl_recipeconfig_test_SOURCES) \ $(cpl_recipedefine_test_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/admin/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/admin/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFITSIO_INCLUDES = @CFITSIO_INCLUDES@ CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@ CFLAGS = @CFLAGS@ CPLCORE_INCLUDES = @CPLCORE_INCLUDES@ CPLDFS_INCLUDES = @CPLDFS_INCLUDES@ CPLDRS_INCLUDES = @CPLDRS_INCLUDES@ CPLUI_INCLUDES = @CPLUI_INCLUDES@ CPL_BINARY_AGE = @CPL_BINARY_AGE@ CPL_BINARY_VERSION = @CPL_BINARY_VERSION@ CPL_CFLAGS = @CPL_CFLAGS@ CPL_INTERFACE_AGE = @CPL_INTERFACE_AGE@ CPL_LDFLAGS = @CPL_LDFLAGS@ CPL_MAJOR_VERSION = @CPL_MAJOR_VERSION@ CPL_MICRO_VERSION = @CPL_MICRO_VERSION@ CPL_MINOR_VERSION = @CPL_MINOR_VERSION@ CPL_VERSION = @CPL_VERSION@ CPL_VERSION_STRING = @CPL_VERSION_STRING@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_INCLUDES = @CX_INCLUDES@ CX_LDFLAGS = @CX_LDFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FFTWF_INCLUDES = @FFTWF_INCLUDES@ FFTWF_LDFLAGS = @FFTWF_LDFLAGS@ FFTW_INCLUDES = @FFTW_INCLUDES@ FFTW_LDFLAGS = @FFTW_LDFLAGS@ FGREP = @FGREP@ GASGANO_CLASSPATH = @GASGANO_CLASSPATH@ GASGANO_SHREXT = @GASGANO_SHREXT@ GREP = @GREP@ INCLTDL = @INCLTDL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JAVA_INCLUDES = @JAVA_INCLUDES@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCEXT = @LIBCEXT@ LIBCFITSIO = @LIBCFITSIO@ LIBCPLCORE = @LIBCPLCORE@ LIBCPLDFS = @LIBCPLDFS@ LIBCPLDRS = @LIBCPLDRS@ LIBCPLUI = @LIBCPLUI@ LIBFFTW = @LIBFFTW@ LIBFFTWF = @LIBFFTWF@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBWCS = @LIBWCS@ LIPO = @LIPO@ LN_S = @LN_S@ LTDLDEPS = @LTDLDEPS@ LTDLINCL = @LTDLINCL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ WCS_INCLUDES = @WCS_INCLUDES@ WCS_LDFLAGS = @WCS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ cpl_includes = @cpl_includes@ cpl_libraries = @cpl_libraries@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libcext = @libcext@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in LDADD = $(LIBCPLUI) $(LIBCPLCORE) $(LIBCFITSIO) $(LIBCEXT) AM_CPPFLAGS = $(CPLUI_INCLUDES) $(CPLCORE_INCLUDES) $(CX_INCLUDES) \ $(CFITSIO_INCLUDES) AM_LDFLAGS = $(CFITSIO_LDFLAGS) cpl_frame_test_SOURCES = cpl_frame-test.c cpl_frameset_test_SOURCES = cpl_frameset-test.c cpl_frameset_io_test_SOURCES = cpl_frameset_io-test.c cpl_parameter_test_SOURCES = cpl_parameter-test.c cpl_parameterlist_test_SOURCES = cpl_parameterlist-test.c cpl_plugin_test_SOURCES = cpl_plugin-test.c cpl_pluginlist_test_SOURCES = cpl_pluginlist-test.c cpl_framedata_test_SOURCES = cpl_framedata-test.c cpl_recipedefine_test_SOURCES = cpl_recipedefine-test.c cpl_recipeconfig_test_SOURCES = cpl_recipeconfig-test.c # Be sure to reexport important environment variables. TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cplui/tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign cplui/tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list cpl_frame-test$(EXEEXT): $(cpl_frame_test_OBJECTS) $(cpl_frame_test_DEPENDENCIES) $(EXTRA_cpl_frame_test_DEPENDENCIES) @rm -f cpl_frame-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_frame_test_OBJECTS) $(cpl_frame_test_LDADD) $(LIBS) cpl_framedata-test$(EXEEXT): $(cpl_framedata_test_OBJECTS) $(cpl_framedata_test_DEPENDENCIES) $(EXTRA_cpl_framedata_test_DEPENDENCIES) @rm -f cpl_framedata-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_framedata_test_OBJECTS) $(cpl_framedata_test_LDADD) $(LIBS) cpl_frameset-test$(EXEEXT): $(cpl_frameset_test_OBJECTS) $(cpl_frameset_test_DEPENDENCIES) $(EXTRA_cpl_frameset_test_DEPENDENCIES) @rm -f cpl_frameset-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_frameset_test_OBJECTS) $(cpl_frameset_test_LDADD) $(LIBS) cpl_frameset_io-test$(EXEEXT): $(cpl_frameset_io_test_OBJECTS) $(cpl_frameset_io_test_DEPENDENCIES) $(EXTRA_cpl_frameset_io_test_DEPENDENCIES) @rm -f cpl_frameset_io-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_frameset_io_test_OBJECTS) $(cpl_frameset_io_test_LDADD) $(LIBS) cpl_parameter-test$(EXEEXT): $(cpl_parameter_test_OBJECTS) $(cpl_parameter_test_DEPENDENCIES) $(EXTRA_cpl_parameter_test_DEPENDENCIES) @rm -f cpl_parameter-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_parameter_test_OBJECTS) $(cpl_parameter_test_LDADD) $(LIBS) cpl_parameterlist-test$(EXEEXT): $(cpl_parameterlist_test_OBJECTS) $(cpl_parameterlist_test_DEPENDENCIES) $(EXTRA_cpl_parameterlist_test_DEPENDENCIES) @rm -f cpl_parameterlist-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_parameterlist_test_OBJECTS) $(cpl_parameterlist_test_LDADD) $(LIBS) cpl_plugin-test$(EXEEXT): $(cpl_plugin_test_OBJECTS) $(cpl_plugin_test_DEPENDENCIES) $(EXTRA_cpl_plugin_test_DEPENDENCIES) @rm -f cpl_plugin-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_plugin_test_OBJECTS) $(cpl_plugin_test_LDADD) $(LIBS) cpl_pluginlist-test$(EXEEXT): $(cpl_pluginlist_test_OBJECTS) $(cpl_pluginlist_test_DEPENDENCIES) $(EXTRA_cpl_pluginlist_test_DEPENDENCIES) @rm -f cpl_pluginlist-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_pluginlist_test_OBJECTS) $(cpl_pluginlist_test_LDADD) $(LIBS) cpl_recipeconfig-test$(EXEEXT): $(cpl_recipeconfig_test_OBJECTS) $(cpl_recipeconfig_test_DEPENDENCIES) $(EXTRA_cpl_recipeconfig_test_DEPENDENCIES) @rm -f cpl_recipeconfig-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_recipeconfig_test_OBJECTS) $(cpl_recipeconfig_test_LDADD) $(LIBS) cpl_recipedefine-test$(EXEEXT): $(cpl_recipedefine_test_OBJECTS) $(cpl_recipedefine_test_DEPENDENCIES) $(EXTRA_cpl_recipedefine_test_DEPENDENCIES) @rm -f cpl_recipedefine-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_recipedefine_test_OBJECTS) $(cpl_recipedefine_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_frame-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_framedata-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_frameset-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_frameset_io-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_parameter-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_parameterlist-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_plugin-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_pluginlist-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_recipeconfig-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_recipedefine-test.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # exand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ else \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? cpl_frame-test.log: cpl_frame-test$(EXEEXT) @p='cpl_frame-test$(EXEEXT)'; \ b='cpl_frame-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_frameset-test.log: cpl_frameset-test$(EXEEXT) @p='cpl_frameset-test$(EXEEXT)'; \ b='cpl_frameset-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_frameset_io-test.log: cpl_frameset_io-test$(EXEEXT) @p='cpl_frameset_io-test$(EXEEXT)'; \ b='cpl_frameset_io-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_parameter-test.log: cpl_parameter-test$(EXEEXT) @p='cpl_parameter-test$(EXEEXT)'; \ b='cpl_parameter-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_parameterlist-test.log: cpl_parameterlist-test$(EXEEXT) @p='cpl_parameterlist-test$(EXEEXT)'; \ b='cpl_parameterlist-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_plugin-test.log: cpl_plugin-test$(EXEEXT) @p='cpl_plugin-test$(EXEEXT)'; \ b='cpl_plugin-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_pluginlist-test.log: cpl_pluginlist-test$(EXEEXT) @p='cpl_pluginlist-test$(EXEEXT)'; \ b='cpl_pluginlist-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_framedata-test.log: cpl_framedata-test$(EXEEXT) @p='cpl_framedata-test$(EXEEXT)'; \ b='cpl_framedata-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_recipedefine-test.log: cpl_recipedefine-test$(EXEEXT) @p='cpl_recipedefine-test$(EXEEXT)'; \ b='cpl_recipedefine-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_recipeconfig-test.log: cpl_recipeconfig-test$(EXEEXT) @p='cpl_recipeconfig-test$(EXEEXT)'; \ b='cpl_recipeconfig-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool clean-local \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am # We need to remove any files that the above tests created. clean-local: $(RM) *.fits *.tfits *.log @USE_PURIFY_TRUE@include $(top_builddir)/Makefile.purify # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/cplui/tests/cpl_recipedefine-test.c0000644000460300003120000001300211475214273016073 00000000000000/* $Id: cpl_recipedefine-test.c,v 1.9 2010-11-30 15:31:07 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-30 15:31:07 $ * $Revision: 1.9 $ * $Name: not supported by cvs2svn $ */ #include "cpl_test.h" #include "cpl_recipedefine.h" /*---------------------------------------------------------------------------- Functions prototypes ----------------------------------------------------------------------------*/ static void cpl_recipedefine_test(cpl_pluginlist *); cpl_recipe_define(my_recipe, 10101, "Fname Lname", PACKAGE_BUGREPORT, "2008", "Test recipe", "Description of test recipe"); /* Enable my_recipe_fill_parameterlist() to either pass or fail */ static cpl_error_code fill_status = CPL_ERROR_NONE; /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_pluginlist * pluginlist; int error; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); error = cpl_plugin_get_info(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(1, error); pluginlist = cpl_pluginlist_new(); cpl_test_zero(cpl_plugin_get_info(pluginlist)); cpl_recipedefine_test(pluginlist); cpl_pluginlist_delete(pluginlist); return cpl_test_end(0); } static cpl_error_code my_recipe_fill_parameterlist(cpl_parameterlist * self) { cpl_test_nonnull(self); return fill_status; } /*----------------------------------------------------------------------------*/ /** @brief This recipe does nothing @param frameset A frameset @param plist A parameterlist @return 0 iff successful */ /*----------------------------------------------------------------------------*/ static int my_recipe(cpl_frameset * frameset, const cpl_parameterlist * plist) { /* The recipe definition ensures that the actual recipe execution is done with non-NULL parameters */ cpl_test_nonnull(frameset); cpl_test_nonnull(plist); return 0; } /*----------------------------------------------------------------------------*/ /** @brief Find a plugin and submit it to some tests @param self A non-empty pluginlist @return void */ /*----------------------------------------------------------------------------*/ static void cpl_recipedefine_test(cpl_pluginlist * self) { cpl_plugin * plugin; cpl_recipe * recipe; int (*recipe_create) (cpl_plugin *); int (*recipe_exec ) (cpl_plugin *); int (*recipe_deinit) (cpl_plugin *); cpl_errorstate prestate = cpl_errorstate_get(); int error; FILE * stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; plugin = cpl_pluginlist_get_first(self); recipe = (cpl_recipe *) plugin; cpl_test_nonnull(plugin); cpl_plugin_dump(plugin, stream); recipe_create = cpl_plugin_get_init(plugin); recipe_exec = cpl_plugin_get_exec(plugin); recipe_deinit = cpl_plugin_get_deinit(plugin); /* Only plugins of type recipe are defined */ cpl_test_eq(cpl_plugin_get_type(plugin), CPL_PLUGIN_TYPE_RECIPE); cpl_test_eq(recipe_create(plugin), CPL_ERROR_NONE); cpl_test_nonnull(recipe->parameters); cpl_parameterlist_dump(recipe->parameters, stream); /* Test 1: Check handling of NULL frameset */ recipe->frames = NULL; /* Execute recipe */ cpl_test( recipe_exec(plugin) ); /* Expect the errorstate to change */ cpl_test_zero( cpl_errorstate_is_equal(prestate) ); /* ... and the error code to not change */ cpl_test_error( CPL_ERROR_NULL_INPUT ); /* Test 2: Check handling of pre-existing error code */ recipe->frames = cpl_frameset_new(); cpl_error_set(cpl_func, CPL_ERROR_EOL); prestate = cpl_errorstate_get(); /* Execute recipe */ cpl_test( recipe_exec(plugin) ); /* Expect the errorstate to change */ cpl_test_zero( cpl_errorstate_is_equal(prestate) ); /* ... and the error code to not change */ cpl_test_error( CPL_ERROR_EOL ); /* Test 3: Check success on empty frameset */ /* Execute recipe */ cpl_test_zero( recipe_exec(plugin) ); /* Expect the error code to not change */ cpl_test_error( CPL_ERROR_NONE ); cpl_frameset_delete(recipe->frames); cpl_test_zero(recipe_deinit(plugin) ); /* Test 4: Check failure on failed parameterlist fill */ fill_status = CPL_ERROR_EOL; error = recipe_create(plugin); cpl_test_error( error ); cpl_test_zero(recipe_deinit(plugin) ); if (stream != stdout) cpl_test_zero( fclose(stream) ); return; } cpl-6.4.1/cplui/cpl_frameset.h0000644000460300003120000001205212207316125013142 00000000000000/* $Id: cpl_frameset.h,v 1.25 2013-08-28 06:44:37 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-08-28 06:44:37 $ * $Revision: 1.25 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_FRAMESET_H #define CPL_FRAMESET_H #include #include #include #include CPL_BEGIN_DECLS /** * @ingroup cpl_frameset * * @brief * The frame set data type. * * This data type is opaque. */ typedef struct _cpl_frameset_ cpl_frameset; /* * Create, copy and destroy operations */ cpl_frameset *cpl_frameset_new(void) CPL_ATTR_ALLOC; cpl_frameset *cpl_frameset_duplicate(const cpl_frameset *other) CPL_ATTR_ALLOC; void cpl_frameset_delete(cpl_frameset *self); /* * Non modifying operations */ cpl_size cpl_frameset_get_size(const cpl_frameset *self); int cpl_frameset_is_empty(const cpl_frameset *self); int cpl_frameset_count_tags(const cpl_frameset *self, const char *tag); /* * Search operations */ const cpl_frame *cpl_frameset_find_const(const cpl_frameset *self, const char *tag); cpl_frame *cpl_frameset_find(cpl_frameset *self, const char *tag); /* * Sequential access */ const cpl_frame *cpl_frameset_get_first_const(const cpl_frameset *self) CPL_ATTR_DEPRECATED; cpl_frame *cpl_frameset_get_first(cpl_frameset *self) CPL_ATTR_DEPRECATED; const cpl_frame *cpl_frameset_get_next_const(const cpl_frameset *self) CPL_ATTR_DEPRECATED; cpl_frame *cpl_frameset_get_next(cpl_frameset *self) CPL_ATTR_DEPRECATED; /* * Inserting and removing elements */ cpl_error_code cpl_frameset_insert(cpl_frameset *self, cpl_frame *frame); cpl_size cpl_frameset_erase(cpl_frameset *self, const char *tag); cpl_error_code cpl_frameset_erase_frame(cpl_frameset *self, cpl_frame *frame); /* * Element access */ const cpl_frame *cpl_frameset_get_frame_const(const cpl_frameset *self, cpl_size position) CPL_ATTR_DEPRECATED; cpl_frame *cpl_frameset_get_frame(cpl_frameset *self, cpl_size position) CPL_ATTR_DEPRECATED; cpl_frame *cpl_frameset_get_position(cpl_frameset *self, cpl_size position); const cpl_frame *cpl_frameset_get_position_const(const cpl_frameset *self, cpl_size position); /* * Miscellaneous functions */ cpl_error_code cpl_frameset_join(cpl_frameset *self, const cpl_frameset *other); cpl_error_code cpl_frameset_sort(cpl_frameset *self, cpl_frame_compare_func compare); cpl_frameset *cpl_frameset_extract(const cpl_frameset *self, const cpl_size *labels, cpl_size desired_label) CPL_ATTR_ALLOC; cpl_size *cpl_frameset_labelise(const cpl_frameset *self, int (*compare)(const cpl_frame *, const cpl_frame *), cpl_size *nb_labels); void cpl_frameset_dump(const cpl_frameset *self, FILE *stream); /* * Iterator support for frame sets */ /** * @ingroup cpl_frameset_iterator * * @brief * The frame set iterator data type. * * This data type is opaque. */ typedef struct _cpl_frameset_iterator_ cpl_frameset_iterator; /* * Iterator create, copy and destroy operations */ cpl_frameset_iterator * cpl_frameset_iterator_new(const cpl_frameset *parent) CPL_ATTR_ALLOC; cpl_frameset_iterator * cpl_frameset_iterator_duplicate(const cpl_frameset_iterator *other) CPL_ATTR_ALLOC; void cpl_frameset_iterator_delete(cpl_frameset_iterator *self); /* * Iterator assignment */ cpl_error_code cpl_frameset_iterator_assign(cpl_frameset_iterator *self, const cpl_frameset_iterator *other); /* * Iterator positioning */ cpl_error_code cpl_frameset_iterator_advance(cpl_frameset_iterator *self, int distance); int cpl_frameset_iterator_distance(const cpl_frameset_iterator *self, const cpl_frameset_iterator *other); void cpl_frameset_iterator_reset(cpl_frameset_iterator *self); /* * Iterator data access */ cpl_frame *cpl_frameset_iterator_get(cpl_frameset_iterator *self); const cpl_frame * cpl_frameset_iterator_get_const(const cpl_frameset_iterator *self); CPL_END_DECLS #endif /* CPL_FRAMESET_H */ cpl-6.4.1/cplui/cpl_framedata.h0000644000460300003120000000667311703310325013270 00000000000000/* $Id: cpl_framedata.h,v 1.4 2012-01-11 13:38:29 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-01-11 13:38:29 $ * $Revision: 1.4 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_FRAMEDATA_H #define CPL_FRAMEDATA_H #include #include #include CPL_BEGIN_DECLS /** * @ingroup cpl_framedata * * @brief * The frame data object type. */ typedef struct _cpl_framedata_ cpl_framedata; /** * @ingroup cpl_framedata * * @brief * The public frame data object. * * The frame data object stores a frame identifier, the frame tag, and * the minimum and maximum number of frames needed. * * The data members of this structure are public to allow for a static * initialization. Any other access of the public data members should * still be done using the member functions. */ struct _cpl_framedata_ { /** * The frame tag. A unique string identifier for a particular kind of * frame. */ const char* tag; /** * The minimum number of frames of the kind given by the @em tag, * the recipe requires in input. A value of @c -1 means that the * minimum number of frames is unspecified. */ cpl_size min_count; /** * The maximum number of frames of the kind given by the @em tag, * the recipe requires in input. A value of @c -1 means that the * maximum number of frames is unspecified. */ cpl_size max_count; }; /* * Create, copy and destroy operations */ cpl_framedata* cpl_framedata_new(void) CPL_ATTR_ALLOC; cpl_framedata* cpl_framedata_create(const char* tag, cpl_size min_count, cpl_size max_count) CPL_ATTR_ALLOC; cpl_framedata* cpl_framedata_duplicate(const cpl_framedata* other) CPL_ATTR_ALLOC; void cpl_framedata_clear(cpl_framedata* self); void cpl_framedata_delete(cpl_framedata* self); /* * Non modifying operations */ const char* cpl_framedata_get_tag(const cpl_framedata* self); cpl_size cpl_framedata_get_min_count(const cpl_framedata* self); cpl_size cpl_framedata_get_max_count(const cpl_framedata* self); /* * Assignment operations */ cpl_error_code cpl_framedata_set_tag(cpl_framedata* self, const char* tag); cpl_error_code cpl_framedata_set_min_count(cpl_framedata* self, cpl_size min_count); cpl_error_code cpl_framedata_set_max_count(cpl_framedata* self, cpl_size max_count); cpl_error_code cpl_framedata_set(cpl_framedata* self, const char* tag, cpl_size min_count, cpl_size max_count); CPL_END_DECLS #endif /* CPL_FRAMEDATA_H */ cpl-6.4.1/cplui/cpl_plugin.c0000644000460300003120000011373111513030720012624 00000000000000/* $Id: cpl_plugin.c,v 1.17 2011-01-11 10:32:48 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-01-11 10:32:48 $ * $Revision: 1.17 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include "cpl_macros.h" #include "cpl_error_impl.h" #include "cpl_memory.h" #include "cpl_msg.h" #include "cpl_plugin.h" /** * @defgroup cpl_plugin Plugin Interface * * @brief * The basic plugin interface definition * * This module defines the basic plugin interface. The plugin interface * provides the possibility to dynamically load and execute software modules. * The basic plugin interface defined here serves as `superclass' for * context specific plugins. All context specific plugins inherit this * basic plugin interface. A plugin context is represented by a type code, * i.e. the different plugin contexts are represented as different plugin * types. * * Most of the time an application using the plugin interface is dealing * only with this basic, plugin type independent part of the interface. * It provides the application with the necessary information about * a particular plugin implementation and the services to initialise, * execute and cleanup a dynamically loaded module. * * In this way plugin type specific details may remain hidden from the * application until the plugin type and its implementation details * are known through querying the basic plugin interface part. * * To obtain a filled plugin interface structure the application will call * the function @c cpl_plugin_get_info(), which has the following prototype: * @code * #include * * cpl_plugin_get_info(cpl_pluginlist *list); * @endcode * * For each plugin library (a shared object library containing one or * more plugins) this function must be implemented by the plugin developer. * Its purpose is to fill a plugin interface structure for each plugin the * plugin library contains and add it to a list provided by the application. * This list of plugin interfaces provides the application with all the * details on how to communicate with a particular plugin. * * As an example on how to create a context specific plugin, i.e. how to * create a new plugin type, you may have a look at @ref cpl_recipe. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /** * @brief * Create a new, empty plugin interface * * @return * The pointer to a newly allocated plugin or @c NULL if it * could not be created. * * The function allocates memory for a @c cpl_plugin and initialises it. The * function returns a handle for the newly created plugin interface object. * The created plugin interface must be destroyed using the plugin interface * destructor @b cpl_plugin_delete(). */ cpl_plugin * cpl_plugin_new(void) { cpl_plugin *self = (cpl_plugin *) cx_malloc(sizeof *self); self->api = 0; self->version = 0L; self->type = 0L; self->name = NULL; self->synopsis = NULL; self->description = NULL; self->author = NULL; self->email = NULL; self->copyright = NULL; self->initialize = NULL; self->execute = NULL; self->deinitialize = NULL; return self; } /** * @brief * Copy a plugin. * * @param self A plugin. * @param other The plugin structure to copy. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or other is a NULL * pointer. *
* @enderror * * The function copies all members of the plugin @em other to the plugin * @em self. The plugin @em other and its copy @em self do not share any * resources after the copy operation. If either @em self, or @em other * are invalid pointers, the function returns immediately. * * Note that the plugins @em self and @em other do not need to be of the * same kind (see below). * * @attention * If a @b derived plugin (a @c cpl_recipe for instance) is passed to * this function, after casting it to its base, a @c cpl_plugin this * function most likely will not work as expected, since @b data slicing * will happen. The function is only aware of the @c cpl_plugin part * of the derived plugin and only these data members are copied. Any * additional data members defined by the derived plugin are therefore * lost, unless they are copied explicitly. * * The should be used function as follows. If necessary, create the target * plugin using the appropriate constructor, or allocate a memory block of the * appropriate size to hold the @b derived plugin type. Use this function * to copy the @c cpl_plugin part of your derived plugin. Copy additional * data members of the target plugin explicitely. */ cpl_error_code cpl_plugin_copy(cpl_plugin *self, const cpl_plugin *other) { if (self == NULL || other == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } self->api = other->api; self->version = other->version; self->type = other->type; if (self->name != NULL) { cx_free((cxptr)self->name); } self->name = cx_strdup(other->name); if (self->synopsis != NULL) { cx_free((cxptr)self->synopsis); } self->synopsis = cx_strdup(other->synopsis); if (self->description != NULL) { cx_free((cxptr)self->description); } self->description = cx_strdup(other->description); if (self->author != NULL) { cx_free((cxptr)self->author); } self->author = cx_strdup(other->author); if (self->email != NULL) { cx_free((cxptr)self->email); } self->email = cx_strdup(other->email); if (self->copyright != NULL) { cx_free((cxptr)self->copyright); } self->copyright = cx_strdup(other->copyright); self->initialize = other->initialize; self->execute = other->execute; self->deinitialize = other->deinitialize; return CPL_ERROR_NONE; } /** * @brief * Destroy a plugin. * * @param self The plugin to destroy. * * @return Nothing. * * The function destroys a plugin. First, the memory used by the members * of the @c cpl_plugin type is released and then the plugin itself is * destroyed. * * @attention * The function may also be used to destroy plugins which have been * derived from the @c cpl_plugin type. But if the derived plugin type * defines members which are dynamically allocated, they have to be * destroyed explicitly before (in the plugin's cleanup handler for * instance) the derived plugin is passed to this function, or the * references to these memory blocks have to be kept and cleaned up * later. Otherwise memory leaks may result. If the plugin @em self * is @c NULL, nothing is done and no error is set. */ void cpl_plugin_delete(cpl_plugin *self) { if (self != NULL) { self->api = 0; self->version = 0L; self->type = 0L; if (self->name != NULL) { cx_free((cxptr)self->name); self->name = NULL; } if (self->synopsis != NULL) { cx_free((cxptr)self->synopsis); self->synopsis = NULL; } if (self->description != NULL) { cx_free((cxptr)self->description); self->description = NULL; } if (self->author != NULL) { cx_free((cxptr)self->author); self->author = NULL; } if (self->email != NULL) { cx_free((cxptr)self->email); self->email = NULL; } if (self->copyright != NULL) { cx_free((cxptr)self->copyright); self->copyright = NULL; } self->initialize = NULL; self->execute = NULL; self->deinitialize = NULL; cx_free(self); } return; } /** * @brief * Set the plugin interface version number. * * @param self A plugin * @param api The plugin interface version to set. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function sets the version number of the plugin interface of the * plugin @em self to the version @em api. * * @attention * The plugin interface version describes the internal layout of the * plugin interface. It should be used by an application to decide whether * a particular plugin can be used or not, i.e. if the plugin interface * supported by the application is compatible with the interface presented * by the plugin itself. */ cpl_error_code cpl_plugin_set_api(cpl_plugin *self, unsigned int api) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } self->api = api; return CPL_ERROR_NONE; } /** * @brief * Get the version number of the plugin interface implementation. * * @param self A plugin. * * @return * The version number of the plugin interface implementation the * plugin @em self complies with. If an error occurs the function * returns 0 and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function returns the plugin interface version number, i.e. the * version number describing the layout of the plugin data type itself. * Valid version numbers are always greater or equal to 1. */ unsigned int cpl_plugin_get_api(const cpl_plugin *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } return self->api; } /** * @brief * Set the version number of a plugin. * * @param self A plugin * @param version The plugin's version number to set. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function sets the version number of the plugin interface of the * plugin @em self to the version @em api. * * This function sets the version number of the plugin @em self to * @em version. */ int cpl_plugin_set_version(cpl_plugin *self, unsigned long version) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } self->version = version; return CPL_ERROR_NONE; } /** * @brief * Get the version number of a plugin. * * @param self A plugin. * * @return * The plugin's version number. If an error occurs the function * returns 0 and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function returns the version number of the plugin @em self. */ unsigned long cpl_plugin_get_version(const cpl_plugin *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } return self->version; } /** * @brief * Get the version number of a plugin as a string. * * @param self A plugin. * * @return * The string representation of the plugin's version number. If an * error occurs the function returns @c NULL and sets an appropriate * error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function returns the version number of the plugin @em self as * a string. The function assumes that the integer representation of * the plugin version can be decoded into a version string of the * usual form: "major.minor.micro" * * The resulting string is placed in a newly allocated buffer. This * buffer must be deallocated using @b cpl_free() by the caller if it * is no longer needed. */ char * cpl_plugin_get_version_string(const cpl_plugin *self) { unsigned long version; unsigned major; unsigned minor; unsigned micro; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } version = self->version; micro = version % 100; version = version / 100; minor = version % 100; version = version / 100; major = version; return cpl_sprintf("%-u.%-u.%-u", major, minor, micro); } /** * @brief * Set the type of a plugin. * * @param self A plugin. * @param type The plugin type to set. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function sets the type (cf. @ref cpl_plugin_type) of the plugin * @em self to @em type. */ cpl_error_code cpl_plugin_set_type(cpl_plugin *self, unsigned long type) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } self->type = type; return CPL_ERROR_NONE; } /** * @brief * Get the type of a plugin. * * @param self A plugin. * * @return * The function returns the plugin type code. If an error occurs the * function returns CPL_PLUGIN_TYPE_NONE and sets an appropriate error * code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function returns the type (cf. @ref cpl_plugin_type) of the * plugin @em self. */ unsigned long cpl_plugin_get_type(const cpl_plugin *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return (unsigned long) CPL_PLUGIN_TYPE_NONE; } return self->type; } /** * @brief * Get the type of a plugin as string. * * @param self A plugin. * * @return * The function returns the string representation of the plugin type. * If an error occurs the function returns @c NULL and sets an appropriate * error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function returns the plugin type of @em self as a string. * The type string is placed into a newly allocated buffer. This * buffer must be deallocated using @b cpl_free() by the caller if it * is no longer needed. */ char * cpl_plugin_get_type_string(const cpl_plugin *self) { const char *stype; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } switch (self->type) { case (unsigned long)CPL_PLUGIN_TYPE_NONE: stype = "none"; break; case (unsigned long)CPL_PLUGIN_TYPE_RECIPE: stype = "recipe"; break; default: stype = "undefined"; break; } return cx_strdup(stype); } /** * @brief * Set the name of a plugin. * * @param self A plugin. * @param name The plugin's unique name. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * This function assigns the name @em name to the plugin @em self. * * @attention * Since plugins are selected through their name this name should * be choosen carefully in order to avoid name clashes with other * plugins. */ cpl_error_code cpl_plugin_set_name(cpl_plugin *self, const char *name) { if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_free((cxptr)self->name); self->name = cx_strdup(name); return CPL_ERROR_NONE; } /** * @brief * Get the name of a plugin. * * @param self A plugin. * * @return * The function returns a pointer to the plugin's unique name string. * If an error occurs the function returns @c NULL and sets an appropriate * error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function returns a reference to the unique name of the plugin * @em self. The plugin's name must not be modified using the returned * pointer. The appropriate method should be used instead. */ const char * cpl_plugin_get_name(const cpl_plugin *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return self->name; } /** * @brief * Set the short description of a plugin. * * @param self A plugin. * @param synopsis The plugin's synopsis, or NULL. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function copies the short description text from the string * @em synopsis to the plugin @em self. */ cpl_error_code cpl_plugin_set_synopsis(cpl_plugin *self, const char *synopsis) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_free((cxchar *)self->synopsis); self->synopsis = synopsis ? cx_strdup(synopsis) : NULL; return CPL_ERROR_NONE; } /** * @brief * Get the short description of a plugin. * * @param self A plugin. * * @return * The function returns a pointer to the plugin's short description. * If an error occurs the function returns @c NULL and sets an appropriate * error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function returns a reference to the short description (its purpose * for instance) of the plugin @em self. The plugin's short description * must not be modified using this pointer. Use the appropriate method * instead! */ const char * cpl_plugin_get_synopsis(const cpl_plugin *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return self->synopsis; } /** * @brief * Set the detailed description of a plugin. * * @param self A plugin. * @param description The plugin's detailed description, or @c NULL. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function copies the detailed description text from the string * @em description to the plugin @em self. The C formatting characters * @c '\\n' and @c '\\t' may be embedded in the string @em description. */ cpl_error_code cpl_plugin_set_description(cpl_plugin *self, const char *description) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_free((cxchar *)self->description); self->description = description ? cx_strdup(description) : NULL; return CPL_ERROR_NONE; } /** * @brief * Get the detailed description of a plugin. * * @param self A plugin. * * @return * The function returns a pointer to the plugin's detailed description. * If an error occurs the function returns @c NULL and sets an appropriate * error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function returns a reference to the detailed description (a * description of the algorithm for instance) of the plugin @em self. * The plugin's description must not be modified using this pointer. * Use the appropriate method instead! */ const char * cpl_plugin_get_description(const cpl_plugin *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return self->description; } /** * @brief * Set the name of the plugin author. * * @param self A plugin * @param author The name of the plugin author. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or author is a NULL * pointer. *
* @enderror * * This function copies the plugin author's name from the string @em author * to the plugin @em self. */ cpl_error_code cpl_plugin_set_author(cpl_plugin *self, const char *author) { if (self == NULL || author == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_free((cxchar *)self->author); self->author = cx_strdup(author); return CPL_ERROR_NONE; } /** * @brief * Get the name of the plugin author. * * @param self A plugin. * * @return * The function returns a pointer to the plugin author's name string. * If an error occurs the function returns @c NULL and sets an appropriate * error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function returns a reference to the name of the author of the * plugin @em self. The plugin author's name must not be modified using * the returned pointer. The appropriate method should be used instead! */ const char * cpl_plugin_get_author(const cpl_plugin *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return self->author; } /** * @brief * Set the contact information of a plugin. * * @param self A plugin. * @param email The plugin author's contact information. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * @returns The function returns 0 on success, or a non-zero value otherwise. * If @em self is not a valid pointer the function returns 1. * * This function copies the plugin author contact information from the * string @em email to the plugin @em self. */ cpl_error_code cpl_plugin_set_email(cpl_plugin *self, const char *email) { if (self == NULL || email == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_free((cxchar *)self->email); self->email = cx_strdup(email); return CPL_ERROR_NONE; } /** * @brief * Get the contact information of a plugin. * * @param self A plugin. * * @return * The function returns a pointer to the plugin author's contact * information string. If an error occurs the function returns * @c NULL and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function returns a reference to the e-mail address of the author of * the plugin @em self. The plugin author's e-mail address must not be * modified using the returned pointer. The appropriate method should be * used instead! */ const char * cpl_plugin_get_email(const cpl_plugin *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return self->email; } /** * @brief * Set the license and copyright information of a plugin. * * @param self A plugin. * @param copyright The plugin's license information. * @note The license information must be compatible with that of CPL. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or copyright is a NULL * pointer. *
* @enderror * * This function copies the plugin's license information from the * string @em copyright to the plugin @em self. */ cpl_error_code cpl_plugin_set_copyright(cpl_plugin *self, const char *copyright) { if (self == NULL || copyright == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_free((cxchar *)self->copyright); self->copyright = cx_strdup(copyright); return CPL_ERROR_NONE; } /** * @brief * Get the license and copyright information of a plugin. * * @param self A plugin. * * @return * The function returns a pointer to the plugin's copyright * information string. If an error occurs the function returns * @c NULL and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function returns a reference to the license and copyright information * of the plugin @em self. The copyright information must not be * modified using the returned pointer. The appropriate method should be * used instead! */ const char * cpl_plugin_get_copyright(const cpl_plugin *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return self->copyright; } /** * @brief * Set the initialisation handler of a plugin. * * @param self A plugin * @param func The plugin's initialisation function * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function installs the function @em func as the initialisation * function of the plugin @em self. The registered function must be called * by an application before the plugin is executed. */ cpl_error_code cpl_plugin_set_init(cpl_plugin *self, cpl_plugin_func func) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } self->initialize = func; return CPL_ERROR_NONE; } /** * @brief * Get the initialisation handler of a plugin. * * @param self A plugin. * * @return * The plugin's initalization function. If an error occurs the * function returns @c NULL and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the initalisation function of the plugin @em self. */ cpl_plugin_func cpl_plugin_get_init(const cpl_plugin *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return self->initialize; } /** * @brief * Set the execution handler of a plugin. * * @param self A plugin. * @param func The plugin's execution function. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function installs the function @em func as the execution * function of the plugin @em self. The registered function must be called * by an application after the plugin's initialisation function was called. * Calling the registered function executes the plugin. */ cpl_error_code cpl_plugin_set_exec(cpl_plugin *self, cpl_plugin_func func) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } self->execute = func; return CPL_ERROR_NONE; } /** * @brief * Get the execution handler of a plugin. * * @param self A plugin. * * @return * The plugin's execution function. If an error occurs the function * returns @c NULL and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the execution function of the plugin @em self. */ cpl_plugin_func cpl_plugin_get_exec(const cpl_plugin *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return self->execute; } /** * @brief * Set the cleanup handler of a plugin. * * @param self A plugin * @param func The plugin's cleanup handler. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function installs the function @em func as the cleanup handler * of the plugin @em self. The registered function is called after the * plugin has been executed to release any acquired resources. */ cpl_error_code cpl_plugin_set_deinit(cpl_plugin *self, cpl_plugin_func func) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } self->deinitialize = func; return CPL_ERROR_NONE; } /** * @brief * Get the cleanup handler of a plugin. * * @param self A plugin. * * @return * The plugin's cleanup handler. If an error occurs the function * returns @c NULL and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the cleanup handler of the plugin @em self. */ cpl_plugin_func cpl_plugin_get_deinit(const cpl_plugin *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return self->deinitialize; } /** * @brief * Initialise a plugin * * @param self The plugin to initialise. * @param api The plugin interface version number. * @param version The plugin's version number. * @param type The plugin's type. * @param name The plugin's unique name. * @param synopsis The plugin's short description (purpose, synopsis ...). * @param description The plugin's detailed description. * @param author The plugin's author name. * @param email The plugin author's e-mail address. * @param copyright The plugin's copyright and licensing information. * @param create The function used to create the plugin. * @param execute The function used to execute the plugin. * @param destroy The function used to destroy the plugin. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function fills the @c cpl_plugin part of a plugin structure. For * information on which information is required and which is optional * please refer to the documentation of the plugin structure _cpl_plugin_. * * If @em self is not a valid pointer, the function returns immediately. */ cpl_error_code cpl_plugin_init(cpl_plugin *self, unsigned int api, unsigned long version, unsigned long type, const char *name, const char *synopsis, const char *description, const char *author, const char *email, const char *copyright, cpl_plugin_func create, cpl_plugin_func execute, cpl_plugin_func destroy) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } if (name == NULL || synopsis == NULL || description == NULL || author == NULL || email == NULL || copyright == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cpl_plugin_set_api(self, api); cpl_plugin_set_version(self, version); cpl_plugin_set_type(self, type); cpl_plugin_set_name(self, name); cpl_plugin_set_synopsis(self, synopsis); cpl_plugin_set_description(self, description); cpl_plugin_set_author(self, author); cpl_plugin_set_email(self, email); cpl_plugin_set_copyright(self, copyright); cpl_plugin_set_init(self, create); cpl_plugin_set_exec(self, execute); cpl_plugin_set_deinit(self, destroy); return CPL_ERROR_NONE; } /** * @brief * Dump the plugin debugging information to the given stream. * * @param self The plugin. * @param stream The output stream to use. * * @return Nothing. * * The function dumps the contents of of the plugin @em self to the * output stream @em stream. If @em stream is @c NULL the function writes * to the standard output. If @em self is @c NULL the function does nothing. */ void cpl_plugin_dump(const cpl_plugin *self, FILE *stream) { if (self != NULL) { const char *s; char *a; if (stream == NULL) { stream = stdout; } fprintf(stream, "Plugin at %p:\n", self); s = cpl_plugin_get_name(self); fprintf(stream, " Name (%p): %s\n", s, s); a = cpl_plugin_get_version_string(self); fprintf(stream, " Version: %s (%ld)\n", a, cpl_plugin_get_version(self)); cx_free(a); a = cpl_plugin_get_type_string(self); fprintf(stream, " Type: %s (%ld)\n", a, cpl_plugin_get_type(self)); cx_free(a); fprintf(stream, " API Version: %d", cpl_plugin_get_api(self)); fprintf(stream, " Initialization handler at %p\n", cpl_plugin_get_init(self)); fprintf(stream, " Execution handler at %p\n", cpl_plugin_get_exec(self)); fprintf(stream, " Cleanup handler at %p\n", cpl_plugin_get_deinit(self)); s = cpl_plugin_get_synopsis(self); fprintf(stream, " Synopsis (%p): %s\n", s, s); s = cpl_plugin_get_copyright(self); fprintf(stream, " Copyright (%p): %s\n", s, s); s = cpl_plugin_get_author(self); fprintf(stream, " Author (%p): %s\n", s, s); s = cpl_plugin_get_email(self); fprintf(stream, " Email (%p): %s\n", s, s); s = cpl_plugin_get_description(self); fprintf(stream, " Description (%p): %s\n", s, s); } return; } /**@}*/ cpl-6.4.1/cplui/cpl_recipedefine.c0000644000460300003120000003122111510370542013747 00000000000000/* $Id: cpl_recipedefine.c,v 1.10 2011-01-03 15:55:14 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-01-03 15:55:14 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include "cpl_recipedefine.h" /* For check of CPL version number inconsistency */ #include #include #include /** * @defgroup cpl_recipedefine Recipe Definition * * This module implements the support for recipe defition. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Create the plugin of type recipe @param list The pluginlist to append the plugin to @param cplversion The CPL version number at recipe compile time. @param version The plugin's version number. @param name The plugin's unique name. @param synopsis The plugin's short description (purpose, synopsis ...). @param description The plugin's detailed description. @param author The plugin's author name. @param email The plugin author's e-mail address. @param copyright The plugin's copyright and licensing information. @param create The function used to create the plugin. @param execute The function used to execute the plugin. @param destroy The function used to destroy the plugin. @return CPL_ERROR_NONE iff successful @see cpl_recipe_define() @note Should never be called directly, only via cpl_recipe_define(). */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_recipedefine_init(cpl_pluginlist * list, unsigned long cplversion, unsigned long version, const char *name, const char *synopsis, const char *description, const char *author, const char *email, const char *copyright, cpl_plugin_func create, cpl_plugin_func execute, cpl_plugin_func destroy) { cpl_recipe * recipe; cpl_plugin * plugin; const char * msgname = name ? name : ""; /* Verify that the compile-time and run-time versions of CPL match */ /* - this will work for run-time versions going back to CPL 3.0 */ /* - earlier versions will cause an exit with an unresolved symbol */ const unsigned vruntime = CPL_VERSION(cpl_version_get_major(), cpl_version_get_minor(), cpl_version_get_micro()); /* The version number of the first major version */ const unsigned vmruntime = CPL_VERSION(cpl_version_get_major(), 0, 0); if (vruntime < cplversion) { cpl_msg_warning(cpl_func, "Run-time version %s of CPL is lower than " "the version (%lX) used to compile %s", cpl_version_get_version(), cplversion, msgname); } else if (vmruntime > cplversion) { cpl_msg_warning(cpl_func, "Run-time version %s of CPL has a newer major " "version than the version (%lX) used to compile %s", cpl_version_get_version(), cplversion, msgname); } else if (vruntime > cplversion) { cpl_msg_info(cpl_func, "Run-time version %s of CPL is higher than " "the version (%lX) used to compile %s", cpl_version_get_version(), cplversion, msgname); } recipe = cpl_calloc(1, sizeof(*recipe)); if (recipe == NULL) { return cpl_error_set_message_(CPL_ERROR_ILLEGAL_OUTPUT, "Recipe allocation failed"); } plugin = &recipe->interface; if (cpl_plugin_init(plugin, CPL_PLUGIN_API, version, CPL_PLUGIN_TYPE_RECIPE, name, synopsis, description, author, email, copyright, create, execute, destroy)) { cpl_plugin_delete(plugin); return cpl_error_set_message_(cpl_error_get_code(), "Plugin initialization failed"); } if (cpl_pluginlist_append(list, plugin)) { cpl_plugin_delete(plugin); return cpl_error_set_message_(cpl_error_get_code(), "Error adding plugin to list"); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Create the plugin of type recipe @param plugin The recipe to create @return CPL_ERROR_NONE iff successful @see cpl_recipe_define() @note Should never be called directly, only via cpl_recipe_define(). */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_recipedefine_create(cpl_plugin * plugin) { cpl_recipe * recipe; /* Return immediately if an error code is already set */ if (cpl_error_get_code() != CPL_ERROR_NONE) { return cpl_error_set_message_(cpl_error_get_code(), "An error is already set"); } if (plugin == NULL) { return cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "Null plugin"); } /* Verify plugin type */ if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) { return cpl_error_set_message_(CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe: %lu <=> %d", cpl_plugin_get_type(plugin), CPL_PLUGIN_TYPE_RECIPE); } /* Get the recipe */ recipe = (cpl_recipe *)plugin; /* Create the parameters list in the cpl_recipe object */ recipe->parameters = cpl_parameterlist_new(); if (recipe->parameters == NULL) { return cpl_error_set_message_(CPL_ERROR_ILLEGAL_OUTPUT, "Parameter list allocation failed"); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Check the return status of the parameter fill function call @param prestate The CPL errorstate prior to the call @param fill_error The return value to check @return CPL_ERROR_NONE iff successful @see cpl_recipe_define() @note Should never be called directly, only via cpl_recipe_define(). */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_recipedefine_create_is_ok(cpl_errorstate prestate, cpl_error_code fill_error) { /* Propagate any error and set a CPL error if the filler failed without setting one */ return fill_error || !cpl_errorstate_is_equal(prestate) ? cpl_error_set_message_(fill_error ? fill_error : cpl_error_get_code(), "Parameter list fill failed") : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Execute the plugin of type recipe using the given function @param plugin The recipe to execute @param function The function to call @return CPL_ERROR_NONE iff successful @see cpl_recipe_define() @note Should never be called directly, only via cpl_recipe_define(). */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_recipedefine_exec(cpl_plugin * plugin, int (*function)(cpl_frameset *, const cpl_parameterlist *)) { cpl_recipe * recipe; int recipe_status; cpl_errorstate initial_errorstate = cpl_errorstate_get(); /* Return immediately if an error code is already set */ if (cpl_error_get_code() != CPL_ERROR_NONE) { return cpl_error_set_message_(cpl_error_get_code(), "An error is already set"); } if (plugin == NULL) { return cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "Null plugin"); } /* Verify plugin type */ if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) { return cpl_error_set_message_(CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe: %lu <=> %d", cpl_plugin_get_type(plugin), CPL_PLUGIN_TYPE_RECIPE); } /* Get the recipe */ recipe = (cpl_recipe *)plugin; /* Verify parameter and frame lists */ if (recipe->parameters == NULL) { return cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "Recipe invoked with NULL parameter list"); } if (recipe->frames == NULL) { return cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "Recipe invoked with NULL frame set"); } if (function == NULL) { /* Reaching this point either indicated an error in cpl_recipe_define(), or that the caller is non-standard. */ return cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "Recipe invoked with NULL function"); } /* Invoke the recipe */ recipe_status = function(recipe->frames, recipe->parameters); if (!cpl_errorstate_is_equal(initial_errorstate)) { /* Dump the error history since recipe execution start. At this point the recipe cannot recover from the error */ cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL); } return recipe_status; } /*----------------------------------------------------------------------------*/ /** @internal @brief Deallocate the parameterlist of a plugin of type recipe @param plugin The recipe to modify @return CPL_ERROR_NONE iff successful @see cpl_recipe_define() @note Should never be called directly, only via cpl_recipe_define(). */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_recipedefine_destroy(cpl_plugin * plugin) { cpl_recipe * recipe; if (plugin == NULL) { return cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "Null plugin"); } /* Verify plugin type */ if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) { return cpl_error_set_message_(CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe: %lu <=> %d", cpl_plugin_get_type(plugin), CPL_PLUGIN_TYPE_RECIPE); } /* Get the recipe */ recipe = (cpl_recipe *)plugin; cpl_parameterlist_delete(recipe->parameters); /* May be NULL */ return CPL_ERROR_NONE; } /**@}*/ cpl-6.4.1/cplui/cpl_frame.h0000644000460300003120000001345112073537672012447 00000000000000/* $Id: cpl_frame.h,v 1.20 2013-01-10 13:18:50 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-01-10 13:18:50 $ * $Revision: 1.20 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_FRAME_H #define CPL_FRAME_H #include #include #include CPL_BEGIN_DECLS /** * @ingroup cpl_frame * * @brief * The frame data type. */ typedef struct _cpl_frame_ cpl_frame; /** * @ingroup cpl_frame * * @brief * Frame comparison function. * * Type definition for functions which compares the frame @em other with the * frame @em self. * * All function of this type must return -1, 0, or 1 if @em self is considered * to be less than, equal or greater than @em other respectively. */ typedef int (*cpl_frame_compare_func)(const cpl_frame *self, const cpl_frame *other); /** * @ingroup cpl_frame * * @brief * Supported frame types * * Defines the possible values for the frame's type attribute. */ enum _cpl_frame_type_ { /** * Undefined frame type * @hideinitializer */ CPL_FRAME_TYPE_NONE = 1 << 0, /** * Image frame type identifier * @hideinitializer */ CPL_FRAME_TYPE_IMAGE = 1 << 1, /** * Matrix frame type identifier * @hideinitializer */ CPL_FRAME_TYPE_MATRIX = 1 << 2, /** * Table frame type identifier * @hideinitializer */ CPL_FRAME_TYPE_TABLE = 1 << 3, /** * paf frame type identifier * @hideinitializer */ CPL_FRAME_TYPE_PAF = 1 << 4, /** * identifier for any other type * @hideinitializer */ CPL_FRAME_TYPE_ANY = 1 << 5 }; /** * @ingroup cpl_frame * * @brief * The frame type data type. */ typedef enum _cpl_frame_type_ cpl_frame_type; /** * @ingroup cpl_frame * * @brief * Supported frame groups. * * Defines the possible values for the frame's group attribute. */ enum _cpl_frame_group_ { /** * The frame does not belong to any supported group. */ CPL_FRAME_GROUP_NONE, /** * The frame is associated to unprocessed data. */ CPL_FRAME_GROUP_RAW, /** * The frame is associated to calibration data. */ CPL_FRAME_GROUP_CALIB, /** * The frame is associated to processed data. */ CPL_FRAME_GROUP_PRODUCT }; /** * @ingroup cpl_frame * * @brief * The frame group data type. */ typedef enum _cpl_frame_group_ cpl_frame_group; /** * @ingroup cpl_frame * * @brief * Supported frame processing levels. * * @note * The processing levels are just flags and it is left to the application * to trigger the appropriate action for the different levels. */ enum _cpl_frame_level_ { /** * Undefined processing level */ CPL_FRAME_LEVEL_NONE, /** * Temporary product. The corresponding file will be deleted when * the processing chain is completed. */ CPL_FRAME_LEVEL_TEMPORARY, /** * Intermediate product. The corresponding file is only kept on request. * The default is to delete these products at the end of the processing * chain. */ CPL_FRAME_LEVEL_INTERMEDIATE, /** * Final data product, which is always written to a file at the end of * the processing chain. */ CPL_FRAME_LEVEL_FINAL }; /** * @ingroup cpl_frame * * @brief * The frame level data type. */ typedef enum _cpl_frame_level_ cpl_frame_level; /* * Identifier strings for the different frame groups. */ /** * @ingroup cpl_frame * * @brief * Frame group tag for unprocessed data. */ #define CPL_FRAME_GROUP_RAW_ID "RAW" /** * @ingroup cpl_frame * * @brief * Frame group tag for calibration data. */ #define CPL_FRAME_GROUP_CALIB_ID "CALIB" /** * @ingroup cpl_frame * * @brief * Frame group tag for processed data. */ #define CPL_FRAME_GROUP_PRODUCT_ID "PRODUCT" /* * Create, copy and destroy operations */ cpl_frame *cpl_frame_new(void) CPL_ATTR_ALLOC; cpl_frame *cpl_frame_duplicate(const cpl_frame *other) CPL_ATTR_ALLOC; void cpl_frame_delete(cpl_frame *self); /* * Modifying and non-modifying operations */ const char *cpl_frame_get_filename(const cpl_frame *self); const char *cpl_frame_get_tag(const cpl_frame *self); cpl_frame_type cpl_frame_get_type(const cpl_frame *self); cpl_frame_group cpl_frame_get_group(const cpl_frame *self); cpl_frame_level cpl_frame_get_level(const cpl_frame *self); /* * Assignment operations */ cpl_error_code cpl_frame_set_filename(cpl_frame *self, const char *filename); cpl_error_code cpl_frame_set_tag(cpl_frame *self, const char *tag); cpl_error_code cpl_frame_set_type(cpl_frame *self, cpl_frame_type type); cpl_error_code cpl_frame_set_group(cpl_frame *self, cpl_frame_group group); cpl_error_code cpl_frame_set_level(cpl_frame *self, cpl_frame_level level); /* * Others */ cpl_size cpl_frame_get_nextensions(const cpl_frame *self); void cpl_frame_dump(const cpl_frame *frame, FILE *stream); CPL_END_DECLS #endif /* CPL_FRAME_H */ cpl-6.4.1/cplui/cpl_plugininfo.h0000644000460300003120000000473111466733006013522 00000000000000/* $Id: cpl_plugininfo.h,v 1.5 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.5 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_PLUGININFO_H #define CPL_PLUGININFO_H #include #include CPL_BEGIN_DECLS /** * @ingroup cpl_plugin * * @brief * Append the plugin information to the given list. * * @param cpl_plugin_list A plugin list. * * @return The function must return 0 on success and 1 in case of an error. * * This function must be implemented by plugin developers. There must * be one such implementation per plugin library, regardless of how many * plugins the library actually offers, provided that there is at least * one plugin implemented in this library. * * This prototype is only provided in order to allow the compiler to do * some basic checks when compiling a plugin library. To have the * prototype available when you are compiling your plugin library, * you must add the line * @code * #include * @endcode * * to your plugin source file. * * The purpose of this function is to create a plugin object for each * plugin implementation provided by the plugin library, fill the * basic plugin interface (the @c cpl_plugin part of the created plugin * object) and append the created object to the plugin list @em list. * * The list will be provided by the application which is going to use the * plugin and it may be expected that @em list points to a valid plugin list * when this function is called. */ int cpl_plugin_get_info(cpl_pluginlist *cpl_plugin_list); CPL_END_DECLS #endif /* CPL_PLUGININFO_H */ cpl-6.4.1/cplui/cpl_frameset_io.h0000644000460300003120000000260711611753401013636 00000000000000/* $Id: cpl_frameset_io.h,v 1.6 2011-07-21 07:36:33 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-21 07:36:33 $ * $Revision: 1.6 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_FRAMESET_IO_H #define CPL_FRAMESET_IO_H #include #include #include #include CPL_BEGIN_DECLS /* Load an image list from a frame set */ cpl_imagelist * cpl_imagelist_load_frameset(const cpl_frameset *, cpl_type, cpl_size, cpl_size) CPL_ATTR_ALLOC; CPL_END_DECLS #endif cpl-6.4.1/cplui/Makefile.am0000644000460300003120000000370212127227645012374 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO Common Pipeline Library ## Copyright (C) 2001-2006 European Southern Observatory ## 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 2 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 02111-1307 USA AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ if MAINTAINER_MODE MAINTAINERCLEANFILES = $(srcdir)/Makefile.in endif SUBDIRS = tests AM_CPPFLAGS = -DCX_LOG_DOMAIN=\"CplUi\" \ $(CPLCORE_INCLUDES) $(CX_INCLUDES) $(CFITSIO_INCLUDES) include_HEADERS = cpl_frame.h cpl_frameset.h cpl_frameset_io.h \ cpl_parameter.h cpl_parameterlist.h cpl_plugin.h \ cpl_plugininfo.h cpl_pluginlist.h cpl_recipe.h \ cpl_recipedefine.h cpl_recipeconfig.h cpl_framedata.h noinst_HEADERS = cpl_frame_impl.h lib_LTLIBRARIES = libcplui.la libcplui_la_SOURCES = cpl_frame.c cpl_frameset.c cpl_frameset_io.c \ cpl_parameter.c cpl_parameterlist.c cpl_plugin.c \ cpl_recipedefine.c \ cpl_pluginlist.c cpl_recipeconfig.c cpl_framedata.c libcplui_la_LDFLAGS = $(CX_LDFLAGS) $(CFITSIO_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libcplui_la_LIBADD = $(LIBCPLCORE) $(LIBCFITSIO) $(LIBCEXT) -lm libcplui_la_DEPENDENCIES = $(LIBCPLCORE) cpl-6.4.1/cplui/cpl_recipeconfig.c0000644000460300003120000012103511703310325013762 00000000000000/* $Id: cpl_recipeconfig.c,v 1.6 2012-01-11 13:38:29 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-01-11 13:38:29 $ * $Revision: 1.6 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include "cpl_error.h" #include "cpl_errorstate.h" #include "cpl_recipeconfig.h" /** * @defgroup cpl_recipeconfig Recipe Configurations * * This module implements the support for recipe configurations. A recipe * configuration stores information about the input data frames a recipe * can process, which other input frame are needed in addition, and * which output frames may be created by the recipe. * * For each input frame extra information, for instance, whether a * particular frame type is a required or optional recipe input, or * how many frames of a certain type are at least needed, can also * be stored. * * The information for the individual recipe configurations and also for * the individual frames can be accessed by means of a unique string * identifier for the configuration and the frame respectively. This * string identifier is called configuration tag in the former, and frame * tag in the latter case. In particular, the configuration tag is a frame * tag too, namely the frame tag of the recipe's "primary" input, or * trigger frame. * * The recipe configuration object stores a separate configuration for * each of the different frame types, indicated by its tag, it is able to * process. Each of these configurations can be retrieved, using the * appropriate configuration tag as a key. * * In the same way the information about individual frames can be retrieved * from the selected configuration. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ typedef struct _cpl_frameinfo_ cpl_frameinfo; struct _cpl_frameinfo_ { cpl_framedata data; cx_list* iframes; cx_list* oframes; }; /* * The recipe configuration object */ struct _cpl_recipeconfig_ { cx_list* frames; }; static void _cpl_frameinfo_delete(cpl_frameinfo* self) { if (self != NULL) { if (self->oframes != NULL) { cx_list_destroy(self->oframes, (cx_free_func)cpl_framedata_delete); self->oframes = NULL; } if (self->iframes != NULL) { cx_list_destroy(self->iframes, (cx_free_func)cpl_framedata_delete); self->iframes = NULL; } cpl_framedata_clear(&self->data); cx_free(self); self = NULL; } return; } inline static cpl_frameinfo* _cpl_frameinfo_create(const cxchar* tag, cxint min_count, cxint max_count, const cx_list* iframes, const cx_list* oframes) { cpl_frameinfo* self = cx_calloc(1, sizeof *self); cpl_errorstate prevstate = cpl_errorstate_get(); cpl_framedata_set((cpl_framedata*)self, tag, min_count, max_count); if (!cpl_errorstate_is_equal(prevstate)) { if (cpl_error_get_code() == CPL_ERROR_ILLEGAL_INPUT) { _cpl_frameinfo_delete(self); self = NULL; return NULL; } else { cpl_errorstate_set(prevstate); } } self->iframes = (cx_list*)iframes; self->oframes = (cx_list*)oframes; return self; } inline static cxchar** _cpl_recipeconfig_get_tags(const cx_list* self) { cxchar** tags = NULL; if (self == NULL) { return tags; } if (cx_list_empty(self) == TRUE) { tags = cx_malloc(sizeof(const cxchar*)); tags[0] = NULL; return tags; } else { cxsize i = 0; cxsize sz = cx_list_size(self); cx_list_iterator entry = cx_list_begin(self); tags = cx_calloc(sz + 1, sizeof(const cxchar*)); while (entry != cx_list_end(self)) { const cxchar** tag = cx_list_get(self, entry); tags[i] = cx_strdup(*tag); entry = cx_list_next(self, entry); ++i; } tags[sz] = NULL; } return tags; } inline static cxptr _cpl_recipeconfig_find(const cx_list* tags, const cxchar* tag) { cxptr data = NULL; cx_list_iterator entry = NULL; cx_assert(tags != NULL); cx_assert(tag != NULL); entry = cx_list_begin(tags); while (entry != cx_list_end(tags)) { const cxchar** _data = cx_list_get(tags, entry); if (strcmp(*_data, tag) == 0) { data = _data; break; } entry = cx_list_next(tags, entry); } return data; } inline static cpl_frameinfo* _cpl_recipeconfig_get_config(const cpl_recipeconfig* self, const cxchar* tag) { cx_assert((self != NULL) && (self->frames != NULL)); cx_assert(tag != NULL); return (cpl_frameinfo*)_cpl_recipeconfig_find(self->frames, tag); } /** * @brief * Create a new recipe configuration object. * * @return * The function returns a pointer to the newly created recipe configuration. * * The function creates a new, empty recipe configuration object. */ cpl_recipeconfig* cpl_recipeconfig_new(void) { cpl_recipeconfig* self = cx_calloc(1, sizeof *self); self->frames = cx_list_new(); return self; } /** * @brief * Delete a recipe configuration object. * * @param self The recipe configuration object. * * @return * Nothing. * * The function destroys the recipe configuration object @em self. Any * resources used by @em self are released. If @em self is @c NULL, nothing is * done and no error is set. */ void cpl_recipeconfig_delete(cpl_recipeconfig* self) { if (self != NULL) { if (self->frames != NULL) { cx_list_destroy(self->frames, (cx_free_func)_cpl_frameinfo_delete); self->frames = NULL; } cx_free(self); self = NULL; } return; } /** * @brief * Clear a recipe configuration object. * * @param self The recipe configuration object. * * @return * Nothing. * * The function clears the contents of the recipe configuration @em self. * After the return from this call, @em self is empty. * * @see cpl_recipeconfig_new() */ void cpl_recipeconfig_clear(cpl_recipeconfig* self) { if (self != NULL) { cx_assert(self->frames != NULL); if (cx_list_empty(self->frames) == FALSE) { cx_list_iterator position = cx_list_begin(self->frames); while (position != cx_list_end(self->frames)) { cpl_frameinfo* data = cx_list_get(self->frames, position); _cpl_frameinfo_delete(data); data = NULL; position = cx_list_next(self->frames, position); } cx_list_clear(self->frames); cx_assert(cx_list_empty(self->frames)); } } return; } /** * @brief * Get the list of supported configuration tags. * * @param self The recipe configuration object. * * @return * On success, the function returns a @c NULL terminated array of strings, * and @c NULL if an error occurred. In the latter case an appropriate * error code is also set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function retrieves the list of configuration tags stored in the * recipe configuration object @em self. The frame tags are returned as the * elements of an array of C strings. The last element of the array is * a @c NULL pointer indicating the end of the list. * * In case the recipe configuration object is empty, i.e. no configuration * tag has been added, or cpl_recipeconfig_clear() has been called for this * object, the function still returns the C string array. In this case the * first element is set to @c NULL. * * If the returned list is not used any more each element, and the array * itself must be deallocated using cpl_free(). */ char** cpl_recipeconfig_get_tags(const cpl_recipeconfig* self) { static const cxchar* const _id = "cpl_recipeconfig_get_tags"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } cx_assert(self->frames != NULL); return _cpl_recipeconfig_get_tags(self->frames); } /** * @brief * Set the list of configuration tags. * * @param self The recipe configuration object. * @param data A frame data array from which the tags are set. * * @return * The function returns @c 0 on success, or a non-zero value otherwise. * Inparticular, if the @em self is @c NULL the function returns @c -1 * and sets the appropriate error code. If any configuration tag in the * input array @em data is invalid, an empty string for instance, the * function returns @c 1 and sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The frame data array data contains an invalid tag. *
* @enderror * * The function is a convenience function to allow an initialization of * a recipe configuration from static data. The configuration tags to be * stored are taken from the frame data array @em data and are added to the * recipe configuration @em self. The configuration tag is copied to * @em self. * * In addition the tags can be configured using the remaining members of * the frame data structures of @em data. * * The function adds each configuration tag found in the array @em data * to the configuration @em self, until a configuration tag set to @em NULL * is reached. The array @em data must be terminated by such an entry, * which indicates the end of the array. */ int cpl_recipeconfig_set_tags(cpl_recipeconfig* self, const cpl_framedata* data) { static const cxchar* const _id = "cpl_recipeconfig_set_tags"; cxint status = 0; cxsize i = 0; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } if (data == NULL) { return 0; } cx_assert(self->frames != NULL); while (data[i].tag != NULL) { if (data[i].tag[0] == '\0') { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); status = 1; } else { cxptr info = _cpl_recipeconfig_find(self->frames, data[i].tag); if (info != NULL) { cx_list_remove(self->frames, info); _cpl_frameinfo_delete(info); info = NULL; } info = _cpl_frameinfo_create(data[i].tag, data[i].min_count, data[i].max_count, cx_list_new(), cx_list_new()); cx_list_push_back(self->frames, info); } ++i; } return status; } /** * @brief * Set a configuration tag. * * @param self The recipe configuration object. * @param tag The configuration tag. * @param min_count The value to set as the minimum number of frames. * @param max_count The value to set as the maximum number of frames. * * @return * The function returns @c 0 on success and a non-zero value if an * error occurred. The return value is @c -1 if @em self or @em tag is * @c NULL, or if @em tag is an invalid string. If an error occurs an * appropriate error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or tag is a NULL * pointer. *
CPL_ERROR_ILLEGAL_INPUT * The frame tag tag is an invalid tag, i.e. the empty * string. *
* @enderror * * The function creates a configuration for the configuration tag @em tag * and adds it to the recipe configuration object @em self. The minimum and * maximum number of frames of this tag can be given using the arguments * @em min_count and @em max_count. Using a value of @c -1 for the minimum * and maximum number of frames, means that these two numbers are * unspecified. If the minimum number of frames is greater than @c 0, the * frame is considered to be required, otherwise it is optional. */ int cpl_recipeconfig_set_tag(cpl_recipeconfig* self, const char* tag, cpl_size min_count, cpl_size max_count) { static const cxchar* const _id = "cpl_recipeconfig_set_tag"; cxptr info = NULL; if ((self == NULL) || (tag == NULL)) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } if (tag[0] == '\0') { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return -1; } cx_assert(self->frames != NULL); info = _cpl_recipeconfig_find(self->frames, tag); if (info != NULL) { cx_list_remove(self->frames, info); _cpl_frameinfo_delete(info); info = NULL; } info = _cpl_frameinfo_create(tag, min_count, max_count, cx_list_new(), cx_list_new()); cx_list_push_back(self->frames, info); return 0; } /** * @brief * Get the input configuration for a given tag. * * @param self The recipe configuration object. * @param tag The tag for which the input configuration is requested. * * @return * On success, the function returns a @c NULL terminated array of strings, * and @c NULL if an error occurred. In the latter case an appropriate * error code is also set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or tag is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The configuration tag tag was not found. *
* @enderror * * The function retrieves the list of input frame tags stored in the * recipe configuration for the configuration tag @em tag from the * configuration object @em self. * * In case the input configuration for the tag @em tag is empty, i.e. no * input frame tag has been added the function still returns a C string * array. In this case the first element is set to @c NULL. * * The returned array and each of its elements must be deallocated using * cpl_free() if they are no longer used. The array is @c NULL terminated, * i.e. the last element of the array is set to @c NULL. */ char** cpl_recipeconfig_get_inputs(const cpl_recipeconfig* self, const char* tag) { static const cxchar* const _id = "cpl_recipeconfig_get_inputs"; cxchar** tags = NULL; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } cx_assert(self->frames != NULL); if (tag == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } else { cpl_frameinfo* info = _cpl_recipeconfig_get_config(self, tag); if (info == NULL) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return NULL; } tags = _cpl_recipeconfig_get_tags(info->iframes); } return tags; } /** * @brief * Set the input configuration for a given tag. * * @param self The recipe configuration object. * @param tag The tag for which the input configuration is set. * @param data An array containing the configuration informations. * * @return * The function returns @c 0 on success, or a non-zero value otherwise. * If @em self or @em tag is @c NULL, or if @em tag is invalid, i.e. the * empty string the function returns @c -1 and sets an appropriate error * code. If no configuration tags were previously configured using * cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags() the function * returns @c 1. If no configuration was found for the given tag @em tag * the return value is @c 2. Finally, if the frame tag to add to the * configuration is invalid, the function returns @c 3. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or tag is a NULL * pointer. *
CPL_ERROR_ILLEGAL_INPUT * The frame tag tag is an invalid tag, i.e. the empty * string or the input frame tag read from @em data is invalid, * or the same as @em tag. *
CPL_ERROR_DATA_NOT_FOUND * No configuration for the tag tag was found, or self * was not properly initialized. *
* @enderror * * The function sets the input configuration for the tag @em tag in the * recipe configuration object @em self. The minimum and maximum number * of frames of this tag can be given using the arguments @em min_count * and @em max_count. Using a value of @c -1 for the minimum and maximum * number of frames, means that these two numbers are unspecified. Using * a value greater than @c 0 for the minimum number of frames makes the * input frame a required frame. * * The function sets the configuration data for each input tag specified * in the array @em data, until a tag set to @c NULL is reached. The array * @em data must contain such an entry as last element, in order to indicate * the end of the array. * * Before an input configuration can be set using this function, the * configuration tag @em tag must have been added to @em self previously * using cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags(). * * @see cpl_recipeconfig_set_tag(), cpl_recipeconfig_set_tags() */ int cpl_recipeconfig_set_inputs(cpl_recipeconfig* self, const char* tag, const cpl_framedata* data) { static const cxchar* const _id = "cpl_recipeconfig_set_inputs"; cxint status = 0; cxsize i = 0; cpl_frameinfo* info = NULL; if ((self == NULL) || (tag == NULL)) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } if (tag[0] == '\0') { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return -1; } if (data == NULL) { return 0; } cx_assert(self->frames != NULL); if (cx_list_empty(self->frames) == TRUE) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return 1; } info = _cpl_recipeconfig_find(self->frames, tag); if (info == NULL) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return 2; } while (data[i].tag != NULL) { if ((data[i].tag[0] == '\0') || (strcmp(data[i].tag, tag) == 0)) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); status = 3; } else { cxptr _data = _cpl_recipeconfig_find(info->iframes, data[i].tag); if (_data != NULL) { cx_list_remove(info->iframes, _data); cpl_framedata_delete(_data); _data = NULL; } _data = cpl_framedata_duplicate(&data[i]); cx_list_push_back(info->iframes, _data); } ++i; } return status; } /** * @brief * Add the configuration for the given input and configuration tag. * * @param self The recipe configuration object. * @param tag The configuration tag. * @param input The input frame tag. * @param min_count The value to set as the minimum number of frames. * @param max_count The value to set as the maximum number of frames. * * @return * The function returns @c 0 on success and a non-zero value if an * error occurred. The return value is @c -1 if @em self, @em tag or * @em input is @c NULL, or, if @em tag or @em input is an invalid string. * The function returns @c 1 if @em self was not properly initialized using * cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags(). If no * tag @em tag is found in @em self the function returns @c 2. If an error * occurs an appropriate error code is also set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, tag or input is a * NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The frame tag tag or input is an empty string, * or tag and input are equal. *
CPL_ERROR_DATA_NOT_FOUND * No configuration for the tag tag was found, or self * was not properly initialized. *
* @enderror * * The function sets the configuration for the input frame tag @em input * of the configuration associated with the tag @em tag in the recipe * configuration object @em self. The minimum and maximum number of frames * of this input frame tag are given using the @em min_count and * @em max_count arguments. Using a value of @c -1 for the minimum and * maximum number of frames, means that these two numbers are unspecified. * Using a minimum number @em min_count greater then @c 0 makes the frame * a required input. * * Before an input configuration can be set using this function, the * configuration tag @em tag must have been added to @em self previously * using cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags(). * * @see cpl_recipeconfig_set_tag(), cpl_recipeconfig_set_tags() */ int cpl_recipeconfig_set_input(cpl_recipeconfig* self, const char* tag, const char* input, cpl_size min_count, cpl_size max_count) { static const cxchar* const _id = "cpl_recipeconfig_set_input"; cxptr data = NULL; cpl_frameinfo* info = NULL; if ((self == NULL) || (tag == NULL) || (input == NULL)) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } if (tag[0] == '\0') { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return -1; } if ((input[0] == '\0') || (strcmp(input, tag) == 0)) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return -1; } cx_assert(self->frames != NULL); if (cx_list_empty(self->frames) == TRUE) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return 1; } info = _cpl_recipeconfig_find(self->frames, tag); if (info == NULL) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return 2; } data = _cpl_recipeconfig_find(info->iframes, input); if (data != NULL) { cx_list_remove(info->iframes, data); cpl_framedata_delete(data); data = NULL; } data = cpl_framedata_create(input, min_count, max_count); cx_list_push_back(info->iframes, data); return 0; } /** * @brief * Get the output configuration for a given tag. * * @param self The recipe configuration object. * @param tag The tag for which the ouput configuration is requested. * * @return * On success, the function returns a @c NULL terminated array of strings, * and @c NULL if an error occurred. In the latter case an appropriate * error code is also set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or tag is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The configuration tag tag was not found. *
* @enderror * * The function retrieves the list of all possible output frame tags * stored in the recipe configuration object @em self for the * configuration tag @em tag. * * In case the output configuration for the tag @em tag is empty, i.e. no * output frame tag has been added the function still returns a C string * array. In this case the first element is set to @c NULL. * * The returned array and each of its elements must be deallocated using * cpl_free() if they are no longer used. The array is @c NULL terminated, * i.e. the last element of the array is set to @c NULL. */ char** cpl_recipeconfig_get_outputs(const cpl_recipeconfig* self, const char* tag) { static const cxchar* const _id = "cpl_recipeconfig_get_inputs"; cxchar** tags = NULL; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } cx_assert(self->frames != NULL); if (tag == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } else { cpl_frameinfo* info = _cpl_recipeconfig_get_config(self, tag); if (info == NULL) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return NULL; } tags = _cpl_recipeconfig_get_tags(info->oframes); } return tags; } /** * @brief * Set the output configuration for a given tag. * * @param self The recipe configuration object. * @param tag The tag for which the output configuration is set. * @param data An array of strings containing the output frame tags to set. * * @return * The function returns @c 0 on success, or a non-zero value otherwise. * If @em self or @em tag is @c NULL, or if @em tag is invalid, i.e. the * empty string the function returns @c -1 and sets an appropriate error * code. If no configuration tags were previously configured using * cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags() the function * returns @c 1. If no configuration was found for the given tag @em tag * the return value is @c 2. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or tag is a NULL * pointer. *
CPL_ERROR_ILLEGAL_INPUT * The frame tag tag is an invalid tag, i.e. the empty string. *
CPL_ERROR_DATA_NOT_FOUND * No configuration for the tag tag was found, or self * was not properly initialized. *
* @enderror * * The function sets the output configuration for the tag @em tag in the * recipe configuration object @em self. The output configuration is a list * of all possible frame tags which could result from the execution of the * corresponding recipe. * * The function stores each output frame tag found in the array @em data, * until an array element set to @c NULL is reached. The array @em data must * contain such an entry as last element, in order to indicate the end of * the array. * * Before an output configuration can be set using this function, the * configuration tag @em tag must have been added to @em self previously * using cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags(). * * @see cpl_recipeconfig_set_tag(), cpl_recipeconfig_set_tags() */ int cpl_recipeconfig_set_outputs(cpl_recipeconfig* self, const char* tag, const char** data) { static const cxchar* const _id = "cpl_recipeconfig_set_outputs"; cxint status = 0; cxsize i = 0; cpl_frameinfo* info = NULL; if ((self == NULL) || (tag == NULL)) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } if (tag[0] == '\0') { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return -1; } if (data == NULL) { return 0; } cx_assert(self->frames != NULL); if (cx_list_empty(self->frames) == TRUE) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return 1; } info = _cpl_recipeconfig_find(self->frames, tag); if (info == NULL) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return 2; } while (data[i] != NULL) { if (*data[i] == '\0') { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); status = 3; } else { cxptr _data = _cpl_recipeconfig_find(info->oframes, data[i]); if (_data != NULL) { cx_list_remove(info->oframes, _data); cx_free(_data); _data = NULL; } _data = cpl_framedata_create(data[i], -1, -1); cx_list_push_back(info->oframes, _data); } ++i; } return status; } /** * @brief * Add an output frame tag for the given configuration tag. * * @param self The recipe configuration object. * @param tag The configuration tag. * @param output The output frame tag to add. * * @return * The function returns @c 0 on success and a non-zero value if an * error occurred. The return value is @c -1 if @em self, @em tag or * @em output is @c NULL, or if @em tag or @em input is an invalid string. * The function returns @c 1 if @em self was not properly initialized using * cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags(). If no * tag @em tag is found in @em self the function returns @c 2. If an error * occurs an appropriate error code is also set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, tag or output is * a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The frame tag tag or input is an invalid string, * i.e. the empty string. *
CPL_ERROR_DATA_NOT_FOUND * No configuration for the tag tag was found, or self * was not properly initialized. *
* @enderror * * The function adds the output frame tag @em ouput to the configuration * associated with the tag @em tag in the recipe configuration object * @em self. * * Before an output frame tag can be set using this function, the * configuration tag @em tag must have been added to @em self previously, * using cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags(). * * @see cpl_recipeconfig_set_tag(), cpl_recipeconfig_set_tags() */ int cpl_recipeconfig_set_output(cpl_recipeconfig* self, const char* tag, const char* output) { static const cxchar* const _id = "cpl_recipeconfig_set_output"; cxptr data = NULL; cpl_frameinfo* info = NULL; if ((self == NULL) || (tag == NULL) || (output == NULL)) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } if (tag[0] == '\0') { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return -1; } if (output[0] == '\0') { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return -1; } cx_assert(self->frames != NULL); if (cx_list_empty(self->frames) == TRUE) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return 1; } info = _cpl_recipeconfig_find(self->frames, tag); if (info == NULL) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return 2; } data = _cpl_recipeconfig_find(info->oframes, output); if (data != NULL) { cx_list_remove(info->oframes, data); cpl_framedata_delete(data); data = NULL; } data = cpl_framedata_create(output, -1, -1); cx_list_push_back(info->oframes, data); return 0; } /** * @brief * Get the minimum number of frames for the given configuration and tag. * * @param self The recipe configuration object. * @param tag The configuration tag to look up. * @param input The frame tag to search for. * * @return * The function returns the minimum number of frames with the tag @em input, * or @c -1, if an error occurred. In the latter case an appropriate error * code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, tag or input is a * NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The configuration tag tag is NULL, or an invalid * string, the empty string for instance. *
CPL_ERROR_DATA_NOT_FOUND * No frame tag tag or input was found, or * self was not properly initialized. *
* @enderror * * The function queries the recipe configuration @em self for the * configuration tag @em tag, searches this configuration for the frame tag * @em input and returns the minimum number of frames required for this * frame type. * * If the same string is passed as @em tag and @em input, the settings for * the frame with tag @em tag are returned. */ cpl_size cpl_recipeconfig_get_min_count(const cpl_recipeconfig* self, const char* tag, const char* input) { static const cxchar* const _id = "cpl_recipeconfig_get_min_count"; const cpl_frameinfo* info = NULL; const cpl_framedata* data = NULL; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } cx_assert(self->frames != NULL); if ((tag == NULL) || (input == NULL)) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } info = _cpl_recipeconfig_find(self->frames, tag); if (info == NULL) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return -1; } if (strcmp(tag, input) == 0) { data = (const cpl_framedata*)info; } else { data = _cpl_recipeconfig_find(info->iframes, input); if (data == NULL) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return -1; } } return data->min_count; } /** * @brief * Get the maximum number of frames for the given configuration and tag. * * @param self The recipe configuration object. * @param tag The configuration tag to look up. * @param input The frame tag to search for. * * @return * The function returns the maximum number of frames with the tag @em input, * or @c -1, if an error occurred. In the latter case an appropriate error * code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, tag or input is a * NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The configuration tag tag is NULL, or an invalid * string, the empty string for instance. *
CPL_ERROR_DATA_NOT_FOUND * No frame tag tag or input was found, or * self was not properly initialized. *
* @enderror * * The function queries the recipe configuration @em self for the * configuration tag @em tag, searches this configuration for the frame tag * @em input and returns the maximum number of frames required for this * frame type. * * If the same string is passed as @em tag and @em input, the settings for * the frame with tag @em tag are returned. */ cpl_size cpl_recipeconfig_get_max_count(const cpl_recipeconfig* self, const char* tag, const char* input) { static const cxchar* const _id = "cpl_recipeconfig_get_max_count"; const cpl_frameinfo* info = NULL; const cpl_framedata* data = NULL; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } cx_assert(self->frames != NULL); if ((tag == NULL) || (input == NULL)) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } info = _cpl_recipeconfig_find(self->frames, tag); if (info == NULL) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return -1; } if (strcmp(tag, input) == 0) { data = (const cpl_framedata*)info; } else { data = _cpl_recipeconfig_find(info->iframes, input); if (data == NULL) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return -1; } } return data->max_count; } /** * @brief * Check whether a frame with the given tag is required. * * @param self A recipe configuration object. * @param tag The configuration tag to look up. * @param input The frame tag to search for. * * @return * The function returns @c 1 if the frame with the tag @em input is required, * and @c 0 if the frame is not a required input. If an error occurred * @c -1 is returned and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, tag or input is a * NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The frame tag tag is NULL, an invalid string, * the empty string for instance. *
CPL_ERROR_DATA_NOT_FOUND * No frame tag tag or input was found, or * self was not properly initialized. *
* @enderror * * The function queries the recipe configuration @em self for the * configuration tag @em tag and searches this configuration for the frame * tag @em input. It returns the maximum number of frames required for * this frame type. * * If the same string is passed as @em tag and @em input, the settings for * the frame with tag @em tag are returned. */ int cpl_recipeconfig_is_required(const cpl_recipeconfig* self, const char* tag, const char* input) { static const cxchar* const _id = "cpl_recipeconfig_is_required"; const cpl_frameinfo* info = NULL; const cpl_framedata* data = NULL; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } if ((tag == NULL) || (input == NULL)) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } info = _cpl_recipeconfig_find(self->frames, tag); if (info == NULL) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return -1; } if (strcmp(tag, input) == 0) { data = (const cpl_framedata*)info; } else { data = _cpl_recipeconfig_find(info->iframes, input); if (data == NULL) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return -1; } } return (data->min_count > 0); } /**@}*/ cpl-6.4.1/cplui/cpl_frame.c0000644000460300003120000005246211703310325012426 00000000000000/* $Id: cpl_frame.c,v 1.29 2012-01-11 13:38:29 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-01-11 13:38:29 $ * $Revision: 1.29 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include "cpl_error.h" #include "cpl_frame.h" #include "cpl_fits.h" #include "cpl_frame_impl.h" #include "cpl_io_fits.h" #include "cpl_tools.h" #include #include #include /** * @defgroup cpl_frame Frames * * This module implements the @c cpl_frame type. A frame is a container for * descriptive attributes related to a data file. The attributes are related * to a data file through the file name member of the frame type. Among the * attributes which may be assigned to a data file is an attribute identifying * the type of the data stored in the file (image or table data), a * classification tag indicating the kind of data the file contains and an * attribute denoting to which group the data file belongs (raw, processed or * calibration file). For processed data a processing level indicates * whether the product is an temporary, intermediate or final product. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * The frame, attributes and fileinfo types. */ typedef struct _cpl_frame_attributes_ cpl_frame_attributes; typedef struct _cpl_frame_fileinfo_ cpl_frame_fileinfo; struct _cpl_frame_attributes_ { cpl_frame_type type; cpl_frame_group group; cpl_frame_level level; }; struct _cpl_frame_fileinfo_ { cxchar *name; }; struct _cpl_frame_ { cpl_frame_attributes attributes; cpl_frame_fileinfo *fileinfo; cxchar *tag; }; /* * Private methods */ inline static cpl_frame_fileinfo * _cpl_frame_fileinfo_new(void) { cpl_frame_fileinfo *info = cx_malloc(sizeof *info); info->name = NULL; return info; } inline static void _cpl_frame_fileinfo_delete(cpl_frame_fileinfo *info) { if (info->name) { cx_free(info->name); } cx_free(info); return; } /** * @internal * @brief * Query the number of planes of an extension. * * @param self The frame to query * @param extnum The extension number * * @return the number of planes. * * Counts how many planes are in the extension. Returns 0 if no plane * is found, and -1 if an error occurred. */ cpl_size cpl_frame_get_nplanes(const cpl_frame *self, cpl_size extnum) { const cxchar *const _id = "cpl_frame_get_nplanes"; cpl_size next; cpl_size nplanes; cxint naxis; cxint status = 0; cxint hdu_type = ANY_HDU; cxint hdu_position = extnum + 1; fitsfile *file = NULL; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -1; } if (!self->fileinfo) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return -1; } cx_assert(self->fileinfo->name != NULL); next = cpl_frame_get_nextensions(self); if (extnum > next) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return -1; } cpl_io_fits_open_diskfile(&file, self->fileinfo->name, READONLY, &status); if (status == FILE_NOT_OPENED) { status = 0; cpl_io_fits_close_file(file, &status); cpl_error_set(_id, CPL_ERROR_FILE_IO); return -1; } else { if (status != 0) { status = 0; cpl_io_fits_close_file(file, &status); cpl_error_set(_id, CPL_ERROR_BAD_FILE_FORMAT); return -1; } } fits_movabs_hdu(file, hdu_position, &hdu_type, &status); if ((status == BAD_HDU_NUM) || (status == END_OF_FILE)) { status = 0; cpl_io_fits_close_file(file, &status); cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return -1; } /* Find the number of axes */ naxis = 0; fits_get_img_dim(file, &naxis, &status); /* Check validity of naxis */ if ((naxis < 2) || (naxis > 3)) { cpl_io_fits_close_file(file, &status); cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return -1; } status = 0; /* Two dimensions cube */ if (naxis == 2) { nplanes = 1; } else { /* For 3D cubes, get the third dimension size */ CPL_FITSIO_TYPE *naxes = cx_malloc(naxis * sizeof(CPL_FITSIO_TYPE)); CPL_FITSIO_GET_SIZE(file, naxis, naxes, &status); nplanes = (cpl_size)naxes[2]; if(naxes[2] < 1) nplanes = 0; cx_free(naxes); } cpl_io_fits_close_file(file, &status); cx_assert(status == 0); return nplanes; } /* * Public methods */ /** * @brief * Create a new, empty frame. * * @return * A handle for the newly created frame. * * The function allocates the memory for the new frame and initialises it * to an empty frame, i.e. it is created without tag and file information, * and the type, group and level set to @c CPL_FRAME_TYPE_NONE, * @c CPL_FRAME_GROUP_NONE, and @c CPL_FRAME_LEVEL_NONE, resepctively. */ cpl_frame * cpl_frame_new(void) { cpl_frame *self = cx_malloc(sizeof *self); self->tag = NULL; self->fileinfo = NULL; self->attributes.type = CPL_FRAME_TYPE_NONE; self->attributes.group = CPL_FRAME_GROUP_NONE; self->attributes.level = CPL_FRAME_LEVEL_NONE; return self; } /** * @brief * Create a copy of a frame. * * @param other The frame to copy. * * @return * The function returns a handle for the created clone. If an error * occurs the function returns @c NULL and sets an appropriate error * code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter other is a NULL pointer. *
* @enderror * * The function creates a clone of the input frame @em other. All members * of the input frame are copied. */ cpl_frame * cpl_frame_duplicate(const cpl_frame *other) { const cxchar *const _id = "cpl_frame_duplicate"; cpl_frame *copy; if (other == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } copy = cx_malloc_clear(sizeof *copy); if (other->tag) { copy->tag = cx_strdup(other->tag); } if (other->fileinfo) { copy->fileinfo = cx_malloc(sizeof(cpl_frame_fileinfo)); if (other->fileinfo->name) { copy->fileinfo->name = cx_strdup(other->fileinfo->name); } else { copy->fileinfo->name = NULL; } } copy->attributes.type = other->attributes.type; copy->attributes.group = other->attributes.group; copy->attributes.level = other->attributes.level; return copy; } /** * @brief * Destroy a frame. * * @param self A frame. * * @return Nothing. * * The function deallocates the memory used by the frame @em self. * If @em self is @c NULL, nothing is done, and no error is set. */ void cpl_frame_delete(cpl_frame *self) { if (self) { if (self->tag) { cx_free(self->tag); } if (self->fileinfo) { _cpl_frame_fileinfo_delete(self->fileinfo); } cx_free(self); } return; } /** * @brief * Get the file name to which a frame refers. * * @param self A frame. * * @return * The file name to which the frame refers, or @c NULL if a file name * has not been set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * The frame self is not associated to a file. *
* @enderror * * The function returns the read-only name of a file associated to @em self. A file * is associated to @em self by calling @b cpl_frame_set_filename() for * @em self. If @em self is not associated to a file this function returns * @c NULL. */ const char * cpl_frame_get_filename(const cpl_frame *self) { const cxchar *const _id = "cpl_frame_get_filename"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } if (!self->fileinfo) { cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND); return NULL; } cx_assert(self->fileinfo->name != NULL); return self->fileinfo->name; } /** * @brief * Get the category tag of a frame. * * @param self A frame. * * @return * The frame's category tag or @c NULL if the tag is not set. The function * returns @c NULL if an error occurs and an appropriate error code is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the read-only frame's category tag. If a tag has not yet * been set a @c NULL pointer is returned. */ const char * cpl_frame_get_tag(const cpl_frame *self) { const cxchar *const _id = "cpl_frame_get_tag"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } return self->tag; } /** * @brief * Get the type of a frame. * * @param self A frame. * * @return * The frame's type. The returns @c CPL_FRAME_TYPE_NONE if an error occurs * and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the type of the data object to which it currently * refers. */ cpl_frame_type cpl_frame_get_type(const cpl_frame *self) { const cxchar *const _id = "cpl_frame_get_type"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_FRAME_TYPE_NONE; } return self->attributes.type; } /** * @brief * Get the current group of a frame. * * @param self A frame. * * @return * The frame's current group. The function returns @c CPL_FRAME_GROUP_NONE * if an error occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the group attribute of the frame @em self. */ cpl_frame_group cpl_frame_get_group(const cpl_frame *self) { const cxchar *const _id = "cpl_frame_get_group"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_FRAME_GROUP_NONE; } return self->attributes.group; } /** * @brief * Get the current level of a frame. * * @param self A frame. * * @return * The frame's current level. The function returns @c CPL_FRAME_LEVEL_NONE * if an error occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the level attribute of the frame @em self. */ cpl_frame_level cpl_frame_get_level(const cpl_frame *self) { const cxchar *const _id = "cpl_frame_get_level"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_FRAME_LEVEL_NONE; } return self->attributes.level; } /** * @brief * Set the file name to which a frame refers. * * @param self A frame. * @param filename The new file name. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or filename is a NULL * pointer. *
* @enderror * * The function sets the name of the file, to which the frame @em self * refers. Any file name which was previously set by a call to this * function is replaced. If no file name is present yet it is created * and initialised to @em filename. */ cpl_error_code cpl_frame_set_filename(cpl_frame *self, const char *filename) { const cxchar *const _id = "cpl_frame_set_filename"; cpl_frame_fileinfo *info; if (self == NULL || filename == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } if (!self->fileinfo) { self->fileinfo = _cpl_frame_fileinfo_new(); cx_assert(self->fileinfo != NULL); } info = self->fileinfo; if (info->name) { cx_free(info->name); info->name = NULL; } info->name = cx_strdup(filename); return CPL_ERROR_NONE; } /** * @brief * Set a frame's category tag * * @param self A frame. * @param tag The new category tag. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or tag is a NULL * pointer. *
* @enderror * * The function sets the category tag of @em self, replacing any * previously set tag. If the frame does not yet have a tag is is * created and initialised to @em tag. */ cpl_error_code cpl_frame_set_tag(cpl_frame *self, const char *tag) { const cxchar *const _id = "cpl_frame_set_tag"; if (self == NULL || tag == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } if (self->tag) { cx_free(self->tag); self->tag = NULL; } self->tag = cx_strdup(tag); return CPL_ERROR_NONE; } /** * @brief * Set the type of a frame. * * @param self A frame. * @param type New frame type. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function sets the type of the frame @em self to @em type. */ cpl_error_code cpl_frame_set_type(cpl_frame *self, cpl_frame_type type) { const cxchar *const _id = "cpl_frame_set_type"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } self->attributes.type = type; return CPL_ERROR_NONE; } /** * @brief * Set the group attribute of a frame. * * @param self A frame. * @param group New group attribute. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function sets the group attribute of the frame @em self to @em group. */ cpl_error_code cpl_frame_set_group(cpl_frame *self, cpl_frame_group group) { const cxchar *const _id = "cpl_frame_set_group"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } self->attributes.group = group; return CPL_ERROR_NONE; } /** * @brief * Set the level attribute of a frame. * * @param self A frame. * @param level New level attribute. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function sets the level attribute of the frame @em self to @em level. */ cpl_error_code cpl_frame_set_level(cpl_frame *self, cpl_frame_level level) { const cxchar *const _id = "cpl_frame_set_level"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } self->attributes.level = level; return CPL_ERROR_NONE; } /** * @brief * Get the number of extensions of this frame * * @param self A frame. * * @return * The number of extensions in the file * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * The frame self is not associated to a file. *
* @enderror * * The function returns the number of extensions in the frame or -1 in * case of error. */ cpl_size cpl_frame_get_nextensions(const cpl_frame *self) { cpl_size next; if (self == NULL) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return -1; } if (!self->fileinfo) { cpl_error_set(cpl_func, CPL_ERROR_DATA_NOT_FOUND); return -1; } if((next = cpl_fits_count_extensions(self->fileinfo->name)) == -1) return -1; return next; } /** * @brief * Dump the frame debugging information to the given stream. * * @param frame The frame. * @param stream The output stream to use. * * @return Nothing. * * The function dumps the contents of the frame @em frame to the * output stream @em stream. If @em stream is @c NULL the function writes * to the standard output. If @em frame is @c NULL the function does nothing. */ void cpl_frame_dump(const cpl_frame *frame, FILE *stream) { const char *name; const char *tag; cpl_frame_type type; cpl_frame_group group; cpl_frame_level level; if (frame == NULL) return; if (stream == NULL) { stream = stdout; } name = cpl_frame_get_filename(frame); tag = cpl_frame_get_tag(frame); type = cpl_frame_get_type(frame); group = cpl_frame_get_group(frame); level = cpl_frame_get_level(frame); fprintf(stream, "%s \t%s ",name, tag); switch (type) { case CPL_FRAME_TYPE_IMAGE: fprintf(stream, "%s ","CPL_FRAME_TYPE_IMAGE"); break; case CPL_FRAME_TYPE_MATRIX: fprintf(stream, "%s ","CPL_FRAME_TYPE_MATRIX"); break; case CPL_FRAME_TYPE_TABLE: fprintf(stream, "%s ","CPL_FRAME_TYPE_TABLE"); break; case CPL_FRAME_TYPE_PAF: fprintf(stream, "%s ","CPL_FRAME_TYPE_PAF"); break; case CPL_FRAME_TYPE_ANY: fprintf(stream, "%s ","CPL_FRAME_TYPE_ANY"); break; default: fprintf(stream, "%s ","CPL_FRAME_TYPE_NONE"); break; } switch (group) { case CPL_FRAME_GROUP_RAW: fprintf(stream, "%s ","CPL_FRAME_GROUP_RAW"); break; case CPL_FRAME_GROUP_CALIB: fprintf(stream, "%s ", "CPL_FRAME_GROUP_CALIB"); break; case CPL_FRAME_GROUP_PRODUCT: fprintf(stream, "%s ", "CPL_FRAME_GROUP_PRODUCT"); break; default: fprintf(stream, "%s ","CPL_FRAME_GROUP_NONE"); break; } switch (level) { case CPL_FRAME_LEVEL_TEMPORARY: fprintf(stream, "%s ","CPL_FRAME_LEVEL_TEMPORARY"); break; case CPL_FRAME_LEVEL_INTERMEDIATE: fprintf(stream, "%s ","CPL_FRAME_LEVEL_INTERMEDIATE"); break; case CPL_FRAME_LEVEL_FINAL: fprintf(stream, "%s ", "CPL_FRAME_LEVEL_FINAL"); break; default: fprintf(stream, "%s ","CPL_FRAME_LEVEL_NONE"); break; } fprintf(stream, "\n"); return; } /**@}*/ cpl-6.4.1/cplui/cpl_parameter.c0000644000460300003120000030377112106171221013314 00000000000000/* $Id: cpl_parameter.c,v 1.33 2013-02-11 13:30:56 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-02-11 13:30:56 $ * $Revision: 1.33 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include "cpl_error.h" #include "cpl_parameter.h" /** * @defgroup cpl_parameter Parameters * * This module implements a class of data types which can be used to manage * context specific, named parameters. They provide a standard way to pass, * for instance, command line information to different components of an * application. * * The fundamental parts of a parameter are its name, a context to which it * belongs (a specific component of an application for instance), its * current value and a default value. * * The implementation supports three classes of parameters: * - A plain value * - A range of values * - An enumeration value * * When a parameter is created it is created for a particular value type. * The type of a parameter's current and default value may be (cf. * @ref cpl_type): * - @c CPL_TYPE_BOOL * - @c CPL_TYPE_INT * - @c CPL_TYPE_DOUBLE * - @c CPL_TYPE_STRING * * When a value is assigned to a parameter, the different parameter classes * behave differently. For a plain value, no checks are applied to the * data value to be assigned. For a range or an enumeration, on the other * hand, the value to be stored is validated with respect to the minimum and * maximum value of the range and the list of enumeration alternatives * respectively. If the value is invalid, an error is reported. * * @note * The validation of parameter values is not yet implemented. * * The functions to create a new parameter of a particular class are * polymorphic and accept any value type mentioned above to initialise the * parameter to create. This is accomplished by using a variable argument * list. The number and type of the parameters expected by these functions * is determined from the parameter class and the indicated value type. * * The constructor of a plain value expects a single value, the parameter's * default value, which @em must be of the appropriate type, as argument while * the constructor for a range expects the default value, the minimum and the * maximum value. The constructor for an enumeration expects as arguments the * default value, the number of alternatives following and the list of * alternatives. Note that the default value must be a member of the list of * alternative enumeration values. * * An example of how parameters of the different classes are created and * destroyed is shown below: * @code * cpl_parameter *value; * cpl_parameter *range; * cpl_parameter *enumeration; * * ... * * value = cpl_parameter_new_value("Value", CPL_TYPE_INT, * "This is a plain value of type integer", * "Example", * -1); * * range = cpl_parameter_new_range("Range", CPL_TYPE_DOUBLE, * "This is a value range of type double", * "Example", * 0.5, 0.0, 1.0); * * enumeration = cpl_parameter_new_enum("Enum", CPL_TYPE_STRING, * "This is an enumeration of type " * "string", * "Example", * "first", 3, "first", "second", * "third"); * * ... * * cpl_parameter_delete(value); * cpl_parameter_delete(range); * cpl_parameter_delete(enumeration); * @endcode * * After the parameter has been created and initialised the parameters current * value equals its default value. The initialisation values are copied into * the parameter, i.e. if an initialiser value resides in dynamically allocated * memory, it can be deallocated after the parameter has been initialised * without affecting the created parameter. * * @note A variable argument list allows only limited type checking. Therefore, * code explicitly what you mean and double check the constructor calls that * the number of arguments and the types of the elements of the variable * argument list are what the constructor expects. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * Utility data type storing parameter setup flags */ typedef struct _cpl_parameter_info_ cpl_parameter_info; struct _cpl_parameter_info_ { cxbool f_active; cxchar *f_key; cxbool e_active; cxchar *e_key; cxbool c_active; cxchar *c_key; cxint32 id; cxbool present; }; /* * Utility data types to store parameter values */ union _cpl_parameter_data_ { cxchar c; cxbool b; cxint i; cxlong l; cxfloat f; cxdouble d; cxchar *s; }; typedef union _cpl_parameter_data_ cpl_parameter_data; struct _cpl_parameter_value_ { cpl_type type; cpl_parameter_data data; cpl_parameter_data preset; }; typedef struct _cpl_parameter_value_ cpl_parameter_value; struct _cpl_parameter_range_ { cpl_parameter_value value; cpl_parameter_data min; cpl_parameter_data max; }; typedef struct _cpl_parameter_range_ cpl_parameter_range; struct _cpl_parameter_enum_ { cpl_parameter_value value; cpl_parameter_data *vlist; cxsize sz; }; typedef struct _cpl_parameter_enum_ cpl_parameter_enum; struct _cpl_parameter_ { cxchar *name; cxchar *context; cxchar *description; cxchar *usertag; cpl_parameter_class class; cpl_parameter_value *data; cpl_parameter_info info; }; /* * Private functions */ inline static cxbool _cpl_parameter_validate_type(cpl_type type) { switch (type) { case CPL_TYPE_BOOL: case CPL_TYPE_INT: case CPL_TYPE_DOUBLE: case CPL_TYPE_STRING: break; default: return FALSE; break; } return TRUE; } inline static cxint _cpl_parameter_data_create(cpl_parameter_data *item, cpl_type type, va_list *ap) { switch (type) { case CPL_TYPE_CHAR: { item->c = (cxchar)va_arg(*ap, cxint); break; } case CPL_TYPE_BOOL: { cxint arg = va_arg(*ap, cxint); item->b = arg ? TRUE : FALSE; break; } case CPL_TYPE_INT: { item->i = va_arg(*ap, cxint); break; } case CPL_TYPE_LONG: { item->l = va_arg(*ap, cxlong); break; } case CPL_TYPE_FLOAT: { item->f = (float)va_arg(*ap, cxdouble); break; } case CPL_TYPE_DOUBLE: { item->d = va_arg(*ap, cxdouble); break; } case CPL_TYPE_STRING: { const cxchar *arg = va_arg(*ap, const cxchar *); if (item->s) { cx_free(item->s); item->s = NULL; } if (arg) { item->s = cx_strdup(arg); } break; } default: return 1; break; } return 0; } inline static cxint _cpl_parameter_data_set(cpl_parameter_data *item, cpl_type type, cxptr value) { switch (type) { case CPL_TYPE_CHAR: { item->c = *(cxchar *)value; break; } case CPL_TYPE_BOOL: { cxint arg = *(cxint *)value; item->b = arg ? TRUE : FALSE; break; } case CPL_TYPE_INT: { item->i = *(cxint *)value; break; } case CPL_TYPE_LONG: { item->l = *(cxlong *)value; break; } case CPL_TYPE_FLOAT: { item->f = *(cxfloat *)value; break; } case CPL_TYPE_DOUBLE: { item->d = *(cxdouble *)value; break; } case CPL_TYPE_STRING: { const cxchar *const arg = *(const cxchar *const *)value; if (item->s) { cx_free(item->s); item->s = NULL; } if (arg) { item->s = cx_strdup(arg); } break; } default: return 1; break; } return 0; } inline static cpl_parameter_value * _cpl_parameter_value_new(cpl_type type, cxsize size) { cpl_parameter_value *self = (cpl_parameter_value *)cx_calloc(1, size); self->type = type; return self; } inline static cxint _cpl_parameter_value_create(cpl_parameter *self, va_list *ap) { cpl_parameter_value *data = NULL; cpl_type type = CPL_TYPE_INVALID; cx_assert(self != NULL); data = self->data; cx_assert(data != NULL); type = data->type; if (_cpl_parameter_data_create(&data->preset, type, ap)) { return 1; } if (_cpl_parameter_data_set(&data->data, type, &data->preset)) { return 1; } return 0; } inline static int _cpl_parameter_value_copy(cpl_parameter *self, const cpl_parameter *other) { cpl_parameter_value *data = NULL; cpl_parameter_value *_data = NULL; cx_assert((self != NULL) && (other != NULL)); data = (cpl_parameter_value *)self->data; _data = (cpl_parameter_value *)other->data; cx_assert((data != NULL) && (_data != NULL)); data->type = _data->type; if (_cpl_parameter_data_set(&data->data, data->type, &_data->data)) { return 1; } if (_cpl_parameter_data_set(&data->preset, data->type, &_data->preset)) { return 1; } return 0; } inline static void _cpl_parameter_value_destroy(cpl_parameter_value *self) { if (self->type == CPL_TYPE_STRING) { if (self->data.s) { cx_free(self->data.s); self->data.s = NULL; } if (self->preset.s) { cx_free(self->preset.s); self->preset.s = NULL; } } return; } inline static cxint _cpl_parameter_range_create(cpl_parameter *self, va_list *ap) { cpl_parameter_range *data = NULL; cpl_type type = CPL_TYPE_INVALID; cx_assert(self != NULL); data = (cpl_parameter_range *)self->data; cx_assert(data != NULL); type = data->value.type; if (_cpl_parameter_data_create(&data->value.preset, type, ap)) { return 1; } if (_cpl_parameter_data_set(&data->value.data, type, &data->value.preset)) { return 1; } if (_cpl_parameter_data_create(&data->min, type, ap)) { return 1; } if (_cpl_parameter_data_create(&data->max, type, ap)) { return 1; } return 0; } inline static int _cpl_parameter_range_copy(cpl_parameter *self, const cpl_parameter *other) { cpl_parameter_range *data = NULL; cpl_parameter_range *_data = NULL; cx_assert((self != NULL) && (other != NULL)); /* * Copy the value part first */ if (_cpl_parameter_value_copy(self, other)) { return 1; } /* * Copy domain limits of the range */ data = (cpl_parameter_range *)self->data; _data = (cpl_parameter_range *)other->data; cx_assert((data != NULL) && (_data != NULL)); if (_cpl_parameter_data_set(&data->min, data->value.type, &data->min)) { return 1; } if (_cpl_parameter_data_set(&data->max, data->value.type, &data->max)) { return 1; } return 0; } inline static void _cpl_parameter_range_destroy(cpl_parameter_value *self) { cpl_parameter_range *_self = (cpl_parameter_range *)self; cpl_type type = self->type; if (type == CPL_TYPE_STRING) { if (_self->min.s) { cx_free(_self->min.s); _self->min.s = NULL; } if (_self->max.s) { cx_free(_self->max.s); _self->max.s = NULL; } } _cpl_parameter_value_destroy(self); return; } inline static cxint _cpl_parameter_enum_create(cpl_parameter *self, va_list *ap) { register cxsize i; cpl_parameter_enum *data = NULL; cpl_type type = CPL_TYPE_INVALID; cx_assert(self != NULL); data = (cpl_parameter_enum *)self->data; cx_assert(data != NULL); type = data->value.type; if (_cpl_parameter_data_create(&data->value.preset, type, ap)) { return 1; } if (_cpl_parameter_data_set(&data->value.data, type, &data->value.preset)) { return 1; } /* * Copy the enum alternatives from the argument list. */ data->sz = va_arg(*ap, cxint); data->vlist = cx_calloc(data->sz, sizeof(cpl_parameter_data)); for (i = 0; i < data->sz; ++i) { if (_cpl_parameter_data_create(data->vlist + i, type, ap)) { return 1; } } return 0; } inline static int _cpl_parameter_enum_copy(cpl_parameter *self, const cpl_parameter *other) { register cxsize i = 0; cpl_parameter_enum *data = NULL; cpl_parameter_enum *_data = NULL; cx_assert((self != NULL) && (other != NULL)); /* * Copy the value part first */ if (_cpl_parameter_value_copy(self, other)) { return 1; } /* * Copy the enum alternatives */ data = (cpl_parameter_enum *)self->data; _data = (cpl_parameter_enum *)other->data; cx_assert((data != NULL) && (_data != NULL)); data->sz = _data->sz; data->vlist = cx_calloc(data->sz, sizeof(cpl_parameter_data)); for (i = 0; i < data->sz; ++i) { if (_cpl_parameter_data_set(data->vlist + i, data->value.type, _data->vlist + i)) { cx_free(data->vlist); return 1; } } return 0; } inline static void _cpl_parameter_enum_destroy(cpl_parameter_value *self) { cpl_parameter_enum *_self = (cpl_parameter_enum *)self; cpl_type type = self->type; if (type == CPL_TYPE_STRING) { register cxsize i; for (i = 0; i < _self->sz; i++) { if (_self->vlist[i].s) { cx_free(_self->vlist[i].s); } } } if (_self->vlist) { cx_free(_self->vlist); } _cpl_parameter_value_destroy(self); return; } inline static cxint _cpl_parameter_default_set(cpl_parameter *self, cxptr value) { cpl_parameter_value *data = self->data; cpl_type type = data->type; cx_assert(value != NULL); if (_cpl_parameter_data_set(&data->preset, type, value)) { return 1; } return 0; } inline static cxint _cpl_parameter_value_set(cpl_parameter *self, cxptr value) { cpl_parameter_value *data = self->data; cpl_type type = data->type; cx_assert(value != NULL); if (_cpl_parameter_data_set(&data->data, type, value)) { return 1; } return 0; } inline static cpl_parameter * _cpl_parameter_create(const cxchar *name, const cxchar *description, const cxchar *context) { cpl_parameter *self = NULL; cx_assert(name != 0); self = (cpl_parameter *) cx_malloc(sizeof(cpl_parameter)); self->name = cx_strdup(name); self->context = context ? cx_strdup(context) : NULL; self->description = description ? cx_strdup(description) : NULL; self->usertag = NULL; self->class = CPL_PARAMETER_CLASS_INVALID; self->data = NULL; self->info.f_active = TRUE; self->info.e_active = TRUE; self->info.c_active = TRUE; self->info.f_key = cx_strdup(self->name); self->info.e_key = cx_strdup(self->name); self->info.c_key = cx_strdup(self->name); self->info.present = FALSE; self->info.id = 0; return self; } inline static int _cpl_parameter_init(cpl_parameter *parameter, va_list *ap) { cxint status; cx_assert(parameter != NULL); cx_assert(ap != NULL); switch (parameter->class) { case CPL_PARAMETER_CLASS_VALUE: status = _cpl_parameter_value_create(parameter, ap); break; case CPL_PARAMETER_CLASS_RANGE: status = _cpl_parameter_range_create(parameter, ap); break; case CPL_PARAMETER_CLASS_ENUM: status = _cpl_parameter_enum_create(parameter, ap); break; default: cpl_error_set(cpl_func, CPL_ERROR_INVALID_TYPE); status = -1; break; } if (status) { if (status == -1) { cx_warning("%s: parameter at %p has invalid class id %02x", cpl_func, (const void*)parameter, parameter->class); } else { cx_warning("%s: parameter at %p has illegal combination of" "class id (%02x) and type id (%02x)", cpl_func, (const void*)parameter, parameter->class, parameter->data->type); } return 1; } return 0; } inline static int _cpl_parameter_copy(cpl_parameter *self, const cpl_parameter *other) { cxint status; cx_assert((self != NULL) && (other != NULL)); switch (self->class) { case CPL_PARAMETER_CLASS_VALUE: status = _cpl_parameter_value_copy(self, other); break; case CPL_PARAMETER_CLASS_RANGE: status = _cpl_parameter_range_copy(self, other); break; case CPL_PARAMETER_CLASS_ENUM: status = _cpl_parameter_enum_copy(self, other); break; default: cpl_error_set(cpl_func, CPL_ERROR_INVALID_TYPE); status = -1; break; } if (status) { if (status == -1) { cx_warning("%s: parameter at %p has invalid class id %02x", cpl_func, (const void *)self, self->class); } else { cx_warning("%s: parameter at %p has illegal combination of" "class id (%02x) and type id (%02x)", cpl_func, (const void *)self, self->class, self->data->type); } return 1; } return 0; } /** * @brief * Create a new value parameter. * * @param name The parameter's unique name * @param type The type of the parameter's current and default value. * @param description An optional comment or description of the parameter. * @param context The context to which the parameter belongs. * @param ... Arguments used for parameter initialisation. * * @return * The function returns the newly created parameter, or @c NULL if * the parameter could not be created. In the latter case an appropriate * error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter name is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * An unsupported type was passed as type. *
* @enderror * * The function allocates memory for a value parameter with the name @em name * and a value type @em type. Optionally a comment describing the parameter * may be passed by @em description and the context to which the parameter * belongs may be given by @em context. * * The newly created parameter is initialised with the default value passed * to the function as the only variable argument list argument. The type * of the value must match the parameter's value type as it is indicated by * @em type. * * The following example creates an integer value parameter with the * unique name @c application.setup.value which belongs to the context * @c application.setup with the default value @em def * * @par Example: * @code * int def = 1; * * cpl_parameter *p = cpl_parameter_new_value("application.setup.value", * CPL_TYPE_INT, * "An integer value", * "application.setup", * def); * @endcode * * @see cpl_parameter_new_range(), cpl_parameter_new_enum() */ cpl_parameter * cpl_parameter_new_value(const char *name, cpl_type type, const char *description, const char *context, ...) { va_list ap; cpl_parameter *p; if (!name) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } if (_cpl_parameter_validate_type(type) != TRUE) { cpl_error_set_message(cpl_func, CPL_ERROR_INVALID_TYPE, "Unsupported parameter type %s", cpl_type_get_name(type)); return NULL; } p = _cpl_parameter_create(name, description, context); cx_assert(p != NULL); p->class = CPL_PARAMETER_CLASS_VALUE; p->data = _cpl_parameter_value_new(type, sizeof(cpl_parameter_value)); cx_assert(p->data != NULL); va_start(ap, context); if (_cpl_parameter_init(p, &ap)) { cpl_parameter_delete(p); va_end(ap); return NULL; } va_end(ap); return p; } /** * @brief * Create a new range parameter. * * @param name The parameter's unique name * @param type The type of the parameter's current and default value. * @param description An optional comment or description of the parameter. * @param context The context to which the parameter belongs. * @param ... Arguments used for parameter initialisation. * * @return * The function returns the newly created parameter, or @c NULL if * the parameter could not be created. In the latter case an appropriate * error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * An unsupported type was passed as type. *
* @enderror * * The function allocates memory for a range parameter with the name @em name * and a value type @em type. Optionally a comment describing the parameter * may be passed by @em description and the context to which the parameter * belongs may be given by @em context. * * To properly initialise the newly created range the parameters default * value together with the minimum and maximum value of the range has to * be passed as the variable argument list arguments. The type of all * initialisation arguments must match the parameter's value type as it * is indicated by @em type. * * The following example creates a double range parameter with the * unique name @c application.setup.range which belongs to the context * @c application.setup with the default @em def and the range boundary * values @em minimum and @em maximum. * * @par Example: * @code * double def = 0.5; * double min = 0.0; * double max = 1.0; * * cpl_parameter *p = cpl_parameter_new_range("application.setup.range", * CPL_TYPE_DOUBLE, * "A range of type double", * "application.setup", * def, min, max); * @endcode * * @see cpl_parameter_new_value(), cpl_parameter_new_enum() */ cpl_parameter * cpl_parameter_new_range(const char *name, cpl_type type, const char *description, const char *context, ...) { va_list ap; cpl_parameter *p; if (!name) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } if (_cpl_parameter_validate_type(type) != TRUE) { cpl_error_set_message(cpl_func, CPL_ERROR_INVALID_TYPE, "Unsupported parameter type %s", cpl_type_get_name(type)); return NULL; } p = _cpl_parameter_create(name, description, context); cx_assert(p != NULL); p->class = CPL_PARAMETER_CLASS_RANGE; p->data = _cpl_parameter_value_new(type, sizeof(cpl_parameter_range)); cx_assert(p->data != NULL); va_start(ap, context); if (_cpl_parameter_init(p, &ap)) { cpl_parameter_delete(p); va_end(ap); return NULL; } va_end(ap); return p; } /** * @brief * Create a new enumeration parameter. * * @param name The parameter's unique name * @param type The type of the parameter's current and default value. * @param description An optional comment or description of the parameter. * @param context The context to which the parameter belongs. * @param ... Arguments used for parameter initialisation. * * @return * The function returns the newly created parameter, or @c NULL if * the parameter could not be created. In the latter case an appropriate * error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * An unsupported type was passed as type. *
* @enderror * * The function allocates memory for an enumeration parameter with the name * @em name and a value type @em type. Optionally a comment describing the * parameter may be passed by @em description and the context to which the * parameter belongs may be given by @em context. * * To properly initialise the newly created enumeration, the parameter's * default value (together with the number of alternatives following) and * the list of enumeration alternatives must be passed as the variable * argument list arguments. The list of enumeration alternatives must * contain the default value! Apart from the number of possible alternatives, * which must be an argument of type @c int, the type of all initialisation * arguments must match the parameter's value type as it is indicated by * @em type. * * The following example creates a string enumeration parameter with the * unique name @c application.setup.enum which belongs to the context * @c application.setup with the default @em def and 3 enumeration * alternatives. * * @par Example: * @code * const char *first = "first"; * const char *second = "second"; * const char *third = "third"; * * cpl_parameter *p = cpl_parameter_new_enum("application.setup.enum", * CPL_TYPE_STRING, * "An enum of type string", * "application.setup", * first, 3, first, second, * third); * @endcode * * @see cpl_parameter_new_value(), cpl_parameter_new_range() */ cpl_parameter * cpl_parameter_new_enum(const char *name, cpl_type type, const char *description, const char *context, ...) { va_list ap; cpl_parameter *p; if (!name) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } if (_cpl_parameter_validate_type(type) != TRUE) { cpl_error_set_message(cpl_func, CPL_ERROR_INVALID_TYPE, "Unsupported parameter type %s", cpl_type_get_name(type)); return NULL; } p = _cpl_parameter_create(name, description, context); cx_assert(p != NULL); p->class = CPL_PARAMETER_CLASS_ENUM; p->data = _cpl_parameter_value_new(type, sizeof(cpl_parameter_enum)); cx_assert(p->data != NULL); va_start(ap, context); if (_cpl_parameter_init(p, &ap)) { cpl_parameter_delete(p); va_end(ap); return NULL; } va_end(ap); return p; } /** * @brief * Create a copy of a parameter. * * @param self The parameter to copy. * * @return * The copy of the given parameter, or @c NULL in case of an error. * In the latter case an appropriate error code is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns a copy of the parameter @em self. The copy is a * deep copy, i.e. all parameter properties are copied. */ cpl_parameter *cpl_parameter_duplicate(const cpl_parameter *self) { cpl_parameter *_self = NULL; if (self == NULL) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } _self = cx_malloc(sizeof(cpl_parameter)); _self->name = cx_strdup(self->name); _self->context = cx_strdup(self->context); _self->description = cx_strdup(self->description); _self->usertag = cx_strdup(self->usertag); _self->class = self->class; _self->data = NULL; switch (_self->class) { case CPL_PARAMETER_CLASS_VALUE: _self->data = _cpl_parameter_value_new(self->data->type, sizeof(cpl_parameter_value)); break; case CPL_PARAMETER_CLASS_RANGE: _self->data = _cpl_parameter_value_new(self->data->type, sizeof(cpl_parameter_range)); break; case CPL_PARAMETER_CLASS_ENUM: _self->data = _cpl_parameter_value_new(self->data->type, sizeof(cpl_parameter_enum)); break; default: cpl_parameter_delete(_self); cpl_error_set(cpl_func, CPL_ERROR_INVALID_TYPE); return NULL; break; } cx_assert(_self->data != NULL); if (_cpl_parameter_copy(_self, self)) { cpl_parameter_delete(_self); return NULL; } _self->info.f_active = self->info.f_active; _self->info.e_active = self->info.e_active; _self->info.c_active = self->info.c_active; _self->info.f_key = cx_strdup(self->info.f_key); _self->info.e_key = cx_strdup(self->info.e_key); _self->info.c_key = cx_strdup(self->info.c_key); _self->info.present = self->info.present; _self->info.id = self->info.id; return _self; } /** * @brief * Delete a parameter. * * @param self The parameter to delete. * * @return Nothing. * * The function deletes a parameter of any class and type. All memory resources * acquired by the parameter during its usage are released. If the parameter @em self * is @c NULL, nothing is done and no error is set. */ void cpl_parameter_delete(cpl_parameter *self) { if (self != NULL) { if (self->data != NULL) { switch (self->class) { case CPL_PARAMETER_CLASS_VALUE: _cpl_parameter_value_destroy(self->data); break; case CPL_PARAMETER_CLASS_RANGE: _cpl_parameter_range_destroy(self->data); break; case CPL_PARAMETER_CLASS_ENUM: _cpl_parameter_enum_destroy(self->data); break; default: break; } cx_free(self->data); self->data = NULL; } if (self->usertag != NULL) { cx_free(self->usertag); self->usertag = NULL; } if (self->description != NULL) { cx_free(self->description); self->description = NULL; } if (self->context != NULL) { cx_free(self->context); self->context = NULL; } if (self->name != NULL) { cx_free(self->name); self->name = NULL; } if (self->info.f_key != NULL) { cx_free(self->info.f_key); self->info.f_key = NULL; } if (self->info.e_key != NULL) { cx_free(self->info.e_key); self->info.e_key = NULL; } if (self->info.c_key != NULL) { cx_free(self->info.c_key); self->info.c_key = NULL; } cx_free(self); } return; } /** * @brief * Assign a boolean value to a parameter. * * @param self The parameter the value is assigned to. * @param value The boolean value to be assigned. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_BOOL. *
* @enderror * * The function assigns a boolean value @em value to a parameter of type * @c CPL_TYPE_BOOL. Any non-zero value passed as @em value is interpreted * as @em true. */ cpl_error_code cpl_parameter_set_bool(cpl_parameter *self, int value) { if (!self) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } cx_assert(self->data); if (self->data->type != CPL_TYPE_BOOL) { return cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); } _cpl_parameter_value_set(self, &value); return CPL_ERROR_NONE; } /** * @brief * Assign an integer value to a parameter. * * @param self The parameter the value is assigned to. * @param value The integer value to be assigned. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_INT. *
* @enderror * * The function assigns an integer value @em value to a parameter of type * @c CPL_TYPE_INT. */ cpl_error_code cpl_parameter_set_int(cpl_parameter *self, int value) { if (!self) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } cx_assert(self->data); if (self->data->type != CPL_TYPE_INT) { return cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); } _cpl_parameter_value_set(self, &value); return CPL_ERROR_NONE; } /** * @brief * Assign a double value to a parameter. * * @param self The parameter the value is assigned to. * @param value The double value to be assigned. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_DOUBLE. *
* @enderror * * The function assigns a double value @em value to a parameter of type * @c CPL_TYPE_DOUBLE. */ cpl_error_code cpl_parameter_set_double(cpl_parameter *self, double value) { if (!self) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } cx_assert(self->data); if (self->data->type != CPL_TYPE_DOUBLE) { return cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); } _cpl_parameter_value_set(self, &value); return CPL_ERROR_NONE; } /** * @brief * Assign a string value to a parameter. * * @param self The parameter the value is assigned to. * @param value The string value to be assigned. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_STRING. *
* @enderror * * The function assigns a string value @em value to a parameter of type * @c CPL_TYPE_STRING. */ cpl_error_code cpl_parameter_set_string(cpl_parameter *self, const char *value) { if (!self) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } cx_assert(self->data); if (self->data->type != CPL_TYPE_STRING) { return cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); } _cpl_parameter_value_set(self, &value); return CPL_ERROR_NONE; } /** * @brief * Modify the default value of a boolean parameter. * * @param self The parameter whose default value is modified. * @param value The boolean value to be assigned. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_BOOL. *
* @enderror * * The function changes the default value of the parameter @em self to the * boolean value @em value. The parameter @em self must be of type * @c CPL_TYPE_BOOL. Any non-zero value passed as @em value is interpreted * as @em true. */ cpl_error_code cpl_parameter_set_default_bool(cpl_parameter *self, int value) { if (!self) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } cx_assert(self->data); if (self->data->type != CPL_TYPE_BOOL) { return cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); } _cpl_parameter_default_set(self, &value); return CPL_ERROR_NONE; } /** * @brief * Modify the default value of an integer parameter. * * @param self The parameter whose default value is modified. * @param value The integer value to be assigned. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_INT. *
* @enderror * * The function changes the default value of the parameter @em self to the * integer value @em value. The parameter @em self must be of type * @c CPL_TYPE_INT. */ cpl_error_code cpl_parameter_set_default_int(cpl_parameter *self, int value) { if (!self) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } cx_assert(self->data); if (self->data->type != CPL_TYPE_INT) { return cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); } _cpl_parameter_default_set(self, &value); return CPL_ERROR_NONE; } /** * @brief * Modify the default value of a double parameter. * * @param self The parameter whose default value is modified. * @param value The double value to be assigned. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_DOUBLE. *
* @enderror * * The function changes the default value of the parameter @em self to the * double value @em value. The parameter @em self must be of type * @c CPL_TYPE_DOUBLE. */ cpl_error_code cpl_parameter_set_default_double(cpl_parameter *self, double value) { if (!self) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } cx_assert(self->data); if (self->data->type != CPL_TYPE_DOUBLE) { return cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); } _cpl_parameter_default_set(self, &value); return CPL_ERROR_NONE; } /** * @brief * Modify the default value of a string parameter. * * @param self The parameter whose default value is modified. * @param value The string value to be assigned. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_STRING. *
* @enderror * * The function changes the default value of the parameter @em self to the * string value @em value. The parameter @em self must be of type * @c CPL_TYPE_STRING. */ cpl_error_code cpl_parameter_set_default_string(cpl_parameter *self, const char *value) { if (!self) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } cx_assert(self->data); if (self->data->type != CPL_TYPE_STRING) { return cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); } _cpl_parameter_default_set(self, &value); return CPL_ERROR_NONE; } /** * @brief * Get the name of a parameter. * * @param self A parameter. * * @return * The function returns the parameter's unique name, or @c NULL if * @em self is not a valid parameter but @c NULL. In the latter case * an appropriate error code is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the read-only unique name of the parameter @em self. The * parameter name @b must not be modified using the returned pointer. */ const char * cpl_parameter_get_name(const cpl_parameter *self) { if (self == NULL) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } cx_assert(self->name != NULL); return self->name; } /** * @brief * Get the context of a parameter. * * @param self A parameter. * * @return * The function returns the context of the parameter, or @c NULL if * @em self is not a valid parameter but @c NULL. In the latter case * an appropriate error code is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the read-only context to which the parameter @em self belongs. * The parameter's context @b must not be modified using the returned pointer. */ const char * cpl_parameter_get_context(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } return self->context; } /** * @brief * Get the description of a parameter. * * @param self A parameter. * * @return * The function returns the parameter description, or @c NULL if * no description has been set. The function returns @c NULL if an error * occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the read-only short help of the parameter @em self. The * parameter description @b must not be modified using the returned pointer. */ const char * cpl_parameter_get_help(const cpl_parameter *self) { if (!self) { (void)cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } return self->description; } /** * @brief * Get the parameter's value type. * * @param self A parameter. * * @return * The function returns the parameter's value type. The function * returns @c CPL_TYPE_INVALID if @em self is not a valid parameter, * but @c NULL. In this case an appropriate error is also set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The type identifier of the parameter's value is retrieved from the * given parameter @em self. */ cpl_type cpl_parameter_get_type(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return CPL_TYPE_INVALID; } return self->data->type; } /** * @brief * Get the parameter's class. * * @param self A parameter. * * @return The function returns the parameter's class identifier. The * function returns @c CPL_PARAMETER_CLASS_INVALID if @em self is not a * valid parameter, but @c NULL. In this case an appropriate error code * is also set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The class identifier of the parameter @em self is retrieved. */ cpl_parameter_class cpl_parameter_get_class(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return CPL_PARAMETER_CLASS_INVALID; } return self->class; } /** * @brief * Get the value of the given boolean parameter. * * @param self A boolean parameter. * * @return * The function returns the integer representation of the parameter's * boolean value. @c TRUE is represented as non-zero value; whereas 0 * indicates @c FALSE. If an error occurs the function returns 0 and sets * an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_BOOL. *
* @enderror * * The current boolean value of the parameter @em self is retrieved. */ int cpl_parameter_get_bool(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0; } cx_assert(self->data); if (self->data->type != CPL_TYPE_BOOL) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0; } return self->data->data.b; } /** * @brief * Get the value of the given integer parameter. * * @param self An integer parameter. * * @return * The function returns the parameter's integer value. If an error * occurs the function returns 0 and sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_INT. *
* @enderror * * The current integer value of the parameter @em self is retrieved. */ int cpl_parameter_get_int(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0; } cx_assert(self->data); if (self->data->type != CPL_TYPE_INT) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0; } return self->data->data.i; } /** * @brief * Get the value of the given double parameter. * * @param self An double parameter. * * @return * The function returns the parameter's double value. If an error * occurs the function returns 0 and sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_INT. *
* @enderror * * The current double value of the parameter @em self is retrieved. */ double cpl_parameter_get_double(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0.; } cx_assert(self->data); if (self->data->type != CPL_TYPE_DOUBLE) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0.; } return self->data->data.d; } /** * @brief * Get the value of the given string parameter. * * @param self A string parameter. * * @return * The function returns the parameter's string value. If an error * occurs the function returns @c NULL and sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_STRING. *
* @enderror * * The current string value of the parameter @em self is retrieved. */ const char * cpl_parameter_get_string(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } cx_assert(self->data); if (self->data->type != CPL_TYPE_STRING) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return NULL; } return self->data->data.s; } /** * @brief * Get the default value of the given boolean parameter. * * @param self A boolean parameter. * * @return * The function returns the integer representation of the parameter's * default boolean value. @c TRUE is represented as non-zero value; * whereas 0 indicates @c FALSE. If an error occurs the function returns * 0 and sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_BOOL. *
* @enderror * * The current boolean default value of the parameter @em self is retrieved. */ int cpl_parameter_get_default_bool(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0; } cx_assert(self->data); if (self->data->type != CPL_TYPE_BOOL) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0; } return self->data->preset.b; } /** * @brief * Get the default value of the given integer parameter. * * @param self An integer parameter. * * @return * The function returns the parameter's default integer value. If an * error occurs the function returns 0 and sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_INT. *
* @enderror * * The current integer default value of the parameter @em self is retrieved. */ int cpl_parameter_get_default_int(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0; } cx_assert(self->data); if (self->data->type != CPL_TYPE_INT) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0; } return self->data->preset.i; } /** * @brief * Get the default value of the given double parameter. * * @param self An double parameter. * * @return * The function returns the parameter's default double value. If an * error occurs the function returns 0 and sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_DOUBLE. *
* @enderror * * The current double default value of the parameter @em self is retrieved. */ double cpl_parameter_get_default_double(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0.; } cx_assert(self->data); if (self->data->type != CPL_TYPE_DOUBLE) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0.; } return self->data->preset.d; } /** * @brief * Get the default value of the given string parameter. * * @param self An string parameter. * * @return * The function returns the parameter's default string value. If an * error occurs the function returns 0 and sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The type of the parameter self is not of type * @c CPL_TYPE_STRING. *
* @enderror * * The current read-only string default value of the parameter @em self is retrieved. * If @em self is not a valid pointer the error code @c CPL_ERROR_NULL_INPUT * is set on return. Also, if the parameter @em self is not an string * parameter, i.e. the parameter's type is different from @c CPL_TYPE_INT, the * error code @c CPL_ERROR_TYPE_MISMATCH is set. */ const char * cpl_parameter_get_default_string(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } cx_assert(self->data); if (self->data->type != CPL_TYPE_STRING) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return NULL; } return self->data->preset.s; } /** * @brief * Get the number of alternatives of an enumeration parameter. * * @param self An enumeration parameter. * * @return * The number of possible values the parameter @em self can take, * or 0 if @em self does not point to a valid parameter, or the * parameter is not an enumeration parameter. In case of an error the * function also sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The class of the parameter self is not of the kind * @c CPL_PARAMETER_CLASS_ENUM. *
* @enderror * * The function retrieves the number of possible alternatives for an * enumeration parameter, which is always greater or equal than 1. */ int cpl_parameter_get_enum_size(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0; } if (self->class != CPL_PARAMETER_CLASS_ENUM) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0; } cx_assert(self->data); return ((cpl_parameter_enum *)self->data)->sz; } /** * @brief * Get the possible values for an integer enumeration. * * @param self An enumeration parameter * @param position Position to look up in the list of possible values. * * @return * The integer value at position @em position in the list of possible * values of the enumeration @em self. In case of an error the * function returns 0 and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The class of the parameter self is not of the kind * @c CPL_PARAMETER_CLASS_ENUM, or self is not of type * @c CPL_TYPE_INT. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The requested index position position is out of range. *
* @enderror * * The function retrieves the integer value at position @em position from the * list of enumeration values the parameter @em self can possibly take. * For any valid enumeration parameter this list contains at least one value. * The possible values are counted starting from 0. */ int cpl_parameter_get_enum_int(const cpl_parameter *self, int position) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0; } if (self->class != CPL_PARAMETER_CLASS_ENUM) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0; } cx_assert(self->data); if (((cpl_parameter_enum *)self->data)->value.type != CPL_TYPE_INT) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0; } if ((position < 0) && (position > cpl_parameter_get_enum_size(self))) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_ACCESS_OUT_OF_RANGE, "%s, pos=%d", cpl_parameter_get_name(self), position); return 0; } return ((cpl_parameter_enum *)self->data)->vlist[position].i; } /** * @brief * Get the possible values for a double enumeration. * * @param self An enumeration parameter * @param position Position to look up in the list of possible values. * * @return * The double value at position @em position in the list of possible * values of the enumeration @em self. In case of an error the * function returns 0. and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The class of the parameter self is not of the kind * @c CPL_PARAMETER_CLASS_ENUM, or self is not of type * @c CPL_TYPE_DOUBLE. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The requested index position position is out of range. *
* @enderror * * The function retrieves the double value at position @em position from the * list of enumeration values the parameter @em self can possibly take. * For any valid enumeration parameter this list contains at leas one value. * The possible values are counted starting from 0. */ double cpl_parameter_get_enum_double(const cpl_parameter *self, int position) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0.; } if (self->class != CPL_PARAMETER_CLASS_ENUM) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0.; } cx_assert(self->data); if (((cpl_parameter_enum *)self->data)->value.type != CPL_TYPE_DOUBLE) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0.; } if ((position < 0) && (position > cpl_parameter_get_enum_size(self))) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_ACCESS_OUT_OF_RANGE, "%s, pos=%d", cpl_parameter_get_name(self), position); return 0.; } return ((cpl_parameter_enum *)self->data)->vlist[position].d; } /** * @brief * Get the possible values for a string enumeration. * * @param self An enumeration parameter * @param position Position to look up in the list of possible values. * * @return The string value at position @em position in the list of possible * values of the enumeration @em self. In case of an error the * function returns @c NULL and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The class of the parameter self is not of the kind * @c CPL_PARAMETER_CLASS_ENUM, or self is not of type * @c CPL_TYPE_STRING. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The requested index position position is out of range. *
* @enderror * * The function retrieves the read-only string value at position @em position from the * list of enumeration values the parameter @em self can possibly take. * For any valid enumeration parameter this list contains at least one value. * The possible values are counted starting from 0. */ const char * cpl_parameter_get_enum_string(const cpl_parameter *self, int position) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } if (self->class != CPL_PARAMETER_CLASS_ENUM) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return NULL; } cx_assert(self->data); if (((cpl_parameter_enum *)self->data)->value.type != CPL_TYPE_STRING) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return NULL; } if ((position < 0) && (position > cpl_parameter_get_enum_size(self))) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_ACCESS_OUT_OF_RANGE, "%s, pos=%d", cpl_parameter_get_name(self), position); return NULL; } return ((cpl_parameter_enum *)self->data)->vlist[position].s; } /** * @brief * Get the minimum value of an integer range parameter. * * @param self An integer range parameter. * * @return * The function returns the minimum integer value the range parameter * @em self can take. In case of an error, the function returns 0 and * sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The class of the parameter self is not of the kind * @c CPL_PARAMETER_CLASS_RANGE, or self is not of type * @c CPL_TYPE_INT. *
* @enderror * * The function retrieves the integer value defined to be the lower limit * of the integer range parameter @em self. */ int cpl_parameter_get_range_min_int(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0; } if (self->class != CPL_PARAMETER_CLASS_RANGE) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0; } cx_assert(self->data); if (((cpl_parameter_range *)self->data)->value.type != CPL_TYPE_INT) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0; } return ((cpl_parameter_range *)self->data)->min.i; } /** * @brief * Get the minimum value of a double range parameter. * * @param self A double range parameter. * * @return * The function returns the minimum double value the range parameter * @em self can take. In case of an error, the function returns 0. and * sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The class of the parameter self is not of the kind * @c CPL_PARAMETER_CLASS_RANGE, or self is not of type * @c CPL_TYPE_DOUBLE. *
* @enderror * * The function retrieves the double value defined to be the lower limit * of the double range parameter @em self. */ double cpl_parameter_get_range_min_double(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0.; } if (self->class != CPL_PARAMETER_CLASS_RANGE) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0.; } cx_assert(self->data); if (((cpl_parameter_range *)self->data)->value.type != CPL_TYPE_DOUBLE) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0.; } return ((cpl_parameter_range *)self->data)->min.d; } /** * @brief * Get the maximum value of an integer range parameter. * * @param self An integer range parameter. * * @return * The function returns the maximum integer value the range parameter * @em self can take. In case of an error, the function returns 0 and * sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The class of the parameter self is not of the kind * @c CPL_PARAMETER_CLASS_RANGE, or self is not of type * @c CPL_TYPE_INT. *
* @enderror * * The function retrieves the integer value defined to be the upper limit * of the integer range parameter @em self. */ int cpl_parameter_get_range_max_int(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0; } if (self->class!=CPL_PARAMETER_CLASS_RANGE) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0; } cx_assert(self->data); if (((cpl_parameter_range *)self->data)->value.type != CPL_TYPE_INT) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0; } return ((cpl_parameter_range *)self->data)->max.i; } /** * @brief * Get the maximum value of a double range parameter. * * @param self A double range parameter. * * @return * The function returns the maximum double value the range parameter * @em self can take. In case of an error, the function returns 0. and * sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The class of the parameter self is not of the kind * @c CPL_PARAMETER_CLASS_RANGE, or self is not of type * @c CPL_TYPE_DOUBLE. *
* @enderror * * The function retrieves the double value defined to be the upper limit * of the double range parameter @em self. */ double cpl_parameter_get_range_max_double(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0.; } if (self->class != CPL_PARAMETER_CLASS_RANGE) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0.; } cx_assert(self->data); if (((cpl_parameter_range *)self->data)->value.type != CPL_TYPE_DOUBLE) { (void)cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, "%s of " "type %s", cpl_parameter_get_name(self), cpl_type_get_name(cpl_parameter_get_type (self))); return 0.; } return ((cpl_parameter_range *)self->data)->max.d; } /** * @brief * Get the presence status flag of the given parameter. * * @param self A parameter. * * @return * The function returns the current setting of the parameters * presence flag. If the parameter is present the function returns 1 and * 0 otherwise. If an error occurs the function returns 0 and sets an * appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function indicates whether the given parameter @em self was seen * by an application while processing the input from the command line, the * environment and/or a configuration file. If the parameter was seen the * application may set this status flag and query it later using this * function. * * @see cpl_parameter_set_default_flag() */ int cpl_parameter_get_default_flag(const cpl_parameter *self) { if (self == NULL) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0; } return self->info.present == TRUE ? 1 : 0; } /** * @brief * Change the presence status flag of the given parameter. * * @param self A parameter. * @param status The presence status value to assign. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function sets the presence status flag of the given parameter * @em self to the value @em status. Any non-zero value means that * the parameter is present. If the presence status should be changed to * `not present' the argument @em status must be 0. * * @see cpl_parameter_get_default_flag() */ cpl_error_code cpl_parameter_set_default_flag(cpl_parameter *self, int status) { if (self == NULL) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } self->info.present = status == 0 ? FALSE : TRUE; return CPL_ERROR_NONE; } /** * @brief * Get the numerical identifier of the given parameter. * * @param self A parameter. * * @return * The function returns the parameter's numerical identifier. If an error * occurs the function returns 0 and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function looks up the numerical identifier of the given parameter * @em self. A numerical identifier may be assigned to a parameter * using @b cpl_parameter_set_id(). * * @see cpl_parameter_set_id() */ int cpl_parameter_get_id(const cpl_parameter *self) { if (self == NULL) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0; } return self->info.id; } /** * @brief * Set the numerical identifier of the given parameter. * * @param self A parameter. * @param id Numerical identifier to assign. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function assigns a numerical identifier to the parameter @em self. * The numerical value to be assigned to the parameter's numerical identifier * member is passed as the argument @em id. The function does not do any * checks on the numerical value of @em id. The numerical identifier may * be used by an application to, for instance, assign a sequence number to * the parameter. * * @see cpl_parameter_get_id() */ cpl_error_code cpl_parameter_set_id(cpl_parameter *self, int id) { if (self == NULL) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } self->info.id = id; return CPL_ERROR_NONE; } /** * @brief * Get the parameter's user tag. * * @param self A parameter. * * @return * The function returns the parameter's user tag, or @c NULL if no * user tag was previously set. The function returns @c NULL if an error * occurs and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The current read-only setting of the user definable tag of the given parameter * @em self is retrieved. */ const char * cpl_parameter_get_tag(const cpl_parameter *self) { if (!self) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } return self->usertag; } /** * @brief * Set the tag of the given parameter. * * @param self A parameter. * @param tag Tag string to assign. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function assigns a user definable tag @em tag to the parameter * @em self. The function does not check the passed string @em tag in any way. * The tag may be used by an application but it cannot rely on the contents * of the parameter's tag. * * @see cpl_parameter_get_tag() */ cpl_error_code cpl_parameter_set_tag(cpl_parameter *self, const char *tag) { if (self == NULL || tag == NULL) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } if (self->usertag != NULL) { cx_free(self->usertag); self->usertag = NULL; } self->usertag = cx_strdup(tag); return CPL_ERROR_NONE; } /** * @brief * Set alias names for the given parameter. * * @param self A parameter * @param mode The parameter mode for which the alias should be set. * @param alias The parameter's alias. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter mode mode is not supported. *
* @enderror * * The function assigns an alternative name to the parameter @em self for * the given mode @em mode. This alias name may be used instead of the * fully qualified parameter name in the context for which they have been * set. If the alias name is @c NULL a previously set alias is deleted. * * The context for which an alias is set is selected by the @em mode. The * functions accepts the parameter modes @c CPL_PARAMETER_MODE_CFG, * @c CPL_PARAMETER_MODE_CLI and @c CPL_PARAMETER_MODE_ENV. * * @see cpl_parameter_mode */ cpl_error_code cpl_parameter_set_alias(cpl_parameter *self, cpl_parameter_mode mode, const char *alias) { if (self == NULL) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } switch (mode) { case CPL_PARAMETER_MODE_CLI: if (self->info.c_key) { cx_free(self->info.c_key); } self->info.c_key = cx_strdup(alias); break; case CPL_PARAMETER_MODE_ENV: if (self->info.e_key) { cx_free(self->info.e_key); } self->info.e_key = cx_strdup(alias); break; case CPL_PARAMETER_MODE_CFG: if (self->info.f_key) { cx_free(self->info.f_key); } self->info.f_key = cx_strdup(alias); break; default: return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "%s, mode=%d, alias=%s", cpl_parameter_get_name(self), (int)mode, alias); } return CPL_ERROR_NONE; } /** * @brief * Get the parameter's alias name for the given mode. * * @param self A parameter. * @param mode The parameter mode. * * @return * The function returns the parameter's context specific alias name. * If no alias name was previously assigned the function returns * @c NULL. If an error occurs the function returns @c NULL and * sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter mode mode is not supported. *
* @enderror * * The function retrieves the read-only alias name of the parameter @em self. * The context for which an alias is retrieved is selected by the @em mode. * The functions accepts the parameter modes @c CPL_PARAMETER_MODE_CFG, * @c CPL_PARAMETER_MODE_CLI and @c CPL_PARAMETER_MODE_ENV. * * @see cpl_parameter_mode */ const char * cpl_parameter_get_alias(const cpl_parameter *self, cpl_parameter_mode mode) { const cxchar *alias = NULL; if (self == NULL) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } switch (mode) { case CPL_PARAMETER_MODE_CLI: alias = self->info.c_key; break; case CPL_PARAMETER_MODE_ENV: alias = self->info.e_key; break; case CPL_PARAMETER_MODE_CFG: alias = self->info.f_key; break; default: (void)cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "%s, mode=%d", cpl_parameter_get_name(self), (int)mode); break; } return alias; } /** * @brief * Get the parameter's activity status for the environment context. * * @param self A parameter. * @param mode The parameter mode. * * @return * The function returns a non-zero value if the parameter is enabled * for the environment context, or 0 if the parameter is not active. * If an error occurs the function returns 0 and sets an appropriate * error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter mode mode is not supported. *
* @enderror * * The function returns whether the parameter is enabled for the * environment context or not. If the parameter is enabled for the * context the application may modify the parameter's value if the * parameter is referenced in the context specific input of the application. * If the parameter is disabled, the application must not modify the * parameter's value. */ int cpl_parameter_is_enabled(const cpl_parameter *self, cpl_parameter_mode mode) { cxbool active = FALSE; if (self == NULL) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return 0; } switch (mode) { case CPL_PARAMETER_MODE_CLI: active = self->info.c_active; break; case CPL_PARAMETER_MODE_ENV: active = self->info.e_active; break; case CPL_PARAMETER_MODE_CFG: active = self->info.f_active; break; default: (void)cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "%s, mode=%d", cpl_parameter_get_name(self), (int)mode); break; } return active == TRUE ? 1 : 0; } /** * @brief * Activates a parameter for the given mode. * * @param self A parameter. * @param mode The parameter mode. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter mode mode is not supported. *
* @enderror * * The function enables the parameter @em self for the given mode @em mode. */ cpl_error_code cpl_parameter_enable(cpl_parameter *self, cpl_parameter_mode mode) { if (self == NULL) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } switch (mode) { case CPL_PARAMETER_MODE_CLI: self->info.c_active = TRUE; break; case CPL_PARAMETER_MODE_ENV: self->info.e_active = TRUE; break; case CPL_PARAMETER_MODE_CFG: self->info.f_active = TRUE; break; default: return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "%s, mode=%d", cpl_parameter_get_name(self), (int)mode); break; } return CPL_ERROR_NONE; } /** * @brief * Deactivate a parameter for the given mode. * * @param self A parameter. * @param mode The parameter mode. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter mode mode is not supported. *
* @enderror * * The function disables the parameter @em self for the given mode @em mode. */ cpl_error_code cpl_parameter_disable(cpl_parameter *self, cpl_parameter_mode mode) { if (self == NULL) { return cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); } switch (mode) { case CPL_PARAMETER_MODE_CLI: self->info.c_active = FALSE; break; case CPL_PARAMETER_MODE_ENV: self->info.e_active = FALSE; break; case CPL_PARAMETER_MODE_CFG: self->info.f_active = FALSE; break; default: return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "%s, mode=%d", cpl_parameter_get_name(self), (int)mode); break; } return CPL_ERROR_NONE; } /** * @brief * Dump the parameter debugging information to the given stream. * * @param self The parameter. * @param stream The output stream to use. * * @return Nothing. * * The function dumps the contents of of the parameter @em self to the * output stream @em stream. If @em stream is @c NULL the function writes * to the standard output. If @em self is @c NULL the function does nothing. */ void cpl_parameter_dump(const cpl_parameter *self, FILE *stream) { if (self != NULL) { const cxchar *class; const cxchar *type; const cpl_parameter_value *value = NULL; if (stream == NULL) { stream = stdout; } switch (self->class) { case CPL_PARAMETER_CLASS_VALUE: class = "Value"; break; case CPL_PARAMETER_CLASS_RANGE: class = "Range"; break; case CPL_PARAMETER_CLASS_ENUM: class = "Enum"; break; default: class = "Unknown"; break; } value = self->data; switch (value->type) { case CPL_TYPE_BOOL: type = "bool"; break; case CPL_TYPE_INT: type = "int"; break; case CPL_TYPE_DOUBLE: type = "double"; break; case CPL_TYPE_STRING: type = "string"; break; default: type = "unknown"; break; } fprintf(stream, "Parameter at %p: class %02x (%s), type %02x (%s)\n" " Attributes:", (const void *)self, self->class, class, value->type, type); fprintf(stream, " name (at %p): %s", self->name, self->name); if (self->description) { fprintf(stream, " description (at %p): %s", self->description, self->description); } else { fprintf(stream, " description (at %p): %p", self->description, self->description); } if (self->context) { fprintf(stream, " context (at %p): %s", self->context, self->context); } else { fprintf(stream, " context (at %p): %p", self->context, self->context); } if (self->usertag) { fprintf(stream, " user tag (at %p): %s", self->usertag, self->usertag); } else { fprintf(stream, " user tag (at %p): %p", self->usertag, self->usertag); } fprintf(stream, "\n Values: "); switch (value->type) { case CPL_TYPE_BOOL: fprintf(stream, " Current: %d Default: %d", value->data.b, value->preset.b); break; case CPL_TYPE_INT: fprintf(stream, " Current: %d Default: %d", value->data.i, value->preset.i); break; case CPL_TYPE_DOUBLE: fprintf(stream, " Current: %g Default: %g", value->data.d, value->preset.d); break; case CPL_TYPE_STRING: if (value->data.s) { if (value->preset.s) { fprintf(stream, " Current: %s Default: %s", value->data.s, value->preset.s); } else { fprintf(stream, " Current: %s Default: %p", value->data.s, value->preset.s); } } else { if (value->preset.s) { fprintf(stream, " Current: %p Default: %s", value->data.s, value->preset.s); } else { fprintf(stream, " Current: %p Default: %p", value->data.s, value->preset.s); } } break; default: fprintf(stream, " Current: invalid Default: invalid"); break; } fprintf(stream, "\n"); } return; } /**@}*/ cpl-6.4.1/cplui/cpl_framedata.c0000644000460300003120000003354311703310325013257 00000000000000/* $Id: cpl_framedata.c,v 1.4 2012-01-11 13:38:29 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-01-11 13:38:29 $ * $Revision: 1.4 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include "cpl_framedata.h" /** * @defgroup cpl_framedata Auxiliary Frame Data * * @brief * Auxiliary frame data for recipe configurations. * * This module implements a frame data object, which stores auxiliary * information of input and output frames of recipes. This information * is used to store the frame configurations of recipes which can be * queried by an application which is going to invoke the recipe. * * The objects stores a frame tag, a unique identifier for a certain * kind of frame, the minimum and maximum number of frames needed. * * A frame is required if the data member @em min_count is set to * a value greater than @c 0. The minimum and maximum number of frames is * unspecified if the respective member, @em min_count or @em max_count, * is set to @c -1. * * The data members of this structure are public to allow for a static * initialization. Any other access of the data members should still * be done using the member functions. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /** * @brief * Create an new frame data object. * * @return * On success the function returns a pointer to the newly created object, * or @c NULL otherwise. * * The function allocates the memory for a frame data object, and initializes * the data members to their default values, i.e. @em tag is set to @c NULL, * and both, @em min_count and @em max_count are set to @c -1. */ cpl_framedata* cpl_framedata_new(void) { cpl_framedata* self = cx_calloc(1, sizeof *self); self->tag = NULL; self->min_count = -1; self->max_count = -1; return self; } /** * @brief * Create a new frame data object and initialize it with the given values. * * @param tag The frame tag initializer. * @param min_count The initial value for the minimum number of frames. * @param max_count The initial value for the maximum number of frames. * * @return * On success the function returns a pointer to the newly created object, * or @c NULL otherwise. * * The function allocates the memory for a frame data object, and initializes * its data members with the given values of the arguments @em tag, * @em min_count, and @em max_count. */ cpl_framedata* cpl_framedata_create(const char* tag, cpl_size min_count, cpl_size max_count) { cpl_framedata* self = cx_calloc(1, sizeof *self); self->tag = cx_strdup(tag); self->min_count = (min_count < -1) ? -1 : min_count; self->max_count = (max_count < -1) ? -1 : max_count; return self; } /** * @brief * Create a duplicate of another frame data object. * * @param other The frame data object to clone. * * @return * On success the function returns a pointer to the newly created copy * of the frame data object, or @c NULL otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter other is a NULL pointer. *
* @enderror * * The function creates a clone of the given frame data object @em other. * The created copy does not share any resources with the original object. */ cpl_framedata* cpl_framedata_duplicate(const cpl_framedata* other) { static const cxchar* const _id = "cpl_framedata_duplicate"; cpl_framedata* self = NULL; if (other == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); } else { self = cx_calloc(1, sizeof *self); self->tag = cx_strdup(other->tag); self->min_count = other->min_count; self->max_count = other->max_count; } return self; } /** * @brief * Clear a frame data object. * * @param self The frame data object to clear. * * @return * Nothing. * * The function clears the contents of the frame data object @em self, i.e. * resets the data members to their default values. If @em self is @c NULL, * nothing is done and no error is set. */ void cpl_framedata_clear(cpl_framedata* self) { if (self != NULL) { if (self->tag != NULL) { cx_free((cxptr)self->tag); self->tag = NULL; } self->min_count = -1; self->max_count = -1; } return; } /** * @brief * Delete a frame data object. * * @param self The frame data object to delete. * * @return * Nothing. * * The function destroys the frame data object @em self. All resources used * by @em self are released. If @em self is @c NULL, nothing is done and no error is set. */ void cpl_framedata_delete(cpl_framedata* self) { if (self != NULL) { cpl_framedata_clear(self); cx_free(self); self = NULL; } return; } /** * @brief * Get the frame tag. * * @param self The frame data object. * * @return * The function returns a pointer to the frame tag on success, or @c NULL * if an error occurred. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns a handle to the frame tag stored in the frame data * object @em self. */ const char* cpl_framedata_get_tag(const cpl_framedata* self) { static const cxchar* const _id = "cpl_framedata_get_tag"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return NULL; } return self->tag; } /** * @brief * Get the minimum number of frames. * * @param self The frame data object. * * @return * The function returns the minimum number of frames on success. In case an * error occurred, the return value is @c -2 and an appropriate error code * is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the minimum number of frames value stored in * @em self. If the returned value is @c -1, the minimum number of frames * is undefined, i.e. any number may be used. */ cpl_size cpl_framedata_get_min_count(const cpl_framedata* self) { static const cxchar* const _id = "cpl_framedata_get_min_count"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -2; } return self->min_count; } /** * @brief * Get the maximum number of frames. * * @param self The frame data object. * * @return * The function returns the maximum number of frames on success. In case an * error occurred, the return value is @c -2 and an appropriate error code * is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the maximum number of frames value stored in * @em self. If the returned value is @c -1, the maximum number of frames * is undefined, i.e. any number may be used. */ cpl_size cpl_framedata_get_max_count(const cpl_framedata* self) { static const cxchar* const _id = "cpl_framedata_get_max_count"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return -2; } return self->max_count; } /** * @brief * Set the frame tag to the given value. * * @param self The frame data object. * @param tag The tag to assign. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter tag is a NULL pointer or the empty * string. *
* @enderror * * The function assigns the string @em tag to the corresponding data member * of the frame data object @em self by copying its contents. Any previous * tag stored in @em self is replaced. */ cpl_error_code cpl_framedata_set_tag(cpl_framedata* self, const char* tag) { static const cxchar* const _id = "cpl_framedata_set_tag"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } if ((tag == NULL) || (tag[0] == '\0')) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return CPL_ERROR_ILLEGAL_INPUT; } if (self->tag != NULL) { cx_free((cxptr)self->tag); } self->tag = cx_strdup(tag); return CPL_ERROR_NONE; } /** * @brief * Set the minimum number of frames. * * @param self The frame data object. * @param min_count The value to set as minimum number of frames. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function sets the minimum number of frames value of @em self to * @em min_count. If @em min_count is @c -1 the minimum number of frames is * unspecified. */ cpl_error_code cpl_framedata_set_min_count(cpl_framedata* self, cpl_size min_count) { static const cxchar* const _id = "cpl_framedata_set_min_count"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } self->min_count = (min_count < -1) ? -1 : min_count; return CPL_ERROR_NONE; } /** * @brief * Set the maximum number of frames. * * @param self The frame data object. * @param max_count The value to set as maximum number of frames. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function sets the maximum number of frames value of @em self to * @em max_count. If @em max_count is @c -1 the maximum number of frames is * unspecified. */ cpl_error_code cpl_framedata_set_max_count(cpl_framedata* self, cpl_size max_count) { static const cxchar* const _id = "cpl_framedata_set_max_count"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } self->max_count = (max_count < -1) ? -1 : max_count; return CPL_ERROR_NONE; } /** * @brief * Assign new values to a frame data object. * * @param self The frame data object. * @param tag The tag to assign. * @param min_count The value to set as minimum number of frames. * @param max_count The value to set as maximum number of frames. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter tag is a NULL pointer or the empty * string. *
* @enderror * * The function updates the frame data object @em self with the given * values for @em tag, @em min_count, and @em max_count. * All previous values stored in @em self are replaced. The string * @em tag is assigned by copying its contents. * * @see cpl_framedata_set_tag() */ cpl_error_code cpl_framedata_set(cpl_framedata* self, const char* tag, cpl_size min_count, cpl_size max_count) { static const cxchar* const _id = "cpl_framedata_set"; if (self == NULL) { cpl_error_set(_id, CPL_ERROR_NULL_INPUT); return CPL_ERROR_NULL_INPUT; } if ((tag == NULL) || (tag[0] == '\0')) { cpl_error_set(_id, CPL_ERROR_ILLEGAL_INPUT); return CPL_ERROR_ILLEGAL_INPUT; } if (self->tag != NULL) { cx_free((cxptr)self->tag); } self->tag = cx_strdup(tag); self->min_count = (min_count < -1) ? -1 : min_count; self->max_count = (max_count < -1) ? -1 : max_count; return CPL_ERROR_NONE; } /**@}*/ cpl-6.4.1/cplui/cpl_recipe.h0000644000460300003120000000707712045701151012613 00000000000000/* $Id: cpl_recipe.h,v 1.8 2012-11-05 09:10:01 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-11-05 09:10:01 $ * $Revision: 1.8 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_RECIPE_H #define CPL_RECIPE_H #include #include #include #include #include CPL_BEGIN_DECLS /** * @defgroup cpl_recipe Recipes * * @brief * Recipe plugin interface definition * * This defines the interface in order to implement recipes as Pluggable * Data Reduction Modules (PDRMs). It extends the generic plugin interface * with a parameter list and a frame set containing the recipe's setup * information (parameters to run with) and the data frames to process. * * This interface is constructed in such a way, that a pointer to an object * of type @c cpl_recipe can be cast into a pointer to @c cpl_plugin (see * @ref cpl_plugin). * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /** * @brief * The recipe plugin data type */ typedef struct _cpl_recipe_ cpl_recipe; /** * @brief * The type representation of the recipe plugin interface. */ struct _cpl_recipe_ { /** * @brief * Generic plugin interface * * See the @ref cpl_plugin documentation for a detailed description. */ cpl_plugin interface; /* Must be the first member! */ /** * @brief * Pointer to the recipes parameter list, or @c NULL if the recipe * does not provide/accept any parameters. * * This member points to a @c cpl_parameterlist, containing all * parameters the recipe accepts, or @c NULL if the recipe does not * need any parameters for execution. * * An application which wants to execute the recipe may update this list * with new parameter values, obtained from the command line for instance. */ cpl_parameterlist *parameters; /** * @brief * Pointer to a frame set, or @c NULL if no frame set is available. * * This member points to the frame set (see \ref cpl_frameset) the recipe * should process. The frame set to process has to be provided by the * application which is going to execute this recipe, i.e. this member * has to be set by the application. * * The recipe can rely on the availability of the frame set at the time * the application executes the recipe by calling * cpl_plugin::execute. The recipe is free to ignore a provided * frame set if it does not need any input frames. */ cpl_frameset *frames; }; typedef struct _cpl_recipe2_ cpl_recipe2; struct _cpl_recipe2_ { cpl_recipe base; cpl_recipeconfig *config; }; /**@}*/ CPL_END_DECLS #endif /* CPL_RECIPE_H */ cpl-6.4.1/cplui/Makefile.in0000644000460300003120000006666112310332724012407 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = cplui DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/admin/depcomp $(include_HEADERS) \ $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/cpl.m4 $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/omp.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = am_libcplui_la_OBJECTS = cpl_frame.lo cpl_frameset.lo \ cpl_frameset_io.lo cpl_parameter.lo cpl_parameterlist.lo \ cpl_plugin.lo cpl_recipedefine.lo cpl_pluginlist.lo \ cpl_recipeconfig.lo cpl_framedata.lo libcplui_la_OBJECTS = $(am_libcplui_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libcplui_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libcplui_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcplui_la_SOURCES) DIST_SOURCES = $(libcplui_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(include_HEADERS) $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFITSIO_INCLUDES = @CFITSIO_INCLUDES@ CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@ CFLAGS = @CFLAGS@ CPLCORE_INCLUDES = @CPLCORE_INCLUDES@ CPLDFS_INCLUDES = @CPLDFS_INCLUDES@ CPLDRS_INCLUDES = @CPLDRS_INCLUDES@ CPLUI_INCLUDES = @CPLUI_INCLUDES@ CPL_BINARY_AGE = @CPL_BINARY_AGE@ CPL_BINARY_VERSION = @CPL_BINARY_VERSION@ CPL_CFLAGS = @CPL_CFLAGS@ CPL_INTERFACE_AGE = @CPL_INTERFACE_AGE@ CPL_LDFLAGS = @CPL_LDFLAGS@ CPL_MAJOR_VERSION = @CPL_MAJOR_VERSION@ CPL_MICRO_VERSION = @CPL_MICRO_VERSION@ CPL_MINOR_VERSION = @CPL_MINOR_VERSION@ CPL_VERSION = @CPL_VERSION@ CPL_VERSION_STRING = @CPL_VERSION_STRING@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_INCLUDES = @CX_INCLUDES@ CX_LDFLAGS = @CX_LDFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FFTWF_INCLUDES = @FFTWF_INCLUDES@ FFTWF_LDFLAGS = @FFTWF_LDFLAGS@ FFTW_INCLUDES = @FFTW_INCLUDES@ FFTW_LDFLAGS = @FFTW_LDFLAGS@ FGREP = @FGREP@ GASGANO_CLASSPATH = @GASGANO_CLASSPATH@ GASGANO_SHREXT = @GASGANO_SHREXT@ GREP = @GREP@ INCLTDL = @INCLTDL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JAVA_INCLUDES = @JAVA_INCLUDES@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCEXT = @LIBCEXT@ LIBCFITSIO = @LIBCFITSIO@ LIBCPLCORE = @LIBCPLCORE@ LIBCPLDFS = @LIBCPLDFS@ LIBCPLDRS = @LIBCPLDRS@ LIBCPLUI = @LIBCPLUI@ LIBFFTW = @LIBFFTW@ LIBFFTWF = @LIBFFTWF@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBWCS = @LIBWCS@ LIPO = @LIPO@ LN_S = @LN_S@ LTDLDEPS = @LTDLDEPS@ LTDLINCL = @LTDLINCL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ WCS_INCLUDES = @WCS_INCLUDES@ WCS_LDFLAGS = @WCS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ cpl_includes = @cpl_includes@ cpl_libraries = @cpl_libraries@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libcext = @libcext@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in SUBDIRS = tests AM_CPPFLAGS = -DCX_LOG_DOMAIN=\"CplUi\" \ $(CPLCORE_INCLUDES) $(CX_INCLUDES) $(CFITSIO_INCLUDES) include_HEADERS = cpl_frame.h cpl_frameset.h cpl_frameset_io.h \ cpl_parameter.h cpl_parameterlist.h cpl_plugin.h \ cpl_plugininfo.h cpl_pluginlist.h cpl_recipe.h \ cpl_recipedefine.h cpl_recipeconfig.h cpl_framedata.h noinst_HEADERS = cpl_frame_impl.h lib_LTLIBRARIES = libcplui.la libcplui_la_SOURCES = cpl_frame.c cpl_frameset.c cpl_frameset_io.c \ cpl_parameter.c cpl_parameterlist.c cpl_plugin.c \ cpl_recipedefine.c \ cpl_pluginlist.c cpl_recipeconfig.c cpl_framedata.c libcplui_la_LDFLAGS = $(CX_LDFLAGS) $(CFITSIO_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libcplui_la_LIBADD = $(LIBCPLCORE) $(LIBCFITSIO) $(LIBCEXT) -lm libcplui_la_DEPENDENCIES = $(LIBCPLCORE) all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cplui/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign cplui/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libcplui.la: $(libcplui_la_OBJECTS) $(libcplui_la_DEPENDENCIES) $(EXTRA_libcplui_la_DEPENDENCIES) $(AM_V_CCLD)$(libcplui_la_LINK) -rpath $(libdir) $(libcplui_la_OBJECTS) $(libcplui_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_frame.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_framedata.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_frameset.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_frameset_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_parameter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_parameterlist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_plugin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_pluginlist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_recipeconfig.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_recipedefine.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libLTLIBRARIES \ clean-libtool cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-includeHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-includeHEADERS uninstall-libLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/TODO0000644000460300003120000000000010223247371007671 00000000000000cpl-6.4.1/cpl.h0000644000460300003120000000503212124022544010135 00000000000000/* $Id: cpl.h,v 1.32 2013-03-25 10:22:28 cgarcia Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 */ /* * $Author: cgarcia $ * $Date: 2013-03-25 10:22:28 $ * $Revision: 1.32 $ * $Name: not supported by cvs2svn $ */ /* CPLCORE */ #include "cpl_bivector.h" #include "cpl_error.h" #include "cpl_errorstate.h" #include "cpl_fits.h" #include "cpl_image.h" #include "cpl_image_basic.h" #include "cpl_image_iqe.h" #include "cpl_image_bpm.h" #include "cpl_image_filter.h" #include "cpl_image_gen.h" #include "cpl_image_io.h" #include "cpl_image_resample.h" #include "cpl_imagelist.h" #include "cpl_imagelist_basic.h" #include "cpl_imagelist_io.h" #include "cpl_image_stats.h" #include "cpl_init.h" #include "cpl_io.h" #include "cpl_macros.h" #include "cpl_mask.h" #include "cpl_matrix.h" #include "cpl_memory.h" #include "cpl_msg.h" #include "cpl_plot.h" #include "cpl_polynomial.h" #include "cpl_property.h" #include "cpl_propertylist.h" #include "cpl_stats.h" #include "cpl_table.h" #include "cpl_test.h" #include "cpl_type.h" #include "cpl_vector.h" #include "cpl_math_const.h" #include "cpl_version.h" #include "cpl_func.h" /* CPLUI */ #include "cpl_frame.h" #include "cpl_frameset.h" #include "cpl_frameset_io.h" #include "cpl_framedata.h" #include "cpl_parameter.h" #include "cpl_parameterlist.h" #include "cpl_plugin.h" #include "cpl_plugininfo.h" #include "cpl_pluginlist.h" #include "cpl_recipe.h" #include "cpl_recipeconfig.h" #include "cpl_recipedefine.h" /* CPLDRS */ #include "cpl_apertures.h" #include "cpl_apertures_img.h" #include "cpl_apertures_img.h" #include "cpl_detector.h" #include "cpl_fit.h" #include "cpl_geom_img.h" #include "cpl_photom.h" #include "cpl_phys_const.h" #include "cpl_ppm.h" #include "cpl_wcs.h" #include "cpl_fft.h" /* CPLDFS */ #include "cpl_dfs.h" cpl-6.4.1/ChangeLog0000644000460300003120000342653211520500371010775 000000000000002010-11-22 15:07 llundin * cpldfs/cpl_dfs.c: rm (all) incorrectly used nonnull __attribute__ 2010-11-22 09:03 llundin * cplcore/: tests/cpl_image_io-test.c, cpl_image_io.c: cpl_image_load(): Test CPL_ERROR_FILE_IO twice 2010-11-19 16:45 llundin * cplcore/cpl_test.c: Fix long lines (mostly) from previous commit 2010-11-19 16:41 llundin * cplcore/cpl_test.h: Fix long lines (mostly) from previous commit 2010-11-19 15:38 cizzo * cplcore/cpl_msg.c: Setting writing to logfile to line buffer mode (Ole Streicher) 2010-11-19 14:56 llundin * cplcore/: cpl_test.c, cpl_test.h: Compute FLOP rates priot to and during tests 2010-11-19 13:36 llundin * cplcore/: cpl_test.c, cpl_test.h: Count FLOPs before and during a test 2010-11-19 10:49 llundin * cplcore/: cpl_test.c, cpl_test.h, cpl_tools.h: cpl_test_get_flops(): Available to cpl_test macros 2010-11-19 09:20 llundin * cplcore/cpl_error_impl.h: cpl_error_set_wcs(): Support also without WCSLIB (for unit testing) 2010-11-19 09:18 llundin * cpldrs/tests/cpl_wcs-test.c: #include 2010-11-19 09:14 llundin * cplcore/cpl_error.c: cpl_error_set_wcs_macro(): identifier wcserrmsg replaces wcs_errmsg 2010-11-18 16:19 llundin * cpldrs/cpl_wcs.c: cpl_wcs_platesol(): Use cpl_error_set_wcs(), improve variable names. wcslib_errmsgs[]: Wrong and potentially dangerous, replaced by cpl_error_set_wcs() 2010-11-18 14:19 llundin * cpldrs/: cpl_wcs.c, tests/cpl_wcs-test.c: cpl_wcs_convert(): Use cpl_error_set_wcs() and fix memory-leak on error 2010-11-18 13:52 llundin * cplcore/cpl_error.c, cplcore/cpl_error_impl.h, cpldrs/tests/Makefile.am, cpldrs/tests/cpl_wcs-test.c: cpl_error_set_wcs_macro(): Defined and test 2010-11-18 13:35 llundin * cpldrs/cpl_wcs.c: cpl_wcs_platesol(): Handle failure of wcshdo(), improve comments, reduce variable scope 2010-11-18 11:16 llundin * cpldrs/cpl_wcs.c: cpl_wcs_plist2fitsstr(), cpl_wcs_fitsstr2plist(): CFITSIO status identifier replaced by ioerror (use status only for array). cpl_wcs_platesol(): Use retval identifier for WCS functions, rm redundant variables + cast. rm extra space 2010-11-18 11:00 llundin * cplcore/cpl_error_impl.h: cpl_error_set_message_(): rm CPL_HAVE_VA_ARGS check since this file is only used within CPL 2010-11-18 10:41 llundin * cpldrs/cpl_wcs.c: cpl_wcs_new_from_propertylist(): rm some dead code, free() replaces cpl_free(). cpl_wcs_init(): Use alloc attribute, rm useless error check. cpl_wcs_plist2fitsstr(): Handle failure in cpl_propertylist_to_fitsfile() 2010-11-17 15:33 llundin * cpldrs/cpl_wcs.c: Use CPL_ATTR_NONNULL on static functions. Check for error on fits calls. Use cpl_error_set_fits(), cpl_error_set_(), cpl_error_set_message_() 2010-11-17 14:47 llundin * cpldrs/cpl_wcs.c: cpl_wcs_ffhdr2str(): Use CFITSIO version finger-printing to only define function when needed 2010-11-17 13:52 llundin * cplcore/cpl_mask.c: CPL_ATTR_NONNULL used for static functions. Use cpl_error_set*_() macros 2010-11-17 13:51 llundin * cplcore/cpl_error_impl.h: cpl_error_set_(), cpl_error_set_where_(), cpl_error_set_message_(): Added 2010-11-17 13:49 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_filter_test(): Test unsupported filter mode 2010-11-17 13:38 llundin * cplcore/cpl_error.c: cpl_error_set_message_macro_(): replaces cpl_error_set_message_() 2010-11-16 14:03 llundin * cplcore/cpl_tools.h: rm cpl_clock 2010-11-16 13:22 llundin * cplcore/cpl_tools.h: cpl_tools_trace(): Added 2010-11-16 11:09 llundin * cplcore/tests/cpl_mask-test.c: cpl_test_eq_error() replaces cpl_test_error() + cpl_test_eq() 2010-11-16 10:56 llundin * cplui/tests/Makefile.am: LDADD: append libcext (needed for cx_strfreev() in cpl_recipeconfig-test (with clang linker)) 2010-11-16 10:45 llundin * cplui/tests/cpl_frameset-test.c: rm cext types since they are not part of the API of CPL (which is being tested here). Use cpl_test.h for actual testing 2010-11-16 10:19 llundin * cplcore/tests/cpl_property-test.c: rm cext types since they are not part of the API of CPL (which is being tested here) 2010-11-16 10:13 llundin * cplcore/tests/Makefile.am: LDADD: append cfitsio + -lm (for clang linker) 2010-11-16 10:13 llundin * cpldrs/tests/Makefile.am: LDADD: append -lm (for clang linker) 2010-11-16 09:47 llundin * cplcore/tests/cpl_errorstate-test.c: my_error_counter(): cpl_test_eq() replaces cx_assert() 2010-11-16 09:44 llundin * cplcore/cpl_test.h: cpl_test_assert(): Add and deprecate cpl_assert() 2010-11-16 09:44 llundin * cplcore/tests/cpl_propertylist-test.c: rm cext data types, since they are not used in the API of CPL. Also prefix created fits files with basename. Also remove unneded cx_log calls and replace cx_assert() with cpl_test_assert() 2010-11-15 16:06 llundin * cplcore/cpl_macros.h: Fix check for gcc ver. 4.2 2010-11-15 10:55 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_test_eq_error() replaces cpl_test_eq()+cpl_test_error(). cpl_test_eq_ptr() on memcpy() 2010-11-15 10:54 llundin * cpldrs/tests/cpl_apertures-test.c: cpl_test_eq_error() replaces cpl_test_eq() + cpl_test_error(). cpl_test_zero() replaces cpl_test_eq(, 0) 2010-11-15 10:45 llundin * cplcore/cpl_image_basic_body.h: Compile-time guard on cpl_tools_add_flops() replaces run-time guard (fixes clang warning) 2010-11-12 15:28 llundin * cplcore/cpl_error.h, cplcore/cpl_macros.h, cplcore/cpl_polynomial.c, cplcore/cpl_test.h, cplcore/cpl_tools.h, cpldfs/cpl_dfs.c, cplui/cpl_recipedefine.h: CPL_HAVE_ATTR_NONNULL: Needed to support absence of __attribute__((nonnull)) (DFS04697) 2010-11-12 15:25 llundin * cplcore/cpl_test.h: cpl_assert(): Reset errno before test. cpl_error_margin: Comment as deprecated 2010-11-12 14:04 llundin * cplcore/cpl_init.c: cpl_init(): Warn if using OpenMP and CFITSIO v. < 3.18 2010-11-12 11:02 llundin * cplcore/tests/cpl_error-test.c: cpl_error_test_set_where(): Test cpl_error_get_where() 2010-11-12 10:46 llundin * cpldrs/tests/cpl_geom_img-test.c: cpl_geom_img_offset_combine(): Added a few tests 2010-11-12 09:54 llundin * cpldrs/tests/cpl_ppm-test.c: Fix gcc warning. Use const for data and permutation array. Test for CPL_ERROR_NONE. Add tests for NULL/invalid input 2010-11-12 08:55 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_all_*(): Fix cpl_tools_add_flops() call 2010-11-11 17:35 llundin * cplcore/cpl_test.c: cpl_test_one(): Report FLOP rate since last test 2010-11-11 16:31 llundin * cplcore/cpl_test.c: cpl_test_end(): Report Wall-clock time and FLOP-rate. cpl_test_init(): omp single replaces omp master 2010-11-11 16:28 llundin * cplcore/: cpl_image_gen.h, cpl_image_resample.h, cpl_imagelist_basic.h, cpl_imagelist_io.h, cpl_matrix.h, cpl_matrix_impl.h, cpl_property.h, cpl_propertylist.h, cpl_stats.h: Append CPL_ATTR_ALLOC to creator functions (DFS0DFS04697) 2010-11-11 13:45 llundin * cplcore/cpl_tools.h: CPL_ATTR_NONNULL, CPL_ATTR_PURE added (DFS04697) 2010-11-11 13:26 llundin * cplcore/: cpl_xmemory.c, cpl_xmemory.h: cpl_xmemory_is_empty(): rm assert() to make it pure 2010-11-11 11:47 llundin * cpldrs/cpl_geom_img.h: Append CPL_ATTR_ALLOC to creator functions 2010-11-11 11:31 llundin * cplui/cpl_frame.h, cplui/cpl_framedata.h, cplui/cpl_frameset.h, cplui/cpl_frameset_io.h, cplui/cpl_parameter.h, cplui/cpl_parameterlist.h, cplui/cpl_plugin.h, cplui/cpl_pluginlist.h, cplui/cpl_recipeconfig.h, cpldrs/cpl_apertures.h, cpldrs/cpl_wcs.h, cplcore/cpl_bivector.h: Append CPL_ATTR_ALLOC to creator functions 2010-11-11 11:05 llundin * cplcore/tests/cpl_bivector-test.c: Test cpl_bivector_get_x_data_const(), cpl_bivector_get_y_data_const(). NULL-input test of accessors 2010-11-11 10:23 llundin * cplcore/cpl_array_impl.h, cplcore/cpl_bivector.c, cplcore/cpl_bivector.h, cplcore/cpl_column.c, cplcore/cpl_column.h, cplcore/cpl_error.c, cplcore/cpl_error.h, cplcore/cpl_error_impl.h, cplcore/cpl_errorstate.c, cplcore/cpl_errorstate.h, cplcore/cpl_filter.h, cplcore/cpl_filter_median.c, cplcore/cpl_filter_median_impl.h, cplcore/cpl_fits.c, cplcore/cpl_fits.h, cplcore/cpl_image.h, cplcore/cpl_image_basic.c, cplcore/cpl_image_basic.h, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_bpm.c, cplcore/cpl_image_bpm.h, cplcore/cpl_image_defs.h, cplcore/cpl_image_filter.c, cplcore/cpl_image_filter.h, cplcore/cpl_image_filter_body.h, cplcore/cpl_image_gen.c, cplcore/cpl_image_gen.h, cplcore/cpl_image_gen_body.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, cplcore/cpl_image_io_impl.h, cplcore/cpl_image_iqe.c, cplcore/cpl_image_iqe.h, cplcore/cpl_image_resample.c, cplcore/cpl_image_resample.h, cplcore/cpl_image_resample_body.h, cplcore/cpl_image_stats.c, cplcore/cpl_image_stats.h, cplcore/cpl_image_stats_body.h, cplcore/cpl_imagelist.h, cplcore/cpl_imagelist_basic.c, cplcore/cpl_imagelist_basic.h, cplcore/cpl_imagelist_basic_body.h, cplcore/cpl_imagelist_defs.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io.h, cplcore/cpl_imagelist_io_impl.h, cplcore/cpl_init.c, cplcore/cpl_init.h, cplcore/cpl_io.h, cplcore/cpl_macros.h, cplcore/cpl_mask.c, cplcore/cpl_mask.h, cplcore/cpl_mask_body.h, cplcore/cpl_math_const.h, cplcore/cpl_matrix.c, cplcore/cpl_matrix.h, cplcore/cpl_matrix_impl.h, cplcore/cpl_memory.c, cplcore/cpl_memory.h, cplcore/cpl_memory_impl.h, cplcore/cpl_msg.c, cplcore/cpl_msg.h, cplcore/cpl_plot.c, cplcore/cpl_plot.h, cplcore/cpl_polynomial.c, cplcore/cpl_polynomial.h, cplcore/cpl_property.c, cplcore/cpl_property.h, cplcore/cpl_propertylist.c, cplcore/cpl_propertylist.h, cplcore/cpl_propertylist_impl.h, cplcore/cpl_stats.c, cplcore/cpl_stats.h, cplcore/cpl_stats_body.h, cplcore/cpl_table.c, cplcore/cpl_table.h, cplcore/cpl_test.c, cplcore/cpl_test.h, cplcore/cpl_tools.c, cplcore/cpl_tools.h, cplcore/cpl_tools_body.h, cplcore/cpl_type.c, cplcore/cpl_type.h, cplcore/cpl_type_impl.h, cplcore/cpl_vector.c, cplcore/cpl_vector.h, cplcore/cpl_vector_fit_impl.h, cplcore/cpl_xmemory.c, cplcore/cpl_xmemory.h, cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_error-test.c, cplcore/tests/cpl_errorstate-test.c, cplcore/tests/cpl_filter-test.c, cplcore/tests/cpl_filter_body.h, cplcore/tests/cpl_fits-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_bpm-test.c, cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_gen-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_image_iqe-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_mask-test.c, cplcore/tests/cpl_math-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_memory-test.c, cplcore/tests/cpl_msg-test.c, cplcore/tests/cpl_plot-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_property-test.c, cplcore/tests/cpl_propertylist-test.c, cplcore/tests/cpl_stats-test.c, cplcore/tests/cpl_table-test.c, cplcore/tests/cpl_test-test.c, cplcore/tests/cpl_tools-test.c, cplcore/tests/cpl_type-test.c, cplcore/tests/cpl_vector-test.c, cpldfs/cpl_dfs.c, cpldfs/cpl_dfs.h, cpldfs/md5.c, cpldfs/md5.h, cpldfs/tests/cpl_dfs-test.c, cpldrs/cpl_apertures.c, cpldrs/cpl_apertures.h, cpldrs/cpl_apertures_img.c, cpldrs/cpl_apertures_img.h, cpldrs/cpl_detector.c, cpldrs/cpl_detector.h, cpldrs/cpl_detector_body.h, cpldrs/cpl_fft.c, cpldrs/cpl_fft.h, cpldrs/cpl_fit.c, cpldrs/cpl_fit.h, cpldrs/cpl_fit_body.h, cpldrs/cpl_geom_img.c, cpldrs/cpl_geom_img.h, cpldrs/cpl_geom_img_body.h, cpldrs/cpl_photom.c, cpldrs/cpl_photom.h, cpldrs/cpl_phys_const.h, cpldrs/cpl_wcs.c, cpldrs/cpl_wcs.h, cpldrs/cpl_wlcalib_xc_impl.h, cpldrs/tests/cpl_apertures-test.c, cpldrs/tests/cpl_apertures_img-test.c, cpldrs/tests/cpl_detector-test.c, cpldrs/tests/cpl_fft-test.c, cpldrs/tests/cpl_fit-test.c, cpldrs/tests/cpl_geom_img-test.c, cpldrs/tests/cpl_photom-test.c, cpldrs/tests/cpl_ppm-test.c, cpldrs/tests/cpl_wcs-test.c, cpljava/cpl_gasgano.c, cplui/cpl_frame.c, cplui/cpl_frame.h, cplui/cpl_framedata.c, cplui/cpl_framedata.h, cplui/cpl_frameset.c, cplui/cpl_frameset.h, cplui/cpl_frameset_io.c, cplui/cpl_frameset_io.h, cplui/cpl_parameter.c, cplui/cpl_parameter.h, cplui/cpl_parameterlist.c, cplui/cpl_parameterlist.h, cplui/cpl_plugin.c, cplui/cpl_plugin.h, cplui/cpl_plugininfo.h, cplui/cpl_pluginlist.c, cplui/cpl_pluginlist.h, cplui/cpl_recipe.h, cplui/cpl_recipeconfig.c, cplui/cpl_recipeconfig.h, cplui/cpl_recipedefine.c, cplui/tests/cpl_frame-test.c, cplui/tests/cpl_framedata-test.c, cplui/tests/cpl_frameset-test.c, cplui/tests/cpl_frameset_io-test.c, cplui/tests/cpl_parameter-test.c, cplui/tests/cpl_parameterlist-test.c, cplui/tests/cpl_plugin-test.c, cplui/tests/cpl_pluginlist-test.c, cplui/tests/cpl_recipeconfig-test.c, cplui/tests/cpl_recipedefine-test.c: Current FSF address (51 Franklin St, Fifth Floor, Boston, MA 02110-1301) replaces old one (at Temple Place) 2010-11-11 10:19 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_mask(): Improve error message for buffer overlap 2010-11-11 10:10 llundin * cplcore/cpl_filter_median.c: Update Copyright notice (FSF address) 2010-11-11 10:10 llundin * cpldfs/md5.h: Add Copyright notice 2010-11-10 16:54 llundin * cplcore/tests/cpl_vector-test.c: Benchmark w. OpenMP 2010-11-10 12:48 llundin * cplcore/tests/cpl_stats-test.c, cpldrs/tests/cpl_apertures-test.c, cplcore/cpl_image_defs.h: CPL_CONCAT*() defined in cpl_macros.h 2010-11-10 12:47 llundin * cplcore/: cpl_polynomial.c, cpl_test.c: Use CPL_ATTR_* (DFS04697) 2010-11-10 12:41 llundin * cplcore/cpl_xmemory.c: Use CPL_ATTR_* (DFS04697) 2010-11-10 12:39 llundin * cplcore/cpl_xmemory.h: rm unused header files 2010-11-10 12:38 llundin * cplcore/cpl_xmemory.h: Use CPL_ATTR_* (DFS04697) 2010-11-10 12:33 llundin * cplcore/cpl_version.h.bot, cplcore/cpl_error.c, cplcore/cpl_error.h, cplcore/cpl_error_impl.h, cplcore/cpl_errorstate.h, cplcore/cpl_fits.h, cplcore/cpl_image_basic.h, cplcore/cpl_image_filter.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_impl.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_mask.h, cplcore/cpl_memory.h, cplcore/cpl_msg.c, cplcore/cpl_msg.h, cplcore/cpl_polynomial.h, cplcore/cpl_test.h, cplcore/cpl_tools.c, cplcore/cpl_tools.h, cplcore/cpl_type.h, cplcore/cpl_vector.c, cplcore/cpl_vector.h, cpldfs/cpl_dfs.c, cplui/cpl_recipedefine.h: Use CPL_ATTR_*() and CPL_CONCAT*() (DFS04697) 2010-11-10 12:26 llundin * cplcore/cpl_macros.h: CPL_CONCAT*(), CPL_ATTR_*(): Added for use all over CPL 2010-11-09 14:22 llundin * cplcore/cpl_error.c: cpl_error_set_fits_macro(): FLEN_ERRMSG replaces FLEN_STATUS 2010-11-09 13:48 llundin * cplcore/: cpl_propertylist.c, tests/cpl_propertylist-test.c: cpl_propertylist_load_regexp(): Catch NULL regexp (DFS09599). cpl_propertylist_{load,copy,erase}_regexp(), cpl_propertylist_to_fitsfile(): use cpl_error_set_regex(). cpl_propertylist_erase_regexp(): rm dead code. cpl_propertylist_to_fitsfile(), cpl_propertylist_load_regexp(), cpl_propertylist_load(), cpl_propertylist_erase_regexp(), cpl_propertylist_copy_property_regexp(): Unit tests of error handling added 2010-11-09 13:40 llundin * cplcore/: cpl_error.c, cpl_error_impl.h, tests/cpl_error-test.c: cpl_error_set_regex(): Added w. uni tests 2010-11-09 11:01 llundin * cplcore/: cpl_propertylist.c, tests/cpl_propertylist-test.c: cpl_propertylist_to_fitsfile(): fits_update_key() replaces fits_write_key() (DFS09596) 2010-11-09 10:37 llundin * cplcore/cpl_propertylist.c: Rename static functions with leading "_" (append "_" instead). cpl_propertylist_from_fitsfile_(): Redeclare to cpl_error_type, improve doxygen, support no key-removal, use TSBYTE for char, avoid unused cast to and from cx-types, create detailed CPL errors. cpl_propertylist_to_fitsfile(): Avoid code duplication by calling cpl_propertylist_from_fitsfile_() 2010-11-09 10:18 llundin * cplcore/cpl_tools.c: cpl_fits_add_properties(): Do not copy properties that will be removed 2010-11-09 10:07 llundin * cplcore/tests/cpl_vector-test.c: filename clean-up 2010-11-08 16:01 llundin * cplcore/: cpl_imagelist_io.c, cpl_propertylist.c, cpl_vector.c: cpl__save(): rm fits_write_key() of mandatory cards and optional cards with its default value (e.g. BSCALE=1) 2010-11-08 15:54 llundin * cplcore/tests/cpl_propertylist-test.c: cpl_test_eq_error() replaces cpl_test_eq() for error codes. Use cpl_test_fits() on saved files 2010-11-08 10:56 llundin * Doxyfile.in, cplcore/cpl_error.h: DOXYGEN_SKIP used to detect if the preprocessor is doxygen 2010-11-08 10:04 llundin * cplcore/cpl_image_filter_body.h: @cond used to avoid doxygen warnings 2010-11-08 09:38 llundin * cplcore/cpl_error.h: CPL_HAVE_VA_ARGS: Fix doxygen @em typo 2010-11-05 16:40 llundin * cplcore/tests/cpl_vector-test.c: Use cpl_test_fits() after cpl_vector_save() 2010-11-05 16:28 llundin * cplcore/Makefile.am, cplcore/cpl_image_io.c, cplcore/cpl_image_io_body.h, cplcore/cpl_image_io_impl.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io_body.h, cplui/cpl_frameset_io.c: cpl_image_load_(): Use for all image loading in CPL - w. improved error messages 2010-11-05 16:04 llundin * cplcore/tests/cpl_image_io-test.c: one more test 2010-11-05 15:57 llundin * cplcore/tests/cpl_imagelist_io-test.c: Test cpl_imagelist_load() error correctly (w. existing file). Typo fix 2010-11-05 10:45 llundin * cplui/cpl_frameset_io.c: #include "cpl_imagelist.h" replaces #include "cpl_imagelist_defs.h" 2010-11-05 10:32 lbilbao * configure.ac, libcext/m4/eso.m4: Remove --enable-threads option. 2010-11-04 16:54 cizzo * cplcore/cpl_table.c: Fix wrong CFITSIO error reporting in cpl_table_save() 2010-11-04 15:41 llundin * cpldfs/cpl_dfs.c: Place Definitions above Private function prototypes. rm one static variable 2010-11-04 15:03 llundin * cplcore/cpl_fits.c: Use cpl_error_set_fits() for I/O errors and avoid cpl_tools_get_cfitsio_msg() (DFS02576) 2010-11-04 13:42 llundin * cplcore/: cpl_tools.c, cpl_tools.h: cpl_tools_get_cfitsio_msg(): removed, using cpl_error_set_fits() instead (DFS02576) 2010-11-04 13:34 llundin * cpldfs/cpl_dfs.c: rm unneeded #include 2010-11-04 13:32 llundin * cplcore/cpl_imagelist_io.c: cpl_imagelist_save(), cpl_imagelist_load*(): Use cpl_error_set_fits() for I/O errors and avoid cpl_tools_get_cfitsio_msg() (DFS02576) 2010-11-04 13:08 llundin * cplcore/: cpl_imagelist_io.c, cpl_imagelist_io_body.h: rm white-space leading ; cpl_imagelist_save(), cpl_imagelist_load(): error replaces fio_status 2010-11-04 11:58 llundin * cplcore/cpl_propertylist.c: cpl_propertylist_load(), cpl_propertylist_load_regexp(), cpl_propertylist_save(): Use cpl_error_set_fits() for I/O errors and avoid cpl_tools_get_cfitsio_msg() (DFS02576) 2010-11-04 11:46 llundin * cplcore/cpl_vector.c: gauss(), gauss_derivative(): Use fabs() not sqrt(), nonnull __attribute__, recode FP-check on exact zero, reduce scope of some vars, use const modifiers 2010-11-04 11:15 llundin * cplcore/cpl_vector.c: cpl_vector_load(), cpl_vector_save(): Use cpl_error_set_fits() for I/O errors and avoid cpl_tools_get_cfitsio_msg() (DFS02576) 2010-11-04 11:00 llundin * cplcore/tests/cpl_vector-test.c: Improve error-tests 2010-11-04 08:58 llundin * cplui/cpl_frameset_io.c: cpl_fits_has_image(): Use cpl_error_set_fits() for I/O errors and avoid cpl_tools_get_cfitsio_msg() (DFS02576) 2010-11-03 16:50 llundin * cpldfs/cpl_dfs.c: Use cpl_error_set_fits() for I/O errors and avoid cpl_tools_get_cfitsio_msg() (DFS02576) 2010-11-03 16:18 llundin * cplcore/cpl_memory.h: Guard __attribute__ w. #ifdef __GNUC__ 2010-11-03 16:06 llundin * cplcore/cpl_image_io.c: Use cpl_error_set_fits() for I/O errors and avoid cpl_tools_get_cfitsio_msg() (DFS02576) 2010-11-03 16:01 llundin * cplcore/cpl_error.c: cpl_error_set_fits_macro(): Improve message 2010-11-03 14:12 llundin * cplcore/: cpl_error.c, cpl_error_impl.h, tests/cpl_error-test.c: cpl_error_set_fits(): Added internally, as replacement for cpl_tools_get_cfitsio_msg() 2010-11-03 11:06 llundin * cplcore/: cpl_tools.c, cpl_tools.h, tests/cpl_vector-test.c: cpl_tools_reset_flops(): rm 2010-11-02 16:49 cizzo * cplcore/cpl_table.c: Now table structure related functions handle also units 2010-11-02 16:48 cizzo * cplcore/tests/cpl_table-test.c: Add unit tests on testing units handling in table structure related functions. 2010-11-02 10:30 llundin * cplcore/tests/cpl_tools-test.c: cpl_tools_get_kth_quickselection_bench(): Add tests + comments 2010-10-29 15:56 llundin * cplcore/cpl_xmemory.c: Ensure OpenMP correctness of count of maximum allocations 2010-10-19 17:18 llundin * cplcore/cpl_test.c: cpl_test_get_description(): Added __STRICT_ANSI__ 2010-10-19 17:07 llundin * cplcore/cpl_test.c: cpl_test_get_description(): Added __STDC_IEC_559_COMPLEX__ 2010-10-18 17:11 llundin * cplcore/cpl_error.h: CPL_HAVE_VA_ARGS: Simplify definition a bit and improve doxygen 2010-10-18 14:25 lbilbao * cplcore/: cpl_error.h, cpl_error_impl.h, cpl_init.c: Make cpl_error_init_locks() non-exported. 2010-10-18 10:12 llundin * cplcore/cpl_error.h: cpl_error_set_message(): Add doxygen C89 example 2010-10-15 11:20 lbilbao * configure.ac, cplcore/cpl_error.c, cplcore/cpl_error.h, cplcore/cpl_init.c, libcext/m4/eso.m4: Option to enable threads added. Fixes in the locks-related code. 2010-10-13 13:56 lbilbao * cplcore/: cpl_error.c, cpl_init.c: RW Locks added for global variables cpl_error_{status, read_only}. 2010-10-13 13:43 llundin * cplcore/cpl_test.c: Fix const cast away (by avoiding mix of string literals and strings from malloc()) 2010-10-12 10:16 llundin * cplcore/cpl_test.c: Fix const cast away (mostly) 2010-10-12 09:47 llundin * cplcore/cpl_image_filter_body.h: Fix const cast away 2010-10-07 11:08 llundin * cpldrs/tests/cpl_wcs-test.c: Add a few pointer tests 2010-10-06 17:37 llundin * cpldrs/tests/cpl_photom-test.c: cpl_photom_fill_blackbody(): Fix monotonicity tests 2010-10-04 15:27 llundin * cpldrs/tests/cpl_photom-test.c: Adjust and generalize constants. Improve messaging 2010-10-04 15:09 llundin * cplcore/cpl_vector.c: cpl_vector_correlate(): Raise bar for assert(), Use explicit FP constants 2010-10-01 17:17 llundin * cpldrs/: cpl_photom.c, tests/cpl_photom-test.c: cpl_photom_fill_blackbody(): Use better error codes, check swap of in- and output units, add unit tests 2010-10-01 14:02 llundin * cpldrs/cpl_phys_const.h: CPL_PHYS_C defined as floating point, since this is how it is typically used 2010-10-01 12:17 llundin * cpldrs/tests/cpl_photom-test.c: Test units, use new cpl_test macros for existing tests 2010-10-01 12:17 llundin * cpldrs/cpl_phys_const.h: Derived quantities defined from basic ones 2010-10-01 08:47 llundin * cplcore/cpl_image_gen.c: Undo previous commit 2010-09-30 14:24 llundin * cplcore/cpl_image_gen.c: CPL_I: use definition that works also w. Sun Studio 12.1 2010-09-30 14:24 llundin * cplcore/cpl_image_gen_body.h: cpl_image_fill_noise_uniform(): Fill with complex values only when supported 2010-09-29 09:20 llundin * cplcore/: cpl_imagelist_io.c, tests/cpl_imagelist_io-test.c: cpl_imagelist_set(), cpl_imagelist_empty(): Support multiple insertions of the same image (DFS09161) 2010-09-29 08:46 llundin * cplui/cpl_plugin.c: Undo previous commit (since gcc 4.X warnings take precedence over gcc 3.X warnings) 2010-09-28 22:41 llundin * cplcore/cpl_imagelist_io_impl.h: cpl_imagelist_empty(): Internal. cpl_imagelist_delete(): Use cpl_imagelist_empty() 2010-09-28 11:06 llundin * cplcore/: Makefile.am, cpl_imagelist_io.c, tests/cpl_imagelist_io-test.c: cpl_imagelist_empty(): Internal. cpl_imagelist_delete(): Use cpl_imagelist_empty() 2010-09-28 10:12 llundin * cplcore/: cpl_image_gen.c, cpl_image_gen_body.h: cpl_image_fill_noise_uniform(): Use CPL_I to try alternative to I (DFS09015) 2010-09-28 10:06 llundin * cplcore/cpl_image_gen_body.h: rm white-space leading ; 2010-09-24 09:28 llundin * cplcore/cpl_propertylist.c, cplui/cpl_frameset.c, cplui/cpl_parameter.c, cplui/cpl_plugin.c: dump function: Cast %p format argument to const void * 2010-09-22 16:10 llundin * cplcore/: cpl_imagelist_io.c, tests/cpl_imagelist_io-test.c: cpl_imagelist_set(): Fix tiny bug on inset check w. uni test. Clean doxygen a bit 2010-09-22 15:31 llundin * cplcore/cpl_image_io.h: Use gcc attributes warn_unused_result, malloc for constructors (DFS04697) 2010-09-22 15:24 llundin * cplcore/: cpl_image_io.c, cpl_image_io.h, tests/cpl_image_io-test.c: cpl_image_wrap(): Added w. unit tests (DFS09162) 2010-09-22 15:05 llundin * cplcore/cpl_image_io.c: cpl_image_wrap_() renamed from cpl_image_wrap() in prep for DFS09162. Also clean up doxygen and error handling 2010-09-21 15:23 llundin * cplcore/tests/cpl_propertylist-test.c: Improve tests of error handling, use cpl_test_eq_error 2010-09-21 14:16 llundin * cplcore/cpl_test.c: cpl_test_end(): Improve message on negative nfail failure 2010-09-21 11:17 llundin * cplcore/cpl_test.c: cpl_test_eq_error_macro(): Perform the two comparisons as a single test 2010-09-21 11:03 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_errorstate(): Added w. unit tests 2010-08-20 16:44 llundin * cplcore/tests/cpl_matrix-test.c: Clean up CPL errors (bis) 2010-08-20 13:45 llundin * cplcore/tests/: cpl_image_io-test.c, cpl_imagelist_basic-test.c, cpl_matrix-test.c, cpl_polynomial-test.c: Clean up CPL errors 2010-08-20 13:44 llundin * cplcore/cpl_test.c: cpl_test_one(): Use new parameter to avoid false positives on pre-existing CPL errors 2010-08-20 11:42 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_2d(): cpl_ensure_code() replaces cx_assert() 2010-08-20 08:41 llundin * cplui/tests/cpl_recipeconfig-test.c: Use cpl_test module 2010-08-19 17:09 llundin * cplui/tests/cpl_pluginlist-test.c: Use cpl_test module (bis) 2010-08-19 16:54 llundin * cplui/tests/cpl_plugin-test.c: Use cpl_test module (bis) 2010-08-19 16:52 llundin * cplui/tests/cpl_plugin-test.c: Use cpl_test module 2010-08-19 13:59 llundin * cplui/tests/cpl_framedata-test.c: Use cpl_test module 2010-08-19 13:38 llundin * cplui/tests/cpl_parameterlist-test.c: Use cpl_test module 2010-08-19 13:24 llundin * cplui/: cpl_parameter.c, tests/cpl_parameter-test.c: Improve error handling: cpl_func replaces _id, use cpl_error_set_message(), add a few unit tests - more needed. cpl_parameter_{en,dis}able(): Fix return code (DFS09224) 2010-08-19 11:48 llundin * cplcore/tests/cpl_memory-test.c: cpl_sprintf(): Test w. NULL argument 2010-08-18 17:00 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_2d(): Set CPL error on NaN-output instead of asserttion failure (DFS09220) 2010-08-16 15:35 llundin * cpldfs/cpl_dfs.c: cpl_dfs_setup_product_header(): For ESO PRO REC1 PARAMi NAME/VALUE: Improve FITS comment 2010-08-16 15:11 llundin * cplui/cpl_parameter.c: cpl_parameter_get_help(): Fix wrong function name in error message 2010-08-16 15:11 llundin * cplui/tests/cpl_parameter-test.c: Strenghten unit-tests - and use cpl_test module 2010-08-16 15:08 llundin * cplcore/cpl_test.c: cpl_test_noneq_string_macro(): Added (bis) 2010-08-16 15:05 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_noneq_string_macro(): Added 2010-08-13 10:52 llundin * cplcore/tests/cpl_filter-test.c: benchmark(): Fix type of wrong enum parameter 2010-08-13 10:47 llundin * cplcore/cpl_mask.c: Improve multiple cpp-concatenation 2010-08-13 09:23 llundin * cplcore/cpl_property.c: cpl_property_get_float(), cpl_property_get_double(): rm redundant, unreachable code 2010-08-13 09:17 llundin * cplcore/cpl_image_io.c: cpl_image_save(): rm redundant cpl_ensure_error() 2010-08-12 18:00 llundin * cplcore/cpl_image_filter_body.h: cpl_filter_average{,_bpm}_*_*(): Fix inconsistent declaration/definition 2010-08-10 17:23 llundin * cpldrs/tests/cpl_fft-test.c: cpl_fft_image_tests(): rm redundant output 2010-08-10 17:21 llundin * cpldrs/tests/cpl_fft-test.c: cpl_fft_image_tests(): Complete rewrite with better coverage 2010-08-10 15:39 llundin * cpldrs/tests/cpl_fft-test.c: cpl_fft_image_tests(): Raise bar for image comparison (FFTW 3.2.2 on 64-bit Ubuntu 10.04) 2010-07-31 09:46 cizzo * cpldrs/cpl_ppm.c: Prevent access out of range when searching forward in match_positions() 2010-07-14 10:00 llundin * cplcore/cpl_vector.c: cpl_vector_correlate(): Add cyclic boundary FIXME 2010-07-12 15:10 llundin * cplcore/cpl_mask.c: cpl_mask_filter(): doxygen specifically the mask dimensions 2010-07-12 14:31 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_mask(), cpl_image_filter(): doxygen spcifically the image dimensions 2010-07-05 09:12 cizzo * cplcore/cpl_matrix.c: Attempt to improve the alignment of columns numbering with printed data 2010-07-02 17:16 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_cmp(): Compare a univariate fit with a bivariate w. a zero-degree 2010-07-02 17:12 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit(): Clean up input check of mindeg 2010-07-02 14:04 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_test_2d(): Use correctly sized zerogdeg array 2010-07-02 13:51 cizzo * cpldrs/cpl_ppm.c: Function match points, to handle also 1D (i.e., correlated) patterns of points 2010-07-02 13:49 cizzo * cpldrs/tests/cpl_ppm-test.c: Add unit test for aligned points 2010-07-02 13:28 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_2d(): Fix wrong degree for dimdeg == true; cpl_polynomial_fit(): Fix mindeg[] check and improve doxygen 2010-07-02 11:01 llundin * cplcore/tests/cpl_polynomial-test.c: Changes to test dimdeg = CPL_TRUE (DFS09022) 2010-07-02 11:00 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_2d(): Fix dimdeg max degree error check. cpl_polynomial_fit(): Support dimdeg == CPL_TRUE (DFS09022) 2010-07-02 10:17 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit(): Draft support of dimdeg == CPL_TRUE (in 2D) (DFS09022) 2010-07-02 09:38 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit(): Ensure CPL_ERROR_UNSUPPORTED_MODE on unsupported 2D mode (DFS09021) 2010-07-02 08:55 llundin * cplcore/cpl_polynomial.c: Use @internal for static functions. cpl_vector_is_eqdist(): Do doxygen 2010-07-01 16:37 llundin * cplui/cpl_recipedefine.h: @hideinitializer, CPL_BEGIN_DECLS 2010-07-01 15:23 llundin * cplcore/cpl_test.h: Use @hideinitializer for #define 2010-07-01 15:19 llundin * cplcore/cpl_io.h: Doxygen of cpl_type_bpp and CPL_IO_* 2010-07-01 14:44 cizzo * cpldrs/cpl_ppm.c: cpl_ppm_match_points(): remove restriction about pattern being larger than data, and ensure mpattern and mdata are initialised if passed 2010-07-01 14:40 cizzo * cpldrs/tests/cpl_ppm-test.c: Add a unit test about case with patter larger than data 2010-07-01 11:32 llundin * cplcore/cpl_test.c: cpl_test_init_macro(): Reduce errno messaging to debugging w. ignore clause (and document why) 2010-06-30 17:52 llundin * cplcore/cpl_filter.h: cpl_filter: doxygen typo 2010-06-30 17:50 llundin * cplcore/cpl_filter.h: defgroup cpl_filter. _cpl_border_mode_, _cpl_filter_mode_: Use enum doxygen 2010-06-30 15:29 llundin * cplcore/cpl_mask.c: rm dependency of cpl_image internals. Clean up CPL header file usage 2010-06-30 15:22 llundin * cplcore/cpl_mask.h: include cpl_image.h replaces cpl_image_io.h 2010-06-30 14:52 llundin * cplcore/: cpl_image.h, cpl_image_basic.c, cpl_image_bpm.c, cpl_image_filter.c, cpl_image_filter_body.h, cpl_image_gen.c, cpl_image_io.c, cpl_image_iqe.c, cpl_image_resample.c, cpl_image_stats.c: Doxygen of all cpl_image functionality into one group, cpl_image (DFS08927) 2010-06-29 11:25 cizzo * cplcore/cpl_table.c: Fix bug on loading columns of boolean arrays when check invalid flag is off 2010-06-24 16:03 llundin * cplcore/cpl_bivector.c: cpl_size replaces int internally 2010-06-24 16:02 llundin * cplcore/: cpl_type_impl.h, Makefile.am: cpl_type_impl.h added 2010-06-18 15:49 llundin * cpldrs/cpl_fit_body.h: Fix indentation problem from previous tabulation 2010-06-17 08:26 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_test_1d(): Raise bar for test of 1D support mindeg 2010-06-16 14:08 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_test_1d(): Raise bar for valgrind test of 1D support mindeg 2010-06-16 13:58 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_test_1d(): Test of 1D support mindeg > 0 (DFS08956) 2010-06-16 13:43 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_1d(), cpl_matrix_fill_normal_vandermonde(): Finalize mindeg > 0 support. cpl_polynomial_fit(): In 1D support mindeg > 0 (DFS08956) 2010-06-16 10:46 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_1d(), cpl_matrix_fill_normal_vandermonde(): Draft (inactive) support of mindeg == degree 2010-06-14 10:59 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_1d(), cpl_matrix_fill_normal_vandermonde(): Draft (inactive) support of mindeg > 0 2010-06-14 10:14 cizzo * cplcore/cpl_table.c: Fix mistyped function name cpl_table_unselect_row() 2010-06-11 14:25 llundin * cplcore/cpl_matrix.c: cpl_matrix_decomp_chol(): Use single return at end, cpl_tools_add_flops() also on error, improve initialization 2010-06-09 17:09 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit(): Fix doxygen example error regarding mindeg (DFS08928) 2010-05-31 16:27 llundin * cplcore/: cpl_mask.c, cpl_mask_body.h: rm OPERATE_AND() macro, add optimization asserts(), improve comments 2010-05-31 13:16 llundin * cplcore/: Makefile.am, cpl_mask.c, cpl_mask_body.h: cpl_mask_body.h added with macro-defined functions for cpl_mask_filter() special cases 2010-05-31 13:15 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_filter_bench(): Called also for 1+2*(hy=3) masks 2010-05-28 10:55 llundin * cplcore/tests/cpl_mask-test.c: Add benchmark for 64-bit special filter-case 2010-05-28 10:47 llundin * cplcore/cpl_mask.c: cpl_mask_erosion_(), cpl_mask_dilation_(): size_t replaces uint{32,64}_t, var-renaming, comments update+improve 2010-05-28 10:34 llundin * configure.ac: rv 1.135 (stdint.h) 2010-05-28 10:15 llundin * cplcore/cpl_mask.c: cpl_mask_erosion_(), cpl_mask_dilation_(): Working 64-bit special cases 2010-05-27 14:51 llundin * cplcore/cpl_mask.c: cpl_mask_filter(): Add special case for 5x3 (and 7x3), 5x5 (and 7x5) 2010-05-27 14:49 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_filter_bench(): Support different masks (for benchmarking handling of special cases) 2010-05-27 11:26 llundin * cplcore/cpl_mask.c: cpl_mask_filter(): Reduce code duplication for handling small kernels, add special case for 1x1,3x1,1x5,3x5 2010-05-27 10:56 llundin * cplcore/cpl_test.c: cpl_test_get_bytes_*(): Fix doxygen typo 2010-05-25 16:16 llundin * cplcore/cpl_mask.c: cpl_mask_filter(): Doxygen typo. cpl_mask_{erosion,dilation}_(): Reduce instruction count 2010-05-25 13:34 llundin * cplcore/cpl_mask.c: cpl_mask_{erosion,dilation}_1_1(): Reduce instruction count in innermost loop 2010-05-21 14:15 llundin * cplcore/: cpl_mask.c, tests/cpl_mask-test.c: cpl_mask_filter(): Fast 3x3 handling w. bench marking 2010-05-20 16:09 llundin * cplcore/cpl_bivector.c: cpl_bivector_interpolate_linear(): Cleaner implementation 2010-05-19 14:29 llundin * cplcore/: cpl_bivector.c, tests/cpl_bivector-test.c: cpl_bivector_interpolate_linear(): rm redundant checks, cleaner support for non-interpolation, improve doxygen 2010-05-19 09:27 lbilbao * configure.ac: cpl-5.2.1cvs 2010-05-18 17:25 llundin * cplcore/cpl_math_const.h: Doxygen of the macros (DFS08857) 2010-05-18 15:14 llundin * cplcore/tests/cpl_bivector-test.c: cpl_bivector_interpolate_linear(): Add 1st element test (DFS08636) 2010-05-18 15:09 llundin * cplcore/cpl_bivector.c: cpl_bivector_interpolate_linear(): Fix wrong 1st value(s) (bis) (DFS08636) 2010-05-05 14:14 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_filter_test_matrix(): Test also against simpler, single element filter 2010-05-04 09:23 llundin * cplcore/: cpl_init.c, cpl_test.c: cpl_get_description(), cpl_test_get_description(): FFTW install status 2010-05-04 07:55 lbilbao * configure.ac: cpl-5.2.0 2010-05-03 17:14 llundin * cplcore/cpl_fits.c: cpl_fits_get_nb_extensions(), cpl_fits_get_extension_nb(): Doxygen @deprecated 2010-05-03 17:13 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_{1,2}d_create(): oxygen @deprecated. cpl_polynomial_fit(): Improve doxygen 2010-05-03 13:35 llundin * NEWS: Update for CPL 5.2: Deprecated functions 2010-05-03 13:33 llundin * cplcore/cpl_mask.c: cpl_mask_erosion(), cpl_mask_dilation(): Doxygen typo 2010-05-03 13:23 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_linear(), cpl_image_filter_morpho(), cpl_image_filter_median(), cpl_image_filter_stdev(): Doxygen @deprecated 2010-05-03 13:20 llundin * cplcore/cpl_image_basic.c: cpl_image_fit_gaussian(): Doxygen @deprecated 2010-05-03 13:20 llundin * cplcore/cpl_vector.c: cpl_vector_new_lss_kernel(), cpl_vector_convolve_symmetric(): Doxygen @deprecated 2010-05-03 13:19 llundin * cplcore/cpl_msg.c: cpl_msg_progress(): Doxygen @deprecated 2010-05-03 13:18 llundin * cplcore/cpl_mask.c: cpl_mask_erosion(), cpl_mask_dilation(), cpl_mask_opening(), cpl_mask_closing(): Doxygen @deprecated 2010-05-03 13:15 llundin * cplcore/cpl_filter.h: Doxygen of CPL_FILTER_EROSION, CPL_FILTER_DILATION, CPL_FILTER_OPENING, CPL_FILTER_CLOSING (DFS08693) 2010-05-03 10:44 cizzo * cplcore/cpl_column.c: In several functions, prevent triggering out-of-range error in case the range has actually length zero 2010-05-03 10:43 cizzo * cplcore/cpl_array.c: Propagate error from cpl_array_fill_window() 2010-05-03 10:08 cizzo * cplcore/cpl_table.c: cpl_table_save() fixed failed save and memory leak on previous error 2010-04-30 17:03 llundin * NEWS: Update for CPL 5.2 2010-04-30 16:54 llundin * cplcore/: cpl_image_io.c, cpl_image_stats.c, cpl_mask.c: Doxygen of pixel indexing convention (DFS08555) 2010-04-30 16:40 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_offset_saa(): Doxygen of bpm (DFS08558) 2010-04-30 16:28 llundin * cpldrs/cpl_detector.c: cpl_detector_interpolate_rejected(): fix lay out 2010-04-30 16:26 llundin * cplcore/cpl_imagelist_basic.c: cpl_imagelist_collapse_create(): doxygen of integer division for type int (DFS08578) 2010-04-30 15:47 llundin * cplcore/cpl_imagelist_basic.c: cpl_image_new_from_accepted(): Fix BPM creation (DFS08781) 2010-04-30 11:46 llundin * cplcore/cpl_mask.c: cpl_mask_filter(): doxygen Unnecessary large kernels 2010-04-30 10:54 llundin * cplcore/: cpl_mask.c, tests/cpl_mask-test.c: cpl_mask_filter(): Finalize CPL_BORDER_COPY support w. tests 2010-04-30 10:18 llundin * cplcore/cpl_mask.c: cpl_mask_filter(): doxygen on duality and idempotency 2010-04-30 10:10 llundin * cplcore/cpl_mask.c: Revert due to lack of unit test for border effect 2010-04-30 10:08 llundin * cplcore/cpl_mask.c: cpl_mask_crop_empty(): Experimental 2010-04-30 10:07 llundin * cplcore/tests/cpl_mask-test.c: Improve comments 2010-04-29 14:59 llundin * cplcore/cpl_mask.c: cpl_mask_filter(): Drop prep for handling of full kernels 2010-04-29 14:53 llundin * cplcore/cpl_mask.c: Revert previous (full mask handling is not faster) 2010-04-29 14:51 llundin * cplcore/cpl_mask.c: cpl_mask_erosion_full(): Working draft version 2010-04-28 21:39 llundin * cpldrs/cpl_apertures.c: cpl_apertures_extract_sigma(): cpl_mask_filter() replaces cpl_mask_opening() 2010-04-28 21:26 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_filter_test_matrix(): Protect against too large half-sizes 2010-04-28 15:47 llundin * cplcore/cpl_mask.h: cpl_mask_{erosion,dilation,opening,closing}(): deprecated (DFS08693) 2010-04-28 15:46 llundin * cplcore/cpl_mask.c: cpl_mask_{erosion,dilation,opening,closing}(): Improve doxygen 2010-04-28 15:39 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_test(): Avoid rounding error in timing 2010-04-28 15:35 llundin * cplcore/tests/cpl_mask-test.c: Drop testing of matrix-based filter functions 2010-04-28 15:33 llundin * cplcore/cpl_mask.c: cpl_mask_new_from_matrix(): clean-up 2010-04-28 15:22 llundin * cplcore/cpl_mask.c: cpl_mask_new_from_matrix(): Use index convention from cpl_mask_{erosion,dilation}() 2010-04-28 15:04 llundin * cplcore/: cpl_image_filter.c, cpl_matrix.c, cpl_matrix_impl.h: Undo previous unneeded edit 2010-04-28 14:59 llundin * cplcore/: cpl_mask.c, tests/cpl_mask-test.c: cpl_mask_{erosion,dilation,opening,closing}(): Reimplement as cpl_mask_filter() wrappers 2010-04-28 13:54 llundin * cplcore/: cpl_image_filter.c, cpl_matrix.c, cpl_matrix_impl.h: cpl_mask_new_from_matrix(): Available internally in CPL 2010-04-28 13:42 llundin * cplcore/tests/cpl_mask-test.c: Idempotency test for opening/closing 2010-04-28 13:06 lbilbao * NEWS: Updated for public release. 2010-04-28 13:01 lbilbao * m4/cpl.m4: Update WCS support to 4.4. 2010-04-28 12:38 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_fill_border(): Implement like cpl_mask_erosion_(). cpl_mask_filter_test_matrix(): Do also duality tests 2010-04-28 12:00 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_filter_test_schalkoff(): Test opening/closing, test duality. Test for empty kernel + unsupported borders 2010-04-28 11:58 llundin * cplcore/cpl_mask.c: cpl_mask_filter(): NOP not supported for opening/closing 2010-04-28 11:58 cizzo * NEWS: Add what's new section for CPL 5.2 2010-04-28 11:40 cizzo * cplcore/tests/cpl_table-test.c: Added commented test 2010-04-28 10:47 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_shift_filter(), cpl_mask_fill_border(): Added. cpl_mask_shift_test(): Test erosion/dilation via cpl_mask_shift_filter() 2010-04-28 10:46 llundin * cplcore/cpl_mask.c: cpl_mask_filter(): Improve doxygen (incl. rm of shiftting). cpl_mask_erosion_(), cpl_mask_dilation_(): Fix out-of-bounds row limit and improve comments 2010-04-27 14:20 llundin * cplcore/tests/cpl_mask-test.c: Test of dilation, opening, closing 2010-04-27 14:18 llundin * cplcore/cpl_mask.c: cpl_mask_filter(): in-place for opening+closing. cpl_mask_{erosion,dilation}_(): refine istop 2010-04-27 14:15 llundin * cplcore/cpl_filter.h: CPL_BORDER_ZERO: Improve doxygen 2010-04-27 09:50 llundin * cplcore/: cpl_mask.c, tests/cpl_mask-test.c: cpl_mask_erosion_(): Handle small kernels on narrow masks. cpl_mask_dilation_(), cpl_mask_opening_(), cpl_mask_closing_(): Added. cpl_mask_filter(): Reduce cost of empty-mask check, support CPL_BORDER_COPY, support dilation, opening, closing 2010-04-26 17:27 llundin * cplcore/cpl_mask.c: cpl_mask_erosion_(): Use u32 padded rows 2010-04-26 15:31 llundin * cplcore/cpl_mask.c: cpl_mask_erosion_(): Enable u16 version 2010-04-26 14:13 llundin * cplcore/: cpl_filter.h, cpl_mask.c, tests/cpl_mask-test.c: CPL_BORDER_ZERO added for cpl_mask_filter() w. unit test cpl_mask_filter_test_matrix() 2010-04-26 13:30 llundin * cplcore/cpl_test.c: cpl_test_eq_mask(): Improve message 2010-04-26 11:46 rpalsa * cpljava/cpl_gasgano.c: Java_org_eso_cpl_jni_JNIParameterImp_nativeSetValue(): Revert change: Update parameter state after its value has been modified. 2010-04-26 10:19 llundin * cplcore/cpl_mask.c: cpl_mask_erosion_(): Draft version of multi-width filter 2010-04-26 09:59 llundin * configure.ac: AC_CHECK_HEADERS(stdint.h) for DFS08693 2010-04-23 13:51 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_filter_test_schalkoff(): Added 2010-04-23 13:50 llundin * cplcore/cpl_mask.c: cpl_mask_erosion_(): use pointer-offsets to reduce innermost loop index arithmetics 2010-04-23 11:41 llundin * cplcore/: cpl_mask.c, tests/cpl_mask-test.c: cpl_mask_filter(): General erosion done (DFS08693) 2010-04-23 11:11 llundin * cplcore/cpl_test.c: cpl_test_macro(): msg depends on fail_on_zero 2010-04-23 09:56 cizzo * cplcore/cpl_column.c: missing fix to types int and double in casting array to array. Eliminate unused variables. 2010-04-22 20:47 llundin * cplcore/cpl_filter.h: CPL_FILTER_EROSION, CPL_FILTER_DILATION, CPL_FILTER_OPENING, CPL_FILTER_CLOSING. (Dfs08693) 2010-04-22 16:53 llundin * cplcore/: cpl_mask.c, cpl_mask.h, tests/cpl_mask-test.c: cpl_mask_filter(): In progress (Dfs08693) 2010-04-22 15:16 llundin * configure.ac: AC_CHECK_FUNCS(setenv) for DFS08569 2010-04-22 15:13 llundin * cplcore/: cpl_plot.c, cpl_plot.h, tests/cpl_plot-test.c: cpl_plot_mask(): Added w. unit tests (DFS08569) 2010-04-22 14:46 rpalsa * cpljava/cpl_gasgano.c: Java_org_eso_cpl_jni_JNIParameterImp_nativeSetValue(): Update parameter state after its value has been modified. 2010-04-22 09:02 llundin * cplcore/tests/cpl_plot-test.c: cpl_plot_test(): Disable cpl_plot_mask() test for now 2010-04-21 17:01 cizzo * cplcore/tests/cpl_table-test.c: Nothing done 2010-04-21 16:55 llundin * cplcore/tests/cpl_plot-test.c: More unit tests 2010-04-21 12:55 llundin * cplcore/cpl_mask.h: ; 2010-04-20 17:11 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_test_matrix(): Added 2010-04-20 11:17 cizzo * cplcore/tests/cpl_table-test.c: Add unit testing for all types of cast 2010-04-20 11:11 cizzo * cplcore/cpl_table.c: Enable cast from column of depth 1 to flat column, and the other way round. Requested by MUSE consortium (Ole Streicher) 2010-04-20 11:09 cizzo * cplcore/: cpl_column.c, cpl_column.h: Add new utilities of the king cpl_column_cast_to_TYPE__array() and _flat(). Fix incorrect casting from array to array 2010-04-12 16:49 cizzo * cplcore/: cpl_array.c, cpl_array.h: Implement cpl_array_cast() 2010-04-12 16:48 cizzo * cplcore/tests/cpl_table-test.c: A couple of direct calls to cpl_array_cast() 2010-04-12 15:59 cizzo * cplcore/cpl_table.c: Specify that all arrays in a column must have same length 2010-04-09 10:56 cizzo * cplcore/cpl_table.c: Complete doc of cpl_table_set_array() 2010-04-09 10:40 llundin * cpldrs/cpl_detector_body.h: cpl_detector_interpolate_rejected(): rm redundant check 2010-04-09 10:38 llundin * cpldrs/tests/cpl_detector-test.c: Add tests, reduce var scope 2010-04-08 15:50 llundin * cpldrs/: cpl_detector.c, cpl_detector_body.h, tests/cpl_detector-test.c: cpl_detector_interpolate_rejected(): Support all pixel types, rm bpm also when empty 2010-04-08 14:01 llundin * cplcore/cpl_image_bpm.c: Improve doxygen. cpl_image_accept_all(): Use cpl_image_unset_bpm() 2010-04-08 14:00 llundin * cplcore/: cpl_image_io.c, cpl_image_io.h, tests/cpl_image_bpm-test.c: cpl_image_unset_bpm(): Added with unit tests (DFS08568) 2010-04-08 13:59 llundin * cplcore/cpl_image_bpm.h: rm white space 2010-04-07 15:52 cizzo * cplcore/tests/cpl_table-test.c: Added some commented test 2010-04-07 15:51 cizzo * cplcore/cpl_table.c: In cpl_table_save(): return in case of ILLEGAL_OUTPUT caused by zero depth integer columns; allocate empty integer arrays in case the must be written to file 2010-04-07 14:09 llundin * cpldrs/tests/cpl_detector-test.c: cpl_detector_interpolate_rejected(): Isotropic test (DFS08639) 2010-04-07 14:06 llundin * cplcore/cpl_test.c: cpl_test_one(): Test number in message 2010-04-07 09:13 llundin * cpldrs/: cpl_detector.c, cpl_detector_body.h, tests/cpl_detector-test.c: cpl_detector_interpolate_rejected(): Improve speed (DFS08639) + doxygen, handle all pixels bad 2010-04-07 09:10 llundin * cpldrs/tests/cpl_detector-test.c: More tests of cpl_detector_interpolate_rejected(). Use cpl_test_eq_error() 2010-04-06 13:25 llundin * cplcore/cpl_tools_body.h: Revert previous revert (now that DFS08657 has been closed) 2010-04-06 11:22 llundin * cpldrs/cpl_wcs.c: cpl_wcs_platesol(): Refactor (avoid duplicated code + dual meaning of variable n, reduce variable scope, rm unused variables 2010-04-06 11:12 llundin * cpldrs/tests/cpl_wcs-test.c: More tests 2010-04-01 17:16 llundin * cpldrs/tests/cpl_wcs-test.c: cpl_wcs_platesol(): cpl_vector_get_median_const() replaces cpl_vector_get_median() in loop to fix permutation bug 2010-04-01 15:59 llundin * cpldrs/cpl_wcs.c: cpl_wcs_platesol(): cpl_vector_get_median_const() replaces cpl_vector_get_median() in loop to fix permutation bug 2010-04-01 08:47 llundin * cplcore/cpl_tools_body.h: cpl_tools_get_median_*(): Revert to cpl_tools_get_kth 2010-03-31 15:57 llundin * cplcore/tests/: cpl_filter-test.c, cpl_filter_body.h: cpl_test_get_cputime() replaces clock() 2010-03-31 15:46 llundin * cplcore/tests/: cpl_filter-test.c, cpl_filter_body.h: Use cpl_test_image_abs() 2010-03-31 15:31 llundin * cplcore/: cpl_tools.c, cpl_tools_body.h, tests/cpl_filter_body.h, tests/cpl_tools-test.c: cpl_tools_median_{int,float,double}(): Use quickselect + special cases instead of _kth (DFS08647) 2010-03-31 15:01 llundin * cplcore/tests/cpl_stats-test.c: cpl_stats_new_median_bench(): Added. Improve tol for stdev test 2010-03-30 15:42 llundin * cplcore/: cpl_tools.c, cpl_tools.h, cpl_tools_body.h, tests/cpl_tools-test.c: cpl_tools_get_kth_{int,float,double}(): Use quickselect (DFS-8647). Also add quicksort as reference in unit-testing 2010-03-30 12:02 llundin * cplcore/tests/cpl_vector-test.c: Use cpl_test_abs(), cpl_test_vector_abs(), cpl_test_leq(). rm cpl_vector_get_diff(). More tests of cpl_vector_sort() 2010-03-26 17:50 llundin * cplcore/: cpl_bivector.c, tests/cpl_bivector-test.c: cpl_bivector_interpolate_linear(): Fix wrong 1st value(s) (DFS08636) 2010-03-25 17:11 llundin * cplcore/tests/cpl_bivector-test.c: Use cpl_test_abs(), cpl_test_vector_abs(), cpl_test_eq_error() 2010-03-25 16:12 llundin * cplcore/: cpl_tools.c, cpl_tools.h, cpl_tools_body.h: Copyedit median code 2010-03-25 15:29 llundin * cplcore/cpl_tools_body.h: CPL_PIX_SORT() replaces gaurded CPL_TYPE_SWAP() 2010-03-25 14:43 llundin * cplcore/: cpl_tools.h, cpl_tools_body.h, tests/cpl_tools-test.c: cpl_tools_quickselection_{double,float,int}(): Added - but only in unit testing due to its slowness 2010-03-24 14:56 llundin * cplcore/: cpl_filter_median.c, cpl_filter_median_double.c, cpl_filter_median_float.c, cpl_filter_median_int.c, tests/cpl_filter_body.h: Use cpl_tools_get_kth_*() 2010-03-24 11:06 llundin * cplcore/cpl_tools_body.h: cpl_tools_get_kth_*(): Improve doxygen and comments 2010-03-23 16:14 llundin * cplcore/cpl_imagelist_basic_body.h: cpl_imagelist_collapse_median_create(): Reduce length of 2nd CPL_TOOLS_GET_KTH() 2010-03-23 10:03 llundin * cplcore/tests/cpl_imagelist_basic-test.c: cpl_imagelist_collapse_median_create(): Error tests added 2010-03-22 16:10 llundin * cplcore/tests/cpl_tools-test.c: Simplify tests 2010-03-22 16:06 llundin * cplcore/tests/cpl_tools-test.c: One more test of cpl_tools_get_kth_int() 2010-03-22 15:12 llundin * cplcore/cpl_tools_body.h: cpl_tools_get_kth_*(): Reduce int instruction count 2010-03-22 15:10 llundin * cplcore/cpl_tools_body.h: cpl_tools_get_kth_*(): Fix bug of previous edit 2010-03-22 14:28 llundin * cplcore/cpl_tools.h: cpl_tools_get_kth_*(): nonnull gcc-attribute 2010-03-22 14:27 llundin * cplcore/tests/cpl_tools-test.c: Tests of cpl_tools_get_kth_int() 2010-03-22 14:27 llundin * cplcore/cpl_tools_body.h: (cpl_tools_get_kth_*(): Improve doxygen + comments, rm NULL check, reduce scope of variables 2010-03-22 13:20 llundin * cplcore/tests/: Makefile.am, cpl_polynomial-test.c, cpl_tools-test.c: cpl_tools-test.c added 2010-03-19 15:23 llundin * cplcore/cpl_imagelist_basic_body.h: cpl_imagelist_collapse_minmax_create(): cpl_tools_add_flops() 2010-03-19 15:16 llundin * cplcore/tests/cpl_imagelist_basic-test.c: Increase tolerance for cpl_imagelist_collapse_minmax_create() versus cpl_imagelist_collapse_create() (due to valgrind) 2010-03-19 14:43 llundin * cplcore/tests/cpl_imagelist_basic-test.c: cpl_imagelist_collapse_minmax_create_bench(): Added 2010-03-19 14:37 llundin * cplcore/cpl_imagelist_basic_body.h: cpl_imagelist_collapse_median_create(): Unfold nested pixel loop to single loop 2010-03-19 10:49 lbilbao * cpldrs/cpl_geom_img.c: Missing information in the documentation added (DFS08579). 2010-03-19 09:36 llundin * cplcore/tests/cpl_imagelist_basic-test.c: Test cpl_imagelist_collapse_minmax_create() versus cpl_imagelist_collapse_create(). Replace cpl_test() where relevant 2010-03-19 09:14 llundin * cplcore/tests/cpl_stats-test.c: Use cpl_test_eq_error() 2010-03-18 16:33 llundin * cplcore/: cpl_imagelist_basic_body.h, cpl_imagelist_basic.c: cpl_imagelist_collapse_minmax_create(): Improve speed (DFS08577) 2010-03-18 10:33 llundin * cplcore/cpl_stats.c: CPL_STATS_DUMP_ONE(), CPL_STATS_DUMP_TWO(): Added. cpl_stats_dump(): Dump median_dev, protect against similar bugs, clean-up precision and messaging (DFS08576) 2010-03-17 10:00 llundin * cplcore/cpl_test.c: cpl_test_end(): debug msg of sysconf(_SC_CLK_TCK) 2010-03-16 16:10 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_offset_combine(): CPL_ERROR_DATA_NOT_FOUND replaces CPL_ERROR_ILLEGAL_OUTPUT (DFS08562), avoid vector duplication, failed refinement falls back on default, re-factor and reduce variable scope. cpl_geom_img_offset_saa(): Fix doxygen on error codes 2010-03-15 11:55 llundin * cpldrs/: cpl_geom_img.c, cpl_geom_img_body.h: cpl_geom_img_offset_saa(): use firstbpm to avoid double bpm-search (DFS08556) 2010-03-15 10:22 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_*(): cpl_mask_is_empty() replaces cpl_image_count_rejected() 2010-03-11 18:17 llundin * cplcore/: cpl_polynomial.h, cpl_vector.h: Declare constructors w. __attribute__((warn_unused_result, malloc)) (DFS04697) 2010-03-11 17:54 llundin * cplcore/cpl_memory.h: cpl_{m,c}alloc(): __attribute__((malloc)) (DFS04697) 2010-03-11 17:45 llundin * cplcore/cpl_memory.h: cpl_strdup(): Fall back on __attribute__((malloc)) (DFS04697) 2010-03-11 16:03 llundin * cplui/cpl_recipedefine.h: gcc (nonnull) attributes (DFS04697) 2010-03-11 15:40 llundin * cplui/cpl_recipedefine.h: CPL_RECIPE_DEFINE(): cpl_error_set_where() replaces cpl_error_set(), Fix doxygen typo 2010-02-26 15:05 llundin * cplcore/cpl_test.c, cplcore/cpl_test.h, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_test-test.c, cplcore/tests/cpl_vector-test.c, cpldrs/tests/cpl_fit-test.c, cpldrs/tests/cpl_geom_img-test.c: cpl_test_get_bytes_{vector,matrix,image,imagelist}(): Added and used in benchmarking 2010-02-23 16:19 llundin * cplcore/cpl_test.h: cpl_test_get_cputime(), cpl_test_get_walltime(): rm pure-attribute (DFS08438) 2010-02-23 14:17 llundin * cplcore/tests/cpl_test-test.c: cpl_test_get_walltime() test again 2010-02-23 14:04 llundin * cplcore/tests/cpl_test-test.c: Strenghten test of cpl_test_get_walltime via sleep(1) 2010-02-23 13:52 llundin * NEWS: CPL 5.1: News draft 2010-02-23 13:43 llundin * cplcore/cpl_io.h: CPL_IO_APPEND: Fix typo in comment 2010-02-22 14:54 llundin * cplcore/: cpl_image_basic.c, cpl_mask.c, tests/cpl_image_basic-test.c, tests/cpl_mask-test.c: cpl_image_turn(), cpl_mask_turn(): Fix doc-bug of rotation direction (DFS08343) 2010-02-19 12:32 lbilbao * cplcore/: Makefile.am, cpl_init.c: FFTW memory cleanup needed. (DFS08284) 2010-02-18 15:52 llundin * cpldfs/cpl_dfs.c: cpl_dfs_find_md5sum(): Support L2_CACHE_BYTES <= 0 (DFS08399) 2010-02-18 15:45 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_test_eq_error() replaces cpl_test_error()+cpl_test_eq() 2010-02-16 16:45 llundin * cplcore/cpl_test.h: break long lines 2010-02-11 14:55 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_test_abs(...) replaces cpl_test_leq(fabs(), ...) 2010-02-09 09:51 lbilbao * cplcore/tests/cpl_fits-test.c: Unit test updated for DFS07813. 2010-02-08 15:27 cizzo * cpldrs/cpl_fit.c: Fix mistake in LaTex code for cpl_fit_image_gaussian() (found by Armin Gabash) 2010-02-08 15:07 lbilbao * cplcore/cpl_fits.c: Changes required by ticket DFS07813 committed now, after CPL 5.1 release. 2010-01-29 15:17 lbilbao * configure.ac: cpl-5.1.0 -> cpl-5.1.1cvs 2010-01-29 15:03 lbilbao * configure.ac: 5.1.0cvs -> 5.1.0 2010-01-27 09:52 llundin * cplcore/cpl_image_filter.c: cpl_image_filter(), cpl_image_filter_mask(): doxygen @brief improved 2010-01-18 16:31 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_mask(): kernel replaces mask, update doxygen accordingly 2010-01-11 14:52 cizzo * cplcore/cpl_error.c: Change standard text associated to CPL_ERROR_FILE_IO from "File access permission denied" to "File read/write error" 2010-01-08 09:57 llundin * NEWS: cpl_image_filter_linear(): Use cpl_image_filter() as per AModigli 2009-12-22 15:24 cizzo * cpldrs/cpl_fit.c: Fix unchecked access to angle, minor, major in cpl_fit_image_gaussian() (signaled by P.Weilbacher) 2009-12-21 11:03 lbilbao * configure.ac: cpl-5.1.0b2 -> cpl-5.1.0cvs 2009-12-21 10:25 lbilbao * configure.ac: 5.1.0b2 2009-12-18 14:35 cgarcia * autogen.sh, libcext/autogen.sh: Changed to make more compliant with modern autotools (in special Fedora 11) 2009-12-15 12:05 llundin * cplcore/cpl_image_filter.c: mv macro-generated function definitions out of doxugen open group 2009-12-15 11:05 llundin * cplui/cpl_plugininfo.h: cpl_plugin_get_info(): Name space protect argument name to avoid causing gcc shadowing warnings to others 2009-12-14 16:35 llundin * cplcore/cpl_column.c, cplcore/cpl_image_basic.c, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_bpm.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_filter_body.h, cplcore/cpl_image_gen_body.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io_body.h, cplcore/cpl_imagelist.h, cplcore/cpl_imagelist_basic.c, cplcore/cpl_imagelist_basic_body.h, cplcore/cpl_imagelist_defs.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io.h, cplcore/cpl_mask.c, cplcore/cpl_plot.c, cplcore/cpl_polynomial.c, cplcore/cpl_property.c, cplcore/cpl_propertylist.c, cplcore/cpl_propertylist.h, cplcore/cpl_stats.c, cplcore/cpl_tools.h, cplcore/cpl_vector.c, cplcore/cpl_vector.h, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_propertylist-test.c, cplcore/tests/cpl_type-test.c, cplcore/tests/cpl_vector-test.c, cpldfs/tests/cpl_dfs-test.c, cpldrs/cpl_apertures.c, cpldrs/cpl_detector.c, cpldrs/cpl_fft.c, cpldrs/cpl_fft.h, cpldrs/cpl_fit.c, cpldrs/cpl_fit.h, cpldrs/cpl_fit_body.h, cpldrs/cpl_photom.c, cpldrs/tests/cpl_detector-test.c, cpldrs/tests/cpl_fft-test.c, cpldrs/tests/cpl_fit-test.c, cpldrs/tests/cpl_geom_img-test.c, cplui/cpl_frame.c, cplui/cpl_frameset.c, cplui/tests/cpl_plugin-test.c, cplui/tests/cpl_pluginlist-test.c, libcext/cext/cxdeque.c: Replace tabulation with four spaces 2009-12-14 14:48 llundin * cplcore/cpl_test.c: cpl_test_get_description(): Use WCSLIB_VERSION when defined 2009-12-09 16:49 lbilbao * cpldrs/cpl_detector.c: cpl_flux_get_bias_window(): Tiny doxygen warning fixed (wrong parameter name). 2009-12-08 16:55 llundin * libcext/cext/cxlist.c: _cx_list_sorted(): Fix gcc uninit-warning 2009-12-08 16:38 llundin * libcext/cext/cxutils.c: cx_vasprintf(): Include stdlib.h for free() 2009-12-08 15:14 llundin * cpljava/cpl_gasgano.c: makePluginLibrary(): Use union to avoid casting object pointer to function pointer 2009-12-08 14:46 llundin * cpljava/cpl_gasgano.c: Fixed unused parameter warnings by assuming env and class are non-NULL 2009-12-08 11:15 llundin * cplcore/cpl_imagelist_io.c: cpl_imagelist_load_internal(): Fix (false) gcc uninit-warning 2009-12-08 11:11 llundin * cplcore/cpl_image_io.c: cpl_image_load_internal(): Fix (false) gcc-uninit warning. cpl_image_cast(): cpl_image_wrap() replaces cpl_image_new(), const correctness. Replace cpl_image_new() w. cpl_image_wrap() 2009-12-08 10:33 llundin * cplcore/cpl_memory.h: cpl_sprintf(), cpl_vsprintf(): malloc + format attributes in absence of warn_unused_result 2009-12-08 10:24 llundin * cpljava/cpl_gasgano.c: default_log_message_handler(): Fix unused-warning. makePluginLibrary(): Improve documentation, explicit cast 2009-12-08 10:04 llundin * cpldrs/cpl_fit.c: cpl_fit_image_gaussian(): Reduce scope of xhalf and fix gcc-uninit warning 2009-12-07 16:57 llundin * libcext/cext/cxmemory.c: cx_*alloc*(): Fix printf-cast-warning 2009-12-07 16:55 llundin * cplui/cpl_parameter.c: _cpl_parameter_init(): Fix printf-cast-warning 2009-12-07 16:48 llundin * cplcore/cpl_msg.c, libcext/cext/cxmessages.h, libcext/cext/cxstring.c, libcext/cext/cxstring.h, libcext/cext/cxstrutils.h, libcext/cext/cxutils.h: Declare printf-like functions with gcc-format attribute 2009-12-07 16:18 llundin * cpldrs/cpl_fft.c: Fix doxygen Warning: end of file while inside a group 2009-12-07 16:14 llundin * cplcore/cpl_array.c: cpl_array_dump(): Fix doxygen typo (array replaces table) 2009-12-07 16:10 llundin * cpldfs/cpl_dfs.c: cpl_dfs_save_table(), cpl_dfs_save_propertylist(), cpl_dfs_save_imagelist(): Doxygen param inherit 2009-12-07 14:51 llundin * cplcore/cpl_polynomial.c: size_t cast for cpl_malloc() (DFS06655) 2009-12-07 14:34 llundin * cpldrs/cpl_fit.c: cpl_fit_imagelist_polynomial_window(): size_t cast for cpl_malloc() (DFS06655) 2009-12-07 14:32 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_offset_saa(): size_t cast for cpl_malloc() (DFS06655) 2009-12-07 14:09 cizzo * cplcore/tests/cpl_table-test.c: Correct specification of IO mode in cpl_table_save() calls; add also unit test by Lars, about unsupported CPL_IO_APPEND mode 2009-12-07 14:08 cizzo * cplcore/cpl_table.c: Better IO mode handling in cpl_table_save(), compatible with new mode CPL_IO_APPEND 2009-12-07 13:53 llundin * cplcore/cpl_image_iqe.c: iqemnt(): Fix gcc init-warning 2009-12-07 12:00 llundin * cplcore/tests/: cpl_image_io-test.c, cpl_imagelist_io-test.c, cpl_propertylist-test.c, cpl_vector-test.c: cpl_*_save(): Check error-handling of CPL_IO_APPEND 2009-12-07 11:56 llundin * cplcore/cpl_imagelist_io.c: cpl_imagelist_save(): Improve error check on mode 2009-12-07 11:38 cizzo * cplcore/: cpl_table.c, cpl_table.h: Remove cpl_table_save_old() 2009-12-07 11:25 llundin * cplcore/cpl_vector.c: cpl_vector_save(): Wrong check on mode combination fixed (DFS08081). 2009-12-07 10:04 llundin * cplcore/: cpl_imagelist_io.c, tests/cpl_imagelist_io-test.c: cpl_imagelist_save(): Error messages for _APPEND improved + some tests added 2009-12-04 15:54 llundin * cplcore/: cpl_imagelist_io.c, cpl_io.h, tests/cpl_imagelist_io-test.c: CPL_IO_APPEND w. draft of support in cpl_imagelist_save() (DFS07702) 2009-12-04 13:10 lbilbao * cplcore/cpl_image_io.c: cpl_image_save(): Wrong check on mode combination fixed (DFS08081). 2009-12-04 11:16 llundin * cplcore/cpl_memory.c: cpl_memory_init(): Explicit cxptr cast to avoid gcc warnings 2009-12-03 11:47 lbilbao * configure.ac: 5.1.0b1 -> 5.1.0cvs 2009-12-03 10:09 lbilbao * configure.ac: 5.1.0cvs -> 5.1.0b1 2009-12-03 09:34 llundin * cplcore/cpl_propertylist.c: _cpl_propertylist_insert(): const correctness (bis) 2009-12-03 09:34 llundin * cplcore/cpl_property.c: _cpl_property_value_set(): const correctness (bis) - use const void * which is used by memcpy() 2009-12-03 09:22 llundin * cplui/cpl_frameset.c: _cpl_frameset_cache_reset(): Declare as const and document potentially dangerous modification of internal members 2009-12-02 13:28 cizzo * cpldrs/cpl_ppm.c: Avoid compiler warning by initialising variable disp in cpl_ppm_match_positions() 2009-12-02 13:05 cizzo * cplcore/cpl_table.c: Eliminate unused variable ubarray in cpl_table_load_window() 2009-12-02 13:01 llundin * cplcore/cpl_image_iqe.c: g2efunc(): rm unused parameter. mx: Rename to mxx due to shadowing. mrqmin(), mrqcof(): Declare function-pointer 2009-12-02 11:55 llundin * cplui/cpl_frameset.c: _cpl_frameset_cache_push(): Declare as const and document potentially dangerous modification of internal members 2009-12-02 11:34 llundin * cplcore/cpl_propertylist.c: _cpl_propertylist_insert(): const correctness 2009-12-02 11:30 llundin * cplcore/cpl_property.c: _cpl_property_value_set(): const correctness 2009-12-02 11:29 lbilbao * cpl.h, cplcore/cpl_image_gen_body.h, cpldrs/Makefile.am, cpldrs/cpl_fft.c, cpldrs/cpl_fft.h, cpldrs/tests/Makefile.am, cpldrs/tests/cpl_fft-test.c, m4/cpl.m4: New cpl_fft module added under cpldrs, with FFTW wrappers. Unit tests added, too. Fix typo in CPL_CHECK_FFTW. Improve clarity in cpl_image_fill_noise_uniform(). 2009-12-02 11:24 llundin * cplcore/cpl_polynomial.c: CPL_POLYNOMIAL_USE_MULTI_HORNER: Avoid compilation of unused code 2009-12-02 10:36 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_fit_gaussian(): rm unit tests from deprecated function (bis) 2009-12-02 09:58 cizzo * cplcore/tests/cpl_table-test.c: Again changing commented test on big tables 2009-12-01 11:59 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_array_abs(): Added w. unit tests. cpl_test_image_abs_macro(): Include pixel type in messaging 2009-12-01 11:46 cizzo * cplcore/cpl_table.c: Cleanup of new cpl_table_save() after benchmarking 2009-12-01 11:45 cizzo * cplcore/tests/cpl_table-test.c: Changing (commented) test on big tables 2009-12-01 09:13 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_fit_gaussian(): rm unit tests from deprecated function 2009-11-30 17:30 cizzo * cplcore/: cpl_table.c, cpl_table.h: Speedup of cpl_table_save(), not yet benchmarked 2009-11-25 13:48 cizzo * cplcore/cpl_table.c: Upgrade doc of cpl_table_set_savetype() 2009-11-24 14:24 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_ima_offset_xcorr_subw_*(): Simplify indexing of output array 2009-11-23 19:00 llundin * cpldrs/tests/cpl_geom_img-test.c: cpl_imagelist_fill_shifted(): Added for test with non-integer shifts 2009-11-23 16:44 cizzo * cplcore/: cpl_column.c, cpl_table.c: Add support for TBYTE and TSBYTE columns in saved FITS tables 2009-11-23 16:43 cizzo * cplcore/tests/cpl_table-test.c: Add some more hidden tests 2009-11-23 07:35 llundin * cpldrs/tests/cpl_geom_img-test.c: Use cpl_test_vector_abs() 2009-11-23 06:03 llundin * cplcore/: cpl_test.c, tests/cpl_test-test.c: cpl_vector_test_abs() bis 2009-11-23 05:29 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_vector_abs(): Added w. unit test 2009-11-22 20:41 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_ima_offset_xcorr_subw_*(): Fix half-size upper limit(DFS08003), simplify pointer use 2009-11-22 16:54 llundin * cpldrs/: cpl_geom_img.c, cpl_geom_img_body.h, tests/cpl_geom_img-test.c: cpl_geom_img_offset_fine(), cpl_geom_ima_offset_xcorr*(): Support objects close to the border (DFS08003) (Draft) 2009-11-21 23:11 llundin * cpldrs/tests/cpl_geom_img-test.c: Tighten bounds on test of cpl_geom_img_offset_fine() + tighten test. Improved messaging 2009-11-21 23:09 llundin * cpldrs/cpl_geom_img.c: cpl_geom_ima_offset_xcorr(): rm redundant error handling+data copying, fix best_xcorr issue. cpl_geom_ima_offset_xcorr_subw(): rm redundant error handling 2009-11-21 19:49 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_ima_offset_xcorr_subw_{float,double}(): rm unused normalizarion. Reduce variable scope. Rename variables and improve comments. rm some redundant index computation. Use cpl_tools_add_flops() 2009-11-21 15:57 llundin * cpldfs/cpl_dfs.c: cpl_dfs_setup_product_header(): For ESO PRO REC1 PARAMi NAME: Add FITS comment about type 2009-11-21 15:47 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_parameterlist_fill(): Added to test the PRO REC1 PARAM cards. Use 1/3 as fp value to see accuracy 2009-11-21 02:55 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_offset_saa(): BPM optimizations 2009-11-21 02:07 llundin * cplcore/: cpl_image_io.c, cpl_image_io_impl.h, tests/cpl_image_io-test.c: cpl_image_fill_int(): Added, non-exported, w. unit-tests. rm useless #includes 2009-11-18 22:12 llundin * cpldrs/cpl_detector.c: cpl_flux_get_noise_ring(): Fail w. CPL_ERROR_DATA_NOT_FOUND on no data (DFS07980), also fix a non-NULL code 2009-11-18 19:26 llundin * cplcore/: cpl_image_io.c, cpl_imagelist_io.c: cpl_image*_load*(): Explicit doxygen on extnum (and pnum), rm cfitsio reference (since the functionality is supposed to be independent of the underlying I/O-library) 2009-11-18 19:17 llundin * cplcore/cpl_imagelist_io.c: cpl_imagelist_load(), cpl_imagelist_load_window(): rm non-ASCII from doxygen 2009-11-18 19:17 llundin * cplcore/cpl_image_io.c: cpl_image_load(): rm non-ASCII 2009-11-18 14:10 cizzo * cplcore/: cpl_array.c, cpl_array.h: Implement cpl_array_is_valid() 2009-11-16 21:29 llundin * cplcore/tests/cpl_test-test.c: cpl_test_fits_file(): Added w. size-check. cpl_test_fits_macro(): Fall back on cpl_test_fits_file() 2009-11-16 17:33 llundin * cplcore/cpl_test.c: cpl_test_fits_file(): Added w. size-check. cpl_test_fits_macro(): Fall back on cpl_test_fits_file() 2009-11-10 11:10 cizzo * cplcore/cpl_array.h: Include stdio.h for the new dump functions 2009-10-30 11:03 lbilbao * configure.ac: 5.1.0a -> 5.1.0cvs 2009-10-30 10:46 lbilbao * configure.ac: 5.1.0cvs -> 5.1.0a 2009-10-29 17:13 lbilbao * configure.ac, cplcore/Makefile.am, cplcore/tests/Makefile.am, cpldfs/Makefile.am, cpldfs/tests/Makefile.am, cpldrs/Makefile.am, cpldrs/tests/Makefile.am, cplui/Makefile.am, cplui/tests/Makefile.am, m4/cpl.m4: Roll back usage of pkg-config mechanism. 2009-10-29 15:33 lbilbao * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic_body.h, tests/cpl_imagelist_basic-test.c: cpl_imagelist_collapse_sigclip_create(): bug fixed. Unit tests added. 2009-10-29 13:00 cizzo * cplcore/: cpl_array.c, cpl_array.h: Add cpl_array_dump() and cpl_array_dump_structure() 2009-10-29 11:14 cizzo * cplcore/cpl_table.c: Eliminate last calls to cx_print() 2009-10-29 09:57 lbilbao * cplcore/tests/cpl_fits-test.c: Roll back previous commit changes as no API change should be included in CPL5.1. 2009-10-29 08:49 lbilbao * cplcore/cpl_fits.c: Roll back previous commit changes as no API change should be included in CPL5.1. 2009-10-28 18:02 lbilbao * cplcore/Makefile.am, cpldfs/Makefile.am, cpldrs/Makefile.am, cplui/Makefile.am: Removal of the now undefined CFITSIO_LDFLAGS (as a consequence of the new pkg-config mechanism). See ticket DFS06589. 2009-10-28 17:44 lbilbao * configure.ac, cplcore/Makefile.am, cplcore/tests/Makefile.am, cpldfs/Makefile.am, cpldfs/tests/Makefile.am, cpldrs/Makefile.am, cpldrs/tests/Makefile.am, cplui/Makefile.am, cplui/tests/Makefile.am, m4/cpl.m4: Move CFITSIO checking step at configuration time to pkg-config based mechanism. (DFS06589) 2009-10-27 10:19 lbilbao * cpl.h: Roll back DetMon headers. 2009-10-26 15:05 cgarcia * cpldfs/cpl_dfs.c: Matched the precision of double keywords in paf files with that of FITS headers. 2009-10-26 12:59 lbilbao * Makefile.am, acinclude.m4, configure.ac, m4/cpl.m4: Roll back DetMon related source files and changes, as part of the preparation of version 5.1 of CPL and as agreed during the DetMon meeting held on the 15th of October. 2009-10-26 11:40 cgarcia * cplcore/cpl_polynomial.c: Fixed a problem with #define's related to Horner evaluation. 2009-10-26 11:02 cgarcia * cplcore/cpl_polynomial.c: Changed _set_coeff to arrange the Horner arrays only if the evaluation method is also Horner. 2009-10-23 17:49 cgarcia * cplcore/cpl_polynomial.c: First implementation of Horner evaluation algorithm. It is disabled by default. 2009-10-23 17:17 lbilbao * cplcore/: cpl_fits.c, tests/cpl_fits-test.c: cpl_fits_find_extension(): return value changed to 0 if extension not found (DFS07813). Unit tests modified accordingly. 2009-10-23 16:45 llundin * cplcore/: cpl_fits.c, tests/cpl_fits-test.c: cpl_fits_find_extension(), cpl_fits_count_extensions(): Proper unit testting, clean-up error handling etc. 2009-10-23 15:40 lbilbao * cplcore/cpl_stats.c: Changes due to DFS07485 rolled back. 2009-10-22 15:30 llundin * cplcore/tests/cpl_imagelist_io-test.c: Use cpl_test_imagelist_abs() on I/O 2009-10-22 15:14 llundin * cplcore/tests/cpl_imagelist_io-test.c: Use cpl_test_zero(), cpl_test_eq(), cpl_test_eq_error(), cpl_test_eq_ptr() 2009-10-22 14:56 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_imagelist_abs(): Added 2009-10-22 14:03 llundin * cplcore/cpl_imagelist_io.c: cpl_imagelist_save(): Clean-up doxygen, error-handling 2009-10-22 14:01 llundin * cplcore/cpl_image_io.c: cpl_image_save(): Improve doxygen 2009-10-22 14:00 llundin * cplcore/cpl_io.h: CPL_IO_CREATE, CPL_IO_EXTEND: Clean-up comments 2009-10-22 12:06 llundin * configure.ac: rm experimental ESO_ENABLE_OPENMP() in preparation for CPL 5.1 release 2009-10-19 09:44 cizzo * cplcore/cpl_type.h: Eliminate comma at last enum entry 2009-10-13 09:47 cizzo * cpldrs/cpl_fit.c: Correct gaussian fit doc 2009-09-23 13:40 llundin * cplcore/cpl_msg.c: Add comment about __STRICT_ANSI__, undo previous commit 2009-09-23 13:22 cizzo * cplcore/cpl_msg.c: Add e precompiler warning in case stream duplication and window resizing are missing 2009-09-22 11:19 llundin * cplcore/cpl_test.c: cpl_test_end(): "the software" replaces "CPL" 2009-09-15 15:05 llundin * cplcore/cpl_image_io.h: #include (needed for FILE*) replaces unneeded #include (bis) 2009-09-15 15:04 llundin * cplcore/cpl_image_io.h: #include (needed for FILE*) replaces unneeded #include 2009-09-15 14:51 llundin * cplcore/: cpl_image_io.c, cpl_image_io.h: cpl_image_*_complex(): Declare only if application includes complex.h (DFS06790) 2009-09-15 14:47 llundin * cplcore/cpl_image_gen.c: #include 2009-09-15 14:08 cizzo * cpldrs/tests/cpl_fit-test.c: Avoid compiler warning about initialising with constant strings a non-constant object in cpl_fit_image_gaussian_test() 2009-09-15 11:29 cizzo * cpldrs/cpl_fit.c: Eliminate two serious bugs about uninitialised variables in cpl_fit_image_gaussian(). 2009-09-15 11:27 cizzo * cpldrs/tests/cpl_fit-test.c: Eliminate few compiler warnings about unused variables 2009-09-15 11:12 cgarcia * cpldrs/cpl_geom_img_body.h: Fixed warning about declarations and code mixed. 2009-09-14 10:44 cizzo * cpldrs/cpl_fit.c: Skip check on finiteness of fitting result of cpl_fit_image_gaussian() 2009-09-11 16:49 cizzo * cplcore/: cpl_image_basic.c, cpl_image_basic.h: Deprecate function cpl_image_fit_gaussian() 2009-09-11 16:49 cizzo * cplcore/cpl_image_iqe.c: Add warning to doc the cpl_image_iqe() 2009-09-11 16:07 cizzo * cpldrs/cpl_fit.h: Fix missing include to cpl_array.h 2009-09-11 16:01 cizzo * cpldrs/tests/cpl_fit-test.c: Add tests for cpl_fit_image_gaussian() 2009-09-11 15:59 cizzo * cpldrs/: cpl_fit.c, cpl_fit.h: Implementation of cpl_fit_image_gaussian() 2009-09-10 13:51 llundin * cplcore/cpl_image_io.c: cpl_image_load_internal(): FIXME comment on filename=NULL 2009-09-10 09:47 llundin * cplcore/: tests/cpl_image_io-test.c, cpl_image_io.c: cpl_image_load(), cpl_image_load_window(): Error propagation. cpl_image_load_internal(): Catch filename==NULL (DFS07571), handle invalid NAXIS 2009-09-09 15:54 cizzo * cplcore/cpl_array.c: Fixs to documentation 2009-09-08 16:24 lbilbao * cplcore/cpl_imagelist_basic_body.h: Warning removed. 2009-09-07 18:37 lbilbao * configure.ac, m4/cpl.m4: CPL_CHECK_COMPLEX (DFS07472) 2009-09-07 18:12 lbilbao * configure.ac, m4/cpl.m4: CPL_CHECK_FFTW added in preparation for the inclusion of FFTW-dependant, new functions cpl_*_fftw(). 2009-09-03 17:34 cgarcia * cpldrs/: cpl_geom_img.c, cpl_geom_img_body.h: Support for bad pixel masks in cpl_geom_img_offset_saa 2009-09-03 17:33 cgarcia * cpldrs/tests/cpl_geom_img-test.c: Added test for _saa with and without masks. 2009-08-28 16:38 lbilbao * configure.ac, cpl.h, m4/cpl.m4: Some additions still related to Detmon code move done now. Added corresponding unit tests, from IRPLIB. Some incompatibilities fixed. 2009-08-28 14:37 lbilbao * Makefile.am, acinclude.m4, configure.ac: DetMon code moved from IRPLIB to CPL. 2009-08-26 13:24 lbilbao * configure.ac: 5.0.3 -> 5.1.0cvs 2009-08-26 13:17 lbilbao * configure.ac: 5.0.3 2009-08-26 12:02 lbilbao * cpldfs/tests/cpl_dfs-test.c: Add unit test for a successful call to cpl_dfs_setup_product_header() with inherit_frame != NULL . 2009-08-26 09:35 cizzo * cpldfs/cpl_dfs.c: Fix bug in checking non-FITS inherit frames in dfs_setup_product_header() 2009-08-20 15:31 lbilbao * cplcore/cpl_stats.c: cpl_stats_new_from_window(): long double -> cpl_long_double in order to enhance portability. 2009-08-19 13:25 lbilbao * cplcore/cpl_stats.c: Workaround for ticket DFS07485. 2009-08-19 11:57 llundin * cpldfs/cpl_dfs.c: Comment typo 2009-08-19 11:56 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_eval_1d_diff(): doxygen typo 2009-08-19 10:56 llundin * cpldrs/cpl_apertures_img.c: cpl_apertures_get_fwhm(): Reduce number of calls to cpl_errorstate_get() 2009-08-18 12:03 cizzo * cplcore/cpl_matrix.c: Keep into account the left-right associativity of the * operator in expressions like n * m * sizeof(): the size_t type is seen last, so n * m would overflow before being upcasted 2009-08-18 12:00 cizzo * cplcore/cpl_column.c: Fix another bug of the same kind as in the previous delta 2009-08-18 11:06 llundin * cplcore/cpl_mask.c: Ensure promotion to size_t for memory sizes (DFS06655) (bis) 2009-08-18 11:01 llundin * cplcore/: cpl_image_filter.c, cpl_mask.c: Ensure promotion to size_t for memory sizes (DFS06655) 2009-08-18 10:13 llundin * cplcore/cpl_vector.c: cpl_vector_wrap(): Complete error handling 2009-08-18 09:58 cizzo * cplcore/cpl_column.c: Change type of private function cpl_column_type_size(), and eliminate now useless castings to size_t 2009-08-18 09:54 cizzo * cplcore/cpl_matrix.c: Eliminate cases where the argument to memset()/memcpy()/malloc()/calloc() etc is not size_t 2009-08-18 09:36 lbilbao * cpldrs/cpl_detector.c: Propagate error from within the internal function cpl_flux_get_window(). 2009-08-17 17:09 lbilbao * cpldrs/cpl_detector.c: DFS07494 2009-08-17 16:56 cizzo * cplcore/cpl_column.c: Eliminate four more locations where the argument to memset()/memcpy() etc is not size_t 2009-08-17 15:48 cizzo * cplcore/cpl_column.c: Eliminate two more locations where the argument to malloc()/calloc() etc is not size_t 2009-08-17 12:02 lbilbao * configure.ac: 5.0.2 -> 5.1.0cvs 2009-08-17 11:49 lbilbao * configure.ac: New options ESO_ENABLE_{OPENMP,PROFILE} removed for patch version CPL 5.0.2 2009-08-17 11:04 llundin * cplcore/cpl_test.c: cpl_test_end(): Ask also for config.log on failure 2009-08-17 10:24 lbilbao * configure.ac: 5.0.2cvs -> 5.0.2 2009-08-14 14:23 llundin * cplcore/cpl_vector.c: cpl_vector_new(), cpl_vector_wrap(): cpl_error_set_message() on error 2009-08-14 14:14 llundin * cplcore/tests/cpl_vector-test.c: cpl_test() replaced with relevant tests 2009-08-14 14:05 llundin * cplcore/tests/cpl_vector-test.c: cpl_test_eq_error() replaces cpl_test() 2009-08-14 13:45 llundin * cplcore/tests/cpl_vector-test.c: test cpl_vector_new(0) 2009-08-12 15:17 llundin * cpldrs/tests/cpl_apertures_img-test.c: cpl_test_eq_error(): Use 2009-08-12 11:17 llundin * cplcore/tests/cpl_errorstate-test.c: cpl_test_eq(), cpl_test_zero() replaces cpl_test() 2009-08-12 11:15 llundin * cplcore/: cpl_error.c, cpl_error.h, cpl_errorstate.c, tests/cpl_error-test.c, tests/cpl_errorstate-test.c: enum _cpl_error_code_, cpl_error_set_message_macro(), cpl_errorstate_find(): Added CPL_ERROR_HISTORY_LOST (DFS05409) 2009-08-11 16:19 llundin * cplcore/: cpl_error.h, cpl_error_impl.h, cpl_errorstate.h, cpl_memory.h, cpl_test.h, cpl_type.h, cpl_version.h.bot: swap gcc attributes pure+const 2009-08-11 16:02 llundin * cplcore/cpl_version.h.bot: cpl_version_get_*(): __attribute__((pure)) 2009-08-11 15:45 llundin * cplcore/cpl_test.h: cpl_test_get_cputime(), cpl_test_get_walltime(): __attribute__((const)) 2009-08-11 15:31 llundin * cplcore/: cpl_error.h, cpl_error_impl.h, cpl_errorstate.h, cpl_type.h: gcc attributes (DFS04697) 2009-08-11 15:02 llundin * cplcore/cpl_memory.h: cpl_memory_is_empty(): __attribute__((const)) 2009-08-11 14:40 llundin * cplcore/cpl_error.c: cpl_error_get_message():Comment out assert() (for const attribute) 2009-08-11 14:36 llundin * cplcore/cpl_errorstate.c: cpl_errorstate_find(): Comment out assert() (for const attribute) 2009-08-11 14:19 llundin * cplcore/cpl_msg.c: cpl_msg_progress(): Avoid recursion, rm dead code, break long line 2009-08-11 14:09 llundin * cplcore/tests/cpl_matrix-test.c: cpl_matrix_product_transpose_bench(): cpl_msg_info() replaces cpl_msg_warning() 2009-08-11 11:04 llundin * cpldrs/cpl_geom_img.c: Internal const correctness 2009-08-11 10:03 llundin * cplcore/cpl_init.c: cpl_get_description(): Simplify for CFITSIO pre-3.03 2009-08-10 14:16 llundin * cpldrs/: cpl_wcs.c, tests/cpl_wcs-test.c: Fix gcc warnings on no WCSLIB. Add @internal on static functions. cpl_wcs_get_*(): NULL input (DFS07446). platesol(): olist == NULL (DFS07447), niter < 1 (DFS07448), output mode check (DFS07449), thresh check (DFS07452) 2009-08-10 12:52 llundin * cplcore/cpl_propertylist.c: cpl_propertylist_dump(): Use cpl_type_get_name() (bis) 2009-08-10 12:51 llundin * cplcore/cpl_propertylist.c: cpl_propertylist_dump(): Use cpl_type_get_name() 2009-08-10 12:50 llundin * cplcore/tests/cpl_propertylist-test.c: Call cpl_propertylist_dump() 2009-08-07 16:56 llundin * cplcore/cpl_imagelist_basic.c: cpl_imagelist_collapse_create(): Reduce image duplication abd bpm usage (DFS07441) 2009-08-07 16:48 llundin * cplcore/cpl_image_basic.c: cpl_image_divide(): Reduce bpm usage (DFS07441) 2009-08-07 11:21 lbilbao * cpldrs/: cpl_detector.c, cpl_detector.h, tests/cpl_detector-test.c: New function cpl_flux_get_bias_window() (FS07129). New internal function cpl_flut_get_window() to be called now from both cpl_flux_get_{bias,noise}_window(), in order to spare some code duplication. 2009-08-07 09:17 llundin * cplcore/cpl_memory.h: CPL_HAVE_GNUC_UNUSED_RESULT 2009-08-06 17:03 llundin * cplcore/cpl_memory.h: Use gcc attributes: warn_unused_result 2009-08-06 16:58 llundin * cplcore/cpl_memory.h: Use gcc attributes: malloc, alloc_size 2009-08-06 16:55 llundin * cplcore/cpl_array.c: cpl_array_extract(): rm two unused vars 2009-08-06 14:18 llundin * cplcore/: cpl_column.c, cpl_column.h, cpl_table.c, cpl_table.h, tests/cpl_table-test.c: const correctness (DFS07434) 2009-08-06 13:20 llundin * cplcore/tests/cpl_property-test.c: cpl_test_noneq_ptr() replaces cpl_test(\041=) 2009-08-06 13:18 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_eq_ptr(), cpl_test_noneq_ptr(): Added 2009-08-06 13:07 llundin * cplcore/cpl_test.h: cpl_assert(): return cpl_test_end(0) 2009-08-05 14:03 llundin * cplcore/cpl_imagelist_io_body.h: CPL_CLASS_BIN: Dropped 2009-08-05 13:55 llundin * libcext/tests/: cxlist-test.c, cxmap-test.c, cxslist-test.c, cxtree-test.c: Conditional compilation of unused function(s) 2009-08-05 13:49 llundin * cplcore/tests/cpl_property-test.c: Use cpl_test module. Conditional compilation of cpl_test_property_dump() 2009-08-05 13:48 llundin * cplcore/tests/cpl_propertylist-test.c, cplui/tests/cpl_recipeconfig-test.c: Drop unused variable 2009-08-05 11:32 llundin * cpldrs/: cpl_wcs.c, cpl_wcs.h, tests/cpl_wcs-test.c: cpl_wcs_platesol(): Const correctness (DFS07427) 2009-08-05 10:54 llundin * cpldrs/cpl_wcs.c: Replace tabs with 4 spaces. endcard, wcslib_errmsgs: Drop static. cpl_wcs_convert(): cpl_error_set_message() replaces cpl_error_set_message_macro(), const dimensions. cpl_wcs_platesol(): Fix uninit warnings, fix memory leak on error, internal const correctness. cpl_wcs_platesol_{4,6}(): const correctness. 2009-08-05 10:10 llundin * cpldrs/tests/cpl_wcs-test.c: cpl_test() replaced with more descriptive tests. Some redundant tests dropped, others added. const replaces static for test arrays 2009-08-04 16:57 llundin * cplcore/: cpl_image_basic_body.h, tests/cpl_image_basic-test.c: cpl_image_collapse_median_create(): Support bad pixel map (DFS07391) 2009-08-04 16:56 llundin * cplcore/cpl_image_basic.c: cpl_image_collapse_median_create(): doxygen typo 2009-08-04 13:58 llundin * cplcore/: cpl_image_basic_body.h, cpl_image_basic.c: cpl_image_collapse_median_create(): Fix doxygen of rejection parms (DFS07405) 2009-08-04 11:26 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: cpl_image_collapse_median_create(): Avoid casting, prep for bpm support, simplify input access, improve doxygen 2009-08-04 11:11 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_collapse_median_test(): Test various drop combinations 2009-08-04 10:42 cizzo * cpldfs/cpl_dfs.c: Implement request by Lander and Pascal: inheritance can be shared between first frame (for mandatory keywords) and inherit frame (for the ESO HIERARCH keywords) 2009-08-04 10:14 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_collapse_median_test(): Verify result on no-drop 2009-08-03 16:47 llundin * cplcore/cpl_image_basic.c: Undo previous 2009-08-03 16:45 llundin * cplcore/: cpl_image_basic.c, tests/cpl_image_basic-test.c: cpl_image_collapse_median_create(): Verify direction (DFS07398) 2009-08-03 16:32 llundin * cplcore/cpl_image_basic.c: cpl_image_collapse_median_create(): Verify direction (DFS07398) 2009-08-03 16:29 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_collapse_median_test(): Added 2009-08-03 15:20 cizzo * cpldrs/cpl_ppm.c: Eliminate wrong error message 2009-07-30 09:11 llundin * cpldrs/: cpl_geom_img.c, tests/cpl_geom_img-test.c: cpl_geom_img_offset_saa(): Handle single image input for CPL_GEOM_FIRST (DFS07378) 2009-07-30 09:00 llundin * cpldrs/tests/cpl_geom_img-test.c: Test cpl_geom_img_offset_saa() with empty imagelist 2009-07-29 17:07 llundin * cpldrs/tests/cpl_geom_img-test.c: cpl_geom_img_offset_saa(): Test with single image 2009-07-29 16:47 llundin * cpldrs/tests/cpl_geom_img-test.c: Extend use of cpl_geom_img_offset_saa_bench() 2009-07-22 16:09 llundin * cpldrs/cpl_apertures.c: cpl_apertures_new_from_image(): CPL_ERROR_TYPE_MISMATCH replaces CPL_ERROR_ILLEGAL_INPUT for non-int label 2009-07-22 16:05 llundin * cpldrs/: cpl_apertures.c, tests/cpl_apertures-test.c: cpl_apertures_new_from_image(): Use also CPL_ERROR_INCOMPATIBLE_INPUT and CPL_ERROR_DATA_NOT_FOUND 2009-07-22 13:14 llundin * NEWS: cpl_polynomial_fit_1d_create(): Deallocate fitsresidual as per KMirny 2009-07-16 12:41 lbilbao * configure.ac, libcext/m4/eso.m4: --enable-profile (DFS04726) 2009-07-13 16:17 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_solve_1d(): Reduce var-scopes 2009-07-13 16:11 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_solve_1d(): Drop random root-theorem, document *px, typos 2009-07-10 11:46 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_solve_1d(): Fix error text (DFS07264) 2009-07-07 14:24 llundin * cplcore/cpl_tools.c: cpl_tools_get_cfitsio_msg(): OpenMP threadprivate 2009-07-07 13:43 llundin * cplcore/cpl_mask.c: cpl_mask_get_data_const(): Avoid cast and calling overhead 2009-07-07 10:01 llundin * cplcore/cpl_mask.c: cpl_mask_get_data_const(): Correct location of error 2009-07-02 16:01 llundin * cplcore/cpl_memory.c: cpl_memory_init(): Disable mode==2 with OpenMP 2009-07-02 16:00 llundin * cplcore/cpl_xmemory.c: Improve documentation (absence of thread-safety). cpl_xmemory_findfree(): Drop redundant casts 2009-07-02 14:32 llundin * cplcore/cpl_xmemory.c: Use size_t instead of unsigned (long). Drop OpenMP threadprivate. Use atomic OpenMP for mode=1. Mode=2 currently not working with OpenMP 2009-07-02 14:15 llundin * cplcore/cpl_error.c: cpl_error_get_where(): cpl_error_where_string OpenMP threadprivate 2009-07-02 13:57 llundin * cplcore/cpl_filter_median.c: dheap_replace(): Make thread-safe 2009-07-02 13:33 llundin * cplcore/cpl_tools.c: cpl_tools_add_flops(): OpenMP atomic 2009-07-02 13:29 llundin * libcext/cext/cxdeque.c: current_compare: Make OpenMP threadprivate 2009-07-02 13:00 llundin * cpldfs/cpl_dfs.h: "ESO Common Pipeline Library" replaces "IIINSTRUMENT Pipeline" in copyright comment 2009-07-02 12:59 llundin * cpl.h: Added GPL license 2009-07-02 08:44 llundin * cplui/tests/cpl_frame-test.c: Do not test on remove() 2009-07-01 14:15 llundin * cplui/tests/cpl_frame-test.c: Reset expected CPL error. Add more tests using cpl_test module. Use correct types for external functions instead of cxtypes 2009-07-01 13:28 llundin * cplui/tests/cpl_frame-test.c: Bug-fix: Call fits_close_file() before testing on the file 2009-06-30 11:11 llundin * cplcore/cpl_msg.c: getTimeISO8601(), strsplit(): Thread-safe (drop OpenMP pragmas) 2009-06-26 16:15 llundin * cplcore/cpl_init.c: cpl_get_description(): OpenMP 2009-06-26 16:15 llundin * cplcore/cpl_test.c: cpl_test_get_description(): OpenMP 2009-06-26 15:28 llundin * cplcore/cpl_msg.c: OpenMP-Privatize the most commonly used static variables 2009-06-25 16:52 llundin * cplcore/: cpl_error.c, cpl_errorstate.c, cpl_memory.c, cpl_xmemory.c: make various static variables threadprivate 2009-06-25 16:51 llundin * configure.ac, libcext/m4/eso.m4: Experimental enabling of OpenMP 2009-06-25 13:23 llundin * cplcore/tests/cpl_imagelist_basic-test.c: cpl_test_eq_error() replaces cpl_test_error(), cpl_test_eq() 2009-06-25 12:43 llundin * cplcore/cpl_test.h: @ingroup added in a number of places (DFS07194) 2009-05-27 15:16 scastro * cpldrs/cpl_wcs.c: replaced _id by cpl_func throughout the file. 2009-05-27 14:19 scastro * cpldrs/cpl_wcs.c: cpl_wcs_convert(): included an explanation on the input and output matrix in the doxygen. DFS06724 2009-05-27 12:01 scastro * cpldrs/tests/cpl_wcs-test.c: included test for NULL input "to" and "status", following fix of DFS06727 2009-05-27 11:46 scastro * cpldrs/cpl_wcs.c: cpl_wcs_convert(): included to and status in the check for NULL input. Updated doxygen with this information. DFS06727 2009-05-20 15:21 lbilbao * cplcore/cpl_imagelist_io.c: Fix ticket 7054. 2009-05-20 15:06 llundin * cplcore/: cpl_test.h, cpl_test.c: Info on pre/during errors+errno. Improve initial/end errno messages 2009-05-20 14:56 llundin * cplcore/tests/cpl_image_io-test.c: Skip cpl_image_add_scalar() for complex pixel types 2009-05-20 14:13 llundin * cplcore/tests/cpl_stats-test.c: CPL_STAT_CMP_IMAGE(): ; replaces , (typo) 2009-05-20 09:57 llundin * cplcore/cpl_test.c: cpl_test_init_macro(), cpl_test_end(): errno msg clean-up 2009-05-19 14:40 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_offset_combine(): offs must be non-NULL (DFS07049) 2009-05-18 13:15 llundin * cplcore/cpl_image_io.c: cpl_image_save(): Ensure file close + improve error msg on failed file create 2009-05-18 12:07 llundin * cplcore/tests/: cpl_image_basic-test.c, cpl_image_filter-test.c: cpl_test_eq_error() replaces cpl_test_error()+cpl_test_eq() 2009-05-18 12:01 llundin * cplcore/tests/cpl_mask-test.c: cpl_test_eq_error() replaces cpl_test_error()+cpl_test_eq() 2009-05-18 11:56 llundin * cplcore/tests/cpl_image_io-test.c: cpl_test_eq_error() replaces cpl_test_error()+cpl_test_eq() 2009-05-12 10:39 llundin * cplui/tests/cpl_frameset_io-test.c: Cast sizeof to unsigned for format string 2009-05-12 10:35 llundin * cplcore/tests/cpl_memory-test.c: Use string literal for format. Use cpl_test_zero(), cpl_test_eq_string() 2009-05-12 10:27 llundin * cplcore/tests/cpl_matrix-test.c: Use string literal for format 2009-05-12 10:25 llundin * cplcore/tests/cpl_msg-test.c: Fix compiler warning 2009-05-12 09:31 llundin * cplcore/cpl_test.c: cpl_test_init_macro(): Use string literal for format 2009-05-11 10:42 llundin * cplcore/cpl_init.c: cpl_init(): Use string-literal with cpl_error_set_message() 2009-05-08 14:57 llundin * cplcore/tests/cpl_polynomial-test.c: Raise tol for valgrind 2009-05-08 14:53 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_test_1d(): Symmetric, non-equidistant 1D sampling 2009-05-08 14:36 llundin * cplcore/tests/cpl_polynomial-test.c: Use cpl_test_eq_error(), cpl_test_eq(), cpl_test_null(), cpl_test_zero() 2009-05-08 14:27 lbilbao * cplcore/tests/cpl_image_filter-test.c: FIXME: Set a higher tolerance to avoid some errors due to rounding errors in CPL_FILTER_STDEV_FAST. 2009-05-07 18:20 llundin * cpldrs/: cpl_apertures.c, tests/cpl_apertures-test.c: cpl_apertures_get_{left,right}_y(), cpl_apertures_get_{top,bottom}_x(): Fix wrong result (DFS06988). Also, improve doxygen 2009-05-06 15:38 lbilbao * configure.ac: 5.0.1 -> 5.0.2cvs 2009-05-06 15:26 lbilbao * configure.ac: 5.0.1cvs -> 5.0.1 2009-05-06 14:33 scastro * cplcore/tests/cpl_propertylist-test.c: fixed comments 2009-05-06 14:32 scastro * cplcore/tests/cpl_propertylist-test.c: Included new tests 27, 28 and 29 2009-05-06 14:31 scastro * cplcore/: cpl_propertylist.h, cpl_propertylist.c: Included new functions cpl_propertylist_append_property, cpl_propertylist_prepend_property, cpl_propertylist_insert_property, cpl_propertylist_insert_after_property. 2009-05-06 14:25 scastro * cplcore/tests/cpl_propertylist-test.c: removed test 29 for new functions 2009-05-06 14:19 scastro * cplcore/: cpl_propertylist.c, cpl_propertylist.h: Removed new functions cpl_propertylist_append_property, cpl_propertylist_prepend_property, cpl_propertylist_insert_property, cpl_propertylist_insert_after_property. 2009-05-06 11:10 scastro * cplcore/tests/cpl_propertylist-test.c: Complemented test 30 with a check on the returned values. 2009-05-06 10:59 scastro * cplcore/cpl_property.c: cpl_property_get_float():fixed return value 2009-05-06 10:56 scastro * cplcore/cpl_property.c: cpl_property_get_double():fixed return value 2009-05-06 08:33 llundin * cplcore/tests/cpl_vector-test.c: cpl_vector_corr_bench(): Added. #define VECTOR_SIZE 256. cpl_test_abs() replaces cpl_test_leq() (mostly) 2009-05-06 08:17 llundin * cplcore/tests/cpl_memory-test.c: do_bench replaces CPL_MEMORY_BENCH 2009-05-06 08:15 llundin * cplcore/cpl_init.c: cpl_get_description(): drop static from char array 2009-05-05 17:12 scastro * cplcore/tests/cpl_propertylist-test.c: new test 30 to check casting in accessor functions of float and double. 2009-05-05 17:11 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_get_double and cpl_propertylist_get_float(): updated documentation regarding casting. 2009-05-05 17:11 scastro * cplcore/cpl_property.c: cpl_property_get_float(): if the property is of type double, it casts it to float and returns it without any error. cpl_property_get_double(): if the property is of type float, it casts it to double and returns it without any error. 2009-05-05 16:09 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_load() and cpl_propertylist_load_regexp(): updated documentation to specifically say that float keywords will always be loaded as double. 2009-05-05 15:32 cizzo * cplcore/cpl_column.c: Fix limit to memory reallocation in cpl_column_set_size() 2009-05-05 13:14 cizzo * cplcore/tests/cpl_image_resample-test.c: Remove forgotten comments 2009-05-05 13:13 cizzo * cplcore/: cpl_image_resample.c, cpl_image_resample_body.h, tests/cpl_image_resample-test.c: Fix problem when x-size is not multiple of the step size in image_rebin() 2009-05-05 11:43 llundin * cplcore/cpl_matrix.c: cpl_matrix_decomp_chol(): Fix doxygen typo 2009-05-04 13:25 llundin * cplcore/cpl_image_iqe.c: iqefit(): Leak-on-error fixed (DFS06953) 2009-04-29 16:50 lbilbao * cplcore/: cpl_image_gen.c, cpl_image_gen_body.h, cpl_type.h, tests/cpl_imagelist_basic-test.c, cpl_image_basic_body.h: cpl_image_fill_noise_uniform(), cpl_image{add, subtract, multiply}(): extended support for COMPLEX pixel types. (DFS06088) New, massive unit tests added to cpl_imagelist_basic module. 2009-04-29 11:46 lbilbao * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic.h, cpl_imagelist_basic_body.h, tests/cpl_imagelist_basic-test.c: Changes required by DFS05505 implemented. 2009-04-28 10:29 scastro * cplcore/tests/cpl_propertylist-test.c: Test 29 for cpl_propertylist_insert_after_property() 2009-04-28 10:28 scastro * cplcore/: cpl_propertylist.c, cpl_propertylist.h: New function cpl_propertylist_insert_after_property(): complement to DFS06522 2009-04-27 18:01 scastro * cplcore/tests/cpl_propertylist-test.c: New test 29 for cpl_propertylist_insert_property() 2009-04-27 18:01 scastro * cplcore/: cpl_propertylist.c, cpl_propertylist.h: New function cpl_propertylist_insert_property(): complement to DFS06522 2009-04-27 16:36 scastro * cplcore/tests/cpl_propertylist-test.c: New test 28 for cpl_propertylist_prepend_property() 2009-04-27 16:36 scastro * cplcore/: cpl_propertylist.c, cpl_propertylist.h: New function cpl_propertylist_prepend_property(): complement to DFS06522 2009-04-27 16:20 scastro * cplcore/tests/cpl_propertylist-test.c: New test 27 for cpl_propertylist_append_property() 2009-04-27 16:09 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_append_property():doxygen 2009-04-27 16:05 scastro * cplcore/: cpl_propertylist.c, cpl_propertylist.h: New function cpl_propertylist_append_property(): DFS06522 2009-04-27 15:05 lbilbao * cplcore/: cpl_filter.h, cpl_image_filter.c, cpl_image_filter_body.h, tests/cpl_image_filter-test.c: cpl_image_filter_mask(): new mode CPL_FILTER_STDEV_FAST. (DFS06411) 2009-04-27 14:55 scastro * cplui/cpl_frame.c: cpl_frame_get_nextensions(): wraps around cpl_fits_count_extensions(). DFS06546 2009-04-27 13:58 llundin * cplcore/: cpl_image_filter_body.h, tests/cpl_image_filter-test.c: cpl_image_filter(): Correct result for CPL_FILTER_STDEV (DFS06942) 2009-03-30 16:01 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: cpl_image_flip(): Avoid duplication for angle 0+2, reduce variable scope 2009-03-30 15:57 llundin * cplcore/tests/cpl_matrix-test.c: cpl_matrix_product_transpose_bench(): Added 2009-03-30 15:21 llundin * cplcore/tests/cpl_mask-test.c: More tests of cpl_mask_collapse_create() 2009-03-30 15:21 llundin * cplcore/cpl_mask.c: cpl_mask_collapse_create(): typo 2009-03-30 15:14 llundin * cplcore/cpl_mask.c: cpl_mask_collapse_create(): donext+ifirst+ilast for idir==0 2009-03-30 11:31 llundin * cplcore/cpl_errorstate.c: size_t replaces unsigned in internal usage 2009-03-30 11:07 llundin * acinclude.m4: CPL_CONFIG_VERSION: Extend with CPL_VERSION_STRING 2009-03-27 12:19 llundin * cplcore/cpl_memory.c: Reduced use of non-staatic variables 2009-03-27 11:18 llundin * cplcore/cpl_mask.c: cpl_mask_extract(): Use memcpy(), simplify input check. cpl_mask_threshold_image_create(): Avoid redundant writes, reduce var scope, CPL_ERROR_UNSUPPORTED_MODE 2009-03-27 11:15 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_extract(): A bit of extra testing 2009-03-27 10:26 llundin * cplcore/cpl_mask.c: cpl_mask_collapse_create(): unit stride also for idir = 0 (Speed up about 40 for 4k by 4k) 2009-03-27 09:32 llundin * cplcore/cpl_mask.c: cpl_mask_collapse_create(): for-loop replaces do-while, improve comments 2009-03-27 08:20 llundin * cplcore/cpl_mask.c: cpl_mask_collapse_create(): Use memchr() for dir==1 2009-03-27 08:19 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_test(): Do actual tests of cpl_mask_collapse_create() 2009-03-26 17:07 llundin * cplcore/cpl_mask.c: cpl_mask_flip(): Avoid mask duplication for angle 0 + 2 2009-03-26 16:59 llundin * cplcore/cpl_mask.c: cpl_mask_{and,or,xor,not}(): Operate on whole words (DFS03635) 2009-03-26 16:58 llundin * configure.ac: AC_CHECK_SIZEOF(size_t) (to detect 64 bit systems at compile time) 2009-03-26 16:49 llundin * cplcore/cpl_test.c: cpl_test_eq_mask_macro(): Use memcmp() (bis) 2009-03-26 15:55 llundin * cplcore/tests/cpl_mask-test.c: Removed redundant tests of cpl_mask_flip() 2009-03-26 15:52 llundin * cplcore/: cpl_mask.c, cpl_mask.h, tests/cpl_mask-test.c: cpl_mask_dump_window(): Added 2009-03-26 15:42 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_test(): Added with tests of several functions 2009-03-26 15:32 llundin * cplcore/cpl_test.c: cpl_test_eq_mask_macro(): Use memcmp() 2009-03-26 15:01 llundin * cplcore/cpl_test.h: cpl_test(), cpl_test_zero(): Avoid cast to int 2009-03-26 14:10 llundin * configure.ac, cplcore/cpl_test.c: sys/time.h (for gettimeofday()) 2009-03-26 14:05 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_get_walltime(): Added 2009-03-25 14:01 llundin * libcext/cext/: cxmemory.c, cxmemory.h: cx_memory_vtable_set(): const correctness 2009-03-24 17:21 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_turn_flip_test(): replaces cpl_image_turn_test() w. test also of cpl_image_flip() + bad pixels. cpl_image_get_diff(): Dropped, use cpl_test_image_abs() instead. Use different cpl_test macros 2009-03-24 16:54 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_eq_error(): Added w. uni test 2009-03-24 13:21 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_flip(): Compare after rotating 2009-03-23 17:54 llundin * cplcore/cpl_memory.c: Add CPL version to cx_log() (useful for debugging f.ex. DFS04315) 2009-03-23 17:48 llundin * cpljava/cpl_gasgano.c: makeJNIRecipe(): Redeclare to take const cpl_recipe *. makePluginLibrary(): Fix memory leak (pluginlist), reduce scope for various variables, add some const modifiers, avoid two malloc()s 2009-03-23 17:31 llundin * cplui/cpl_recipedefine.c: cpl_recipedefine_init(): Improve version mismatch messages 2009-03-23 13:42 llundin * cpljava/cpl_gasgano.c: undo previous commit (does not help) 2009-03-23 13:41 llundin * cpljava/cpl_gasgano.c: Try to catch SIGSEGV 2009-03-23 09:01 llundin * cpljava/cpl_gasgano.c: makePluginLibrary(): Detect run-time change of CPL version (DFS04315). Also catch NULL return from lt_dlsym() 2009-03-18 10:39 llundin * configure.ac: -> 5.0.1cvs 2009-03-18 10:30 llundin * configure.ac: cpl-5_0_0 2009-03-17 13:14 llundin * cplcore/: cpl_image_io.h, cpl_image_io.c: cpl_image_*_complex(): Do not declare with gcc -ansi -pedantic (DFS06790) 2009-03-17 09:27 llundin * cplcore/cpl_image_bpm.c: Improve doxygen: In the bad pixel map CPL_BINARY_1 is used for bad pixels and CPL_BINARY_0 for good ones 2009-03-12 11:13 llundin * configure.ac: -> 5.0.0cvs 2009-03-12 11:09 llundin * configure.ac: -> 5.0.0b4 2009-03-12 11:07 llundin * README: update version numbers: CPL, cfitsio, JDK, gasgano 2009-03-11 17:09 llundin * cpldrs/: cpl_geom_img_body.h, tests/cpl_geom_img-test.c: cpl_geom_img_offset_saa_all_*(): Fix resampling noise on edge with zero shift (DFS05360 - 2) 2009-03-10 14:16 llundin * cplcore/cpl_image_iqe.c: cpl_image_iqe(): doxygen drop "The code should not be changed" 2009-03-04 14:50 lbilbao * configure.ac: -> 5.0.0cvs 2009-03-04 14:40 lbilbao * configure.ac: -> 5.0.0b3 2009-03-04 14:37 lbilbao * cplcore/: cpl_image_io.c, cpl_imagelist_io.c, cpl_vector.c: Change mode-checking in saving functions to use the new bitwise CPL_IO_{CREATE, EXTEND}. 2009-03-04 12:13 lbilbao * NEWS: Information about the new complex types added. 2009-03-04 11:45 lbilbao * cplcore/: Makefile.am, cpl_image_io.c, cpl_image_io.h, cpl_image_io_impl.h, tests/cpl_image_io-test.c: Functions related to complex-types, of unstable API yet, made internal. 2009-03-03 18:43 llundin * cplcore/: cpl_image_io.c, cpl_image_io_body.h, tests/cpl_image_io-test.c: cpl_image_wrap(): Added static, use size_t to compute allocation sizes. cpl_image_new(), cpl_image_wrap_*(): Call cpl_image_wrap() 2009-03-02 09:54 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_mask(): Doxygen examples of mask creation 2009-02-18 16:47 llundin * cplcore/cpl_image_stats.c: cpl_image_get_{min,max}pos{,_window}(): Fix return on window-fail (DFS06646) 2009-02-18 11:07 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_save(): removed unreachable code 2009-02-16 17:56 lbilbao * configure.ac: cpl-5.0.0b2 -> cpl-5.0.0cvs 2009-02-16 17:45 lbilbao * configure.ac: 5.0.0b2 2009-02-16 12:12 llundin * NEWS: New functions in CPL 2009-02-16 12:09 llundin * NEWS: How to change the calls to functions with new prototypes 2009-02-16 11:52 llundin * NEWS: How to replace deprecated functions 2009-02-16 11:33 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit(): Fix doxygen typos 2009-02-16 11:19 scastro * cplcore/cpl_polynomial.c: cpl_polynomial_fit_1d_create and cpl_polynomial_fit_2d_create: marked doxygen as @internal and deprecated. 2009-02-16 11:04 scastro * cplcore/cpl_msg.c: cpl_msg_progress(): Marked doxygen as @internal and deprecated. 2009-02-16 10:59 scastro * cplcore/cpl_image_filter.c: cpl_image_filter_linear, cpl_image_filter_morpho, cpl_image_filter_median, cpl_image_filter_stdev: Changed doxygen of these functions to @internal and marked them as deprecated. 2009-02-16 10:17 scastro * cplcore/cpl_fits.c: cpl_fits_get_nb_extensions() and cpl_fits_get_extension_nb(): made doxygen internal to these two deprecated functions. 2009-02-16 09:41 llundin * NEWS: Slight rewrite with ./configure 2009-02-16 04:20 lbilbao * configure.ac: cpl5.0.0b1 -> cpl5.0.0cvs 2009-02-16 04:01 lbilbao * configure.ac: cpl5.0.0a -> cpl5.0.0b1 2009-02-13 16:32 llundin * NEWS: List with deprecated functions and API changes - needs update-how-to 2009-02-12 14:41 llundin * cplcore/cpl_test.c: cpl_test_dump_status(): Active only with -DCPL_TEST_DUMP_STATUS 2009-02-11 17:50 llundin * cplcore/cpl_filter_median.c: filter_median(): memcpy() used for rx=ry=0 case (i.e. no support for different input- and output-pixel types 2009-02-11 17:35 llundin * cplcore/cpl_filter_median.c: filter_median(): Avoid overflow in CPL_BORDER_CROP pointer arithmetic (DFS06582), remove dead-code (for different input- and output pixel-types) 2009-02-11 14:40 scastro * cplcore/cpl_bivector.c: cpl_bivector_delete(): updated documentation about NULL input. 2009-02-11 14:40 scastro * cplcore/cpl_imagelist_io.c: cpl_imagelist_delete(): updated documentation about NULL input. 2009-02-11 14:40 scastro * cplcore/cpl_mask.c: cpl_mark_delete(): updated documentation about NULL input. 2009-02-11 14:39 scastro * cplcore/cpl_polynomial.c: cpl_polynomial_delete(): updated documentation about NULL input. 2009-02-11 14:39 scastro * cplcore/cpl_property.c: cpl_property_delete(): updated documentation about NULL input. 2009-02-11 14:38 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_delete(): updated documentation about NULL input. 2009-02-11 14:38 scastro * cplcore/cpl_stats.c: cpl_stats_delete(): updated documentation about NULL input. 2009-02-11 14:38 scastro * cplcore/cpl_vector.c: cpl_vector_delete(): updated documentation about NULL input. 2009-02-11 14:37 scastro * cplcore/cpl_xmemory.c: cpl_xmemory_free(): updated documentation about NULL input. 2009-02-11 14:37 scastro * cplui/cpl_frame.c: cpl_frame_delete(): updated documentation about NULL input. 2009-02-11 14:36 scastro * cplui/cpl_framedata.c: cpl_framedata_delete() and cpl_framedata_clear(): updated documentation about NULL input. 2009-02-11 14:35 scastro * cplui/cpl_frameset.c: cpl_frameset_delete(): updated documentation about NULL input. 2009-02-11 14:34 scastro * cplui/cpl_parameter.c: cpl_parameter_delete(): updated documentation about NULL input. 2009-02-11 14:34 scastro * cplui/cpl_parameterlist.c: cpl_parameterlist_delete(): updated documentation about NULL input. 2009-02-11 14:34 scastro * cplui/cpl_plugin.c: cpl_plugin_delete(): updated documentation about NULL input. 2009-02-11 14:33 scastro * cplui/cpl_pluginlist.c: cpl_pluginlist_delete(): updated documentation about NULL input. 2009-02-11 14:33 scastro * cplui/cpl_recipeconfig.c: cpl_recipeconfig_delete(): updated documentation about NULL input. 2009-02-11 14:32 scastro * cpldrs/cpl_apertures.c: cpl_apertures_delete(): updated documentation about NULL input. 2009-02-11 14:31 scastro * cpldrs/cpl_wcs.c: cpl_wcs_delete(): updated documentation about NULL input. 2009-02-11 14:05 llundin * libcext/cext/: Makefile.am, cxtypes.h.bot, cxtypes.h.top: Disable automatic creation of cext/cxtypes.h (DFS06591) 2009-02-11 13:48 llundin * libcext/tests/: Makefile.am, cxtypes-test.c: Added cxtypes unit test (with sizeof test) 2009-02-11 13:29 llundin * libcext/configure.ac: Disable automatic creation of cext/cxtypes.h (DFS06591) 2009-02-11 13:27 llundin * libcext/cext/cxtypes.h: #if for 64 bit 2009-02-11 13:27 llundin * libcext/cext/cxtypes.h: As created on i386 GNU/Linux and Mac Mini powerpc 2009-02-11 13:24 scastro * cplui/cpl_frame.c: cpl_frame_delete(): updated documentation about NULL input frame. 2009-02-11 13:10 scastro * cplui/: cpl_frame.h, cpl_frameset.h: Included missing 2009-02-11 11:49 llundin * cplcore/tests/cpl_memory-test.c: cpl_free(NULL) 2009-02-10 19:23 cizzo * cplcore/: cpl_array.c, cpl_array.h: Add const modifier where required in lately added functions 2009-02-10 14:45 llundin * cpldfs/cpl_dfs.c: cpl_dfs_find_md5sum(): Use fits_get_hduaddrll() when available, else fits_get_hduoff() 2009-02-10 14:43 llundin * cplcore/cpl_test.c: cpl_test_get_description(): #ifdef OFF_T 2009-02-10 14:00 llundin * cplcore/cpl_mask.c: cpl_mask_extract_subsample(): Drop unused variable, pos 2009-02-10 13:18 llundin * m4/cpl.m4: CPL_CHECK_CFITSIO: Check in lib64, lib32 and lib (DFS06590) 2009-02-09 15:31 llundin * cplcore/cpl_filter.h: cpl_image_filter: doxygen elaborate on border pixels 2009-02-09 12:16 llundin * cplcore/cpl_filter.h: cpl_image_filter: Doxygen definition of border pixels 2009-02-09 11:41 llundin * cpljava/cpl_gasgano.c: GASGANO_HAS_NO_CPL_EXCEPTION_HANDLER replaces GASGANO_HAS_CPL_EXCEPTION_HANDLER 2009-02-06 16:53 llundin * cplcore/cpl_polynomial.c: cpl_vector_fill_polynomial_fit_residual(): doxygen typos 2009-02-06 16:50 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit(), cpl_vector_fill_polynomial_fit_residual(): Improve doxygen 2009-02-04 10:02 jvinther * .cvsignore, .settings/.cvsignore: added .cvsignore file 2009-02-04 09:53 jvinther * libcext/.cvsignore, libltdl/.cvsignore, cpljava/.cvsignore: added .cvsignore file 2009-02-03 15:42 lbilbao * configure.ac: cpl-5.0.0a -> cpl-5.0.0cvs 2009-02-03 15:28 lbilbao * cplcore/cpl_array.c: Rename new {max, min}pos functions fors arrays properly. 2009-02-03 15:18 lbilbao * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic.h, tests/cpl_imagelist_basic-test.c: cpl_imagelist_collapse_sigclip_create(): API change needed for further implementation of ticket DFS05505. 2009-02-03 14:29 lbilbao * cplcore/tests/cpl_vector-test.c: Disable unit test until code is fixed (cpl_vector_fit_gaussian()). 2009-02-03 11:36 lbilbao * configure.ac: 5.0.0a 2009-01-28 17:10 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_offset_saa(): Fix ppos_x/ppos_y typo 2009-01-28 17:02 llundin * cpldfs/: cpl_dfs.c, cpl_dfs.h, tests/cpl_dfs-test.c: cpl_dfs_save_{image,table,imagelist,propertylist}(): Add header+inherit parameters 2009-01-28 16:39 scastro * cplcore/tests/cpl_propertylist-test.c: replaced cx_assert() by cpl_test functions. 2009-01-28 16:11 llundin * cpldfs/: cpl_dfs.c, cpl_dfs.h, tests/cpl_dfs-test.c: cpl_dfs_save_{image,table,imagelist,propertylist}(): Drop procat parameter, applist now mandatory 2009-01-28 15:52 llundin * cpldfs/cpl_dfs.c: cpl_dfs_product_save(): Add inherit-frame 2009-01-28 15:31 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_setup_product_header(): Added two tests related to the inherit frame 2009-01-28 13:09 scastro * cplui/cpl_parameter.c: _cpl_parameter_init(): replaced CPL_ERROR_TYPE_MISMATCH with CPL_ERROR_INVALID_TYPE as for DFS05614. 2009-01-26 16:26 cizzo * cpldfs/tests/cpl_dfs-test.c: Upgrade existing tests to match API change of cpl_dfs_setup_priduct_header() 2009-01-26 16:25 cizzo * cpldfs/: cpl_dfs.c, cpl_dfs.h: API change to cpl_dfs_setup_product_header(): the reference frame can be specified at the last parameter 2009-01-26 10:34 llundin * cplcore/cpl_image_resample.c: cpl_image_rebin(): #define CPL_IMAGE_REBIN for _body 2009-01-22 14:05 lbilbao * configure.ac: Close to 5.0 - 4.5.1cvs -> 4.9.9 2009-01-21 15:07 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, cpl_vector.c, tests/cpl_polynomial-test.c: cpl_polynomial_shift_1d(): Dimension parameter added (DFS05731) 2009-01-20 11:14 llundin * cpldrs/: cpl_geom_img.c, cpl_geom_img.h, tests/cpl_geom_img-test.c: cpl_geom_img_offset_saa(): Append two optional output parameters (DFS05123) 2009-01-14 09:25 llundin * cplcore/tests/cpl_image_bpm-test.c: main(): Fix const issue 2009-01-14 09:23 llundin * cplcore/tests/cpl_vector-test.c: main(): fclose(stream) 2009-01-12 13:37 cizzo * cplcore/cpl_column.c: cpl_column_save_type(): check column array type, not only save array type 2009-01-09 13:58 llundin * cplcore/tests/cpl_image_bpm-test.c: main(): More tests of cpl_image_get_bpm_const(), cpl_image_get_bpm() 2009-01-09 11:36 llundin * cplcore/tests/cpl_image_bpm-test.c: main(): Test cpl_image_get_bpm_const() 2009-01-09 11:36 llundin * cplcore/cpl_test.h: cpl_test_leq(), cpl_assert(): Improve doxygen 2009-01-09 10:47 llundin * cplcore/tests/cpl_imagelist_io-test.c: main(): fclose(stream) 2009-01-08 16:59 llundin * cplcore/cpl_image_io.c: cpl_image_get_bpm_const(): Return NULL when no bpm is allocated 2009-01-07 13:38 cizzo * cplcore/cpl_table.c: Ignore TDIM keyword when loading string columns 2009-01-05 16:13 cizzo * cplcore/cpl_table.c: Fix unallocated array in loading columns of arrays of strings 2008-12-24 13:10 cizzo * cplcore/: cpl_table.c, cpl_table.h: Add new function cpl_table_where_selected() 2008-12-24 13:09 cizzo * cplcore/tests/cpl_table-test.c: Add test cases for cpl_table_where_selected() 2008-12-24 11:35 cizzo * cplcore/: cpl_array.c, cpl_array.h: Add new functions: cpl_array_get_max(), cpl_array_get_min(), cpl_array_get_maxpos(), cpl_array_get_minpos() 2008-12-23 16:54 cizzo * cplcore/: cpl_array.c, cpl_array.h: Add new functions: cpl_array_get_mean(), cpl_array_get_median(), cpl_array_get_stdev() 2008-12-23 16:15 cizzo * cplcore/: cpl_array.c, cpl_array.h: Add new functions: cpl_array_extract(), cpl_array_insert_window(), cpl_array_erase_window(), cpl_array_insert(), cpl_array_add(), cpl_array_subtract(), cpl_array_multiply(), cpl_array_divide(), cpl_array_add_scalar(), cpl_array_subtract_scalar(), cpl_array_multiply_scalar(), cpl_array_divide_scalar() 2008-12-22 16:54 cizzo * cplcore/: cpl_array.c, cpl_array.h: Add function cpl_array_set_size(), fix correct error handling, simplify code 2008-12-22 15:02 cizzo * cplcore/: cpl_image_resample.c, cpl_image_resample_body.h: cpl_image_rebin(): fix wrong memory access in case of incomplete bins 2008-12-22 14:30 cizzo * cplcore/cpl_image_resample.c: Add extra check in cpl_image_rebin() and upgrade doc accordingly 2008-12-22 10:16 llundin * cplcore/tests/cpl_filter_body.h: image_filter_average_bf_*(): Correct assertion on supported border mode 2008-12-19 14:48 cizzo * cplcore/tests/cpl_image_resample-test.c: Add new tests for function cpl_image_rebin() 2008-12-19 14:48 cizzo * cplcore/: cpl_image_resample.c, cpl_image_resample.h, cpl_image_resample_body.h: Add new function cpl_image_rebin() 2008-12-19 14:30 llundin * cplcore/cpl_image_filter.c: Move /**@{*/ up 2008-12-19 14:14 llundin * cplcore/cpl_filter.h: cpl_filter_mode, cpl_border_mode: doxygen 2008-12-19 14:13 llundin * cplcore/cpl_image_filter.c: Fixed /**@{*/ 2008-12-19 13:56 llundin * cplcore/cpl_filter.h: cpl_border_mode, cpl_filter_mode: Updated doxygen 2008-12-19 13:55 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: ADDTYPE(), ADDTYPE_TWO(): Moved to cplcore/cpl_image_filter.c 2008-12-19 13:42 llundin * cplcore/cpl_filter_median.c: @internal added to doxygen 2008-12-19 10:56 cizzo * cplcore/cpl_image_resample.c: Generalisation of cpl_image_extract_subsample() (DFS05473) 2008-12-19 10:54 cizzo * cplcore/cpl_mask.c: Fix bug in previous delta 2008-12-19 10:53 cizzo * cplcore/cpl_mask.c: Generalisation of cpl_mask_extract_subsample() (DFS05473) 2008-12-18 17:43 cizzo * cplcore/tests/cpl_image_resample-test.c: Add unit tests for cpl_image_extract_subsample() 2008-12-18 17:42 cizzo * cplcore/: cpl_image_resample.c, cpl_image_resample_body.h: cpl_image_extract_subsample(): Draft of function generalisation. Still needs cpl_mask_extract_subsample() upgrade 2008-12-16 11:21 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter.h, cpl_image_filter_body.h, tests/cpl_image_filter-test.c: cpl_image_filter_linear(), cpl_image_filter_morpho(): Deprecate 2008-12-16 10:38 llundin * cplcore/cpl_bivector.c: cpl_bivector_interpolate_linear(): Fix var-shadow warning 2008-12-16 10:32 cizzo * cplcore/cpl_table.c: Eliminate calls to cx_print() in cpl_table_save() and _load(), extend error message with CFITSIO message instead 2008-12-16 10:17 llundin * cplcore/: cpl_test.c, tests/cpl_filter-test.c: Undo previous commit 2008-12-16 10:16 llundin * cplcore/cpl_polynomial.c: Undo previous edit 2008-12-16 10:14 llundin * cplcore/: cpl_image_filter_body.h, cpl_polynomial.c, cpl_test.c, tests/cpl_filter-test.c, tests/cpl_image_filter-test.c: cpl_filter_morpho_slow_*(): Fix index bug - cast explicitly 2008-12-15 15:45 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_mask(): Comment on the orginal codes optimazation strategy 2008-12-15 15:13 cizzo * cpldrs/tests/cpl_detector-test.c: Fix unit test against newly returned error status of cpl_detector_interpolate_rejected() 2008-12-15 15:02 cizzo * cplcore/cpl_table.c: Fix doc of cpl_table_set_column_depth() 2008-12-15 15:02 cizzo * cplcore/cpl_column.c: In cpl_column_get_dimensions() swap returned errors CPL_ERROR_TYPE_MISMATCH and CPL_ERROR_ILLEGAL_INPUT, and correct doc accordingly. Fix also doc of cpl_column_set_depth() 2008-12-15 11:07 lbilbao * cplcore/cpl_column.c: Machine-dependent cpl_table-test failure due to ambigous operator priority solved. 2008-12-15 10:19 lbilbao * cplcore/cpl_image_basic.c: Re-introduce code removed by error. 2008-12-15 09:54 lbilbao * cplcore/cpl_image_basic.c, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_gen.c, cplcore/cpl_image_io.c, cplcore/cpl_image_iqe.c, cplcore/cpl_image_resample.c, cplcore/cpl_image_stats.c, cplcore/cpl_imagelist_basic.c, cplcore/cpl_imagelist_io.c, cplcore/tests/cpl_image_iqe-test.c, cpldrs/cpl_detector.c, cpldrs/cpl_geom_img.c: CPL_ERROR_TYPE_MISMATCH replaced with CPL_ERROR_INVALID_TYPE where necessary. (DFS05614). cpl_image_load(): documentation extended to reflect new type CPL_TYPE_UNSPECIFIED. Bug in cpl_image_basic_body.h fixed. 2008-12-12 16:37 cizzo * cplcore/cpl_column.c: Replace more efficient computation of the standard deviation (DFS05126) 2008-12-12 16:36 cizzo * cplcore/tests/cpl_table-test.c: Add test cases for computing the standard deviation in columns with no invalid elements 2008-12-12 14:11 lbilbao * cplcore/cpl_image_basic.c: cpl_image_average_create(): check on input images' sizes added. (DFS06392) 2008-12-11 16:44 lbilbao * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: Complex types supported for cpl_image_{divide, divide_create, extract}(). (DFS06088) 2008-12-11 16:23 llundin * cplcore/: cpl_filter_median_double.c, cpl_filter_median_float.c, cpl_filter_median_impl.h, cpl_filter_median_int.c, cpl_image_filter.c, cpl_image_filter_body.h: cpl_image_filter_mask(): Use function pointers. Unify API of internal filtering functions 2008-12-11 14:57 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: cpl_image_filter(): Reduce code duplication with function pointer 2008-12-11 14:45 lbilbao * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h: New complex-related functions cpl_image_{mod, phase, set_complex}() (DFS06088) 2008-12-11 14:44 llundin * cplcore/cpl_tools_body.h: double/float/int function definitions moved to cpl_tools_body.h (bis) 2008-12-11 14:33 llundin * cplcore/: cpl_filter.h, cpl_image_filter.c, cpl_image_filter_body.h: cpl_image_filter(): CPL_FILTER_MORPHO added 2008-12-11 14:31 llundin * cplcore/tests/cpl_image_filter-test.c: cpl_image_filter_test(): Added consistency test of tests... 2008-12-11 14:29 llundin * cplcore/: cpl_tools.c, cpl_tools.h, cpl_tools_body.h: cpl_tools_sort_float(): Added. double/float/int function definitions moved to cpl_tools_body.h 2008-12-11 14:04 lbilbao * cplcore/: cpl_fits.c, tests/cpl_fits-test.c: cpl_fits_find_extension(): API change (error return). (DFS05661) 2008-12-11 13:10 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: cpl_image_filter(): Avoid cpl_matrix_flip(), improve doxygen. cpl_image_filter_mask(): Improve doxygen 2008-12-11 10:41 llundin * cplcore/: cpl_image_filter.c, tests/cpl_image_filter-test.c: cpl_image_filter(): Use cpl_matrix_flip() to handle non-symm kernels 2008-12-10 16:51 llundin * cplcore/: cpl_filter.h, cpl_image_filter.c, cpl_image_filter_body.h, tests/cpl_image_filter-test.c: cpl_image_filter(), CPL_FILTER_LINEAR: Draft 2008-12-10 15:14 llundin * cpldrs/: cpl_apertures.c, cpl_apertures.h, tests/cpl_apertures-test.c: cpl_apertures_new(): static 2008-12-10 14:19 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_mask(), cpl_mask_new_from_matrix(): Update doxygen 2008-12-10 08:46 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_mask(): The mask must have an odd number of rows and an odd number of columns 2008-12-09 17:45 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter.h, cpl_image_filter_body.h, tests/cpl_image_filter-test.c: cpl_image_filter_stdev(), cpl_image_filter_median(): Deprecate 2008-12-09 17:34 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_offset_fine(): cpl_image_filter_mask() replaces cpl_image_filter_median() 2008-12-09 13:51 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: cpl_filter_average: doxygen, cpl_filter_median_slow replaces cpl_filter_median 2008-12-09 13:33 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: cpl_image_filter_mask(): pixel-type functions declared with _body.h 2008-12-08 15:57 llundin * cplcore/: tests/cpl_image_filter-test.c, cpl_image_filter.c: cpl_image_filter_mask(CPL_FILTER_STDEV): Handling of 1-element mask 2008-12-08 15:23 llundin * cplcore/cpl_mask.c: cpl_mask_count_window(): Stylistic change (and use previously unused variable, to reduce instruction count) 2008-12-08 15:20 llundin * cplcore/tests/cpl_image_filter-test.c: cpl_image_filter_mask_test(): Fix sign in shift-test 2008-12-08 14:37 llundin * cplcore/cpl_image_filter_body.h: cpl_filter_average_*(): Nx -> nx, Ny -> ny. cpl_filter_average_bpm_*(): Drop guard on pbpm == NULL 2008-12-08 14:24 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_mask(): Initially, clear bpm of self 2008-12-02 15:58 llundin * cplcore/tests/cpl_image_filter-test.c: revert previous edit 2008-12-02 15:57 llundin * cplcore/tests/: cpl_image_filter-test.c: cpl_image_filter_mask_test(): Extend with shift test (draft) 2008-12-02 15:03 llundin * cplcore/cpl_tools.c: cpl_tools_shift_window(): Check nx,ny,size > 0, use myshift function pointer, improve pointer names 2008-12-02 15:02 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_shift_test(): Test 1,1-mask 2008-12-02 14:48 llundin * cplcore/: cpl_image_basic_body.h, cpl_image_basic.c: cpl_image_shift(): Use cpl_tools_shift_window() (DFS06340) 2008-12-02 14:39 llundin * cplcore/tests/cpl_image_resample-test.c: cpl_image_warp_polynomial_test_turn(), cpl_image_warp_polynomial_test_shift(): Test also with bad pixels 2008-12-02 14:24 llundin * cplcore/tests/cpl_image_resample-test.c: check_kernel(): Loop over kernels that preserve the pixel-values 2008-12-02 14:02 llundin * cplcore/tests/cpl_image_resample-test.c: cpl_image_warp_polynomial_test_shift(), cpl_image_warp_polynomial_test_turn(): Added 2008-12-02 11:02 llundin * cplcore/tests/cpl_image_resample-test.c: check_id_kernel(): Use also on float+int images 2008-12-01 16:57 llundin * cplcore/cpl_mask.c: cpl_mask_shift(): Use cpl_tools_shift_window() 2008-12-01 16:56 llundin * cplcore/: cpl_tools.c, cpl_tools.h: cpl_tools_shift_window(): Added 2008-12-01 16:33 llundin * cplcore/cpl_test.c: cpl_test_image_abs_macro(): All pixels are bad in the first or second image, propagate error 2008-12-01 15:30 llundin * cplcore/: cpl_mask.c, tests/cpl_mask-test.c: cpl_mask_shift(): Use memmove/memcpy(), unit test against old, brute-force 2008-12-01 14:18 llundin * cplcore/cpl_test.c: cpl_test_eq_mask_macro(): Count number of different values 2008-12-01 10:06 lbilbao * cplcore/cpl_type.c: cpl_type_get_name(): Combination of complex types with pointer type added. 2008-12-01 09:21 llundin * cplcore/tests/cpl_type-test.c: Add test for CPL_TRUE/FALSE, add info on type name test 2008-11-28 18:22 llundin * cplcore/tests/cpl_image_filter-test.c: cpl_image_filter_mask_test(): Increase tol for CPL_FILTER_AVERAGE_FAST 2008-11-28 17:20 llundin * cplcore/tests/cpl_image_filter-test.c: cpl_image_filter_mask_test(): Fix tol on CPL_FILTER_AVERAGE_FAST 2008-11-28 17:02 lbilbao * cplcore/: cpl_image_io.c, cpl_imagelist_io.c, cpl_vector.c: cpl_{vector, image, imagelist}_save(): code made a little bit more comprehensible thanks to new CPL_IO_CREATE. 2008-11-28 16:56 lbilbao * cpldrs/tests/cpl_detector-test.c: New explicit, bitwise I/O mode value CPL_IO_CREATE. CPL_IO_DEFAULT equals now the new CPL_IO_CREATE. Checks added where needed and CPL_IO_DEFAULT replaced with the new CPL_IO_CREATE. (DFS06116) 2008-11-28 16:56 llundin * cplcore/tests/cpl_filter-test.c: test_filter(): Fixed typo 2008-11-28 16:48 llundin * cplcore/tests/cpl_image_filter-test.c: cpl_image_filter_mask_test(): CPL_FILTER_MEDIAN added 2008-11-28 16:48 lbilbao * cplcore/cpl_image_io.c, cplcore/cpl_imagelist_io.c, cplcore/cpl_io.h, cplcore/cpl_propertylist.c, cplcore/cpl_table.c, cplcore/cpl_vector.c, cplcore/tests/cpl_fits-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_mask-test.c, cplcore/tests/cpl_propertylist-test.c, cplcore/tests/cpl_vector-test.c, cpldfs/cpl_dfs.c, cpldfs/tests/cpl_dfs-test.c, cpldrs/tests/cpl_geom_img-test.c, cplui/tests/cpl_frameset_io-test.c: New explicit, bitwise I/O mode value CPL_IO_CREATE. CPL_IO_DEFAULT equals now the new CPL_IO_CREATE. Checks added where needed and CPL_IO_DEFAULT replaced with the new CPL_IO_CREATE. (DFS06116) 2008-11-28 16:06 llundin * cplcore/tests/cpl_image_filter-test.c: cpl_image_filter_mask_test(): Added 2008-11-28 16:02 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_mask(): for CPL_FILTER_STDEV mask must have more than 1 element 2008-11-28 15:40 lbilbao * cplcore/: cpl_type.c, tests/cpl_type-test.c: cpl_type_get_{name, sizeof}(): extended for new types CPL_TYPE_{FLOAT, DOUBLE}_COMPLEX and CPL_TYPE_UNSPECIFIED. 2008-11-28 15:40 llundin * cplcore/cpl_test.c: cpl_test_image_abs(): OK, when all pixels are bad in both (equal sized) images 2008-11-28 15:30 lbilbao * cplcore/: cpl_image_io.c, cpl_imagelist_io.c: cpl_{image, imagelist}_load_internal(): new functions to be wrapped from cpl_{image, imagelist}_load{, _window}(). 2008-11-28 14:04 llundin * cplcore/: cpl_mask.c, tests/cpl_mask-test.c: cpl_mask_set(): Return proper CPL error code (DFS06322) 2008-11-28 12:35 lbilbao * cplcore/: cpl_imagelist_io.c, tests/cpl_imagelist_io-test.c: cpl_imagelist_load{, _window}(): new type CPL_TYPE_UNSPECIFIED supported for no-casting loading operations, with unit tests. (DFS06138) 2008-11-28 12:16 lbilbao * cplcore/cpl_image_io.c: cpl_image_load_window(): error checking in switch-case CPL_TYPE_UNSPECIFIED reordered to deallocate memory properly in error cases. 2008-11-28 12:05 lbilbao * cplcore/: cpl_imagelist_io.c, cpl_imagelist_io_body.h: cpl_imagelist_load(): wrapped around cpl_imagelist_load_window(). 2008-11-28 11:05 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h, tests/cpl_filter_body.h: cpl_filter_stdev_slow_*(): Added. cpl_image_filter_mask(): Support CPL_FILTER_STDEV, needs unit test 2008-11-28 11:01 llundin * cplcore/cpl_filter.h: CPL_FILTER_AVERAGE_FAST: Update doxygen 2008-11-28 10:39 lbilbao * cplcore/: cpl_image_io.c, cpl_image_io_body.h, tests/cpl_image_io-test.c: cpl_image_load_window(): new type CPL_TYPE_UNSPECIFIED supported for no-casting loading operations, with unit tests. (DFS06138) Additionally, cpl_image_load(): wrap around cpl_image_load_window(). 2008-11-28 10:36 llundin * cplcore/: cpl_filter.h, cpl_image_filter.c, tests/cpl_filter-test.c: CPL_FILTER_AVERAGE_FAST: Added. cpl_image_filter_mask(): Support CPL_FILTER_AVERAGE_FAST 2008-11-28 09:47 lbilbao * cplcore/: cpl_image_io.c, cpl_type.h, tests/cpl_image_io-test.c: cpl_image_load(): new type CPL_TYPE_UNSPECIFIED supported for no-casting loading operations, with unit tests. (DFS06138) 2008-11-28 09:29 llundin * cplcore/cpl_image_filter_body.h: cpl_filter_average_slow_*(): Disable recurrence mean per default 2008-11-27 17:02 llundin * cplcore/cpl_image_filter_body.h: cpl_filter_average_slow_*(): Use incremental mean for floating point data 2008-11-27 16:29 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: cpl_image_filter_mask(): Support avering in general (slow+accurate) 2008-11-27 15:47 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: cpl_image_filter_mask(): Support bpms for averaging 2008-11-27 15:25 llundin * cplcore/tests/cpl_filter-test.c: benchmark(): Benchmark on all filter/border modes 2008-11-27 14:19 lbilbao * cplcore/: cpl_fits.c, cpl_fits.h, tests/cpl_fits-test.c, tests/cpl_image_io-test.c: cpl_fits_get_nb_extensions(): renamed as cpl_fits_count_extensions(). cpl_fits_get_extension_nb(): renamed as cpl_fits_find_extension(). Old APIs kept as deprecated wrappers around the new ones. (DFS06193) 2008-11-27 14:07 llundin * cplcore/tests/cpl_filter_body.h: test_cpl_image_filter_*(): pixel type in msg 2008-11-27 14:03 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_mask(): Buffer-overlap w. doxygen 2008-11-27 12:03 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_mask(): Doxygen of error codes 2008-11-27 10:30 llundin * cplcore/cpl_tools.h: revert to 1.75 2008-11-27 10:29 llundin * cplcore/cpl_test.h: Revert to 1.25 2008-11-27 09:17 llundin * cplcore/tests/cpl_filter-test.c: benchmark(): Add size 2008-11-26 17:12 lbilbao * cplcore/tests/cpl_image_basic-test.c: Warnings because of a bug in gcc related to I complex macro removed by a workaroung (cpl_i). 2008-11-26 16:56 llundin * cplcore/cpl_image_filter_body.h: cpl_filter_average_*(): Explicit pixel-counts in prep for support of bad pixels 2008-11-26 15:55 llundin * cplcore/: cpl_test.h, cpl_tools.h: CPL_HAVE_GNUC_NONNULL definition moved to cpl_tools.h from cpl_test.h 2008-11-26 15:54 llundin * cplcore/tests/cpl_bivector-test.c: cpl_tools.h included (again) 2008-11-26 15:29 llundin * cplcore/cpl_tools.h: Include of cpl_test.h dropped 2008-11-26 15:28 llundin * cplcore/cpl_test.c, cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_error-test.c, cplcore/tests/cpl_errorstate-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_bpm-test.c, cplcore/tests/cpl_image_iqe-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_mask-test.c, cplcore/tests/cpl_memory-test.c, cplcore/tests/cpl_msg-test.c, cplcore/tests/cpl_plot-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_propertylist-test.c, cplcore/tests/cpl_vector-test.c, cpldfs/tests/cpl_dfs-test.c, cpldrs/tests/cpl_apertures-test.c, cpldrs/tests/cpl_apertures_img-test.c, cpldrs/tests/cpl_detector-test.c, cpldrs/tests/cpl_wcs-test.c, cplui/tests/cpl_frameset-test.c, cplui/tests/cpl_frameset_io-test.c: cpl_test.h included 2008-11-26 15:22 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_erase_regexp(): updated doxygen text to reflect change in return code when version >= 5.0. 2008-11-26 15:01 cizzo * cplcore/cpl_table.c: cpl_table_save, writes now DATE record before HIERARCH keywords 2008-11-26 14:45 lbilbao * cplcore/tests/cpl_vector-test.c: Dump debugging information to stdout only with CPL_MSG_INFO. 2008-11-26 09:54 llundin * cplcore/tests/Makefile.am: Activate cpl_filter-test.c 2008-11-19 16:13 lbilbao * cplcore/tests/cpl_vector-test.c: New unit test added for cpl_vector_fit_gaussian(). 2008-11-19 14:45 llundin * cplcore/cpl_test.c: cpl_test_end(): Call cpl_test_dump_status() - experimental 2008-11-19 14:45 llundin * configure.ac: AC_CHECK_FUNCS getpid (for cpl_test.c) 2008-11-19 14:44 llundin * cplcore/tests/cpl_image_io-test.c: fclose(stream) 2008-11-18 11:35 scastro * cplcore/tests/cpl_propertylist-test.c: added cpl_test_error(CPL_ERROR_ILLEGAL_INPUT) inside the ifdef CPL_PROPERTYLIST_CHECK_NAN_LOAD 2008-11-17 18:04 lbilbao * cplcore/: cpl_image_basic_body.h, cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h, cpl_type.c, tests/cpl_image_basic-test.c, tests/cpl_image_io-test.c: Fix warning about complex -> double complex. 2008-11-17 17:32 scastro * cplcore/cpl_propertylist.c: _cpl_propertylist_from_fitsfile(): include check for NaN, nan keyword values. 2008-11-17 17:24 scastro * cplcore/cpl_propertylist.c: _cpl_propertylist_from_fitsfile(): include check for NaN keyword values. 2008-11-14 17:19 llundin * cplcore/tests/cpl_propertylist-test.c: Test for DFS06221 2008-11-14 16:15 lbilbao * m4/cpl.m4: CPL_CHECK_CFITSIO: Add warning for 2.510, remove debug comment on 64-bit flags for CFITSIO 3.X and higher. 2008-11-14 12:43 lbilbao * cplcore/: cpl_image_io.c, cpl_image_io.h, tests/cpl_image_io-test.c: New functions cpl_image_get_{complex, real, imag}() added. Functions cpl_image_{cast, fill_rejected, dump_window}() modified to support complex pixel types. With unit tests. (DFS06088) 2008-11-14 10:59 llundin * cplcore/tests/cpl_propertylist-test.c: Test 26 added: NANs cannot be saved 2008-11-14 09:08 lbilbao * cplcore/: tests/cpl_image_basic-test.c, cpl_image_basic.c, cpl_image_basic_body.h, cpl_image_defs.h, cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h, cpl_type.c, cpl_type.h: cpl_image_new(): extended to support CPL_TYPE_{DOUBLE, FLOAT}_COMPLEX. 6 new functions: cpl_image_get_data_{double, float}_complex{, _const}() and cpl_image_wrap_{double, float}_complex(). cpl_image_{add, subtract, multiply}_create(): extended to support operations between complex operands. Definitions for the new types added accordingly where needed. Basic unit tests included. Work under development yet. 2008-11-13 17:17 lbilbao * cplcore/cpl_init.c: Allowed CFITSIO 3.x for CPL HEAD 2008-11-13 16:19 llundin * m4/cpl.m4: CPL_CHECK_CFITSIO: Disable version warning for 3.X and higher, try to use 64-bit flags for CFITSIO 3.X and higher 2008-11-13 13:57 scastro * cplcore/tests/cpl_propertylist-test.c: Started to replace cx_assert() with calls to cpl_test functions. These replacements are commented out. Work under development 2008-11-13 13:17 llundin * cplcore/cpl_vector.h: cpl_vector_new_lss_kernel(), cpl_vector_new_lss_kernel(): Deprecated 2008-11-13 12:12 llundin * cpl.h: Add cpl_plot.h 2008-11-13 12:02 llundin * cplcore/tests/cpl_image_io-test.c: Add some failure tests, remove some redundant tests 2008-11-13 12:01 llundin * cplcore/cpl_image_io.c: cpl_image_save(): Drop BSCALE, update doxygen 2008-11-13 11:45 scastro * cplcore/tests/cpl_propertylist-test.c: Started to replace cx_assert() with calls to cpl_test functions. These replacements are commented out. Work under development 2008-11-13 10:57 scastro * cplcore/tests/cpl_propertylist-test.c: Started to replace cx_assert() with calls to cpl_test functions. These replacements are commented out. Work under development 2008-11-13 10:51 lbilbao * cplcore/cpl_init.c: Bug fixed 2008-11-13 10:46 llundin * cplcore/cpl_image_io.c: cpl_image_save(): cpl_propertylist_save() used on NULL image 2008-11-13 10:36 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_save(): included missing return in "Open the file" if statement. 2008-11-13 10:29 lbilbao * configure.ac, cplcore/cpl_init.c: Allowed CFITSIO 3.x for CPL4.1.1 2008-11-13 10:25 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_load_regexp(): replaced calls to cpl_error_set() with cpl_error_set_message_macro() on I/O calls, to catch CFITSIO error message. 2008-11-12 18:27 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_load(): replaced calls to cpl_error_set() with cpl_error_set_message_macro() on I/O calls, to catch CFITSIO error message. 2008-11-12 17:48 scastro * cplcore/cpl_propertylist.c: Replaced calls to cpl_error_set(_id, CPL_ERROR_DATA_NOT_FOUND) with cpl_error_set_message(_id, CPL_ERROR_DATA_NOT_FOUND, "%s", name), so that a more meaningful message is printed out. See DFS05122. 2008-11-12 16:52 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_save(): added mandatory keywords PCOUNT and GCOUNT on the extensions of data-less FITS headers. 2008-11-12 14:58 llundin * cplcore/cpl_test.c: cpl_test_get_description(): OFF_T definition 2008-11-10 15:01 llundin * cplui/: cpl_recipedefine.c, cpl_recipedefine.h: CPL_RECIPE_DEFINE(), cpl_get_license(): Improve doxygen. Move some includes to .c file 2008-11-10 11:38 llundin * cplcore/cpl_test.c: cpl_test_one(): Reset errno 2008-11-08 22:36 scastro * cplcore/tests/cpl_propertylist-test.c: Included test for DFS06137. 2008-11-08 22:35 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_save(): fixed bug when appending NULL propertylist. XTENSION must be set to IMAGE. DFS06137. 2008-11-07 11:39 lbilbao * cplcore/: cpl_imagelist_io.c, cpl_imagelist_io.h, tests/cpl_imagelist_io-test.c: cpl_imagelist_dump_{structure, window}() added with unit tests (DFS06025). 2008-11-07 08:51 llundin * cpl.h: Removed cpl_wlcalib_xc.h 2008-11-06 15:38 llundin * cplcore/: cpl_vector.c, cpl_vector.h: cpl_vector_convolve_symmetric(): Redeclare as cpl_error_code 2008-11-06 15:15 llundin * cplcore/cpl_vector.c, cplcore/cpl_vector.h, cpldrs/Makefile.am, cpldrs/cpl_wlcalib_xc.c, cpldrs/cpl_wlcalib_xc.h, cpldrs/tests/Makefile.am, cpldrs/tests/cpl_wlcalib-test.c: DFS06148: Move cpl_wlcalib functions to IRPLIB (Keep copy of convolve functions in cpl_vector module) 2008-11-06 13:05 cizzo * cpldrs/cpl_ppm.c: Fix typo in doc 2008-11-05 16:26 cizzo * cplcore/: cpl_array.c, cpl_array.h: Added new functions cpl_array_abs(), cpl_array_logarithm(), cpl_array_power(), cpl_array_exponential() 2008-11-05 10:04 lbilbao * cplcore/: cpl_vector.c, cpl_image_basic.c: Unnecessary processing of 0^0 removed in cpl_{image, vector}_power(); C99 pow() sets 0^0=1. Documentation updated accordingly. 2008-11-05 09:09 lbilbao * cplcore/: cpl_vector.c, tests/cpl_vector-test.c: cpl_vector_power() behaviour modified to set 0^0=1 (DFS06017) with unit tests. 2008-11-05 08:50 lbilbao * cplcore/: cpl_image_basic.c, tests/cpl_image_basic-test.c: cpl_image_power() behaviour modified to set 0^0=1 (DFS06017). 2008-11-05 08:04 lbilbao * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic.h, tests/cpl_imagelist_basic-test.c: New function cpl_imagelist_power() (DFS06018) with unit tests, added as well for cpl_imagelist_{logarithm, exponential}(). 2008-11-04 19:23 llundin * cplcore/cpl_image_filter_body.h: cpl_filter_average_*(): Fix // comments 2008-11-04 15:57 cizzo * cplcore/cpl_image_resample.c: Just create auxiliary images, instead of duplicating them from input 2008-11-04 14:56 llundin * cplcore/cpl_xmemory.c: perror(NULL) called as well on failure 2008-11-04 14:46 llundin * cplcore/cpl_xmemory.c: abort() instead of exit() on failure 2008-11-04 12:16 lbilbao * cplcore/: cpl_vector.c, tests/cpl_vector-test.c: Performance improvement in cpl_vector_save() (DFS06101) with unit tests added. 2008-11-04 11:10 lbilbao * cplcore/: cpl_imagelist_io.c, cpl_imagelist_io_body.h: Unnecessary code removed. 2008-11-04 11:03 lbilbao * cplcore/cpl_imagelist_io.c: Performance improvement for cpl_imagelist_save() (DFS06101). 2008-11-04 11:01 cizzo * cplcore/tests/cpl_image_resample-test.c: Adapt test to renaming of functions cpl_image_warp_polynomial_scale() and cpl_image_warp() to cpl_image_fill_jacobian_polynomial() and cpl_image_fill_jacobian() 2008-11-04 11:00 cizzo * cplcore/: cpl_image_resample.c, cpl_image_resample.h: Rename functions cpl_image_warp_polynomial_scale() and cpl_image_warp() to cpl_image_fill_jacobian_polynomial() and cpl_image_fill_jacobian() 2008-11-04 10:20 cizzo * cplcore/cpl_image_resample.c: Minimale change (indentation) 2008-11-04 10:20 cizzo * cplcore/tests/cpl_image_resample-test.c: Add minimal test for cpl_image_warp_scale() 2008-11-04 09:38 llundin * cplcore/cpl_image_resample.c: cpl_image_warp(): Update doxygen 2008-11-04 09:30 lbilbao * cplcore/: cpl_image_io.c, cpl_io.h: Handling of CPL_BPP_16_UNSIGNED totally removed -> rely on CFITSIO for that. 2008-11-03 15:14 cizzo * cplcore/: cpl_image_resample.c, cpl_image_resample.h: Add new function cpl_image_warp_scale() 2008-11-03 11:45 llundin * cplcore/cpl_image_io.c: cpl_image_save(): Allow use of cpl_propertylist_save() on NULL image 2008-11-03 11:36 llundin * cplcore/tests/cpl_image_io-test.c: cpl_image_save(): Test empty main HDU 2008-11-03 11:22 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_fits(): CPL_TEST_FITS replaces CPL_FITS_TESTER 2008-11-03 11:12 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_extract(): Guard against empty self 2008-11-03 08:51 lbilbao * configure.ac: cpl-4.5.0 -> cpl-4.5.1cvs 2008-11-03 08:33 lbilbao * configure.ac: cpl-4.4.1cvs -> cpl-4.5.0 2008-10-31 18:50 llundin * cplcore/cpl_image_io.c: cpl_image_save(): Fix type-punning warning for bpp (bis) 2008-10-31 18:47 llundin * cplcore/cpl_test.c: cpl_test_fits_macro(): Add CPL_FITS_TESTER help text when unset 2008-10-31 18:45 llundin * cplcore/cpl_image_io.c: cpl_image_save(): Fix type-punning warning for bpp 2008-10-31 18:38 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_test_fits() Used on successful saves 2008-10-31 18:35 llundin * cplcore/: cpl_image_io.c, tests/cpl_image_io-test.c: cpl_image_save(): Write PCOUNT,GCOUNT in dataless extension headers (DFS06130) 2008-10-31 17:39 llundin * cplcore/cpl_image_io.c: cpl_image_save(): Check status of fits_close_file(), avoid unneeded fio_status check on NULL image 2008-10-31 17:32 llundin * cplcore/tests/cpl_image_io-test.c: cpl_test_fits() used on successful saves. Drop keep.fits 2008-10-31 17:27 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_fits(): Added with some unit-testing. cpl_test_image_abs(): CPL_MSG_ERROR guard on cpl_image_dump_structure() 2008-10-31 15:14 llundin * cplcore/: cpl_image_io.c, cpl_image_io_body.h, tests/cpl_image_io-test.c: cpl_image_save(): DFS06101 also for CPL_BPP_16_UNSIGNED, Drop BZERO+BSCALE from minimal header, drop use of _body.h, reduce scope of variables, tightened unit-tests a bit 2008-10-31 14:51 cizzo * cplcore/cpl_image_resample.c: Minor modification to doc for cpl_image_warp_polynomial_scale() 2008-10-31 14:01 cizzo * cplcore/cpl_image_resample.c: Simplify doc for cpl_image_warp_polynomial_scale() 2008-10-31 13:14 cizzo * cplcore/cpl_image_resample.c: Fix incorrect doc for cpl_image_warp_polynomial_scale() 2008-10-31 11:21 cizzo * cplcore/cpl_image_resample.c: Add doc to cpl_image_warp_polynomial_scale() 2008-10-31 11:19 llundin * cplcore/tests/cpl_image_io-test.c: Drop default image size from 512 to 32 2008-10-31 10:33 llundin * cplcore/cpl_image_filter_body.h: cpl_filter_median_*(): Drop unused code 2008-10-31 10:11 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_mask(): Update doxygen 2008-10-31 09:14 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_derivative(): Add two more tests 2008-10-30 17:16 llundin * cplcore/: cpl_polynomial.c, tests/cpl_polynomial-test.c: cpl_polynomial_derivative(): Fix DFS06121, support multivariate differentation that changes the degree from non-zero to zero 2008-10-30 16:20 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: cpl_image_filter_mask(): Support non-full mask in median filtering 2008-10-30 16:03 llundin * cplcore/cpl_image_resample_body.h: cpl_image_get_interpolated_*(): Fix indentation 2008-10-30 15:58 cizzo * cplcore/tests/cpl_image_resample-test.c: Add minimal test case for cpl_image_warp_polynomial_scale() 2008-10-30 15:58 cizzo * cplcore/: cpl_image_resample.c, cpl_image_resample.h: Add first tentative implementation of cpl_image_warp_polynomial_scale() 2008-10-30 15:16 llundin * cplcore/: cpl_image_resample.c, cpl_image_resample_body.h: cpl_image_get_interpolated_*(): Remove redundancy from interface. cpl_image_warp_polynomial(): Replace ++ on double with explicit cast 2008-10-30 13:49 llundin * cplcore/: cpl_image_resample.c, cpl_image_resample_body.h, tests/cpl_image_resample-test.c: cpl_image_warp_polynomial(): (poly_x,poly_y) replaces (poly_u,poly_v) (DFS06120) 2008-10-30 13:00 lbilbao * configure.ac: cpl-4.4.0 -> cpl-4.4.1cvs 2008-10-30 12:07 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_copy_test(): Added 2008-10-30 12:06 llundin * cplcore/cpl_image_basic.c: cpl_image_copy(): Document non-overlapping pixel-buffers, correct pointer in multi-row-copying 2008-10-30 11:30 lbilbao * cplcore/cpl_image_io.c: Extra check added regarding previous performance-related change in cpl_image_save(). 2008-10-30 10:58 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_copy(): Verify bpm copy 2008-10-30 10:10 lbilbao * configure.ac: cpl-4.3.0 -> cpl-4.4.0 2008-10-29 17:17 lbilbao * cplcore/cpl_image_io.c: Performance improvement in cpl_image_save() (DFS6101). 2008-10-29 17:00 lbilbao * cplcore/: cpl_image_io.c, tests/cpl_image_io-test.c: cpl_image_save() and cpl_image_append() merged and new unit test added as a preparation for ticket DFS6101. 2008-10-29 16:12 cizzo * cpldfs/: cpl_dfs.c, cpl_dfs.h: Add new function cpl_dfs_setup_product_init() to support alternative behaviour in cpl_dfs_setup_product_header(). 2008-10-28 18:24 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h, tests/cpl_image_filter-test.c: cpl_image_filter_mask(): (Still draft) Handle bpms in median filtering 2008-10-28 18:21 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: cpl_image_copy(): Use memcpy(), avoid cpl_mask_duplicate() 2008-10-28 18:19 llundin * cplcore/cpl_mask.c: cpl_mask_duplicate(): Avoid cpl_calloc(). cpl_mask_copy(): Use memcpy() 2008-10-28 16:40 scastro * cplui/tests/cpl_frameset-test.c: Added Test 2a to dump a frameset into file in disk. 2008-10-28 16:40 scastro * cplui/cpl_frameset.c: Added cpl_frameset_dump(const cpl_frameset *self, FILE *stream). See DFS06025. 2008-10-28 16:39 scastro * cplui/cpl_frameset.h: Added prototype for void cpl_frameset_dump(const cpl_frameset *self, FILE *stream); 2008-10-28 16:27 scastro * cplui/cpl_frame.h: cpl_frame_dump(): made cpl_frame a const. 2008-10-28 16:26 scastro * cplui/cpl_frame.c: cpl_frame_dump(): modified to all the information in only one line. Made cpl_frame a const. 2008-10-28 15:13 scastro * cplui/tests/cpl_frame-test.c: Removed unsed cpl_test_frame_dump() and replaced by Test 4 which uses the new cpl_frame_dump(). 2008-10-28 15:11 scastro * cplui/cpl_frame.c: Added new function void cpl_frame_dump(cpl_frame *frame, FILE *stream) as requested in DFS06025. 2008-10-28 15:11 scastro * cplui/cpl_frame.h: New prototype for void cpl_frame_dump(cpl_frame *frame, FILE *stream); 2008-10-28 15:08 llundin * cplcore/tests/cpl_mask-test.c: cpl_mask_copy(): Test error handling 2008-10-28 15:04 llundin * cplcore/tests/cpl_mask-test.c: Added some more tests... 2008-10-28 14:10 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_eq_mask(): Added w. some unit testing 2008-10-28 13:58 scastro * cplui/cpl_frameset.c: cpl_frameset_labelise(): replaced cpl_ensure(0, CPL_ERROR_UNSPECIFIED, NULL) by cpl_ensure(0, cpl_error_get_code, NULL). DFS05722. 2008-10-28 09:41 llundin * cplcore/cpl_test.c: cpl_test_image_abs_macro(): Dump image structures on failure 2008-10-27 15:49 cizzo * cplcore/cpl_table.c: According to CPL rule, eliminate asserts from code 2008-10-24 15:32 llundin * cplcore/: cpl_image_io.c, cpl_image_io.h, tests/cpl_image_io-test.c: cpl_image_dump_structure(), cpl_image_dump_window(): Added with unit tests 2008-10-24 14:21 llundin * cplcore/: cpl_type.c, tests/cpl_type-test.c: cpl_type_get_name(): Return empty string on error 2008-10-24 14:17 llundin * cplcore/cpl_test.c: cpl_test_{,non}null(): Improve message 2008-10-24 12:47 llundin * cplcore/: cpl_type.c, cpl_type.h, tests/cpl_type-test.c: cpl_type_get_name(): Added with unit tests 2008-10-22 14:33 llundin * cplcore/: cpl_filter_median_double.c, cpl_filter_median_float.c, cpl_filter_median_impl.h, cpl_filter_median_int.c, cpl_image_filter.c, cpl_image_filter_body.h: cpl_filter_median_*(): Draft added. cpl_image_filter_median_uniform_*():Dropped 2008-10-22 13:08 llundin * cplcore/: cpl_filter_median_double.c, cpl_filter_median_float.c, cpl_filter_median_impl.h, cpl_filter_median_int.c, cpl_image_filter.c: cpl_filter_median_all_*(): Replaces cpl_filter_median_*() 2008-10-22 13:00 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: cpl_filter_average_*(): Replaces cpl_image_filter_*() 2008-10-22 12:50 llundin * cplcore/: cpl_filter_median.c, cpl_filter_median_double.c, cpl_filter_median_float.c, cpl_filter_median_int.c: Drop support for different input and output pixel types 2008-10-22 12:49 llundin * cplcore/cpl_filter_median_impl.h: include cpl_macros.h to support stand alone inclusion 2008-10-22 11:14 llundin * cplcore/: cpl_filter.h, cpl_filter_median.c, tests/cpl_filter-test.c, tests/cpl_filter_body.h: Drop CPL_BORDER_EXTRAPOL_OUT 2008-10-21 17:48 llundin * cplcore/: cpl_filter.h, cpl_image_filter.c, cpl_image_filter.h, tests/cpl_filter-test.c, tests/cpl_filter_body.h: cpl_image_filter_mask(): Draft, replaces cpl_image_filter_uniform() 2008-10-21 17:27 llundin * cplcore/tests/cpl_filter-test.c: Drop benchmark size to 32 as default 2008-10-21 15:15 llundin * cplcore/: Makefile.am, cpl_filter.h, cpl_filter_median.c, cpl_filter_median_double.c, cpl_filter_median_float.c, cpl_filter_median_impl.h, cpl_filter_median_int.c, cpl_image_filter.c, cpl_image_filter.h, cpl_image_filter_body.h, tests/Makefile.am, tests/cpl_filter-test.c, tests/cpl_filter_body.h: cpl_image_filter_uniform(): Draft version imported from irplib - API will change 2008-10-17 17:09 llundin * cplcore/: cpl_stats.c, cpl_stats_body.h: Avoid extra pixel-buffer pass for median-dev on CPL_STATS_ALL 2008-10-17 17:05 llundin * cplcore/tests/cpl_stats-test.c: CPL_STAT_CMP(): Added. CPL_STATS_MEDIAN_DEV appended to statone test 2008-10-17 16:24 llundin * cplcore/: cpl_image_stats.c, cpl_image_stats.h, cpl_image_stats_body.h, cpl_stats.c, cpl_stats.h, cpl_stats_body.h, tests/cpl_stats-test.c: cpl_image_get_median_dev_window(), cpl_stats_get_median_dev(), CPL_STATS_MEDIAN_DEV: Added 2008-10-17 15:06 llundin * cplcore/cpl_mask.c: cpl_mask_get_first_window(): Added as static 2008-10-16 18:43 llundin * cplcore/: cpl_image_stats.c, cpl_image_stats_body.h: cpl_image_get_median_dev(): Correct error location on all rejected pixels, avoid bad-pixel map allocation+check when empty, add FLOP count 2008-10-16 17:33 llundin * cplcore/: cpl_image_stats.c, tests/cpl_stats-test.c: cpl_image_get_median_dev(): Fix error location on all-rejected image (with unit-test), avoid duplication of pre-existing mask 2008-10-16 15:35 llundin * cplcore/: cpl_image_stats.c, cpl_image_stats.h, tests/cpl_stats-test.c: cpl_image_get_centroid_{x,y}(): Added (for completeness). Error propagation corrected, code duplication reduced, more unit tests added 2008-10-16 15:33 llundin * cplcore/cpl_image_defs.h: CPL_CONCAT3X(): Added 2008-10-09 11:02 llundin * cplcore/cpl_test.c: cpl_test_end(): Test mem leaks after unit test report 2008-09-30 10:36 lbilbao * configure.ac: cpl-4.3.0 -> cpl-4.3.1cvs 2008-09-30 10:20 lbilbao * configure.ac: cpl-4.3.0cvs -> cpl-4.3.0 2008-09-29 16:38 cizzo * cpldrs/cpl_ppm.c: Fix typo 2008-09-18 13:32 llundin * cplcore/cpl_memory.c: cpl_vsprintf(): Improve error text 2008-09-17 15:27 cizzo * cplcore/: cpl_table.c, cpl_table.h: Add new function cpl_table_set_column_savetype() 2008-09-17 14:55 cizzo * cplcore/cpl_table.h: Standard C comments 2008-09-16 11:48 llundin * cplcore/cpl_init.c: cpl_init(): Use cpl_error_set_message() instead of cpl_error_set_message_macro() 2008-09-16 11:47 llundin * configure.ac, m4/cpl.m4: Test for variadic macros 2008-09-16 11:44 llundin * cplcore/cpl_imagelist_basic_body.h, cpldfs/cpl_dfs.c, cpldrs/cpl_fit.c: Use CPL_CPU_CACHE as default for L2 cache size 2008-09-16 10:40 llundin * m4/cpl.m4: Improve help text 2008-09-16 10:39 llundin * acinclude.m4: typos 2008-09-16 10:14 llundin * cpldfs/cpl_dfs.c: cpl_dfs_find_md5sum(): Improve error string on fits_get_hduoff() failure 2008-09-12 16:11 llundin * cpldfs/cpl_dfs.c: cpl_dfs_find_md5sum(): Fix memory leak on failed ffmbyt() 2008-09-12 15:07 llundin * cpldfs/cpl_dfs.c: cpl_dfs_find_md5sum(): Replace fits_get_hduaddr() with fits_get_hduoff() (DFS05866) and reenable blocking 2008-09-10 09:28 llundin * cplui/: cpl_recipedefine.c, cpl_recipedefine.h, tests/cpl_recipedefine-test.c: CPL_RECIPE_DEFINE(): Use new internal function cpl_recipedefine_create_is_ok() to reduce macro size 2008-09-09 17:23 llundin * cplui/: cpl_recipedefine.c, cpl_recipedefine.h, tests/cpl_recipedefine-test.c: CPL_RECIPE_DEFINE(): Use new internal function cpl_recipedefine_init() to reduce macro size 2008-09-09 16:41 llundin * cplui/: Makefile.am, cpl_recipedefine.c, cpl_recipedefine.h, tests/cpl_recipedefine-test.c: CPL_RECIPE_DEFINE(): Use new internal functions to reduce macro size: cpl_recipedefine_{create,exec,destroy}() 2008-09-09 13:28 llundin * cpldfs/md5.c: Drop doxygen tags from static, non-doxygen documented function definitions 2008-09-05 11:50 cizzo * cplcore/cpl_table.c: Add function cpl_table_set_column_save_type(), defined private until it is officially decided that this extremely complex accessor function will be accepted by the Community, by the CPL Team, and by His Holyness the Pope 2008-09-05 11:38 cizzo * cplcore/cpl_table.h: Add prototype to cpl_table_set_column_save_type(), commented out until it is officially decided that this extremely complex accessor function will be accepted by the Community, the CPL Team, and His Holyness the Pope 2008-09-05 11:36 cizzo * cplcore/: cpl_column.c, cpl_column.h: Add new functions cpl_column_set_save_type() cpl_column_get_save_type() 2008-09-05 11:03 cizzo * cplcore/tests/cpl_table-test.c: Add some tests about TLOGICAL columns - commented out 2008-09-04 14:58 scastro * cpldrs/cpl_wcs.c: cpl_wcs_delete(): reordered the way memory is deallocated. 2008-08-22 15:08 cizzo * cplcore/cpl_table.c: Support type TLOGICAL in cpl_table_load() 2008-08-19 18:06 lbilbao * cpldrs/cpl_fit.c: Bug fix. (DFS05795) 2008-08-12 09:22 llundin * cpldrs/tests/cpl_wlcalib-test.c: cpl_wlcalib_lss(): Protect against negative values due to round-off 2008-08-12 09:17 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_lt(): Added 2008-08-11 15:06 lbilbao * cplcore/cpl_vector.c: fits_open_file() -> fits_open_diskfile(). (DFS05510) 2008-08-11 15:01 llundin * configure.ac: Undo previous change (which breaks SunOS support) 2008-08-11 14:58 lbilbao * cplcore/: cpl_image_io.c, cpl_imagelist_io.c: fits_open_file() -> fits_open_diskfile(). Error checking improved in cpl_image_load_window(). (DFS05510) 2008-08-08 17:00 llundin * cplui/cpl_frameset_io.c: cpl_fits_has_image(): Ensure proper closing of file on error 2008-08-08 16:59 llundin * cplcore/cpl_image_io.c: cpl_image_save(): Propagate error from cpl_image_append(). cpl_image_load(): Ensure proper closing of file on error. cpl_image_append(): Use cpl_error_set_message_macro() on error 2008-08-08 14:51 llundin * configure.ac: Drop unused AC_CHECK_LIB() on -lsocket, -lnsl 2008-08-08 12:07 lbilbao * cplcore/: cpl_image_io.c, tests/cpl_image_io-test.c: fits_open_file() -> fits_open_diskfile(). (DFS05510) 2008-08-08 09:46 llundin * cplcore/cpl_image_basic.c, cplcore/cpl_vector.c, cpldrs/cpl_fit.c: cpl_image_normalise(), cpl_vector_fill_kernel_profile(), cpl_vector_gen_lowpass_kernel(), cpl_fit_imagelist_polynomial_window(): use CPL error state for unsupported switch-cases (DFS05755) 2008-08-07 18:59 lbilbao * cplcore/cpl_image_stats.c: Added missing references in documentation. (DFS05612) 2008-08-07 18:53 lbilbao * cplcore/cpl_stats.c: Documentation relevant to previous error code change (DFS05610) added. 2008-08-07 18:39 lbilbao * cplcore/cpl_stats.c: Error code changed CPL_ERROR_TYPE_MISMATCH -> CPL_ERROR_INVALID_TYPE. (DFS05614) 2008-08-07 15:50 lbilbao * cplcore/: cpl_stats.c, tests/cpl_stats-test.c: Error code changed. (DFS05610) 2008-08-07 15:19 lbilbao * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: Unused piece of code removed. 2008-08-07 12:01 lbilbao * configure.ac: 4.2.0 -> 4.3.0cvs 2008-08-07 10:17 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_shift_1d_1(): Dim numbered from 0 2008-08-07 10:03 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_solve_1d(): Use cpl_error_set_message_macro() on iterator failure 2008-08-06 14:46 lbilbao * configure.ac: cpl-4_2_0b3 -> cpl-4_2_0 2008-08-04 13:45 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_shift_1d_1(): Added as static 2008-08-01 16:36 llundin * cpldrs/cpl_wlcalib_xc.c: cpl_vector_fill_line_spectrum(): Update with checks from IRPLIB version 2008-07-28 16:21 llundin * cplcore/tests/cpl_plot-test.c: Fix const-gcc-warning 2008-07-28 15:01 lbilbao * configure.ac: 4.2.0b2 -> 4.2.0b3 2008-07-28 14:54 cizzo * cpldfs/cpl_dfs.c: Avoid inheriting QC parameters from input frames 2008-07-28 14:09 lbilbao * configure.ac: 4.2.0b1 -> 4.2.0b2 2008-07-28 14:00 llundin * cplcore/tests/cpl_memory-test.c: cpl_memory_test_is_empty(),cpl_memory_test_is_non_empty(): Added 2008-07-28 13:32 llundin * cpldrs/cpl_wlcalib_xc.c: cpl_vector_fill_lss_profile_symmetric(): Add FIXME optimization comment 2008-07-28 12:10 llundin * cpldrs/cpl_wlcalib_xc.c: cpl_wlcalib_xc_best_poly(): Do not fail on *wlres == NULL, set xc of failed candidates to zero. cpl_wlcalib_is_lines(), cpl_vector_fill_line_spectrum(): Do not assume dispersion is positive 2008-07-28 11:25 llundin * cpldrs/tests/cpl_wlcalib-test.c: cpl_wlcalib_xc_best_poly_test_one(): Verify sign of solution, shift 1st guess, and increase problem size a bit 2008-07-25 13:05 llundin * cpldrs/cpl_wlcalib_xc.c: static cpl_erf_antideriv() replaces macro. cpl_vector_fill_line_spectrum(): Fail on non-physical disp1d + better error messages 2008-07-24 16:28 llundin * cpldrs/tests/cpl_wlcalib-test.c: cpl_wlcalib_xc_best_poly_test_one(): Improve error bound to allow real solution to be found, use better test spectra 2008-07-24 15:35 llundin * cpldrs/cpl_wlcalib_xc.c: cpl_wlcalib_fill_spectrum(): Fix mem leak on error 2008-07-24 15:02 llundin * cpldrs/tests/cpl_photom-test.c: cpl_plot_bivector() 2008-07-24 11:32 llundin * cpldrs/: Makefile.am, cpl_wlcalib_xc.c, cpl_wlcalib_xc_impl.h, tests/cpl_wlcalib-test.c: cpl_wlcalib_xc_gen_spc_table(): Use cpl_vector_fill_line_spectrum() when needed. cpl_vector_fill_line_spectrum(): Non-static, available internally in CPL via cpl_wlcalib_xc_impl.h for unit-tests 2008-07-24 10:31 llundin * cpldrs/tests/cpl_wlcalib-test.c: cpl_wlcalib_xc_best_poly_test_one(): Used for test with and without catalog resampling 2008-07-24 09:48 llundin * cpldrs/cpl_wlcalib_xc.c: cpl_wlcalib_xc_best_poly_test(): Add cpl_msg_debug() call on resamping status 2008-07-23 20:55 llundin * cpldrs/cpl_wlcalib_xc.c: cpl_wlcalib_xc_best_poly(): Fix compiler warning 2008-07-23 19:18 llundin * cpldrs/cpl_wlcalib_xc.c: cpl_wlcalib_is_lines(): Added. cpl_vector_fill_line_spectrum(): Copied from nacop. cpl_wlcalib_fill_spectrum(): Handle only sampled profiles, wrap sub_cat around hires-cat, call cpl_wlcalib_xc_signal_resample() on sub_cat 2008-07-23 17:08 llundin * cpldrs/cpl_wlcalib_xc.c: cpl_wlcalib_fill_spectrum(): Replaces cpl_wlcalib_xc_gen_signal() with only half the poly-evals. cpl_wlcalib_xc_estimate(): Take vectors with work-memory, call cpl_wlcalib_fill_spectrum(). cpl_wlcalib_xc_gen_spc_table(): Use cpl_wlcalib_fill_spectrum() 2008-07-23 17:02 llundin * cpldrs/tests/cpl_wlcalib-test.c: cpl_wlcalib_xc_best_poly_test(): Call cpl_plot_columns() on spc-table 2008-07-23 16:01 llundin * cplcore/cpl_bivector.c: cpl_bivector_interpolate_linear(): Use cpl_vector_find() for 1st ref point 2008-07-23 15:51 scastro * cpldrs/cpl_wcs.c: removed include cpl_msg.h 2008-07-23 14:03 llundin * cplcore/cpl_test.c: #include "cpl_msg.h" 2008-07-23 14:02 llundin * cpldrs/cpl_geom_img.c: Calls to cpl_msg_info() replaced by cpl_msg_debug() 2008-07-23 14:02 llundin * cplcore/cpl_matrix.c: cpl_matrix_get_determinant(): Remove dead code 2008-07-23 13:51 llundin * cpldrs/cpl_wlcalib_xc.c: do not include cpl_msg.h 2008-07-23 13:28 llundin * cpldrs/cpl_wlcalib_xc.c: cpl_wlcalib_xc_signal_resample(): Void repeated call to cpl_bivector_get_size(). cpl_wlcalib_xc_cat_extract(): cpl_vector_find() used instead of linear search. cpl_wlcalib_xc_best_poly(): No upper limit on degree, cpl_wlcalib_xc_gen_spc_table() called only when needed, add doxygen about deallocation + complexity, Verify that nsamples is positive, and that guess_poly is 1D 2008-07-23 09:43 llundin * cplcore/cpl_polynomial.c: cpl_vector_fill_polynomial(): Use cpl_vector_get_data() 2008-07-22 16:32 llundin * cpldrs/cpl_wlcalib_xc.c: cpl_wlcalib_xc_best_poly(): Fix compiler warning 2008-07-22 11:02 llundin * cplcore/cpl_polynomial.c: cpl_vector_fill_polynomial_fit_residual(): cpl_tools_add_flops() called 2008-07-21 14:21 llundin * cpldrs/cpl_fit_body.h: cpl_fit_imagelist_polynomial_{double,float,int}(): Fix warnings issued with -O2, but not -O3 2008-07-21 14:09 llundin * configure.ac: package name -> 4.2.0b1, CPL_CONFIG_VERSION incremented 2008-07-21 13:13 llundin * cpldrs/: cpl_ppm.c, cpl_ppm.h: cpl_ppm_match_positions(): const correctness. (also fix warnings: undeclared use of cpl_msg_debug() + unused variables 2008-07-21 12:04 llundin * cpldfs/cpl_dfs.c: cpl_dfs_find_md5sum(): In fits_movabs_hdu() NULL replaces (int*)&hdutype 2008-07-21 12:01 lbilbao * cplcore/cpl_image_io.c: Change to fits_open_diskfile() reverted. Further investigation required. It is probably worth to drop the whole cpl_image_append(). 2008-07-21 11:14 lbilbao * cplcore/cpl_image_io.c: Last instance of fits_open_file() replaced. 2008-07-21 10:48 llundin * cplcore/cpl_image_basic.c, cplcore/cpl_matrix.c, cplcore/cpl_plot.c, cpldfs/Makefile.am, cpldfs/cpl_dfs.c, cpldfs/md5.c, cpldfs/tests/Makefile.am, cpldfs/tests/cpl_dfs-test.c, cplui/cpl_frameset_io.c, cplui/cpl_frameset_io.h, cplui/tests/cpl_pluginlist-test.c, cplcore/cpl_image_filter.h, cplcore/cpl_image_gen.h, cplcore/cpl_image_stats.c, cplcore/cpl_bivector.c, cplcore/cpl_column.h, cplcore/cpl_error.h, cplcore/cpl_image.h, cplcore/cpl_image_basic.h, cplcore/cpl_image_gen.c, cplcore/cpl_imagelist.h, cplcore/cpl_math_const.h, cplcore/cpl_msg.h, cplcore/cpl_propertylist_impl.h, cplcore/cpl_table.c, cplcore/cpl_tools.c, cplcore/cpl_tools_body.h, cplcore/cpl_errorstate.c, cplcore/cpl_errorstate.h, cplcore/cpl_fits.h, cplcore/cpl_image_bpm.h, cplcore/cpl_image_filter_body.h, cplcore/cpl_image_io_body.h, cplcore/cpl_image_stats.h, cplcore/cpl_io.h, cplcore/cpl_msg.c, cplcore/cpl_stats.c, cplcore/cpl_table.h, cplcore/cpl_vector.c, Makefile.am, cplcore/cpl_bivector.h, cplcore/cpl_column.c, cplcore/cpl_fits.c, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_bpm.c, cplcore/cpl_image_defs.h, cplcore/cpl_image_filter.c, cplcore/cpl_image_gen_body.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_iqe.c, cplcore/cpl_image_iqe.h, cplcore/cpl_image_resample.c, cplcore/cpl_image_resample.h, cplcore/cpl_image_resample_body.h, cplcore/cpl_image_stats_body.h, cplcore/cpl_imagelist_basic.c, cplcore/cpl_imagelist_basic.h, cplcore/cpl_imagelist_basic_body.h, cplcore/cpl_imagelist_defs.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io.h, cplcore/cpl_imagelist_io_body.h, cplcore/cpl_init.h, cplcore/cpl_mask.c, cplcore/cpl_mask.h, cplcore/cpl_matrix.h, cplcore/cpl_plot.h, cplcore/cpl_polynomial.c, cplcore/cpl_polynomial.h, cplcore/cpl_stats.h, cplcore/cpl_stats_body.h, cplcore/cpl_test.c, cplcore/cpl_test.h, cplcore/cpl_tools.h, cplcore/cpl_vector.h, cplcore/cpl_vector_fit_impl.h, cplcore/cpl_xmemory.c, cplcore/cpl_xmemory.h, cplcore/tests/Makefile.am, cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_error-test.c, cplcore/tests/cpl_errorstate-test.c, cplcore/tests/cpl_fits-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_bpm-test.c, cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_gen-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_image_iqe-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_mask-test.c, cplcore/tests/cpl_math-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_memory-test.c, cplcore/tests/cpl_msg-test.c, cplcore/tests/cpl_plot-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_stats-test.c, cplcore/tests/cpl_table-test.c, cplcore/tests/cpl_test-test.c, cplcore/tests/cpl_type-test.c, cplcore/tests/cpl_vector-test.c, cpldrs/Makefile.am, cpldrs/cpl_apertures.c, cpldrs/cpl_apertures.h, cpldrs/cpl_apertures_img.c, cpldrs/cpl_apertures_img.h, cpldrs/cpl_detector.c, cpldrs/cpl_detector.h, cpldrs/cpl_detector_body.h, cpldrs/cpl_fit.c, cpldrs/cpl_fit.h, cpldrs/cpl_geom_img.c, cpldrs/cpl_geom_img.h, cpldrs/cpl_geom_img_body.h, cpldrs/cpl_photom.c, cpldrs/cpl_photom.h, cpldrs/cpl_phys_const.h, cpldrs/cpl_wcs.c, cpldrs/cpl_wlcalib_xc.c, cpldrs/cpl_wlcalib_xc.h, cpldrs/tests/Makefile.am, cpldrs/tests/cpl_apertures-test.c, cpldrs/tests/cpl_apertures_img-test.c, cpldrs/tests/cpl_detector-test.c, cpldrs/tests/cpl_fit-test.c, cpldrs/tests/cpl_geom_img-test.c, cpldrs/tests/cpl_photom-test.c, cpldrs/tests/cpl_ppm-test.c, cpldrs/tests/cpl_wcs-test.c, cpldrs/tests/cpl_wlcalib-test.c: Extend range of copyright years from 2004 to 2008 2008-07-21 10:32 llundin * cplcore/cpl_msg.h: cpl_msg_progress(): deprecated 2008-07-21 08:49 llundin * cpldrs/: cpl_fit.c, cpl_fit_body.h: cpl_fit_imagelist_polynomial_{double,float,int}(): Drop redundant urx, ury; Add doxygen for llx, lly; Try to simplify index expression for pi[] 2008-07-21 08:40 llundin * cpldrs/cpl_fit_body.h: cpl_fit_imagelist_polynomial_{double,float,int}(): Revert swap of loops for filling pbw[] due to inefficient change of memory access 2008-07-18 18:19 llundin * cpldrs/cpl_wlcalib_xc.c: cpl_wlcalib_xc_best_poly(): cpl_polynomial_fit() replaces cpl_polynomial_fit_1d_create(), use CPL_PTR_SWAP() to avoid deep copy+new allocation 2008-07-18 17:36 llundin * cplcore/tests/cpl_polynomial-test.c: Recoded last instance of cpl_polynomial_fit_2d_create() 2008-07-18 16:55 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_test_2d(): Added 2008-07-18 16:49 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_2d(): Fix bug in coefficient resetting 2008-07-18 16:33 cizzo * cpldrs/: cpl_ppm.c, cpl_ppm.h: upgrade to cpl_polynomial_fit() 2008-07-18 15:10 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_test(): More 1D tests 2008-07-18 14:33 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_test(): Only one distinct sampling point (1D) 2008-07-18 13:24 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: cpl_vector_fill_polynomial_fit_residual(): Added with unit test 2008-07-18 11:29 cizzo * cpldrs/: cpl_ppm.c, cpl_ppm.h: Add const-correctness to cpl_ppm_match_points() 2008-07-18 10:19 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit(): doxygen (distint samples) 2008-07-18 09:57 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_{1,2}d(): Use cpl_polynomial_delete_coeff() 2008-07-17 18:06 lbilbao * cplcore/cpl_image_io.c: Calls to fits_open_file() replaced with fits_open_diskfile() in cpl_image_load() and cpl_image_load_window() (DFS05510). 2008-07-17 17:36 lbilbao * cplcore/cpl_fits.c: cpl_fits_get_extension_nb() and cpl_fits_get_nb_extensions() rewritten to avoid use of CFITSIO fits_open_file() (DFS5510). 2008-07-17 16:32 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_test(): Test more errors and reset of preset 1D-coeffs 2008-07-17 16:13 llundin * cplcore/cpl_polynomial.h: cpl_polynomial_fit_1d_create(), cpl_polynomial_fit_2d_create(): Deprecated 2008-07-17 16:09 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_test(): Some 1D tests. cpl_polynomial_eval_1d_diff(): One more test 2008-07-17 15:53 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_polynomial_abs(): Added 2008-07-17 15:26 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit(): Correct 1D-residual. doxygen 2008-07-17 14:31 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_2d(): added. cpl_polynomial_fit(): Support 2D 2008-07-17 11:29 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h: cpl_polynomial_fit(), cpl_polynomial_eval_1d_diff(): Added 2008-07-10 17:16 lbilbao * cpldrs/: cpl_fit.c, cpl_fit.h, cpl_fit_body.h, tests/cpl_fit-test.c: New function cpl_fit_imagelist_polynomial_window() added with unit tests. The existing cpl_fit_imagelist_polynomial() is now a wrapper around the new one. 2008-07-10 16:45 cizzo * cpldrs/cpl_ppm.c: Eliminate too many debug messages, turn info messages into debug, use cpl_set_error_message() to send error messages in the stack instead of printing them 2008-07-10 11:41 llundin * cplcore/cpl_matrix.c: cpl_matrix_set(): inline 2008-07-10 11:39 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_2d_create(): dmv[] replaces cpl_matrix_set() 2008-07-09 13:58 scastro * cplcore/cpl_propertylist.c: Added doxygen code to cpl_propertylist_dump(). 2008-07-09 13:56 scastro * cplcore/cpl_propertylist.c: new function cpl_propertylist_dump(). 2008-07-09 13:55 scastro * cplcore/cpl_propertylist.h: new prototype for cpl_propertylist_dump(). 2008-07-09 13:55 scastro * cplcore/tests/cpl_propertylist-test.c: Commented out call to cpl_propertylist_dump(), which replaces static function in this test (cpl_test_plist_dump()). 2008-07-07 11:41 llundin * cplcore/cpl_plot.c: cpl_plot_vectors(): Use correct error code 2008-07-04 17:29 llundin * cpldrs/cpl_fit.c: cpl_fit_imagelist_polynomial(): is_symsamp replaces is_eqdist, update doxygen accordingly (and mention Chebyshev nodes) 2008-07-04 17:05 lbilbao * cpldrs/tests/cpl_fit-test.c: Proven Validity of eq_dist in case of symmetric values around a mean for x_pos. 2008-07-04 14:55 llundin * cplcore/cpl_vector.c: cpl_vector_correlate(): Added @code to doxygen 2008-07-04 11:32 llundin * README: --with-cfitsio replaces --with-CFITSIO 2008-07-03 11:56 llundin * cpldrs/: cpl_wlcalib_xc.c, tests/cpl_wlcalib-test.c: cpl_vector_fill_lss_profile_symmetric(): Convolve with unit width and area tophat 2008-06-17 14:41 llundin * cpldrs/tests/Makefile.am: Align with cplcore/tests/Makefile.am 2008-06-17 14:17 llundin * cpldrs/tests/cpl_wlcalib-test.c: cpl_wlcalib_xc_convolve_create_kernel_test(): Add more tests 2008-06-17 13:38 llundin * cpldrs/: cpl_wlcalib_xc.c, tests/cpl_wlcalib-test.c: cpl_wlcalib_xc_convolve_create_kernel(): Use new, static function cpl_vector_fill_lss_profile_symmetric(), Added unit tests 2008-06-12 14:49 yjung * cpldrs/cpl_wlcalib_xc.c: [no log message] 2008-06-11 16:56 scastro * cplui/cpl_frame.c: cpl_frame_get_nplanes(): replaced a call to fits_open_file() with fits_open_diskfile(). See DFS05510. 2008-06-11 16:23 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_save(): replaced a call to fits_open_file() with fits_open_diskfile(). See DFS05510. 2008-06-11 15:31 scastro * cpldrs/cpl_wcs.c: Removed all calls to cpl_msg_error() and replaced them by either cpl_ensure() or cpl_error_set_message_macro() when appropriate. 2008-06-11 14:32 scastro * cpldrs/tests/cpl_wcs-test.c: replaced at the end return(0) with return cpl_test_end(0). 2008-06-11 14:31 scastro * cpldrs/tests/cpl_wcs-test.c: Replaced calls to cpl_error_reset() with cpl_test_error() 2008-06-11 14:25 scastro * cpldrs/tests/cpl_wcs-test.c: Removed warning of C99 for mixed declarations and code. 2008-06-11 09:38 llundin * cpldrs/tests/cpl_wlcalib-test.c: Add multiple calls of cpl_wlcalib_xc_best_poly() for benchmarking (on for msg. level info and debug) 2008-06-10 15:27 yjung * cpldrs/cpl_wlcalib_xc.c: ispeed up with direct acess to vectors and bivectors (DFS05537) 2008-06-10 14:17 llundin * cpldrs/cpl_wlcalib_xc.c: cpl_wlcalib_xc_estimate(): cpl_error_reset() replaced by cpl_errorstate_get()/cpl_errorstate_set() 2008-06-10 13:55 yjung * cpldrs/cpl_wlcalib_xc.c: [no log message] 2008-06-10 13:49 yjung * cpldrs/: cpl_wlcalib_xc.c, tests/cpl_wlcalib-test.c: Added some error checking Less strict on slitw requirement (DFS05522) Convolution kernel generated once (DFS05526 part 1) 2008-06-06 14:08 yjung * cpldrs/cpl_wlcalib_xc.c: update doc 2008-06-06 13:27 llundin * cplcore/cpl_type.c: #include dropped 2008-06-06 11:57 llundin * cpldrs/tests/: Makefile.am, cpl_wlcalib-test.c: Added cpl_wlcalib-test.c with a single test 2008-06-06 11:32 llundin * cpldfs/cpl_dfs.c: cpl_dfs_update_product_header(): Drop call to cpl_msg_debug() 2008-06-06 11:27 llundin * cpldfs/cpl_dfs.c: cpl_dfs_paf_init(): cpl_error_set_message_macro() replaces cpl_msg_error() 2008-06-06 11:25 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_save_tests(): Call cpl_dfs_save_paf() with illegal filename 2008-06-05 10:29 scastro * cpldrs/cpl_wcs.c: cpl_wcs_new_from_propertylist(): inverted the order of the check for NAXIS. If checks first if there is ZNAXIS, then NAXIS. 2008-06-04 16:30 llundin * cplcore/cpl_image_io.c: cpl_image_load(): Put CFITSIO error info + arguments into error after failed open call, only allocate extname when xtnum greater than zero 2008-06-04 09:54 yjung * cpldrs/cpl_wlcalib_xc.c: if not needed do not allocate the large vxcorrs vector 2008-06-03 16:35 yjung * cpldrs/cpl_wlcalib_xc.c: DFS05344: Memory error in cpl_wlcalib_xc_best_poly() 2008-06-03 15:12 yjung * cpldrs/cpl_wlcalib_xc.c: DFS05345: wlcalib_xc_best_poly() does not use CPL error system -> solved 2008-06-02 14:58 scastro * cpldrs/tests/cpl_wcs-test.c: New tests for accessor functions. 2008-06-02 14:58 scastro * cpldrs/cpl_wcs.c: Modified cpl_wcs structure to include new elements from wcslib structure. New accessor functions: int cpl_wcs_get_image_naxis(const cpl_wcs *wcs); const cpl_array *cpl_wcs_get_image_dims(const cpl_wcs *wcs); const cpl_array *cpl_wcs_get_crval(const cpl_wcs *wcs); const cpl_array *cpl_wcs_get_crpix(const cpl_wcs *wcs); const cpl_matrix *cpl_wcs_get_cd(const cpl_wcs *wcs) cpl_wcs_new_from_propertylist(): included a check for the existence of NAXIS or ZNAXIS. 2008-06-02 14:53 scastro * cpldrs/cpl_wcs.h: New prototypes for accessor functions. int cpl_wcs_get_image_naxis(const cpl_wcs *wcs); const cpl_array *cpl_wcs_get_image_dims(const cpl_wcs *wcs); const cpl_array *cpl_wcs_get_crval(const cpl_wcs *wcs); const cpl_array *cpl_wcs_get_crpix(const cpl_wcs *wcs); const cpl_matrix *cpl_wcs_get_cd(const cpl_wcs *wcs); 2008-05-29 17:12 scastro * cplui/tests/Makefile.am: removed -static from AM_LDFLAGS 2008-05-27 13:03 llundin * cpldfs/cpl_dfs.c: cpl_dfs_setup_product_header): Use cpl_parameterlist_get_first_const(), cpl_parameterlist_get_next_const() to avoid cast of const to non-const 2008-05-27 11:38 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_save_tests(): Add test of cpl_dfs_save_propertylist() 2008-05-27 11:37 llundin * cpldfs/: cpl_dfs.c, cpl_dfs.h: cpl_dfs_save_propertylist(), CPL_DFS_PRO_SCIENCE, CPL_DFS_PRO_TECH, CPL_DFS_PRO_TYPE, CPL_DFS_PRO_CATG: Added. cpl_dfs_save_*(): doxygen improved. cpl_dfs_update_product_header(): Fail on frame with missing filename 2008-05-27 11:17 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_save_tests(): Verify support of NULL-image in cpl_dfs_save_image() 2008-05-20 14:25 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_2d_bench(): Added 2008-05-20 09:36 llundin * cplcore/tests/Makefile.am: cpl_type-test added 2008-05-19 11:55 cizzo * cpldrs/: cpl_ppm.c, cpl_ppm.h, tests/cpl_ppm-test.c: Add extra parameters lin_scale and lin_angle 2008-05-16 17:47 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_offset_saa(): Add onto 1st image when rtot == 0 and CPL_GEOM_FIRST 2008-05-16 16:11 llundin * cplcore/cpl_type.c: cpl_type_get_sizeof(): Drop cx types (DFS05359) 2008-05-16 16:07 llundin * cplcore/tests/cpl_type-test.c: Test also CPL_TYPE_POINTER 2008-05-16 16:02 llundin * cplcore/tests/cpl_type-test.c: Tests cpl_type_get_sizeof() 2008-05-15 15:46 llundin * cplcore/: cpl_image_basic.c, cpl_image_io.c: cpl_image_fill_rejected(): cpl_mask_is_empty() replaces cpl_mask_count() 2008-05-14 16:14 llundin * cpldrs/: cpl_geom_img.c, cpl_geom_img_body.h, tests/cpl_geom_img-test.c: cpl_geom_img_offset_saa(): contribution is at least zero, reject zero-contribution pixels 2008-05-14 16:11 llundin * cplcore/: cpl_test.c, cpl_test.h: cpl_test_leq_macro(): #value, #tolerance 2008-05-14 15:06 cizzo * cpldrs/: cpl_ppm.c, cpl_ppm.h: Minor changes 2008-05-14 14:35 llundin * cpldrs/: cpl_geom_img.c, cpl_geom_img_body.h: cpl_geom_img_offset_fine(), cpl_geom_img_offset_saa(): Do not call cpl_msg_progress() 2008-05-14 14:25 llundin * cplcore/cpl_msg.c: cpl_msg_progess(): Roll back to original version in rev. 1.32 (using statically defined cpl_tools_get_cputime()), mark as deprecated 2008-05-13 17:55 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_{float,double}(): comment on stride access for acc[] 2008-05-13 16:38 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_{float,double}(): Use a single variable in innermost loop, reduce scope of some declarations 2008-05-13 14:46 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_{float,double}(): Make nx-loop innermost 2008-05-13 11:58 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_{float,double}(): localize offset_i/j 2008-05-13 11:32 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_{float,double}(): Compute rsc[] onces for each source image 2008-05-13 11:07 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_get_min_max_double(): CX_MIN(rmin, rmax) 2008-05-13 10:55 llundin * cpldrs/tests/cpl_geom_img-test.c: cpl_geom_img_offset_saa_bench(): Take nx,ny; msg MFLOP/s 2008-05-09 16:01 cguirao * Makefile.purify.in: Adding -dlclose-mode=2 on request from MZ 2008-05-08 16:30 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_get_min_max_double(): cpl_tools_add_flops(), small localization 2008-05-08 14:29 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_get_min_max_double(): Improve doxygen, use CPL_SORT(), inline 2008-05-08 09:32 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_all_{float,double}(): Use additional unsigned char buffer for contribution map 2008-05-07 16:36 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_get_min_max_double(): Improve comments 2008-05-07 16:35 llundin * cpldrs/: cpl_geom_img.c, cpl_geom_img_body.h: cpl_geom_img_get_min_max_double(): Added. cpl_geom_img_offset_saa_{float,double}(): cpl_geom_img_get_min_max_double() replaces cpl_tools_sort_double() 2008-05-07 15:01 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_all_{float,double}(): Improved doxumentation 2008-05-07 14:04 llundin * configure.ac, m4/cpl.m4: CPL_CHECK_CPU: Defines CPL_CPU_CACHE, CPL_CPU_CORES from /proc/cpuinfo 2008-05-07 11:41 llundin * cpldrs/tests/cpl_geom_img-test.c: cpl_geom_img_offset_saa_bench(): Use images of CPL_TYPE_FLOAT 2008-05-07 11:15 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_all_{float,double}(): Iterate only on valid source pixels, use only a single index in innermost loop 2008-05-07 10:24 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_all_{float,double}{}: Move final division to separate loop 2008-05-07 10:07 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_all_{float,double}(): Do not compute floating point source location 2008-05-07 09:07 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_{float,double}(): Drop leaps, neighbors, add ppi[] 2008-05-06 19:26 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa(): Add clop-count. cpl_geom_img_offset_saa_all_{float,double}(): Divide sumrs into rsc 2008-05-06 19:06 llundin * cplcore/cpl_tools.c: cpl_tools_add_flops(): inline 2008-05-06 18:34 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa_all_{double,float}(): Drops leaps[], use 1/sumrs, pull rsc etc out out to image-loop 2008-05-06 17:29 llundin * cpldrs/: cpl_geom_img.c, cpl_geom_img_body.h: cpl_geom_img_offset_saa(): Add special case with no rejection 2008-05-06 17:27 llundin * cpldrs/tests/cpl_geom_img-test.c: Call cpl_geom_img_offset_saa_bench() with and without rejection 2008-05-06 15:08 llundin * cpldrs/: cpl_geom_img.c, cpl_geom_img_body.h: Support pixel types via static functions. Put cpl_msg_error() into CPl error 2008-05-06 11:46 llundin * cpldrs/: cpl_geom_img.c, cpl_geom_img_body.h: cpl_geom_img_offset_saa(): Move variables to smaller scope 2008-05-06 10:20 llundin * cplcore/cpl_test.c: cpl_test_end(): Fix doxygen example 2008-05-05 15:25 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_offset_saa(): Correct sub-pixel offeset error (DFS05411). Fix warning of y1 shadowing 2008-05-05 09:15 cizzo * cpldrs/tests/cpl_ppm-test.c: Use CPL_MATH_PI instead of M_PI 2008-05-02 16:22 cizzo * cpldrs/cpl_ppm.c: Simplify distance between triangles 2008-05-02 15:42 cizzo * cpldrs/cpl_ppm.c: Use c99 compatible constants 2008-05-02 14:27 llundin * cplcore/: cpl_errorstate.c, tests/cpl_errorstate-test.c: cpl_errorstate_append(), cpl_errorstate_find(): Fix for DFS05408 2008-05-02 12:01 cizzo * cplcore/tests/cpl_table-test.c: Add unit tests about null values in float and double columns of arrays 2008-05-02 12:00 cizzo * cplcore/cpl_table.c: Fix problem with NULL values in float and double columns of arrays 2008-05-02 10:46 llundin * cplcore/tests/cpl_math-test.c: Verify sizeof CPL_MATH_PI 2008-04-30 13:41 cizzo * cpldrs/tests/cpl_ppm-test.c: Automatic check introduced, make the test silent 2008-04-30 13:07 cizzo * cpldrs/tests/cpl_ppm-test.c: Add test with contaminated data set 2008-04-30 11:26 cizzo * cpldrs/cpl_ppm.c: Avoid patterns larger than data (for the moment) 2008-04-29 15:48 cizzo * cpldrs/tests/cpl_ppm-test.c: Add test on random points 2008-04-29 13:50 cizzo * cpldrs/cpl_ppm.c: Fix bug about negative tolerance... 2008-04-29 13:50 cizzo * cpldrs/tests/cpl_ppm-test.c: Add some more tests... 2008-04-29 11:29 cizzo * cpldrs/tests/Makefile.am: Add unit tests for ppm 2008-04-29 11:29 cizzo * cpldrs/tests/cpl_ppm-test.c: First unit tests added, work still ongoing 2008-04-29 11:27 cizzo * cpldrs/cpl_ppm.c: First running version: it seems to work... Testing still ongoing 2008-04-28 17:13 cizzo * cpldrs/cpl_ppm.c: Temporary delta for 2D pattern matching (7) 2008-04-28 16:23 cizzo * cpldrs/cpl_ppm.c: Temporary delta for 2D pattern matching (6) 2008-04-28 14:46 cizzo * cpldrs/cpl_ppm.c: Temporary delta for 2D pattern matching (5) 2008-04-25 15:42 cizzo * cpldrs/cpl_ppm.c: Temporary delta for 2D pattern matching (4) 2008-04-25 11:46 cizzo * cpldrs/cpl_ppm.c: Temporary delta for 2D pattern matching (3) 2008-04-25 11:19 cizzo * cpldrs/cpl_ppm.c: Temporary delta for 2D pattern matching (2) 2008-04-24 17:08 cizzo * cpldrs/cpl_ppm.c: Temporary delta for 2D pattern matching 2008-04-23 16:25 cizzo * cpldrs/: cpl_ppm.c, cpl_ppm.h: Begin implementation 2008-04-23 00:45 llundin * cpldrs/tests/cpl_geom_img-test.c: cpl_geom_img_offset_saa_bench(): Added 2008-04-22 17:09 cizzo * cpldrs/cpl_ppm.c: Temporary delta: doc for 2D pattern matching in the making (2)... 2008-04-21 20:09 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_offset_saa(): Move ox/oy_tmp code to scope of CPL_GEOM_UNION, Catch empty output image for CPL_GEOM_INTERSECT 2008-04-21 19:01 llundin * cpldrs/cpl_geom_img_body.h: cpl_geom_img_offset_saa(): Sort only when outliers are rejected 2008-04-21 16:57 cizzo * cpldrs/cpl_ppm.c: Temporary delta: doc for 2D pattern matching in the making... 2008-04-21 03:21 llundin * cpldrs/tests/cpl_geom_img-test.c: #ifdef SAVE_COMBINED 2008-04-21 03:11 llundin * cplcore/cpl_image_resample_body.h: cpl_image_get_interpolated(): Direct bpm[] access replaces cpl_image_is_rejected() 2008-04-21 00:28 llundin * cplcore/: cpl_init.c, cpl_tools.c, cpl_tools.h: cpl_init(): Remove cpl_tools_get_cputime() from CPL 2008-04-21 00:16 llundin * cplcore/cpl_msg.c: cpl_msg_progress(): clock() replaces cpl_tools_get_cputime() (and drop cpl_tools.h), cpl_sprintf() replaces cpl_malloc()+sprintf() 2008-04-20 22:43 llundin * cpldrs/tests/cpl_geom_img-test.c: Add some more tests of cpl_geom_img_offset_saa(). Use cpl_test_get_cputime() instead of cpl_tools_get_cputime() 2008-04-20 22:41 llundin * cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_stats-test.c, cplcore/tests/cpl_vector-test.c, cpldrs/tests/cpl_fit-test.c: Use cpl_test_get_cputime() instead of cpl_tools_get_cputime() 2008-04-20 22:39 llundin * cplcore/tests/cpl_image_gen-test.c: Use cpl_test functions 2008-04-20 22:37 llundin * cplcore/: cpl_test.c, cpl_test.h: cpl_test_get_cputime(): Defined. cpl_test_end(): print info from times() 2008-04-20 22:35 llundin * configure.ac: Invoke ESO_FUNC_SYSCONF and define HAVE_SYS_TIMES_H in order to let times() replace the troublesome cpl_tools_get_cputime() 2008-04-20 06:05 llundin * cpldrs/tests/cpl_geom_img-test.c: cpl_geom_img_offset_saa(): Added some more tests 2008-04-19 18:15 llundin * cplcore/cpl_vector.c: cpl_vector_correlate(): Added FIXME comment. cpl_vector_get(),cpl_vector_set(): idx replaces index, which is declared as index() from strings.h 2008-04-19 01:18 llundin * cpldrs/tests/cpl_detector-test.c: Use cpl_test_image_abs() 2008-04-19 01:09 llundin * cplcore/: cpl_image_io.c, cpl_image_io_body.h: cpl_image_new(): Srop switch 2008-04-19 00:59 llundin * cplcore/tests/cpl_image_io-test.c: Add more unit tests 2008-04-19 00:58 llundin * cplcore/: cpl_image_io.c, cpl_image_io_body.h: cpl_image_duplicate(): Drop switch. cpl_image_save(): Put CFITSIO text into error 2008-04-19 00:56 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_image_abs(): Added 2008-04-19 00:45 llundin * cplcore/cpl_image_gen.c: Improve doxygen + error checking, avoid repeated calls to new()/delete() 2008-04-16 21:13 llundin * cplcore/cpl_xmemory.c: cpl_xmemory_status(): Improve msg on fatal error 2008-04-15 20:24 llundin * cpldfs/cpl_dfs.c: cpl_dfs_paf_dump(): Use cpl_propertylist_get_const(), cpl_sprintf(), memchr(); avoid multiple calls to cpl_propertylist_get_size() 2008-04-15 15:06 yjung * cpldfs/cpl_dfs.c: Added support for CPL_TYPE_BOOL in cpl_dfs_save_paf() (DFS05341) 2008-04-12 17:41 llundin * cpldrs/tests/cpl_detector-test.c: Added more unit tests also with errors 2008-04-04 10:51 scastro * cpldrs/cpl_wcs.c: cpl_wcs_new_from_propertylist(): replace calls to cpl_error_get_code() with cpl_errorstate functions. 2008-03-27 14:27 yjung * cplcore/: cpl_plot.c, cpl_plot.h, tests/cpl_plot-test.c: added cpl_plot_columns() 2008-03-27 12:44 yjung * cplcore/: cpl_plot.c, cpl_plot.h, tests/cpl_plot-test.c: [no log message] 2008-03-25 16:40 yjung * cplcore/cpl_plot.c: [no log message] 2008-03-25 13:34 yjung * cplcore/tests/cpl_plot-test.c: [no log message] 2008-03-25 12:02 yjung * cplcore/: cpl_plot.c, cpl_plot.h, tests/cpl_plot-test.c: added support for NULL first column in cpl_plot_table() 2008-03-25 11:28 yjung * cplcore/tests/cpl_plot-test.c: [no log message] 2008-03-20 11:14 llundin * cplcore/cpl_image_bpm.c: cpl_image_count_rejected(): Single point of return 2008-03-19 16:36 llundin * cplcore/cpl_image_bpm.c: cpl_image_reject_from_mask(): Preserve bpm-pointer (DFS05191) 2008-03-19 16:29 llundin * cplcore/: cpl_image_io.c, cpl_image_io_body.h: cpl_image_get_bpm(): Drop spurious temp-variable. cpl_image_get() + cpl_image_set(): variable pos replaces already-defined name index. cpl_image_save() + cpl_image_append(): variable b0 replaces already-defined name bzero 2008-03-19 13:49 llundin * cplcore/cpl_image_iqe.c: iqesec(): #define hsq2 to CPL_MATH_SQRT1_2 2008-03-18 13:50 llundin * cplcore/cpl_image_io.c: cpl_image_get_bpm_const(): Comment on const in-correctness 2008-03-17 10:14 llundin * cplcore/cpl_image_io.c: cpl_image_append(): const correctness 2008-03-17 10:11 llundin * cplcore/cpl_imagelist_io.c: cpl_imagelist_append(): const correctness 2008-03-17 10:07 llundin * cplcore/cpl_mask.c: cpl_mask_count(): Fix compiler warnings 2008-03-13 14:26 llundin * cplcore/tests/cpl_polynomial-test.c: Default call of _dump() to /dev/null 2008-03-13 14:23 llundin * cplcore/tests/cpl_matrix-test.c: Default call of _dump() with /dev/null. Reduce bench-mark default size. Formatting 2008-03-13 14:14 llundin * cplcore/tests/cpl_image_resample-test.c: Default call of _dump() with /dev/null. Formatting. cpl_test() -> cpl_test_nonnull() 2008-03-13 14:06 llundin * cpldrs/tests/cpl_apertures_img-test.c, cplcore/tests/cpl_image_iqe-test.c: Default call of _dump() with /dev/null 2008-03-13 14:01 llundin * cplui/tests/cpl_recipedefine-test.c: cpl_recipedefine_test(): Default call of _dump() with /dev/null 2008-03-13 10:38 llundin * cpldrs/tests/cpl_apertures-test.c: fclose(stream) 2008-03-12 15:37 llundin * cpldrs/tests/cpl_apertures-test.c: Verify correctness of aperture stats 2008-03-12 14:30 llundin * cpldrs/tests/cpl_apertures-test.c: Loop on all three image types, check on NULL pointers 2008-03-11 21:09 llundin * cplcore/cpl_vector.c: cpl_vector_append(): const correctness 2008-03-11 18:11 llundin * cplcore/cpl_tools_body.h: cpl_tools_get_variance_double(): Fix doxygen typo 2008-03-11 18:04 llundin * cplcore/: cpl_matrix.c, cpl_vector.c: cpl_{vector,matrix}_get_stdev(): Use cpl_tools_get_variancesum_double() 2008-03-11 18:04 llundin * cplcore/: cpl_stats_body.h, tests/cpl_stats-test.c: cpl_stats_new_from_image_window(): pix_mean may be computed differently in all-stats block 2008-03-11 17:59 llundin * cplcore/: cpl_tools.h, cpl_tools_body.h: cpl_tools_get_variancesum_{double,float,int}(): Added 2008-03-11 17:31 llundin * cplcore/: cpl_tools.c, cpl_tools.h, cpl_tools_body.h: Added cpl_tools_get_variance_{float,int}() 2008-03-11 17:26 llundin * cplcore/cpl_stats.c: cpl_stats_new_from_image_window(): Fix uninit warning 2008-03-11 17:11 llundin * cpldrs/cpl_apertures.c: cpl_apertures_new_from_image(): Compute mean and stdev using accumulated sums (DFS05126) 2008-03-11 17:07 llundin * cpldrs/tests/cpl_apertures-test.c: Call cpl_apertures_dump() on CPL_MSG_INFO 2008-03-11 14:54 llundin * cplcore/: cpl_stats.c, tests/cpl_stats-test.c: cpl_stats_new_from_image_window(): Avoid double-pass on pixel buffer for mean+stdev (DFS05126) 2008-03-11 14:25 llundin * cplcore/: cpl_stats.c, cpl_stats_body.h, tests/cpl_stats-test.c: cpl_stats_new_from_image_window(): All-category replaces minmaxflux category, with bench-mark 2008-03-11 11:12 llundin * cplcore/: cpl_stats.c, cpl_stats_body.h: cpl_stats_new_from_image_window(): Minor clean-up in preparation for DFS05126 2008-03-10 16:24 llundin * cplcore/tests/cpl_stats-test.c: Verify cpl_image_get_{min,max,mean,etc}() against cpl_stats_get_{ditto}(). Verify cpl_stats_get_{min,max,mean,stdev}() against cpl_vector_get_{ditto() 2008-03-10 13:06 llundin * cplcore/cpl_stats.c: cpl_stats_new_from_image(): Propagate error from cpl_stats_new_from_image_window() 2008-03-10 11:14 llundin * cplcore/tests/cpl_stats-test.c: Add tests of NULL-pointers and consistency of mode-flags 2008-03-10 11:00 llundin * cplcore/cpl_stats.c: cpl_stats_dump(): Guard against NULL stream (DFS05138) 2008-03-10 10:22 llundin * cplcore/tests/cpl_image_bpm-test.c: cpl_test(), cpl_test_zero(), cpl_test_nonnull(), cpl_test_eq() replaces assert() 2008-03-10 10:07 llundin * cplcore/tests/cpl_stats-test.c: Use cpl_test_rel(), cpl_test_nonnull() 2008-03-07 15:29 llundin * cplcore/cpl_matrix.c: cpl_matrix_get_stdev(): Use cpl_tools_get_variance_double() (DFS05126) 2008-03-07 15:27 llundin * cplcore/tests/cpl_matrix-test.c: main(): Add unit test of cpl_matrix_get_stdev() 2008-03-07 15:04 llundin * cplcore/: cpl_polynomial.c, cpl_tools.c, cpl_tools.h, cpl_vector.c, tests/cpl_bivector-test.c: cpl_tools_get_variance_double(): Use new algorithm, compute mean instead of expecting it 2008-03-07 15:03 llundin * cplcore/tests/cpl_vector-test.c: Added cpl_vector_get_stdev_bench() 2008-03-07 13:24 llundin * cplcore/cpl_vector.c: cpl_vector_fill_tanh_kernel(): Redeclare to cpl_error_code and guard against too long vectors (DFS05133) 2008-03-07 11:14 llundin * cplcore/tests/cpl_plot-test.c: cpl_vector_save_bench(), cpl_vector_get_diff(): Drop definition. main(): Do not fail on failed plotting, plot iff CPL_MSG_LEVEL is set below warning 2008-03-07 09:35 yjung * cplcore/tests/cpl_plot-test.c: missed #include 2008-03-06 17:03 llundin * cpldfs/: cpl_dfs.c, tests/cpl_dfs-test.c: cpl_dfs_update_product_header(): Allow (ignore) non-fits products 2008-03-06 16:34 llundin * cpljava/cpl_gasgano.c: doExec(): Ignore return status of cpl_dfs_update_product_header() 2008-03-04 10:06 cizzo * cplcore/cpl_column.c: Initialise new integer column buffer to zero - all elements remain invalid though. This is to avoid a warning by velgrind about uninitialised variables in cpl_table_save() 2008-03-03 16:03 llundin * cplcore/cpl_errorstate.c: @defgroup added 2008-03-03 11:25 llundin * cplcore/: cpl_error.c, cpl_error.h: cpl_error_{set,get}_message(): Fix doxygen (DFS05090) 2008-03-03 11:06 llundin * cplcore/tests/cpl_error-test.c: Use cpl_test_{eq,eq_string,zero}() instead of cpl_test() 2008-02-28 13:07 yjung * cplcore/cpl_image_filter.c: DFS04857 : improved the fitering documentation 2008-02-27 13:35 yjung * cplcore/: cpl_plot.c, cpl_plot.h, tests/cpl_plot-test.c: Ready for evaluation 2008-02-27 09:33 yjung * cplcore/tests/cpl_plot-test.c: [no log message] 2008-02-26 18:05 yjung * cplcore/tests/Makefile.am: added cpl_plot-test 2008-02-26 18:04 yjung * cplcore/tests/cpl_plot-test.c: [no log message] 2008-02-26 17:55 yjung * cplcore/: cpl_plot.c, cpl_plot.h: [no log message] 2008-02-26 17:48 yjung * cplcore/: Makefile.am, cpl_plot.c, cpl_plot.h: added cpl_plot.c .h for evaluation 2008-02-26 13:58 yjung * configure.ac: after the 4.1.0 release 2008-02-26 13:54 yjung * configure.ac: Package name -> 4.1.0 2008-02-26 13:28 scastro * Doxyfile.in: Removed cpl.css which was creating bad formatting in html pages. 2008-02-26 11:36 scastro * cpldrs/cpl_wcs.c: fixed typo in doxygen. 2008-02-26 11:29 yjung * Doxyfile.in: update config with doxygen -u 2008-02-26 11:29 yjung * libcext/cext/cxdeque.c: doxygen tag missing 2008-02-26 11:13 yjung * doxygen/Doxyfile.in: [no log message] 2008-02-26 10:53 yjung * cpldrs/cpl_detector.c: doxygen problem solved 2008-02-26 10:50 yjung * cplcore/cpl_test.h: doxygen description of a parameter corrected 2008-02-26 10:49 yjung * cpldrs/cpl_wcs.c: /** replaces /* for doxygen comments 2008-02-21 13:41 llundin * cplcore/cpl_test.c: cpl_test_get_description(): WCSLIB replaces LIBWCS 2008-02-14 16:01 yjung * configure.ac: package name -> 4.1.0cvs 2008-02-14 16:00 yjung * configure.ac: package name -> 4.1.0b3 2008-02-14 15:23 llundin * cplcore/: Makefile.am, cpl_init.c: cpl_get_description(): Add desc for WCSLIB 2008-02-14 09:51 llundin * cplcore/cpl_test.c: cpl_test_init(): exit() on cpl_init() failure 2008-02-13 14:15 llundin * cplcore/cpl_test.c: CPL_XSTRINGIFY(), CPL_STRINGIFY(): Moved to cpl_tools.h. cpl_test_init_macro(): Call cpl_get_description() 2008-02-13 14:14 llundin * cplcore/: cpl_init.c, cpl_init.h: cpl_get_description(): Added (DFS04975) 2008-02-13 14:12 llundin * cplcore/cpl_tools.h: CPL_XSTRINGIFY(), CPL_STRINGIFY(): Added 2008-02-13 13:44 llundin * cplcore/cpl_init.c: cpl_init(): Warn about unsupported CFITSIO version 2008-02-13 13:42 llundin * cplcore/cpl_test.c: cpl_test_init_macro(): Dump most recent error in cpl_init() 2008-02-13 09:55 llundin * cplcore/cpl_test.c: cpl_test_get_description(): Improved message 2008-02-12 10:09 llundin * cplui/cpl_recipedefine.h: CPL_RECIPE_DEFINE(): In cpl_plugin_get_info() print also compile-time CPL version number (using %X...) 2008-02-07 17:35 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_fit_gaussian(): Add error check on NULL image and too small size (DFS04939) 2008-02-07 17:30 llundin * cplcore/cpl_image_basic.c: cpl_image_fit_gaussian(): Avoid cast of float image, split multiple error checks into single ones, updated doxygen on size (4) 2008-02-07 17:28 llundin * cplcore/: cpl_image_iqe.c, tests/cpl_image_iqe-test.c: cpl_image_iqe(): Guard against too small images (DFS04939) 2008-02-07 11:54 llundin * cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_errorstate-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_stats-test.c, cplcore/tests/cpl_vector-test.c, cpldfs/tests/cpl_dfs-test.c, cpldrs/tests/cpl_apertures_img-test.c, cpldrs/tests/cpl_fit-test.c, cpldrs/tests/cpl_photom-test.c, cplui/tests/cpl_frameset_io-test.c, cplui/tests/cpl_recipedefine-test.c: cpl_test() -> cpl_test_zero() 2008-02-07 11:47 llundin * cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_memory-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_stats-test.c, cpldrs/tests/cpl_wcs-test.c, cplui/tests/cpl_frameset_io-test.c: cpl_test() -> cpl_test_error() 2008-02-07 11:38 llundin * cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_vector-test.c, cpldrs/tests/cpl_photom-test.c: cpl_test() -> cpl_test_nonnull() 2008-02-07 11:30 llundin * cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cpldrs/tests/cpl_apertures_img-test.c, cpldrs/tests/cpl_fit-test.c, cpldrs/tests/cpl_wcs-test.c, cplui/tests/cpl_frameset_io-test.c: cpl_test() -> cpl_test_{,non}null() 2008-02-07 11:22 llundin * cplcore/tests/cpl_test-test.c: Test cpl_test_zero() 2008-02-07 11:18 llundin * cplcore/: cpl_test.c, cpl_test.h: cpl_test_zero(): Added. cpl_test(): Improve report on success 2008-02-07 11:15 llundin * cplui/tests/cpl_recipedefine-test.c: cpl_recipedefine_test(): Define prestate 2008-02-04 15:16 scastro * cplui/cpl_parameter.c: cpl_parameter_new_value(): fixed doxygen text. 2008-02-01 15:59 yjung * cpldrs/cpl_wlcalib_xc.c: allow degree = 4 2008-01-31 14:15 llundin * cplcore/cpl_test.h: Improve doxygen 2008-01-31 11:45 llundin * cplcore/cpl_test.c: cpl_test_end(): Fixed msg typo 2008-01-31 10:45 llundin * cpl.h, cplui/Makefile.am, cplui/cpl_recipedefine.h, cplui/tests/Makefile.am, cplui/tests/cpl_recipedefine-test.c: Added CPL recipe definition macro with unit test 2008-01-30 14:27 yjung * configure.ac: package name -> 4_1_0cvs 2008-01-30 14:26 yjung * configure.ac: package name -> 4.1.0b2 2008-01-30 14:07 yjung * cpldrs/: cpl_wcs.c, tests/cpl_wcs-test.c: Use CPL_ERROR_NO_WCS as an error code in the cpl_wcs functions if WCSLIB is not installed. 2008-01-30 13:44 yjung * cplcore/: cpl_error.c, cpl_error.h: added CPL_ERROR_NO_WCS new error code 2008-01-30 13:19 yjung * cplcore/cpl_image_filter.c: change constraint on kernel size for cpl_image_filter_median() 2008-01-29 11:50 llundin * cpldfs/cpl_dfs.c: cpl_dfs_setup_product_header(): Move declaration int pro_science to beginning of scope 2008-01-29 11:29 cizzo * cplcore/cpl_table.c: In cpl_table_save() move declaration of variable at top of scope 2008-01-29 10:43 yjung * cpldrs/tests/cpl_wcs-test.c: Check if CPL_WCS installed 2008-01-29 10:33 scastro * cpldrs/cpl_wcs.c: Replaced M_TWOPI by the CPL analogous, CPL_MATH_2PI. 2008-01-28 10:33 yjung * cplcore/cpl_tools.c: DFS04883: DICB sorting is incomplete in cpl_fits_property_get_type() 2008-01-24 10:05 scastro * cpldrs/cpl_wcs.c: Included stdio.h for snprintf() 2008-01-23 16:25 cizzo * cpldfs/cpl_dfs.c: cpl_dfs_setup_product_header(), improve comments of keywords PRO.TECH and PRO.SCIENCE according to DFO directives 2008-01-23 14:28 yjung * configure.ac: [no log message] 2008-01-23 14:27 yjung * configure.ac: -> 4.1.0b1 2008-01-23 14:02 cizzo * cpldfs/cpl_dfs.c: In cpl_dfs_setup_product_header() fix the check is-FITS made on the wrong file 2008-01-23 13:36 cizzo * cpldfs/cpl_dfs.c: In cpl_dfs_setup_product_header() extend support for PRO.TYPE, PRO.TECH, PRO.SCIENCE 2008-01-23 09:06 llundin * cplcore/cpl_init.c: cpl_init(): CPL_MEMORY_MODE overwrites the default CPL memory mode 2008-01-23 08:57 llundin * cplcore/cpl_memory.c: cpl_memory_is_empty(): Remove QFITS reference 2008-01-22 17:27 scastro * cpldrs/tests/cpl_wcs-test.c: New test for cpl_wcs_platesol(). 2008-01-22 17:26 scastro * cpldrs/cpl_wcs.c: New function cpl_wcs_platesol(). Removed unused variables. Included missing return value in function cpl_wcs_platesol(). 2008-01-22 17:24 scastro * cpldrs/cpl_wcs.h: New version delivered. Prototype of new function cpl_wcs_platesol(). 2008-01-22 16:14 yjung * cpldrs/tests/: Makefile.am, cpl_wcs-test.c: [no log message] 2008-01-22 15:37 cizzo * cpldfs/cpl_dfs.c: In cpl_dfs_setup_product_header() add support for PRO.TYPE, PRO.TECH, PRO.SCIENCE 2008-01-21 14:53 yjung * cpldrs/cpl_wcs.h: removed #ifdef CPL_WCS_INSTALLED from cpl_wcs.h 2008-01-21 14:05 cizzo * cplcore/cpl_table.c: Fix DFS04866: cpl_table_save() can now overwrite also a non-FITS file 2008-01-21 09:15 yjung * cplcore/cpl_imagelist_io.c: [no log message] 2008-01-17 16:23 llundin * cplcore/cpl_test.c: cpl_test_end(): Add counter of tests 2008-01-16 13:55 yjung * cpldrs/Makefile.am, cpldrs/cpl_wcs.c, cpldrs/cpl_wcs.h, m4/cpl.m4: Add conditional compilation of cpl_ws 2008-01-16 13:40 yjung * m4/cpl.m4: added definition for CPL_WCS_INSTALLED 2008-01-16 13:11 yjung * cpldrs/Makefile.am: removed wcslib.h 2008-01-16 13:11 yjung * cpldrs/wcsconfig.h: removed 2008-01-15 13:54 yjung * cplcore/cpl_image_basic.c: DFS04843 : added doc 2008-01-11 11:35 llundin * cplcore/cpl_test.h: cpl_test_error(): Fix doxygen 2008-01-11 11:33 yjung * cpldrs/: Makefile.am, wcsconfig.h: [no log message] 2008-01-11 09:51 yjung * cpldrs/: cpl_wcs.c, cpl_wcs.h: moved include wcslib.h from .h to .c 2008-01-10 17:56 yjung * Doxyfile.in, Makefile.am, README.CVS, acinclude.m4, configure.ac, cpl.h, cpldrs/Makefile.am, cpldrs/cpl_wcs.c, cpldrs/cpl_wcs.h, m4/cpl.m4: USE EXTERNALLY installed WCSLIB 4.3 - specified with WCSDIR 2008-01-10 17:05 yjung * cpldrs/: cpl_wcs.c, cpl_wcs.h: [no log message] 2008-01-10 13:52 llundin * cplcore/cpl_tools.c: cpl_polynomial_shift_double(): Correct FLOP count 2008-01-09 15:12 scastro * libcext/configure.ac: Removed -pedantic from this file to avoid errors in Solaris 10. 2008-01-08 10:41 yjung * cpldfs/cpl_dfs.c: DFS04786: removed writing of PRO TYPR = REDUCED 2008-01-07 14:42 yjung * m4/cpl.m4: [no log message] 2008-01-07 13:20 yjung * m4/cpl.m4: Only Warning if CFITSIO version is not good. 2008-01-07 10:31 llundin * libcext/cext/cxutils.c: cx_vasprintf(): Define-guard on ENOMEM 2007-12-27 16:49 scastro * libcext/configure.ac: Removed -ansi and -std=c99. THESE FLAGS MAKE COMPILATION FAIL IN THE HP MACHINE (dfs5). THE CX LIBRARY IS MEANT TO BE POSIX COMPLIANT, WHICH IS CONTRARY TO ANSI OR C99. 2007-12-27 13:50 scastro * cplcore/cpl_msg.c: cpl_msg_out(): TEST. Initialized msg_text[], msg_log[] and msg_term[]. 2007-12-21 16:58 cguirao * Makefile.am, Makefile.purify.in, configure.ac, cplcore/tests/Makefile.am, cpldfs/tests/Makefile.am, cpldrs/tests/Makefile.am, cplui/tests/Makefile.am, libcext/Makefile.am, libcext/Makefile.purify.in, libcext/configure.ac, libcext/m4/purify.m4, libcext/tests/Makefile.am, m4/purify.m4: PURIFY NRI Compliant 2007-12-21 14:17 llundin * cplcore/tests/cpl_memory-test.c: cpl_memory_dump() at info level. Cause a resize of the memory table 2007-12-21 14:17 llundin * cplcore/cpl_xmemory.c: cpl_xmemory_init(): calloc() the memory table, and resize as needed 2007-12-20 15:56 llundin * cplcore/cpl_xmemory.c: cpl_xmemory_status(): For Memory Still Allocated report only number of pointers, when that number is zero 2007-12-20 12:54 llundin * cplcore/tests/cpl_msg-test.c: Call cpl_msg_indent_more/less(), cpl_msg_set_time_on() (on terminal), cpl_msg_info() (on too long message) 2007-12-20 12:53 llundin * cplcore/: cpl_msg.c, cpl_msg.h: cpl_msg_get_domain(): Replace old-style declaration with proper one 2007-12-20 09:49 llundin * libcext/cext/cxfileutils.c: cx_path_alloc(): Use only stat() when S_ISDIR() is defined. cx_path_max(): Guard pathconf() against NULL (and try to avoid compiler warning on unavailable pathconf() 2007-12-18 16:02 llundin * cplcore/tests/cpl_memory-test.c: Choose non-zero number of pointers in benchmark for mode 1 2007-12-18 15:50 llundin * cplcore/cpl_xmemory.c, cplcore/tests/Makefile.am, cplcore/tests/cpl_memory-test.c, m4/cpl.m4: Always define both CPL_XMEMORY_MODE and CPL_XMEMORY_MAXPTRS - and use them in unit testing 2007-12-18 10:20 llundin * cplcore/cpl_xmemory.c: cpl_xmemory_realloc_count(): Wrap around cpl_xmemory_malloc_count() on NULL, detect invalid pointer on ncells = 0. Improve messaging, fix cast warnings 2007-12-17 16:36 llundin * cplcore/cpl_xmemory.c: cpl_xmemory_findfree(): Added with code removed from cpl_xmemory_addcell(). cpl_xmemory_realloc(): Reuse pos when pointer unchanged 2007-12-17 15:09 llundin * cplcore/: cpl_memory.c, cpl_xmemory.c, cpl_xmemory.h: cpl_xmemory_{{m,c,re}alloc,free}(): Replace __FILE__, __LINE__ with type. cpl_memory_init(): Register the system/xmemory functions directly. cpl_xmemory_addcell(): Find free cell with memchr() 2007-12-17 11:02 llundin * libcext/cext/cxmemory.c: cx_realloc(): Move declaration to start of block 2007-12-17 09:36 llundin * cplcore/cpl_xmemory.c: cpl_xmemory_alloc(): Remove. Inline short functions 2007-12-14 19:05 llundin * cplcore/cpl_xmemory.c: Fixed warnings: tatic counters, cast of size_t for fprintf() 2007-12-14 15:58 llundin * cplcore/tests/cpl_memory-test.c: Add memory benchmark 2007-12-14 15:27 llundin * cplcore/cpl_xmemory.c: Reduce pointer checks in memory mode 1 allocation 2007-12-14 14:56 llundin * cplcore/cpl_xmemory.c: Initilized static variables replaces xmemory struct. Detect memory leaks also in mode 1. Mode 2 allocates using mode 1 routines 2007-12-14 14:54 llundin * cplcore/tests/cpl_memory-test.c: test cpl_memory_is_empty() 2007-12-14 14:54 llundin * cplcore/: cpl_test.c, cpl_test.h: cpl_test_memory_is_empty(): Added 2007-12-14 13:08 llundin * cplcore/: cpl_memory.c, cpl_xmemory.c, cpl_xmemory.h: cpl_xmemory_status(), cpl_xmemory_is_empty(): Take mode as parameter 2007-12-14 11:57 llundin * cplcore/: cpl_memory.c, cpl_xmemory.c, cpl_xmemory.h: cpl_xmemory_{{m,c,re}alloc,free}_nocell(): Added for xmemory-mode = 1 2007-12-14 10:11 llundin * cplcore/: cpl_init.c, cpl_memory.c, cpl_memory_impl.h: cpl_memory_init(): Take int CPL_XMEMORY_MODE 2007-12-14 10:10 llundin * cplcore/: cpl_xmemory.c, cpl_xmemory.h: No default for CPL_XMEMORY_MODE. cpl_xmemory_strdup(): Removed (unused) 2007-12-14 09:14 llundin * libcext/cext/cxmemory.c: cx_realloc(): Fix memory leak on nbytes == 0 (DFS04757) 2007-12-14 09:06 llundin * cplcore/cpl_xmemory.c: PTR_HASH(): Cast to int. cpl_xmemory_init(): init _p_val. cpl_xmemory_addcell(): Drop return value 2007-12-13 18:12 llundin * cplcore/cpl_xmemory.c: cpl_xmemory_p_val[] const. alloc_total, MEMPAGESZ dropped. cpl_xmemory_findcell(): added. cpl_xmemory_addcell(), cpl_xmemory_remcell(): void. cpl_xmemory_alloc(): Added. cpl_xmemory_{m,c,re}alloc(): Wrap around cpl_xmemory_alloc() using corresponding system alloc-call. Branch on CPL_XMEMORY_MODE at compile time. strdup_(): Dropped 2007-12-13 16:21 llundin * cplcore/cpl_tools.c: CPL_XSTRINGIFY(), CPL_STRINGIFY(): Dropped 2007-12-13 11:28 llundin * cplcore/tests/cpl_memory-test.c: Test cpl_{m,c,re}alloc() on zero size 2007-12-13 09:49 scastro * BUGS: Included mention to memory leak in wcslib. 2007-12-12 16:18 llundin * cplcore/cpl_xmemory.c: cpl_xmemory_malloc(): Solve NULL-pointer problem by dropping linux specific code, assert() on NULL, remove unused variables. cpl_xmemory_hash(): Removed. cpl_xmemory_status_(): Removed 2007-12-12 13:10 scastro * libcext/cext/cxstring.c: cx_string_truncate(): renamed MIN to CX_MIN 2007-12-12 13:09 scastro * libcext/cext/cxmacros.h: Namespace protected the following: CX_MIN, CX_MAX, CX_ABS, CX_CLAMP 2007-12-12 12:52 yjung * doxygen/cplref_introduction.tex: rm qfits ref 2007-12-12 12:50 yjung * doxygen/cplref_installation.tex: removed qfits ref 2007-12-12 12:48 yjung * README: -> 4.1.0 2007-12-12 12:46 yjung * configure.ac: 4.1.0a1 -> 4.1.0cvs 2007-12-12 12:42 yjung * configure.ac: 4.0.0cvs -> 4.1.0a1 2007-12-11 16:07 scastro * cplcore/tests/cpl_propertylist-test.c: Fixed typo. 2007-12-11 15:44 scastro * libcext/cext/cxmacros.h: Changed from #undef to #ifndef the following: MIN, MAX, ABS, CLAMP as mentioned in DFS 03017 2007-12-11 15:42 llundin * cplcore/tests/cpl_polynomial-test.c: Raise bar for valgrind 2007-12-11 14:49 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_error_set(): Removed 2007-12-11 14:42 llundin * cplcore/tests/: cpl_bivector-test.c, cpl_image_iqe-test.c, cpl_imagelist_io-test.c, cpl_matrix-test.c, cpl_memory-test.c, cpl_polynomial-test.c, cpl_vector-test.c: Use cpl_test_error(), cpl_test_{,non}null() etc. 2007-12-11 14:41 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_divide(): Check bpm on zero-division, use cpl_test_error() etc 2007-12-11 13:15 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_test_nonnull(), cpl_test_error(), cpl_test_eq_string() replaces cpl_test(), cpl_test_error_set() 2007-12-11 13:07 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_test_error() replaces cpl_test(), cpl_test_error_set() 2007-12-11 12:58 llundin * cpldrs/tests/: cpl_apertures-test.c, cpl_apertures_img-test.c, cpl_fit-test.c: cpl_test_error() replaces cpl_test(), cpl_test_error_set() 2007-12-11 11:36 llundin * cplui/tests/: cpl_frameset-test.c, cpl_frameset_io-test.c: cpl_test_error() replaces cpl_test_eq(), cpl_test_error_set() 2007-12-11 11:12 llundin * cplcore/: cpl_test.c, cpl_test.h: cpl_test_reset(): Made static 2007-12-11 11:11 llundin * cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_errorstate-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_iqe-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_memory-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_vector-test.c, cpldfs/tests/cpl_dfs-test.c, cpldrs/tests/cpl_apertures-test.c, cpldrs/tests/cpl_apertures_img-test.c, cpldrs/tests/cpl_fit-test.c, cplui/tests/cpl_frameset-test.c, cplui/tests/cpl_frameset_io-test.c: cpl_test_error_set() replaces cpl_test_reset() 2007-12-11 09:54 scastro * cplcore/tests/cpl_propertylist-test.c: Increased tests for removal of compression keywords. 2007-12-11 09:54 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_save(): include removal of compression keywords when saving a property list. 2007-12-06 18:32 scastro * cplcore/tests/cpl_propertylist-test.c: Removed tests that used internal functions get_first and get_next, which have been removed from cpl. 2007-12-06 18:31 scastro * cplcore/cpl_propertylist_impl.h: Removed prototypes of internal functions: cpl_propertylist_get_first(), _first_const(), _get_next(), _next_const(). 2007-12-06 18:18 scastro * cplcore/cpl_propertylist.c: Removed internal functions: cpl_propertylist_get_first(), get_firts_const(), get_next(), get_next_const(). Removed temporaty cx_deque_iterator pos from propertylist structure because it was only needed for the get_first and get_next functions. 2007-12-06 17:50 scastro * cplcore/Makefile.am: Removed PLIST_CFLAGS. 2007-12-06 17:49 scastro * cplcore/cpl_propertylist.c: Removed cpl_propertylist based on cx_list. The basic type now is cx_deque. Removed #ifdef PLIST. 2007-12-06 15:30 yjung * cplcore/: cpl_image_io.c, cpl_imagelist_io.c, cpl_vector.c: added removal of FITS COMPRESSION KEYS in the products 2007-12-06 13:31 scastro * cplcore/cpl_table.c: cpl_table_save(): renamed to CPL_FITS_COMPRKEYS. 2007-12-06 13:30 scastro * cplcore/cpl_tools.h: renamed CPL_FITS_COMPRESSEDKEYS to CPL_FITS_COMPRKEYS 2007-12-06 13:25 scastro * cplcore/tests/cpl_propertylist-test.c: Added test 24 to check the removal of compressed keywords from the header when saving a table. 2007-12-06 13:24 scastro * cplcore/cpl_table.c: cpl_table_save(): Added CPL_FITS_COMPRESSEDKEYS in calls to cpl_fits_add_properties(), to removed compressed keywords when saving a table. 2007-12-06 13:22 scastro * cplcore/cpl_tools.h: New define CPL_FITS_COMPRESSEDKEYS which contains a regular expression with keywords describing compressed files. 2007-12-05 16:51 scastro * cplcore/tests/cpl_msg-test.c: Included tests for DFS02594. 2007-12-05 16:50 scastro * libcext/configure.ac: Placed ESO_PROG_CC_FLAG([ansi], [CFLAGS="$CFLAGS -ansi"]) before the call to std=c99 so that it allows checking for C99 semantics in vsnprintf tests which are performed in eso.m4. This should fix ticket DFS02594. 2007-12-05 16:48 scastro * libcext/m4/eso.m4: Fixed typos related to brackets. Included stdlib.h in check whether vsnprintf() has C99 semantics. These changes, in combination with the change in configure.ac should fix the bug mentioned in DFS02594. 2007-12-04 12:59 yjung * m4/cpl.m4: [no log message] 2007-12-04 12:55 yjung * m4/cpl.m4: added LIBCPLWCS 2007-12-04 10:58 yjung * cpldrs/: cpl_wcs.c, cpl_wcs.h, tests/cpl_wcs-test.c: [no log message] 2007-12-04 10:55 yjung * Doxyfile.in, Makefile.am, README.CVS, acinclude.m4, configure.ac, cpl.h: added CPLWCS subdirectory / library - IMPORTED from WCSLIB-4.2/C 2007-11-30 14:42 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_to_fitsfile(): explicit variable initialization added. 2007-11-29 12:39 llundin * cplui/cpl_frameset_io.c: cpl_imagelist_load_frameset(): Fix mem-leak on empty imagelist 2007-11-29 09:25 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_error_set(): Added 2007-11-28 16:31 yjung * cplcore/tests/cpl_fits-test.c: [no log message] 2007-11-28 16:24 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_neq() renamed to cpl_test_noneq(). cpl_test_null(), cpl_test_error() added 2007-11-28 16:23 llundin * cplcore/tests/Makefile.am: Added cpl_test module 2007-11-27 17:07 cizzo * cplcore/: cpl_msg.c, cpl_msg.h: Add new function cpl_msg_get_domain() 2007-11-27 17:06 cizzo * cplcore/tests/cpl_msg-test.c: Add test on cpl_msg_get_domain() 2007-11-27 16:30 scastro * cpldrs/cpl_wcs.c: Adapted to the change in API of cpl_propertylist_to_fitsfile(). 2007-11-27 16:20 scastro * cpldrs/cpl_wcs.c: Fixed bug in _id of cpl_error_msg() as mentioned in DFS04314 2007-11-27 16:12 cizzo * cplcore/cpl_matrix.c: Upgrade doc for function cpl_matrix_power() 2007-11-27 15:40 cizzo * cplcore/cpl_matrix.c: In case of exponent 0.5 sqrt() is used for speedup 2007-11-27 13:13 cizzo * cplcore/cpl_table.c: Upgrade doc of cpl_table_sort() 2007-11-27 12:00 cizzo * cplcore/cpl_table.c: Now cpl_table_sort() does modify pointer to sorted columns 2007-11-27 11:57 cizzo * cplcore/tests/cpl_table-test.c: Add unit test about cpl_table_sort() 2007-11-27 10:27 scastro * cplcore/tests/cpl_propertylist-test.c: Included test 23 to test new API of cpl_propertylist_to_fitsfile(). 2007-11-27 10:26 scastro * cplcore/cpl_tools.c: cpl_fits_add_properties(): removed the call to cpl_propertylist_copy_property_regexp() in favour of the new API of cpl_propertylist_to_fitsfile(). 2007-11-27 10:23 scastro * cplcore/cpl_propertylist_impl.h: new prototype for cpl_propertylist_to_fitsfile(): changed API to take a new argument, which is a const char *to_rm as a regular expression to filter keywords. 2007-11-27 10:22 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_to_fitsfile(): changed API to take a new argument, which is a const char *to_rm as a regular expression to filter keywords. For rhis, I have also included a new inline function called _cpl_propertylist_to_fitsfile(). 2007-11-26 10:23 yjung * configure.ac: 4.0cvs -> 4.0.0cvs 2007-11-26 10:15 yjung * cplcore/: cpl_propertylist.c, tests/cpl_fits-test.c: allow to pass pl=NULL to cpl_propertylist_save() 2007-11-26 09:06 llundin * cplui/cpl_frameset_io.c: cpl_fits_has_image(): fits_get_img_dim() replaces fits_read_key() 2007-11-26 08:34 llundin * cplui/: cpl_frameset_io.c, tests/cpl_frameset_io-test.c: cpl_imagelist_load_frameset(): Allow only 1st HDU to not have image data (as before), require created imagelist to be non-empty (as before) 2007-11-23 21:57 llundin * cplcore/cpl_matrix.c: cpl_matrix_get_data_const(): fixed warnings 2007-11-23 20:32 llundin * cplui/: cpl_frameset_io.c, tests/cpl_frameset_io-test.c: cpl_fits_has_image(): Added. cpl_imagelist_load_frameset(): Check for image data using cpl_fits_has_image(), and fail on invalid requests on primary header 2007-11-23 19:06 llundin * cplui/cpl_frameset_io.c: cpl_imagelist_append_from_file(): Added. _cpl_frameset_check_hdu(): Dropped due to redundant image load. cpl_imagelist_load_frameset(): Drop _cpl_frameset_check_hdu, use cpl_imagelist_append_from_file() 2007-11-23 19:04 llundin * cplui/tests/cpl_frameset_io-test.c: cpl_imagelist_load_frameset(): Add test on empty frameset 2007-11-23 17:03 llundin * cplui/cpl_frameset_io.c: _cpl_frameset_check_hdu(): Take filename. cpl_imagelist_load_frameset(): Improve doxygen, avoid cpl_frame_get_nextensions() on extnum non-negative, avoid cpl_frameset_get_frame_const()+cpl_frameset_get_size() 2007-11-23 17:01 llundin * cplui/tests/cpl_frameset_io-test.c: Fixed memory leak 2007-11-23 14:32 llundin * cplui/tests/cpl_frameset_io-test.c: cpl_imagelist_load_frameset(): Cover error handling, verify plane number on a range of calls 2007-11-23 13:23 llundin * cplcore/: cpl_test.c, cpl_test.h, tests/cpl_test-test.c: cpl_test_nonnull(), cpl_test_neq(): Added 2007-11-23 11:17 scastro * cplcore/tests/cpl_propertylist-test.c: Included Test 22 for cpl_propertylist_save(). 2007-11-22 16:08 yjung * cplcore/cpl_propertylist.c: [no log message] 2007-11-22 15:17 yjung * cplcore/tests/cpl_fits-test.c: [no log message] 2007-11-22 15:07 yjung * cplcore/tests/: cpl_fits-test.c: [no log message] 2007-11-22 15:00 yjung * cplcore/: cpl_propertylist.c, tests/cpl_fits-test.c: [no log message] 2007-11-22 14:25 yjung * cplcore/: cpl_propertylist.c, cpl_propertylist.h: added cpl_propertylist_save() 2007-11-22 12:04 yjung * cplcore/cpl_fits.c: [no log message] 2007-11-22 11:18 llundin * cplcore/cpl_test.h: include cpl_msg.h, cpl_type.h 2007-11-22 11:12 yjung * cplcore/tests/cpl_fits-test.c: [no log message] 2007-11-22 10:56 yjung * cplcore/cpl_fits.h: [no log message] 2007-11-22 10:45 yjung * cplcore/tests/: Makefile.am, cpl_fits-test.c: [no log message] 2007-11-22 10:44 yjung * cpl.h, cplcore/Makefile.am, cplcore/cpl_fits.c, cplcore/cpl_fits.h: added cpl_fits module 2007-11-22 09:58 yjung * cplcore/cpl_imagelist_basic.c: the created image in cpl_imagelist_collapse_create() has a NULL bpm if there are none (DFS04143) 2007-11-22 09:48 yjung * cplcore/tests/cpl_mask-test.c: add test for cpl_mask_count_window() 2007-11-22 09:41 yjung * cplcore/: cpl_mask.c, cpl_mask.h: added cpl_mask_count_window 2007-11-22 08:45 llundin * cplcore/: Makefile.am, cpl_image_filter.c, cpl_image_stats.c, cpl_mask.c, cpl_mask.h, cpl_mask_impl.h, tests/cpl_mask-test.c: cpl_mask_is_empty(), cpl_mask_is_empty_window(): Export (DFS04640) 2007-11-21 16:15 llundin * cplcore/cpl_test.c: cpl_test_end(): Improve doxygen on nfail 2007-11-21 14:17 scastro * BUGS: Added not about warnings caused in regcomp() of the C library. See DFS04623. 2007-11-21 09:58 llundin * cplcore/cpl_test.c: cpl_test_end(): Drop PACKAGE name on failure 2007-11-21 09:58 llundin * cplcore/tests/cpl_matrix-test.c: main(): cpl_msg_info() replaces cpl_msg_warning() on near-singular matrix 2007-11-20 15:00 yjung * acinclude.m4: Still for MAcOS support 2007-11-20 13:33 yjung * acinclude.m4: cpl_with_java_include -> cpl_with_java_includes - typo that prevented --with-java-includes to possibly work !!! (DFS03891 part 2) 2007-11-20 11:38 yjung * acinclude.m4: added support for java on Mac OS X (DFS03891) 2007-11-19 17:53 yjung * cplcore/cpl_xmemory.c: rm warning 2007-11-19 17:34 yjung * libcext/cext/cxutils.c: free() used instead of cx_free(). Bug exposed on MacOS X where vasprintf() were avaliable DFS03194 2007-11-19 16:06 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_to_fitsfile(): using cpl_error_set_macro() to catch CFITSIO errors and pass them to the user. Removed cx_print. 2007-11-19 14:03 yjung * cplcore/cpl_vector.c: add doc for DFS03972 2007-11-19 13:26 yjung * cplcore/: cpl_image_basic.c, tests/cpl_image_basic-test.c: DFS03177 : cpl_image_fit_gaussian() calls now cpl_image_iqe() 2007-11-19 13:15 yjung * cplcore/cpl_image_iqe.c: added a missing include 2007-11-16 13:58 llundin * cpldfs/cpl_dfs.c: cpl_dfs_update_product_header(): Drop place-holder special key 2007-11-16 10:36 llundin * cpldfs/cpl_dfs.c: Added defines for DATAMD5 and DATAMD5_PLACEHOLDER 2007-11-15 08:57 llundin * cplcore/cpl_test.h: Check for support of GCC nonnull attribute and use it also with cpl_test_eq_string_macro() 2007-11-14 12:03 llundin * cpldfs/cpl_dfs.c: cpl_dfs_update_product_header(): Support place-holder COMMENT DATAMD5 2007-11-14 10:55 yjung * cplcore/: cpl_imagelist_io.c, tests/cpl_imagelist_io-test.c: Add support for extensions in cpl_imagelist_save() 2007-11-14 10:07 yjung * cplcore/: cpl_image_resample.c, tests/cpl_image_resample-test.c: added DOC and unit tests 2007-11-13 15:33 llundin * libcext/cext/cxfileutils.c: Guarded include of sys/types.h to support -ansi on HP-UX 2007-11-13 15:32 yjung * cplcore/cpl_image_resample.c: [no log message] 2007-11-13 15:27 yjung * cplcore/: cpl_image_resample.c, cpl_image_resample.h, cpl_image_resample_body.h: added cpl_image_warp() 2007-11-13 15:23 llundin * cplcore/tests/: cpl_polynomial-test.c, cpl_vector-test.c: Compensate for cpl_error_margin set to 1 2007-11-13 15:07 llundin * cplcore/tests/cpl_math-test.c: cpl_test_rel() replaces cpl_test_leq() 2007-11-13 14:22 llundin * cpldrs/cpl_detector.c: cpl_flux_get_noise_ring(): cpl_error_set_message_macro() replaces cpl_error_set_message() 2007-11-13 14:13 llundin * cplcore/cpl_test.c, cplcore/cpl_test.h, cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_error-test.c, cplcore/tests/cpl_errorstate-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_bpm-test.c, cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_gen-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_image_iqe-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_mask-test.c, cplcore/tests/cpl_math-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_memory-test.c, cplcore/tests/cpl_msg-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_stats-test.c, cplcore/tests/cpl_test-test.c, cplcore/tests/cpl_vector-test.c, cpldfs/tests/cpl_dfs-test.c, cpldrs/tests/cpl_apertures-test.c, cpldrs/tests/cpl_apertures_img-test.c, cpldrs/tests/cpl_detector-test.c, cpldrs/tests/cpl_fit-test.c, cpldrs/tests/cpl_geom_img-test.c, cpldrs/tests/cpl_photom-test.c, cpldrs/tests/cpl_wcs-test.c, cplui/tests/cpl_frameset-test.c, cplui/tests/cpl_frameset_io-test.c: cpl_test_init(): Take also PACKAGE_BUGREPORT 2007-11-13 10:44 llundin * cplcore/tests/cpl_test-test.c: Test also expected failures 2007-11-13 10:16 llundin * cplcore/cpl_test.c: cpl_test_end(): Dump errorstate on failed test 2007-11-09 16:34 scastro * cplcore/tests/cpl_propertylist-test.c: Included #ifdef HAVE_CONFIG_H to remove warning related to CPL_MAJOR_VERSION. Modified #if CPL_MAJOR_VERSION to >= 5 in test 14b. 2007-11-09 16:33 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_erase_regexp(): changed #if CPL_MAJOR_VERSION to >= 5 2007-11-09 15:34 llundin * cplcore/cpl_test.c: cpl_test_eq_string_macro(): Avoid cpl_strdup() 2007-11-09 13:00 llundin * cplcore/tests/: Makefile.am, cpl_test-test.c: Added unit tests of unit test module 2007-11-09 12:18 llundin * cplcore/tests/cpl_polynomial-test.c: Use cpl_test_rel() and cpl_test_abs() 2007-11-09 12:17 llundin * cplcore/: cpl_test.c, cpl_test.h: cpl_test_eq(), cpl_test_eq_string(), cpl_test_abs(), cpl_test_rel(): Added 2007-11-08 15:54 llundin * libcext/m4/eso.m4: AC_DEFUN([ESO_ENABLE_STRICT]: [std=c99] replaces [-std=c99] 2007-11-08 15:24 yjung * configure.ac: 4.0.1 -> 4.0.1cvs 2007-11-08 15:23 yjung * configure.ac: 4.0cvs -> 4.0.1 2007-11-08 13:49 scastro * cplcore/tests/cpl_propertylist-test.c: Test 14b: included a #if around the return values in case of error so that it returns -1 when CPL_MAJOR_VERSION == 5 otherwise it returns 0. This #if should be removed after cpl-5.0 is released. 2007-11-08 13:49 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_erase_regexp(): included a #if around the return values in case of error so that it returns -1 when CPL_MAJOR_VERSION == 5 otherwise it returns 0. This #if should be removed after cpl-5.0 is released. 2007-11-08 12:08 llundin * cplcore/cpl_msg.c: cpl_msg_init(), cpl_msg_stop(): Duplicate streams and change line width only on supported systems 2007-11-08 12:07 llundin * configure.ac: Check for presence of non-C99 functions 2007-11-08 11:14 scastro * cplcore/tests/cpl_propertylist-test.c: Test 14b: Rollback previous change on the return value when an error occurs. It is set to 0. 2007-11-08 11:12 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_erase_regexp(): rollback previous change on the return value when an error occurs. It is set to 0. 2007-11-08 10:04 llundin * libcext/configure.ac: Added -fno-common -std=c99 -ansi -pedantic 2007-11-08 09:54 llundin * libcext/cext/cxdeque.c: cx_deque_insert(): /* */ comment replaces // 2007-11-07 14:38 cizzo * cplcore/cpl_msg.c: Truncate too long messages instead of corrupting memory 2007-11-07 14:09 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h, cpl_image_stats_body.h: cpl_image_extract(), cpl_image_get_median_window(): Use cpl_tools_copy_window() 2007-11-07 14:08 llundin * cplcore/: cpl_tools.c, cpl_tools.h: cpl_tools_copy_window(): Added 2007-11-07 13:18 llundin * cplcore/: Makefile.am, cpl_image_filter.c, cpl_image_stats.c, cpl_mask.c, cpl_mask_impl.h, tests/cpl_mask-test.c, cpl_mask.h: cpl_mask_is_empty(), cpl_mask_is_empty_window(): Do not export 2007-11-06 17:46 llundin * cplcore/cpl_image_filter.c: cpl_mask_has_rejected(): Dropped, use cpl_mask_is_empty() instead 2007-11-06 17:45 llundin * cplcore/: cpl_mask.c, cpl_mask.h, tests/cpl_mask-test.c: cpl_mask_is_empty() added 2007-11-06 17:16 llundin * cplcore/: cpl_image_stats.c, cpl_image_stats_body.h: cpl_image_get_median_window(): Transitive window bounds check, compute median without casting to double, use memcpy() to duplicate pixel buffer 2007-11-06 10:41 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: cpl_image_turn(): Avoid image duplication for 1D-images. cpl_vector_get_fwhm(): Fix compiler warning (y_[12] replaces y[12]). Improve documentation 2007-11-06 10:34 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_get_diff(): cpl_test() replaces assert() 2007-11-06 09:40 llundin * cplcore/: cpl_image_basic.c, cpl_mask.c: cpl_image_turn(), cpl_mask_turn(): Fix doxygen bug (DFS04637) 2007-11-06 09:25 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_turn_test(): Check direction of 90 degree rotation 2007-11-06 08:51 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: cpl_image_turn(): Fix a doxygen typo, avoid image duplication for rot=2 and for square images with rot=+/- 1 2007-11-05 18:36 llundin * cplcore/: cpl_mask.c, tests/cpl_mask-test.c: cpl_mask_turn(): Allow all values of rot and extend the unit test to verify the result 2007-11-05 17:53 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_turn_test(): Do actual unit-test of cpl_image_turn 2007-11-05 17:19 llundin * cplcore/tests/cpl_image_basic-test.c: CPL_MATH_E replaces E_VALUE 2007-11-05 16:28 yjung * cplcore/cpl_image_basic.c: [no log message] 2007-11-05 16:19 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: cpl_image_turn(): Sllow all values of rot 2007-11-05 16:10 yjung * cplcore/tests/cpl_image_basic-test.c: add tests for DFS02049 2007-11-05 16:03 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: cpl_image_extract(): cpl_image_wrap() replaces cpl_image_new 2007-11-05 15:45 yjung * cplcore/cpl_image_basic.c: DFS02049 : Handle the division by zero : set the pixel as bad if it occurs. 2007-11-05 11:35 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: cpl_image_extract(): Use memcpy() for extractions with more than a single column 2007-11-02 09:13 llundin * cpldfs/cpl_dfs.c: cpl_dfs_{image,table}_save(): Fix for DFS04585 copied from HEAD 2007-10-31 15:26 yjung * cplcore/: cpl_mask.c, cpl_mask.h, tests/cpl_mask-test.c: added cpl_mask_warp() cpl_mask_unwrap() 2007-10-31 14:46 yjung * cplcore/cpl_xmemory.c: [no log message] 2007-10-31 14:08 yjung * cplcore/cpl_xmemory.c, m4/cpl.m4: [no log message] 2007-10-30 17:21 yjung * cplcore/cpl_xmemory.c: [no log message] 2007-10-30 17:07 yjung * m4/cpl.m4: [no log message] 2007-10-30 16:34 yjung * cplcore/: cpl_xmemory.c, cpl_xmemory.h: Simplified : rm mmap calls and falloc fdealloc() 2007-10-30 15:56 yjung * m4/cpl.m4: [no log message] 2007-10-30 15:39 yjung * m4/cpl.m4: Add check on the CFITSIO version 2007-10-29 09:42 scastro * cplcore/cpl_propertylist.c: Included FIXME note in _cpl_propertylist_from_fitsfile() to be checked before next release in Dez 2007. 2007-10-26 12:26 scastro * cplcore/tests/cpl_propertylist-test.c: Included test 14b to catch the proper error code returned when regexp is NULL. 2007-10-26 12:25 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_erase_regexp(): Changed return value from 0 to -1 when an error occurs, to avoid conflicts with when n o entries are erased (and 0 is returned). See DFS04587. 2007-10-26 12:07 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_load() and cpl_propertylist_load_regexp(): Check for cfitsio error code END_OF_FILE when moving to the next HDU (cxlist version). 2007-10-26 12:01 scastro * cplcore/tests/cpl_propertylist-test.c: Included test 10a to verify the error code returned by cpl_propertylist_load() and cpl_propertylist_load_regexp() when a non-existent extension is requested. 2007-10-26 12:00 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_load() and cpl_propertylist_load_regexp(): Check for cfitsio error code END_OF_FILE when moving to the next HDU (deque version). 2007-10-26 09:16 llundin * cpldfs/cpl_dfs.c: cpl_dfs_update_product_header(): Improve doxygen 2007-10-25 13:52 cizzo * cplcore/cpl_table.c: Support TUSHORT in cpl_table_load() 2007-10-25 11:35 yjung * configure.ac: [no log message] 2007-10-24 17:16 scastro * Doxyfile.in: Included SORT_BRIEF_DOCS=yes to alphabetically sort functions inside each modules page. 2007-10-24 13:40 llundin * cpldfs/cpl_dfs.c: cpl_dfs_product_save(): Update documentation 2007-10-23 14:50 llundin * cpldfs/: cpl_dfs.c, tests/cpl_dfs-test.c: cpl_dfs_update_product_header(): Fail on missing product file, and on missing DATAMD5 card, recompute DATAMD5 for any product type (DFS4596, DFS4552) 2007-10-23 13:38 llundin * cpldfs/: cpl_dfs.c, cpl_dfs.h, tests/cpl_dfs-test.c: cpl_dfs_save_imagelist(): Added with unit-test - Still missing MD5-sum in header 2007-10-23 11:29 llundin * cpldfs/: cpl_dfs.c, cpl_dfs.h: cpl_dfs_product_save(): Add cpl_imagelist support 2007-10-23 08:41 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_save_tests(): Cover regexp card removal with both zero and one key removed 2007-10-22 17:13 scastro * cplcore/tests/cpl_propertylist-test.c: Included Test 14b to test return value in case of an error in cpl_propertylist_erase_regexp(). 2007-10-22 17:12 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_erase_regexp(): Changed return value when an error occurs from 0 to -1, to avoid conflicts with when no entries are erased (and 0 is returned). See DFS04587. 2007-10-22 16:35 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_{image,table}_save(): Test fits key removal 2007-10-22 16:06 llundin * cpldfs/cpl_dfs.c: cpl_dfs_{image,table}_save(): Fix for DFS04585 (error check on cpl_propertylist_erase_regexp()) 2007-10-16 14:50 scastro * doxygen/Doxyfile.in: Included SORT_BRIEF_DOCS=YES to alphabetically sort the functions in each module page. 2007-10-15 11:46 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_save_tests(): QC -> ESO QC 2007-10-15 10:25 cizzo * cplcore/cpl_column.c: Call fabs() instead of fabsf() in cpl_column_absolute() 2007-10-12 15:02 scastro * cplcore/tests/cpl_propertylist-test.c: Included test for when trying to load a property list with an extension larger than the number of extensions. 2007-10-12 15:01 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_to_fitsfile(): included better error messaging report when receiving an error from CFITSIO. 2007-10-10 16:24 cizzo * cplcore/tests/cpl_table-test.c: Add tests for new function cpl_table_get_column_names(). 2007-10-10 16:23 cizzo * cplcore/: cpl_table.c, cpl_table.h: Add new function cpl_table_get_column_names(). Function cpl_table_get_column_name() is deprecated 2007-10-10 12:29 cizzo * cplcore/: cpl_table.c, cpl_table.h, tests/cpl_table-test.c: Rename cpl_table_absolute_column() to cpl_table_abs_column() 2007-10-09 17:24 cizzo * cplcore/cpl_msg.c: Fix problem with long messages in cpl_msg_out() (DFS03014) 2007-10-09 17:23 cizzo * cplcore/tests/cpl_table-test.c: Add test for cpl_table_absolute_column() 2007-10-09 17:22 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_table.c, cpl_table.h: Add functions cpl_table_absolute_column() and cpl_column_absolute() 2007-10-07 18:59 rpalsa * cplcore/cpl_propertylist.c: _cpl_propertylist_from_fitsfile(): Skip totally empty FITS records. Records with a blank keyword followed by a comment are translated to a comment record, i.e. the blank keyword is replaced by COMMENT. 2007-10-07 16:45 rpalsa * cplcore/cpl_propertylist.c: cpl_propertylist_load(), cpl_propertylist_load_regexp(): Check for cfitsio error code END_OF_FILE when moving to the target HDU (deque version). 2007-10-07 16:03 rpalsa * cplcore/cpl_propertylist.c: cpl_propertylist_load(), cpl_propertylist_load_regexp(): Check for cfitsio error code END_OF_FILE when moving to the target HDU. 2007-10-05 17:09 cizzo * cplcore/cpl_table.c: Support also TUSHORT columns in cpl_table_load() 2007-10-04 10:41 llundin * cplcore/cpl_tools.c: cpl_tools_get_median_9double(): Updated doxygen with algorithm citation found in eclipse 2007-10-02 14:37 cizzo * NEWS: More News for CPL 4.0 2007-09-26 10:26 llundin * cplcore/tests/cpl_propertylist-test.c, cplui/tests/cpl_frame-test.c, cplui/tests/cpl_frameset_io-test.c: ANSI-C remove() replaces unlink() 2007-09-26 10:24 llundin * cplcore/cpl_tools.c: cpl_errorstate_dump_debug(): Prototype dropped following move to cpl_test 2007-09-25 15:53 llundin * cplcore/cpl_test.h: cpl_test_leq(): Fix doxygen typo 2007-09-24 15:57 llundin * NEWS: Some News for CPL 4.0 2007-09-24 15:13 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_save_txt(): Added and replaces argv[0] 2007-09-24 13:39 llundin * README: Fix typo: version 3.2 -> gcc version 3.2 2007-09-24 10:05 llundin * libcext/cext/cxutils.c: cx_line_max(): Call sysconf only when _SC_LINE_MAX is defined (i.e. incomplete sysconf() support, as under CYGWIN_NT-5.1) 2007-09-19 16:26 llundin * cpl.h, cplcore/Makefile.am, cplcore/cpl_test.c, cplcore/cpl_test.h, cplcore/cpl_tools.c, cplcore/cpl_tools.h: cplcore/cpl_test module created and exported using functions moved from cplcore/cpl_tools module 2007-09-14 14:25 llundin * libcext/acinclude.m4: Removed all CX math constants, except CX_PI which is still used by giraf-2.4 2007-09-14 14:06 llundin * cplcore/cpl_image_basic.c, cplcore/cpl_image_gen.c, cplcore/cpl_image_iqe.c, cplcore/cpl_vector.c, cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_vector-test.c, cpldrs/cpl_photom.c, cpldrs/cpl_wlcalib_xc.c: CPL_MATH constants replaces CX, atan(),sqrt(),exp() dittos 2007-09-14 14:02 llundin * cplcore/tests/cpl_image_iqe-test.c: cpl_image_iqe(): Test error handling 2007-09-14 11:59 llundin * libcext/acinclude.m4: Add comment regarding deprecated mathematical constants 2007-09-14 11:46 llundin * cplcore/: cpl_math_const.h, tests/cpl_math-test.c: CPL_MATH_2PI added 2007-09-14 11:36 llundin * cplcore/: cpl_math_const.h, tests/cpl_math-test.c: CPL_MATH_SQRT2PI added 2007-09-14 11:04 llundin * cplcore/: cpl_math_const.h, tests/cpl_math-test.c: CPL_MATH_FWHM_SIG, CPL_MATH_SIG_FWHM added 2007-09-14 10:35 llundin * cplcore/: cpl_math_const.h, tests/cpl_math-test.c: CPL_MATH_4_PI added 2007-09-14 10:25 llundin * cplcore/: cpl_math_const.h, tests/cpl_math-test.c: CPL_MATH_DEG_RAD, CPL_MATH_RAD_DEG added 2007-09-14 10:09 llundin * cpldrs/cpl_detector.c: cpl_bivector_gen_rect_poisson(), cpl_bivector_gen_ring_poisson(): CPL_MATH_PI_2 and CPL_MATH_SQRT1_2 replaces M_PI_2 and M_SQRT1_2 2007-09-14 09:11 llundin * cplcore/tests/cpl_math-test.c: Lower bar on accuracy, atan2() replaces atan() in pi approximations 2007-09-13 17:01 llundin * cpl.h, cplcore/Makefile.am, cplcore/cpl_math_const.h, cplcore/tests/Makefile.am, cplcore/tests/cpl_math-test.c: Math constants added (DFS03268) 2007-09-12 16:28 llundin * cpljava/cpl_gasgano.c: setCplMessaging(): Added with call to cpl_msg_warning() on failure. makePluginLibrary(): Call setCplMessaging(), ignore plugins when cpl_plugin_get_info() fails. doExec(): Call cpl_dfs_update_product_header() only if a plugin-exec is found and check if it failed, restore error state to point prior to cpl_plugin_get_info() call. ensureHandlersSetup(): Call cpl_msg_warning() on cpl_init() failure 2007-09-10 12:19 yjung * cpldfs/cpl_dfs.c: added doc for doxygen 2007-09-10 12:07 yjung * cpldrs/cpl_wlcalib_xc.c: pb in doxygen 2007-09-10 10:42 llundin * cplcore/cpl_init.c: cpl_init(): Fixed doxygen typo 2007-09-10 10:41 llundin * cplcore/cpl_init.c: cpl_init(): Added doxygen on possible CPL error code 2007-09-10 09:15 yjung * configure.ac: [no log message] 2007-09-10 09:14 yjung * configure.ac: 4.0b4cvs -> 4.0 2007-09-07 11:33 cizzo * cplcore/cpl_table.c: Improve doc of cpl_table_set_column_format() 2007-09-07 11:29 cizzo * cplcore/cpl_table.c: Improve doc of cpl_table_get_column_unit() 2007-09-05 11:53 kbanse * README: include JDK link 2007-09-04 14:11 yjung * configure.ac: 4.0b4 -> 4.0b4cvs 2007-09-04 14:10 yjung * configure.ac: 4.0b3 -> 4.0b4 2007-09-04 09:19 llundin * cplcore/cpl_image_filter_body.h: cpl_image_filter_median_uniform_{double,float}(): Moved calls to CPL_IMAGE_FILTER_MIN(), CPL_IMAGE_FILTER_MAX() out of innermost loops 2007-09-04 08:03 llundin * cplcore/tests/cpl_image_filter-test.c: included config.h. filter_one(): Fix mem-leak, init func-pointer 2007-09-03 16:36 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: cpl_image_filter_{linear,morpho,median,stdev}(): Delete empty bpm from result, drop never-taken cpl_mask_has_rejected()-guarded return following nobpm call. cpl_image_filter_median_uniform_{double,float}(): Added. cpl_image_filter_median(): Use cpl_image_filter_median_uniform_{double,float}() when kernel is uniform and no bpm on input 2007-09-03 15:13 cizzo * cplcore/cpl_column.c: Correct error handling in a number of accessor functions 2007-09-03 15:05 cizzo * cplcore/: cpl_array.c, cpl_table.c: Correct error handling in a number of accessor functions 2007-09-03 12:47 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: cpl_image_filter_median(): Avoid cast for median computation 2007-09-03 12:47 llundin * cplcore/cpl_tools.c: cpl_tools_get_median_9float(): Added. cpl_tools_get_median_float(): Use cpl_tools_get_median_9float() 2007-09-03 09:48 llundin * cplcore/tests/cpl_image_filter-test.c: Reduce default image size and fix typos 2007-08-31 14:36 llundin * cplcore/tests/cpl_image_filter-test.c: filter_one(): for linear filtering use a unity kernel and verify the result 2007-08-31 14:06 llundin * cplcore/tests/cpl_image_filter-test.c: Added filter_one() and loops for test variations 2007-08-31 14:02 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_{linear,morpho,median,stdev}(): cpl_mask_has_rejected() replaces cpl_image_count_rejected() 2007-08-30 15:12 llundin * cplcore/cpl_tools.c: cpl_test_init(): Work-around for DFS04285. cpl_test_end(): cpl_msg_debug on errno 2007-08-30 12:28 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_load_regexp(): fixed leaks as described in DFS04290. 2007-08-30 12:26 scastro * cplcore/tests/cpl_propertylist-test.c: Fixed small leaks. 2007-08-30 10:43 llundin * cplcore/tests/cpl_image_bpm-test.c: Renamed ima to img, fixed memory leak 2007-08-29 13:28 kbanse * README: change qfits to CFITSIO 2007-08-29 12:29 llundin * cplcore/cpl_tools.c: cpl_test_one(): cpl_errorstate_dump() added 2007-08-29 12:27 yjung * configure.ac: add cvs to the package name to protect b3 2007-08-29 12:23 yjung * configure.ac: b3 release 2007-08-28 14:02 scastro * cplcore/cpl_type.c: Added type codes into doxygen text. See DFS03301. 2007-08-28 12:02 llundin * cplcore/cpl_memory.c: cpl_vsprintf(): Removed fix for DFS04278 (which has been solved) 2007-08-28 11:50 scastro * libcext/cext/cxutils.c: cx_vasprintf(): fixed bug from DFS04278. 2007-08-27 16:49 llundin * cplcore/cpl_memory.c: cpl_vsprintf(): Improved error message 2007-08-27 16:45 llundin * cplcore/cpl_memory.c: cpl_vsprintf(): Check _cpl_memory_is_initialized like the others do 2007-08-27 16:41 llundin * cplcore/cpl_memory.c: Fix for DFS04278 using work-around for DFS04276 - Add comment about work-around 2007-08-27 16:35 llundin * cplcore/: cpl_memory.c, tests/cpl_memory-test.c: Fix for DFS04278 using work-around for DFS04276 2007-08-24 09:52 yjung * configure.ac: [no log message] 2007-08-23 16:24 llundin * cplcore/cpl_image_filter.c: cpl_image_filter_{linear,morpho,median,stdev}(): Use cpl_mask_has_rejected() to avoid calls to cpl_mask_dilation() with no bad pixels 2007-08-23 16:22 llundin * cplcore/: cpl_image_io.c, cpl_image_io.h: cpl_image_wrap_{double,float,int}(): Dropped const modifier 2007-08-22 12:05 scastro * cplcore/cpl_propertylist_impl.c: Removed cpl_propertylist_impl.c because it is now deprecated. 2007-08-21 13:41 scastro * cplui/tests/Makefile.am: Included cpl_frameset_io-test. Included also a clean-local. 2007-08-21 13:40 scastro * cplui/tests/cpl_frameset_io-test.c: Including unit tests for cpl_frameset_io module. 2007-08-21 13:34 scastro * cplui/cpl_frameset_io.c: cpl_imagelist_load_frameset(): Fixed bug when loading all fits extensions. Included new internal static function for this fix. See ticket DFS04250. 2007-08-20 14:13 scastro * cplui/cpl_frameset.c: cpl_frameset{find, get_first, get_frame, get_next}: replaced cpl_error_get_code() by cpl_errorstate_is_equal() as reported in DFS04212. 2007-08-20 14:06 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_{get, get_first, get_next, get_property}: replace cpl_error_get_code() by cpl_errorstate_is_equal() as reported in DFS04212. 2007-08-20 13:37 yjung * cplcore/cpl_image_basic.c: doc error corrected 2007-08-14 12:05 yjung * configure.ac: 4.0b1 -> 4.0b2 2007-08-10 17:18 yjung * cplcore/: cpl_imagelist_io.c, cpl_imagelist_io_body.h: DFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first imageDFS04211 : cpl_imagelist_load loads the first image 2007-08-10 09:56 llundin * cplui/cpl_parameterlist.c: cpl_parameterlist_get_{first,next,last}(), cpl_parameterlist_find{,_type,_context,_tag}(): cpl_errorstate_is_equal() replaces cpl_error_get_code(), see DFS04212 2007-08-10 08:07 llundin * cplcore/cpl_image_io.c: cpl_image_load(): Removed unused variable, related to DFS04193 fix 2007-08-09 23:19 llundin * cpldfs/: cpl_dfs.c, tests/cpl_dfs-test.c: cpl_is_fits(): Set CPL_ERROR_BAD_FILE_FORMAT only on failed close 2007-08-09 18:05 llundin * cpldrs/cpl_apertures.c: cpl_apertures_extract(): On sucess recover from error(s) set by cpl_apertures_extract_sigma(), see DFS02616 2007-08-09 13:28 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_save_image(): Do test 3 on a single rawframe + one calibration fits image 2007-08-09 10:01 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_save_image(): Do test 3 on a single rawframe. Delete frameset at end 2007-08-09 09:42 llundin * cpldfs/: cpl_dfs.c, tests/cpl_dfs-test.c: cpl_is_fits(): CPL_ERROR_FILE_NOT_FOUND replaces CPL_ERROR_FILE_IO 2007-08-09 09:39 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_save_image(): Test error handling on non-existing raw-file 2007-08-09 09:35 llundin * cpldfs/cpl_dfs.c: cpl_is_fits(): Use also CPL_ERROR_FILE_IO, add CFITSIO text to error 2007-08-07 10:05 llundin * cpldrs/cpl_fit.c: cpl_fit_imagelist_polynomial(): Improve documentation 2007-08-06 14:09 llundin * cpldfs/cpl_dfs.c: cpl_dfs_update_product_header(): close fits file on error, fits_open_diskfile() replaces fits_open_file(), Add cfitsio return value to error message 2007-08-03 21:33 yjung * cplcore/cpl_image_io.c: DFS04193: pnum unused in cpl_image_load 2007-08-02 10:27 llundin * cplcore/cpl_tools.c: cpl_test_get_description(): LP64, PIC, OPTIMIZE, gcc version fall-back 2007-08-02 10:08 llundin * cplcore/cpl_tools.c: cpl_test_get_description(): Add CFITSIO_VERSION 2007-07-31 15:27 llundin * cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_vector-test.c, cplcore/cpl_tools.c, cplcore/cpl_tools.h, cplcore/tests/cpl_error-test.c, cplcore/tests/cpl_errorstate-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_memory-test.c, cplcore/tests/cpl_stats-test.c, cpldfs/tests/cpl_dfs-test.c, cpldrs/tests/cpl_apertures-test.c, cpldrs/tests/cpl_apertures_img-test.c, cpldrs/tests/cpl_fit-test.c, cpldrs/tests/cpl_photom-test.c, cpldrs/tests/cpl_wcs-test.c, cplui/tests/cpl_frameset-test.c: cpl_test() redeclared to void and error-counting is done via an internal variable. cpl_test_reset() replaces cpl_error_reset() 2007-07-31 14:28 llundin * cplcore/cpl_errorstate.c: cpl_errorstate_dump(): Do nothing when cpl_error_is_readonly() 2007-07-31 11:56 llundin * cplcore/cpl_tools.c, cplcore/cpl_tools.h, cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_vector-test.c, cpldrs/tests/cpl_fit-test.c: cpl_test_leq(): Redeclared to void 2007-07-31 11:53 llundin * cpldrs/tests/cpl_wcs-test.c: Use cpl_test_init() instead if cpl_init(). Use cpl_test_end() instead of cpl_end() 2007-07-31 11:27 yjung * cplcore/cpl_image_basic.c: [no log message] 2007-07-31 09:40 llundin * cplcore/cpl_tools.h: cpl_assert(): cpl_assert_ok replaces ok 2007-07-31 09:33 llundin * cpldrs/cpl_wcs.c: cpl_memory.h and cpl_msg.h replaces cpl.h and cxmessages.h. Included string.h. Added newline at end of file 2007-07-31 08:50 llundin * cplcore/tests/cpl_stats-test.c: Output from cpl_stats_dump() sent to /dev/null per default 2007-07-31 08:35 llundin * cpldfs/tests/cpl_dfs-test.c: Removed unused code 2007-07-30 21:01 llundin * cplcore/cpl_tools.c: cpl_test_get_description(): Check for definition of gcc macros 2007-07-30 18:19 llundin * cplcore/tests/cpl_stats-test.c: cpl_stats_dump() called only with debugging 2007-07-30 18:11 llundin * cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_error-test.c, cplcore/tests/cpl_errorstate-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_bpm-test.c, cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_gen-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_image_iqe-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_mask-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_memory-test.c, cplcore/tests/cpl_msg-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_stats-test.c, cplcore/tests/cpl_vector-test.c, cpldrs/tests/cpl_apertures-test.c, cpldrs/tests/cpl_apertures_img-test.c, cpldrs/tests/cpl_detector-test.c, cpldrs/tests/cpl_fit-test.c, cpldrs/tests/cpl_geom_img-test.c, cpldrs/tests/cpl_photom-test.c, cplui/tests/cpl_frameset-test.c: Use cpl_test_init() instead if cpl_init(). Use cpl_test_end instead of cpl_end() 2007-07-30 17:53 llundin * cplcore/cpl_tools.c: cpl_test_init(): Added signal(SIGFPE, SIG_IGN), improved error message 2007-07-30 17:48 llundin * cplcore/cpl_tools.h: cpl_assert(): Use cpl_test_end() 2007-07-30 16:13 llundin * cplcore/tests/Makefile.am: Cleanup of cleanup target 2007-07-30 16:12 llundin * cplcore/cpl_tools.c, cplcore/cpl_tools.h, cpldfs/tests/cpl_dfs-test.c: cpl_error_reset_test(): Removed. cpl_test_reset(), cpl_test_init(), cpl_test_end(): Added 2007-07-30 14:24 llundin * cplcore/cpl_matrix.c: cpl_matrix_decomp_{chol,lu}(): Use cpl_error_set_message_macro() on CPL_ERROR_SINGULAR_MATRIX 2007-07-30 10:08 llundin * cpldrs/tests/cpl_fit-test.c: cpl_fit_imagelist_polynomial(): Tested with multiple samples at three different (equidistant) points 2007-07-30 10:07 llundin * cpldrs/cpl_fit.c: cpl_fit_imagelist_polynomial(): Call to cpl_vector_ensure_distinct() replaces such code, Drop incorrect reset of center element on is_eqdist 2007-07-30 10:05 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_1d_create(): Call cpl_vector_ensure_distinct() 2007-07-30 10:04 llundin * cplcore/: cpl_tools.c, cpl_tools.h: Added @internal to doxygen of all functions. cpl_vector_ensure_distinct(): Added 2007-07-27 18:13 llundin * cpldrs/cpl_fit.c: cpl_fit_imagelist_polynomial(): Count number of distinct sampling points to detect singular systems. Avoid vector duplication on mindeg == 1 2007-07-27 09:57 llundin * cplcore/cpl_init.c: cpl_init(): Verify run-time version of cfitsio, DFS04171 2007-07-26 14:47 llundin * cplcore/cpl_error.h: cpl_error_ensure(): document break as action 2007-07-26 14:46 llundin * cplcore/cpl_image_io.c: cpl_image_load{,_window}(): Fixed missing error check on pixel load, DFS04170 2007-07-26 13:40 llundin * cplcore/cpl_tools.c, cplcore/cpl_tools.h, cpldfs/cpl_dfs.c: cpl_tools_get_cfitsio_msg(): Replaces static cpl_dfs_get_cfitsio_msg() 2007-07-26 13:02 llundin * cpldrs/cpl_detector.c: cpl_flux_get_noise_ring(): Fix for zero-valued pixel samples, DFS04169 2007-07-25 09:59 llundin * cplcore/cpl_errorstate.c: cpl_errorstate_dump_one(): cpl_error_get_where() replaces non-standard location dump 2007-07-23 15:24 cizzo * cpl.h: Add cpl_ppm.h 2007-07-23 09:59 scastro * cplcore/tests/cpl_propertylist-test.c: Removed mixed declarations. 2007-07-20 16:23 yjung * configure.ac: 4.0cvs -> 4.0b1 2007-07-20 15:54 scastro * cplcore/tests/cpl_propertylist-test.c: Included test for saving an empty HISTORY and COMMENT keyword. 2007-07-20 15:54 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_to_fitsfile(): Included a work-around for what seems to be a bug in CFITSIO when saving an empty value for keywords HISTORY and COMMENT. 2007-07-20 14:49 cizzo * cplcore/cpl_table.c: Fix wrong memory handling in cpl_table_save() when saving array columns 2007-07-20 13:15 cizzo * cplcore/cpl_table.c: Avoid to pass NULL units to CFITSIO routine: it only works with the latest CFITSIO releases (after 3.06). Now cpl_table_save() is also compatible with CFITSIO 2.51 2007-07-20 13:13 cizzo * cplcore/tests/cpl_table-test.c: Add a final blank to an info string (cosmetics) 2007-07-20 11:24 llundin * cpldrs/cpl_geom_img.c: cpl_geom_ima_offset_xcorr_subw(): DBL_MAX replaces overflowing expression 2007-07-20 11:18 llundin * cplcore/tests/cpl_errorstate-test.c: Change default message level to off, but allow for the final error message 2007-07-20 11:18 llundin * cplcore/cpl_errorstate.c: cpl_errorstate_dump_one(): Change message level from info to error for all but no error message 2007-07-20 09:43 scastro * libcext/cext/cxdeque.c: Removed unrelated comments. 2007-07-20 09:42 scastro * libcext/tests/cxdeque-test.c: Removed unused variables. 2007-07-19 17:48 llundin * cplcore/: cpl_errorstate.c, tests/cpl_errorstate-test.c: cpl_errorstate_dump(): Correct bug introduced in previous commit and call dumper once with zeroes when there is not error to dump. Extend unit-tests to verify that zero-calls are done correctly 2007-07-19 16:53 cizzo * cplcore/cpl_table.c: Column units are now read in by cpl_table_load() 2007-07-19 16:52 cizzo * cplcore/tests/cpl_table-test.c: Add a number of unit tests on loading and saving table column units 2007-07-19 13:31 scastro * libcext/tests/cxdeque-test.c: Removed unused functions. Removed warnings. 2007-07-19 13:30 scastro * cplcore/tests/cpl_propertylist-test.c: Tested sorting from cx_list and from cx_deque. Test is now commented out. 2007-07-19 10:23 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_to_fitsfile(): removed mixed declarations and code, which caused warnings when compiling on Solaris machines. 2007-07-18 16:29 llundin * cplcore/: cpl_errorstate.c, tests/cpl_errorstate-test.c: cpl_errorstate_dump_one(): Print message of no errors to dump also when older errors exist. Update doxygen accordingly and fix typo. Unit test added 2007-07-18 15:45 scastro * cplui/: cpl_plugin.h, cpl_plugin.c: cpl_plugin_get_type_string() and cpl_plugin_get_version_string(): removed const from return value. 2007-07-18 13:27 scastro * cplcore/cpl_propertylist.c: Making the implementation with cxdeque the default one for CPL propertylist. Functions cpl_propertylist_get_first(), cpl_propertylist_get_next(), cpl_propertylist_get_first_const(), and cpl_propertylist_get_next_const() are now internal. 2007-07-18 13:25 scastro * cplcore/cpl_propertylist_impl.h: Added prototypes for: cpl_propertylist_get_first(), cpl_propertylist_get_next(), cpl_propertylist_get_first_const(), and cpl_propertylist_get_next_const(). 2007-07-18 13:25 scastro * cplcore/cpl_propertylist.h: Moved the following prototypes to the internal header file. cpl_propertylist_get_first(), cpl_propertylist_get_next(), cpl_propertylist_get_first_const(), and cpl_propertylist_get_next_const(). 2007-07-18 13:09 jmlarsen * cplcore/: cpl_table.c, tests/cpl_table-test.c: Fixed assertion failure when sorting table column with only invalid values (DFS04044). Unit test added 2007-07-18 11:54 scastro * cpldrs/cpl_wcs.c: Making doc internal. 2007-07-18 11:53 scastro * cpldrs/tests/cpl_wcs-test.c: Updated to new delivery 2007-07-18 11:50 scastro * cpldrs/cpl_wcs.c: Updated all functions to new delivery. 2007-07-18 11:50 scastro * cpldrs/cpl_wcs.h: Updated all prototypes to new delivery. 2007-07-18 09:57 llundin * cplcore/cpl_image_iqe.c: old-style function definitions replaced 2007-07-17 17:14 scastro * cplcore/tests/cpl_propertylist-test.c: Changed test for sorting function. 2007-07-17 17:13 scastro * libcext/cext/cxdeque.c: Improved the sorting function. 2007-07-17 16:01 llundin * libcext/cext/snprintf.c: fmtint(): Redeclare string literal pointer to const 2007-07-17 15:59 llundin * cpldrs/cpl_wlcalib_xc.c: Include cpl_msg.h 2007-07-17 15:59 llundin * cpldrs/cpl_geom_img.c: cpl_geom_img_offset_saa(): Add CPL_ERROR_UNSUPPORTED_MODE for unsupported combination modes (and fix uninit warning) 2007-07-17 15:58 llundin * cpldrs/cpl_apertures.c: cpl_apertures_sort_by_{npix,max,flux}(): Fix (false) uninit warning 2007-07-17 15:57 llundin * cplcore/cpl_vector.c: cpl_vector_correlate(): Raised bar on assert() on rounding errors 2007-07-17 15:56 llundin * cplcore/cpl_image_iqe.c: indexd(): Removed. Add declarations of (private) functions imported from RTD. WARNING: Duplicate code. Great care should be excersized if the code is reimported from RTD 2007-07-17 15:54 llundin * cplcore/cpl_stats.c: cpl_stats_new_from_image_window(): Fixed (false) uninit warnings 2007-07-17 15:53 llundin * cplcore/cpl_mask.c: cpl_mask_collapse_create(): Fixed uninit compiler warning (and optimize collapse) 2007-07-17 15:52 llundin * cplcore/cpl_xmemory.c: cpl_xmemory_addcell(): Work around unused variable warning 2007-07-17 15:51 llundin * cplcore/cpl_image_io.c: cpl_image_load{,_window}(): Fixed free of undefined image on CPL_ERROR_TYPE_MISMATCH 2007-07-17 15:50 llundin * cplcore/cpl_bivector.c: cpl_bivector_interpolate_linear(): Fixed (false) uninit warning 2007-07-17 12:48 cizzo * cplcore/cpl_array.c, cplcore/cpl_array.h, cplcore/cpl_column.c, cplcore/cpl_column.h, cplcore/cpl_table.c, cplcore/cpl_table.h, cpldfs/cpl_dfs.c: const correctness (again) 2007-07-17 12:03 scastro * cplcore/cpl_propertylist.c: Adapted calls to renamed functions in deque implementation. 2007-07-17 12:00 scastro * cplcore/cpl_propertylist.c: Adapted calls to renamed functions. 2007-07-17 11:53 yjung * cplcore/cpl_tools.c: changed cpl_property_get_name_const -> cpl_property_get_name 2007-07-17 11:42 scastro * cplui/cpl_frameset_io.c: Adapted to function tha has been renamed. 2007-07-17 11:36 scastro * cplui/cpl_parameter.h, cplui/cpl_parameter.c, cplui/cpl_frame.h, cplui/cpl_frame.c, cplcore/cpl_property.h, cplcore/cpl_property.c: Removed non-const functions. 2007-07-16 16:37 scastro * libcext/tests/Makefile.am: Added cxdeque-test. 2007-07-16 16:36 scastro * libcext/tests/cxdeque-test.c: cxdeque-test.c: Added a test suite for cxdeque. 2007-07-16 16:20 rpalsa * cplui/tests/cpl_recipeconfig-test.c: main(): const qualifier removed from variable declaration of "tags". 2007-07-16 16:04 yjung * cplcore/cpl_tools.c: rm warnings const related 2007-07-16 16:00 llundin * cplcore/cpl_init.h: Redeclared CPL_INIT_DEFAULT 2007-07-16 15:47 scastro * cplcore/cpl_propertylist.c: Modified calls to const functions when appropriated. 2007-07-16 15:30 cizzo * cplcore/cpl_table.c, cpldfs/cpl_dfs.c: const correctness 2007-07-16 15:11 scastro * cplui/cpl_frameset_io.c: cpl_imagelist_load_frameset(): Replaced call to cpl_frame_get_filename() with cpl_frame_get_filename_const(). 2007-07-16 15:09 scastro * cplui/: cpl_frame.h, cpl_frame.c: Added const accessor functions. 2007-07-16 14:54 scastro * cplcore/: cpl_property.h, cpl_property.c: Added const accessor functions. 2007-07-16 14:31 scastro * cplui/: cpl_parameter.h, cpl_parameter.c: Added const accessor functions. 2007-07-16 13:55 cizzo * cpldfs/cpl_dfs.c, cplcore/cpl_table.c: const correctness 2007-07-16 13:55 scastro * cplui/: cpl_parameterlist.h, cpl_parameterlist.c: Added const accessor functions. 2007-07-16 13:22 scastro * cplui/cpl_frameset_io.c: cpl_imagelist_load_frameset(): Replaced call to cpl_frameset_get_frame() with cpl_frameset_get_frame_const(). 2007-07-16 13:14 scastro * cplui/cpl_frameset.c: Added const accessor functions. Included appropriate calls to const accessor functions in other functions. 2007-07-16 13:13 scastro * cplui/cpl_frameset.h: Added const accessor functions. 2007-07-16 11:57 scastro * cplcore/: cpl_propertylist.h, cpl_propertylist.c: Added new const accessor functions. 2007-07-16 11:19 cizzo * cpldrs/: cpl_ppm.c, cpl_ppm.h: Minimized inclusions in header file, and source 2007-07-16 11:09 llundin * cplcore/cpl_init.c, cplcore/cpl_init.h, cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_error-test.c, cplcore/tests/cpl_errorstate-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_bpm-test.c, cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_gen-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_image_iqe-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_mask-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_memory-test.c, cplcore/tests/cpl_msg-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_property-test.c, cplcore/tests/cpl_propertylist-test.c, cplcore/tests/cpl_stats-test.c, cplcore/tests/cpl_table-test.c, cplcore/tests/cpl_vector-test.c, cpldfs/tests/cpl_dfs-test.c, cpldrs/tests/cpl_apertures-test.c, cpldrs/tests/cpl_apertures_img-test.c, cpldrs/tests/cpl_detector-test.c, cpldrs/tests/cpl_fit-test.c, cpldrs/tests/cpl_geom_img-test.c, cpldrs/tests/cpl_photom-test.c, cpldrs/tests/cpl_wcs-test.c, cpljava/cpl_gasgano.c, cplui/tests/cpl_frame-test.c, cplui/tests/cpl_framedata-test.c, cplui/tests/cpl_frameset-test.c, cplui/tests/cpl_parameter-test.c, cplui/tests/cpl_parameterlist-test.c, cplui/tests/cpl_plugin-test.c, cplui/tests/cpl_pluginlist-test.c, cplui/tests/cpl_recipeconfig-test.c: cpl_init(): Redeclared to take a parameter, CPL_INIT_DEFAULT 2007-07-16 10:58 cizzo * cplcore/: cpl_array.c, cpl_array.h, cpl_column.c, cpl_column.h, cpl_table.c, cpl_table.h: const correctness improved 2007-07-16 10:52 rpalsa * cplui/: cpl_recipeconfig.c, cpl_recipeconfig.h: _cpl_recipeconfig_get_tags(), cpl_recipeconfig_get_tags(), cpl_recipeconfig_get_inputs() and cpl_recipeconfig_get_outputs(): Remove const qualifier from the function return value. 2007-07-13 16:21 scastro * cplcore/cpl_propertylist.h, cplcore/cpl_propertylist.c, cplui/cpl_frameset.h, cplui/cpl_frameset.c, cplui/cpl_parameterlist.h, cplui/cpl_parameterlist.c: Const correct accessor functions. 2007-07-13 14:25 cizzo * cpldrs/: Makefile.am, cpl_ppm.c, cpl_ppm.h: Fix implementation of ppm modules 2007-07-13 12:52 cizzo * cpldrs/: cpl_ppm.c, cpl_ppm.h: Adding point-pattern-matching module 2007-07-12 17:03 cizzo * cplcore/cpl_matrix.c: Slight modification of cpl_matrix_dump() according to MUSE consortium wish list 2007-07-11 17:39 rpalsa * cplcore/tests/cpl_propertylist-test.c: cpl_test_property_comparison(): Cast and extra dereference operator removed from return values of cpl_property_get_name() when calling strcmp(). 2007-07-11 16:05 yjung * cplcore/: cpl_image_io.c, cpl_vector.c: fixed DFS04124 : rm PCOUNT GCOUNT from image and vector savings - already added by cfitsio 2007-07-11 15:09 cizzo * cplcore/: cpl_table.c, cpl_table.h: Const correct accessor functions 2007-07-11 09:32 cizzo * cplcore/cpl_array.c: Fix wrong access to array data in cpl_array_get_data_double() 2007-07-10 11:55 cizzo * cplcore/: cpl_array.c, cpl_array.h, cpl_array_impl.h, cpl_column.c, cpl_column.h: Const correct accessor functions 2007-07-06 16:35 llundin * cplcore/: cpl_image_stats.c, cpl_stats.c: Use const for bpm of input image 2007-07-06 16:20 llundin * cpldrs/cpl_geom_img.c: cpl_geom_ima_offset_xcorr(): Use cpl_vector_get_median_const() and not cpl_vector_get_median() 2007-07-06 16:20 llundin * cpldrs/cpl_detector.c: cpl_flux_get_noise_window(), cpl_flux_get_noise_ring(): Optimize by allowing vector to be modified by cpl_vector_get_median() 2007-07-06 16:20 llundin * cplcore/: cpl_vector.c, cpl_vector.h: cpl_vector_get_median(): Renamed from cpl_vector_get_median_modify(). cpl_vector_get_median_const(): Renamed from cpl_vector_get_median() 2007-07-06 15:57 llundin * cplcore/cpl_bivector.c, cplcore/cpl_bivector.h, cplcore/cpl_image_basic.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_resample.c, cplcore/cpl_imagelist_basic.c, cplcore/cpl_imagelist_basic_body.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io.h, cplcore/cpl_mask.c, cplcore/cpl_mask.h, cplcore/cpl_matrix.c, cplcore/cpl_matrix.h, cplcore/cpl_polynomial.c, cplcore/cpl_vector.c, cplcore/cpl_vector.h, cplcore/cpl_vector_fit_impl.h, cplcore/tests/cpl_vector-test.c, cpldrs/cpl_apertures.c, cpldrs/cpl_detector.c, cpldrs/cpl_detector_body.h, cpldrs/cpl_fit.c, cpldrs/cpl_fit_body.h, cpldrs/cpl_geom_img.c, cpldrs/cpl_geom_img_body.h, cpldrs/cpl_photom.c, cpldrs/cpl_wlcalib_xc.c, cpldrs/tests/cpl_fit-test.c: Dropped const modifier from input to 13 pointer-accessors and added 13 new _const pointer-accessors. Suppressed (unrelated) warnings about dropped const-modifier on string literals passed to CFITSIO and an old-style definition. Use new _const pointer-accessors where applicable 2007-07-06 15:43 llundin * cplcore/tests/cpl_error-test.c: cpl_error_test_set_message_empty(): Drop extra argument from var list 2007-07-06 15:08 llundin * libcext/cext/cxmessages.c: cx_log_prefix_init(): Declare explicitly (Avoid old-style function definition) 2007-07-06 11:15 scastro * libcext/cext/Makefile.am: Added cxdeque.c and cxdeque.h. 2007-07-06 11:06 scastro * cplcore/tests/cpl_propertylist-test.c: Added a new test to test saving a very long propertylist. It is commented out now. 2007-07-06 11:06 scastro * cplcore/Makefile.am: Added PLIST_FLAGS to control the switch between propertylist with deque and with cxlist. Setting this flag at build time will activate the version with deques. The setting is done as follows: make PLIST_FLAGS="-DPLIST" 2007-07-06 11:04 scastro * cplcore/cpl_propertylist.c: Added version with deque of all propertylist functions. The choice between version with cxlist and version with cxdeque is controlled by a PLIST flag. 2007-07-06 10:25 llundin * cplcore/: cpl_error.c, cpl_error.h: doxygen cleanup, including doxygen for CPL_HAVE_VA_ARGS and CPL_ERROR_MAX_MESSAGE_LENGTH 2007-07-05 14:59 llundin * cplcore/cpl_error.h: cpl_error_ensure(): Imported from irplib. CPL_HAVE_VA_ARGS: Added. cpl_ensure(), cpl_ensure_code(): Redefined in terms of cpl_error_ensure() 2007-07-05 09:51 llundin * cplcore/cpl_vector.c: cpl_vector_correlate(): Raised bar on assert() on rounding errors 2007-07-04 14:27 scastro * cplcore/cpl_propertylist_impl.c: cpl_propertylist_impl.c: This is a test file. Synchronized the API of cpl_propertylist_sort() with that of cx_list version. 2007-07-04 14:14 scastro * libcext/cext/cxdeque.h: This is a test file. Added prototypes for cx_deque_sort() and cx_deque_compare(). 2007-07-04 14:13 scastro * libcext/cext/cxdeque.c: cx_deque_sort(): This is a test file. Added a function to sort a deque. 2007-07-04 14:12 scastro * cplcore/cpl_propertylist_impl.c: cpl_propertylist_impl.c: This is a test file. Implemented cpl_propertylist_sort using cx_deque. 2007-07-04 09:33 llundin * cpldfs/tests/cpl_dfs-test.c: Removed fix for DFS4100 2007-07-04 09:31 llundin * cplcore/tests/cpl_table-test.c: cpl_table_save(): Added regression test for DFS4100 2007-07-04 09:27 llundin * cplcore/: cpl_error.c, cpl_error.h, tests/cpl_error-test.c: cpl_error_get_message_default(): Made public (DFS4046). cpl_error_set_message_macro(): Ignore single-space message to avoid warnings on NULL and empty format-strings. Improve doxygen on CPL error codes 2007-07-03 16:41 cizzo * cplcore/cpl_table.c: Cleanup 2007-07-03 16:32 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_to_fitsfile(): Fixed a bug when trying to work with an empty propertylist. 2007-07-03 16:22 llundin * cpldfs/: cpl_dfs.c, cpl_dfs.h, tests/cpl_dfs-test.c: cpl_dfs_save_{image,table,paf}(): Added with unit tsts 2007-07-03 16:21 llundin * cpldfs/tests/Makefile.am: Added clean-up of files to clean-local target 2007-07-03 16:20 llundin * cplcore/cpl_tools.h: cpl_error_reset_test(): Added 2007-07-03 15:45 llundin * cplcore/cpl_table.c: cpl_table_save(): Avoid modification of propertylist for primary header 2007-07-03 13:51 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_product_tests(): do unit tests of cpl_dfs_setup_product_header() and cpl_dfs_update_product_header() 2007-07-02 17:24 scastro * cplcore/cpl_propertylist_impl.c: cpl_propertylist_impl.c: Added to the repository. This is a test-development file which is not included in any makefile. 2007-07-02 17:20 scastro * libcext/cext/cxdeque.h: cxdeque.h: Added to the repository. This file is not included in any makefile. 2007-07-02 17:19 scastro * libcext/cext/cxdeque.c: cxdeque.c: Added to the repository. This file is not included in any makefile. 2007-06-29 14:07 llundin * cpldfs/cpl_dfs.c: cpl_error_set_message_macro() replaces cpl_error_set_message() to support gcc -std=c99 -pedantic 2007-06-29 09:33 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_get(): included comment in doxygen to point users to use get_first() and get_next() as a more efficient way to loop through a list. 2007-06-28 15:13 llundin * cplcore/cpl_image_gen_body.h, cplcore/tests/cpl_vector-test.c, cpldrs/cpl_detector.c: Use cpl_drand() instead of drand48() (and drop useless calls to srand48()) 2007-06-28 15:13 llundin * cplcore/cpl_tools.h: cpl_drand(): Added 2007-06-28 14:06 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_to_fitsfile(): replaced calls to cpl_propertylist_get() with _get_first() and _get_next(). 2007-06-28 09:39 cizzo * cplcore/tests/cpl_table-test.c: Add (in comment) the test on a big table 2007-06-27 13:59 llundin * cplcore/cpl_table.c: cpl_table_save(): Avoid modification of propertylist for extension header 2007-06-21 14:15 llundin * cplcore/cpl_error.c: cpl_error_get_message_default(): Renamed from cpl_error_get_message_standard() 2007-06-20 16:55 yjung * cplcore/cpl_image_basic.c, cplcore/cpl_image_io.h, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_mask-test.c, cpldrs/cpl_apertures.c, cpldrs/cpl_geom_img.c, cpldrs/tests/cpl_apertures-test.c, cpldrs/tests/cpl_apertures_img-test.c: removed CPL_PIXEL_MAXVAL and CPL_PIXEL_MINVAL definitions (DFS03433) 2007-06-20 15:37 yjung * cpldrs/: cpl_detector.c, cpl_detector.h, tests/cpl_detector-test.c: [no log message] 2007-06-20 15:27 scastro * cpldrs/tests/cpl_wcs-test.c: cpl_wcs-test.c: Adding tests for cpl_wcs functions. 2007-06-20 15:18 scastro * cpldrs/cpl_wcs.c: cpl_wcs.c: Adding new cpl_wcs module. 2007-06-20 15:18 scastro * cpldrs/cpl_wcs.h: cpl_wcs.h: Adding header file for new cpl_wcs module. 2007-06-20 09:31 llundin * cplcore/cpl_error.h: cpl_error_set_message(): Updated doxygen with __STRICT_ANSI__ case 2007-06-20 09:08 llundin * cplcore/cpl_error.h: cpl_error_set_message(): ifdef __STRICT_ANSI__ then allow only a non-printf-style message 2007-06-20 08:59 llundin * cplcore/cpl_errorstate.c: cpl_errorstate_append(): Remove incorrect assertion. Correct typo in struct documentation 2007-06-19 15:43 llundin * cplcore/: cpl_error.c, cpl_error.h, tests/cpl_error-test.c: cpl_error_set_message_macro(): Added __attribute__ to declaration. cpl_error_set(): Define as call to cpl_error_set_message_macro(). cpl_error_set_macro(): Removed. cpl_error_set_where(): Define as call to cpl_error_set_message_macro(). cpl_error_set(), cpl_error_set_where(): Added unit tests 2007-06-19 14:04 llundin * cpldfs/cpl_dfs.c: cpl_error_set_message_macro(): Redeclared to type cpl_error_code (bis) 2007-06-19 14:00 llundin * cplcore/: cpl_error.c, cpl_error.h: cpl_error_set_where(): Calls cpl_error_set_macro(), redeclared to type cpl_error_code. cpl_error_set_where_macro(): Removed. cpl_error_set*(): Improved documentation 2007-06-19 13:06 llundin * cplcore/cpl_error.c, cplcore/cpl_error.h, cplcore/tests/cpl_error-test.c, cpldfs/cpl_dfs.c: cpl_error_set_message_macro(): Redeclared to type cpl_error_code 2007-06-19 10:17 llundin * cpldfs/: cpl_dfs.c, tests/cpl_dfs-test.c: cpl_dfs_setup_product_header(): Set well-defined error code on missing product tag - with unit test 2007-06-19 08:43 llundin * cplcore/tests/cpl_error-test.c, cplcore/tests/cpl_errorstate-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_vector-test.c, cpldfs/tests/cpl_dfs-test.c: Added ifdef HAVE_CONFIG_H/include config.h 2007-06-18 17:17 llundin * cpldfs/: cpl_dfs.c, tests/cpl_dfs-test.c: cpl_dfs_setup_product_header(), cpl_dfs_update_product_header(): Put error messages into the CPL error history. cpl_dfs_setup_product_header(): Require product frame to be grouped as product (with unit test) 2007-06-18 17:09 llundin * cplcore/: cpl_error.h, cpl_error_impl.h: CPL_ERROR_MAX_MESSAGE_LENGTH: definition moved to cpl_error.h from cpl_error_impl.h. cpl_ensure(), cpl_ensure_code(): Moved to section of macro definitions in cpl_error.h 2007-06-18 16:13 yjung * cplcore/cpl_bivector.c: DOC fix <- Muse input 2007-06-18 14:35 llundin * cplcore/: cpl_error.c, cpl_error.h, tests/cpl_error-test.c, tests/cpl_errorstate-test.c: cpl_error_set_message(), cpl_error_set_message_macro(): Redeclared to type void, allow message with no arguments 2007-06-18 13:50 llundin * cplcore/cpl_column.c: cpl_column_dump() + cpl_column_dump_structure(): Use cpl_errorstate_get/set() instead of cpl_error_reset() 2007-06-18 13:44 llundin * cplcore/: cpl_error.c, cpl_error.h, cpl_error_impl.h, cpl_errorstate.c, tests/cpl_error-test.c, tests/cpl_errorstate-test.c: Added message to CPL error struct, Added cpl_error_set_message() with unit tests. Improved documentation. cpl_error_get_where(): Use cx_snprintf() instead of snprintf() 2007-06-18 11:03 llundin * cplcore/: cpl_error.c, cpl_error.h: Improved documentation 2007-06-18 10:46 llundin * cplcore/cpl_errorstate.c: Removed calls to cpl_msg_debug() 2007-06-18 10:44 llundin * cplcore/: cpl_error.c, cpl_error.h: cpl_error_dump(): Removed again 2007-06-18 09:49 llundin * cpl.h, cplcore/cpl_error.c, cplcore/cpl_error.h, cplcore/cpl_error_impl.h, cplcore/cpl_errorstate.c, cplcore/cpl_errorstate.h, cplcore/cpl_image_basic.c, cplcore/cpl_imagelist_basic.c, cplcore/cpl_matrix.c, cplcore/cpl_property.c, cplcore/cpl_propertylist.c, cplcore/cpl_table.c, cplcore/cpl_vector.c, cplcore/cpl_vector_fit_impl.h, cplcore/tests/Makefile.am, cplcore/tests/cpl_error-test.c, cplcore/tests/cpl_errorstate-test.c, cplcore/tests/cpl_matrix-test.c, cpldrs/cpl_apertures_img.c, cpldrs/cpl_fit.c, cpldrs/cpl_geom_img.c, cplui/cpl_parameter.c, cplui/cpl_recipeconfig.c: Added cpl_errorstate functions, removed cpl_error_push(), cpl_error_pop() 2007-06-15 11:19 llundin * cplcore/: Makefile.am, cpl_errorstate.c, cpl_errorstate.h: cpl_errorstate module with stubs added 2007-06-15 11:19 llundin * cplcore/: cpl_error.c, cpl_error_impl.h: Add internal, static state: cpl_errorstate_is_set. cpl_error_where_string moved to cpl_error_get_where(). CPL error string sizes moved to cpl_error_impl.h. Some internal variables renamed 2007-06-15 09:39 cizzo * cplcore/tests/cpl_table-test.c: No real change - some commented code added 2007-06-13 09:24 scastro * cplcore/cpl_memory.c: cpl_memory_dump(): Removed warning. 2007-06-13 08:46 yjung * cpl.h: added cpl_wlcalib_xc 2007-06-12 16:13 llundin * cplcore/cpl_error.c: Change CPL error state to an array (so far use only 1st element) 2007-06-12 15:49 llundin * cplcore/cpl_error.c: Disentagle the CPL error state from its backup (and simplify cpl_error_push()/cpl_error_pop()) 2007-06-12 15:09 llundin * cplcore/cpl_error.c, cplcore/cpl_error_impl.h, cplcore/cpl_property.c, cplcore/cpl_propertylist.c, cplui/cpl_parameter.c: cpl_error_set_code(): Made static, replaced by cpl_error_set()/cpl_ensure() 2007-06-12 14:49 cizzo * cplcore/tests/: cpl_table-testfail1.c, cpl_table-testfail2.c: This file is no longer needed 2007-06-12 14:24 llundin * cplcore/tests/cpl_error-test.c: Test also cpl_error_push()/cpl_error_pop() 2007-06-12 14:21 llundin * cplcore/tests/cpl_error-test.c: Improve comments 2007-06-12 14:02 llundin * cplcore/tests/cpl_error-test.c: Tests of all error codes with cpl_error_set() and cpl_ensure() 2007-06-12 13:38 llundin * cplcore/tests/: Makefile.am, cpl_error-test.c: Added unit tests for error module 2007-06-12 09:39 rpalsa * libcext/cext/cxmessages.h: cx_assert() macro definitions: Do not put the #expr argument on a line of its own, this confuses some code parsers, syntax checkers, which interpret this as preprocessor directive. 2007-06-12 09:33 rpalsa * cplui/: cpl_parameterlist.c, cpl_parameterlist.h: cpl_parameterlist_get_first(), cpl_parameterlist_get_next(), cpl_parameterlist_get_last(), cpl_parameterlist_find(), cpl_parameterlist_find_tag(), cpl_parameterlist_find_type(), cpl_parameterlist_find_context(): const qualifier added to first argument. 2007-06-11 16:32 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_get_property(): updated doxygen text. 2007-06-08 16:57 scastro * cplcore/tests/cpl_propertylist-test.c: Added tests for cpl_propertylist_get_first() and cpl_propertylist_get_next(). 2007-06-08 16:56 scastro * cplcore/cpl_propertylist.c: Added two new functions. As a consequence, modified the structure of cpl_propertylist to take a new member, which gives the cached position of a property in the list. cpl_propertylist_get_first(): added. cpl_propertylist_get_next():added. cpl_propertylist_new(): initializes the cache position. 2007-06-08 16:54 scastro * cplcore/cpl_propertylist.h: Added prototype for two new functions: cpl_propertylist_get_first() and cpl_propertylist_get_next(). 2007-06-08 14:44 scastro * cplcore/cpl_memory.c: CPL memory module has been updated to include cpl_xmemory calls when appropriate. 2007-06-06 19:10 llundin * cpldfs/cpl_dfs.c: cpl_dfs_find_md5sum(): Call fits_get_hduaddr() instead of fits_get_hduaddrll(), which is introduced after CFITSIO 2.510 2007-06-05 17:00 llundin * cpldfs/cpl_dfs.c: cpl_dfs_setup_product_header(): Removed unneeded snprintf() (which causes a compiler warning on HP-UX) and move pval to smallest possible scope. cpl_dfs_find_md5sum(): Fix implicit-cast warning 2007-06-04 14:59 llundin * cpldfs/: cpl_dfs.c, tests/cpl_dfs-test.c: cpl_dfs_setup_product_header(): New error codes: CPL_ERROR_BAD_FILE_FORMAT for an invalid input file, e.g. a directory, CPL_ERROR_DATA_NOT_FOUND for a frame with a missing filename, CPL_ERROR_UNSPECIFIED has been removed 2007-06-04 12:18 llundin * cpldfs/cpl_dfs.c: cpl_is_fits(): Add prototype and doxygen, use CPL error codes, check return status of fits_open_diskfile() and fits_close_file(). cpl_get_base_name(): Add prototype and doxygen, do not segfault on NULL. cpl_dfs_setup_product_header((): Replace CPL_ERROR_UNSPECIFIED with CPL_ERROR_FILE_NOT_FOUND 2007-06-04 10:54 yjung * cplcore/cpl_stats.c: DFS03993 ... doc 2007-06-01 11:14 scastro * cplcore/tests/cpl_propertylist-test.c: Removed warnings. 2007-05-31 09:44 scastro * cplui/tests/cpl_frame-test.c: Removed comments about qfits. 2007-05-31 09:43 scastro * cplcore/tests/cpl_propertylist-test.c: Included missing header file unistd.h. 2007-05-31 09:42 scastro * cplui/tests/cpl_frame-test.c: Included missing header file unistd.h. Removed commented qfits calls. 2007-05-31 09:35 scastro * cplcore/cpl_memory.c: cpl_memory_is_empty() and cpl_memory_dump(): removed qfits comments. 2007-05-30 17:07 yjung * m4/cpl.m4: QFITS totally removed 2007-05-30 15:27 llundin * cpldfs/: md5.c, md5.h: MD5Transform(): Moved from md5.h to md5.c. byteReverse(): Use only on actual Big-Endian machines (check for WORDS_BIGENDIAN) 2007-05-30 14:51 llundin * cpldfs/cpl_dfs.c: cpl_get_base_name(): Redeclare to const and add to documentation. cpl_dfs_find_md5sum(): Disable blocking 2007-05-30 14:02 llundin * cpldfs/tests/cpl_dfs-test.c: Use cpl_test() on strncmp(md5sum, ...) 2007-05-30 09:20 cizzo * cplcore/: cpl_table.c, cpl_table.h: Add const modifier to from_table in cpl_table_duplicate_column() 2007-05-29 17:30 yjung * cplcore/tests/cpl_property-test.c: typo (forgotten ';') 2007-05-29 17:26 llundin * cplcore/cpl_tools.c, cplcore/cpl_vector.c, cpldrs/cpl_apertures.c: #include added (was previously removed from the header-file of the module 2007-05-29 17:19 yjung * cplcore/: cpl_image_io.c, cpl_imagelist_io.c, cpl_tools.h, cpl_vector.c: Fixed DFS03966 : - missing PCOUNT GCOUNT - DATE written twice - buffer overflow risks avoided with cpl_sprintf() 2007-05-29 17:11 cizzo * cpldfs/cpl_dfs.c: Eliminate the dependencies of dfs_setup_header() from qfits 2007-05-29 16:13 rpalsa * cplui/cpl_pluginlist.c: cpl_pluginlist_get_next(): Add missing semicolon after cx_assert() call. 2007-05-29 16:08 rpalsa * libcext/cext/cxmessages.h: cx_assert() macro definition: wrap if statement in a do-while loop. 2007-05-29 15:00 yjung * cplcore/cpl_mask.c: DFS03967 : doc updated 2007-05-29 13:03 cizzo * cplcore/cpl_table.c: In cpl_table_load_window() allow loading zero rows even if a first row greater than zero is specified 2007-05-29 12:51 cizzo * cplcore/cpl_table.c: In cpl_table_load_window(), remove the overloading of firstrow and nrow arguments 2007-05-28 13:48 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_update_product_header() test: Added test with large multi-extension file and test with new PIPEFILE value 2007-05-28 13:47 llundin * cpldfs/cpl_dfs.c: cpl_dfs_find_md5sum(): Added PIPEFILE updated. Changed messaging to info from error. Corrected Copyright Comment and improved comments 2007-05-26 12:04 llundin * cpldfs/cpl_dfs.c: cpl_dfs_find_md5sum((): At most one cpl_malloc() 2007-05-25 18:35 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_update_product_header() test: Try several variations of single- and multi- extension files 2007-05-25 18:34 llundin * cpldfs/cpl_dfs.c: cpl_dfs_update_product_header(): Split calls to ffgbyt()/MD5Update() into blocks 2007-05-25 16:26 llundin * cpldfs/cpl_dfs.c: cpl_dfs_find_md5sum(): Draft, computes MD5sum, needs blocking. cpl_dfs_update_product_header(): Drop qfits usage 2007-05-25 16:13 llundin * cpldfs/: Makefile.am, cpl_dfs.c: Add md5.{c,h} as include-files for cpl_dfs.c 2007-05-25 16:12 llundin * cpldfs/: md5.c, md5.h: All (four) exported (MD5-)functions redeclared to static. Comment changed from QFITS to CPL 2007-05-25 16:09 llundin * cpldfs/: md5.c, md5.h: Copied MD5 source from QFITS cvs repo 2007-05-25 16:02 llundin * cpldfs/cpl_dfs.c: cpl_dfs_find_md5sum(): Draft version added, data units loaded, MD5 not yet computed 2007-05-25 15:07 cizzo * cplcore/cpl_table.c: Minor modification to cpl_table_load() 2007-05-25 14:28 cizzo * cplcore/cpl_table.c: Fix bugs in cpl_table_load_window() - this is the first working and tested version 2007-05-25 14:27 cizzo * cplcore/tests/cpl_table-test.c: Add tests about loading part of a table 2007-05-25 13:37 yjung * cplcore/Makefile.am, m4/cpl.m4: add support for CPL_XMEMORY options 2007-05-25 11:37 cizzo * cplcore/: cpl_table.c, cpl_table.h: Add new function cpl_table_load_window() - it compiles, but basically it is STILL UNTESTED! cpl_table_load(), now based on cpl_table_load_window(), was however tested successfully. 2007-05-24 17:53 yjung * cpldrs/cpl_wlcalib_xc.c: [no log message] 2007-05-24 17:47 scastro * cplcore/cpl_propertylist.c, cplcore/cpl_propertylist_impl.h, cplcore/cpl_memory.c, cplcore/cpl_init.c, cplui/cpl_frame.c, cplui/cpl_frameset_io.c: Removed all calls to QFITS functions. Removed include qfits.h. 2007-05-24 17:33 yjung * cpldrs/: Makefile.am, cpl_wlcalib_xc.c, cpl_wlcalib_xc.h: [no log message] 2007-05-24 17:19 scastro * cplui/tests/Makefile.am: Added LIBCFITSIO and CFITSIO_INCLUDES. 2007-05-24 17:11 scastro * cplcore/tests/cpl_property-test.c: Removed warnings. 2007-05-24 17:11 scastro * cplcore/tests/cpl_propertylist-test.c: Removed all calls to QFITS functions and replaced whenever possible with calls to CFITSIO. 2007-05-24 16:36 llundin * cpldfs/cpl_dfs.c: cpl_dfs_get_cfitsio_msg(): Added. cpl_dfs_update_key_string(): Added. cpl_dfs_update_product_header(): Use cpl_dfs_update_key_string() instead of qfits_replace_card() 2007-05-24 16:33 yjung * configure.ac, m4/cpl.m4: add check memory mode 2007-05-24 16:17 yjung * cplcore/cpl_xmemory.c: swiched the default CPL_XMEMORY_MODE mode to 1 2007-05-24 15:58 yjung * cpldrs/cpl_detector.c: Remove the check on the number of pixels 2007-05-24 12:53 cizzo * cplcore/cpl_table.c: Eliminate any remaining reference to qfits 2007-05-24 12:04 llundin * cpldrs/tests/cpl_photom-test.c: cpl_photom_fill_blackbody() test: Remove obsolete tests based on user provided FITS files 2007-05-24 09:42 cizzo * cplcore/cpl_table.c: First working implementation of cpl_table_load() and cpl_table_save() based on CFITSIO 2007-05-23 18:04 scastro * cplcore/tests/cpl_property-test.c, cplui/tests/cpl_frame-test.c: included static qualifier in internal function to remove warning. 2007-05-23 17:28 scastro * cplui/cpl_frameset_io.c: cpl_imagelist_load_frameset(): include #else in QFITS_SUPPORT statement. 2007-05-23 17:26 scastro * cplcore/cpl_init.c: Included missing header cpl_init.h to get rid of warning. 2007-05-23 16:48 cizzo * cplcore/cpl_table.c: Work in progress (7) for new CFITSIO-based cpl_table_load/save() - excluded from compilation 2007-05-23 15:55 cizzo * cplcore/cpl_tools.h: Add entry for TNULL to CPL_FITS_BADKEYS list 2007-05-23 15:35 cizzo * cplcore/cpl_tools.h: Add entry for TDIM to CPL_FITS_BADKEYS list 2007-05-23 15:12 cizzo * cplcore/cpl_table.c: Unused variable declarations removed 2007-05-23 11:22 cizzo * cplcore/cpl_column.c: Eliminate (wrong) compiler warnings about possible use of uninitialised variables 2007-05-23 10:10 cizzo * cplcore/cpl_table.h: cpl_table_get_column_dimension() needed its type to be corrected 2007-05-23 10:10 cizzo * cplcore/cpl_table.c: Fix doc of cpl_table_set_column_dimension() and cpl_table_get_column_dimension(); the latter function needed also its type to be corrected 2007-05-23 10:06 cizzo * cplcore/tests/cpl_table-test.c: Add tests about table of images 2007-05-22 15:28 cizzo * cplcore/cpl_table.c: Unit tests successful for cpl_table_load() and cpl_table_save(), memory leaks eliminated - still excluded from compilation 2007-05-22 14:55 cizzo * cplcore/cpl_table.c: Work in progress (6) for new CFITSIO-based cpl_table_load() - excluded from compilation 2007-05-22 09:54 scastro * cplui/tests/cpl_frame-test.c: Removed inline initializations. 2007-05-21 17:01 cizzo * cplcore/cpl_table.c: Work in progress (5) for new CFITSIO-based cpl_table_load() - excluded from compilation 2007-05-21 15:05 cizzo * cplcore/cpl_table.c: Work in progress (4) for new CFITSIO-based cpl_table_load() - excluded from compilation 2007-05-21 15:04 scastro * cplui/cpl_frame.c: cpl_frame_get_nplanes(): fixed a bug when calling cx_free outside a loop. 2007-05-21 13:45 scastro * cplcore/tests/cpl_propertylist-test.c: Removed inline initializations due to non-supporting platforms. 2007-05-21 09:52 llundin * cplcore/tests/cpl_memory-test.c: cpl_sprintf() test: Allow w. warning that an illegal format is accepted (MacOS X) 2007-05-21 09:13 llundin * cpldrs/cpl_fit.c: cpl_fit_imagelist_polynomial(): Indentation, a comment 2007-05-18 17:01 cizzo * cplcore/cpl_table.c: Work in progress (3) for new CFITSIO-based cpl_table_load() - excluded from compilation 2007-05-18 13:40 llundin * cplcore/tests/cpl_memory-test.c: cpl_sprintf() tests improved on illegal format failure 2007-05-18 12:13 scastro * cplcore/cpl_propertylist.c: cpl_propertylist_get_property(): Removed inline initialization of variable to support SunOS. 2007-05-17 16:32 cizzo * cplcore/cpl_table.c: Work in progress (2) for new CFITSIO-based cpl_table_load() - excluded from compilation 2007-05-16 17:43 scastro * cplui/tests/cpl_frame-test.c: Call to renamed function. 2007-05-16 17:43 scastro * cplui/cpl_frameset_io.c: Support for renamed internal function cpl_frame_get_nplanes(). 2007-05-16 17:42 scastro * cplui/cpl_frame.c: Included @internal in doxygen text of cpl_frame_get_nplanes(). Renamed function. 2007-05-16 17:41 scastro * cplui/cpl_frame_impl.h: renamed cpl_frame_get_nplanes() 2007-05-16 17:31 scastro * cplui/tests/cpl_frame-test.c: Included cpl_frame_impl.h 2007-05-16 17:29 scastro * cplui/cpl_frameset_io.c: cpl_imagelist_load_frameset(): Included support for CFITSIO. 2007-05-16 17:27 scastro * cplui/cpl_frame.c: Renamed cpl_frame_get_nplanes() to _cpl_frame_get_nplanes() and made it private. 2007-05-16 17:25 scastro * cplui/cpl_frame.h: Moved and renamed cpl_frame_get_nplanes() to _cpl_frame_get_nplanes() in cpl_frame_impl.h. 2007-05-16 17:22 scastro * cplui/Makefile.am: include in: noninst_HEADERS, the cpl_frame_impl.h 2007-05-16 17:17 scastro * cplui/cpl_frame_impl.h: cpl_frame_impl.h has been added to CVS. It contains a private function _cpl_frame_get_nplanes(), which uses CFITSIO. 2007-05-16 17:02 cizzo * cplcore/cpl_table.c: Work in progress (1) for new CFITSIO-based cpl_table_load() - excluded from compilation 2007-05-16 16:37 scastro * cplui/cpl_frame.c: Added static qualifier for internal functions. 2007-05-15 17:09 cizzo * cplcore/tests/cpl_table-test.c: Make unique the names of the produced FITS tables, as well as some error messages 2007-05-15 17:07 cizzo * cplcore/cpl_table.c: Debugging (1) for new CFITSIO-based cpl_table_save() - excluded from compilation 2007-05-15 16:44 scastro * cplui/tests/cpl_frame-test.c: cpl_frame-test.c: included tests for cpl_frame_get_nplanes(). 2007-05-15 16:43 scastro * cplui/: cpl_frame.c, cpl_frame.h: cpl_frame_get_nplanes(): new function was added to query the number of planes in an extension. It uses CFITSIO.(function was converted from QFITS). 2007-05-15 09:02 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_{1,2}d_create(): Use CPL_ERROR_DATA_NOT_FOUND for x/xy_pos too short 2007-05-14 15:54 yjung * cplcore/: Makefile.am, cpl_xmemory.c, cpl_xmemory.h: import cpl_xmemory from qfits_memory 2007-05-14 14:55 cizzo * cplcore/cpl_table.c: Work in progress (6) for new CFITSIO-based cpl_table_save() - excluded from compilation 2007-05-14 11:59 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_1d_create(): Fixed documentation typos 2007-05-11 14:51 scastro * cpldfs/cpl_dfs.c: cpl_dfs_setup_product_header(): replaced calls to cpl_propertylsit_contains() with cpl_propertylist_has(). 2007-05-11 14:24 scastro * cplcore/cpl_propertylist.h: cpl_propertylist_get_property(): It was added in the library. 2007-05-11 14:22 yjung * cplcore/: cpl_image_io.c, cpl_imagelist_io.c, cpl_tools.c, cpl_tools.h, cpl_vector.c: call to cpl_propertylist_to_fitsfile 2007-05-11 14:19 scastro * cplcore/cpl_propertylist.c: cpl-propertylist_to_fitsfile: Removed warnings. 2007-05-11 11:19 scastro * cplcore/tests/cpl_propertylist-test.c: cpl_propertylist-test.c: included test using cpl_propertylist_to_fitsfile() and cpl_propertylist_get_property(). 2007-05-11 10:48 scastro * cplcore/cpl_propertylist_impl.h: cpl_propertylist_to_fitsfile and cpl_propertylist_from_fitsfile: Included support to CFITSIO. 2007-05-11 10:44 scastro * cplcore/cpl_propertylist.c: All cpl_propertylist_get*() and _set*(): updated the documentation to clarify that when a propertylist is searched for a property, it will return the first one it finds. New functions: cpl_propertylist_to_fitsfile() and cpl_propertylist_from_fitsfile(): Included support for CFITSIO. 2007-05-10 17:03 cizzo * cplcore/cpl_table.c: Work in progress (5) for new CFITSIO-based cpl_table_save() - excluded from compilation 2007-05-10 16:59 scastro * cplcore/cpl_memory.c: Replaced all calls to qfits_malloc, realloc, calloc and free to the system memory calls. Removed all calls to qfits functions: qfits_cache_purge(), qfits_memory_is_empty(), qfits_memory_status(). 2007-05-10 13:15 cizzo * cplcore/cpl_table.c: Work in progress (4) for new CFITSIO-based cpl_table_save() - excluded from compilation 2007-05-09 16:54 cizzo * cplcore/cpl_table.c: Work in progress (3) for new CFITSIO-based cpl_table_save() - excluded from compilation 2007-05-09 14:53 yjung * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic.h, cpl_imagelist_basic_body.h, tests/cpl_imagelist_basic-test.c: removed cpl_imagelist_basic_fit_polynomial() 2007-05-09 12:10 yjung * cpldrs/: cpl_apert/cpl_apertures.c, cpl_apert/cpl_apertures.h, cpl_apert/cpl_apertures_img.c, cpl_apert/cpl_apertures_img.h, cpl_det/cpl_detector.c, cpl_det/cpl_detector.h, cpl_det/cpl_detector_body.h, cpl_fit/cpl_fit.c, cpl_fit/cpl_fit.h, cpl_fit/cpl_fit_body.h, cpl_geom/cpl_geom_img.c, cpl_geom/cpl_geom_img.h, cpl_geom/cpl_geom_img_body.h, cpl_phot/cpl_photom.c, cpl_phot/cpl_photom.h: rm dir struct in cpldrs 2007-05-09 11:53 yjung * cplcore/Makefile.am: rm cpldrs dir struct 2007-05-09 11:38 yjung * Doxyfile.in: [no log message] 2007-05-09 11:34 yjung * acinclude.m4: rm dir struct in cpldrs 2007-05-09 11:33 yjung * doxygen/Doxyfile.in: removed dir struct in cpldrs 2007-05-09 11:28 yjung * cpldrs/: Makefile.am, cpl_apertures.c, cpl_apertures.h, cpl_apertures_img.c, cpl_apertures_img.h, cpl_detector.c, cpl_detector.h, cpl_detector_body.h, cpl_fit.c, cpl_fit.h, cpl_fit_body.h, cpl_geom_img.c, cpl_geom_img.h, cpl_geom_img_body.h, cpl_photom.c, cpl_photom.h: removed directory structure 2007-05-08 17:41 scastro * cplcore/cpl_init.c: cpl_init(): included support for CFITSIO. 2007-05-08 17:32 scastro * cplui/cpl_frame.c: cpl_frame_get_nextensions(): included support for CFITSIO. 2007-05-08 12:19 yjung * cplcore/cpl_tools.c: added the keywords sorting implementation 2007-05-07 17:38 cizzo * cplcore/cpl_table.c: Work in progress (2) for new CFITSIO-based cpl_table_save() - excluded from compilation 2007-05-07 17:09 yjung * cplcore/cpl_tools.c: [no log message] 2007-05-07 16:19 yjung * cplcore/: cpl_image_io.c, cpl_image_io_body.h, cpl_imagelist_io.c, cpl_imagelist_io_body.h, cpl_io.h, cpl_tools.c, cpl_tools.h, cpl_vector.c, tests/cpl_image_io-test.c, tests/cpl_vector-test.c: moved from QFITS to CFITSIO in cpl_vector cpl_image cpl_imagelist cpl_tools 2007-05-04 16:49 cizzo * cplcore/cpl_table.c: Work in progress for new CFITSIO-based cpl_table_save() - excluded from compilation 2007-05-04 11:26 yjung * cpldrs/tests/cpl_detector-test.c: CPL_BPP_DEFAULT ->CPL_BPP_IEEE_FLOAT 2007-05-04 11:25 yjung * cplcore/tests/: cpl_image_basic-test.c, cpl_image_filter-test.c, cpl_image_io-test.c, cpl_image_resample-test.c, cpl_imagelist_basic-test.c, cpl_imagelist_io-test.c, cpl_mask-test.c: CPL_BPP_DEFAULT -> CPL_BPP_IEEE_FLOAT 2007-04-30 17:19 rpalsa * configure.ac: Package and library version updated. 2007-04-30 16:50 rpalsa * autogen.sh, libcext/autogen.sh: Terminal output redirected, if warnings are not requested. 2007-04-30 16:15 llundin * cplcore/cpl_imagelist_io.c: cpl_imagelist_unset(): Removed unneeded array and iterations 2007-04-30 16:13 llundin * cplcore/tests/cpl_imagelist_io-test.c: cpl_imagelist_empty(): Added, unit tests cpl_imagelist_unset() 2007-04-30 15:00 llundin * cplui/cpl_frameset.c: cpl_frameset_labelise(), cpl_frameset_extract(): Improved documentation (including complexity) 2007-04-30 12:08 llundin * cplui/tests/cpl_frameset-test.c: Keep all frames for cpl_frameset_labelise() tests. Add check for memory leaks and error code. Message level runtime controlled 2007-04-30 11:09 llundin * cplui/cpl_frameset.c: cpl_frameset_labelise(): Reduce comparisons for blocks of identical tags, Add cpl_msg_debug() 2007-04-30 07:59 llundin * cplui/tests/cpl_frameset-test.c: cpl_frameset_labelise(): Add test using frame_equal() 2007-04-27 15:51 llundin * cplui/cpl_frameset.c: cpl_frameset_labelise(): Reduce complexity to O(nframes * nlabels) from O(nframes^2) 2007-04-27 15:50 llundin * cplui/tests/cpl_frameset-test.c: cpl_frameset_labelise(): Some real tests, using frame_oddeven() and frame_differ(). Removed unused functions 2007-04-27 14:17 llundin * cplui/tests/cpl_frameset-test.c: cpl_frameset_labelise(), cpl_frameset_extract(): Added trivial error handling test 2007-04-27 14:17 llundin * cplui/: cpl_frameset.c, cpl_frameset.h: cpl_frameset_labelise(), cpl_frameset_extract(): Added const modifiers to API. cpl_frameset_labelise(): Use cpl_frameset_get_next(), drop switch, nframes == 1 case 2007-04-26 15:54 rpalsa * libcext/cext/cxutils.c: cx_vasprintf(): In case the system does not provide a vasprintf, make sure that -1 is also returned if another error than an allocation failure happened. 2007-04-26 11:22 cizzo * cplcore/Makefile.am: Supporting new cpl_tools for fast cpl_table sorting 2007-04-26 11:21 cizzo * cplcore/cpl_table.c: New and much faster cpl_table_sort() version, provided by Jonas Larsen 2007-04-26 11:19 cizzo * cplcore/: cpl_tools.c, cpl_tools.h: New functions inserted for support of fast table sorting, and eliminate calls to malloc for i_stack variable 2007-04-26 11:17 cizzo * cplcore/cpl_tools_body.h: Implementation, for support of fast table sorting 2007-04-26 09:46 llundin * cpldrs/tests/cpl_fit-test.c: cpl_fit_imagelist_polynomial_tests(): Measure only FLOP/sec in cpl_fit_imagelist_polynomial() 2007-04-26 09:01 llundin * cpldrs/tests/cpl_fit-test.c: cpl.h -> cpl_init.h, cpl_memory.h, cpl_stats.h 2007-04-24 15:16 llundin * cpl.h: cpl_fit.h added 2007-04-24 14:10 llundin * cpldrs/: cpl_fit/cpl_fit.c, cpl_fit/cpl_fit_body.h, tests/cpl_fit-test.c: cpl_fit_imagelist_polynomial(), cpl_fit_imagelist_residual_{double,float,int}(): Added FLOP count. cpl_fit_imagelist_polynomial_tests()(): Added FLOP/sec 2007-04-24 13:52 llundin * cplcore/cpl_matrix.c, cpldrs/cpl_fit/cpl_fit.c: cpl_matrix_product_normal_create(), cpl_matrix_product_transpose(), cpl_matrix_solve_chol_transpose(): Removed from cpl_fit, instead use from matrix. cpl_matrix_solve_chol_transpose(): Added error codes to doxygen 2007-04-24 13:32 llundin * cplcore/cpl_polynomial.c, cplcore/cpl_tools.c, cplcore/cpl_tools.h, cpldrs/cpl_fit/cpl_fit.c: cpl_polynomial_shift_double(), cpl_vector_transform_mean(): Moved to tools (from polynomial and fit). cpl_tools_ipow(): Remove from fit (available from tools) 2007-04-24 11:47 llundin * cpldrs/: Makefile.am, cpl_fit/cpl_fit.c, cpl_fit/cpl_fit.h, cpl_fit/cpl_fit_body.h, tests/Makefile.am, tests/cpl_fit-test.c: cpl_fit_imagelist_polynomial(): Renamed from IRPLIB 2007-04-24 11:42 llundin * cplcore/: cpl_image_gen.c, cpl_image_gen_body.h: cpl_image_fill_noise_uniform(): Support also CPL_TYPE_INT 2007-04-24 10:28 llundin * cplcore/tests/cpl_memory-test.c: cpl_malloc(), cpl_calloc, cpl_realloc(), cpl_free(): Added unit tests 2007-04-23 16:01 llundin * cplcore/tests/: Makefile.am, cpl_memory-test.c: cpl_strdup() + cpl_sprintf(): Added unit tests (also covers cpl_vsprintf()) 2007-04-23 16:00 llundin * cplcore/: cpl_memory.c, cpl_memory.h, cpl_tools.c, cpl_tools.h: cpl_sprintf() + cpl_vsprintf(): Made public via a move from tools to memory module. cpl_vsprintf(): Reimplemented as a wrapper around cx_vasprintf(). cpl_memory_init(): Fixed implicit declaration 2007-04-23 08:22 cizzo * cplcore/cpl_table.c: In cpl_table_load(), report error in case of loading columnless tables 2007-04-20 16:48 cizzo * cplcore/tests/cpl_table-test.c: Test cpl_table_save() and cpl_table_load() on 0-length FITS tables 2007-04-20 16:48 cizzo * cplcore/cpl_table.c: Now cpl_table_load() allows to load 0-length FITS tables 2007-04-20 09:59 cizzo * cplcore/cpl_table.c: Fix DATE keyword deletion from table headers 2007-04-05 10:14 rpalsa * cplcore/cpl_propertylist_impl.h: Added cfitsio header include directive. cpl_propertylist_from_fitsfile(): Prototype added. Support (preliminary) for cfitsio added. 2007-04-05 10:12 rpalsa * cplcore/cpl_propertylist.h: Added cfitsio header include directive. cpl_propertylist_sort(): Prototype added. 2007-04-05 10:11 rpalsa * cplcore/cpl_propertylist.c: _cpl_propertylist_from_fitsfile(), cpl_propertylist_from_fitsfile(): Added to support FITS I/O using cfitsio cpl_propertylist_load(), cpl_propertylist_load_regexp(): Modified to support cfitsio FITS I/O. cpl_propertylist_sort(): Added. 2007-04-03 17:15 yjung * m4/cpl.m4: typo CFITIODIR -> CFITSIODIR 2007-04-03 17:10 yjung * m4/cpl.m4: typo CFITIOSDIR -> CFITIODIR 2007-04-03 17:03 yjung * cplcore/: cpl_image_io.c, cpl_image_io_body.h, cpl_imagelist_io.c, cpl_imagelist_io_body.h: imagelist loading uses CFITSIO inst of QFITS 2007-04-03 14:10 yjung * cplcore/: cpl_image_io.c, cpl_image_io_body.h, tests/cpl_image_io-test.c: cpl_image_load() and cpl_image_load_window() : QFITS -> CFITSIO 2007-03-30 11:42 rpalsa * autogen.sh, libcext/autogen.sh: libltdl configuration: Trigger for autoreconf workaround fixed (imported from trunk). 2007-03-30 11:36 rpalsa * autogen.sh, libcext/autogen.sh: libltdl configuration: Trigger for autoreconf workaround fixed. 2007-03-29 11:32 rpalsa * cpljava/Makefile.am, libcext/cext/Makefile.am, libcext/tests/Makefile.am: Use correct path for MAINTAINERCLEANFILES entries. 2007-03-29 11:21 rpalsa * cplcore/tests/Makefile.am, cpldfs/Makefile.am, cpldfs/tests/Makefile.am, cpldrs/Makefile.am, cplui/Makefile.am, cplui/tests/Makefile.am, cpldrs/tests/Makefile.am: Symbols QFITS_INCLUDES, QFITS_LDFLAGS and LIBQFITS replaced by their CFITSIO counterparts. 2007-03-29 11:18 rpalsa * cplcore/Makefile.am: Symbols QFITS_INCLUDES, QFITS_LDFLAGS and LIBQFITS replaced by their CFITSIO counterparts. 2007-03-29 11:16 rpalsa * configure.ac: Package version updated. Macro call CPL_CHECK_QFITS replaced by CPL_CHECK_CFITSIO 2007-03-29 11:15 rpalsa * acinclude.m4: All references to QFITS_INCLUDES replaced by CFITSIO_INCLUDES. 2007-03-29 11:14 rpalsa * m4/cpl.m4: Macro CPL_CHECK_CFITSIO added. 2007-03-29 09:53 rpalsa * libcext/autogen.sh, autogen.sh: libltdl configuration: Workaround for autoreconf incompatibility with libtool versions older than 2.0 updated (imported from revision 1.5) 2007-03-29 09:50 rpalsa * autogen.sh, libcext/autogen.sh: libltdl configuration: Workaround for autoreconf incompatibility with libtool versions older than 2.0 updated. 2007-03-28 16:24 rpalsa * admin/html.am: Use build directory instead of source directory as target for doxygen output. 2007-03-28 15:15 rpalsa * cplui/tests/Makefile.am: Tests for module cpl_parameterlist added (imported from trunk). 2007-03-28 15:14 rpalsa * cplui/tests/cpl_parameterlist-test.c: Added (imported from trunk) 2007-03-28 15:12 rpalsa * cplui/cpl_parameterlist.c: cpl_parameterlist_find_context(), cpl_parameterlist_find_tag(): Problem with unset context and tag fixed (imported from trunk) 2007-03-28 15:09 rpalsa * cplui/cpl_parameterlist.c: cpl_parameterlist_find_context(), cpl_parameterlist_find_tag(): Problem with unset context and tag fixed. 2007-03-28 14:33 rpalsa * cplui/tests/Makefile.am: Tests for module cpl_parameterlist added. 2007-03-28 14:32 rpalsa * cplui/tests/cpl_parameterlist-test.c: Added. 2007-03-21 18:16 llundin * cplcore/cpl_image_io.c: cpl_image_labelise_mask_create(): Allocate the temporary work-space needed by cpl_image_floodfill() 2007-03-21 16:46 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_collapse_window_create(): Several unit tests 2007-03-21 16:46 llundin * cplcore/cpl_image_basic_body.h: cpl_image_collapse_window_create(): Proper handling of bad -pixels 2007-03-20 22:23 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: cpl_image_collapse_create(): Call cpl_image_collapse_window_create() - and not vice-versa. cpl_image_collapse_window_create(): Call cpl_image_collapse_window_create_{double,float,int}(). cpl_image_collapse_window_create_{double,float,int}(): Collapse directly w. stride-2 - and not via cpl_stats 2007-03-20 22:20 llundin * cplcore/cpl_image_defs.h: Added CPL_CONCAT2X and CPL_CONCAT 2007-03-20 14:04 cizzo * cplcore/cpl_table.c: Avoid access to uninitialised data in functions cpl_table_and_selected_TYPE() 2007-03-20 14:02 cizzo * cplcore/tests/cpl_table-test.c: Add test case related to incorrect logic for arrays and strings in functions cpl_table_or_selected_invalid() and cpl_table_and_selected_invalid() (ticket DFS03619) 2007-03-20 13:36 cizzo * cplcore/cpl_table.c: Correct inverted logic for arrays and strings in functions cpl_table_or_selected_invalid() and cpl_table_and_selected_invalid() 2007-03-20 11:52 jmlarsen * cplcore/tests/cpl_table-test.c: Finished unfinished comment 2007-03-20 11:51 jmlarsen * cplcore/tests/cpl_table-test.c: Added test to expose DFS03618, and a commented-out test to expose DFS03619 2007-03-20 11:42 jmlarsen * cplcore/cpl_table.c: Fixed bug that cpl_table_erase_selected did reselect rows (DFS03618) 2007-03-13 23:48 llundin * cplcore/cpl_image_basic.h, cplcore/cpl_image_bpm.h, cplcore/cpl_image_defs.h, cplcore/cpl_image_filter.h, cplcore/cpl_image_gen.h, cplcore/cpl_image_io.h, cplcore/cpl_image_iqe.h, cplcore/cpl_imagelist_basic.h, cplcore/cpl_imagelist_defs.h, cplcore/cpl_imagelist_io.h, cplcore/cpl_mask.h, cplcore/cpl_stats.h, cpldrs/cpl_det/cpl_detector.h, cpldrs/cpl_geom/cpl_geom_img.h: Removed unused standard header files: stdio.h, stdlib.h, string.h, unistd.h, limits.h 2007-03-13 23:45 llundin * cplcore/cpl_tools.h: Added float.h and removed string.h 2007-03-13 23:44 llundin * cpldfs/tests/Makefile.am: Added LIBCPLUI to LDADD 2007-03-13 20:09 llundin * cplcore/cpl_matrix.c: cpl_matrix_get_nrow(), cpl_matrix_get_ncol() and cpl_matrix_get_data(): Do not use cpl_ensure() 2007-03-13 20:08 llundin * cplcore/cpl_error.h: cpl_ensure() + cpl_ensure_code(): Added doxygen 2007-03-09 16:42 cplmgr * ChangeLog: Updated 2007-03-09 16:38 cplmgr * libcext/ChangeLog: Updated 2007-03-09 16:34 cplmgr * configure.ac: Package version updated 2007-03-06 13:22 jmlarsen * cplcore/: cpl_column.c, cpl_table.c: Replaced some tabs with spaces 2007-03-05 11:43 llundin * cplcore/cpl_polynomial.c: cpl_vector_fill_polynomial(): Avoid repeated calls to cpl_vector_get_size() 2007-02-22 12:49 llundin * cplcore/cpl_matrix.c: cpl_matrix_product_create(): Wrap around cpl_matrix_product(). cpl_matrix_product(): Rewrite in style of cpl_matrix_product_transpose(). cpl_matrix_product(), cpl_matrix_product_transpose(), cpl_matrix_solve_chol_transpose(): Use cpl_tools_add_flops() 2007-02-22 11:27 jmlarsen * cplcore/tests/cpl_table-test.c: Added a few tests in order to have full white-box testing of cpl_table_erase_selected() and cpl_column_erase_pattern() 2007-02-22 11:25 jmlarsen * cplcore/cpl_table.c: Optimized cpl_table_erase_selected() from O(n*n) to O(n) execution time (DFS02356) 2007-02-22 11:23 jmlarsen * cplcore/: cpl_column.c, cpl_column.h: Added cpl_column_erase_pattern() in order to support O(n) cpl_table_erase_selected() (DFS02356) 2007-02-22 10:47 llundin * cplcore/: cpl_matrix.c, cpl_matrix_impl.h: cpl_matrix_product(), cpl_matrix_product_transpose() and cpl_matrix_solve_chol_transpose(): Imported from IRPLIB. cpl_matrix_get_nrow(), cpl_matrix_get_ncol() and cpl_matrix_get_data(): Use inline and cpl_ensure() 2007-02-22 10:45 llundin * cplcore/cpl_error.h: Removed unnecessary checks on __LINE__ and __FILE__ 2007-02-22 10:31 llundin * cplcore/: Makefile.am, cpl_matrix.c, cpl_tools.c, cpl_matrix_impl.h, cpl_polynomial.c, cpl_tools.h: Use cpl_matrix_impl.h for non-exported cpl_matrix functions (instead of cpl_tools) 2007-02-22 10:20 llundin * cplcore/cpl_matrix.c: cpl_matrix_swap_rows(), cpl_matrix_decomp_lu(), cpl_matrix_flip_rows(): Use static swap_rows() 2007-02-21 09:18 llundin * cplcore/cpl_tools.c: cpl_matrix_product_normal_create(): Use cpl_matrix_wrap() instead of cpl_matrix_new() 2007-02-21 09:17 llundin * cplcore/cpl_matrix.c: cpl_matrix_transpose_create() and cpl_matrix_product_create(): Use cpl_matrix_wrap() instead of cpl_matrix_new() 2007-02-16 13:39 llundin * cplcore/cpl_polynomial.c: cpl_matrix_fill_normal_vandermonde(): Improved documentation 2007-02-15 14:30 llundin * cplcore/cpl_matrix.c: cpl_matrix_{new,wrap,duplicate,extract,extract_diagonal}(): Use cpl_malloc instead of cpl_calloc() to create matrix struct 2007-02-15 13:19 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_1d_create(): Use cpl_matrix_wrap() when possible 2007-02-15 12:23 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_1d_create(): Call cpl_polynomial_set_coeff() with leading coefficient first (Discovered due to DFS03488) 2007-02-15 12:19 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_[12]d_create(): Verify that CPL error state is OK on success (bis) 2007-02-15 12:11 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_[12]d_create(): Verify that CPL error state is OK on success 2007-02-08 11:07 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_tools_ipow(): Added unit tests 2007-02-06 10:15 rpalsa * README: Add section on Gasgano support 2007-02-06 09:15 cplmgr * configure.ac: Package version updated. 2007-02-01 15:29 llundin * COPYING: Updated FSF address 2007-02-01 13:49 llundin * cplcore/cpl_error.h: Improved documentation of CPL error codes, including CPL_ERROR_EOL 2007-01-31 15:11 rpalsa * acinclude.m4: Macro CPL_BASE_PATHS(): Add directory cpl_fit to CPLDRS_INCLUDES 2007-01-31 12:07 rpalsa * cpldrs/cpl_fit/cpl_fit.c: Levenberg-Marquard implementation moved to cpl_vector_fit_impl.h in cplcore. cpl_fit_lvmq(): Made this function a wrapper for the static implementation _cpl_fit_lvmq(). 2007-01-31 11:55 rpalsa * cplcore/cpl_vector.c: cpl_vector_fit_gaussian(): Call static version of cpl_fit_lvmq instead of public interface. 2007-01-31 11:53 rpalsa * cplcore/cpl_vector_fit_impl.h: Include guards added, and FIXME warning in the beginning completed. 2007-01-31 11:45 rpalsa * cplcore/Makefile.am: noinst_HEADERS: File cpl_vector_fit_impl.h added. 2007-01-31 11:40 rpalsa * cplcore/cpl_vector_fit_impl.h: Added. 2007-01-31 11:37 rpalsa * cpljava/cpl_gasgano.c: doExec(): Macro call replaced with explicit code. Support for product MD5 sum computation for recipe plugins added. 2007-01-31 11:29 rpalsa * cpljava/Makefile.am: Add LIBCPLDFS to library dependencies. 2007-01-30 11:23 kbanse * cpljava/cpl_gasgano.c: add MD5 calculation to the doExec function 2007-01-29 11:29 rpalsa * libcext/autogen.sh: Function bt_libtoolize() added and libltdl support added. 2007-01-29 11:19 rpalsa * libcext/autogen.sh: Command 'grep -E' replaced by oldfashioned 'egrep' to make SunOS and HP-UX happy. 2007-01-29 11:15 rpalsa * autogen.sh: Command 'grep -E' replaced by oldfashioned 'egrep' to make SunOS and HP-UX happy. 2007-01-29 09:40 rpalsa * cplcore/Makefile.am: Add directory cpldrs/cpl_fit to INCLUDES. It is required by cpl_vector_fit_gaussian(). Note: This breaks the library hierarchy! 2007-01-29 09:21 jmlarsen * cpldrs/cpl_fit/cpl_fit.h: Ooops. Added missing #endif 2007-01-25 12:00 jmlarsen * Doxyfile.in: Moved non-linear fitting routine to cpldrs 2007-01-25 11:38 jmlarsen * cplcore/cpl_vector.c, cplcore/cpl_matrix.c, cplcore/cpl_matrix.h, cpldrs/Makefile.am, cpldrs/cpl_fit/cpl_fit.c, cpldrs/cpl_fit/cpl_fit.h, doxygen/Doxyfile.in: Moved non-linear fitting routine to cpldrs (Klaus' orders) 2007-01-25 11:36 jmlarsen * cplcore/cpl_vector.h: Moved typedef of cpl_vector to after includes 2007-01-24 13:55 cplmgr * configure.ac: Package version updated. 2007-01-24 13:54 rpalsa * README: CPL package version updated 2007-01-23 15:14 jmlarsen * cplcore/cpl_matrix_type.h: Moved matrix type definition back to cpl_matrix.h and solved the cyclic inclusion problem by a re-ordering of typedefs and includes, similar to what is done elsewhere in CPL 2007-01-23 15:06 jmlarsen * cplcore/tests/cpl_vector-test.c: Added simple test of cpl_vector_fit_gaussian 2007-01-23 15:05 jmlarsen * cplcore/: cpl_matrix.h, cpl_vector.c, cpl_vector.h: Moved matrix type definition back to cpl_matrix.h and solved the cyclic inclusion problem by a re-ordering of typedefs and includes, similar to what is done elsewhere in CPL 2007-01-23 14:15 jmlarsen * cplcore/cpl_vector.h: Include cpl_matrix_type.h instead of cpl_matrix.h to avoid cyclic inclusion 2007-01-23 14:13 jmlarsen * cplcore/: cpl_matrix.c, cpl_vector.c: Exported non-linear fitting routine 2007-01-23 14:12 jmlarsen * cplcore/: cpl_matrix.h, cpl_matrix_type.h: Moved cpl_matrix typedef to separate header file 2007-01-19 10:01 cizzo * cplcore/cpl_matrix.c: Change cpl_matrix_dump to a more flexible format 2007-01-18 08:57 llundin * cpldfs/cpl_dfs.c: cpl_dfs_setup_product_header(): Fixed cast warning from splint, replace fid with cpl_func, remove static from xfid, replace 0x0 with NULL, use cpl_ensure_code(), drop obsolete cast on qifts_is_fits(), drop obsolete fix for DFS02961, added FIXME for product group and spurious function name in error message 2007-01-17 14:30 llundin * cpldfs/: cpl_dfs.c, cpl_dfs.h, tests/cpl_dfs-test.c: cpl_dfs_update_product_header(): Added 2007-01-17 14:30 llundin * cplcore/: cpl_tools.c, cpl_tools.h: cpl_sprintf(): Added 2007-01-17 13:21 jmlarsen * doxygen/Doxyfile.in: Undo previous erroneous commit 2007-01-17 13:17 jmlarsen * cplcore/cpl_image_iqe.c, doxygen/Doxyfile.in: Declared static the functions which are not supposed to be exported. WARNING: Duplicate code! Great care should be excersized if the code is reimported from RTD 2007-01-16 15:06 llundin * cplcore/: cpl_msg.c, cpl_msg.h, cpl_tools.c, cpl_tools.h: cpl_msg_set_level_from_env(): Moved to (public) msg-module from tools 2007-01-12 11:01 llundin * cplcore/cpl_matrix.c: const char * fid replaced by cpl_func 2007-01-12 10:50 llundin * cplcore/cpl_matrix.c: Replaced 0x0 with NULL, fixed some implicit cast warnings 2007-01-12 10:22 llundin * cplcore/: cpl_matrix.c, tests/cpl_matrix-test.c: cpl_matrix_solve_lu(): Fix memory leak on illegal input 2007-01-11 11:19 jmlarsen * cplcore/cpl_vector.c: cpl_vector_fit_gaussian: Made estimation of offset more robust for noisy inputs, and estimation of centroid slightly more accurate (DFS03329) 2007-01-11 10:47 llundin * cpldrs/cpl_geom/cpl_geom_img.c: cpl_geom_img_offset_combine(), cpl_geom_img_offset_saa(): Use @code/@endcode 2007-01-11 10:13 yjung * cplcore/cpl_image_iqe.c: [no log message] 2007-01-11 09:21 yjung * cplcore/cpl_io.h: DFS02998 2007-01-10 16:33 yjung * cplcore/: cpl_vector.c, cpl_vector.h: added cpl_vector_get_median_modify() (DFS03223) 2007-01-10 14:58 yjung * cplcore/: cpl_imagelist_basic.c, tests/cpl_imagelist_basic-test.c: added bad pixels handlingin cpl_imagelist_swap_axis_create() 2007-01-10 09:16 yjung * cplcore/cpl_imagelist_basic.c: [no log message] 2007-01-10 09:11 yjung * cplcore/tests/cpl_imagelist_basic-test.c: added test for cpl_imagelist_swap_axis_create() 2007-01-09 16:40 yjung * cplcore/: cpl_image_basic.h, cpl_imagelist_basic.c, cpl_imagelist_basic.h, cpl_imagelist_basic_body.h, tests/cpl_imagelist_basic-test.c: added cpl_imagelist_swap_axis_create() (DFS03234) 2007-01-09 09:11 yjung * cplcore/cpl_vector.c: Added doc for cpl_vector_new() (DFS03317) 2006-12-20 12:59 yjung * cplcore/: cpl_image_io.c, cpl_vector.c: [no log message] 2006-12-13 16:00 yjung * cplcore/: cpl_image_io.c, cpl_vector.c: Solve DFS03286: wrong DATE key with empty data units 2006-12-08 13:54 yjung * cplcore/cpl_tools.c: do not remove DATAMD5 any more 2006-12-01 14:15 yjung * cplcore/: cpl_image_io.c, cpl_imagelist_io.c, cpl_vector.c: removed MD5 key 2006-12-01 10:32 cizzo * cplcore/cpl_table.c: Do not add anymore the DATAMD5 placeholder (done in function cpl_dfs_setup_product_header() 2006-12-01 10:27 cizzo * cpldfs/cpl_dfs.c: Add DATAMD5 placeholder 2006-11-29 13:09 llundin * cplcore/cpl_tools.c: cpl_tools_gen_valid_header(): Replace cpl_propertylist_duplicate() + cpl_propertylist_erase_regexp() with cpl_propertylist_copy_property_regexp(), limit scope of some variables 2006-11-29 13:08 llundin * cplcore/tests/cpl_vector-test.c: Added cpl_vector_save_bench(). Check vector contens after save/load 2006-11-27 12:31 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h, tests/cpl_image_basic-test.c: Use sqrt() instead of pow() in special case for efficiency reason. (DFS03222) 2006-11-27 11:33 yjung * cplcore/: cpl_image_io.c, cpl_imagelist_io.c, cpl_vector.c: added some documentation (DFS03190) 2006-11-27 11:19 yjung * cplcore/cpl_image_iqe.c: added dof cpl_image_iqe() (DFS03188) 2006-11-24 09:00 cizzo * cplcore/cpl_table.c: Remove computation of md5 signature in cpl_table_save() 2006-11-23 17:54 yjung * cplcore/cpl_image_io.c: [no log message] 2006-11-23 17:51 yjung * cplcore/: cpl_image_io.c, cpl_imagelist_io.c, cpl_vector.c: removed MD5 computation - this task is moved to the caller application 2006-11-22 15:53 yjung * cplcore/cpl_image_bpm.c: fixed cpl_image_accept (DFS03258) to make it faster 2006-11-21 16:11 llundin * cplcore/cpl_image_basic.c: cpl_image_flip(): Add FIXME comment 2006-11-21 14:41 rpalsa * configure.ac: Package and library version updated. 2006-11-21 14:40 rpalsa * cpljava/cpl_gasgano.c: Start doing some stylistic changes to bring it in line with the CPL conventions. 2006-11-21 14:38 rpalsa * cpljava/Makefile.am: Add symbol GASGANO_SHREXT to libgasgano_la_LDFLAGS to enforce the proper filename suffix. Needed for Mac OS X support. 2006-11-21 13:54 rpalsa * acinclude.m4: CPL_PATH_JAVA(): Better support for Mac OS X. CPL_ENABLE_GASGANO(): Use required library filename suffix on Mac OS X. 2006-11-17 15:28 llundin * cplcore/cpl_imagelist_basic_body.h: cpl_imagelist_collapse_median_create(): Fill multiple timelines depending on L2-cache size 2006-11-17 15:27 llundin * cplcore/tests/cpl_imagelist_basic-test.c: Added cpl_imagelist_fit_polynomial_bench(). Benchmark only with msg-level info (or debug) 2006-11-17 13:36 rpalsa * acinclude.m4: In CPL_PATH_GASGANO(): Typo in test statement fixed. 2006-11-17 09:57 rpalsa * acinclude.m4: In CPL_PATH_JAVA(): Command line option --with-java-includes-md added. 2006-11-17 09:56 yjung * cplcore/: cpl_image_stats.c, cpl_vector.c: added doc for median of even number of samples (DFS03221) 2006-11-17 09:44 rpalsa * cpljava/Makefile.am: Symbol GASGANO_NATIVE_INCLUDES defined. Rules for the individual header files merged into one. 2006-11-17 09:42 rpalsa * acinclude.m4: Obsolete macro CPL_HEADER_GASGANO removed. Macro CPL_CLASSPATH_GASGANO added. In CPL_PATH_JAVA(): Checks for javah added. 2006-11-17 09:40 rpalsa * configure.ac: Package version updated. Obsolete call to CPL_HEADER_HASGANO removed. Explicit call to CPL_CLASSPATH_GASGANO added. 2006-11-16 10:20 rpalsa * cpljava/Makefile.am: Add INCLTDL to INCLUDES. 2006-11-16 09:58 llundin * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic_body.h: cpl_imagelist_collapse_median_create(): Compute median using type of pixel (instead of always casting to double) 2006-11-16 09:57 llundin * cplcore/tests/cpl_imagelist_basic-test.c: cpl_imagelist_collapse_median_create(): Added unit tests and benchmark 2006-11-15 17:52 yjung * cplcore/cpl_image_io.c: bug fix (related to DFS03204) 2006-11-15 17:43 yjung * cplcore/tests/cpl_image_io-test.c: added test case for cpl_imagesave with CPL_BPP_16_UNSIGNED 2006-11-15 16:45 rpalsa * configure.ac: Explicit call to CPL_PATH_GASGANO added. 2006-11-15 16:43 rpalsa * cpljava/Makefile.am: libcplgasgano_la_SOURCES: Source file javacpl.c renamed to cpl_gasgano.c 2006-11-15 16:41 rpalsa * cpljava/: Makefile.am, cpl_gasgano.c: Added. 2006-11-15 16:39 rpalsa * Makefile.am: Support for the optional Gasgano interface library added. 2006-11-15 16:38 rpalsa * cpl.h: Headers for the cpl_framedata and cpl_recipeconfig modules added. 2006-11-15 16:37 rpalsa * autogen.sh: Support for libltdl configuration added. 2006-11-15 16:36 rpalsa * acinclude.m4: Macros CPL_PATH_JAVA, CPL_PATH_GASGANO, CPL_HEADER_GASGANO and CPL_ENABLE_GASGANO added. 2006-11-15 16:35 rpalsa * configure.ac: Checks for JDK and Gasgano added. Support for the optional gasgano interface library added. 2006-11-15 16:33 rpalsa * libltdl/.cvsignore: Added. 2006-11-15 16:04 yjung * cplcore/: cpl_image_io.c, cpl_image_io_body.h, cpl_imagelist_io.c, cpl_imagelist_io_body.h, cpl_io.h: DFS03204 : allow to save UNSIGNED 16 bits int (image and imagelist) 2006-11-13 14:38 llundin * cplcore/tests/cpl_matrix-test.c: cpl_matrix_get_determinant(): Test also with an existing error code 2006-11-13 14:36 llundin * cplcore/cpl_matrix.c: cpl_matrix_get_determinant(): Call cpl_error_pop() iff cpl_error_push() is called 2006-11-13 10:16 llundin * cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_stats-test.c, cplcore/tests/cpl_vector-test.c, cpldfs/tests/cpl_dfs-test.c, cpldrs/tests/cpl_photom-test.c: Removed \n from messages 2006-11-13 10:14 llundin * cpldrs/tests/cpl_apertures-test.c: Removed \t from messages 2006-11-13 10:04 llundin * cplcore/tests/cpl_image_basic-test.c: Removed shadowed declaration. Removed \t from cpl_msg_info() 2006-11-13 09:57 llundin * libcext/tests/: cxlist-test.c, cxmap-test.c, cxslist-test.c, cxstring-test.c, cxtree-test.c: main(): Explicitly declare argument as void 2006-11-13 09:51 llundin * cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_bpm-test.c, cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_gen-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_image_iqe-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_mask-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_msg-test.c, cplcore/tests/cpl_property-test.c, cplcore/tests/cpl_propertylist-test.c, cplcore/tests/cpl_stats-test.c, cplcore/tests/cpl_table-test.c, cplcore/tests/cpl_vector-test.c, cpldrs/tests/cpl_apertures-test.c, cpldrs/tests/cpl_detector-test.c, cpldrs/tests/cpl_geom_img-test.c, cplui/tests/cpl_frame-test.c, cplui/tests/cpl_framedata-test.c, cplui/tests/cpl_frameset-test.c, cplui/tests/cpl_parameter-test.c, cplui/tests/cpl_plugin-test.c, cplui/tests/cpl_pluginlist-test.c, cplui/tests/cpl_recipeconfig-test.c: main(): Explicitly declare argument as void 2006-11-13 09:51 llundin * cplcore/cpl_imagelist_basic_body.h: cpl_imagelist_fit_polynomial(): Minor improvement on error-computation 2006-11-13 09:26 llundin * cplcore/tests/cpl_polynomial-test.c: Fix gcc-warning: main(). Added test: cpl_memory_is_empty(). Removed shadowed declarations 2006-11-13 09:02 llundin * cplcore/cpl_image_basic.c: Fix cpp warning: undef CPL_IMAGE_BASIC_OP_SCALAR 2006-11-13 09:02 llundin * cplcore/: cpl_image_basic_body.h, cpl_image_resample_body.h: Fix cpp warning: undef CPL_OPERATION 2006-11-10 16:30 llundin * cplcore/tests/cpl_imagelist_basic-test.c: cpl_imagelist_fit_polynomial(): Added tests 2006-11-10 16:30 llundin * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic_body.h: Fix warning: defined CPL_CLASS. cpl_imagelist_fit_polynomial(): Corrected documentation, Added a couple of new CPL error codes, Try to avoid resetting existing CPL error code on success, Reduce memory usage, Increase speed 2006-11-07 14:10 cizzo * cplcore/cpl_table.c: Release memory of possible nulls buffer in case of 3d tables 2006-11-03 10:28 rpalsa * cplcore/cpl_version.c: cpl_version_get_version(): Documentation updated. 2006-11-02 16:43 llundin * cplcore/cpl_imagelist_basic.h: cpl_imagelist_power_scalar(): Removed, has no definition 2006-11-02 15:46 llundin * cplcore/cpl_imagelist_basic.h: Fixed typo 2006-10-31 15:58 rpalsa * cplui/tests/Makefile.am: Testcases for modules cpl_framedata and cpl_recipeconfig added. 2006-10-31 15:57 rpalsa * cplui/Makefile.am: Modules cpl_framedata and cpl_recipeconfig added. 2006-10-31 15:55 rpalsa * configure.ac: Package and library version updated. 2006-10-31 15:54 rpalsa * cplui/cpl_recipe.h: Type cpl_recipe2 and structure definition struct _cpl_recipe2_ added. 2006-10-31 15:52 rpalsa * cplui/cpl_plugin.h: enum _cpl_plugin_type: constant CPL_PLUGIN_TYPE_RECIPE_V2 added. 2006-10-31 15:48 rpalsa * cplui/: tests/cpl_framedata-test.c, tests/cpl_recipeconfig-test.c, cpl_framedata.c, cpl_framedata.h, cpl_recipeconfig.c, cpl_recipeconfig.h: Added. 2006-10-31 15:19 rpalsa * acinclude.m4: CPL_BASE_PATH: Build tree added to includes. 2006-10-16 11:53 llundin * cplcore/cpl_image_basic.c: cpl_image_get_fwhm(): Improved comment on cpl_error_push/pop() 2006-10-12 11:47 jmlarsen * cplcore/cpl_vector.c: Reduced source code line length 2006-10-11 15:45 jmlarsen * cplcore/cpl_vector.c: cpl_fit_lm(): Avoid resetting an existing error (DFS03176) 2006-10-10 14:44 llundin * cplcore/cpl_image_basic.c: cpl_image_fit_gaussian(): Replace calls to cpl_error_reset()+cpl_error_set_code() with cpl_error_push()+cpl_error_pop() (DFS03174) 2006-10-10 13:34 llundin * cplcore/cpl_stats.c: cpl_stats_new_from_image_window(): Correct handling of round-off for CPL_STATS_CENTROID (DFS03173) 2006-10-07 07:09 yjung * cplcore/cpl_image_basic_body.h: DFS03169 : bug in cpl_image_threshold() 2006-10-04 13:44 llundin * cpldrs/tests/cpl_apertures_img-test.c: Added more unit tests of cpl_apertures_get_fwhm() 2006-10-04 13:42 llundin * cpldrs/cpl_apert/: cpl_apertures_img.c, cpl_apertures_img.h: cpl_apertures_get_fwhm(): Add const modifiers to input, check errors from call to cpl_image_get_fwhm() - ignoring all but CPL_ERROR_DATA_NOT_FOUND (except when that happens for all apertures) 2006-10-04 13:34 llundin * cplcore/cpl_image_basic.c: cpl_image_get_fwhm(): Work-around for missing guard in cpl_error_push() 2006-09-29 11:19 cizzo * cplcore/cpl_column.c: Functions cpl_column_get_array() and _get_string() didn't report out-of-range access 2006-09-29 11:07 cizzo * cplcore/cpl_table.c: Minor code formatting 2006-09-29 10:24 yjung * cplcore/cpl_mask.c, cpldrs/cpl_apert/cpl_apertures.c: DFS03150 : closing <-> opening 2006-09-28 17:35 yjung * cplcore/cpl_image_filter_body.h: DFS03156: add a check on the filter norm before dividing with it... 2006-09-15 09:43 llundin * cplui/cpl_plugin.c: cpl_plugin_init(): Fixed doxygen typo 2006-09-14 10:12 llundin * cplcore/tests/cpl_msg-test.c: Corrected buffer size 2006-09-12 16:43 llundin * acinclude.m4, configure.ac, cpl.h, cplcore/Makefile.am, cplcore/cpl_error.h, cplcore/cpl_func.h.bot, cplcore/cpl_func.h.top: Make cpl_func work outside of CPL 2006-09-05 10:09 cplmgr * libcext/ChangeLog, ChangeLog: Updated. 2006-09-04 13:47 yjung * cpldrs/cpl_apert/cpl_apertures.c: added documentation for the centroiding computation 2006-09-04 12:03 yjung * cpldrs/cpl_apert/cpl_apertures.c: DFS03116: centroid computation wrong if all pixels to 0 2006-08-29 10:48 llundin * cplcore/tests/cpl_matrix-test.c: Take into account -O0 for DFS03097 test 2006-08-29 10:12 yjung * cplcore/tests/cpl_vector-test.c: added tests for cpl_vector_load() cpl_vector_save 2006-08-29 09:42 yjung * cplcore/: cpl_bivector.c, cpl_bivector.h, cpl_vector.c, cpl_vector.h, tests/cpl_bivector-test.c, tests/cpl_vector-test.c: Solved DFS03083: new cpl_vector_save() cpl_vector_load() functions 2006-08-29 09:33 yjung * cplcore/tests/cpl_image_gen-test.c: warniong 2006-08-28 15:55 yjung * cplcore/cpl_image_iqe.c: declared cpl_iqe() as static 2006-08-28 15:22 yjung * cplcore/cpl_vector.c: [no log message] 2006-08-28 14:45 yjung * cplcore/: cpl_vector.c, cpl_vector.h: added cpl_vector_save() and cpl_vector_append() as static functions 2006-08-28 14:44 llundin * cplcore/tests/cpl_matrix-test.c: Added tests related to DFS03097 2006-08-28 14:44 llundin * cplcore/cpl_matrix.c: cpl_matrix_decomp_lu(): Last pivot bug. cpl_matrix_solve_chol(): Fix similar to DFS3097 2006-08-28 13:16 llundin * cplcore/cpl_matrix.c: cpl_matrix_solve_lu(): Fix for DFS03097 2006-08-28 10:06 yjung * cplcore/cpl_image_basic_body.h: cpl_error_get_code --> cpl_error_get_code() !!!! 2006-08-25 14:06 cizzo * cplcore/cpl_table.c: Upgrade documentation 2006-08-23 15:44 yjung * cplcore/: cpl_imagelist_defs.h, cpl_imagelist_io.c, cpl_imagelist_io.h: removed unused nalloc private member. Added cpl_imagelist_unset() (DFS02455) 2006-08-23 14:24 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h, cpl_stats.c, cpl_stats_body.h: DFS03079 : efficiency problems solved with cpl_stats_image (allocate/deallocate the full bpm ...) 2006-08-23 13:30 yjung * cplcore/cpl_image_stats.c: DFS03084 : memory leak if no good pixel 2006-08-23 13:19 yjung * cplcore/cpl_stats.c: DFS03016: handle the no good pixels case 2006-08-07 09:38 cizzo * cplcore/cpl_array.c: Eliminate memory leak in cpl_array_duplicate() 2006-08-06 11:06 cizzo * cplcore/cpl_table.c: Fix memory leaks in cpl_table_load() and cpl_table_save() 2006-07-25 15:59 rpalsa * libcext/cext/cxmemory.c: cx_memory_calloc_fallback(): Inline function specifier removed to avoid problems with gcc 4.1.x. 2006-07-25 15:57 rpalsa * cplcore/cpl_msg.c: _cpl_print_err(), _cpl_print_out(), _cpl_change_width(): Inline function specifier removed to avoid problems with gcc 4.1.x 2006-07-25 15:54 rpalsa * cplui/cpl_frameset.c: _cpl_frameset_compare(): Inline function specifier removed to avoid problems with gcc 4.1.x 2006-07-24 10:19 cplmgr * libcext/ChangeLog, ChangeLog: Updated. 2006-07-24 10:07 cplmgr * configure.ac: Package version updated. 2006-07-21 09:25 rpalsa * cpl.h: Header cpl_version.h added. 2006-07-21 09:24 rpalsa * cplui/cpl_parameter.c: cpl_parameter_get_string(): Documentation updated with correct return value in case of an error. 2006-07-21 09:19 rpalsa * cplcore/cpl_propertylist.c: cpl_propertylist_get_bool(): Documentation beautified. 2006-07-21 09:12 rpalsa * libcext/m4/eso.m4: Definition of ESO_ENABLE_DEBUG: Typo fixed in check for support of the gcc compiler option -g3. 2006-07-17 17:34 yjung * cplcore/cpl_memory.c: [no log message] 2006-07-13 08:49 jmlarsen * cplcore/cpl_vector.c: cpl_vector_fit_gaussian(): Make sure that returned sigma is always positive 2006-07-10 13:39 cizzo * cplcore/cpl_table.c: More clear documentation on the meaning of resetting the selection flags 2006-07-10 10:49 cizzo * cplcore/cpl_table.c: cpl_table_save() now erases possible WCS keywords from output property list 2006-07-10 09:47 cizzo * cplcore/cpl_table.c: cpl_table_compare_structure() was setting error code when comparing different tables with same number of columns 2006-07-10 09:16 cizzo * cplcore/cpl_error.c: Redefinition of MAX_FILE_LENGTH 2006-07-03 13:55 cizzo * cplcore/cpl_table.c: Correct error handling in several functions, using cpl_error_push() and _pop() where necessary 2006-07-03 10:43 cizzo * cplcore/cpl_table.c: Correct error handling in cpl_table_sort() 2006-06-30 15:23 llundin * cplcore/tests/cpl_propertylist-test.c: Test 17: Removed unnecessary code 2006-06-30 14:33 rpalsa * cplcore/cpl_propertylist.c: cpl_propertylist_to_fits(): Avoid writing beyond string buffer boundaries. 2006-06-30 11:55 llundin * cplcore/cpl_error.c: cpl_error_get_where(): Replaced all strcpy()/strcat()/sprintf() with a single snprintf() 2006-06-30 11:18 llundin * cplcore/tests/cpl_propertylist-test.c: Added variable-key-length test of cpl_propertylist_to_fits() 2006-06-30 11:18 llundin * cplcore/tests/: Makefile.am, cpl_msg-test.c: Added cpl_msg-test.c 2006-06-27 10:32 llundin * cplcore/cpl_image_basic.c, cplcore/cpl_image_bpm.c, cplcore/cpl_image_io.c, cpldrs/cpl_apert/cpl_apertures.c: cpl_ensure(, CPL_ERROR_<*>) -> cpl_ensure_code() 2006-06-27 10:31 llundin * cplcore/cpl_imagelist_io.c: cpl_ensure(, CPL_ERROR_<*>) -> cpl_ensure_code(). Removed qfits-casts 2006-06-27 10:30 llundin * cpldrs/cpl_det/cpl_detector.c: cpl_flux_get_noise_ring(): Fixed gcc warning 2006-06-26 16:13 cizzo * cplcore/: cpl_array.c, cpl_table.c: Eliminate several strict compiler warnings 2006-06-26 15:54 cizzo * cplcore/: cpl_matrix.c, cpl_msg.c: Eliminate several strict compiler warnings 2006-06-26 15:46 cizzo * cplcore/cpl_column.c: Eliminate several strict compiler warnings 2006-06-26 14:15 rpalsa * cplui/tests/cpl_plugin-test.c: Version string test updated to new version string format. 2006-06-26 13:59 cplmgr * ChangeLog: Updated. 2006-06-26 13:52 cplmgr * configure.ac: Package version updated. 2006-06-26 13:52 cplmgr * libcext/ChangeLog: Updated. 2006-06-26 11:00 llundin * cplcore/cpl_vector.c: cpl_vector_set_size(): Fixed doc-bug 2006-06-26 09:08 rpalsa * cplui/cpl_plugin.c: cpl_plugin_get_version_string(): Version string format changed. 2006-06-22 15:45 cizzo * cplcore/cpl_array.c: Fix wrong argument name in cpl_array_get_size() doc 2006-06-13 14:16 rpalsa * libcext/tests/Makefile.am: AM_LDFLAGS: Changed from -all-static to -static, so that the tests may be used with valgrind. 2006-06-13 14:09 rpalsa * libcext/.cvsignore: Updated to package version 1.0.5. 2006-06-13 14:04 rpalsa * libcext/: cext/cxlist.c, cext/cxfileutils.h, cext/cxfileutils.c, templates/Makefile.am.tmpl, templates/source.c.tmpl, templates/source.h.tmpl, doxygen/Doxyfile.in, admin/html.am: Updated to package version 1.0.5. 2006-06-13 14:01 rpalsa * libcext/cext/: Makefile.am, cxutils.h, cxutils.c, cxtypes.h.top, cxtree.h, cxtree.c, cxstrutils.h, cxstrutils.c, cxstring.h, cxstring.c, cxslist.h, cxslist.c, cxmultimap.h, cxmultimap.c, cxmessages.h, cxmessages.c, cxmemory.h, cxmemory.c, cxmap.h, cxmap.c, cxmacros.h, cxlist.h: Updated to package version 1.0.5. 2006-06-13 14:00 rpalsa * libcext/cext/snprintf.c: Beautified. 2006-06-13 13:57 rpalsa * libcext/: tests/cxtree-test.c, tests/cxstring-test.c, tests/cxslist-test.c, tests/cxmap-test.c, tests/cxlist-test.c, cext/snprintf.h: Updated to package version 1.0.5. 2006-06-13 13:56 rpalsa * libcext/tests/Makefile.am: Updated to package version 1.0.5. AM_LDFLAGS: Changed from -all-static to -static, so that tests can be used with valgrind. 2006-06-13 13:53 rpalsa * libcext/: Makefile.am, Doxyfile.in, COPYING, configure.ac: Updated to package version 1.0.5. 2006-06-13 13:47 rpalsa * tests/Makefile.am: AM_LDFLAGS: Changed from -all-static to -static, in order to use the tests with valgrind. 2006-06-12 15:38 rpalsa * libcext/cext/cxslist.c: Extra empty line added. 2006-06-12 15:37 rpalsa * libcext/cext/cxmessages.h: Extra line at the end removed. 2006-06-12 15:37 rpalsa * libcext/tests/cxmap-test.c: cx_test_map_greater_char(): Put back. 2006-06-12 13:25 rpalsa * libcext/tests/cxmap-test.c: cx_test_map_dump(): keyword static added to function definition 2006-06-12 13:25 rpalsa * libcext/tests/cxtree-test.c: cx_test_tree_dump(): keyword static added to function definition 2006-06-12 13:25 rpalsa * libcext/tests/cxslist-test.c: cx_test_slist_dump(): keyword static added to function definition 2006-06-12 12:09 rpalsa * libcext/tests/cxlist-test.c: cx_test_list_dump(): keyword static added to function definition 2006-06-12 11:54 rpalsa * libcext/cext/: cxslist.h, cxstring.c, cxstring.h, cxstrutils.h, cxtree.c, cxtree.h, cxtypes.h.top, cxutils.c, cxutils.h, snprintf.h, cxfileutils.c, cxfileutils.h, cxlist.h, cxmacros.h, cxmap.c, cxmap.h, cxmemory.c, cxmemory.h, cxmessages.c, cxmessages.h, cxmultimap.c, cxmultimap.h: Copyright and FSF address updated. 2006-06-12 11:52 rpalsa * libcext/tests/cxstring-test.c: Copyright updated. 2006-06-12 11:06 rpalsa * libcext/COPYING: Copyright and FSF address updated. 2006-06-12 11:01 rpalsa * libcext/: tests/Makefile.am, tests/cxlist-test.c, tests/cxmap-test.c, tests/cxslist-test.c, tests/cxtree-test.c, cext/Makefile.am, Makefile.am: Copyright and FSF address updated. 2006-06-12 10:46 rpalsa * libcext/cext/: cxlist.c, cxslist.c, cxstrutils.c: Fixes from CPL-1_0-BRANCH for non-standard (non C99) usage of the inline function specifier merged in. 2006-06-12 10:43 rpalsa * libcext/tests/cxstring-test.c: Disable terminal output from individual tests by default. Environment variable VERBOSE is used to enable verbose output from the tests. 2006-06-12 10:41 rpalsa * libcext/configure.ac: Package and library version updated. 2006-06-09 14:56 rpalsa * libcext/cext/: cxlist.c, cxslist.c, cxstrutils.c: Non standard (C99) usage of inline function specifier fixed. 2006-06-09 14:54 rpalsa * libcext/tests/cxstring-test.c: Disable terminal output from individual tests by default. (Needs to be improved!) 2006-06-07 15:15 rpalsa * cplui/cpl_frameset.c: cpl_frameset_get_frame(): Documentation updated. 2006-06-07 11:27 rpalsa * cplcore/cpl_propertylist.c: cpl_propertylist_copy_property_regexp(): Do not generate an error if the source list is empty, but rather do nothing. Memory leaks fixed. 2006-06-06 16:21 rpalsa * cplcore/: cpl_propertylist.c, cpl_propertylist.h: cpl_propertylist_get(): const qualifier added to first argument. 2006-06-06 15:46 rpalsa * cplui/cpl_parameter.c: _cpl_parameter_init(): Use cpl_error_push()/cpl_error_pop() instead of cpl_error_get_code()/cpl_error_set_code(). 2006-06-06 15:26 rpalsa * cplui/cpl_frameset.c: cpl_frameset_insert(): Function documentation updated with respect to transfer of ownership of frames. 2006-06-06 14:59 rpalsa * cplui/tests/cpl_frameset-test.c: Compiler warnings fixed. Properly deallocate the created frameset at the end. 2006-06-01 15:52 rpalsa * cplcore/cpl_version.h.bot: Line feed added at the end of the file. 2006-06-01 15:28 llundin * cpldfs/tests/Makefile.am: Added CPLUI_INCLUDES to includes 2006-06-01 15:28 llundin * cpldfs/cpl_dfs.h: Changed DFS_H to CPL_DFS_H 2006-06-01 10:13 jmlarsen * cplcore/cpl_vector.c: Replaced M_PI -> CX_PI 2006-05-31 15:58 llundin * cplcore/tests/cpl_vector-test.c: cpl_vector_correlate(): Raised bar for -O3 2006-05-31 15:44 jmlarsen * cplcore/: cpl_vector.c, cpl_vector.h: Imported 1d Gaussian fitting routine from IRPLIB 2006-05-31 13:28 llundin * cpldfs/cpl_dfs.c: cpl_dfs_setup_product_header(): Use cpl_propertylist_load_regexp() for loading DATAMD5 from input calib frames 2006-05-31 11:49 llundin * cpldfs/cpl_dfs.c: cpl_dfs_setup_product_header(): Fixed DFS02964, use cpl_propertylist_load_regexp() 2006-05-31 11:44 llundin * cpldfs/tests/cpl_dfs-test.c: cpl_dfs_setup_product_header(): Added a simple successful call 2006-05-31 11:30 llundin * cpldfs/tests/cpl_dfs-test.c: Added some more checks of error handling 2006-05-31 10:42 llundin * cpldfs/tests/: Makefile.am, cpl_dfs-test.c, cpl_prokeys-test.c: Added a (simple) test of cpl_dfs_setup_product_header() 2006-05-30 16:57 cizzo * cplcore/cpl_error.c: Avoid doc for cpl_error_set_code() 2006-05-30 16:23 llundin * cpldfs/cpl_dfs.c: cpl_dfs_setup_product_header(): Copy properties via cpl_propertylist_{copy,erase}_regexp() (DFS02790), Remove const char * gcc-warnings 2006-05-18 17:12 yjung * cplcore/cpl_imagelist_basic_body.h: BUG recently introduced - removed 2006-05-18 09:31 llundin * cplcore/cpl_error.h: Removed kludgey cpl_msg.h (unneeded with cpl_assure reemoved) 2006-05-18 09:29 llundin * cplcore/cpl_tools.h: Included cpl_msg.h (for testing macros) 2006-05-17 16:24 yjung * cplcore/cpl_imagelist_io_body.h: improve the image_list loading efficiency 2006-05-17 15:14 llundin * cplcore/cpl_error.h: cpl_assure{,_code}() removed 2006-05-17 14:27 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: cpl_polynomial_create_collapse(): Renamed to cpl_polynomial_extract() 2006-05-15 17:00 rpalsa * doxygen/cpl.css: Fonts changed. 2006-05-15 16:58 rpalsa * cplui/cpl_frameset.c: cpl_frameset_get_frame(): Second argument "index" renamed to "position" to avoid shadowing of a global symbol. _cpl_frameset_get(): "static" qualifier added to internal function definition. 2006-05-15 16:55 rpalsa * cplui/cpl_frameset.h: cpl_frameset_get_frame(): Compiler warnings fixed. Second argument renamed to "position". 2006-05-15 16:53 rpalsa * cpldfs/cpl_dfs.c: cpl_dfs_setup_product_header(): Calls to cpl_propertylist_erase_regexp() updated. 2006-05-15 16:50 rpalsa * cplcore/tests/Makefile.am: Empty symbol AM_LDFLAGS added as placeholder. 2006-05-15 16:49 rpalsa * cplcore/tests/cpl_propertylist-test.c: Tests for functions cpl_propertylist_copy_property_regexp(), cpl_propertylist_erase_regexp(), cpl_propertylist_load_regexp() and cpl_propertylist_append() added. 2006-05-15 16:47 rpalsa * cplcore/cpl_propertylist.c: Functions cpl_propertylist_append() and cpl_propertylist_load_regexp() added. Functions cpl_propertylist_erase_regexp() and cpl_propertylist_copy_property_regexp() updated with new API. 2006-05-15 16:46 rpalsa * cplcore/cpl_propertylist.h: Prototypes cpl_propertylist_append() and cpl_propertylist_load_regexp() added. Prototypes cpl_propertylist_erase_regexp() and cpl_propertylist_copy_property_regexp() updated with new API. 2006-05-15 16:43 rpalsa * cplcore/cpl_table.c: cpl_table_save(): Calls to cpl_propertylist_erase_regexp() updated. 2006-05-15 16:40 rpalsa * cplcore/cpl_tools.c: cpl_tools_gen_valid_header(): Calls to cpl_propertylist_erase_regexp() updated. 2006-05-15 16:38 rpalsa * cplcore/cpl_version.c: cpl_version_get_version(): Documentation updated. 2006-05-15 16:36 rpalsa * Doxyfile.in: Value of HTML_STYLESHEET updated. 2006-05-10 13:28 llundin * cpldrs/cpl_phot/cpl_photom.c: Include cpl_photom.h. cpl_photom_fill_blackbody(): Add physical units to the documentation 2006-05-09 17:14 yjung * cplcore/: cpl_image_stats.c, cpl_image_stats_body.h: compute only if there is a bpm 2006-05-09 11:13 rpalsa * cplui/cpl_parameter.c: Documentation for functions cpl_parameter_set_default_bool(), cpl_parameter_set_default_int(), cpl_parameter_set_default_double(), cpl_parameter_set_default_string() added. 2006-05-09 11:11 rpalsa * cplui/cpl_frameset.c: Indendation cleaned. 2006-05-09 11:09 rpalsa * acinclude.m4: Macro CPL_BASE_PATH(): Add build directory to CX_INCLUDES definition. 2006-05-09 10:39 rpalsa * cplcore/cpl_version.c: Function documentation added. Needs to be improved. 2006-05-09 10:38 rpalsa * cplcore/cpl_array.c: Generation of the doxygen documentation enabled. 2006-05-08 15:32 scastro * cplcore/cpl_table.c: Fixed a bug when casting a QFITS type I (short) to a cpl type J (long). 2006-05-04 15:24 rpalsa * Makefile.am: Set SUBDIRS variable without using indirection. 2006-05-04 15:20 rpalsa * libcext/admin/html.am, admin/html.am: Move definition of HTML_BUILD_DIR outside of MAINTAINER_MODE conditional. 2006-05-04 15:19 rpalsa * libcext/Makefile.am: Set SUBDIRS variable without using indirection. 2006-05-04 15:16 rpalsa * libcext/Doxyfile.in: OUTPUT_DIRECTORY setting corrected. 2006-05-04 15:05 rpalsa * cplui/cpl_parameter.c: Functions _cpl_parameter_default_set(), cpl_parameter_default_set_bool(), cpl_parameter_default_set_int(), cpl_parameter_default_set_double(), cpl_parameter_default_set_string() implemented. 2006-05-04 15:00 rpalsa * cplui/cpl_parameter.h: Function prototypes cpl_parameter_set_default_bool(), cpl_parameter_set_default_int(), cpl_parameter_set_default_double(), cpl_parameter_set_default_string() added. 2006-05-04 14:55 rpalsa * cplui/Makefile.am: Replace symbol CPPFLAGS with AM_CPPFLAGS to avoid shadowing of the user variable. 2006-05-04 14:52 rpalsa * cplui/tests/Makefile.am: Empty symbol definition AM_LDFLAGS added. Indendation fixed. 2006-05-04 14:48 rpalsa * cplui/tests/cpl_parameter-test.c: Test cases for changing a parameter's default value added. 2006-05-04 13:22 rpalsa * autogen.sh, libcext/autogen.sh: Workaround for autoreconf problem with libltdl convenience library implemented. 2006-05-03 15:52 scastro * cplcore/cpl_table.c: Fixed a bug on cpl_table_load when no invalid elements exist in arrays. 2006-05-03 11:53 llundin * cplcore/: cpl_matrix.c, cpl_matrix.h, cpl_tools.c, tests/cpl_matrix-test.c: Removed cpl_matrix_do_echelon(). Made cpl_matrix_{decomp,solve}_{lu,chol}() public 2006-05-02 13:44 rpalsa * libltdl/.cvsignore: Added again. 2006-05-02 12:00 rpalsa * libltdl/.cvsignore: Obsolete. 2006-04-27 14:49 llundin * cplcore/cpl_matrix.c: cpl_matrix_solve_lu(): Added const modif, removed (false) uninit warning 2006-04-26 11:34 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_solve_1d(): Revert to previous stopping criterion 2006-04-26 11:34 llundin * cplcore/tests/cpl_polynomial-test.c: Remove most of previous test 2006-04-25 15:04 rpalsa * cplcore/tests/Makefile.am: Remove locally created file test_table.tfits on cleanup. 2006-04-25 14:52 rpalsa * cplcore/Makefile.am: Target cpl_version.h added. List of DISTCLEANFILES extended. 2006-04-25 14:40 rpalsa * cplcore/: cpl_version.h.top, cpl_version.h.bot, cpl_version.c: Added. 2006-04-25 14:40 rpalsa * acinclude.m4: Macro CPL_CONFIG_VERSION() added. 2006-04-25 14:39 rpalsa * configure.ac: Package and library version updated. Call CPL_CONFIG_VERSION() instead of ESO_SET_VERSION() 2006-04-21 15:22 rpalsa * .cvsignore, libcext/.cvsignore: Updated. 2006-04-21 15:19 rpalsa * cplui/tests/.cvsignore: Added. 2006-04-21 15:16 rpalsa * cpldfs/.cvsignore, cpldfs/tests/.cvsignore, cpldrs/tests/.cvsignore: Added. 2006-04-21 15:12 rpalsa * cplcore/tests/.cvsignore: Added. 2006-04-21 15:09 rpalsa * libcext/admin/.cvsignore, admin/.cvsignore: Added. 2006-04-21 15:06 rpalsa * configure.ac: Obsolete libltdl configuration macros removed. The list of configuration files to create was updated. 2006-04-21 15:01 rpalsa * Makefile.am: Directory prefixes updated. 2006-04-21 14:48 rpalsa * bootstrap: Updated to call autogen.sh. Kept for backwards compatibility. 2006-04-21 14:47 rpalsa * Doxyfile.in: Added. 2006-04-21 14:47 rpalsa * bootdirs: Obsolete. 2006-04-21 14:40 rpalsa * templates/: Makefile.am.tmpl, source.c.tmpl, source.h.tmpl: Updated. 2006-04-21 14:29 rpalsa * m4/cpl.m4, autogen.sh: Added. 2006-04-21 14:24 rpalsa * cpldrs/tests/Makefile.am: Clean local files created by the tests. 2006-04-21 14:17 rpalsa * admin/: config.guess, config.sub, depcomp, install-sh, ltmain.sh, missing, mkinstalldirs: Obsolete. 2006-04-21 14:07 rpalsa * libcext/cext/: cxstring.c, cxtree.c: Compiler warnings fixed. 2006-04-21 14:00 rpalsa * libcext/cext/cxmessages.c: Compiler warnings fixed. 2006-04-21 13:57 rpalsa * libcext/cext/Makefile.am: Add cxtypes.h to DISTCLEANFILES. Rule for creating cxtypes.h updated with explicit directory prefixes. 2006-04-21 13:49 rpalsa * libcext/configure.ac: Package and library version updated. 2006-04-21 13:43 rpalsa * libcext/Makefile.am: Various directory prefixes adapted. 2006-04-21 13:41 rpalsa * libcext/bootstrap: Updated to call autogen.sh. Kept for backwards compatibility. 2006-04-21 12:14 rpalsa * libcext/autogen.sh: Added. 2006-04-21 12:11 rpalsa * libcext/acinclude.m4: Macro ESO_ENABLE_DEBUG(): Logic inverted in check whether debugging code should be generated. 2006-04-21 12:05 rpalsa * libcext/templates/: Makefile.am.tmpl, source.c.tmpl, source.h.tmpl: Updated. 2006-04-21 11:48 rpalsa * libcext/tests/Makefile.am: Build directory added to INCLUDES. Symbol AM_LDFLAGS added. 2006-04-21 11:40 rpalsa * libcext/admin/: config.guess, config.sub, depcomp, install-sh, ltmain.sh, missing, mkinstalldirs: Obsolete. 2006-04-21 11:39 rpalsa * libcext/admin/html.am, admin/html.am: Use build directory instead of source directory as target for doxygen output. 2006-04-21 11:31 rpalsa * libcext/doxygen/Doxyfile.in: Moved to top level directory. 2006-04-21 11:28 rpalsa * libcext/Doxyfile.in: Added. 2006-04-21 11:22 rpalsa * libcext/m4/eso.m4: Added. 2006-04-21 11:20 rpalsa * m4macros/cpl.m4, libcext/m4macros/eso.m4: Removed. 2006-04-20 16:58 scastro * cplcore/cpl_table.c: Included support for TDIM keywords in cpl_table_load and cpl_table_save. 2006-04-20 14:45 rpalsa * libcext/cext/cxstrutils.c: cx_strjoinv(): Increment local variable i properly, when joining the array elements. 2006-04-19 15:33 yjung * cplcore/cpl_image_io.c: added doc 2006-04-11 16:37 scastro * cplcore/tests/cpl_table-test.c: Add tests for cpl_table_load() and cpl_table_save() 2006-04-11 16:36 scastro * cplcore/cpl_table.c: Support 3D-tables in cpl_table_save() and cpl_table_load() 2006-04-10 17:07 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_solve_1d(): Try difficult polynomial and its derivative 2006-04-10 17:06 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_solve_1d(): Improved stopping criterion and internal documentation. cpl_polynomial_derivative(): Improved docs and simplified check for zero-polynomial 2006-04-07 16:13 rpalsa * libcext/m4/eso.m4: Macro definition ESO_CHECK_FUNC: Move AC_CHECK_DECL call before the option pedantic errors is added to the CFLAGS. Otherwise the ISO C Standard compliance makes this macro not working as intended, since it contains a conversion from function pointer to object pointer. 2006-04-07 16:07 rpalsa * libltdl/.cvsignore: Updated. 2006-04-07 16:05 rpalsa * cplcore/cpl_memory.c: Support for Qfits 6.0 added. Compiler warnings fixed. 2006-04-07 16:02 rpalsa * cplcore/: cpl_table.c, cpl_sparseimage.c, cpl_plist.c, cpl_messaging.c, cpl_column.c: Compiler warnings fixed. 2006-04-07 16:00 rpalsa * cplcore/Makefile.am: Symbol CPPFLAGS replaced by AM_CPPFLAGS to avoid shadowing the user variable. 2006-04-07 15:50 rpalsa * cplexec/Makefile.am: Symbol CPPFLAGS replaced by AM_CPPFLAGS to avoid shadowing the user variable. 2006-04-07 15:48 rpalsa * cplui/: cpl_frameset.c, cpl_frame.c: Compiler warnings fixed. 2006-04-07 15:03 rpalsa * cplui/cpl_parameter.c: Compiler warnings fixed. 2006-04-07 15:02 rpalsa * cplui/Makefile.am: Symbol CPPFLAGS replaced by AM_CPPFLAGS to avoid shadowing of the user variable. 2006-04-07 15:00 rpalsa * m4/cpl.m4: Macro definition CPL_CHECK_QFITS: Updated to take into account the changes for Qfits 6.0. 2006-04-07 14:51 rpalsa * libcext/configure.ac: Pacakge and library version updated. 2006-04-07 14:50 rpalsa * libcext/tests/Makefile.am: Add build directory to INCLUDES. 2006-04-07 14:48 rpalsa * libcext/cext/Makefile.am: Target cxtypes.h: Use proper directory prefix for built sources. 2006-04-07 14:44 rpalsa * libcext/cext/: cxmessages.c, cxstring.c, cxstrutils.c: Compiler warnings fixed. 2006-04-07 14:43 rpalsa * libcext/acinclude.m4: Macro definition CEXT_ENABLE_DEBUG: Logic inverted in check for debug code generation. 2006-04-07 14:37 rpalsa * libcext/autogen.sh: Added. 2006-04-07 14:37 rpalsa * libcext/bootstrap: Updated to use autoreconf. 2006-04-07 14:36 rpalsa * libcext/Makefile.am: Updated for changed location of the M4 macro files. 2006-04-07 14:13 rpalsa * acinclude.m4: CX_INCLUDES extended to take the build directory into account. 2006-04-07 14:11 rpalsa * autogen.sh: Added. 2006-04-07 13:11 yjung * cplcore/cpl_bivector.c: [no log message] 2006-04-07 12:02 rpalsa * bootstrap: Updated to use autoreconf. 2006-04-07 12:00 rpalsa * configure.ac: Package and library version updated. 2006-04-07 11:59 rpalsa * Makefile.am: Updated with changed location of the M4 macro files. 2006-04-06 15:00 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h, tests/cpl_image_filter-test.c: Allow 9x9 median filtering (DFS02160) 2006-04-06 14:03 yjung * cplcore/cpl_image_io.c: removed warning 2006-04-06 13:55 yjung * cplcore/cpl_image_filter_body.h: call cpl_tools_get_median_double inst of cpl_tools_get_median_9double 2006-04-06 13:54 yjung * cplcore/: cpl_tools.c, cpl_tools.h: made cpl_tools_get_median_9double() static and called by cpl_tools_get_median_double() 2006-04-06 13:38 yjung * cplcore/cpl_image_basic.c: The input parameters check was invalid (DFS02696) 2006-04-06 11:38 yjung * cpldrs/cpl_apert/cpl_apertures.c: removed a leak in an error case 2006-04-06 11:22 cizzo * cplcore/cpl_column.c: In function cpl_column_fill_invalid_int() allocate and fill invalid arrays with the integer invalid code 2006-04-06 10:20 llundin * cplcore/cpl_polynomial.c: Improved documentation 2006-04-05 16:36 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_solve_1d(): Raised bar for alphaev56 2006-04-05 16:09 yjung * cplcore/cpl_mask.c: leak corrected in cpl_mask_turn() 2006-04-05 15:32 yjung * cplcore/cpl_memory.c: added qfits_cache_purge() call in qfits_memory_dump() 2006-04-05 15:23 llundin * cpldrs/tests/cpl_photom-test.c: Moved cpl_end() to end 2006-04-05 15:18 llundin * cpldrs/tests/cpl_geom_img-test.c: Ignore SIGFPE (alphaev56). No output on default. Add total time and mem-leak check 2006-04-05 15:07 llundin * cpldrs/tests/cpl_apertures_img-test.c: Ignore SIGFPE (alphaev56). Use cpl_assert(). Add total time and mem-leak check 2006-04-05 15:03 llundin * cpldrs/tests/cpl_apertures-test.c: Ignore SIGFPE (alphaev56). No output on default. Add total time and mem-leak check 2006-04-05 14:53 yjung * cplcore/: cpl_image_stats.c, cpl_image_stats_body.h: add bad pixels handling in median computation 2006-04-05 14:51 llundin * cplcore/tests/cpl_image_io-test.c: Ignore SIGFPE (alphaev56). No output on default. Add total time and mem-leak check. assert() -> cpl_assert() 2006-04-05 14:42 llundin * cplcore/tests/cpl_image_basic-test.c: Ignore SIGFPE (alphaev56). Move cpl_end to end. Add total time 2006-04-05 14:30 llundin * cplcore/tests/cpl_image_filter-test.c: Ignore SIGFPE (alphaev56). No output on default. Add total time and check for mem-leaks 2006-04-05 14:29 yjung * cplcore/cpl_tools.c: [no log message] 2006-04-05 14:22 llundin * cplcore/tests/cpl_image_gen-test.c: Ignore SIGFPE (alphaev56). No output on default. Add timing and check for mem-leaks 2006-04-05 14:16 llundin * cplcore/tests/cpl_image_iqe-test.c: Moved cpl_end() to end. Ignore SIGFPE (alphaev56). Added timing. 2006-04-05 14:10 llundin * cplcore/tests/cpl_stats-test.c: Moved cpl_end() to end. Ignore SIGFPE (alphaev56) 2006-04-05 14:09 yjung * cplcore/cpl_imagelist_io.c: [no log message] 2006-04-05 14:06 llundin * cplcore/tests/cpl_bivector-test.c: Moved cpl_end() to end. Added timing. 2006-04-05 14:06 yjung * cplcore/cpl_image_basic.c: added some doc on bad pixels 2006-04-05 14:03 llundin * cplcore/tests/cpl_vector-test.c: Moved cpl_end() to end 2006-04-05 14:01 llundin * cplcore/tests/cpl_mask-test.c: Ignore SIGFPE (alphaev56). No output on default. Add timing and check for mem-leaks 2006-04-05 13:43 llundin * cplcore/tests/cpl_image_resample-test.c: Ignore SIGFPE (alphaev56) 2006-04-04 17:03 yjung * cplcore/cpl_image_io.c: DFS02709 : empty bad pixel map created if one uses get_ function 2006-04-04 15:26 llundin * cplcore/tests/cpl_matrix-test.c: Ignore SIGFPE (alphaev56). cpl_matrix_solve(): Accept CPL_ERROR_SINGULAR_MATRIX on near-singular (alphaev56). Benchmark: Do not reset overall time 2006-04-04 13:34 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h, cpl_image_filter.c, cpl_image_filter_body.h, cpl_image_resample.c, cpl_image_stats_body.h, cpl_imagelist_basic_body.h, cpl_mask.c, cpl_stats.c: Changed order of loops for optimisation (DFS02808) 2006-04-04 11:18 rpalsa * libcext/m4macros/eso.m4, m4macros/cpl.m4: Moved to directory m4. 2006-04-04 11:17 rpalsa * libcext/m4/eso.m4, m4/cpl.m4: Added. 2006-04-04 11:05 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_1d_create(): Raised bar for alphaev56 2006-04-04 09:35 rpalsa * admin/config.guess, admin/config.sub, admin/depcomp, admin/install-sh, admin/ltmain.sh, admin/missing, admin/mkinstalldirs, libcext/admin/config.guess, libcext/admin/config.sub, libcext/admin/depcomp, libcext/admin/install-sh, libcext/admin/ltmain.sh, libcext/admin/missing, libcext/admin/mkinstalldirs, bootdirs: Obsolete. 2006-04-04 09:34 rpalsa * admin/.cvsignore, libcext/admin/.cvsignore: Added. 2006-04-04 09:30 rpalsa * libltdl/: COPYING.LIB, Makefile.am, README, acinclude.m4, config.guess, config.sub, configure.ac, install-sh, ltdl.c, ltdl.h, ltmain.sh, missing: Obsolete. 2006-04-03 16:46 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: cpl_polynomial_collapse_create(): Collapse along a polynomial 2006-04-03 15:29 llundin * cplcore/cpl_polynomial.c: Added cpl_polynomial_delete_coeff(). Removed cpl_polynomial_{decrease,increase}_pow(). cpl_polynomial_derivative() & cpl_polynomial_set_coeff(): Use cpl_polynomial_delete_coeff(). 2006-04-03 14:34 llundin * cplcore/tests/cpl_polynomial-test.c: Removed two memory leaks 2006-04-03 11:43 llundin * cplcore/cpl_polynomial.c: Switch layout of self->pow[] 2006-04-03 09:08 llundin * cplcore/tests/cpl_polynomial-test.c: Raised bar for Xeon (cpl_polynomial_solve_1d()) 2006-03-31 17:00 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: Added cpl_polynomial_derivative() 2006-03-31 10:31 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: Added cpl_polynomial_collapse_create() 2006-03-30 14:45 llundin * cplcore/tests/cpl_polynomial-test.c: Added new tests of cpl_polynomial_fit_2d_create(). Improved messages. Added optional benchmark of cpl_polynomial_fit_2d_create() 2006-03-30 14:44 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_2d_create(): Removed alternatives for mv-fill 2006-03-30 13:06 llundin * cplcore/tests/cpl_polynomial-test.c: Remove cpl_msg_progress() calls 2006-03-30 11:32 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_1d_create(): Use cpl_matrix_fill_normal_vandermonde. cpl_polynomial_fit_2d_create(): Create transpose Vandermonde and use cpl_matrix_solve_spd() 2006-03-30 11:26 llundin * cplcore/: cpl_matrix.c, cpl_tools.c, cpl_tools.h: cpl_matrix_product_normal_create(): Moved to cpl_tools 2006-03-30 11:25 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_2d_create(): Removed dead test 2006-03-28 09:30 llundin * cplcore/cpl_polynomial.c: cpl_polynomial_fit_1d_create(): call cpl_matrix_solve_spd(), improved documentation 2006-03-28 09:29 llundin * cplcore/cpl_matrix.c: cpl_matrix_solve_normal(): call cpl_matrix_solve_spd() 2006-03-28 09:29 llundin * cplcore/: cpl_tools.c, cpl_tools.h: cpl_matrix_solve_spd() added 2006-03-28 09:24 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_polynomial_fit_1d_create(): Test unordered insertion 2006-03-22 11:50 yjung * cplcore/cpl_memory.c: call qfits_cache_purge() in cpl_memory_is_empty() 2006-03-20 15:53 yjung * cplcore/tests/: cpl_image_bpm-test.c, cpl_image_resample-test.c, cpl_stats-test.c: [no log message] 2006-03-20 11:17 llundin * cplcore/cpl_tools.c: Removed cpl_tools_gaussian_2d(). assert() -> cpl_ensure() 2006-03-17 17:03 llundin * cplcore/cpl_tools.c: cpl_tools_is_power_of_2(): Reimplemented without conversion to double 2006-03-17 16:40 llundin * cplcore/cpl_polynomial.c: Removed shadowed pow-warning. assert() -> cx_assert(). Removed possible uninit access 2006-03-17 15:37 cizzo * cplcore/tests/cpl_table-test.c: Add more tests related to 3D tables 2006-03-17 13:49 cizzo * cplcore/tests/cpl_table-test.c: Add more tests related to 3D tables 2006-03-17 11:20 llundin * cplcore/cpl_tools.c: Remore pow and float cmp warning 2006-03-16 11:25 cizzo * cplcore/cpl_table.c: Fix some bad formatting of output in cpl_table_dump() 2006-03-16 10:50 cizzo * cplcore/cpl_array.c: Use CPL memory correctly 2006-03-16 10:41 cizzo * cplcore/cpl_array.c: Fix bug in cpl_array_duplicate (the input object was destroyed) 2006-03-16 09:12 llundin * cplcore/tests/cpl_polynomial-test.c: Raised bar on test of cpl_polynomial_solve_1d() for dmdlin9a 2006-03-16 08:59 llundin * cplcore/tests/: cpl_image_basic-test.c, cpl_vector-test.c: Cast %p-argument to void* 2006-03-16 08:55 llundin * cplcore/tests/cpl_polynomial-test.c: Raised bar on test of cpl_polynomial_solve_1d() for ma011965 2006-03-15 17:22 llundin * cplcore/cpl_matrix.c: cpl_matrix_*_chol(): Updated flop-count 2006-03-15 17:14 yjung * cplcore/cpl_image_io.c: DFS02819 solved: PCOUNT GCOUNT missing in extension images 2006-03-15 16:58 cizzo * cplcore/tests/cpl_table-test.c: Begin introducing tests on 3D-tables. Temporarily disable saving and loading of intermediate tables, since those functions do not support yet 3D-tables 2006-03-15 14:11 llundin * cplcore/cpl_matrix.c: cpl_matrix_solve_normal(): Update documentation and use cpl_matrix_product_normal_create(). Remove cpl_matrix_product_transpose_create() 2006-03-14 16:49 llundin * cplcore/cpl_matrix.c: cpl_matrix_product_transpose_create(): Unroll j-loop 6 times 2006-03-14 16:36 llundin * cplcore/cpl_matrix.c: cpl_matrix_product_transpose_create(): Loop unrolling experiment 2006-03-14 16:34 llundin * cplcore/tests/cpl_matrix-test.c: Compute FLOP/sec in becnmark 2006-03-14 16:32 llundin * cplcore/tests/cpl_polynomial-test.c: typo 2006-03-13 13:37 llundin * cplcore/cpl_error.h: cpl_ensure*(): Protect against shadowing of error variable 2006-03-13 11:00 llundin * cplcore/cpl_matrix.c: cpl_matrix_solve_normal(): Use cpl_matrix_{decomp,solve}_chol(). static cpl_matrix_product_transpose_create(): Compute only upper half for AtA 2006-03-13 10:58 llundin * cplcore/tests/cpl_polynomial-test.c: Stop fit on CPL_ERROR_SINGULAR_MATRIX 2006-03-13 10:58 llundin * cplcore/tests/cpl_matrix-test.c: Added cpl_matrix_fill_test(). Benchmark and test determinant with cpl_matrix_fill_test() 2006-03-12 15:42 cizzo * cplcore/: cpl_table.c, cpl_table.h: Support dimensioned columns 2006-03-12 15:41 cizzo * cplcore/cpl_column.c: Minor corrections in the doc 2006-03-12 15:00 cizzo * cplcore/: cpl_column.c, cpl_column.h: Support dimensioned columns 2006-03-10 17:31 cizzo * cplcore/: cpl_table.c, cpl_table.h: First implementation of 3D tables support 2006-03-10 16:57 cizzo * cplcore/: cpl_column.c, cpl_column.h: Several more changes for array columns support 2006-03-10 16:56 cizzo * cplcore/: cpl_array.c, cpl_array_impl.h: Add function cpl_array_set_column() 2006-03-10 16:54 llundin * cplcore/cpl_matrix.c: cpl_matrix_solve*(): Updated documentation (including multiple RHS) 2006-03-10 14:13 rpalsa * cplui/cpl_frame.c: _cpl_frame_fileinfo_delete(): Braces put around if-statement body. 2006-03-10 14:06 rpalsa * cplui/: cpl_frame.c: _cpl_frame_fileinfo_delete(): Braces put around if-statement body. 2006-03-10 11:46 llundin * cplcore/: cpl_matrix.c, tests/cpl_matrix-test.c: Added static cpl_matrix_{decomp,solve}_lu(). cpl_matrix_get_determinant(): Solved DFS 2809. cpl_matrix_solve(): Solved DFS 2390 2006-03-09 13:06 cizzo * cplcore/cpl_column.c: Ensure that inserted arrays are compatible with hosting column type 2006-03-09 13:04 cizzo * cplcore/: cpl_array.c, cpl_array.h: Const correct functions 2006-03-09 10:25 cizzo * cplcore/cpl_array.c: eliminate unused variable in cpl_array_get_column() 2006-03-09 10:22 cizzo * cplcore/: cpl_array.c, cpl_array_impl.h: Const correct cpl_array_get_column() 2006-03-09 10:21 cizzo * cplcore/: cpl_column.c, cpl_column.h: Add function cpl_column_set_depth() 2006-03-08 16:00 llundin * cplcore/cpl_bivector.c, cplcore/cpl_image_basic.c, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_bpm.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_gen.c, cplcore/cpl_image_io.c, cplcore/cpl_image_io_body.h, cplcore/cpl_image_iqe.c, cplcore/cpl_image_resample.c, cplcore/cpl_image_stats.c, cplcore/cpl_imagelist_basic.c, cplcore/cpl_imagelist_basic_body.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io_body.h, cplcore/cpl_mask.c, cplcore/cpl_msg.c, cplcore/cpl_polynomial.c, cplcore/cpl_stats.c, cplcore/cpl_tools.c, cplcore/cpl_vector.c, cplcore/tests/cpl_matrix-test.c, cpldrs/cpl_apert/cpl_apertures.c, cpldrs/cpl_apert/cpl_apertures_img.c, cpldrs/cpl_det/cpl_detector.c, cpldrs/cpl_det/cpl_detector_body.h, cpldrs/cpl_geom/cpl_geom_img.c, cpldrs/cpl_geom/cpl_geom_img_body.h, cpldrs/cpl_phot/cpl_photom.c, cplui/cpl_frameset_io.c: Replaced cpl_assure() with cpl_ensure() (and cpl_assure_code() -> cpl_ensure_code(). Replaced fctid with cpl_func 2006-03-08 15:37 llundin * cplcore/cpl_bivector.c, cplcore/cpl_image_basic.c, cplcore/cpl_image_iqe.c, cplcore/cpl_image_stats.c, cplcore/cpl_imagelist_basic.c, cplcore/cpl_mask.c, cplcore/cpl_msg.c, cplcore/cpl_polynomial.c, cplcore/cpl_stats.c, cplcore/cpl_vector.c, cpldrs/cpl_apert/cpl_apertures.c, cpldrs/cpl_det/cpl_detector.c, cpldrs/cpl_geom/cpl_geom_img.c: cpl_assure() -> cpl_ensure() 2006-03-08 15:35 cizzo * cplcore/Makefile.am: Add support for cpl_array_impl.h 2006-03-08 15:34 cizzo * cplcore/: cpl_array.c, cpl_array_impl.h: Add private function for direct access of cpl_column contained in cpl_array 2006-03-08 15:20 llundin * cplcore/cpl_bivector.c, cplcore/cpl_image_basic.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_io.c, cplcore/cpl_image_iqe.c, cplcore/cpl_image_resample.c, cplcore/cpl_imagelist_basic.c, cplcore/cpl_imagelist_io.c, cplcore/cpl_mask.c, cplcore/cpl_polynomial.c, cplcore/cpl_vector.c, cplcore/tests/cpl_matrix-test.c, cpldrs/cpl_apert/cpl_apertures.c, cpldrs/cpl_det/cpl_detector.c, cpldrs/cpl_geom/cpl_geom_img.c, cplcore/cpl_tools.c, cpldrs/cpl_apert/cpl_apertures_img.c, cpldrs/cpl_phot/cpl_photom.c, cplui/cpl_frameset_io.c: cpl_assure() -> cpl_ensure() one liners (bis) 2006-03-08 15:15 llundin * cplcore/: cpl_image_basic.c, cpl_image_bpm.c, cpl_image_io.c, cpl_image_resample.c, cpl_image_stats.c, cpl_imagelist_basic.c, cpl_imagelist_io.c, cpl_mask.c, cpl_polynomial.c, cpl_stats.c, cpl_vector.c: cpl_assure() -> cpl_ensure() one liners 2006-03-08 15:06 llundin * cplcore/: cpl_image_basic.c, cpl_image_bpm.c, cpl_image_gen.c, cpl_image_io.c, cpl_image_resample.c, cpl_image_stats.c, cpl_imagelist_basic.c, cpl_imagelist_io.c, cpl_mask.c, cpl_polynomial.c, cpl_stats.c, cpl_vector.c: cpl_assure_code() -> cpl_ensure_code() 2006-03-08 14:35 llundin * cplcore/cpl_error.h: Defined cpl_func, cpl_ensure() and cpl_ensure_code(). Removed support for (getenv("CPL_DEBUG") in cpl_assure*() and ensured one-time evaluation of their macro arguments 2006-03-08 14:33 llundin * configure.ac: Added AC_CHECK_DECLS() for __func__ 2006-03-08 09:31 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic.h: cpl_image_threshold(): DFS2802 2006-03-08 09:29 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic.h, tests/cpl_image_basic-test.c: cpl_image_threshold(): DFS2802 and disallow lo_cut greater than hi_cut 2006-03-08 09:27 cizzo * cplcore/cpl_array.c: Use cpl_memory instead of xmemory 2006-03-08 09:23 cizzo * cplcore/: cpl_column.c, cpl_column.h: Add support for array columns 2006-03-08 09:23 cizzo * cplcore/Makefile.am: Support cpl_array modules 2006-03-08 09:22 cizzo * cplcore/: cpl_array.c, cpl_array.h: First implementation 2006-03-07 09:17 cizzo * cpldfs/cpl_dfs.c: Correct documentation of cpl_dfs_setup_header() 2006-03-06 14:19 cizzo * cplcore/: cpl_column.c, cpl_table.c: Restore realloc calls where necessary 2006-03-02 11:41 llundin * cplcore/tests/cpl_polynomial-test.c: Raised bar on test of cpl_polynomial_fit_2d_create() 2006-03-01 09:25 yjung * m4macros/cpl.m4: [no log message] 2006-03-01 09:18 yjung * m4macros/cpl.m4: [no log message] 2006-02-27 11:55 yjung * cplcore/cpl_memory.c: pointer cast 2006-02-23 16:25 yjung * cpldrs/tests/cpl_photom-test.c: [no log message] 2006-02-23 16:18 yjung * cplcore/tests/: cpl_bivector-test.c, cpl_image_iqe-test.c, cpl_imagelist_basic-test.c, cpl_imagelist_io-test.c, cpl_polynomial-test.c, cpl_vector-test.c: missing includes 2006-02-23 15:31 yjung * cpldrs/tests/cpl_photom-test.c: [no log message] 2006-02-23 15:30 yjung * cplcore/tests/: cpl_bivector-test.c, cpl_image_basic-test.c, cpl_image_iqe-test.c, cpl_image_resample-test.c, cpl_imagelist_basic-test.c, cpl_imagelist_io-test.c, cpl_matrix-test.c, cpl_polynomial-test.c, cpl_stats-test.c, cpl_vector-test.c: use cpl_memory_dump() inst of xmemory_status() 2006-02-23 15:24 yjung * cplcore/cpl_memory.c: [no log message] 2006-02-23 15:21 yjung * cplcore/: cpl_memory.c, cpl_memory.h: added cpl_memory_is_empty() and cpl_memory_dump() 2006-02-23 14:54 yjung * cplcore/: cpl_bivector.c, cpl_image_basic.c, cpl_image_basic_body.h, cpl_image_bpm.c, cpl_image_filter.c, cpl_image_filter_body.h, cpl_image_gen.c, cpl_image_io.c, cpl_image_io_body.h, cpl_image_iqe.c, cpl_image_resample.c, cpl_image_stats.c, cpl_imagelist_basic.c, cpl_imagelist_basic_body.h, cpl_imagelist_io.c, cpl_mask.c, cpl_memory_impl.h, cpl_stats.c, cpl_tools.c, cpl_vector.c: removed #include "cpl_memory_impl.h" and use cpl_malloc() inst of malloc() 2006-02-23 14:28 yjung * cplcore/tests/: cpl_image_bpm-test.c, cpl_image_filter-test.c, cpl_image_gen-test.c, cpl_image_io-test.c, cpl_mask-test.c: [no log message] 2006-02-23 13:59 yjung * cplcore/cpl_column.c, cplcore/cpl_memory.c, cplcore/cpl_polynomial.c, cplcore/cpl_table.c, cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_iqe-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_stats-test.c, cplcore/tests/cpl_table-test.c, cplcore/tests/cpl_vector-test.c, cpldrs/tests/cpl_photom-test.c: #include "xmemory.h" removed, call cpl_free() inst of free() 2006-02-21 12:15 yjung * cplcore/: cpl_image_basic_body.h, tests/cpl_image_basic-test.c: Fixed DFS02782 and add test case to verify it in the test suite (cast prob in int images) 2006-02-21 11:40 yjung * cplcore/: cpl_image_basic_body.h, tests/cpl_image_basic-test.c: Fixed DFS02782 and add a test for it 2006-02-21 09:56 yjung * cpldrs/cpl_det/: cpl_detector.c: fixed DFS02792 (added doc for random number usage) 2006-02-20 11:13 yjung * cplcore/cpl_table.c: QFITS API changes 2006-02-17 17:30 llundin * cplcore/: cpl_image_basic.c, tests/cpl_image_basic-test.c: cpl_image_divide_create(): Fixed DFS1724 2006-02-17 17:17 llundin * cplcore/: cpl_image_basic.c, tests/cpl_image_basic-test.c: cpl_image_divide_create(): Fixed DFS1724 2006-02-17 15:33 yjung * cpldfs/cpl_dfs.c: QFITS renamed: is_fits_file() ---> qfits_is_fits() 2006-02-17 15:31 yjung * cplcore/cpl_propertylist.c: QFITS renaming : is_fits_file() --> qfits_is_fits() 2006-02-15 15:36 llundin * cplcore/cpl_imagelist_io.h: cpl_imagelist_new(): Added the required void to prototype 2006-02-12 14:12 cizzo * cplcore/cpl_table.c: Appropriate return value for null for cpl_table_get_TYPE() 2006-02-03 21:16 llundin * cplcore/tests/cpl_matrix-test.c: Stop the test of cpl_matrix_solve*() when it becomes meaningless 2006-01-31 19:55 rpalsa * cplexec/Makefile.am: cplexec_LDFLAGS and cplexec_DEPENDENCIES symbol definitions completed with settings for libcplcore and libcext. 2006-01-31 19:50 rpalsa * cplcore/: cpl_messaging.h, cpl_messaging.c: cpl_msg_error(), cpl_msg_warning(), cpl_msg_info(), cpl_msg_debug(): const qualifier added to format argument. 2006-01-31 19:45 rpalsa * doxygen/Doxyfile.in: Remove LaTeX package html from EXTRA_PACKAGES 2006-01-31 17:04 rpalsa * cplui/: cpl_parameterlist.c: cpl_parameterlist_get_size(): Typo in the documentation fixed. 2006-01-29 16:25 cizzo * cplcore/cpl_table.c: In functions cpl_table_get_TYPE() ensure that the error flag is set properly 2006-01-28 23:17 llundin * cplcore/tests/cpl_matrix-test.c: cpl_matrix_solve*(): Add a test of numerical performance 2006-01-26 12:57 llundin * cplcore/cpl_tools.h: Added cpl_assert() for test modules 2006-01-26 12:56 llundin * cplcore/tests/cpl_matrix-test.c: cpl_matrix_solve(): Remove test of not-yet-supported multiple right han sides 2006-01-26 12:53 llundin * cplcore/tests/cpl_matrix-test.c: Added two checks cpl_matrix_solve(). Use CPL messaging system and check for memory leaks 2006-01-25 14:53 yjung * cplcore/cpl_image_io.c: added documentation (DFS02709) 2006-01-24 17:48 yjung * cpldrs/cpl_geom/: cpl_geom_img.c: Fixed bug in cpl_geom_img_offset_combine() (DFS02712) 2006-01-24 17:29 yjung * cpldrs/cpl_apert/cpl_apertures.c: Many bugs corrected in cpl_apertures_extract_window() 2006-01-24 17:27 yjung * cpldrs/cpl_apert/cpl_apertures.c: Many bugs solved at once in this function ... 2006-01-19 09:32 llundin * cplcore/cpl_image_resample.c: Proper placement of #define CPL_OP 2006-01-19 09:29 yjung * cplcore/cpl_image_resample.c: [no log message] 2006-01-16 11:55 yjung * cplcore/: cpl_image_bpm.c, cpl_imagelist_basic.c: [no log message] 2006-01-16 10:27 llundin * cplcore/tests/cpl_polynomial-test.c: Raised bar for P-III Coppermine 2006-01-16 09:59 llundin * cplcore/tests/cpl_polynomial-test.c: Raised bar for P-III Coppermine 2006-01-15 11:18 llundin * cplcore/tests/cpl_polynomial-test.c: Replaced test_leq with cpl_test_leq 2006-01-13 17:42 llundin * cplcore/: cpl_polynomial.c, cpl_tools.h, tests/cpl_polynomial-test.c: Use HAVE_LONG_DOUBLE to typedef cpl_long_double 2006-01-13 17:29 llundin * configure.ac: Added AC_C_LONG_DOUBLE 2006-01-13 17:28 llundin * cplcore/cpl_tools.h: config.h 2006-01-13 17:26 llundin * configure.ac: Added AC_C_LONG_DOUBLE 2006-01-13 16:31 llundin * cplcore/: cpl_polynomial.c, cpl_tools.h, tests/cpl_polynomial-test.c: Use HAVE_LONG_DOUBLE to typedef cpl_long_double 2006-01-04 11:21 llundin * cplcore/cpl_image_basic.c: cpl_image_fft(): Removed compiler warning 2005-12-02 14:04 yjung * cplcore/tests/cpl_image_iqe-test.c: usable now 2005-12-02 13:35 yjung * cplcore/tests/cpl_image_iqe-test.c: first usable version 2005-12-02 13:11 yjung * cplcore/tests/: Makefile.am, cpl_image_iqe-test.c: added test for IQE 2005-12-02 13:09 yjung * cpl.h, cplcore/Makefile.am, cplcore/cpl_image.h, cplcore/cpl_image_iqe.c, cplcore/cpl_image_iqe.h: added cpl_image_iqe module 2005-12-02 12:59 cplmgr * ChangeLog: Updated. 2005-12-02 12:11 cplmgr * libcext/ChangeLog: Updated. 2005-12-02 12:02 rpalsa * libcext/tests/Makefile.am: Symbol AM_LDFLAGS added. 2005-12-02 11:56 cplmgr * configure.ac: Package and library version updated. 2005-12-02 11:52 yjung * cplcore/: cpl_image_iqe.h, cpl_image_iqe.c: [no log message] 2005-12-02 10:18 yjung * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic.h, cpl_imagelist_basic_body.h, tests/cpl_imagelist_basic-test.c: added cpl_imagelist_collapse_sigclip_create() (DFS02662) 2005-11-28 12:13 yjung * cpldrs/cpl_apert/cpl_apertures.c: DFS02616 2005-11-28 11:22 yjung * cpldrs/cpl_apert/cpl_apertures.c: return an error if the labelised image miss a value (DFS02616) 2005-11-28 11:21 yjung * cpldrs/tests/cpl_apertures-test.c: added a test to catch a pb with the labelised image (DFS02616) 2005-11-24 14:42 rpalsa * cplui/tests/cpl_plugin-test.c: Version string test updated to new version string format. 2005-11-24 12:20 cplmgr * ChangeLog: Updated. 2005-11-24 12:15 cplmgr * cplui/cpl_plugin.c: cpl_plugin_get_version_string(): Version string format changed. 2005-11-24 11:46 cplmgr * ChangeLog: Updated. 2005-11-24 11:38 cplmgr * configure.ac: Package and library version updated. 2005-11-24 11:33 cizzo * cplcore/cpl_table.c, cpldfs/cpl_dfs.c: Upgrade from HEAD 2005-11-24 10:14 yjung * cplcore/cpl_image_basic.c: added doc for the cpl_fft() 2005-11-23 16:23 yjung * cplcore/cpl_bivector.c: DFS02447 : expects file with 2 columns for cpl_bivector_load() 2005-11-23 14:43 yjung * cplcore/tests/cpl_mask-test.c: added tests for new functions 2005-11-23 14:23 yjung * cplcore/cpl_image_basic.c: added doc for collapse func. 2005-11-23 14:21 yjung * cplcore/tests/cpl_image_basic-test.c: Test if a column of bad pixels can be collapsed... 2005-11-23 13:52 yjung * cplcore/tests/cpl_sparseimage-test.c: [no log message] 2005-11-22 17:23 yjung * cplcore/Makefile.am, cplcore/cpl_image_basic.c, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_bpm.c, cplcore/cpl_image_defs.h, cplcore/cpl_image_filter.c, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, cplcore/cpl_image_resample.c, cplcore/cpl_image_resample.h, cplcore/cpl_image_resample_body.h, cplcore/cpl_image_stats.c, cplcore/cpl_imagelist_basic.c, cplcore/cpl_mask.c, cplcore/cpl_mask.h, cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h, cplcore/cpl_stats.c, cplcore/cpl_stats_body.h, cplcore/tests/Makefile.am, cplcore/tests/cpl_image_bpm-test.c, cplcore/tests/cpl_image_resample-test.c, cpldrs/cpl_apert/cpl_apertures.c, cpldrs/cpl_det/cpl_detector.c, cpldrs/cpl_det/cpl_detector_body.h: Replaced the internal image badpixel map type from sparseimage to cpl_mask. cpl_sparseimage is no longer existing. New functions had to be added to the cpl_mask module to replace the sparse image functionalities. Removed public functions: - cpl_mask_new_from_rejected() - cpl_mask_new_from_rejected_window() Removed private function: - cpl_sparseimage_new() - cpl_sparseimage_delete() - cpl_sparseimage_get_size() - cpl_sparseimage_get_data() - cpl_sparseimage_contains() - cpl_sparseimage_duplicate() - cpl_sparseimage_or_create() - cpl_sparseimage_extract() - cpl_sparseimage_turn() - cpl_sparseimage_shift() - cpl_sparseimage_flip() - cpl_sparseimage_move() - cpl_sparseimage_collapse_create() - cpl_sparseimage_or() - cpl_sparseimage_insert() - cpl_sparseimage_erase() - cpl_sparseimage_subsample() - cpl_sparseimage_copy() - cpl_sparseimage_dump() - cpl_sparseimage_extract_mask() New functions: - cpl_image_get_bpm() - cpl_mask_collapse_create() - cpl_mask_extract() - cpl_mask_turn() - cpl_mask_shift() - cpl_mask_copy() - cpl_mask_flip() - cpl_mask_move() - cpl_mask_extract_subsample() Modified API: - cpl_image_extract_subsample() DFS ticket : DFS02652 2005-11-21 11:53 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h, cpl_image_defs.h, cpl_image_io.c, cpl_image_io_body.h, cpl_type.h: removed the COMPLEX type support in images (DFS02659 / part2) 2005-11-21 11:30 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, tests/cpl_image_basic-test.c: Changed cpl_image_fft() API to use a real and an imaginary part image, and not the COMPLEX type any more (DFS02659 / part1) 2005-11-14 14:28 cizzo * cplcore/cpl_table.c: Fix bug in cpl_table_duplicate_column() that allowed copying columns between tables of different sizes 2005-10-25 14:17 yjung * cpldrs/cpl_geom/cpl_geom_img.c: corrected bug 2005-10-25 14:15 yjung * cpldrs/cpl_geom/cpl_geom_img_body.h: [no log message] 2005-10-25 14:06 yjung * cpldrs/cpl_geom/: cpl_geom_img.c, cpl_geom_img_body.h: added includes 2005-10-25 12:16 yjung * cpldrs/cpl_geom/cpl_geom_img.h: [no log message] 2005-10-25 11:48 yjung * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic_body.h, cpl_imagelist_defs.h, cpl_imagelist_io.c, cpl_imagelist_io.h: removed internal members nx, ny, type 2005-10-25 11:13 yjung * cpldrs/: cpl_apert/cpl_apertures.c, cpl_apert/cpl_apertures_img.c, cpl_det/cpl_detector.c, cpl_geom/cpl_geom_img.c, cpl_geom/cpl_geom_img_body.h, cpl_phot/cpl_photom.c, tests/cpl_apertures-test.c, tests/cpl_apertures_img-test.c, tests/cpl_detector-test.c, tests/cpl_geom_img-test.c, tests/cpl_photom-test.c: removed includes to cpl_image_defs.h cpl_imagelist_defs.h cpl_memory_impl.h and any access to the internal objects structures. 2005-10-13 17:12 yjung * cplcore/cpl_image_basic.c: added doc (DFS02570) 2005-10-12 14:59 llundin * cplcore/tests/cpl_polynomial-test.c: Added cpl_tools_add_flops() etc. Changed 2D-poly test back to POLY_SIZE 2005-10-12 14:59 llundin * cplcore/: cpl_image_basic_body.h, cpl_image_resample.c, cpl_image_resample_body.h, cpl_matrix.c, cpl_polynomial.c, cpl_tools.c, cpl_tools.h, cpl_vector.c, tests/cpl_image_basic-test.c, tests/cpl_image_resample-test.c, tests/cpl_vector-test.c: Added cpl_tools_add_flops() etc. 2005-10-10 14:58 llundin * cplcore/cpl_imagelist_io.c: cpl_imagelist_save(): Fix for DFS2591 2005-10-10 14:46 llundin * cplcore/tests/cpl_imagelist_io-test.c: Add several failure checks. Add some normal checks. Add check for memory leaks. Reduce size of test image. Add timing. Detect multiple failures 2005-10-10 14:43 llundin * cplcore/cpl_imagelist_io.c: cpl_imagelist_save(): Fix memory leak on write failure. cpl_imagelist_set(): Check uniformity also when pos=0 2005-10-10 14:42 llundin * cplcore/cpl_imagelist_io_body.h: cpl_imagelist_load{,_window}(): Detect negative qfits_query_n_ext() 2005-10-06 14:25 llundin * cplcore/cpl_init.c: cpl_end(): Added reset of state of cpl_tools_get_cputime() 2005-10-06 14:25 llundin * cplcore/: cpl_tools.c, cpl_tools.h: cpl_tools_get_cputime(): Added reset mode of internal state 2005-09-29 09:38 yjung * cplcore/cpl_image_io.c: new doc on error codes for loading functions (DFS02560) 2005-09-29 09:35 yjung * cplcore/cpl_image_io_body.h: corrected error code in case of failure while loading an image (DFS02560) 2005-09-26 14:33 cplmgr * ChangeLog: Updated. 2005-09-26 14:23 cplmgr * configure.ac: Package and library version updated. 2005-09-21 16:17 yjung * cplcore/cpl_image_io.c: corrected bug 2005-09-21 16:09 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_mask.c, cpl_mask.h: moved cpl_image_labelise_create_mask() from cpl_mask to cpl_image_io 2005-09-21 15:49 yjung * cplcore/: cpl_mask.c, cpl_mask.h, tests/cpl_mask-test.c: added cpl_mask_get() cpl_mask_set() and cpl_mask_duplicate as well as some documentation on CPL_BINARY_0 and CPL_BINARY_1 (DFS02543). 2005-09-19 14:50 llundin * cplcore/tests/cpl_vector-test.c: Higher round-off on AMD-64 2005-09-19 14:22 llundin * cplcore/cpl_tools.h, cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_sparseimage-test.c, cplcore/tests/cpl_stats-test.c, cplcore/tests/cpl_vector-test.c, cpldrs/tests/cpl_photom-test.c: Moved common (numerical) test-code to cpl_tools.h and stop use of assert() for tests 2005-09-15 12:04 yjung * cplcore/: cpl_image_io.c, cpl_imagelist_io.c, cpl_tools.c, cpl_tools.h: Solved DFS02537 : missing ORIGIN and DATE-OBS in products headers 2005-09-15 11:58 yjung * cplcore/: cpl_image_io.c, cpl_imagelist_io.c, cpl_tools.c, cpl_tools.h: Solved DFS02537 : ORIGIN and DATE-OBS keys missing in products 2005-09-15 11:32 yjung * cpldfs/cpl_dfs.c: removed a printf() 2005-09-06 14:18 cizzo * cpldfs/cpl_dfs.c: Use PACKAGE and PACKAGE_VERSION for the content of PRO.REC1.DRS.ID 2005-09-06 13:20 cizzo * cpldfs/cpl_dfs.c: Change CPL version string 2005-08-25 16:49 rpalsa * cplui/cpl_plugin.c: cpl_plugin_get_version_as_string(): Correctly format the version string to return. No leading zeros. 2005-08-22 15:19 yjung * cplcore/: cpl_imagelist_io.c, cpl_imagelist_io.h, cpl_imagelist_io_body.h, tests/cpl_imagelist_io-test.c: added cpl_imagelist_load_window() and its tests (DFS02372) 2005-08-22 12:20 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h, tests/cpl_image_io-test.c: added cpl_image_load_window() 2005-08-17 09:48 cizzo * cplcore/cpl_table.c: Remove 'inline' specifier on function definition 2005-08-16 15:01 rpalsa * libcext/cext/cxtree.c: Use inline function specifier according to ISO/IEC 9899:1999(E) 6.7.4 3 2005-08-16 11:27 rpalsa * configure.ac: ESO_SET_LIBRARY_VERSION: Comment indicating its calling sequence added. 2005-08-16 11:27 rpalsa * libcext/configure.ac: Package and library version updated. ESO_SET_LIBRARY_VERSION: Comment indicating its calling sequence added. 2005-08-16 11:21 rpalsa * libcext/cext/cxstring.c: Use inline function specifier according to ISO/IEC 9899:1999(E) 6.7.4 3 2005-08-11 14:58 cizzo * cpldfs/cpl_dfs.c: Upgrade CPL package version 2005-08-10 15:13 yjung * cpldrs/cpl_geom/: cpl_geom_img.c: cpl_msg_warning -> cpl_msg_debug 2005-08-05 09:03 llundin * cpldrs/cpl_phys_const.h: Updated URL in comment 2005-08-04 09:05 yjung * cplcore/: cpl_mask.c, tests/cpl_image_filter-test.c: increased the allowed kernel size for erosion/dilation 2005-08-04 09:02 yjung * cplcore/: cpl_mask.c, tests/cpl_image_filter-test.c: increased the allowed kernel size for dilation ant erosion 2005-08-04 08:47 llundin * cplcore/: cpl_image_bpm.c, cpl_sparseimage.c: cpl_image_accept() and cpl_sparseimage_erase(): Corrected bug on last rejected pixel 2005-08-02 15:14 yjung * cplcore/: cpl_image_filter.c, tests/cpl_image_filter-test.c: DFS02163 - allow bigger kernels for linear filtering 2005-08-02 15:12 yjung * cplcore/: cpl_image_filter.c, tests/cpl_image_filter-test.c: ticket DFS02163 - allow bigger kernels for the linear filtering 2005-07-29 15:29 cplmgr * configure.ac: Library version fixed again. 2005-07-29 15:07 cplmgr * configure.ac: Library version fixed. 2005-07-29 10:06 cizzo * cpldfs/cpl_dfs.c: cpl_dfs_setup_pro_header(): write to header keywords true and false instead of 1 and 0, in case of boolean parameters 2005-07-28 14:37 rpalsa * cplui/: cpl_frameset.c: cpl_frameset_insert(): Add a check verifying that the frame to insert has a valid tag, otherwise return an error 2005-07-22 14:38 cplmgr * ChangeLog: Updated. 2005-07-22 14:31 rpalsa * cplcore/cpl_property.c: In cpl_property_get_size(): Documentation fixed with respect to the size returned for a string property. 2005-07-22 14:27 cplmgr * ChangeLog: Updated. 2005-07-22 14:20 cplmgr * libcext/ChangeLog: Updated. 2005-07-22 13:57 cplmgr * configure.ac: Package version updated. 2005-07-21 13:56 rpalsa * cplcore/cpl_table.c: In cpl_table_print(): Correctly check whether a string value is a NULL value or not when retrieving values from a table. 2005-07-18 12:57 yjung * cplcore/cpl_image_io.c: removed an useless zero-padding 2005-07-14 17:55 llundin * cplcore/cpl_error.h: cpl_assure(): Explicit cast (void)cpl_error_set_code() 2005-07-13 17:22 cizzo * cplcore/cpl_column.c: Go to nearest integer in result of cpl_column_pow_int() 2005-07-13 17:07 cizzo * cplcore/tests/cpl_table-test.c: Implement tests for cpl_table_power_column(), cpl_table_logarithm_column(), and cpl_table_exponential_column() 2005-07-13 17:03 cizzo * cplcore/cpl_column.c: Compute integer powers using cpl_tools_ipow() instead of pow() 2005-07-13 16:19 llundin * cplcore/: cpl_msg.c, tests/cpl_polynomial-test.c: cpl_msg_progress(): test + fix for DFS02166 2005-07-13 15:23 cizzo * cplcore/: cpl_table.c, cpl_table.h: Add const qualifier to indicate non-modified arguments in cpl_table_sort() and cpl_table_save() functions 2005-07-13 15:22 cizzo * cplcore/cpl_msg.h: Implement safe declaration of functions with variable argument list, in case the compiler is gcc 2005-07-12 14:22 llundin * cplcore/cpl_tools.c, cplcore/cpl_tools.h, cpldrs/cpl_phot/cpl_photom.c: Added cpl_tools_ipow() 2005-07-08 11:00 cizzo * cplcore/cpl_msg.c: Correct bug in msg_init counter 2005-07-08 10:45 cizzo * cplcore/cpl_msg.c: Keep backward compatibility with CPL2.0 of cpl_msg_init() 2005-07-08 09:51 llundin * cplcore/cpl_polynomial.c: Improved documentation 2005-07-08 08:54 llundin * cplcore/: cpl_polynomial.c, tests/cpl_polynomial-test.c: Solved performance problem related to pow() 2005-07-07 16:02 llundin * cplcore/cpl_msg.h: Revoked 1.6 which was done in error 2005-07-07 15:59 llundin * cplcore/cpl_image_basic.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_filter_body.h, cplcore/cpl_msg.h, cpldrs/cpl_apert/cpl_apertures.c, cpldrs/cpl_geom/cpl_geom_img.c: Removed/recoded arbitrary constants (DFS 2319) 2005-07-07 14:07 llundin * cpldrs/tests/cpl_apertures_img-test.c: Treshold test image at 1. Use cpl_msg_set_level_from_env() and no output as default 2005-07-06 17:48 yjung * configure.ac: Package version updated 2.1a -> 2.1b 2005-07-05 10:32 cizzo * cplcore/cpl_table.c: Add warning to cpl_table_save() documentation 2005-07-04 17:42 yjung * cplcore/cpl_image_io.c: added doc refering to DFS01883 2005-07-04 09:32 cplmgr * configure.ac: Package version updated. 2005-07-04 08:28 cizzo * cplcore/cpl_column.c: explicit braces to avoid ambiguous 'else' in cpl_column_duplicate() 2005-07-01 16:37 llundin * cplcore/: cpl_tools.c, cpl_tools.h, tests/cpl_bivector-test.c, tests/cpl_image_resample-test.c, tests/cpl_polynomial-test.c, tests/cpl_vector-test.c: Added cpl_msg_set_level_from_env() 2005-07-01 16:36 llundin * cpldrs/tests/cpl_geom_img-test.c: Corrected bug: CPL_TRUE => CPL_GEOM_UNION 2005-07-01 16:19 cizzo * cpldfs/cpl_dfs.c: Remove useless extra parameter to cpl_msg_warning() call 2005-06-29 11:38 llundin * cplui/: cpl_parameterlist.c, cpl_parameterlist.h: Function cpl_parameterlist_get_size(): const modifier added 2005-06-28 13:44 llundin * cplcore/cpl_init.c: cpl_end(): Call qfits_cache_purge() 2005-06-28 13:23 cizzo * cplcore/cpl_msg.c: Correct warning messages for uninitialised system 2005-06-28 11:12 cizzo * cplcore/cpl_init.c: Extend doc of cpl_init() 2005-06-28 09:51 cizzo * cplcore/tests/cpl_table-test.c: Add test for cpl_table_unwrap() 2005-06-28 09:50 cizzo * cplcore/: cpl_table.c, cpl_table.h: Add function cpl_table_unwrap() 2005-06-28 09:49 cizzo * cplcore/: cpl_column.c, cpl_column.h: Change API to cpl_column_unwrap(): now returns the pointer to the internal data buffer 2005-06-28 09:26 llundin * cplcore/cpl_image_resample_body.h: Removed debugging line 2005-06-28 08:59 cizzo * cpldrs/tests/: cpl_geom_img-test.c, cpl_photom-test.c: New usage of cpl_init() and cpl_end() 2005-06-28 08:53 cizzo * cpldrs/tests/: cpl_apertures-test.c, cpl_apertures_img-test.c, cpl_detector-test.c: New usage of cpl_init() and cpl_end() 2005-06-28 08:49 cizzo * cplui/tests/: cpl_plugin-test.c, cpl_pluginlist-test.c: New usage of cpl_init() and cpl_end() 2005-06-28 08:46 cizzo * cplui/tests/: cpl_frame-test.c, cpl_frameset-test.c, cpl_parameter-test.c: New usage of cpl_init() and cpl_end() 2005-06-28 08:41 cizzo * cplcore/tests/: cpl_table-test.c, cpl_vector-test.c: New usage of cpl_init() and cpl_end() 2005-06-28 08:38 cizzo * cplcore/tests/: cpl_sparseimage-test.c, cpl_stats-test.c: New usage of cpl_init() and cpl_end() 2005-06-28 08:34 cizzo * cplcore/tests/: cpl_polynomial-test.c, cpl_property-test.c, cpl_propertylist-test.c: New usage of cpl_init() and cpl_end() 2005-06-28 08:30 cizzo * cplcore/tests/: cpl_mask-test.c, cpl_matrix-test.c: New usage of cpl_init() and cpl_end() 2005-06-28 08:25 cizzo * cplcore/tests/: cpl_image_resample-test.c, cpl_imagelist_basic-test.c, cpl_imagelist_io-test.c: New usage of cpl_init() and cpl_end() 2005-06-28 08:21 cizzo * cplcore/tests/: cpl_image_filter-test.c, cpl_image_gen-test.c, cpl_image_io-test.c: New usage of cpl_init() and cpl_end() 2005-06-28 08:16 cizzo * cplcore/tests/: cpl_bivector-test.c, cpl_image_basic-test.c, cpl_image_bpm-test.c: New usage of cpl_init() and cpl_end() 2005-06-27 16:52 cizzo * cplcore/: cpl_init.c, cpl_init.h: Add function cpl_end() 2005-06-27 16:51 cizzo * cplcore/cpl_msg.c: Deprecate cpl_msg_init() and cpl_msg_stop() 2005-06-27 13:53 cizzo * cplcore/cpl_matrix.c: Add a note about NaN contained in solutions based on nearly singular matrices 2005-06-22 16:25 yjung * cpldrs/cpl_geom/: cpl_geom_img.c, cpl_geom_img.h: added CPL_GEOM_FIRST 2005-06-16 16:18 llundin * cplcore/: cpl_vector.c, cpl_vector.h, tests/cpl_vector-test.c: cpl_vector_product() 2005-06-14 16:19 llundin * cplcore/tests/cpl_polynomial-test.c: Adapt accuracy limit to non-debug mode 2005-06-14 11:36 yjung * cplcore/cpl_imagelist_basic.c, cplcore/cpl_imagelist_basic.h, cplcore/cpl_imagelist_basic_body.h, cpldrs/cpl_det/cpl_detector.c, cpldrs/cpl_det/cpl_detector.h, cpldrs/cpl_det/cpl_detector_body.h: moved cpl_imagelist_fit_polynomial() from cpldrs to cplcore 2005-06-14 10:08 cizzo * cplcore/cpl_table.c: Fix typo: choosen chosen 2005-06-13 13:53 llundin * cplcore/: cpl_image_resample.c, cpl_image_resample_body.h, tests/cpl_image_resample-test.c: cpl_image_warp_polynomial(): Fix for identity transform. cpl_image_get_interpolated() brought up to specs 2005-06-13 13:50 llundin * cplcore/cpl_vector.c: Generalized radius from 2 in cpl_vector_fill_alpha_kernel() and other modes in cpl_vector_fill_kernel_profile() 2005-06-09 14:02 llundin * cplcore/cpl_tools.c, cplcore/cpl_vector.c, cplcore/cpl_vector.h, cpldrs/cpl_geom/cpl_geom_img.c: Generalized radius and resolution of pixel interpolation 2005-06-08 16:16 rpalsa * libcext/cext/cxstrutils.c: (cx_strsplit): Typo in documentation fixed. 2005-06-08 14:27 cizzo * cplcore/cpl_msg.c: Fix erroneous precompiler instructions (by Lars) 2005-06-08 09:36 llundin * cplcore/cpl_msg.c: Fixed #ifdef 2005-06-08 09:21 cizzo * cplcore/: cpl_msg.c: Improve portability in using ioctl() and stream descriptors handling functions 2005-06-03 13:06 rpalsa * cplui/tests/cpl_parameter-test.c: Added. 2005-06-03 13:05 rpalsa * cplui/tests/Makefile.am: Test module cpl_parameter-test added. 2005-06-03 13:04 rpalsa * cplui/cpl_parameter.c: Function _cpl_parameter_set_data(): In order to correctly set a string value in case the original value is not a plain type, but a cpl_parameter_data, the function must treat the passed pointer in the same way as for the built-in types, i.e. treat it as a pointer to pointer to char. 2005-06-03 13:00 rpalsa * cplui/cpl_parameter.c: Function _cpl_parameter_set_data(): In order to correctly set a string value in case the original value is not a plain type, but a cpl_parameter_data, the function must treat the passed pointer in the same way as for the built-in types, i.e. treat it as a pointer to pointer to char. 2005-06-03 12:59 rpalsa * cplui/tests/Makefile.am: Test module cpl_parameter-test added. 2005-06-03 12:59 rpalsa * cplui/tests/cpl_parameter-test.c: Added. 2005-06-03 11:57 cizzo * cplcore/tests/cpl_table-test.c: Add test related to a bug in dividing a double column by a column of different type 2005-06-03 11:55 cizzo * cplcore/cpl_column.c: cpl_column_divide(): fix bug in dividing a double column by a column of different type 2005-06-03 11:45 rpalsa * cplui/cpl_parameter.h: Copyright updated 2005-06-03 11:45 rpalsa * cplui/cpl_parameter.c: Function _cpl_parameter_set_data(): In order to correctly set a string value in case the original value is not a plain type, but a cpl_parameter_data, the function must treat the passed pointer in the same way as for the built-in types, i.e. treat it as a pointer to pointer to char. 2005-06-03 11:39 cizzo * cplcore/cpl_column.c: cpl_column_divide(): fix bug in dividing a double column by a column of different type 2005-06-03 11:38 cizzo * cplcore/tests/cpl_table-test.c: Add test related to a bug in dividing a double column by a column of different type 2005-06-03 11:33 rpalsa * tests/Makefile.am: Test module cpl_parameter-test added. 2005-06-03 11:31 rpalsa * tests/cpl_parameter-test.c: Added. 2005-06-02 17:15 cplmgr * cplcore/cpl_image_basic.c, cplcore/cpl_image_basic.h, cplcore/cpl_image_gen.c, cplcore/cpl_image_io.c, cplcore/cpl_image_io_body.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_matrix.c, cplcore/cpl_polynomial.c, cplcore/cpl_polynomial.h, cplcore/cpl_stats.c, cplcore/cpl_stats.h, cplcore/cpl_table.c, cplcore/cpl_tools.c, cplcore/cpl_tools.h, cplcore/cpl_vector.c, cplcore/cpl_vector.h, cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_vector-test.c, cpldfs/cpl_dfs.c, cpldrs/cpl_apert/cpl_apertures.c, cpldrs/cpl_phot/cpl_photom.c, cplui/cpl_frameset_io.c: Bug fixes imported from HEAD. 2005-05-23 08:53 llundin * cplcore/cpl_bivector.c: Let cpl_bivector_delete() (silently) accept a corrupted object for deletion 2005-05-20 17:06 llundin * cplcore/tests/cpl_bivector-test.c: Added test of cpl_bivector_duplicate(), and some more tests of cpl_bivector_(). 2005-05-20 17:05 llundin * cplcore/: cpl_bivector.c, cpl_bivector.h: Fixed cpl_bivector_load() empty file bug. Added const modifiers. void cpl_bivector_dump() acts like other cpl_<*>_dump() functions (does not set CPL error code, etc). cpl_bivector_load() does not hang on FIFO. 2005-05-20 11:49 llundin * cplcore/tests/cpl_polynomial-test.c: Extra test of 0-degree + memory leak 2005-05-20 11:48 llundin * cplcore/cpl_polynomial.c: Abolish stdev-scaling in polynomial-fitting 2005-05-20 11:46 llundin * cplcore/: cpl_tools.c, cpl_tools.h, cpl_vector.c: cpl_tools_get_variance_double() needed to solve 0-degree inconsistencies in polynomial module 2005-05-20 11:42 yjung * cplcore/cpl_image_io_body.h: typo 2005-05-20 10:32 yjung * cplcore/: cpl_image_io.c, cpl_image_io_body.h: DFS02342 2005-05-20 09:50 llundin * cplcore/tests/cpl_polynomial-test.c: Improved tests of 0-degree polynomials 2005-05-20 09:48 llundin * cplcore/cpl_polynomial.c: Solved 0-degree inconsistencies 2005-05-18 15:55 cizzo * cpldfs/cpl_dfs.c: Improve documentation of cpl_def_setup_product_header() 2005-05-18 15:42 yjung * cplcore/cpl_imagelist_basic.c: unused variable removed 2005-05-17 15:18 yjung * cplui/cpl_frameset_io.c: improved error checking 2005-05-17 14:23 yjung * cplcore/cpl_imagelist_io.c: make use of cpl_tools_gen_valid_header() 2005-05-17 14:14 yjung * cplcore/cpl_image_io.c: uses cpl_tools_gen_valid_header() to properly handle the files creation. 2005-05-17 14:13 yjung * cplcore/: cpl_tools.c, cpl_tools.h: added cpl_tools_gen_valid_header() 2005-05-17 08:15 cizzo * cplcore/cpl_matrix.c: Eliminate a memory leak and complete documentation of cpl_matrix_solve_normal() 2005-05-12 08:06 llundin * cplcore/tests/cpl_polynomial-test.c: typo 2005-05-11 15:24 llundin * cplcore/tests/cpl_polynomial-test.c: Added P0-check for cpl_polynomial_fit_1d_create(). Adjust limits to HP-UX and SunOS. Added test of cpl_polynomial_fit_2d_create(). Added a (temporary?) genccd test 2005-05-11 15:19 llundin * cplcore/cpl_polynomial.c: Improved documentation. cpl_polynomial_fit_{1,2}d_create(): Prepared stdev transform. cpl_polynomial_fit_{1,2}d_create(): transform eval-points by mean. Prevent print of zero-valued coeffs in cpl_polynomial_dump(). cpl_polynomial_fit_2d_create(): set CPL_ERROR_DIVISION_BY_ZERO if all data-points have same value, do not use pow(), avoid lookup-table 2005-05-11 15:06 llundin * cplcore/cpl_vector.c: Fixed some errors in documention. cpl_vector_dump() compatible with cpl_matrix_dump(). cpl_vector_load(): Solved rewind() problem and extended error checking. Reduced round-off in cpl_vector_get_mean(). Use memcpy() in cpl_vector_get_median() 2005-05-11 15:01 llundin * cplcore/tests/cpl_vector-test.c: cpl_msg_set_level_from_env(). Some more tests of cpl_vector_load() 2005-05-11 13:16 yjung * cplcore/cpl_imagelist_basic.c: doc 2005-05-11 12:37 yjung * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic.h, cpl_imagelist_basic_body.h, tests/cpl_imagelist_basic-test.c: added cpl_imagelist_collapse_minmax_create() 2005-05-09 09:44 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_msg_set_level_from_env(). Some tests of cpl_polynomial_fit_1d_create() and a call to cpl_polynomial_fit_2d_create() 2005-05-09 09:41 llundin * cplcore/cpl_polynomial.c: Fixed some errors in documention. Use CPL_ERROR_DATA_NOT_FOUND for empty polynomials and CPL_ERROR_INVALID_TYPE for wrong dimension. Use CPL_ERROR_INCOMPATIBLE_INPUT when appropriate. Require non-empty input-polynomial in cpl_polynomial_copy(). Use realloc in cpl_polynomial_copy() for identical dims. Use assert() to expose internal bugs. cpl_polynomial_fit_1d_create(): Require at least at many data-points as the polynomial coefficients, set CPL_ERROR_DIVISION_BY_ZERO if all data-points have same x-value, do not use pow(), set CPL_ERROR_SINGULAR_MATRIX when appropriate, transform x-values by mean and stdev, extend documentation, use cpl_matrix_wrap() for RHS. cpl_polynomial_fit_2d_create(): Require at least at many data-points as the polynomial coefficients, set CPL_ERROR_SINGULAR_MATRIX when appropriate, use cpl_matrix_wrap() for RHS 2005-05-06 18:39 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_stats.c, cpl_stats.h: Avoid bitmasks with value 1 (to detect use of logical or on bitmasks) 2005-05-06 18:37 llundin * cplcore/cpl_vector.c: Fixed wrong cpl_error code in cpl_vector_divide_scalar() 2005-05-06 08:03 llundin * cplcore/cpl_image_basic.c: Remove memory-leak on rejected pixel in cpl_image_get_fwhm() (DFS02318) 2005-05-04 18:03 llundin * cplcore/cpl_image_basic.c: Removed redundant initialization 2005-05-04 17:25 llundin * cplcore/cpl_image_basic.c: Ensure return of -1 on error in cpl_image_get_fwhm() (DFS02317) 2005-04-27 14:35 cizzo * cpldfs/cpl_dfs.c: Remove HIERARCH prefix from property names 2005-04-15 16:59 llundin * cplcore/tests/: cpl_image_basic-test.c, cpl_polynomial-test.c, cpl_vector-test.c: assert_cpl(). test_leq(). error_margin = 2. Default is no output 2005-04-15 14:19 rpalsa * libcext/m4macros/eso.m4: Fixes from revision 1.2.2.5 imported. 2005-04-15 13:48 rpalsa * configure.ac: Package version updated. 2005-04-15 13:47 rpalsa * libcext/configure.ac: Library revision updated. 2005-04-15 13:40 rpalsa * libcext/configure.ac: Package version changed. 2005-04-15 13:39 rpalsa * libcext/m4macros/eso.m4: ESO_FUNC_VA_COPY: Fix test setting symbol HAVE_VA_COPY. 2005-04-15 08:58 llundin * cplcore/tests/cpl_polynomial-test.c: Accuracy checks ported to alpha, sun4u, 9000/785 2005-04-15 08:57 llundin * cplcore/tests/cpl_vector-test.c: Reduced POLY_SIZE to 20 due to SIGFPE on alphaev56 2005-04-14 14:23 cizzo * cplcore/cpl_table.c: Fix bug on cpl_table_and/or_selected_invalid 2005-04-14 12:45 cizzo * cpldfs/cpl_dfs.c: Use a more portable definition of MAX_PLENGTH 2005-04-13 10:01 llundin * cplcore/: cpl_vector.c, tests/cpl_vector-test.c: Higher round-off on cpl_vector_correlate() (commutative test) 2005-04-12 14:25 cizzo * cpldfs/cpl_dfs.c: Do not stop on headerless input files 2005-04-12 13:05 yjung * cplcore/cpl_imagelist_io.c: corrected a bug in cpl_imagelist_delete() 2005-04-12 09:41 llundin * cplcore/cpl_polynomial.c: Added missing do to macro 2005-04-12 09:39 cizzo * cpldfs/cpl_dfs.c: Add missing error checking when loading a header from a specified file 2005-04-08 10:58 cizzo * doxygen/cplref_introduction_pdf.tex: Implementation (by Klaus Banse) 2005-04-07 17:22 rpalsa * doxygen/Doxyfile.in: Really disable LaTeX documnetation. 2005-04-07 12:49 llundin * cplcore/cpl_tools.h: Included cxtypes.h 2005-04-07 12:47 llundin * cplcore/cpl_image_basic.c, cplcore/cpl_image_gen.c, cplcore/cpl_tools.c, cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_vector-test.c, cpldrs/cpl_phot/cpl_photom.c: Replaced M_PI with CX_PI (from libcext) 2005-04-07 11:28 llundin * cplcore/: cpl_polynomial.h, cpl_vector.h: Removed Carriage Return 2005-04-07 10:55 cizzo * cpldfs/cpl_dfs.c: Add header file for snprintf()... 2005-04-06 17:31 cplmgr * ChangeLog: Updated. 2005-04-06 17:18 cizzo * NEWS: Draft for 2.0 release - please check 2005-04-06 14:40 rpalsa * cplui/cpl_parameterlist.c: Function cpl_parameterlist_get_next(): Move argument check after variable declarations. 2005-04-01 15:39 yjung * TODO: [no log message] 2005-04-01 15:35 yjung * README: update to 2.0 2005-03-31 13:42 cizzo * cplcore/cpl_error.c: Associate a message to CPL_ERROR_INVALID_TYPE 2005-03-30 17:14 cizzo * cplcore/cpl_column.c: Fix bug: attempt to duplicate null string was not caught 2005-03-27 18:49 cplmgr * ChangeLog, libcext/ChangeLog: Updated. 2005-03-27 18:45 cplmgr * libcext/ChangeLog: Updated. 2005-03-24 11:39 yjung * cpldrs/cpl_apert/cpl_apertures.c: check to avoid division by zero 2005-03-23 12:14 rpalsa * configure.ac: Package version changed. 2005-03-23 11:02 cplmgr * ChangeLog: Updated. 2005-03-23 10:58 cplmgr * libcext/ChangeLog: Updated 2005-03-23 10:51 cplmgr * configure.ac: Package version updated. 2005-03-23 10:51 cplmgr * libcext/tests/cxmap-test.c: Function cx_test_map_greater_char() removed. 2005-03-22 15:05 cizzo * cplcore/cpl_error.c: Make MAX_NAME_LENGTH compatible with the value of CPL_MAX_FUNCTION_NAME 2005-03-22 14:33 cizzo * cpldfs/cpl_dfs.c: Correct delete of DPR keywords 2005-03-21 10:31 llundin * cplcore/cpl_error.c, cplcore/cpl_error.h, cplcore/cpl_image_bpm.c, cplcore/cpl_image_bpm.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_stats.c, cplcore/cpl_image_stats.h, cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h, cplcore/cpl_tools.c, cplcore/cpl_tools.h, cpldrs/cpl_phot/cpl_photom.h, cplcore/cpl_stats.c, cplcore/cpl_stats.h: Removed const modifier from arguments passed by value 2005-03-18 11:54 yjung * cpldrs/cpl_geom/cpl_geom_img.c: added include for cpl_error_push() 2005-03-18 11:06 llundin * cpldrs/cpl_geom/cpl_geom_img.c: Added TODO comment 2005-03-18 10:58 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_table.c, cpl_table.h: Add const qualifier where appropriate 2005-03-18 10:19 cizzo * cplcore/: cpl_matrix.c, cpl_matrix.h: Add const qualifier where appropriate 2005-03-17 15:17 cizzo * cpldfs/cpl_dfs.c: Avoid duplicate definition of PRO_DID 2005-03-15 14:53 yjung * cpldrs/cpl_geom/cpl_geom_img.c: added some documentation 2005-03-11 16:49 cizzo * cplcore/cpl_msg.c: Add separators for component 2005-03-11 16:33 cizzo * cplcore/cpl_msg.c: Ugly indentation eliminated 2005-03-10 17:14 rpalsa * cplui/cpl_parameter.c: Function cpl_parameter_set_tag(): Deallocate previous usertag before setting the new one. 2005-03-10 09:11 yjung * cplcore/cpl_msg.c: changed circa to something else 2005-03-09 15:01 rpalsa * cplui/cpl_parameter.h: Definition of enum _cpl_parameter_mode_: trailing comma removed. 2005-03-08 15:05 yjung * cpldrs/cpl_det/cpl_detector_body.h: iset-> ilist 2005-03-08 15:04 yjung * cpldrs/cpl_det/cpl_detector.c: iset -> ilist 2005-03-08 11:52 yjung * cpldrs/cpl_apert/cpl_apertures.c: bug correction on centroid computation 2005-03-07 16:34 yjung * cplcore/: cpl_imagelist_defs.h, cpl_imagelist_io.h: offered cpl_imagelist_is_uniform() 2005-03-07 14:16 yjung * cpldrs/cpl_geom/: cpl_geom_img.c, cpl_geom_img_body.h: iset -> ilist 2005-03-02 17:41 yjung * cpldrs/cpl_geom/cpl_geom_img.c: added #include cpl_error.h 2005-03-02 17:39 cplmgr * configure.ac: Package version updated. 2005-03-02 17:37 rpalsa * cplcore/: cpl_init.c, cpl_memory.c, cpl_memory.h, cpl_memory_impl.h: Include cpl_memory_impl.h instead of cpl_memory.h 2005-03-02 16:51 cizzo * cpldfs/cpl_dfs.c: Add PRO TYPE keyword 2005-03-02 15:25 yjung * cplui/cpl_frame.h: added CPL_FRAME_TYPE_ANY in cpl_frame types 2005-03-02 09:57 yjung * cpldrs/cpl_geom/cpl_geom_img.c: error handling changed 2005-03-01 11:24 yjung * cpldrs/: cpl_apert/cpl_apertures.c, cpl_apert/cpl_apertures_img.c, cpl_det/cpl_detector.c, cpl_geom/cpl_geom_img.c, cpl_phot/cpl_photom.c: added doc on returned error codes 2005-03-01 09:24 yjung * cpldrs/cpl_phot/cpl_photom.c: added defgroup for this one 2005-03-01 09:21 yjung * cpldrs/cpl_apert/: cpl_apertures.c, cpl_apertures_img.c: added doc 2005-03-01 09:15 yjung * cpldrs/: cpl_det/cpl_detector.c, cpl_geom/cpl_geom_img.c: added doc 2005-03-01 09:02 yjung * doxygen/Doxyfile.in: remove cpl_tools.c from doc 2005-03-01 08:41 yjung * cplcore/: cpl_polynomial.c, cpl_stats.c: updated documentation 2005-02-28 19:39 yjung * cplcore/cpl_vector.c: added doc on returned error codes 2005-02-28 19:24 yjung * cplcore/cpl_stats.c: added documentation on returned error codes 2005-02-28 19:19 yjung * cplcore/cpl_polynomial.c: added doc on retured errors 2005-02-28 18:54 yjung * cplcore/cpl_mask.c: added doc on returned error codes 2005-02-28 18:47 yjung * cplcore/cpl_image_stats.c: add the doc on the error codes 2005-02-28 18:36 yjung * cplcore/cpl_image_resample.c: added doc on returned error codes 2005-02-28 18:27 yjung * cplcore/cpl_imagelist_io.c: added doc for the returned errors 2005-02-28 18:14 yjung * cplcore/cpl_imagelist_basic.c: added doc for the returned error codes (doxygen) 2005-02-28 13:59 yjung * cplcore/cpl_imagelist_basic_body.h: [no log message] 2005-02-28 12:06 yjung * cplcore/cpl_image_io.c: added doc for the returned error codes 2005-02-28 11:51 yjung * cplcore/cpl_image_gen.c: documentation for returned error codes (doxygen) 2005-02-28 10:00 llundin * cpldfs/: cpl_dfs.c, cpl_dfs.h: Added const modifier to parlist 2005-02-28 09:15 yjung * cplcore/cpl_imagelist_io_body.h: not mmapp 2005-02-28 08:19 llundin * cplcore/cpl_imagelist_io_body.h: Revert image creation in cpl_imagelist_load() to cpl_image_load() 2005-02-28 08:14 llundin * cplcore/: cpl_imagelist_defs.h, cpl_imagelist_io.c: Removed need for cpl_image_defs.h 2005-02-28 08:11 llundin * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic_body.h: Removed need for cpl_image_defs.h. Replaced CPL_ERROR_ILLEGAL_OUTPUT. Corrected error checking with cpl_imagelist_is_uniform() 2005-02-28 08:00 llundin * cplcore/tests/cpl_imagelist_basic-test.c: Removed unneeded #include 2005-02-28 07:58 llundin * cpldrs/cpl_apert/cpl_apertures.c: Removed need for cpl_image_defs.h. Simplified calling sequence for cpl_apertures_extract{,_window}() 2005-02-28 07:56 llundin * cpldrs/cpl_det/cpl_detector.c: Removed need for cpl_image_defs.h 2005-02-28 07:55 llundin * cpldrs/cpl_geom/cpl_geom_img.c: Fixed memory leak in cpl_geom_img_offset_combine() 2005-02-26 15:56 cizzo * cplcore/cpl_msg.c: Minor correction to the documentation 2005-02-26 15:33 cizzo * cplcore/cpl_msg.c: Reformatting of error description 2005-02-26 15:01 cizzo * cplcore/cpl_matrix.c: Reformatting of error description 2005-02-26 12:56 cizzo * cplcore/cpl_table.c: Fix some mistakes in the reformatted error description 2005-02-26 12:50 cizzo * cplcore/cpl_table.c: Completed reformatting of error description 2005-02-25 17:23 cizzo * cplcore/cpl_table.c: Further reformatting of error description 2005-02-25 17:03 yjung * cpldrs/cpl_geom/cpl_geom_img.c: doxygen 2005-02-25 16:47 yjung * cplcore/cpl_image_filter.c: updated the returned error codes doc (doxygen) 2005-02-25 16:24 yjung * cplcore/cpl_image_bpm.c: updated doc on returned error codes (doxygen) 2005-02-25 12:52 yjung * cplcore/cpl_image_basic.c: updated documentation on error codes (doxygen) 2005-02-25 11:32 yjung * cplcore/cpl_bivector.c: added error description (doxygen) 2005-02-25 09:47 llundin * cpldfs/: cpl_dfs.c, cpl_dfs.h: Added 2 const modifiers to cpl_dfs_setup_product_header() 2005-02-25 09:34 cizzo * cplcore/cpl_table.c: Partial reformatting of error description 2005-02-24 19:51 yjung * cplcore/cpl_imagelist_io_body.h: load the whole extenxion in one go (all the planes 2005-02-24 18:37 yjung * cplcore/: cpl_image_io.c, cpl_imagelist_io_body.h: do not map the files any more !!!!!!! problems with huge files 2005-02-24 09:24 cplmgr * configure.ac: Package version updated. 2005-02-23 16:59 llundin * cplcore/cpl_image_basic.c: Cleaned up division 2005-02-23 16:58 llundin * cplcore/cpl_image_resample.c: 4 X 4 Caveat for pixel-interpolation 2005-02-23 16:57 llundin * cpldrs/cpl_geom/cpl_geom_img.c: Commented out currently unused variable 2005-02-23 16:28 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_table.c, cpl_table.h: Add cpl_table_get_column_stdev() 2005-02-23 16:27 cizzo * cplcore/tests/cpl_table-test.c: Add test for cpl_table_get_column_mean(), _median(), and _stdev() 2005-02-23 16:02 yjung * cplcore/cpl_vector.c: cpl_vector_get_median used to modify the input vector - corrected 2005-02-22 11:43 llundin * cplcore/cpl_error.h: cpl_assure{,_code}() will at least set CPL_ERROR_UNSPECIFIED 2005-02-21 13:28 cizzo * cpldfs/cpl_dfs.c: Fix wrong check in cpl_dfs_setup_product_header() 2005-02-21 13:19 yjung * cplcore/cpl_imagelist_io.c: doxygen 2005-02-21 11:05 yjung * cplcore/: cpl_imagelist_io.c, cpl_imagelist_io_body.h: updated doxygen comments 2005-02-21 11:01 yjung * cplcore/: cpl_image_basic.c, cpl_image_filter.c, cpl_imagelist_basic.c, cpl_imagelist_basic_body.h: updated doxygen comments 2005-02-21 09:40 yjung * doxygen/Doxyfile.in: added cpldfs 2005-02-21 09:38 yjung * cpldrs/cpl_det/cpl_detector.c: doxygen 2005-02-21 09:35 yjung * cplcore/cpl_vector.c: doxygen change 2005-02-18 16:15 cizzo * cplcore/: cpl_table.c, cpl_msg.c: Fix typo 2005-02-18 14:30 yjung * cplcore/tests/cpl_imagelist_io-test.c: bug in the test 2005-02-18 14:15 llundin * cplcore/cpl_msg.c: Moved _cpl_msg_init("cpl_msg_progress") to follow declarations 2005-02-18 08:42 cplmgr * configure.ac: Package version updated 2005-02-17 11:52 yjung * cplcore/: cpl_stats.c, cpl_stats_body.h: centroid computation: subtract the min if there are <0 values 2005-02-17 10:07 yjung * cplcore/tests/cpl_sparseimage-test.c: solved centroid pb 2005-02-17 09:53 yjung * cplcore/: cpl_stats.c, cpl_stats_body.h: support 1 pixel image 2005-02-17 09:37 rpalsa * cplui/cpl_plugin.c: Function cpl_plugin_dump(): Use correct format when printing plugin type and version. 2005-02-16 19:28 yjung * cpl.h, cplcore/Makefile.am, cplcore/cpl_image.h, cplcore/cpl_image_basic.c, cplcore/cpl_image_stats.c, cplcore/cpl_image_stats.h, cplcore/cpl_image_stats_body.h, cplcore/cpl_stats.c, cplcore/cpl_stats.h, cplcore/cpl_stats_body.h, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_imagelist_basic-test.c: created the cpl_image_stats module from functions in cpl_stats 2005-02-16 18:56 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h, cpl_image_filter.c, cpl_image_io.c, cpl_image_io.h, cpl_imagelist_basic_body.h, cpl_mask.c, cpl_stats.c, tests/cpl_image_basic-test.c, tests/cpl_image_io-test.c: new removal of _remove() functions 2005-02-16 18:40 yjung * cplcore/tests/: Makefile.am, cpl_bivector-test.c, cpl_image_bpm-test.c, cpl_imagelist_complex-test.c, cpl_imagelist_io-test.c, cpl_polynomial-test.c: removed _remove() functions 2005-02-16 18:12 yjung * cplcore/Makefile.am, cplcore/cpl_bivector.c, cplcore/cpl_bivector.h, cplcore/cpl_image_bpm.c, cplcore/cpl_image_bpm.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_imagelist_basic.c, cplcore/cpl_imagelist_complex.c, cplcore/cpl_imagelist_complex.h, cplcore/cpl_imagelist_complex_body.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io.h, cplcore/cpl_imagelist_io_body.h, cplcore/cpl_memory.c, cplcore/cpl_polynomial.c, cplcore/cpl_polynomial.h, cplcore/cpl_stats.c, cplcore/cpl_stats.h, cplui/cpl_frameset_io.c: removed _remove() functions 2005-02-16 12:33 llundin * cplcore/tests/cpl_sparseimage-test.c: Disabled centroiding 2005-02-14 18:20 rpalsa * cplui/cpl_frame.c: Functions cpl_frame_set_filename(), cpl_frame_set_tag(): Do proper zero termination when resetting the filename or tag. 2005-02-14 18:10 rpalsa * cplui/cpl_frame.c: Functions cpl_frame_set_filename() and cpl_frame_set_tag(): Simplify code for resetting the filename and the tag. 2005-02-14 13:03 cizzo * cplcore/cpl_table.c: Correct documentation for cpl_table_erase_selected() 2005-02-14 11:25 cizzo * cplcore/cpl_msg.c: Correct doc of cpl_msg_stop_log() 2005-02-14 10:33 cizzo * cplcore/: cpl_matrix.c, cpl_matrix.h: Correct name for cpl_matrix_get_mean(), _median(), _stdev() 2005-02-14 08:56 cizzo * cplcore/cpl_table.c: Improve doc of cpl_table_load() and cpl_table_save(), and differentiate between illegal FITS files and specifying an extension not containing a table 2005-02-11 18:40 yjung * cplui/: cpl_frame.c, cpl_frame.h: added cpl_frame_get_nextensions 2005-02-11 17:30 yjung * cplcore/cpl_stats.c: raise an error if the centroid cannot be computed 2005-02-11 16:20 rpalsa * cplcore/cpl_propertylist.c: Use cpl_error_push() and cpl_error_pop() 2005-02-11 15:47 rpalsa * cplcore/: cpl_error.c, cpl_error_impl.h: Functions cpl_error_push() and cpl_error_pop() added. 2005-02-11 10:36 rpalsa * cplui/cpl_parameterlist.c: Function cpl_parameterlist_dump(): Implementation added. 2005-02-11 10:35 rpalsa * cplui/cpl_parameter.c: Function cpl_parameter_dump(): Implementation added. 2005-02-11 09:10 cizzo * cplcore/cpl_error.c: Correct array sizes 2005-02-10 15:30 rpalsa * cplui/: cpl_parameter.c, cpl_parameter.h: Function cpl_parameter_dump() resurrected (stubs only). 2005-02-10 15:30 rpalsa * cplui/: cpl_parameterlist.c, cpl_parameterlist.h: Function cpl_parameterlist_dump() resurrected (stubs only). 2005-02-10 15:29 rpalsa * cplui/: cpl_pluginlist.c, cpl_pluginlist.h: Function cpl_pluginlist_dump() resurrected. 2005-02-10 15:28 rpalsa * cplui/: cpl_plugin.c, cpl_plugin.h: Function cpl_plugin_copy(): Documentation updated. Function cpl_plugin_dump() resurrected. 2005-02-10 11:59 yjung * ChangeLog, cpldrs/cpl_apert/cpl_apertures.c, cpldrs/cpl_apert/cpl_apertures.h, cpldrs/cpl_apert/cpl_apertures_img.c, cpldrs/cpl_apert/cpl_apertures_img.h, cpldrs/tests/cpl_apertures-test.c, cpldrs/tests/cpl_apertures_img-test.c: removed remaining _remove() functions 2005-02-10 11:47 rpalsa * cplui/: cpl_parameter.c, cpl_parameter.h: Function cpl_parameter_set_tag(): Added. 2005-02-09 18:12 llundin * cplcore/tests/cpl_vector-test.c: Raised bar on Commutativity test 2005-02-09 17:56 llundin * cplcore/cpl_vector.c: Fixed remaining sign bugs 2005-02-09 17:44 yjung * cplcore/cpl_vector.c: Fixed sign bug 2005-02-09 17:18 yjung * cpldrs/cpl_det/cpl_detector.c: typo 2005-02-09 16:42 cizzo * cpldfs/cpl_dfs.c: Fix bug in error handling 2005-02-09 16:01 rpalsa * cplui/cpl_parameter.c: Function cpl_parameter_set_alias(), cpl_parameter_get_alias(): Documentation updated. 2005-02-09 16:01 cizzo * cpldfs/cpl_dfs.c: Hardcoded CPL version 2005-02-09 16:00 rpalsa * cplui/cpl_parameter.h: Documentation for enum _cpl_parameter_mode_ added. 2005-02-09 15:59 cizzo * cpldfs/cpl_dfs.c: Input primary FITS keywords no longer mandatory, and other minor changes of behaviour 2005-02-09 15:22 llundin * cplcore/tests/cpl_image_io-test.c: Removed unused variable 2005-02-08 16:24 cizzo * cpldfs/cpl_dfs.c: Fix two or three bugs (Yves' test) 2005-02-08 12:50 cizzo * cplcore/cpl_error.c: cpl_error_reset() also resets the file and the line fields 2005-02-08 10:31 yjung * cpldfs/: cpl_dfs.c, cpl_dfs.h: moved defines in cpl_dfs.c 2005-02-08 10:15 yjung * cpldfs/cpl_dfs.c: little changes 2005-02-07 18:04 yjung * cpl.h: added cpl_dfs.h in cpl.h 2005-02-07 17:53 yjung * cpldfs/: cpl_prokeys.c, cpl_prokeys.h: obsolete 2005-02-07 13:28 cizzo * cplcore/cpl_error.c: Avoid setting CPL_ERROR_UNSPECIFIED if no error is set at cpl_set_where() call 2005-02-07 11:06 llundin * cplcore/cpl_image_resample.h, cplcore/cpl_imagelist_basic.c, cplcore/cpl_imagelist_basic.h, cplcore/cpl_tools.h, cplcore/cpl_vector.c, cplcore/cpl_vector.h, cpldrs/cpl_geom/cpl_geom_img.c, cpldrs/cpl_geom/cpl_geom_img.h: Removed cpl_tools.h from public .h files. typedef enum cpl_lowpass 2005-02-07 10:05 yjung * cpldfs/cpl_prokeys.c: removed functions 2005-02-07 09:56 cizzo * cpldfs/Makefile.am: Support cpl_dfs.c.h 2005-02-07 09:56 cizzo * cpldfs/: cpl_dfs.c, cpl_dfs.h: Implementation of cpl_dfs_setup_product_header() - NOT TESTED 2005-02-07 09:29 rpalsa * cplcore/: cpl_propertylist.c, cpl_propertylist.h: Convenience functions to update and copy properties added. 2005-02-04 15:35 cizzo * cplcore/cpl_table.h: Add necessary FILE definition 2005-02-04 13:49 rpalsa * cplui/cpl_plugin.c: Function cpl_plugin_copy(): More typos fixed in the documentation. 2005-02-04 10:22 rpalsa * cplui/cpl_plugin.c: Function cpl_plugin_copy(): Typo in documentation fixed. 2005-02-02 16:32 yjung * cplcore/cpl_imagelist_io.c: ... 2005-02-02 11:38 cplmgr * configure.ac: Package version updated. 2005-02-02 10:52 rpalsa * doxygen/Doxyfile.in: Hide documentation of internal functions. 2005-02-02 10:37 cizzo * cplui/cpl_parameter.c: Move cpl_error_set_code() to cpl_error_impl.h 2005-02-02 10:32 cizzo * cplcore/: Makefile.am, cpl_error.c, cpl_error.h, cpl_image_basic.c, cpl_property.c, cpl_propertylist.c: Move cpl_error_set_code() to cpl_error_impl.h 2005-02-02 10:28 cizzo * cplcore/cpl_error_impl.h: Implementation 2005-02-01 17:00 cizzo * cplcore/cpl_table.c: Include cpl_propertylist_impl.h 2005-02-01 16:54 yjung * cplcore/tests/cpl_image_io-test.c: no qfits use any more 2005-02-01 16:51 yjung * cplcore/: cpl_image_io.c, cpl_imagelist_io.c: added some missing includes 2005-02-01 16:32 rpalsa * doxygen/cpl.css: Added. 2005-02-01 16:31 rpalsa * doxygen/Doxyfile.in: Updated. 2005-02-01 16:29 rpalsa * cplcore/tests/cpl_property-test.c, cplcore/tests/cpl_propertylist-test.c, cplui/tests/cpl_frame-test.c, cplui/tests/cpl_frameset-test.c, cplui/tests/cpl_plugin-test.c: Adapted to API changes. 2005-02-01 16:28 rpalsa * cplcore/cpl_macros.h, cplcore/cpl_memory.c, cplcore/cpl_memory.h, cplcore/cpl_memory_impl.h, cplcore/cpl_property.c, cplcore/cpl_property.h, cplcore/cpl_propertylist.c, cplcore/cpl_propertylist.h, cplcore/cpl_type.c, cplcore/cpl_type.h, cplui/cpl_frame.c, cplui/cpl_frame.h, cplui/cpl_frameset.c, cplui/cpl_frameset.h, cplui/cpl_parameter.c, cplui/cpl_parameter.h, cplui/cpl_parameterlist.c, cplui/cpl_parameterlist.h, cplui/cpl_plugin.c, cplui/cpl_plugin.h, cplui/cpl_plugininfo.h, cplui/cpl_pluginlist.c, cplui/cpl_pluginlist.h, cplui/cpl_recipe.h: API changes. 2005-02-01 11:33 llundin * cplcore/tests/cpl_image_basic-test.c: Raised round-off limit for cpl_image_fft() 2005-02-01 10:54 llundin * cplcore/tests/cpl_image_basic-test.c: Raised round-off limit cpl_image_logarithm() 2005-01-31 15:09 cizzo * cplcore/: cpl_error.c, cpl_error.h: Apply better solution to the previous delta (following Lars' suggestion) 2005-01-31 11:45 llundin * cplcore/Makefile.am: cpl_tools.h is not distributed 2005-01-31 11:45 llundin * cplui/cpl_frameset_io.c: Needs private cpl_imagelist_is_uniform() 2005-01-31 10:27 llundin * cplcore/: cpl_image_basic.c, tests/cpl_image_basic-test.c: cpl_image_fft(): Normalize on inverse transform 2005-01-30 11:02 cizzo * cplcore/cpl_msg.h: Increase the value of MAX_FUNCTION_NAME 2005-01-30 10:58 cizzo * cplcore/: cpl_msg.c, cpl_msg.h: Move the definition of the constants MAX_MSG_LENGTH, MAX_FUNCTION_NAME, MAX_DOMAIN_NAME, MAX_LOGFILE_NAME from .c to .h 2005-01-29 17:04 cizzo * cplcore/: cpl_error.c, cpl_error.h: Preliminary step before making cpl_error_set_code() private 2005-01-29 16:19 cizzo * cplcore/cpl_msg.c: Avoid cpl_error_set_code() calls 2005-01-29 16:11 cizzo * cplcore/: cpl_matrix.c, cpl_matrix.h: Avoid cpl_error_set_code() calls, and reintroduce the _mean(), _median(), _stdev() 2005-01-29 14:44 cizzo * cplcore/cpl_column.c: Avoid cpl_error_set_code() calls 2005-01-28 17:29 llundin * cplcore/cpl_io.h: #include 2005-01-28 16:26 llundin * cpl.h, cplcore/Makefile.am, cplcore/cpl_image.h, cplcore/cpl_image_basic.c, cplcore/cpl_image_basic.h, cplcore/cpl_image_bpm.c, cplcore/cpl_image_bpm.h, cplcore/cpl_image_defs.h, cplcore/cpl_image_filter.c, cplcore/cpl_image_filter.h, cplcore/cpl_image_gen.c, cplcore/cpl_image_gen.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_resample.c, cplcore/cpl_image_resample.h, cplcore/cpl_imagelist.h, cplcore/cpl_imagelist_basic.h, cplcore/cpl_imagelist_complex.h, cplcore/cpl_imagelist_defs.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io.h, cplcore/cpl_mask.c, cplcore/cpl_mask.h, cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h, cplcore/cpl_stats.c, cplcore/cpl_stats.h, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_sparseimage-test.c, cplcore/tests/cpl_stats-test.c, cpldrs/cpl_apert/cpl_apertures.c, cpldrs/cpl_apert/cpl_apertures.h, cpldrs/cpl_apert/cpl_apertures_img.c, cpldrs/cpl_apert/cpl_apertures_img.h, cpldrs/cpl_det/cpl_detector.c, cpldrs/cpl_geom/cpl_geom_img.c, cpldrs/cpl_geom/cpl_geom_img.h, cpldrs/tests/cpl_detector-test.c: Privatized cpl_image members. cpl_geom_combine. pisigma optional 2005-01-28 12:39 cizzo * cplcore/: cpl_table.c, cpl_table.h: Avoid cpl_error_set_code() call, and move the cpl_column.h include from the .h to the .c module 2005-01-28 12:38 cizzo * cplcore/tests/cpl_table-test.c: Avoid cpl_error_set_code() call 2005-01-28 11:30 yjung * cpl.h: ui-> io 2005-01-28 11:27 yjung * cplui/cpl_frameset_io.c: small crrection 2005-01-28 11:20 yjung * cplui/Makefile.am: ui-> io 2005-01-28 11:19 yjung * cplui/cpl_frameset_io.h: ui -> io 2005-01-28 11:18 yjung * cplui/: cpl_frameset_io.c, cpl_frameset_io.h, cpl_frameset_ui.c, cpl_frameset_ui.h: _ui renamed in _io 2005-01-28 11:15 rpalsa * cplcore/cpl_propertylist_impl.h: Added. 2005-01-28 11:07 yjung * cpl.h: added cpl_frameset_ui.h 2005-01-28 11:06 yjung * cplui/: Makefile.am, cpl_frameset_ui.c, cpl_frameset_ui.h: added cpl_frameset_ui 2005-01-28 10:27 rpalsa * cplcore/Makefile.am: Updated. 2005-01-28 10:18 llundin * cpldrs/: cpl_apert/cpl_apertures.c, cpl_apert/cpl_apertures.h, cpl_geom/cpl_geom_img.c, tests/cpl_apertures-test.c: Redeclare aperture sorting routines to not modify object pointer 2005-01-28 09:43 llundin * cpldrs/: cpl_apert/cpl_apertures.c, cpl_apert/cpl_apertures.h, cpl_geom/cpl_geom_img.c, cpl_geom/cpl_geom_img.h, tests/cpl_apertures-test.c, tests/cpl_geom_img-test.c: Added sigmas to cpl_geom_img_offset_combine() 2005-01-28 08:37 cizzo * cplcore/cpl_table.h: Change of API: the append flag in cpl_table_save is now unsigned int to accomodate the new output modes 2005-01-27 16:55 cizzo * cplcore/cpl_table.c: Change of API: the append flag in cpl_table_save is now unsigned int to accomodate the new output modes 2005-01-27 16:11 cizzo * cplcore/tests/: cpl_image_filter-test.c, cpl_mask-test.c, cpl_matrix-test.c: Adapt to cpl_matrix_wrap() API change 2005-01-27 16:11 cizzo * cplcore/: cpl_matrix.c, cpl_matrix.h: Make _unwrap() to return void *, and change the _wrap() API 2005-01-27 15:46 llundin * cpldrs/: cpl_apert/cpl_apertures.c, cpl_apert/cpl_apertures.h, tests/cpl_apertures-test.c: Added sigmas to cpl_apertures_extract_window() 2005-01-27 15:00 cizzo * cplcore/cpl_table.c: Wrong error code setting in functions _selected_invalid() 2005-01-27 14:59 llundin * cpldrs/cpl_apert/cpl_apertures.c: loop over sigmas in cpl_apertures_extract_window() 2005-01-27 14:43 llundin * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_vector.c, cpl_vector.h: Redeclared cpl_{vector,image}_unwrap() to void * 2005-01-27 11:53 llundin * cplcore/: cpl_vector.c, cpl_vector.h: Aligned API of cpl_vector_wrap() with that of cpl_image_wrap_*() 2005-01-26 15:06 llundin * cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io.h, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cpldrs/cpl_det/cpl_detector.c, cpldrs/cpl_det/cpl_detector_body.h: Removed redundant cpl_imagelist_get_*() 2005-01-26 14:10 llundin * cplcore/: cpl_imagelist_defs.h, cpl_imagelist_io.c, cpl_imagelist_io.h, tests/cpl_imagelist_io-test.c: cpl_imagelist_is_uniform() is private 2005-01-26 13:42 cizzo * cplcore/cpl_table.c: Fix error setting in cpl_table_delete 2005-01-25 17:59 llundin * cplcore/: cpl_vector.c, cpl_vector.h, tests/cpl_vector-test.c: Added istep to cpl_vector_extract() 2005-01-25 17:47 llundin * cplcore/cpl_image_resample.c, cplcore/cpl_image_resample.h, cplcore/cpl_image_resample_body.h, cplcore/tests/cpl_image_resample-test.c, cpldrs/cpl_geom/cpl_geom_img.c: cpl_image_extract_subsample() generalized 2005-01-25 17:38 llundin * cpl.h: Removed private sparseimage.h and column.h 2005-01-25 16:44 llundin * cplcore/: cpl_image_resample.c, cpl_image_resample.h, tests/cpl_image_resample-test.c: cpl_image_warp_polynomial() API change: radius + profile 2005-01-25 14:22 llundin * cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io.h, cplcore/cpl_io.h, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_mask-test.c, cpldrs/tests/cpl_detector-test.c: cpl_image_save(). CPL_IO_DEFAULT 2005-01-25 09:41 llundin * cplcore/cpl_image_basic.c: CPL_FFT_EOL => CPL_FFT_MAX 2005-01-25 09:02 llundin * cplcore/: cpl_imagelist_io.c, cpl_imagelist_io.h, cpl_imagelist_io_body.h, tests/cpl_imagelist_io-test.c: cpl_imagelist_load() 2005-01-25 08:02 llundin * cpldrs/: cpl_apert/cpl_apertures_img.c, cpl_det/cpl_detector.c, cpl_geom/cpl_geom_img.c: defgroup renaming 2005-01-24 15:53 llundin * cplcore/cpl_imagelist_complex.c, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io.h, cplcore/cpl_imagelist_io_body.h, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_complex-test.c, cplcore/tests/cpl_imagelist_io-test.c, cpldrs/cpl_det/cpl_detector.c, cpldrs/tests/cpl_geom_img-test.c: Redeclared cpl_imagelist_new() 2005-01-24 14:43 llundin * cplcore/cpl_imagelist_io_body.h: Removed direct access of ->ni 2005-01-24 14:43 llundin * cplcore/cpl_imagelist_io.c: fixed cpl_imagelist_set() bug 2005-01-21 16:09 cizzo * cplcore/tests/cpl_matrix-test.c: Fix rounding problem 2005-01-21 15:49 cizzo * cplcore/cpl_msg.c: Avoid warning message 2005-01-21 14:28 llundin * cplcore/cpl_imagelist_basic.c, cplcore/cpl_imagelist_basic.h, cplcore/cpl_imagelist_basic_body.h, cplcore/cpl_imagelist_complex.c, cplcore/cpl_imagelist_defs.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io.h, cplcore/cpl_imagelist_io_body.h, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cpldrs/cpl_geom/cpl_geom_img.c, cpldrs/cpl_geom/cpl_geom_img.h, cpldrs/tests/cpl_geom_img-test.c: Redeclare cpl_imagelist_erase() and cpl_geom_img_offset_combine(). cpl_imagelist_check() redeclared to cpl_imagelist_is_uniform(). Remove direct imagelist access. Added checks in cpl_imagelist_set() 2005-01-21 14:24 llundin * cplcore/cpl_io.h: Removed unnecessary comma 2005-01-20 15:31 llundin * cplcore/cpl_error.h: -DCPL_DEBUG 2005-01-20 15:15 llundin * cplcore/cpl_io.h: Removed _cpl_type_bpp_ and the references to qfits and changed CPL_BPP_DEFAULT to a macro 2005-01-17 12:03 cizzo * cplcore/: cpl_msg.c, cpl_msg.h: Add function cpl_msg_set_log_name() 2005-01-17 11:55 llundin * cpl.h, cplcore/Makefile.am, cplcore/cpl_imagelist.h, cplcore/cpl_imagelist_basic.c, cplcore/cpl_imagelist_basic.h, cplcore/cpl_imagelist_complex.c, cplcore/cpl_imagelist_complex.h, cplcore/cpl_imagelist_defs.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io.h, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_io-test.c, cpldrs/cpl_det/cpl_detector.c, cpldrs/cpl_det/cpl_detector_body.h, cpldrs/cpl_geom/cpl_geom_img.c, cpldrs/cpl_geom/cpl_geom_img.h, cpldrs/cpl_geom/cpl_geom_img_body.h, cpldrs/tests/cpl_geom_img-test.c: Members of cpl_imagelist made private 2005-01-17 09:39 rpalsa * cplcore/cpl_plist.c: Function cpl_plist_load(): Check whether qfits returned a valid header or not. Function cpl_plist_get_string(): Typo fixed in the documentation. 2005-01-13 11:13 llundin * cplcore/cpl_property.c, cplcore/cpl_property.h, cplcore/cpl_propertylist.c, cplcore/cpl_propertylist.h, cplui/cpl_frame.c, cplui/cpl_frame.h, cplui/cpl_frameset.c, cplui/cpl_frameset.h, cplui/cpl_parameter.c, cplui/cpl_parameter.h: Redeclaration of some functions from int to cpl_error_code. Replacement of some cx_assert() with cpl_assure_code() 2005-01-13 08:09 llundin * cplcore/cpl_error.h: set CPL_ERROR_UNSPECIFIED to 1 while verifying redeclation of functions from int to cpl_error_code 2005-01-13 07:51 llundin * cplcore/tests/cpl_vector-test.c: unused variable 2005-01-12 18:16 llundin * cplcore/cpl_error.h: include stdlib.h (for getenv()) 2005-01-12 17:35 llundin * cpldfs/cpl_prokeys.h: include cpl_error.h 2005-01-12 17:29 llundin * cpldfs/: cpl_prokeys.c, cpl_prokeys.h: Renamed plist to propertylist 2005-01-12 17:29 llundin * cpl.h: Include most basic modules first 2005-01-12 15:21 llundin * cplui/: cpl_frameset.c, cpl_frameset.h: cpl_frameset_labelise() stays in CPL 2005-01-11 17:06 llundin * cpldrs/cpl_geom/: cpl_geom_img.c, cpl_geom_img.h: Use cpl_vector_fill_kernel_profile() 2005-01-11 17:04 llundin * cplcore/cpl_image_resample.c: cpl_image_get_interpolated() confidence is negative on error 2005-01-11 13:54 llundin * cplcore/cpl_vector.c, cplcore/cpl_vector.h, cplcore/tests/cpl_vector-test.c, cpldrs/cpl_det/cpl_detector.c: Redeclared cpl_vector_get_stdev() 2005-01-11 06:40 llundin * cpl.h, cplcore/Makefile.am, cplcore/cpl_image_basic.h, cplcore/cpl_image_io.h, cplcore/cpl_imagelist_io.c, cplcore/cpl_imagelist_io.h, cplcore/cpl_io.h, cplcore/cpl_mask.h, cplcore/cpl_type.h, cplcore/cpl_vector.h: Added cpl_io.h 2005-01-10 16:34 cizzo * cplcore/: cpl_msg.c, cpl_msg.h: Add const qualifier to function arguments declaration where appropriate 2005-01-10 16:14 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h: CPL_FFT_SWAP_HALVES. Support for CPL_TYPE_COMPLEX in cpl_image_move() 2005-01-10 16:13 llundin * cpldrs/tests/cpl_geom_img-test.c: my_assert() 2005-01-10 16:12 llundin * cpldrs/cpl_geom/cpl_geom_img.c: Added cpl_assure() 2005-01-10 15:49 llundin * cplcore/cpl_image_io.c: Removed assert() from cpl_image_delete_imaginary() 2005-01-09 07:28 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h, cpl_image_gen.c, cpl_image_gen_body.h, cpl_image_io.c, cpl_imagelist_basic.c, cpl_imagelist_io.c, cpl_stats.c: Fixed doxygen warnings 2005-01-09 06:26 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h, tests/cpl_image_basic-test.c: CPL_TYPE_COMPLEX supported by cpl_image_copy() 2005-01-08 17:55 llundin * cplcore/cpl_image_basic.c: Documentation of FFT modes 2005-01-08 17:00 llundin * cplcore/cpl_image_basic.c, cplcore/cpl_image_basic.h, cplcore/tests/cpl_image_basic-test.c, cpldrs/cpl_geom/cpl_geom_img.c: CPL_FFT_UNNORMALIZED and CPL_FFT_TO_REAL. cpl_image_divide() && cpl_image_abs() test 2005-01-08 15:12 llundin * cplcore/cpl_image_basic.c, cplcore/cpl_image_basic.h, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_defs.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io_body.h, cplcore/tests/cpl_image_basic-test.c, cpldrs/cpl_geom/cpl_geom_img.c, cpldrs/tests/cpl_geom_img-test.c: cpl_image_fft() 2005-01-08 15:11 llundin * cplcore/cpl_type.h: CPL_TYPE_COMPLEX 2005-01-05 20:04 llundin * cplcore/cpl_vector.c, cplcore/cpl_vector.h, cplcore/tests/cpl_vector-test.c, cpldrs/tests/cpl_photom-test.c: Changed API of cpl_vector_correlate(). cpl_vector_set_size() 2005-01-05 19:02 llundin * cplcore/tests/cpl_polynomial-test.c: Removed unused static function 2005-01-04 17:01 cizzo * cplcore/cpl_msg.c: Eliminate asserts; add option to avoid output lines of text to be splitted; output lines of text are never splitted in logfiles 2005-01-04 14:46 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: cpl_polynomial_shift() => cpl_polynomial_shift_1d 2005-01-04 14:02 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: API change of cpl_polynomial_solve_1d 2005-01-03 17:26 llundin * cplcore/cpl_column.c, cplcore/cpl_column.h, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_filter_body.h, cplcore/cpl_imagelist_basic_body.h, cplcore/cpl_stats.c, cplcore/cpl_table.c, cplcore/cpl_tools.c, cplcore/cpl_tools.h, cplcore/cpl_vector.c, cpldrs/cpl_apert/cpl_apertures.c: cpl_tools_{kth,median}_*() => cpl_tools_get_{kth,median}_*(). cpl_column_mean() => cpl_column_get_mean() etc. 2005-01-03 17:11 llundin * cplcore/cpl_mask.c: #include "cpl_image_bpm.h" 2005-01-03 17:11 llundin * cplcore/tests/cpl_imagelist_basic-test.c: Commented out cpl_imagelist_compare() 2005-01-03 17:08 llundin * cplcore/cpl_mask.h: Removed #include "cpl_image_bpm.h" 2005-01-03 17:05 llundin * cplcore/cpl_mask.h: #include "cpl_image_bpm.h" 2005-01-03 16:03 cizzo * cplcore/: cpl_column.c, cpl_matrix.c, cpl_table.c: Make some returned check values -1 in case of error 2005-01-03 11:45 llundin * cplcore/: cpl_stats.c, cpl_tools.c, cpl_tools.h: Removed _remove from cpl_tools_kth_{double,float,int}_remove() and cpl_tools_median_{double,float}_remove() 2005-01-03 11:45 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_matrix.c, cpl_matrix.h, cpl_table.c, cpl_table.h, tests/Makefile.am, tests/cpl_matrix-test.c, tests/cpl_table-test.c: Function renaming, API changes, eliminate asserts 2005-01-03 10:27 llundin * cplcore/cpl_type.h: Added CPL FITS IO modes 2004-12-30 17:19 llundin * cplcore/: cpl_image_resample.c, cpl_image_resample.h, cpl_image_resample_body.h, tests/cpl_image_resample-test.c: cpl_image_warp_polynomial(). Use direct buffer access in cpl_image_get_interpolated() 2004-12-30 17:17 llundin * cplcore/cpl_image_io.c: Unused variable 2004-12-30 13:33 llundin * cplcore/cpl_image_resample.c: Fixed cpl_image index + 1 bug 2004-12-30 12:29 llundin * cplcore/: cpl_image_basic.c, cpl_image_bpm.c, cpl_image_io.c, cpl_image_io.h, cpl_image_resample.c, tests/cpl_image_basic-test.c, tests/cpl_stats-test.c: Added int * is_rejected to cpl_image_get() 2004-12-30 12:27 llundin * cplcore/cpl_type.h: cpl_boolean 2004-12-29 19:35 llundin * cplcore/: cpl_image_resample.c, cpl_image_resample.h, cpl_tools.c, cpl_tools.h, cpl_vector.c, cpl_vector.h: cpl_image_get_interpolated(). cpl_vector_fill_kernel_profile() 2004-12-29 19:34 llundin * cplcore/cpl_image_io.c: man typo 2004-12-29 17:51 llundin * cplcore/: cpl_tools.c, cpl_tools.h: cpl_clock, cpl_kernel enum. Prepend CPL_ to #define 2004-12-29 16:16 llundin * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic.h: enum cpl_norm in cpl_imagelist_normalise(). Propagate error code 2004-12-29 15:39 llundin * cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, cpldrs/tests/cpl_apertures-test.c: Removed bpm-pointer from cpl_image_wrap_*() 2004-12-29 15:10 llundin * cplcore/cpl_image_basic_body.h, cplcore/cpl_image_filter_body.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io_body.h, cplcore/cpl_image_resample_body.h, cplcore/cpl_imagelist_basic_body.h, cplcore/cpl_imagelist_complex_body.h, cpldrs/cpl_geom/cpl_geom_img_body.h: cpl_image_wrap_*() requires non-NULL pixel pointer 2004-12-29 14:11 llundin * cplcore/cpl_image_gen.c, cplcore/cpl_image_io.c, cplcore/cpl_mask.c, cplcore/cpl_sparseimage.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_gen-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_sparseimage-test.c, cpldrs/cpl_det/cpl_detector.c, cpldrs/cpl_geom/cpl_geom_img.c, cpldrs/tests/cpl_detector-test.c: cpl_image_wrap_*(,NULL,NULL) => cpl_image_new() 2004-12-29 13:22 llundin * cplcore/cpl_image_io_body.h: cpl_image_new() bis 2004-12-29 13:12 llundin * cplcore/cpl_image_io.c: Minor comments 2004-12-29 13:06 llundin * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h: cpl_image_new() 2004-12-29 12:45 llundin * cpldrs/cpl_geom/cpl_geom_img.c: Removed cpl_image_get_mean(), cpl_image_subtract_scalar() and cpl_image_move() from cpl_geom_img_offset_coarse() 2004-12-28 17:27 llundin * cplcore/: cpl_image_basic.c, cpl_stats.c, cpl_stats.h, tests/cpl_sparseimage-test.c, tests/cpl_stats-test.c: CPL_STAT_* => CPL_STATS_*. Add stream parameter to cpl_stats_dump(). cpl_image_get_sqflux() 2004-12-28 14:42 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic.h: cpl_image_normalise() 2004-12-28 13:06 llundin * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h, cpl_stats.c, cpl_stats.h, tests/cpl_image_basic-test.c: cpl_image_get() and cpl_image_set() 2004-12-28 10:15 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h, cpl_imagelist_basic.c, cpl_imagelist_basic.h, tests/cpl_image_basic-test.c: Replacement of cpl_*_op_scalar*() 2004-12-23 16:53 llundin * cplcore/: cpl_imagelist_basic.c, cpl_imagelist_basic.h, cpl_imagelist_basic_body.h, tests/cpl_imagelist_basic-test.c: Replacements for cpl_imagelist_op_scalar(). iset => imlist 2004-12-23 16:51 llundin * cplcore/: cpl_imagelist_io.c, cpl_imagelist_io_body.h: iset => imlist. Individual checks in cpl_imagelist_check() 2004-12-23 16:49 llundin * cplcore/cpl_image_basic.c: argument renaming. cpl_image_op_scalar() => cpl_image_divide_scalar() 2004-12-22 19:30 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image_logarithm() 2004-12-22 19:26 llundin * cplcore/tests/cpl_image_basic-test.c: cpl_image__scalar(), cpl_image_exponential(), cpl_vector_pow() checks 2004-12-22 18:58 llundin * cplcore/tests/cpl_vector-test.c: more cpl_vector_pow() checks 2004-12-22 18:25 llundin * cplcore/cpl_image_basic_body.h: Fixed CPL_OPERATION bug. Really 2004-12-22 18:22 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: Fixed CPL_OPERATION bug 2004-12-22 16:53 llundin * cplcore/cpl_image_basic.c: Domain check in CPL_IMAGE_LOGASSIGN(). FIXME 2004-12-22 11:23 llundin * cplcore/tests/cpl_vector-test.c: cpl_vector_delete(error). more cpl_vector_power() 2004-12-22 10:58 llundin * cplcore/tests/cpl_vector-test.c: cpl_vector_power() 2004-12-22 10:15 llundin * cplcore/cpl_bivector.c, cplcore/cpl_polynomial.c, cplcore/cpl_sparseimage.c, cpldrs/cpl_phot/cpl_photom.c: Recoded som assert()s to be side-effect-free 2004-12-21 18:47 llundin * cplcore/cpl_image_gen.c, cplcore/cpl_imagelist_basic.c, cplcore/tests/cpl_image_basic-test.c, cpldrs/cpl_geom/cpl_geom_img.c: cpl_image_op_scalar() => cpl_image__scalar() 2004-12-21 18:09 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h: Added cpl_image_{add,subtract,multiply,divide}_scalar(), cpl_image_{power,exponential,logarithm}() 2004-12-21 14:04 cizzo * cplcore/tests/cpl_matrix-test.c: Adapt to the few API changes planned for cpl version 2.0 2004-12-21 14:04 cizzo * cplcore/: cpl_matrix.c, cpl_matrix.h: Eliminate all assertions, and add few API changes planned for cpl version 2.0 2004-12-21 13:35 llundin * cplcore/tests/cpl_vector-test.c: A few more tests 2004-12-21 13:07 llundin * cplcore/: cpl_vector.c, cpl_vector.h, tests/cpl_bivector-test.c, tests/cpl_vector-test.c: Removed cpl_vector_op_scalar(). Added some tests of cpl_vector_add_scalar() etc. 2004-12-20 18:00 llundin * cplcore/: cpl_vector.c, cpl_vector.h: cpl_vector_{add,subtract,multiply,divide}_scalar(), cpl_vector_{logarithm,exponential,power}() 2004-12-20 15:04 llundin * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_imagelist_io.c, cpl_imagelist_io.h, cpl_type.h: cpl_type_bpp 2004-12-20 11:27 llundin * cplcore/cpl_image_gen.c, cplcore/cpl_image_gen.h, cplcore/cpl_polynomial.c, cplcore/cpl_polynomial.h, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_bpm-test.c, cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_gen-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_imagelist_basic-test.c, cplcore/tests/cpl_imagelist_complex-test.c, cplcore/tests/cpl_imagelist_io-test.c, cplcore/tests/cpl_mask-test.c, cplcore/tests/cpl_stats-test.c, cpldrs/tests/cpl_apertures-test.c, cpldrs/tests/cpl_apertures_img-test.c, cpldrs/tests/cpl_geom_img-test.c: cpl_image_fill_test_create(), cpl_polynomial_fit_1d_create() and cpl_polynomial_fit_2d_create() 2004-12-16 16:53 cizzo * cpldrs/: cpl_apert/cpl_apertures.c, cpl_geom/cpl_geom_img.c: Avoid cpl_matrix_new_constant(), now deprecated 2004-12-16 15:33 yjung * cpldfs/: Makefile.am, cpl_prokeys.h: added CPLDFS libraru 2004-12-16 13:45 yjung * Makefile.am, README.CVS, acinclude.m4, configure.ac, cpldfs/Makefile.am, cpldfs/cpl_prokeys.c, m4macros/cpl.m4: added cpldfs library 2004-12-16 13:31 yjung * cpldfs/tests/cpl_prokeys-test.c: new test file 2004-12-16 13:29 yjung * cpldfs/tests/Makefile.am: new file 2004-12-16 13:11 yjung * cpl.h: added cpl_prokeys 2004-12-16 13:10 yjung * cpldfs/: cpl_prokeys.c, cpl_prokeys.h: new file 2004-12-16 12:54 yjung * cpldfs/Makefile.am: new 2004-12-16 11:15 yjung * cplcore/Makefile.am: cpl_tools still distyributed for the moment 2004-12-16 11:00 yjung * cplcore/Makefile.am: do not install cpl_tools any more 2004-12-16 10:58 yjung * Makefile.am: added cpl.h in the distribution 2004-12-16 10:56 yjung * cpl.h: added the cpl.h file 2004-12-15 20:50 llundin * cplcore/cpl_image_stats.c, cplcore/cpl_image_stats.h, cplcore/cpl_imset.h, cplcore/cpl_plist.c, cplcore/cpl_plist.h, cplcore/tests/cpl_image_stats-test.c, cplcore/tests/cpl_plist-test.c, cplui/cpl_parlist.c, cplui/cpl_parlist.h: Renaming according to naming convention 2004-12-15 20:35 llundin * cplcore/Makefile.am, cplcore/cpl_bivector.c, cplcore/cpl_bivector.h, cplcore/cpl_column.c, cplcore/cpl_column.h, cplcore/cpl_error.c, cplcore/cpl_error.h, cplcore/cpl_image.h, cplcore/cpl_image_basic.c, cplcore/cpl_image_basic.h, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_bpm.c, cplcore/cpl_image_bpm.h, cplcore/cpl_image_defs.h, cplcore/cpl_image_filter.c, cplcore/cpl_image_filter_body.h, cplcore/cpl_image_gen.c, cplcore/cpl_image_gen.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, cplcore/cpl_image_resample.c, cplcore/cpl_image_resample.h, cplcore/cpl_image_resample_body.h, cplcore/cpl_imagelist.h, cplcore/cpl_mask.c, cplcore/cpl_matrix.c, cplcore/cpl_matrix.h, cplcore/cpl_memory.c, cplcore/cpl_memory.h, cplcore/cpl_polynomial.c, cplcore/cpl_polynomial.h, cplcore/cpl_property.c, cplcore/cpl_property.h, cplcore/cpl_propertylist.c, cplcore/cpl_propertylist.h, cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h, cplcore/cpl_stats.c, cplcore/cpl_stats.h, cplcore/cpl_table.c, cplcore/cpl_table.h, cplcore/cpl_tools.c, cplcore/cpl_tools.h, cplcore/cpl_vector.c, cplcore/cpl_vector.h, cplcore/tests/Makefile.am, cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_bpm-test.c, cplcore/tests/cpl_image_filter-test.c, cplcore/tests/cpl_image_gen-test.c, cplcore/tests/cpl_image_io-test.c, cplcore/tests/cpl_image_resample-test.c, cplcore/tests/cpl_mask-test.c, cplcore/tests/cpl_matrix-test.c, cplcore/tests/cpl_polynomial-test.c, cplcore/tests/cpl_property-test.c, cplcore/tests/cpl_propertylist-test.c, cplcore/tests/cpl_sparseimage-test.c, cplcore/tests/cpl_stats-test.c, cplcore/tests/cpl_table-test.c, cplcore/tests/cpl_table-testfail2.c, cplcore/tests/cpl_vector-test.c, cpldrs/Makefile.am, cpldrs/tests/Makefile.am, cplui/Makefile.am, cplui/cpl_frameset.c, cplui/cpl_frameset.h, cplui/cpl_parameter.c, cplui/cpl_parameter.h, cplui/cpl_parameterlist.c, cplui/cpl_parameterlist.h, cplui/cpl_plugin.c, cplui/cpl_plugin.h, cplui/cpl_pluginlist.c, cplui/cpl_pluginlist.h, cplui/cpl_recipe.h, cplui/tests/cpl_frameset-test.c, cplui/tests/cpl_plugin-test.c, cplui/tests/cpl_pluginlist-test.c: Renaming according to naming convention 2004-12-15 20:35 llundin * cpldrs/cpl_geom/: cpl_geom_ima_body.h, cpl_geom_img_body.h: Renaming (renamed cpldrs/cpl_geom/cpl_geom_ima_body.h to cpldrs/cpl_geom/cpl_geom_img_body.h) 2004-12-15 20:35 llundin * cpldrs/cpl_geom/: cpl_geom_ima.h, cpl_geom_img.h: Renaming (renamed cpldrs/cpl_geom/cpl_geom_ima.h to cpldrs/cpl_geom/cpl_geom_img.h) 2004-12-15 20:35 llundin * cpldrs/cpl_geom/: cpl_geom_ima.c, cpl_geom_img.c: Renaming (renamed cpldrs/cpl_geom/cpl_geom_ima.c to cpldrs/cpl_geom/cpl_geom_img.c) 2004-12-15 20:35 llundin * cpldrs/cpl_det/: cpl_det_body.h, cpl_detector_body.h: Renaming (renamed cpldrs/cpl_det/cpl_det_body.h to cpldrs/cpl_det/cpl_detector_body.h) 2004-12-15 20:35 llundin * cpldrs/cpl_det/: cpl_det.h, cpl_detector.h: Renaming (renamed cpldrs/cpl_det/cpl_det.h to cpldrs/cpl_det/cpl_detector.h) 2004-12-15 20:35 llundin * cpldrs/cpl_det/: cpl_det.c, cpl_detector.c: Renaming (renamed cpldrs/cpl_det/cpl_det.c to cpldrs/cpl_det/cpl_detector.c) 2004-12-15 20:35 llundin * cpldrs/cpl_phot/: cpl_phot.h, cpl_photom.h: Renaming (renamed cpldrs/cpl_phot/cpl_phot.h to cpldrs/cpl_phot/cpl_photom.h) 2004-12-15 20:35 llundin * cpldrs/cpl_phot/: cpl_phot.c, cpl_photom.c: Renaming (renamed cpldrs/cpl_phot/cpl_phot.c to cpldrs/cpl_phot/cpl_photom.c) 2004-12-15 20:35 llundin * cpldrs/cpl_apert/: cpl_apert_ima.h, cpl_apertures_img.h: Renaming (renamed cpldrs/cpl_apert/cpl_apert_ima.h to cpldrs/cpl_apert/cpl_apertures_img.h) 2004-12-15 20:35 llundin * cpldrs/cpl_apert/: cpl_apert.h, cpl_apertures.h: Renaming (renamed cpldrs/cpl_apert/cpl_apert.h to cpldrs/cpl_apert/cpl_apertures.h) 2004-12-15 20:35 llundin * cpldrs/cpl_apert/: cpl_apert_ima.c, cpl_apertures_img.c: Renaming (renamed cpldrs/cpl_apert/cpl_apert_ima.c to cpldrs/cpl_apert/cpl_apertures_img.c) 2004-12-15 20:35 llundin * cpldrs/cpl_apert/: cpl_apert.c, cpl_apertures.c: Renaming (renamed cpldrs/cpl_apert/cpl_apert.c to cpldrs/cpl_apert/cpl_apertures.c) 2004-12-15 20:35 llundin * cpldrs/tests/: cpl_phot-test.c, cpl_photom-test.c: Renaming (renamed cpldrs/tests/cpl_phot-test.c to cpldrs/tests/cpl_photom-test.c) 2004-12-15 20:35 llundin * cpldrs/tests/: cpl_det-test.c, cpl_detector-test.c: Renaming (renamed cpldrs/tests/cpl_det-test.c to cpldrs/tests/cpl_detector-test.c) 2004-12-15 20:35 llundin * cpldrs/tests/: cpl_geom_ima-test.c, cpl_geom_img-test.c: Renaming (renamed cpldrs/tests/cpl_geom_ima-test.c to cpldrs/tests/cpl_geom_img-test.c) 2004-12-15 20:35 llundin * cpldrs/tests/: cpl_apert_ima-test.c, cpl_apertures_img-test.c: Renaming (renamed cpldrs/tests/cpl_apert_ima-test.c to cpldrs/tests/cpl_apertures_img-test.c) 2004-12-15 20:35 llundin * cpldrs/tests/: cpl_apert-test.c, cpl_apertures-test.c: Renaming (renamed cpldrs/tests/cpl_apert-test.c to cpldrs/tests/cpl_apertures-test.c) 2004-12-15 20:34 llundin * cplcore/tests/: cpl_imagelist_io-test.c, cpl_imset_io-test.c: Renaming (renamed cplcore/tests/cpl_imset_io-test.c to cplcore/tests/cpl_imagelist_io-test.c) 2004-12-15 20:34 llundin * cplcore/tests/: cpl_imagelist_basic-test.c, cpl_imset_basic-test.c: Renaming (renamed cplcore/tests/cpl_imset_basic-test.c to cplcore/tests/cpl_imagelist_basic-test.c) 2004-12-15 20:34 llundin * cplcore/tests/: cpl_imagelist_complex-test.c, cpl_imset_complex-test.c: Renaming (renamed cplcore/tests/cpl_imset_complex-test.c to cplcore/tests/cpl_imagelist_complex-test.c) 2004-12-15 20:34 llundin * cplcore/: cpl_imagelist_io_body.h, cpl_imset_io_body.h: Renaming (renamed cplcore/cpl_imset_io_body.h to cplcore/cpl_imagelist_io_body.h) 2004-12-15 20:34 llundin * cplcore/: cpl_imagelist_basic_body.h, cpl_imset_basic_body.h: Renaming (renamed cplcore/cpl_imset_basic_body.h to cplcore/cpl_imagelist_basic_body.h) 2004-12-15 20:34 llundin * cplcore/: cpl_imagelist_complex_body.h, cpl_imset_complex_body.h: Renaming (renamed cplcore/cpl_imset_complex_body.h to cplcore/cpl_imagelist_complex_body.h) 2004-12-15 20:34 llundin * cplcore/: cpl_image_stats_body.h, cpl_stats_body.h: Renaming (renamed cplcore/cpl_image_stats_body.h to cplcore/cpl_stats_body.h) 2004-12-15 20:34 llundin * cplcore/: cpl_imagelist_io.h, cpl_imset_io.h: Renaming (renamed cplcore/cpl_imset_io.h to cplcore/cpl_imagelist_io.h) 2004-12-15 20:34 llundin * cplcore/: cpl_imagelist_basic.h, cpl_imset_basic.h: Renaming (renamed cplcore/cpl_imset_basic.h to cplcore/cpl_imagelist_basic.h) 2004-12-15 20:34 llundin * cplcore/: cpl_messaging.h, cpl_msg.h: Renaming (renamed cplcore/cpl_messaging.h to cplcore/cpl_msg.h) 2004-12-15 20:34 llundin * cplcore/: cpl_imagelist_complex.h, cpl_imset_complex.h: Renaming (renamed cplcore/cpl_imset_complex.h to cplcore/cpl_imagelist_complex.h) 2004-12-15 20:34 llundin * cplcore/: cpl_imagelist_defs.h, cpl_imset_defs.h: Renaming (renamed cplcore/cpl_imset_defs.h to cplcore/cpl_imagelist_defs.h) 2004-12-15 20:34 llundin * cplcore/: cpl_type.h, cpl_types.h: Renaming (renamed cplcore/cpl_types.h to cplcore/cpl_type.h) 2004-12-15 20:34 llundin * cplcore/: cpl_imagelist_io.c, cpl_imset_io.c: Renaming (renamed cplcore/cpl_imset_io.c to cplcore/cpl_imagelist_io.c) 2004-12-15 20:34 llundin * cplcore/: cpl_imagelist_basic.c, cpl_imset_basic.c: Renaming (renamed cplcore/cpl_imset_basic.c to cplcore/cpl_imagelist_basic.c) 2004-12-15 20:34 llundin * cplcore/: cpl_messaging.c, cpl_msg.c: Renaming (renamed cplcore/cpl_messaging.c to cplcore/cpl_msg.c) 2004-12-15 20:34 llundin * cplcore/: cpl_imagelist_complex.c, cpl_imset_complex.c: Renaming (renamed cplcore/cpl_imset_complex.c to cplcore/cpl_imagelist_complex.c) 2004-12-15 20:34 llundin * cplcore/: cpl_type.c, cpl_types.c: Renaming (renamed cplcore/cpl_types.c to cplcore/cpl_type.c) 2004-12-15 17:25 llundin * cplcore/cpl_types.h: Define BPP_* within CPL (for renaming) 2004-12-15 15:15 rpalsa * configure.ac: Package version updated. 2004-12-08 13:24 cizzo * doxygen/: cpl_reference.tex, cplref_applications.tex, cplref_installation.tex, cplref_introduction.tex, layout.tex: Apply corrections suggested by Derek 2004-12-07 15:55 yjung * cplcore/cpl_mask.h: doc 2004-12-07 15:07 yjung * cpldrs/tests/: cpl_apert-test.c, cpl_apert_ima-test.c: replaced binary images by cpl_mask 2004-12-07 14:04 yjung * cplcore/cpl_mask.c: cpl_mask_new creates an initialized mask 2004-12-07 12:10 yjung * cplcore/tests/cpl_image_io-test.c: ... 2004-12-07 12:04 yjung * cplcore/tests/cpl_mask-test.c: corrected from image bnary 2004-12-07 11:54 yjung * cplcore/tests/: cpl_image_bpm-test.c, cpl_image_filter-test.c, cpl_image_io-test.c: replace image binary by mask 2004-12-07 11:43 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h: removed cpl_image_copy_from_fits() 2004-12-07 11:42 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h: removed cpl_image_new_empty() 2004-12-07 11:30 yjung * cplcore/tests/: cpl_image_binary-test.c, cpl_mask-test.c: replaced image-binary by mask 2004-12-07 11:29 yjung * cplcore/tests/Makefile.am: removed image-binary / added cpl_mask 2004-12-07 11:26 yjung * cpldrs/cpl_det/: cpl_det.c, cpl_det_body.h: use cpl_mask inst of cpl_image_binary 2004-12-07 11:26 yjung * cpldrs/cpl_geom/cpl_geom_ima.c: removed include cpl_image_binary.h 2004-12-07 11:14 yjung * cpldrs/cpl_apert/cpl_apert.c: replaced binary images by cpl_mask 2004-12-07 11:04 yjung * cplcore/: cpl_image_bpm.h, cpl_imset_basic.c, cpl_imset_basic_body.h, cpl_mask.c, cpl_sparseimage.c, cpl_sparseimage.h: compiles now properly after having replaced the binary image by cpl_mask 2004-12-07 10:39 yjung * cplcore/cpl_mask.h: added an include 2004-12-07 10:10 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h: added cpl_image_new_from_mask() 2004-12-06 19:18 yjung * cplcore/cpl_image_stats.c: removed direct access to cpl_mask 2004-12-06 19:14 yjung * cplcore/cpl_image_io_body.h: wrong function name 2004-12-06 19:09 yjung * cplcore/cpl_image_filter.c: removed direct access to cpl_mask struct 2004-12-06 19:00 yjung * cplcore/cpl_image_filter.c: undo 2004-12-06 18:59 yjung * cplcore/: cpl_image_filter.c, cpl_sparseimage.c, cpl_sparseimage.h: cpl_sparseimage_extract_mask(const cpl_mask * map) made public again 2004-12-06 18:53 yjung * cplcore/: cpl_image_bpm.c, cpl_image_bpm.h: use accessor funct for cpl_mask 2004-12-06 18:45 yjung * cplcore/: cpl_mask.c, cpl_mask.h: added cpl_mask_new_from_rejected_window() and cpl_mask_new_from_rejected() 2004-12-06 18:35 yjung * cplcore/: cpl_image_bpm.c, cpl_image_bpm.h: moved cpl_image_bpm_from_image and cpl_image_bpm_from_image_subw to cpl_mask 2004-12-06 18:23 yjung * cplcore/cpl_image_filter.c: removed cpl_binary images use cpl_mask 2004-12-06 18:13 yjung * cplcore/: cpl_mask.c, cpl_mask.h: added accessor functions 2004-12-06 17:28 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: removed support for binary images 2004-12-06 17:12 yjung * cplcore/: cpl_image_stats.c, cpl_image_stats_body.h: cpl_bin images support removed 2004-12-06 16:54 yjung * cplcore/: cpl_image_resample.c, cpl_image_resample_body.h: removed support for binary images 2004-12-06 16:52 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h: binary images replaced by cpl_mask 2004-12-06 16:34 yjung * cplcore/cpl_mask.h: added cpl_binary definition 2004-12-06 16:31 yjung * cplcore/: cpl_image_basic_body.h, cpl_image_defs.h: removed support for binary images 2004-12-06 16:31 yjung * cplcore/cpl_image_basic.c: removed binary image 2004-12-06 16:30 yjung * cplcore/cpl_image.h: removed cpl_image_binary (-> cpl_mask) 2004-12-06 16:29 yjung * cplcore/: cpl_mask.c, cpl_mask.h: updated 2004-12-06 11:51 yjung * cplcore/Makefile.am: cpl_image_binary - > cpl_mask 2004-12-06 11:50 yjung * cplcore/: cpl_mask.c, cpl_mask.h: from cpl_image_binary 2004-12-06 11:50 yjung * cplcore/: cpl_image_binary.c, cpl_image_binary.h: moved to cpl_mask 2004-11-30 14:58 rpalsa * cplui/cpl_parameter.c: Change copyright. 2004-11-30 14:57 rpalsa * libcext/configure.ac: Change required version of aoutoconf to 2.59 2004-11-30 14:56 rpalsa * m4macros/cpl.m4: When checking for qfits_get_datetime_iso8601() use AC_LINK_IFELSE instead of AC_RUN_IFELSE. 2004-11-30 14:53 cizzo * cplcore/cpl_table.c: In cpl_table_erase_unselected(): workaround for premature destruction of selection buffer 2004-11-30 11:08 cizzo * cplcore/cpl_table.c: cpl_table_save(): Make sure that the XTENSION property is removed before writing the primary header. 2004-11-30 11:03 rpalsa * cplcore/cpl_table.c: cpl_table_save(): Make sure that the XTENSION property is removed before writing the primary header. 2004-11-25 13:09 llundin * cplcore/: cpl_error.c, cpl_error.h: Added CPL_ERROR_UNSPECIFIED and CPL_ERROR_EOL 2004-11-18 11:37 yjung * cplcore/cpl_image_io.c: remove NAXIS1 and NAXIS2 if empty image is passed (cpl_image_save) 2004-11-18 11:12 yjung * cplcore/cpl_image_io.c: add simple in header if not passed... 2004-11-18 10:59 rpalsa * cplexec/cpl_exec_params_process.c, tests/cpl_plugin-test.c: C++ style comment replaced. 2004-11-18 10:48 yjung * cplcore/cpl_image_io.c: update NAXIS to 0 if the passed image is NULL (cpl_image_save) 2004-11-18 10:21 yjung * cplcore/cpl_image_io.c: corrected bug when you try to save an empty image 2004-11-09 13:07 rpalsa * bootstrap, libcext/bootstrap: Make the script tolerant in case the libltdl directory exists, but is empty 2004-11-05 16:30 yjung * cplcore/cpl_image_basic.c: doxygen command corrected 2004-11-03 11:17 rpalsa * configure.ac: Package version changed 2004-10-26 16:50 llundin * cplcore/tests/cpl_matrix-test.c: Fixed memory leak. Use return cpl_error_get_code() 2004-10-26 15:14 llundin * cplcore/tests/cpl_table-test.c: Fixed memory leak. Use cpl_error_reset() + assert() + return cpl_error_get_code() 2004-10-26 14:35 llundin * cplcore/tests/cpl_vector-test.c: Fixed memory leak: cpl_vector_delete(tmp_vec) 2004-10-26 13:59 llundin * cplcore/tests/cpl_imset_complex-test.c: Fixed memory leak. Use cpl_error_get_code() and assert(). 2004-10-26 13:57 llundin * cplcore/cpl_imset_io.c: CPL_ASSURE_ERR_CODE() in cpl_imset_set_image() 2004-10-26 13:16 llundin * cplcore/cpl_image_filter.c: Removed memory leak using cpl_sparseimage_delete() 2004-10-26 11:50 llundin * cplcore/tests/cpl_image_bpm-test.c: moved remove() 2004-10-26 11:19 llundin * cplcore/tests/cpl_image_stats-test.c: Use assert(). Stricter numerical check 2004-10-26 11:18 llundin * cplcore/cpl_image_stats.c: Fixed memory leak in cpl_image_percentile() 2004-10-26 10:39 llundin * cplcore/cpl_image_bpm.c: Removed memory leak in cpl_image_bpm_set_from_ascii() 2004-10-26 10:38 llundin * cplcore/tests/cpl_image_bpm-test.c: Use assert() 2004-10-26 10:03 llundin * cplcore/cpl_imset_io.c: Fixed too big malloc() in cpl_imset_new(). Fixed return value on error in cpl_imset_get_type() 2004-10-21 08:31 llundin * cplcore/cpl_image_io.c: Avoid use of internals in cpl_image_copy_from_fits() 2004-10-18 14:55 llundin * cplcore/cpl_matrix.c: Corrected argument check in cpl_matrix_power(), cpl_matrix_logarithm() 2004-10-13 13:45 cizzo * cplcore/cpl_matrix.c: Correct computation of the standard deviation in cpl_matrix_stdev 2004-10-13 13:41 cizzo * cplcore/cpl_table.c: In cpl_table_save(), avoid a field_size = 0 when in a character column all strings are invalid 2004-10-13 13:18 cizzo * cplcore/cpl_table.c: In cpl_table_save(), avoid a field_size = 0 when in a character column all strings are invalid 2004-10-12 15:01 cizzo * cplcore/cpl_matrix.c: Correct computation of the standard deviation 2004-10-07 15:39 cizzo * cplcore/tests/cpl_table-test.c: Eliminate debug printf()s 2004-10-07 14:56 cizzo * cplcore/tests/cpl_matrix-test.c: Trying to fix a number of memory leaks 2004-10-06 09:25 cizzo * cplcore/cpl_column.c: Fix access violation in cpl_column_median_TYPE() functions 2004-09-30 17:33 llundin * cplcore/cpl_image_filter.c: ker_norm = 0 2004-09-30 16:56 llundin * cplcore/tests/cpl_vector-test.c: Added ifdef`ed code for FFT-test 2004-09-30 16:56 llundin * cplcore/tests/cpl_image_basic-test.c: renamed to test.fits 2004-09-30 16:36 llundin * cplcore/tests/cpl_bivector-test.c, cplcore/tests/cpl_imset_basic-test.c, cplcore/tests/cpl_polynomial-test.c, cpldrs/tests/cpl_apert-test.c, cpldrs/tests/cpl_apert_ima-test.c, cpldrs/tests/cpl_geom_ima-test.c, cpldrs/tests/cpl_phot-test.c: Added cpl_msg_stop() 2004-09-30 12:57 llundin * cplcore/: cpl_image_basic.c, cpl_sparseimage.c, tests/cpl_sparseimage-test.c: Fixed memory leaks in cpl_sparseimage_new(), cpl_sparseimage_shift_int(), cpl_image_shift_int_local() 2004-09-29 08:42 llundin * cplcore/cpl_image_stats.c: Allow functions to complete when called with cpl_error_get_code() 2004-09-28 08:48 cizzo * cplcore/tests/cpl_table-test.c: Translate into English 2004-09-22 17:14 yjung * cplcore/cpl_image_basic.c: forgot to deallocate an image 2004-09-22 15:43 yjung * cpldrs/tests/cpl_apert-test.c: corrected access to the cpl_apert structure 2004-09-22 14:50 yjung * cpldrs/cpl_det/cpl_det.c: removed doxy entry 2004-09-13 11:50 dmckay * cplui/cpl_frameset.c: Allow comment lines (which start with a hash (#)) within Set Of Frames (SOF) files. This affects the cpl_frameset_load() function. 2004-09-13 08:49 llundin * cplcore/cpl_vector.c: CPL_ASSURE_ERR_CODE() in cpl_vector_fill() 2004-09-10 19:36 llundin * cplcore/: cpl_image_stats.c, cpl_image_stats_body.h: Added support for binary images. Fixed a few memory leaks (on error). Some checks on centroid output. Avoid overwrite of cpl_error_code 2004-09-05 06:20 llundin * cplcore/tests/cpl_polynomial-test.c: replaced printf() with cpl_msg_info() 2004-09-04 04:37 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: Improved handling of bad pixels in cpl_image_collapse() 2004-09-04 02:53 llundin * cplcore/cpl_image_stats.c, cpldrs/cpl_apert/cpl_apert.c: Detect stdev error with one sample 2004-09-02 13:40 rpalsa * cplcore/: cpl_property.c: In cpl_property_set_string(): add check for argument value. 2004-09-01 13:45 rpalsa * cplui/cpl_frameset.c: Cross reference corrected in cpl_frameset_next() documentation. 2004-09-01 13:37 rpalsa * cplui/cpl_frameset.c: Cross reference corrected in cpl_frameset_next() documentation. 2004-09-01 02:17 yjung * cplcore/cpl_imset_io.c: added check on the size of an image added to an image set 2004-08-27 21:44 yjung * cplcore/cpl_image_basic_body.h: corrected rotation bug reported by Nuria 2004-08-24 14:35 cizzo * cplcore/cpl_error.h: eliminate comma at enum end 2004-08-18 14:50 yjung * cplcore/cpl_image_io.c: added doc for cpl_image_load() 2004-08-03 15:59 llundin * cplcore/tests/cpl_polynomial-test.c: Allowed minor rounding (SunOS) 2004-07-29 10:22 cplmgr * configure.ac: Package version changed. 2004-07-27 15:08 yjung * cpldrs/cpl_apert/: cpl_apert.c, cpl_apert.h: added 8 fields in cpl_apert : left_x, left_y, right_x right_y top_x top_y bottom_x bottom_y 2004-07-16 11:37 yjung * cplcore/: cpl_image_basic.c, cpl_image_stats.c, cpl_image_stats.h, tests/cpl_image_stats-test.c, tests/cpl_sparseimage-test.c: de allocate cpl_image_stats with cpl_image_stats_delete() 2004-07-16 11:23 yjung * cplcore/cpl_image_stats.c: added ref to bitmask def 2004-07-14 15:23 llundin * cplcore/cpl_image_stats.c: Fixed allocation bug 2004-07-14 13:33 llundin * cplcore/: cpl_image_stats.c, cpl_image_stats_body.h, cpl_vector.c, tests/cpl_vector-test.c: stdev is bias-corrected (vector and image). Check that image_stats object is properly defined when used 2004-07-07 15:24 rpalsa * cplui/cpl_plugin.h: Change order of enum _cpl_plugin_type_ and the corresponding typedef. 2004-07-07 15:19 rpalsa * cplui/cpl_plugin.h: Move typedef cpl_plugin_type after enum definition. 2004-07-06 11:50 rpalsa * cplcore/cpl_messaging.c: Send warning messages to the standard output stream rather than the error stream. 2004-07-06 11:50 cizzo * cplcore/cpl_messaging.c: Send warnings to the print stream 2004-07-05 07:18 llundin * cplcore/: cpl_bivector.c, cpl_bivector.h, cpl_vector.c, cpl_vector.h: Corrected meaning of cpl_vector_new_from_data() + removed const ! 2004-07-05 02:46 llundin * cplcore/: cpl_image_filter.c, cpl_image_filter.h: Added const to prototypes 2004-07-04 03:24 llundin * cplcore/cpl_messaging.c: Added guard on Loop time prediction offset 2004-07-03 01:45 llundin * cplcore/: cpl_vector.c, cpl_vector.h: cpl_vector_delete_but_data() 2004-07-03 01:44 llundin * cplcore/: cpl_table.c, cpl_table.h: Added const to cpl_table_load() 2004-06-24 17:45 llundin * cplcore/: cpl_messaging.c, cpl_tools.c, cpl_tools.h: Cancelled non-intrusive use of cpl_tools_cputime() in cpl_msg_progress(). Fixed bug in cpl_tools_cputime() 2004-06-24 11:46 rpalsa * configure.ac: Package version changed 2004-06-24 11:38 llundin * cplcore/cpl_image_binary.c, cplcore/cpl_image_binary.h, cplcore/cpl_image_gen.c, cplcore/cpl_imset_basic.c, cplcore/cpl_imset_io.c, cplcore/cpl_imset_io.h, cplcore/cpl_imset_io_body.h, cplcore/cpl_matrix.c, cplcore/cpl_matrix.h, cplcore/cpl_table.c, cplcore/cpl_table.h, cplcore/cpl_tools.c, cpldrs/cpl_apert/cpl_apert.c, cpldrs/cpl_apert/cpl_apert.h, cplui/cpl_frameset.c, cplui/cpl_frameset.h: Added const to several function prototypes. Removed some dead code and unused variables. Improved cpl_tools_cputime(). Casted several filenames to (char*) due to qfits 2004-06-24 10:48 cizzo * cplcore/cpl_messaging.c: Replace error handling with asserts 2004-06-24 09:50 llundin * cplcore/: cpl_messaging.c, cpl_tools.c, cpl_tools.h: Added consistency checks and read-only mode for cpl_tools_cputime() and fixed wrap-around bug. Non-intrusive use of cpl_tools_cputime() in cpl_msg_progress(). 2004-06-23 19:16 llundin * cplcore/cpl_messaging.c: Added some consistency checks to cpl_msg_progress() 2004-06-23 18:55 llundin * cplcore/cpl_messaging.c: cpl_msg_progress() produces normal line(s) of output 2004-06-23 16:02 rpalsa * libcext/cext/: snprintf.c: Fix bug with %% conversion code 2004-06-23 14:52 rpalsa * cplui/tests/cpl_frameset-test.c: Merge in changes from cpl 1.0.1. 2004-06-23 14:51 rpalsa * cplui/cpl_frameset.h: Cleanup 2004-06-23 14:50 rpalsa * cplui/cpl_frameset.c: Merge in changes from cpl 1.0.1. In cpl_frameset_load(): If no tag is given in the input file use an empty string as tag instead of ignoring the entry in the file. 2004-06-23 14:47 rpalsa * m4macros/cpl.m4: When checking for qfits_get_datetime_iso8601() use AC_LINK_IFELSE instead of AC_RUN_IFELSE. 2004-06-23 11:05 yjung * cplcore/cpl_image_basic.c: check the image size for FWHM computation 2004-06-22 15:49 yjung * cplcore/cpl_image_basic.c: bug corrected in cpl_vector_get_noise() 2004-06-21 14:34 yjung * cpldrs/cpl_det/cpl_det.c: bug corrected 2004-06-18 17:54 llundin * cpldrs/cpl_apert/cpl_apert.c: sqrt(stdev) 2004-06-18 17:29 llundin * cplcore/: cpl_image_stats.c, cpl_image_stats_body.h: Fixed a few CPL_ASSURE bugs. Renamed some variables 2004-06-18 17:07 llundin * cplcore/cpl_image_stats.h: Removed variable names from prototypes 2004-06-16 08:57 cizzo * cplcore/cpl_messaging.c: Complete the previous delta 2004-06-16 08:28 cizzo * cplcore/cpl_messaging.c: Complete the previous delta 2004-06-15 17:26 yjung * cpldrs/tests/cpl_apert-test.c: rm unused var 2004-06-15 17:22 yjung * cplcore/tests/cpl_image_basic-test.c: typo in messages 2004-06-15 17:20 yjung * cpldrs/cpl_det/cpl_det.c: rm unused var 2004-06-15 17:11 yjung * cpldrs/tests/: cpl_apert-test.c, cpl_apert_ima-test.c, cpl_det-test.c, cpl_geom_ima-test.c, cpl_phot-test.c: removed relative path in includes 2004-06-15 17:07 yjung * cpldrs/cpl_geom/cpl_geom_ima.c: include ../../cpl_apert.h replaced by include cpl_apert.h 2004-06-15 16:33 rpalsa * acinclude.m4: Extra single quote removed from symbol definition of CPLDRS_INCLUDE 2004-06-15 15:19 rpalsa * configure.ac: Package version changed. Checks for header files stropts.h, sys/ioctl.h, termios.h, and termio.h added. Support for directory libltdl removed. 2004-06-15 15:16 rpalsa * acinclude.m4: Use correct quoting in macro definitions. Subdirectories of cpldrs added to CPLDRS_INCLUDES 2004-06-15 15:14 rpalsa * admin/: config.guess, config.sub, depcomp, install-sh, missing, mkinstalldirs: Updated to new version from automake 1.8.5 2004-06-15 15:14 rpalsa * admin/html.am: Definition of target html removed. Already provided by automake 1.8.5 2004-06-15 15:14 rpalsa * admin/ltmain.sh: Updated to new version from libtool 1.5.6 2004-06-15 15:12 rpalsa * libcext/acinclude.m4: Use correct quoting in macro definitions. 2004-06-15 15:12 rpalsa * libcext/bootstrap, bootstrap: Required version of GNU build tools updated. 2004-06-15 15:09 rpalsa * libcext/configure.ac: Required version of autoconf updated. 2004-06-15 15:04 rpalsa * libcext/admin/ltmain.sh: Updated to new version from libtool 1.5.6 2004-06-15 15:04 rpalsa * libcext/admin/html.am: Definition of target html removed. Already provided by automake 1.8.5 2004-06-15 15:02 rpalsa * libcext/admin/: config.guess, config.sub, depcomp, install-sh, missing, mkinstalldirs: Updated to new version from automake 1.8.5 2004-06-15 14:59 rpalsa * Makefile.am: Required version of automake updated. Subdirectory libltdl is no longer built. 2004-06-15 14:53 rpalsa * cpldrs/: Makefile.am, tests/Makefile.am: Required version of automake updated. List of includes updated. 2004-06-15 14:51 rpalsa * cplui/Makefile.am, cplui/tests/Makefile.am, libcext/Makefile.am, libcext/cext/Makefile.am, libcext/tests/Makefile.am, cplcore/Makefile.am, cplcore/tests/Makefile.am: Required version of automake updated. 2004-06-15 14:46 rpalsa * libcext/m4macros/eso.m4: Use correct quoting in macro definitions. Use the AC_RUN_IFELSE macro instead of AC_TRY_RUN 2004-06-15 14:42 rpalsa * m4macros/cpl.m4: Use correct quoting in macro definitions. Add check for qfits compatibility 2004-06-15 14:27 yjung * cplcore/cpl_image_basic_body.h: corrected bug 2004-06-15 14:23 cizzo * cplcore/cpl_messaging.c: Avoid line wrapping for overwritable messages 2004-06-15 11:40 rpalsa * libltdl/: .cvsignore, COPYING.LIB, Makefile.am, README, acinclude.m4, config.guess, config.sub, configure.in, install-sh, ltconfig, ltdl.c, ltdl.h, ltmain.sh, missing, mkinstalldirs: Obsolete. 2004-06-15 09:17 yjung * cplcore/cpl_image_io.c: added doc 2004-06-11 11:23 cizzo * cplcore/cpl_table.c: From branch: eliminate from primary header spurious entries EXTNAME EXTVER EXTLEVEL, and update the DATE entry for each appended HDU 2004-06-11 11:09 cizzo * cplcore/cpl_table.c: Import from branch: NAXIS keywords must be removed both from primary and secondary headers of created FITS tables 2004-06-11 10:51 rpalsa * configure.ac: Update library and package version. 2004-06-11 10:49 rpalsa * cplcore/: cpl_image_io.c, cpl_table.c: Use the appropriate function name of qfits_get_datetime_iso8601(), depending on the version of qfits we link against. 2004-06-11 10:47 rpalsa * libcext/m4macros/eso.m4: Replace macro AC_TRY_RUN with AC_RUN_IFELSE 2004-06-11 10:46 rpalsa * m4macros/cpl.m4: Add check for the presence of the qfits function qfits_get_datetime_iso8601() 2004-06-11 10:43 rpalsa * README: Update note about the required Qfits version. 2004-06-02 17:08 llundin * cplcore/cpl_sparseimage.c: Improved documentation of cpl_sparseimage_from_binary() 2004-06-02 13:34 yjung * cpldrs/cpl_geom/cpl_geom_ima.c: corrected error on the combined image size computation 2004-06-01 16:41 llundin * cplcore/: cpl_bivector.c, cpl_bivector.h: Added cpl_bivector_delete_but_data() 2004-05-28 09:51 yjung * cplcore/cpl_bivector.c: typo 2004-05-28 09:50 yjung * cplcore/: cpl_bivector.c, cpl_bivector.h: added cpl_bivector_new_from_vectors 2004-05-27 13:59 yjung * cplui/: cpl_frameset.c, cpl_frameset.h: added cpl_frameset_to_tags() 2004-05-24 14:53 cplmgr * ChangeLog: Updated. 2004-05-24 14:20 llundin * cplcore/tests/cpl_sparseimage-test.c: Removed flawed test 2004-05-24 14:01 llundin * tests/cpl_sparseimage-test.c: Removed flawed test 2004-05-19 16:11 cplmgr * libcext/tests/Makefile.am, tests/Makefile.am: Remove -all-static from LDFLAGS. Seems to cause problems on Mac OS X 2004-05-19 13:17 cplmgr * ChangeLog: Updated. 2004-05-19 13:12 cplmgr * libcext/ChangeLog: Updated. 2004-05-18 18:54 rpalsa * configure.ac: Check for additional headers. Package version changed. 2004-05-18 18:53 rpalsa * cplcore/cpl_messaging.c: Add conditional compilation depending on which header files the system provides. (To be improved). 2004-05-18 18:49 rpalsa * libltdl/: ltconfig, mkinstalldirs: Not part of this package anymore. 2004-05-18 18:48 rpalsa * libltdl/: Makefile.am, README, acinclude.m4, config.guess, config.sub, install-sh, ltdl.c, ltdl.h, ltmain.sh, missing: Updated with new version coming with libtool 1.5.6 2004-05-18 18:45 rpalsa * admin/html.am, libcext/admin/html.am: Definition of target html removed. Already provided by automake. 2004-05-18 18:43 rpalsa * admin/config.guess, admin/config.sub, admin/depcomp, admin/install-sh, admin/missing, admin/mkinstalldirs, libcext/admin/config.guess, libcext/admin/config.sub, libcext/admin/depcomp, libcext/admin/install-sh, libcext/admin/missing, libcext/admin/mkinstalldirs: Updated with new version from automake 1.8.5 2004-05-18 18:40 rpalsa * admin/ltmain.sh, libcext/admin/ltmain.sh: Updated with new version from libtool 1.5.6 2004-05-18 18:38 rpalsa * Makefile.am, cplcore/Makefile.am, cplexec/Makefile.am, cplui/Makefile.am, tests/Makefile.am, libcext/Makefile.am, libcext/cext/Makefile.am, libcext/tests/Makefile.am: Update required automake version. 2004-05-18 18:37 rpalsa * README: Update package version number. 2004-05-18 18:36 rpalsa * bootstrap, libcext/bootstrap, README.CVS: Update required build tool versions 2004-05-18 18:33 rpalsa * m4macros/cpl.m4, acinclude.m4, libcext/acinclude.m4, libcext/m4macros/eso.m4: Add proper quoting to macro definitions. 2004-05-18 16:24 rpalsa * libltdl/configure.ac: Replacement for configure.in 2004-05-18 16:23 rpalsa * libltdl/configure.in: Replaced by configure.ac 2004-05-17 11:54 rpalsa * README: Remove 'or newer' from qfits version requirement. It works only with qfits 4.3.5 2004-05-14 14:38 cplmgr * ChangeLog: Updated. 2004-05-14 14:32 cplmgr * libcext/ChangeLog: Updated. 2004-05-14 13:42 cplmgr * configure.ac: Package version updated. 2004-05-13 11:53 rpalsa * tests/check.out.HP-UX: Obsolete. 2004-05-13 11:51 rpalsa * cplui/cpl_frameset.c: Solution for caching problem when removing frames from the set has been implemented. 2004-05-13 11:42 rpalsa * tests/cpl_frameset-test.c: Adapted to changed frameset internal caching behaviour. 2004-05-11 17:26 rpalsa * cplui/cpl_frameset.c: Do not reset internal cache after frame deletion. This does not work. True solution has to be found 2004-05-11 17:20 rpalsa * cplui/cpl_frameset.c: Reset internal cache after frame deletion. 2004-05-11 16:30 rpalsa * tests/Makefile.am: Add libtool link flag -all-static to LDFLAGS 2004-05-11 16:25 rpalsa * tests/cpl_frameset-test.c: Adapted to changed behaviour of cpl_frameset_begin()/cpl_frameset_next() 2004-05-11 16:24 rpalsa * cplui/cpl_frameset.c: Change cpl_frameset_begin() and cpl_frameset_next() so that frames are accessed in the order of insertion. 2004-05-11 16:15 cizzo * cplcore/: cpl_messaging.c: Now cpl_msg_stop() also closes the logfile if still open 2004-05-10 08:20 cizzo * cplcore/cpl_table.c: Fix inverted logic in cpl_and_select_string() 2004-05-07 22:43 yjung * cpldrs/cpl_geom/cpl_geom_ima.c: corrected bug in computation of the intersection image (shift and add) piosition 2004-05-06 08:47 rpalsa * configure.ac: Library and package version changed. 2004-05-06 08:46 rpalsa * AUTHORS: Updated. 2004-05-04 21:50 yjung * cpldrs/cpl_geom/: cpl_geom_ima.c, cpl_geom_ima.h: added the refine parameter to cpl_geom_ima_offset_combine() 2004-05-04 14:17 cizzo * cplcore/cpl_messaging.c: Fix a bug - verbosity level shouldn't be changed in case of failure in creating a logfile 2004-05-04 14:13 cizzo * cplcore/cpl_messaging.c: Fix a bug - verbosity level shouldn't be changed in case of failure in creating a logfile 2004-05-01 06:18 yjung * cpldrs/cpl_geom/cpl_geom_ima.c: do not try to correlate the 1st frame with itself any more 2004-04-30 09:07 cizzo * doxygen/: cplref_applications.tex, cplref_installation.tex, cplref_introduction.tex: Consistent heading style of capitalisation 2004-04-29 13:19 cizzo * cplcore/cpl_table.c: Fix bug in cpl_table_and_select_string() (inverted logic) 2004-04-23 10:49 yjung * cpldrs/cpl_det/cpl_det.c: corrected a bug (array read outside bounds 2004-04-23 09:51 llundin * cplcore/cpl_polynomial.c: cpl_vector_gen_polynomial_equid() renamed x to x0 2004-04-22 18:35 llundin * cpldrs/: cpl_phot/cpl_phot.c, cpl_phot/cpl_phot.h, tests/cpl_phot-test.c: Rename of cpl_vector_planck() to cpl_phot_blackbody() 2004-04-22 13:21 yjung * cplcore/tests/cpl_matrix-test.c: commented out cpl_matrix_dump() 2004-04-22 13:11 yjung * cpldrs/cpl_geom/cpl_geom_ima.c: changed the include back 2004-04-22 13:03 yjung * cpldrs/cpl_geom/cpl_geom_ima.c: changed include 2004-04-22 11:40 yjung * cpldrs/cpl_det/: cpl_det.c, cpl_det.h, cpl_det_body.h: added cpl_det_linearity 2004-04-22 10:59 yjung * cpldrs/: cpl_det/cpl_det.c, cpl_det/cpl_det.h, tests/cpl_det-test.c: added cpl_det_ron_ring() 2004-04-19 11:36 yjung * cplcore/cpl_polynomial.c: cpl_matrix_leastsq() changed 2004-04-19 11:16 cizzo * cplcore/cpl_matrix.c: Correct convention used in cpl_matrix_leastsq(), consistent with cpl_matrix_solve_system() 2004-04-19 11:16 cizzo * cplcore/tests/cpl_matrix-test.c: Add cpl_matrix_leastq() test 2004-04-15 11:36 llundin * cpldrs/: cpl_phys_const.h, cpl_phot/cpl_phot.c, tests/cpl_phot-test.c: Wien displacement. Unit-less Planck 2004-04-13 14:23 cplmgr * configure.ac: Package version updated. 2004-04-13 11:24 cizzo * cplcore/cpl_table.c: Upgrade the DATE keyword to the last file modification, and not just to the file creation 2004-04-08 18:55 yjung * cplcore/cpl_image_io.c: old name used (qfits 4.3.5) 2004-04-08 18:48 yjung * cplcore/cpl_image_io.c: update md5 and date of writing in produced fits images 2004-04-08 18:40 yjung * cplcore/cpl_image_io.c: add datamd5 and date of writing in saved images 2004-04-08 17:32 rpalsa * cplcore/cpl_table.c: Erase extension related keywords from the primary header property list 2004-04-08 17:06 yjung * cpldrs/tests/cpl_det-test.c: changed API for image generation functions 2004-04-08 16:56 yjung * cplcore/: cpl_image_gen.c, cpl_image_gen.h, cpl_image_gen_body.h, tests/cpl_image_basic-test.c, tests/cpl_image_gen-test.c, tests/cpl_imset_basic-test.c: changed the image generation functions API 2004-04-08 15:12 yjung * cplcore/: cpl_polynomial.c, cpl_polynomial.h: changed API of cpl_polynomial_1d_fit and cpl_polynomial_2d_fit() according CPL group req. 2004-04-08 14:54 yjung * cpldrs/tests/: cpl_image_photometry-test.c, cpl_imset_combine-test.c, cpl_objects-test.c: renamed 2004-04-08 14:52 yjung * cpldrs/tests/: cpl_apert_ima-test.c, cpl_geom_ima-test.c, cpl_phot-test.c: cpl_1dfunction -> cpl_bivector 2004-04-08 14:48 yjung * cpldrs/cpl_geom/: cpl_geom_ima.c, cpl_geom_ima.h: cpl_1dfunction -> cpl_bivector 2004-04-08 14:45 yjung * cpldrs/cpl_det/cpl_det.c: cpl_1dfunction -> cpl_bivector 2004-04-08 14:43 yjung * cpldrs/cpl_apert/: cpl_apert_ima.c, cpl_apert_ima.h: cpl_1dfunction -> cpl_bivector 2004-04-08 14:39 yjung * cplcore/tests/cpl_image_bpm-test.c: 1dfunction - > bivector 2004-04-08 14:38 yjung * cplcore/tests/cpl_1dfunction-test.c: moved to cpl_bictor 2004-04-08 14:36 yjung * cplcore/tests/Makefile.am: 1dfunction-> bivector 2004-04-08 14:34 yjung * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_bivector-test.c: cpl_1dfunction -> cpl_bivector 2004-04-08 14:33 yjung * cplcore/cpl_vector.c: doc update 2004-04-08 14:31 yjung * cplcore/cpl_imset_basic.h: removed an unused include 2004-04-08 14:30 yjung * cplcore/: cpl_image_stats.c, cpl_tools.h: rm an unused include 2004-04-08 14:30 yjung * cplcore/: cpl_image_bpm.c, cpl_image_bpm.h: cpl_1dfunction -> cpl_bivector 2004-04-08 14:28 yjung * cplcore/cpl_image_basic.c: doc corrected 2004-04-08 14:26 yjung * cplcore/Makefile.am: cpl_1dfunction-> cpl_bivector 2004-04-08 14:25 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h: moved to cpl_bivector 2004-04-08 14:25 yjung * cplcore/: cpl_bivector.c, cpl_bivector.h: New revision 2004-04-08 09:48 rpalsa * libcext/m4macros/eso.m4: In ESO_FUNC_STRDUP: Change pil_strdup to cx_strdup in the symbol definition 2004-04-08 09:46 cizzo * cplcore/cpl_table.c: Avoid duplication of DATAMD5 keyword 2004-04-08 09:23 cizzo * cplcore/cpl_table.c: Avoid duplication of DATAMD5 keyword 2004-04-08 09:22 cizzo * cplcore/tests/cpl_table-test.c: Minor change 2004-04-07 16:05 llundin * cplcore/cpl_polynomial.c, cplcore/cpl_polynomial.h, cplcore/tests/cpl_polynomial-test.c, cpldrs/tests/cpl_phot-test.c: Renamed cpl_polynomial_1d_eval_equid() to cpl_vector_gen_polynomial_equid() 2004-04-07 09:41 yjung * cplcore/cpl_image_io.c: cpl_image_save updates NAXIS1 and 2 in accordance with the provided image 2004-04-07 09:25 yjung * cplcore/cpl_image_io.c: NAXIS NAXIS1 NAXIS2 NAXIS3 corrected inside cpl_image_save() and cpl_image_append() 2004-04-06 18:45 llundin * cpldrs/cpl_phot/cpl_phot.h: Removed relative include-path 2004-04-06 18:24 yjung * cpldrs/tests/: cpl_det-test.c, cpl_geom_ima-test.c: corrected missing include and unused variables 2004-04-06 18:10 yjung * cpldrs/: cpl_spectro.c, cpl_spectro.h: moved to cpl_phot/cpl_phot.[ch] 2004-04-06 18:09 yjung * cpldrs/tests/cpl_spectro-test.c: moved to cpl_phot-test 2004-04-06 18:09 yjung * cpldrs/tests/cpl_phot-test.c: renamed from cpl_spectro-test 2004-04-06 18:08 yjung * cpldrs/tests/Makefile.am: renamed cpl_spectro in cpl_phot 2004-04-06 18:05 yjung * cpldrs/cpl_phot/: cpl_phot.c, cpl_phot.h: New revision 2004-04-06 18:05 yjung * cpldrs/Makefile.am: created cpl_phot/ 2004-04-06 17:28 llundin * cplcore/cpl_1dfunction.c, cplcore/cpl_1dfunction.h, cplcore/tests/cpl_1dfunction-test.c, cpldrs/tests/cpl_spectro-test.c: Fixed API for cpl_1dfunction_interpolate_linear(). Removed cpl_1dfunction_natural_spline() 2004-04-06 11:53 cplmgr * ChangeLog: Updated 2004-04-06 11:33 cplmgr * configure.ac: Package version changed. 2004-04-06 11:22 yjung * cpldrs/cpl_apert/: cpl_apert.c, cpl_apert.h: added cpl_apert_detect_threshold_sigma() 2004-04-05 16:25 cizzo * cplcore/: cpl_table.c: Avoid warning from xmemory 2004-04-05 16:06 cizzo * cplcore/cpl_table.c: Correct violation in cpl_table_print() 2004-04-05 16:03 cizzo * cplcore/cpl_table.c: Correct violation in cpl_table_print() 2004-04-05 10:05 yjung * cplcore/tests/cpl_image_basic-test.c: added test for insert_local() 2004-04-05 10:04 yjung * cplcore/cpl_sparseimage.c: corrected bug in insert_local() 2004-04-05 09:45 yjung * cplcore/cpl_sparseimage.c: bug in insert_local() 2004-04-02 18:57 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: added cpl_sparseimage_insert_local() 2004-04-02 18:56 yjung * cplcore/cpl_image_basic.c: added bad pixels handling in cpl_image_insert_local() 2004-04-02 16:38 yjung * doxygen/Doxyfile.in: added cpldrs 2004-04-02 16:27 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h, tests/cpl_image_basic-test.c: added cpl_image_insert_local() 2004-04-02 15:05 yjung * cplcore/cpl_image_basic.c, cplcore/cpl_image_basic.h, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_resample.c, cplcore/cpl_image_resample.h, cplcore/cpl_image_resample_body.h, cplcore/tests/cpl_image_basic-test.c, cplcore/tests/cpl_image_resample-test.c, cpldrs/cpl_geom/cpl_geom_ima.c: cpl_image_subsample moved from cpl_image_basic to cpl_image_resample 2004-04-02 13:53 yjung * cpldrs/tests/cpl_geom_ima-test.c: cpl_geom_ima_offset_saa() prototype changed 2004-04-02 13:13 cizzo * cplcore/cpl_messaging.c: Move previous fix to the right block... 2004-04-02 11:25 yjung * cplcore/: cpl_polynomial.c, cpl_polynomial.h: added cpl_polynomial_2d_fit and cpl_polynomial_1d_fit 2004-04-02 11:24 yjung * cplcore/: cpl_image_gen.c, cpl_image_gen.h, cpl_image_gen_body.h: added cpl_image_gen_polynomial_double and cpl_image_gen_polynomial_float 2004-04-02 11:15 cizzo * cplcore/cpl_messaging.c: Avoid empty line after progress bar 2004-04-01 17:45 yjung * cpldrs/cpl_geom/: cpl_geom_ima.c, cpl_geom_ima.h, cpl_geom_ima_body.h: cpl_geom_ima_offset_saa and cpl_geom_ima_offset_combine return now both the cpombined image and the contribution map 2004-04-01 14:45 yjung * cpldrs/tests/cpl_apert-test.c: added an include 2004-04-01 12:00 yjung * cpldrs/cpl_geom/: cpl_geom_ima.c, cpl_geom_ima.h: cpl_geom_ima_offset_combine() returns now 3 images 2004-03-31 11:11 cizzo * cplcore/: cpl_table.c, cpl_table.h: Add function cpl_table_row_is_selected() 2004-03-29 13:51 yjung * cplcore/cpl_vector.c: corrected bad check on entries 2004-03-26 14:43 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: the filtered images borders are computed now 2004-03-26 10:08 yjung * cplcore/cpl_image_bpm.c: updated doc 2004-03-26 09:40 cizzo * cplcore/cpl_messaging.c: Keep into account message indentation when wrapping 2004-03-26 09:31 cizzo * cplcore/cpl_messaging.c: Keep into account message indentation when wrapping 2004-03-25 10:40 cizzo * cplcore/cpl_messaging.c: Improve documentation, and add a new-line character at the end of the progress message 2004-03-25 09:52 yjung * cpldrs/cpl_geom/cpl_geom_ima.c: if refining fails or if no anchor point is detected, still recombine using the offsets estimates 2004-03-22 13:10 yjung * cpldrs/: cpl_apert/cpl_apert.c, cpl_apert/cpl_apert_ima.c, cpl_geom/cpl_geom_ima.c, tests/cpl_geom_ima-test.c: cpl_apert_get_xxx() 's index starts with 1 and not 0 2004-03-17 16:09 yjung * cplcore/: cpl_image_basic.c, cpl_image_stats_body.h: unused variables removed 2004-03-17 15:09 yjung * cplcore/: cpl_image_basic.c, cpl_image_stats.c: added doc 2004-03-16 17:09 yjung * cpldrs/cpl_det/: cpl_det.c, cpl_det_body.h: made cpl_det_clean_bad_pix() much faster 2004-03-16 13:28 yjung * cpldrs/cpl_det/cpl_det.c: small change in entries check 2004-03-16 12:55 yjung * cplcore/cpl_image_io.c: added some doc 2004-03-16 12:25 yjung * cpldrs/cpl_apert/cpl_apert.c: removed a cpl_image_save() 2004-03-16 12:22 yjung * cpldrs/tests/cpl_apert_ima-test.c: typo 2004-03-16 12:21 yjung * cpldrs/tests/cpl_apert-test.c: added tests on bad pixels support 2004-03-16 12:20 yjung * cpldrs/cpl_apert/cpl_apert.c: corrected cpl_apert_dump() 2004-03-16 11:08 yjung * cpldrs/cpl_apert/: cpl_apert.c, cpl_apert.h: added cpl_apert_get_min() cpl_apert_get_xcentroid() and cpl_apert_get_ycentroid() 2004-03-16 09:35 yjung * cplcore/cpl_image_bpm.c: changed doc and better checked inputs of cpl_image_bpm_set_from_map() 2004-03-15 15:15 yjung * cpldrs/tests/cpl_apert_ima-test.c: comment out the dumps 2004-03-15 15:14 yjung * cpldrs/tests/cpl_apert_ima-test.c: typo 2004-03-15 15:03 yjung * cpldrs/tests/Makefile.am: added cpl_apert_ima-test 2004-03-15 15:02 yjung * cpldrs/tests/cpl_apert_ima-test.c: Initial revision 2004-03-15 15:02 yjung * cpldrs/tests/cpl_apert-test.c: typo 2004-03-15 14:56 yjung * cpldrs/cpl_det/cpl_det.h: typo 2004-03-15 14:48 yjung * cpldrs/tests/cpl_det-test.c: updated 2004-03-15 14:22 yjung * cpldrs/tests/: cpl_apert-test.c, cpl_geom_ima-test.c, cpl_det-test.c: updated 2004-03-15 14:11 yjung * cpldrs/cpl_apert/cpl_apert_ima.c: typo 2004-03-15 14:00 yjung * cpldrs/tests/Makefile.am: added cpl_geom_ima-test and cpl_det-test 2004-03-15 13:57 yjung * cpldrs/tests/cpl_apert-test.c: updated 2004-03-15 13:48 yjung * cpldrs/tests/: Makefile.am, cpl_apert-test.c, cpl_det-test.c, cpl_geom_ima-test.c: new directory organisation 2004-03-15 13:24 yjung * cpldrs/cpl_det/cpl_det.c: bad file included 2004-03-15 13:22 yjung * cpldrs/: cpl_imset_combine.c, cpl_imset_combine.h, cpl_imset_combine_body.h: functions moved to cpl_geom/cpl_geom_ima.c 2004-03-15 13:21 yjung * cpldrs/: cpl_image_photometry.c, cpl_image_photometry.h, cpl_image_photometry_body.h: functions moved to cpl_det/cpl_det.c and cpl_apert/cpl_apert_ima.c 2004-03-15 13:19 yjung * cpldrs/: cpl_objects.c, cpl_objects.h: moved to cpl_apert/cpl_apert.c 2004-03-15 13:19 yjung * cpldrs/cpl_geom/cpl_geom_ima.c: typo 2004-03-15 13:04 yjung * cpldrs/Makefile.am: changed the compiled files 2004-03-15 12:05 yjung * cpldrs/cpl_det/: cpl_det.c, cpl_det.h, cpl_det_body.h: Initial revision 2004-03-15 11:54 yjung * cpldrs/cpl_apert/: cpl_apert.c, cpl_apert.h: renamed cpl_apert_detect() 2004-03-15 11:50 yjung * cpldrs/cpl_geom/: cpl_geom_ima.c, cpl_geom_ima.h, cpl_geom_ima_body.h: Initial revision 2004-03-12 16:06 yjung * cpldrs/Makefile.am: added cpl_apert.c cpl_apert_ima.c 2004-03-12 16:03 yjung * cpldrs/cpl_apert/cpl_apert.c: typo 2004-03-12 15:51 yjung * cpldrs/cpl_apert/: cpl_apert_ima.c, cpl_apert_ima.h: Initial revision 2004-03-12 15:13 yjung * cpldrs/cpl_apert/: cpl_apert.c, cpl_apert.h: first correct version 2004-03-12 14:25 yjung * cpldrs/cpl_apert/: cpl_apert.c, cpl_apert.h: Initial revision 2004-03-10 15:50 yjung * cpldrs/: cpl_image_photometry.c, cpl_image_photometry.h, tests/cpl_image_photometry-test.c: cpl_image_get_fwhm_basic moved to cplcore as cpl_image_fwhm_locmax() 2004-03-10 15:49 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, tests/cpl_image_basic-test.c: added cpl_image_get_fwhm_locmax() and changed prototype of cpl_image_gaussian_fit() 2004-03-08 16:59 yjung * cplcore/: cpl_image_stats.c, cpl_image_stats.h, cpl_image_stats_body.h: added cpl_image_xcentroid(), cpl_image_xcentroid_subw(), cpl_image_ycentroid() and cpl_image_ycentroid_subw() 2004-03-08 14:40 yjung * cpldrs/: cpl_imset_combine.c, cpl_imset_combine.h: added 3 parameters to cpl_imset_recombine (min and max rej and union_flag) 2004-03-05 11:16 yjung * cpldrs/tests/cpl_image_photometry-test.c: typo 2004-03-05 11:16 yjung * cpldrs/cpl_image_photometry.c: use log() 2004-03-04 16:12 yjung * cpldrs/tests/cpl_image_photometry-test.c: added test for cpl_image_fwhm_gaussian() 2004-03-04 16:01 yjung * cplcore/cpl_image_basic.c: doc 2004-03-04 16:00 yjung * cplcore/: cpl_image_basic.c, tests/cpl_image_basic-test.c: support bad pixels handling in cpl_image fit gaussian() 2004-03-04 14:28 yjung * cplcore/tests/cpl_image_stats-test.c: test cpl_image_get() on bad pixels. 2004-03-04 14:20 yjung * cplcore/cpl_image_stats.c: handle the case where cpl_image_get() is called on a bad pixel 2004-03-04 13:14 yjung * cplcore/: cpl_image_stats.c, cpl_image_stats.h: added cpl_image_get() 2004-03-04 13:13 yjung * cpldrs/: cpl_image_photometry.c, cpl_image_photometry.h: added cpl_image_get_fwhm_gaussian() cpl_image_get_fwhms_gaussian() cpl_image_get_fwhm_basic() cpl_image_get_fwhms_basic() 2004-03-04 10:16 yjung * cplcore/cpl_image_basic.c: anges in cpl_image_gaussian_fit(0 2004-03-03 18:41 yjung * cpldrs/tests/: cpl_imset_combine-test.c, cpl_objects-test.c: some changes due to the new cpl_image_gen() 2004-03-03 18:26 yjung * cplcore/tests/cpl_imset_basic-test.c: start the message system 2004-03-03 18:11 cizzo * cplcore/cpl_messaging.c: Ensure that the messaging system is initialized just once 2004-03-03 17:57 yjung * cplcore/tests/cpl_image_io-test.c: nothing 2004-03-03 17:55 yjung * cplcore/cpl_image_gen.c: new image generated by default 2004-03-03 17:43 yjung * cplcore/cpl_image_gen_body.h: typo 2004-03-03 17:40 yjung * cplcore/: cpl_image_gen.c, cpl_image_gen.h, cpl_image_gen_body.h, tests/cpl_image_gen-test.c: allow to specify sig_x and sig_y for the 2d gaussian generation 2004-03-03 16:31 yjung * cplcore/cpl_image_basic.c: typo 2004-03-03 16:27 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h: added cpl_image_gaussian_fit() 2004-03-02 11:27 llundin * cpldrs/tests/cpl_spectro-test.c: Test of cpl_vector_planck() with atmospheric transmissivity 2004-03-02 09:26 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h: added cpl_image_append() 2004-03-01 18:14 yjung * cplcore/: cpl_imset_basic.c, cpl_imset_basic_body.h: cpl_imset_time_median() efficiency improve - bad pixels not handled any more by the function 2004-03-01 17:41 yjung * cpldrs/cpl_imset_combine.c: removed a cpl_msg_info() 2004-03-01 17:33 yjung * cpldrs/: cpl_imset_combine.c, cpl_imset_combine_body.h: added calls to cpl_msg_progress() 2004-03-01 17:19 yjung * cplcore/cpl_imset_basic_body.h: added call to cpl_msg_progress() 2004-03-01 15:04 cizzo * cplcore/: cpl_messaging.c, cpl_messaging.h: Implement function cpl_msg_progress() 2004-03-01 12:08 yjung * cplcore/tests/cpl_vector-test.c: remove call to cpl_vector_dump() 2004-03-01 11:57 yjung * cplcore/tests/cpl_vector-test.c: added tests for cpl_vector_slect() and cpl_vector _extract_selected() 2004-03-01 11:53 yjung * cplcore/cpl_vector.h: added cpl_vector_extract_selected 2004-03-01 11:52 yjung * cplcore/cpl_vector.c: typo 2004-03-01 11:48 cizzo * cplcore/: cpl_messaging.c, cpl_messaging.h: implementation of cpl_msg_progress() 2004-03-01 11:44 yjung * cplcore/: cpl_vector.c, cpl_vector.h: added cpl_vector_extract_selected() and cpl_vector_select() 2004-03-01 11:43 llundin * cpldrs/: cpl_phys_const.h, cpl_spectro.c, cpl_spectro.h, tests/cpl_spectro-test.c: cpl_vector_planck() supports 4 modes 2004-02-27 19:24 yjung * cpldrs/cpl_image_photometry.c: additional test on fwhm validity 2004-02-27 19:03 yjung * cplcore/cpl_image_basic_body.h: bug in cpl_image_extractrow() and cpl_image_extractcol() 2004-02-27 18:39 yjung * cpldrs/cpl_objects.c: bug corrected in cpl_objects_detect() 2004-02-27 18:04 yjung * cpldrs/: cpl_image_photometry.c, cpl_image_photometry.h: added cpl_image_get_objects_fwhm() 2004-02-27 16:09 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h: added cpl_image_extract_row() and cpl_image_extract_col() 2004-02-27 14:58 yjung * cpldrs/cpl_objects.c: x, y pos in cpl_objects are in FITS convention 2004-02-27 11:59 cizzo * cplcore/cpl_messaging.c: Correct typo 2004-02-27 11:53 cizzo * cplcore/: cpl_messaging.c, cpl_messaging.h: Implement function cpl_msg_over() (UNTESTED) 2004-02-27 10:41 yjung * cplcore/tests/: cpl_vector-test.c, cpl_1dfunction-test.c: added a missing include 2004-02-27 10:40 yjung * cplcore/tests/cpl_polynomial-test.c: added an unclude 2004-02-27 10:38 yjung * cplcore/: cpl_memory_impl.h, cpl_polynomial.c, cpl_tools.c: use cpl_memory instead of cxmemory 2004-02-27 09:43 rpalsa * cplcore/: cpl_memory.c, cpl_memory.h: Function cpl_strdup() added. 2004-02-26 17:30 yjung * cpldrs/cpl_image_photometry.c: input test less strict on the nb of bad pixels allowed in cpl_image_clean_badpix() 2004-02-26 17:19 yjung * cplcore/: cpl_vector.c, tests/cpl_vector-test.c: corrected bad check of inputs in cpl_vector_extract() 2004-02-26 14:50 yjung * cpldrs/cpl_imset_combine.c: changed the output messages 2004-02-26 11:23 yjung * cpldrs/cpl_imset_combine.c: new test on cross correlation validity 2004-02-25 15:03 yjung * cplcore/: cpl_vector.c: typo 2004-02-25 15:02 yjung * cplcore/: cpl_vector.c, tests/cpl_vector-test.c: typo + new tests 2004-02-25 14:52 yjung * cplcore/: cpl_vector.c, cpl_vector.h: added cpl_vector_new_from_data() cpl_vector_get() cpl_vector_set() cpl_vector_extract() cpl_vector_sum() 2004-02-16 12:01 yjung * cplcore/cpl_image_stats.c: cpl_image_delete used instead of free to delete an image !!!!!!!!!! 2004-02-16 11:05 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: Fixed bug in cpl_polynomial_duplicate(). Added cpl_polynomial_cmp(). Improved documentation on cpl_polynomial_1d_shift(). 2004-02-14 10:34 rpalsa * tests/.cvsignore: Obsolete. 2004-02-13 17:52 yjung * cpldrs/cpl_image_photometry.c: new check on entries in deadpix correction 2004-02-13 17:18 yjung * cpldrs/: cpl_image_photometry.c, cpl_image_photometry_body.h, tests/cpl_image_photometry-test.c: bugs in deadpix correction - test ok 2004-02-13 16:44 yjung * cpldrs/cpl_image_photometry_body.h: borders effects in clean_bad_pix() 2004-02-13 16:30 yjung * cpldrs/: cpl_image_photometry.c, cpl_image_photometry.h, cpl_image_photometry_body.h: added cpl_image_clean_badpix() 2004-02-13 16:28 yjung * cpldrs/Makefile.am: added cpl_image_photometry_body.h 2004-02-13 16:27 yjung * cpldrs/cpl_image_photometry_body.h: Initial revision 2004-02-13 15:09 yjung * cplcore/tests/cpl_image_bpm-test.c: typo 2004-02-13 15:04 yjung * cplcore/: cpl_image_bpm.c, cpl_image_bpm.h, tests/cpl_image_bpm-test.c: added cpl_image_bpm_get_pos() 2004-02-13 11:49 yjung * cpldrs/: cpl_imset_combine.c, cpl_imset_combine.h: added option to specify the anchor points 2004-02-13 10:56 llundin * cplcore/: cpl_polynomial.c, tests/cpl_polynomial-test.c: Improved documentation on cpl_polynomial_1d_shift(). Optimized cpl_polynomial_copy() for same size args 2004-02-13 10:09 yjung * cpldrs/: cpl_imset_combine.c, cpl_imset_combine.h: corrected bug with pointers... 2004-02-12 16:01 llundin * cplcore/: cpl_polynomial.c, tests/cpl_polynomial-test.c: cpl_polynomial_1d_{eval,diff}() uses long double 2004-02-11 15:52 llundin * cplcore/: cpl_polynomial.c, tests/cpl_polynomial-test.c: Changed output format of cpl_polynomial_dump 2004-02-11 15:20 llundin * cplcore/: cpl_image_resample.c, cpl_image_resample_body.h: Renamed cpl_polynomial_compute() to cpl_polynomial_eval() and cpl_polynomial_get_dimension() to cpl_polynomial_dimension() 2004-02-11 15:06 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: Removed cpl_polynomial_get_size(). Added cpl_polynomial_degree(). Redeclared void cpl_polynomial_dump() to cpl_error_code. Renamed cpl_polynomial_compute() to cpl_polynomial_eval() and cpl_polynomial_get_dimension() to cpl_polynomial_dimension() 2004-02-11 14:02 llundin * cplcore/cpl_error.h: Added CPL_ASSURE_ERR_CODE() 2004-02-11 12:39 yjung * cpldrs/: cpl_imset_combine.c, cpl_imset_combine.h: added cpl_imset_recombine() 2004-02-11 11:16 llundin * cplcore/cpl_polynomial.c, cplcore/cpl_polynomial.h, cplcore/tests/cpl_polynomial-test.c, cpldrs/tests/cpl_spectro-test.c: Unified API for 1- and multi-dimensional polynomials 2004-02-10 17:49 yjung * cpldrs/cpl_imset_combine.c: corrected test to detect bad correlated planes 2004-02-10 16:33 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: Special storage for 1d-polynomials 2004-02-10 11:52 yjung * cplcore/: Makefile.am, cpl_image.h, cpl_image_distortion.c, cpl_image_distortion.h, cpl_image_distortion_body.h, cpl_image_resample.c, cpl_image_resample.h, cpl_image_resample_body.h, tests/Makefile.am, tests/cpl_image_distortion-test.c, tests/cpl_image_resample-test.c: renamed cpl_image_distortion in cpl_image_resample. removed cpl_image_distortion_linear() - was a special case of cpl_image_distortion_poly(). cpl_image_distortion_poly() renamed in cpl_image_warp_poly() 2004-02-10 09:53 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: Added cpl_double_horner1d_diff() 2004-02-09 18:14 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: Added cpl_vector_horner1d_shift() 2004-02-09 15:31 cizzo * cplcore/cpl_table.c: Handle case of all-NULL string column 2004-02-09 15:26 cizzo * cplcore/cpl_table.c: Handle case of all-NULL string column 2004-02-09 13:34 llundin * cplcore/cpl_polynomial.c: cpl_double_horner1d_root_nr: Improved convergence check (2) 2004-02-09 10:37 llundin * cplcore/: cpl_polynomial.c, cpl_polynomial.h, tests/cpl_polynomial-test.c: cpl_double_horner1d_root_nr: Improved convergence check 2004-02-06 19:16 llundin * cplcore/: cpl_polynomial.c, tests/cpl_polynomial-test.c: Accelerated NR 2004-02-06 16:56 yjung * cpldrs/cpl_imset_combine.h: added an include 2004-02-06 16:56 yjung * cpldrs/tests/cpl_imset_combine-test.c: added tests for cpl_imset_shiftandadd() cpl_imset_find_offsets_with_objs() 2004-02-06 16:28 llundin * cpldrs/: cpl_phys_const.h, cpl_spectro.c: Renamed constants 2004-02-06 15:46 yjung * cpldrs/tests/cpl_objects-test.c: added tests on cpl_objects_detect() and cpl_objects_detect_subw() 2004-02-06 14:19 yjung * cplui/cpl_frameset.c: cx_malloc inst. of cpl_malloc 2004-02-06 14:17 yjung * cplui/: cpl_frameset.c, cpl_frameset.h: added cpl_frameset_to_filenames() cpl_frameset_labelise() cpl_frameset_get_frame() cpl_frameset_extract() 2004-02-06 14:12 llundin * cplcore/tests/cpl_polynomial-test.c: cpl_double_horner1d() suddenly less accurate 2004-02-06 13:58 yjung * cplcore/tests/cpl_imset_io-test.c: updated test on cpl_imset_reject_images() 2004-02-06 13:47 yjung * cplcore/tests/cpl_imset_basic-test.c: test of cpl_imaset_find_offsets() moved to cpldrs 2004-02-06 13:47 yjung * cpldrs/tests/cpl_imset_combine-test.c: added test of cpl_imset_find_offsets() 2004-02-06 13:27 yjung * cpldrs/tests/cpl_spectro-test.c: ok... 2004-02-06 13:25 yjung * cplcore/tests/cpl_1dfunction-test.c: typo 2004-02-06 13:22 yjung * cpldrs/tests/cpl_spectro-test.c: added test on cpl_vector_planck() 2004-02-06 13:20 yjung * cplcore/tests/cpl_1dfunction-test.c: typo 2004-02-06 13:17 yjung * cplcore/tests/cpl_1dfunction-test.c: test on cpl_vector_planck() moved to cpldrs 2004-02-06 13:11 yjung * cpldrs/tests/Makefile.am: typo 2004-02-06 13:08 yjung * cpldrs/tests/: Makefile.am, cpl_image_photometry-test.c, cpl_imset_combine-test.c, cpl_spectro-test.c: added new test suites 2004-02-06 12:52 yjung * cpldrs/: Makefile.am, cpl_image_distortion.c, cpl_image_distortion.h, cpl_image_distortion_body.h, tests/Makefile.am, tests/cpl_image_distortion-test.c: moved to cplcore 2004-02-06 12:51 yjung * cplcore/: Makefile.am, cpl_image_distortion.c, cpl_image_distortion.h, cpl_image_distortion_body.h: added cpl_image_distortion 2004-02-06 12:49 yjung * cplcore/tests/Makefile.am: added cpl_image-distortion-test 2004-02-06 12:48 yjung * cplcore/tests/cpl_image_distortion-test.c: Re imported 2004-02-06 12:47 yjung * cplcore/tests/cpl_image_distortion-test.c: new 2004-02-06 12:47 yjung * cplcore/tests/cpl_image_distortion.c: mistake 2004-02-06 12:46 yjung * cplcore/tests/cpl_image_distortion.c: Initial revision 2004-02-06 11:45 llundin * cplcore/: cpl_error.c, cpl_error.h: Added CPL_ERROR_CONTINUE 2004-02-06 11:41 yjung * tests/: cpl_1dfunction-test.c, cpl_frame-test.c, cpl_frameset-test.c, cpl_image_basic-test.c, cpl_image_binary-test.c, cpl_image_bpm-test.c, cpl_image_distortion-test.c, cpl_image_filter-test.c, cpl_image_gen-test.c, cpl_image_io-test.c, cpl_image_stats-test.c, cpl_imset_basic-test.c, cpl_imset_complex-test.c, cpl_imset_io-test.c, cpl_matrix-test.c, cpl_objects-test.c, cpl_plist-test.c, Makefile.am, cpl_plugin-test.c, cpl_pluginlist-test.c, cpl_polynomial-test.c, cpl_property-test.c, cpl_sparseimage-test.c, cpl_table-test.c, cpl_table-testfail1.c, cpl_table-testfail2.c, cpl_vector-test.c: moved to cplcore/tests 2004-02-06 11:38 yjung * cplcore/tests/cpl_polynomial-test.c: in progress 2004-02-06 11:11 yjung * cpldrs/tests/: cpl_image_distortion-test.c, cpl_objects-test.c: from cplcore/tests 2004-02-06 11:10 yjung * cplcore/tests/: cpl_image_distortion-test.c, cpl_objects-test.c: to cpldrs/tests 2004-02-06 11:09 yjung * cpldrs/tests/Makefile.am: Initial revision 2004-02-06 11:05 yjung * cplcore/tests/: cpl_frame-test.c, cpl_frameset-test.c, cpl_plugin-test.c, cpl_pluginlist-test.c: to cplui/tests 2004-02-06 11:05 yjung * cplui/tests/: cpl_frame-test.c, cpl_frameset-test.c, cpl_plugin-test.c, cpl_pluginlist-test.c: coming from cplcore/tests 2004-02-06 11:02 yjung * cplui/tests/Makefile.am: Initial revision 2004-02-06 10:55 yjung * cplui/Makefile.am, cpldrs/Makefile.am: added SUBDIRS = tests 2004-02-06 10:52 yjung * cplcore/tests/Makefile.am: New file 2004-02-06 10:52 yjung * cplcore/Makefile.am: added SUBDIRS = tests 2004-02-06 10:52 llundin * cplcore/cpl_polynomial.c, cplcore/cpl_polynomial.h, tests/cpl_polynomial-test.c: cpl_double_horner1d() also computes derivative. Added cpl_double_horner1d_root() 2004-02-06 10:51 yjung * configure.ac: added declaration of cplcore/tests/Makefile, cplui/tests/Makefile and cpldrs/tests/Makefile 2004-02-06 10:48 yjung * Makefile.am: removed compilation of cpl/tests 2004-02-06 10:47 yjung * cplcore/tests/: cpl_1dfunction-test.c, cpl_imset_basic-test.c: removed usage of cpldrs functions 2004-02-06 09:24 yjung * cplcore/tests/: cpl_1dfunction-test.c, cpl_frame-test.c, cpl_frameset-test.c, cpl_image_basic-test.c, cpl_image_binary-test.c, cpl_image_bpm-test.c, cpl_image_distortion-test.c, cpl_image_filter-test.c, cpl_image_gen-test.c, cpl_image_io-test.c, cpl_image_stats-test.c, cpl_imset_basic-test.c, cpl_imset_complex-test.c, cpl_imset_io-test.c, cpl_matrix-test.c, cpl_objects-test.c, cpl_plist-test.c, cpl_plugin-test.c, cpl_pluginlist-test.c, cpl_polynomial-test.c, cpl_property-test.c, cpl_sparseimage-test.c, cpl_table-test.c, cpl_table-testfail1.c, cpl_table-testfail2.c, cpl_vector-test.c: moved cpl/tests/* to cpl/cplcore/tests/. 2004-02-05 18:23 yjung * cpldrs/: cpl_objects.c, cpl_objects.h: added cpl_objects_detect_subw() and cpl_objects_detect() 2004-02-05 18:11 yjung * cplcore/: cpl_imset_io.c, cpl_imset_io.h: changed prototype of cpl_imset_reject_images() 2004-02-05 18:01 yjung * tests/cpl_imset_io-test.c: changed cpl_imset_reject_frames() 2004-02-05 13:45 yjung * cpldrs/: cpl_objects.c, cpl_objects.h: removed fwhm stuff 2004-02-05 11:02 yjung * cpldrs/cpl_imset_combine.c: precisely defined the different offsets meanings ! 2004-02-04 18:11 yjung * cpldrs/: cpl_imset_combine.c, cpl_imset_combine.h, cpl_imset_combine_body.h: added cpl_image_correlate_subw(), cpl_image_find_offset_with_objs() and cpl_imset_find_offsets_with_objs() 2004-02-03 17:20 llundin * cplcore/cpl_polynomial.c, cplcore/cpl_polynomial.h, cplcore/cpl_vector.c, cplcore/cpl_vector.h, tests/cpl_polynomial-test.c, tests/cpl_vector-test.c: Moved cpl_double_horner1d() and cpl_vector_horner1d_equid 2004-02-03 15:29 llundin * cpldrs/cpl_spectro.c, tests/cpl_1dfunction-test.c: cpl_vector_planck: Improved comments and testing 2004-02-03 11:57 llundin * cpldrs/cpl_spectro.c: cpl_vector_planck() tested 2004-02-03 11:52 yjung * cplcore/cpl_1dfunction.c: removed unused defines 2004-02-03 11:51 yjung * cpldrs/cpl_image_photometry.c: added missing defines 2004-02-03 11:39 yjung * cpldrs/: cpl_image_photometry.c, cpl_image_photometry.h: Initial revision 2004-02-03 11:23 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h, cpl_image_stats.c, cpl_image_stats.h: moved readout noise measurement functions to cpldrs 2004-02-03 11:22 yjung * cpldrs/Makefile.am: added cpl_image_photometry 2004-02-03 10:52 llundin * cpldrs/cpl_spectro.c: Removed spurious #endif 2004-02-03 10:46 llundin * cpldrs/: cpl_spectro.c, cpl_spectro.h: cpl_vector_planck() 2004-02-03 10:45 yjung * tests/cpl_imset_basic-test.c: added an include 2004-02-03 10:42 llundin * cpldrs/Makefile.am: Added cpl_phys_const.h & cpl_spectro.{h,c} 2004-02-03 10:37 yjung * cpldrs/cpl_imset_combine.c: typo 2004-02-03 10:24 yjung * cplcore/: cpl_imset_basic.c, cpl_imset_basic.h, cpl_imset_basic_body.h: moved cpl_imset_finf_offsets() and cpl_imset_shiftandadd() to cpldrs 2004-02-03 10:21 yjung * cpldrs/: Makefile.am, cpl_imset_combine.c, cpl_imset_combine.h, cpl_imset_combine_body.h: added cpl_imset_combine 2004-02-03 10:11 yjung * Makefile.am, tests/Makefile.am: added cpldrs 2004-02-03 10:07 llundin * cpldrs/cpl_phys_const.h: Speed of light, Planck & Boltzman 2004-02-03 10:03 yjung * cplcore/: cpl_image_distortion.c, cpl_image_distortion.h, cpl_image_distortion_body.h, cpl_objects.c, cpl_objects.h: moved to cpldrs 2004-02-03 10:02 yjung * cplcore/Makefile.am: moved cpl_image_distortion and cpl_objects to cpldrs 2004-02-03 10:01 yjung * cpldrs/: Makefile.am, cpl_image_distortion.c, cpl_image_distortion.h, cpl_image_distortion_body.h, cpl_objects.c, cpl_objects.h: added cpl_image_distortion and cpl_objects files 2004-02-02 18:24 llundin * cplcore/cpl_vector.c: cpl_double_horner1d: Improved comments 2004-02-02 18:04 llundin * cplcore/cpl_vector.c: Imporved cpl_double_horner1d 2004-02-02 17:49 llundin * cplcore/cpl_1dfunction.c, cplcore/cpl_1dfunction.h, tests/cpl_1dfunction-test.c: cpl_1dfunction_interpolate_linear: more checks and efficiency 2004-02-02 17:00 yjung * cplcore/cpl_image_distortion.c, cplcore/cpl_image_distortion_body.h, cplcore/cpl_polynomial.c, cplcore/cpl_polynomial.h, tests/cpl_image_distortion-test.c, tests/cpl_polynomial-test.c: polynomial object from 2d to any dimension 2004-02-02 16:37 llundin * cplcore/cpl_vector.c, cplcore/cpl_vector.h, tests/cpl_vector-test.c: Added cpl_double_horner1d() and cpl_vector_horner1d_equid() 2004-02-02 10:37 rpalsa * cpldrs/Makefile.am: Added. 2004-02-02 10:37 rpalsa * configure.ac: Build directory cpldrs added. 2004-02-02 10:37 rpalsa * README.CVS, acinclude.m4, m4macros/cpl.m4: cplbase replaced by cpldrs 2004-02-02 10:31 rpalsa * cplbase/.cvsignore: Obsolete. 2004-02-02 10:16 rpalsa * cpldrs/.cvsignore: Added. 2004-01-30 15:36 llundin * cplcore/: cpl_tools.c, cpl_tools.h: cpl_tools_is_power_of_2: Reimplemented with frexp() and improved comment 2004-01-30 15:06 cizzo * cplcore/cpl_table.c: cpl_table_save() crashed with integer columns just containing NULLs 2004-01-30 11:40 cizzo * cplcore/cpl_table.c: Take care of the EXTEND, BSCALE and BZERO keywords in the secondary array, while saving a table 2004-01-30 11:38 cizzo * cplcore/cpl_table.c: Take care of the BSCALE and BZERO keywords in the secondary array, while saving a table 2004-01-30 11:37 cizzo * cplcore/cpl_column.c: Fix access violation in cpl_column_median_TYPE() functions 2004-01-30 11:34 cizzo * cplcore/cpl_table.c: Take care of the EXTEND keyword in the secondary array, while saving a table 2004-01-30 11:26 rpalsa * tests/cpl_plist-test.c: Add testcase for cpl_plist_from_fits() as Test 11. Test 11 renamed to Test 12. 2004-01-30 11:25 rpalsa * cplui/cpl_frame.h: Add PAF frame type to the API 2004-01-30 11:24 rpalsa * cplcore/cpl_messaging.c: Flush the correct streams in the default print handlers. Move default print handler initialization to proper place. 2004-01-30 11:22 rpalsa * cplcore/cpl_plist.c: cpl_plist_decode_fits(): Leave parsing the FITS card to qfits to avoid problems if the qfits keytuple does not carry the line member. This currently needs to use a work around due to a type reporting problem in qfits! Fix it asap. 2004-01-30 11:10 cizzo * cplcore/: cpl_table.c: Take care of the SIMPLE keyword in the secondary array, while saving a table 2004-01-30 10:37 cizzo * cplcore/cpl_table.c: cpl_table_save() crashed with integer columns just containing NULLs 2004-01-23 13:16 rpalsa * cplcore/cpl_messaging.c: Installation of default print handlers is done before terminal size check. 2004-01-23 12:02 rpalsa * cplcore/cpl_plist.c: _cpl_plist_decode_fits(): Do proper check whether a returned value or comment is empty. 2004-01-23 11:52 rpalsa * tests/cpl_plist-test.c: Remove single quotes from string value for the entry ORIGIN in hdr[] 2004-01-23 11:31 yjung * cplcore/: cpl_imset_basic.c, cpl_imset_basic.h, cpl_imset_basic_body.h: added cpl_imset_shiftandadd() 2004-01-23 11:31 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h: added const in declarations 2004-01-22 17:42 yjung * cplcore/: cpl_image_distortion.c, cpl_image_distortion.h, cpl_tools.c, cpl_tools.h: move cpl_interpolation_kernel to cpl_tools 2004-01-22 17:27 rpalsa * tests/cpl_plist-test.c: Test 11 renamed to Test 12. Test for cpl_plist_from_fits() added as Test 11. 2004-01-22 17:25 rpalsa * cplcore/cpl_plist.c: _cpl_plist_decode_fits(): Leave parsing the FITS card to qfits to avoid problems if the qfits keytuple does not carry the line member. This currently needs to use a work around due to a type reporting problem in qfits! Fix it asap. 2004-01-22 17:21 rpalsa * cplui/cpl_frame.h: Frame type CPL_FRAME_TYPE_PAF added. 2004-01-22 14:36 yjung * cplcore/cpl_1dfunction.c: corrected bug in cpl_1dfunction_read() 2004-01-22 09:15 yjung * cplcore/cpl_imset_basic.c, cplcore/cpl_imset_basic.h, tests/cpl_imset_basic-test.c: changed cpl_imset_find_offsets() prototype 2004-01-20 17:07 yjung * tests/cpl_plist-test.c: added a test 12 case 2004-01-20 15:42 yjung * cplcore/cpl_imset_io.c: bug in cpl_imset_delete() corrected 2004-01-20 15:27 yjung * cplcore/cpl_imset_io.c: corrected bug in cpl_imset_delete() 2004-01-20 15:15 yjung * cplcore/cpl_1dfunction.c: bug in cpl_1dfunction_gen_rect_poisson() corrected 2004-01-19 13:02 yjung * cplcore/cpl_image_io.c: cpl_image_set_badpixels() : better check on inputs 2004-01-19 11:50 yjung * cplcore/: cpl_image_stats.c, cpl_image_stats.h: cpl_image_rect_readout_noise() made public (used in NACO pipeline) 2004-01-16 15:55 rpalsa * cplexec/cpl_exec.c: Call cpl_init() at the correct position. 2004-01-16 14:51 rpalsa * cplexec/cpl_exec_plugin_process.c: Startup/Shutdown of CPL message subsystem moved to main() 2004-01-16 14:50 rpalsa * cplexec/cpl_exec.c: CPL message subsystem is initialized close to the CPL library initialization. 2004-01-14 15:34 cizzo * cplcore/cpl_messaging.c: Wrong stream flushed in _cpl_print_out() and _cpl_print_err() 2004-01-13 11:33 llundin * cplcore/cpl_vector.c: XC: Toeplitz comment 2004-01-09 14:40 llundin * cplcore/cpl_vector.c: cpl_vector_xcorr: Removed zero-term from norms 2004-01-08 16:27 llundin * cplcore/cpl_vector.c: cpl_vector_xcorr: Fixed offset bug. Added zero-term to norms. Use that dot-product is distributive over subtraction (3rd) 2004-01-07 17:08 llundin * cplcore/cpl_vector.c: cpl_vector_xcorr: Use that dot-product is distributive over subtraction (2nd) 2004-01-07 16:32 llundin * cplcore/cpl_vector.c: cpl_vector_xcorr: Use that dot-product is distributive (1st) 2004-01-07 11:38 yjung * cplcore/cpl_tools.c: chaeck inputs in cpl_tools_median_9double() 2004-01-02 11:10 cizzo * doxygen/: cpl_reference.tex, cplref_applications.tex, cplref_installation.tex, cplref_introduction.tex, layout.tex: Fix some typos 2004-01-02 11:02 cizzo * cplcore/cpl_column.c: Switch off doxygen triggers 2004-01-02 09:54 rpalsa * templates/Makefile.am.tmpl: MAINTAINERCLEANFILES and surrounding MAINTAINER_MODE conditional added. 2004-01-02 09:52 rpalsa * cplcore/Makefile.am, cplui/Makefile.am, tests/Makefile.am: MAINTAINER_MODE conditional moved. 2004-01-02 09:37 rpalsa * libcext/: cext/Makefile.am, tests/Makefile.am: MAINTAINER_MODE conditional added. 2003-12-30 17:15 rpalsa * AUTHORS, BUGS, COPYING, Makefile.am, README, TODO, configure.ac: Merged in changes from CPL-1_0-BRANCH, release cpl-1_0 2003-12-30 17:15 rpalsa * cplcore/cpl_vector.c: License changed to GPL, Copyright updated. Two semicolons added to make it compile. 2003-12-30 17:12 rpalsa * cplcore/: cpl_imset_io.h, cpl_imset_io_body.h, cpl_matrix.c, cpl_matrix.h, cpl_messaging.c, cpl_messaging.h, cpl_objects.c, cpl_objects.h, cpl_polynomial.c, cpl_polynomial.h, cpl_sparseimage.c, cpl_sparseimage.h, cpl_table.c, cpl_table.h, cpl_tools.c, cpl_tools.h, cpl_vector.h, cpl_image_gen.h, cpl_image_gen_body.h, cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h, cpl_image_stats.c, cpl_image_stats.h, cpl_image_stats_body.h, cpl_imset.h, cpl_imset_basic.c, cpl_imset_basic.h, cpl_imset_basic_body.h, cpl_imset_complex.c, cpl_imset_complex.h, cpl_imset_complex_body.h, cpl_imset_defs.h, cpl_imset_io.c, cpl_1dfunction.c, cpl_1dfunction.h, cpl_column.c, cpl_column.h, cpl_error.c, cpl_error.h, cpl_image.h, cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h, cpl_image_binary.c, cpl_image_binary.h, cpl_image_bpm.c, cpl_image_bpm.h, cpl_image_defs.h, cpl_image_distortion.c, cpl_image_distortion.h, cpl_image_distortion_body.h, cpl_image_filter.c, cpl_image_filter.h, cpl_image_filter_body.h, cpl_image_gen.c: License changed to GPL, Copyright updated. 2003-12-30 17:09 rpalsa * cplcore/: Makefile.am, cpl_init.c, cpl_init.h, cpl_macros.h, cpl_memory.c, cpl_memory.h, cpl_memory_impl.h, cpl_plist.c, cpl_plist.h, cpl_property.c, cpl_property.h, cpl_types.c, cpl_types.h: Merged in changes from CPL-1_0-BRANCH, release cpl-1_0 2003-12-30 17:06 rpalsa * m4macros/cpl.m4, cplui/cpl_plugin.h, cplui/Makefile.am, cplui/cpl_frame.c, cplui/cpl_frame.h, cplui/cpl_frameset.c, cplui/cpl_frameset.h, cplui/cpl_parameter.c, cplui/cpl_parameter.h, cplui/cpl_parlist.c, cplui/cpl_parlist.h, cplui/cpl_plugin.c, cplui/cpl_plugininfo.h, cplui/cpl_pluginlist.c, cplui/cpl_pluginlist.h, cplui/cpl_recipe.h: Merged in changes from CPL-1_0-BRANCH, release cpl-1_0 2003-12-30 17:06 rpalsa * templates/: Makefile.am.tmpl, source.c.tmpl, source.h.tmpl: Added. 2003-12-30 17:05 rpalsa * tests/: cpl_1dfunction-test.c, cpl_image_basic-test.c, cpl_image_binary-test.c, cpl_image_bpm-test.c, cpl_image_distortion-test.c, cpl_image_filter-test.c, cpl_image_gen-test.c, cpl_image_io-test.c, cpl_image_stats-test.c, cpl_imset_basic-test.c, cpl_imset_complex-test.c, cpl_imset_io-test.c, cpl_matrix-test.c, cpl_objects-test.c, cpl_polynomial-test.c, cpl_sparseimage-test.c, cpl_vector-test.c: License changed to GPL, Copyright updated. 2003-12-30 17:01 rpalsa * tests/: cpl_frame-test.c, cpl_frameset-test.c, cpl_plist-test.c, cpl_plugin-test.c, cpl_pluginlist-test.c, cpl_property-test.c, cpl_table-test.c, cpl_table-testfail1.c, cpl_table-testfail2.c, Makefile.am: Merged in changes from CPL-1_0-BRANCH, release cpl-1_0 2003-12-30 16:54 rpalsa * tests/check.out.HP-UX: Useless. 2003-12-29 15:17 rpalsa * libcext/: cext/cxmemory.c, cext/cxmemory.h, cext/cxmessages.c, cext/cxmessages.h, cext/cxmultimap.c, cext/cxmultimap.h, cext/cxslist.c, cext/cxslist.h, cext/cxstring.c, cext/cxstring.h, cext/cxstrutils.c, cext/cxstrutils.h, cext/cxtree.c, cext/cxtree.h, cext/cxtypes.h.bot, cext/cxtypes.h.top, cext/cxutils.c, cext/cxutils.h, cext/snprintf.c, cext/snprintf.h, cext/Makefile.am, cext/cxfileutils.c, cext/cxfileutils.h, cext/cxlist.c, cext/cxlist.h, cext/cxmacros.h, cext/cxmap.c, cext/cxmap.h, AUTHORS, BUGS, COPYING, ChangeLog, INSTALL, Makefile.am, NEWS, README, TODO, configure.ac: Merged in changes from CPL-1_0-BRANCH, release cpl-1_0 2003-12-29 15:15 rpalsa * libcext/tests/: Makefile.am, cxlist-test.c, cxmap-test.c, cxslist-test.c, cxstring-test.c, cxtree-test.c: Merged in changes from CPL-1_0-BRANCH 2003-12-29 15:13 rpalsa * libcext/templates/: Makefile.am.tmpl, source.c.tmpl, source.h.tmpl: Added. 2003-12-19 15:48 llundin * cplcore/cpl_vector.c, tests/cpl_vector-test.c: cpl_vector_xcorr: Incremental RMS 2003-12-18 18:30 llundin * cplcore/cpl_vector.c: cpl_vector_xcorr: Added comments 2003-12-17 17:10 llundin * cplcore/cpl_vector.c: cpl_vector_xcorr: Improved documentation 2003-12-17 16:43 llundin * cplcore/cpl_vector.c, tests/cpl_vector-test.c: Fixed cross-correlation i1-bug 2003-12-16 20:09 llundin * cplcore/cpl_vector.c, tests/cpl_vector-test.c: Cross-correlation checked 2003-12-16 17:17 cplmgr * libcext/Makefile.am, Makefile.am: BUGS added to distribution 2003-12-16 17:12 cplmgr * BUGS, libcext/BUGS: Updated 2003-12-16 16:06 rpalsa * cplcore/cpl_memory.c: Fixed bug in _cpl_free() 2003-12-16 11:47 cplmgr * libcext/ChangeLog, ChangeLog: Updated for release 1.0 2003-12-16 11:27 cizzo * tests/: cpl_image_io-test.c, cpl_frame-test.c, cpl_image_filter-test.c, cpl_vector-test.c: GPL license 2003-12-16 11:26 llundin * cplcore/cpl_vector.c, cplcore/cpl_vector.h, tests/cpl_vector-test.c: 1st version of cross-correlation. cpl_vector_compare: CPL_ASSURE() on tolerance. cpl_vector_sort: Improved order onversion 2003-12-16 11:24 cizzo * tests/: cpl_image_bpm-test.c, cpl_table-testfail1.c, cpl_table-testfail2.c, cpl_image_basic-test.c, cpl_plist-test.c: GPL license 2003-12-16 11:21 cizzo * tests/: cpl_image_stats-test.c, cpl_sparseimage-test.c, cpl_property-test.c, cpl_frameset-test.c, cpl_1dfunction-test.c: GPL license 2003-12-16 11:17 cizzo * tests/: cpl_plugin-test.c, cpl_image_gen-test.c, cpl_pluginlist-test.c, cpl_table-test.c, cpl_image_binary-test.c, cpl_matrix-test.c: GPL license 2003-12-16 11:15 cizzo * cplcore/: cpl_matrix.c, cpl_table.c: Restore headings... 2003-12-16 11:08 cizzo * cplcore/: cpl_messaging.c: Fix a bug 2003-12-16 10:32 cizzo * cplcore/: cpl_matrix.c, cpl_table.c: Fix bugs detected by Lars: functions segmented instead of failing appropriately 2003-12-16 09:57 cizzo * cplcore/: cpl_matrix.h: Remove prototype of non-existing function 2003-12-15 19:24 llundin * cplcore/cpl_image_io.c: Fixed CPL_ASSURE() bug 2003-12-15 19:16 llundin * cplcore/cpl_image_io.c: Fixed CPL_ASSURE() bug 2003-12-15 18:48 rpalsa * cplexec/cpl_exec_plugin_process.c: Use platform specific shlib extension 2003-12-15 18:39 rpalsa * cplcore/cpl_property.c: cpl_property_delete(): correctly handle a NULL pointer. 2003-12-15 15:54 cizzo * libcext/cext/snprintf.c: Remove ESO copyright statement 2003-12-15 15:53 cizzo * libcext/cext/cxmemory.c: License changed to GPL 2003-12-15 15:50 cizzo * libcext/cext/: cxmultimap.c, cxlist.c, cxstring.c, cxtree.c, cxutils.c: License changed to GPL 2003-12-15 15:47 cizzo * libcext/cext/: cxmemory.h, cxmap.c, cxfileutils.c, cxslist.c, cxmessages.c, cxstrutils.c: License changed to GPL 2003-12-15 15:42 cizzo * libcext/cext/: cxstring.h, cxtree.h, cxutils.h: License changed to GPL 2003-12-15 15:38 cizzo * libcext/cext/cxtypes.h.top: License changed to GPL 2003-12-15 15:30 cizzo * libcext/cext/: cxmap.h, cxmacros.h, cxfileutils.h, cxslist.h, cxmessages.h, cxstrutils.h, cxmultimap.h, cxlist.h: License changed to GPL 2003-12-15 15:24 cizzo * cplui/: cpl_frame.c, cpl_plugin.c, cpl_pluginlist.c, cpl_parlist.c, cpl_frameset.c, cpl_parameter.c: License changed to GPL 2003-12-15 15:20 cizzo * cplui/: cpl_frame.h, cpl_recipe.h, cpl_plugin.h, cpl_plugininfo.h, cpl_pluginlist.h, cpl_parlist.h, cpl_frameset.h, cpl_parameter.h: License changed to GPL 2003-12-15 15:14 cizzo * cplexec/: cpl_exec_plugin_process.c, cpl_exec_utils.c, cpl_exec_stringarray.c, cpl_exec_params_process.c, cpl_exec.c, cpl_exec_params_utils.c: License changed to GPL 2003-12-15 15:11 cizzo * cplexec/: cpl_exec_plugin_process.h, cpl_exec_utils.h, cpl_exec_stringarray.h, cpl_exec_params_process.h, cpl_exec.h, cpl_exec_params_utils.h: License changed to GPL 2003-12-15 15:06 cizzo * cplcore/: cpl_image_stats.c, cpl_image_io.c, cpl_column.c, cpl_matrix.c, cpl_image_filter.c, cpl_sparseimage.c: License changed to GPL 2003-12-15 15:02 cizzo * cplcore/: cpl_types.c, cpl_messaging.c, cpl_image_binary.c, cpl_plist.c, cpl_vector.c: License changed to GPL 2003-12-15 14:59 cizzo * cplcore/: cpl_table.c, cpl_error.c, cpl_property.c, cpl_tools.c, cpl_memory.c, cpl_1dfunction.c, cpl_image_bpm.c, cpl_image_gen.c: License changed to GPL 2003-12-15 14:55 cizzo * cplcore/cpl_image_basic.c: License changed to GPL 2003-12-15 14:52 cizzo * cplcore/cpl_sparseimage.h: License changed to GPL 2003-12-15 14:48 cizzo * cplcore/: cpl_memory_impl.h, cpl_image_filter.h, cpl_image_filter_body.h, cpl_matrix.h: License changed to GPL 2003-12-15 14:45 cizzo * cplcore/: cpl_plist.h, cpl_vector.h, cpl_image_io_body.h, cpl_image_stats.h, cpl_image_io.h, cpl_column.h: License changed to GPL 2003-12-15 14:42 cizzo * cplcore/: cpl_types.h, cpl_messaging.h, cpl_image_binary.h, cpl_macros.h, cpl_image.h, cpl_image_basic_body.h: License changed to GPL 2003-12-15 14:39 cizzo * cplcore/: cpl_tools.h, cpl_memory.h, cpl_image_stats_body.h, cpl_1dfunction.h, cpl_image_bpm.h, cpl_image_gen.h: License changed to GPL 2003-12-15 14:36 cizzo * cplcore/: cpl_image_gen_body.h, cpl_error.h, cpl_image_defs.h, cpl_property.h: License changed to GPL 2003-12-15 14:32 cizzo * cplcore/: cpl_image_basic.h, cpl_table.h: License changed to GPL 2003-12-15 14:26 cizzo * tests/Makefile.am, libcext/Makefile.am: License changed to GPL 2003-12-15 14:24 llundin * cplcore/cpl_vector.c: Added CPL_ASSURE() on arguments 2003-12-15 14:23 cizzo * cplcore/Makefile.am, cplexec/Makefile.am, cplui/Makefile.am: License changed to GPL 2003-12-15 14:10 rpalsa * templates/: Makefile.am.tmpl, source.c.tmpl, source.h.tmpl: Added. 2003-12-15 14:09 rpalsa * cplcore/: cpl_init.c, cpl_init.h: License changed to GPL 2003-12-15 14:07 llundin * tests/cpl_vector-test.c: Additional tests. Use of assert() 2003-12-15 13:50 rpalsa * Makefile.am: License changed to GPL 2003-12-15 13:40 rpalsa * COPYING, libcext/COPYING: License changed to GPL 2003-12-15 10:45 rpalsa * README: Required qfits version corrected and download location updated. 2003-12-15 10:42 rpalsa * cplui/cpl_plugininfo.h: Documentation updated. 2003-12-15 10:30 rpalsa * cplui/cpl_plugininfo.h: Documentation updated. 2003-12-15 10:22 rpalsa * cplexec/cpl_exec_plugin_process.c: Bug fixed: cpl_msg_stop() called after cpl_msg_terminal_off() 2003-12-15 10:21 rpalsa * cplexec/cpl_exec_params_process.c: Usage output updated. 2003-12-15 10:20 rpalsa * cplui/cpl_plugininfo.h: Documentation updated. 2003-12-15 09:38 llundin * cplcore/cpl_vector.c: CPL_ASSURE of arguments 2003-12-14 18:00 rpalsa * configure.ac: Package version changed, contact address updated. 2003-12-14 17:59 rpalsa * cplcore/cpl_plist.c: Added FITS header sorting, string property to FITS conversion updated. 2003-12-14 17:58 rpalsa * cplcore/: cpl_1dfunction.c, cpl_property.c: Typo in documentation fixed. 2003-12-14 17:56 rpalsa * tests/cpl_plist-test.c: Test 11 changed because of header sorting. 2003-12-14 17:55 rpalsa * tests/Makefile.am: Cleanup of local files changed. 2003-12-14 17:54 rpalsa * tests/: cpl_plugin-test.c, cpl_pluginlist-test.c: Calls to cpl_plugin_create() replaced 2003-12-14 17:53 rpalsa * cplexec/cpl_exec_params_process.c: Usage text corrected. 2003-12-14 17:52 rpalsa * cplui/Makefile.am: Header file cpl_plugininfo.h added. 2003-12-14 17:50 rpalsa * cplui/cpl_frameset.c: Replaced const cxptr with cxcptr because of ISO-C standard, obsolete type casts removed 2003-12-14 17:48 rpalsa * cplui/cpl_plugininfo.h: Added. 2003-12-14 17:47 rpalsa * libcext/configure.ac: Package version changed, contact address updated. 2003-12-14 17:45 rpalsa * libcext/tests/: cxlist-test.c, cxmap-test.c, cxslist-test.c, cxtree-test.c: Replaced const cxptr with cxcptr because of ISO-C standard 2003-12-14 17:44 rpalsa * libcext/cext/: cxlist.c, cxlist.h, cxmap.c, cxmap.h, cxmultimap.c, cxmultimap.h, cxslist.c, cxslist.h, cxtree.c, cxtree.h, cxtypes.h.bot: Replaced const cxptr with cxcptr because of ISO-C standard; iterators were fixed similarly 2003-12-13 20:51 rpalsa * cplui/cpl_plugin.c: Documentation updated. 2003-12-13 20:51 rpalsa * README, libcext/README: Updated 2003-12-13 16:52 rpalsa * configure.ac: Add macro call to determine the file name extension of shared libraries. 2003-12-13 16:42 rpalsa * cplexec/cpl_exec.h: Remove hardcoded shlib extension. 2003-12-13 16:40 rpalsa * cplui/cpl_frame.c, cplui/cpl_frame.h, cplui/cpl_frameset.c, cplui/cpl_frameset.h, cplui/cpl_parameter.c, cplui/cpl_parameter.h, cplui/cpl_parlist.c, cplui/cpl_parlist.h, cplui/cpl_plugin.c, cplui/cpl_plugin.h, cplui/cpl_pluginlist.c, cplui/cpl_pluginlist.h, cplui/cpl_recipe.h, cplcore/cpl_init.c, cplcore/cpl_memory.c, cplcore/cpl_plist.c, cplcore/cpl_plist.h, cplcore/cpl_property.c, cplcore/cpl_property.h, cplcore/cpl_types.c, cplcore/cpl_types.h: Reference documentation updated. 2003-12-12 17:53 rpalsa * cplexec/cpl_exec_params_process.c: Changed call to cpl_parlist_size() into cpl_parlist_get_size(). 2003-12-12 14:44 yjung * cplcore/: cpl_image_io.c, cpl_sparseimage.c: @see function -> @see function() 2003-12-12 14:42 yjung * cplcore/cpl_image_basic.c: params in accordance with doc in cpl_image_threshold() 2003-12-12 14:41 yjung * cplcore/: cpl_image_io.c, cpl_sparseimage.c: @see function -> @see function() 2003-12-12 14:38 yjung * cplcore/cpl_image_basic.c: params in accordance with the doc 2003-12-12 13:28 rpalsa * libcext/cext/: cxlist.c, cxmap.c, cxmessages.c, cxmultimap.c, cxslist.c, cxstrutils.c, cxtree.c, cxutils.c: Documentation fixed: () added to functions listed after @see tags. 2003-12-12 13:26 rpalsa * libcext/cext/cxmemory.c: Typos in the documentation fixed. 2003-12-12 12:20 cizzo * cplcore/: cpl_matrix.c: Fix parameter list in doc 2003-12-12 12:19 cizzo * cplcore/: cpl_messaging.c: Fix function names in doc 2003-12-12 10:01 llundin * TODO: Improve the handling of range errors 2003-12-12 09:46 llundin * cplcore/: cpl_image_binary.c, cpl_image_io.c, cpl_vector.c: Replaced some small arbitrary constants 2003-12-12 09:36 llundin * cplcore/: cpl_image_binary.c, cpl_image_io.c, cpl_vector.c: Replaced some small arbitrary constants 2003-12-12 09:09 llundin * cplcore/cpl_image_distortion.c: sinc: Removed arbitrary constant 2003-12-11 17:46 llundin * cplcore/cpl_vector.c: cpl_vector_mean & cpl_vector_sqrt: Verify input 2003-12-11 16:40 llundin * cplcore/cpl_vector.c: cpl_vector_mean & cpl_vector_sqrt: Verify input 2003-12-11 15:19 cizzo * cplcore/: cpl_messaging.c: Fix incorrect asserts 2003-12-11 08:33 cizzo * tests/cpl_matrix-test.c: Eliminate calls to cpl_matrix_is_matrix() 2003-12-09 17:03 yjung * cplcore/cpl_sparseimage.c: corrected a small bug 2003-12-09 17:03 yjung * tests/cpl_image_basic-test.c: added test case for shift function 2003-12-09 16:54 yjung * tests/cpl_sparseimage-test.c: added test cases 2003-12-09 16:50 yjung * cplcore/: cpl_image_basic.c, cpl_sparseimage.c, cpl_sparseimage.h: changed cpl_sparseimage_shift_int_local() - > cpl_sparseimage_shift_int() 2003-12-09 16:49 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: [no log message] 2003-12-09 15:12 yjung * cplcore/cpl_sparseimage.c: corrected bug in indices computation in cpl_spareimage_extract() 2003-12-09 13:46 yjung * cplcore/: cpl_image_basic.c, cpl_sparseimage.c, cpl_sparseimage.h: added cpl_sparseimage_shift_int_local() 2003-12-09 09:50 cizzo * cplcore/: cpl_messaging.c: Avoid brakets in component name 2003-12-09 09:49 cizzo * cplcore/: cpl_matrix.c: Fix wrong doc 2003-12-08 18:06 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h: added cpl_image_shift_int_local() 2003-12-08 18:04 yjung * tests/cpl_imset_basic-test.c: added tests for cpl_imset_find_offsets() 2003-12-08 16:31 yjung * cplcore/cpl_imset_basic.c: corrected the shift computation 2003-12-08 15:35 yjung * cplcore/cpl_imset_basic.c: small bug 2003-12-08 15:03 yjung * cplcore/cpl_tools.c: 0 is not a power of 2 (cpl_tools_is_power_of_2()) 2003-12-08 14:55 yjung * cplcore/cpl_imset_basic.c: added doc 2003-12-08 14:15 yjung * tests/cpl_imset_complex-test.c: added test on multiply_complex() 2003-12-08 14:06 yjung * cplcore/cpl_imset_basic.c: cpl_imset_multiply_complex renamed in cpl_imset_complex_multiply() 2003-12-08 14:03 yjung * cplcore/: cpl_imset_basic.c, cpl_imset_complex.c, cpl_imset_complex.h, cpl_imset_complex_body.h: cpl_imset_multiply_complex() -> cpl_imset_complex_multiply 2003-12-08 13:43 yjung * cplcore/cpl_imset_complex.c: added bad pixel map handling 2003-12-08 11:32 yjung * cplcore/cpl_tools.c: corrected cpl_tools_is_power_of_2() name 2003-12-08 11:23 yjung * tests/cpl_imset_basic-test.c: moved some tests to cpl_imset_complex-test 2003-12-08 11:22 yjung * tests/cpl_imset_complex-test.c: Initial revision 2003-12-08 11:22 yjung * tests/Makefile.am: added cpl_imset_complex-test 2003-12-08 10:56 yjung * cplcore/: cpl_imset_basic.h, cpl_imset_basic_body.h: new module... cpl_imset_complex 2003-12-08 10:54 yjung * cplcore/: Makefile.am, cpl_imset.h, cpl_imset_basic.c: created a new module cpl_imset_complex 2003-12-08 10:51 yjung * cplcore/: cpl_tools.c, cpl_tools.h: added cpl_tools_is_power_of_2() 2003-12-08 10:50 yjung * cplcore/: cpl_imset_complex.c, cpl_imset_complex.h, cpl_imset_complex_body.h: Initial revision 2003-12-05 15:04 cizzo * cplcore/: cpl_table.c: Fix doc 2003-12-05 11:55 cizzo * cplui/: cpl_frame.c, cpl_frameset.c, cpl_parameter.c: Fix typos 2003-12-05 11:31 cizzo * cplcore/: cpl_plist.c, cpl_property.c: Fix typos 2003-12-05 11:06 cizzo * cplui/: cpl_plugin.c, cpl_pluginlist.c: Fix some typos 2003-12-05 10:32 cizzo * cplcore/: cpl_messaging.c, cpl_table.c: Upgrade doc 2003-12-05 10:06 cizzo * cplcore/: cpl_init.c: Correct typos 2003-12-05 10:03 cizzo * cplcore/: cpl_table.c: Upgrade doc 2003-12-05 08:46 cizzo * cplcore/cpl_column.c: Eliminate Doxygen trigger 2003-12-04 16:53 cizzo * cplcore/: cpl_table.c: Improve documentation. 2003-12-04 16:52 cizzo * cplcore/: cpl_matrix.c, cpl_matrix.h: Improve documentation. Function cpl_matrix_is_matrix() is eliminated. 2003-12-04 16:52 cizzo * tests/cpl_matrix-test.c: Function cpl_matrix_is_matrix() is eliminated 2003-12-04 15:03 yjung * cplcore/: cpl_image_distortion.c, cpl_imset_basic.c, cpl_imset_io.c, cpl_objects.c, cpl_polynomial.c: upgraded documentation 2003-12-04 14:35 yjung * tests/: cpl_image_basic-test.c, cpl_sparseimage-test.c: remove an extrac cpl_msg_stop() 2003-12-04 14:30 yjung * cplcore/cpl_sparseimage.c: upgraded documentation 2003-12-04 14:23 yjung * cplcore/cpl_image_basic.c: forgot badpixelmap 2003-12-04 14:17 yjung * cplcore/cpl_image_stats.c: upgraded documentation 2003-12-04 14:12 yjung * cplcore/cpl_image_io.c: upgraded documentation 2003-12-04 14:11 yjung * cplcore/: cpl_image_gen.c, cpl_image_gen_body.h: ugrade documentation 2003-12-04 14:07 yjung * cplcore/: cpl_image_bpm.c, cpl_image_filter.c: upgraded documentation 2003-12-04 14:01 yjung * cplcore/: cpl_image_basic.c, cpl_image_binary.c: upgraded documentation 2003-12-04 13:47 yjung * cplcore/cpl_vector.c: upgrade documentation 2003-12-04 13:44 yjung * cplcore/cpl_tools.c: upgrade documerntation 2003-12-04 13:41 yjung * cplcore/cpl_1dfunction.c: documentation upgrade 2003-12-04 13:12 yjung * tests/: cpl_image_binary-test.c, cpl_image_filter-test.c: added #include "cpl_memory_impl.h" 2003-12-04 13:04 cizzo * cplcore/: cpl_error.c, cpl_error.h: Upgrade doc 2003-12-04 13:01 yjung * cplcore/cpl_image_gen_body.h: documentation - > change of parameter names 2003-12-04 12:49 yjung * cplcore/: cpl_1dfunction.c, cpl_image_basic.c, cpl_image_binary.c, cpl_image_bpm.c, cpl_image_filter.c, cpl_image_gen.c, cpl_image_io.c, cpl_image_stats.c, cpl_sparseimage.c, cpl_tools.c, cpl_vector.c: reference manual - doxygen documentation upgrade 2003-12-03 17:26 yjung * tests/: cpl_image_basic-test.c, cpl_sparseimage-test.c: added calls to cpl_msg_start and stop() and added test for cpl_image_move_pixels() 2003-12-03 17:16 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h, cpl_imset_basic.c, cpl_imset_basic.h, cpl_imset_basic_body.h, cpl_sparseimage.c, cpl_sparseimage.h: added cpl_sparseimage_move_pixels(), cpl_image_move_pixels(), cpl_imset_multiply_complex(), cpl_imset_find_offstes() 2003-12-01 16:19 cizzo * cplcore/cpl_init.c: Add Synopsis 2003-12-01 16:13 cizzo * cplcore/: cpl_column.c, cpl_error.c, cpl_matrix.c, cpl_messaging.c, cpl_table.c: Add Synopsis 2003-12-01 16:04 cizzo * cplcore/: cpl_column.c, cpl_error.c, cpl_init.c, cpl_matrix.c, cpl_messaging.c, cpl_table.c: Add Synopsis 2003-12-01 13:20 cizzo * cplcore/: cpl_error.c, cpl_error.h: Improve documentation 2003-12-01 13:18 cizzo * cplcore/: cpl_error.c, cpl_error.h: Improve documentation and solve a problem with cpl_messaging.h including cpl_error.h and viceversa (Lars) 2003-12-01 12:48 cizzo * cplcore/: cpl_messaging.c, cpl_messaging.h: Upgrade the documentation 2003-12-01 12:47 cizzo * tests/: cpl_1dfunction-test.c, cpl_frame-test.c, cpl_frameset-test.c, cpl_image_basic-test.c, cpl_image_binary-test.c, cpl_image_filter-test.c, cpl_image_gen-test.c, cpl_image_io-test.c, cpl_image_stats-test.c, cpl_matrix-test.c, cpl_plist-test.c, cpl_plugin-test.c, cpl_pluginlist-test.c, cpl_property-test.c, cpl_sparseimage-test.c, cpl_table-test.c, cpl_table-testfail1.c, cpl_table-testfail2.c, cpl_vector-test.c: Add missing initialization calls 2003-12-01 11:23 cizzo * cplcore/: cpl_error.c, cpl_error.h: Fix a problem with header files, because cpl_error.h included cpl_messaging.h and viceversa (Lars) 2003-12-01 11:22 cizzo * cplcore/: cpl_messaging.c, cpl_messaging.h: Set the right type to functions 2003-12-01 10:31 cizzo * tests/: cpl_image_basic-test.c, cpl_sparseimage-test.c: Init messaging system 2003-11-30 11:54 cizzo * cplcore/: cpl_messaging.c, cpl_messaging.h: Upgrade documentation, and make the software a bit safer 2003-11-26 16:44 cizzo * cplcore/: cpl_table.c: Minor improvement to documentation 2003-11-26 15:49 rpalsa * m4macros/cpl.m4: In CPL_CHECK_QFITS: Include the Qfits default installation path when looking for headers and libraries. 2003-11-26 14:38 cizzo * cplcore/: cpl_matrix.c, cpl_table.c: Further improvements to the documentation 2003-11-25 16:29 cizzo * cplcore/: cpl_table.c: Replace calls to snprintf() with calls to cx_snprintf() to solve a problem with the gcc 3.2 compiler 2003-11-24 09:23 cizzo * cplcore/: cpl_table.h: Eliminate two unused functions 2003-11-24 09:23 cizzo * cplcore/: cpl_table.c: Major upgrade of the documentation, and fix some minor bugs. Eliminate two unused functions 2003-11-21 15:31 cizzo * cplcore/: cpl_matrix.c: Correct typo in the doc 2003-11-21 14:52 rpalsa * libcext/cext/: cxmessages.c, cxmessages.h: Functions cx_log_set_default_handler(), cx_log_get_domain_count() and cx_log_get_domain_name() added. 2003-11-18 15:21 cizzo * cplcore/: cpl_matrix.c: Minor change in documentation 2003-11-18 10:53 cizzo * cplcore/: cpl_matrix.c: Minor change in documentation 2003-11-18 10:29 cizzo * cplcore/: cpl_matrix.c: Minor change in doc style 2003-11-17 16:30 cizzo * cplcore/: cpl_matrix.c: Improve the documentation, replace the emulation of realloc() with a call to cx_realloc(), and other minor changes 2003-11-14 11:51 yjung * cplcore/cpl_image_bpm.c, cplcore/cpl_image_bpm.h, tests/cpl_image_bpm-test.c: renamed cpl_image_bpm_set_goodpix() in cpl_image_bpm_reset_badpix() 2003-11-14 11:27 yjung * cplcore/cpl_image_bpm.c: check bounds of indices given in ASCII file 2003-11-14 11:25 yjung * cplcore/cpl_image_bpm.c: check the indices given in an ASCII file to see if they are out of bounds 2003-11-14 11:11 yjung * cplcore/: cpl_image_bpm.c, cpl_image_bpm.h: added cpl_image_bpm_is_badpix() and cpl_image_bpm_set_goodpix() 2003-11-14 11:09 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: added cpl_sparseimage_has_index() and cpl_sparseimage_remove_pixel() 2003-11-14 11:04 yjung * tests/cpl_sparseimage-test.c: added tests fo cpl_sparseimage_has_index() and cpl_sparseimage_remove_pixel() 2003-11-14 10:58 yjung * tests/cpl_image_bpm-test.c: added tests for cpl_image_bpm_set_goodpix() and cpl_image_bpm_is_bad() 2003-11-14 10:38 yjung * cplcore/cpl_sparseimage.c: typo 2003-11-14 10:36 yjung * cplcore/: cpl_image_bpm.c, cpl_image_bpm.h: added cpl_image_bpm_is_badpix() and cpl_image_bpm_set_goodpix() 2003-11-14 10:35 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: added cpl_sparseimage_remove_pixel() 2003-11-14 09:54 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: added cpl_sparseimage_has_index() 2003-11-11 10:19 cplmgr * ChangeLog: Updated for release 1.0b1 2003-11-11 10:13 cplmgr * libcext/ChangeLog: Updated for release 1.0b1 2003-11-11 09:50 rpalsa * cplcore/cpl_plist.c: Function cpl_plist_from_fits() added, cpl_plist_load() restructured to use same architecture as cpl_plist_from_fits(). 2003-11-11 09:46 rpalsa * cplcore/cpl_plist.h: Function cpl_plist_from_fits() added. 2003-11-07 17:14 yjung * cplcore/cpl_imset_basic.c, cplcore/cpl_imset_basic.h, cplcore/cpl_imset_basic_body.h, tests/cpl_imset_basic-test.c: added cpl_imset_conv_xy_rtheta() and cpl_imset_conv_rtheta_xy() 2003-11-07 15:39 cplmgr * configure.ac, libcext/configure.ac: Package version changed 2003-11-07 15:34 yjung * tests/cpl_imset_basic-test.c: added test for cpl_imset_fft() 2003-11-07 15:34 yjung * cplcore/cpl_imset_basic.c: added cpl_is_power_of_2() 2003-11-07 15:27 cplmgr * README: Updated for version 1.0b1 2003-11-07 15:17 rpalsa * cplui/cpl_plugin.c: Symbol _CPL_PLUGIN_API replaced by version number. 2003-11-07 15:14 rpalsa * cplui/cpl_plugin.h: Obsolete symbol _CPL_PLUGIN_API removed. 2003-11-07 14:59 yjung * cplcore/cpl_imset_basic.c: corrected index 2003-11-07 14:37 rpalsa * cplexec/cpl_exec.h, cplexec/cpl_exec_params_process.h, cplexec/cpl_exec_params_utils.h, cplexec/cpl_exec_plugin_process.h, cplexec/cpl_exec_stringarray.h, cplexec/cpl_exec_utils.h, cplcore/cpl_init.h, cplcore/cpl_macros.h, cplcore/cpl_memory.h, cplcore/cpl_memory_impl.h, cplcore/cpl_plist.h, cplcore/cpl_property.h, cplcore/cpl_types.h: Leading underscore removed from code guards 2003-11-07 14:32 yjung * cplcore/: cpl_imset_io.c, cpl_imset_io.h: changed api of cpl_imset_save() 2003-11-07 14:31 yjung * cplcore/cpl_imset_basic.c: doxygen 2003-11-07 14:26 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_error.c, cpl_error.h, cpl_matrix.c, cpl_matrix.h, cpl_messaging.h, cpl_table.c, cpl_table.h: Eliminate identifiers in capital letters prefixed by an underscore 2003-11-07 14:22 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_error.c, cpl_error.h, cpl_matrix.c, cpl_matrix.h, cpl_messaging.h, cpl_table.c, cpl_table.h: Eliminate identifiers in capital letters prefixed by an underscore 2003-11-07 14:02 yjung * cplcore/: cpl_imset_basic.c, cpl_imset_basic.h, cpl_imset_basic_body.h: added cpl_imset_fft() 2003-11-07 14:01 yjung * cplcore/: cpl_imset_io.c, cpl_imset_io.h: added cpl_imset_set_image() 2003-11-07 14:01 rpalsa * cplui/: cpl_frame.h, cpl_frameset.h, cpl_parameter.h, cpl_parlist.h, cpl_pluginlist.h, cpl_recipe.h: Leading underscore removed from code guards 2003-11-07 13:58 rpalsa * libcext/cext/: cxfileutils.h, cxlist.h, cxmacros.h, cxmap.h, cxmemory.h, cxmessages.h, cxmultimap.h, cxslist.h, cxstring.h, cxstrutils.h, cxtree.h, cxutils.h, snprintf.h: Leading underscore removed from code guards 2003-11-07 13:58 cizzo * tests/cpl_matrix-test.c: rename cpl_matrix_is_null() to cpl_matrix_is_zero(), add tests for cpl_matrix_maxpos _minpos _max _min 2003-11-07 13:55 cizzo * cplcore/cpl_table.c, cplcore/cpl_table.h, tests/cpl_table-test.c: Create new function cpl_table_column_convert() replacing the convert functions carrying the type signature in their names 2003-11-07 13:54 cizzo * cplcore/: cpl_matrix.c, cpl_matrix.h: rename cpl_matrix_is_null() to cpl_matrix_is_zero(), fix a serious bug in cpl_matrix_maxpos _minpos 2003-11-07 13:50 cizzo * cplcore/cpl_matrix.h: rename cpl_matrix_is_null() to cpl_matrix_is_zero() 2003-11-07 13:46 cizzo * cplcore/cpl_table.c: Minor fix 2003-11-07 11:35 cizzo * cplcore/cpl_table.c: Minor fix 2003-11-07 11:33 cizzo * tests/cpl_table-test.c, cplcore/cpl_table.c, cplcore/cpl_table.h: Create new function cpl_table_column_convert() replacing the convert functions carrying the type signature in their names 2003-11-07 10:52 cizzo * cplcore/cpl_matrix.c: Fix serious bug in cpl_matrix_minpo() and cpl_matrix_maxpos() 2003-11-07 10:41 cizzo * tests/cpl_matrix-test.c: Add tests for cpl_matrix_min _max _minpos and _maxpos 2003-11-06 17:03 yjung * cplcore/: cpl_image_gen.c, cpl_image_gen_body.h, cpl_tools.c, cpl_tools.h: functions made static 2003-11-06 16:53 yjung * cplcore/: cpl_image_distortion.c, cpl_image_distortion.h, cpl_image_gen.c, cpl_image_gen_body.h, cpl_tools.c, cpl_tools.h: some functions made static 2003-11-06 16:06 yjung * cplcore/cpl_image_stats.c: removed an unused function 2003-11-06 16:04 yjung * cplcore/: cpl_tools.c, cpl_tools.h: code reorganized 2003-11-06 16:00 yjung * cplcore/cpl_image_stats.c: added cpl_image_rect_readout_noise() 2003-11-06 15:57 yjung * cplcore/cpl_vector.c: ASCIILINESZ does not exist any more 2003-11-06 15:55 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h: added cpl_1dfunction_gen_rect_poisson() 2003-11-06 15:53 yjung * cplcore/cpl_image_io.c: added doc for cpl_image_duplicate() 2003-11-06 15:49 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h, cpl_image_distortion.c, cpl_image_distortion_body.h, cpl_image_stats.c, cpl_tools.c, cpl_tools.h, cpl_vector.c: cleaned cpl_tools and improved documentation 2003-11-06 12:00 yjung * cplcore/cpl_image_io.c: added CPL_ASSURE checks in cpl_image_duplicate() 2003-11-05 16:03 yjung * cplcore/: cpl_image_io.c: doxygen 2003-11-05 15:20 yjung * cplcore/: cpl_image.h, cpl_image_defs.h, cpl_image_io.c, cpl_image_io_body.h, cpl_image_stats.c, cpl_imset.h, cpl_imset_io_body.h: _CPL_XXX_H_ -> CPL_XXX_H CPL_CLASS_BINARY -> CPL_CLASS_BIN 2003-11-05 15:06 yjung * cplcore/cpl_image_basic.h: use const 2003-11-05 15:02 yjung * tests/: cpl_image_basic-test.c, cpl_image_filter-test.c, cpl_image_io-test.c, cpl_image_stats-test.c: changed prototypes for cpl_image_load() and cpl_image_convert() 2003-11-05 14:55 yjung * cplcore/cpl_tools.h: added some new functions 2003-11-05 14:52 yjung * cplcore/cpl_tools.c: added a couple of new functions and updated documentation 2003-11-05 14:45 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h: cpl_image_load_TYPE() to cpl_image_load(TYPE) cpl_image_convert_to_TYPE() to cpl_image_convert(TYPE) 2003-11-05 14:27 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h, cpl_image_defs.h, cpl_image_io.c, cpl_image_io_body.h: replaced CPL_IMAGE_BINARY by CPL_IMAGE_BIN 2003-11-05 14:25 yjung * cplcore/: cpl_1dfunction.h, cpl_image.h, cpl_image_basic.h, cpl_image_defs.h, cpl_image_filter.h, cpl_image_gen.h, cpl_image_io.h, cpl_image_stats.h, cpl_tools.h, cpl_vector.h: replaced _CPL_XXX_H_ by CPL_XXX_H 2003-11-05 14:09 yjung * cplcore/cpl_tools.c: updated doxygen documentation 2003-11-05 13:39 yjung * cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, cplcore/cpl_imset_basic.c, cplcore/cpl_imset_io_body.h, cplcore/cpl_objects.c, tests/cpl_image_basic-test.c, tests/cpl_image_distortion-test.c, tests/cpl_image_filter-test.c, tests/cpl_image_io-test.c, tests/cpl_image_stats-test.c: changed cpl_image_load_TYPE() to cpl_image_load(.., TYPE,..) changed cpl_image_convert_to_TYPE() to cpl_image_convert(..., TYPE, ...) 2003-10-30 15:03 yjung * cplcore/cpl_vector.c: doxygen + synchro with the main trunk 2003-10-30 14:57 yjung * cplcore/: cpl_image_io.c, cpl_image_stats.c: doxygen + synchro with trunk 2003-10-30 14:52 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h, cpl_sparseimage.c, cpl_sparseimage.h, cpl_image_gen.c: doxygen + synchro with trunk 2003-10-30 14:42 yjung * cplcore/cpl_image_bpm.c: doxygen + synchro with trunk 2003-10-30 14:38 yjung * cplcore/: cpl_image_binary.c, cpl_image_binary.h: synchro with the trunk 2003-10-30 14:28 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: doxygen + synchro with the main trunk version 2003-10-30 14:28 yjung * cplcore/cpl_1dfunction.c: doxygen... 2003-10-30 14:10 yjung * cplcore/: cpl_1dfunction.c, cpl_image_basic.c, cpl_image_binary.c, cpl_image_bpm.c, cpl_image_distortion.c, cpl_image_filter.c, cpl_image_gen.c, cpl_image_io.c, cpl_image_stats.c, cpl_imset_basic.c, cpl_imset_io.c, cpl_objects.c, cpl_polynomial.c, cpl_sparseimage.c, cpl_tools.c, cpl_vector.c: doxygen: added error codes in doc 2003-10-30 09:29 yjung * cplcore/: cpl_error.h, cpl_image_io.c, cpl_image_io.h, cpl_imset_basic.c: removed cpl_image_delete_bpm() (replaced by cpl_image_bpm_reset()) 2003-10-29 16:31 yjung * cplcore/cpl_image_bpm.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_imset_basic.c, tests/cpl_image_io-test.c, tests/cpl_imset_basic-test.c: removed cpl_image_count_badpixels 2003-10-29 16:21 yjung * tests/cpl_image_bpm-test.c: added missing include 2003-10-29 16:15 yjung * tests/cpl_image_filter-test.c: do not use sparse image object any more 2003-10-29 16:13 yjung * cplcore/cpl_image_binary.c, cplcore/cpl_image_bpm.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, tests/cpl_image_io-test.c: removed cpl_image_count_badpixels() 2003-10-29 16:00 yjung * tests/cpl_image_io-test.c: do not use sparse image object any more 2003-10-29 15:52 yjung * cplcore/cpl_image_bpm.c: removed bad test 2003-10-29 15:52 yjung * cplcore/cpl_memory.h: added prototype of cpl_memory_init() 2003-10-29 15:51 yjung * cplcore/cpl_image_stats.c: added missing include 2003-10-29 15:51 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h: changed prototypes of cpl_image_new_type() 2003-10-29 15:34 yjung * tests/cpl_imset_basic-test.c: do not use sparse images any more 2003-10-29 15:34 yjung * tests/cpl_image_bpm-test.c: rm printf() 2003-10-29 15:33 yjung * cplcore/cpl_image_bpm.c: removed a bad test 2003-10-29 15:10 yjung * cplcore/cpl_image_bpm.c: bug in cpl_image_bpm_set_badpix() 2003-10-29 14:49 yjung * tests/cpl_image_filter-test.c: do not use sparse images any more 2003-10-29 14:42 yjung * tests/cpl_image_io-test.c: do not use cpl_sparse objects any more 2003-10-29 14:32 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h: removed cpl_image_add_badpixel() 2003-10-29 14:06 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h: changed prototype of cpl_image_new_type() 2003-10-29 13:51 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h: removed cpl_image_get_badpixelmap() 2003-10-29 13:45 yjung * cplcore/cpl_image_bpm.c: doxygen 2003-10-29 13:43 yjung * tests/cpl_image_bpm-test.c: added a missing include 2003-10-29 13:43 yjung * cplcore/cpl_sparseimage.c: changed cpl_sparseimage_subsample() 2003-10-29 13:34 yjung * cplcore/cpl_sparseimage.c: added a entries test in cpl_sparseimage_subsample() 2003-10-29 13:34 yjung * cplcore/cpl_memory.h: added declaration of cpl_memory_init() 2003-10-29 13:13 yjung * cplcore/cpl_image_bpm.c: doxygen... 2003-10-29 13:01 yjung * tests/: cpl_image_filter-test.c, cpl_image_io-test.c: added include "cpl_sparseimage" - should not be allowed, just temporarly... 2003-10-29 12:55 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: added cpl_sparseimage_add_pixel() 2003-10-29 12:44 yjung * tests/cpl_image_bpm-test.c, cplcore/cpl_image_bpm.c, cplcore/cpl_image_bpm.h: removed cpl_image_bpm_set_from_map() 2003-10-29 12:36 yjung * tests/Makefile.am: added cpl_image_bpm 2003-10-29 12:35 yjung * tests/cpl_image_bpm-test.c: Initial revision 2003-10-29 12:34 yjung * tests/cpl_sparseimage-test.c, cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h: removed cpl_sparseimage_loadmap() 2003-10-29 12:31 yjung * cplcore/: Makefile.am, cpl_image.h: added cpl_image_bpm 2003-10-29 12:30 yjung * cplcore/: cpl_image_bpm.c, cpl_image_bpm.h: Initial revision 2003-10-29 11:49 yjung * tests/cpl_image_bpm-test.c: added tests for all currently existing bpm functions 2003-10-29 11:49 yjung * cplcore/cpl_image_bpm.c: cpl_sparseimage_loadmap() removed and implemented here. 2003-10-29 11:23 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: removed cpl_sparseimage_loadmap() 2003-10-29 11:14 yjung * tests/cpl_sparseimage-test.c: removed cpl_sparseimage_loadmap() 2003-10-29 10:48 yjung * cplcore/cpl_image_bpm.c: fixed a bug in cpl_image_bpm_reset() 2003-10-29 10:32 yjung * cplcore/cpl_image_bpm.c: added a test case im cpl_image_bpm_set_pix 2003-10-29 10:03 yjung * cplcore/cpl_image_bpm.c: added a check 2003-10-28 18:08 yjung * cplcore/Makefile.am: typo 2003-10-28 17:59 yjung * cplcore/: cpl_image_distortion.c, cpl_polynomial.c: doxygen doc small update 2003-10-28 17:46 yjung * cplcore/: cpl_image_binary.c, cpl_image_binary.h, cpl_image_bpm.c, cpl_image_bpm.h, cpl_image_filter.c, cpl_image_stats.c, cpl_imset_basic.c, cpl_imset_basic_body.h, cpl_sparseimage.c: hide cpl_sparseimage to ext user, and add a cpl_image_bpm module for the bad pixels handling interface 2003-10-28 17:45 yjung * tests/Makefile.am: added cpl_image_bpm-test 2003-10-28 17:43 yjung * tests/cpl_image_bpm-test.c: Initial revision 2003-10-28 16:17 yjung * cplcore/cpl_image.h: added cpl_image_bpm module and removed cpl_sparseimage from public place 2003-10-28 16:17 yjung * cplcore/Makefile.am: added cpl_image_bpm module 2003-10-28 16:15 yjung * cplcore/: cpl_image_bpm.c, cpl_image_bpm.h: Initial revision 2003-10-28 16:08 yjung * cplcore/: cpl_image_gen.c, cpl_image_stats.c: doxygen... 2003-10-28 15:04 yjung * cplcore/cpl_image_basic.c, cplcore/cpl_image_basic.h, cplcore/cpl_image_binary.c, cplcore/cpl_image_binary.h, cplcore/cpl_image_filter.c, cplcore/cpl_image_filter.h, cplcore/cpl_image_gen.c, cplcore/cpl_image_gen.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, cplcore/cpl_image_stats.c, cplcore/cpl_image_stats.h, cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h, tests/cpl_sparseimage-test.c: reorganized code (added cpl_image_defs.h, hide cpl_image_stats, hide ccpl_sparseimage...) 2003-10-28 14:10 yjung * cplcore/cpl_image.h: definitions moved to cpl_image_defs.h 2003-10-28 14:09 yjung * cplcore/Makefile.am: added cpl_image_defs.h 2003-10-28 14:07 yjung * cplcore/cpl_image_defs.h: new revision 2003-10-28 13:36 yjung * cplcore/cpl_vector.c: updated doxygen documentation according to Derek's comments 2003-10-28 13:31 yjung * cplcore/cpl_sparseimage.c: updated doxygen documentation according to Derek's comments 2003-10-28 13:26 yjung * cplcore/cpl_image_stats.c: updated doxygen documentation according to Derek's comments 2003-10-28 13:14 yjung * cplcore/cpl_image_io.c: updated doxygen documentation according to Derek's comments 2003-10-28 12:58 yjung * cplcore/cpl_image_gen.c: updated doxygen documentation according to Derek's comments 2003-10-28 12:54 yjung * cplcore/cpl_image_filter.c: updated doxygen documentation according to Derek's comments 2003-10-28 12:49 yjung * cplcore/cpl_image_binary.c: updated doxygen documentation according to Derek's comments 2003-10-28 12:02 yjung * cplcore/cpl_image_basic.c: updated doxygen documentation according to Derek's comments 2003-10-28 11:50 yjung * cplcore/cpl_1dfunction.c: updated doxygen documentation according to Derek's comments 2003-10-28 11:29 yjung * cplcore/: cpl_1dfunction.c, cpl_image_basic.c, cpl_image_binary.c, cpl_image_distortion.c, cpl_image_filter.c, cpl_image_gen.c, cpl_image_io.c, cpl_image_stats.c, cpl_imset_basic.c, cpl_imset_io.c, cpl_objects.c, cpl_polynomial.c, cpl_sparseimage.c, cpl_tools.c, cpl_vector.c: doxygen documentation updated according Derek's comments 2003-10-27 14:58 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h: added cpl_image_subsample() 2003-10-27 14:58 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: added cpl_sparseimage_subsample() 2003-10-27 14:57 yjung * tests/cpl_image_basic-test.c: added test case for cpl_image_subsample() 2003-10-24 13:51 yjung * cplcore/: cpl_1dfunction.h, cpl_image_basic.h, cpl_image_binary.h, cpl_image_defs.h, cpl_image_distortion.h, cpl_image_filter.h, cpl_image_gen.h, cpl_image_io.h, cpl_image_stats.h, cpl_imset_basic.h, cpl_imset_defs.h, cpl_imset_io.h, cpl_memory.h, cpl_objects.h, cpl_polynomial.h, cpl_sparseimage.h, cpl_tools.h, cpl_vector.h: _CPL_BAL_BLA_H_ ---> CPL_BLA_BLA_H 2003-10-23 16:25 yjung * cplcore/cpl_memory_impl.h, tests/cpl_1dfunction-test.c, tests/cpl_image_basic-test.c, tests/cpl_image_binary-test.c, tests/cpl_image_distortion-test.c, tests/cpl_image_filter-test.c, tests/cpl_image_gen-test.c, tests/cpl_image_io-test.c, tests/cpl_image_stats-test.c, tests/cpl_imset_basic-test.c, tests/cpl_imset_io-test.c, tests/cpl_objects-test.c, tests/cpl_polynomial-test.c, tests/cpl_sparseimage-test.c, tests/cpl_vector-test.c: use xmemory functions in the tests 2003-10-23 15:11 yjung * tests/cpl_sparseimage-test.c: typo 2003-10-23 15:10 yjung * tests/: cpl_image_basic-test.c, cpl_image_binary-test.c, cpl_image_distortion-test.c, cpl_image_filter-test.c, cpl_image_gen-test.c, cpl_image_io-test.c, cpl_image_stats-test.c, cpl_imset_basic-test.c, cpl_imset_io-test.c, cpl_objects-test.c, cpl_polynomial-test.c, cpl_sparseimage-test.c, cpl_vector-test.c: call cpl_init() to use xmemory 2003-10-23 15:02 yjung * tests/cpl_1dfunction-test.c: use the xmemory model (call cpl_init()) 2003-10-23 14:13 yjung * cplcore/cpl_image_io.c: changed cpl_image_save() prototype to use cpl_plist instead of qfits_header 2003-10-23 14:09 yjung * tests/cpl_image_io-test.c: change in cpl_image_save prototype 2003-10-23 14:09 yjung * cplcore/cpl_image_io.h: changed cpl_image_save() prototype to use cpl_plist instead of qfits_header 2003-10-23 13:51 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h: changed cpl_image_save() prototype to use cpl_plist instead of qfits_header 2003-10-21 15:23 rpalsa * cplexec/cpl_exec.c: Program information updated. 2003-10-21 15:22 rpalsa * cplexec/cpl_exec.h: Symbol APP_DATE removed. 2003-10-01 16:09 cizzo * cplcore/: cpl_column.c: Fix bug in cpl_column_min() and cpl_column_max() 2003-10-01 13:11 cizzo * cplcore/: cpl_column.c: Fix bug in cpl_column_minpos() and cpl_column_maxpos() 2003-10-01 11:20 cizzo * cplcore/: cpl_table.c, cpl_table.h: Fix error in the interface 2003-10-01 10:09 cizzo * cplcore/cpl_table.c: Fix error in the documentation 2003-09-30 14:32 cplmgr * configure.ac: Check endianess of target system 2003-09-29 16:14 cplmgr * AUTHORS: Updated 2003-09-29 15:17 cplmgr * libcext/: AUTHORS, BUGS, COPYING, INSTALL, NEWS, README, TODO: Added 2003-09-29 11:59 cplmgr * ChangeLog: Updated for 1.0b 2003-09-29 11:58 cplmgr * libcext/ChangeLog: Added. 2003-09-29 10:58 yjung * cplcore/: cpl_1dfunction.c, cpl_vector.c: added Synopsys/doxygen info 2003-09-29 10:54 yjung * cplcore/: cpl_1dfunction.c, cpl_image_basic.c, cpl_image_binary.c, cpl_image_filter.c, cpl_image_gen.c, cpl_image_io.c, cpl_image_stats.c, cpl_sparseimage.c, cpl_vector.c: added doxygen info on which file to include... 2003-09-29 09:42 cplmgr * configure.ac, libcext/configure.ac: Package version changed. 2003-09-29 09:27 cplmgr * configure.ac, libcext/configure.ac: Package version change reverted 2003-09-29 09:13 cplmgr * configure.ac, libcext/configure.ac: Package version changed 2003-09-24 14:59 rpalsa * cplui/cpl_plugin.h: Previous change reverted. The typedef of cpl_plugin moved back in front of the structure definition. 2003-09-24 09:42 rpalsa * cplui/cpl_plugin.h: Move typedef struct _cpl_plugin_ after structure declaration. 2003-09-17 14:42 rpalsa * tests/cpl_pluginlist-test.c: Offending cpl_plugin_delete() calls removed. 2003-09-17 14:06 rpalsa * cplui/cpl_pluginlist.c: Bug fixed in cpl_pluginlist_next() 2003-09-09 21:34 yjung * cplcore/: cpl_objects.c, cpl_polynomial.c: small warnings corrected 2003-09-09 21:22 yjung * cplcore/cpl_sparseimage.c: added a forgotten #include "cp_tools.h" 2003-09-08 14:46 mkiesgen * tests/cpl_pluginlist-test.c: Fixed call to changed Function names 2003-09-05 10:49 yjung * tests/cpl_objects-test.c: added an include 2003-09-05 10:48 yjung * tests/cpl_polynomial-test.c: removed unused var. 2003-09-05 10:39 yjung * tests/cpl_objects-test.c: use accessor functions 2003-09-05 10:37 yjung * cplcore/cpl_objects.c: typo 2003-09-05 10:20 yjung * cplcore/: cpl_objects.c, cpl_objects.h: added accessor functions 2003-09-05 10:00 yjung * cplcore/cpl_objects.c: added cpl_objects_sort_max() and cpl_objects_sort_flux() 2003-09-05 09:48 yjung * cplcore/: cpl_objects.c, cpl_objects.h: added cpl_objects_sort_npix() 2003-09-04 17:43 yjung * tests/cpl_objects-test.c: some additional tests 2003-09-04 17:43 yjung * cplcore/: cpl_objects.c, cpl_objects.h: some new functions added 2003-09-04 15:21 yjung * tests/cpl_objects-test.c: added an include 2003-09-04 15:20 yjung * cplcore/cpl_objects.c: added some includes 2003-09-04 14:32 yjung * cplcore/cpl_image_stats.c: cosmetics 2003-09-04 13:55 yjung * tests/cpl_objects-test.c: added missing includes 2003-09-04 13:40 yjung * tests/Makefile.am: added cpl_objects-test 2003-09-04 13:40 yjung * tests/cpl_objects-test.c: Initial revision 2003-09-04 11:42 yjung * cplcore/cpl_objects.h: added some functions declarations 2003-09-04 11:38 yjung * cplcore/cpl_image_distortion.c: added doc 2003-09-04 11:12 yjung * cplcore/: cpl_image_binary.c, cpl_1dfunction.c: cosmetics 2003-09-04 11:08 yjung * cplcore/: cpl_image_stats.c, cpl_image_gen.c, cpl_image_filter.c: cosmetics 2003-09-04 11:06 yjung * cplcore/cpl_imset_io.c: remived cxstrutils dependency 2003-09-04 11:03 yjung * cplcore/cpl_polynomial.c: removed cxchar 2003-09-04 11:02 yjung * cplcore/cpl_vector.c: cosmetics 2003-09-04 10:39 yjung * cplcore/cpl_objects.c: various corrections 2003-09-04 10:21 yjung * cplcore/Makefile.am: added cpl_objects 2003-09-04 10:20 yjung * cplcore/cpl_objects.h: include only image definition 2003-09-03 17:47 yjung * tests/cpl_image_distortion-test.c: cosmetics 2003-09-03 17:44 yjung * cplcore/cpl_image_distortion.c, cplcore/cpl_image_distortion_body.h, tests/cpl_image_distortion-test.c: added cpl_image_distortion_poly() and tested it 2003-09-03 15:57 yjung * tests/cpl_image_distortion-test.c: first usable version 2003-09-03 15:12 yjung * cplcore/cpl_image_distortion.c: added include "math.h" 2003-09-03 14:44 cizzo * cplcore/: cpl_matrix.h: eliminate unused prototype 2003-09-03 14:17 yjung * cplcore/: cpl_image_distortion.c, cpl_image_distortion.h: moved #include cpl_tools.h from .c to .h 2003-09-03 14:11 yjung * tests/Makefile.am: added cpl_image_distortion-test 2003-09-03 14:11 yjung * tests/cpl_image_distortion-test.c: Initial revision 2003-09-02 17:56 yjung * cplcore/cpl_tools.c: added sinc() 2003-09-02 17:43 yjung * cplcore/: cpl_image_distortion.c, cpl_image_distortion.h, cpl_image_distortion_body.h: added cpl_image_distortion_linear() 2003-09-02 17:42 yjung * cplcore/: cpl_tools.c, cpl_tools.h: added cpl_interpolation_kernel() 2003-09-02 17:01 yjung * cplcore/cpl_image.h: added cpl_image_distortion.h 2003-09-02 13:22 yjung * cplcore/Makefile.am: added cpl_image_distortion 2003-09-02 13:21 yjung * cplcore/: cpl_image_distortion.c, cpl_image_distortion.h, cpl_image_distortion_body.h: New revision - still empty 2003-09-02 11:29 yjung * cplcore/: cpl_polynomial.c, cpl_polynomial.h: changed cpl_polynomial_new() and first working revision 2003-09-02 11:28 yjung * tests/cpl_polynomial-test.c: functions successfully tested 2003-09-01 17:24 yjung * tests/Makefile.am: added cpl_polynomial 2003-09-01 17:08 yjung * tests/Makefile.am: added cpl_polynomial 2003-09-01 17:08 yjung * tests/cpl_polynomial-test.c: Initial revision 2003-09-01 16:40 yjung * cplcore/: cpl_polynomial.c, cpl_polynomial.h: typo 2003-09-01 16:21 yjung * cplcore/cpl_polynomial.c: typo 2003-09-01 14:39 yjung * cplcore/Makefile.am: added cpl_polynomial.[ch] 2003-09-01 14:32 yjung * cplcore/: cpl_polynomial.c, cpl_polynomial.h: New revision 2003-09-01 11:24 cizzo * cplcore/: cpl_table.c, cpl_table.h: Added function cpl_table_erase_unselected() 2003-08-29 15:27 rpalsa * cplui/cpl_parameter.c: Typo fixed. 2003-08-29 15:25 rpalsa * cplexec/cpl_exec_plugin_process.c: Adapted to API changes in cpl_pluginlist. 2003-08-29 15:23 rpalsa * cplui/: cpl_pluginlist.c, cpl_pluginlist.h: API cleanup 2003-08-29 15:19 rpalsa * cplui/cpl_parameter.h: Return types updated. 2003-08-29 15:19 rpalsa * cplui/cpl_parameter.c: Return types updated. Function documentation added (partially). 2003-08-29 10:34 rpalsa * libcext/cext/cxstrutils.c: Fixes from branch CPL-1_0-BRANCH, Revision 1.1.2.1 imported. 2003-08-29 10:34 rpalsa * libcext/cext/cxstring.c: Fixes from branch CPL-1_0-BRANCH, Revision 1.3.2.1 imported. 2003-08-29 10:31 rpalsa * libcext/cext/cxtree.c: Fixes from branch CPL-1_0-BRANCH, Revision 1.4.2.1 imported. 2003-08-29 10:29 rpalsa * libcext/cext/: cxmap.c, cxmultimap.c: Fixes from branch CPL-1_0-BRANCH, Revision 1.1.2.1 imported. 2003-08-29 10:27 rpalsa * libcext/cext/cxmessages.h: Fixes from branch CPL-1_0-BRANCH, Revision 1.2.2.1 imported. 2003-08-29 10:26 rpalsa * cplcore/cpl_plist.c: Fixes from branch CPL-1_0-BRANCH, revision 1.4.2.9 added. 2003-08-29 09:43 rpalsa * libcext/cext/: cxmap.c, cxmultimap.c, cxstring.c, cxstrutils.c, cxtree.c: Typos fixed. 2003-08-26 14:27 rpalsa * cplcore/cpl_plist.c: Typo fixed. 2003-08-25 14:25 cizzo * cplcore/cpl_table.c: Rewrite cpl_table_print() 2003-08-25 14:25 cizzo * cplcore/cpl_column.c: Change default column formats 2003-08-25 14:23 cizzo * tests/cpl_table-test.c: [no log message] 2003-08-25 14:18 cizzo * cplcore/cpl_table.c: Rewrite cpl_table_print() 2003-08-25 14:18 cizzo * cplcore/cpl_column.c: Change default column formats 2003-08-25 09:21 rpalsa * libcext/cext/cxmessages.h: Typo fixed. 2003-08-22 11:10 cizzo * cplexec/: cpl_exec_params_process.c, cpl_exec_params_utils.c: Change name of few functions 2003-08-22 10:44 cizzo * tests/cpl_table-test.c: Add tests for cpl_table_load() and cpl_table_save() 2003-08-22 10:43 cizzo * cplcore/cpl_table.c: First fully tested (on Linux) version of cpl_table_save() 2003-08-22 10:38 cizzo * tests/cpl_table-test.c: Add tests for cpl_table_load() and cpl_table_save() 2003-08-22 10:37 cizzo * cplcore/cpl_table.c: First fully tested version of cpl_table_save() 2003-08-21 16:16 cizzo * cplcore/: cpl_column.c: Fix uninitialized pointers in cpl_column_code_null_TYPE() functions 2003-08-21 12:57 cizzo * cplui/: cpl_parameter.c, cpl_parameter.h: Shorten the name of a few functions, and eliminate cpl_parameter_enum_set_element_int() 2003-08-21 08:49 cizzo * cplcore/: cpl_table.c: Fix a problem with headers. There is still a problem with NULL values coding in FITS, but this seems to be related to qfits. This routine should still not be considered tested. 2003-08-20 14:23 cizzo * cplcore/: cpl_table.c, cpl_table.h: Add cpl_table_save(). The function is not yet completely tested 2003-08-20 10:37 llundin * cplcore/cpl_tools.c: Added environment var. CPL_SRAND_CONST to set the srand argument to the constant 1 2003-08-19 17:08 cizzo * cplcore/: cpl_messaging.c: Restore original print and error handlers at msg_stop() 2003-08-18 09:10 cizzo * cplcore/: cpl_plist.c, cpl_plist.h: Add cpl_plist_prepend_TYPE() 2003-08-18 09:03 cizzo * cplcore/: cpl_plist.c, cpl_plist.h: Add cpl_plist_prepend_TYPE() 2003-08-14 13:12 rpalsa * cplexec/cpl_exec_plugin_process.c: Print proper error message if plugin TOC could not be found. 2003-08-13 13:35 yjung * cplcore/cpl_messaging.h: use CPL_END_DECLS and CPL_BEGIN_DECLS 2003-08-13 13:27 yjung * cplcore/: cpl_1dfunction.c, cpl_image_basic.c, cpl_image_binary.c, cpl_image_filter.c, cpl_image_gen.c, cpl_image_io.c, cpl_image_stats.c, cpl_imset_basic.c, cpl_imset_io.c, cpl_objects.c, cpl_sparseimage.c, cpl_tools.c, cpl_vector.c: use #include "cpl_memory_impl.h" 2003-08-13 13:18 yjung * cplcore/cpl_memory_impl.h: added #include "cpl_macros.h" 2003-08-13 12:54 yjung * cplcore/cpl_memory_impl.h: added #include "cpl_macros.h" 2003-08-13 10:00 yjung * cplcore/: cpl_1dfunction.c, cpl_image_basic.c, cpl_image_binary.c, cpl_image_filter.c, cpl_image_gen.c, cpl_image_io.c, cpl_image_stats.c, cpl_sparseimage.c, cpl_tools.c, cpl_vector.c: replaced #include "cxmemory.h" by #include "cpl_memory_impl.h" 2003-08-13 09:57 rpalsa * cplcore/Makefile.am: Private header file cpl_memory_impl.h added. 2003-08-13 09:55 rpalsa * cplcore/cpl_memory_impl.h: Added from CPL-1_0-BRANCH 2003-08-13 09:48 rpalsa * cplcore/cpl_plist.c, cplcore/cpl_property.c, cplui/cpl_frame.c, cplui/cpl_frameset.c, cplui/cpl_parameter.c, cplui/cpl_parlist.c, cplui/cpl_plugin.c, cplui/cpl_pluginlist.c: Changes to memory service calls reverted. 2003-08-13 09:47 rpalsa * cplcore/cpl_memory_impl.h: Go directly to the cxmemory services. 2003-08-12 17:01 rpalsa * cplcore/cpl_plist.c, cplcore/cpl_property.c, cplui/cpl_frame.c, cplui/cpl_frameset.c, cplui/cpl_parameter.c, cplui/cpl_parlist.c, cplui/cpl_plugin.c, cplui/cpl_pluginlist.c: Memory services changed 2003-08-12 16:21 rpalsa * cplcore/Makefile.am: Private header cpl_memory_impl.h file added. 2003-08-12 16:20 rpalsa * cplcore/cpl_memory_impl.h: Added 2003-08-07 11:55 cizzo * cplcore/: cpl_column.c: Eliminate memory leak in column destructor 2003-08-05 17:06 mkiesgen * cplexec/cpl_exec_params_process.c: Fixed help system for plugin/recipe handling 2003-08-05 12:53 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h, cpl_sparseimage.c, cpl_sparseimage.h, cpl_tools.c, cpl_tools.h: added cpl_image_flip_local() cpl_sparseimage_flip_local() cpl_tools_sort_iarray() 2003-08-05 11:31 yjung * tests/cpl_image_basic-test.c: added tests for cpl_image_flip_local() 2003-08-05 10:49 yjung * tests/: cpl_image_filter-test.c, cpl_imset_basic-test.c: removed some products creation 2003-08-05 10:43 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h, cpl_sparseimage.c, cpl_sparseimage.h: added cpl_image_flip_local() and cpl_sparseimage_flip_local() 2003-08-04 16:05 yjung * cplcore/: cpl_1dfunction.c, cpl_image.h, cpl_image_basic.c, cpl_image_basic.h, cpl_image_binary.c, cpl_image_binary.h, cpl_image_filter.c, cpl_image_filter.h, cpl_image_gen.c, cpl_image_gen.h, cpl_image_io.c, cpl_image_io.h, cpl_image_stats.c, cpl_image_stats.h, cpl_sparseimage.c, cpl_sparseimage.h, cpl_tools.c, cpl_tools.h, cpl_vector.c: removed #include "xmemory.h" an added #include "cxmemory.h" 2003-08-04 15:50 yjung * cplcore/: cpl_image_basic.c, cpl_image_io.c: corrected compilation warning 2003-08-04 15:37 yjung * cplcore/: cpl_1dfunction.c, cpl_image_basic.c, cpl_image_binary.c, cpl_image_defs.h, cpl_image_filter.c, cpl_image_gen.c, cpl_image_io.c, cpl_image_stats.c, cpl_imset_basic.c, cpl_imset_defs.h, cpl_imset_io.c, cpl_objects.c, cpl_sparseimage.c, cpl_tools.c, cpl_tools.h, cpl_vector.c: removed #include "xmemory.h" and added #include "cxmemory.h" 2003-07-29 11:36 rpalsa * cplexec/cpl_exec_plugin_process.c: File sequence number and suffix handling fixed. 2003-07-24 16:35 rpalsa * cplcore/Makefile.am: Source modules cpl_init and cpl_memory added. 2003-07-24 16:24 rpalsa * acinclude.m4: Fixes from CPL-1_0-BRANCH, Revision 1.11.2.2 imported 2003-07-24 16:19 rpalsa * cplcore/cpl_plist.c: Fixes from CPL-1_0-BRANCH, Revision 1.4.2.5 imported 2003-07-24 16:13 rpalsa * cplcore/cpl_table.c: Fixes from CPL-1_0-BRANCH, Revision 1.37.2.10 imported 2003-07-24 16:00 rpalsa * libcext/cext/snprintf.c: Conflicts resolved. 2003-07-24 15:58 rpalsa * libcext/cext/snprintf.c: Fixes from CPL-1_0-BRANCH, Revision 1.1.2.3 imported. 2003-07-24 15:55 rpalsa * libcext/cext/snprintf.c: Correct order of symbol definition for call redirection. 2003-07-24 14:44 rpalsa * cplcore/: cpl_init.c, cpl_init.h, cpl_memory.c, cpl_memory.h: Added from CPL-1_0-BRANCH 2003-07-24 14:42 rpalsa * cplui/cpl_parameter.c: Fixes form CPL-1_0-BRANCH, Revision 1.2.2.5 imported 2003-07-24 14:38 rpalsa * cplui/cpl_plugin.h: Fixes form CPL-1_0-BRANCH, Revision 1.3.2.3 imported 2003-07-24 14:33 rpalsa * libcext/cext/cxmessages.c: Fixes from CPL-1_0-BRANCH, Revision 1.2.2.1 imported. 2003-07-24 14:32 rpalsa * libcext/cext/cxutils.c: Fixes from CPL-1_0-BRANCH, Revision 1.3.2.1 imported. 2003-07-24 14:30 rpalsa * libcext/cext/snprintf.c: Fixes from CPL-1_0-BRANCH, Revision 1.1.2.2 imported. 2003-07-24 14:29 rpalsa * libcext/cext/snprintf.h: Fixes from CPL-1_0-BRANCH, Revision 1.2.2.1 imported. 2003-07-24 14:09 rpalsa * libcext/cext/cxutils.c: Add macros to redirect calls to snprintf() and vsnprintf(). 2003-07-24 14:08 rpalsa * libcext/cext/: snprintf.c, snprintf.h: Do not use system function names for API. 2003-07-24 14:04 rpalsa * libcext/cext/cxmessages.c: Replace vsnprintf() call with cx_vsnprintf(). 2003-07-24 11:52 llundin * cplcore/: cpl_error.c, cpl_error.h: See version 1.13 and 1.21 in HEAD 2003-07-23 17:33 llundin * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: Allowed NULL input in cpl_sparseimage_extract() and added assert(). Added accessors. 2003-07-23 16:00 llundin * cplcore/cpl_image_basic_body.h, cplcore/cpl_image_binary.c, cplcore/cpl_image_filter_body.h, cplcore/cpl_image_gen_body.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, tests/cpl_image_io-test.c, tests/cpl_sparseimage-test.c: Added pointer args to cpl_image_new_{double,float,int,bin}() 2003-07-23 14:52 llundin * cplcore/: cpl_image_io.c, cpl_image_io.h: Added const qualifier to second arg of cpl_image_set_type() 2003-07-23 14:47 llundin * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h: Added const qualifier to cpl_image_new_{double,float,int,bin}() 2003-07-23 14:47 rpalsa * cplcore/cpl_plist.c: _cpl_plist_decode_fits(): Empty values (NULL) for HISTORY keyword is handled correctly. 2003-07-23 14:37 llundin * cplcore/cpl_image_basic_body.h, cplcore/cpl_image_binary.c, cplcore/cpl_image_filter_body.h, cplcore/cpl_image_gen_body.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, cplcore/cpl_imset_basic_body.h, cplcore/cpl_sparseimage.c, tests/cpl_image_io-test.c, tests/cpl_sparseimage-test.c: Added pointer args to cpl_image_new_{double,float,int,bin}() 2003-07-23 11:31 llundin * cplcore/cpl_sparseimage.c: use assert() to verify internal consistency 2003-07-22 15:11 rpalsa * cplui/cpl_plugin.h: Change order of enum _cpl_plugin_type_ and the corresponding typedef. 2003-07-22 09:17 llundin * cplcore/cpl_sparseimage.c: Improved argument check in cpl_sparseimage_rotate_int_local() & cpl_sparseimage_extract() & cpl_sparseimage_collapse() 2003-07-21 18:20 llundin * tests/cpl_image_basic-test.c: return CPL_ERROR_NONE 2003-07-21 18:19 llundin * cplcore/cpl_sparseimage.c: Allowed for NULL input in cpl_sparseimage_rotate_int_local() & cpl_sparseimage_extract() & cpl_sparseimage_collapse() 2003-07-21 14:29 llundin * cplcore/cpl_image_stats.c: Fix firstgoodpos bug in cpl_image_stat_subw() 2003-07-21 14:16 llundin * cplcore/cpl_image_basic.c: Fixed scale bug in cpl_image_normalize() 2003-07-21 14:14 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h: Numerically robusted & fixed scale bug in cpl_image_normalize(). Add const qualifier to args of cpl_image_threshold(). Identifier rename in prep. for BPM in arithmetics. 2003-07-21 14:11 llundin * cplcore/: cpl_image_stats.c, cpl_image_stats.h: Fix firstgoodpos bug in cpl_image_stat_subw(). Add const qualifier to function arguments 2003-07-17 13:53 rpalsa * cplcore/Makefile.am: Source modules cpl_init and cpl_memory added. 2003-07-17 13:53 rpalsa * cplcore/: cpl_init.c, cpl_init.h, cpl_memory.c, cpl_memory.h: Added. 2003-07-17 13:48 rpalsa * cplexec/cpl_exec_plugin_process.c: Do not create plugin list list_of_pllib_names using ce_stringarray_new(). Terminal/log file appearance changed. 2003-07-17 13:47 rpalsa * cplexec/cpl_exec.c: Add library initialization. 2003-07-17 10:38 rpalsa * cplcore/cpl_table.c: In cpl_table_or_select_string(): Properly deallocate compliled regular expression 2003-07-17 10:37 rpalsa * cplcore/cpl_plist.c: In cpl_plist_erase_regexp(): Properly deallocate compliled regular expression 2003-07-17 10:31 cizzo * cplcore/: cpl_matrix.c: Avoid memory leak in solve_system() 2003-07-17 09:59 cizzo * cplcore/: cpl_table.c: Fix memory leak from incomplete cpl_table destructor 2003-07-17 09:46 yjung * cplcore/cpl_image_filter.c: typo 2003-07-17 09:38 yjung * cplcore/cpl_image_filter.c, cplcore/cpl_image_filter.h, cplcore/cpl_image_filter_body.h, tests/cpl_image_filter-test.c: changed cpl_image_filter_bpm -> cpl_image_filter and cpl_image_filter -> cpl_image_filter_nobpm (in static) 2003-07-16 17:49 yjung * tests/cpl_image_filter-test.c: changed filtering functiuons names 2003-07-16 17:45 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: rm a const 2003-07-16 17:36 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter.h, cpl_image_filter_body.h: changed filter functions names 2003-07-16 17:15 yjung * cplcore/cpl_image_filter.c, cplcore/cpl_image_filter_body.h, tests/cpl_image_filter-test.c: enhanced the bad pixel maps handling in filtering functions 2003-07-16 15:39 mkiesgen * cplexec/cpl_exec_plugin_process.c: Fixed memory leaks Fixed 78 char 2003-07-16 14:16 mkiesgen * cplui/cpl_pluginlist.c: Fixed 78 char 2003-07-16 14:16 mkiesgen * cplui/cpl_plugin.h: Added new functions prototype 2003-07-16 14:15 mkiesgen * cplui/cpl_plugin.c: Fixed 78 char Added new functions 2003-07-16 14:13 mkiesgen * cplexec/cpl_exec_utils.h: Fixed header 2003-07-16 14:13 mkiesgen * cplexec/cpl_exec_utils.c: Fixed 78 char 2003-07-16 14:12 mkiesgen * cplexec/cpl_exec_stringarray.h: Fixed header Added new functions 2003-07-16 14:12 mkiesgen * cplexec/cpl_exec_stringarray.c: Fixed memory leaks Fixed 78 char Storage into array in now always a complete object (string) and never a reference 2003-07-16 14:09 mkiesgen * cplexec/: cpl_exec_params_process.h, cpl_exec_params_utils.h: Fixed header 2003-07-16 14:09 mkiesgen * cplexec/cpl_exec_params_process.c: Fixed memory leaks Fixed 78 char 2003-07-16 14:08 mkiesgen * cplexec/: cpl_exec.c, cpl_exec_params_utils.c: Fixed 78 char 2003-07-15 16:12 yjung * cplcore/: cpl_image_io_body.h: forgot to initialize ql.map 2003-07-15 15:53 yjung * tests/cpl_image_basic-test.c: changed a call 2003-07-15 15:39 yjung * cplcore/: cpl_image_binary.c, cpl_image_binary.h, cpl_image_filter.c, cpl_image_stats.c: changed prototype of cpl_image_binary_from_sparse() and added cpl_image_binary_from_sparse_subw() 2003-07-15 15:25 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h, cpl_image_binary.c, cpl_image_binary.h, cpl_image_filter.c, cpl_image_stats.c, cpl_imset_basic.c, cpl_imset_basic_body.h, cpl_sparseimage.c, cpl_sparseimage.h: - added correct output badpixel maps in collapsing functions. - added cpl_image_binary_from_sparse_subw() and changed prototype of cpl_image_binary_from_sparse() - added cpl_sparseimage_collapse() 2003-07-15 13:23 llundin * cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h, tests/cpl_sparseimage-test.c: const in cpl_sparseimage_new() + added documentation & assertions 2003-07-15 13:07 llundin * cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h, tests/cpl_image_io-test.c, tests/cpl_sparseimage-test.c: cpl_sparseimage_add_pixel() & cpl_image_add_badpixel() 2003-07-15 12:53 yjung * tests/cpl_imset_basic-test.c: added test case for cpl_imset_time_median() 2003-07-15 12:47 yjung * cplcore/cpl_imset_basic_body.h: correct a bug in cpl_imset_time_median() 2003-07-15 11:46 yjung * tests/cpl_imset_basic-test.c: removed a bug 2003-07-15 11:32 yjung * tests/cpl_imset_basic-test.c: added tests on cpl_imset_time_median(0 2003-07-15 11:08 yjung * cplcore/: cpl_imset_basic.c, cpl_imset_basic.h, cpl_imset_basic_body.h: added cpl_imset_time_median() 2003-07-14 15:50 llundin * cplcore/cpl_image_binary.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, tests/cpl_image_io-test.c: rename to cpl_image_count_badpixels() 2003-07-14 15:21 llundin * cplcore/cpl_image_binary.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_imset_basic.c, tests/cpl_image_io-test.c, tests/cpl_imset_basic-test.c: rename to cpl_image_count_badpixels(). Fixed return value of cpl_imset_time_badpixels 2003-07-14 14:50 rpalsa * cplexec/cpl_exec.c: Parameter definitions corrected. 2003-07-14 14:48 rpalsa * cplexec/cpl_exec_params_process.c: Missing break statement added in params_parse_config_postprocess(). 2003-07-14 14:47 rpalsa * cplexec/cpl_exec_plugin_process.c: Standard header included. Terminal message default changed to CPL_MSG_INFO, verbose changed to CPL_MSG_DEBUG 2003-07-14 14:41 rpalsa * cplexec/cpl_exec_plugin_process.h: Standard header included, Cleaned up. 2003-07-14 14:39 rpalsa * cplui/cpl_parameter.c: On parameter definition, set the parameter's current value to its default. Note this has consequences for the function calling sequence. 2003-07-14 14:32 llundin * cplcore/cpl_imset_basic.c: Improved comments. Added assert() 2003-07-14 13:26 llundin * cplcore/: cpl_imset_basic.c, cpl_imset_defs.h: cpl_imset_time_badpixels() 2003-07-14 09:40 cizzo * cplcore/: cpl_matrix.c, cpl_table.c: Import changes from CPL-1_0-BRANCH 2003-07-14 09:36 cizzo * cplcore/cpl_table.c: Include xmemory.h and another minor fix 2003-07-14 09:15 rpalsa * cplcore/cpl_matrix.c: In cpl_matrix_min(), cpl_matrix_max(): Size is decremented before being used. Allocs/frees replaced by cxmemory calls. Headers referring to qfits/xmemory removed. 2003-07-14 09:13 rpalsa * cplcore/cpl_table.c: Fix assertion in cpl_table_unselect_row(). 2003-07-11 17:04 yjung * cplcore/: cpl_image_basic.c, cpl_image_io.c, cpl_sparseimage.c, cpl_tools.c: warning removed 2003-07-11 17:01 yjung * tests/cpl_imset_basic-test.c: ... 2003-07-11 16:54 yjung * tests/cpl_image_stats-test.c: removed some debug code 2003-07-11 16:26 yjung * cplcore/cpl_imset_basic.c, cplcore/cpl_imset_basic.h, cplcore/cpl_imset_basic_body.h, tests/cpl_image_stats-test.c, tests/cpl_imset_basic-test.c: added cpl_imset_time_stdev() 2003-07-11 16:13 llundin * cplcore/cpl_error.h: Included cpl_messaging.h 2003-07-11 16:01 rpalsa * cplui/: cpl_parameter.c, cpl_parameter.h: libcext types removed from interface. 2003-07-11 15:59 llundin * cplcore/cpl_sparseimage.c: Adhered to bad-pixel convention in cpl_sparseimage_from_binary() 2003-07-11 09:24 llundin * tests/cpl_sparseimage-test.c: Add CPL_MSG_DEBUG output 2003-07-10 14:12 llundin * cplcore/cpl_error.h: Added cpl_msg_debug to CPL_ASSURE 2003-07-10 11:42 rpalsa * cplui/cpl_parameter.c: Robustness against not set string value added to cpl_parameter_print() 2003-07-10 11:28 rpalsa * cplui/cpl_parameter.c: Robustness against not set attributes added to cpl_parameter_print() 2003-07-09 17:44 mkiesgen * cplexec/cpl_exec_plugin_process.c: Program flow to handle logfile was wrong 2003-07-09 11:27 mkiesgen * cplexec/cpl_exec_plugin_process.c: Program flow to handle logfile was wrong 2003-07-08 19:59 mkiesgen * cplui/cpl_plugin.h: Removed doxygen tag which was there by mistake 2003-07-08 19:58 mkiesgen * cplexec/: cpl_exec_params_process.c, cpl_exec_params_process.h, cpl_exec_params_utils.c, cpl_exec_plugin_process.c, cpl_exec_utils.c: Various small bugfixes needed to get cplexec working properly 2003-07-08 16:52 yjung * cplcore/: cpl_image_basic.c, cpl_image_binary.c, cpl_image_filter.c, cpl_image_gen.c, cpl_image_io.c, cpl_image_stats.c, cpl_imset_basic.c, cpl_imset_io.c, cpl_sparseimage.c: doxygen 2003-07-08 15:35 yjung * cplcore/Makefile.am, cplcore/cpl_imset.h, cplcore/cpl_imset_basic.c, cplcore/cpl_imset_basic.h, cplcore/cpl_imset_defs.h, cplcore/cpl_imset_io.c, cplcore/cpl_imset_io.h, tests/cpl_imset_basic-test.c, tests/cpl_imset_io-test.c: moved imset definition in cpl_imset_defs.h and changed includes accordingly 2003-07-08 14:57 yjung * cplcore/cpl_image_binary.c: doxygen 2003-07-08 14:46 yjung * cplcore/Makefile.am: added cpl_image_defs.h 2003-07-08 14:45 yjung * tests/: cpl_image_binary-test.c, cpl_image_gen-test.c: forgot includes 2003-07-08 14:37 yjung * cplcore/: cpl_image_gen.c, cpl_image_stats.c, cpl_sparseimage.c: forgot some includes 2003-07-08 14:26 yjung * cplcore/cpl_image.h, cplcore/cpl_image_basic.c, cplcore/cpl_image_basic.h, cplcore/cpl_image_binary.c, cplcore/cpl_image_binary.h, cplcore/cpl_image_defs.h, cplcore/cpl_image_filter.c, cplcore/cpl_image_filter.h, cplcore/cpl_image_gen.c, cplcore/cpl_image_gen.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_stats.c, cplcore/cpl_image_stats.h, cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h, tests/cpl_image_basic-test.c, tests/cpl_image_binary-test.c, tests/cpl_image_filter-test.c, tests/cpl_image_gen-test.c, tests/cpl_image_io-test.c, tests/cpl_image_stats-test.c, tests/cpl_sparseimage-test.c: reorganized the includes to put the image definition in cpl_image_defs.h 2003-07-08 13:08 rpalsa * cplexec/Makefile.am: Library dependencies for LIBCPLCORE, LIBCEXT and LIBQFITS removed. LIBCPLUI depends on LIBCPLCORE which in turn depends on the others. 2003-07-08 12:53 yjung * cplcore/cpl_image.h, cplcore/cpl_image_binary.c, cplcore/cpl_image_io.c, cplcore/cpl_image_io_body.h, cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h, tests/cpl_sparseimage-test.c: put the cpl_image and cpl_sparseimage definitions in the cpl_sparseimage.c and added accessors functions for sparseimage objects 2003-07-08 12:06 rpalsa * cplexec/getopt/: getopt.c, getopt.h, getopt1.c: Added. 2003-07-08 12:05 rpalsa * cplexec/cpl_exec_params_process.c: Check on HAVE_GETOPT_LONG added. 2003-07-08 12:04 rpalsa * cplexec/Makefile.am: Add getopt extra sources (compiled on demand) 2003-07-08 12:02 rpalsa * configure.ac: Call to CPL_FUNC_GETOPT added. 2003-07-08 12:02 rpalsa * acinclude.m4: Macro CPL_FUNC_GETOPT added. 2003-07-07 18:49 yjung * cplcore/cpl_image.h, cplcore/cpl_image_basic.c, cplcore/cpl_image_stats.c, cplcore/cpl_image_stats.h, tests/cpl_sparseimage-test.c: made cpl_image_stats struct invisible and added accessor functions in cpl_image_stats.h 2003-07-07 17:19 yjung * cplcore/cpl_sparseimage.c: doxygen 2003-07-07 17:15 yjung * cplcore/: cpl_image_io.c, cpl_image_stats.c: doxygen 2003-07-07 17:11 yjung * cplcore/: cpl_1dfunction.c, cpl_image_basic.c, cpl_image_binary.c: doxygen 2003-07-07 17:07 yjung * cplcore/: cpl_image_stats.c, cpl_sparseimage.c: doxygen 2003-07-07 17:01 yjung * cplcore/: cpl_image_binary.c, cpl_image_io.c: doxygen 2003-07-07 16:58 yjung * cplcore/: cpl_1dfunction.c, cpl_image_basic.c: doxygen 2003-07-07 16:13 yjung * cplcore/: cpl_image_io.c: cast filename 2003-07-07 16:00 cizzo * cplcore/cpl_matrix.c: Remove unsupported LaTeX commands 2003-07-07 15:55 cizzo * cplcore/: cpl_column.c, cpl_matrix.c, cpl_table.c: Correct wrong docs 2003-07-07 15:54 rpalsa * cplexec/cplexecrc.in: Added. 2003-07-07 15:54 rpalsa * cplexec/: caller.conf.tmpl, demo.sh: Abandoned. 2003-07-07 15:49 rpalsa * cplexec/Makefile.am: Header files added. Library dependencies added. Add config file to installation. 2003-07-07 15:48 rpalsa * cplexec/cpl_exec.c: Location and name of the configuration file has changed. Version is now the package version. 2003-07-07 15:47 rpalsa * cplexec/cpl_exec.h: Location and name of the configuration file has changed. 2003-07-07 15:44 rpalsa * configure.ac: Create cplexec configuration file from template. 2003-07-07 15:43 rpalsa * acinclude.m4: Directory for config files added to macro CPL_SET_PATHS 2003-07-07 11:27 llundin * cplcore/: cpl_error.c, cpl_error.h: cpl_error_set() sets file name & line number 2003-07-06 13:34 rpalsa * libcext/m4macros/eso.m4: Fixes from CPL-1_0-BRANCH, Revision 1.2.2.1 imported. 2003-07-06 13:32 rpalsa * libcext/cext/snprintf.c: Fixes from CPL-1_0-BRANCH, Revision 1.1.2.1 imported. 2003-07-05 19:50 rpalsa * libcext/cext/snprintf.c: Compile vsnprintf() if we do not have a C99 version. 2003-07-05 19:48 rpalsa * libcext/m4macros/eso.m4: Typo fixed in test for vsnprintf(). Stricter check of vsnprintf() C99 features. 2003-07-04 18:11 rpalsa * bootstrap, libcext/bootstrap: Require bash. Bugs fixed. 2003-07-04 18:07 rpalsa * bootstrap, libcext/bootstrap: Require bash. Bugs fixed. 2003-07-04 16:46 yjung * cplcore/cpl_image_io.c: forgot to zero-pad the saved FITS images 2003-07-04 16:44 yjung * cplcore/cpl_image_io.c: forgot to Zero-pad the saved FITS files 2003-07-03 17:58 mkiesgen * cplexec/Makefile.am: Corrected include command 2003-07-03 17:23 llundin * cplcore/cpl_error.c, cplcore/cpl_error.h, tests/cpl_sparseimage-test.c: Enhanced error handling with file & line number 2003-07-03 17:17 mkiesgen * cplexec/: Makefile.am, caller.conf.tmpl, cpl_exec.c, cpl_exec.h, cpl_exec_params_process.c, cpl_exec_params_process.h, cpl_exec_params_utils.c, cpl_exec_params_utils.h, cpl_exec_plugin_process.c, cpl_exec_plugin_process.h, cpl_exec_stringarray.c, cpl_exec_stringarray.h, cpl_exec_utils.c, cpl_exec_utils.h, demo.sh: CPL High Level Plugin API Reference Calling Application 2003-07-03 17:15 mkiesgen * Makefile.am: Added necessary steps for cplexec calling application 2003-07-03 17:14 mkiesgen * configure.ac: Added necessary checks for cplexec calling application 2003-07-03 17:14 mkiesgen * cplui/: cpl_pluginlist.c, cpl_pluginlist.h: Removed static from search procedures 2003-07-03 17:13 mkiesgen * cplui/cpl_plugin.c: Added API Version number assignment 2003-07-03 17:13 mkiesgen * cplui/cpl_parameter.h: Added necessary accessor functions for caller 2003-07-03 17:13 mkiesgen * cplui/cpl_parameter.c: Added necessary accessor functions for caller Fixed minor bug 2003-07-03 11:42 rpalsa * cplcore/cpl_plist.c: Fixes form CPL-1_0-BRANCH, Revision 1.4.2.3 imported 2003-07-03 11:42 rpalsa * cplcore/cpl_property.c: Fixes form CPL-1_0-BRANCH, Revision 1.6.2.2 imported 2003-07-03 11:35 rpalsa * cplcore/cpl_plist.c: sprintf() calls replaced by snprintf(). Return values fixed for get value operations. 2003-07-03 11:33 rpalsa * cplcore/cpl_property.c: Some casts added. 2003-07-03 08:39 yjung * cplcore/cpl_image_io.c: support all kind of conversion in cpl_image_convert() 2003-07-02 17:17 llundin * cplcore/cpl_image_stats.c: Fixed typo in cpl_image_rect_readout_noise 2003-07-02 16:30 yjung * cplcore/cpl_image_io.c: bug corrected (bpp handling in cpl_image_save()) 2003-07-02 15:46 yjung * tests/cpl_image_io-test.c: better testing for cpl_image_save() 2003-07-02 15:45 yjung * cplcore/cpl_image_io.c: bug fixed in cpl_image_save (bpp not correctly handled in headers) 2003-07-02 14:59 rpalsa * README: Prepared for version 1.0a 2003-07-02 11:49 yjung * tests/cpl_image_gen-test.c: added use of cpl_tools_cputime() 2003-07-02 11:48 yjung * cplcore/: cpl_tools.c, cpl_tools.h: added cpl_tools_cputime() 2003-07-02 11:37 rpalsa * tests/cpl_property-test.c: Merged in changes on CPL-1_0-BRANCH Revision 1.2.2.1 2003-07-02 11:36 rpalsa * cplcore/cpl_property.h: Merged in changes on CPL-1_0-BRANCH Revision 1.3.2.1 2003-07-02 11:36 rpalsa * cplcore/cpl_property.c: Merged in changes on CPL-1_0-BRANCH Revision 1.6.2.1 2003-07-02 11:35 rpalsa * cplcore/cpl_plist.h, tests/cpl_plist-test.c: Merged in changes on CPL-1_0-BRANCH Revision 1.4.2.1 2003-07-02 11:35 rpalsa * cplcore/cpl_plist.c: Merged in changes on CPL-1_0-BRANCH Revision 1.4.2.2 2003-07-02 11:26 rpalsa * cplcore/cpl_plist.c, cplcore/cpl_plist.h, cplcore/cpl_property.c, cplcore/cpl_property.h, tests/cpl_plist-test.c, tests/cpl_property-test.c: Type cpl_property_type replaced by cpl_type. Type identifiers updated. 2003-07-02 11:22 cizzo * cplcore/: cpl_table.c, cpl_table.h: rename some functions 2003-07-01 18:14 yjung * tests/cpl_imset_basic-test.c: added tests for cpl_imset_time_average() 2003-07-01 18:10 yjung * cplcore/cpl_imset_basic.c: added a test case 2003-07-01 18:08 yjung * cplcore/cpl_image_io.c: break ; were missing 2003-07-01 17:20 yjung * cplcore/cpl_imset_basic.c: the contribution map counts the good pixels, not the bad ones 2003-07-01 17:11 yjung * tests/cpl_imset_basic-test.c: added tests for 14 functions 2003-07-01 16:05 llundin * cplcore/: cpl_vector.c, cpl_vector.h: Declared cpl_vector_copy as cpl_error_code. AAdded const qualifiers 2003-07-01 15:43 yjung * tests/cpl_imset_io-test.c: .. 2003-07-01 15:36 llundin * cplcore/: cpl_image_stats.c, cpl_image_stats.h, cpl_tools.c, cpl_tools.h: Not yet tested: cpl_image_rect_readout_noise & cpl_generate_rect_poisson_points 2003-07-01 15:35 yjung * tests/cpl_imset_io-test.c: NFRAMES 10 -> 5 2003-07-01 15:21 yjung * tests/: Makefile.am, cpl_imset_basic-test.c: added cpl_imset_basic-test (still empty) 2003-07-01 15:09 llundin * cplcore/: cpl_vector.c, cpl_vector.h: Added mean & stdev. Declared cpl_vector_copy as cpl_error_code. Added const qualifiers 2003-07-01 15:06 yjung * tests/cpl_imset_io-test.c: added test cases 2003-07-01 14:17 yjung * cplcore/: cpl_imset_io.c, cpl_imset_io.h, cpl_imset_io_body.h: added cpl_imset_duplicate() cpl_imset_reject_images() replaced cpl_imset_new_TYPE() by cpl_imset_new() 2003-07-01 11:56 yjung * cplcore/cpl_sparseimage.c: added an include for cpl_tools.h 2003-07-01 11:41 yjung * tests/cpl_imset_io-test.c: removed from the branch 2003-07-01 11:37 yjung * cplcore/: cpl_objects.h, cpl_imset.h, cpl_imset_io.c, cpl_imset_io.h, cpl_imset_io_body.h, cpl_objects.c: removed from this branch 2003-07-01 11:31 yjung * cplcore/: cpl_imset_io.c, cpl_imset_io.h, cpl_imset_io_body.h: added cpl_imset_from_image() and removed cpl_imset_get_pixel_type() 2003-07-01 10:38 yjung * cplcore/cpl_image_basic.c: changed doc 2003-07-01 10:35 yjung * tests/cpl_image_basic-test.c: added printf 2003-07-01 10:03 yjung * cplcore/cpl_image_basic.c: changed prototype of cpl_sparseimage_rotate_int_local() 2003-07-01 10:03 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: implemented cpl_sparseimage_rotate_int_local() 2003-07-01 10:02 yjung * cplcore/: cpl_tools.c, cpl_tools.h: added cpl_tools_iarray_sort() 2003-06-30 17:36 yjung * cplcore/: cpl_image_basic.c, cpl_sparseimage.c, cpl_sparseimage.h: added support in rotate function for bad pixel map handling, added cpl_sparseimage_rotate_int_local (still to be written... 2003-06-30 17:19 yjung * tests/cpl_image_basic-test.c: added tests for rotate function 2003-06-30 17:12 yjung * cplcore/cpl_image_basic_body.h: corrected rotate function 2003-06-30 16:26 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h: added cpl_image_basic_rotate_int_local() 2003-06-30 15:08 cizzo * cplcore/cpl_table.c: Improve the documentation 2003-06-30 13:43 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter.h, cpl_image_gen.c, cpl_image_gen.h, cpl_image_io.c, cpl_image_io.h, cpl_image_stats.c, cpl_image_stats.h, cpl_imset_basic.c, cpl_imset_basic.h, cpl_imset_io.c, cpl_imset_io.h: moved some definitions from .h to .c 2003-06-30 13:36 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h: moved some defines in .c 2003-06-30 13:19 yjung * tests/Makefile.am: remnoved cpl_imset from branch 2003-06-30 13:19 yjung * cplcore/Makefile.am: removed cpl_imset from branch 2003-06-30 12:48 yjung * tests/cpl_imset_io-test.c: changed cpl_imset_new() in cpl_imset_new_type() 2003-06-30 12:47 yjung * cplcore/: cpl_imset_basic.c, cpl_imset_basic.h, cpl_imset_basic_body.h: added cpl_imset_add_local, cpl_imset_subtract_local, cpl_imset_multiply_local, cpl_imset_divide_local, cpl_imset_add_image_local, cpl_imset_subtract_image_local, cpl_imset_multiply_image_local, cpl_imset_divide_image_local, cpl_imset_const_op_local, cpl_imset_normalize_local, cpl_imset_threshold_local, cpl_imset_contribution_map, cpl_imset_time_average. 2003-06-30 12:46 yjung * cplcore/: cpl_imset_io.c, cpl_imset_io.h, cpl_imset_io_body.h: added cpl_imset_check(), added some const, replaced cpl_imset_new() by cpl_imset_new_double(), cpl_imset_new_float() and cpl_imset_new_int() 2003-06-30 12:44 yjung * cplcore/cpl_imset.h: added type field in the cpl_imset definition 2003-06-30 12:02 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h: added cpl_image_delete_bpm() 2003-06-30 12:01 yjung * cplcore/: cpl_image_binary.c, cpl_image_binary.h: added a const... 2003-06-30 12:00 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: added cpl_sparseimage_from_binary() 2003-06-30 11:59 yjung * cplcore/Makefile.am: tabs ... 2003-06-30 11:58 yjung * cplcore/Makefile.am: added cpl_imset_basic_body.h 2003-06-27 13:40 yjung * cplcore/cpl_imset_basic_body.h: Initial revision 2003-06-27 10:14 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic.h: Removed "const" qualifier from cpl_image_const_op_local 2003-06-27 10:14 rpalsa * libcext/cext/cxmacros.h: Patches from CPL-1_0-BRANCH Rev. 1.1.2.1 imported. 2003-06-27 10:12 rpalsa * cplcore/cpl_types.c: Patches from CPL-1_0-BRANCH Rev 1.2.2.1 imported. 2003-06-27 09:52 cizzo * cplcore/: cpl_column.c, cpl_column.h: Correct prototype of cpl_column_set_string() and of cpl_column_fill_string() 2003-06-27 09:51 yjung * cplcore/Makefile.am: added cpl_imset_basic 2003-06-27 09:47 yjung * cplcore/: cpl_imset.h, cpl_imset_basic.c, cpl_imset_basic.h: added cpl_imset_basic.ch (still empty) 2003-06-27 09:44 cizzo * cplcore/: cpl_column.c, cpl_column.h: Correct prototype of cpl_column_set_string() and of cpl_column_fill_string() 2003-06-26 13:56 llundin * cplcore/cpl_sparseimage.c: Improved comment on cpl_sparseimage_union_local 2003-06-25 13:43 cizzo * tests/cpl_matrix-test.c, cplcore/cpl_matrix.c, cplcore/cpl_matrix.h: rename cpl_matrix_resize() to cpl_matrix_reshape(), and create new function cpl_matrix_resize() 2003-06-24 11:51 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: corrected kernel norm computation (use fabs()) 2003-06-24 11:28 yjung * cplcore/cpl_image_filter_body.h: typo 2003-06-24 11:23 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: corrected kernel norm computation (with fabs()...) 2003-06-23 16:42 cizzo * cplcore/cpl_matrix.c: Correct documentation 2003-06-23 15:15 llundin * cplcore/: cpl_image_stats.c, cpl_image_stats.h: Changed return type of cpl_image_{min,max}pos* from int to cpl_error_code 2003-06-23 15:05 llundin * cplcore/: cpl_image_stats.c, cpl_image_stats.h: Changed return type of cpl_image_{min,max}pos* from int to cpl_error_code 2003-06-20 17:40 cizzo * cplcore/: cpl_table.c, cpl_table.h: Add const qualifier at the last argument of cpl_table_set_string() 2003-06-18 17:40 cizzo * tests/cpl_table-test.c: Alignment to cpl_type 2003-06-18 17:37 cizzo * tests/cpl_table-test.c, cplcore/cpl_column.c, cplcore/cpl_column.h, cplcore/cpl_table.c, cplcore/cpl_table.h: Alignment to cpl_type 2003-06-18 17:08 rpalsa * cplcore/cpl_types.c: Dead code removed from cpl_type_sizeof(). Documentation added. 2003-06-18 14:20 cizzo * cplcore/: cpl_matrix.c: Upgrade the documentation with regard to the error codes set by the routines 2003-06-18 14:18 cizzo * cplcore/: cpl_column.c, cpl_table.c: Minor change in the documentation 2003-06-18 13:32 cizzo * cplcore/: cpl_table.c: Upgrade the documentation with regard to the error codes set by the routines 2003-06-18 13:31 cizzo * cplcore/: cpl_column.c: Minor changes 2003-06-18 11:31 rpalsa * libcext/cext/cxmacros.h: Macro CLAMP added. 2003-06-18 10:33 yjung * tests/: cpl_image_gen-test.c, cpl_image_stats-test.c, cpl_imset_io-test.c: rm tabs 2003-06-18 10:31 yjung * cplcore/cpl_image.h, cplcore/cpl_image_basic.c, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_binary.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_io.c, cplcore/cpl_image_stats.c, cplcore/cpl_imset_io_body.h, tests/cpl_image_gen-test.c, tests/cpl_image_stats-test.c, tests/cpl_imset_io-test.c: rm tabs - update doc 2003-06-18 10:11 yjung * cplcore/cpl_image.h, cplcore/cpl_image_basic.c, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_binary.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_filter_body.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, cplcore/cpl_image_stats.c, cplcore/cpl_image_stats_body.h, cplcore/cpl_imset_io_body.h, tests/cpl_image_io-test.c: use types frome cpl_types.h for image types 2003-06-18 09:45 yjung * TODO: test 2003-06-18 09:41 yjung * cplcore/cpl_image.h, cplcore/cpl_image_basic.c, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_binary.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_filter_body.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, cplcore/cpl_image_stats.c, cplcore/cpl_image_stats_body.h, cplcore/cpl_imset_io_body.h, tests/cpl_image_io-test.c: use the types from cpl_types.h for image types 2003-06-17 17:26 cizzo * cplcore/cpl_column.c: Upgrade the documentation with regard to the error codes set by the routines 2003-06-17 17:13 cizzo * cplcore/cpl_column.c: Upgrade the documentation with regard to the error codes set by the routines 2003-06-17 16:18 yjung * README: test 2003-06-17 14:21 cizzo * cplcore/: cpl_error.c, cpl_error.h: Add cpl_error_set() 2003-06-17 13:58 cizzo * cplcore/: cpl_error.h: Set the comments on cpl_error codes to the appropriate location so that they are interpreted correctly by Doxygen 2003-06-17 11:09 cizzo * cplcore/cpl_plist.c: Fix wrong call to _cpl_plist_compare_regexp 2003-06-17 11:01 cizzo * cplcore/cpl_plist.c: Fix wrong call to _cpl_plist_compare_regexp 2003-06-16 14:51 cplmgr * libcext/configure.ac: Package version set to pre 1.1 2003-06-16 14:48 cplmgr * configure.ac, libcext/configure.ac: Package version set to 1.0 (alpha) 2003-06-16 14:45 cplmgr * configure.ac: Package version set to pre 1.1 2003-06-16 11:47 mkiesgen * libcext/cext/cxstrutils.h: Added cx_strfreev prototype 2003-06-14 18:16 rpalsa * tests/cpl_plist-test.c: Adapted to changed loader calling sequence. 2003-06-14 18:15 rpalsa * cplcore/: cpl_plist.c, cpl_plist.h: Loader calling sequence changed. Fills a property list instead of creation one. 2003-06-13 17:05 cizzo * tests/cpl_matrix-test.c: Minor change 2003-06-13 15:39 yjung * cplcore/: cpl_vector.c, cpl_vector.h: doc... 2003-06-13 15:32 yjung * cplcore/cpl_image_stats.c: typo 2003-06-13 15:08 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: doc... 2003-06-13 15:04 yjung * cplcore/: cpl_objects.c, cpl_objects.h: doc 2003-06-13 15:02 yjung * cplcore/: cpl_imset_io.c, cpl_imset_io.h: doc.. 2003-06-13 15:00 yjung * cplcore/: cpl_image_stats.c, cpl_image_stats.h: doc... 2003-06-13 14:53 yjung * cplcore/cpl_image_io.c: doc... 2003-06-13 14:43 yjung * cplcore/: cpl_image_gen.c, cpl_image_gen.h: doc ... 2003-06-13 14:40 yjung * cplcore/cpl_image_filter.c: doc... 2003-06-13 14:37 yjung * cplcore/cpl_imset_io.h: ... 2003-06-13 14:35 yjung * cplcore/cpl_image_binary.c: doc... 2003-06-13 14:26 yjung * cplcore/cpl_image_basic.c: doc... 2003-06-13 14:20 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h: doc... 2003-06-13 10:58 cizzo * cplcore/cpl_image_basic.h: Rename a number of functions to uniform to used CPL conventions 2003-06-13 10:49 yjung * cplcore/cpl_image_basic.h: changed prototype of cpl_image_threshold() 2003-06-13 10:27 cizzo * cplcore/cpl_image_basic.c, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_binary.c, cplcore/cpl_image_filter.c, cplcore/cpl_image_gen.c, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_imset_io_body.h, cplcore/cpl_objects.c, tests/cpl_image_basic-test.c, tests/cpl_image_filter-test.c, tests/cpl_image_io-test.c, tests/cpl_image_stats-test.c, tests/cpl_sparseimage-test.c: Rename a number of functions to uniform to used CPL conventions 2003-06-12 15:27 llundin * tests/cpl_sparseimage-test.c: Improved sparse statistics test with less output 2003-06-12 15:15 yjung * tests/cpl_image_filter-test.c: add some printf() 2003-06-12 15:02 yjung * tests/cpl_image_binary-test.c: update 2003-06-12 14:45 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h: tabs... 2003-06-12 14:43 yjung * tests/cpl_image_basic-test.c: update tests 2003-06-12 13:26 yjung * cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, tests/cpl_image_io-test.c: completed test suite for image_io 2003-06-12 12:43 llundin * cplcore/cpl_image_basic.c, cplcore/cpl_image_basic.h, cplcore/cpl_image_basic_body.h, cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h, tests/cpl_sparseimage-test.c: Improved sparse image union with undefined map 2003-06-12 09:51 yjung * cplcore/cpl_image_filter.c, cplcore/cpl_image_filter.h, cplcore/cpl_image_filter_body.h, tests/cpl_image_filter-test.c: chieved bpm handling in filtering functions 2003-06-11 17:06 yjung * cplcore/cpl_image_filter.c, cplcore/cpl_image_filter.h, cplcore/cpl_image_filter_body.h, tests/cpl_image_filter-test.c: support bad pixels for all functions but stdev filtering 2003-06-11 16:29 llundin * cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, tests/check.out.HP-UX, tests/cpl_sparseimage-test.c: Test of statistics on images with bad pixels 2003-06-11 15:26 llundin * cplcore/cpl_sparseimage.c: Removed unused declaration 2003-06-11 15:09 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter.h, cpl_image_filter_body.h: added support for bpm for linear filtering 2003-06-11 15:05 llundin * cplcore/cpl_image_basic_body.h, cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h, tests/cpl_image_stats-test.c, tests/cpl_sparseimage-test.c: NULL input to sparse image union no longer an error 2003-06-11 14:58 llundin * cplcore/cpl_image_binary.c: Fixed bug (inverted values) in cpl_image_binary_from_sparse 2003-06-11 13:57 yjung * cplcore/: cpl_image_binary.c, cpl_image_binary.h: morphological operations use now a kernel 2003-06-11 13:10 yjung * tests/cpl_image_binary-test.c: changed morpho functions prototypes 2003-06-11 12:55 llundin * cplcore/cpl_image_binary.c: Added support for NULL params in cpl_image_binary_from_sparse 2003-06-11 10:56 yjung * cplcore/cpl_image_binary.c: typo 2003-06-11 09:36 llundin * cplcore/cpl_image_io.c: Added assert comments to cpl_image_get_badpixels 2003-06-10 17:20 yjung * cplcore/cpl_image_stats.c: checks if input image is empty 2003-06-10 17:08 yjung * cplcore/cpl_image_io.c: added checks to verify that the input image is not empty 2003-06-10 17:01 yjung * cplcore/cpl_image_filter.c: cheks to verify if the input image is empty or not 2003-06-10 16:52 yjung * cplcore/cpl_image_binary.c: added checks to verify that input images are not empty 2003-06-10 16:35 yjung * cplcore/cpl_image_basic.c: typo 2003-06-10 16:34 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic_body.h: add checks to verify that input image is not 'empty' 2003-06-10 16:17 yjung * cplcore/: cpl_image_io.c: typo 2003-06-10 16:07 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h: new functions 2003-06-10 15:04 cizzo * cplcore/cpl_1dfunction.c, cplcore/cpl_vector.c, cplcore/cpl_vector.h, tests/cpl_vector-test.c: Rename cpl_vector_size() to cpl_vector_get_size() 2003-06-10 14:54 cizzo * tests/cpl_1dfunction-test.c, tests/cpl_vector-test.c, cplcore/cpl_1dfunction.c, cplcore/cpl_1dfunction.h, cplcore/cpl_vector.c, cplcore/cpl_vector.h: Merge all constant arith operations into cpl_vector_const_op(), and rename some of the functions 2003-06-10 14:05 cizzo * cplcore/cpl_matrix.c: Minor changes 2003-06-10 14:03 yjung * cplcore/cpl_imset_io.c, cplcore/cpl_imset_io.h, cplcore/cpl_imset_io_body.h, tests/cpl_imset_io-test.c: slightly corrected imset functions and added test cases 2003-06-10 14:01 cizzo * cplcore/cpl_matrix.c: Minor changes 2003-06-10 13:19 llundin * cplcore/: cpl_image_binary.c, cpl_image_binary.h, cpl_image_stats.c, cpl_image_stats.h, cpl_image_stats_body.h: Improved bad pixel map usage with binary image 2003-06-10 11:06 yjung * cplcore/: cpl_imset_io.c, cpl_imset_io.h: added cpl_imset_get_ni() 2003-06-09 17:21 rpalsa * cplcore/cpl_image_io_body.h: Cast added to filename in image loading operations 2003-06-09 17:20 rpalsa * cplcore/: cpl_image_io.c, cpl_image_io.h: Some functions added (TO BE CONFIRMED) 2003-06-09 17:13 rpalsa * libcext/tests/cxstring-test.c: Tests adapted to modified calling sequence for member functions. 2003-06-09 17:11 rpalsa * libcext/cext/cxstring.h: Member functions removed from type definition. Prototypes adapted. 2003-06-09 17:11 rpalsa * libcext/cext/cxstring.c: Member functions removed from type definition. Functions creating a copy during processing have been removed. All functions work in place. 2003-06-09 17:07 rpalsa * libcext/bootstrap, bootstrap: Function definitions changed to be compatible with Bourne shell. 2003-06-06 19:37 yjung * tests/: cpl_image_test1.fits, cpl_image_test2.fits: not needed any more - use images generation now 2003-06-06 19:36 yjung * tests/Makefile.am: rm cpl_image_test12.fits 2003-06-06 19:35 yjung * tests/cpl_image_stats-test.c: use image generation function 2003-06-06 19:30 yjung * tests/cpl_image_io-test.c: generate test images 2003-06-06 19:17 yjung * tests/cpl_image_binary-test.c: use image generation function 2003-06-06 19:14 yjung * tests/cpl_image_basic-test.c: use image generation function 2003-06-06 18:56 yjung * tests/cpl_image_filter-test.c: changed proto of cpl_image_gen_test() 2003-06-06 18:55 yjung * tests/cpl_image_gen-test.c: [no log message] 2003-06-06 18:54 yjung * cplcore/: cpl_image_gen.c, cpl_image_gen.h: can specify the size to cpl_image_gen_test() 2003-06-06 18:37 yjung * tests/cpl_image_filter-test.c: use a generated test image now 2003-06-06 17:23 yjung * tests/cpl_image_gen-test.c: completed tests for cpl_image_gen_test 2003-06-06 17:22 rpalsa * cplui/Makefile.am: Modules cpl_parameter and cpl_parlist added. Interface cpl_recipe.h added. 2003-06-06 17:21 yjung * cplcore/: cpl_image_gen.c, cpl_image_gen.h: added cpl_image_gen_test() 2003-06-06 17:21 rpalsa * cplui/cpl_parameter.h: Parameter initialization merged with parameter creation. Prototypes adapted. 2003-06-06 17:21 rpalsa * cplui/cpl_parameter.c: Parameter initialization merged with parameter creation. 2003-06-06 17:19 rpalsa * cplui/cpl_plugin.c: Function name changed for cpl_plugin_set_all(). Lines folded if necessary. 2003-06-06 17:18 rpalsa * cplui/cpl_plugin.h: Names changed. 2003-06-06 17:16 rpalsa * cplui/cpl_recipe.h: Type names adapted. Accessor functions are not used anymore for frames and parameters. 2003-06-06 16:56 cizzo * cplcore/: cpl_matrix.c, cpl_matrix.h: Correct return type of several functions: cpl_error_code instead of int 2003-06-06 16:53 yjung * cplcore/: cpl_image_gen.c, cpl_image_gen.h, cpl_image_gen_body.h: in progress 2003-06-06 16:53 yjung * cplcore/: cpl_tools.c, cpl_tools.h: added cpl_tools_gaussian_2d() 2003-06-06 16:43 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_table.c, cpl_table.h: Correct return type of several functions: cpl_error_code instead of int 2003-06-06 16:02 yjung * tests/Makefile.am: added cpl_image_gen-test 2003-06-06 15:52 yjung * tests/cpl_image_gen-test.c: Initial revision 2003-06-06 15:50 yjung * cplcore/: Makefile.am, cpl_image.h, cpl_image_gen.c, cpl_image_gen_body.h: added first compiling version of cpl_image_gen 2003-06-06 15:33 yjung * cplcore/: cpl_image_gen.c, cpl_image_gen.h, cpl_image_gen_body.h: Initial revision 2003-06-06 15:27 yjung * cplcore/cpl_image_filter_body.h: ... 2003-06-06 15:22 llundin * cplcore/cpl_sparseimage.c, cplcore/cpl_sparseimage.h, tests/cpl_sparseimage-test.c: Extended sparse image test 2003-06-06 15:02 cizzo * cplcore/cpl_table.c: Regular expression matching was not applied in the _or_constant_string selection function; upgrade the documentation 2003-06-06 14:58 cizzo * cplcore/: cpl_property.c, cpl_property.h: Rename some functions 2003-06-06 14:57 cizzo * cplcore/: cpl_plist.c, cpl_plist.h: Rename some functions, remove cpl_plist_erase_with() and replace it with cpl_plist_erase_regexp() 2003-06-06 14:55 cizzo * tests/: cpl_plist-test.c, cpl_property-test.c: Rename some functions calls 2003-06-06 14:49 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h: int-> cpl_error_code in functions prototypes 2003-06-06 14:38 yjung * tests/cpl_image_io-test.c: cpl_image_save proto changed 2003-06-06 14:37 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h: changed prototype : int->cpl_error_code 2003-06-06 14:35 yjung * cplcore/: cpl_imset_io.c, cpl_imset_io.h: prototype changed int->cpl_error_code 2003-06-06 14:33 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h: some prototypes changed int->cpl_error_code 2003-06-06 14:30 yjung * cplcore/: cpl_vector.c, cpl_vector.h: changed prototype int to cpl_error_code 2003-06-06 14:29 yjung * cplcore/: cpl_imset.h, cpl_imset_io.c: includes stuff 2003-06-06 14:27 yjung * cplcore/: cpl_image_binary.c, cpl_image_filter.c: rm an include 2003-06-06 14:20 yjung * cplcore/cpl_image_binary.c: returned type int replaced by cpl_error_code for some functions 2003-06-06 14:19 yjung * cplcore/cpl_image_binary.h: return type int replaced by cpl_error_code for some functions 2003-06-06 14:06 yjung * tests/cpl_image-test.c: not used any more 2003-06-06 13:48 yjung * tests/cpl_image_basic-test.c: .. 2003-06-06 13:43 yjung * tests/Makefile.am: added cpl_imset_io.c 2003-06-06 13:27 yjung * tests/cpl_imset_io-test.c: Initial revision 2003-06-06 13:24 yjung * cplcore/Makefile.am: added cpl_imset.h cpl_imset_io.h cpl_imset_io.c cpl_imset_body.h 2003-06-06 13:16 rpalsa * cplcore/Makefile.am: Tabs removed. 2003-06-06 13:15 rpalsa * cplcore/cpl_types.c: Typo fixed when removing array flag. 2003-06-06 13:01 yjung * cplcore/: cpl_imset_io.c, cpl_imset_io.h, cpl_imset_io_body.h: first compiling version 2003-06-06 12:01 llundin * tests/: Makefile.am, cpl_sparseimage-test.c: Tests for sparse image functionality 2003-06-06 11:06 llundin * cplcore/: cpl_image_basic_body.h, cpl_sparseimage.c, cpl_sparseimage.h: Improved error handling 2003-06-06 10:54 cizzo * tests/cpl_frameset-test.c: Renaming some calls 2003-06-06 10:54 cizzo * cplui/: cpl_frameset.c, cpl_frameset.h: Rename cpl_frameset_size() to cpl_frameset_get_size() and cpl_frameset_empty() to cpl_frameset_is_empty() 2003-06-06 10:53 cizzo * tests/cpl_frame-test.c: Call to cpl_frame_copy() changed to cpl_frame_duplicate() 2003-06-06 10:52 cizzo * cplui/: cpl_frame.c, cpl_frame.h: Rename cpl_frame_copy() to cpl_frame_duplicate() 2003-06-06 10:33 cizzo * cplcore/: cpl_matrix.c, cpl_matrix.h: Implement cpl_matrix_determinant() 2003-06-05 16:26 mkiesgen * bootstrap, libcext/bootstrap: Changed /bin/sh to /bin/bash 2003-06-05 16:11 yjung * cplcore/cpl_imset_io.h: ... 2003-06-05 16:02 yjung * cplcore/cpl_imset_io.c: typo 2003-06-05 15:49 yjung * cplcore/: cpl_imset_io.c, cpl_imset_io.h, cpl_imset_io_body.h: added new functions 2003-06-05 14:34 cizzo * tests/cpl_matrix-test.c: Rename some functions 2003-06-05 14:33 cizzo * cplcore/: cpl_matrix.c, cpl_matrix.h: Rename several functions, and add some more 2003-06-05 14:32 cizzo * cplcore/cpl_column.c: Rename a function and fix an exception in minmax routines 2003-06-05 14:31 cizzo * cplcore/cpl_column.h: Rename a function 2003-06-05 14:30 cizzo * cplcore/: cpl_table.c, cpl_table.h: Rename some functions 2003-06-05 12:00 yjung * cplcore/cpl_image_io.c: use CPL_ASSURE in cpl_image_convert() 2003-06-03 13:23 yjung * cplcore/cpl_image_basic.c: fix badpixels handling for collapse functions 2003-06-03 12:06 yjung * cplcore/cpl_image_basic.c: added support for sparseimage in cpl_image_extract() 2003-06-03 12:00 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: added cpl_sparseimage_extract() 2003-06-03 10:19 yjung * cplcore/: cpl_imset_io.c, cpl_imset_io_body.h, cpl_image_binary.c, cpl_image_filter.c: renaming 2003-06-03 10:17 yjung * cplcore/cpl_1dfunction.c: renameing 2003-06-03 10:15 yjung * cplcore/cpl_vector.c: renaming 2003-06-03 09:36 yjung * cplcore/cpl_image.h: changed doc for stats 2003-06-02 16:04 yjung * cplcore/cpl_imset_io.c: changed defgroup 2003-06-02 11:34 mkiesgen * tests/Makefile.am: Added testcase for cpl_pluginlist, part of the high-level caller-plugin interface 2003-06-02 11:33 mkiesgen * tests/cpl_pluginlist-test.c: Testcase for cpl_pluginlist, part of the high-level caller-plugin interface 2003-06-02 11:32 mkiesgen * tests/cpl_plugin-test.c, cplui/cpl_pluginlist.h, cplui/cpl_pluginlist.c: Cleaned up code 2003-06-01 16:35 rpalsa * cplcore/cpl_error.h: Error code CPL_ERROR_INVALID_TYPE added. 2003-06-01 16:34 rpalsa * cplcore/: cpl_types.c, cpl_types.h: Added. 2003-06-01 16:31 rpalsa * cplui/: cpl_parameter.c, cpl_parameter.h, cpl_parlist.c, cpl_parlist.h: Added. 2003-05-28 17:14 yjung * tests/Makefile.am: images for tests included in the dist 2003-05-28 16:57 mkiesgen * cplui/: cpl_plugin.c, cpl_pluginlist.c, cpl_pluginlist.h: Changed cpl_pluginlist according to CPL high level interface proposal 2003-05-28 16:55 mkiesgen * cplui/cpl_plugin.h, cplui/Makefile.am, tests/Makefile.am, tests/cpl_plugin-test.c: Changed cpl_plugin according to CPL high level interface proposal 2003-05-28 13:37 llundin * cplcore/cpl_image_basic.c, cplcore/cpl_sparseimage.c, cplcore/cpl_vector.c, tests/cpl_image_basic-test.c, tests/cpl_image_binary-test.c, tests/cpl_image_filter-test.c, tests/cpl_image_io-test.c, tests/cpl_image_stats-test.c, tests/cpl_matrix-test.c: Removed some gcc warnings (including cpl_tools.h bug in cpl_image_basic) 2003-05-28 13:32 rpalsa * doxygen/Doxyfile.in: Added symbols to PREDEFINED, optimization for C turned off. 2003-05-28 13:30 rpalsa * libcext/cext/cxstring.h: Beautified. 2003-05-28 11:35 llundin * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_io.c, cpl_image_io.h, cpl_image_stats.c, cpl_image_stats.h, cpl_sparseimage.c, cpl_sparseimage.h: Added const in function declarations 2003-05-27 18:01 llundin * cplcore/cpl_image_basic_body.h: Fixed too long line 2003-05-27 18:00 llundin * cplcore/cpl_error.h: Fixed too long line (and improved comment) 2003-05-27 13:24 llundin * cplcore/cpl_image.h, cplcore/cpl_image_basic.c, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_io.c, cplcore/cpl_image_io_body.h, cplcore/cpl_image_stats.c, cplcore/cpl_sparseimage.c, tests/check.out.HP-UX: Exception handling + bug fix (log domain cpl_image_cst_op*) 2003-05-27 13:03 yjung * cplcore/: cpl_imset.h, cpl_imset_io.c, cpl_imset_io.h, cpl_imset_io_body.h: in progress 2003-05-27 11:22 yjung * cplcore/cpl_imset_io.c: in progress 2003-05-27 11:11 yjung * cplcore/cpl_imset_io.c: Initial revision 2003-05-27 10:55 yjung * cplcore/cpl_imset.h: in progress 2003-05-27 10:53 yjung * cplcore/cpl_imset.c: moved to cpl_imset_io.c 2003-05-27 10:52 yjung * cplcore/cpl_imset_io.h: Initial revision 2003-05-27 10:43 yjung * cplcore/: cpl_imset.c, cpl_imset.h: in progress 2003-05-27 10:42 yjung * cplcore/cpl_imset_io_body.h: Initial revision 2003-05-26 15:35 yjung * cplcore/: cpl_imset.c, cpl_imset.h: in progress 2003-05-26 13:50 yjung * cplcore/: cpl_objects.c, cpl_objects.h: moved objects def in .c and use error module 2003-05-26 13:32 yjung * cplcore/: cpl_imset.c, cpl_imset.h: Initial revision 2003-05-26 13:19 yjung * tests/cpl_vector-test.c: added test case for read and dump 2003-05-26 13:18 yjung * cplcore/: cpl_vector.c, cpl_vector.h: added a parameter to cpl_vector_compare 2003-05-26 12:05 rpalsa * cplui/: cpl_plugin.h, cpl_recipe.h: Added. 2003-05-26 10:28 yjung * tests/cpl_1dfunction-test.c: added test for cpl_1dfunction_read() and cpl_1dfunction_dump() 2003-05-26 10:27 yjung * cplcore/cpl_1dfunction.c: small bug in cpl_1dfunction_read() 2003-05-24 14:19 cizzo * cplcore/cpl_table.c: Fix wrong error check 2003-05-23 19:07 rpalsa * libcext/cext/cxstring.h: Type layout changed, function names changed. 2003-05-23 19:06 rpalsa * libcext/cext/cxstring.c: Type layout changed, some bugs fixed. 2003-05-23 19:05 rpalsa * libcext/doxygen/Doxyfile.in: Turn off optimization for C. 2003-05-23 19:05 rpalsa * libcext/tests/cxstring-test.c: Adapted cx_string layout changes. 2003-05-23 18:32 rpalsa * libcext/tests/cxlist-test.c: Properly destroy all created lists. 2003-05-23 17:48 yjung * tests/cpl_image_binary-test.c: some functions now return an error code 2003-05-23 17:43 yjung * tests/cpl_vector-test.c: returned value is now error code for some functions 2003-05-23 17:34 yjung * tests/cpl_1dfunction-test.c: some returned values changed (error code) 2003-05-23 17:23 yjung * cplcore/cpl_image_filter.c: typo 2003-05-23 17:22 yjung * cplcore/cpl_image_filter.c: introduce use of the error module 2003-05-23 17:04 yjung * cplcore/cpl_image_binary.c: improved use of error module 2003-05-23 16:46 yjung * cplcore/cpl_1dfunction.c: improved error module usage 2003-05-23 16:43 yjung * cplcore/cpl_vector.h: changed cpl_vector_sort prototype 2003-05-23 16:42 yjung * cplcore/cpl_vector.c: improved error module usage 2003-05-23 16:11 yjung * cplcore/cpl_image_binary.c: use error module 2003-05-23 16:04 cizzo * cplcore/cpl_table.c: Try some CPL_ASSURE calls to macro 2003-05-23 15:37 rpalsa * libcext/tests/cxslist-test.c: Properly destroy all created lists. 2003-05-23 15:29 cizzo * tests/cpl_table-test.c: Renaming of a function 2003-05-23 15:28 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_table.c, cpl_table.h: Add new functions for computing log, exp and pow of a column, and add the general function cpl_table_const_op() for compatibility with other packages 2003-05-23 15:16 rpalsa * libcext/cext/cxtree.c: cx_tree_delete(): Correctly destroy head node and the tree structure itself. 2003-05-23 15:14 rpalsa * libcext/tests/cxtree-test.c: Test 12: Bug fixed. _tree replaced by tree. 2003-05-23 14:44 yjung * cplcore/cpl_vector.c: changed prototype of cpl_vector_sort and use error module 2003-05-23 14:43 yjung * tests/cpl_vector-test.c: changed prototype of cpl_vector_sort() 2003-05-23 12:09 yjung * cplcore/cpl_1dfunction.c: added usage of the error system 2003-05-23 10:53 yjung * cplcore/cpl_image_binary.c: use a bit more accessors. 2003-05-23 10:47 llundin * cplcore/cpl_error.h: Added CPL_ASSURE for exception handling 2003-05-22 16:51 yjung * cplcore/: cpl_error.c, cpl_error.h: relation code - message done by a function 2003-05-22 14:55 llundin * cplcore/: cpl_image_stats.c, cpl_image_stats_body.h: Fixed initialization bug in sparse minmaxpos 2003-05-22 11:35 yjung * cplcore/cpl_image_binary.h: changed some names 2003-05-22 11:32 yjung * tests/cpl_image_binary-test.c: added test cases for binary images handling functions 2003-05-21 18:35 yjung * tests/Makefile.am: addded cpl_image_binary-test.c 2003-05-21 18:34 yjung * tests/cpl_image_binary-test.c: Initial revision 2003-05-21 18:23 yjung * tests/cpl_image_filter-test.c: added test cases for all filtering functions 2003-05-21 18:10 yjung * cplcore/cpl_image_filter.c: ... 2003-05-21 18:05 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter.h, cpl_image_filter_body.h: removed cpl_image_filter_flat which is covered by the linear filtering functions 2003-05-21 17:35 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter.h, cpl_image_filter_body.h: morpho filtering now uses cpl_matrix 2003-05-21 17:34 yjung * tests/cpl_image_filter-test.c: added test for morpho filtering 2003-05-21 17:10 cizzo * tests/cpl_table-test.c, cplcore/cpl_column.c, cplcore/cpl_column.h, cplcore/cpl_table.c, cplcore/cpl_table.h: Eliminate type in constant operation functions names 2003-05-21 16:35 yjung * cplcore/cpl_1dfunction.c, cplcore/cpl_1dfunction.h, cplcore/cpl_vector.c, cplcore/cpl_vector.h, tests/cpl_1dfunction-test.c, tests/cpl_vector-test.c: hide the vector and 1dfunction data types 2003-05-21 16:31 cizzo * cplcore/: cpl_column.c, cpl_table.c: Correct documentation of some functions 2003-05-21 09:06 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_table.c: Rename a function and implement regular expression for string matching 2003-05-20 17:29 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter.h, cpl_image_filter_body.h: removed cpl_image_filter_3x1() cpl_image_filter_3x3(), cpl_image_filter_5x5(). They are replaced by the more generic cpl_image_filter_linear(). cpl_image_filter_linear is 8% slower for a 5x5 filter, but that's ok. 2003-05-20 17:16 yjung * tests/cpl_image_filter-test.c: added test for linear filtering 2003-05-20 17:03 yjung * cplcore/cpl_image_filter.c: the kernel size has to be odd, not even 2003-05-20 16:38 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter_body.h: do not acces cpl_matrix struct 2003-05-20 16:28 yjung * cplcore/: cpl_matrix.c, cpl_matrix.h: put the cpl_matrix definition back in the .c 2003-05-20 16:11 yjung * cplcore/: cpl_image_stats.c, cpl_image_stats.h, cpl_image_stats_body.h: CPL_IMAGE_STATS_MEDIAN -> CPL_IMAGE_STATS_MEDIAN_STAT 2003-05-20 16:08 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter.h, cpl_image_filter_body.h: use cpl_matrix for kernels and add a generic cpl_image_filter_linear function 2003-05-20 14:29 yjung * cplcore/cpl_matrix.h: typo 2003-05-20 11:54 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter.h: cpl_image_filter3x3, cpl_image_filter3x1, cpl_image_filter5x5 made static 2003-05-20 11:54 yjung * cplcore/cpl_image_filter_body.h: no support for int images 2003-05-20 11:43 yjung * cplcore/cpl_matrix.h: classified methods... 2003-05-20 11:35 yjung * tests/cpl_matrix-test.c: print_matrix() -> cpl_matrix_print() 2003-05-20 11:29 yjung * cplcore/cpl_tools.c: typo 2003-05-20 11:23 yjung * cplcore/cpl_column.c: use cpl_tools.c 2003-05-20 11:23 yjung * cplcore/: cpl_tools.c, cpl_tools.h: added cpl_tools_kth_float() cpl_tools_kth_int() cpl_tools_median_float() and cpl_tools_median_int() 2003-05-20 11:05 yjung * cplcore/: cpl_matrix.c, cpl_matrix.h: use cpl_tools.c... 2003-05-20 11:05 yjung * cplcore/: cpl_1dfunction.h, cpl_vector.h, cpl_image.h: added CPL_END_DECLS 2003-05-20 10:23 yjung * tests/Makefile.am: added cpl_image_filter-test 2003-05-20 10:21 yjung * tests/cpl_image_filter-test.c: Initial revision 2003-05-20 10:08 yjung * tests/cpl_image_stats-test.c: completed with cpl_image_median_stat() and cpl_image_percentile() 2003-05-20 09:57 yjung * cplcore/cpl_image_stats.c: corrected index in cpl_image_percentile() 2003-05-19 18:05 yjung * tests/: Makefile.am, cpl_image_stats-test.c: added cpl_image_stats-test.c 2003-05-19 17:59 yjung * tests/cpl_image_basic-test.c: bad call for a collapse function 2003-05-19 17:45 yjung * tests/cpl_image-test.c: cpl_image_firstgoodpos_subw() not offered...not tested 2003-05-19 17:41 yjung * tests/Makefile.am: added cpl_image-basic 2003-05-19 17:40 yjung * tests/cpl_image_basic-test.c: Initial revision 2003-05-19 17:30 yjung * cplcore/cpl_image_basic.c: comments 2003-05-19 17:21 yjung * cplcore/cpl_image_basic.h: comment 2003-05-19 17:19 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_stats.c: moved cpl_image_firstgoodpos_subw as static into cpl_image_stats() 2003-05-19 17:13 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h: removed cpl_image_floor() (use cpl_image_convert instead) 2003-05-19 17:03 cizzo * tests/cpl_table-test.c: Renaming several functions 2003-05-19 17:03 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_table.c, cpl_table.h: Renaming several functions, add functionality 2003-05-19 17:01 yjung * cplcore/cpl_image_basic.h: removed cpl_image_opposite() and cpl_image_invert() 2003-05-19 16:46 yjung * tests/Makefile.am: added cpl_image_io-test 2003-05-19 16:28 yjung * tests/cpl_image_io-test.c: first usable version 2003-05-19 16:10 yjung * tests/cpl_image_io-test.c: Initial revision 2003-05-19 15:08 yjung * tests/cpl_1dfunction-test.c: added test cases to cover all functions 2003-05-19 15:08 yjung * cplcore/cpl_1dfunction.c: cosmetics 2003-05-19 14:30 yjung * cplcore/cpl_vector.c: ... 2003-05-19 14:30 yjung * tests/cpl_vector-test.c: added some test cases to cover all functions 2003-05-19 13:36 yjung * cplcore/: cpl_image.h, cpl_image_binary.h: moved cpl_binary definition to cpl_image.h 2003-05-19 13:06 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h: added support for binary images 2003-05-19 11:25 yjung * cplcore/cpl_image_io_body.h: added CPL_CLASS_BINARY 2003-05-19 11:22 yjung * cplcore/: cpl_image_io.h, cpl_image_io.c: added cpl_image_new_bin 2003-05-19 11:11 yjung * cplcore/cpl_sparseimage.c: include error corrected 2003-05-19 11:10 yjung * cplcore/cpl_image_io.h: moved some functions to cpl_sparseimage.h 2003-05-19 11:09 yjung * cplcore/cpl_image_binary.c: corrected some errors... 2003-05-19 11:00 yjung * cplcore/Makefile.am: added cpl_sparseimage and cpl_image_binary 2003-05-19 10:59 yjung * cplcore/cpl_image_binary.h: added cpl_binary definition 2003-05-19 10:58 yjung * cplcore/cpl_image_io.c: moved sparse functions to cpl_sparseimage.c and add defgroup for doxygen 2003-05-19 10:57 yjung * cplcore/cpl_image.h: added include for cpl_image_binary and cpl_sparseimage 2003-05-19 10:56 yjung * cplcore/: cpl_sparseimage.c, cpl_image_basic.c, cpl_image_binary.c, cpl_image_filter.c, cpl_image_stats.c: added defgroup for doxygen 2003-05-19 10:35 yjung * cplcore/: cpl_sparseimage.c, cpl_sparseimage.h: Initial revision 2003-05-16 18:16 rpalsa * cplcore/Makefile.am: cpl_image_binary.h added to include_HEADERS 2003-05-16 17:38 rpalsa * libcext/configure.ac: Libtool versioning macro added. Macros syncronized with changes in acinclude.m4. 2003-05-16 17:36 rpalsa * libcext/acinclude.m4: Macro CEXT_CREATE_FSSTND renamed. 2003-05-16 17:35 rpalsa * libcext/Makefile.am: Add file eso.m4 to EXTRA_DIST 2003-05-16 17:34 rpalsa * libcext/cext/Makefile.am: Use libtool version symbols rather than explicit version numbers. 2003-05-16 17:34 rpalsa * libcext/m4macros/eso.m4: Generic macro added to set libtool version information from configure. MAndatory argument added to macro ESO_FUNC_VA_COPY. 2003-05-16 17:31 rpalsa * configure.ac: Libtool versioning is setup here. Support added. Macro names changed in accordance with changes in acinlude.m4 2003-05-16 17:29 rpalsa * acinclude.m4: Macros renamed. Macros which are needed for building (external) instrument packages moved to cpl.m4 2003-05-16 17:27 rpalsa * Makefile.am: Standard files removed from EXTRA_DIST, already distributed by default with recent automake versions. Add m4macros/cpl.m4 to EXTRA_DIST 2003-05-16 17:24 rpalsa * admin/config.guess, admin/config.sub, admin/install-sh, admin/ltmain.sh, admin/mkinstalldirs, libcext/admin/config.guess, libcext/admin/config.sub, libcext/admin/install-sh, libcext/admin/ltmain.sh, libcext/admin/mkinstalldirs: New version installed 2003-05-16 17:22 llundin * cplcore/Makefile.am: Added *_body.h files 2003-05-16 17:18 rpalsa * cplui/Makefile.am, cplcore/Makefile.am: Using symbols in INCLUDES, LDFLAGS. Libtool version now done in configure; support added. 2003-05-16 17:16 rpalsa * m4macros/cpl.m4: Macro CPL_CHECK_CEXT added. Type in cpl_check_cpl_header fixed. Macro CPL_CREATE_SYMBOLS added. 2003-05-16 17:12 rpalsa * tests/Makefile.am: Symbols used in INCLUDES, LDFLAGS 2003-05-16 16:41 rpalsa * bootstrap, libcext/bootstrap: Remove all occurrances of the cwd from PATH 2003-05-16 15:53 llundin * cplcore/cpl_image.h, cplcore/cpl_image_basic.c, cplcore/cpl_image_basic.h, cplcore/cpl_image_basic_body.h, cplcore/cpl_image_filter.c, cplcore/cpl_image_io.c, cplcore/cpl_image_io.h, cplcore/cpl_image_io_body.h, tests/cpl_image-test.c, cplcore/cpl_image_stats.c, cplcore/cpl_image_stats_body.h: Beta version of bad pixel maps 2003-05-16 14:38 mkiesgen * libcext/tests/cxstring-test.c: Changed compare value in test 7 to > 0 instead of ==1 to make test work correctly under gcc 3 2003-05-15 17:11 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_table.c, cpl_table.h: Rename some of the functions 2003-05-15 17:10 cizzo * tests/cpl_table-test.c: Rename some functions 2003-05-15 16:14 yjung * cplcore/cpl_vector.c: doxygen things 2003-05-15 15:33 cizzo * tests/cpl_table-test.c: Changed calling sequence for cpl_table_move_column(), and insert alternative code in case cpl_table_resize would be eliminated 2003-05-15 15:29 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_table.c, cpl_table.h: Several changes, in accordance with (not yet all) Michele's comments 2003-05-15 15:23 yjung * cplcore/cpl_1dfunction.c: added an include 2003-05-15 15:22 yjung * cplcore/: cpl_1dfunction.c, cpl_tools.h, cpl_vector.c: define moved in cpl_tools.h 2003-05-15 15:20 yjung * cplcore/cpl_tools.h: added defin ASCIILINESZ 2003-05-15 15:16 yjung * cplcore/cpl_tools.c: removed end of defgroup (doxygen) 2003-05-15 15:15 yjung * cplcore/cpl_objects.c: added defgroup for doxygen 2003-05-15 15:14 yjung * cplcore/: cpl_1dfunction.c, cpl_vector.c: added defgroup for Doxygen 2003-05-15 13:45 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h, cpl_vector.c, cpl_vector.h: cosmetics 2003-05-14 17:57 yjung * cplcore/: cpl_objects.c, cpl_objects.h: in progress 2003-05-14 17:16 rpalsa * .bootstrap: Obsolete. 2003-05-14 17:16 rpalsa * Makefile.boot, libcext/Makefile.boot: Replaced by bootstrap shell script. 2003-05-14 17:15 rpalsa * Makefile.am, libcext/Makefile.am: ACLOCAL_AMFLAGS added. 2003-05-14 17:14 rpalsa * acinclude.m4, libcext/acinclude.m4: Package independent macros replaced by common version. Local implementations removed. 2003-05-14 17:13 rpalsa * configure.ac, libcext/configure.ac: Package independent macros replaced by common version. 2003-05-14 17:07 rpalsa * m4macros/cpl.m4: Added. 2003-05-14 17:06 rpalsa * README.CVS: Makefile.boot and kazlib specific parts removed. 2003-05-14 17:03 rpalsa * libcext/bootstrap, bootdirs, bootstrap: Added. 2003-05-14 16:56 rpalsa * libcext/m4macros/eso.m4: Added. 2003-05-14 15:00 rpalsa * kazlib/.cvsignore: Obsolete. Usage of kazlib has bbeen abandoned. 2003-05-14 14:57 rpalsa * kazlib/: CHANGES, MUST_READ, Makefile.am, Makefile.gcc, Makefile.vc, README, acinclude.m4, blast.pl, configure.ac, convenience.m4, dict.c, dict.h, docs.ist, docs.ltx, except.c, except.h, hash.c, hash.h, list.c, list.h, sfx.c, sfx.h, admin/compile, admin/config.guess, admin/config.sub, admin/depcomp, admin/install-sh, admin/ltmain.sh, admin/missing, admin/mkinstalldirs: Obsolete. Usage of kazlib has bbeen abandoned. 2003-05-13 17:05 yjung * cplcore/: cpl_objects.c, cpl_objects.h: Initial revision 2003-05-13 17:00 yjung * cplcore/: cpl_image_binary.c, cpl_image_binary.h: Initial revision 2003-05-12 15:06 yjung * cplcore/: cpl_image_filter.c, cpl_image_filter.h, cpl_image_filter_body.h: changed possible values foe CPL_IMAGE_OPERATION 2003-05-12 15:04 yjung * cplcore/: cpl_image_stats.c, cpl_image_stats.h, cpl_image_stats_body.h: renames possible values for CPL_IMAGE_OPERATION 2003-05-12 14:59 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h: rnamed CPL_OPERATION possible values 2003-05-12 14:55 yjung * cplcore/: cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h: renamed some the CPL_OPERATION possible values 2003-05-12 14:48 yjung * cplcore/cpl_vector.c: use cpl_tools 2003-05-12 14:45 yjung * cplcore/: cpl_image_filter_body.h, cpl_tools.c, cpl_tools.h: cpl_tools_double_sort() renamed in cpl_tools_darray_sort() 2003-05-12 14:33 yjung * cplcore/: cpl_image.c, cpl_image_operation.h: files splitted into cpl_image_io basic filter ans stats 2003-05-12 14:30 yjung * cplcore/: Makefile.am, cpl_image.h, cpl_image_basic_body.h, cpl_image_filter.c, cpl_image_filter_body.h, cpl_image_stats.c, cpl_tools.c, cpl_tools.h: sorting and median -> cpl_tools.ch 2003-05-12 13:51 yjung * cplcore/: cpl_tools.c, cpl_tools.h: Initial revision 2003-05-12 10:54 yjung * cplcore/: cpl_image_basic.c, cpl_image_basic.h, cpl_image_basic_body.h, cpl_image_filter.c, cpl_image_filter.h, cpl_image_filter_body.h, cpl_image_io.c, cpl_image_io.h, cpl_image_io_body.h, cpl_image_stats.c, cpl_image_stats.h, cpl_image_stats_body.h: cpl_image.c splitted in 4 different cpl_image categories 2003-05-09 16:20 cizzo * cplcore/cpl_table.c: Rename cpl_table_select() and cpl_table_unselect() 2003-05-09 14:29 cizzo * cplcore/: cpl_table.c, cpl_table.h: Get rid of several select functions, and eliminate needless type check in comparison between columns 2003-05-06 13:09 cizzo * cplcore/: cpl_column.h, cpl_error.h, cpl_matrix.h, cpl_messaging.h, cpl_table.h: Correct header 2003-05-06 13:05 cizzo * cplcore/: cpl_error.c, cpl_column.c, cpl_matrix.c, cpl_messaging.c, cpl_table.c: Correct header 2003-05-05 13:26 yjung * cplcore/: cpl_image.c, cpl_image.h: changed prototype of cpl_image_convert() 2003-04-30 09:48 yjung * cplcore/cpl_1dfunction.c: forgot a fabs() 2003-04-30 09:43 yjung * cplcore/cpl_vector.h: static function were not supposed to be declared here 2003-04-29 17:29 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h: cpl_function1d_centroid also handles negative values now 2003-04-29 15:49 llundin * cplcore/cpl_image.c: Removed unused declarations found by MKiesgen 2003-04-29 15:23 cizzo * cplcore/cpl_matrix.c: 1x1 matrices are now allowed 2003-04-29 15:22 cizzo * tests/cpl_matrix-test.c: Add test on 1x1 matrix 2003-04-28 09:26 llundin * cplcore/cpl_image.c, tests/check.out.HP-UX: Reverted change in cpl_image.c rev. 1.34. Added stdout/stderr from `make check` on HP-UX (& alpha linux) 2003-04-25 11:27 cizzo * cplcore/cpl_matrix.c: Avoid changing pointer to matrix once it is shifted 2003-04-24 16:35 yjung * tests/: cpl_image_test1.fits, cpl_image_test2.fits: new test FITS files (512x512 instead of 1024x1024) 2003-04-24 16:35 yjung * tests/cpl_image-test.c: reduced IMAGESZ 2003-04-23 17:56 llundin * cplcore/: cpl_image.c, cpl_image_operation.h: Fixed first-pixel-bug in min/max location in cpl_image_stat_subw. Increased memory performance by reordering some loops. 2003-04-17 17:19 llundin * cplcore/: cpl_image.c, cpl_image.h, cpl_image_operation.h: Removed invert & reciprocal functions. Improved accuracy in std.dev. Finalized code reuse 2003-04-17 14:33 llundin * tests/cpl_image-test.c: Express invert & reciprocal by cpl_image_cst_op 2003-04-11 17:50 llundin * cplcore/cpl_image.c: Increased number of digits in printf in cpl_image_stat_dump 2003-04-11 16:13 llundin * cplcore/cpl_image.h: Set result to zero in case of division overflow 2003-04-11 11:50 mkiesgen * libcext/tests/cxstring-test.c: Added test for cxstring 2003-04-11 11:50 mkiesgen * libcext/tests/Makefile.am: Added cxstring-test 2003-04-11 11:49 mkiesgen * libcext/cext/: cxstring.c, cxstring.h: cxstring is a container for a string and its length. 2003-04-11 11:48 mkiesgen * libcext/cext/Makefile.am: Added cxstring. 2003-04-11 11:48 mkiesgen * cplcore/cpl_property.c: Bugfixed cpl_property_copy due to changes in memory allocation 2003-04-11 11:46 mkiesgen * cplcore/: cpl_plist.h, cpl_plist.c: Added erase for keywords starting with a given string. 2003-04-11 11:27 llundin * cplcore/: cpl_image.c, cpl_image.h, cpl_image_operation.h: Fixed rounding problem with sqrt() in cpl_image_stat_subw. Made cpl_image_invert consistent over types 2003-04-11 09:27 llundin * tests/cpl_image-test.c: Moderated ranges and prevented gross rounding errors 2003-04-10 16:09 yjung * cplcore/cpl_image.c: forgot a cast ... 2003-04-10 12:04 yjung * cplcore/cpl_image.c: Check return of stat functions 2003-04-10 11:51 yjung * cplcore/cpl_image.c, cplcore/cpl_image.h, tests/cpl_image-test.c: Statistic object and related functions completely re-written according design discussed together in the CPL meeting 09-04-2003. 2003-04-10 08:11 cizzo * cplcore/cpl_table.c: Minor changes 2003-04-10 08:06 cizzo * cplcore/cpl_column.c: Minor changes 2003-04-10 08:00 cizzo * cplcore/cpl_matrix.c: Minor changes 2003-04-09 15:19 llundin * cplcore/: cpl_image.c, cpl_image.h, cpl_image_operation.h: Robust use of pow() and log(). Rewritten cpl_image_cst_op* to reduce code replication 2003-04-08 18:31 yjung * tests/cpl_image-test.c: added test cases for log ^ and exp 2003-04-08 17:23 llundin * cplcore/cpl_image_operation.h: Fixed cpp warning - really 2003-04-08 17:15 llundin * cplcore/: cpl_image.c, cpl_image.h, cpl_image_operation.h: Fixed cpp warning. Rewritten to reduce code replication 2003-04-08 16:36 rpalsa * cplcore/cpl_error.h, cplcore/cpl_property.h, cplui/cpl_frame.h: Order of typedef and enum definition changed. The HP compiler apparently needs to know the object size for typedef referring to enums. 2003-04-08 16:34 rpalsa * cplcore/cpl_property.c: _cpl_property_value_resize(): Bare type (char *) replaced by library type (cxptr) 2003-04-08 16:16 rpalsa * libcext/cext/cxmemory.c: Standard memory services encapsulated in functions. Defining a symbol is not sufficient on HP-UX without verifying the prototypes 2003-04-08 15:16 rpalsa * libcext/cext/cxtree.c: Order of typedef and enum definition changed for cx_tnode_color. The HP compiler needs to know the object size for this typedef. 2003-04-08 14:45 rpalsa * cplcore/cpl_property.c: cpl_property_get_bool(): cast operation on result fixed. 2003-04-08 12:29 rpalsa * tests/cpl_plist-test.c: Comment updated. 2003-04-08 11:49 yjung * cplcore/: cpl_image.c, cpl_image.h, cpl_image_operation.h: Problems of compilations on HP: moved type_t to cpl_type_t 2003-04-08 11:01 rpalsa * libcext/acinclude.m4: CX_CREATE_CXTYPES: Changed order of inclusion for cxmacros.h. 2003-04-08 10:59 rpalsa * libcext/cext/snprintf.h: Unnecessary includes removed. 2003-04-08 09:25 yjung * cplcore/Makefile.am: added cpl_image_operation.h 2003-04-07 17:05 yjung * cplcore/cpl_image.c: changed comments 2003-04-07 15:57 rpalsa * acinclude.m4: Added option to skip QFITS test completely in CPL_CHECK_QFITS 2003-04-07 15:54 yjung * cplcore/: cpl_image.c, cpl_image.h: reorganized a bit the functions. Corrected the log() bug reported by Lars 2003-04-07 15:20 yjung * tests/cpl_image-test.c: added test on INT and cross types operations 2003-04-07 14:11 yjung * cplcore/cpl_image.c: added support for integer_t images in all functions but filtering functions 2003-04-07 10:28 yjung * cplcore/cpl_image.h: added cpl_image_load_int() 2003-04-04 17:08 yjung * cplcore/: cpl_image.c, cpl_image.h: added cpl_image_convert() - still needs to be tested 2003-04-04 15:59 yjung * cplcore/cpl_image.c, cplcore/cpl_image.h, cplcore/cpl_image_operation.h, tests/cpl_image-test.c: Support now operations on images with differtent types. Removed MACROS for operation functions (to support thes cross operations). Division is correctly done now. In cpl_image_getmaxpos(): corrected bad initialization INT image type support still has to be added. 2003-04-04 11:01 yjung * cplcore/cpl_image.c, cplcore/cpl_image.h, cplcore/cpl_image_operation.h, tests/cpl_image-test.c: moved data to pixels in the cpl_image definition 2003-04-04 10:27 llundin * cplcore/cpl_image.c, cplcore/cpl_image.h, cplcore/cpl_image_operation.h, tests/cpl_image-test.c: Renamed lx/ly (and made new division default) 2003-04-04 09:35 llundin * cplcore/cpl_image_operation.h: Rewritten to reduce code replication 2003-04-04 08:40 llundin * cplcore/: cpl_image.c, cpl_image.h: Rewritten to reduce code replication 2003-04-03 17:21 yjung * tests/: cpl_image-test.c, cpl_image_test1.fits, cpl_image_test2.fits: added 2 input FITS test files and upgraded the cpl_image-test module 2003-04-02 18:54 yjung * cplcore/: cpl_image.c, cpl_image.h: added cpl_image_get_pixels_as_float() cpl_image_get_pixels_as_double() 2003-04-02 18:11 yjung * cplcore/cpl_image.c: some bugs detected thanks to tests cpl_image-test.c 2003-04-02 18:10 yjung * tests/cpl_image-test.c: in progress - still has to be completed 2003-04-02 14:48 yjung * cplcore/cpl_image.c: cpl_image_del() -> cpl_image_delete() 2003-04-02 14:43 yjung * cplcore/cpl_image.c: typo 2003-04-02 14:30 yjung * tests/cpl_image-test.c: new tests for the new cpl_image functions() 2003-04-02 14:22 yjung * tests/Makefile.am: moved image-test to cpl_image-test 2003-04-02 13:13 yjung * tests/image-test.c: moved to cpl_image-test.c 2003-04-02 13:12 yjung * tests/cpl_image-test.c: previously named image-tests.c 2003-04-02 12:01 yjung * cplcore/: cpl_image.c, cpl_image.h: Finished to upgrade the cpl_image functions. Still have to be tested. 2003-04-01 13:48 yjung * cplcore/: cpl_image.c, cpl_image.h: in progress... 2003-03-31 18:06 yjung * cplcore/: cpl_image.c, cpl_image.h: in progress - many functions are still missing 2003-03-19 10:51 mkiesgen * cplcore/cpl_property.c: Changed the memory allocation scheme, due to a misalignment memory allocation problem in the old scheme. Works without memory leaks now. 2003-03-10 11:53 llundin * tests/image-test.c: Renamed cpl_image_t 2003-02-24 17:34 rpalsa * README.CVS: CVSROOT updated, tool versions corrected. 2003-02-10 16:09 yjung * cplcore/: cpl_image.c, cpl_image.h: image_cst_op_local -> cpl_image_cst_op_local image_get_median -> cpl_image_get_median 2003-02-10 16:06 yjung * cplcore/: cpl_image.c, cpl_image.h: pixelvalue-> pixelval 2003-02-10 16:05 yjung * tests/image-test.c: pixelvalue -> pixelval 2003-02-10 13:00 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h, cpl_image.c, cpl_image.h, cpl_vector.c, cpl_vector.h: cleaning 2003-01-14 16:09 rpalsa * configure.ac: CPL_CHECK_LIBCEXT commented out. Not yet implemented. 2002-12-18 08:36 cizzo * cplcore/cpl_error.c: Correct documentation 2002-09-25 10:02 rpalsa * libcext/cext/Makefile.am, Makefile.am, configure.ac, cplcore/Makefile.am, cplui/Makefile.am, libcext/Makefile.am, libcext/configure.ac, libcext/tests/Makefile.am, tests/Makefile.am: Pushed to automake 1.6 2002-09-24 11:13 rpalsa * admin/config.guess, admin/config.sub, admin/depcomp, admin/install-sh, admin/missing, admin/mkinstalldirs, libcext/admin/config.guess, libcext/admin/config.sub, libcext/admin/depcomp, libcext/admin/install-sh, libcext/admin/missing, libcext/admin/mkinstalldirs, libltdl/config.guess, libltdl/config.sub, libltdl/install-sh, libltdl/missing, libltdl/mkinstalldirs: New version installed. 2002-09-02 13:54 cizzo * cplcore/cpl_messaging.c: Add handlers for printing, and do all the messages printing through the cx_print() and cx_printerr() calls 2002-08-26 15:15 rpalsa * tests/: cpl_frame-test.c, cpl_frameset-test.c: Added. 2002-08-26 15:12 rpalsa * tests/Makefile.am: Add cpl_framet and cpl_frameset tests. 2002-08-26 10:43 rpalsa * cplui/: Makefile.am, cpl_frame.c, cpl_frame.h, cpl_frameset.c, cpl_frameset.h: Added. 2002-07-27 15:21 rpalsa * tests/Makefile.am: Cleaned up. Tests cpl_property-test and cpl_plist-test added. 2002-07-27 15:19 rpalsa * tests/: cpl_plist-test.c, cpl_property-test.c: Added. 2002-07-27 15:16 rpalsa * cplcore/: cpl_plist.c, cpl_plist.h, cpl_property.c, cpl_property.h, cpl_macros.h: Added. 2002-07-22 11:30 rpalsa * tests/.cvsignore: Added. 2002-07-19 16:21 rpalsa * libcext/cext/Makefile.am: Make use of CX_DEBUG_FLAGS. 2002-07-19 16:20 rpalsa * libcext/acinclude.m4: CX_DEBUG_FLAGS setup added. 2002-07-19 14:51 rpalsa * libcext/: Makefile.am, configure.ac: Testsuite support added. 2002-07-19 14:49 rpalsa * libcext/tests/: .cvsignore, Makefile.am, cxlist-test.c, cxmap-test.c, cxslist-test.c, cxtree-test.c: Added. 2002-07-19 13:50 rpalsa * libcext/cext/cxtree.c: Bug fixees after testing. 2002-07-19 13:49 rpalsa * libcext/cext/: cxlist.c, cxslist.c: Assertion simplified. 2002-07-17 16:26 rpalsa * libcext/cext/cxlist.c: Various bugs fixed after testing. 2002-07-17 16:25 rpalsa * libcext/cext/cxslist.c: Sentinel node data field initialization removed. 2002-07-17 11:43 rpalsa * libcext/cext/cxslist.c: Various bugs fixed after testing. 2002-07-17 11:41 rpalsa * libcext/cext/cxslist.h: Function name corrected for cx_slist_is_empty(). Changed to cx_slist_empty(). 2002-07-15 14:31 rpalsa * tests/dict-test.c: Obsolete, dictionary implementation moved to C extensions. 2002-07-15 14:29 rpalsa * cplcore/: cpl_dict.c, cpl_dict.h: Obsolete. Implementation replaced by C extensions. 2002-07-15 12:13 rpalsa * cplcore/Makefile.am, tests/Makefile.am: Remove kazlib dependencies. 2002-07-15 12:12 rpalsa * Makefile.am: Remove kazlib support. Subdirectory cplui added. 2002-07-15 12:11 rpalsa * configure.ac: Remove kazlib support. Obsolete. 2002-07-15 12:10 rpalsa * acinclude.m4: Let QFITSDIR take precedence over CPLDIR when locating the qfits library. 2002-07-15 12:05 rpalsa * Makefile.boot: Remove kazlib. Obsolete. 2002-07-15 11:50 rpalsa * libcext/cext/cxfileutils.c: Typo fixed in documentation. 2002-07-15 11:45 rpalsa * libcext/cext/Makefile.am: Module cxfileutils added. 2002-07-15 11:42 rpalsa * libcext/cext/: cxfileutils.c, cxfileutils.h: Added. 2002-07-15 11:39 rpalsa * libcext/cext/cxutils.c: cx_line_alloc() either uses sysconf() or the default. Preprocessor symbols are not used anymore. 2002-07-15 11:35 rpalsa * libcext/configure.ac: Checks for stat macros and stat functions added. 2002-07-10 16:29 rpalsa * libcext/cext/: cxutils.c, cxutils.h: Functions cx_line_max() and cx_line_alloc() added. 2002-07-10 15:44 rpalsa * libcext/: acinclude.m4, configure.ac: Checks for sysconf(), fpathconf() and pathconf() added. 2002-07-04 15:43 rpalsa * libcext/cext/cxmultimap.h: Compare function type corrected in cx_multimap_new() 2002-07-02 16:09 cizzo * cplcore/: cpl_column.c, cpl_matrix.c, cpl_messaging.c, cpl_table.c: Minor changes in the documentation 2002-07-02 15:59 cizzo * doxygen/Doxyfile.in: Restoring original value of EXTRACT_ALL 2002-07-02 15:07 cizzo * cplcore/cpl_error.h: Add documentation to cpl_error_code enum 2002-07-02 15:04 cizzo * doxygen/Doxyfile.in: Minor changes 2002-07-02 14:40 cizzo * cplcore/cpl_error.c: Add extra standard messages 2002-07-02 08:51 cizzo * cplcore/cpl_error.c: Correct cpl_error_set_where() prototype, and add Doxygen preprocessing instructions. 2002-07-02 08:50 cizzo * cplcore/cpl_error.h: Correct cpl_error_set_where() prototype. 2002-07-01 17:04 rpalsa * cplcore/cpl_error.h: FILE_IO and BAD_FILE_FORMAT errors added. 2002-07-01 16:29 cizzo * doxygen/Doxyfile.in: DOXYGEN_SKIP added to PREDEFINED list 2002-07-01 16:27 rpalsa * doxygen/Doxyfile.in: Add directory cplui to input list. 2002-07-01 11:00 cizzo * cplcore/cpl_table.c: Final version of the loader 2002-06-27 11:15 cizzo * cplcore/cpl_table.c: Transform some asserts in recoverable errors 2002-06-27 10:55 cizzo * cplcore/cpl_column.c: Transform some asserts in recoverable errors, and fix some more bugs 2002-06-26 08:44 cizzo * libcext/cext/Makefile.am: Remove module cxstring 2002-06-24 15:53 cizzo * cplcore/cpl_table.c: Changed prototype qfits_query_columns_nulls() 2002-06-24 15:42 rpalsa * libcext/cext/: cxmap.h, cxmultimap.h, cxslist.h, cxtree.h: Typo fixed in comment. 2002-06-24 15:42 rpalsa * libcext/cext/: cxlist.h, cxlist.c: Added. Untested code! 2002-06-21 16:45 rpalsa * libcext/cext/: strlib.c, strlib.h: Discontinued. 2002-06-21 16:45 rpalsa * libcext/cext/Makefile.am: Tree, map and multimap modules added. 2002-06-21 16:44 rpalsa * libcext/cext/: cxmap.c, cxmap.h, cxmultimap.c, cxmultimap.h, cxtree.c, cxtree.h: Added. Untested Code! 2002-06-21 16:37 rpalsa * cplcore/: cpl_error.c, cpl_error.h: Type mismatch error added. 2002-06-21 16:36 rpalsa * libcext/cext/cxslist.c: Function definitions enhanced by using const qualifier for arguments where appropriate. 2002-06-21 16:35 rpalsa * libcext/cext/cxslist.h: Prototypes enhanced by using const qualifier. 2002-06-21 16:33 rpalsa * libcext/cext/cxmessages.c: cx_log_set_level_flags() function name syncronized with prototype. 2002-06-21 16:31 rpalsa * libcext/cext/cxmessages.h: Bug fixed in cx_assert for non-GNU case. 2002-06-21 16:30 rpalsa * libcext/doxygen/Doxyfile.in: Macro expansion changed. 2002-06-19 17:27 cizzo * cplcore/cpl_matrix.c: Now using xmemory.h. Calls to realloc() must be replaced by less efficient code 2002-06-19 17:27 cizzo * tests/cpl_matrix-test.c: Introduce new memory model, and the VERBOSE flag 2002-06-19 16:35 cizzo * cplcore/cpl_table.c: Align to new qfits_query_column_data() prototype 2002-06-19 16:15 cizzo * tests/cpl_table-test.c: Introducing the VERBOSE flag 2002-06-19 16:14 cizzo * cplcore/: cpl_column.c, cpl_table.c: Now using xmemory.h. Calls to realloc() must be replaced by less efficient code 2002-06-19 10:25 cizzo * cplcore/cpl_column.h: Upgrade header 2002-06-19 10:16 cizzo * cplcore/cpl_table.c: Working on loader in progress; now using consistently the memory model defined in xmemory.h 2002-06-19 10:13 cizzo * cplcore/cpl_matrix.c: Fix a bug, other minor changes 2002-06-18 12:40 cizzo * cplcore/: cpl_messaging.c, cpl_messaging.h: Shorten functions names 2002-06-17 13:07 cizzo * cplcore/cpl_matrix.c: Improve error handling 2002-06-17 12:53 cizzo * cplcore/cpl_table.c: Improve error handling 2002-06-17 12:36 cizzo * cplcore/cpl_column.c: Improve error handling 2002-06-17 12:28 cizzo * cplcore/Makefile.am: Add messaging module 2002-06-17 12:28 cizzo * cplcore/: cpl_error.c, cpl_error.h: Add more error codes, and modify cpl_error_set_code() to return the set code 2002-06-17 12:27 cizzo * cplcore/: cpl_messaging.c, cpl_messaging.h: First implementation 2002-06-12 11:15 cizzo * cplcore/: cpl_column.h, cpl_error.h, cpl_matrix.h, cpl_table.h: Minor change 2002-06-12 10:45 cizzo * cplcore/: cpl_error.c, cpl_error.h: Add one more message 2002-06-12 10:44 cizzo * cplcore/cpl_table.c: Several changes, use error module, fix bugs, add functions cpl_table_any_null() and cpl_table_any_valid() 2002-06-12 10:40 cizzo * cplcore/cpl_table.h: Add functions cpl_table_any_null() and cpl_table_any_valid() 2002-06-12 10:38 cizzo * cplcore/: cpl_column.c, cpl_column.h: Add functions cpl_column_any_null() and cpl_column_any_valid() 2002-06-10 16:22 cizzo * cplcore/cpl_matrix.c: Fix wrong usage of cpl_error_set_where() 2002-06-10 13:54 cizzo * cplcore/Makefile.am: Add error module 2002-06-10 13:53 cizzo * cplcore/: cpl_error.c, cpl_error.h: Add some more error flags 2002-06-10 13:52 cizzo * cplcore/cpl_column.c: Unsing error module; some more useless checka are eliminated 2002-06-10 11:23 cizzo * cplcore/: cpl_error.c, cpl_error.h: First implementation 2002-06-10 11:23 cizzo * cplcore/cpl_matrix.c: First using of the error module 2002-06-10 11:21 cizzo * tests/cpl_matrix-test.c: Matching modifications in CPL matrix 2002-06-07 14:35 cizzo * cplcore/cpl_matrix.c: Close doxygen block 2002-06-07 10:42 cizzo * cplcore/cpl_matrix.h: Remove comments in italian... 2002-06-07 09:40 cizzo * cplcore/cpl_matrix.c: Eliminate return status checks from cxmemory routines 2002-06-06 15:58 cizzo * cplcore/Makefile.am: Add include path to cext (hardcoded, to be fixed) 2002-06-06 15:56 cizzo * cplcore/cpl_table.c: Eliminate return status checks from cxmemory routines 2002-06-06 12:20 cizzo * cplcore/cpl_column.c: Eliminate return status checks from cxmemory routines 2002-06-06 08:01 cizzo * cplcore/: cpl_table.c, cpl_table.h: Support column unit and format 2002-06-05 16:55 rpalsa * cplcore/Makefile.am: Blank lines removed. 2002-06-05 16:46 cizzo * cplcore/: cpl_column.c, cpl_column.h: Add unit and format to cpl_column 2002-06-04 14:41 rpalsa * libcext/cext/Makefile.am: Intermediate version. Subset of modules added. 2002-06-04 14:34 rpalsa * libcext/acinclude.m4: Changed the whole thing. 2002-06-04 14:34 rpalsa * libcext/configure.ac: Checks for particular functions added. 2002-06-04 14:32 rpalsa * libcext/cext/: cxslist.c, cxslist.h: Added. Untested code! 2002-06-04 14:31 rpalsa * libcext/cext/: cxmacros.h, cxmemory.c, cxmemory.h, cxmessages.c, cxmessages.h, cxstrutils.c, cxstrutils.h, cxtypes.h.bot, cxtypes.h.top, cxutils.c, cxutils.h, snprintf.c, snprintf.h: Added. 2002-05-15 14:35 cizzo * cplcore/cpl_table.c: Some optimizations added 2002-05-12 14:08 cizzo * cplcore/: cpl_column.c, cpl_column.h: Completed code optimization 2002-05-09 16:16 cizzo * cplcore/cpl_column.c: Optimization of some routines 2002-05-09 14:15 cizzo * cplcore/cpl_matrix.c: Optimization 2002-05-09 14:14 cizzo * tests/cpl_matrix-test.c: Add one more test 2002-05-09 11:54 cizzo * tests/cpl_matrix-test.c: Improve checks 2002-05-07 14:50 cizzo * cplcore/cpl_matrix.c: Add functions for median computation, and avoid creation of 1x1 matrices 2002-05-07 14:48 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_table.c, cpl_table.h: Add functions for median computation 2002-05-07 14:45 cizzo * tests/cpl_table-test.c: Minor changes 2002-05-05 15:24 cizzo * tests/Makefile.am: Add cpl_matrix tester 2002-05-05 15:20 cizzo * cplcore/Makefile.am: Add matrix class 2002-05-05 15:20 cizzo * cplcore/cpl_matrix.c, cplcore/cpl_matrix.h, tests/cpl_matrix-test.c: Implementation 2002-04-26 08:58 rpalsa * doxygen/: cplref_applications.tex, cplref_installation.tex, cplref_introduction.tex: Comments included. 2002-04-24 15:48 rpalsa * doxygen/cpl_reference.tex: Change record: correct date inserted. 2002-04-24 15:31 rpalsa * doxygen/: cpl_reference.tex, cplref_applications.tex, cplref_components.tex, cplref_installation.tex, cplref_introduction.tex, dmd-doc.sty, layout.tex, shortcut.tex, eso-logo.eps: Added. 2002-04-24 14:21 rpalsa * cplcore/: cpl_image.c, cpl_image.h: Changed to new header template. 2002-04-18 15:01 cizzo * cplcore/: cpl_column.c, cpl_table.c: Correct standard header 2002-04-18 15:01 cizzo * cplcore/: cpl_table.h, cpl_column.h, cpl_matrix.h: Add standard header 2002-04-18 14:36 cizzo * cplcore/cpl_matrix.h: First (untested) implementation 2002-04-10 15:43 yjung * cplcore/: cpl_vector.c, cpl_vector.h: added cpl_vector_threshold() 2002-04-10 14:53 csabet * cplcore/cpl_image.c: Removed the cause for a warning 2002-04-10 14:52 csabet * cplcore/cpl_vector.h: added prototypes for the new routines 2002-04-10 14:52 csabet * cplcore/cpl_vector.c: Changed two routines subject to further discussion 2002-03-21 17:42 cizzo * cplcore/: cpl_table.c, cpl_table.h: Add new function() 2002-03-21 17:38 cizzo * cplcore/: cpl_column.c, cpl_column.h: Add new module cpl_column_set_data_null() 2002-03-18 18:06 cizzo * cplcore/cpl_table.c: Fix sorting routine 2002-03-18 18:05 cizzo * tests/cpl_table-test.c: Add sorting checks 2002-03-18 10:34 ndevilla * tests/image-test.c: Added basic tests for arithmetic. 2002-03-18 10:33 ndevilla * cplcore/cpl_image.c: Corrected bug in cpl_image_mul 2002-03-13 12:04 rpalsa * Makefile.boot: Use correct syntax for test command in boot-libltdl and boot-kazlib. 2002-03-13 09:52 cizzo * tests/: cpl_table-test.c, cpl_table-testfail1.c, cpl_table-testfail2.c: Silence the 'OK' messages of the program 2002-03-13 09:37 cizzo * tests/Makefile.am: Add tests for the cpl_table class 2002-03-13 09:37 cizzo * tests/cpl_table-testfail2.c: Trying to create a table modeled on an existing cpl_table, specifying a negative number of rows. 2002-03-13 09:36 cizzo * tests/cpl_table-testfail1.c: Trying to create a table with negative number of rows 2002-03-13 09:35 cizzo * tests/cpl_table-test.c: Implementation (test on selection and sorting still missing) 2002-03-13 08:56 cizzo * cplcore/cpl_table.c: Implementation of cpl_table_column_exist(), eliminate a buggy speedup, fix more bugs 2002-03-13 08:51 cizzo * cplcore/cpl_table.h: Declaration of cpl_table_column_exist() and cpl_table_compare_structures(), correct declaration of cpl_table_set_segment_null() 2002-03-13 08:50 cizzo * cplcore/cpl_column.c: Fix s few bugs 2002-03-07 15:35 yjung * cplcore/cpl_vector.c: added the size of vector 2002-03-07 15:34 yjung * cplcore/cpl_1dfunction.c: ... 2002-03-07 15:34 yjung * tests/cpl_1dfunction-test.c: added tests 2002-03-07 14:57 yjung * tests/cpl_1dfunction-test.c: first usable version 2002-03-07 14:02 yjung * tests/cpl_vector-test.c: ... 2002-03-07 12:34 yjung * tests/cpl_vector-test.c: usable now 2002-03-06 16:39 yjung * tests/Makefile.am: added cpl_vector-test and cpl_1dfunction-test 2002-03-06 16:29 yjung * tests/: cpl_1dfunction-test.c, cpl_vector-test.c: Initial revision 2002-03-06 16:29 yjung * tests/: cpl_1dfunction.c, cpl_vector_test.c: [no log message] 2002-03-06 16:21 yjung * tests/: cpl_1dfunction.c, cpl_vector_test.c: Initial revision 2002-03-05 15:21 rpalsa * cplcore/Makefile.am: Add -lm to libcplcore_la_LIBADD to satisfy the library dependency. 2002-03-04 10:50 ndevilla * tests/image-test.c: Initial release, just to see if it compiles. 2002-03-04 10:50 ndevilla * tests/Makefile.am: Added image-test target 2002-02-22 13:21 yjung * cplcore/cpl_1dfunction.c: bad function call... 2002-02-22 13:03 ndevilla * cplcore/cpl_image.c: Renamed eclipse functions, removed eclipse error handling, added pixel sorting routines. 2002-02-22 09:23 rpalsa * tests/Makefile.am: Empty XFAIL_TESTS hook added. 2002-02-22 08:58 rpalsa * tests/Makefile.am: Don't distribute test executables. TESTS removed from EXTRA_DIST. 2002-02-22 08:54 rpalsa * configure.ac: Create Makefile for the testsuite. 2002-02-22 08:53 rpalsa * Makefile.am: Added testsuite directory. 2002-02-22 08:52 rpalsa * tests/: Makefile.am, dict-test.c: Added. 2002-02-20 14:31 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h, cpl_vector.c, cpl_vector.h: updated files headers 2002-02-19 16:59 cizzo * cplcore/: cpl_column.c, cpl_column.h, cpl_table.c, cpl_table.h: Replace size_t -> int, on failure/success return 0/not-zero instead of EXIT_SUCCESS/EXIT_FAILURE, and other changes in the documentation 2002-02-18 16:52 ndevilla * cplcore/: cpl_image.c, cpl_image.h: added load/save functions. 2002-02-18 14:17 cizzo * cplcore/cpl_table.c: Move @return after @param documentation 2002-02-12 13:03 rpalsa * cplcore/Makefile.am: cpl_image.h added to include_HEADERS 2002-02-07 15:54 ndevilla * cplcore/cpl_vector.c: Removed GNU attributes for some functions. Not needed here. 2002-02-07 15:03 ndevilla * README.CVS: Added section about qfits. 2002-02-07 12:56 rpalsa * cplcore/Makefile.am: Handle qfits as installed library. 2002-02-07 12:55 rpalsa * configure.ac: Check for external qfits library. Removed qfits from CONFIG_SUBDIRS 2002-02-07 12:53 rpalsa * acinclude.m4: Macro CPL_CHECK_QFITS added. 2002-02-07 12:53 rpalsa * Makefile.am: Support for qfits as part of the CPL tree removed. 2002-02-07 12:52 rpalsa * .bootstrap: Directory qfits removed. 2002-02-07 12:04 rpalsa * README.CVS: Updated with respect to the changed handling of Qfits. 2002-02-06 17:16 ndevilla * cplcore/: cpl_image.c, cpl_image.h: Added filtering functions. 2002-01-23 16:10 ndevilla * cplcore/cpl_image.c: Suppressed e_error messages. 2002-01-21 09:47 rpalsa * kazlib/convenience.m4: Don't rely on variable LIBTOOL in check whether litool is used or not. 2002-01-21 09:38 rpalsa * configure.ac: Changed location of KAZLIB_CONVENIENCE_LIBRARY. Must run after AC_PROG_LIBTOOL. 2002-01-21 09:19 rpalsa * kazlib/convenience.m4: Check if libtool is used and determine proper library suffix. 2002-01-16 18:05 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h: added modifs requested during CPL meeting 2002-01-16 17:58 yjung * cplcore/: cpl_vector.c, cpl_vector.h: modif after meeting requests 2002-01-16 14:30 yjung * cplcore/: cpl_vector.c, cpl_vector.h: added some functions required by Cyrus 2002-01-16 13:49 rpalsa * acinclude.m4, libcext/acinclude.m4: Typo fixed. 2002-01-16 12:55 rpalsa * kazlib/configure.ac: AC_PROG_RANLIB removed, since AC_PROG_LIBTOOL does it too. 2002-01-16 09:06 rpalsa * kazlib/Makefile.am: Better test for dvi file in target dist-hook. 2002-01-16 09:06 rpalsa * Makefile.am, libcext/Makefile.am: Better test for html subdirectory in target dist-hook. 2002-01-14 11:22 rpalsa * kazlib/Makefile.am: Typo fixed in MAINTAINER_MODE conditional. 2002-01-14 10:07 rpalsa * kazlib/Makefile.am: Remove aclocal.m4 from MAINTAINERCLEANFILES when building a convenience library, since the parent configure might depend on it. 2002-01-14 10:05 rpalsa * Makefile.am: Add kazlib's aclocal.m4 to MAINTAINERCLEANFILES. 2002-01-11 16:27 yjung * cplcore/: cpl_vector.c, cpl_vector.h: moved a part to cpl_1dfunction and changed cpl_vector type 2002-01-11 16:27 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h: first valid version 2002-01-11 16:26 yjung * cplcore/Makefile.am: added cpl_1dfunction.[ch] 2002-01-11 16:03 ndevilla * cplcore/Makefile.am: Added cpl_image.c 2002-01-11 16:03 ndevilla * cplcore/: cpl_image.c, cpl_image.h: Initial release, contains various constructors/destructors, arithmetic operators, statistics computation and various data extraction routines. Still missing FITS I/O. 2002-01-11 14:18 yjung * cplcore/: cpl_1dfunction.c, cpl_1dfunction.h: Initial revision 2002-01-08 15:34 cizzo * cplcore/cpl_table.h: Select functions now return correctly size_t instead of int 2002-01-08 15:33 cizzo * cplcore/cpl_table.c: Review documentation, and apply some minor changes 2002-01-08 15:18 rpalsa * kazlib/configure.ac: Test for working malloc() removed. Use simple check for vprintf(). 2002-01-08 15:14 rpalsa * kazlib/acinclude.m4: Bug in macro KAZLIB_ENABLE_EXCEPTIONS fixed. Output of default parameter values unified. 2002-01-08 13:51 cizzo * cplcore/cpl_column.c: Review documentation, and some minor changes 2002-01-07 18:30 cizzo * cplcore/Makefile.am: Add modules cpl_table and cpl_column 2002-01-07 18:29 cizzo * cplcore/: cpl_column.h, cpl_column.c, cpl_table.c, cpl_table.h: Implementation 2002-01-07 16:04 rpalsa * kazlib/Makefile.am: sfx.c moved to EXTRA_libkaz_SOURCES. 2002-01-07 15:32 rpalsa * cplcore/cpl_dict.h: Iterator type removed. 2002-01-07 15:04 rpalsa * Makefile.am: Add kazlib to aclocal include path. 2002-01-04 10:32 yjung * cplcore/: cpl_vector.c, cpl_vector.h: Still in development 2002-01-04 10:31 yjung * cplcore/Makefile.am: added cpl_vector.[ch] 2002-01-02 16:51 yjung * cplcore/: cpl_vector.c, cpl_vector.h: Initial revision 2002-01-01 15:00 rpalsa * acinclude.m4, libcext/acinclude.m4: Changed behaviour of ENABLE_DEBUG macro. This should avoid the necessity of calling ENABLE_DEBUG before any other macro setting compiler options. 2002-01-01 13:38 rpalsa * acinclude.m4, libcext/acinclude.m4: Avoid (cached) output when ENABLE_DEBUG and ENABLE_STRICT macros run the first time. Bug fixed in ENABLE_STRICT macro. Not needed AC_REQUIRE removed from ENABLE_DEBUG and ENABLE_STRICT macros. 2001-12-30 22:15 rpalsa * acinclude.m4, libcext/acinclude.m4: Bug fixed when caching results in ENABLE_DEBUG and ENABLE_STRICT macros. 2001-12-19 13:00 rpalsa * README.CVS: Topics added. Some recommendations about the installation process. 2001-12-19 09:28 rpalsa * Makefile.am: Distribute files AUTHORS, COPYING, INSTALL and README. Added to EXTRA_DIST. 2001-12-19 09:13 cizzo * libcext/cext/strlib.c: Set variables to consistent types 2001-12-17 17:35 rpalsa * AUTHORS, BUGS, COPYING, ChangeLog, INSTALL, NEWS, README, README.CVS, TODO: Added. 2001-12-17 14:17 rpalsa * configure.ac: Package version set to 0.0 2001-12-17 11:14 rpalsa * cplcore/Makefile.am: Changed symbol INCLUDES to use correct path to qfits includes. 2001-12-17 11:13 rpalsa * acinclude.m4: Changed symbol LIBQFITS to correct path. 2001-12-17 11:12 rpalsa * Makefile.am: Added generated files in libltdl to MAINTAINERCLEANFILES. 2001-12-17 09:56 rpalsa * libltdl/: .cvsignore, COPYING.LIB, Makefile.am, README, acinclude.m4, config.guess, config.sub, configure.in, install-sh, ltconfig, ltdl.c, ltdl.h, ltmain.sh, missing, mkinstalldirs: Import of GNU libltdl from libtool 1.4.2 2001-12-17 09:56 rpalsa * libltdl/: .cvsignore, COPYING.LIB, Makefile.am, README, acinclude.m4, config.guess, config.sub, configure.in, install-sh, ltconfig, ltdl.c, ltdl.h, ltmain.sh, missing, mkinstalldirs: Initial revision 2001-12-17 09:42 rpalsa * kazlib/: admin/compile, admin/config.guess, admin/config.sub, admin/depcomp, admin/install-sh, admin/ltmain.sh, admin/missing, admin/mkinstalldirs, .cvsignore, Makefile.am, acinclude.m4, configure.ac, convenience.m4: Added when adding support for automake/autoconf. 2001-12-17 09:31 rpalsa * kazlib/: CHANGES, MUST_READ, Makefile.gcc, Makefile.vc, README, blast.pl, dict.c, dict.h, docs.ist, docs.ltx, except.c, except.h, hash.c, hash.h, list.c, list.h, sfx.c, sfx.h: Import of kazlib v1.20 2001-12-17 09:31 rpalsa * kazlib/: CHANGES, MUST_READ, Makefile.gcc, Makefile.vc, README, blast.pl, dict.c, dict.h, docs.ist, docs.ltx, except.c, except.h, hash.c, hash.h, list.c, list.h, sfx.c, sfx.h: Initial revision 2001-12-14 16:19 rpalsa * libcext/: .cvsignore, Makefile.am, Makefile.boot, acinclude.m4, configure.ac, admin/config.guess, admin/config.sub, admin/depcomp, admin/html.am, admin/install-sh, admin/ltmain.sh, admin/missing, admin/mkinstalldirs, cext/.cvsignore, cext/Makefile.am, cext/strlib.c, cext/strlib.h, doxygen/.cvsignore, doxygen/Doxyfile.in: Imported libcext sources. 2001-12-14 16:19 rpalsa * libcext/: .cvsignore, Makefile.am, Makefile.boot, acinclude.m4, configure.ac, admin/config.guess, admin/config.sub, admin/depcomp, admin/html.am, admin/install-sh, admin/ltmain.sh, admin/missing, admin/mkinstalldirs, cext/.cvsignore, cext/Makefile.am, cext/strlib.c, cext/strlib.h, doxygen/.cvsignore, doxygen/Doxyfile.in: Initial revision 2001-12-14 16:13 rpalsa * .bootstrap, .cvsignore, Makefile.am, Makefile.boot, acinclude.m4, configure.ac, admin/config.guess, admin/config.sub, admin/depcomp, admin/html.am, admin/install-sh, admin/ltmain.sh, admin/missing, admin/mkinstalldirs, cplbase/.cvsignore, cplcore/.cvsignore, cplcore/Makefile.am, cplcore/cpl_dict.c, cplcore/cpl_dict.h, cplui/.cvsignore, doxygen/.cvsignore, doxygen/Doxyfile.in: Imported CPL sources. 2001-12-14 16:13 rpalsa * .bootstrap, .cvsignore, Makefile.am, Makefile.boot, acinclude.m4, configure.ac, admin/config.guess, admin/config.sub, admin/depcomp, admin/html.am, admin/install-sh, admin/ltmain.sh, admin/missing, admin/mkinstalldirs, cplbase/.cvsignore, cplcore/.cvsignore, cplcore/Makefile.am, cplcore/cpl_dict.c, cplcore/cpl_dict.h, cplui/.cvsignore, doxygen/.cvsignore, doxygen/Doxyfile.in: Initial revision cpl-6.4.1/admin/0000755000460300003120000000000012310333011010345 500000000000000cpl-6.4.1/admin/compile0000744000460300003120000001624512310332723011662 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2012 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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 2, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/admin/ltmain.sh0000644000460300003120000105152212310332713012123 00000000000000 # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.2 TIMESTAMP="" package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 cpl-6.4.1/admin/doxygen.am0000644000460300003120000000446212112623623012302 00000000000000DOXYGEN_BUILD_DIR = $(top_builddir) if MAINTAINER_MODE DOXYGEN_RECURSIVE_TARGETS = install-doxygen-recursive doxygen: doxygen-am doxygen-am: @if test -f $(DOXYGEN_BUILD_DIR)/Doxyfile; then \ echo "cd $(DOXYGEN_BUILD_DIR) && $(DOXYGEN)"; \ d=`pwd`; cd $(DOXYGEN_BUILD_DIR) && $(DOXYGEN); cd $$d; \ if test -n "$(POST_DOXYGEN_CLEANFILES)"; then \ cd $(DOXYGEN_BUILD_DIR)/html && rm -f $(POST_DOXYGEN_CLEANFILES); \ fi; \ else \ echo "Nothing to be done for \`$@'."; \ fi clean-doxygen: clean-doxygen-am clean-doxygen-am: -rm -rf $(DOXYGEN_BUILD_DIR)/html DOXYGEN_INSTALL_TARGETS = doxygen-am install-doxygen-generic else DOXYGEN_RECURSIVE_TARGETS = install-doxygen-recursive DOXYGEN_INSTALL_TARGETS = install-doxygen-generic endif install-doxygen: install-doxygen-recursive install-doxygen-am: $(DOXYGEN_INSTALL_TARGETS) install-doxygen-generic: @$(NORMAL_INSTALL) @if test -d $(DOXYGEN_BUILD_DIR)/html; then \ echo "$(mkinstalldirs) $(DESTDIR)$(apidocdir)"; \ $(mkinstalldirs) $(DESTDIR)$(apidocdir); \ list="`ls -1 $(DOXYGEN_BUILD_DIR)/html`"; \ for p in $$list; do \ if test -f $(DOXYGEN_BUILD_DIR)/html/$$p; then \ echo " $(INSTALL_DATA) $(DOXYGEN_BUILD_DIR)/html/$$p $(DESTDIR)$(apidocdir)/$$p"; \ $(INSTALL_DATA) $(DOXYGEN_BUILD_DIR)/html/$$p $(DESTDIR)$(apidocdir)/$$p; \ else if test -f $$p; then \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(apidocdir)/$$p"; \ $(INSTALL_DATA) $$p $(DESTDIR)$(apidocdir)/$$p; \ fi; fi; \ done; \ fi uninstall-doxygen: @$(NORMAL_UNINSTALL) @list="`ls -1 $(DESTDIR)$(apidocdir)`"; \ for p in $$list; do \ echo " rm -f $(DESTDIR)$(apidocdir)/$$p"; \ rm -f $(DESTDIR)$(apidocdir)/$$p; \ done $(DOXYGEN_RECURSIVE_TARGETS): @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(DOXYGEN_SUBDIRS)'; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" cpl-6.4.1/admin/depcomp0000744000460300003120000005570312310332724011664 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2012-10-18.11; # UTC # Copyright (C) 1999-2012 Free Software Foundation, Inc. # 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 2, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/admin/config.guess0000744000460300003120000012760712310332723012631 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-09-25' # This file 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 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, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cpl-6.4.1/admin/config.sub0000744000460300003120000010565612310332723012274 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-12-06' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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 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, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cpl-6.4.1/admin/test-driver0000744000460300003120000000761112310332724012500 00000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2012-06-27.10; # UTC # Copyright (C) 2011-2012 Free Software Foundation, Inc. # # 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 2, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then estatus=1 fi case $estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/admin/install-sh0000744000460300003120000003325512310332723012310 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/admin/missing0000744000460300003120000001533112310332723011676 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2012-06-26.16; # UTC # Copyright (C) 1996-2012 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # 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 2, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'automa4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/Doxyfile.in0000644000460300003120000023007712073537611011343 00000000000000# Doxyfile 1.8.2 # 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 = "Common Pipeline Library Reference Manual" # 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 = @VERSION@ # 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, 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 = YES # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. 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 = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful 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 = 4 # 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 = "error=
Errors
" \ enderror=
# 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 = NO # 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 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 = NO # 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 = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous 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 = YES # 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 = YES # 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 = NO # 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 = NO # 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 = YES # 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 = YES # 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 = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or 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 = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and 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. 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 = # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @top_srcdir@/cplcore \ @top_srcdir@/cplui \ @top_srcdir@/cpldrs \ @top_srcdir@/cpldfs # 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 = *.dox \ *.h \ *.c # 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 = NO # 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 = CVS # 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 = cpl_tools.c # 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 , where # is the value of the INPUT_FILTER tag, and 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 = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C, 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 = NO #--------------------------------------------------------------------------- # 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 = @top_srcdir@/doxygen/cpl.css # 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 = NO # 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 = NO # 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 = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # 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 # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. 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 = NO # 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 = 1 # 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 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 = NO # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # 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 = YES # 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 = times # 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 = # 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 = # 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 = # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = # 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 for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # 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 = "CPL_BEGIN_DECLS= " \ "CPL_END_DECLS= " \ "CPL_ATTR_ALLOC= " \ "CPL_ATTR_NONNULL= " \ "cpl_error_set_(x)= " \ "__attribute__(x)= " \ DOXYGEN_SKIP # 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 = CPL_TYPE_ADD # 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 = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = #--------------------------------------------------------------------------- # 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 = NO # 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 = Helvetica # 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 = NO # 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 cpl-6.4.1/cpldrs/0000755000460300003120000000000012310333011010544 500000000000000cpl-6.4.1/cpldrs/cpl_fit.h0000644000460300003120000001031712253611520012271 00000000000000/* $Id: cpl_fit.h,v 1.10 2011-07-27 14:18:36 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-27 14:18:36 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_FIT_H #define CPL_FIT_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /* * Default parameter values for * Levenberg-Marquardt fitting */ #ifndef CPL_FIT_LVMQ_TOLERANCE #define CPL_FIT_LVMQ_TOLERANCE 0.01 #endif /* Should be << 1. (A relative decrease in chi squared << 1 is not statistically significant so there is no point in converging to machine precision.) */ #ifndef CPL_FIT_LVMQ_COUNT #define CPL_FIT_LVMQ_COUNT 5 #endif /* Should be somewhat greater than 1 */ #ifndef CPL_FIT_LVMQ_MAXITER #define CPL_FIT_LVMQ_MAXITER 1000 #endif /* Should be >> 1 */ /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_error_code cpl_fit_lvmq(const cpl_matrix*, const cpl_matrix*, const cpl_vector*, const cpl_vector*, cpl_vector*, const int[], int (*)(const double[], const double[], double*), int (*)(const double[], const double[], double[]), double, int, int, double*, double*, cpl_matrix**); cpl_imagelist* cpl_fit_imagelist_polynomial(const cpl_vector*, const cpl_imagelist*, cpl_size, cpl_size, cpl_boolean, cpl_type, cpl_image*) CPL_ATTR_ALLOC; cpl_imagelist* cpl_fit_imagelist_polynomial_window(const cpl_vector*, const cpl_imagelist*, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_boolean, cpl_type, cpl_image*) CPL_ATTR_ALLOC; cpl_error_code cpl_fit_image_gaussian(const cpl_image*, const cpl_image*, cpl_size, cpl_size, cpl_size, cpl_size, cpl_array*, cpl_array*, const cpl_array*, double*, double*, cpl_matrix**, double*, double*, double*, cpl_matrix**); double cpl_gaussian_eval_2d(const cpl_array *, double, double); CPL_END_DECLS #endif /* end of cpl_fit.h */ cpl-6.4.1/cpldrs/cpl_wlcalib_impl.h0000644000460300003120000000515611667361405014166 00000000000000/* $Id: cpl_wlcalib_impl.h,v 1.3 2011-12-06 09:40:21 llundin Exp $ * * This file is part of the CPL package * Copyright (C) 2002,2003 European Southern Observatory * * 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 2 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * $Author: llundin $ * $Date: 2011-12-06 09:40:21 $ * $Revision: 1.3 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_WLCALIB_IMPL_H #define CPL_WLCALIB_IMPL_H /*----------------------------------------------------------------------------- Include -----------------------------------------------------------------------------*/ #include "cpl_wlcalib.h" /*----------------------------------------------------------------------------- Functions prototypes -----------------------------------------------------------------------------*/ /* Cost counting functions for the slitmodel */ cpl_error_code cpl_wlcalib_slitmodel_add_cost(cpl_wlcalib_slitmodel *, cpl_size); cpl_error_code cpl_wlcalib_slitmodel_add_xcost(cpl_wlcalib_slitmodel *, cpl_size); cpl_error_code cpl_wlcalib_slitmodel_add_ulines(cpl_wlcalib_slitmodel *, cpl_size); /* Acessors of the slitmodel */ double cpl_wlcalib_slitmodel_get_wslit(const cpl_wlcalib_slitmodel *); double cpl_wlcalib_slitmodel_get_wfwhm(const cpl_wlcalib_slitmodel *); double cpl_wlcalib_slitmodel_get_threshold(const cpl_wlcalib_slitmodel *); cpl_size cpl_wlcalib_slitmodel_get_cost(const cpl_wlcalib_slitmodel *); cpl_size cpl_wlcalib_slitmodel_get_xcost(const cpl_wlcalib_slitmodel *); cpl_size cpl_wlcalib_slitmodel_get_ulines(const cpl_wlcalib_slitmodel *); cpl_bivector * cpl_wlcalib_slitmodel_get_catalog(cpl_wlcalib_slitmodel *); const cpl_bivector * cpl_wlcalib_slitmodel_get_catalog_const(const cpl_wlcalib_slitmodel *); cpl_bivector * cpl_wlcalib_slitmodel_unset_catalog(cpl_wlcalib_slitmodel *); #endif cpl-6.4.1/cpldrs/cpl_detector.c0000644000460300003120000007342712245344116013333 00000000000000/* $Id: cpl_detector.c,v 1.33 2012-10-29 14:27:53 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-10-29 14:27:53 $ * $Revision: 1.33 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_detector.h" #include #include #include #include #include #include /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ /* Computes the square of an euclidean distance bet. 2 points */ #define pdist(x1,y1,x2,y2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2))) /** Computes the square of an euclidean distance bet. 2 points (polar coord) */ #define qdist(r1,t1,r2,t2) \ ((r1*r1)+(r2*r2)-2*r1*r2*cos((t1-t2))) #define CPL_CLASS_NONE 0 #define CPL_CLASS_DOUBLE 1 #define CPL_CLASS_FLOAT 2 #define CPL_CLASS_INT 3 /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_detector High-level functions to compute detector features * * @par Synopsis: * @code * #include "cpl_detector.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Private Function declarations and definitions -----------------------------------------------------------------------------*/ /* Define the C-type dependent functions */ /* These three macros are needed for support of the different pixel types */ #define CONCAT(a,b) a ## _ ## b #define CONCAT2X(a,b) CONCAT(a,b) #define CPL_TYPE double complex #define CPL_NAME_TYPE double_complex #define CPL_SUM_TYPE double complex #include "cpl_detector_body.h" #undef CPL_TYPE #undef CPL_NAME_TYPE #define CPL_TYPE float complex #define CPL_NAME_TYPE float_complex #include "cpl_detector_body.h" #undef CPL_TYPE #undef CPL_NAME_TYPE #undef CPL_SUM_TYPE #define CPL_TYPE double #define CPL_NAME_TYPE double #define CPL_SUM_TYPE double #include "cpl_detector_body.h" #undef CPL_TYPE #undef CPL_NAME_TYPE #define CPL_TYPE float #define CPL_NAME_TYPE float #include "cpl_detector_body.h" #undef CPL_TYPE #undef CPL_NAME_TYPE #define CPL_TYPE int #define CPL_NAME_TYPE int #define CPL_DO_ROUND #include "cpl_detector_body.h" #undef CPL_TYPE #undef CPL_NAME_TYPE #undef CPL_DO_ROUND #undef CPL_SUM_TYPE static cpl_error_code cpl_flux_get_window(const cpl_image *, const cpl_size *, cpl_size, cpl_size, double *, double *, double *, double *); static cpl_bivector * cpl_bivector_gen_rect_poisson(const cpl_size *, const cpl_size, const cpl_size) CPL_ATTR_NONNULL CPL_ATTR_ALLOC; static cpl_bivector * cpl_bivector_gen_ring_poisson(const double *, const cpl_size, const cpl_size) CPL_ATTR_NONNULL CPL_ATTR_ALLOC; /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ #define RECT_RON_HS 4 #define RECT_RON_SAMPLES 100 /*----------------------------------------------------------------------------*/ /** @brief Compute the readout noise in a rectangle. @param diff Input image, usually a difference frame. @param zone_def Zone where the readout noise is to be computed. @param ron_hsize to specify half size of squares (<0 to use default) @param ron_nsamp to specify the nb of samples (<0 to use default) @param noise Output parameter: noise in the frame. @param error Output parameter: error on the noise. @return CPL_ERROR_NONE on success or the relevant #_cpl_error_code_ on error @see rand() @note No calls to srand() are made from CPL This function is meant to compute the readout noise in a frame by means of a MonteCarlo approach. The input is a frame, usually a difference between two frames taken with the same settings for the acquisition system, although no check is done on that, it is up to the caller to feed in the right kind of frame. The provided zone is an array of four integers specifying the zone to take into account for the computation. The integers specify ranges as xmin, xmax, ymin, ymax, where these coordinates are given in the FITS notation (x from 1 to lx, y from 1 to ly and bottom to top). Specify NULL instead of an array of four values to use the whole frame in the computation. The algorithm will create typically 100 9x9 windows on the frame, scattered optimally using a Poisson law. In each window, the standard deviation of all pixels in the window is computed and this value is stored. The readout noise is the median of all computed standard deviations, and the error is the standard deviation of the standard deviations. Both noise and error are returned by modifying a passed double. If you do not care about the error, pass NULL. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if diff or noise is NULL - CPL_ERROR_ILLEGAL_INPUT if the specified window (zone_def) is invalid */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_flux_get_noise_window(const cpl_image * diff, const cpl_size * zone_def, cpl_size ron_hsize, cpl_size ron_nsamp, double * noise, double * error) { return cpl_flux_get_window(diff, zone_def, ron_hsize, ron_nsamp, noise, error, NULL, NULL) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Compute the bias in a rectangle. @param diff Input image, usually a difference frame. @param zone_def Zone where the bias is to be computed. @param ron_hsize to specify half size of squares (<0 to use default) @param ron_nsamp to specify the nb of samples (<0 to use default) @param bias Output parameter: bias in the frame. @param error Output parameter: error on the bias. @return CPL_ERROR_NONE on success or the relevant #_cpl_error_code_ on error @see cpl_flux_get_noise_window(), rand() @note No calls to srand() are made from CPL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_flux_get_bias_window(const cpl_image * diff, const cpl_size * zone_def, cpl_size ron_hsize, cpl_size ron_nsamp, double * bias, double * error) { return cpl_flux_get_window(diff, zone_def, ron_hsize, ron_nsamp, NULL, NULL, bias, error) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /* @brief Internal function, wrapped by cpl_flux_get_{noise,bias}_window(). */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_flux_get_window( const cpl_image * diff, const cpl_size * zone_def, cpl_size ron_hsize, cpl_size ron_nsamp, double * noise, double * noise_error, double * bias, double * bias_error) { cpl_errorstate prestate = cpl_errorstate_get(); const cpl_size hsize = ron_hsize < 0 ? RECT_RON_HS : ron_hsize; const cpl_size nsamples = ron_nsamp < 0 ? RECT_RON_SAMPLES : ron_nsamp; cpl_bivector * sample_reg; cpl_vector * rms_list = NULL; cpl_vector * bias_list = NULL; cpl_size rect[4]; cpl_size zone[4]; const double * px; const double * py; double * pr1 = NULL; double * pr2 = NULL; cpl_size i; /* Test entries */ cpl_ensure_code(diff != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(noise != NULL || bias != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(nsamples > 0, CPL_ERROR_ILLEGAL_INPUT); /* Generate nsamples window centers in the image */ if (zone_def != NULL) { rect[0] = zone_def[0] + hsize + 1; /* xmin */ rect[1] = zone_def[1] - hsize - 1; /* xmax */ rect[2] = zone_def[2] + hsize + 1; /* ymin */ rect[3] = zone_def[3] - hsize - 1; /* ymax */ } else { rect[0] = hsize + 1; /* xmin */ rect[1] = cpl_image_get_size_x(diff) - hsize - 1; /* xmax */ rect[2] = hsize + 1; /* ymin */ rect[3] = cpl_image_get_size_y(diff) - hsize - 1; /* ymax */ } cpl_ensure_code( rect[0] < rect[1] && rect[2] < rect[3], CPL_ERROR_ILLEGAL_INPUT); /* Generate n+1 regions, because the first region is always at (0,0) */ /* and it would bias the measurement. */ sample_reg = cpl_bivector_gen_rect_poisson(rect, nsamples+1, nsamples+1); cpl_ensure_code( sample_reg != NULL, CPL_ERROR_ILLEGAL_INPUT); px = cpl_bivector_get_x_data_const(sample_reg); py = cpl_bivector_get_y_data_const(sample_reg); /* Now, for each window center, extract a vignette and compute the */ /* signal RMS in it. Store this rms into a table. */ if (noise) rms_list = cpl_vector_new(nsamples); if (bias) bias_list = cpl_vector_new(nsamples); if (noise) pr1 = cpl_vector_get_data(rms_list); if (bias) pr2 = cpl_vector_get_data(bias_list); for (i=0; i nx) continue; zone[2] = (cpl_size)dy - hsize; if (zone[2] < 1) continue; zone[3] = (cpl_size)dy + hsize; if (zone[3] > ny) continue; stdev = cpl_image_get_stdev_window(diff, zone[0], zone[2], zone[1], zone[3]); if (!cpl_errorstate_is_equal(prestate)) { /* All pixels could be bad */ cpl_errorstate_set(prestate); continue; } cpl_vector_set(rms_list, rsize, stdev); rsize++; /* At this point rms_list has rsize elements */ } cpl_bivector_delete(sample_reg); if (4 * rsize < nsamp) { cpl_vector_delete(rms_list); return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "Need at least %" CPL_SIZE_FORMAT "/4 " "(not %" CPL_SIZE_FORMAT ") samples" " to compute noise", nsamp, rsize); } /* Ignore all but the first rsize elements */ rms_list = cpl_vector_wrap(rsize, (double*)cpl_vector_unwrap(rms_list)); /* The error is the rms of the rms */ if (error != NULL) *error = cpl_vector_get_stdev(rms_list); /* The final computed RMS is the median of all values. */ /* This call will modify the rms_list */ *noise = cpl_vector_get_median(rms_list); cpl_vector_delete(rms_list); return CPL_ERROR_NONE; } #undef RING_RON_HLX #undef RING_RON_HLY #undef RING_RON_SAMPLES #define CPL_OPERATION CPL_DET_CLEAN_BAD_PIX /*----------------------------------------------------------------------------*/ /** @brief Interpolate any bad pixels in an image and delete the bad pixel map @param self The image to clean @return The #_cpl_error_code_ or CPL_ERROR_NONE The value of a bad pixel is interpolated from the good pixels among the 8 nearest. (If all but one of the eight neighboring pixels are bad, the interpolation becomes a nearest neighbor interpolation). For integer images the interpolation in done with floating-point and rounded to the nearest integer. If there are pixels for which all of the eight neighboring pixels are bad, a subsequent interpolation pass is done, where the already interpolated pixels are included as source for the interpolation. The interpolation passes are repeated until all bad pixels have been interpolated. In the worst case, all pixels will be interpolated from a single good pixel. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_DATA_NOT_FOUND if all pixels are bad */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_detector_interpolate_rejected(cpl_image * self) { const cpl_mask * mask = cpl_image_get_bpm_const(self); if (mask != NULL) { const cpl_size nx = cpl_image_get_size_x(self); const cpl_size ny = cpl_image_get_size_y(self); const cpl_binary * bpm = cpl_mask_get_data_const(mask); cpl_binary * doit = memchr(bpm, CPL_BINARY_1, (size_t)nx * (size_t)ny * sizeof(*bpm)); if (doit) { /* Switch on image type */ switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: cpl_ensure_code(!cpl_detector_interpolate_rejected_double ((double*)cpl_image_get_data(self), bpm, nx, ny, doit), cpl_error_get_code()); break; case CPL_TYPE_FLOAT: cpl_ensure_code(!cpl_detector_interpolate_rejected_float ((float*)cpl_image_get_data(self), bpm, nx, ny, doit), cpl_error_get_code()); break; case CPL_TYPE_INT: cpl_ensure_code(!cpl_detector_interpolate_rejected_int ((int*)cpl_image_get_data(self), bpm, nx, ny, doit), cpl_error_get_code()); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_ensure_code(!cpl_detector_interpolate_rejected_double_complex ((double complex*)cpl_image_get_data(self), bpm, nx, ny, doit), cpl_error_get_code()); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_ensure_code(!cpl_detector_interpolate_rejected_float_complex ((float complex*)cpl_image_get_data(self), bpm, nx, ny, doit), cpl_error_get_code()); break; default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } (void)cpl_image_accept_all(self); /* bpm could be empty */ } else if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } return CPL_ERROR_NONE; } #undef CPL_OPERATION /**@}*/ /*----------------------------------------------------------------------------*/ /* @brief Generate points with a Poisson scattering property in a rectangle. @param r Array of 4 integers as [xmin,xmax,ymin,ymax] @param np Number of points to generate. @param homog Homogeneity factor. @return Newly allocated cpl_bivector object or NULL in error case The returned object must be deallocated using cpl_bivector_delete(). POISSON POINT GENERATION Without homogeneity factor, the idea is to generate a set of np points within a given rectangle defined by (xmin xmax ymin ymax). All these points obey a Poisson law, i.e. no couple of points is closer to each other than a minimal distance. This minimal distance is defined as a function of the input requested rectangle and the requested number of points to generate. We apply the following formula: @f$ d_{min} = \sqrt{\frac{W \times H}{\sqrt{2}}} @f$ Where W and H stand for the rectangle width and height. Notice that the system in which the rectangle vertices are given is completely left unspecified, generated points will have coordinates in the specified x and y ranges. With a specified homogeneity factor h (0 < h <= np), the generation algorithm is different. the Poisson law applies for any h consecutive points in the final output, but not for the whole point set. This enables us to generate groups of points which statisfy the Poisson law, without constraining the whole set. This actually is equivalent to dividing the rectangle in h regions of equal surface, and generate points randomly in each of these regions, changing region at each point. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if np is not strictly positive */ /*----------------------------------------------------------------------------*/ static cpl_bivector * cpl_bivector_gen_rect_poisson(const cpl_size * r, const cpl_size np, const cpl_size homog) { double min_dist; cpl_size i; cpl_size gnp; cpl_bivector * list; double cand_x, cand_y; cpl_boolean ok; cpl_size start_ndx; cpl_size xmin, xmax, ymin, ymax; /* Corrected Homogeneity factor */ const cpl_size homogc = 0 < homog && homog < np ? homog : np; double * px; double * py; /* error handling: test arguments are correct */ cpl_ensure(r, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure( np > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); list = cpl_bivector_new(np); cpl_ensure(list, CPL_ERROR_NULL_INPUT,NULL); px = cpl_bivector_get_x_data(list); py = cpl_bivector_get_y_data(list); xmin = r[0]; xmax = r[1]; ymin = r[2]; ymax = r[3]; min_dist = CPL_MATH_SQRT1_2*(double)((xmax-xmin)*(ymax-ymin)) / (double)(homogc+1); gnp = 1; px[0] = 0; py[0] = 0; /* First: generate points */ while (gnp < homogc) { /* Pick a random point within requested range */ cand_x = cpl_drand() * (double)(xmax - xmin) + (double)xmin; cand_y = cpl_drand() * (double)(ymax - ymin) + (double)ymin; /* Check the candidate obeys the minimal Poisson distance */ ok = CPL_TRUE; for (i=0; i points. */ start_ndx=0; while (gnp < np) { /* Pick a random point within requested range */ cand_x = cpl_drand() * (double)(xmax - xmin) + (double)xmin; cand_y = cpl_drand() * (double)(ymax - ymin) + (double)ymin; /* Check the candidate obeys the minimal Poisson distance */ ok = CPL_TRUE; for (i=0; i points. */ start_ndx=0; while (gnp < np) { /* Pick a random point within requested range */ cand_x = cpl_drand() * (double)(xmax - xmin) + (double)xmin; cand_y = cpl_drand() * (double)(ymax - ymin) + (double)ymin; /* Check the candidate obeys the minimal Poisson distance */ ok = CPL_TRUE; for (i=0; i points */ while (gnp < homogc) { /* Pick a random point within requested range */ cand_r = cpl_drand() * (double)(r2 - r1) + (double)r1; cand_t = cpl_drand() * CPL_MATH_2PI; /* Check the candidate obeys the minimal Poisson distance */ ok = CPL_TRUE; for (i=0; i points. */ start_ndx = 0; while (gnp < np) { /* Pick a random point within requested range */ cand_r = cpl_drand() * (double)(r2 - r1) + (double)r1; cand_t = cpl_drand() * CPL_MATH_2PI; /* Check the candidate obeys the minimal Poisson distance */ ok = CPL_TRUE; for (i=0; i #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_wlcalib_impl.h" #include #include #include #include #include #include #include #ifdef CPL_WLCALIB_DEBUG #include #endif #include #include /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_wlcalib Wavelength calibration * * This module contains functions to perform 1D-wavelength calibration, * typically of long-slit spectroscopy data. * * @par Synopsis: * @code * #include "cpl_wlcalib.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef inline #define inline /* inline */ #endif /*----------------------------------------------------------------------------- New Types -----------------------------------------------------------------------------*/ struct cpl_wlcalib_slitmodel_ { cpl_size cost; /* May be incremented for cost counting */ cpl_size xcost; /* Ditto (can exclude failed fills) */ cpl_size ulines; /* May be set to number of lines used */ double wslit; /* Slit Width */ double wfwhm; /* FWHM of transfer function */ double lthres; /* Line truncation threshold */ cpl_bivector * lines; /* Catalog of intensities, with increasing X-vector elements */ /* Private members, filled automatically */ cpl_vector * linepix; /* Catalog of line pixel positions - zero for uninitialized */ cpl_vector * erftmp; /* Temporary storage for erf() values - zero for uninitialized */ }; /*----------------------------------------------------------------------------- Private Function Prototypes -----------------------------------------------------------------------------*/ inline static double cpl_erf_antideriv(double x, double); static cpl_error_code cpl_wlcalib_fill_line_spectrum_model(cpl_vector *, cpl_vector *, cpl_vector **, const cpl_polynomial *, const cpl_bivector *, double, double, double, cpl_size, cpl_boolean, cpl_boolean, cpl_size *); static cpl_error_code cpl_wlcalib_evaluate(cpl_vector *, cpl_size *, cpl_vector *, const cpl_vector *, void *, cpl_error_code (*)(cpl_vector *, void *, const cpl_polynomial *), const cpl_polynomial *); /*----------------------------------------------------------------------------- Function Prototypes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Create a new line model to be initialized @return 1 newly allocated cpl_wlcalib_slitmodel @note All elements are initialized to either zero or NULL. @see cpl_wlcalib_slitmodel_delete() for object deallocation. The model comprises these elements: Slit Width FWHM of transfer function Truncation threshold of the transfer function Catalog of lines (typically arc or sky) The units of the X-values of the lines is a length, it is assumed to be the same as that of the Y-values of the dispersion relation (e.g. meter), the units of slit width and the FWHM are assumed to be the same as the X-values of the dispersion relation (e.g. pixel), while the units of the produced spectrum will be that of the Y-values of the lines. */ /*----------------------------------------------------------------------------*/ cpl_wlcalib_slitmodel * cpl_wlcalib_slitmodel_new(void) { return (cpl_wlcalib_slitmodel*)cpl_calloc(1, sizeof(cpl_wlcalib_slitmodel)); } /*----------------------------------------------------------------------------*/ /** @brief Free memory associated with a cpl_wlcalib_slitmodel object. @param self The cpl_wlcalib_slitmodel object or @em NULL @return Nothing @see cpl_wlcalib_slitmodel_new() @note If @em self is @c NULL nothing is done and no error is set. */ /*----------------------------------------------------------------------------*/ void cpl_wlcalib_slitmodel_delete(cpl_wlcalib_slitmodel * self) { if (self != NULL) { cpl_bivector_delete(self->lines); cpl_vector_delete(self->linepix); cpl_vector_delete(self->erftmp); cpl_free(self); } return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Increment the cost counting of a cpl_wlcalib_slitmodel object @param self The cpl_wlcalib_slitmodel object or @em NULL @param value The increment @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_wlcalib_slitmodel_new() @note A spectrum filler function can use this function to increment the number of times it has been invoked. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_wlcalib_slitmodel_add_cost(cpl_wlcalib_slitmodel * self, cpl_size value) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); self->cost += value; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Increment the exclusive cost counting of a cpl_wlcalib_slitmodel object @param self The cpl_wlcalib_slitmodel object or @em NULL @param value The increment @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_wlcalib_slitmodel_new() @note A spectrum filler function can use this function to increment the number of times it has been invoked. The increment can be omitted if the fill fails. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_wlcalib_slitmodel_add_xcost(cpl_wlcalib_slitmodel * self, cpl_size value) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); self->xcost += value; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Increment the line cost counting of a cpl_wlcalib_slitmodel object @param self The cpl_wlcalib_slitmodel object or @em NULL @param value The increment @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_wlcalib_slitmodel_new() @note A spectrum filler function can increment this counter with the number of catalog lines used to provide a cost measure. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_wlcalib_slitmodel_add_ulines(cpl_wlcalib_slitmodel * self, cpl_size value) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); self->ulines += value; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Set the slit width to be used by the spectrum filler @param self The cpl_wlcalib_slitmodel object @param value The (positive) width of the slit @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_wlcalib_slitmodel_new() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL - CPL_ERROR_ILLEGAL_INPUT the value is non-positive */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_wlcalib_slitmodel_set_wslit(cpl_wlcalib_slitmodel * self, double value) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(value > 0.0, CPL_ERROR_ILLEGAL_INPUT); self->wslit = value; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Set the FWHM of the transfer function to be used by the spectrum filler @param self The cpl_wlcalib_slitmodel object @param value The (positive) FWHM @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_wlcalib_slitmodel_new() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL - CPL_ERROR_ILLEGAL_INPUT the value is non-positive */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_wlcalib_slitmodel_set_wfwhm(cpl_wlcalib_slitmodel * self, double value) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(value > 0.0, CPL_ERROR_ILLEGAL_INPUT); self->wfwhm = value; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief The (positive) threshold for truncating the transfer function @param self The cpl_wlcalib_slitmodel object @param value The (non-negative) truncation threshold, 5 is a good value. @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_wlcalib_slitmodel_new() @note The threshold should be high enough to ensure a good line profile, but not too high to make the spectrum generation too costly. The line profile is truncated at this distance [pixel] from its maximum: \f$x_{max} = w/2 + k * \sigma,\f$ where \f$w\f$ is the slit width and \f$\sigma = w_{FWHM}/(2\sqrt(2\log(2))),\f$ where \f$w_{FWHM}\f$ is the Full Width at Half Maximum (FWHM) of the transfer function and \f$k\f$ is the user supplied value. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL - CPL_ERROR_ILLEGAL_INPUT the value is negative */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_wlcalib_slitmodel_set_threshold(cpl_wlcalib_slitmodel * self, double value) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(value >= 0.0, CPL_ERROR_ILLEGAL_INPUT); self->lthres = value; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Set the catalog of lines to be used by the spectrum filler @param self The cpl_wlcalib_slitmodel object @param catalog The catalog of lines (e.g. arc lines) @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_wlcalib_slitmodel_new() @note The values in the X-vector must be increasing. Any previously set catalog is deallocated Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_wlcalib_slitmodel_set_catalog(cpl_wlcalib_slitmodel * self, cpl_bivector * catalog) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(catalog != NULL, CPL_ERROR_NULL_INPUT); cpl_bivector_delete(self->lines); self->lines = catalog; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the slit width of the cpl_wlcalib_slitmodel object @param self The cpl_wlcalib_slitmodel object @return The slit width @see cpl_wlcalib_slitmodel_set_wslit() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ double cpl_wlcalib_slitmodel_get_wslit(const cpl_wlcalib_slitmodel * self) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, 0.0); return self->wslit; } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the FWHM of the cpl_wlcalib_slitmodel object @param self The cpl_wlcalib_slitmodel object @return The FWHM @see cpl_wlcalib_slitmodel_set_wfwhm() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ double cpl_wlcalib_slitmodel_get_wfwhm(const cpl_wlcalib_slitmodel * self) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, 0.0); return self->wfwhm; } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the truncating threshold of the cpl_wlcalib_slitmodel object @param self The cpl_wlcalib_slitmodel object @return The truncating threshold for the transfer function @see cpl_wlcalib_slitmodel_set_threshold() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ double cpl_wlcalib_slitmodel_get_threshold(const cpl_wlcalib_slitmodel * self) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, 0.0); return self->lthres; } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the lines catalog of the cpl_wlcalib_slitmodel object @param self The cpl_wlcalib_slitmodel object @return The lines catalog @see cpl_wlcalib_slitmodel_set_catalog() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ cpl_bivector * cpl_wlcalib_slitmodel_get_catalog(cpl_wlcalib_slitmodel * self) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); return self->lines; } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the lines catalog of the cpl_wlcalib_slitmodel object @param self The cpl_wlcalib_slitmodel object @return The lines catalog @see cpl_wlcalib_slitmodel_set_catalog() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ const cpl_bivector * cpl_wlcalib_slitmodel_get_catalog_const(const cpl_wlcalib_slitmodel * self) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); return self->lines; } /*----------------------------------------------------------------------------*/ /** @internal @brief Remove the lines catalog from the cpl_wlcalib_slitmodel object @param self The cpl_wlcalib_slitmodel object @return The lines catalog @see cpl_wlcalib_slitmodel_set_catalog() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ cpl_bivector * cpl_wlcalib_slitmodel_unset_catalog(cpl_wlcalib_slitmodel * self) { cpl_bivector * lines; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); lines = self->lines; self->lines = NULL; return lines; } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the accumulated cost of the cpl_wlcalib_slitmodel object usage @param self The cpl_wlcalib_slitmodel object @return The accumulated cost @see cpl_wlcalib_slitmodel_new() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_wlcalib_slitmodel_get_cost(const cpl_wlcalib_slitmodel * self) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, 0); return self->cost; } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the accumulated exclusive cost of the cpl_wlcalib_slitmodel object usage @param self The cpl_wlcalib_slitmodel object @return The accumulated exclusive cost @see cpl_wlcalib_slitmodel_new() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_wlcalib_slitmodel_get_xcost(const cpl_wlcalib_slitmodel * self) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, 0); return self->xcost; } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the accumulated line cost of the cpl_wlcalib_slitmodel object usage @param self The cpl_wlcalib_slitmodel object @return The accumulated line cost @see cpl_wlcalib_slitmodel_new() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_wlcalib_slitmodel_get_ulines(const cpl_wlcalib_slitmodel * self) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, 0); return self->ulines; } /*----------------------------------------------------------------------------*/ /** @brief Generate a 1D spectrum from a model and a dispersion relation @param self Vector to fill with spectrum @param model Pointer to cpl_wlcalib_slitmodel object @param disp 1D-Dispersion relation, at least of degree 1 @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @note The model is passed as a @em void pointer so the function can be used with cpl_wlcalib_find_best_1d(). @see cpl_wlcalib_find_best_1d() The fill a vector with a spectrum, one must first initialize the parameters of the model (error checks omitted for brevity): @code cpl_vector * spectrum = cpl_vector_new(nresolution); cpl_wlcalib_slitmodel * model = cpl_wlcalib_slitmodel_new(); cpl_bivector * lines = my_load_lines_catalog(filename); cpl_polynomial * dispersion = my_1d_dispersion(); cpl_wlcalib_slitmodel_set_wslit(model, 3.0); cpl_wlcalib_slitmodel_set_wfwhm(model, 4.0); cpl_wlcalib_slitmodel_set_threshold(model, 5.0); cpl_wlcalib_slitmodel_set_catalog(model, lines); @endcode With that the spectrum can be filled: @code cpl_wlcalib_fill_line_spectrum(spectrum, model, dispersion); @endcode Clean-up when no more spectra are needed (lines are deleted with the model): @code cpl_wlcalib_slitmodel_delete(model); cpl_polynomial_delete(dispersion); cpl_vector_delete(spectrum); @endcode Each line profile is given by the convolution of the Dirac delta function with a Gaussian with \f$\sigma = w_{FWHM}/(2\sqrt(2\log(2))),\f$ and a top-hat with the slit width as width. This continuous line profile is then integrated over each pixel, wherever the intensity is above the threshold set by the given model. For a given line the value on a given pixel requires the evaluation of two calls to @em erf(). Possible #_cpl_error_code_ set by this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL - CPL_ERROR_INVALID_TYPE If the input polynomial is not 1D - CPL_ERROR_ILLEGAL_INPUT If the input polynomial is non-increasing over the given input (pixel) range, or if a model parameter is non-physical (e.g. non-positive slit width). - CPL_ERROR_DATA_NOT_FOUND If no catalog lines are available in the range of the dispersion relation - CPL_ERROR_INCOMPATIBLE_INPUT If the wavelengths of two catalog lines are found to be in non-increasing order. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_wlcalib_fill_line_spectrum(cpl_vector * self, void * model, const cpl_polynomial * disp) { cpl_wlcalib_slitmodel * mymodel = (cpl_wlcalib_slitmodel *)model; const cpl_size hsize = 0; /* FIXME: remove */ cpl_ensure_code(model != NULL, CPL_ERROR_NULL_INPUT); mymodel->cost++; if (cpl_wlcalib_fill_line_spectrum_model(self, mymodel->linepix, NULL, disp, mymodel->lines, mymodel->wslit, mymodel->wfwhm, mymodel->lthres, hsize, CPL_FALSE, CPL_FALSE, &(mymodel->ulines))) { return cpl_error_set_where_(); } mymodel->xcost++; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Generate a 1D spectrum from a model and a dispersion relation @param self Vector to fill with spectrum @param model Pointer to cpl_wlcalib_slitmodel object @param disp 1D-Dispersion relation, at least of degree 1 @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @note The spectrum is generated from 1 + the logarithm of the line intensities @see cpl_wlcalib_fill_line_spectrum() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_wlcalib_fill_logline_spectrum(cpl_vector * self, void * model, const cpl_polynomial * disp) { cpl_wlcalib_slitmodel * mymodel = (cpl_wlcalib_slitmodel *)model; const cpl_size hsize = 0; /* FIXME: remove */ cpl_ensure_code(model != NULL, CPL_ERROR_NULL_INPUT); mymodel->cost++; if (cpl_wlcalib_fill_line_spectrum_model(self, mymodel->linepix, NULL, disp, mymodel->lines, mymodel->wslit, mymodel->wfwhm, mymodel->lthres, hsize, CPL_FALSE, CPL_TRUE, &(mymodel->ulines))) { return cpl_error_set_where_(); } mymodel->xcost++; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Generate a 1D spectrum from a model and a dispersion relation @param self Vector to fill with spectrum @param model Pointer to cpl_wlcalib_slitmodel object @param disp 1D-Dispersion relation, at least of degree 1 @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @note The generated spectrum will use an approximate line profile for speed @see cpl_wlcalib_fill_line_spectrum() The approximation preserves the position of the maximum, the symmetry and the flux of the line profile. The use of a given line in a spectrum requires the evaluation of four calls to @em erf(). The fast spectrum generation can be useful when the model spectrum includes many catalog lines. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_wlcalib_fill_line_spectrum_fast(cpl_vector * self, void * model, const cpl_polynomial * disp) { cpl_wlcalib_slitmodel * mymodel = (cpl_wlcalib_slitmodel *)model; const cpl_size hsize = 0; /* FIXME: remove */ cpl_ensure_code(model != NULL, CPL_ERROR_NULL_INPUT); mymodel->cost++; if (cpl_wlcalib_fill_line_spectrum_model(self, mymodel->linepix, &(mymodel->erftmp), disp, mymodel->lines, mymodel->wslit, mymodel->wfwhm, mymodel->lthres, hsize, CPL_TRUE, CPL_FALSE, &(mymodel->ulines))) { return cpl_error_set_where_(); } mymodel->xcost++; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Generate a 1D spectrum from a model and a dispersion relation @param self Vector to fill with spectrum @param model Pointer to cpl_wlcalib_slitmodel object @param disp 1D-Dispersion relation, at least of degree 1 @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @note The spectrum is generated from 1 + the logarithm of the line intensities and an approximate line profile for speed @see cpl_wlcalib_fill_line_spectrum_fast() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_wlcalib_fill_logline_spectrum_fast(cpl_vector * self, void * model, const cpl_polynomial * disp) { cpl_wlcalib_slitmodel * mymodel = (cpl_wlcalib_slitmodel *)model; const cpl_size hsize = 0; /* FIXME: remove */ cpl_ensure_code(model != NULL, CPL_ERROR_NULL_INPUT); mymodel->cost++; if (cpl_wlcalib_fill_line_spectrum_model(self, mymodel->linepix, &(mymodel->erftmp), disp, mymodel->lines, mymodel->wslit, mymodel->wfwhm, mymodel->lthres, hsize, CPL_TRUE, CPL_TRUE, &(mymodel->ulines))) { return cpl_error_set_where_(); } mymodel->xcost++; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Find the best 1D dispersion polynomial in a given search space @param self Pre-created 1D-polynomial for the result @param guess 1D-polynomial with the guess, may equal self @param spectrum The vector with the observed 1D-spectrum @param model The spectrum model @param filler The function used to make the spectrum @param wl_search Search range around the anchor points, same unit as guess @param nsamples Number of samples around the anchor points @param hsize Maximum (pixel) displacement of the polynomial guess @param xcmax On success, the maximum cross-correlation @param xcorrs The vector to fill with the correlation values or NULL @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_wlcalib_fill_line_spectrum() for the model and filler. Find the polynomial that maximizes the cross-correlation between an observed 1D-spectrum and a model spectrum based on the polynomial dispersion relation. The wavelength search range is in the same units as the Y-values of the dispersion relation. For each candidate polynomial P(x), the polynomial P(x+u), -hsize <= u <= hsize is also evaluated. The half-size hsize may be zero. When it is non-zero, an additional 2 * hsize cross-correlations are performed for each candidate polynomial, one for each possible shift. The maximizing polynomial among those shifted polynomials is kept. A well-chosen half-size can allow for the use of fewer number of samples around the anchor points, leading to a reduction of polynomials to be evaluated. The complexity in terms of model spectra creation is O(N^D) and in terms of cross-correlations O(hsize * N^D), where N is nsamples and D is the length of wl_error. xcorrs must be NULL or have a size of (at least) N^D*(1 + 2 * hsize). Possible #_cpl_error_code_ set by this function: - CPL_ERROR_NULL_INPUT if an input pointer is @em NULL - CPL_ERROR_INVALID_TYPE If an input polynomial is not 1D - CPL_ERROR_ILLEGAL_INPUT If nfree is less than 2, or nsamples is less than 1, hsize negative or if wl_search contains a zero search bound, or if xcorrs is non-NULL and too short. - CPL_ERROR_DATA_NOT_FOUND If no model spectra can be created using the supplied model and filler */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_wlcalib_find_best_1d(cpl_polynomial * self, const cpl_polynomial * guess, const cpl_vector * spectrum, void * model, cpl_error_code (* filler) (cpl_vector *, void *, const cpl_polynomial *), const cpl_vector * wl_search, cpl_size nsamples, cpl_size hsize, double * xcmax, cpl_vector * xcorrs) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_errorstate errorstate = prestate; /* Fix (false) uninit warning */ const cpl_size spec_sz = cpl_vector_get_size(spectrum); const cpl_size nfree = cpl_vector_get_size(wl_search); const cpl_size degree = nfree - 1; const cpl_size nxc = 1 + 2 * hsize; cpl_size ntests = 1; cpl_vector * spmodel; cpl_vector * vxc; cpl_vector * init_pts_wl; cpl_vector * init_pts_x; cpl_vector * pts_wl; cpl_vector * conv_kernel = NULL; cpl_polynomial * cand; double * xcdata = xcorrs ? cpl_vector_get_data(xcorrs) : NULL; const double * pwl_search = cpl_vector_get_data_const(wl_search); const double * pinit_pts_wl; double * ppts_wl; cpl_boolean has_solution = CPL_FALSE; cpl_boolean has_no_error = CPL_TRUE; cpl_size i; cpl_ensure_code(xcmax != NULL, CPL_ERROR_NULL_INPUT); *xcmax = -1.0; /* In case of failure */ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(guess != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(spectrum != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(model != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(filler != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(wl_search != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1, CPL_ERROR_INVALID_TYPE); cpl_ensure_code(cpl_polynomial_get_dimension(guess) == 1, CPL_ERROR_INVALID_TYPE); cpl_ensure_code(nfree >= 2, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(nsamples > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(hsize >= 0, CPL_ERROR_ILLEGAL_INPUT); if (nsamples > 1) { /* Search place must consist of more than one point */ /* FIXME: The bounds should probably not be negative */ for (i = 0; i < nfree; i++) { if (pwl_search[i] != 0.0) break; } cpl_ensure_code(i < nfree, CPL_ERROR_ILLEGAL_INPUT); } if (xcorrs != NULL) { const cpl_size ncand = nxc * (cpl_size)cpl_tools_ipow(nsamples, nfree); cpl_ensure_code(cpl_vector_get_size(xcorrs) >= ncand, CPL_ERROR_ILLEGAL_INPUT); } /* Create initial test points */ init_pts_x = cpl_vector_new(nfree); init_pts_wl = cpl_vector_new(nfree); pts_wl = cpl_vector_new(nfree); for (i = 0; i < nfree; i++) { const double xpos = spec_sz * i / (double)degree; const double wlpos = cpl_polynomial_eval_1d(guess, xpos, NULL) - 0.5 * pwl_search[i]; cpl_vector_set(init_pts_x, i, xpos); cpl_vector_set(init_pts_wl, i, wlpos); ntests *= nsamples; /* Count number of tests */ } cand = cpl_polynomial_new(1); spmodel = cpl_vector_new(spec_sz + 2 * hsize); vxc = xcdata ? cpl_vector_wrap(nxc, xcdata) : cpl_vector_new(nxc); pinit_pts_wl = cpl_vector_get_data_const(init_pts_wl); ppts_wl = cpl_vector_get_data(pts_wl); /* Create the polynomial candidates and estimate them */ for (i = 0; i < ntests; i++) { cpl_size idiv = i; cpl_size deg; cpl_error_code error = CPL_ERROR_NONE; /* Update wavelength at one anchor point - and reset wavelengths to their default for any anchor point(s) at higher wavelengths */ for (deg = degree; deg >= 0; deg--, idiv /= nsamples) { const cpl_size imod = idiv % nsamples; const double wlpos = pinit_pts_wl[deg] + imod * pwl_search[deg] / nsamples; if (deg < degree && wlpos >= ppts_wl[deg+1]) { /* The current anchor points do not form a monotonely increasing sequence. This is not physical, so mark the polynomial as invalid. Still need to complete loop for subsequent candidates */ /* Not an actual error, but used for flow control */ error = CPL_ERROR_DATA_NOT_FOUND; } ppts_wl[deg] = wlpos; if (imod > 0) break; } if (!error) { has_no_error = cpl_errorstate_is_equal(prestate); /* Fit the candidate polynomial, init_pts_x is symmetric */ error = cpl_polynomial_fit_1d(cand, init_pts_x, pts_wl, 0, degree, CPL_TRUE, NULL); if (!error && cpl_polynomial_get_degree(cand) > 0) { /* In spmodel input pixel 0 is at position hsize, shift accordingly */ error = cpl_polynomial_shift_1d(cand, 0, -hsize); if (!error) { cpl_size ixcmax = -1; /* Fix (false) uninit warning */ /* *** Estimate *** */ error = cpl_wlcalib_evaluate(vxc, &ixcmax, spmodel, spectrum, model, filler, cand); if (!error) { const double xci = cpl_vector_get(vxc, ixcmax); if (xci > *xcmax) { /* Found a better solution */ *xcmax = xci; cpl_polynomial_shift_1d(cand, 0, ixcmax); cpl_polynomial_copy(self, cand); has_solution = CPL_TRUE; } } } } if (error) { if (has_solution) { #ifdef CPL_WLCALIB_DEBUG cpl_errorstate_dump(prestate, CPL_FALSE, cpl_errorstate_dump_one_debug); #endif cpl_errorstate_set(prestate); } else if (has_no_error) { /* Keep error(s) from 1st failed try in case no solutions are found */ errorstate = cpl_errorstate_get(); } else { /* Reset all subsequent errors - which may be many */ #ifdef CPL_WLCALIB_DEBUG cpl_errorstate_dump(errorstate, CPL_FALSE, cpl_errorstate_dump_one_debug); #endif cpl_errorstate_set(errorstate); } } } if (xcdata != NULL) { if (error) (void)cpl_vector_fill(vxc, -1.0); xcdata += nxc; (void)cpl_vector_rewrap(vxc, nxc, xcdata); } } cpl_vector_delete(spmodel); xcdata ? (void)cpl_vector_unwrap(vxc) : cpl_vector_delete(vxc); cpl_vector_delete(conv_kernel); cpl_vector_delete(pts_wl); cpl_vector_delete(init_pts_x); cpl_vector_delete(init_pts_wl); cpl_polynomial_delete(cand); return has_solution ? CPL_ERROR_NONE : cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Generate a 1D spectrum from (arc) lines and a dispersion relation @param self Vector to fill with spectrum @param linepix Vector to update with best guess of line pixel position @param perftmp Vector to update with erf()-values in fast mode, may be NULL @param disp 1D-Dispersion relation, at least of degree 1 @param lines Catalog of lines, with increasing wavelengths @param wslit Positive width of the slit @param wfwhm Positive FWHM of the transfer function @param lthres Line truncation threshold @param hsize The 1st intensity in self will be disp(1-hsize), hsize >= 0 @param dofast Iff true compose profile from pairs of two integer-placed @param dolog Iff true log(1+I) is used for the (positive) intensities @param pulines Iff non-NULL incremented by number of lines used, on success @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code @see cpl_wlcalib_fill_line_spectrum() */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_wlcalib_fill_line_spectrum_model(cpl_vector * self, cpl_vector * linepix, cpl_vector ** perftmp, const cpl_polynomial * disp, const cpl_bivector * lines, double wslit, double wfwhm, double lthres, cpl_size hsize, cpl_boolean dofast, cpl_boolean dolog, cpl_size * pulines) { cpl_errorstate prestate; const double sigma = wfwhm * CPL_MATH_SIG_FWHM; const cpl_vector * xlines = cpl_bivector_get_x_const(lines); const double * dxlines = cpl_vector_get_data_const(xlines); const double * dylines = cpl_bivector_get_y_data_const(lines); double * plinepix = linepix ? cpl_vector_get_data(linepix) : NULL; const cpl_size nlines = cpl_vector_get_size(xlines); const cpl_size nself = cpl_vector_get_size(self); double * dself = cpl_vector_get_data(self); cpl_polynomial * dispi; double * profile = NULL; cpl_size i0 = 0; const double p0 = cpl_polynomial_get_coeff(disp, &i0); const cpl_size degree = cpl_polynomial_get_degree(disp); double wl; const double xtrunc = 0.5 * wslit + lthres * sigma; double xpos = (double)(1-hsize)-xtrunc; const double xmax = (double)(nself-hsize)+xtrunc; double xderiv; cpl_error_code error = CPL_ERROR_NONE; cpl_size iline; cpl_size ulines = 0; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(disp != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(lines != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(wslit > 0.0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(wfwhm > 0.0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(hsize >= 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(xtrunc > 0.0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(nself > 2 * hsize, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(cpl_polynomial_get_dimension(disp) == 1, CPL_ERROR_INVALID_TYPE); cpl_ensure_code(degree > 0, CPL_ERROR_ILLEGAL_INPUT); /* The smallest wavelength contributing to the spectrum. */ wl = cpl_polynomial_eval_1d(disp, xpos, &xderiv); if (wl <= 0.0) return cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Non-positive " "wavelength at x=%g: P(x)=%g, P'(x)=%g", xpos, wl, xderiv); if (xderiv <= 0.0) return cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Non-increasing " "dispersion at x=%g: P'(x)=%g, P(x)=%g, " "degree=%" CPL_SIZE_FORMAT, xpos, xderiv, wl, degree); /* Find the 1st line */ iline = cpl_vector_find(xlines, wl); if (iline < 0) { return cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "Invalid " "%" CPL_SIZE_FORMAT "-entry catalog", nlines); } /* The first line must be at least at wl */ if (dxlines[iline] < wl) iline++; if (iline >= nlines) return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "The %" CPL_SIZE_FORMAT "-line catalog has only lines below " "P(%g)=%g > %g, degree=%" CPL_SIZE_FORMAT, nlines, xpos, wl, dxlines[nlines-1], degree); (void)memset(dself, 0, nself * sizeof(double)); prestate = cpl_errorstate_get(); if (dofast) { const cpl_size npix = 1+(cpl_size)xtrunc; if (*perftmp != NULL && cpl_vector_get_size(*perftmp) == npix && cpl_vector_get(*perftmp, 0) > 0.0) { profile = cpl_vector_get_data(*perftmp); } else { const double yval = 0.5 / wslit; const double x0p = 0.5 * wslit + 0.5; const double x0n = -0.5 * wslit + 0.5; double x1diff = cpl_erf_antideriv(x0p, sigma) - cpl_erf_antideriv(x0n, sigma); cpl_size ipix; if (*perftmp == NULL) { *perftmp = cpl_vector_new(npix); } else { cpl_vector_set_size(*perftmp, npix); } profile = cpl_vector_get_data(*perftmp); profile[0] = 2.0 * yval * x1diff; for (ipix = 1; ipix < npix; ipix++) { const double x1 = (double)ipix; const double x1p = x1 + 0.5 * wslit + 0.5; const double x1n = x1 - 0.5 * wslit + 0.5; const double x0diff = x1diff; x1diff = cpl_erf_antideriv(x1p, sigma) - cpl_erf_antideriv(x1n, sigma); profile[ipix] = yval * (x1diff - x0diff); } cpl_tools_add_flops( 33 * npix ); } } dispi = cpl_polynomial_duplicate(disp); /* FIXME: A custom version of cpl_polynomial_solve_1d() which returns P'(xpos) can be used for the 1st NR-iteration. */ /* Perform 1st NR-iteration in solving for P(xpos) = dxlines[iline] */ xpos -= (wl - dxlines[iline]) / xderiv; /* Iterate through the lines */ for (; !error && iline < nlines; iline++) { if (iline > 0 && dxlines[iline-1] >= dxlines[iline]) { error = cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "Non-increasing wavelengths in %" CPL_SIZE_FORMAT "-entry catalog: I(%" CPL_SIZE_FORMAT ") = %g >= %g = I(%" CPL_SIZE_FORMAT "+1)", nlines, iline, dxlines[iline-1], dxlines[iline], iline); break; } /* Lines may have a non-physical intensity (e.g. zero) to indicate some property of the line, e.g. unknown intensity due to blending */ if (dylines[iline] <= 0.0) continue; /* Use 1st guess, if available (Use 0.0 to flag unavailable) */ if (plinepix != NULL && plinepix[iline] > 0.0) xpos = plinepix[iline]; if (xpos > xmax) xpos = xmax; /* FIXME: Better to limit xpos ? */ /* Find the (sub-) pixel position of the line */ /* Also, verify monotony of dispersion */ error = cpl_polynomial_set_coeff(dispi, &i0, p0 - dxlines[iline]) || cpl_polynomial_solve_1d_(dispi, xpos, &xpos, 1, CPL_TRUE); if (xpos > xmax) { if (error) { error = 0; #ifdef CPL_WLCALIB_DEBUG cpl_msg_debug(cpl_func, "Stopping spectrum fill at line %d/%d " "at xpos=%g > xmax=%g", iline, nlines, xpos, xmax); cpl_errorstate_dump(prestate, CPL_FALSE, cpl_errorstate_dump_one_debug); #endif cpl_errorstate_set(prestate); } break; } else if (error) { if (linepix != NULL && ulines) (void)cpl_vector_fill(linepix, 0.0); (void)cpl_error_set_message_(cpl_error_get_code(), "Could not find pixel-position " "of line %" CPL_SIZE_FORMAT "/%" CPL_SIZE_FORMAT " at wavelength=%g. " "xpos=%g, xmax=%g", iline, nlines, dxlines[iline], xpos, xmax); break; } else if (dofast) { const double frac = fabs(xpos - floor(xpos)); #ifdef CPL_WAVECAL_FAST_FAST const double frac0 = 1.0 - frac; /* Weight opposite of distance */ #else /* Center intensity correctly */ const double ep1pw = cpl_erf_antideriv(frac + 0.5 * wslit, sigma); const double en1pw = cpl_erf_antideriv(frac + 0.5 * wslit - 1.0, sigma); const double ep1nw = cpl_erf_antideriv(frac - 0.5 * wslit, sigma); const double en1nw = cpl_erf_antideriv(frac - 0.5 * wslit - 1.0, sigma); const double frac0 = (en1nw - en1pw) / (ep1pw - en1pw - ep1nw + en1nw); #endif const double frac1 = 1.0 - frac0; const double yval0 = frac0 * dylines[iline]; const double yval1 = frac1 * dylines[iline]; const cpl_size npix = 1+(cpl_size)xtrunc; cpl_size ipix; cpl_size i0n = hsize - 1 + floor(xpos); cpl_size i0p = i0n; cpl_size i1n = i0n + 1; cpl_size i1p = i1n; cpl_boolean didline = CPL_FALSE; /* Update 1st guess for next time, if available */ if (plinepix != NULL) plinepix[iline] = xpos; if (frac0 < 0.0) { (void)cpl_error_set_message_(CPL_ERROR_UNSPECIFIED, "Illegal " "split at x=%g: %g + %g = 1", xpos, frac0, frac1); #ifdef CPL_WAVEVAL_DEBUG } else { cpl_msg_warning(cpl_func,"profile split at x=%g: %g + %g = 1", xpos, frac0, frac1); #endif } for (ipix = 0; ipix < npix; ipix++, i0n--, i0p++, i1n--, i1p++) { if (i0n >= 0 && i0n < nself) { dself[i0n] += yval0 * profile[ipix]; didline = CPL_TRUE; } if (i1n >= 0 && i1n < nself && ipix + 1 < npix) { dself[i1n] += yval1 * profile[ipix+1]; didline = CPL_TRUE; } if (ipix == 0) continue; if (i0p >= 0 && i0p < nself) { dself[i0p] += yval0 * profile[ipix]; didline = CPL_TRUE; } if (i1p >= 0 && i1p < nself && ipix + 1 < npix) { dself[i1p] += yval1 * profile[ipix+1]; didline = CPL_TRUE; } } if (didline) ulines++; } else { const double yval = 0.5 * dylines[iline] / wslit; const cpl_size ifirst = CX_MAX((cpl_size)(xpos-xtrunc+0.5), 1-hsize); const cpl_size ilast = CX_MIN((cpl_size)(xpos+xtrunc), nself-hsize); cpl_size ipix; const double x0 = (double)ifirst - xpos; const double x0p = x0 + 0.5*wslit - 0.5; const double x0n = x0 - 0.5*wslit - 0.5; double x1diff = cpl_erf_antideriv(x0p, sigma) - cpl_erf_antideriv(x0n, sigma); /* Update 1st guess for next time, if available */ if (plinepix != NULL) plinepix[iline] = xpos; if (ilast >= ifirst) ulines++; for (ipix = ifirst; ipix < 1 + ilast; ipix++) { const double x1 = (double)ipix - xpos; const double x1p = x1 + 0.5*wslit + 0.5; const double x1n = x1 - 0.5*wslit + 0.5; const double x0diff = x1diff; x1diff = cpl_erf_antideriv(x1p, sigma) - cpl_erf_antideriv(x1n, sigma); dself[ipix+hsize-1] += yval * (x1diff - x0diff); } } } cpl_polynomial_delete(dispi); cpl_ensure_code(!error, cpl_error_get_code()); if (dolog) { int i; for (i = 0; i < nself; i++) { dself[i] = dself[i] > 0.0 ? log(1.0 + dself[i]) : 0.0; } cpl_tools_add_flops( 2 * nself ); } if (!ulines) return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "The %" CPL_SIZE_FORMAT "-line catalog has no lines in the range " "%g -> P(%g)=%g", nlines, wl, xmax, cpl_polynomial_eval_1d(disp, xmax, NULL)); cpl_tools_add_flops( ulines * (dofast ? 4 * (cpl_flops)xtrunc + 74 : 70 * (cpl_flops)xtrunc + 35 )); if (pulines != NULL) *pulines += ulines; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief The antiderivative of erx(x/sigma/sqrt(2)) with respect to x @param x x @param sigma sigma @return The antiderivative @note This function is even. 12 FLOPs. */ /*----------------------------------------------------------------------------*/ inline static double cpl_erf_antideriv(double x, double sigma) { return x * erf( x / (sigma * CPL_MATH_SQRT2)) + 2.0 * sigma/CPL_MATH_SQRT2PI * exp(-0.5 * x * x / (sigma * sigma)); } /*----------------------------------------------------------------------------*/ /** @internal @brief Evaluate a dispersion relation @param vxc The 1-vector of cross-correlation(s) to be filled @param pixcmax The index in vxc with the maximum cross-correlation @param spmodel Temporary storage for the model spectrum @param observed The observed spectrum @param model The spectrum model @param filler The spectrum filler function @param disp The candidate dispersion relation @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_wlcalib_evaluate(cpl_vector * vxc, cpl_size * pixcmax, cpl_vector * spmodel, const cpl_vector * observed, void * model, cpl_error_code (* filler) (cpl_vector *, void *, const cpl_polynomial *), const cpl_polynomial * disp) { cpl_error_code error; cpl_ensure_code(vxc != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pixcmax != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(spmodel != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(observed != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(model != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(filler != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(disp != NULL, CPL_ERROR_NULL_INPUT); error = filler(spmodel, model, disp); if (!error) { *pixcmax = cpl_vector_correlate(vxc, spmodel, observed); if (*pixcmax < 0) error = cpl_error_get_code(); } return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } cpl-6.4.1/cpldrs/cpl_apertures_img.h0000644000460300003120000000253711553250104014361 00000000000000/* $Id: cpl_apertures_img.h,v 1.4 2011-04-19 09:05:08 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-04-19 09:05:08 $ * $Revision: 1.4 $ * $Name: not supported by cvs2svn $ */ /* Deprecated: Include cpl_apertures.h instead */ #ifndef CPL_APERTURES_IMG_H #define CPL_APERTURES_IMG_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_apertures.h" #endif cpl-6.4.1/cpldrs/cpl_apertures.h0000644000460300003120000001163111737034437013535 00000000000000/* $Id: cpl_apertures.h,v 1.11 2012-04-04 12:05:51 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-04-04 12:05:51 $ * $Revision: 1.11 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_APERTURES_H #define CPL_APERTURES_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ typedef struct _cpl_apertures_ cpl_apertures; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* IO functions */ void cpl_apertures_delete(cpl_apertures *); void cpl_apertures_dump(const cpl_apertures *, FILE *); /* Statistics computation */ cpl_apertures * cpl_apertures_new_from_image(const cpl_image *, const cpl_image *) CPL_ATTR_ALLOC; /* Accessor functions */ cpl_size cpl_apertures_get_size(const cpl_apertures *); double cpl_apertures_get_pos_x(const cpl_apertures *, cpl_size); double cpl_apertures_get_pos_y(const cpl_apertures *, cpl_size); double cpl_apertures_get_max_x(const cpl_apertures *, cpl_size) CPL_ATTR_DEPRECATED; double cpl_apertures_get_max_y(const cpl_apertures *, cpl_size) CPL_ATTR_DEPRECATED; double cpl_apertures_get_centroid_x(const cpl_apertures *, cpl_size); double cpl_apertures_get_centroid_y(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_maxpos_x(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_maxpos_y(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_minpos_x(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_minpos_y(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_npix(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_left(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_left_y(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_right(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_right_y(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_top_x(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_top(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_bottom_x(const cpl_apertures *, cpl_size); cpl_size cpl_apertures_get_bottom(const cpl_apertures *, cpl_size); double cpl_apertures_get_max(const cpl_apertures *, cpl_size); double cpl_apertures_get_min(const cpl_apertures *, cpl_size); double cpl_apertures_get_mean(const cpl_apertures *, cpl_size); double cpl_apertures_get_median(const cpl_apertures *, cpl_size); double cpl_apertures_get_stdev(const cpl_apertures *, cpl_size); double cpl_apertures_get_flux(const cpl_apertures *, cpl_size); /* Sorting functions */ cpl_error_code cpl_apertures_sort_by_npix(cpl_apertures *); cpl_error_code cpl_apertures_sort_by_max(cpl_apertures *); cpl_error_code cpl_apertures_sort_by_flux(cpl_apertures *); /* Detection functions */ cpl_apertures * cpl_apertures_extract(const cpl_image *, const cpl_vector *, cpl_size *) CPL_ATTR_ALLOC; cpl_apertures * cpl_apertures_extract_window(const cpl_image *, const cpl_vector *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size *) CPL_ATTR_ALLOC; cpl_apertures * cpl_apertures_extract_mask(const cpl_image *, const cpl_mask *) CPL_ATTR_ALLOC; cpl_apertures * cpl_apertures_extract_sigma(const cpl_image *, double) CPL_ATTR_ALLOC; cpl_bivector* cpl_apertures_get_fwhm(const cpl_image*, const cpl_apertures*) CPL_ATTR_DEPRECATED; CPL_END_DECLS #endif cpl-6.4.1/cpldrs/cpl_fft.c0000644000460300003120000003221111753231732012265 00000000000000/* $Id: cpl_fft.c,v 1.34 2012-05-11 15:44:26 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifdef HAVE_CONFIG_H #include #endif /*---------------------------------------------------------------------------- Includes ----------------------------------------------------------------------------*/ /* Must be included first to ensure declaration of complex image accessors */ #include #include "cpl_fft.h" #include "cpl_error_impl.h" #if defined CPL_FFTWF_INSTALLED || defined CPL_FFTW_INSTALLED /* If FFTW is installed */ #include #endif #include /*---------------------------------------------------------------------------*/ /** * @defgroup cpl_fft FFTW wrappers * * This module provides FFTW wrappers * * @par Synopsis: * @code * #include "cpl_fft.h" * @endcode */ /*---------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Private functions -----------------------------------------------------------------------------*/ #if defined CPL_FFTWF_INSTALLED || defined CPL_FFTW_INSTALLED static void * cpl_fft_aligned(void *, void *, size_t) CPL_ATTR_NONNULL; #endif static cpl_error_code cpl_fft_image_(cpl_image *, const cpl_image *, cpl_fft_mode, void *, void *, void *, cpl_boolean) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(5,6))) #endif ; #ifdef CPL_FFTW_INSTALLED # define CPL_FFTW fftw /* Cannot concatenate the reserved macro complex :-( */ # define CPL_FFTW_TYPE fftw_complex # define CPL_TYPE double /* Cannot concatenate the reserved macro complex :-( */ # define CPL_TYPE_C double_complex # include "cpl_fft_body.h" # undef CPL_FFTW # undef CPL_TYPE # undef CPL_TYPE_T # undef CPL_TYPE_C # undef CPL_FFTW_TYPE #endif #ifdef CPL_FFTWF_INSTALLED # define CPL_FFTW fftwf /* Cannot concatenate the reserved macro complex :-( */ # define CPL_FFTW_TYPE fftwf_complex # define CPL_TYPE float /* Cannot concatenate the reserved macro complex :-( */ # define CPL_TYPE_C float_complex # include "cpl_fft_body.h" # undef CPL_FFTW # undef CPL_TYPE # undef CPL_TYPE_T # undef CPL_TYPE_C # undef CPL_FFTW_TYPE #endif /*---------------------------------------------------------------------------*/ /** @brief Perform a FFT operation on an image @param self Pre-allocated output image to transform to @param other Input image to transform from, use self for in-place transform @param mode CPL_FFT_FORWARD or CPL_FFT_BACKWARD, optionally CPL_FFT_NOSCALE @return CPL_ERROR_NONE or the corresponding #_cpl_error_code_ on error This function performs an FFT on an image, using FFTW. CPL may be configured without this library, in this case an otherwise valid call will set and return the error CPL_ERROR_UNSUPPORTED_MODE. The input and output images must match in precision level. Integer images are not supported. In a forward transform the input image may be non-complex. In this case a real-to-complex transform is performed. This will only compute the first ny/2 + 1 columns of the transform. In this transform it is allowed to pass an output image with ny/2 + 1 columns. Similarly, in a backward transform the output image may be non-complex. In this case a complex-to-real transform is performed. This will only transform the first ny/2 + 1 columns of the input. In this transform it is allowed to pass an input image with ny/2 + 1 columns. Per default the backward transform scales (divides) the result with the number of elements transformed (i.e. the number of pixels in the result image). This scaling can be turned off with CPL_FFT_NOSCALE. If many transformations in the same direction are to be done on data of the same size and type, a reduction in the time required to perform the transformations can be achieved by adding the flag CPL_FFT_FIND_MEASURE to the first transformation. For a larger number of transformations a further reduction may be achived with the flag CPL_FFT_FIND_PATIENT and for an even larger number of transformations a further reduction may be achived with the flag CPL_FFT_FIND_EXHAUSTIVE. If many transformations are to be done then a reduction in the time required to perform the transformations can be achieved by using cpl_fft_imagelist(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an image is NULL - CPL_ERROR_ILLEGAL_INPUT if the mode is illegal - CPL_ERROR_INCOMPATIBLE_INPUT if the image sizes do not match - CPL_ERROR_TYPE_MISMATCH if the image types are incompatible with each other or with the transform - CPL_ERROR_UNSUPPORTED_MODE if FFTW has not been installed */ /*---------------------------------------------------------------------------*/ cpl_error_code cpl_fft_image(cpl_image * self, const cpl_image * other, cpl_fft_mode mode) { /* The below pointers hold temporary storage allocated and deallocated by cpl_fft_image_(). */ void * bufin = NULL; void * bufout = NULL; return cpl_fft_image_(self, other, mode, NULL, &bufin, &bufout, CPL_TRUE) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*---------------------------------------------------------------------------*/ /** @internal @brief Perform a FFT operation on an image @param self Pre-allocated output image to transform to @param other Input image to transform from, use self for in-place transform @param mode CPL_FFT_FORWARD or CPL_FFT_BACKWARD, optionally CPL_FFT_NOSCALE @param pplan NULL, or a pointer to keep the plan @param pbufin A pointer to keep the input buffer @param pbufout A pointer to keep the output buffer @param is_last CPL_TRUE for the last call with the given pplan @return CPL_ERROR_NONE or the corresponding #_cpl_error_code_ on error @see cpl_fft_image() */ /*---------------------------------------------------------------------------*/ static cpl_error_code cpl_fft_image_(cpl_image * self, const cpl_image * other, cpl_fft_mode mode, void * pplan, void * pbufin, void * pbufout, cpl_boolean is_last) { const cpl_type typin = cpl_image_get_type(other); const cpl_type typout = cpl_image_get_type(self); const cpl_size lnxin = cpl_image_get_size_x(other); const cpl_size lnyin = cpl_image_get_size_y(other); const cpl_size lnxout = cpl_image_get_size_x(self); const cpl_size lnyout = cpl_image_get_size_y(self); const int nxin = (int)lnxin; const int nyin = (int)lnyin; const int nxout = (int)lnxout; const int nyout = (int)lnyout; const int nxh = ((mode & CPL_FFT_FORWARD) ? nxin : nxout) / 2 + 1; cpl_error_code error; #if defined CPL_FFTWF_INSTALLED || defined CPL_FFTW_INSTALLED unsigned rigor = FFTW_ESTIMATE; /* Default value */ if (mode & CPL_FFT_FIND_EXHAUSTIVE) { rigor = FFTW_EXHAUSTIVE; /* Reset bit. At the end the bitmask must be zero */ mode ^= CPL_FFT_FIND_EXHAUSTIVE; } else if (mode & CPL_FFT_FIND_PATIENT) { rigor = FFTW_PATIENT; /* Reset bit. At the end the bitmask must be zero */ mode ^= CPL_FFT_FIND_PATIENT; } else if (mode & CPL_FFT_FIND_MEASURE) { rigor = FFTW_MEASURE; /* Reset bit. At the end the bitmask must be zero */ mode ^= CPL_FFT_FIND_MEASURE; } #endif cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(other != NULL, CPL_ERROR_NULL_INPUT); /* FFTW (only) supports dimensions that fit within an int type */ cpl_ensure_code((cpl_size)nxin == lnxin, CPL_ERROR_UNSUPPORTED_MODE); cpl_ensure_code((cpl_size)nyin == lnyin, CPL_ERROR_UNSUPPORTED_MODE); cpl_ensure_code((cpl_size)nxout == lnxout, CPL_ERROR_UNSUPPORTED_MODE); cpl_ensure_code((cpl_size)nyout == lnyout, CPL_ERROR_UNSUPPORTED_MODE); if (mode & CPL_FFT_FORWARD && !(typin & CPL_TYPE_COMPLEX)) { cpl_ensure_code(nxin == nxout || nxout == nxh, CPL_ERROR_INCOMPATIBLE_INPUT); } else if (mode & CPL_FFT_BACKWARD && !(typout & CPL_TYPE_COMPLEX)) { cpl_ensure_code(nxin == nxout || nxin == nxh, CPL_ERROR_INCOMPATIBLE_INPUT); } else { cpl_ensure_code(nxin == nxout, CPL_ERROR_INCOMPATIBLE_INPUT); } cpl_ensure_code(lnyin == lnyout, CPL_ERROR_INCOMPATIBLE_INPUT); if (typin & CPL_TYPE_FLOAT) { cpl_ensure_code(typout & CPL_TYPE_FLOAT, CPL_ERROR_TYPE_MISMATCH); #ifdef CPL_FFTWF_INSTALLED error = cpl_fft_image_float(self, other, mode, rigor, (fftwf_plan*)pplan, (fftwf_complex**)pbufin, (fftwf_complex**)pbufout, is_last); #else error = CPL_ERROR_UNSUPPORTED_MODE; #endif } else if (typin & CPL_TYPE_DOUBLE) { cpl_ensure_code(typout & CPL_TYPE_DOUBLE, CPL_ERROR_TYPE_MISMATCH); #ifdef CPL_FFTW_INSTALLED error = cpl_fft_image_double(self, other, mode, rigor, (fftw_plan*)pplan, (fftw_complex**)pbufin, (fftw_complex**)pbufout, is_last); #else error = CPL_ERROR_UNSUPPORTED_MODE; #endif } else { error = CPL_ERROR_TYPE_MISMATCH; } /* Set or propagate error, if any */ return cpl_error_set_message_(error, "mode=%d (%d). %d X %d (%s) => %d X" " %d (%s)", (int)mode, (int)is_last, nxin, nyin, cpl_type_get_name(typin), nxout, nyout, cpl_type_get_name(typout)); } /*----------------------------------------------------------------------------*/ /** @brief Perform a FFT operation on the images in an imagelist @param self Pre-allocated output imagelist to transform to @param other Input imagelist to transform from @param mode CPL_FFT_FORWARD or CPL_FFT_BACKWARD, optionally CPL_FFT_NOSCALE @return CPL_ERROR_NONE or the corresponding #_cpl_error_code_ on error @see cpl_fft_image() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_fft_imagelist(cpl_imagelist * self, const cpl_imagelist * other, cpl_fft_mode mode) { const cpl_size sizein = cpl_imagelist_get_size(other); /* The below pointers hold temporary storage allocated by cpl_fft_image_(), the first call (if successful) allocates and the last call is responsible for the deallocation (so if the first call succeeds the subsequent call(s) are assumed to succeed). */ void * plan = NULL; void * bufin = NULL; void * bufout = NULL; cpl_size i; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(other != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_imagelist_get_size(self) == sizein, CPL_ERROR_INCOMPATIBLE_INPUT); for (i = 0; i < sizein; i++) { cpl_image * imgout = cpl_imagelist_get(self, i); const cpl_image * imgin = cpl_imagelist_get_const(other, i); if (cpl_fft_image_(imgout, imgin, mode, &plan, &bufin, &bufout, i+1 == sizein)) break; } return i == sizein ? CPL_ERROR_NONE : cpl_error_set_where_(); } /**@}*/ #if defined CPL_FFTWF_INSTALLED || defined CPL_FFTW_INSTALLED /*----------------------------------------------------------------------------*/ /** @brief Return CPL_TRUE on proper alignment (4 bits or matching align mask) @param self Pointer to return, if aligned @param other Aligned pointer, returned if self is not aligned @param align Pattern @return Aligned pointer */ /*----------------------------------------------------------------------------*/ static void * cpl_fft_aligned(void * self, void * other, size_t align) { const size_t myself = (const size_t)self; size_t lsb = 1; /* Find number of zero-valued LSBs */ while (!(align & lsb) && lsb < 16) { lsb <<=1; lsb |= 1; } lsb >>= 1; /* Iff self has a 1 where lsb has a 1, then self is not aligned */ return (myself & lsb) ? other : self; } #endif cpl-6.4.1/cpldrs/cpl_photom.c0000644000460300003120000001664011611772524013026 00000000000000/* $Id: cpl_photom.c,v 1.8 2011-07-21 09:45:56 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-21 09:45:56 $ * $Revision: 1.8 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include "cpl_tools.h" #include "cpl_math_const.h" #include "cpl_photom.h" /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_photom High-level functions that are photometry related * * @par Synopsis: * @code * #include "cpl_photom.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief The Planck radiance from a black-body @param spectrum Preallocated, the computed radiance @param out_unit CPL_UNIT_PHOTONRADIANCE, CPL_UNIT_ENERGYRADIANCE or CPL_UNIT_LESS @param evalpoints The evaluation points (wavelengths or frequencies) @param in_unit CPL_UNIT_LENGTH or CPL_UNIT_FREQUENCY @param temp The black body temperature [K] @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ The Planck black-body radiance can be computed in 5 different ways: As a radiance of either energy [J*radian/s/m^3] or photons [radian/s/m^3], and in terms of either wavelength [m] or frequency [1/s]. The fifth way is as a unit-less radiance in terms of wavelength, in which case the area under the planck curve is 1. The dimension of the spectrum (energy or photons or unit-less, CPL_UNIT_LESS) is controlled by out_unit, and the dimension of the input (length or frequency) is controlled by in_unit. evalpoints and spectrum must be of equal, positive length. The input wavelengths/frequencies and the temperature must be positive. The four different radiance formulas are: Rph1(l,T) = 2pi c/l^4/(exp(hc/klT)-1) Rph2(f,T) = 2pi f^2/c^2/(exp(hf/kT)-1) Re1(l,T) = 2pi hc^2/l^5/(exp(hc/klT)-1) = Rph1(l,T) * hc/l Re2(f,T) = 2pi hf^3/c^2/(exp(hf/kT)-1) = Rph2(f,T) * hf R1(l,T) = 15h^5c^5/(pi^4k^5l^5T^5/(exp(hc/klT)-1) = Rph1(l,T) * h^4c^3/(2pi^5k^5T^5) where l is the wavelength, f is the frequency, T is the temperature, h is the Planck constant, k is the Boltzmann constant and c is the speed of light in vacuum. When the radiance is computed in terms of wavelength, the radiance peaks at l_max = CPL_PHYS_Wien/temp. When the radiance is unit-less this maximum, R1(l_max,T), is approximately 3.2648. R1(l,T) integrated over l from 0 to infinity is 1. A unit-less black-body radiance in terms of frequency may be added later, until then it is an error to combine CPL_UNIT_LESS and CPL_UNIT_FREQUENCY. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the size of evalpoints is different from the size of spectrum - CPL_ERROR_UNSUPPORTED_MODE if in_unit and out_unit are not as requested - CPL_ERROR_ILLEGAL_INPUT if temp or a wavelength is non-positive */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_photom_fill_blackbody(cpl_vector * spectrum, cpl_unit out_unit, const cpl_vector * evalpoints, cpl_unit in_unit, double temp) { double walpha = CPL_MATH_2PI; double wbeta = CPL_PHYS_H / (CPL_PHYS_K * temp); double * sp = cpl_vector_get_data( spectrum ); const double * wlf = cpl_vector_get_data_const( evalpoints ); const cpl_size n = cpl_vector_get_size( evalpoints ); int ipow; cpl_size i; cpl_ensure_code(spectrum != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(evalpoints != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(n == cpl_vector_get_size( spectrum ), CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(temp > 0.0, CPL_ERROR_ILLEGAL_INPUT); assert( wlf != NULL ); assert( sp != NULL ); switch (in_unit) { case CPL_UNIT_LENGTH: { switch (out_unit) { case CPL_UNIT_LESS: { walpha *= 7.5 * cpl_tools_ipow(CPL_PHYS_H * CPL_PHYS_C /(CPL_MATH_PI*CPL_PHYS_K * temp), 5); ipow = 5; break; } case CPL_UNIT_PHOTONRADIANCE: { walpha *= CPL_PHYS_C; ipow = 4; break; } case CPL_UNIT_ENERGYRADIANCE: { walpha *= CPL_PHYS_H * CPL_PHYS_C * CPL_PHYS_C; ipow = 5; break; } default: return cpl_error_set(cpl_func, CPL_ERROR_UNSUPPORTED_MODE); } wbeta *= CPL_PHYS_C; for (i=0; i < n; i++) { cpl_ensure_code(wlf[i] > 0.0, CPL_ERROR_ILLEGAL_INPUT); sp[i] = walpha / (cpl_tools_ipow(wlf[i], ipow) * (exp(wbeta / wlf[i]) - 1.0)); } break; } case CPL_UNIT_FREQUENCY: { switch (out_unit) { case CPL_UNIT_PHOTONRADIANCE: { walpha /= CPL_PHYS_C * CPL_PHYS_C; ipow = 2; break; } case CPL_UNIT_ENERGYRADIANCE: { walpha *= CPL_PHYS_H / (CPL_PHYS_C * CPL_PHYS_C); ipow = 3; break; } default: return cpl_error_set(cpl_func, CPL_ERROR_UNSUPPORTED_MODE); } for (i=0; i < n; i++) { cpl_ensure_code(wlf[i] > 0.0, CPL_ERROR_ILLEGAL_INPUT); sp[i] = walpha * cpl_tools_ipow(wlf[i], ipow) / (exp(wbeta * wlf[i]) - 1.0); } break; } default: return cpl_error_set(cpl_func, CPL_ERROR_UNSUPPORTED_MODE); } return CPL_ERROR_NONE; } /**@}*/ cpl-6.4.1/cpldrs/cpl_fft.h0000644000460300003120000000536212100266660012274 00000000000000/* $Id: cpl_fft.h,v 1.8 2013-01-24 17:21:52 cgarcia Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CPL_FFT_H #define CPL_FFT_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_imagelist.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ /** * @ingroup cpl_fft * @brief The supported values of the CPL fft mode. */ enum _cpl_fft_mode_ { /** * The forward transform * @hideinitializer */ CPL_FFT_FORWARD = 1 << 1, /** * The backward transform * @hideinitializer */ CPL_FFT_BACKWARD = 1 << 2, /** * Transform without scaling (has no effect on forward transform) * @hideinitializer */ CPL_FFT_NOSCALE = 1 << 3, /** * Spend time finding the best transform * @hideinitializer */ CPL_FFT_FIND_MEASURE = 1 << 4, /** * Spend more time finding the best transform * @hideinitializer */ CPL_FFT_FIND_PATIENT = 1 << 5, /** * Spend even more time finding the best transform * @hideinitializer */ CPL_FFT_FIND_EXHAUSTIVE = 1 << 6 }; /** * @ingroup cpl_fft * @brief The CPL fft mode. */ typedef enum _cpl_fft_mode_ cpl_fft_mode; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_error_code cpl_fft_image(cpl_image *, const cpl_image *, cpl_fft_mode); cpl_error_code cpl_fft_imagelist(cpl_imagelist *, const cpl_imagelist *, cpl_fft_mode); CPL_END_DECLS #endif /* CPL_FFT_H */ cpl-6.4.1/cpldrs/cpl_detector.h0000644000460300003120000000431111614520666013327 00000000000000/* $Id: cpl_detector.h,v 1.8 2011-07-29 12:04:06 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-29 12:04:06 $ * $Revision: 1.8 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_DETECTOR_H #define CPL_DETECTOR_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* Noise computation */ cpl_error_code cpl_flux_get_noise_window(const cpl_image *, const cpl_size *, cpl_size, cpl_size, double *, double *); cpl_error_code cpl_flux_get_bias_window(const cpl_image *, const cpl_size *, cpl_size, cpl_size, double *, double *); cpl_error_code cpl_flux_get_noise_ring(const cpl_image *, const double *, cpl_size, cpl_size, double *, double *); /* Bad pixels cleaning */ cpl_error_code cpl_detector_interpolate_rejected(cpl_image *); CPL_END_DECLS #endif cpl-6.4.1/cpldrs/cpl_wcs.h0000644000460300003120000000661312272261460012314 00000000000000/* $Id: cpl_wcs.h,v 1.14 2012-08-29 14:49:48 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-08-29 14:49:48 $ * $Revision: 1.14 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_WCS_H #define CPL_WCS_H #include "cpl_error.h" #include "cpl_propertylist.h" #include "cpl_matrix.h" #include "cpl_array.h" /* Definition of WCS structure */ typedef struct _cpl_wcs_ cpl_wcs; /* Enumerate the modes available for the convert routine */ enum cpl_wcs_trans_mode { CPL_WCS_PHYS2WORLD, CPL_WCS_WORLD2PHYS, CPL_WCS_PHYS2STD, CPL_WCS_WORLD2STD}; typedef enum cpl_wcs_trans_mode cpl_wcs_trans_mode; /* Enumerate the modes available for the plate solution routine */ enum cpl_wcs_platesol_fitmode { CPL_WCS_PLATESOL_6, CPL_WCS_PLATESOL_4}; typedef enum cpl_wcs_platesol_fitmode cpl_wcs_platesol_fitmode; enum cpl_wcs_platesol_outmode { CPL_WCS_MV_CRVAL, CPL_WCS_MV_CRPIX}; typedef enum cpl_wcs_platesol_outmode cpl_wcs_platesol_outmode; /* Macro definitions */ /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_wcs @brief A regular expression that matches the FITS keys used for WCS */ /*----------------------------------------------------------------------------*/ #define CPL_WCS_REGEXP "WCSAXES|WCSNAME|(PC|CD|PV|PS)[0-9]+_[0-9]+|" \ "C(RVAL|RPIX|DELT|TYPE|UNIT|RDER|SYER)[0-9]+" /* Function prototypes */ CPL_BEGIN_DECLS cpl_wcs *cpl_wcs_new_from_propertylist(const cpl_propertylist *plist) CPL_ATTR_ALLOC; void cpl_wcs_delete(cpl_wcs *wcs); cpl_error_code cpl_wcs_convert(const cpl_wcs *wcs, const cpl_matrix *from, cpl_matrix **to, cpl_array **status, cpl_wcs_trans_mode transform); cpl_error_code cpl_wcs_platesol(const cpl_propertylist *ilist, const cpl_matrix *cel, const cpl_matrix *xy, int niter, float thresh, cpl_wcs_platesol_fitmode fitmode, cpl_wcs_platesol_outmode outmode, cpl_propertylist **olist); /* Accessor routines */ int cpl_wcs_get_image_naxis(const cpl_wcs *wcs); const cpl_array *cpl_wcs_get_image_dims(const cpl_wcs *wcs); const cpl_array *cpl_wcs_get_crval(const cpl_wcs *wcs); const cpl_array *cpl_wcs_get_crpix(const cpl_wcs *wcs); const cpl_array *cpl_wcs_get_ctype(const cpl_wcs *wcs); const cpl_array *cpl_wcs_get_cunit(const cpl_wcs *wcs); const cpl_matrix *cpl_wcs_get_cd(const cpl_wcs *wcs); CPL_END_DECLS #endif /* CPL_WCS_H */ cpl-6.4.1/cpldrs/tests/0000755000460300003120000000000012310333012011707 500000000000000cpl-6.4.1/cpldrs/tests/cpl_photom-test.c0000644000460300003120000004046411614514436015145 00000000000000/* $Id: cpl_photom-test.c,v 1.26 2011-07-29 11:27:26 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-29 11:27:26 $ * $Revision: 1.26 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include "cpl_polynomial.h" #include "cpl_bivector.h" #include "cpl_photom.h" #include "cpl_type.h" #include "cpl_tools.h" #include "cpl_memory.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef FUNCTION_SIZE #define FUNCTION_SIZE 1024 #endif /* A telescope main mirror could for example have a temperature of 12C */ #define TEMP_BB 285 /* Wiens displacement in frequency domain [Hz/K] */ /* FIXME: Document and export */ #define CPL_PHYS_Wien_Freq 5.879e10 /* The relevant range for black-body radiation is about [2;32[ micron */ #define WL_MIN 2e-6 #define WL_MAX 32e-6 /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_photom_units_test(void); static void cpl_photom_fill_blackbody_test(cpl_vector *, cpl_unit, const cpl_vector *, cpl_unit, double, unsigned); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_polynomial * poly1 ; cpl_bivector * fun ; cpl_bivector * trans; FILE * ftrans; const double temp = TEMP_BB; cpl_size i; const cpl_size half_search = FUNCTION_SIZE/2; cpl_vector * vxc; cpl_error_code error; double * wlf; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ cpl_msg_info("", CPL_STRINGIFY(TEMP_BB) "K Black-Body radiation peaks at " "[m]: %g", CPL_PHYS_Wien/temp); cpl_msg_info("", CPL_STRINGIFY(TEMP_BB) "K Black-Body radiation peaks at " "[Hz]: %g", CPL_PHYS_Wien_Freq * temp); cpl_photom_units_test(); poly1 = cpl_polynomial_new(1); cpl_test_nonnull( poly1 ); i = 0; error = cpl_polynomial_set_coeff(poly1, &i, WL_MIN); cpl_test_eq_error(error, CPL_ERROR_NONE); i++; error = cpl_polynomial_set_coeff(poly1, &i, (WL_MAX-WL_MIN)/FUNCTION_SIZE); cpl_test_eq_error(error, CPL_ERROR_NONE); fun = cpl_bivector_new(FUNCTION_SIZE); cpl_test_nonnull( fun ); error = cpl_vector_fill_polynomial(cpl_bivector_get_x(fun), poly1, 0, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_photom_fill_blackbody_test(cpl_bivector_get_y(fun), CPL_UNIT_PHOTONRADIANCE, cpl_bivector_get_x(fun), CPL_UNIT_LENGTH, temp, __LINE__); ftrans = fopen("planck1.txt", "w"); cpl_test_nonnull( ftrans ); cpl_bivector_dump(fun, ftrans); cpl_test_zero( fclose(ftrans) ); cpl_photom_fill_blackbody_test(cpl_bivector_get_y(fun), CPL_UNIT_ENERGYRADIANCE, cpl_bivector_get_x_const(fun), CPL_UNIT_LENGTH, temp, __LINE__); trans = cpl_bivector_new(FUNCTION_SIZE); cpl_test_nonnull( trans ); error = cpl_vector_copy(cpl_bivector_get_x(trans), cpl_bivector_get_x_const(fun)); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_photom_fill_blackbody_test(cpl_bivector_get_y(trans), CPL_UNIT_LESS, cpl_bivector_get_x_const(trans), CPL_UNIT_LENGTH, temp, __LINE__); vxc = cpl_vector_new(2*half_search + 1); cpl_test_eq( cpl_vector_correlate(vxc, cpl_bivector_get_y_const(trans), cpl_bivector_get_y_const(fun)), half_search ); cpl_test_error(CPL_ERROR_NONE); cpl_test_abs(cpl_vector_get(vxc, half_search), 1.0, FUNCTION_SIZE * DBL_EPSILON); ftrans = fopen("planck2.txt", "w"); cpl_test_nonnull( ftrans ); cpl_bivector_dump(trans, ftrans); cpl_test_zero( fclose(ftrans) ); if (cpl_msg_get_level() <= CPL_MSG_DEBUG) { const char * options[] = {"t '" CPL_STRINGIFY(TEMP_BB) "K black body " "radiance' w points;", "t '" CPL_STRINGIFY(TEMP_BB) "K black body " "radiance peak';"}; cpl_bivector *pair[] = {cpl_bivector_new(1), trans}; error = cpl_vector_set(cpl_bivector_get_x(pair[0]), 0, CPL_PHYS_Wien/temp); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_photom_fill_blackbody_test(cpl_bivector_get_y(pair[0]), CPL_UNIT_LESS, cpl_bivector_get_x_const(pair[0]), CPL_UNIT_LENGTH, temp, __LINE__); error = cpl_plot_bivectors("set xlabel 'Wavelength [m]';" "set ylabel 'Unit less';", options, "", (const cpl_bivector**)pair, 2); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_bivector_delete(pair[0]); } /* Fill also in frequency mode */ wlf = cpl_bivector_get_x_data(fun); for (i = 0; i < FUNCTION_SIZE; i++) { wlf[i] = CPL_PHYS_C / wlf[i]; } cpl_photom_fill_blackbody_test(cpl_bivector_get_y(fun), CPL_UNIT_PHOTONRADIANCE, cpl_bivector_get_x(fun), CPL_UNIT_FREQUENCY, temp, __LINE__); cpl_photom_fill_blackbody_test(cpl_bivector_get_y(fun), CPL_UNIT_ENERGYRADIANCE, cpl_bivector_get_x_const(fun), CPL_UNIT_FREQUENCY, temp, __LINE__); if (cpl_msg_get_level() <= CPL_MSG_DEBUG) { const char * options[] = {"t '" CPL_STRINGIFY(TEMP_BB) "K black body " "radiance' w points;", "t '" CPL_STRINGIFY(TEMP_BB) "K black body " "radiance peak';"}; cpl_bivector *pair[] = {cpl_bivector_new(1), fun}; error = cpl_vector_set(cpl_bivector_get_x(pair[0]), 0, CPL_PHYS_Wien_Freq * temp); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_photom_fill_blackbody_test(cpl_bivector_get_y(pair[0]), CPL_UNIT_ENERGYRADIANCE, cpl_bivector_get_x_const(pair[0]), CPL_UNIT_FREQUENCY, temp, __LINE__); error = cpl_plot_bivectors("set xlabel 'Frequency [hz]';" "set ylabel 'Energy Radiance';", options, "", (const cpl_bivector**)pair, 2); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_bivector_delete(pair[0]); } /* Error testing */ error = cpl_photom_fill_blackbody(NULL, CPL_UNIT_LESS, cpl_bivector_get_x_const(trans), CPL_UNIT_LENGTH, temp); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_photom_fill_blackbody(cpl_bivector_get_y(trans), CPL_UNIT_LESS, NULL, CPL_UNIT_LENGTH, temp); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_photom_fill_blackbody(vxc, CPL_UNIT_LESS, cpl_bivector_get_x_const(trans), CPL_UNIT_LENGTH, temp); cpl_test_eq_error(error, CPL_ERROR_INCOMPATIBLE_INPUT); error = cpl_photom_fill_blackbody(cpl_bivector_get_y(trans), CPL_UNIT_LESS, cpl_bivector_get_x_const(trans), CPL_UNIT_LENGTH, 0.0); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_photom_fill_blackbody(cpl_bivector_get_y(trans), CPL_UNIT_LESS, cpl_bivector_get_x_const(trans), CPL_UNIT_FREQUENCY, temp); cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); error = cpl_photom_fill_blackbody(cpl_bivector_get_y(trans), CPL_UNIT_LESS, cpl_bivector_get_x_const(trans), CPL_UNIT_FREQUENCY, temp); cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); error = cpl_photom_fill_blackbody(cpl_bivector_get_y(trans), CPL_UNIT_LESS, cpl_bivector_get_x_const(trans), CPL_UNIT_LESS, temp); cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); error = cpl_photom_fill_blackbody(cpl_bivector_get_y(trans), CPL_UNIT_LENGTH, cpl_bivector_get_x_const(trans), CPL_UNIT_ENERGYRADIANCE, temp); cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); error = cpl_vector_set(cpl_bivector_get_x(trans), 0, 0.0); cpl_test_error(CPL_ERROR_NONE); error = cpl_photom_fill_blackbody(cpl_bivector_get_y(trans), CPL_UNIT_LESS, cpl_bivector_get_x_const(trans), CPL_UNIT_LENGTH, temp); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); cpl_vector_delete(vxc); cpl_polynomial_delete(poly1); cpl_bivector_delete(fun); cpl_bivector_delete(trans); return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @brief Test the CPL units @return void */ /*----------------------------------------------------------------------------*/ static void cpl_photom_units_test(void) { const cpl_unit units[] = { CPL_UNIT_LESS, CPL_UNIT_RADIAN, CPL_UNIT_LENGTH, CPL_UNIT_TIME, CPL_UNIT_PERLENGTH, CPL_UNIT_FREQUENCY, CPL_UNIT_MASS, CPL_UNIT_ACCELERATION, CPL_UNIT_FORCE, CPL_UNIT_ENERGY, CPL_UNIT_PHOTONRADIANCE, CPL_UNIT_ENERGYRADIANCE}; const unsigned nunits = sizeof(units)/sizeof(units[0]); unsigned i, j; /* No-unit must be the identity element with respect to multiplication */ cpl_test_eq(CPL_UNIT_LESS, 1); /* Verify uniqueness of units */ for (i = 0; i < nunits; i++) { for (j = 0; j < nunits; j++) { if (i == j) continue; cpl_test_noneq(units[i], units[j]); } } /* Reciprocal units do _not_ cancel out :-( */ cpl_test_noneq(CPL_UNIT_TIME * CPL_UNIT_FREQUENCY, CPL_UNIT_LESS); cpl_test_noneq(CPL_UNIT_LENGTH * CPL_UNIT_PERLENGTH, CPL_UNIT_LESS); /* Derived quantities */ cpl_test_eq(CPL_UNIT_ACCELERATION, CPL_UNIT_LENGTH * CPL_UNIT_FREQUENCY * CPL_UNIT_FREQUENCY); cpl_test_eq(CPL_UNIT_FORCE, CPL_UNIT_MASS * CPL_UNIT_ACCELERATION); cpl_test_eq(CPL_UNIT_ENERGY, CPL_UNIT_LENGTH * CPL_UNIT_FORCE); cpl_test_eq(CPL_UNIT_PHOTONRADIANCE, CPL_UNIT_RADIAN * CPL_UNIT_FREQUENCY * CPL_UNIT_PERLENGTH * CPL_UNIT_PERLENGTH * CPL_UNIT_PERLENGTH); cpl_test_eq(CPL_UNIT_ENERGYRADIANCE, CPL_UNIT_ENERGY * CPL_UNIT_PHOTONRADIANCE); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Fill a spectrum using valid input and verify it @param spectrum Preallocated, the computed radiance @param out_unit CPL_UNIT_PHOTONRADIANCE, CPL_UNIT_ENERGYRADIANCE or CPL_UNIT_LESS @param evalpoints The evaluation points (wavelengths or frequencies) @param in_unit CPL_UNIT_LENGTH or CPL_UNIT_FREQUENCY @param temp The black body temperature [K] @param line __LINE__ @return void @see cpl_photom_fill_blackbody() evalpoints must be strictly monotone, increasing for wavelengths, decreasing for frequencies. */ /*----------------------------------------------------------------------------*/ static void cpl_photom_fill_blackbody_test(cpl_vector * spectrum, cpl_unit out_unit, const cpl_vector * evalpoints, cpl_unit in_unit, double temp, unsigned line) { const cpl_size fsize = cpl_vector_get_size(spectrum); const cpl_error_code error = cpl_photom_fill_blackbody(spectrum, out_unit, evalpoints, in_unit, temp); cpl_test_eq_error(error, CPL_ERROR_NONE); if (error != CPL_ERROR_NONE) { cpl_msg_error(cpl_func, "Failure from line %u", line); } else if (out_unit == CPL_UNIT_ENERGYRADIANCE) { /* FIXME: Test also CPL_UNIT_PHOTONRADIANCE */ const double * sp = cpl_vector_get_data_const(spectrum); const double * wl = cpl_vector_get_data_const(evalpoints); cpl_size i; if (in_unit == CPL_UNIT_LENGTH) { const double xtpt = CPL_PHYS_Wien/temp; /* wavelength */ cpl_test_lt(0.0, sp[0]); for (i = 1; i < fsize; i++) { /* Wavelengths must increase */ cpl_test_lt(wl[i-1], wl[i]); if (wl[i] < xtpt) { /* Must be monotonely increasing */ cpl_test_lt(sp[i-1], sp[i]); } else if (i < fsize - 1) { /* Must be monotonely decreasing */ cpl_test_lt(sp[i+1], sp[i]); } } } else if (in_unit == CPL_UNIT_FREQUENCY) { const double xtpt = temp * CPL_PHYS_Wien_Freq; /* Frequency */ cpl_test_lt(0.0, sp[0]); for (i = 1; i < fsize; i++) { /* Frequencies must increase */ cpl_test_lt(wl[i], wl[i-1]); if (xtpt < wl[i]) { /* Must be monotonely increasing */ cpl_test_lt(sp[i-1], sp[i]); } else if (i < fsize - 1) { /* Must be monotonely decreasing */ cpl_test_lt(sp[i+1], sp[i]); } } } } return; } cpl-6.4.1/cpldrs/tests/cpl_fit-test.c0000644000460300003120000020725012130557644014421 00000000000000/* $Id: cpl_fit-test.c,v 1.48 2013-04-08 15:17:56 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-08 15:17:56 $ * $Revision: 1.48 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_fit.h" #include "cpl_memory.h" #include "cpl_stats.h" #include "cpl_tools.h" #include "cpl_test.h" #include "cpl_math_const.h" #include #include #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef IMAGESZ #define IMAGESZ 10 #endif #ifndef IMAGESZFIT #define IMAGESZFIT 256 #endif #ifndef WINSTART #define WINSTART 3 #endif #define IMSZ 6 /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_fit_test Testing of the CPL utilities */ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define cpl_fit_imagelist_is_zero(A, B) \ cpl_fit_imagelist_is_zero_macro(A, B, __LINE__) #define cpl_fit_image_is_zero(A, B) \ cpl_fit_image_is_zero_macro(A, B, __LINE__) /*----------------------------------------------------------------------------- Private Function prototypes -----------------------------------------------------------------------------*/ static void cpl_fit_imagelist_polynomial_tests(void); static void cpl_fit_imagelist_polynomial_bpm(void); static void cpl_fit_image_gaussian_tests(cpl_type); static void cpl_fit_imagelist_is_zero_macro(const cpl_imagelist *, double, int); static void cpl_fit_image_is_zero_macro(const cpl_image *, double, int); static void eval_gauss(const double x[], const double a[], double *); static int check_gauss_success(const char **, const double *, const double *, const char **, const double *, const double *, cpl_array *, cpl_array *, double, double, double, cpl_matrix *); static void cpl_fit_image_gaussian_test_one(void); static void cpl_fit_image_gaussian_test_local(void); static cpl_imagelist * cpl_fit_imagelist_polynomial_window_test(const cpl_vector *, const cpl_imagelist *, int, int, int, int, int, int, cpl_boolean, cpl_type, cpl_image *); /*----------------------------------------------------------------------------*/ /** @internal @brief Unit tests of fit module **/ /*----------------------------------------------------------------------------*/ int main(void) { cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ cpl_fit_imagelist_polynomial_bpm(); cpl_fit_image_gaussian_tests(CPL_TYPE_INT); cpl_fit_image_gaussian_tests(CPL_TYPE_FLOAT); cpl_fit_image_gaussian_tests(CPL_TYPE_DOUBLE); cpl_fit_imagelist_polynomial_tests(); cpl_fit_image_gaussian_test_one(); cpl_fit_image_gaussian_test_local(); /* End of tests */ return cpl_test_end(0); } static void cpl_fit_imagelist_polynomial_tests(void) { const double ditval[] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}; const double neqditval[] = {1.0, 2.0, 4.0, 6.0, 10.0, 14.0, 16.0, 18.0, 19.0}; cpl_imagelist * fit; cpl_imagelist * fit_eq; cpl_imagelist * input; cpl_image * dfiterror = cpl_image_new(IMAGESZFIT, IMAGESZFIT, CPL_TYPE_DOUBLE); cpl_image * ffiterror = cpl_image_new(IMAGESZFIT, IMAGESZFIT, CPL_TYPE_FLOAT); cpl_image * ifiterror = cpl_image_new(IMAGESZFIT, IMAGESZFIT, CPL_TYPE_INT); cpl_image * cfiterror = cpl_image_new(IMAGESZFIT, IMAGESZFIT, CPL_TYPE_FLOAT_COMPLEX); cpl_image * dfiterrorwin; const int ndits = (int)(sizeof(ditval)/sizeof(double)); cpl_vector * vdit = cpl_vector_wrap(ndits, (double*)ditval); cpl_vector * nvdit = cpl_vector_wrap(ndits, (double*)neqditval); cpl_polynomial * vfiller = cpl_polynomial_new(1); const double sqsum = 204.0; /* Sum of squares of ditvals */ const double mytol = 5.52 * FLT_EPSILON; cpl_size i; const cpl_type pixel_type[] = {CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT}; const int ntypes = (int)(sizeof(pixel_type)/sizeof(pixel_type[0])); int ntest; cpl_flops flopsum = 0; cpl_flops flops; double secs = 0.0; size_t bytes = 0; double cputime; double demax; cpl_error_code error; cpl_msg_info(cpl_func, "Testing with %d %d X %d images", ndits, IMAGESZFIT, IMAGESZFIT); fit = cpl_fit_imagelist_polynomial(NULL, NULL, 0, 0, CPL_FALSE, CPL_TYPE_FLOAT, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null( fit ); cpl_imagelist_delete(fit); fit = cpl_fit_imagelist_polynomial_window(NULL, NULL, 1, 1, IMAGESZFIT, IMAGESZFIT, 0, 0, CPL_FALSE, CPL_TYPE_FLOAT, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null( fit ); cpl_imagelist_delete(fit); input = cpl_imagelist_new(); fit = cpl_fit_imagelist_polynomial(vdit, input, 0, 0, CPL_FALSE, CPL_TYPE_FLOAT, NULL); cpl_test_error(CPL_ERROR_INCOMPATIBLE_INPUT); cpl_test_null( fit ); cpl_imagelist_delete(fit); fit = cpl_fit_imagelist_polynomial_window(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 0, 0, CPL_FALSE, CPL_TYPE_FLOAT, NULL); cpl_test_error(CPL_ERROR_INCOMPATIBLE_INPUT); cpl_test_null( fit ); cpl_imagelist_delete(fit); fit = cpl_fit_imagelist_polynomial(vdit, input, 1, 1, CPL_FALSE, CPL_TYPE_FLOAT, NULL); cpl_test_error(CPL_ERROR_INCOMPATIBLE_INPUT); cpl_test_null( fit ); cpl_imagelist_delete(fit); fit = cpl_fit_imagelist_polynomial_window(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 0, 0, CPL_FALSE, CPL_TYPE_FLOAT, NULL); cpl_test_error(CPL_ERROR_INCOMPATIBLE_INPUT); cpl_test_null( fit ); cpl_imagelist_delete(fit); /* Test with all types of pixels */ for (ntest = 0; ntest < ntypes; ntest++) { const cpl_type test_type = pixel_type[ntest]; cpl_image * image = cpl_image_new(IMAGESZFIT, IMAGESZ, test_type); cpl_msg_info(cpl_func, "Fitting with pixel type: %s", cpl_type_get_name(test_type)); error = cpl_imagelist_set(input, image, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); image = cpl_image_duplicate(image); error = cpl_image_fill_noise_uniform(image, 1.0, 20.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_multiply_scalar(image, ditval[1]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, image, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); /* A perfectly linear set */ for (i = 2; i < ndits; i++) { image = cpl_image_multiply_scalar_create(cpl_imagelist_get(input, 1), ditval[i]); error = cpl_imagelist_set(input, image, i); cpl_test_eq_error(error, CPL_ERROR_NONE); } flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, 1, 1, IMAGESZFIT, IMAGESZ, 1, ndits-1, CPL_FALSE, test_type, NULL); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), ndits - 1 ); /* The linarity must be equal to the values in image 1 - normalize */ error = cpl_image_divide(cpl_imagelist_get(fit, 0), cpl_imagelist_get(input, 1)); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Subtract the expected value in the 1st image */ error = cpl_image_subtract_scalar(cpl_imagelist_get(fit, 0), 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_fit_imagelist_is_zero(fit, IMAGESZFIT * mytol); cpl_imagelist_delete(fit); flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, WINSTART, WINSTART, IMAGESZFIT - WINSTART, IMAGESZ - WINSTART, 1, ndits-1, CPL_FALSE, test_type, NULL); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), ndits - 1 ); cpl_imagelist_delete(fit); /* * For the _window() version of the fitting function, we don't test * the correctness of the products any further here, * as it would add too much complexity and the objective inside * this loop is mainly to test on different pixel tests. We will do * do it in later steps. */ cpl_imagelist_delete(input); input = cpl_imagelist_new(); /* * Repeat with non-equidistant but symmetric x-axis values * and check validity of the eq_dist in this case */ image = cpl_image_new(IMAGESZFIT, IMAGESZ, test_type); error = cpl_image_fill_noise_uniform(image, 1.0, 20.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_multiply_scalar(image, neqditval[0]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, image, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); /* A perfectly linear set */ for (i = 1; i < ndits; i++) { image = cpl_image_multiply_scalar_create(cpl_imagelist_get(input, 0), neqditval[i]); error = cpl_imagelist_set(input, image, i); cpl_test_eq_error(error, CPL_ERROR_NONE); } /* Fit without is_eqdist option */ flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); fit = cpl_fit_imagelist_polynomial_window_test(nvdit, input, 1, 1, IMAGESZFIT, IMAGESZ, 1, ndits-1, CPL_FALSE, test_type, NULL); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), ndits - 1 ); /* Repeat with is_eqdist */ flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); fit_eq = cpl_fit_imagelist_polynomial_window_test(nvdit, input, 1, 1, IMAGESZFIT, IMAGESZ, 1, ndits-1, CPL_TRUE, test_type, NULL); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_imagelist_abs(fit, fit_eq, mytol); cpl_imagelist_delete(fit); cpl_imagelist_delete(fit_eq); cpl_imagelist_delete(input); input = cpl_imagelist_new(); } /* 2nd order function check with and without eq_dist */ for (i=0; i < ndits; i++) { cpl_image * image = cpl_image_new(IMAGESZFIT, IMAGESZFIT, CPL_TYPE_DOUBLE); error = cpl_image_add_scalar(image, neqditval[i]*neqditval[i]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, image, i); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_msg_debug(cpl_func, "Dit and mean of input image no. %" CPL_SIZE_FORMAT ": %g %g", i, ditval[i], cpl_image_get_mean(image)); } fit = cpl_fit_imagelist_polynomial_window_test(nvdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 1, ndits, CPL_FALSE, CPL_TYPE_FLOAT, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(fit); fit_eq = cpl_fit_imagelist_polynomial_window_test(nvdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 1, ndits, CPL_TRUE, CPL_TYPE_FLOAT, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(fit_eq); cpl_test_imagelist_abs(fit, fit_eq, mytol); cpl_imagelist_delete(fit); cpl_imagelist_delete(fit_eq); cpl_imagelist_delete(input); input = cpl_imagelist_new(); cpl_test_eq_ptr(cpl_vector_unwrap(nvdit), neqditval); /* Create a list of images with a 2nd order function */ for (i=0; i < ndits; i++) { cpl_image * image = cpl_image_new(IMAGESZFIT, IMAGESZFIT, CPL_TYPE_DOUBLE); error = cpl_image_add_scalar(image, ditval[i]*ditval[i]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, image, i); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_msg_info(cpl_func, "Dit and mean of input image no. %" CPL_SIZE_FORMAT ": %g %g", i, ditval[i], cpl_image_get_mean(image)); } /* Fit a high-order overdetermined system and a maximum-order, non-overdetermined system */ for (i = ndits-1; i <= ndits; i++) { fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 1, i, CPL_FALSE, CPL_TYPE_FLOAT, NULL); #if defined SIZEOF_SIZE_T && SIZEOF_SIZE_T == 4 if (i == ndits && fit == NULL) { /* FIXME: When fitting a non-overdetermined, maximum-order system on (some) 32-bit machines the rounding errors in the Vandermonde matrix become dominant to the point that the Cholesky decomposition fails. */ cpl_test_error(CPL_ERROR_SINGULAR_MATRIX); } else #endif { cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(fit); cpl_imagelist_delete(fit); } } /* Illegal max-degree */ fit = cpl_fit_imagelist_polynomial(vdit, input, 1, 0, CPL_FALSE, CPL_TYPE_FLOAT, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null( fit ); /* Illegal min-degree */ fit = cpl_fit_imagelist_polynomial(vdit, input, -1, 0, CPL_FALSE, CPL_TYPE_FLOAT, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null( fit ); /* Illegal pixeltype */ fit = cpl_fit_imagelist_polynomial(vdit, input, 0, 0, CPL_FALSE, CPL_TYPE_INVALID, NULL); cpl_test_error(CPL_ERROR_UNSUPPORTED_MODE); cpl_test_null( fit ); flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); /* Fit with zero-order term */ /* Also, try to use an integer-type image for fitting error */ fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 0, 2, CPL_TRUE, CPL_TYPE_FLOAT, ifiterror); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), 3 ); cpl_fit_image_is_zero(ifiterror, mytol); error = cpl_image_subtract_scalar(cpl_imagelist_get(fit, 2), 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_fit_imagelist_is_zero(fit, mytol); cpl_imagelist_delete(fit); flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); /* Fit with zero-order term */ /* Also, try to use an integer-type image for fitting error */ fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 0, ndits-1, CPL_TRUE, CPL_TYPE_FLOAT, ifiterror); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), ndits ); cpl_fit_image_is_zero(ifiterror, mytol); error = cpl_image_subtract_scalar(cpl_imagelist_get(fit, 2), 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_fit_imagelist_is_zero(fit, mytol); cpl_imagelist_delete(fit); /* Fit without zero-order term */ fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 1, ndits-1, CPL_FALSE, CPL_TYPE_FLOAT, dfiterror); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), ndits-1 ); error = cpl_image_subtract_scalar(cpl_imagelist_get(fit, 1), 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_fit_imagelist_is_zero(fit, mytol); cpl_fit_image_is_zero(dfiterror, mytol); cpl_imagelist_delete(fit); /* A valid fit, except that the fitting error is complex */ fit = cpl_fit_imagelist_polynomial(vdit, input, 1, ndits-1, CPL_FALSE, CPL_TYPE_FLOAT, cfiterror); cpl_test_error(CPL_ERROR_UNSUPPORTED_MODE); cpl_test_null(fit); /* A valid fit, except that the fitting type is complex */ fit = cpl_fit_imagelist_polynomial(vdit, input, 1, ndits-1, CPL_FALSE, CPL_TYPE_FLOAT_COMPLEX, ffiterror); cpl_test_error(CPL_ERROR_UNSUPPORTED_MODE); cpl_test_null(fit); flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); /* Repeat previous test on _window() function */ dfiterrorwin = cpl_image_new(IMAGESZFIT - 2 * WINSTART + 1, IMAGESZ - 2 * WINSTART + 1, CPL_TYPE_DOUBLE); fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, WINSTART, WINSTART, IMAGESZFIT - WINSTART, IMAGESZ - WINSTART, 1, ndits-1, CPL_FALSE, CPL_TYPE_FLOAT, dfiterrorwin); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); /* FIXME: Too large... */ cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), ndits-1 ); cpl_test_eq(cpl_image_get_size_x(cpl_imagelist_get(fit, 0)), IMAGESZFIT - 2 * WINSTART + 1 ); cpl_test_eq(cpl_image_get_size_y(cpl_imagelist_get(fit, 0)), IMAGESZ - 2 * WINSTART + 1 ); error = cpl_image_subtract_scalar(cpl_imagelist_get(fit, 1), 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_fit_imagelist_is_zero(fit, mytol); cpl_fit_image_is_zero(dfiterrorwin, mytol); cpl_imagelist_delete(fit); cpl_image_delete(dfiterrorwin); flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); /* Fit with no zero- and 1st-order terms */ fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 2, ndits, CPL_TRUE, CPL_TYPE_FLOAT, ffiterror); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), ndits-1 ); error = cpl_image_subtract_scalar(cpl_imagelist_get(fit, 0), 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_fit_imagelist_is_zero(fit, mytol); cpl_fit_image_is_zero(ffiterror, mytol); cpl_imagelist_delete(fit); flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); /* Fit with one zero-term */ fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 0, 0, CPL_TRUE, CPL_TYPE_FLOAT, dfiterror); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), 1 ); error = cpl_image_subtract_scalar(cpl_imagelist_get(fit, 0), sqsum/(double)ndits); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_fit_imagelist_is_zero(fit, mytol); cpl_imagelist_delete(fit); cpl_imagelist_delete(input); cpl_test_eq_ptr(cpl_vector_unwrap(vdit), ditval); /* Try to fit as many coefficients are there are data points */ /* Also, use floats this time */ /* Use a polynomial to filler vdit */ i = 0; error = cpl_polynomial_set_coeff(vfiller, &i, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); i = 1; error = cpl_polynomial_set_coeff(vfiller, &i, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); input = cpl_imagelist_new(); vdit = cpl_vector_new(1); for (ntest = 1; ntest <= ndits; ntest++) { const double gain = 4.0; /* Some random number */ cpl_msg_info(cpl_func, "Fitting %d coefficients to as many points", ntest); error = cpl_vector_set_size(vdit, ntest); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_fill_polynomial(vdit, vfiller, 0.0, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Create a list of images with a 2nd order function */ for (i = ntest - 1; i < ntest; i++) { cpl_image * image = cpl_image_new(IMAGESZFIT, IMAGESZFIT, CPL_TYPE_FLOAT); error = cpl_image_add_scalar(image, gain * ditval[i]*ditval[i]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, image, i); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_msg_info(cpl_func, "Dit and mean of input image no. %" CPL_SIZE_FORMAT ": %g %g", i, ditval[i], cpl_image_get_mean(image)); } /* Ready for fitting */ flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); /* Fit with zero-order term */ fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 0, ntest-1, CPL_TRUE, CPL_TYPE_FLOAT, ffiterror); if (cpl_error_get_code() != CPL_ERROR_NONE) { cpl_test_error(CPL_ERROR_SINGULAR_MATRIX ); cpl_test_null( fit ); cpl_msg_warning(cpl_func, "Could not fit %d coefficients to as many " "points", ntest); break; } secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_eq( cpl_imagelist_get_size(fit), ntest ); if (ntest == 2) { error = cpl_image_subtract_scalar(cpl_imagelist_get(fit, 1), gain); cpl_test_eq_error(error, CPL_ERROR_NONE); } else if (ntest > 2) { error = cpl_image_subtract_scalar(cpl_imagelist_get(fit, 2), gain); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_fit_imagelist_is_zero(fit, ntest * mytol); cpl_fit_image_is_zero(ffiterror, ntest * mytol); cpl_imagelist_delete(fit); } cpl_imagelist_delete(input); cpl_vector_delete(vdit); /* Multiple samples at three different (equidistant) points */ input = cpl_imagelist_new(); vdit = cpl_vector_new(9); error = cpl_vector_set(vdit, 0, 5.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_set(vdit, 1, 5.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_set(vdit, 2, 5.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_set(vdit, 3, 3.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_set(vdit, 4, 3.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_set(vdit, 5, 3.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_set(vdit, 6, 7.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_set(vdit, 7, 7.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_set(vdit, 8, 7.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, cpl_image_fill_test_create(IMAGESZFIT, IMAGESZFIT), 0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, cpl_image_fill_test_create(IMAGESZFIT, IMAGESZFIT), 1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, cpl_image_fill_test_create(IMAGESZFIT, IMAGESZFIT), 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, cpl_image_fill_test_create(IMAGESZFIT, IMAGESZFIT), 3); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, cpl_image_fill_test_create(IMAGESZFIT, IMAGESZFIT), 4); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, cpl_image_fill_test_create(IMAGESZFIT, IMAGESZFIT), 5); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, cpl_image_fill_test_create(IMAGESZFIT, IMAGESZFIT), 6); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, cpl_image_fill_test_create(IMAGESZFIT, IMAGESZFIT), 7); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(input, cpl_image_fill_test_create(IMAGESZFIT, IMAGESZFIT), 8); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Fit a non-over-determined set without constant and linear terms */ flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 2, 4, CPL_FALSE, CPL_TYPE_DOUBLE, dfiterror); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), 3 ); cpl_fit_image_is_zero(dfiterror, DBL_MAX); cpl_imagelist_delete(fit); /* Fit a non-over-determined set with a constant term */ flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 0, 2, CPL_FALSE, CPL_TYPE_DOUBLE, dfiterror); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), 3 ); cpl_fit_image_is_zero(dfiterror, DBL_MAX); demax = cpl_image_get_sqflux(dfiterror); cpl_imagelist_delete(fit); /* Repeat the previous test - this time exploiting that the sampling points are equidistant */ flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 0, 2, CPL_TRUE, CPL_TYPE_DOUBLE, dfiterror); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), 3 ); cpl_fit_image_is_zero(dfiterror, DBL_MAX); cpl_test_leq( cpl_image_get_sqflux(dfiterror), demax ); cpl_imagelist_delete(fit); /* Repeat the previous test - after sorting the sampling points */ error = cpl_vector_sort(vdit, CPL_SORT_ASCENDING); cpl_test_eq_error(error, CPL_ERROR_NONE); flops = cpl_tools_get_flops(); cputime = cpl_test_get_cputime(); fit = cpl_fit_imagelist_polynomial_window_test(vdit, input, 1, 1, IMAGESZFIT, IMAGESZFIT, 0, 2, CPL_TRUE, CPL_TYPE_DOUBLE, dfiterror); secs += cpl_test_get_cputime() - cputime; flopsum += cpl_tools_get_flops() - flops; bytes += cpl_test_get_bytes_imagelist(input); cpl_test_error(CPL_ERROR_NONE ); cpl_test_eq( cpl_imagelist_get_size(fit), 3 ); cpl_fit_image_is_zero(dfiterror, DBL_MAX); cpl_imagelist_delete(fit); /* Fit an under-determined set without a constant term */ fit = cpl_fit_imagelist_polynomial(vdit, input, 1, 4, CPL_FALSE, CPL_TYPE_DOUBLE, dfiterror); cpl_test_error(CPL_ERROR_SINGULAR_MATRIX ); cpl_test_null( fit ); cpl_imagelist_delete(input); cpl_vector_delete(vdit); cpl_msg_info("","Speed while fitting with image size %d in %g secs " "[Mflop/s]: %g", IMAGESZFIT, secs, (double)flopsum/secs/1e6); if (secs > 0.0) { cpl_msg_info(cpl_func,"Processing rate [MB/s]: %g", 1e-6 * (double)bytes / secs); } cpl_image_delete(cfiterror); cpl_image_delete(dfiterror); cpl_image_delete(ffiterror); cpl_image_delete(ifiterror); cpl_polynomial_delete(vfiller); } /*----------------------------------------------------------------------------*/ /** @internal @brief Verify that all elements in an imagelist are zero (within a tolerance) @param self The list of images to check @param tol The non-negative tolerance param line The line number of the caller @return void */ /*----------------------------------------------------------------------------*/ static void cpl_fit_imagelist_is_zero_macro(const cpl_imagelist * self, double tol, int line) { const cpl_size n = cpl_imagelist_get_size(self); cpl_size i; for (i = 0; i < n; i++) { /* FIXME: Need traceback of failure */ cpl_fit_image_is_zero_macro(cpl_imagelist_get_const(self, i), tol, line); } } /*----------------------------------------------------------------------------*/ /** @internal @brief Verify that all elements in an image are zero (within a tolerance) @param self The image to check @param tol The non-negative tolerance param line The line number of the caller @return void */ /*----------------------------------------------------------------------------*/ static void cpl_fit_image_is_zero_macro(const cpl_image * self, double tol, int line) { cpl_stats * stats = cpl_stats_new_from_image(self, CPL_STATS_MIN | CPL_STATS_MAX | CPL_STATS_MEAN); const double mymin = cpl_stats_get_min(stats); const double mymax = cpl_stats_get_max(stats); /* FIXME: Need traceback of failure */ cpl_test(line > 0); cpl_test_leq( fabs(mymin), tol ); cpl_test_leq( fabs(mymax), tol ); cpl_stats_delete(stats); } static void cpl_fit_image_gaussian_tests(cpl_type pixeltype) { cpl_image *box = NULL; cpl_image *image = NULL; cpl_image *eimage = NULL; cpl_matrix *covariance = NULL; cpl_matrix *phys_cov = NULL; cpl_array *parameters = NULL; cpl_array *err_params = NULL; cpl_array *fit_params = NULL; double major, minor, angle, rms, chisq, value; const int nx = 30; const int ny = 30; const int lnx = 2438; const int lny = 2438; int i, j; cpl_error_code error; double x[2]; const char *p[7] = { /* Parameter names */ "Background ", "Normalisation ", "Correlation ", "Center position x", "Center position y", "Sigma x ", "Sigma y "}; double u[7] = { /* Parameter values of simulated gaussian */ 2.130659, 104274.700696, 0.779320, 796.851741, 1976.324361, 4.506552, 3.248286 }; const double e[7] = { /* Errors on parameters of simulated gaussian */ 2.029266, 955.703656, 0.004452, 0.035972, 0.025949, 0.037186, 0.026913 }; const char *fp[3] = { /* Physical parameter names */ "Angle ", "Major semi-axis ", "Minor semi-axis "}; const double fu[3] = { /* Physical parameter values of simulated gaussian */ 33.422720, 5.276152, 1.738563}; const double fe[3] = { /* Errors on physical parameters of gaussian */ 0.238359, 0.283202, 0.052671}; /* * Fill image with model gaussian. */ box = cpl_image_new(nx, ny, pixeltype); u[3] -= 782; u[4] -= 1961; for (j = 1; j <= ny; j++) { x[1] = j; for (i = 1; i <= nx; i++) { x[0] = i; eval_gauss(x, u, &value); cpl_image_set(box, i, j, value); } } u[3] += 782; u[4] += 1961; /* * Insert it into a bigger image. */ image = cpl_image_new(lnx, lny, pixeltype); cpl_image_copy(image, box, 783, 1962); cpl_image_delete(box); box = NULL; /* * Add some noise, and create corresponding error image * (not really physical, but this is just for testing). */ eimage = cpl_image_new(lnx, lny, pixeltype); cpl_image_fill_noise_uniform(eimage, -50, 50); cpl_image_add(image, eimage); cpl_image_delete(eimage); eimage = cpl_image_new(lnx, lny, pixeltype); cpl_image_fill_noise_uniform(eimage, 50, 60); /* * Allocate the parameters array, with the error array, and leave * them empty (for the moment). */ parameters = cpl_array_new(7, CPL_TYPE_DOUBLE); err_params = cpl_array_new(7, CPL_TYPE_DOUBLE); /* * Now see if we can find a gaussian without any first guess: */ phys_cov = NULL; covariance = NULL; error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_NONE); if (!error || cpl_msg_get_level() <= CPL_MSG_INFO) cpl_test(check_gauss_success(p, u, e, fp, fu, fe, parameters, err_params, angle, major, minor, phys_cov)); cpl_matrix_delete(covariance); cpl_matrix_delete(phys_cov); /* * Now retry with a first-guess, all parameters free. */ fit_params = cpl_array_new(7, CPL_TYPE_INT); for (i = 0; i < 7; i++) cpl_array_set(fit_params, i, 1); for (i = 0; i < 7; i++) cpl_array_set(parameters, i, u[i]); for (i = 0; i < 7; i++) cpl_array_set(err_params, i, e[i]); phys_cov = NULL; covariance = NULL; error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_NONE); if (!error || cpl_msg_get_level() <= CPL_MSG_INFO) cpl_test(check_gauss_success(p, u, e, fp, fu, fe, parameters, err_params, angle, major, minor, phys_cov)); cpl_matrix_delete(covariance); cpl_matrix_delete(phys_cov); /* * Now retry with a first-guess, two parameters are frozen. */ for (i = 0; i < 7; i++) cpl_array_set(parameters, i, u[i]); for (i = 0; i < 7; i++) cpl_array_set(err_params, i, e[i]); cpl_array_set(fit_params, 0, 0); cpl_array_set(fit_params, 4, 0); phys_cov = NULL; covariance = NULL; error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_NONE); if (!error || cpl_msg_get_level() <= CPL_MSG_INFO) cpl_test(check_gauss_success(p, u, e, fp, fu, fe, parameters, err_params, angle, major, minor, phys_cov)); cpl_matrix_delete(covariance); cpl_matrix_delete(phys_cov); /* * Now try without eny error propagation */ phys_cov = NULL; covariance = NULL; error = cpl_fit_image_gaussian(image, NULL, 797, 1976, 30, 30, parameters, NULL, fit_params, &rms, NULL, NULL, &major, &minor, &angle, NULL); cpl_test_eq_error(error, CPL_ERROR_NONE); if (!error || cpl_msg_get_level() <= CPL_MSG_INFO) cpl_test(check_gauss_success(p, u, e, fp, fu, fe, parameters, err_params, angle, major, minor, phys_cov)); /* * Try different error situations: */ error = cpl_fit_image_gaussian(NULL, eimage, 797, 1976, 30, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 30, NULL, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_fit_image_gaussian(image, eimage, -1, 1976, 30, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); error = cpl_fit_image_gaussian(image, eimage, 797, 197600, 30, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 300000, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 2, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 300000, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 2, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); box = cpl_image_new(46, 72, pixeltype); error = cpl_fit_image_gaussian(image, box, 797, 1976, 30, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_image_delete(box); cpl_test_eq_error(error, CPL_ERROR_INCOMPATIBLE_INPUT); error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 30, parameters, fit_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_INVALID_TYPE); error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 30, fit_params, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_INVALID_TYPE); error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 30, parameters, err_params, err_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_INVALID_TYPE); error = cpl_fit_image_gaussian(image, NULL, 797, 1976, 30, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_DATA_NOT_FOUND); for (i = 0; i < 7; i++) cpl_array_set(fit_params, i, 0); /* All frozen */ error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); cpl_image_delete(image); image = cpl_image_new(lnx, lny, CPL_TYPE_FLOAT_COMPLEX); cpl_image_delete(eimage); eimage = cpl_image_duplicate(image); error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_INVALID_TYPE); cpl_image_delete(image); image = cpl_image_new(lnx, lny, CPL_TYPE_DOUBLE_COMPLEX); cpl_image_delete(eimage); eimage = cpl_image_duplicate(image); error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_INVALID_TYPE); cpl_image_delete(image); image = cpl_image_new(lnx, lny, pixeltype == CPL_TYPE_DOUBLE ? CPL_TYPE_FLOAT : CPL_TYPE_DOUBLE); error = cpl_fit_image_gaussian(image, eimage, 797, 1976, 30, 30, parameters, err_params, fit_params, &rms, &chisq, &covariance, &major, &minor, &angle, &phys_cov); cpl_test_eq_error(error, CPL_ERROR_TYPE_MISMATCH); cpl_image_delete(image); cpl_image_delete(eimage); cpl_array_delete(parameters); cpl_array_delete(err_params); cpl_array_delete(fit_params); } static void eval_gauss(const double x[], const double a[], double *result) { if (a[5] == 0.0) { if (x[0] == a[3]) { *result = DBL_MAX; } else { *result = 0.0; } } else if (a[6] == 0.0) { if (x[1] == a[4]) { *result = DBL_MAX; } else { *result = 0.0; } } else { double b1 = -0.5 / (1 - a[2] * a[2]); double b2 = (x[0] - a[3]) / a[5]; double b3 = (x[1] - a[4]) / a[6]; *result = a[0] + a[1] / (CPL_MATH_2PI * a[5] * a[6] * sqrt(1 - a[2] * a[2])) * exp(b1 * (b2 * b2 - 2 * a[2] * b2 * b3 + b3 * b3)); } return; } static int check_gauss_success(const char **p, const double *u, const double *e, const char **fp, const double *fu, const double *fe, cpl_array *parameters, cpl_array *err_params, double angle, double major, double minor, cpl_matrix *phys_cov) { cpl_matrix *matrix = NULL; int success = 0; int i; if (phys_cov == NULL) { matrix = cpl_matrix_new(3, 3); cpl_matrix_fill(matrix, 0.0); phys_cov = matrix; } else { /* The covariance matrix must be 3 X 3, symmetric, positive definite */ cpl_error_code error; cpl_test_eq(cpl_matrix_get_nrow(phys_cov), 3); cpl_test_eq(cpl_matrix_get_ncol(phys_cov), 3); matrix = cpl_matrix_transpose_create(phys_cov); cpl_test_matrix_abs(phys_cov, matrix, DBL_EPSILON); error = cpl_matrix_decomp_chol(matrix); cpl_test_eq_error(error, CPL_ERROR_NONE); } for (i = 0; i < 7; i++) { /* * The info message is only printed if * cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_INFO); * or if running with * export CPL_MSG_LEVEL=info */ cpl_msg_info(cpl_func, "%s = %f +- %f", p[i], cpl_array_get_double(parameters, i, NULL), cpl_array_get_double(err_params, i, NULL)); /* * The result must not differ from expectations more than 3 sigmas. * The reason of this loose test is that cpl_image_fill_noise_uniform() * gives different results depending on how many times it is called, * and other tests may be added in future. * It may therefore happen that a test "fails" because of an offset * passing the 3-sigma limit (1% probability). A solution to this * problem would be to store simulated images in the CPL repository. */ success = fabs(cpl_array_get_double(parameters, i, NULL) - u[i]) < 3.0 * e[i]; if (!success) { cpl_msg_error(cpl_func, "Expected value for %s = %f +- %f", p[i], u[i], e[i]); cpl_msg_error(cpl_func, "Obtained value for %s = %f +- %f", p[i], cpl_array_get_double(parameters, i, NULL), cpl_array_get_double(err_params, i, NULL)); cpl_matrix_delete(matrix); return success; } } cpl_msg_info(cpl_func, "%s = %f +- %f (degrees)", fp[0], angle * CPL_MATH_DEG_RAD, sqrt(cpl_matrix_get(phys_cov, 0, 0)) * CPL_MATH_DEG_RAD); success = fabs(angle * CPL_MATH_DEG_RAD - fu[0]) < 3.0 * fe[0] * CPL_MATH_DEG_RAD; if (!success) { cpl_msg_error(cpl_func, "Expected value for %s = %f +- %f", fp[0], fu[0], fe[0]); cpl_msg_error(cpl_func, "Obtained value for %s = %f +- %f", fp[0], angle * CPL_MATH_DEG_RAD, sqrt(cpl_matrix_get(phys_cov, 0, 0)) * CPL_MATH_DEG_RAD); cpl_matrix_delete(matrix); return success; } cpl_msg_info(cpl_func, "%s = %f +- %f", fp[1], major, sqrt(cpl_matrix_get(phys_cov, 1, 1))); success = fabs(major - fu[1]) < 3.0 * fe[1]; if (!success) { cpl_msg_error(cpl_func, "Expected value for %s = %f +- %f", fp[1], fu[1], fe[1]); cpl_msg_error(cpl_func, "Obtained value for %s = %f +- %f", fp[1], major, sqrt(cpl_matrix_get(phys_cov, 1, 1))); cpl_matrix_delete(matrix); return success; } cpl_msg_info(cpl_func, "%s = %f +- %f\n", fp[2], minor, sqrt(cpl_matrix_get(phys_cov, 2, 2))); success = fabs(minor - fu[2]) < 3.0 * fe[2]; if (!success) { cpl_msg_error(cpl_func, "Expected value for %s = %f +- %f", fp[2], fu[2], fe[2]); cpl_msg_error(cpl_func, "Obtained value for %s = %f +- %f", fp[2], major, sqrt(cpl_matrix_get(phys_cov, 2, 2))); } cpl_matrix_delete(matrix); return success; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test cpl_fit_image_gaussian() with no returned covariance matrix @return void @see DFS10000 */ /*----------------------------------------------------------------------------*/ static void cpl_fit_image_gaussian_test_one(void) { double rms = 0.0; double redchi = 0.0; cpl_image * image; cpl_image * imerr; cpl_array * params; cpl_array * paramserr; cpl_error_code error; params = cpl_array_new(7, CPL_TYPE_DOUBLE); paramserr = cpl_array_new(7, CPL_TYPE_DOUBLE); image = cpl_image_new(IMAGESZFIT, IMAGESZFIT, CPL_TYPE_DOUBLE); error = cpl_image_fill_gaussian(image, IMAGESZFIT/2, IMAGESZFIT/2, 20.0, 20.0, 20.0); cpl_test_eq_error(error, CPL_ERROR_NONE); imerr = cpl_image_new(IMAGESZFIT, IMAGESZFIT, CPL_TYPE_DOUBLE); error = cpl_image_fill_noise_uniform(imerr,1.0,1.00001); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_fit_image_gaussian(image, imerr, IMAGESZFIT/2, IMAGESZFIT/2, IMAGESZFIT/5, IMAGESZFIT/5, params, paramserr, NULL, &rms, NULL, NULL, NULL, NULL, NULL, NULL); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_fit_image_gaussian(image, imerr, IMAGESZFIT/2, IMAGESZFIT/2, IMAGESZFIT/5, IMAGESZFIT/5, params, paramserr, NULL, &rms, &redchi, NULL, NULL, NULL, NULL, NULL); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_image_delete(image); cpl_image_delete(imerr); cpl_array_delete(params); cpl_array_delete(paramserr); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the function @see cpl_fit_imagelist_polynomial_window */ /*----------------------------------------------------------------------------*/ static cpl_imagelist * cpl_fit_imagelist_polynomial_window_test(const cpl_vector * x_pos, const cpl_imagelist * values, int llx, int lly, int urx, int ury, int mindeg, int maxdeg, cpl_boolean is_symsamp, cpl_type pixeltype, cpl_image * fiterror) { cpl_imagelist * self = cpl_fit_imagelist_polynomial_window(x_pos, values, llx, lly, urx, ury, mindeg, maxdeg, is_symsamp, pixeltype, fiterror); if (self != NULL) { const cpl_size np = cpl_vector_get_size(x_pos); cpl_imagelist * icopy = cpl_imagelist_duplicate(values); cpl_vector * vcopy = cpl_vector_new(np + 1); cpl_image * bad = cpl_image_duplicate(cpl_imagelist_get_const(icopy, 0)); const cpl_size mx = cpl_image_get_size_x(bad); const cpl_size my = cpl_image_get_size_y(bad); cpl_mask * mask = cpl_mask_new(mx, my); cpl_imagelist * fitbad; cpl_image * baderror = fiterror ? cpl_image_duplicate(fiterror) : NULL; const double tol = pixeltype == CPL_TYPE_INT ? 0.0 : (pixeltype == CPL_TYPE_FLOAT #if defined SIZEOF_SIZE_T && SIZEOF_SIZE_T == 4 /* FIXME: Extreme loss of precision on (some) 32-bit machines */ ? 0.004 : 30.0 * FLT_EPSILON #else ? FLT_EPSILON : 800.0 * DBL_EPSILON #endif ); cpl_error_code error; cpl_msg_info(cpl_func, "Testing with %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " bad pixels", mx, my); cpl_test_eq_ptr(memcpy(cpl_vector_get_data(vcopy), cpl_vector_get_data_const(x_pos), (size_t)np * sizeof(double)), cpl_vector_get_data_const(vcopy)); /* The value of this sampling point is not used */ error = cpl_vector_set(vcopy, np, DBL_MAX); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(icopy, bad, np); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_mask_not(mask); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_reject_from_mask(bad, mask); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_image_count_rejected(bad), mx * my); cpl_test_eq(cpl_imagelist_get_size(icopy), np + 1); cpl_test_eq(cpl_vector_get_size(vcopy), np + 1); fitbad = cpl_fit_imagelist_polynomial_window(vcopy, icopy, llx, lly, urx, ury, mindeg, maxdeg, is_symsamp, pixeltype, baderror); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(fitbad); cpl_test_imagelist_abs(self, fitbad, tol); if (fiterror != NULL) { cpl_test_image_abs(fiterror, baderror, tol); } cpl_imagelist_delete(icopy); cpl_imagelist_delete(fitbad); cpl_image_delete(baderror); cpl_vector_delete(vcopy); cpl_mask_delete(mask); } return self; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the function @see cpl_fit_imagelist_polynomial */ /*----------------------------------------------------------------------------*/ static void cpl_fit_imagelist_polynomial_bpm(void) { const double ditval[] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}; const int ndits = (int)(sizeof(ditval)/sizeof(double)); cpl_vector * vdit = cpl_vector_wrap(ndits, (double*)ditval); const int mx = 2; /* Two pixels: one all good, one mixed */ const int my = 1; cpl_image * dfiterror = cpl_image_new(mx, my, CPL_TYPE_DOUBLE); cpl_imagelist * imlist = cpl_imagelist_new(); cpl_imagelist * fit; int is_bad = 0; int i; /* Test 1: A perfectly linear fit */ for (i = 0; i < ndits; i++) { const double value = ditval[i]; cpl_image * bad = cpl_image_new(mx, my, CPL_TYPE_DOUBLE); cpl_image_set(bad, 1, 1, value); cpl_image_set(bad, 2, 1, value); cpl_imagelist_set(imlist, bad, i); if (i & 1) { const cpl_error_code error = cpl_image_reject(bad, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); } } fit = cpl_fit_imagelist_polynomial(vdit, imlist, 0, 1, CPL_FALSE, CPL_TYPE_DOUBLE, dfiterror); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_imagelist_get_size(fit), 2); cpl_test_abs(cpl_image_get(cpl_imagelist_get(fit, 0), 1, 1, &is_bad), 0.0, 4.0 * DBL_EPSILON); cpl_test_zero(is_bad); cpl_test_rel(cpl_image_get(cpl_imagelist_get(fit, 1), 1, 1, &is_bad), 1.0, 2.0 * DBL_EPSILON); cpl_test_zero(is_bad); cpl_test_abs(cpl_image_get(dfiterror, 1, 1, &is_bad), 0.0, DBL_EPSILON); cpl_test_zero(is_bad); /* Test 2: A perfectly quadratic fit */ for (i = 0; i < ndits; i++) { const double value = ditval[i] * ditval[i]; cpl_image * bad = cpl_imagelist_get(imlist, i); cpl_image_set(bad, 1, 1, value); cpl_image_set(bad, 2, 1, value); if (i & 1) { const cpl_error_code error = cpl_image_reject(bad, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); } } cpl_imagelist_delete(fit); fit = cpl_fit_imagelist_polynomial(vdit, imlist, 0, 2, CPL_FALSE, CPL_TYPE_DOUBLE, dfiterror); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_imagelist_get_size(fit), 3); cpl_test_abs(cpl_image_get(cpl_imagelist_get(fit, 0), 1, 1, &is_bad), 0.0, 12.0 * DBL_EPSILON); cpl_test_zero(is_bad); cpl_test_abs(cpl_image_get(cpl_imagelist_get(fit, 1), 1, 1, &is_bad), 0.0, 24.0 * DBL_EPSILON); cpl_test_zero(is_bad); cpl_test_rel(cpl_image_get(cpl_imagelist_get(fit, 2), 1, 1, &is_bad), 1.0, 2.0 * DBL_EPSILON); cpl_test_zero(is_bad); cpl_test_abs(cpl_image_get(dfiterror, 1, 1, &is_bad), 0.0, DBL_EPSILON); cpl_test_zero(is_bad); /* Test 3: A perfectly quadratic fit, without the constant+linear terms */ for (i = 0; i < ndits; i++) { const double value = ditval[i] * ditval[i]; cpl_image * bad = cpl_imagelist_get(imlist, i); cpl_image_set(bad, 1, 1, value); cpl_image_set(bad, 2, 1, value); if (i & 1) { const cpl_error_code error = cpl_image_reject(bad, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); } } cpl_imagelist_delete(fit); fit = cpl_fit_imagelist_polynomial(vdit, imlist, 2, 2, CPL_FALSE, CPL_TYPE_DOUBLE, dfiterror); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_imagelist_get_size(fit), 1); cpl_test_rel(cpl_image_get(cpl_imagelist_get(fit, 0), 1, 1, &is_bad), 1.0, 2.0 * DBL_EPSILON); cpl_test_zero(is_bad); cpl_test_abs(cpl_image_get(dfiterror, 1, 1, &is_bad), 0.0, DBL_EPSILON); cpl_test_zero(is_bad); cpl_test_eq_ptr(cpl_vector_unwrap(vdit), ditval); cpl_imagelist_delete(imlist); cpl_imagelist_delete(fit); cpl_image_delete(dfiterror); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test cpl_fit_image_gaussian() using local data @return void @see DFS11865 */ /*----------------------------------------------------------------------------*/ static void cpl_fit_image_gaussian_test_local(void) { cpl_array * params = cpl_array_new(7, CPL_TYPE_DOUBLE); const int values[][IMSZ * IMSZ] = {{111, 477, 1596, 1263, 194, 64, 255, 970, 3210, 2640, 469, 141, 1565, 8840, 30095, 17625, 2381, 656, 4982, 33104, 65535, 63588, 7276, 2377, 1822, 12167, 37548, 20715, 2597, 856, 353, 1440, 4042, 3121, 535, 135}, {408, 880, 1043, 719, 249, 93, 1512, 2730, 2253, 1159, 470, 212, 11366, 22069, 18434, 7102, 1898, 789, 15630, 52992, 65535, 43330, 11619, 2834, 3422, 13283, 31354, 32311, 13946, 3225, 616, 1717, 3143, 3298, 2029, 662}, {161, 587, 1618, 1487, 409, 103, 475, 1681, 4511, 4295, 1302, 308, 2009, 10686, 40660, 42502, 10990, 1559, 4526, 26557, 65535, 65535, 16232, 2942, 1136, 6054, 17506, 13985, 3569, 697, 249, 1057, 2944, 2536, 633, 115}, {684, 1620, 2240, 2021, 1041, 346, 3549, 8272, 11679, 9524, 4789, 1661, 18252, 45616, 65535, 57247, 28755, 9689, 7025, 17892, 26878, 23738, 12277, 4084, 905, 2057, 3227, 2941, 1546, 586, 275, 651, 998, 978, 581, 218}, {419, 964, 1470, 1165, 428, 118, 2547, 7622, 7975, 3391, 979, 335, 5931, 29549, 51281, 22243, 3797, 1143, 4522, 21513, 65535, 62954, 13954, 2253, 1293, 4305, 15660, 26446, 12002, 1870, 243, 849, 2525, 3565, 2228, 491}, {207, 747, 2302, 3383, 2176, 762, 867, 2512, 10026, 22327, 16365, 3663, 2689, 11998, 55855, 65535, 27336, 4542, 3587, 20606, 52265, 33975, 7420, 1594, 1275, 5343, 7709, 4121, 1060, 319, 210, 744, 1303, 1024, 391, 87} }; const double major[] = {5.80423, 1.25846, 0.9219, 1.35805, 1.08065, 1.09118}; const double minor[] = {2.82963, 0.661684, 0.714119, 0.601602, 0.661207, 0.679018}; const double angle[] = {0.865826, 0.318316, -0.13699, 0.0127396, 0.613033, -0.556366}; const size_t n = sizeof(values)/sizeof(values[0]); size_t i; const double tol = 1e-5; for (i = 0; i < n; i++) { const cpl_size nx = IMSZ; const cpl_size ny = IMSZ; cpl_image * image = cpl_image_wrap_int(nx, ny, (int*)values[i]); double mymajor, myminor, myangle, rms; cpl_error_code error; cpl_test_nonnull(image); error = cpl_array_fill_window_invalid(params, 1, 7); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_fit_image_gaussian(image, NULL, nx/2, ny/2, nx, ny, params, NULL, NULL, &rms, NULL, NULL, &mymajor, &myminor, &myangle, NULL); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_msg_info(cpl_func, CPL_STRINGIFY(IMSZ) " X " CPL_STRINGIFY(IMSZ) " int-image %d/%d: Major: %g <=> %g. Minor: %g <=> %g. " "Angle: %g <=> %g. RMS=%g", (int)i + 1, (int)n, mymajor, major[i], myminor, minor[i], myangle, angle[i], rms); cpl_test_abs(mymajor, major[i], tol); cpl_test_abs(myminor, minor[i], tol); cpl_test_abs(myangle, angle[i], tol); cpl_test_eq_ptr(cpl_image_unwrap(image), values[i]); } cpl_array_delete(params); } cpl-6.4.1/cpldrs/tests/cpl_detector-test.c0000644000460300003120000002145211545320622015437 00000000000000/* $Id: cpl_detector-test.c,v 1.29 2011-04-01 09:57:38 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-04-01 09:57:38 $ * $Revision: 1.29 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include "cpl_detector.h" /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ #define IMAGESZX 10 #define IMAGESZY 20 #define IMAGESZ2 100 /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { const cpl_type pixel_type[] = {CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT, CPL_TYPE_DOUBLE_COMPLEX, CPL_TYPE_FLOAT_COMPLEX}; const int nbad = 10; /* The bad pixel positions */ const int bad_pos_x[] = {4, 5, 6, 4, 5, 6, 4, 5, 6, 8}; const int bad_pos_y[] = {5, 5, 5, 6, 6, 6, 7, 7, 7, 9}; /* Two concentric circles in the image center */ const double zone1[] = {0.5*IMAGESZ2, 0.5*IMAGESZ2, IMAGESZ2/10.0, IMAGESZ2/5.0}; const double zone2[] = {0.5*IMAGESZ2, 0.5*IMAGESZ2, IMAGESZ2/10.0, IMAGESZ2/10.0}; double noise, errnoise; unsigned itype; int i; cpl_error_code error; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ /* Test 0: Test with nbad pixels */ cpl_test_eq(nbad, sizeof(bad_pos_x)/sizeof(bad_pos_x[0])); cpl_test_eq(nbad, sizeof(bad_pos_y)/sizeof(bad_pos_y[0])); for (itype = 0; itype < sizeof(pixel_type)/sizeof(pixel_type[0]); itype++) { const cpl_type mytype = pixel_type[itype]; const cpl_boolean is_complex = pixel_type[itype] == CPL_TYPE_DOUBLE_COMPLEX || pixel_type[itype] == CPL_TYPE_FLOAT_COMPLEX; cpl_image * im; cpl_image * copy; double stdev; /* Create the test image */ im = cpl_image_new(IMAGESZX, IMAGESZY, mytype); error = cpl_image_fill_noise_uniform(im, 10, 20); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Test 1: cpl_detector_interpolate_rejected() may not modify a bad-pixel free image */ copy = cpl_image_duplicate(im); cpl_test_nonnull(cpl_image_get_bpm(copy)); /* Create empty bpm */ error = cpl_detector_interpolate_rejected(copy); cpl_test_eq_error(error, CPL_ERROR_NONE); if (!is_complex) cpl_test_image_abs(im, copy, 0.0); cpl_image_delete(copy); /* Set the bad pixels values */ for (i = 0; i < nbad; i++) { if (!is_complex) cpl_image_set(im, bad_pos_x[i], bad_pos_y[i], FLT_MAX); cpl_image_reject(im, bad_pos_x[i], bad_pos_y[i]); } cpl_test_eq(cpl_image_count_rejected(im), nbad); /* Test 2: cpl_detector_interpolate_rejected() on some bad pixels */ copy = cpl_image_duplicate(im); if (!is_complex) stdev = cpl_image_get_stdev(im); error = cpl_detector_interpolate_rejected(im); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_null(cpl_image_get_bpm_const(im)); if (!is_complex) cpl_test_leq(cpl_image_get_stdev(im), stdev); if (pixel_type[itype] == CPL_TYPE_DOUBLE) { /* In absence of an actual unit test for the cleaning, a regression test may be used to ensure that no unintended changes occur */ cpl_image * load = cpl_image_load("regression.fits", CPL_TYPE_DOUBLE, 0, 0); if (load == NULL) { cpl_test_error(CPL_ERROR_FILE_IO); #ifdef CPL_DETECTOR_PREPARE_REGRESSION /* Enable this call before making changes to cpl_detector_interpolate_rejected() to enable a regression test of your changes. */ cpl_image_save(im, "regression.fits", CPL_TYPE_DOUBLE, NULL, CPL_IO_CREATE); #endif } else { cpl_test_error(CPL_ERROR_NONE); cpl_test_image_abs(load, im, 20.0 * DBL_EPSILON); cpl_image_delete(load); } } if (!is_complex) { /* Test 2a: Verify that the cleaning is isotropic */ for (i = 1; i < 4; i++) { cpl_image * turn = cpl_image_duplicate(copy); cpl_test_nonnull(turn); error = cpl_image_turn(turn, i); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_detector_interpolate_rejected(turn); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_null(cpl_image_get_bpm_const(turn)); error = cpl_image_turn(turn, -i); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Non-zero tolerance, since order of additions changed */ if (!is_complex) cpl_test_image_abs(turn, im, 40.0 * DBL_EPSILON); cpl_image_delete(turn); } } cpl_image_delete(copy); /* Reject all pixels */ error = cpl_mask_not(cpl_image_get_bpm(im)); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_image_count_rejected(im), IMAGESZX * IMAGESZY); error = cpl_detector_interpolate_rejected(im); cpl_test_eq_error(error, CPL_ERROR_DATA_NOT_FOUND); /* Reject all but one pixel */ error = cpl_image_accept(im, IMAGESZX, IMAGESZY); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_image_count_rejected(im), IMAGESZX * IMAGESZY - 1); error = cpl_detector_interpolate_rejected(im); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_null(cpl_image_get_bpm_const(im)); cpl_image_delete(im); /* Create an other test image */ im = cpl_image_new(IMAGESZ2, IMAGESZ2, CPL_TYPE_DOUBLE); cpl_image_fill_noise_uniform(im, 10, 20); /* Test 3: the RON & BIAS computation */ error = cpl_flux_get_noise_window(im, NULL, -1, -1, &noise, &errnoise); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_flux_get_bias_window(im, NULL, -1, -1, &noise, &errnoise); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Test 4: the RON computation - on a ring */ error = cpl_flux_get_noise_ring(im, zone1, -1, -1, &noise, &errnoise); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Test 5: An empty ring */ error = cpl_flux_get_noise_ring(im, zone2, -1, -1, &noise, &errnoise); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Test 6A: NULL input */ error = cpl_flux_get_noise_ring(im, NULL, -1, -1, &noise, &errnoise); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_flux_get_noise_ring(im, zone1, -1, -1, NULL, NULL); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); cpl_image_delete(im); } /* Test 6B: NULL input */ error = cpl_detector_interpolate_rejected(NULL); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_flux_get_noise_window(NULL, NULL, -1, -1, &noise, &errnoise); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_flux_get_bias_window(NULL, NULL, -1, -1, &noise, &errnoise); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_flux_get_noise_ring(NULL, zone1, -1, -1, &noise, &errnoise); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); return cpl_test_end(0); } cpl-6.4.1/cpldrs/tests/cpl_wlcalib-test.c0000644000460300003120000004414111670417251015247 00000000000000/* $Id: cpl_wlcalib-test.c,v 1.38 2011-12-09 14:43:53 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-12-09 14:43:53 $ * $Revision: 1.38 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_wlcalib_impl.h" #include #include #include #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef CPL_WLCALIB_SPC_SIZE #define CPL_WLCALIB_SPC_SIZE 100 #endif #ifndef CPL_WLCALIB_WSLIT #define CPL_WLCALIB_WSLIT 3.0 #endif #ifndef CPL_WLCALIB_WFWHM #define CPL_WLCALIB_WFWHM 4.0 #endif #ifndef CPL_WLCALIB_LTHRESH #define CPL_WLCALIB_LTHRESH 5.0 #endif #ifndef CPL_WLCALIB_SHIFT #define CPL_WLCALIB_SHIFT 4 #endif #ifndef CPL_WLCALIB_NOISE #define CPL_WLCALIB_NOISE 0.95 #endif /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_wlcalib_test_one(void); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); cpl_wlcalib_test_one(); return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the exported functions @return void */ /*----------------------------------------------------------------------------*/ static void cpl_wlcalib_test_one(void) { const double linepos[] = {0.2 * CPL_WLCALIB_SPC_SIZE, 0.24 * CPL_WLCALIB_SPC_SIZE, 0.5 * CPL_WLCALIB_SPC_SIZE, 0.75 * CPL_WLCALIB_SPC_SIZE, 0.82 * CPL_WLCALIB_SPC_SIZE}; const double lineval[] = {1.0, 1.0, 2.0, 3.0, 4.0}; /* The true dispersion relation */ const double coeffs[] = {1.0, 2.0 / CPL_WLCALIB_SPC_SIZE, 3.0 /(CPL_WLCALIB_SPC_SIZE*CPL_WLCALIB_SPC_SIZE)}; const cpl_size ncoeffs = (cpl_size)(sizeof(coeffs)/sizeof(coeffs[0])); const cpl_size nlines = (cpl_size)(sizeof(linepos)/sizeof(linepos[0])); cpl_polynomial * dtrue = cpl_polynomial_new(1); cpl_polynomial * dcand = cpl_polynomial_new(1); cpl_polynomial * dfind = cpl_polynomial_new(1); cpl_bivector * lines = cpl_bivector_new(nlines); cpl_vector * observed = cpl_vector_new(CPL_WLCALIB_SPC_SIZE); cpl_vector * obsfast = cpl_vector_new(CPL_WLCALIB_SPC_SIZE); cpl_vector * wl_search = cpl_vector_new(ncoeffs); cpl_vector * wl_sfine = cpl_vector_new(ncoeffs); cpl_vector * xcorrs; double xcmax = -1.0; double tn0, tn1, tf0, tf1; cpl_size cost, xcost; cpl_size ntests = 1; const cpl_size nsamples = 25; const cpl_size hsize = 2 + abs(CPL_WLCALIB_SHIFT); cpl_size nxc = 1 + 2 * hsize; cpl_wlcalib_slitmodel * model = cpl_wlcalib_slitmodel_new(); FILE * stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; cpl_error_code error; cpl_size i; cpl_test_eq(nlines, (cpl_size)(sizeof(lineval)/sizeof(lineval[0]))); cpl_test_nonnull(model); for (i = 0; i < ncoeffs; i++) { error = cpl_polynomial_set_coeff(dtrue, &i, coeffs[i]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_set_coeff(dcand, &i, coeffs[i] * CPL_WLCALIB_NOISE); cpl_test_eq_error(error, CPL_ERROR_NONE); ntests *= nsamples; } nxc *= ntests; cpl_test_eq(cpl_polynomial_get_degree(dtrue), ncoeffs - 1); error = cpl_wlcalib_slitmodel_set_wslit(model, 3.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_wlcalib_slitmodel_set_wfwhm(model, 4.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_wlcalib_slitmodel_set_threshold(model, 5.0); cpl_test_eq_error(error, CPL_ERROR_NONE); for (i = 0; i < nlines; i++) { const double wl = cpl_polynomial_eval_1d(dtrue, linepos[i], NULL); cpl_test_error(CPL_ERROR_NONE); error = cpl_vector_set(cpl_bivector_get_x(lines), i, wl); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_set(cpl_bivector_get_y(lines), i, lineval[i]); cpl_test_eq_error(error, CPL_ERROR_NONE); } error = cpl_wlcalib_slitmodel_set_catalog(model, lines); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Create an observed spectrum from the true dispersion relation and the line catalog */ error = cpl_wlcalib_fill_logline_spectrum_fast(obsfast, model, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_wlcalib_fill_logline_spectrum(observed, model, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); /* FIXME: Ridiculously high tolerance needed with valgrind */ cpl_test_vector_abs(observed, obsfast, 0.1); error = cpl_wlcalib_fill_line_spectrum_fast(obsfast, model, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_wlcalib_fill_line_spectrum(observed, model, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); /* FIXME: Ridiculously high tolerance needed with valgrind */ cpl_test_vector_abs(observed, obsfast, 0.2); if (cpl_msg_get_level() <= CPL_MSG_INFO) { const cpl_vector * dual[] = {NULL, observed, obsfast}; cpl_vector * fdiff = cpl_vector_duplicate(observed); error = cpl_plot_vectors("", "", "", (const cpl_vector**)dual, 3); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_subtract(fdiff, obsfast); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_plot_vector("", "", "", fdiff); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_vector_delete(fdiff); } error = cpl_vector_fill(wl_search, 0.20); cpl_test_eq_error(error, CPL_ERROR_NONE); cost = cpl_wlcalib_slitmodel_get_cost(model); xcost = cpl_wlcalib_slitmodel_get_xcost(model); /* No failed fills yet */ cpl_test_eq(cost, xcost); /* Test 1. Failure test: 1st guess is non-monotone */ xcmax = 0.0; i = ncoeffs - 1; error = cpl_polynomial_copy(dfind, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_set_coeff(dfind, &i, -coeffs[i]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_wlcalib_find_best_1d(dfind, dfind, observed, model, cpl_wlcalib_fill_line_spectrum, wl_search, nsamples, 0, &xcmax, NULL); cpl_test_eq_error(error, CPL_ERROR_DATA_NOT_FOUND); cpl_test_abs(xcmax, -1.0, 0.0); /* All fills failed */ cpl_test_eq(xcost, cpl_wlcalib_slitmodel_get_xcost(model)); cost = cpl_wlcalib_slitmodel_get_cost(model) - cost; cpl_test_leq(cost, ntests); /* Test 2. "Dummy" test: 1st guess is the correct solution */ cost = cpl_wlcalib_slitmodel_get_cost(model); xcost = cpl_wlcalib_slitmodel_get_xcost(model); error = cpl_wlcalib_find_best_1d(dfind, dtrue, observed, model, cpl_wlcalib_fill_line_spectrum, wl_search, 2*nsamples, 0, &xcmax, NULL); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_msg_info(cpl_func, "Perfect 1st guess, XC: %g", xcmax); cpl_test_leq(xcmax, 1.0); cpl_test_leq(1.0 - FLT_EPSILON, xcmax); cpl_test_polynomial_abs(dfind, dtrue, FLT_EPSILON); error = cpl_polynomial_subtract(dfind, dfind, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_dump(dfind, stream); cpl_test_eq_error(error, CPL_ERROR_NONE); cost = cpl_wlcalib_slitmodel_get_cost(model) - cost; xcost = cpl_wlcalib_slitmodel_get_xcost(model) - xcost; /* No failed fills during this test */ cpl_test_eq(cost, xcost); cpl_test_eq(cost, ntests * (cpl_size)cpl_tools_ipow(2.0, ncoeffs)); /* Test 3. 1st guess is an alteration of the correct solution */ xcorrs = cpl_vector_new(nxc); cost = cpl_wlcalib_slitmodel_get_cost(model); xcost = cpl_wlcalib_slitmodel_get_xcost(model); tn0 = cpl_test_get_cputime(); error = cpl_wlcalib_find_best_1d(dfind, dcand, observed, model, cpl_wlcalib_fill_line_spectrum, wl_search, nsamples, hsize, &xcmax, xcorrs); cpl_test_eq_error(error, CPL_ERROR_NONE); tn1 = cpl_test_get_cputime() - tn0; cpl_msg_info(cpl_func, "Altered 1st guess, XC: %g (%gsecs)", xcmax, tn1); cpl_test_abs(xcmax, cpl_vector_get_max(xcorrs), 0.0); cpl_test_leq(xcmax, 1.0); cpl_test_leq(0.98, xcmax); cpl_test_polynomial_abs(dfind, dtrue, 0.01); error = cpl_polynomial_subtract(dfind, dfind, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_dump(dfind, stream); cpl_test_eq_error(error, CPL_ERROR_NONE); cost = cpl_wlcalib_slitmodel_get_cost(model) - cost; xcost = cpl_wlcalib_slitmodel_get_xcost(model) - xcost; /* No failed fills during this test */ cpl_test_eq(xcost, cost); cpl_test_eq(cost, ntests); /* Test 4. Same, but try with fast spectrum generation */ cost = cpl_wlcalib_slitmodel_get_cost(model); xcost = cpl_wlcalib_slitmodel_get_xcost(model); tf0 = cpl_test_get_cputime(); error = cpl_wlcalib_find_best_1d(dfind, dcand, observed, model, cpl_wlcalib_fill_line_spectrum_fast, wl_search, nsamples, hsize, &xcmax, xcorrs); cpl_test_eq_error(error, CPL_ERROR_NONE); tf1 = cpl_test_get_cputime() - tf0; cpl_msg_info(cpl_func, "Fast spectrum generation, XC: %g (%gsecs)", xcmax, tf1); cpl_test_abs(xcmax, cpl_vector_get_max(xcorrs), 0.0); cpl_test_leq(xcmax, 1.0); cpl_test_leq(0.98, xcmax); cpl_test_polynomial_abs(dfind, dtrue, 0.01); error = cpl_polynomial_subtract(dfind, dfind, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_dump(dfind, stream); cpl_test_eq_error(error, CPL_ERROR_NONE); cost = cpl_wlcalib_slitmodel_get_cost(model) - cost; xcost = cpl_wlcalib_slitmodel_get_xcost(model) - xcost; /* No failed fills during this test */ cpl_test_eq(xcost, cost); cpl_test_eq(cost, ntests); /* Test 5. Try the find using a shift of the true polynomial */ /* For a shifted polynomial we can do with a much smaller search range */ error = cpl_vector_fill(wl_search, 0.1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_copy(dfind, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_shift_1d(dfind, 0, CPL_WLCALIB_SHIFT); cpl_test_eq_error(error, CPL_ERROR_NONE); cost = cpl_wlcalib_slitmodel_get_cost(model); xcost = cpl_wlcalib_slitmodel_get_xcost(model); tn0 = cpl_test_get_cputime(); error = cpl_wlcalib_find_best_1d(dfind, dfind, observed, model, cpl_wlcalib_fill_line_spectrum, wl_search, nsamples, hsize, &xcmax, xcorrs); cpl_test_eq_error(error, CPL_ERROR_NONE); tn1 = cpl_test_get_cputime() - tn0; cpl_msg_info(cpl_func, "Shifted " CPL_STRINGIFY(CPL_WLCALIB_SHIFT) " pixel(s), XC: %g (%gsecs)", xcmax, tn1); cpl_test_abs(xcmax, cpl_vector_get_max(xcorrs), 0.0); cpl_test_leq(xcmax, 1.0); cpl_test_leq(0.999, xcmax); cpl_test_polynomial_abs(dfind, dtrue, 0.01); error = cpl_polynomial_subtract(dcand, dfind, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_dump(dcand, stream); cpl_test_eq_error(error, CPL_ERROR_NONE); cost = cpl_wlcalib_slitmodel_get_cost(model) - cost; xcost = cpl_wlcalib_slitmodel_get_xcost(model) - xcost; /* No failed fills during this test */ cpl_test_eq(xcost, cost); cpl_test_eq(cost, ntests); /* Test 6. Try to refine the solution */ error = cpl_vector_fill(wl_sfine, 0.01); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_fill(xcorrs, -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cost = cpl_wlcalib_slitmodel_get_cost(model); xcost = cpl_wlcalib_slitmodel_get_xcost(model); tn0 = cpl_test_get_cputime(); error = cpl_wlcalib_find_best_1d(dfind, dfind, observed, model, cpl_wlcalib_fill_line_spectrum, wl_sfine, nsamples, 0, &xcmax, xcorrs); cpl_test_eq_error(error, CPL_ERROR_NONE); tn1 = cpl_test_get_cputime() - tn0; cpl_msg_info(cpl_func, "Refined search, XC: %g (%gsecs)", xcmax, tn1); cpl_test_abs(xcmax, cpl_vector_get_max(xcorrs), 0.0); cpl_test_leq(xcmax, 1.0); cpl_test_leq(0.9999, xcmax); cpl_test_polynomial_abs(dfind, dtrue, 0.005); error = cpl_polynomial_subtract(dcand, dfind, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_dump(dcand, stream); cpl_test_eq_error(error, CPL_ERROR_NONE); cost = cpl_wlcalib_slitmodel_get_cost(model) - cost; xcost = cpl_wlcalib_slitmodel_get_xcost(model) - xcost; /* No failed fills during this test */ cpl_test_eq(xcost, cost); cpl_test_eq(cost, ntests); /* Test 7. Same shift, but try with fast spectrum generation */ error = cpl_polynomial_copy(dfind, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_shift_1d(dfind, 0, CPL_WLCALIB_SHIFT); cpl_test_eq_error(error, CPL_ERROR_NONE); cost = cpl_wlcalib_slitmodel_get_cost(model); xcost = cpl_wlcalib_slitmodel_get_xcost(model); tf0 = cpl_test_get_cputime(); error = cpl_wlcalib_find_best_1d(dfind, dfind, observed, model, cpl_wlcalib_fill_line_spectrum_fast, wl_search, nsamples, hsize, &xcmax, xcorrs); cpl_test_eq_error(error, CPL_ERROR_NONE); tf1 = cpl_test_get_cputime() - tf0; cpl_msg_info(cpl_func, "Shifted " CPL_STRINGIFY(CPL_WLCALIB_SHIFT) " pixel(s) (fast), XC: %g (%gsecs)", xcmax, tf1); cpl_test_abs(xcmax, cpl_vector_get_max(xcorrs), 0.0); cpl_test_leq(xcmax, 1.0); cpl_test_leq(0.999, xcmax); cpl_test_polynomial_abs(dfind, dtrue, 0.01); error = cpl_polynomial_subtract(dcand, dfind, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_dump(dcand, stream); cpl_test_eq_error(error, CPL_ERROR_NONE); cost = cpl_wlcalib_slitmodel_get_cost(model) - cost; xcost = cpl_wlcalib_slitmodel_get_xcost(model) - xcost; /* No failed fills during this test */ cpl_test_eq(xcost, cost); cpl_test_eq(cost, ntests); /* Test 8. Try to refine the solution */ error = cpl_vector_fill(xcorrs, -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cost = cpl_wlcalib_slitmodel_get_cost(model); xcost = cpl_wlcalib_slitmodel_get_xcost(model); tn0 = cpl_test_get_cputime(); error = cpl_wlcalib_find_best_1d(dfind, dfind, observed, model, cpl_wlcalib_fill_line_spectrum_fast, wl_sfine, nsamples, 0, &xcmax, xcorrs); cpl_test_eq_error(error, CPL_ERROR_NONE); tn1 = cpl_test_get_cputime() - tn0; cpl_msg_info(cpl_func, "Refined fast search, XC: %g (%gsecs)", xcmax, tn1); cpl_test_abs(xcmax, cpl_vector_get_max(xcorrs), 0.0); cpl_test_leq(xcmax, 1.0); cpl_test_leq(0.9999, xcmax); cpl_test_polynomial_abs(dfind, dtrue, 0.001); error = cpl_polynomial_subtract(dcand, dfind, dtrue); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_dump(dcand, stream); cpl_test_eq_error(error, CPL_ERROR_NONE); cost = cpl_wlcalib_slitmodel_get_cost(model) - cost; xcost = cpl_wlcalib_slitmodel_get_xcost(model) - xcost; /* No failed fills during this test */ cpl_test_eq(xcost, cost); cpl_test_eq(cost, ntests); /* Test 9. Revert the order of the wavelengths in the catalog */ error = cpl_bivector_sort(lines, lines, CPL_SORT_DESCENDING, CPL_SORT_BY_X); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_fill(xcorrs, -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_wlcalib_find_best_1d(dfind, dfind, observed, model, cpl_wlcalib_fill_line_spectrum_fast, wl_sfine, nsamples, 0, &xcmax, xcorrs); cpl_test_eq_error(error, CPL_ERROR_DATA_NOT_FOUND); cpl_test_abs(xcmax, cpl_vector_get_max(xcorrs), 0.0); cpl_test_leq(xcmax, -1.0); if (stream != stdout) cpl_test_zero( fclose(stream) ); cpl_wlcalib_slitmodel_delete(model); cpl_polynomial_delete(dtrue); cpl_polynomial_delete(dfind); cpl_polynomial_delete(dcand); cpl_vector_delete(observed); cpl_vector_delete(obsfast); cpl_vector_delete(wl_search); cpl_vector_delete(wl_sfine); cpl_vector_delete(xcorrs); } cpl-6.4.1/cpldrs/tests/cpl_ppm-test.c0000644000460300003120000006316411615763404014437 00000000000000/* $Id: cpl_ppm-test.c,v 1.13 2011-08-02 12:01:08 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-08-02 12:01:08 $ * $Revision: 1.13 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "cpl_test.h" #include "cpl_math_const.h" #include "cpl_ppm.h" #include "cpl_error.h" #include "cpl_msg.h" #include "cpl_memory.h" int main(void) { cpl_matrix *pattern = NULL; cpl_matrix *data = NULL; cpl_matrix *rdata = NULL; cpl_matrix *mpattern = NULL; cpl_matrix *mdata = NULL; cpl_array *matches = NULL; cpl_array *nullarray= NULL; cpl_matrix *rotate = NULL; cpl_matrix *twobytwo = NULL; const double buffer[] = {96.807119, 6.673062, 47.828109, 90.953442, 35.169238, 93.253366, 65.443582, 2.107025, 51.220486, 20.201893, 93.997703, 20.408227, 37.882893, 79.311394, 28.820079, 26.715673, 35.682260, 12.837355, 70.329776, 73.741373, 80.252114, 91.523087, 51.138163, 76.205738, 45.638141, 47.106201, 29.955025, 61.255939, 7.338079, 49.818536, 21.958749, 4.145198, 56.491598, 69.786858, 95.098640, 91.660836, 63.040224, 60.542222, 93.767861, 14.260710, 80.744116, 87.765564, 34.668937, 18.627008, 67.076958, 63.489016, 45.342681, 2.759218, 76.326371, 15.672457, 76.500591, 56.578485, 7.195544, 27.638754, 32.784223, 52.833685, 74.744955, 62.739249, 14.089624, 82.083033, 12.557785, 36.048373, 86.228231, 69.049383, 5.835231, 81.326871, 60.710220, 68.875455, 41.869094, 54.478081, 83.136166, 22.613209, 42.243645, 17.805103, 41.240218, 9.320603, 81.294120, 86.582899, 12.079821, 57.620490, 2.255356, 88.580412, 14.198976, 9.450900, 16.219166, 46.983199, 62.284586, 90.964121, 9.722447, 76.374210, 73.047154, 22.280233, 12.422583, 59.275385, 91.329616, 18.257814, 40.602257, 52.039836, 87.133270, 82.471350, 6.517916, 70.269436, 5.084560, 48.761561, 88.074539, 46.324777, 58.082164, 69.368659, 32.907676, 70.161985, 26.989149, 35.163032, 58.742397, 41.188125, 44.613932, 74.961563, 88.171324, 6.898518, 65.925684, 97.893771, 83.272728, 38.972839, 20.174004, 95.695311, 98.248224, 11.503620, 13.953125, 38.850481, 63.543456, 1.086395, 21.321831, 70.061372, 71.355831, 26.406390, 18.822933, 59.430370, 72.731168, 76.905097, 28.799029, 5.638844, 47.067082, 55.788179, 40.801876, 5.809480, 96.976304, 85.415809, 80.771043, 85.147628, 92.314327, 46.696728, 83.041400, 75.587054, 85.669566, 3.215404, 71.282365, 83.917790, 14.719024, 85.235491, 22.768271, 78.262480, 86.321886, 44.090102, 48.323852, 57.677717, 70.496492, 67.146785, 17.108088, 43.227660, 44.051883, 45.907117, 48.866504, 91.118965, 1.695296, 89.668380, 96.928445, 98.671600, 75.084189, 77.699488, 83.819228, 67.398515, 24.396216, 66.860628, 42.985570, 10.065782, 70.076031, 14.267935, 93.983572, 84.795055, 99.503426, 16.751843, 63.057535, 85.825312, 60.841945, 11.381387, 43.503029, 31.338437, 78.528172, 60.611117, 74.566097, 22.580055}; const int permute[] = {8, 2, 1, 13, 7, 3, 5, 9, 14, 4, 0, 6, 11, 10, 12, 23, 17, 16, 28, 22, 18, 20, 24, 29, 19, 15, 21, 26, 25, 27}; int i, j, k, npattern, ndata; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* * Create a list of 3 points (0,9), 9,0), and (9,9): * * 0 9 9 * 9 0 9 */ pattern = cpl_matrix_new(2, 3); cpl_matrix_set(pattern, 0, 0, 0.0); cpl_matrix_set(pattern, 0, 1, 9.0); cpl_matrix_set(pattern, 0, 2, 9.0); cpl_matrix_set(pattern, 1, 0, 9.0); cpl_matrix_set(pattern, 1, 1, 0.0); cpl_matrix_set(pattern, 1, 2, 9.0); /* * Create an identical data matrix */ data = cpl_matrix_duplicate(pattern); /* * Now try to match points: the transformation should be an identity * (rotation angle 0, scaling 0, translation 0): */ cpl_msg_info(cpl_func, "Trying to match 3 identical points:"); matches = cpl_ppm_match_points(data, 3, 1, pattern, 3, 0, 0.1, 1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_matrix_get_ncol(mpattern), 3); cpl_test_eq(cpl_array_get_size(matches), 3); cpl_msg_info(cpl_func, "%" CPL_SIZE_FORMAT " points matched", cpl_matrix_get_ncol(mpattern)); cpl_array_delete(matches); cpl_matrix_delete(mpattern); cpl_matrix_delete(mdata); cpl_msg_info(cpl_func, "Scale data points by 2:"); cpl_matrix_multiply_scalar(data, 2.0); matches = cpl_ppm_match_points(data, 3, 1, pattern, 3, 0, 0.1, 1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_matrix_get_ncol(mpattern), 3); cpl_test_eq(cpl_array_get_size(matches), 3); cpl_msg_info(cpl_func, "%" CPL_SIZE_FORMAT " points matched", cpl_matrix_get_ncol(mpattern)); cpl_array_delete(matches); cpl_matrix_delete(mpattern); cpl_matrix_delete(mdata); cpl_msg_info(cpl_func, "Rotate data points by +45 degrees:"); rotate = cpl_matrix_new(2, 2); cpl_matrix_set(rotate, 0, 0, sqrt(2)/2); cpl_matrix_set(rotate, 0, 1, -sqrt(2)/2); cpl_matrix_set(rotate, 1, 0, sqrt(2)/2); cpl_matrix_set(rotate, 1, 1, sqrt(2)/2); rdata = cpl_matrix_product_create(rotate, data); cpl_matrix_delete(rotate); cpl_matrix_delete(data); matches = cpl_ppm_match_points(rdata, 3, 1, pattern, 3, 0, 0.1, 1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_matrix_get_ncol(mpattern), 3); cpl_test_eq(cpl_array_get_size(matches), 3); cpl_msg_info(cpl_func, "%" CPL_SIZE_FORMAT " points matched", cpl_matrix_get_ncol(mpattern)); cpl_array_delete(matches); cpl_matrix_delete(mpattern); cpl_matrix_delete(mdata); cpl_msg_info(cpl_func, "Shift data points by some vector:"); cpl_matrix_add_scalar(rdata, -15); matches = cpl_ppm_match_points(rdata, 3, 1, pattern, 3, 0, 0.1, 1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_matrix_get_ncol(mpattern), 3); cpl_test_eq(cpl_array_get_size(matches), 3); cpl_msg_info(cpl_func, "%" CPL_SIZE_FORMAT " points matched", cpl_matrix_get_ncol(mpattern)); cpl_array_delete(matches); cpl_matrix_delete(mpattern); cpl_matrix_delete(mdata); cpl_matrix_delete(pattern); cpl_matrix_delete(rdata); /* * Now we start testing the same, with longer lists of points. * Matrices will still be identical (no extra points), but only * the first 3 points will be used for pattern matching, and the * rest will be recovered... * * Create a list of 8 points: * * 0 9 9 1 1 5 2 3 * 9 0 9 0 3 4 1 7 */ pattern = cpl_matrix_new(2, 8); cpl_matrix_set(pattern, 0, 0, 0.0); cpl_matrix_set(pattern, 0, 1, 9.0); cpl_matrix_set(pattern, 0, 2, 9.0); cpl_matrix_set(pattern, 0, 3, 1.0); cpl_matrix_set(pattern, 0, 4, 1.0); cpl_matrix_set(pattern, 0, 5, 5.0); cpl_matrix_set(pattern, 0, 6, 2.0); cpl_matrix_set(pattern, 0, 7, 3.0); cpl_matrix_set(pattern, 1, 0, 9.0); cpl_matrix_set(pattern, 1, 1, 0.0); cpl_matrix_set(pattern, 1, 2, 9.0); cpl_matrix_set(pattern, 1, 3, 0.0); cpl_matrix_set(pattern, 1, 4, 3.0); cpl_matrix_set(pattern, 1, 5, 4.0); cpl_matrix_set(pattern, 1, 6, 1.0); cpl_matrix_set(pattern, 1, 7, 7.0); /* * Create an identical data matrix */ data = cpl_matrix_duplicate(pattern); /* * Now try to match points: the transformation should be an identity * (rotation angle 0, scaling 0, translation 0): */ cpl_msg_info(cpl_func, "Trying to match 8 identical points:"); matches = cpl_ppm_match_points(data, 4, 1, pattern, 3, 0, 0.1, 1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_matrix_get_ncol(mpattern), 8); cpl_test_eq(cpl_array_get_size(matches), 8); cpl_msg_info(cpl_func, "%" CPL_SIZE_FORMAT " points matched", cpl_matrix_get_ncol(mpattern)); cpl_array_delete(matches); cpl_matrix_delete(mpattern); cpl_matrix_delete(mdata); cpl_msg_info(cpl_func, "Remove a point from data:"); rdata = cpl_matrix_duplicate(data); cpl_matrix_erase_columns(rdata, 6, 1); matches = cpl_ppm_match_points(rdata, 4, 1, pattern, 3, 0, 0.1, 1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_matrix_get_ncol(mpattern), 7); cpl_test_eq(cpl_array_get_size(matches), 8); cpl_test_eq(cpl_array_count_invalid(matches), 1); cpl_msg_info(cpl_func, "%" CPL_SIZE_FORMAT " points matched", cpl_matrix_get_ncol(mpattern)); cpl_array_delete(matches); cpl_matrix_delete(mpattern); cpl_matrix_delete(mdata); cpl_matrix_delete(rdata); cpl_msg_info(cpl_func, "Rotate data points by -27 degrees:"); rotate = cpl_matrix_new(2, 2); cpl_matrix_set(rotate, 0, 0, cos(-27./180.*CPL_MATH_PI)); cpl_matrix_set(rotate, 0, 1, -sin(-27./180.*CPL_MATH_PI)); cpl_matrix_set(rotate, 1, 0, sin(-27./180.*CPL_MATH_PI)); cpl_matrix_set(rotate, 1, 1, cos(-27./180.*CPL_MATH_PI)); rdata = cpl_matrix_product_create(rotate, data); cpl_matrix_delete(rotate); cpl_matrix_delete(data); matches = cpl_ppm_match_points(rdata, 4, 1, pattern, 3, 0, 0.1, 1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_matrix_get_ncol(mpattern), 8); cpl_test_eq(cpl_array_get_size(matches), 8); cpl_msg_info(cpl_func, "%" CPL_SIZE_FORMAT " points matched", cpl_matrix_get_ncol(mpattern)); cpl_matrix_delete(rdata); cpl_array_delete(matches); cpl_matrix_delete(mpattern); cpl_matrix_delete(mdata); cpl_matrix_delete(pattern); /* * At this point we use a random distribution of 100 points. * Only the first 70 will be written to pattern, the other 30 * will be "false detections". And only the first 10 pattern * points and the first 20 data points will be used for direct * pattern matching - the remaining points will be recovered * in the second step. The data matrix will be rotated by 95 * degrees and rescaled by a factor 2.35. */ cpl_msg_info(cpl_func, "100 random distributed data points " "(70 in pattern, 30 false-detections), data rescaled " "by 2.35 and rotated by 95 degrees..."); pattern = cpl_matrix_new(2, 100); for (k = 0, i = 0; i < 2; i++) { for (j = 0; j < 100; j++, k++) { cpl_matrix_set(pattern, i, j, buffer[k]); } } data = cpl_matrix_duplicate(pattern); cpl_matrix_erase_columns(pattern, 70, 30); cpl_matrix_multiply_scalar(data, 2.35); rotate = cpl_matrix_new(2, 2); cpl_matrix_set(rotate, 0, 0, cos(95./180.*CPL_MATH_PI)); cpl_matrix_set(rotate, 0, 1, -sin(95./180.*CPL_MATH_PI)); cpl_matrix_set(rotate, 1, 0, sin(95./180.*CPL_MATH_PI)); cpl_matrix_set(rotate, 1, 1, cos(95./180.*CPL_MATH_PI)); rdata = cpl_matrix_product_create(rotate, data); cpl_matrix_delete(rotate); cpl_matrix_delete(data); matches = cpl_ppm_match_points(rdata, 20, 1, pattern, 10, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_matrix_get_ncol(mpattern), 70); cpl_test_eq(cpl_array_get_size(matches), 70); cpl_msg_info(cpl_func, "%" CPL_SIZE_FORMAT " points matched", cpl_matrix_get_ncol(mpattern)); cpl_matrix_delete(rdata); cpl_array_delete(matches); cpl_matrix_delete(mpattern); cpl_matrix_delete(mdata); cpl_matrix_delete(pattern); /* * Now with a random distribution of 20 points. This time * the whole data and the whole pattern (limited to 10 points) * are used. This means that a 50% contamination is present * on the data side already at the first pattern matching step. * The data matrix will be again rotated by 95 degrees and * rescaled by a factor 2.35. */ npattern = 10; ndata = 20; cpl_msg_info(cpl_func, "%d random distributed data points " "(%d in pattern, %d in data, i.e., including %d " "false-detections), data rescaled " "by 2.35 and rotated by 95 degrees...", ndata, npattern, ndata, ndata - npattern); pattern = cpl_matrix_new(2, ndata); for (k = 0, i = 0; i < 2; i++) { for (j = 0; j < ndata; j++, k++) { cpl_matrix_set(pattern, i, j, buffer[k]); } } data = cpl_matrix_duplicate(pattern); cpl_matrix_erase_columns(pattern, npattern, ndata - npattern); cpl_matrix_multiply_scalar(data, 2.35); rotate = cpl_matrix_new(2, 2); cpl_matrix_set(rotate, 0, 0, cos(95./180.*CPL_MATH_PI)); cpl_matrix_set(rotate, 0, 1, -sin(95./180.*CPL_MATH_PI)); cpl_matrix_set(rotate, 1, 0, sin(95./180.*CPL_MATH_PI)); cpl_matrix_set(rotate, 1, 1, cos(95./180.*CPL_MATH_PI)); rdata = cpl_matrix_product_create(rotate, data); cpl_matrix_delete(rotate); cpl_matrix_delete(data); matches = cpl_ppm_match_points(rdata, ndata, 1, pattern, npattern, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_matrix_get_ncol(mpattern), npattern); cpl_test_eq(cpl_array_get_size(matches), npattern); cpl_msg_info(cpl_func, "%" CPL_SIZE_FORMAT " points matched", cpl_matrix_get_ncol(mpattern)); cpl_matrix_delete(rdata); cpl_array_delete(matches); cpl_matrix_delete(mpattern); cpl_matrix_delete(mdata); cpl_matrix_delete(pattern); /* * Now with a random distribution of 10 points. This time * the pattern is larger than the data set by 5 points. * This means that points are missing on the data side. * The data matrix will be again rotated by 95 degrees and * rescaled by a factor 2.35. */ npattern = 15; ndata = 10; cpl_msg_info(cpl_func, "%d random distributed data points " "(%d in pattern, %d in data, i.e., with %d " "missing detections), data rescaled " "by 2.35 and rotated by 95 degrees...", ndata, npattern, ndata, npattern - ndata); pattern = cpl_matrix_new(2, npattern); for (k = 0, i = 0; i < 2; i++) { for (j = 0; j < npattern; j++, k++) { cpl_matrix_set(pattern, i, j, buffer[permute[k]]); } } data = cpl_matrix_new(2, npattern); for (k = 0, i = 0; i < 2; i++) { for (j = 0; j < npattern; j++, k++) { cpl_matrix_set(data, i, j, buffer[k]); } } cpl_matrix_erase_columns(data, ndata, npattern - ndata); cpl_matrix_multiply_scalar(data, 2.35); rotate = cpl_matrix_new(2, 2); cpl_matrix_set(rotate, 0, 0, cos(95./180.*CPL_MATH_PI)); cpl_matrix_set(rotate, 0, 1, -sin(95./180.*CPL_MATH_PI)); cpl_matrix_set(rotate, 1, 0, sin(95./180.*CPL_MATH_PI)); cpl_matrix_set(rotate, 1, 1, cos(95./180.*CPL_MATH_PI)); rdata = cpl_matrix_product_create(rotate, data); cpl_matrix_delete(rotate); cpl_matrix_delete(data); matches = cpl_ppm_match_points(rdata, ndata, 1, pattern, npattern, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_matrix_get_ncol(mpattern), ndata); cpl_test_eq(cpl_array_get_size(matches), npattern); cpl_msg_info(cpl_func, "%" CPL_SIZE_FORMAT " points matched", cpl_matrix_get_ncol(mpattern)); cpl_matrix_delete(rdata); cpl_array_delete(matches); cpl_matrix_delete(mpattern); cpl_matrix_delete(mdata); cpl_matrix_delete(pattern); /* * Now with a random distribution of 20 aligned points. * The whole data and the whole pattern (limited to 10 points) * are used. This means that a 50% contamination is present * on the data side already at the first pattern matching step. * The data matrix will be rescaled by a factor 2.35. */ npattern = 10; ndata = 20; cpl_msg_info(cpl_func, "%d random distributed aligned data points " "(%d in pattern, %d in data, i.e., including %d " "false-detections), data rescaled by 2.35...", ndata, npattern, ndata, ndata - npattern); pattern = cpl_matrix_new(2, ndata); for (j = 0; j < ndata; j++, k++) cpl_matrix_set(pattern, 0, j, buffer[k]); for (j = 0; j < ndata; j++, k++) cpl_matrix_set(pattern, 1, j, 0.0); data = cpl_matrix_duplicate(pattern); cpl_matrix_erase_columns(pattern, npattern, ndata - npattern); cpl_matrix_multiply_scalar(data, 2.35); matches = cpl_ppm_match_points(data, ndata, 1, pattern, npattern, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_matrix_get_ncol(mpattern), npattern); cpl_test_eq(cpl_array_get_size(matches), npattern); cpl_msg_info(cpl_func, "%" CPL_SIZE_FORMAT " points matched", cpl_matrix_get_ncol(mpattern)); cpl_matrix_delete(mpattern); cpl_matrix_delete(mdata); cpl_array_delete(matches); /* Use data also as pattern */ matches = cpl_ppm_match_points(data, ndata, 1, data, ndata, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_matrix_get_ncol(mpattern), ndata); cpl_test_eq(cpl_array_get_size(matches), ndata); cpl_msg_info(cpl_func, "%" CPL_SIZE_FORMAT " points matched", cpl_matrix_get_ncol(mpattern)); cpl_matrix_delete(mpattern); cpl_matrix_delete(mdata); cpl_array_delete(matches); cpl_msg_info(cpl_func, "Check handling of NULL input"); nullarray = cpl_ppm_match_points(NULL, ndata, 1, pattern, npattern, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullarray); cpl_test_null(mpattern); cpl_test_null(mdata); nullarray = cpl_ppm_match_points(data, ndata, 1, NULL, npattern, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullarray); cpl_test_null(mpattern); cpl_test_null(mdata); nullarray = cpl_ppm_match_points(data, ndata, 1, pattern, npattern, 0, 0.1, 0.1, NULL, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullarray); cpl_test_null(mpattern); nullarray = cpl_ppm_match_points(data, ndata, 1, pattern, npattern, 0, 0.1, 0.1, &mdata, NULL, NULL, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullarray); cpl_test_null(mdata); cpl_msg_info(cpl_func, "Check handling of other invalid input"); /* ndata too small */ nullarray = cpl_ppm_match_points(data, 2, 1, pattern, npattern, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullarray); cpl_test_null(mpattern); cpl_test_null(mdata); /* ndata too large */ nullarray = cpl_ppm_match_points(data, ndata+1, 1, pattern, npattern, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_null(nullarray); cpl_test_null(mpattern); cpl_test_null(mdata); /* npattern too large */ nullarray = cpl_ppm_match_points(data, ndata, 1, pattern, npattern+1, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_null(nullarray); cpl_test_null(mpattern); cpl_test_null(mdata); /* npattern too small */ nullarray = cpl_ppm_match_points(data, ndata, 1, pattern, 2, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullarray); cpl_test_null(mpattern); cpl_test_null(mdata); /* err_data and err_pattern non-positive */ nullarray = cpl_ppm_match_points(data, ndata, 0.0, pattern, npattern, 0.0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullarray); cpl_test_null(mpattern); cpl_test_null(mdata); /* tolerance negative */ nullarray = cpl_ppm_match_points(data, ndata, 1.0, pattern, npattern, 0.0, -0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullarray); cpl_test_null(mpattern); cpl_test_null(mdata); /* radius negative */ nullarray = cpl_ppm_match_points(data, ndata, 1.0, pattern, npattern, 0.0, 0.1, -0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullarray); cpl_test_null(mpattern); cpl_test_null(mdata); /* Too few columns in data */ twobytwo = cpl_matrix_new(2, 2); matches = cpl_ppm_match_points(twobytwo, ndata, 1, pattern, npattern, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullarray); cpl_test_null(mpattern); cpl_test_null(mdata); /* Too few columns in pattern */ matches = cpl_ppm_match_points(data, ndata, 1, twobytwo, npattern, 0, 0.1, 0.1, &mdata, &mpattern, NULL, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullarray); cpl_test_null(mpattern); cpl_test_null(mdata); cpl_matrix_delete(twobytwo); cpl_matrix_delete(data); cpl_matrix_delete(pattern); return cpl_test_end(0); } cpl-6.4.1/cpldrs/tests/Makefile.am0000644000460300003120000000514712127227645013716 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO Common Pipeline Library ## Copyright (C) 2001-2008 European Southern Observatory ## 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 2 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 02111-1307 USA AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ if MAINTAINER_MODE MAINTAINERCLEANFILES = $(srcdir)/Makefile.in endif AM_CPPFLAGS = $(CPLDRS_INCLUDES) $(CPLCORE_INCLUDES) $(CX_INCLUDES) \ $(CFITSIO_INCLUDES) $(WCS_INCLUDES) \ $(CPL_CFLAGS) LDADD = $(LIBCPLDRS) $(LIBCPLCORE) $(LIBWCS) -lm AM_LDFLAGS = $(WCS_LDFLAGS) check_PROGRAMS = cpl_fit-test \ cpl_apertures-test \ cpl_geom_img-test \ cpl_detector-test \ cpl_photom-test \ cpl_wcs-test \ cpl_wlcalib-test \ cpl_ppm-test \ cpl_fft-test cpl_fit_test_SOURCES = cpl_fit-test.c cpl_apertures_test_SOURCES = cpl_apertures-test.c cpl_detector_test_SOURCES = cpl_detector-test.c cpl_geom_img_test_SOURCES = cpl_geom_img-test.c cpl_photom_test_SOURCES = cpl_photom-test.c cpl_wcs_test_SOURCES = cpl_wcs-test.c cpl_wlcalib_test_SOURCES = cpl_wlcalib-test.c cpl_ppm_test_SOURCES = cpl_ppm-test.c cpl_fft_test_SOURCES = cpl_fft-test.c # Be sure to reexport important environment variables. TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" TESTS = cpl_fit-test \ cpl_apertures-test \ cpl_geom_img-test \ cpl_detector-test \ cpl_photom-test \ cpl_wcs-test \ cpl_wlcalib-test \ cpl_ppm-test \ cpl_fft-test XFAIL_TESTS = # We need to remove any files that the above tests created. clean-local: $(RM) planck1.txt planck2.txt *.log if USE_PURIFY include $(top_builddir)/Makefile.purify endif cpl-6.4.1/cpldrs/tests/cpl_geom_img-test.c0000644000460300003120000007257611765320133015427 00000000000000/* $Id: cpl_geom_img-test.c,v 1.50 2012-06-11 07:38:03 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-06-11 07:38:03 $ * $Revision: 1.50 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include /* cpl_drand() */ #include #include "cpl_apertures.h" #include "cpl_geom_img.h" /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ #ifndef IMAGESZ #define IMAGESZ 256 #endif #define NFRAMES 10 #define NSIGMAS 4 #define MAX_SHIFT_ERROR1 15 #define MAX_SHIFT_ERROR2 0.1 /*----------------------------------------------------------------------------- Pricate functions -----------------------------------------------------------------------------*/ static void cpl_geom_img_offset_saa_one(cpl_kernel); static void cpl_geom_img_offset_saa_bench(cpl_geom_combine, int, int, int, int, int); static void cpl_imagelist_fill_shifted(cpl_imagelist *, cpl_size, const double *, const double *); /**@{*/ /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { /* These kernels preserve the actual pixel-values */ cpl_kernel kernels[] = {CPL_KERNEL_DEFAULT, CPL_KERNEL_NEAREST}; const cpl_geom_combine geoms[] = {CPL_GEOM_INTERSECT, CPL_GEOM_UNION, CPL_GEOM_FIRST}; /* Shift by non-integer amount to evaluate resampling */ const double off_x_init[] = { 0.0, -6.5, -18.5, 54.5, 33.5, 46.5, -3.5, 36.5, 42.5, -13.5}; const double off_y_init[] = { 0.0, 13.5, 3.5, 8.5, 32.5, 22.5, 18.5, -56.5, 3.5, 10.5}; cpl_imagelist * iset; cpl_image * img; cpl_bivector * offs_est; cpl_vector * off_vec_x; cpl_vector * off_vec_y; cpl_bivector * offs_ref; cpl_apertures * aperts; int naperts; cpl_bivector * aperts_pos; cpl_vector * aperts_pos_x; cpl_vector * aperts_pos_y; cpl_vector * correl; const double psigmas[] = {5, 2, 1, 0.5}; cpl_vector * sigmas; cpl_image ** combined; int i; cpl_size pos; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Verify the test data */ cpl_test_eq(sizeof(off_x_init), NFRAMES * sizeof(off_x_init[0])); cpl_test_eq(sizeof(off_y_init), sizeof(off_x_init)); cpl_test_eq(sizeof(psigmas), NSIGMAS * sizeof(psigmas[0])); for (i = 0; i < NFRAMES; i++) { cpl_test_leq(fabs(off_x_init[i]), IMAGESZ); cpl_test_leq(fabs(off_y_init[i]), IMAGESZ); } cpl_geom_img_offset_saa_one(CPL_KERNEL_DEFAULT); cpl_geom_img_offset_saa_one(CPL_KERNEL_NEAREST); if (cpl_msg_get_level() <= CPL_MSG_INFO) { const double tprev = cpl_test_get_cputime(); const cpl_flops fprev = cpl_tools_get_flops(); double tpost, cputime; cpl_flops fpost, nflops; #ifndef _OPENMP cpl_geom_img_offset_saa_bench(CPL_GEOM_FIRST, 10, 16, 4*IMAGESZ, 4*IMAGESZ, 0); cpl_geom_img_offset_saa_bench(CPL_GEOM_FIRST, 6, 18, 4*IMAGESZ, 4*IMAGESZ, 1); #endif #ifdef _OPENMP #pragma omp parallel for private(i) #endif for (i=0; i < 8; i++) { cpl_geom_img_offset_saa_bench(CPL_GEOM_FIRST, 6, 18, 4*IMAGESZ, 4*IMAGESZ, 1); } tpost = cpl_test_get_cputime(); fpost = cpl_tools_get_flops(); cputime = tpost - tprev; nflops = fpost - fprev; cpl_msg_info(cpl_func, "Time to benchmark [s]: %g (%g MFLOP/s)", cputime, cputime > 0.0 ? (double)nflops/cputime/1e6 : 0.0); } else { cpl_geom_img_offset_saa_bench(CPL_GEOM_FIRST, 1, 4, IMAGESZ/4, IMAGESZ/4, 1); } /* Bivector with 1 zero-valued element */ off_vec_x = cpl_vector_new(1); cpl_vector_set(off_vec_x, 0, 0.0); offs_ref = cpl_bivector_wrap_vectors(off_vec_x, off_vec_x); /* Test with empty imagelist */ iset = cpl_imagelist_new(); combined = cpl_geom_img_offset_saa(iset, offs_ref, CPL_KERNEL_DEFAULT, 0, 0, CPL_GEOM_FIRST, NULL, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(combined); /* Insert one image into imagelist */ img = cpl_image_fill_test_create(IMAGESZ, IMAGESZ); cpl_imagelist_set(iset, img, 0); for (i = 0; i < (int)(sizeof(geoms)/sizeof(geoms[0])); i++) { const cpl_geom_combine geom = geoms[i]; /* Shift and add */ cpl_msg_info("", "Shift and add single image with geom number %d", (int)geom); combined = cpl_geom_img_offset_saa(iset, offs_ref, CPL_KERNEL_DEFAULT, 0, 0, geom, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(combined); cpl_test_nonnull(combined[0]); cpl_test_nonnull(combined[1]); cpl_test_eq(cpl_image_get_type(combined[1]), CPL_TYPE_INT); cpl_test_eq(cpl_image_get_min(combined[1]), 1); cpl_test_eq(cpl_image_get_max(combined[1]), 1); cpl_test_zero(cpl_image_count_rejected(combined[0])); cpl_test_eq(cpl_image_get_size_x(combined[0]), cpl_image_get_size_x(combined[1])); cpl_test_eq(cpl_image_get_size_y(combined[0]), cpl_image_get_size_y(combined[1])); cpl_test_image_abs(combined[0], cpl_imagelist_get_const(iset, 0), 0.0); cpl_image_delete(combined[0]); cpl_image_delete(combined[1]); cpl_free(combined); } cpl_bivector_unwrap_vectors(offs_ref); cpl_vector_delete(off_vec_x); cpl_imagelist_fill_shifted(iset, NFRAMES-1, off_x_init, off_y_init); cpl_test_eq(cpl_imagelist_get_size(iset), NFRAMES); /* Not modified */ off_vec_x = cpl_vector_wrap(NFRAMES, (double*)off_x_init); off_vec_y = cpl_vector_wrap(NFRAMES, (double*)off_y_init); offs_est = cpl_bivector_new(NFRAMES); cpl_vector_copy(cpl_bivector_get_x(offs_est), off_vec_x); cpl_vector_copy(cpl_bivector_get_y(offs_est), off_vec_y); /* Distort the estimate */ cpl_vector_add_scalar(cpl_bivector_get_x(offs_est), 2.0); cpl_vector_add_scalar(cpl_bivector_get_y(offs_est), -3.0); sigmas = cpl_vector_wrap(NSIGMAS, (double*)psigmas); /* Not modified */ cpl_test_error(CPL_ERROR_NONE); /* Get some cross-correlation apertures */ aperts = cpl_apertures_extract(cpl_imagelist_get_const(iset, 0), sigmas, &pos); cpl_vector_unwrap(sigmas); cpl_test_nonnull(aperts); naperts = cpl_apertures_get_size(aperts); cpl_test_leq(1, naperts); cpl_msg_info("","Detected %d apertures at sigma %g (%" CPL_SIZE_FORMAT "/%" CPL_SIZE_FORMAT ")", naperts, psigmas[pos], 1+pos, (cpl_size)NSIGMAS); if (cpl_msg_get_level() <= CPL_MSG_DEBUG) cpl_apertures_dump(aperts, stdout); aperts_pos = cpl_bivector_new(naperts); aperts_pos_x = cpl_bivector_get_x(aperts_pos); aperts_pos_y = cpl_bivector_get_y(aperts_pos); for (i=0; i 0.0 ? (double)nflops/cputime/1e6 : 0.0); if (cputime > 0.0) { cpl_msg_info(cpl_func,"Processing rate [MB/s]: %g", 1e-6 * (double)bytes / cputime); } cpl_bivector_delete(offset); cpl_imagelist_delete(imglist); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Create imagelist of images shifted from the 1st image @param self Imagelist with one image to append to @param napp The number of shifted images to append @param dx The array of n+1 X-shifts (0.0 as 1st element) @param dy The array of n+1 Y-shifts (0.0 as 1st element) @return void @note On return the number of images in self will be n+1 */ /*----------------------------------------------------------------------------*/ static void cpl_imagelist_fill_shifted(cpl_imagelist * self, cpl_size napp, const double * dx, const double * dy) { const cpl_image * img = cpl_imagelist_get_const(self, 0); const cpl_size type = cpl_image_get_type (img); const cpl_size nx = cpl_image_get_size_x(img); const cpl_size ny = cpl_image_get_size_x(img); const cpl_size ishift_0[2] = {0, 0}; const cpl_size ishift_x[2] = {1, 0}; const cpl_size ishift_y[2] = {0, 1}; const double xyradius = CPL_KERNEL_DEF_WIDTH; cpl_vector * xyprofile = cpl_vector_new(CPL_KERNEL_DEF_SAMPLES); cpl_polynomial * shift_x = cpl_polynomial_new(2); cpl_polynomial * shift_y = cpl_polynomial_new(2); cpl_error_code error; cpl_size i; cpl_test_eq(cpl_imagelist_get_size(self), 1); cpl_test_leq(1, napp); cpl_test_nonnull(dx); cpl_test_nonnull(dy); /* Identity transforms */ error = cpl_polynomial_set_coeff(shift_x, ishift_x, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_set_coeff(shift_y, ishift_y, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Resampling profile */ error = cpl_vector_fill_kernel_profile(xyprofile, CPL_KERNEL_DEFAULT, xyradius); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Append images to image set */ for (i=1; i < napp+1; i++) { cpl_image * copy = cpl_image_new(nx, ny, type); /* Shift in X and Y */ error = cpl_polynomial_set_coeff(shift_x, ishift_0, dx[i]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_set_coeff(shift_y, ishift_0, dy[i]); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_warp_polynomial(copy, img, shift_x, shift_y, xyprofile, xyradius, xyprofile, xyradius); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(self, copy, i); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_polynomial_delete(shift_x); cpl_polynomial_delete(shift_y); cpl_vector_delete(xyprofile); cpl_test_eq(cpl_imagelist_get_size(self), napp+1); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @param kernel Kernel type @return void @note On return the number of images in self will be n+1 */ /*----------------------------------------------------------------------------*/ static void cpl_geom_img_offset_saa_one(cpl_kernel kernel) { const int nz = 2 + NFRAMES; cpl_imagelist * imglist = cpl_imagelist_new(); cpl_image ** combined; cpl_bivector * offset = cpl_bivector_new(nz); cpl_vector * off_x = cpl_bivector_get_x(offset); cpl_vector * off_y = cpl_bivector_get_y(offset); cpl_error_code error; cpl_size iz; cpl_image * central0; cpl_image * central1; for (iz = 0; iz < nz; iz++) { cpl_image * img = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_FLOAT); cpl_test_nonnull(img); /* Insert flat images with known sum of the non-rejected planes */ error = cpl_image_add_scalar(img, (double)(nz - iz - nz/5)); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(imglist, img, iz); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_vector_set(off_x, iz, iz ? cpl_drand() : 0.0); cpl_vector_set(off_y, iz, iz ? cpl_drand() : 0.0); } combined = cpl_geom_img_offset_saa(imglist, offset, kernel, nz/5, nz/4, CPL_GEOM_INTERSECT, NULL, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(combined); error = cpl_image_dump_structure(combined[1], stdout); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_image_get_max(combined[0]), (nz - nz/5 - nz/4 + 1) /2.0); cpl_test_eq(cpl_image_get_max(combined[1]), nz - nz/5 - nz/4); central0 = cpl_image_extract(combined[0], 3, 3, IMAGESZ - 2, IMAGESZ - 2); central1 = cpl_image_extract(combined[1], 3, 3, IMAGESZ - 2, IMAGESZ - 2); cpl_test_eq(cpl_image_get_min(central0), (nz - nz/5 - nz/4 + 1) /2.0); cpl_test_eq(cpl_image_get_min(central1), nz - nz/5 - nz/4); cpl_image_delete(combined[0]); cpl_image_delete(combined[1]); cpl_free(combined); cpl_image_delete(central0); cpl_image_delete(central1); cpl_imagelist_delete(imglist); cpl_bivector_delete(offset); } cpl-6.4.1/cpldrs/tests/cpl_wcs-test.c0000644000460300003120000007137412072544451014436 00000000000000/* $Id: cpl_wcs-test.c,v 1.35 2013-01-07 13:10:01 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-01-07 13:10:01 $ * $Revision: 1.35 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*---------------------------------------------------------------------------- Includes ----------------------------------------------------------------------------*/ #include "cpl_error_impl.h" #include "cpl_wcs.h" #include "cpl_init.h" #include "cpl_test.h" #include "cpl_memory.h" #include #include #include #include #include #ifdef CPL_WCS_INSTALLED /* Needed for cpl_error_set_wcs() */ #include #endif #define TESTFILE "nonaxis.fits" #define NSK 2 #define NDK 13 #define NIK 3 const char *skeys[NSK] = {"CTYPE1", "CTYPE2"}; const char *skeys_tab[NSK] = {"TCTYP3","TCTYP5"}; const char *dkeys[NDK] = {"CRVAL1", "CRVAL2", "CRPIX1", "CRPIX2", "CD1_1", "CD1_2", "CD2_1", "CD2_2", "PV2_1", "PV2_2", "PV2_3", "PV2_4", "PV2_5"}; const char *dkeys_tab[NDK] = {"TCRVL3","TCRVL5","TCRPX3","TCRPX5", "TC3_3","TC3_5","TC5_3","TC5_5","TV5_1", "TV5_2","TV5_3","TV5_4","TV5_5"}; const char *ikeys[NIK] = {"NAXIS","NAXIS1","NAXIS2"}; const char *svals[NSK] = {"RA---ZPN", "DEC--ZPN"}; const double dvals[NDK] = {5.57368333333, -72.0576388889, 5401.6, 6860.8, 5.81347849634012E-21, 9.49444444444444E-05, -9.49444444444444E-05, -5.81347849634012E-21, 1.0, 0.0, 42.0, 0.0, 0.0}; const int ivals[NIK] = {2, 2048, 2048}; const char *svals2[NSK] = {"RA---ZPN", "DEC--ZPN"}; const double dvals2[NDK] = {136.018529319233, 34.5793698413348, 3000.83678222321, -936.601342583387, 5.33299465243094E-08, -0.000111500211205622, 0.000111494500595739, -1.41761930842942E-08, 1.0, 0.0, -45.0, 0.0, 0.0}; const int ivals2[NIK] = {2, 2064, 2064}; #define NP 2 const double physin[2*NP] = {1024.0, 1024.0, 1025.0, 1023.0}; const double worldout[2*NP] = {3.825029720, -71.636524754, 3.824722171, -71.636616487}; const double stdcout[2] = {-0.554171733, 0.415628800}; const double worldin[2] = {3.824875946, -71.636570620}; const double physout[2] = {1024.5, 1023.5}; #define NSTDS 94 const double xy[] = { 382.252, 36.261, 18.097, 38.428, 1551.399, 51.774, 800.372, 85.623, 296.776, 97.524, 1688.610, 137.485, 1137.220, 207.411, 881.385, 213.913, 1301.158, 239.626, 1925.201, 242.518, 152.270, 252.434, 493.289, 274.073, 1027.982, 286.037, 1123.301, 302.822, 791.430, 309.277, 1634.414, 329.992, 45.455, 334.707, 224.075, 343.282, 622.339, 352.331, 1967.698, 358.488, 901.068, 409.338, 953.233, 417.257, 1289.861, 426.885, 596.422, 430.980, 129.039, 446.756, 1534.073, 463.523, 1476.210, 464.923, 749.281, 475.854, 441.555, 478.242, 1333.284, 482.094, 662.150, 536.999, 1246.223, 585.173, 475.595, 656.727, 169.960, 679.461, 1502.242, 689.464, 93.412, 694.360, 545.388, 696.031, 247.199, 746.899, 615.903, 757.244, 1927.821, 864.380, 1724.554, 889.479, 1449.032, 895.684, 1558.846, 906.941, 777.762, 912.936, 1327.582, 914.718, 857.511, 920.258, 850.675, 936.752, 317.737, 966.788, 1954.225, 967.560, 1334.811,1055.225, 311.918,1075.083, 1132.445,1097.327, 1600.109,1096.887, 1254.242,1119.658, 1285.886,1141.102, 665.050,1149.314, 259.059,1182.549, 1511.898,1203.002, 1041.352,1220.464, 944.823,1302.967, 990.619,1303.994, 1303.476,1320.765, 1059.565,1334.145, 1035.701,1340.268, 441.037,1340.244, 1149.912,1355.465, 225.527,1356.680, 1558.375,1387.388, 2034.853,1410.099, 799.400,1429.687, 1285.559,1491.646, 218.601,1500.189, 726.648,1516.822, 1112.176,1520.933, 147.153,1531.091, 904.416,1534.735, 1736.805,1557.387, 1496.763,1603.196, 1478.237,1618.552, 770.317,1656.818, 1625.301,1676.042, 1207.898,1696.559, 470.996,1727.196, 1807.232,1732.755, 1462.826,1735.153, 1098.744,1753.648, 67.590,1757.731, 431.763,1811.486, 92.574,1834.930, 833.029,1939.049, 244.391,1953.157, 1040.013,1959.332, 874.378,1980.592, 1396.658,2014.189 }; const double radec[] = { 135.88677979, 34.28698730, 135.88664246, 34.24613953, 135.88479614, 34.41748047, 135.88023376, 34.33363724, 135.87858582, 34.27736664, 135.87304688, 34.43286514, 135.86373901, 34.37126541, 135.86285400, 34.34273529, 135.85929871, 34.38956833, 135.85894775, 34.45923233, 135.85778809, 34.26112366, 135.85470581, 34.29931259, 135.85314941, 34.35920334, 135.85084534, 34.36973190, 135.84997559, 34.33263397, 135.84710693, 34.42679977, 135.84652710, 34.24911499, 135.84542847, 34.26911163, 135.84413147, 34.31375504, 135.84321594, 34.46398163, 135.83653259, 34.34495163, 135.83547974, 34.35073853, 135.83410645, 34.38834763, 135.83352661, 34.31077576, 135.83146667, 34.25836945, 135.82904053, 34.41551590, 135.82885742, 34.40904236, 135.82754517, 34.32785416, 135.82716370, 34.29343414, 135.82658386, 34.39306641, 135.81916809, 34.31809998, 135.81260681, 34.38336945, 135.80287170, 34.29724884, 135.79995728, 34.26297760, 135.79847717, 34.41189957, 135.79797363, 34.25428772, 135.79760742, 34.30493546, 135.79077148, 34.27165985, 135.78939819, 34.31282425, 135.77473450, 34.45937729, 135.77145386, 34.43675232, 135.77061462, 34.40594864, 135.76892090, 34.41823959, 135.76821899, 34.33092880, 135.76800537, 34.39233398, 135.76731873, 34.33979416, 135.76509094, 34.33901596, 135.76103210, 34.27935028, 135.76074219, 34.46220398, 135.74896240, 34.39315033, 135.74639893, 34.27863312, 135.74327087, 34.37044907, 135.74317932, 34.42278671, 135.74020386, 34.38416672, 135.73742676, 34.38760376, 135.73634338, 34.31815338, 135.73170471, 34.27264023, 135.72891235, 34.41275406, 135.72660828, 34.36019516, 135.71536255, 34.34933853, 135.71527100, 34.35440445, 135.71296692, 34.38951492, 135.71118164, 34.36217117, 135.71046448, 34.35951996, 135.71041870, 34.29297638, 135.70826721, 34.37225342, 135.70826721, 34.26868439, 135.70388794, 34.41787720, 135.70075989, 34.47105789, 135.69830322, 34.33304977, 135.68984985, 34.38727188, 135.68881226, 34.26796341, 135.68650818, 34.32481003, 135.68591309, 34.36791611, 135.68466187, 34.25994110, 135.68405151, 34.34471130, 135.68084717, 34.43779755, 135.67460632, 34.41091919, 135.67254639, 34.40884781, 135.66752625, 34.32962036, 135.66487122, 34.42524338, 135.66201782, 34.37860870, 135.65805054, 34.29612732, 135.65704346, 34.44551849, 135.65676880, 34.40697479, 135.65438843, 34.36631012, 135.65388489, 34.25082397, 135.64648438, 34.29161072, 135.64344788, 34.25370026, 135.62927246, 34.33645630, 135.62741089, 34.27054977, 135.62643433, 34.35960388, 135.62356567, 34.34106827, 135.61895752, 34.39946365 }; static void cpl_wcs_error_test(int); static void cpl_wcs_test_propertylist(const cpl_propertylist *); static void cpl_wcs_test_one(void); int main (void) { int i; double crval1, crval2, crpix1, crpix2, cd1, cd2, cd3, cd4; cpl_propertylist *pl,*opl; cpl_wcs *wcs; cpl_matrix *from,*xymat,*rdmat; cpl_matrix * to = NULL; cpl_array * status = NULL; const cpl_array * nullarray; const cpl_array * arrdims; const cpl_matrix * nullmatrix; const cpl_array *crval, *crpix; const cpl_matrix *cd; double d1,d2; cpl_error_code error; /* Initialise */ cpl_test_init(PACKAGE_BUGREPORT,CPL_MSG_WARNING); cpl_wcs_test_one(); cpl_wcs_error_test(1); /* Create a propertylist for the WCS header items */ pl = cpl_propertylist_new(); /* Use a non-empty propertylist with no WCS */ error = cpl_propertylist_append_double(pl, "EXPTIME", 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); wcs = cpl_wcs_new_from_propertylist(pl); /* Check that the WCS functions are provided */ if (cpl_error_get_code() == CPL_ERROR_NO_WCS) { cpl_test_error(CPL_ERROR_NO_WCS); cpl_test_null(wcs); cpl_msg_warning(cpl_func, "WCSLIB not found - skip cpl_wcs tests") ; cpl_propertylist_delete(pl) ; return cpl_test_end(0); } cpl_test_error(CPL_ERROR_UNSPECIFIED); cpl_test_null(wcs); /* Some NULL input tests */ wcs = cpl_wcs_new_from_propertylist(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(wcs); i = cpl_wcs_get_image_naxis(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_zero(i); nullarray = cpl_wcs_get_image_dims(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullarray); nullarray = cpl_wcs_get_crval(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullarray); nullarray = cpl_wcs_get_crpix(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullarray); nullmatrix = cpl_wcs_get_cd(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullmatrix); /* Create a matrix. physin is _not_ modified */ from = cpl_matrix_wrap(NP, 2, (double*)physin); /* Test handling of NULL wcs */ error = cpl_wcs_convert(NULL, from, &to, &status, CPL_WCS_PHYS2WORLD); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); cpl_test_null(to); cpl_test_null(status); /* Create the WCS header */ for (i = 0; i < NSK; i++) cpl_propertylist_append_string(pl,skeys[i],svals[i]); for (i = 0; i < NDK; i++) cpl_propertylist_append_double(pl,dkeys[i],dvals[i]); for (i = 0; i < NIK; i++) cpl_propertylist_append_int(pl,ikeys[i],ivals[i]); /* Get a wcs structure */ wcs = cpl_wcs_new_from_propertylist(pl); cpl_test_nonnull(wcs); cpl_propertylist_delete(pl); cpl_test_eq(cpl_wcs_get_image_naxis(wcs), 2); arrdims = cpl_wcs_get_image_dims(wcs); cpl_test_nonnull(arrdims); cpl_test_eq(cpl_array_get_type(arrdims), CPL_TYPE_INT); cpl_test_eq(cpl_array_get_size(arrdims), 2); for (i = 1; i < NIK; i++) { cpl_test_eq(cpl_array_get_int(arrdims, i-1, NULL), ivals[i]); } crval = cpl_wcs_get_crval(wcs); cpl_test_nonnull(crval); cpl_test_eq(cpl_array_get_type(crval), CPL_TYPE_DOUBLE); cpl_test_eq(cpl_array_get_size(crval), 2); crpix = cpl_wcs_get_crpix(wcs); cpl_test_nonnull(crpix); cpl_test_eq(cpl_array_get_type(crpix), CPL_TYPE_DOUBLE); cpl_test_eq(cpl_array_get_size(crpix), 2); cd = cpl_wcs_get_cd(wcs); cpl_test_nonnull(cd); cpl_test_eq(cpl_matrix_get_nrow(cd), 2); cpl_test_eq(cpl_matrix_get_ncol(cd), 2); /* Test cpl_wcs_convert to see if we get the correct error messages */ /* If wcs is NULL */ error = cpl_wcs_convert(NULL,from,&to,&status,CPL_WCS_PHYS2WORLD); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); cpl_test_null(to); cpl_test_null(status); /* If from is NULL */ error = cpl_wcs_convert(wcs,NULL,&to,&status,CPL_WCS_PHYS2WORLD); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); cpl_test_null(to); cpl_test_null(status); /* If to is NULL */ error = cpl_wcs_convert(wcs,from,NULL,&status,CPL_WCS_PHYS2WORLD); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); cpl_test_null(to); cpl_test_null(status); /* If status is NULL */ error = cpl_wcs_convert(wcs,from,&to,NULL,CPL_WCS_PHYS2WORLD); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); cpl_test_null(to); cpl_test_null(status); /* If the transformation is invalid */ error = cpl_wcs_convert(wcs, from, &to, &status, CPL_WCS_PHYS2STD + CPL_WCS_WORLD2STD); cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); cpl_test_null(to); cpl_test_null(status); /* Ok, do a conversion of physical to world coordinates */ cpl_msg_info("","Transform physical -> world (2 points)"); error = cpl_wcs_convert(wcs,from,&to,&status,CPL_WCS_PHYS2WORLD); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_nonnull(to); cpl_test_nonnull(status); (void)cpl_matrix_unwrap(from); /* Test the output values. The status should all be 0. The output matrix is compared to predefined world coordinate values */ for (i = 0; i < NP; i++) cpl_test_zero(cpl_array_get_data_int_const(status)[i]); cpl_test_abs(worldout[0], cpl_matrix_get(to, 0, 0), FLT_EPSILON); cpl_test_abs(worldout[1], cpl_matrix_get(to, 0, 1), FLT_EPSILON); cpl_test_abs(worldout[2], cpl_matrix_get(to, 1, 0), FLT_EPSILON); cpl_test_abs(worldout[3], cpl_matrix_get(to, 1, 1), FLT_EPSILON); d1 = fabs(worldout[0] - cpl_matrix_get(to,0,0)); d2 = fabs(worldout[1] - cpl_matrix_get(to,0,1)); cpl_msg_info("","phys1,phys2: %15.9f %15.9f",physin[0],physin[1]); cpl_msg_info("","world1,world2: %15.9f %15.9f",worldout[0],worldout[1]); cpl_msg_info("","calc1,calc2: %15.9f %15.9f",cpl_matrix_get(to,0,0), cpl_matrix_get(to,0,1)); cpl_msg_info("","diff1,diff2: %15.9f %15.9f",d1,d2); cpl_msg_info("","status: %d", cpl_array_get_data_int_const(status)[0]); d1 = fabs(worldout[2] - cpl_matrix_get(to,1,0)); d2 = fabs(worldout[3] - cpl_matrix_get(to,1,1)); cpl_msg_info("","phys1,phys2: %15.9f %15.9f",physin[2],physin[3]); cpl_msg_info("","world1,world2: %15.9f %15.9f",worldout[2],worldout[3]); cpl_msg_info("","calc1,calc2: %15.9f %15.9f",cpl_matrix_get(to,1,0), cpl_matrix_get(to,1,1)); cpl_msg_info("","diff1,diff2: %15.9f %15.9f",d1,d2); cpl_msg_info("","status: %d", (cpl_array_get_data_int_const(status)[1])); cpl_matrix_delete(to); cpl_array_delete(status); /* Do world to physical conversion */ cpl_msg_info("","Transform world -> physical"); /* worldin is _not_ modified */ from = cpl_matrix_wrap(1,2, (double*)worldin); error = cpl_wcs_convert(wcs,from,&to,&status,CPL_WCS_WORLD2PHYS); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_nonnull(to); cpl_test_nonnull(status); (void)cpl_matrix_unwrap(from); /* Test the output values again */ cpl_test_zero(cpl_array_get_data_int_const(status)[0]); cpl_test_abs(physout[0], cpl_matrix_get(to, 0, 0), 100.0 * FLT_EPSILON); cpl_test_abs(physout[1], cpl_matrix_get(to, 0, 1), 20.0 * FLT_EPSILON); d1 = fabs(physout[0] - cpl_matrix_get(to,0,0)); d2 = fabs(physout[1] - cpl_matrix_get(to,0,1)); cpl_msg_info("","world1,world2: %15.9f %15.9f",worldin[0],worldin[1]); cpl_msg_info("","phys1,phys2: %15.9f %15.9f",physout[0],physout[1]); cpl_msg_info("","calc1,calc2: %15.9f %15.9f",cpl_matrix_get(to,0,0), cpl_matrix_get(to,0,1)); cpl_msg_info("","diff1,diff2: %15.9f %15.9f",d1,d2); cpl_msg_info("","status: %d", cpl_array_get_data_int_const(status)[0]); cpl_matrix_delete(to); cpl_array_delete(status); /* Do physical to standard */ cpl_msg_info("","Transform physical -> standard"); /* physin is _not_ modified */ from = cpl_matrix_wrap(1, 2, (double*)physin); error = cpl_wcs_convert(wcs,from,&to,&status,CPL_WCS_PHYS2STD); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_nonnull(to); cpl_test_nonnull(status); (void)cpl_matrix_unwrap(from); /* Test the output values again */ cpl_test_zero(cpl_array_get_data_int_const(status)[0]); cpl_test_abs(stdcout[0], cpl_matrix_get(to, 0, 0), 1.7e-9); cpl_test_abs(stdcout[1], cpl_matrix_get(to, 0, 1), 1.7e-9); d1 = fabs(stdcout[0] - cpl_matrix_get(to,0,0)); d2 = fabs(stdcout[1] - cpl_matrix_get(to,0,1)); cpl_msg_info("","phys1,phys2: %15.9f %15.9f",physin[0],physin[1]); cpl_msg_info("","std1,std2: %15.9f %15.9f",stdcout[0],stdcout[1]); cpl_msg_info("","calc1,calc2: %15.9f %15.9f",cpl_matrix_get(to,0,0), cpl_matrix_get(to,0,1)); cpl_msg_info("","diff1,diff2: %15.9f %15.9f",d1,d2); cpl_msg_info("","status: %d", cpl_array_get_data_int_const(status)[0]); cpl_matrix_delete(to); cpl_array_delete(status); /* Do world to standard */ cpl_msg_info("","Transform world -> standard"); /* worldout is _not_ modified */ from = cpl_matrix_wrap(1, 2, (double*)worldout); error = cpl_wcs_convert(wcs, from, &to, &status, CPL_WCS_WORLD2STD); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_nonnull(to); cpl_test_nonnull(status); (void)cpl_matrix_unwrap(from); /* Test the output values again */ cpl_test_zero(cpl_array_get_data_int_const(status)[0]); cpl_test_abs(stdcout[0], cpl_matrix_get(to,0,0), 1.7e-9); cpl_test_abs(stdcout[1], cpl_matrix_get(to,0,1), 1.7e-9); d1 = fabs(stdcout[0] - cpl_matrix_get(to,0,0)); d2 = fabs(stdcout[1] - cpl_matrix_get(to,0,1)); cpl_msg_info("","world1,world2: %15.9f %15.9f",worldout[0],worldout[1]); cpl_msg_info("","std1,std2: %15.9f %15.9f",stdcout[0],stdcout[1]); cpl_msg_info("","calc1,calc2: %15.9f %15.9f",cpl_matrix_get(to,0,0), cpl_matrix_get(to,0,1)); cpl_msg_info("","diff1,diff2: %15.9f %15.9f",d1,d2); cpl_msg_info("","status: %d", cpl_array_get_data_int_const(status)[0]); cpl_matrix_delete(to); cpl_array_delete(status); /* Tidy */ cpl_wcs_delete(wcs); /* Do a WCS fit. Start by defining an input WCS */ pl = cpl_propertylist_new(); for (i = 0; i < NDK; i++) cpl_propertylist_append_double(pl,dkeys[i],dvals2[i]); for (i = 0; i < NSK; i++) cpl_propertylist_append_string(pl,skeys[i],svals2[i]); for (i = 0; i < NIK; i++) cpl_propertylist_append_int(pl,ikeys[i],ivals2[i]); /* Wrap the coordinates into matrices */ /* xy and radec are _not_ modified */ xymat = cpl_matrix_wrap(NSTDS, 2, (double*)xy); rdmat = cpl_matrix_wrap(NSTDS, 2, (double*)radec); if (cpl_msg_get_level() <= CPL_MSG_DEBUG) { cpl_matrix_dump(xymat, stdout); cpl_matrix_dump(rdmat, stdout); } /* Do 6 constant plate solution - first with failure checks */ error = cpl_wcs_platesol(NULL, rdmat, xymat, 3, 3.0,CPL_WCS_PLATESOL_6, CPL_WCS_MV_CRVAL,&opl); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); cpl_test_null(opl); error = cpl_wcs_platesol(pl, NULL, xymat, 3, 3.0,CPL_WCS_PLATESOL_6, CPL_WCS_MV_CRVAL,&opl); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); cpl_test_null(opl); error = cpl_wcs_platesol(pl, rdmat, NULL, 3, 3.0,CPL_WCS_PLATESOL_6, CPL_WCS_MV_CRVAL,&opl); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); cpl_test_null(opl); error = cpl_wcs_platesol(pl, rdmat, xymat, 3, 3.0,CPL_WCS_PLATESOL_6, CPL_WCS_MV_CRVAL, NULL); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_wcs_platesol(pl, rdmat, xymat, 3, 3.0, 2 * CPL_WCS_PLATESOL_4 + 2 * CPL_WCS_PLATESOL_6, CPL_WCS_MV_CRVAL,&opl); cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); cpl_test_null(opl); error = cpl_wcs_platesol(pl, rdmat, xymat, 3, 3.0,CPL_WCS_PLATESOL_6, 2 * CPL_WCS_MV_CRVAL + 2 * CPL_WCS_MV_CRPIX, &opl); cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); cpl_test_null(opl); error = cpl_wcs_platesol(pl,rdmat,xymat, 0, 3.0,CPL_WCS_PLATESOL_6, CPL_WCS_MV_CRVAL,&opl); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(opl); error = cpl_wcs_platesol(pl, rdmat, xymat, 3, 0.0, CPL_WCS_PLATESOL_6, CPL_WCS_MV_CRVAL, &opl); cpl_test_eq_error(error, CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(opl); /* Do 6 constant plate solution */ error = cpl_wcs_platesol(pl,rdmat,xymat,3,3.0,CPL_WCS_PLATESOL_6, CPL_WCS_MV_CRVAL,&opl); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_nonnull(opl); d1 = cpl_propertylist_get_double(opl,"CSYER1"); d2 = cpl_propertylist_get_double(opl,"CSYER2"); cpl_msg_info("","WCS 6 constant fit with errors: %20.12g %20.12g",d1,d2); cpl_test_leq(d1, 3.8e-5); cpl_test_leq(d2, 3.8e-5); cpl_wcs_test_propertylist(opl); if (cpl_msg_get_level() <= CPL_MSG_DEBUG) cpl_propertylist_dump(opl, stdout); cpl_propertylist_delete(opl); /* Do 6 constant plate solution - using CPL_WCS_MV_CRPIX */ error = cpl_wcs_platesol(pl,rdmat,xymat,3,3.0,CPL_WCS_PLATESOL_6, CPL_WCS_MV_CRPIX, &opl); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_nonnull(opl); d1 = cpl_propertylist_get_double(opl,"CSYER1"); d2 = cpl_propertylist_get_double(opl,"CSYER2"); cpl_msg_info("","WCS 6 constant fit with errors: %20.12g %20.12g",d1,d2); cpl_test_leq(d1, 3.8e-5); cpl_test_leq(d2, 3.8e-5); cpl_wcs_test_propertylist(opl); if (cpl_msg_get_level() <= CPL_MSG_DEBUG) cpl_propertylist_dump(opl, stdout); cpl_propertylist_delete(opl); /* Do 4 constant plate solution */ error = cpl_wcs_platesol(pl, rdmat, xymat, 3, 3.0, CPL_WCS_PLATESOL_4, CPL_WCS_MV_CRVAL, &opl); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_nonnull(opl); d1 = cpl_propertylist_get_double(opl,"CSYER1"); d2 = cpl_propertylist_get_double(opl,"CSYER2"); cpl_msg_info("","WCS 4 constant fit with errors: %20.12g %20.12g",d1,d2); cpl_test_leq(d1, 1.05e-4); cpl_test_leq(d2, 7.3e-5); cpl_wcs_test_propertylist(opl); if (cpl_msg_get_level() <= CPL_MSG_DEBUG) cpl_propertylist_dump(opl, stdout); cpl_propertylist_delete(opl); /* Do 4 constant plate solution - using CPL_WCS_MV_CRPIX */ error = cpl_wcs_platesol(pl, rdmat, xymat, 3, 3.0, CPL_WCS_PLATESOL_4, CPL_WCS_MV_CRPIX, &opl); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_nonnull(opl); d1 = cpl_propertylist_get_double(opl,"CSYER1"); d2 = cpl_propertylist_get_double(opl,"CSYER2"); cpl_msg_info("","WCS 6 constant fit with errors: %20.12g %20.12g",d1,d2); cpl_test_leq(d1, 1.05e-4); cpl_test_leq(d2, 7.3e-5); cpl_wcs_test_propertylist(opl); if (cpl_msg_get_level() <= CPL_MSG_DEBUG) cpl_propertylist_dump(opl, stdout); cpl_propertylist_delete(opl); /* Tidy a bit */ cpl_propertylist_delete(pl); (void)cpl_matrix_unwrap(xymat); (void)cpl_matrix_unwrap(rdmat); /* Test accessor functions */ pl = cpl_propertylist_new(); for (i = 0; i < NDK; i++) cpl_propertylist_append_double(pl,dkeys[i],dvals2[i]); for (i = 0; i < NSK; i++) cpl_propertylist_append_string(pl,skeys[i],svals2[i]); for (i = 0; i < NIK; i++) cpl_propertylist_append_int(pl,ikeys[i],ivals2[i]); wcs = cpl_wcs_new_from_propertylist(pl); cpl_test_nonnull(wcs); cpl_test_eq(cpl_wcs_get_image_naxis(wcs), 2); arrdims = cpl_wcs_get_image_dims(wcs); cpl_test_nonnull(arrdims); cpl_test_eq(cpl_array_get_type(arrdims), CPL_TYPE_INT); cpl_test_eq(cpl_array_get_size(arrdims), 2); for (i = 1; i < NIK; i++) { cpl_test_eq(cpl_array_get_int(arrdims, i-1, NULL), ivals2[i]); } crval = cpl_wcs_get_crval(wcs); cpl_test_nonnull(crval); cpl_test_eq(cpl_array_get_type(crval), CPL_TYPE_DOUBLE); cpl_test_eq(cpl_array_get_size(crval), 2); crpix = cpl_wcs_get_crpix(wcs); cpl_test_nonnull(crpix); cpl_test_eq(cpl_array_get_type(crpix), CPL_TYPE_DOUBLE); cpl_test_eq(cpl_array_get_size(crpix), 2); cd = cpl_wcs_get_cd(wcs); cpl_test_nonnull(cd); cpl_test_eq(cpl_matrix_get_nrow(cd), 2); cpl_test_eq(cpl_matrix_get_ncol(cd), 2); crval1 = cpl_array_get_double(crval, 0, NULL); cpl_test_eq(crval1, dvals2[0]); crval2 = cpl_array_get_double(crval, 1, NULL); cpl_test_eq(crval2, dvals2[1]); crpix1 = cpl_array_get_double(crpix, 0, NULL); cpl_test_eq(crpix1, dvals2[2]); crpix2 = cpl_array_get_double(crpix, 1, NULL); cpl_test_eq(crpix2, dvals2[3]); cd1 = cpl_matrix_get(cd, 0, 0); cpl_test_eq(cd1, dvals2[4]); cd2 = cpl_matrix_get(cd, 0, 1); cpl_test_eq(cd2, dvals2[5]); cd3 = cpl_matrix_get(cd, 1, 0); cpl_test_eq(cd3, dvals2[6]); cd4 = cpl_matrix_get(cd, 1, 1); cpl_test_eq(cd4, dvals2[7]); /* Tidy */ cpl_propertylist_delete(pl); cpl_wcs_delete(wcs); /* See if we can parse the table style keywords */ pl = cpl_propertylist_new(); for (i = 0; i < NDK; i++) cpl_propertylist_append_double(pl,dkeys_tab[i],dvals[i]); for (i = 0; i < NSK; i++) cpl_propertylist_append_string(pl,skeys_tab[i],svals[i]); wcs = cpl_wcs_new_from_propertylist(pl); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(wcs); /* Tidy */ cpl_propertylist_delete(pl); cpl_wcs_delete(wcs); /* Are there any memory leaks (NB: this only covers CPL. Memory is allocated separately by WCSLIB */ return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test cpl_wcs_new_from_propertylist() using a specified propertylist @param self The propertylist to test, must be non-NULL and with NAXIS == 0 @return void @see cpl_wcs_new_from_propertylist() FIXME: Add more validation */ /*----------------------------------------------------------------------------*/ static void cpl_wcs_test_propertylist(const cpl_propertylist * self) { cpl_wcs * wcs = cpl_wcs_new_from_propertylist(self); const int naxis = cpl_wcs_get_image_naxis(wcs); const cpl_array * ardims = cpl_wcs_get_image_dims(wcs); const cpl_array * arcrval = cpl_wcs_get_crval(wcs); const cpl_array * arcrpix = cpl_wcs_get_crpix(wcs); const cpl_matrix * mtcd = cpl_wcs_get_cd(wcs); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(wcs); cpl_test_zero(naxis); cpl_test_null(ardims); cpl_test_nonnull(arcrval); cpl_test_eq(cpl_array_get_size(arcrval), 2); cpl_test_nonnull(arcrpix); cpl_test_eq(cpl_array_get_size(arcrpix), 2); cpl_test_nonnull(mtcd); cpl_test_eq(cpl_matrix_get_nrow(mtcd), 2); cpl_test_eq(cpl_matrix_get_ncol(mtcd), 2); cpl_wcs_delete(wcs); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test cpl_error_wcs_set() @param The number of WCS error codes to test @return void @note The number of error messages in WCSLIB 4.4.4 is 14 */ /*----------------------------------------------------------------------------*/ static void cpl_wcs_error_test(int nerror) { int i; for (i = -1; i < nerror; i++) { cpl_error_code error; error = cpl_error_set_wcs(CPL_ERROR_NONE, i, "my_wcs_dummy", "OK"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_error_set_wcs(CPL_ERROR_EOL, i, "my_wcs_dummy", "FAIL"); cpl_test_eq_error(error, CPL_ERROR_EOL); } } /*----------------------------------------------------------------------------*/ /** @internal @brief Test a header from a specific file, nonaxis.fits, w. NAXIS=0 @return void */ /*----------------------------------------------------------------------------*/ static void cpl_wcs_test_one(void) { cpl_propertylist * pl = cpl_propertylist_load(TESTFILE, 0); cpl_msg_info(cpl_func, "Testing " TESTFILE ": %p", (const void*)pl); if (pl == NULL) { /* Ignore errors */ cpl_test_error(cpl_error_get_code()); } else { cpl_wcs_test_propertylist(pl); cpl_propertylist_delete(pl); } } cpl-6.4.1/cpldrs/tests/cpl_apertures-test.c0000644000460300003120000004773211737034437015662 00000000000000/* $Id: cpl_apertures-test.c,v 1.41 2012-04-04 12:05:51 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-04-04 12:05:51 $ * $Revision: 1.41 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include "cpl_apertures.h" /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ #define IMAGESZ 10 #define IMAGESZ2 512 #define CPL_APERTS_CMP_IMAGE(OP) \ do { \ cpl_test_abs( CPL_CONCAT(cpl_apertures_get, OP)(aperts, 1), \ CPL_CONCAT2X(cpl_image_get, CPL_CONCAT(OP,window)) \ (imb, 1, 1, IMAGESZ, IMAGESZ), \ 4.0 * DBL_EPSILON); \ } while (0) /*----------------------------------------------------------------------------- Private functions -----------------------------------------------------------------------------*/ static void cpl_apertures_test_one(const cpl_apertures *, FILE *); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { const cpl_type img_type[] = {CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT}; cpl_size (*ap_get_cpl_size[])(const cpl_apertures *, cpl_size) = {cpl_apertures_get_maxpos_x, cpl_apertures_get_maxpos_y, cpl_apertures_get_minpos_x, cpl_apertures_get_minpos_y, cpl_apertures_get_npix, cpl_apertures_get_left, cpl_apertures_get_left_y, cpl_apertures_get_right, cpl_apertures_get_right_y, cpl_apertures_get_top_x, cpl_apertures_get_top, cpl_apertures_get_bottom_x, cpl_apertures_get_bottom}; const size_t napsize = sizeof(ap_get_cpl_size)/sizeof(*ap_get_cpl_size); double (*ap_get_double_pos[])(const cpl_apertures *, cpl_size) = { cpl_apertures_get_pos_x, cpl_apertures_get_pos_y, cpl_apertures_get_centroid_x, cpl_apertures_get_centroid_y}; const size_t napdpos = sizeof(ap_get_double_pos)/sizeof(*ap_get_double_pos); double (*ap_get_double[])(const cpl_apertures *, cpl_size) = { cpl_apertures_get_max, cpl_apertures_get_min, cpl_apertures_get_mean, cpl_apertures_get_median, cpl_apertures_get_stdev, cpl_apertures_get_flux}; const size_t napdbl = sizeof(ap_get_double)/sizeof(*ap_get_double); size_t isize; cpl_image * imd; cpl_mask * bpm; cpl_apertures * aperts; cpl_apertures * nullapert; double * val; const double psigmas[] = {5, 2, 1, 0.5}; const double maxval = 10.0; cpl_vector * sigmas; unsigned itype; FILE * stream; cpl_error_code error; cpl_size errsize, nsize, pos; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; /* Test 1: NULL pointers */ cpl_apertures_delete(NULL); /* Just verify the return */ cpl_apertures_dump(NULL, NULL); /* Just verify the return */ cpl_apertures_dump(NULL, stream); /* Just verify the return */ for (isize = 0; isize < napsize; isize++) { errsize = ap_get_cpl_size[isize](NULL, 1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_lt(errsize, 0.0); } for (isize = 0; isize < napdpos; isize++) { const double errpos = ap_get_double_pos[isize](NULL, 1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_lt(errpos, 0.0); } for (isize = 0; isize < napdbl; isize++) { (void)ap_get_double[isize](NULL, 1); cpl_test_error(CPL_ERROR_NULL_INPUT); } /* Statistics computation */ nullapert = cpl_apertures_new_from_image(NULL, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullapert); /* Accessor functions */ errsize = cpl_apertures_get_size(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(errsize, -1); /* Sorting functions */ error = cpl_apertures_sort_by_npix(NULL); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_apertures_sort_by_max(NULL); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_apertures_sort_by_flux(NULL); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); /* Detection functions */ nullapert = cpl_apertures_extract(NULL, NULL, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullapert); nullapert = cpl_apertures_extract_window(NULL, NULL, 1, 1, 2, 2, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullapert); nullapert = cpl_apertures_extract_sigma(NULL, 1.0); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullapert); imd = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE); val = cpl_image_get_data_double(imd); val[33] = val[34] = val[35] = val[36] = 1.0; val[43] = val[44] = val[45] = val[46] = 1.0; val[53] = val[54] = val[56] = 1.0; val[55] = maxval; val[63] = val[64] = val[65] = val[66] = 1.0; val[88] = 2.0 * maxval; bpm = cpl_mask_threshold_image_create(imd, 0.5, 0.5 + maxval); error = cpl_mask_not(bpm); cpl_test_eq_error(error, CPL_ERROR_NONE); for (itype = 0; itype < sizeof(img_type)/sizeof(img_type[0]); itype++) { const cpl_size naperts = 2; const cpl_type type = img_type[itype]; cpl_image * labels = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_INT); cpl_image * img = cpl_image_cast(imd, type); cpl_image * imb = cpl_image_duplicate(img); cpl_mask * bin; cpl_size xpos, ypos; error = cpl_image_reject_from_mask(imb, bpm); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Create test image and the labels */ cpl_msg_info(cpl_func, "Testing with a %d X %d %s-image", IMAGESZ, IMAGESZ, cpl_type_get_name(type)); /* Test 3: with a 'bad' label image */ nullapert = cpl_apertures_new_from_image(img, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullapert); cpl_test_nonnull(labels); nullapert = cpl_apertures_new_from_image(img, labels); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullapert); error = cpl_image_set(labels, 1, 1, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); aperts = cpl_apertures_new_from_image(img, labels); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(aperts); cpl_apertures_test_one(aperts, stream); nsize = cpl_apertures_get_size(aperts); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(nsize, 1); cpl_apertures_delete(aperts); if (type != CPL_TYPE_INT) { /* Test (error) handling of a complex image */ cpl_image * imgc = cpl_image_cast(imd, type | CPL_TYPE_COMPLEX); aperts = cpl_apertures_new_from_image(imgc, labels); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null(aperts); cpl_image_delete(imgc); } /* Test other error handling */ error = cpl_image_set(labels, 1, 1, 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); aperts = cpl_apertures_new_from_image(img, labels); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(aperts); cpl_image_delete(labels); /* Test 4: Thresholding */ bin = cpl_mask_threshold_image_create(img, 0.5, DBL_MAX); cpl_test_nonnull(bin); labels = cpl_image_labelise_mask_create(bin, NULL); cpl_test_nonnull(labels); cpl_mask_delete(bin); /* Compute statistics on the apertures */ cpl_msg_info("","Compute statistics on detected apertures"); aperts = cpl_apertures_new_from_image(img, labels); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(aperts); cpl_apertures_dump(aperts, NULL); /* Just verify the return */ nsize = cpl_apertures_get_size(aperts); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(nsize, naperts); error = cpl_apertures_sort_by_npix(aperts); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_apertures_test_one(aperts, stream); cpl_msg_info("","Compare statistics with those from same " "image with %" CPL_SIZE_FORMAT "rejected pixels", cpl_image_count_rejected(imb)); cpl_test_eq(cpl_apertures_get_npix(aperts, 1), IMAGESZ * IMAGESZ - cpl_image_count_rejected(imb)); CPL_APERTS_CMP_IMAGE(min); CPL_APERTS_CMP_IMAGE(max); CPL_APERTS_CMP_IMAGE(mean); CPL_APERTS_CMP_IMAGE(median); CPL_APERTS_CMP_IMAGE(stdev); CPL_APERTS_CMP_IMAGE(flux); CPL_APERTS_CMP_IMAGE(centroid_x); CPL_APERTS_CMP_IMAGE(centroid_y); error = cpl_image_get_maxpos(imb, &xpos, &ypos); cpl_test_eq(cpl_apertures_get_left(aperts, 1), 4); cpl_test_eq(cpl_apertures_get_right(aperts, 1), 7); cpl_test_eq(cpl_apertures_get_left_y(aperts, 1), 4); cpl_test_eq(cpl_apertures_get_right_y(aperts, 1), 4); cpl_test_eq(cpl_apertures_get_bottom(aperts, 1), 4); cpl_test_eq(cpl_apertures_get_top(aperts, 1), 7); cpl_test_eq(cpl_apertures_get_bottom_x(aperts, 1), 4); cpl_test_eq(cpl_apertures_get_top_x(aperts, 1), 4); cpl_test_leq(cpl_apertures_get_left(aperts, 1), xpos); cpl_test_leq(xpos, cpl_apertures_get_right(aperts, 1)); cpl_test_leq(cpl_apertures_get_bottom(aperts, 1), ypos); cpl_test_leq(ypos, cpl_apertures_get_top(aperts, 1)); cpl_apertures_delete(aperts); /* Set a bad pixel and recompute the apertures */ error = cpl_image_reject(img, 6, 6); cpl_test_eq_error(error, CPL_ERROR_NONE); aperts = cpl_apertures_new_from_image(img, labels); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(aperts); cpl_apertures_test_one(aperts, stream); nsize = cpl_apertures_get_size(aperts); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(nsize, naperts); error = cpl_image_set(labels, IMAGESZ, IMAGESZ, -1.0); nullapert = cpl_apertures_new_from_image(img, labels); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullapert); cpl_image_delete(labels); /* Get the biggest object */ cpl_msg_info("","Get the biggest aperture:"); error = cpl_apertures_sort_by_npix(aperts); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_msg_info("","number of pixels: %" CPL_SIZE_FORMAT, cpl_apertures_get_npix(aperts, 1)); cpl_apertures_test_one(aperts, stream); cpl_test_leq(cpl_apertures_get_npix(aperts, 2), cpl_apertures_get_npix(aperts, 1)); /* Get the brightest object */ cpl_msg_info("","Get the brightest aperture:"); error = cpl_apertures_sort_by_flux(aperts); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_msg_info("","flux: %g", cpl_apertures_get_flux(aperts, 1)); cpl_apertures_test_one(aperts, stream); cpl_test_leq(cpl_apertures_get_flux(aperts, 2), cpl_apertures_get_flux(aperts, 1)); /* Get the aperture with the highest peak */ cpl_msg_info("","Get the aperture with the highest peak:"); error = cpl_apertures_sort_by_max(aperts); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_msg_info("","maximum value: %g", cpl_apertures_get_max(aperts, 1)); cpl_apertures_test_one(aperts, stream); cpl_test_abs(cpl_apertures_get_max(aperts, 1), cpl_image_get_max(img), 0.0); cpl_test_leq(cpl_apertures_get_max(aperts, 2), cpl_apertures_get_max(aperts, 1)); for (isize = 0; isize < napsize; isize++) { errsize = ap_get_cpl_size[isize](aperts, 0); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_lt(errsize, 0.0); errsize = ap_get_cpl_size[isize](aperts, 1+naperts); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_lt(errsize, 0.0); } for (isize = 0; isize < napdpos; isize++) { double errpos = ap_get_double_pos[isize](aperts, 0); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_lt(errpos, 0.0); errpos = ap_get_double_pos[isize](aperts, 1+naperts); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_lt(errpos, 0.0); } for (isize = 0; isize < napdbl; isize++) { (void)ap_get_double[isize](aperts, 0); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); (void)ap_get_double[isize](aperts, 1+naperts); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); } cpl_apertures_delete(aperts); cpl_image_delete(imb); cpl_image_delete(img); } cpl_image_delete(imd); /* Create a new test image */ imd = cpl_image_fill_test_create(IMAGESZ2, IMAGESZ2); sigmas = cpl_vector_wrap(4, (double*)psigmas); /* Test cpl_apertures_extract() */ cpl_msg_info("","Test the apertures detection with a thresholding method"); aperts = cpl_apertures_extract(imd, sigmas, &pos); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(aperts); cpl_apertures_test_one(aperts, stream); cpl_apertures_delete(aperts); /* Test error handling of cpl_apertures_extract_sigma() */ nullapert = cpl_apertures_extract_sigma(imd, 100.0); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(nullapert); /* Test error handling of cpl_apertures_extract_mask() */ nullapert = cpl_apertures_extract_mask(imd, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullapert); cpl_mask_delete(bpm); bpm = cpl_mask_new(IMAGESZ2, IMAGESZ2); nullapert = cpl_apertures_extract_mask(imd, bpm); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(nullapert); /* Test cpl_apertures_extract_window() */ cpl_msg_info("","Test the apertures detection (threshold) on a zone"); aperts = cpl_apertures_extract_window(imd, sigmas, IMAGESZ2/4, IMAGESZ2/4, 3*IMAGESZ2/4, 3*IMAGESZ2/4, &pos); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(aperts); cpl_apertures_test_one(aperts, stream); nsize = cpl_apertures_get_size(aperts); cpl_test_error(CPL_ERROR_NONE); error = cpl_apertures_sort_by_max(aperts); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(nsize, cpl_apertures_get_size(aperts)); cpl_apertures_test_one(aperts, stream); for (pos = 1; pos < nsize; pos++) { cpl_test_leq(cpl_apertures_get_max(aperts, pos+1), cpl_apertures_get_max(aperts, pos)); } error = cpl_apertures_sort_by_npix(aperts); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(nsize, cpl_apertures_get_size(aperts)); cpl_apertures_test_one(aperts, stream); for (pos = 1; pos < nsize; pos++) { cpl_test_leq(cpl_apertures_get_npix(aperts, pos+1), cpl_apertures_get_npix(aperts, pos)); } error = cpl_apertures_sort_by_flux(aperts); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(nsize, cpl_apertures_get_size(aperts)); cpl_apertures_test_one(aperts, stream); for (pos = 1; pos < nsize; pos++) { cpl_test_leq(cpl_apertures_get_flux(aperts, pos+1), cpl_apertures_get_flux(aperts, pos)); } cpl_vector_unwrap(sigmas); cpl_apertures_delete(aperts); cpl_image_delete(imd); cpl_mask_delete(bpm); if (stream != stdout) cpl_test_zero( fclose(stream) ); return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Subject the aperture to some self-consistency checks @param self The object to test @param stream The stream to dump to @return void */ /*----------------------------------------------------------------------------*/ static void cpl_apertures_test_one(const cpl_apertures * self, FILE * stream) { const cpl_size nsize = cpl_apertures_get_size(self); cpl_size i; cpl_test_error(CPL_ERROR_NONE); cpl_test(nsize); cpl_apertures_dump(self, stream); for (i = 1; i <= nsize; i++) { const cpl_size npix = cpl_apertures_get_npix(self, i); cpl_test_error(CPL_ERROR_NONE); cpl_test(npix); if (npix == 1) { const double stdev_err = cpl_apertures_get_stdev(self, i); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_lt(stdev_err, 0.0); } cpl_test_leq(cpl_apertures_get_left(self, i), cpl_apertures_get_pos_x(self, i)); cpl_test_leq(cpl_apertures_get_pos_x(self, i), cpl_apertures_get_right(self, i)); cpl_test_leq(cpl_apertures_get_bottom(self, i), cpl_apertures_get_pos_y(self, i)); cpl_test_leq(cpl_apertures_get_pos_y(self, i), cpl_apertures_get_top(self, i)); cpl_test_leq(cpl_apertures_get_left(self, i), cpl_apertures_get_maxpos_x(self, i)); cpl_test_leq(cpl_apertures_get_maxpos_x(self, i), cpl_apertures_get_right(self, i)); cpl_test_leq(cpl_apertures_get_bottom(self, i), cpl_apertures_get_maxpos_y(self, i)); cpl_test_leq(cpl_apertures_get_maxpos_y(self, i), cpl_apertures_get_top(self, i)); cpl_test_leq(cpl_apertures_get_left(self, i), cpl_apertures_get_minpos_x(self, i)); cpl_test_leq(cpl_apertures_get_minpos_x(self, i), cpl_apertures_get_right(self, i)); cpl_test_leq(cpl_apertures_get_bottom(self, i), cpl_apertures_get_minpos_y(self, i)); cpl_test_leq(cpl_apertures_get_minpos_y(self, i), cpl_apertures_get_top(self, i)); cpl_test_leq(cpl_apertures_get_min(self, i), cpl_apertures_get_mean(self, i)); cpl_test_leq(cpl_apertures_get_mean(self, i), cpl_apertures_get_max(self, i)); cpl_test_leq(cpl_apertures_get_min(self, i), cpl_apertures_get_median(self, i)); cpl_test_leq(cpl_apertures_get_median(self, i), cpl_apertures_get_max(self, i)); cpl_test_error(CPL_ERROR_NONE); } } cpl-6.4.1/cpldrs/tests/Makefile.in0000644000460300003120000012041312310332724013706 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = cpl_fit-test$(EXEEXT) cpl_apertures-test$(EXEEXT) \ cpl_geom_img-test$(EXEEXT) cpl_detector-test$(EXEEXT) \ cpl_photom-test$(EXEEXT) cpl_wcs-test$(EXEEXT) \ cpl_wlcalib-test$(EXEEXT) cpl_ppm-test$(EXEEXT) \ cpl_fft-test$(EXEEXT) TESTS = cpl_fit-test$(EXEEXT) cpl_apertures-test$(EXEEXT) \ cpl_geom_img-test$(EXEEXT) cpl_detector-test$(EXEEXT) \ cpl_photom-test$(EXEEXT) cpl_wcs-test$(EXEEXT) \ cpl_wlcalib-test$(EXEEXT) cpl_ppm-test$(EXEEXT) \ cpl_fft-test$(EXEEXT) XFAIL_TESTS = subdir = cpldrs/tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/admin/depcomp $(top_srcdir)/admin/test-driver ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/cpl.m4 $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/omp.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_cpl_apertures_test_OBJECTS = cpl_apertures-test.$(OBJEXT) cpl_apertures_test_OBJECTS = $(am_cpl_apertures_test_OBJECTS) cpl_apertures_test_LDADD = $(LDADD) am__DEPENDENCIES_1 = cpl_apertures_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_cpl_detector_test_OBJECTS = cpl_detector-test.$(OBJEXT) cpl_detector_test_OBJECTS = $(am_cpl_detector_test_OBJECTS) cpl_detector_test_LDADD = $(LDADD) cpl_detector_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_cpl_fft_test_OBJECTS = cpl_fft-test.$(OBJEXT) cpl_fft_test_OBJECTS = $(am_cpl_fft_test_OBJECTS) cpl_fft_test_LDADD = $(LDADD) cpl_fft_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_cpl_fit_test_OBJECTS = cpl_fit-test.$(OBJEXT) cpl_fit_test_OBJECTS = $(am_cpl_fit_test_OBJECTS) cpl_fit_test_LDADD = $(LDADD) cpl_fit_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_cpl_geom_img_test_OBJECTS = cpl_geom_img-test.$(OBJEXT) cpl_geom_img_test_OBJECTS = $(am_cpl_geom_img_test_OBJECTS) cpl_geom_img_test_LDADD = $(LDADD) cpl_geom_img_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_cpl_photom_test_OBJECTS = cpl_photom-test.$(OBJEXT) cpl_photom_test_OBJECTS = $(am_cpl_photom_test_OBJECTS) cpl_photom_test_LDADD = $(LDADD) cpl_photom_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_cpl_ppm_test_OBJECTS = cpl_ppm-test.$(OBJEXT) cpl_ppm_test_OBJECTS = $(am_cpl_ppm_test_OBJECTS) cpl_ppm_test_LDADD = $(LDADD) cpl_ppm_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_cpl_wcs_test_OBJECTS = cpl_wcs-test.$(OBJEXT) cpl_wcs_test_OBJECTS = $(am_cpl_wcs_test_OBJECTS) cpl_wcs_test_LDADD = $(LDADD) cpl_wcs_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_cpl_wlcalib_test_OBJECTS = cpl_wlcalib-test.$(OBJEXT) cpl_wlcalib_test_OBJECTS = $(am_cpl_wlcalib_test_OBJECTS) cpl_wlcalib_test_LDADD = $(LDADD) cpl_wlcalib_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(cpl_apertures_test_SOURCES) $(cpl_detector_test_SOURCES) \ $(cpl_fft_test_SOURCES) $(cpl_fit_test_SOURCES) \ $(cpl_geom_img_test_SOURCES) $(cpl_photom_test_SOURCES) \ $(cpl_ppm_test_SOURCES) $(cpl_wcs_test_SOURCES) \ $(cpl_wlcalib_test_SOURCES) DIST_SOURCES = $(cpl_apertures_test_SOURCES) \ $(cpl_detector_test_SOURCES) $(cpl_fft_test_SOURCES) \ $(cpl_fit_test_SOURCES) $(cpl_geom_img_test_SOURCES) \ $(cpl_photom_test_SOURCES) $(cpl_ppm_test_SOURCES) \ $(cpl_wcs_test_SOURCES) $(cpl_wlcalib_test_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/admin/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/admin/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFITSIO_INCLUDES = @CFITSIO_INCLUDES@ CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@ CFLAGS = @CFLAGS@ CPLCORE_INCLUDES = @CPLCORE_INCLUDES@ CPLDFS_INCLUDES = @CPLDFS_INCLUDES@ CPLDRS_INCLUDES = @CPLDRS_INCLUDES@ CPLUI_INCLUDES = @CPLUI_INCLUDES@ CPL_BINARY_AGE = @CPL_BINARY_AGE@ CPL_BINARY_VERSION = @CPL_BINARY_VERSION@ CPL_CFLAGS = @CPL_CFLAGS@ CPL_INTERFACE_AGE = @CPL_INTERFACE_AGE@ CPL_LDFLAGS = @CPL_LDFLAGS@ CPL_MAJOR_VERSION = @CPL_MAJOR_VERSION@ CPL_MICRO_VERSION = @CPL_MICRO_VERSION@ CPL_MINOR_VERSION = @CPL_MINOR_VERSION@ CPL_VERSION = @CPL_VERSION@ CPL_VERSION_STRING = @CPL_VERSION_STRING@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_INCLUDES = @CX_INCLUDES@ CX_LDFLAGS = @CX_LDFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FFTWF_INCLUDES = @FFTWF_INCLUDES@ FFTWF_LDFLAGS = @FFTWF_LDFLAGS@ FFTW_INCLUDES = @FFTW_INCLUDES@ FFTW_LDFLAGS = @FFTW_LDFLAGS@ FGREP = @FGREP@ GASGANO_CLASSPATH = @GASGANO_CLASSPATH@ GASGANO_SHREXT = @GASGANO_SHREXT@ GREP = @GREP@ INCLTDL = @INCLTDL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JAVA_INCLUDES = @JAVA_INCLUDES@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCEXT = @LIBCEXT@ LIBCFITSIO = @LIBCFITSIO@ LIBCPLCORE = @LIBCPLCORE@ LIBCPLDFS = @LIBCPLDFS@ LIBCPLDRS = @LIBCPLDRS@ LIBCPLUI = @LIBCPLUI@ LIBFFTW = @LIBFFTW@ LIBFFTWF = @LIBFFTWF@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBWCS = @LIBWCS@ LIPO = @LIPO@ LN_S = @LN_S@ LTDLDEPS = @LTDLDEPS@ LTDLINCL = @LTDLINCL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ WCS_INCLUDES = @WCS_INCLUDES@ WCS_LDFLAGS = @WCS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ cpl_includes = @cpl_includes@ cpl_libraries = @cpl_libraries@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libcext = @libcext@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in AM_CPPFLAGS = $(CPLDRS_INCLUDES) $(CPLCORE_INCLUDES) $(CX_INCLUDES) \ $(CFITSIO_INCLUDES) $(WCS_INCLUDES) \ $(CPL_CFLAGS) LDADD = $(LIBCPLDRS) $(LIBCPLCORE) $(LIBWCS) -lm AM_LDFLAGS = $(WCS_LDFLAGS) cpl_fit_test_SOURCES = cpl_fit-test.c cpl_apertures_test_SOURCES = cpl_apertures-test.c cpl_detector_test_SOURCES = cpl_detector-test.c cpl_geom_img_test_SOURCES = cpl_geom_img-test.c cpl_photom_test_SOURCES = cpl_photom-test.c cpl_wcs_test_SOURCES = cpl_wcs-test.c cpl_wlcalib_test_SOURCES = cpl_wlcalib-test.c cpl_ppm_test_SOURCES = cpl_ppm-test.c cpl_fft_test_SOURCES = cpl_fft-test.c # Be sure to reexport important environment variables. TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cpldrs/tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign cpldrs/tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list cpl_apertures-test$(EXEEXT): $(cpl_apertures_test_OBJECTS) $(cpl_apertures_test_DEPENDENCIES) $(EXTRA_cpl_apertures_test_DEPENDENCIES) @rm -f cpl_apertures-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_apertures_test_OBJECTS) $(cpl_apertures_test_LDADD) $(LIBS) cpl_detector-test$(EXEEXT): $(cpl_detector_test_OBJECTS) $(cpl_detector_test_DEPENDENCIES) $(EXTRA_cpl_detector_test_DEPENDENCIES) @rm -f cpl_detector-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_detector_test_OBJECTS) $(cpl_detector_test_LDADD) $(LIBS) cpl_fft-test$(EXEEXT): $(cpl_fft_test_OBJECTS) $(cpl_fft_test_DEPENDENCIES) $(EXTRA_cpl_fft_test_DEPENDENCIES) @rm -f cpl_fft-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_fft_test_OBJECTS) $(cpl_fft_test_LDADD) $(LIBS) cpl_fit-test$(EXEEXT): $(cpl_fit_test_OBJECTS) $(cpl_fit_test_DEPENDENCIES) $(EXTRA_cpl_fit_test_DEPENDENCIES) @rm -f cpl_fit-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_fit_test_OBJECTS) $(cpl_fit_test_LDADD) $(LIBS) cpl_geom_img-test$(EXEEXT): $(cpl_geom_img_test_OBJECTS) $(cpl_geom_img_test_DEPENDENCIES) $(EXTRA_cpl_geom_img_test_DEPENDENCIES) @rm -f cpl_geom_img-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_geom_img_test_OBJECTS) $(cpl_geom_img_test_LDADD) $(LIBS) cpl_photom-test$(EXEEXT): $(cpl_photom_test_OBJECTS) $(cpl_photom_test_DEPENDENCIES) $(EXTRA_cpl_photom_test_DEPENDENCIES) @rm -f cpl_photom-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_photom_test_OBJECTS) $(cpl_photom_test_LDADD) $(LIBS) cpl_ppm-test$(EXEEXT): $(cpl_ppm_test_OBJECTS) $(cpl_ppm_test_DEPENDENCIES) $(EXTRA_cpl_ppm_test_DEPENDENCIES) @rm -f cpl_ppm-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_ppm_test_OBJECTS) $(cpl_ppm_test_LDADD) $(LIBS) cpl_wcs-test$(EXEEXT): $(cpl_wcs_test_OBJECTS) $(cpl_wcs_test_DEPENDENCIES) $(EXTRA_cpl_wcs_test_DEPENDENCIES) @rm -f cpl_wcs-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_wcs_test_OBJECTS) $(cpl_wcs_test_LDADD) $(LIBS) cpl_wlcalib-test$(EXEEXT): $(cpl_wlcalib_test_OBJECTS) $(cpl_wlcalib_test_DEPENDENCIES) $(EXTRA_cpl_wlcalib_test_DEPENDENCIES) @rm -f cpl_wlcalib-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_wlcalib_test_OBJECTS) $(cpl_wlcalib_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_apertures-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_detector-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_fft-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_fit-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_geom_img-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_photom-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_ppm-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_wcs-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_wlcalib-test.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # exand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ else \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? cpl_fit-test.log: cpl_fit-test$(EXEEXT) @p='cpl_fit-test$(EXEEXT)'; \ b='cpl_fit-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_apertures-test.log: cpl_apertures-test$(EXEEXT) @p='cpl_apertures-test$(EXEEXT)'; \ b='cpl_apertures-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_geom_img-test.log: cpl_geom_img-test$(EXEEXT) @p='cpl_geom_img-test$(EXEEXT)'; \ b='cpl_geom_img-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_detector-test.log: cpl_detector-test$(EXEEXT) @p='cpl_detector-test$(EXEEXT)'; \ b='cpl_detector-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_photom-test.log: cpl_photom-test$(EXEEXT) @p='cpl_photom-test$(EXEEXT)'; \ b='cpl_photom-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_wcs-test.log: cpl_wcs-test$(EXEEXT) @p='cpl_wcs-test$(EXEEXT)'; \ b='cpl_wcs-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_wlcalib-test.log: cpl_wlcalib-test$(EXEEXT) @p='cpl_wlcalib-test$(EXEEXT)'; \ b='cpl_wlcalib-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_ppm-test.log: cpl_ppm-test$(EXEEXT) @p='cpl_ppm-test$(EXEEXT)'; \ b='cpl_ppm-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_fft-test.log: cpl_fft-test$(EXEEXT) @p='cpl_fft-test$(EXEEXT)'; \ b='cpl_fft-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool clean-local \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am # We need to remove any files that the above tests created. clean-local: $(RM) planck1.txt planck2.txt *.log @USE_PURIFY_TRUE@include $(top_builddir)/Makefile.purify # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/cpldrs/tests/cpl_fft-test.c0000644000460300003120000007715012224721006014407 00000000000000/* $Id: cpl_fft-test.c,v 1.38 2013-10-08 06:11:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-10-08 06:11:18 $ * $Revision: 1.38 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_fft.h" #include "cpl_test.h" #include "cpl_image_io_impl.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef IMAGESZ #define IMAGESZ 10 #endif #ifndef IMAGENZ #define IMAGENZ 5 #endif #ifndef CONSTANT #define CONSTANT 200 #endif /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_fft_test Unit tests of the CPL FFT functions */ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------- Private Function prototypes -----------------------------------------------------------------------------*/ static void cpl_fft_image_test(void); #if defined CPL_FFTWF_INSTALLED || defined CPL_FFTW_INSTALLED static void cpl_fft_image_test_one(cpl_size, cpl_size, cpl_type); static void cpl_fft_imagelist_test_one(cpl_size, cpl_size, cpl_size, cpl_type); static void cpl_fft_imagelist_test_image(cpl_size, cpl_size, cpl_size, cpl_type); static void cpl_fft_image_test_correlate(cpl_size, cpl_size, cpl_type); #endif /*----------------------------------------------------------------------------*/ /** @brief Unit tests of cpl_fft module **/ /*----------------------------------------------------------------------------*/ int main(void) { const cpl_type imtypes[] = {CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT}; cpl_boolean do_bench; int i; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); do_bench = cpl_msg_get_level() <= CPL_MSG_INFO; /* Insert tests below */ #ifdef _OPENMP #pragma omp parallel for private(i) #endif for (i = 0; i < 2; i++) { const cpl_size mz = do_bench ? 10 * IMAGENZ : IMAGENZ; cpl_size nz; /* Collect wisdom */ #ifdef CPL_FFTWF_INSTALLED if (imtypes[i] == CPL_TYPE_FLOAT) { cpl_fft_image_test_one( 16, 16, imtypes[i]); cpl_fft_image_test_one( 4, 32, imtypes[i]); cpl_fft_image_test_one( 4, 4, imtypes[i]); cpl_fft_image_test_one( 2, 128, imtypes[i]); cpl_fft_image_test_one(128, 2, imtypes[i]); cpl_fft_image_test_one(128, 1, imtypes[i]); cpl_fft_image_test_one( 1, 128, imtypes[i]); cpl_fft_image_test_correlate( 16, 16, imtypes[i]); cpl_fft_image_test_correlate( 64, 128, imtypes[i]); cpl_fft_image_test_correlate(128, 64, imtypes[i]); cpl_fft_image_test_correlate(128, 128, imtypes[i]); if (do_bench) { cpl_fft_image_test_one(256, 256, imtypes[i]); cpl_fft_image_test_correlate(512, 512, imtypes[i]); } } #endif #ifdef CPL_FFTW_INSTALLED if (imtypes[i] == CPL_TYPE_DOUBLE) { cpl_fft_image_test_one( 16, 16, imtypes[i]); cpl_fft_image_test_one( 32, 4, imtypes[i]); cpl_fft_image_test_one( 4, 4, imtypes[i]); cpl_fft_image_test_one( 2, 128, imtypes[i]); cpl_fft_image_test_one(128, 2, imtypes[i]); cpl_fft_image_test_one(128, 1, imtypes[i]); cpl_fft_image_test_one( 1, 128, imtypes[i]); cpl_fft_image_test_correlate( 16, 16, imtypes[i]); cpl_fft_image_test_correlate( 64, 128, imtypes[i]); cpl_fft_image_test_correlate(128, 64, imtypes[i]); cpl_fft_image_test_correlate(128, 128, imtypes[i]); if (do_bench) { cpl_fft_image_test_one(256, 256, imtypes[i]); cpl_fft_image_test_correlate(512, 512, imtypes[i]); } } #endif for (nz = 1; nz <= 1 + mz; nz+= mz) { #ifdef CPL_FFTWF_INSTALLED if (imtypes[i] == CPL_TYPE_FLOAT) { cpl_fft_imagelist_test_image( 16, 16, nz, imtypes[i]); cpl_fft_imagelist_test_image( 4, 32, nz, imtypes[i]); cpl_fft_imagelist_test_image( 4, 4, nz, imtypes[i]); cpl_fft_imagelist_test_image( 2, 128, nz, imtypes[i]); cpl_fft_imagelist_test_image(128, 2, nz, imtypes[i]); cpl_fft_imagelist_test_image(128, 1, nz, imtypes[i]); cpl_fft_imagelist_test_image( 1, 128, nz, imtypes[i]); if (do_bench) { cpl_fft_imagelist_test_image(256, 256, nz, imtypes[i]); } } #endif #ifdef CPL_FFTW_INSTALLED if (imtypes[i] == CPL_TYPE_DOUBLE) { cpl_fft_imagelist_test_image( 16, 16, nz, imtypes[i]); cpl_fft_imagelist_test_image( 32, 4, nz, imtypes[i]); cpl_fft_imagelist_test_image( 4, 4, nz, imtypes[i]); cpl_fft_imagelist_test_image( 2, 128, nz, imtypes[i]); cpl_fft_imagelist_test_image(128, 2, nz, imtypes[i]); cpl_fft_imagelist_test_image(128, 1, nz, imtypes[i]); cpl_fft_imagelist_test_image( 1, 128, nz, imtypes[i]); if (do_bench) { cpl_fft_imagelist_test_image(256, 256, nz, imtypes[i]); } } #endif } } cpl_fft_image_test(); /* End of tests */ return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Unit tests of the function @see cpl_fft_image() **/ /*----------------------------------------------------------------------------*/ static void cpl_fft_image_test(void) { const cpl_type imtypes[] = {CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT, CPL_TYPE_DOUBLE_COMPLEX, CPL_TYPE_FLOAT_COMPLEX}; int ityp; int nok = 0; /* Number of successful calls */ /* Insert tests below */ /* Iterate through all pixel types */ for (ityp = 0; ityp < (int)(sizeof(imtypes)/sizeof(imtypes[0])); ityp++) { const cpl_type imtype = imtypes[ityp]; int ityp2; cpl_image * img1 = cpl_image_new(IMAGESZ, IMAGESZ, imtype); cpl_image * img3 = cpl_image_new(IMAGESZ, IMAGESZ, imtype); cpl_error_code error; /* Various error checks */ error = cpl_fft_image(img3, NULL, CPL_FFT_FORWARD); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_fft_image(NULL, img3, CPL_FFT_FORWARD); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_fft_image(img3, img3, CPL_FFT_FORWARD | CPL_FFT_BACKWARD); if (imtype & CPL_TYPE_COMPLEX) { if (imtype & CPL_TYPE_DOUBLE) { #ifdef CPL_FFTW_INSTALLED cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); #else cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); #endif } else if (imtype & CPL_TYPE_FLOAT) { #ifdef CPL_FFTWF_INSTALLED cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); #else cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); #endif } else { cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); } } else if (imtype == CPL_TYPE_DOUBLE) { #ifdef CPL_FFTW_INSTALLED cpl_test_eq_error(error, CPL_ERROR_TYPE_MISMATCH); #else cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); #endif } else if (imtype == CPL_TYPE_FLOAT) { #ifdef CPL_FFTWF_INSTALLED cpl_test_eq_error(error, CPL_ERROR_TYPE_MISMATCH); #else cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); #endif } else { cpl_test_eq_error(error, CPL_ERROR_TYPE_MISMATCH); } if (!(imtype & CPL_TYPE_COMPLEX)) { error = cpl_image_fill_noise_uniform(img1, 0, CONSTANT); cpl_test_eq_error(error, CPL_ERROR_NONE); } for (ityp2 = 0; ityp2 < (int)(sizeof(imtypes)/sizeof(imtypes[0])); ityp2++) { const cpl_type imtype2 = imtypes[ityp2]; cpl_image * img2 = cpl_image_new(IMAGESZ, IMAGESZ, imtype2); const cpl_image * imgin = img3; cpl_image * imgout = img2; int idir; /* No scaling on the forward transform has no effect */ unsigned mode = CPL_FFT_FORWARD | CPL_FFT_NOSCALE; error = cpl_image_copy(img3, img1, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Transform first forward, then backward */ /* Those two iterations will succeed iff the input image and output image have matching non-integer precision */ for (idir = 0; idir < 2; idir++, mode = CPL_FFT_BACKWARD, imgin = img2, imgout = img3) { error = cpl_fft_image(imgout, imgin, mode); if (cpl_image_get_type(img3) == CPL_TYPE_FLOAT && cpl_image_get_type(img2) == (CPL_TYPE_FLOAT | CPL_TYPE_COMPLEX)) { #ifdef CPL_FFTWF_INSTALLED cpl_test_eq_error(CPL_ERROR_NONE, error); nok++; if (mode == CPL_FFT_BACKWARD) { /* Transformed forward and backwards, so the result should equal the original input */ cpl_test_image_abs(img1, img3, 3.0 * FLT_EPSILON * CONSTANT); } #else cpl_test_eq_error(CPL_ERROR_UNSUPPORTED_MODE, error); #endif } else if (cpl_image_get_type(img3) == CPL_TYPE_DOUBLE && cpl_image_get_type(img2) == (CPL_TYPE_DOUBLE | CPL_TYPE_COMPLEX)) { #ifdef CPL_FFTW_INSTALLED cpl_test_eq_error(CPL_ERROR_NONE, error); nok++; if (mode == CPL_FFT_BACKWARD) { /* Transformed forward and backwards, so the result should equal the original input */ cpl_test_image_abs(img1, img3, 5.0 * DBL_EPSILON * CONSTANT); } #else cpl_test_eq_error(CPL_ERROR_UNSUPPORTED_MODE, error); #endif } else if (cpl_image_get_type(img3) == (CPL_TYPE_DOUBLE | CPL_TYPE_COMPLEX) && cpl_image_get_type(img2) == (CPL_TYPE_DOUBLE | CPL_TYPE_COMPLEX)) { #ifdef CPL_FFTW_INSTALLED cpl_test_eq_error(CPL_ERROR_NONE, error); #else cpl_test_eq_error(CPL_ERROR_UNSUPPORTED_MODE, error); #endif } else if (cpl_image_get_type(img3) == (CPL_TYPE_FLOAT | CPL_TYPE_COMPLEX) && cpl_image_get_type(img2) == (CPL_TYPE_FLOAT | CPL_TYPE_COMPLEX)) { #ifdef CPL_FFTWF_INSTALLED cpl_test_eq_error(CPL_ERROR_NONE, error); #else cpl_test_eq_error(CPL_ERROR_UNSUPPORTED_MODE, error); #endif } else if ((imtype & CPL_TYPE_INT) || (imtype2 & CPL_TYPE_INT)) { cpl_test_eq_error(CPL_ERROR_TYPE_MISMATCH, error); } else if ((imtype & (CPL_TYPE_FLOAT | CPL_TYPE_DOUBLE | CPL_TYPE_INT)) != (imtype2 & (CPL_TYPE_FLOAT | CPL_TYPE_DOUBLE | CPL_TYPE_INT))) { cpl_test_eq_error(CPL_ERROR_TYPE_MISMATCH, error); } else if (!((imtype & CPL_TYPE_COMPLEX) ^ (imtype2 & CPL_TYPE_COMPLEX))) { /* None or both are complex */ if (imtype == CPL_TYPE_DOUBLE) { #ifdef CPL_FFTW_INSTALLED cpl_test_eq_error(CPL_ERROR_TYPE_MISMATCH, error); #else cpl_test_eq_error(CPL_ERROR_UNSUPPORTED_MODE, error); #endif } else if (imtype == CPL_TYPE_FLOAT) { #ifdef CPL_FFTWF_INSTALLED cpl_test_eq_error(CPL_ERROR_TYPE_MISMATCH, error); #else cpl_test_eq_error(CPL_ERROR_UNSUPPORTED_MODE, error); #endif } else { cpl_test_eq_error(CPL_ERROR_TYPE_MISMATCH, error); } } else if (imtype & CPL_TYPE_DOUBLE) { #ifdef CPL_FFTW_INSTALLED cpl_test_eq_error(CPL_ERROR_TYPE_MISMATCH, error); #else cpl_test_eq_error(CPL_ERROR_UNSUPPORTED_MODE, error); #endif } else if (imtype & CPL_TYPE_FLOAT) { #ifdef CPL_FFTWF_INSTALLED cpl_test_eq_error(CPL_ERROR_TYPE_MISMATCH, error); #else cpl_test_eq_error(CPL_ERROR_UNSUPPORTED_MODE, error); #endif } else { cpl_test_eq_error(CPL_ERROR_TYPE_MISMATCH, error); } } cpl_image_delete(img2); } cpl_image_delete(img1); cpl_image_delete(img3); } #if defined CPL_FFTWF_INSTALLED && defined CPL_FFTW_INSTALLED cpl_test_eq(nok, 4); /* Forward and backward of float and double */ #elif defined CPL_FFTWF_INSTALLED cpl_msg_warning(cpl_func, "Double precision FFT not available for " "unit testing"); cpl_test_eq(nok, 2); /* Forward and backward of type float */ #elif defined CPL_FFTW_INSTALLED cpl_msg_warning(cpl_func, "Single precision FFT not available for " "unit testing"); cpl_test_eq(nok, 2); /* Forward and backward of type double */ #else cpl_msg_warning(cpl_func, "FFT not available for unit testing"); cpl_test_zero(nok); #endif } #if defined CPL_FFTWF_INSTALLED || defined CPL_FFTW_INSTALLED /*----------------------------------------------------------------------------*/ /** @internal @brief Unit tests of the function @param nx Size in x (the number of columns) @param ny Size in y (the number of rows) @param type One of CPL_TYPE_DOUBLE or CPL_TYPE_FLOAT @see cpl_fft_image() **/ /*----------------------------------------------------------------------------*/ static void cpl_fft_image_test_one(cpl_size nx, cpl_size ny, cpl_type type) { const int rigor = CPL_FFT_FIND_MEASURE; cpl_image * image1r = cpl_image_new(nx, ny, type); cpl_image * image1c; cpl_image * image2 = cpl_image_new(nx, ny, type); cpl_image * image3r = cpl_image_new(nx, ny, type | CPL_TYPE_COMPLEX); cpl_image * image3c = cpl_image_new(nx, ny, type | CPL_TYPE_COMPLEX); cpl_image * image3h = cpl_image_new(nx/2+1, ny, type | CPL_TYPE_COMPLEX); cpl_image * image4; cpl_image * image4r; cpl_image * image4c; cpl_image * image5 = cpl_image_new(nx, ny, type); cpl_error_code error; error = cpl_image_fill_noise_uniform(image1r, 0.0, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); image1c = cpl_image_cast(image1r, type | CPL_TYPE_COMPLEX); /* Real-to-complex, both full size */ error = cpl_fft_image(image3r, image1r, CPL_FFT_FORWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Extract half of r2c transform */ image4 = cpl_image_extract(image3r, 1, 1, nx/2 + 1, ny); /* Real-to-complex, complex is half size */ error = cpl_fft_image(image3h, image1r, CPL_FFT_FORWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); /* That half has to match the transform onto the half-sized image */ cpl_test_image_abs(image3h, image4, 80.0 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); /* Complex-to-complex of same real values */ error = cpl_fft_image(image3c, image1c, CPL_FFT_FORWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); /* In-place complex-to-complex of same real values */ error = cpl_fft_image(image1c, image1c, CPL_FFT_FORWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(image3c, image1c, type == CPL_TYPE_DOUBLE ? 128.0 * DBL_EPSILON : 40.0 * FLT_EPSILON); /* Extract half of c2c transform */ cpl_image_delete(image4); image4 = cpl_image_extract(image3c, 1, 1, nx/2 + 1, ny); cpl_test_image_abs(image3h, image4, 128.0 * nx * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); /* Complex-to-real, both full size */ error = cpl_fft_image(image2, image3r, CPL_FFT_BACKWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); /* The back-transformed must match the original image */ cpl_test_image_abs(image1r, image2, 6.0 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); /* Complex-to-real, complex is half size */ error = cpl_fft_image(image2, image3h, CPL_FFT_BACKWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); /* The back-transformed must match the original image */ cpl_test_image_abs(image1r, image2, 6.0 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); /* Complex-to-complex of same real values */ error = cpl_fft_image(image3r, image3c, CPL_FFT_BACKWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); /* In-place complex-to-complex of same real values */ error = cpl_fft_image(image3c, image3c, CPL_FFT_BACKWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(image3r, image3c, 3.2 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); /* The back-transformed must match the original image - on the real part */ image4r = cpl_image_extract_real(image3r); cpl_test_image_abs(image1r, image4r, 6.0 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); /* The back-transformed must have a zero-valued imaginary part */ image4c = cpl_image_extract_imag(image3r); cpl_image_delete(image4); image4 = cpl_image_new(nx, ny, type); cpl_test_image_abs(image4c, image4, 2.0 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); cpl_image_delete(image1r); cpl_image_delete(image1c); cpl_image_delete(image2); cpl_image_delete(image3r); cpl_image_delete(image3c); cpl_image_delete(image3h); cpl_image_delete(image4); cpl_image_delete(image4r); cpl_image_delete(image4c); cpl_image_delete(image5); } /*----------------------------------------------------------------------------*/ /** @internal @brief Unit tests of the function @param nx Size in x (the number of columns) @param ny Size in y (the number of rows) @param nz Size in z (the number of planes/images) @param type One of CPL_TYPE_DOUBLE or CPL_TYPE_FLOAT @see cpl_fft_image() **/ /*----------------------------------------------------------------------------*/ static void cpl_fft_imagelist_test_one(cpl_size nx, cpl_size ny, cpl_size nz, cpl_type type) { const int rigor = CPL_FFT_FIND_MEASURE; cpl_imagelist * ilist1r = cpl_imagelist_new(); cpl_imagelist * ilist1c = cpl_imagelist_new(); cpl_imagelist * ilist2 = cpl_imagelist_new(); cpl_imagelist * ilist3r = cpl_imagelist_new(); cpl_imagelist * ilist3c = cpl_imagelist_new(); cpl_imagelist * ilist3h = cpl_imagelist_new(); cpl_imagelist * ilist4 = cpl_imagelist_new(); cpl_imagelist * ilist4r = cpl_imagelist_new(); cpl_imagelist * ilist4c = cpl_imagelist_new(); cpl_imagelist * ilistr = cpl_imagelist_new(); cpl_imagelist * ilistc = cpl_imagelist_new(); cpl_imagelist * ilist5 = cpl_imagelist_new(); cpl_error_code error; cpl_size i; for (i = 0; i < nz; i++) { cpl_image * image1r = cpl_image_new(nx, ny, type); cpl_image * image1c; cpl_image * image2 = cpl_image_new(nx, ny, type); cpl_image * image3r = cpl_image_new(nx, ny, type | CPL_TYPE_COMPLEX); cpl_image * image3c; cpl_image * image3h = cpl_image_new(nx/2+1, ny, type | CPL_TYPE_COMPLEX); cpl_image * image5 = cpl_image_new(nx, ny, type); error = cpl_image_fill_noise_uniform(image1r, 0.0, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(ilist1r, image1r, i); cpl_test_eq_error(error, CPL_ERROR_NONE); image1c = cpl_image_cast(image1r, type | CPL_TYPE_COMPLEX); error = cpl_imagelist_set(ilist1c, image1c, i); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(ilist2 , image2, i); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(ilist3r, image3r, i); cpl_test_eq_error(error, CPL_ERROR_NONE); image3c = cpl_image_new(nx, ny, type | CPL_TYPE_COMPLEX); error = cpl_imagelist_set(ilist3c, image3c, i); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(ilist3h, image3h, i); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(ilist5, image5, i); cpl_test_eq_error(error, CPL_ERROR_NONE); } /* Real-to-complex, both full size */ error = cpl_fft_imagelist(ilist3r, ilist1r, CPL_FFT_FORWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Extract half of r2c transform */ for (i = 0; i < nz; i++) { const cpl_image * image3r = cpl_imagelist_get_const(ilist3r, i); cpl_image * image4 = cpl_image_extract(image3r, 1, 1, nx/2 + 1, ny); error = cpl_imagelist_set(ilist4, image4, i); cpl_test_eq_error(error, CPL_ERROR_NONE); } /* Real-to-complex, complex is half size */ error = cpl_fft_imagelist(ilist3h, ilist1r, CPL_FFT_FORWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); /* That half has to match the transform onto the half-sized image */ cpl_test_imagelist_abs(ilist3h, ilist4, 80.0 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); /* Complex-to-complex of same real values */ error = cpl_fft_imagelist(ilist3c, ilist1c, CPL_FFT_FORWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); /* In-place complex-to-complex of same real values */ error = cpl_fft_imagelist(ilist1c, ilist1c, CPL_FFT_FORWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_imagelist_abs(ilist3c, ilist1c, 2.0 * (nx + ny) * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); /* Extract half of c2c transform */ cpl_imagelist_empty(ilist4); for (i = 0; i < nz; i++) { const cpl_image * image3c = cpl_imagelist_get_const(ilist3c, i); cpl_image * image4 = cpl_image_extract(image3c, 1, 1, nx/2 + 1, ny); error = cpl_imagelist_set(ilist4, image4, i); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_test_imagelist_abs(ilist3h, ilist4, 128.0 * nx * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); /* Complex-to-real, both full size */ error = cpl_fft_imagelist(ilist2, ilist3r, CPL_FFT_BACKWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); /* The back-transformed must match the original image */ cpl_test_imagelist_abs(ilist1r, ilist2, 6.0 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); /* Complex-to-real, complex is half size */ error = cpl_fft_imagelist(ilist2, ilist3h, CPL_FFT_BACKWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); /* The back-transformed must match the original image */ cpl_test_imagelist_abs(ilist1r, ilist2, 6.0 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); /* Complex-to-complex of same real values */ error = cpl_fft_imagelist(ilist3r, ilist3c, CPL_FFT_BACKWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); /* In-place complex-to-complex of same real values */ error = cpl_fft_imagelist(ilist3c, ilist3c, CPL_FFT_BACKWARD | rigor); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_imagelist_abs(ilist3r, ilist3c, 8.0 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); /* The back-transformed must match the original image - on the real part */ /* - and the back-transformed must have a zero-valued imaginary part */ cpl_imagelist_empty(ilist4); for (i = 0; i < nz; i++) { const cpl_image * image3r = cpl_imagelist_get_const(ilist3r, i); cpl_image * image4r = cpl_image_extract_real(image3r); cpl_image * image4c = cpl_image_extract_imag(image3r); cpl_image * image4 = cpl_image_new(nx, ny, type); error = cpl_imagelist_set(ilist4r, image4r, i); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(ilist4c, image4c, i); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(ilist4, image4, i); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_test_imagelist_abs(ilist1r, ilist4r, 6.0 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); cpl_test_imagelist_abs(ilist4c, ilist4, 2.0 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON)); cpl_imagelist_delete(ilist1r); cpl_imagelist_delete(ilist1c); cpl_imagelist_delete(ilist2); cpl_imagelist_delete(ilist3r); cpl_imagelist_delete(ilist3c); cpl_imagelist_delete(ilist3h); cpl_imagelist_delete(ilist4); cpl_imagelist_delete(ilist4r); cpl_imagelist_delete(ilist4c); cpl_imagelist_delete(ilistr); cpl_imagelist_delete(ilistc); cpl_imagelist_delete(ilist5); } /*----------------------------------------------------------------------------*/ /** @internal @brief Benchmark cpl_fft_imagelist() aginst cpl_fft_image() @param nx Size in x (the number of columns) @param ny Size in y (the number of rows) @param nz Size in z (the number of planes/images) @param type One of CPL_TYPE_DOUBLE or CPL_TYPE_FLOAT @see cpl_fft_imagelist_test_one() cpl_fft_image_test_one() **/ /*----------------------------------------------------------------------------*/ static void cpl_fft_imagelist_test_image(cpl_size nx, cpl_size ny, cpl_size nz, cpl_type type) { cpl_flops flopl0, flopl1, flopi0, flopi1; double timel0, timel1, timei0, timei1; cpl_size i; flopl0 = cpl_test_get_flops(); timel0 = cpl_test_get_cputime(); cpl_fft_imagelist_test_one(nx, ny, nz, type); flopl1 = cpl_test_get_flops() - flopl0; timel1 = cpl_test_get_cputime() - timel0; flopi0 = cpl_test_get_flops(); timei0 = cpl_test_get_cputime(); for (i = 0; i < nz; i++) { cpl_fft_image_test_one(nx, ny, type); } flopi1 = cpl_test_get_flops() - flopi0; timei1 = cpl_test_get_cputime() - timei0; if (timei1 > 0.0 && timel1 > 0.0) { cpl_msg_info(cpl_func, "List vs single %d X %d X %d (%s): %g <=> %g " "[s] (%g <=> %g [MFLOP/s])", (int)nx, (int)ny, (int)nz, cpl_type_get_name(type), timel1, timei1, 1e-6*(double)flopl1/timel1, 1e-6*(double)flopi1/timei1); } else { cpl_msg_info(cpl_func, "List vs single %d X %d X %d (%s): %g <=> %g " "[s] (%g <=> %g [MFLOP])", (int)nx, (int)ny, (int)nz, cpl_type_get_name(type), timel1, timei1, 1e-6*(double)flopl1, 1e-6*(double)flopi1); } } /*----------------------------------------------------------------------------*/ /** @internal @brief Try to use the FFT for correlation @param nx Size in x (the number of columns) @param ny Size in y (the number of rows) @param type One of CPL_TYPE_DOUBLE or CPL_TYPE_FLOAT @see cpl_fft_image_test_one() **/ /*----------------------------------------------------------------------------*/ static void cpl_fft_image_test_correlate(cpl_size nx, cpl_size ny, cpl_type type) { cpl_image * ia = cpl_image_new(nx, ny, type); cpl_image * ib = cpl_image_new(nx, ny, type); cpl_image * ic = cpl_image_new(nx, ny, type); cpl_image * fa = cpl_image_new(nx, ny, type | CPL_TYPE_COMPLEX); cpl_image * fb = cpl_image_new(nx, ny, type | CPL_TYPE_COMPLEX); cpl_image * fc = cpl_image_new(nx, ny, type | CPL_TYPE_COMPLEX); cpl_imagelist * iab = cpl_imagelist_new(); cpl_imagelist * fab = cpl_imagelist_new(); cpl_size xmax, ymax; cpl_error_code code; code = cpl_imagelist_set(iab, ia, 0); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_imagelist_set(iab, ib, 1); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_imagelist_set(fab, fa, 0); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_imagelist_set(fab, fb, 1); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_fill_gaussian(ia, nx/2.0, ny/2.0, 1.0, 1.0, 1.0); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_copy(ib, ia, 1, 1); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_shift(ib, nx/4, ny/4); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_fft_imagelist(fab, iab, CPL_FFT_FORWARD); cpl_test_eq_error(code, CPL_ERROR_NONE); /* Auto-correlate */ code = cpl_image_conjugate(fc, fa); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_multiply(fc, fa); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_fft_image(ic, fc, CPL_FFT_BACKWARD | CPL_FFT_NOSCALE); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_get_maxpos(ic, &xmax, &ymax); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_eq(xmax, 1); cpl_test_eq(ymax, 1); /* Cross-correlate */ code = cpl_image_conjugate(fc, fb); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_multiply(fc, fa); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_fft_image(ic, fc, CPL_FFT_BACKWARD | CPL_FFT_NOSCALE); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_get_maxpos(ic, &xmax, &ymax); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_eq(xmax, 1 + nx/2 + nx/4); cpl_test_eq(ymax, 1 + ny/2 + ny/4); cpl_imagelist_delete(iab); cpl_imagelist_delete(fab); cpl_image_delete(ic); cpl_image_delete(fc); } #endif cpl-6.4.1/cpldrs/cpl_detector_body.h0000644000460300003120000001342011611773034014341 00000000000000/* $Id: cpl_detector_body.h,v 1.10 2011-07-21 09:49:16 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #define CPL_TYPE_ADD(a) CONCAT2X(a, CPL_NAME_TYPE) static cpl_error_code CPL_TYPE_ADD(cpl_detector_interpolate_rejected)(CPL_TYPE * pi, const cpl_binary * bpm, cpl_size nx, cpl_size ny, cpl_binary * doit) CPL_ATTR_NONNULL; /*----------------------------------------------------------------------------*/ /** @internal @brief Interpolate any bad pixels in an image and clean the bad pixel map @param pi The pixel buffer @param bpm The bad pixel map buffer @param nx X-size of image and bad pixel map @param ny Y-size of image and bad pixel map @param doit The first bad pixel to clean @return The #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_detector_interpolate_rejected @note No input checking in this internal function! Possible #_cpl_error_code_ set in this function: - CPL_ERROR_DATA_NOT_FOUND if all pixels are bad */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_detector_interpolate_rejected)(CPL_TYPE * pi, const cpl_binary * bpm, cpl_size nx, cpl_size ny, cpl_binary * doit) { /* Need a copy of the bpm, to not use as interpolation source pixels that have been interpolated in the same pass */ cpl_binary * bpmcopy = cpl_malloc((size_t)(nx * ny) * sizeof(*bpm)); cpl_mask * copy = cpl_mask_wrap(nx, ny, bpmcopy); const cpl_binary * prev = doit; cpl_boolean ok; /* All pixels may be bad */ (void)memset(bpmcopy, CPL_BINARY_0, (size_t)(prev - bpm)); do { cpl_binary * found = doit; /* assert( *doit ); */ /* No more bad pixels between previous and current bad pixel */ (void)memset(bpmcopy + (prev - bpm), CPL_BINARY_0, (size_t)(doit - prev)); /* Bad pixels may have been cleaned in remaining buffer as well */ (void)memcpy(bpmcopy + (doit - bpm), doit, (size_t)(nx * ny - (doit - bpm)) * sizeof(*bpm)); prev = doit; doit = NULL; ok = CPL_FALSE; do { /* Found bad pixel at (i,j) */ const cpl_size ij = found - bpm; const cpl_size j = ij / nx; const cpl_size i = ij - j * nx; /* Try to interpolate the bad pixel */ cpl_size npix = 0; CPL_SUM_TYPE sumpix = 0.0; if (i > 0) { /* The three pixels to the left */ if (bpmcopy[ij - 1] == CPL_BINARY_0) { sumpix += (CPL_SUM_TYPE)pi[ij - 1]; npix++; } if (j > 0 && bpmcopy[ij - 1 - nx] == CPL_BINARY_0) { sumpix += (CPL_SUM_TYPE)pi[ij - 1 - nx]; npix++; } if (j + 1 < ny && bpmcopy[ij - 1 + nx] == CPL_BINARY_0) { sumpix += (CPL_SUM_TYPE)pi[ij - 1 + nx]; npix++; } } /* The two pixels below and above */ if (j > 0 && bpmcopy[ij - nx] == CPL_BINARY_0) { sumpix += (CPL_SUM_TYPE)pi[ij - nx]; npix++; } if (j + 1 < ny && bpmcopy[ij + nx] == CPL_BINARY_0) { sumpix += (CPL_SUM_TYPE)pi[ij + nx]; npix++; } if (i + 1 < nx) { /* The three pixels to the right */ if (bpmcopy[ij + 1] == CPL_BINARY_0) { sumpix += (CPL_SUM_TYPE)pi[ij + 1]; npix++; } if (j > 0 && bpmcopy[ij + 1 - nx] == CPL_BINARY_0) { sumpix += (CPL_SUM_TYPE)pi[ij + 1 - nx]; npix++; } if (j + 1 < ny && bpmcopy[ij + 1 + nx] == CPL_BINARY_0) { sumpix += (CPL_SUM_TYPE)pi[ij + 1 + nx]; npix++; } } if (npix > 0) { /* Found source pixel(s) for interpolation */ #ifdef CPL_DO_ROUND /* For integers round halfway cases away from zero */ sumpix += sumpix < 0.0 ? -0.5 : 0.5; #endif pi[ij] = (CPL_TYPE)(sumpix / (CPL_SUM_TYPE)npix); *found = CPL_BINARY_0; ok = CPL_TRUE; } else if (doit == NULL) { doit = found; /* First bad pixel to redo */ } found = memchr(found+1, CPL_BINARY_1, (size_t)(nx * ny - ij - 1) * sizeof(*bpm)); } while (found); } while (doit && ok); cpl_mask_delete(copy); return ok ? CPL_ERROR_NONE : cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); } #undef CPL_TYPE_ADD cpl-6.4.1/cpldrs/cpl_geom_img_body.h0000644000460300003120000006545711617757262014347 00000000000000/* $Id: cpl_geom_img_body.h,v 1.39 2011-08-08 13:03:46 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #define CPL_TYPE_ADD(a) CPL_CONCAT2X(a, CPL_TYPE) #define CPL_TYPE_ADD_CONST(a) CPL_CONCAT3X(a, CPL_TYPE, const) /*----------------------------------------------------------------------------*/ /** @internal @brief Correlate two image windows @param correl Buffer to hold the correlations (1 + 2s_hx)(1 + 2s_hy) @param im1 First input image @param im2 Second input image of same size and type @param x_1 X-coordinate of the subwindow center inside im1 (0 for 1st) @param y_1 Y-coordinate of the subwindow center inside im1 @param x_2 X-coordinate of the subwindow center inside im2 @param y_2 Y-coordinate of the subwindow center inside im2 @param s_hx Search area half-width. @param s_hy Search area half-height. @param m_hx Measurement area half-width. @param m_hy Measurement area half-height. @param pk_min Optimum correlation X-offset @param pl_min Optimum correlation Y-offset @see cpl_geom_ima_offset_xcorr_subw() @note The "correlation" is actually a sum of squared differences per sampled number of pixels! Bad pixel maps ignored! No input validation! */ /*----------------------------------------------------------------------------*/ static void CPL_TYPE_ADD(cpl_geom_ima_offset_xcorr_subw)(double * correl, const cpl_image * im1, const cpl_image * im2, cpl_size x_1, cpl_size y_1, cpl_size x_2, cpl_size y_2, cpl_size s_hx, cpl_size s_hy, cpl_size m_hx, cpl_size m_hy, cpl_size * pk_min, cpl_size * pl_min) { double sqsum_min = DBL_MAX; const cpl_size nx = cpl_image_get_size_x(im1); const cpl_size ny = cpl_image_get_size_y(im1); /* Point to the center corellation position */ const CPL_TYPE * pi1 = CPL_TYPE_ADD_CONST(cpl_image_get_data)(im1) + x_1 + y_1 * nx; const CPL_TYPE * pi2 = CPL_TYPE_ADD_CONST(cpl_image_get_data)(im2) + x_2 + y_2 * nx; double * pxc = correl + s_hx; /* Offset for indexing with k */ const cpl_size s_hx_min = -CX_MIN(s_hx, CX_MIN(x_1, x_2)); const cpl_size s_hy_min = -CX_MIN(s_hy, CX_MIN(y_1, y_2)); const cpl_size s_hx_max = CX_MIN(s_hx, nx-1-CX_MAX(x_1, x_2)); const cpl_size s_hy_max = CX_MIN(s_hy, ny-1-CX_MAX(y_1, y_2)); cpl_size k, l; /* Outside the image(s) */ for (l = -s_hy; l < s_hy_min; l++, pxc += 1 + 2 * s_hx) { for (k = -s_hx; k <= s_hx; k++) { pxc[k] = -1.0; } } /* Compute the sums of squared differences and keep the minimum one */ for (; l <= s_hy_max; l++, pxc += 1 + 2 * s_hx) { /* Outside the image(s) */ for (k = -s_hx; k < s_hx_min; k++) { pxc[k] = -1.0; } for (; k <= s_hx_max; k++) { const cpl_size m_hx_min = -CX_MIN(m_hx, CX_MIN(x_1 + k, x_2)); const cpl_size m_hy_min = -CX_MIN(m_hy, CX_MIN(y_1 + l, y_2)); const cpl_size m_hx_max = CX_MIN(m_hx, nx-1-CX_MAX(x_1 + k, x_2)); const cpl_size m_hy_max = CX_MIN(m_hy, ny-1-CX_MAX(y_1 + l, y_2)); const cpl_size npix = (1+m_hx_max-m_hx_min) * (1+m_hy_max-m_hy_min); if (npix < m_hx + m_hy) { /* FIXME: Arbitrary lower limit on sampled pixels */ pxc[k] = -1.0; } else { double sqsum = 0.0; const double rnpix = 1.0 / (double)npix; const CPL_TYPE * pos1 = pi1 + k + (l + m_hy_min) * nx; const CPL_TYPE * pos2 = pi2 + ( m_hy_min) * nx; cpl_size i, j; /* One sum of squared differences */ for (j = m_hy_min; j <= m_hy_max; j++, pos1 += nx, pos2 += nx) { for (i = m_hx_min; i <= m_hx_max; i++) { const double diff = (double)pos1[i]-(double)pos2[i]; sqsum += diff * diff; } } sqsum *= rnpix; pxc[k] = sqsum; /* Keep track of the minimum */ if (sqsum < sqsum_min) { *pl_min = l; *pk_min = k; sqsum_min = sqsum; } cpl_tools_add_flops(1 + 3 * npix); } } /* Outside the image(s) */ for (; k <= s_hx; k++) { pxc[k] = -1.0; } } /* Outside the image(s) */ for (; l <= s_hy; l++, pxc += 1 + 2 * s_hx) { for (k = -s_hx; k <= s_hx; k++) { pxc[k] = -1.0; } } return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Shift and add an images list to a single image @param final Combined image, assumed to be zero @param contrib Contribution map, assumed to be zero @param rmin Number of minimum value pixels to reject in stacking @param rmax Number of maximum value pixels to reject in stacking @param start_x Offset X-position for 1st pixel in 1st image @param start_y Offset Y-position for 1st pixel in 1st image @param ilist Input image list @param firstbpm Index of 1st plane with a non-empty bpm (or list size) @param offs List of offsets in x and y @param xyprofile The sampling profile (weight) @param tabsperpix Number of profile-samples per pixel @see cpl_geom_img_offset_saa() */ /*----------------------------------------------------------------------------*/ static void CPL_TYPE_ADD(cpl_geom_img_offset_saa)(cpl_image * final, cpl_image * contrib, cpl_size rmin, cpl_size rmax, double start_x, double start_y, const cpl_imagelist * ilist, cpl_size firstbpm, const cpl_bivector * offs, const cpl_vector * xyprofile, cpl_size tabsperpix) { const cpl_size nima = cpl_imagelist_get_size(ilist); const cpl_image * img1 = cpl_imagelist_get_const(ilist, 0); const cpl_size sizex = cpl_image_get_size_x(img1); const cpl_size sizey = cpl_image_get_size_y(img1); const cpl_size nx = cpl_image_get_size_x(final); const cpl_size ny = cpl_image_get_size_y(final); const cpl_size rtot = rmin + rmax; CPL_TYPE * po = CPL_TYPE_ADD(cpl_image_get_data)(final); const double * offs_x = cpl_bivector_get_x_data_const(offs); const double * offs_y = cpl_bivector_get_y_data_const(offs); double * acc = (double*)cpl_malloc((size_t)nx * (size_t)nima * sizeof(*acc)); int * pcontrib = cpl_image_get_data_int(contrib); const CPL_TYPE ** ppi = cpl_malloc((size_t)nima * sizeof(CPL_TYPE*)); const cpl_binary ** ppibpm = NULL; int * ncontrib = (int*)cpl_calloc(sizeof(int), (size_t)nx); cpl_size * offset_ij = cpl_malloc(2 * (size_t)nima * sizeof(*offset_ij)); double * rsc = (double*)cpl_malloc((size_t)nima * 8 * sizeof(*rsc)); cpl_boolean * isint = (cpl_boolean*)cpl_calloc((size_t)nima, sizeof(*isint)); cpl_size j, p; cpl_flops myflop_count = 0; for (p=0; p < nima; p++) { const double offset_x = start_x - offs_x[p]; const double offset_y = start_y - offs_y[p]; const double suboff_x = offset_x - floor(offset_x); const double suboff_y = offset_y - floor(offset_y); /* Which tabulated value index shall be used? */ const cpl_size tabx = (int)(0.5 + suboff_x * (double)(tabsperpix)); const cpl_size taby = (int)(0.5 + suboff_y * (double)(tabsperpix)); offset_ij[0 + p * 2] = (cpl_size)floor(offset_x); offset_ij[1 + p * 2] = (cpl_size)floor(offset_y); ppi[p] = CPL_TYPE_ADD_CONST(cpl_image_get_data) (cpl_imagelist_get_const(ilist, p)); ppi[p] += offset_ij[0 + p * 2]; if (tabx == 0 && taby == 0) { isint[p] = CPL_TRUE; } else { const double * interp_kernel = cpl_vector_get_data_const(xyprofile); const double sumrs = ( interp_kernel[ tabsperpix + tabx] + interp_kernel[ tabx] + interp_kernel[ tabsperpix - tabx] + interp_kernel[2 * tabsperpix - tabx]) * ( interp_kernel[ tabsperpix + taby] + interp_kernel[ taby] + interp_kernel[ tabsperpix - taby] + interp_kernel[2 * tabsperpix - taby]); /* Compute resampling coefficients */ /* rsc[0..3] in x, rsc[4..7] in y */ /* Also divide the y-rsc with the sum of the rsc */ rsc[0 + p * 8] = interp_kernel[ tabsperpix + tabx]; rsc[1 + p * 8] = interp_kernel[ tabx]; rsc[2 + p * 8] = interp_kernel[ tabsperpix - tabx]; rsc[3 + p * 8] = interp_kernel[2 * tabsperpix - tabx]; rsc[4 + p * 8] = interp_kernel[ tabsperpix + taby] / sumrs; rsc[5 + p * 8] = interp_kernel[ taby] / sumrs; rsc[6 + p * 8] = interp_kernel[ tabsperpix - taby] / sumrs; rsc[7 + p * 8] = interp_kernel[2 * tabsperpix - taby] / sumrs; } } /* Get the masks if there are bad pixels */ if (firstbpm < nima) { ppibpm = (const cpl_binary **)cpl_malloc((size_t)nima * sizeof(cpl_binary*)); for (p = 0; p < firstbpm; p++) { ppibpm[p] = NULL; } for (; p < nima; p++) { const cpl_mask * bpm = cpl_image_get_bpm_const(cpl_imagelist_get_const(ilist, p)); if (p == firstbpm || (bpm != NULL && !cpl_mask_is_empty(bpm))) { ppibpm[p] = cpl_mask_get_data_const(bpm); ppibpm[p] += offset_ij[0 + p * 2]; } else { ppibpm[p] = NULL; } } } /* Triple loop */ for (j=0; j < ny; j++) { cpl_flops myintp_count = 0; cpl_size i; for (p=0; p < nima; p++) { const cpl_size py = j + offset_ij[1 + p * 2]; /* If original pixel is present in the current plane */ if (py > 1 && py < (sizey-2)) { const CPL_TYPE * pi = ppi[p] + py * sizex; const cpl_binary * pibpm = NULL; /* First offset source location used */ const cpl_size i0 = CX_MAX(0, 2 - offset_ij[0 + p * 2]); /* First offset source location not used */ const cpl_size i1 = CX_MIN(sizex - 2 - offset_ij[0 + p * 2], nx); if(ppibpm != NULL && ppibpm[p] != NULL) pibpm = ppibpm[p] + py * sizex; if (isint[p]) { /* The shift is purely integer, so no interpolation done */ /* When the whole list has integer shifts, the speed-up is a factor between 3 and 4 on the unit tests */ for (i = i0; i < i1; i++) { /* assert( px == i + offset_ij[0 + p * 2] ); */ /* Check if the pixel used * is a bad pixel. If true, this image is not used * for this pixel */ if (pibpm == NULL || !pibpm[i]) { /* Collect pixel and update number of contributing pixels */ /* acc[] is accessed with stride nima here, in order to achieve stride one access below */ acc[ncontrib[i] + i * nima] = pi[i]; ncontrib[i]++; } } } else { for (i = i0; i < i1; i++) { /* assert( px == i + offset_ij[0 + p * 2] ); */ /* Check if any of the pixels used for the interpolation * is a bad pixel. If true, this image is not used * for this pixel */ /* An earlier check required the pixel to be bad and the resampling coefficient to be non-zero. This was dropped to support bad pixels w. NaNs */ if(pibpm == NULL || /* One read for all 4 pixels in the bpm row */ (!*((const uint32_t*)(pibpm + i - 1 - sizex )) && !*((const uint32_t*)(pibpm + i - 1 )) && !*((const uint32_t*)(pibpm + i - 1 + sizex )) && !*((const uint32_t*)(pibpm + i - 1 + sizex * 2)))) { /* Compute interpolated pixel and update number of contributing pixels */ /* acc[] is accessed with stride nima here, in order to achieve stride one access below */ acc[ncontrib[i] + i * nima] = rsc[4 + 8*p] * (rsc[0 + 8*p] * pi[i - 1 - sizex] + rsc[1 + 8*p] * pi[i - sizex] + rsc[2 + 8*p] * pi[i + 1 - sizex] + rsc[3 + 8*p] * pi[i + 2 - sizex] ) + rsc[5 + 8*p] * (rsc[0 + 8*p] * pi[i - 1] + rsc[1 + 8*p] * pi[i ] + rsc[2 + 8*p] * pi[i + 1] + rsc[3 + 8*p] * pi[i + 2] ) + rsc[6 + 8*p] * (rsc[0 + 8*p] * pi[i - 1 + sizex] + rsc[1 + 8*p] * pi[i + sizex] + rsc[2 + 8*p] * pi[i + 1 + sizex] + rsc[3 + 8*p] * pi[i + 2 + sizex] ) + rsc[7 + 8*p] * (rsc[0 + 8*p] * pi[i - 1 + sizex * 2] + rsc[1 + 8*p] * pi[i + sizex * 2] + rsc[2 + 8*p] * pi[i + 1 + sizex * 2] + rsc[3 + 8*p] * pi[i + 2 + sizex * 2]); ncontrib[i]++; myintp_count++; } } } } } for (i=0; i < nx; i++) { if (ncontrib[i] > rtot) { double finpix = 0.0; double * acci = acc + i * nima; /* Place rmin and rmax samples at the ends */ #ifdef CPL_GEOM_USE_KTH /* Equivalent, but slower in unit tests */ if (rmin > 0) (void)cpl_tools_get_kth_double(acci, ncontrib[i], rmin-1); if (rmax > 0) (void)cpl_tools_get_kth_double(acci + rmin, ncontrib[i] - rmin, ncontrib[i] - rtot); #else cpl_geom_img_get_min_max_double(acci, ncontrib[i], rmin, rmax); #endif for (p=rmin; p<(ncontrib[i]-rmax); p++) finpix += acci[p]; finpix /= (double)(ncontrib[i]-rtot); po[i+j*nx] = (CPL_TYPE)finpix; pcontrib[i+j*nx] = ncontrib[i] - rtot; myflop_count += 1 + ncontrib[i] - rtot; } else { cpl_image_reject(final, i+1, j+1); } ncontrib[i] = 0; } myflop_count += 35 * myintp_count; } cpl_tools_add_flops(myflop_count + 15 * nima); cpl_free(offset_ij); cpl_free(rsc); cpl_free(acc); cpl_free(ncontrib); cpl_free((void*)ppi); cpl_free((void*)ppibpm); cpl_free((void*)isint); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Shift and add an images list to a single image @param final Combined image, assumed to be zero @param contrib Contribution map, assumed to be zero @param start_x Offset X-position for 1st pixel in 1st image @param start_y Offset Y-position for 1st pixel in 1st image @param ilist Input image list @param offs List of offsets in x and y @param xyprofile The sampling profile (weight) @param tabsperpix Number of profile-samples per pixel @see cpl_geom_img_offset_saa() */ /*----------------------------------------------------------------------------*/ static void CPL_TYPE_ADD(cpl_geom_img_offset_saa_all)(cpl_image * final, cpl_image * contrib, double start_x, double start_y, const cpl_imagelist * ilist, const cpl_bivector * offs, const cpl_vector * xyprofile, cpl_size tabsperpix) { const cpl_size nima = cpl_imagelist_get_size(ilist); const cpl_image * img1 = cpl_imagelist_get_const(ilist, 0); const cpl_size sizex = cpl_image_get_size_x(img1); const cpl_size sizey = cpl_image_get_size_y(img1); const cpl_size nx = cpl_image_get_size_x(final); const cpl_size ny = cpl_image_get_size_y(final); CPL_TYPE * po = CPL_TYPE_ADD(cpl_image_get_data)(final); const double * offs_x = cpl_bivector_get_x_data_const(offs); const double * offs_y = cpl_bivector_get_y_data_const(offs); const double * interp_kernel = cpl_vector_get_data_const(xyprofile); /* The contribution map. */ int * pcontrib = cpl_image_get_data_int(contrib); /* A more compact contribution map yields a small performance gain */ unsigned char * pcb = cpl_calloc(1, nx * ny); const unsigned char * pbjr = pcb; /* Pointer for j'th row of pcb */ /* The resampling coefficients, 4 in X and 4 in Y. No speed-up by declaring as CPL_TYPE. No speed-up by forming the 16 products (saves four multiplications, but introduces eight reads). */ double rsc[8]; cpl_flops myintp_count = 0; cpl_flops myaddp_count = 0; cpl_flops myflop_count = nx * ny + 4 * nima; cpl_size i, j, p; /* Triple loop */ for (p = 0; p < nima; p++) { const cpl_image * imgp = cpl_imagelist_get_const(ilist, p); const CPL_TYPE * pij = CPL_TYPE_ADD_CONST(cpl_image_get_data)(imgp); const double offset_x = start_x - offs_x[p]; const double offset_y = start_y - offs_y[p]; const double suboff_x = offset_x - floor(offset_x); const double suboff_y = offset_y - floor(offset_y); const cpl_size offset_i = (int)floor(offset_x); const cpl_size offset_j = (int)floor(offset_y); /* Which tabulated value index shall be used? */ const cpl_size tabx = (int)(0.5 + suboff_x * (double)(tabsperpix)); const cpl_size taby = (int)(0.5 + suboff_y * (double)(tabsperpix)); CPL_TYPE * poj = po; int * pcj = pcontrib; unsigned char * pbj = pcb; /* Pointer for j'th row of pcb */ if (tabx == 0 && taby == 0) { /* No sub-pixel shift, add input image */ /* In this context, the pixels are numbered from 0. */ /* First source location used */ const int px0 = CX_MAX(0, offset_i); const int py0 = CX_MAX(0, offset_j); /* First source location not used */ const int px1 = CX_MIN(sizex, nx + offset_i); const int py1 = CX_MIN(sizey, ny + offset_j); int px, py; /* Offset the pointers so a single variable suffices for the indexing. */ poj += (py0 - offset_j) * nx - offset_i; pcj += (py0 - offset_j) * nx - offset_i; pbj += (py0 - offset_j) * nx - offset_i; pij += py0 * sizex; myaddp_count += (py1 - py0) * (px1 - px0); for (py = py0; py < py1; py++, poj += nx, pcj += nx, pbj += nx, pij += sizex) { for (px = px0; px < px1; px++) { poj[px] += pij[px]; if (++pbj[px] == 0) pcj[px] += 256; } } } else { const double sumrs = ( interp_kernel[ tabsperpix + tabx] + interp_kernel[ tabx] + interp_kernel[ tabsperpix - tabx] + interp_kernel[2 * tabsperpix - tabx]) * ( interp_kernel[ tabsperpix + taby] + interp_kernel[ taby] + interp_kernel[ tabsperpix - taby] + interp_kernel[2 * tabsperpix - taby]); /* Interpolate values from any source pixel at least 2 pixels away from the source boundary */ /* In this context, the pixels are numbered from 0. */ /* First source location used */ const int px0 = CX_MAX(2, offset_i); const int py0 = CX_MAX(2, offset_j); /* First source location not used */ const int px1 = CX_MIN(sizex - 2, nx + offset_i); const int py1 = CX_MIN(sizey - 2, ny + offset_j); int px, py; /* Number of interpolated pixels */ myintp_count += 11 + 36 * (py1 - py0) * (px1 - px0); /* Compute resampling coefficients */ /* rsc[0..3] in x, rsc[4..7] in y */ /* Also divide the y-rsc with the sum of the rsc */ rsc[0] = interp_kernel[ tabsperpix + tabx]; rsc[1] = interp_kernel[ tabx]; rsc[2] = interp_kernel[ tabsperpix - tabx]; rsc[3] = interp_kernel[2 * tabsperpix - tabx]; rsc[4] = interp_kernel[ tabsperpix + taby] / sumrs; rsc[5] = interp_kernel[ taby] / sumrs; rsc[6] = interp_kernel[ tabsperpix - taby] / sumrs; rsc[7] = interp_kernel[2 * tabsperpix - taby] / sumrs; /* Interpolate from input image */ /* Offset the pointers so a single variable suffices for the indexing. */ poj += (py0 - offset_j) * nx - offset_i; pcj += (py0 - offset_j) * nx - offset_i; pbj += (py0 - offset_j) * nx - offset_i; pij += py0 * sizex; for (py = py0; py < py1; py++, poj += nx, pcj += nx, pbj += nx, pij += sizex) { for (px = px0; px < px1; px++) { /* Compute interpolated pixel now */ poj[px] += rsc[4] * ( rsc[0] * pij[px - 1 - sizex] + rsc[1] * pij[px - sizex] + rsc[2] * pij[px + 1 - sizex] + rsc[3] * pij[px + 2 - sizex] ) + rsc[5] * ( rsc[0] * pij[px - 1] + rsc[1] * pij[px ] + rsc[2] * pij[px + 1] + rsc[3] * pij[px + 2] ) + rsc[6] * ( rsc[0] * pij[px - 1 + sizex] + rsc[1] * pij[px + sizex] + rsc[2] * pij[px + 1 + sizex] + rsc[3] * pij[px + 2 + sizex] ) + rsc[7] * ( rsc[0] * pij[px - 1 + sizex * 2] + rsc[1] * pij[px + sizex * 2] + rsc[2] * pij[px + 1 + sizex * 2] + rsc[3] * pij[px + 2 + sizex * 2] ); if (++pbj[px] == 0) pcj[px] += 256; } } } } for (j = 0; j < ny; j++, po += nx, pcontrib += nx, pbjr += nx) { for (i = 0; i < nx; i++) { pcontrib[i] += (int)pbjr[i]; if (pcontrib[i] > 0) { po[i] /= (CPL_TYPE)pcontrib[i]; } else { cpl_image_reject(final, i+1, j+1); myflop_count--; } } } cpl_tools_add_flops(myflop_count + myintp_count + myaddp_count); cpl_free(pcb); return; } #undef CPL_TYPE_ADD #undef CPL_TYPE_ADD_CONST cpl-6.4.1/cpldrs/cpl_wcs.c0000644000460300003120000016723612277350203012317 00000000000000/* $Id: cpl_wcs.c,v 1.55 2013-04-26 13:44:02 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-26 13:44:02 $ * $Revision: 1.55 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*---------------------------------------------------------------------------- Includes ----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include #include "cpl_wcs.h" #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ /* * Undefine PACKAGE_ symbols to avoid redefinition warnings from the compiler. * Although these symbols are meant for internal use wcslib exports them in * as part of a public header. */ #ifdef PACKAGE_NAME # undef PACKAGE_NAME #endif #ifdef PACKAGE_VERSION # undef PACKAGE_VERSION #endif #ifdef PACKAGE_TARNAME # undef PACKAGE_TARNAME #endif #ifdef PACKAGE_STRING # undef PACKAGE_STRING #endif #ifdef PACKAGE_BUGREPORT # undef PACKAGE_BUGREPORT #endif #include #endif /* End If WCS is installed */ /*---------------------------------------------------------------------------*/ /** * @defgroup cpl_wcs World Coordinate System * * This module provides functions to manipulate FITS World Coordinate Systems * * A @em cpl_wcs is an object containing a pointer to the WCSLIB structure * and the physical dimensions of the image from which the WCS was read. * The functionality provided includes general transformations between physical * and world coordinates as well as a few convenience routines for * x,y <=> RA,Dec transformations. * * @par Synopsis: * @code * #include "cpl_wcs.h" * @endcode */ /*---------------------------------------------------------------------------*/ /**@{*/ /*---------------------------------------------------------------------------- Type definition ----------------------------------------------------------------------------*/ #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ struct _cpl_wcs_ { struct wcsprm *wcsptr; /* WCSLIB structure */ int istab; /* Set if header is from a table */ int naxis; /* Number of dimensions of the image */ int *dims; /* Dimensions of image */ cpl_array *imdims; /* Wrapper for image dimensions */ cpl_array *crval; /* CRVALia keyvalues for each coord axis */ cpl_array *crpix; /* CRPIXja keyvalues for each pixel axis */ cpl_array *ctype; /* CTYPEja keyvalues for each pixel axis */ cpl_array *cunit; /* CUNITja keyvalues for each pixel axis */ cpl_matrix *cd; /* CDi_ja linear transformation matrix */ }; /*---------------------------------------------------------------------------- Private functions ----------------------------------------------------------------------------*/ static cpl_wcs *cpl_wcs_init(void) CPL_ATTR_ALLOC; /* Fix when cfitsio is upgraded */ /* static char *cpl_wcs_plist2fitsstr(const cpl_propertylist *self); */ static char *cpl_wcs_plist2fitsstr(const cpl_propertylist *self, int *nkeys); static cpl_propertylist *cpl_wcs_fitsstr2plist(const char *fitsstr) CPL_ATTR_ALLOC; static void cpl_wcs_platesol_4(const cpl_matrix *xy, const cpl_matrix *std, const cpl_array *bad, cpl_array **plateconsts) CPL_ATTR_NONNULL; static void cpl_wcs_platesol_6(const cpl_matrix *xy, const cpl_matrix *std, const cpl_array *bad, cpl_array **plateconsts) CPL_ATTR_NONNULL; static int _cpl_wcsset(cpl_wcs *wcs); #ifdef fits_write_hdu /* fits_write_hdu() was introduced in CFITSIO version 3.03 */ #define cpl_wcs_ffhdr2str fits_hdr2str #else static int cpl_wcs_ffhdr2str(fitsfile *fptr, int exclude_comm, char **exclist, int nexc, char **header, int *nkeys, int *status); #endif #endif /* End If WCS is installed */ /*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ /** * @brief * Create a wcs structure by parsing a propertylist. * * @param plist The input propertylist * * @return * The newly created and filled cpl_wcs object or NULL if it could not be * created. In the latter case an appropriate error code is set. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter plist is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * NAXIS information in image propertylist is not an integer *
CPL_ERROR_DATA_NOT_FOUND * Error in getting NAXIS information for image propertylists *
CPL_ERROR_UNSPECIFIED * An unspecified error occurred in the WCSLIB routine. *
CPL_ERROR_NO_WCS * The WCS sub library is not available. *
* @enderror * * The function allocates memory for a WCS structure. A pointer to the WCSLIB * header information is created by parsing the FITS WCS keywords from the * header of a file. A few ancillary items are also filled in. * * It is allowed to pass a cpl_propertylist with a valid WCS structure and * NAXIS = 0, such a propertylist can be created by cpl_wcs_platesol(). * In this case a cpl_wcs object is returned for which the dimensional * information (accessible via cpl_wcs_get_image_dims()) will be NULL. * * The returned property must be destroyed using the wcs destructor * @b cpl_wcs_delete(). * * @see cpl_wcs_delete() */ cpl_wcs *cpl_wcs_new_from_propertylist(const cpl_propertylist *plist) { #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ char *shdr; cpl_wcs *wcs; cpl_propertylist *testp; int retval,nrej,nwcs; int np = 0; int istab = -1; struct wcsprm *wwcs = NULL; /* Check to see if the propertylist exists */ cpl_ensure(plist != NULL, CPL_ERROR_NULL_INPUT, NULL); /* See if the propertylist has some form of WCS in it */ testp = cpl_propertylist_new(); if (!cpl_propertylist_copy_property_regexp(testp, plist, "^CRVAL", 0) && cpl_propertylist_get_size(testp) > 0) { istab = 0; } else if (!cpl_propertylist_copy_property_regexp(testp, plist, "^TCRVL", 0) && cpl_propertylist_get_size(testp) > 0) { istab = 1; } else { /* The input propertylist contains no WCS */ /* FIXME: This error code is not according to the doxygen */ (void)cpl_error_set_(CPL_ERROR_UNSPECIFIED); } cpl_propertylist_delete(testp); if (istab < 0) return NULL; /* Get a cpl_wcs structure and initialise it */ wcs = cpl_wcs_init(); /* Convert the propertylist into a string */ shdr = cpl_wcs_plist2fitsstr(plist, &np); if (shdr == NULL) { cpl_error_set_where_(); cpl_wcs_delete(wcs); return(NULL); } /* Parse the header to get the wcslib structure */ if (! istab) retval = wcspih(shdr,np,0,0,&nrej,&nwcs,&wwcs); else retval = wcsbth(shdr,np,0,0,0,NULL,&nrej,&nwcs,&wwcs); free(shdr); if (retval != 0) { wcsvfree(&nwcs,&wwcs); cpl_wcs_delete(wcs); if (istab) (void)cpl_error_set_wcs(CPL_ERROR_UNSPECIFIED, retval, "wcsbth", "np=%d", np); else (void)cpl_error_set_wcs(CPL_ERROR_UNSPECIFIED, retval, "wcspih", "np=%d", np); return NULL; } wcs->istab = istab; /* Now extract the one you want and ditch the rest */ wcs->wcsptr = (struct wcsprm *)cpl_calloc(1,sizeof(struct wcsprm)); (wcs->wcsptr)->flag = -1; wcscopy(1,wwcs,wcs->wcsptr); wcsset(wcs->wcsptr); wcsvfree(&nwcs,&wwcs); wcs->naxis = wcs->wcsptr->naxis; if (wcs->naxis > 0) { int k = 0; /* If this is a table, then just copy the vital WCS information over and leave the image dimensional information as NULL */ wcs->crval = cpl_array_wrap_double(wcs->wcsptr->crval, wcs->naxis); wcs->crpix = cpl_array_wrap_double(wcs->wcsptr->crpix, wcs->naxis); wcs->cd = cpl_matrix_wrap(wcs->naxis, wcs->naxis, wcs->wcsptr->lin.piximg); /* * Make the contents of CUNITia and CTYPEia available through * accessors. * * Due to the way wcslib stores this information, wrapping * wcsptr->cunit and wcsptr->ctype is not possible, and therefore * the elements have to be copied. * * NOTE: The elements of wcsptr->cuint and wcsptr->ctype get updated * when wcsset() is called. Thus the copy has to be updated after each * call to wcsset()! * * Apart from this function where the structure is initially created * use _cpl_wcsset() to make sure that the copied fields get properly * updated */ wcs->ctype = cpl_array_new(wcs->naxis, CPL_TYPE_STRING); wcs->cunit = cpl_array_new(wcs->naxis, CPL_TYPE_STRING); for (k = 0; k < wcs->naxis; ++k) { cpl_array_set_string(wcs->ctype, k, wcs->wcsptr->ctype[k]); cpl_array_set_string(wcs->cunit, k, wcs->wcsptr->cunit[k]); } if (! istab ) { cpl_errorstate prevstate = cpl_errorstate_get(); /* This is an image, see if it's a compressed image */ const int compressed = cpl_propertylist_has(plist, "ZNAXIS"); const char * fmt = compressed ? "ZNAXIS%d" : "NAXIS%d"; int i = wcs->naxis; char * nax = cpl_sprintf(fmt, i); /* Sufficient, minimal length */ char * naxd = nax + (compressed ? 6 : 5); /* Digit(s) start here */ /* Now copy the stuff over to someplace where we can get it */ wcs->dims = cpl_malloc((size_t)wcs->naxis * sizeof(int)); /* Get the image size information */ for (; i > 0;) { const int inax = cpl_propertylist_get_int(plist, nax); if (!cpl_errorstate_is_equal(prevstate)) break; /* Card not OK*/ i--; wcs->dims[i] = inax; (void)sprintf(naxd, "%d", i); /* Cannot overflow buffer */ } cpl_free(nax); if (i > 0) { /* Set the image dimensional information as NULL */ cpl_errorstate_set(prevstate); cpl_free(wcs->dims); wcs->dims = NULL; wcs->imdims = NULL; wcs->naxis = 0; /* crval, crpix and cd are still non-NULL */ } else { wcs->imdims = cpl_array_wrap_int(wcs->dims, wcs->naxis); } } } else { /* FIXME: Is it correct/necessary to set to NULL ? */ wcs->crval = NULL; wcs->crpix = NULL; wcs->ctype = NULL; wcs->cunit = NULL; wcs->cd = NULL; } return(wcs); #else cpl_ensure(plist != NULL, CPL_ERROR_NULL_INPUT, NULL); (void)cpl_error_set_(CPL_ERROR_NO_WCS); return NULL; #endif /* End If WCS is installed */ } /** * @brief * Destroy a WCS structure * * @param wcs The WCS structure to destroy * * @return * Nothing. * * @error * * * * * *
CPL_ERROR_NO_WCS * The WCS sub library is not available. *
* @enderror * The function destroys the WCS structure @em wcs and its whole * contents. If @em wcs is @c NULL, nothing is done and no error is set. */ void cpl_wcs_delete(cpl_wcs *wcs) { if (wcs == NULL) return; #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ /* Free the workspace */ if (wcs->naxis != 0) { cpl_free(wcs->dims); cpl_array_unwrap(wcs->imdims); } cpl_array_unwrap(wcs->crval); cpl_array_unwrap(wcs->crpix); cpl_array_delete(wcs->ctype); cpl_array_delete(wcs->cunit); cpl_matrix_unwrap(wcs->cd); if (wcs->wcsptr != NULL) { (void)wcsfree(wcs->wcsptr); cpl_free(wcs->wcsptr); } cpl_free(wcs); #else cpl_error_set_(CPL_ERROR_NO_WCS); #endif /* End If WCS is installed */ } /** * @brief * Convert between physical and world coordinates. * * @param wcs The input cpl_wcs structure * @param from The input coordinate matrix * @param to The output coordinate matrix * @param status The output status array * @param transform The transformation mode * * @return * An appropriate error code. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter wcs, from, to or status is a NULL pointer * or wcs is missing some of its information. *
CPL_ERROR_UNSPECIFIED * No rows or columns in the input matrix, or an unspecified error * has occurred in the WCSLIB routine *
CPL_ERROR_UNSUPPORTED_MODE * The input conversion mode is not supported *
CPL_ERROR_NO_WCS * The WCS sub library is not available. *
* @enderror * * This function converts between several types of coordinates. These include: * -- physical coordinates: The physical location on a detector (i.e. * pixel coordinates) * -- world coordinates: The real astronomical coordinate system for the * observations. This may be spectral, celestial, * time, etc. * -- standard coordinates: These are an intermediate relative coordinate * representation, defined as a distance from * a reference point in the natural units of the * world coordinate system. Any defined projection * geometry will have already been included in * the definition of standard coordinates. * * The supported conversion modes are: * -- CPL_WCS_PHYS2WORLD: Converts input physical to world coordinates * -- CPL_WCS_WORLD2PHYS: Converts input world to physical coordinates * -- CPL_WCS_WORLD2STD: Converts input world to standard coordinates * -- CPL_WCS_PHYS2STD: Converts input physical to standard coordinates * * The input cpl_matrix @b from has to be filled with coordinates. The number of * rows equals the number of objects and the number of columns has to be equal to * the value of the NAXIS keyword in the @b wcs structure. The same convention is used * for the output cpl_matrix @b to. For example, if an image contains NAXIS = 2 and * 100 stars with positions X,Y, the new matrix will be created: * @code * from = cpl_matrix_new(100, 2); * @endcode * Each element in column 0 will take a X coordinate and each element in column 1 * will take a Y coordinate. * * The output matrix and status arrays will be allocated here, and thus will * need to be freed by the calling routine. The status array is used to flag * input coordinates where there has been some sort of failure in the * transformation. * */ cpl_error_code cpl_wcs_convert(const cpl_wcs *wcs, const cpl_matrix *from, cpl_matrix **to, cpl_array **status, cpl_wcs_trans_mode transform) { #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ const cpl_size mrows = cpl_matrix_get_nrow(from); const cpl_size mcols = cpl_matrix_get_ncol(from); const int nrows = (int)mrows; const int ncols = (int)mcols; int *sdata,retval; cpl_matrix *x1; cpl_array *x2,*x3; double *tdata,*x1data,*x2data,*x3data; const double *fdata; const char * wcsfunc = NULL; /* Basic checks on the input pointers */ cpl_ensure_code(wcs != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(from != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(to != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(status != NULL, CPL_ERROR_NULL_INPUT); /* FIXME: Perhaps this should be an assertion ? */ cpl_ensure_code(wcs->wcsptr != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code((cpl_size)nrows == mrows, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code((cpl_size)ncols == mcols, CPL_ERROR_ILLEGAL_INPUT); /* Initialise output */ *to = NULL; *status = NULL; /* Check the number of rows/columns for the input matrix */ if (nrows == 0 || ncols == 0) { /* Unreachable without a bug in CPL */ return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } /* Get the output memory and some memory for wcslib to use */ *to = cpl_matrix_new(mrows, mcols); *status = cpl_array_new(mrows, CPL_TYPE_INT); x1 = cpl_matrix_new(mrows, mcols); x2 = cpl_array_new(mrows, CPL_TYPE_DOUBLE); x3 = cpl_array_new(mrows, CPL_TYPE_DOUBLE); /* Now get the pointers for the data arrays */ fdata = cpl_matrix_get_data_const(from); tdata = cpl_matrix_get_data(*to); sdata = cpl_array_get_data_int(*status); x1data = cpl_matrix_get_data(x1); x2data = cpl_array_get_data_double(x2); x3data = cpl_array_get_data_double(x3); /* Right, now switch for the transform type. First physical to world coordinates */ switch (transform) { case CPL_WCS_PHYS2WORLD: wcsfunc = "wcsp2s"; retval = wcsp2s(wcs->wcsptr,nrows,wcs->naxis,fdata,x1data,x2data, x3data,tdata,sdata); break; case CPL_WCS_WORLD2PHYS: wcsfunc = "wcss2p"; retval = wcss2p(wcs->wcsptr,nrows,wcs->naxis,fdata,x2data,x3data, x1data,tdata,sdata); break; case CPL_WCS_WORLD2STD: wcsfunc = "wcss2p"; retval = wcss2p(wcs->wcsptr,nrows,wcs->naxis,fdata,x2data,x3data, tdata,x1data,sdata); break; case CPL_WCS_PHYS2STD: wcsfunc = "wcsp2s"; retval = wcsp2s(wcs->wcsptr,nrows,wcs->naxis,fdata,tdata,x2data, x3data,x1data,sdata); break; default: break; } /* Ditch the intermediate coordinate results */ cpl_matrix_delete(x1); cpl_array_delete(x2); cpl_array_delete(x3); if (wcsfunc == NULL) { cpl_matrix_delete(*to); cpl_array_delete(*status); *to = NULL; *status = NULL; return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } return retval ? cpl_error_set_wcs(retval == 1 ? CPL_ERROR_NULL_INPUT : CPL_ERROR_UNSPECIFIED, retval, wcsfunc, "transform=%d", transform) : CPL_ERROR_NONE; #else cpl_ensure_code(wcs != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(from != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(to != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(status != NULL, CPL_ERROR_NULL_INPUT); switch (transform) { case CPL_WCS_PHYS2WORLD: case CPL_WCS_WORLD2PHYS: case CPL_WCS_WORLD2STD: case CPL_WCS_PHYS2STD: break; default: return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } return cpl_error_set_(CPL_ERROR_NO_WCS); #endif /* End If WCS is installed */ } /** * @brief * Do a 2d plate solution given physical and celestial coordinates * * @param ilist The input property list containing the first pass WCS * @param cel The celestial coordinate matrix * @param xy The physical coordinate matrix * @param niter The number of fitting iterations * @param thresh The threshold for the fitting rejection cycle * @param fitmode The fitting mode (see below) * @param outmode The output mode (see below) * @param olist The output property list containing the new WCS * * @return * An appropriate error code. * * @error * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter cel is a NULL pointer, the parameter * xy is a NULL pointer or ilist is a * NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter niter is non-positive. *
CPL_ERROR_UNSPECIFIED * Unable to parse the input propertylist into a proper FITS WCS or * there are too few points in the input matrices for a fit. *
CPL_ERROR_INCOMPATIBLE_INPUT * The matrices cel and xy have different sizes. *
CPL_ERROR_UNSUPPORTED_MODE * Either fitmode or outmode are specified incorrectly *
CPL_ERROR_DATA_NOT_FOUND * The threshold is so low that no valid points are found. If the * threshold is not positive, this error is certain to occur. *
CPL_ERROR_NO_WCS * The WCS sub library is not available. *
* @enderror * * This function allows for the following type of fits: * -- CPL_WCS_PLATESOL_4: Fit for zero point, 1 scale and 1 rotation. * -- CPL_WCS_PLATESOL_6: Fit for zero point, 2 scales, 1 rotation, 1 shear. * * This function allows the zeropoint to be defined by shifting either the * physical or the celestial coordinates of the reference point: * -- CPL_WCS_MV_CRVAL: Keeps the physical point fixed and shifts the celestial * -- CPL_WCS_MV_CRPIX: Keeps the celestial point fixed and shifts the physical * * The output property list contains WCS relevant information only. * * The matrices @em cel, and @em xy have to be set up in the same way as it * is required for @b cpl_wcs_convert(). See the documentation of * @b cpl_wcs_convert() for details. * * @see cpl_wcs_convert() */ cpl_error_code cpl_wcs_platesol(const cpl_propertylist *ilist, const cpl_matrix *cel, const cpl_matrix *xy, int niter, float thresh, cpl_wcs_platesol_fitmode fitmode, cpl_wcs_platesol_outmode outmode, cpl_propertylist **olist) { #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ const cpl_size npts = cpl_matrix_get_nrow(cel); int iter,n,i; int * isbad; double xifit,etafit,mederr_xi,mederr_eta; double crval1,crval2,phi,theta; double crpix1 = 0.0; /* Avoid uninit warning (See below comment on pc) */ double crpix2 = 0.0; /* Avoid uninit warning (See below comment on pc) */ const double *xydata = cpl_matrix_get_data_const(xy); const double *pc = NULL; char *o; struct wcsprm *wp; cpl_wcs *wcs; cpl_matrix *std; const double *stddata; cpl_array *status, *bad, *plateconsts; double *eta_work; double *xi_work; double *med_work = NULL; int nbad = 0; int nprev = -1; cpl_error_code code = CPL_ERROR_NONE; /* Initialise the output pointer */ cpl_ensure_code(olist != NULL, CPL_ERROR_NULL_INPUT); *olist = NULL; /* Basic checks on the input pointers */ cpl_ensure_code(cel != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(xy != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(ilist != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(niter > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(fitmode == CPL_WCS_PLATESOL_6 || fitmode == CPL_WCS_PLATESOL_4, CPL_ERROR_UNSUPPORTED_MODE); /* Open the cpl_wcs structure */ wcs = cpl_wcs_new_from_propertylist(ilist); if (wcs == NULL) { return cpl_error_set_message_(CPL_ERROR_UNSPECIFIED, "Unable to parse header"); } /* Get the number of celestial points and compare this with the size of the matrix with the xy coordinates. Also look at the total number of points available */ if (npts != cpl_matrix_get_nrow(xy)) { cpl_wcs_delete(wcs); return cpl_error_set_(CPL_ERROR_INCOMPATIBLE_INPUT); } if (npts < 2) { cpl_wcs_delete(wcs); return cpl_error_set_message_(CPL_ERROR_UNSPECIFIED, "Insufficient " "points for a fit: npoints=%" CPL_SIZE_FORMAT " < 2", npts); } /* Convert the celestial coordinates to standard coordinates */ cpl_wcs_convert(wcs, cel, &std, &status, CPL_WCS_WORLD2STD); cpl_array_delete(status); stddata = cpl_matrix_get_data_const(std); /* Get some workspace for rejection algorithm */ eta_work = (double*)cpl_malloc((size_t)npts * sizeof(double)); xi_work = (double*)cpl_malloc((size_t)npts * sizeof(double)); /* Get an array to flag bad pairs */ isbad = (int*)cpl_calloc((size_t)npts, sizeof(int)); bad = cpl_array_wrap_int(isbad, npts); /* Iterative loop */ plateconsts = NULL; for (iter = 1;iter <= niter && nprev < nbad && nbad + 1 < npts; iter++) { double mederr; /* Do a plate solution */ cpl_array_delete(plateconsts); (fitmode == CPL_WCS_PLATESOL_6 ? cpl_wcs_platesol_6 : cpl_wcs_platesol_4) (xy, std, bad, &plateconsts); pc = cpl_array_get_data_double_const(plateconsts); /* Get the fit residuals */ n = 0; for (i = 0; i < npts; i++) { if (!isbad[i]) { const double xifiti = xydata[2*i]*pc[0] + xydata[2*i+1]*pc[1] + pc[2]; const double etafiti = xydata[2*i]*pc[3] + xydata[2*i+1]*pc[4] + pc[5]; xi_work [n] = fabs(xifiti - stddata[2*i]); eta_work[n] = fabs(etafiti - stddata[2*i+1]); n++; } } /* assert( n > 0 ); */ if (iter < niter) { /* No rejections in last iteration */ if (med_work == NULL) { /* Need copy due to permutation in median computation */ med_work = (double*)cpl_malloc( 2 * (size_t)n * sizeof(double)); } /* Get the median of the array */ (void)memcpy(med_work, xi_work, (size_t)n * sizeof(double)); (void)memcpy(med_work + n, eta_work, (size_t)n * sizeof(double)); mederr = 1.48 * cpl_tools_get_median_double(med_work, 2 * n); /* Now reject the bad ones... */ nprev = nbad; for (i = 0; i < npts; i++) { if (!isbad[i] && (eta_work[i] > thresh * mederr || xi_work [i] > thresh * mederr)) { isbad[i] = 1; nbad++; } } } } /* Do some intermediate tidying */ cpl_matrix_delete(std); cpl_array_delete(bad); cpl_free(med_work); if (nbad == npts) { cpl_array_delete(plateconsts); cpl_wcs_delete(wcs); cpl_free(eta_work); cpl_free(xi_work); return cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); } /* assert( pc != NULL ); */ /* Now work out the median error in each axis */ mederr_xi = 1.48 * cpl_tools_get_median_double(xi_work, n); mederr_eta = 1.48 * cpl_tools_get_median_double(eta_work, n); /* Do some intermediate tidying */ cpl_free(eta_work); cpl_free(xi_work); /* Define the reference point result */ wp = wcs->wcsptr; switch (outmode) { case CPL_WCS_MV_CRPIX: crpix1 = (pc[4]*pc[2] - pc[1]*pc[5])/(pc[3]*pc[1] - pc[4]*pc[0]); crpix2 = (pc[0]*pc[5] - pc[3]*pc[2])/(pc[3]*pc[1] - pc[4]*pc[0]); crval1 = (wp->crval)[0]; crval2 = (wp->crval)[1]; break; case CPL_WCS_MV_CRVAL: { int retval, sdata[] = {0}; crpix1 = (wp->crpix)[0]; crpix2 = (wp->crpix)[1]; xifit = crpix1*pc[0] + crpix2*pc[1] + pc[2]; etafit = crpix1*pc[3] + crpix2*pc[4] + pc[5]; retval = celx2s(&(wp->cel),1,1,2,2,&xifit,&etafit,&phi,&theta, &crval1,&crval2,sdata); if (retval) { cpl_wcs_delete(wcs); cpl_array_delete(plateconsts); return cpl_error_set_wcs(CPL_ERROR_UNSPECIFIED, retval, "celx2s", "niter=%d, thresh=%f, " "fitmode=%d, outmode=%d", niter, (double)thresh, (int)fitmode, (int)outmode); } break; } default: cpl_wcs_delete(wcs); cpl_array_delete(plateconsts); return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } /* Now update the wcs structure */ (wp->crval)[0] = crval1; (wp->crval)[1] = crval2; (wp->crpix)[0] = crpix1; (wp->crpix)[1] = crpix2; (wp->pc)[0] = pc[0]; (wp->pc)[1] = pc[1]; (wp->pc)[2] = pc[3]; (wp->pc)[3] = pc[4]; for (i = 0; i < 4; i++) (wp->cd)[i] = (wp->pc)[i]; (wp->cdelt)[0] = 1.0; (wp->cdelt)[1] = 1.0; (wp->csyer)[0] = mederr_xi; (wp->csyer)[1] = mederr_eta; _cpl_wcsset(wcs); /* Make a FITS string and convert it to a propertylist */ if (wcshdo(0,wp, &i, &o)) { code = CPL_ERROR_NULL_INPUT; } else { cpl_errorstate prestate = cpl_errorstate_get(); cpl_propertylist *pvlist; cpl_property *p; char *outstr = cpl_calloc((size_t)(i+1) * 80 + 1, 1); /* FITS END card */ const char *endcard = "END " " "; cpl_size nprop, iprop; strncpy(outstr, o, (size_t)i * 80); free(o); strncat(outstr,endcard,80); *olist = cpl_wcs_fitsstr2plist(outstr); cpl_free(outstr); for (i = 2; i > 0; --i) { unsigned int j; for (j = 2; j > 0; --j) { cx_string *cd = cx_string_new(); cx_string_sprintf(cd, "CD%1d_%1d", i, j); cpl_property *_p = cpl_property_new(cx_string_get(cd), CPL_TYPE_DOUBLE); cpl_property_set_double(_p, (wp->lin.piximg)[(i - 1) * 2 + (j - 1)]); cpl_property_set_comment(_p, "Coordinate transformation matrix " "element"); cx_string_delete(cd); cpl_propertylist_insert_after_property(*olist, "CRPIX2", _p); cpl_property_delete(_p); } } /* * Remove keywords which are not needed for the DICB required * CD representation of the linear transformation matrix. */ // FIXME: What about the RESTFRQ, RESTWAV stuff? Needed or not? cpl_propertylist_erase_regexp(*olist, "^PC[12]_[12]$", 0); cpl_propertylist_erase(*olist,"CDELT1"); cpl_propertylist_erase(*olist,"CDELT2"); cpl_propertylist_erase(*olist,"RESTFRQ"); cpl_propertylist_erase(*olist,"RESTWAV"); cpl_propertylist_erase(*olist,"END"); /* Fix boo-boo in wcslib */ /* The above uninformative comment means: Change type of PV-properties from int to double */ pvlist = cpl_propertylist_new(); cpl_propertylist_copy_property_regexp(pvlist, *olist, "PV", 0); nprop = cpl_propertylist_get_size(pvlist); for (iprop = 0; iprop < nprop; iprop++) { p = cpl_propertylist_get(pvlist, iprop); if (cpl_property_get_type(p) == CPL_TYPE_INT) { const int ival = cpl_property_get_int(p); cpl_propertylist_erase(*olist, cpl_property_get_name(p)); cpl_propertylist_append_double(*olist, cpl_property_get_name(p), (double)ival); } } cpl_propertylist_delete(pvlist); if (!cpl_errorstate_is_equal(prestate)) code = cpl_error_get_code(); } /* Tidy and exit */ cpl_array_delete(plateconsts); cpl_wcs_delete(wcs); return cpl_error_set_(code); #else cpl_ensure_code(olist != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cel != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(xy != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(ilist != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(niter > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(thresh > 0.0, CPL_ERROR_DATA_NOT_FOUND); switch (fitmode) { case CPL_WCS_PLATESOL_6: case CPL_WCS_PLATESOL_4: break; default: return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } switch (outmode) { case CPL_WCS_MV_CRPIX: case CPL_WCS_MV_CRVAL: break; default: return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } return cpl_error_set_(CPL_ERROR_NO_WCS); #endif /* End If WCS is installed */ } #ifdef CPL_WCS_IS_TABLE /** * @internal * @brief * Accessor to say whether the original header was from an image or a table * * @param wcs The WCS structure to examine * * @return * A flag where 0 -> the header was an image type or 1 -> the header was * a table type. If -1 is returned, then the header didn't parse correctly * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter wcs is a NULL pointer. *
CPL_ERROR_NO_WCS * The WCS sub library is not available. *
* @enderror * The function returns the flag defining the type of input header. * If the header was not parsed correctly then this is -1. */ int cpl_wcs_is_table(const cpl_wcs *wcs) { /* Check for NULL input */ cpl_ensure(wcs != NULL, CPL_ERROR_NULL_INPUT, -1); #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ /* Return the relevant value */ return(wcs->istab); #else (void)cpl_error_set_(CPL_ERROR_NO_WCS); return -1; #endif /* End If WCS is installed */ } #endif /** * @brief * Accessor to get the dimensionality of the image associated with a WCS * * @param wcs The WCS structure to examine * * @return * The image dimensionality, * or zero on error * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter wcs is a NULL pointer. *
CPL_ERROR_NO_WCS * The WCS sub library is not available. *
* @enderror * The function returns the dimensionality of the image associated with a WCS. * If no image was used to define the WCS then a value of zero is returned. */ int cpl_wcs_get_image_naxis(const cpl_wcs *wcs) { /* Check for NULL input */ cpl_ensure(wcs != NULL, CPL_ERROR_NULL_INPUT, 0); #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ /* Return the relevant value */ return(wcs->naxis); #else (void)cpl_error_set_(CPL_ERROR_NO_WCS); return 0; #endif /* End If WCS is installed */ } /** * @brief * Accessor to get the axis lengths of the image associated with a WCS * * @param wcs The WCS structure to examine * * @return * An array with the image axis sizes, or NULL on error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter wcs is a NULL pointer. *
CPL_ERROR_NO_WCS * The WCS sub library is not available. *
* @enderror * The function returns a handle to an array with the axis lengths of the image * associated with this WCS. If no image was used to define the WCS then * a NULL value will be returned. */ const cpl_array *cpl_wcs_get_image_dims(const cpl_wcs *wcs) { /* Check for NULL input */ cpl_ensure(wcs != NULL, CPL_ERROR_NULL_INPUT, NULL); #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ /* Return the array, or NULL when unavailable */ return wcs->naxis == 0 ? NULL : wcs->imdims; #else (void)cpl_error_set_(CPL_ERROR_NO_WCS); return NULL; #endif /* End If WCS is installed */ } /** * @brief * Accessor to get the CRVAL vector for a WCS * * @param wcs The WCS structure to examine * * @return * A handle to an array with the CRVALia keyvalues for each coord axis, * or NULL on error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter wcs is a NULL pointer. *
CPL_ERROR_NO_WCS * The WCS sub library is not available. *
* @enderror * The function returns a handle to an array with the CRVAL vector defined for * this WCS. */ const cpl_array *cpl_wcs_get_crval(const cpl_wcs *wcs) { /* Check for NULL input */ cpl_ensure(wcs != NULL, CPL_ERROR_NULL_INPUT, NULL); #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ return wcs->wcsptr->naxis == 0 ? NULL : wcs->crval; #else cpl_ensure(wcs != NULL, CPL_ERROR_NULL_INPUT, NULL); (void)cpl_error_set_(CPL_ERROR_NO_WCS); return NULL; #endif /* End If WCS is installed */ } /** * @brief * Accessor to get the CRPIX vector for a WCS * * @param wcs The WCS structure to examine * * @return * A handle to an array with the CRPIXja keyvalues for each pixel axis, * or NULL on error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter wcs is a NULL pointer. *
CPL_ERROR_NO_WCS * The WCS sub library is not available. *
* @enderror * The function returns a handle to an array with the CRPIX vector defined for * this WCS. */ const cpl_array *cpl_wcs_get_crpix(const cpl_wcs *wcs) { /* Check for NULL input */ cpl_ensure(wcs != NULL, CPL_ERROR_NULL_INPUT, NULL); #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ return wcs->wcsptr->naxis == 0 ? NULL : wcs->crpix; #else cpl_ensure(wcs != NULL, CPL_ERROR_NULL_INPUT, NULL); (void)cpl_error_set_(CPL_ERROR_NO_WCS); return NULL; #endif /* End If WCS is installed */ } /** * @brief * Accessor to get the CTYPE vector for a WCS * * @param wcs The WCS structure to examine * * @return * A handle to an array with the CTYPEja keyvalues for each pixel axis, * or NULL on error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter wcs is a NULL pointer. *
CPL_ERROR_NO_WCS * The WCS sub library is not available. *
* @enderror * The function returns a handle to an array with the CTYPE vector defined for * this WCS. */ const cpl_array *cpl_wcs_get_ctype(const cpl_wcs *wcs) { /* Check for NULL input */ cpl_ensure(wcs != NULL, CPL_ERROR_NULL_INPUT, NULL); #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ return wcs->wcsptr->naxis == 0 ? NULL : wcs->ctype; #else cpl_ensure(wcs != NULL, CPL_ERROR_NULL_INPUT, NULL); (void)cpl_error_set_(CPL_ERROR_NO_WCS); return NULL; #endif /* End If WCS is installed */ } /** * @brief * Accessor to get the CUNIT vector for a WCS * * @param wcs The WCS structure to examine * * @return * A handle to an array with the CUNITja keyvalues for each pixel axis, * or NULL on error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter wcs is a NULL pointer. *
CPL_ERROR_NO_WCS * The WCS sub library is not available. *
* @enderror * The function returns a handle to an array with the CUNIT vector defined for * this WCS. */ const cpl_array *cpl_wcs_get_cunit(const cpl_wcs *wcs) { /* Check for NULL input */ cpl_ensure(wcs != NULL, CPL_ERROR_NULL_INPUT, NULL); #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ return wcs->wcsptr->naxis == 0 ? NULL : wcs->cunit; #else cpl_ensure(wcs != NULL, CPL_ERROR_NULL_INPUT, NULL); (void)cpl_error_set_(CPL_ERROR_NO_WCS); return NULL; #endif /* End If WCS is installed */ } /** * @brief * Accessor to get the CD matrix for a WCS * * @param wcs The WCS structure to examine * * @return * A handle to a matrix with the CDi_ja linear transformation matrix, * or NULL on error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter wcs is a NULL pointer. *
CPL_ERROR_NO_WCS * The WCS sub library is not available. *
* @enderror * The function returns a handle to a matrix with the CD matrix defined for * this WCS. */ const cpl_matrix *cpl_wcs_get_cd(const cpl_wcs *wcs) { /* Check for NULL input */ cpl_ensure(wcs != NULL, CPL_ERROR_NULL_INPUT, NULL); #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ return wcs->wcsptr->naxis == 0 ? NULL : wcs->cd; #else (void)cpl_error_set_(CPL_ERROR_NO_WCS); return NULL; #endif /* End If WCS is installed */ } /**@}*/ #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ /*-------------------------------------------------------------------------*/ /** * @internal * @brief * Create an empty wcs structure. * * @return * The output wcs structure * * @error * None * * This is a static routine that creates an empty cpl_wcs structure. */ static cpl_wcs *cpl_wcs_init(void) { /* Get the main structure workspace */ cpl_wcs * self = (cpl_wcs *)cpl_malloc(sizeof(cpl_wcs)); /* Initialise the output structure */ self->istab = -1; self->wcsptr = NULL; self->naxis = 0; self->dims = NULL; self->imdims = NULL; self->crval = NULL; self->crpix = NULL; self->ctype = NULL; self->cunit = NULL; self->cd = NULL; return(self); } /** * @internal * @brief * Convert a propertylist to a FITS string * * @param self The input propertylist * @param nkeys On success, *nkeys points to the number of keys (cards) * * @return * The output character string with the properties formatted as in a FITS * header. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This converts a propertylist into a single string with all properties formatted * as FITS cards. This is needed for wcspih. The output string must be freed by * the calling routine. */ /* static char *cpl_wcs_plist2fitsstr(const cpl_propertylist *self) { */ static char *cpl_wcs_plist2fitsstr(const cpl_propertylist *self, int *nkeys) { char * header = NULL; int ioerror = 0; fitsfile * fptr; /* Sanity testing of input propertylist */ if (self == NULL) { (void)cpl_error_set_(CPL_ERROR_NULL_INPUT); return(NULL); } /* Open a memory file with CFITSIO */ if (fits_create_file(&fptr, "mem://", &ioerror)) { (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, ioerror, fits_create_file, "filename='mem://'"); return NULL; } /* Add the properties into the FITS file */ if (cpl_propertylist_to_fitsfile(fptr, self, NULL)) { (void)cpl_error_set_where_(); return NULL; } /* Parse the header */ if (cpl_wcs_ffhdr2str(fptr, 1, NULL, 0, &header, nkeys, &ioerror)) { (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, ioerror, fits_hdr2str, "filename='mem://'"); ioerror = 0; } /* The close will likely fail due to a missing 1st SIMPLE/EXTENSION key */ if (fits_close_file(fptr, &ioerror) && ioerror != UNKNOWN_REC && ioerror != NO_SIMPLE) { free(header); header = NULL; (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, ioerror, fits_close_file, "filename='mem://'"); } return(header); } /** * @internal * @brief * Convert a FITS string to a propertylist * * @param fitsstr The input FITS header string * * @return * The output propertylist. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter fitsstr is a NULL pointer. *
* @enderror * * This converts a single string formatted with FITS cards into a propertylist. * This is needed for wcspih. The output propertylist must be freed by the * calling routine */ static cpl_propertylist *cpl_wcs_fitsstr2plist(const char *fitsstr) { int ioerror = 0; fitsfile * fptr; const char * f = fitsstr; cpl_propertylist * p = NULL; /* Check input */ if (fitsstr == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return(NULL); } /* Create a memory file using CFITSIO. We can then add individual cards to the header and allow CFITSIO to decide on data types etc. */ if (fits_create_file(&fptr, "mem://", &ioerror)) { (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, ioerror, fits_create_file, "fitsstr='%s'", fitsstr); return NULL; } /* Loop for all the cards in the FITS string and add them to the memory FITS header */ while (strncmp(f, "END ", 8) && !fits_insert_card(fptr, f, &ioerror)) { f += (FLEN_CARD - 1); } if (ioerror || fits_insert_card(fptr, f, &ioerror)) { (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, ioerror, fits_insert_card, "fitsstr='%s'", fitsstr); ioerror = 0; } else { /* Now create the propertylist */ p = cpl_propertylist_from_fitsfile(fptr); } /* The close will likely fail due to a missing 1st SIMPLE/EXTENSION key */ if (fits_close_file(fptr, &ioerror) && ioerror != UNKNOWN_REC && ioerror != NO_SIMPLE) { cpl_propertylist_delete(p); p = NULL; (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, ioerror, fits_close_file, "fitsstr='%s'", fitsstr); } return(p); } /** * @internal * @brief * Do a 6 plate constant fit * * @param xy The matrix of physical coordinates * @param std The matrix of celestial coordinates * @param bad An array to flag points to be ignored from the fit * @param plateconsts The output array of plate constants * * @return * Nothing * * This routine fits the constants a,b,c,d,e,f to the equations: * xi = ax + by + c * eta = dx + ey + f * The values of these coefficients are passed back in the plateconsts * array. * */ static void cpl_wcs_platesol_6(const cpl_matrix *xy, const cpl_matrix *std, const cpl_array *bad, cpl_array **plateconsts) { double sx1sq,sy1sq,sx1y1,sx1x2,sy1x2,*pc; double sy1y2,sx1y2,xposmean,yposmean,ximean,etamean,xx1,yy1,xx2,yy2; /* Get some convenience variables */ const double *xydata = cpl_matrix_get_data_const(xy); const double *stddata = cpl_matrix_get_data_const(std); const int *isbad = cpl_array_get_data_int_const(bad); const cpl_size nstds = cpl_array_get_size(bad); cpl_size i,ngood; /* Initialise all the counters and summations */ sx1sq = 0.0; sy1sq = 0.0; sx1y1 = 0.0; sx1x2 = 0.0; sy1x2 = 0.0; sy1y2 = 0.0; sx1y2 = 0.0; xposmean = 0.0; yposmean = 0.0; ximean = 0.0; etamean = 0.0; /* Find means in each coordinate system */ ngood = 0; for (i = 0; i < nstds; i++) { if (isbad[i] != 0) continue; xposmean += xydata[2*i]; yposmean += xydata[2*i+1]; ximean += stddata[2*i]; etamean += stddata[2*i+1]; ngood++; } xposmean /= (double)ngood; yposmean /= (double)ngood; ximean /= (double)ngood; etamean /= (double)ngood; /* Now accumulate the sums */ for (i = 0; i < nstds; i++) { if (! isbad[i]) { xx1 = xydata[2*i] - xposmean; yy1 = xydata[2*i+1] - yposmean; xx2 = stddata[2*i] - ximean; yy2 = stddata[2*i+1] - etamean; sx1sq += xx1*xx1; sy1sq += yy1*yy1; sx1y1 += xx1*yy1; sx1x2 += xx1*xx2; sy1x2 += yy1*xx2; sy1y2 += yy1*yy2; sx1y2 += xx1*yy2; } } /* Get an output array for the results */ *plateconsts = cpl_array_new(6,CPL_TYPE_DOUBLE); pc = cpl_array_get_data_double(*plateconsts); /* Do solution for X */ pc[0] = (sx1y1*sy1x2 - sx1x2*sy1sq)/(sx1y1*sx1y1 - sx1sq*sy1sq); pc[1] = (sx1x2*sx1y1 - sx1sq*sy1x2)/(sx1y1*sx1y1 - sx1sq*sy1sq); pc[2] = -xposmean*pc[0] - yposmean*pc[1] + ximean; /* Now the solution for Y */ pc[3] = (sy1y2*sx1y1 - sy1sq*sx1y2)/(sx1y1*sx1y1 - sy1sq*sx1sq); pc[4] = (sx1y1*sx1y2 - sy1y2*sx1sq)/(sx1y1*sx1y1 - sy1sq*sx1sq); pc[5] = -xposmean*pc[3] - yposmean*pc[4] + etamean; } /** * @internal * @brief * Do a 4 plate constant fit * * @param xy The matrix of physical coordinates * @param std The matrix of celestial coordinates * @param bad An array to flag points to be ignored from the fit * @param plateconsts The output array of plate constants * * @return * Nothing * * This routine fits the constants a,b,c,d,e,f to the equations: * xi = ax + by + c * eta = dx + ey + f * but where the scale and rotation implied by the coefficients a,b,d,e are * constrained to be the same for each axis. The 6 coefficients are passed * back in the plateconsts array. * */ static void cpl_wcs_platesol_4(const cpl_matrix *xy, const cpl_matrix *std, const cpl_array *bad, cpl_array **plateconsts) { double sx1sq,sy1sq,sx1x2,sy1x2,sy1y2,sx1y2,xposmean,yposmean,*pc; double ximean,etamean,xx1,yy1,xx2,yy2,det,num,denom,theta,mag; double stheta,ctheta; /* Get some convenience variables */ const double *xydata = cpl_matrix_get_data_const(xy); const double *stddata = cpl_matrix_get_data_const(std); const int *isbad = cpl_array_get_data_int_const(bad); const cpl_size nstds = cpl_array_get_size(bad); cpl_size i,ngood; /* Initialise all the counters and summations */ sx1sq = 0.0; sy1sq = 0.0; sx1x2 = 0.0; sy1x2 = 0.0; sy1y2 = 0.0; sx1y2 = 0.0; xposmean = 0.0; yposmean = 0.0; ximean = 0.0; etamean = 0.0; /* Find means in each coordinate system */ ngood = 0; for (i = 0; i < nstds; i++) { if (isbad[i] != 0) continue; xposmean += xydata[2*i]; yposmean += xydata[2*i+1]; ximean += stddata[2*i]; etamean += stddata[2*i+1]; ngood++; } xposmean /= (double)ngood; yposmean /= (double)ngood; ximean /= (double)ngood; etamean /= (double)ngood; /* Now accumulate the sums */ for (i = 0; i < nstds; i++) { if (! isbad[i]) { xx1 = xydata[2*i] - xposmean; yy1 = xydata[2*i+1] - yposmean; xx2 = stddata[2*i] - ximean; yy2 = stddata[2*i+1] - etamean; sx1sq += xx1*xx1; sy1sq += yy1*yy1; sx1x2 += xx1*xx2; sy1x2 += yy1*xx2; sy1y2 += yy1*yy2; sx1y2 += xx1*yy2; } } /* Compute the rotation angle */ det = sx1x2*sy1y2 - sy1x2*sx1y2; if (det < 0.0) { num = sy1x2 + sx1y2; denom = -sx1x2 + sy1y2; } else { num = sy1x2 - sx1y2; denom = sx1x2 + sy1y2; } if (num == 0.0 && denom == 0.0) { theta = 0.0; } else { theta = atan2(num,denom); if (theta < 0.0) theta += CPL_MATH_2PI; } /* Compute magnification factor */ ctheta = cos(theta); stheta = sin(theta); num = denom*ctheta + num*stheta; denom = sx1sq + sy1sq; if (denom <= 0.0) { mag = 1.0; } else { mag = num/denom; } /* Get an output array for the results */ *plateconsts = cpl_array_new(6,CPL_TYPE_DOUBLE); pc = cpl_array_get_data_double(*plateconsts); /* Compute coeffs */ if (det < 0.0) { pc[0] = -mag*ctheta; pc[3] = mag*stheta; } else { pc[0] = mag*ctheta; pc[3] = -mag*stheta; } pc[1] = mag*stheta; pc[4] = mag*ctheta; pc[2] = -xposmean*pc[0] - yposmean*pc[1] + ximean; pc[5] = -xposmean*pc[3] - yposmean*pc[4] + etamean; } inline static int _cpl_wcsset(cpl_wcs *wcs) { int k; int status = wcsset(wcs->wcsptr); /* * Update indirectly, exported data which may have been updated by * the call to wcsset(). */ for (k = 0; k < wcs->naxis; ++k) { cpl_array_set_string(wcs->ctype, k, wcs->wcsptr->ctype[k]); cpl_array_set_string(wcs->cunit, k, wcs->wcsptr->cunit[k]); } return status; } #ifndef fits_write_hdu /*-------------------------------------------------------------------------*/ /* * NOTE: * Work around for cfitsio-2.5.10 memory errors in ffhdr2str(). This * problem has been fixed in cfitsio > 3.0.3. * In spite of the above comment: The below work-around is disabled for * cfitsio version >= 3.03, so we'll stick with that. */ /* read header keywords into a long string of chars. This routine allocates memory for the string, so the calling routine must eventually free the memory when it is not needed any more. If exclude_comm is TRUE, then all the COMMENT, HISTORY, and keywords will be excluded from the output string of keywords. Any other list of keywords to be excluded may be specified with the exclist parameter. */ static int cpl_wcs_ffhdr2str( fitsfile *fptr, /* I - FITS file pointer */ int exclude_comm, /* I - if TRUE, exclude commentary keywords */ char **exclist, /* I - list of excluded keyword names */ int nexc, /* I - number of names in exclist */ char **header, /* O - returned header string */ int *nkeys, /* O - returned number of 80-char keywords */ int *status) /* IO - error status */ { int casesn, match, exact, totkeys; long ii, jj; char keybuf[162], keyname[FLEN_KEYWORD], *headptr; /* NOTE: Use the actual CFITSIO function if the version number is more recent than 3.0.3 */ float version; fits_get_version(&version); if (version >= 3.030) return ffhdr2str(fptr, exclude_comm, exclist, nexc, header, nkeys, status); *nkeys = 0; if (*status > 0) return(*status); /* get number of keywords in the header (doesn't include END) */ if (ffghsp(fptr, &totkeys, NULL, status) > 0) return(*status); /* allocate memory for all the keywords (multiple of 2880 bytes) */ *header = (char *) calloc ( (totkeys + 1) * 80 + 1, 1); if (!(*header)) { *status = MEMORY_ALLOCATION; ffpmsg("failed to allocate memory to hold all the header keywords"); return(*status); } headptr = *header; casesn = FALSE; /* read every keyword */ for (ii = 1; ii <= totkeys; ii++) { ffgrec(fptr, ii, keybuf, status); /* pad record with blanks so that it is at least 80 chars long */ strcat(keybuf, " "); keyname[0] = '\0'; strncat(keyname, keybuf, 8); /* copy the keyword name */ if (exclude_comm) { if (!FSTRCMP("COMMENT ", keyname) || !FSTRCMP("HISTORY ", keyname) || !FSTRCMP(" ", keyname) ) continue; /* skip this commentary keyword */ } /* does keyword match any names in the exclusion list? */ for (jj = 0; jj < nexc; jj++ ) { ffcmps(exclist[jj], keyname, casesn, &match, &exact); if (match) break; } if (jj == nexc) { /* not in exclusion list, add this keyword to the string */ strcpy(headptr, keybuf); headptr += 80; (*nkeys)++; } } /* add the END keyword */ strcpy(headptr, "END "); headptr += 80; (*nkeys)++; *headptr = '\0'; /* terminate the header string */ /* * This is the actual fix for this function * (Version 2.510 forgot to assign result to *header) */ *header = realloc(*header, (*nkeys *80) + 1); /* minimize the allocated memory */ return(*status); } #endif #endif /* End If WCS is installed */ cpl-6.4.1/cpldrs/cpl_ppm.h0000644000460300003120000000317211615763275012324 00000000000000/* $Id: cpl_ppm.h,v 1.10 2011-08-02 11:59:57 rpalsa Exp $ * * This file is part of the VIMOS Pipeline * Copyright (C) 2002-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-08-02 11:59:57 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_PPM_H #define CPL_PPM_H #include #include CPL_BEGIN_DECLS cpl_bivector *cpl_ppm_match_positions(const cpl_vector *, const cpl_vector *, double, double, double, cpl_array **, cpl_array **); cpl_array *cpl_ppm_match_points(const cpl_matrix *, cpl_size, double, const cpl_matrix *, cpl_size, double, double, double, cpl_matrix **, cpl_matrix **, double *, double *); CPL_END_DECLS #endif /* CPL_PPM_H */ cpl-6.4.1/cpldrs/Makefile.am0000644000460300003120000000535712127227645012557 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO Common Pipeline Library ## Copyright (C) 2001-2008 European Southern Observatory ## 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 2 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 02111-1307 USA AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ if MAINTAINER_MODE MAINTAINERCLEANFILES = $(srcdir)/Makefile.in endif SUBDIRS = tests # Place optional 3rd party components last since those locations may contain # obsolete and therefore unwanted CFITSIO installations AM_CPPFLAGS = -DCX_LOG_DOMAIN=\"CplDrs\" \ $(CPLDRS_INCLUDES) $(CPLCORE_INCLUDES) $(CX_INCLUDES) \ $(CFITSIO_INCLUDES) $(WCS_INCLUDES) $(FFTW_INCLUDES) \ $(FFTWF_INCLUDES) include_HEADERS = cpl_apertures.h \ cpl_apertures_img.h \ cpl_geom_img.h \ cpl_detector.h \ cpl_phys_const.h \ cpl_photom.h \ cpl_fit.h \ cpl_ppm.h \ cpl_wcs.h \ cpl_wlcalib.h \ cpl_fft.h noinst_HEADERS = cpl_geom_img_body.h \ cpl_fit_body.h \ cpl_fft_body.h \ cpl_wlcalib_impl.h \ cpl_detector_body.h lib_LTLIBRARIES = libcpldrs.la libcpldrs_la_SOURCES = cpl_apertures.c \ cpl_detector.c \ cpl_geom_img.c \ cpl_photom.c \ cpl_fit.c \ cpl_ppm.c \ cpl_wcs.c \ cpl_wlcalib.c \ cpl_fft.c # Place optional 3rd party components last since those locations may contain # obsolete and therefore unwanted CFITSIO installations libcpldrs_la_LDFLAGS = $(CX_LDFLAGS) $(CFITSIO_LDFLAGS) $(FFTW_LDFLAGS) $(FFTWF_LDFLAGS) $(WCS_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libcpldrs_la_LIBADD = $(LIBCPLCORE) $(LIBCFITSIO) $(LIBWCS) $(LIBCEXT) $(LIBFFTW) $(LIBFFTWF) -lm libcpldrs_la_DEPENDENCIES = $(LIBCPLCORE) cpl-6.4.1/cpldrs/cpl_ppm.c0000644000460300003120000016745312050712365012320 00000000000000/* $Id: cpl_ppm.c,v 1.37 2012-11-14 12:56:21 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2002-2007 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-11-14 12:56:21 $ * $Revision: 1.37 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include /** * @defgroup cpl_ppm Point pattern matching module * * @par Synopsis: * @code * #include "cpl_ppm.h" * @endcode */ /**@{*/ /** * @brief * Match 1-D patterns. * * @param peaks List of observed positions (e.g., of emission peaks) * @param lines List of positions in searched pattern (e.g., wavelengths) * @param min_disp Min expected scale (e.g., spectral dispersion in A/pixel) * @param max_disp Max expected scale (e.g., spectral dispersion in A/pixel) * @param tolerance Tolerance for interval ratio comparison * @param seq_peaks Returned: index of identified peaks in input @em peaks * @param seq_lines Returned: index of identified lines in input @em lines * * @return List of all matching points positions * * This function attempts to find the reference pattern @em lines in a * list of observed positions @em peaks. In the following documentation * a terminology drawn from the context of arc lamp spectra calibration * is used for simplicity: the reference pattern is then a list of * wavelengths corresponding to a set of reference arc lamp emission * lines - the so-called line catalog; while the observed positions are * the positions (in pixel) on the CCD, measured along the dispersion * direction, of any significant peak of the signal. To identify the * observed peaks means to associate them with the right reference * wavelength. This is attempted here with a point-pattern matching * technique, where the pattern is contained in the vector @em lines, * and is searched in the vector @em peak. * * In order to work, this method just requires a rough expectation * value of the spectral dispersion (in Angstrom/pixel), and a line * catalog. The line catalog @em lines should just include lines that * are expected somewhere in the CCD exposure of the calibration lamp * (note, however, that a catalog including extra lines at its blue * and/or red ends is still allowed). * * Typically, the arc lamp lines candidates @em peak will include * light contaminations, hot pixels, and other unwanted signal, * but only in extreme cases does this prevent the pattern-recognition * algorithm from identifying all the spectral lines. The pattern * is detected even in the case @em peak contained more arc lamp * lines than actually listed in the input line catalog. * * This method is based on the assumption that the relation between * wavelengths and CCD positions is with good approximation @em locally * linear (this is always true, for any modern spectrograph). * * The ratio between consecutive intervals pairs in wavelength and in * pixel is invariant to linear transformations, and therefore this * quantity can be used in the recognition of local portions of the * searched pattern. All the examined sub-patterns will overlap, leading * to the final identification of the whole pattern, notwithstanding the * overall non-linearity of the relation between pixels and wavelengths. * * Ambiguous cases, caused by exceptional regularities in the pattern, * or by a number of undetected (but expected) peaks that disrupt the * pattern on the data, are recovered by linear interpolation and * extrapolation of the safely identified peaks. * * More details about the applied algorithm can be found in the comments * to the function code. * * The @em seq_peaks and @em seq_lines are array reporting the positions * of matching peaks and wavelengths in the input @em peaks and @em lines * vectors. This functionality is not yet supported: this arguments * should always be set to NULL or a CPL_ERROR_UNSUPPORTED_MODE would * be set. */ cpl_bivector *cpl_ppm_match_positions(const cpl_vector *peaks, const cpl_vector *lines, double min_disp, double max_disp, double tolerance, cpl_array **seq_peaks, cpl_array **seq_lines) { int i, j, k, l; cpl_size nlint, npint; int minpos; double min; double lratio, pratio; double lo_start, lo_end, hi_start, hi_end, denom; double disp = 0.0; double variation, prev_variation; int max, maxpos, minl, mink; int ambiguous; int npeaks_lo, npeaks_hi; int *peak_lo; int *peak_hi; int **ident; int *nident; int *lident; const double *peak; const double *line; cpl_size npeaks, nlines; double *xpos; double *lambda; int *ilambda; double *tmp_xpos; double *tmp_lambda; int *tmp_ilambda; int *flag; int n = 0; int nn; int nseq = 0; int gap; int *seq_length; int found; if (seq_lines || seq_peaks) { cpl_error_set(cpl_func, CPL_ERROR_UNSUPPORTED_MODE); return NULL; } peak = cpl_vector_get_data_const(peaks); npeaks = cpl_vector_get_size(peaks); line = cpl_vector_get_data_const(lines); nlines = cpl_vector_get_size(lines); if (npeaks < 4) return NULL; peak_lo = cpl_malloc((size_t)npeaks * sizeof(int)); peak_hi = cpl_malloc((size_t)npeaks * sizeof(int)); nident = cpl_calloc((size_t)npeaks, sizeof(int)); lident = cpl_calloc((size_t)nlines, sizeof(int)); xpos = cpl_calloc((size_t)npeaks, sizeof(double)); lambda = cpl_calloc((size_t)npeaks, sizeof(double)); ilambda = cpl_calloc((size_t)npeaks, sizeof(int)); tmp_xpos = cpl_calloc((size_t)npeaks, sizeof(double)); tmp_lambda = cpl_calloc((size_t)npeaks, sizeof(double)); tmp_ilambda = cpl_calloc((size_t)npeaks, sizeof(int)); flag = cpl_calloc((size_t)npeaks, sizeof(int)); seq_length = cpl_calloc((size_t)npeaks, sizeof(int)); ident = cpl_malloc((size_t)npeaks * sizeof(int *)); for (i = 0; i < npeaks; i++) ident[i] = cpl_malloc(3 * (size_t)npeaks * sizeof(int)); /* * This is just the number of intervals - one less than the number * of points (catalog wavelengths, or detected peaks). */ nlint = nlines - 1; npint = npeaks - 1; /* * Here the big loops on catalog lines begins. */ for (i = 1; i < nlint; i++) { /* * For each catalog wavelength I take the previous and the next one, * and compute the ratio of the corresponding wavelength intervals. * This ratio will be compared to all the ratios obtained doing the * same with all the detected peaks positions. */ lratio = (line[i+1] - line[i]) / (line[i] - line[i-1]); /* * Here the loop on detected peaks positions begins. */ for (j = 1; j < npint; j++) { /* * Not all peaks are used for computing ratios: just the ones * that are compatible with the expected spectral dispersion * are taken into consideration. Therefore, I define the pixel * intervals before and after any peak that are compatible with * the specified dispersion interval, and select just the peaks * within such intervals. If either of the two intervals doesn't * contain any peak, then I skip the current peak and continue * with the next. */ lo_start = peak[j] - (line[i] - line[i-1]) / min_disp; lo_end = peak[j] - (line[i] - line[i-1]) / max_disp; hi_start = peak[j] + (line[i+1] - line[i]) / max_disp; hi_end = peak[j] + (line[i+1] - line[i]) / min_disp; for (npeaks_lo = 0, k = 0; k < npeaks; k++) { if (peak[k] > lo_end) break; if (peak[k] > lo_start) { peak_lo[npeaks_lo] = k; ++npeaks_lo; } } if (npeaks_lo == 0) continue; for (npeaks_hi = 0, k = 0; k < npeaks; k++) { if (peak[k] > hi_end) break; if (peak[k] > hi_start) { peak_hi[npeaks_hi] = k; ++npeaks_hi; } } if (npeaks_hi == 0) continue; /* * Now I have all peaks that may help for a local identification. * peak_lo[k] is the sequence number of the k-th peak of the lower * interval; peak_hi[l] is the sequence number of the l-th peak of * the higher interval. j is, of course, the sequence number of the * current peak (second big loop). */ prev_variation = 1000.0; minl = mink = 0; for (k = 0; k < npeaks_lo; k++) { denom = peak[j] - peak[peak_lo[k]]; for (l = 0; l < npeaks_hi; l++) { /* * For any pair of peaks - one from the lower and the other * from the higher interval - I compute the same ratio that * was computed with the current line catalog wavelength. */ pratio = (peak[peak_hi[l]] - peak[j]) / denom; /* * If the two ratios are compatible within the specified * tolerance, we have a preliminary identification. This * will be marked in the matrix ident[][], where the first * index corresponds to a peak sequence number, and the second * index is the counter of the identifications made during * this whole process. The array of counters is nident[]. * If more than one interval pair fulfills the specified * tolerance, the closest to the expected ratio is selected. */ variation = fabs(lratio-pratio) / pratio; if (variation < tolerance) { if (variation < prev_variation) { prev_variation = variation; minl = l; mink = k; } } } } if (prev_variation < tolerance) { ident[j][nident[j]] = i; ident[peak_hi[minl]][nident[peak_hi[minl]]] = i + 1; ident[peak_lo[mink]][nident[peak_lo[mink]]] = i - 1; ++nident[j]; ++nident[peak_hi[minl]]; ++nident[peak_lo[mink]]; } } /* End loop on positions */ } /* End loop on lines */ /* * At this point I have filled the ident matrix with all my preliminary * identifications. Ambiguous identifications must be eliminated. */ for (i = 0; i < npeaks; i++) { /* * I don't take into consideration peaks that were never identified. * They are likely contaminations, or emission lines that were not * listed in the input wavelength catalog. */ if (nident[i] > 1) { /* * Initialise the histogram of wavelengths assigned to the i-th peak. */ for (j = 0; j < nlines; j++) lident[j] = 0; /* * Count how many times each catalog wavelength was assigned * to the i-th peak. */ for (j = 0; j < nident[i]; j++) ++lident[ident[i][j]]; /* * What wavelength was most frequently assigned to the i-th peak? */ max = 0; maxpos = 0; for (j = 0; j < nlines; j++) { if (max < lident[j]) { max = lident[j]; maxpos = j; } } /* * Were there other wavelengths assigned with the same frequency? * This would be the case of an ambiguous identification. It is * safer to reject this peak... */ ambiguous = 0; for (k = maxpos + 1; k < nlines; k++) { if (lident[k] == max) { ambiguous = 1; break; } } if (ambiguous) continue; /* * Otherwise, I assign to the i-th peak the wavelength that was * most often assigned to it. */ tmp_xpos[n] = peak[i]; tmp_lambda[n] = line[maxpos]; tmp_ilambda[n] = maxpos; ++n; } } /* * Check on identified peaks. Contaminations from other spectra might * be present and should be excluded: this type of contamination * consists of peaks that have been _correctly_ identified! The non- * spectral type of light contamination should have been almost all * removed already in the previous steps, but it may still be present. * Here, the self-consistent sequences of identified peaks are * separated one from the other. At the moment, just the longest of * such sequences is selected (in other words, spectral multiplexing * is ignored). */ if (n > 1) { nn = 0; /* Number of peaks in the list of sequences */ nseq = 0; /* Current sequence */ for (k = 0; k < n; k++) { if (flag[k] == 0) { /* Was peak k already assigned to a sequence? */ flag[k] = 1; xpos[nn] = tmp_xpos[k]; /* Begin the nseq-th sequence */ lambda[nn] = tmp_lambda[k]; ilambda[nn] = tmp_ilambda[k]; ++seq_length[nseq]; ++nn; /* * Now look for all the following peaks that are compatible * with the expected spectral dispersion, and add them in * sequence to xpos. Note that missing peaks are not a problem... */ i = k; while (i < n - 1) { found = 0; for (j = i + 1; j < n; j++) { if (flag[j] == 0) { disp = (tmp_lambda[j] - tmp_lambda[i]) / (tmp_xpos[j] - tmp_xpos[i]); if (disp >= min_disp && disp <= max_disp) { flag[j] = 1; xpos[nn] = tmp_xpos[j]; lambda[nn] = tmp_lambda[j]; ilambda[nn] = tmp_ilambda[j]; ++seq_length[nseq]; ++nn; i = j; found = 1; break; } } } if (!found) break; } /* * Current sequence is completed: begin new sequence on the * excluded peaks, starting the loop on peaks again. */ ++nseq; k = 0; } } /* * Find the longest sequence of self-consistent peaks. */ max = 0; maxpos = 0; for (i = 0; i < nseq; i++) { if (seq_length[i] > max) { max = seq_length[i]; maxpos = i; } } /* * Find where this sequence starts in the whole peak position * storage. */ nn = 0; for (i = 0; i < maxpos; i++) nn += seq_length[i]; /* * Move the longest sequence at the beginning of the returned lists */ n = max; for (i = 0; i < n; i++, nn++) { xpos[i] = xpos[nn]; lambda[i] = lambda[nn]; ilambda[i] = ilambda[nn]; } /* * Are some wavelengths missing? Recover them. */ for (i = 1; i < n; i++) { gap = ilambda[i] - ilambda[i-1]; for (j = 1; j < gap; j++) { if (j == 1) { /* * Determine the local dispersion from the current pair of peaks */ disp = (lambda[i] - lambda[i-1]) / (xpos[i] - xpos[i-1]); } /* * With this, find the expected position of the missing * peak by linear interpolation. */ hi_start = xpos[i-1] + (line[ilambda[i-1] + j] - lambda[i-1]) / disp; /* * Is there a peak at that position? Here a peak from the * original list is searched, that is closer than 2 pixels * to the expected position. If it is found, insert it at * the current position on the list of identified peaks, * and leave immediately the loop (taking the new position * for the following linear interpolation, in case more * than one peak is missing in the current interval). * If it is not found, stay in the loop, looking for * the following missing peaks in this interval. */ found = 0; for (k = 0; k < npeaks; k++) { if (fabs(peak[k] - hi_start) < 2) { for (l = n; l > i; l--) { xpos[l] = xpos[l-1]; lambda[l] = lambda[l-1]; ilambda[l] = ilambda[l-1]; } xpos[i] = peak[k]; lambda[i] = line[ilambda[i-1] + j]; ilambda[i] = ilambda[i-1] + j; ++n; found = 1; break; } } if (found) break; } } /* * Try to extrapolate forward */ found = 1; if (n > 0) { while (ilambda[n-1] < nlines - 1 && found) { /* * Determine the local dispersion from the last pair of * identified peaks */ if (n > 1) disp = (lambda[n-1] - lambda[n-2]) / (xpos[n-1] - xpos[n-2]); else disp = 0.0; if (disp > max_disp || disp < min_disp) break; /* * With this, find the expected position of the missing * peak by linear interpolation. */ hi_start = xpos[n-1] + (line[ilambda[n-1] + 1] - lambda[n-1]) / disp; /* * Is there a peak at that position? Here a peak from the * original list is searched, that is closer than 6 pixels * to the expected position. If it is found, insert it at * the end of the list of identified peaks. If it is not * found, leave the loop. */ found = 0; min = fabs(peak[0] - hi_start); minpos = 0; for (k = 1; k < npeaks; k++) { if (min > fabs(peak[k] - hi_start)) { min = fabs(peak[k] - hi_start); minpos = k; } } if (min < 6.0 && fabs(peak[minpos] - xpos[n-1]) > 1.0) { xpos[n] = peak[minpos]; lambda[n] = line[ilambda[n-1] + 1]; ilambda[n] = ilambda[n-1] + 1; ++n; found = 1; } } } /* * Try to extrapolate backward */ found = 1; while (ilambda[0] > 0 && found) { /* * Determine the local dispersion from the first pair of * identified peaks */ disp = (lambda[1] - lambda[0]) / (xpos[1] - xpos[0]); if (disp > max_disp || disp < min_disp) break; /* * With this, find the expected position of the missing * peak by linear interpolation. */ hi_start = xpos[0] - (lambda[0] - line[ilambda[0] - 1]) / disp; /* * Is there a peak at that position? Here a peak from the * original list is searched, that is closer than 6 pixels * to the expected position. If it is found, insert it at * the beginning of the list of identified peaks. If it is not * found, leave the loop. */ found = 0; min = fabs(peak[0] - hi_start); minpos = 0; for (k = 1; k < npeaks; k++) { if (min > fabs(peak[k] - hi_start)) { min = fabs(peak[k] - hi_start); minpos = k; } } if (min < 6.0 && fabs(peak[minpos] - xpos[0]) > 1.0) { for (j = n; j > 0; j--) { xpos[j] = xpos[j-1]; lambda[j] = lambda[j-1]; ilambda[j] = ilambda[j-1]; } xpos[0] = peak[minpos]; lambda[0] = line[ilambda[0] - 1]; ilambda[0] = ilambda[0] - 1; ++n; found = 1; } } } /* * At this point all peaks are processed. Free memory, and return * the result. */ /************************************************+ for (i = 0; i < npeaks; i++) { printf("Peak %d:\n ", i); for (j = 0; j < nident[i]; j++) printf("%.2f, ", line[ident[i][j]]); printf("\n"); } printf("\n"); for (i = 0; i < n; i++) printf("%.2f, %.2f\n", xpos[i], lambda[i]); +************************************************/ for (i = 0; i < npeaks; i++) cpl_free(ident[i]); cpl_free(ident); cpl_free(nident); cpl_free(lident); cpl_free(ilambda); cpl_free(tmp_xpos); cpl_free(tmp_lambda); cpl_free(tmp_ilambda); cpl_free(peak_lo); cpl_free(flag); cpl_free(seq_length); cpl_free(peak_hi); if (n == 0) { cpl_free(xpos); cpl_free(lambda); return NULL; } return cpl_bivector_wrap_vectors(cpl_vector_wrap(n, xpos), cpl_vector_wrap(n, lambda)); } /* End of function for 1D point pattern matching */ /*************************************************************************** * Definitions for 2D point-pattern-matching ***************************************************************************/ /* This one subtracts y from x, with error propagation. */ static double double_subtract(double x, double dx, double y, double dy, double *error) { *error = sqrt( dx*dx + dy*dy ); return x - y; } /* This one divides x by y, with error propagation. */ static double double_divide(double x, double dx, double y, double dy, double *error) { double y2 = y*y; if (y2 > 0.0) { *error = sqrt(( dx*dx + dy*dy * x*x / (y2) ) / (y2)); return x/y; } *error = 0.0; return 0.0; } /* This one finds angle of the direction defined by point (x,y), with error propagation. */ static double double_atan2(double y, double dy, double x, double dx, double *error) { double x2 = x*x; double y2 = y*y; if (x2 > 0.0 || y2 > 0.0) { /* * Using error propagation formula and d(atan(u))/du = 1/(1+u^2) */ *error = sqrt((dy*dy*x2 + dx*dx*y2) / ((x2 + y2)*(x2 + y2))); return atan2(y, x); } *error = 0.0; return 0.0; } /* This one returns the square of the distance between two points */ static double point_distsq(double xa, double ya, double xb, double yb) { return ((xa - xb)*(xa - xb) + (ya - yb)*(ya - yb)); } /* The "triangle" is actually the element 2D pattern made of 3 points. It carries its coordinates in the parameter space of similar triangles, and an identifier of the three points composing it. The identifiers are the matrix column sequence number in the matrix containing the points (in the main program). */ typedef struct _triangle { double ratsq; /* (Rmin/Rmax)^2 */ double dratsq; /* Error */ double theta; /* Angle min - Angle max in [0; 2pi[ */ double dtheta; /* Error */ double xref, yref; /* Reference point */ double xmin, ymin; /* Nearest point */ double xmax, ymax; /* Farthest point */ int id_ref; /* Identifier of reference point */ int id_min; /* Identifier of nearest point */ int id_max; /* Identifier of farthest point */ } triangle; /* Square root of 2 */ #define V2 (1.4142136) /* This constructs a triangle from three points, propagates errors, and keeps the points identifiers. */ static triangle * triangle_new(double xa, double ya, double xb, double yb, double xc, double yc, double error, int ida, int idb, int idc) { double r1, r2, dr1, dr2; double t1, t2, dt1, dt2; double two_pi; triangle *t; t = cpl_calloc(1, sizeof(triangle)); t->xref = xa; t->yref = ya; t->id_ref = ida; r1 = point_distsq(xa, ya, xb, yb); r2 = point_distsq(xa, ya, xc, yc); dr1 = sqrt(8*error*error*r1); dr2 = sqrt(8*error*error*r2); t1 = double_atan2(ya - yb, V2*error, xa - xb, V2*error, &dt1); t2 = double_atan2(ya - yc, V2*error, xa - xc, V2*error, &dt2); if (r1 < r2) { t->ratsq = double_divide(r1, dr1, r2, dr2, &t->dratsq); t->theta = double_subtract(t1, dt1, t2, dt2, &t->dtheta); t->xmin = xb; t->ymin = yb; t->id_min = idb; t->xmax = xc; t->ymax = yc; t->id_max = idc; } else { t->ratsq = double_divide(r2, dr2, r1, dr1, &t->dratsq); t->theta = double_subtract(t2, dt2, t1, dt1, &t->dtheta); t->xmin = xc; t->ymin = yc; t->id_min = idc; t->xmax = xb; t->ymax = yb; t->id_max = idb; } two_pi = CPL_MATH_2PI; while (t->theta < 0) t->theta += two_pi; while (t->theta >= two_pi) t->theta -= two_pi; return t; } /* Triangle destructor */ static void triangle_delete(triangle **t) { cpl_free(*t); *t = NULL; } /* Here we have a set of triangles... */ typedef struct _triangles { int n; triangle **t; } triangles; /* A constructor of arrays of triangles... */ static triangles *triangles_new(int n) { triangles *t; t = cpl_calloc(1, sizeof(triangles)); t->t = cpl_calloc((size_t)n, sizeof(triangle *)); t->n = n; return t; } /* ... and this one destroys sets of triangles. */ static void triangles_delete(triangles **t) { while ((*t)->n--) triangle_delete((*t)->t + (*t)->n); cpl_free((*t)->t); cpl_free(*t); *t = NULL; } static void triangles_delete_holder(triangles **t) { cpl_free((*t)->t); cpl_free(*t); *t = NULL; } /* Given one matrix 2xN of points, generates all the possible triangles from the points listed in its first n columns, propagating to the triangles the error on point positions. */ static triangles * triangles_from_points(const cpl_matrix *points, int n, double err) { triangles *pattern; const double *m = cpl_matrix_get_data_const(points); double x1, x2, x3, y1, y2, y3; const cpl_size nc = cpl_matrix_get_ncol(points); int nt = n*(n-1)*(n-2)/2; int count; int i, j, k; cpl_msg_debug(cpl_func, "Evaluate %d triangles...", nt); pattern = triangles_new(nt); count = 0; for (i = 0; i < n-2; i++) { for (j = i+1; j < n-1; j++) { for (k = j+1; k < n; k++) { /* * i, j, and k, are the matrix columns where the * three points are. Three triangles are created * using each one of these points as reference. */ x1 = m[i]; x2 = m[j]; x3 = m[k]; y1 = m[i + nc]; y2 = m[j + nc]; y3 = m[k + nc]; pattern->t[count] = triangle_new(x1, y1, x2, y2, x3, y3, err, i, j, k); count++; pattern->t[count] = triangle_new(x2, y2, x1, y1, x3, y3, err, j, i, k); count++; pattern->t[count] = triangle_new(x3, y3, x2, y2, x1, y1, err, k, j, i); count++; } } } return pattern; } /* * Difference between angles (in radians) in [0;pi] */ static double difference_of_angles(double a1, double a2) { double d = a1 - a2; while (d < -CPL_MATH_PI) d += CPL_MATH_2PI; while (d > CPL_MATH_PI) d -= CPL_MATH_2PI; return fabs(d); } /* * The distance is calculated in normalized parameter space [0;1]x[0;1] * as well as its error (if error is not a null pointer). This is to * give equal weight to differences in radii and differences in theta. */ static double distance_of_triangles(triangle *t1, triangle *t2, double *error) { double dtheta = difference_of_angles(t1->theta, t2->theta); /* in [0;pi] */ double dist, dist_in_errs, dr, pisquare, rr, tt; dtheta *= dtheta; dr = (t1->ratsq - t2->ratsq) * (t1->ratsq - t2->ratsq); pisquare = CPL_MATH_PI*CPL_MATH_PI; rr = t1->dratsq*t1->dratsq + t2->dratsq*t2->dratsq; tt = (t1->dtheta*t1->dtheta + t2->dtheta*t2->dtheta) / 4; dist = sqrt(dr + dtheta / pisquare); if (error) { dist_in_errs = sqrt(dr/rr + dtheta/tt); if (dist == 0.0) *error = 1.0; else *error = dist / dist_in_errs; } return dist; } static triangle * nearest_triangle(triangle *t, triangles *list) { triangle **pattern = list->t; int n = list->n; triangle *nearest; double dist, mindist; int i; mindist = distance_of_triangles(t, pattern[0], NULL); nearest = pattern[0]; for (i = 1; i < n; i++) { dist = distance_of_triangles(t, pattern[i], NULL); if (mindist > dist) { mindist = dist; nearest = pattern[i]; } } return nearest; } /* * Get scale ratio of matching triangles (t1 / t2) */ static double scaling_factor_of_triangles(const triangle *t1, const triangle *t2) { double s1 = point_distsq(t1->xref, t1->yref, t1->xmax, t1->ymax); double s2 = point_distsq(t2->xref, t2->yref, t2->xmax, t2->ymax); return (s2 == 0) ? 0 : sqrt(s1/s2); } /* * Get angle of orientation between matching patterns */ static double angle_between_triangles(const triangle *t1, const triangle *t2) { double a1 = atan2(t1->yref - t1->ymax, t1->xref - t1->xmax); double a2 = atan2(t2->yref - t2->ymax, t2->xref - t2->xmax); double a = a1 - a2; while (a >= CPL_MATH_2PI) a -= CPL_MATH_2PI; while (a < 0) a += CPL_MATH_2PI; return a; } static cpl_array * find_matches(triangles *p_triangle, triangles *n_triangle, int np) { int nt = p_triangle->n; int i; int *data; cpl_array *matches = cpl_array_new(np, CPL_TYPE_INT); cpl_array_fill_window_int(matches, 0, np, -1); data = cpl_array_get_data_int(matches); for (i = 0; i < nt; i++) { if (n_triangle->t[i]) { data[p_triangle->t[i]->id_ref] = n_triangle->t[i]->id_ref; data[p_triangle->t[i]->id_min] = n_triangle->t[i]->id_min; data[p_triangle->t[i]->id_max] = n_triangle->t[i]->id_max; } } for (i = 0; i < np; i++) if (data[i] < 0) cpl_array_set_invalid(matches, i); return matches; } /* Returns 0 on success */ static int find_transform(cpl_array *matches, const cpl_matrix *pattern, const cpl_matrix *data, cpl_size degree, cpl_polynomial *trans_x, cpl_polynomial *trans_y) { cpl_errorstate prev_state = cpl_errorstate_get(); cpl_error_code error; cpl_vector *xdpos; /* x positions on data */ cpl_vector *ydpos; /* y positions on data */ cpl_matrix *ppos; /* x,y positions on pattern */ double *xd; double *yd; double *xp; double *yp; const cpl_size np = cpl_array_get_size(matches); const cpl_size nvalid = np - cpl_array_count_invalid(matches); int null; int count = 0; int i, j; xdpos = cpl_vector_new(nvalid); ydpos = cpl_vector_new(nvalid); ppos = cpl_matrix_new(2, nvalid); xd = cpl_vector_get_data(xdpos); yd = cpl_vector_get_data(ydpos); xp = cpl_matrix_get_data(ppos); yp = cpl_matrix_get_data(ppos) + nvalid; count = 0; for (i = 0; i < np; i++) { j = cpl_array_get_int(matches, i, &null); if (null) continue; xd[count] = cpl_matrix_get(data, 0, j); yd[count] = cpl_matrix_get(data, 1, j); xp[count] = cpl_matrix_get(pattern, 0, i); yp[count] = cpl_matrix_get(pattern, 1, i); count++; } error = cpl_polynomial_fit(trans_x, ppos, NULL, xdpos, NULL, CPL_FALSE, NULL, °ree); if (error == CPL_ERROR_SINGULAR_MATRIX) { /* * Try a 1-D fit */ const cpl_size degrees[] = {degree, 0}; cpl_errorstate_set(prev_state); error = cpl_polynomial_fit(trans_x, ppos, NULL, xdpos, NULL, CPL_TRUE, NULL, degrees); if (error == CPL_ERROR_SINGULAR_MATRIX) { cpl_errorstate_set(prev_state); error = CPL_ERROR_NONE; } } if (!error) { error = cpl_polynomial_fit(trans_y, ppos, NULL, ydpos, NULL, CPL_FALSE, NULL, °ree); if (error == CPL_ERROR_SINGULAR_MATRIX) { /* * Try a 1-D fit */ const cpl_size degrees[] = {0, degree}; cpl_errorstate_set(prev_state); error = cpl_polynomial_fit(trans_y, ppos, NULL, ydpos, NULL, CPL_TRUE, NULL, degrees); if (error == CPL_ERROR_SINGULAR_MATRIX) { cpl_errorstate_set(prev_state); error = CPL_ERROR_NONE; } } } cpl_matrix_delete(ppos); cpl_vector_delete(xdpos); cpl_vector_delete(ydpos); if (error) { cpl_error_set(cpl_func, error); return 1; } return 0; } static int nearest_point(double x, double y, const cpl_matrix *matrix) { const cpl_size nc = cpl_matrix_get_ncol(matrix); const double *data = cpl_matrix_get_data_const(matrix); int minpos, i; double min, value; minpos = 0; min = point_distsq(x, y, data[0], data[nc]); for (i = 1; i < nc; i++) { value = point_distsq(x, y, data[i], data[i+nc]); if (min > value) { min = value; minpos = i; } } return minpos; } static cpl_array * find_all_matches(const cpl_matrix *pattern, const cpl_matrix *data, double radius, const cpl_polynomial *trans_x, const cpl_polynomial *trans_y, cpl_matrix **mpattern, cpl_matrix **mdata) { cpl_vector *point = cpl_vector_new(2); double *p = cpl_vector_get_data(point); const double *ddata = cpl_matrix_get_data_const(data); const cpl_size dnc = cpl_matrix_get_ncol(data); const double *dpatt = cpl_matrix_get_data_const(pattern); const cpl_size pnc = cpl_matrix_get_ncol(pattern); cpl_array *matches = cpl_array_new(pnc, CPL_TYPE_INT); double exp_x, exp_y; double *md; double *mp; cpl_size nvalid, count; int null; int i, j; radius *= radius; for (i = 0; i < pnc; i++) { p[0] = dpatt[i]; p[1] = dpatt[i + pnc]; exp_x = cpl_polynomial_eval(trans_x, point); exp_y = cpl_polynomial_eval(trans_y, point); j = nearest_point(exp_x, exp_y, data); if (radius > point_distsq(exp_x, exp_y, ddata[j], ddata[j + dnc])) { cpl_array_set_int(matches, i, j); } } cpl_vector_delete(point); nvalid = pnc - cpl_array_count_invalid(matches); if (nvalid) { if (mpattern && mdata) { *mdata = cpl_matrix_new(2, nvalid); md = cpl_matrix_get_data(*mdata); *mpattern = cpl_matrix_new(2, nvalid); mp = cpl_matrix_get_data(*mpattern); count = 0; for (i = 0; i < pnc; i++) { j = cpl_array_get_int(matches, i, &null); if (null) continue; md[count] = ddata[j]; md[count + nvalid] = ddata[j + dnc]; mp[count] = dpatt[i]; mp[count + nvalid] = dpatt[i + pnc]; count++; } } } else { cpl_array_delete(matches); return NULL; } return matches; } /** * @brief * Match 2-D distributions of points. * * @param data List of data points (e.g., detected stars positions). * @param use_data Number of @em data points used for preliminary match. * @param err_data Error on @em data points positions. * @param pattern List of pattern points (e.g., expected stars positions). * @param use_pattern Number of @em pattern points used for preliminary match. * @param err_pattern Error on @em pattern points positions. * @param tolerance Max relative difference of angles and scales from * their median value for match acceptance. * @param radius Search radius applied in final matching (@em data units). * @param mdata List of identified @em data points. * @param mpattern List of matching @em pattern points. * @param lin_scale Linear transformation scale factor. * @param lin_angle Linear transformation rotation angle. * * @return Indexes of identified data points (pattern-to-data). * * A point is described here by its coordinates on a cartesian plane. * The input matrices @em data and @em pattern must have 2 rows, as * their column vectors are the points coordinates. * * This function attemps to associate points in @em data to points in * @em pattern, under the assumption that a transformation limited to * scaling, rotation, and translation, would convert positions in * @em pattern into positions in @em data. Association between points * is also indicated in the following as "match", or "identification". * * Point identification is performed in two steps. In the first step * only a subset of the points is identified (preliminary match). In * the second step the identified points are used to define a first-guess * transformation from @em pattern points to @em data points, that is * applied to identify all the remaining points as well. The second * step would be avoided if a @em use_pattern equal to the number of * points in @em pattern is given, and exactly @em use_pattern points * would be identified already in the first step. * * First step: * * All possible triangles (sub-patterns) are built using the first * @em use_data points from @em data and the first @em use_pattern * points from @em pattern. The values of @em use_data and @em use_pattern * must always be at least 3 (however, see the note at the end), * and should not be greater than the length of the corresponding * lists of points. The point-matching algorithm goes as follow: * * @code * For every triplet of points: * Select one point as the reference. The triangle coordinates * are defined by * * ((Rmin/Rmax)^2, theta_min - theta_max) * * where Rmin (Rmax) is the shortest (longest) distance from the * reference point to one of the two other points, and theta_min * (theta_max) is the view angle in [0; 2pi[ to the nearest * (farthest) point. * * Triangles are computed by using each point in the triplet * as reference, thereby computing 3 times as many triangles * as needed. * * The accuracy of triangle patterns is robust against distortions * (i.e., systematic inaccuracies in the points positions) of the * second order. This is because, if the points positions had * constant statistical uncertainty, the relative uncertainty in * the triangle coordinates would be inversely proportional to * the triangle size, while if second order distortions are * present the systematic error on points position would be * directly proportional to the triangle size. * * For every triangle derived from the @em pattern points: * Match with nearest triangle derived from @em data points * if their distance in the parameter space is less than their * uncertainties (propagated from the points positions uncertainties * @em err_data and @em err_pattern). For every matched pair of * triangles, record their scale ratio, and their orientation * difference. Note that if both @em err_data and @em err_pattern * are zero, the tolerance in triangle comparison will also be * zero, and therefore no match will be found. * * Get median scale ratio and median angle of rotation, and reject * matches with a relative variation greater than @em tolerance from * the median of either quantities. The estimator of all the rotation * angles a_i is computed as * * atan( med sin(a_i) / med cos(a_i) ) * * @endcode * * Second step: * * From the safely matched triangles, a list of identified points is * derived, and the best transformation from @em pattern points to * @em data points (in terms of best rotation angle, best scaling * factor, and best shift) is applied to attempt the identification of * all the points that are still without match. This matching is made * by selecting for each @em pattern point the @em data point which is * closest to its transformed position, and at a distance less than * @em radius. * * The returned array of integers is as long as the number of points in * @em pattern, and each element reports the position of the matching * point in @em data (counted starting from zero), or is invalid if no * match was found for the @em pattern point. For instance, if element * N of the array has value M, it means that the Nth point in @em pattern * matches the Mth point in @em data. A NULL pointer is returned in case * no point was identified. * * If @em mdata and @em mpattern are both valid pointers, two more * matrices will be returned with the coordinates of the identified * points. These two matrices will both have the same size: 2 rows, * and as many columns as successfully identified points. Matching * points will be in the same column of both matrices. Those matrix * should in the end be destroyed using cpl_matrix_delete(). * * If @em lin_scale is a valid pointer, it is returned with a good estimate * of the scale (distance_in_data = lin_scale * distance_in_pattern). * This makes sense only in case the transformation between @em pattern * and @em data is an affine transformation. In case of failure, * @em lin_scale is set to zero. * * If @em lin_angle is a valid pointer, it is returned with a good * estimate of the rotation angle between @em pattern and @em data * in degrees (counted counterclockwise, from -180 to +180, and with * data_orientation = pattern_orientation + lin_angle). This makes * sense only in case the transformation between @em pattern and * @em data is an affine transformation. In case of failure, * @em lin_angle is set to zero. * * The returned values for @em lin_scale and @em lin_angle have the only * purpose of providing a hint on the relation between @em pattern points * and @em data points. This function doesn't attempt in any way to * determine or even suggest a possible transformation between @em pattern * points and @em data points: this function just matches points, and it * is entriely a responsibility of the caller to fit the appropriate * transformation between one coordinate system and the other. * A polynomial transformation of degree 2 from @em pattern to @em data * may be fit in the following way (assuming that @em mpattern and * @em mdata are available): * * @code * * int degree = 2; * int npoints = cpl_matrix_get_ncol(mdata); * double *dpoints = cpl_matrix_get_data(mdata); * cpl_vector *data_x = cpl_vector_wrap(npoints, dpoints); * cpl_vector *data_y = cpl_vector_wrap(npoints, dpoints + npoints); * cpl_polynomial *x_trans = cpl_polynomial_new(degree); * cpl_polynomial *y_trans = cpl_polynomial_new(degree); * * cpl_polynomial_fit(x_trans, mpattern, NULL, data_x, NULL, CPL_FALSE, * NULL, degree); * cpl_polynomial_fit(y_trans, mpattern, NULL, data_y, NULL, CPL_FALSE, * NULL, degree); * * @endcode * * @note * The basic requirement for using this function is that the searched * point pattern (or at least most of it) is contained in the data. * As an indirect consequence of this, it would generally be appropriate * to have more points in @em data than in @em pattern (and analogously, * to have @em use_data greater than @em use_pattern), even if this is * not strictly necessary. * * Also, @em pattern and @em data should not contain too few points * (say, less than 5 or 4) or the identification may risk to be incorrect: * more points enable the construction of many more triangles, reducing * the risk of ambiguity (multiple valid solutions). Special situations, * involving regularities in patterns (as, for instance, input @em data * containing just three equidistant points, or the case of a regular * grid of points) would certainly provide an answer, and this answer * would very likely be wrong (the human brain would fail as well, * and for exactly the same reasons). * * The reason why a two steps approach is encouraged here is mainly to * enable an efficient use of this function: in principle, constructing * all possible triangles using @em all of the available points is never * wrong, but it could become very slow: a list of N points implies the * evaluation of N*(N-1)*(N-2)/2 triangles, and an even greater number * of comparisons between triangles. The possibility of evaluating * first a rough transformation based on a limited number of identified * points, and then using this transformation for recovering all the * remaining points, may significantly speed up the whole identification * process. However it should again be ensured that the main requirement * (i.e., that the searched point pattern must be contained in the data) * would still be valid for the selected subsets of points: a random * choice would likely lead to a matching failure (due to too few, or * no, common points). * * A secondary reason for the two steps approach is to limit the effect * of another class of ambiguities, happening when either or both of * the input matrices contains a very large number of uniformely * distributed points. The likelihood to find several triangles that * are similar by chance, and at all scales and orientations, may * increase to unacceptable levels. * * A real example may clarify a possible way of using this function: * let @em data contain the positions (in pixel) of detected stars * on a CCD. Typically hundreds of star positions would be available, * but only the brightest ones may be used for preliminary identification. * The input @em data positions will therefore be opportunely ordered * from the brightest to the dimmest star positions. In order to * identify stars, a star catalogue is needed. From a rough knowledge * of the pointing position of the telescope and of the size of the * field of view, a subset of stars can be selected from the catalogue: * they will be stored in the @em pattern list, ordered as well by their * brightness, and with their RA and Dec coordinates converted into * standard coordinates (a gnomonic coordinate system centered on the * telescope pointing, i.e., a cartesian coordinate system), no matter * in what units of arc, and no matter what orientation of the field. * For the first matching step, the 10 brightest catalogue stars may * be selected (selecting less stars would perhaps be unsafe, selecting * more would likely make the program slower without producing any * better result). Therefore @em use_pattern would be set to 10. * From the data side, it would generally be appropriate to select * twice as many stars positions, just to ensure that the searched * pattern is present. Therefore @em use_data would be set to 20. * A reasonable value for @em tolerance and for @em radius would be * respectively 0.1 (a 10% variation of scales and angles) and 20 * (pixels). */ cpl_array * cpl_ppm_match_points(const cpl_matrix *data, cpl_size use_data, double err_data, const cpl_matrix *pattern, cpl_size use_pattern, double err_pattern, double tolerance, double radius, cpl_matrix **mdata, cpl_matrix **mpattern, double *lin_scale, double *lin_angle) { cpl_size nd, np; /* Number of points in data and pattern */ triangles *d_triangle; /* Triangles from data points */ triangles *p_triangle; /* Triangles from pattern points */ triangles *n_triangle; /* Nearest d_triangles to each p_triangle */ triangle *nearest; /* Nearest triangle */ cpl_array *matches = NULL; cpl_table *table = NULL; cpl_polynomial *trans_x; cpl_polynomial *trans_y; double err; double *distance; double *scale, median_scale; double *angle, median_angle; double *angle_s; double *angle_c; double scale_tolerance, angle_tolerance; int i; if (mpattern) *mpattern = NULL; if (mdata) *mdata = NULL; if (lin_scale) *lin_scale = 0.0; if (lin_angle) *lin_angle = 0.0; if (data == NULL || pattern == NULL) { cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); return NULL; } nd = cpl_matrix_get_ncol(data); np = cpl_matrix_get_ncol(pattern); if (nd < 3 || np < 3 || use_data < 3 || use_pattern < 3) { cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT); return NULL; } if (use_data > nd || use_pattern > np) { cpl_error_set(cpl_func, CPL_ERROR_ACCESS_OUT_OF_RANGE); return NULL; } // FIXME: Remove these checks! Currently only the interface is changed // to cpl_size. Once the module has been ported completely the // following tests must be removed. if (((int)use_data != use_data) || ((int)use_pattern != use_pattern)) { cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT); return NULL; } /* if (use_data < use_pattern) { cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "A pattern larger than data is not yet supported"); return NULL; } */ if (err_data <= 0.0 && err_pattern <= 0.0) { cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT); return NULL; } if (tolerance < 0.0 || radius < 0.0) { cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT); return NULL; } if ((mdata == NULL && mpattern) || (mpattern == NULL && mdata)) { cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT); return NULL; } /* * Looking for matches between data-triangles and pattern-triangles... * * The n_triangle list of triangles is as long as the p_triangle * list of triangles from pattern points, and just points to * triangles in d_triangle made from data points, whenever an * association is found. */ // FIXME: Remove casts to int when the module is ported to cpl_size cpl_msg_debug(cpl_func, "Pattern:"); cpl_msg_indent_more(); p_triangle = triangles_from_points(pattern, (int)use_pattern, err_pattern); cpl_msg_indent_less(); cpl_msg_debug(cpl_func, "Data:"); cpl_msg_indent_more(); d_triangle = triangles_from_points(data, (int)use_data, err_data); cpl_msg_indent_less(); n_triangle = triangles_new(p_triangle->n); /* * The table keeps track of relations between matching triangles, * such as their distance in the parameter space, their scale, * their relative orientation... */ table = cpl_table_new(p_triangle->n); cpl_table_new_column(table, "distance", CPL_TYPE_DOUBLE); cpl_table_fill_column_window_double(table, "distance", 0, p_triangle->n, 0.0); distance = cpl_table_get_data_double(table, "distance"); cpl_table_new_column(table, "scale", CPL_TYPE_DOUBLE); cpl_table_fill_column_window_double(table, "scale", 0, p_triangle->n, 0.0); scale = cpl_table_get_data_double(table, "scale"); cpl_table_new_column(table, "angle", CPL_TYPE_DOUBLE); cpl_table_fill_column_window_double(table, "angle", 0, p_triangle->n, 0.0); angle = cpl_table_get_data_double(table, "angle"); cpl_table_new_column(table, "angle_s", CPL_TYPE_DOUBLE); cpl_table_fill_column_window_double(table, "angle_s", 0, p_triangle->n, 0.0); angle_s = cpl_table_get_data_double(table, "angle_s"); cpl_table_new_column(table, "angle_c", CPL_TYPE_DOUBLE); cpl_table_fill_column_window_double(table, "angle_c", 0, p_triangle->n, 0.0); angle_c = cpl_table_get_data_double(table, "angle_c"); /* * For each pattern triangle find the most similar data triangle. * The triangles are associated if their distance in the parameter * space is less than their uncertainties. */ for (i = 0; i < p_triangle->n; i++) { nearest = nearest_triangle(p_triangle->t[i], d_triangle); distance[i] = distance_of_triangles(p_triangle->t[i], nearest, &err); if (distance[i] / err < 1.0) { scale[i] = scaling_factor_of_triangles(nearest, p_triangle->t[i]); angle[i] = angle_between_triangles(nearest, p_triangle->t[i]); angle_s[i] = sin(angle[i]); angle_c[i] = cos(angle[i]); n_triangle->t[i] = nearest; /* cpl_msg_debug(cpl_func, "distance, error, scale, angle = %f, %f, %f, %f", distance[i], err, scale[i], angle[i]); */ } else { cpl_table_set_invalid(table, "distance", i); cpl_table_set_invalid(table, "scale", i); cpl_table_set_invalid(table, "angle", i); cpl_table_set_invalid(table, "angle_s", i); cpl_table_set_invalid(table, "angle_c", i); /* cpl_msg_debug(cpl_func, "EXCLUDED:\ndistance, error = %f, %f", distance[i], err); */ } } /* * If there are matches, determine the median relations between * matching triangles. */ if (cpl_table_has_valid(table, "distance")) { const double median_s = cpl_table_get_column_median(table, "angle_s"); #ifdef CPL_PPM_DEBUG const double rms_s = cpl_table_get_column_stdev(table, "angle_s"); const double rms_c = cpl_table_get_column_stdev(table, "angle_c"); const double rms_angle= sqrt(rms_s*rms_s + rms_c*rms_c); double rms_scale; #endif const double median_c = cpl_table_get_column_median(table, "angle_c"); median_scale = cpl_table_get_column_median(table, "scale"); median_angle = atan2(median_s, median_c); #ifdef CPL_PPM_DEBUG rms_scale = cpl_table_get_column_stdev(table, "scale"); cpl_msg_debug(cpl_func, "Median scale (first iteration) = %.4f +/- %.4f", median_scale, rms_scale); cpl_msg_debug(cpl_func, "Median angle (first iteration) = %.4f +/- %.4f degrees", median_angle*CPL_MATH_DEG_RAD, rms_angle*CPL_MATH_DEG_RAD); #endif } else { cpl_msg_debug(cpl_func, "No match found"); cpl_table_delete(table); triangles_delete(&p_triangle); triangles_delete(&d_triangle); triangles_delete_holder(&n_triangle); return matches; } /* * Now eliminate outliers: matches implying scales where * * | scale - median_scale | > tolerance * median_scale * * are rejected. The same is done with angles (using the same * tolerance). */ scale_tolerance = tolerance * median_scale; angle_tolerance = tolerance * fabs(median_angle); for (i = 0; i < p_triangle->n; i++) { if (n_triangle->t[i]) { if (fabs(scale[i] - median_scale) > scale_tolerance || difference_of_angles(angle[i], median_angle) > angle_tolerance) { n_triangle->t[i] = NULL; cpl_table_set_invalid(table, "distance", i); cpl_table_set_invalid(table, "scale", i); cpl_table_set_invalid(table, "angle", i); cpl_table_set_invalid(table, "angle_s", i); cpl_table_set_invalid(table, "angle_c", i); } } } /* * There should by definition be survivors: however, for safety * the "if" check is done anyway... */ if (cpl_table_has_valid(table, "distance")) { const double median_s = cpl_table_get_column_median(table, "angle_s"); #ifdef CPL_PPM_DEBUG const double rms_s = cpl_table_get_column_stdev(table, "angle_s"); const double rms_c = cpl_table_get_column_stdev(table, "angle_c"); const double rms_angle= sqrt(rms_s*rms_s + rms_c*rms_c); double rms_scale; #endif const double median_c = cpl_table_get_column_median(table, "angle_c"); median_scale = cpl_table_get_column_median(table, "scale"); median_angle = atan2(median_s, median_c); #ifdef CPL_PPM_DEBUG rms_scale = cpl_table_get_column_stdev(table, "scale"); cpl_msg_debug(cpl_func, "Median scale (second iteration) = %.4f +/- %.4f", median_scale, rms_scale); cpl_msg_debug(cpl_func, "Median angle (second iteration) = %.4f +/- %.4f degrees", median_angle*CPL_MATH_DEG_RAD, rms_angle*CPL_MATH_DEG_RAD); #endif } else { /* cpl_msg_warning(cpl_func, "No match found (impossible!)"); cpl_error_set_message(cpl_func, CPL_ERROR_UNSPECIFIED, "No match found (impossible!)"); */ cpl_msg_debug(cpl_func, "No match found"); cpl_table_delete(table); triangles_delete(&p_triangle); triangles_delete(&d_triangle); triangles_delete_holder(&n_triangle); return matches; } cpl_table_delete(table); /* * Reaching this point means to have a good estimate of the scale * [data_size = median_scale * pattern_size] and of the angle * [data_orientation = median_angle + pattern_orientation]. */ if (lin_scale) { *lin_scale = median_scale; } if (lin_angle) { *lin_angle = median_angle * CPL_MATH_DEG_RAD; } /* * Build the list of safely matched points from the surviving * triangles, and find the best transformation from points in * pattern to points in data. The safely matched points are * "listed" in an integer array, whose index i corresponds to * column i in the pattern matrix, and whose value j corresponds * to column j in the data matrix. In case of no match for * column i, element i is left invalid. */ // FIXME: Remove casts to int when the module is ported to cpl_size matches = find_matches(p_triangle, n_triangle, (int)use_pattern); triangles_delete(&p_triangle); triangles_delete(&d_triangle); triangles_delete_holder(&n_triangle); /* * Using the safely matched points, find the best linear * transformation from pattern points to data poins... */ trans_x = cpl_polynomial_new(2); trans_y = cpl_polynomial_new(2); find_transform(matches, pattern, data, 1, trans_x, trans_y); cpl_array_delete(matches); /* * Now the transformation is used to find a match to all points * in pattern. Even the points who already have found a match, * are put again into discussion. If mpattern and mdata are * given, the coordinate of the matching points in pattern * and in data are returned. */ matches = find_all_matches(pattern, data, radius, trans_x, trans_y, mpattern, mdata); /* * Fare thee well, transformation! */ cpl_polynomial_delete(trans_x); cpl_polynomial_delete(trans_y); return matches; } #undef V2 /**@}*/ cpl-6.4.1/cpldrs/cpl_apertures.c0000644000460300003120000017437412253611520013532 00000000000000/* $Id: cpl_apertures.c,v 1.34 2012-11-14 12:23:29 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-11-14 12:23:29 $ * $Revision: 1.34 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_apertures.h" #include #include #include #include #include #include #include #include #include #include /* Needed by memcpy() */ #include /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_apertures High level functions to handle apertures * * The aperture object contains a list of zones in an image. It is * typically used to contain the results of an objects detection, or if * one wants to work on a very specific zone in an image. * * This module provides functions to handle @em cpl_apertures. */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Type definition -----------------------------------------------------------------------------*/ struct _cpl_apertures_ { /* Number of apertures */ cpl_size naperts; /* All positions are in FITS conventions : (1,1) is the lower left) */ /* Aperture center: x=sum(x*1)/sum(1) */ double * x; double * y; /* The position of the aperture maximum */ cpl_size* maxpos_x; cpl_size* maxpos_y; /* The position of the aperture minimum */ cpl_size* minpos_x; cpl_size* minpos_y; /* Aperture weighted center : xcentroid=sum(x*f(x)) / sum(f(x)) */ double * xcentroid; double * ycentroid; cpl_size* npix; cpl_size* left_x; cpl_size* left_y; cpl_size* right_x; cpl_size* right_y; cpl_size* top_x; cpl_size* top_y; cpl_size* bottom_x; cpl_size* bottom_y; double * max_val; double * min_val; double * mean; double * varsum; double * median; double * stdev; double * flux; }; /*----------------------------------------------------------------------------- Private functions -----------------------------------------------------------------------------*/ static cpl_apertures * cpl_apertures_new(cpl_size) CPL_ATTR_ALLOC; /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Destructor for cpl_apertures @param self The object to delete. @return void @note If @em self is @c NULL, nothing is done and no error is set. This function deallocates all memory allocated for the object. */ /*----------------------------------------------------------------------------*/ void cpl_apertures_delete(cpl_apertures * self) { if (self !=NULL) { cpl_free(self->x); cpl_free(self->y); cpl_free(self->maxpos_x); cpl_free(self->maxpos_y); cpl_free(self->minpos_x); cpl_free(self->minpos_y); cpl_free(self->xcentroid); cpl_free(self->ycentroid); cpl_free(self->npix); cpl_free(self->left_x); cpl_free(self->left_y); cpl_free(self->right_x); cpl_free(self->right_y); cpl_free(self->top_x); cpl_free(self->top_y); cpl_free(self->bottom_x); cpl_free(self->bottom_y); cpl_free(self->max_val); cpl_free(self->min_val); cpl_free(self->mean); cpl_free(self->varsum); cpl_free(self->median); cpl_free(self->stdev); cpl_free(self->flux); cpl_free(self); } } /*----------------------------------------------------------------------------*/ /** @brief Dump a cpl_apertures to an opened file pointer. @param self The cpl_apertures to dump @param fp File pointer, may use @em stdout or @em stderr @return void This function dumps all information in a cpl_apertures to the passed file pointer. If the object is unallocated or contains nothing, this function does nothing. */ /*----------------------------------------------------------------------------*/ void cpl_apertures_dump(const cpl_apertures * self, FILE * fp) { if (self !=NULL && fp !=NULL && self->naperts > 0) { cpl_size i; fprintf(fp, "# X Y"); fprintf(fp, " XCENTROID YCENTROID"); fprintf(fp, " XMAX YMAX"); fprintf(fp, " XMIN YMIN"); fprintf(fp, " pix"); fprintf(fp, " max"); fprintf(fp, " min"); fprintf(fp, " mean"); fprintf(fp, " med"); fprintf(fp, " dev"); fprintf(fp, " flux"); fprintf(fp, "\n"); for (i = 0; i < self->naperts; i++) { fprintf(fp, "% 3" CPL_SIZE_FORMAT " %6.1f %6.1f", i+1, self->x[i], self->y[i]); fprintf(fp, " %6.1f %6.1f", self->xcentroid[i], self->ycentroid[i]); fprintf(fp, " %6" CPL_SIZE_FORMAT " %6" CPL_SIZE_FORMAT, self->maxpos_x[i], self->maxpos_y[i]); fprintf(fp, " %6" CPL_SIZE_FORMAT " %6" CPL_SIZE_FORMAT, self->minpos_x[i], self->minpos_y[i]); fprintf(fp, " % 6" CPL_SIZE_FORMAT, self->npix[i]); fprintf(fp, " %6.2f", self->max_val[i]); fprintf(fp, " %6.2f", self->min_val[i]); fprintf(fp, " %6.2f", self->mean[i]); fprintf(fp, " %6.2f", self->median[i]); fprintf(fp, " %6.2f", self->stdev[i]); fprintf(fp, " %8.2f", self->flux[i]); fprintf(fp, "\n"); } } } /*----------------------------------------------------------------------------*/ /** @brief Compute statistics on selected apertures @param self Reference image @param lab Labelized image (of type CPL_TYPE_INT) @return An CPL apertures object or @em NULL on error @note The returned object must be deleted using cpl_apertures_delete(). @see cpl_image_labelise_mask_create() The labelized image must contain at least one pixel for each value from 1 to the maximum value in the image. For the centroiding computation of an aperture, if some pixels have values lower or equal to 0, all the values of the aperture are locally shifted such as the minimum value of the aperture has a value of epsilon. The centroid is then computed on these positive values. In principle, centroid should always be computed on positive values, this is done to avoid raising an error in case the caller of the function wants to use it on negative values images without caring about the centroid results. In such cases, the centroid result would be meaningful, but slightly depend on the hardcoded value chosen for epsilon (1e-10). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_TYPE_MISMATCH if lab is not of type CPL_TYPE_INT or if self is of a complex type - CPL_ERROR_ILLEGAL_INPUT if lab has a negative value or zero maximum - CPL_ERROR_INCOMPATIBLE_INPUT if lab and self have different sizes. - CPL_ERROR_DATA_NOT_FOUND if one of the lab values is missing. */ /*----------------------------------------------------------------------------*/ cpl_apertures * cpl_apertures_new_from_image(const cpl_image * self, const cpl_image * lab) { cpl_apertures * aperts; const cpl_image * dimage; cpl_image * cimage = NULL; const cpl_mask * bpm; cpl_image * labcopy = NULL; const cpl_image * labuse; cpl_size naperts; const double * pd; const int * plab; double * sqsum; cpl_size npix; double * med_array; double weight; cpl_size count; const cpl_size nx = cpl_image_get_size_x(self); const cpl_size ny = cpl_image_get_size_y(self); const double ep = 1e-10; cpl_size i, j, k; /* Test entries */ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(lab != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(cpl_image_get_type(lab) == CPL_TYPE_INT, CPL_ERROR_TYPE_MISMATCH, NULL); cpl_ensure(nx == cpl_image_get_size_x(lab), CPL_ERROR_INCOMPATIBLE_INPUT, NULL); cpl_ensure(ny == cpl_image_get_size_y(lab), CPL_ERROR_INCOMPATIBLE_INPUT, NULL); bpm = cpl_image_get_bpm_const(self); if (bpm != NULL && !cpl_mask_is_empty(bpm)) { /* Set the bad pixels of the input image to 0 in the lab image */ /* FIXME: Is this even necessary ? */ labcopy = cpl_image_duplicate(lab); cpl_image_reject_from_mask(labcopy, bpm); cpl_image_fill_rejected(labcopy, 0.0); } labuse = labcopy ? labcopy : lab; plab = cpl_image_get_data_int_const(labuse); /* Get number of apertures from the labelised image */ naperts = (cpl_size)cpl_image_get_max(labuse); if (naperts <= 0) { cpl_image_delete(labcopy); (void)cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return NULL; } /* Convert input image in a double image */ dimage = cpl_image_get_type(self) == CPL_TYPE_DOUBLE ? self : (cimage = cpl_image_cast(self, CPL_TYPE_DOUBLE)); if (dimage == NULL) { cpl_image_delete(labcopy); (void)cpl_error_set_where_(); return NULL; } pd = cpl_image_get_data_double_const(dimage); /* Create a cpl_apertures */ aperts = cpl_apertures_new(naperts); sqsum = cpl_calloc((size_t)naperts, sizeof(double)); /* Initialise min and max */ for (k = 0; k < naperts; k++) { aperts->max_val[k] = -DBL_MAX; aperts->min_val[k] = DBL_MAX; } /* Compute some stats */ for (j = 0; j < ny; j++) { for (i = 0; i < nx; i++) { double pix, delta; k = plab[i+j*nx]-1; /* Background: do nothing */ if (k==-1) continue; if (k < 0) { cpl_free(sqsum); cpl_apertures_delete(aperts); cpl_image_delete(cimage); cpl_image_delete(labcopy); (void)cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return NULL; } /* Current pixel value */ pix = pd[i+j*nx]; /* See cpl_tools_get_variance_double() */ delta = pix - aperts->mean[k]; aperts->varsum[k] += (double)aperts->npix[k] * delta * delta / (double)(aperts->npix[k] + 1); aperts->mean[k] += delta / (double)(aperts->npix[k] + 1); /* Accumulate positions */ aperts->x[k] += (double)(i+1); aperts->y[k] += (double)(j+1); /* Increase number of pixels */ aperts->npix[k] ++; /* Store pixel sum and squared sum */ aperts->flux[k] += pix; sqsum[k] += (pix * pix); /* Check max pos value */ if (pix > aperts->max_val[k]) { aperts->max_val[k] = pix; aperts->maxpos_x[k] = i+1; aperts->maxpos_y[k] = j+1; } /* Check min pos value */ if (pix < aperts->min_val[k]) { aperts->min_val[k] = pix; aperts->minpos_x[k] = i+1; aperts->minpos_y[k] = j+1; } /* Check object extremities */ if ((i+1 < aperts->left_x[k]) || (aperts->left_x[k] == 0)) { aperts->left_x[k] = i+1; aperts->left_y[k] = j+1; } if (i+1 > aperts->right_x[k]) { aperts->right_x[k] = i+1; aperts->right_y[k] = j+1; } if ((j+1 < aperts->bottom_y[k]) || (aperts->bottom_y[k] == 0)) { aperts->bottom_x[k] = i+1; aperts->bottom_y[k] = j+1; } if (j+1 > aperts->top_y[k]) { aperts->top_x[k] = i+1; aperts->top_y[k] = j+1; } } } /* Centroiding */ for (j = 0; j < ny; j++) { for (i = 0; i < nx; i++) { double pix; k = plab[i+j*nx]-1; /* Background: do nothing */ if (k==-1) continue; /* Current pixel value */ pix = pd[i+j*nx]; if (aperts->min_val[k] <= 0) { /* Accumulate weighted positions */ aperts->xcentroid[k]+=(double)(i+1)*(pix-aperts->min_val[k]+ep); aperts->ycentroid[k]+=(double)(j+1)*(pix-aperts->min_val[k]+ep); } else { /* Accumulate weighted positions */ aperts->xcentroid[k] += (double)(i+1) * pix; aperts->ycentroid[k] += (double)(j+1) * pix; } } } /* Compute average and std dev for each aperture, normalize centers */ for (k = 0; k < aperts->naperts; k++) { npix = aperts->npix[k]; if (npix<=0) { cpl_free(sqsum); cpl_apertures_delete(aperts); cpl_image_delete(cimage); cpl_image_delete(labcopy); (void)cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); return NULL; } if (npix > 1) { aperts->stdev[k] = sqrt(aperts->varsum[k]/((double)npix-1.0)); } else { aperts->stdev[k] = -1.0; } aperts->x[k] /= (double)npix; aperts->y[k] /= (double)npix; weight = aperts->flux[k]; if (aperts->min_val[k] <= 0) { weight -= (double)npix * aperts->min_val[k]; weight += (double)npix * ep; } if (aperts->xcentroid[k] >= weight * (double)aperts->left_x[k] && aperts->xcentroid[k] <= weight * (double)aperts->right_x[k] && weight != 0.0) { aperts->xcentroid[k] /= weight; } else { aperts->xcentroid[k] = 0.0; } if (aperts->ycentroid[k] >= weight * (double)aperts->bottom_y[k] && aperts->ycentroid[k] <= weight * (double)aperts->top_y[k] && weight != 0.0) { aperts->ycentroid[k] /= weight; } else { aperts->ycentroid[k] = 0.0; } } cpl_free(sqsum); /* Compute median for each aperture */ for (k = 0; k < naperts; k++) { med_array = cpl_malloc((size_t)aperts->npix[k] * sizeof(double)); count=0; for (j = 0; j < ny; j++) { for (i = 0; i < nx; i++) { if (plab[i+j*nx]==(k+1)) med_array[count++] = pd[i+j*nx]; } } aperts->median[k] = cpl_tools_get_median_double(med_array, count); cpl_free(med_array); } cpl_image_delete(cimage); cpl_image_delete(labcopy); return aperts; } /*----------------------------------------------------------------------------*/ /** @brief Get the number of apertures @param self The cpl_apertures object @return The number of apertures or -1 on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_size(const cpl_apertures * self) { cpl_ensure(self, CPL_ERROR_NULL_INPUT, -1); return self->naperts; } /*----------------------------------------------------------------------------*/ /** @brief Get the average X-position of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The average X-position of the aperture or negative on error @note In case of an error the #_cpl_error_code_ code is set @see cpl_apertures_get_centroid_x() */ /*----------------------------------------------------------------------------*/ double cpl_apertures_get_pos_x(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1.0); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2.0); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3.0); return self->x[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the average Y-position of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The average Y-position of the aperture or negative on error @see cpl_apertures_get_pos_x() */ /*----------------------------------------------------------------------------*/ double cpl_apertures_get_pos_y(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1.0); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2.0); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3.0); return self->y[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the average X-position of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The average X-position of the aperture or negative on error @deprecated Replace this function with cpl_apertures_get_pos_x() */ /*----------------------------------------------------------------------------*/ double cpl_apertures_get_max_x(const cpl_apertures * self, cpl_size ind) { return cpl_apertures_get_pos_x(self, ind); } /*----------------------------------------------------------------------------*/ /** @brief Get the average Y-position of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The average Y-position of the aperture or negative on error @deprecated Replace this function with cpl_apertures_get_pos_y() */ /*----------------------------------------------------------------------------*/ double cpl_apertures_get_max_y(const cpl_apertures * self, cpl_size ind) { return cpl_apertures_get_pos_y(self, ind); } /*----------------------------------------------------------------------------*/ /** @brief Get the X-centroid of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The X-centroid position of the aperture or negative on error @note In case of an error the #_cpl_error_code_ code is set For a concave aperture the centroid may not belong to the aperture. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if ind is non-positive - CPL_ERROR_ACCESS_OUT_OF_RANGE if ind exceeds the number of apertures in self */ /*----------------------------------------------------------------------------*/ double cpl_apertures_get_centroid_x(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1.0); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2.0); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3.0); return self->xcentroid[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the Y-centroid of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The X-centroid position of the aperture or negative on error @note In case of an error the #_cpl_error_code_ code is set @see cpl_apertures_get_centroid_x() */ /*----------------------------------------------------------------------------*/ double cpl_apertures_get_centroid_y(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1.0); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2.0); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3.0); return self->ycentroid[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the X-position of the aperture maximum value @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The X-position of the aperture maximum value or negative on error @note In case of an error the #_cpl_error_code_ code is set @see cpl_apertures_get_centroid_x() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_maxpos_x(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->maxpos_x[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the Y-position of the aperture maximum value @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The Y-position of the aperture maximum value or negative on error @note In case of an error the #_cpl_error_code_ code is set @see cpl_apertures_get_maxpos_x() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_maxpos_y(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->maxpos_y[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the X-position of the aperture minimum value @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The X-position of the aperture minimum value or negative on error @note In case of an error the #_cpl_error_code_ code is set @see cpl_apertures_get_maxpos_x() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_minpos_x(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->minpos_x[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the Y-position of the aperture minimum value @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The Y-position of the aperture minimum value or negative on error @note In case of an error the #_cpl_error_code_ code is set @see cpl_apertures_get_minpos_x() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_minpos_y(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->minpos_y[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the number of pixels of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The number of pixels of the aperture or negative on error @note In case of an error the #_cpl_error_code_ code is set Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if ind is non-positive - CPL_ERROR_ACCESS_OUT_OF_RANGE if ind exceeds the number of apertures in self */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_npix(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->npix[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the leftmost x position in an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return the leftmost x position of the aperture or negative on error @note In case of an error the #_cpl_error_code_ code is set @see cpl_apertures_get_maxpos_x() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_left(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->left_x[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the y position of the leftmost x position in an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return the y position of the leftmost x position or negative on error @note An aperture may have multiple leftmost x positions, in which case one of these is returned. @see cpl_apertures_get_maxpos_x() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_left_y(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->left_y[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the rightmost x position in an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return the rightmost x position in an aperture or negative on error @note In case of an error the #_cpl_error_code_ code is set @see cpl_apertures_get_maxpos_x() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_right(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->right_x[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the y position of the rightmost x position in an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return the y position of the rightmost x position or negative on error @note An aperture may have multiple rightmost x positions, in which case one of these is returned. @see cpl_apertures_get_maxpos_x() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_right_y(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->right_y[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the x position of the bottommost y position in an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return the bottommost x position of the aperture or negative on error @note An aperture may have multiple bottom x positions, in which case one of these is returned. @see cpl_apertures_get_maxpos_x() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_bottom_x(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->bottom_x[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the bottommost y position in an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return the bottommost y position in the aperture or negative on error @note In case of an error the #_cpl_error_code_ code is set @see cpl_apertures_get_maxpos_x() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_bottom(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->bottom_y[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the x position of the topmost y position in an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return the x position of the topmost y position or negative on error @note An aperture may have multiple topmost x positions, in which case one of these is returned. @see cpl_apertures_get_maxpos_x() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_top_x(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->top_x[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the topmost y position in an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return the topmost y position in the aperture or negative on error @note In case of an error the #_cpl_error_code_ code is set @see cpl_apertures_get_maxpos_x() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_apertures_get_top(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); return self->top_y[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the maximum value of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The maximum value of the aperture or undefined on error @note In case of an error the #_cpl_error_code_ code is set Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if ind is non-positive - CPL_ERROR_ACCESS_OUT_OF_RANGE if ind exceeds the number of apertures in self */ /*----------------------------------------------------------------------------*/ double cpl_apertures_get_max(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, 0.0); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, 0.0); return self->max_val[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the minimum value of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The minimum value of the aperture or undefined on error @see cpl_apertures_get_max() */ /*----------------------------------------------------------------------------*/ double cpl_apertures_get_min(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, 0.0); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, 0.0); return self->min_val[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the mean value of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The mean value of the aperture or undefined on error @see cpl_apertures_get_max() */ /*----------------------------------------------------------------------------*/ double cpl_apertures_get_mean(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, 0.0); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, 0.0); return self->mean[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the median value of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The median value of the aperture or undefined on error @see cpl_apertures_get_max() */ /*----------------------------------------------------------------------------*/ double cpl_apertures_get_median(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, 0.0); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, 0.0); return self->median[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the standard deviation of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The standard deviation of the aperture or negative on error @see cpl_apertures_get_max() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if ind is non-positive - CPL_ERROR_ACCESS_OUT_OF_RANGE if ind exceeds the number of apertures in self - CPL_ERROR_DATA_NOT_FOUND if the aperture comprises less than two pixels */ /*----------------------------------------------------------------------------*/ double cpl_apertures_get_stdev(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1.0); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, -2.0); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3.0); /* A negative value is used as internal representation of an undefined stdev. An error is raised only when the stdev is asked for */ cpl_ensure(self->stdev[ind-1] >= 0.0, CPL_ERROR_DATA_NOT_FOUND, -4.0); return self->stdev[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Get the flux of an aperture @param self The cpl_apertures object @param ind The aperture index (1 for the first one) @return The flux of the aperture or undefined on error @see cpl_apertures_get_max() */ /*----------------------------------------------------------------------------*/ double cpl_apertures_get_flux(const cpl_apertures * self, cpl_size ind) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(ind > 0, CPL_ERROR_ILLEGAL_INPUT, 0.0); cpl_ensure(ind <= self->naperts, CPL_ERROR_ACCESS_OUT_OF_RANGE, 0.0); return self->flux[ind-1]; } /*----------------------------------------------------------------------------*/ /** @brief Sort by decreasing aperture size @param self Apertures to sort (MODIFIED) @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_apertures_sort_by_npix(cpl_apertures * self) { cpl_apertures * sorted_apert; void * swap; cpl_size naperts; cpl_size * sorted_ind; cpl_size * computed; cpl_size max_npix; cpl_size max_ind = -1; /* Avoid (false) uninit warning */ cpl_size i, j; /* Test entries */ cpl_ensure_code(self, CPL_ERROR_NULL_INPUT); /* Initialize */ naperts = self->naperts; /* Compute the sorted index array - FIXME: Use better sort algorithm ? */ sorted_ind = cpl_malloc((size_t)naperts * sizeof(*sorted_ind)); computed = cpl_calloc((size_t)naperts, sizeof(*computed)); for (j = 0; j < naperts; j++) { max_npix = -1; for (i = 0; i < naperts; i++) { if ((computed[i]==0) && (max_npix < self->npix[i])) { max_npix = self->npix[i]; max_ind = i; } } computed[max_ind] = 1; sorted_ind[j] = max_ind; } cpl_free(computed); /* Now sort the input apertures */ sorted_apert = cpl_apertures_new(naperts); for (i = 0; i < sorted_apert->naperts; i++) { sorted_apert->x[i] = self->x[sorted_ind[i]]; sorted_apert->y[i] = self->y[sorted_ind[i]]; sorted_apert->maxpos_x[i] = self->maxpos_x[sorted_ind[i]]; sorted_apert->maxpos_y[i] = self->maxpos_y[sorted_ind[i]]; sorted_apert->minpos_x[i] = self->minpos_x[sorted_ind[i]]; sorted_apert->minpos_y[i] = self->minpos_y[sorted_ind[i]]; sorted_apert->xcentroid[i] = self->xcentroid[sorted_ind[i]]; sorted_apert->ycentroid[i] = self->ycentroid[sorted_ind[i]]; sorted_apert->npix[i] = self->npix[sorted_ind[i]]; sorted_apert->left_x[i] = self->left_x[sorted_ind[i]]; sorted_apert->left_y[i] = self->left_y[sorted_ind[i]]; sorted_apert->right_x[i] = self->right_x[sorted_ind[i]]; sorted_apert->right_y[i] = self->right_y[sorted_ind[i]]; sorted_apert->top_x[i] = self->top_x[sorted_ind[i]]; sorted_apert->top_y[i] = self->top_y[sorted_ind[i]]; sorted_apert->bottom_x[i] = self->bottom_x[sorted_ind[i]]; sorted_apert->bottom_y[i] = self->bottom_y[sorted_ind[i]]; sorted_apert->max_val[i] = self->max_val[sorted_ind[i]]; sorted_apert->min_val[i] = self->min_val[sorted_ind[i]]; sorted_apert->mean[i] = self->mean[sorted_ind[i]]; sorted_apert->median[i] = self->median[sorted_ind[i]]; sorted_apert->stdev[i] = self->stdev[sorted_ind[i]]; sorted_apert->flux[i] = self->flux[sorted_ind[i]]; } cpl_free(sorted_ind); /* Swap the sorted and the input apertures */ swap = cpl_malloc(sizeof(cpl_apertures)); memcpy(swap, sorted_apert, sizeof(cpl_apertures)); memcpy(sorted_apert, self, sizeof(cpl_apertures)); memcpy(self, swap, sizeof(cpl_apertures)); cpl_free(swap); cpl_apertures_delete(sorted_apert); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Sort by decreasing aperture peak value @param self Apertures to sort (MODIFIED) @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_apertures_sort_by_npix() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_apertures_sort_by_max(cpl_apertures * self) { cpl_apertures * sorted_apert; void * swap; cpl_size naperts; cpl_size * sorted_ind; cpl_size * computed; double max_max = DBL_MAX; /* Avoid (false) uninit warning */ cpl_size max_ind; cpl_size i, j; /* Test entries */ cpl_ensure_code(self, CPL_ERROR_NULL_INPUT); /* Initialize */ naperts = self->naperts; /* Compute the sorted index array - FIXME: Use better sort algorithm ? */ sorted_ind = cpl_malloc((size_t)naperts * sizeof(*sorted_apert)); computed = cpl_calloc((size_t)naperts, sizeof(*computed)); for (j = 0; j < naperts; j++) { max_ind = -1; for (i = 0; i < naperts; i++) { if ((computed[i]==0) && (max_ind < 0 || max_max < self->max_val[i])) { max_max = self->max_val[i]; max_ind = i; } } computed[max_ind] = 1; sorted_ind[j] = max_ind; } cpl_free(computed); /* Now sort the input apertures */ sorted_apert = cpl_apertures_new(naperts); for (i = 0; i < sorted_apert->naperts; i++) { sorted_apert->x[i] = self->x[sorted_ind[i]]; sorted_apert->y[i] = self->y[sorted_ind[i]]; sorted_apert->maxpos_x[i] = self->maxpos_x[sorted_ind[i]]; sorted_apert->maxpos_y[i] = self->maxpos_y[sorted_ind[i]]; sorted_apert->minpos_x[i] = self->minpos_x[sorted_ind[i]]; sorted_apert->minpos_y[i] = self->minpos_y[sorted_ind[i]]; sorted_apert->xcentroid[i] = self->xcentroid[sorted_ind[i]]; sorted_apert->ycentroid[i] = self->ycentroid[sorted_ind[i]]; sorted_apert->npix[i] = self->npix[sorted_ind[i]]; sorted_apert->left_x[i] = self->left_x[sorted_ind[i]]; sorted_apert->left_y[i] = self->left_y[sorted_ind[i]]; sorted_apert->right_x[i] = self->right_x[sorted_ind[i]]; sorted_apert->right_y[i] = self->right_y[sorted_ind[i]]; sorted_apert->top_x[i] = self->top_x[sorted_ind[i]]; sorted_apert->top_y[i] = self->top_y[sorted_ind[i]]; sorted_apert->bottom_x[i] = self->bottom_x[sorted_ind[i]]; sorted_apert->bottom_y[i] = self->bottom_y[sorted_ind[i]]; sorted_apert->max_val[i] = self->max_val[sorted_ind[i]]; sorted_apert->min_val[i] = self->min_val[sorted_ind[i]]; sorted_apert->mean[i] = self->mean[sorted_ind[i]]; sorted_apert->median[i] = self->median[sorted_ind[i]]; sorted_apert->stdev[i] = self->stdev[sorted_ind[i]]; sorted_apert->flux[i] = self->flux[sorted_ind[i]]; } cpl_free(sorted_ind); /* Swap the sorted and the input apertures */ swap = cpl_malloc(sizeof(cpl_apertures)); memcpy(swap, sorted_apert, sizeof(cpl_apertures)); memcpy(sorted_apert, self, sizeof(cpl_apertures)); memcpy(self, swap, sizeof(cpl_apertures)); cpl_free(swap); cpl_apertures_delete(sorted_apert); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Sort by decreasing aperture flux @param self Apertures to sort (MODIFIED) @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_apertures_sort_by_npix() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_apertures_sort_by_flux(cpl_apertures * self) { cpl_apertures * sorted_apert; void * swap; cpl_size naperts; cpl_size * sorted_ind; cpl_size * computed; double max_flux = DBL_MAX; /* Avoid (false) uninit warning */ cpl_size max_ind; cpl_size i, j; /* Test entries */ cpl_ensure_code(self, CPL_ERROR_NULL_INPUT); /* Initialize */ naperts = self->naperts; /* Compute the sorted index array - FIXME: Use better sort algorithm ? */ sorted_ind = cpl_malloc((size_t)naperts * sizeof(*sorted_ind)); computed = cpl_calloc((size_t)naperts, sizeof(*computed)); for (j = 0; j < naperts; j++) { max_ind = -1; for (i = 0; i < naperts; i++) { if ((computed[i]==0) && (max_ind < 0 || max_flux < self->flux[i])) { max_flux = self->flux[i]; max_ind = i; } } computed[max_ind] = 1; sorted_ind[j] = max_ind; } cpl_free(computed); /* Now sort the input apertures */ sorted_apert = cpl_apertures_new(naperts); for (i = 0; i < sorted_apert->naperts; i++) { sorted_apert->x[i] = self->x[sorted_ind[i]]; sorted_apert->y[i] = self->y[sorted_ind[i]]; sorted_apert->maxpos_x[i] = self->maxpos_x[sorted_ind[i]]; sorted_apert->maxpos_y[i] = self->maxpos_y[sorted_ind[i]]; sorted_apert->minpos_x[i] = self->minpos_x[sorted_ind[i]]; sorted_apert->minpos_y[i] = self->minpos_y[sorted_ind[i]]; sorted_apert->xcentroid[i] = self->xcentroid[sorted_ind[i]]; sorted_apert->ycentroid[i] = self->ycentroid[sorted_ind[i]]; sorted_apert->npix[i] = self->npix[sorted_ind[i]]; sorted_apert->left_x[i] = self->left_x[sorted_ind[i]]; sorted_apert->left_y[i] = self->left_y[sorted_ind[i]]; sorted_apert->right_x[i] = self->right_x[sorted_ind[i]]; sorted_apert->right_y[i] = self->right_y[sorted_ind[i]]; sorted_apert->top_x[i] = self->top_x[sorted_ind[i]]; sorted_apert->top_y[i] = self->top_y[sorted_ind[i]]; sorted_apert->bottom_x[i] = self->bottom_x[sorted_ind[i]]; sorted_apert->bottom_y[i] = self->bottom_y[sorted_ind[i]]; sorted_apert->max_val[i] = self->max_val[sorted_ind[i]]; sorted_apert->min_val[i] = self->min_val[sorted_ind[i]]; sorted_apert->mean[i] = self->mean[sorted_ind[i]]; sorted_apert->median[i] = self->median[sorted_ind[i]]; sorted_apert->stdev[i] = self->stdev[sorted_ind[i]]; sorted_apert->flux[i] = self->flux[sorted_ind[i]]; } cpl_free(sorted_ind); /* Swap the sorted and the input apertures */ swap = cpl_malloc(sizeof(cpl_apertures)); memcpy(swap, sorted_apert, sizeof(cpl_apertures)); memcpy(sorted_apert, self, sizeof(cpl_apertures)); memcpy(self, swap, sizeof(cpl_apertures)); cpl_free(swap); cpl_apertures_delete(sorted_apert); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Simple detection of apertures in an image @param self The image to process @param sigmas Positive, decreasing sigmas to apply @param pisigma Index of the sigma that was used or unchanged on error @return The detected apertures or NULL on error @see cpl_apertures_extract_sigma() pisigma may be NULL. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if self or sigmas is NULL - CPL_ERROR_DATA_NOT_FOUND if the apertures cannot be detected */ /*----------------------------------------------------------------------------*/ cpl_apertures * cpl_apertures_extract(const cpl_image * self, const cpl_vector * sigmas, cpl_size * pisigma) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_apertures * aperts = NULL; const cpl_size n = cpl_vector_get_size(sigmas); cpl_size i; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(sigmas != NULL, CPL_ERROR_NULL_INPUT, NULL); for (i = 0; i < n; i++) { const double sigma = cpl_vector_get(sigmas, i); if (sigma <= 0.0) break; /* Apply the detection */ aperts = cpl_apertures_extract_sigma(self, sigma); if (aperts != NULL) break; } cpl_ensure(aperts != NULL, CPL_ERROR_DATA_NOT_FOUND, NULL); /* Recover from any errors set in cpl_apertures_extract_sigma() */ cpl_errorstate_set(prestate); if (pisigma) *pisigma = i; return aperts; } /*----------------------------------------------------------------------------*/ /** @brief Simple detection of apertures in an image window @param self The image to process @param sigmas Positive, decreasing sigmas to apply @param llx Lower left x position (FITS convention) @param lly Lower left y position (FITS convention) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @param pisigma Index of the sigma that was used or undefined on error @return The list of detected apertures or NULL on error @see cpl_apertures_extract() @see cpl_image_extract() */ /*----------------------------------------------------------------------------*/ cpl_apertures * cpl_apertures_extract_window(const cpl_image * self, const cpl_vector * sigmas, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size * pisigma) { cpl_apertures * aperts; cpl_image * extracted; cpl_size i; /* Test entries */ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(sigmas != NULL, CPL_ERROR_NULL_INPUT, NULL); /* Extract the subwindow - and check entries */ extracted = cpl_image_extract(self, llx, lly, urx, ury); cpl_ensure(extracted, cpl_error_get_code(), NULL); /* Get the apertures */ aperts = cpl_apertures_extract(extracted, sigmas, pisigma); cpl_image_delete(extracted); cpl_ensure(aperts, cpl_error_get_code(), NULL); /* Update the detected positions */ for (i = 0; i < aperts->naperts; i++) { aperts->x[i] += (double)(llx - 1); aperts->y[i] += (double)(lly - 1); aperts->maxpos_x[i] += (double)(llx - 1); aperts->maxpos_y[i] += (double)(lly - 1); aperts->minpos_x[i] += (double)(llx - 1); aperts->minpos_y[i] += (double)(lly - 1); aperts->xcentroid[i] += (double)(llx - 1); aperts->ycentroid[i] += (double)(lly - 1); aperts->left_x[i] += llx - 1; aperts->left_y[i] += lly - 1; aperts->right_x[i] += llx - 1; aperts->right_y[i] += lly - 1; aperts->top_x[i] += llx - 1; aperts->top_y[i] += lly - 1; aperts->bottom_x[i] += llx - 1; aperts->bottom_y[i] += lly - 1; } return aperts; } /*----------------------------------------------------------------------------*/ /** @brief Simple apertures creation from a user supplied selection mask @param self The image to process @param selection The mask of selected pixels @return The list of detected apertures or NULL if nothing detected or on error. @see cpl_image_labelise_mask_create(), cpl_apertures_new_from_image() The values selected for inclusion in the apertures must have the non-zero value in the selection mask, and must not be flagged as bad in the bad pixel map of the image. The input image type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if self and selection have different sizes. - CPL_ERROR_TYPE_MISMATCH if self is of a complex type - CPL_ERROR_DATA_NOT_FOUND if the selection mask is empty */ /*----------------------------------------------------------------------------*/ cpl_apertures * cpl_apertures_extract_mask(const cpl_image * self, const cpl_mask * selection) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_apertures * aperts = NULL; cpl_size nlabels; /* Labelise the user provided selection */ cpl_image * labels = cpl_image_labelise_mask_create(selection, &nlabels); if (labels != NULL && nlabels > 0) { /* Create the detected apertures list */ aperts = cpl_apertures_new_from_image(self, labels); } if (aperts == NULL) { cpl_errorstate_is_equal(prestate) ? (void)cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND) : (void)cpl_error_set_where_(); } cpl_image_delete(labels); return aperts; } /*----------------------------------------------------------------------------*/ /** @brief Simple apertures detection in an image using a provided sigma @param self The image to process @param sigma Detection level @return The list of detected apertures or NULL on error @note In order to avoid (the potentially many) detections of small objects the mask of detected pixels is subjected to a 3x3 morphological opening filter. @see cpl_apertures_extract_mask(), cpl_mask_filter() The threshold used for the detection is the median plus the average distance to the median times sigma. The input image type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if sigma is non-positive - CPL_ERROR_TYPE_MISMATCH if self is of a complex type - CPL_ERROR_DATA_NOT_FOUND if the no apertures are found */ /*----------------------------------------------------------------------------*/ cpl_apertures * cpl_apertures_extract_sigma(const cpl_image * self, double sigma) { double median, med_dist; double threshold; cpl_mask * selection; cpl_apertures * aperts = NULL; /* Check entries */ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(sigma > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Compute the threshold */ median = cpl_image_get_median_dev(self, &med_dist); threshold = median + sigma * med_dist; /* Binarise the image */ selection = cpl_mask_threshold_image_create(self, threshold, DBL_MAX); if (selection != NULL) { /* Use a morphological opening to remove the single pixel detections */ cpl_mask * kernel = cpl_mask_new(3, 3); /* These two should not be able to fail */ const int error = cpl_mask_not(kernel) || cpl_mask_filter(selection, selection, kernel, CPL_FILTER_OPENING, CPL_BORDER_ZERO); cpl_mask_delete(kernel); if (!error) { /* Create the detected apertures list */ aperts = cpl_apertures_extract_mask(self, selection); } cpl_mask_delete(selection); } if (aperts == NULL) { (void)cpl_error_set_where_(); } return aperts; } /*----------------------------------------------------------------------------*/ /** @brief Compute FWHM values in x and y for a list of apertures @param self The image to process @param aperts The list of apertures @return A newly allocated object containing the fwhms in x and y or NULL @see cpl_image_get_fwhm() @deprecated Replace this call with a loop over cpl_image_get_fwhm() */ /*----------------------------------------------------------------------------*/ cpl_bivector * cpl_apertures_get_fwhm(const cpl_image * self, const cpl_apertures * aperts) { cpl_errorstate prevstate = cpl_errorstate_get(); cpl_bivector * fwhms; double * fwhms_x; double * fwhms_y; cpl_size naperts; cpl_size i, nok = 0; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(aperts != NULL, CPL_ERROR_NULL_INPUT, NULL); naperts = cpl_apertures_get_size(aperts); cpl_ensure(naperts >= 1, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Allocate storage */ fwhms = cpl_bivector_new(naperts); fwhms_x = cpl_bivector_get_x_data(fwhms); fwhms_y = cpl_bivector_get_y_data(fwhms); /* Compute FWHM on all apertures */ for (i=0; i < naperts; i++) { const cpl_error_code error = cpl_image_get_fwhm(self, (cpl_size)cpl_apertures_get_pos_x(aperts, i+1), (cpl_size)cpl_apertures_get_pos_y(aperts, i+1), &(fwhms_x[i]), &(fwhms_y[i])); if (!error) { nok++; } else if (error == CPL_ERROR_DATA_NOT_FOUND) { /* This error can be ignored */ cpl_errorstate_set(prevstate); } else { /* This unexpected error cannot be ignored */ cpl_bivector_delete(fwhms); (void)cpl_error_set_where_(); return NULL; } } if (!nok) { /* Require at least one fwhm to be OK */ cpl_bivector_delete(fwhms); (void)cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); fwhms = NULL; } return fwhms; } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Constructor for cpl_apertures @param naperts Number of apertures in the structure @return 1 newly allocated cpl_apertures or NULL on error The returned object must be deleted using cpl_apertures_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if naperts is not strictly positive */ /*----------------------------------------------------------------------------*/ static cpl_apertures * cpl_apertures_new(cpl_size naperts) { cpl_apertures * aperts; /* Check entries */ cpl_ensure(naperts > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Create a cpl_apertures */ aperts = (cpl_apertures *)cpl_malloc(sizeof(cpl_apertures)); aperts->naperts = naperts; /* Allocate data holders */ aperts->x = cpl_calloc((size_t)naperts, sizeof(double)); aperts->y = cpl_calloc((size_t)naperts, sizeof(double)); aperts->maxpos_x = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->maxpos_y = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->minpos_x = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->minpos_y = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->xcentroid = cpl_calloc((size_t)naperts, sizeof(double)); aperts->ycentroid = cpl_calloc((size_t)naperts, sizeof(double)); aperts->npix = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->left_x = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->left_y = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->right_x = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->right_y = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->top_x = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->top_y = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->bottom_x = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->bottom_y = cpl_calloc((size_t)naperts, sizeof(cpl_size)); aperts->max_val = cpl_calloc((size_t)naperts, sizeof(double)); aperts->min_val = cpl_calloc((size_t)naperts, sizeof(double)); aperts->mean = cpl_calloc((size_t)naperts, sizeof(double)); aperts->varsum = cpl_calloc((size_t)naperts, sizeof(double)); aperts->median = cpl_calloc((size_t)naperts, sizeof(double)); aperts->stdev = cpl_calloc((size_t)naperts, sizeof(double)); aperts->flux = cpl_calloc((size_t)naperts, sizeof(double)); return aperts; } cpl-6.4.1/cpldrs/cpl_geom_img.h0000644000460300003120000000641211660456770013312 00000000000000/* $Id: cpl_geom_img.h,v 1.8 2011-11-15 12:41:28 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-11-15 12:41:28 $ * $Revision: 1.8 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_GEOM_IMG_H #define CPL_GEOM_IMG_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ typedef enum { /* CPL Geometry combination modes */ /* Combine using the intersection of the images */ CPL_GEOM_INTERSECT, /* Combine using the union of the images */ CPL_GEOM_UNION, /* Combine using the first image to aggregate the other ones */ CPL_GEOM_FIRST } cpl_geom_combine; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* Offsets detection and frames recombination */ cpl_bivector * cpl_geom_img_offset_fine(const cpl_imagelist *, const cpl_bivector *, const cpl_bivector *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_vector *) CPL_ATTR_ALLOC; cpl_image ** cpl_geom_img_offset_saa(const cpl_imagelist *, const cpl_bivector *, cpl_kernel, cpl_size, cpl_size, cpl_geom_combine, double *, double *) CPL_ATTR_ALLOC; cpl_image ** cpl_geom_img_offset_combine(const cpl_imagelist *, const cpl_bivector *, int, const cpl_bivector *, const cpl_vector *, cpl_size *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_geom_combine) CPL_ATTR_ALLOC; CPL_END_DECLS #endif cpl-6.4.1/cpldrs/cpl_fit_body.h0000644000460300003120000002720711614520716013322 00000000000000/* $Id: cpl_fit_body.h,v 1.13 2011-07-29 12:04:30 llundin Exp $ * * This file is part of the ESO cpl package * Copyright (C) 2001-2007 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #define CPL_TYPE_ADD(a) CONCAT2X(a, CPL_TYPE) #define CPL_TYPE_ADD_CONST(a) CONCAT3X(a, CPL_TYPE, const) /*----------------------------------------------------------------------------*/ /** @brief Fit a polynomial to each pixel in a list of images @param self Preallocated imagelist to hold fitting result @param ml Lower triangular matrix L, L * L' = V' * V @param mv The transpose of the Vandermonde matrix, V' @param x_pos The vector of positions to fit (used for fiterror only) @param values The list of images with values to fit @param llx Lower left x coordinate @param lly Lower left y coordinate @param xpow The mindeg powers of x_pos (or NULL, when mindeg is zero) @param xnmean Minus the mean value of the x_pos elements (or zero) @param fiterror When non-NULL, the error of the fit @return CPL_ERROR_NONE or the relevant CPL error code on error @see cpl_fit_imagelist_polynomial */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_fit_imagelist_polynomial)(cpl_imagelist * self, const cpl_matrix * ml, const cpl_matrix * mv, const cpl_vector * x_pos, const cpl_imagelist * values, cpl_size llx, cpl_size lly, const cpl_vector * xpow, double xnmean, cpl_image * fiterror) { const cpl_image * first = cpl_imagelist_get(self, 0); const cpl_type pixeltype = cpl_image_get_type(first); const cpl_image * value = cpl_imagelist_get_const(values, 0); const cpl_size innx = cpl_image_get_size_x(value); const cpl_size np = cpl_imagelist_get_size(values); const cpl_size nx = cpl_image_get_size_x(first); const cpl_size ny = cpl_image_get_size_y(first); const cpl_size nc = cpl_imagelist_get_size(self); const cpl_boolean do_err = fiterror != NULL ? CPL_TRUE : CPL_FALSE; const cpl_type errtype = do_err ? cpl_image_get_type(fiterror) : CPL_TYPE_INVALID; /* Total number of fits to do */ const cpl_size imsize = nx * ny; /* Process this many pixel fits in one go to improve cache usage - The code will be correct for any natural-number-value of ijblock, but a too small and a too large value will slow down the code. */ const cpl_size ijblock = cpl_fit_imagelist_polynomial_find_block_size(np, nc, do_err, cpl_image_get_type(value), pixeltype, errtype); /* - except in that the last block may have fewer points */ cpl_size ijdo = ijblock; const CPL_TYPE * pi; double * px = cpl_malloc((size_t)(ijblock * nc) * sizeof(*px)); double * pbw = cpl_malloc((size_t)(ijblock * np) * sizeof(*pbw)); /* The polynomial coefficients to be solved for - transposed, so the ijblock polynomials are stored consequtively */ cpl_matrix * mx = cpl_matrix_wrap(ijblock, nc, px); /* The transpose of one row of values to be fitted */ cpl_matrix * mb = cpl_matrix_wrap(ijblock, np, pbw); cpl_size i, k; cpl_size ij, ijstop; /* First pixel to read from - in row i */ cpl_size ini0 = (llx - 1) + (lly - 1) * innx; cpl_size ini = 0; /* Avoid (false) uninit warning */ cpl_size ii0; /* Row index of input image buffer */ cpl_size ii = 0; /* Avoid (false) uninit warning */ cpl_error_code error = CPL_ERROR_NONE; /* Process ijdo pixels at a time - Improves cache usage */ for (ij = 0, ii0 = 0; ij < imsize; ij += ijdo) { if (ij + ijdo > imsize) ijdo = imsize - ij; /* Upper limit for pixel index in this iteration */ ijstop = ij + ijdo; /* Fill in matrices */ for (k=0; k < np; k++) { pi = CPL_TYPE_ADD_CONST(cpl_image_get_data) (cpl_imagelist_get_const(values, k)); ii = ii0; ini = ini0; for (i=0; i < ijdo; i++, ii++) { if (ii == nx) { ii = 0; ini += innx; } /* The fact the mb is transposed makes this operation more expensive - which is OK, since it has a lower complexity than the subsequent use of mb */ pbw[np * i + k] = (double)pi[ini + ii]; } } ii0 = ii; ini0 = ini; /* Form the right hand side of the normal equations, X = V' * B */ cpl_matrix_product_transpose(mx, mb, mv); /* In-place solution of the normal equations, L * L' * X = V' * B */ cpl_matrix_solve_chol_transpose(ml, mx); if (xnmean != 0.0) { /* Shift polynomials back */ for (i=0; i < ijdo; i++) { cpl_polynomial_shift_double(px + i * nc, (int)nc, xnmean); } } /* Copy results to output image list */ switch (pixeltype) { case CPL_TYPE_DOUBLE: cpl_fit_imagelist_fill_double(self, ij, ijstop, mx); break; case CPL_TYPE_FLOAT: cpl_fit_imagelist_fill_float(self, ij, ijstop, mx); break; case CPL_TYPE_INT: cpl_fit_imagelist_fill_int(self, ij, ijstop, mx); break; default: /* It is an error in CPL to reach this point */ (void)cpl_error_set_(CPL_ERROR_UNSPECIFIED); } if (fiterror != NULL) { switch (cpl_image_get_type(fiterror)) { case CPL_TYPE_DOUBLE: cpl_fit_imagelist_residual_double(fiterror, ij, ijstop, x_pos, xpow, mx, mb); break; case CPL_TYPE_FLOAT: cpl_fit_imagelist_residual_float(fiterror, ij, ijstop, x_pos, xpow, mx, mb); break; case CPL_TYPE_INT: cpl_fit_imagelist_residual_int(fiterror, ij, ijstop, x_pos, xpow, mx, mb); break; default: error = cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } if (error) break; } } cpl_matrix_delete(mx); cpl_matrix_delete(mb); return error; } /*----------------------------------------------------------------------------*/ /** @brief Fill a row in the imagelist with the contents of the matrix @param self Preallocated imagelist @param jj The index of the image row to fill @param mx The transpose of the computed fitting coefficients @return void The fact the mx is transposed makes this operation more expensive - which is OK, since it has a lower complexity than the other use of mx */ /*----------------------------------------------------------------------------*/ static void CPL_TYPE_ADD(cpl_fit_imagelist_fill)(cpl_imagelist * self, cpl_size ij, cpl_size ijstop, const cpl_matrix * mx) { const cpl_size ijdo = ijstop - ij; const cpl_size nc = cpl_matrix_get_ncol(mx); const double * px = cpl_matrix_get_data_const(mx); cpl_size i, k; assert(cpl_imagelist_get_size(self) == nc); for (k=0; k < nc; k++) { CPL_TYPE * pdest = ij + CPL_TYPE_ADD(cpl_image_get_data)(cpl_imagelist_get(self, k)); for (i=0; i < ijdo; i++) { #ifdef CPL_TYPE_INT_ROUND /* Round off to nearest integer */ pdest[i] = CPL_TYPE_INT_ROUND(px[nc * i + k]); #else pdest[i] = (CPL_TYPE)px[nc * i + k]; #endif } } } /*----------------------------------------------------------------------------*/ /** @brief Compute the residual of a polynomial fit to an imagelist @param self Preallocated image to hold residual @param jj The index of the image row to compute @param x_pos The vector of positions to fit (used for fiterror only) @param xpow The mindeg powers of x_pos (or NULL, when mindeg is zero) @param mx The transpose of the computed fitting coefficients @param mb The transpose of the values to be fitted @return void @see cpl_fit_imagelist_polynomial() The call requires (ijstop - ij) * (np * (2 * nc + 1) + 1) FLOPs. */ /*----------------------------------------------------------------------------*/ static void CPL_TYPE_ADD(cpl_fit_imagelist_residual)(cpl_image * self, cpl_size ij, cpl_size ijstop, const cpl_vector * x_pos, const cpl_vector * xpow, const cpl_matrix * mx, const cpl_matrix * mb) { double err, sq_err; const cpl_size nc = cpl_matrix_get_ncol(mx); const cpl_size np = cpl_vector_get_size(x_pos); /* pself points to 1st element in jj'th row */ CPL_TYPE * pself = CPL_TYPE_ADD(cpl_image_get_data)(self); const double * pp = cpl_vector_get_data_const(x_pos); /* If mindeg == 0 xpow is NULL (since no multiplication is needed) */ const double * pm = xpow != NULL ? cpl_vector_get_data_const(xpow) : NULL; const double * px = cpl_matrix_get_data_const(mx); const double * pb = cpl_matrix_get_data_const(mb); cpl_size i, j, k; for (i=ij; i < ijstop; i++, pb += np, px += nc) { sq_err = 0.0; for (j=0; j < np; j++) { /* Evaluate the polynomial using Horners scheme, see cpl_polynomial_eval_1d() */ k = nc; err = px[--k]; while (k) err = pp[j] * err + px[--k]; /* Multiply by x^mindeg - wheen needed */ /* Substract expected value to compute the residual */ if (pm != NULL) { err = err * pm[j] - pb[j]; } else { err -= pb[j]; } sq_err += err * err; } #ifdef CPL_TYPE_INT_ROUND /* Round off to nearest integer */ pself[i] = CPL_TYPE_INT_ROUND(sq_err/(double)np); #else pself[i] = (CPL_TYPE)(sq_err/(double)np); #endif } cpl_tools_add_flops((cpl_flops)((ijstop - ij) * (np * (2 * nc + 1) + 1))); } #undef CPL_TYPE_ADD cpl-6.4.1/cpldrs/cpl_phys_const.h0000644000460300003120000000547311466733006013720 00000000000000/* $Id: cpl_phys_const.h,v 1.9 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.9 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_PHYS_CONST_H #define CPL_PHYS_CONST_H CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /* Fundamental physical constants from http://physics.nist.gov/constants/ (the above page has been moved, probably to http://physics.nist.gov/cuu/) SI-units are used unless otherwise stated. The constants are listed in numerical order */ /* Planck constant [Js] */ #define CPL_PHYS_H 6.6260693E-34 /* Boltzmann constant [J/K] */ #define CPL_PHYS_K 1.3806505E-23 /* Wien displacement law constant [mK] (meter * Kelvin)*/ #define CPL_PHYS_Wien 2.8977685E-3 /* The speed of light in vacuum [m/s] */ #define CPL_PHYS_C 299792458.0 enum _cpl_unit_ { CPL_UNIT_LESS = 1, /* Dimension-less */ CPL_UNIT_RADIAN = 2, /* [radian] */ CPL_UNIT_LENGTH = 3, /* [m] */ CPL_UNIT_TIME = 5, /* [s] */ CPL_UNIT_PERLENGTH = 7, /* [1/m] */ CPL_UNIT_FREQUENCY = 11, /* [1/s] */ CPL_UNIT_MASS = 13, /* [kg] */ /* Derived quantities */ CPL_UNIT_ACCELERATION /* [m/s^2]*/ = CPL_UNIT_LENGTH * CPL_UNIT_FREQUENCY * CPL_UNIT_FREQUENCY, CPL_UNIT_FORCE /* [N] = [kg * m/s^2]*/ = CPL_UNIT_MASS * CPL_UNIT_ACCELERATION, CPL_UNIT_ENERGY /* [J] = [m * N] */ = CPL_UNIT_LENGTH * CPL_UNIT_FORCE, CPL_UNIT_PHOTONRADIANCE /* [ radian/s/m^3] */ = CPL_UNIT_RADIAN * CPL_UNIT_FREQUENCY * CPL_UNIT_PERLENGTH * CPL_UNIT_PERLENGTH * CPL_UNIT_PERLENGTH, CPL_UNIT_ENERGYRADIANCE /* [J*radian/s/m^3] */ = CPL_UNIT_ENERGY * CPL_UNIT_PHOTONRADIANCE }; typedef enum _cpl_unit_ cpl_unit; CPL_END_DECLS #endif cpl-6.4.1/cpldrs/cpl_fft_body.h0000644000460300003120000003451511752702370013320 00000000000000/* $Id: cpl_fft_body.h,v 1.24 2012-05-10 09:06:00 llundin Exp $ * * This file is part of the ESO cpl package * Copyright (C) 2012 European Southern Observatory * * 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 2 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 FFTNESS 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #define CPL_FFTW_ADD(a) CPL_CONCAT2X(CPL_FFTW, a) #define CPL_TYPE_ADD(a) CPL_CONCAT2X(a, CPL_TYPE) #define CPL_TYPE_ADD_CONST(a) CPL_CONCAT3X(a, CPL_TYPE, const) #define CPL_TYPE_ADD_COMPLEX(a) CPL_CONCAT2X(a, CPL_TYPE_C) #define CPL_TYPE_ADD_COMPLEX_CONST(a) CPL_CONCAT3X(a, CPL_TYPE_C, const) static cpl_error_code CPL_TYPE_ADD(cpl_fft_image)(cpl_image *, const cpl_image *, cpl_fft_mode , unsigned , CPL_FFTW_ADD(plan) *, CPL_FFTW_TYPE **, CPL_FFTW_TYPE **, cpl_boolean) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6,7))) #endif ; /*----------------------------------------------------------------------------*/ /** @internal @brief Perform a FFT operation on an image of a specific type @param self Pre-allocated output image of the given type @param other Input image @param mode CPL_FFT_FORWARD or CPL_FFT_BACKWARD, optionally CPL_FFT_NOSCALE @param rigor FFTW_ESTIMATE, FFTW_MEASURE etc. Transform only w. _ESTIMATE @param pplan NULL, or a pointer to keep the plan @param pbufin A pointer to keep the input buffer @param pbufout A pointer to keep the output buffer @param is_last CPL_TRUE for the last call with the given pplan @return CPL_ERROR_NONE or the corresponding #_cpl_error_code_ @see cpl_fft_image_() @note The precision for both images must be either double or float. When pplan is non-NULL, then the plan is destroyed when is_last is TRUE */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_fft_image)(cpl_image * self, const cpl_image * other, cpl_fft_mode mode, unsigned rigor, CPL_FFTW_ADD(plan) * pplan, CPL_FFTW_TYPE ** pbufin, CPL_FFTW_TYPE ** pbufout, cpl_boolean is_last) { const cpl_type typin = cpl_image_get_type(other); const cpl_type typout = cpl_image_get_type(self); const int nxin = (int)cpl_image_get_size_x(other); const int nyin = (int)cpl_image_get_size_y(other); const int nxout = (int)cpl_image_get_size_x(self); const int nxh = ((mode & CPL_FFT_FORWARD) ? nxin : nxout) / 2 + 1; cpl_error_code error = CPL_ERROR_NONE; /* FIXME: This should be verified during configure and replaced by an assert() */ cpl_ensure_code(sizeof(CPL_TYPE complex) == sizeof(CPL_FFTW_TYPE), CPL_ERROR_UNSUPPORTED_MODE); if (mode & CPL_FFT_FORWARD) { CPL_FFTW_ADD(plan) pforw; CPL_FFTW_TYPE * out_b = (CPL_FFTW_TYPE*) CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(self); CPL_FFTW_TYPE * out_bt; cpl_ensure_code(out_b != NULL, CPL_ERROR_TYPE_MISMATCH); /* Make sure mode contains only the supported flags */ cpl_ensure_code(!(mode & ~(CPL_FFT_FORWARD | CPL_FFT_NOSCALE)), CPL_ERROR_ILLEGAL_INPUT); if (typin & CPL_TYPE_COMPLEX) { CPL_FFTW_TYPE * in_b = (CPL_FFTW_TYPE *) CPL_TYPE_ADD_COMPLEX_CONST(cpl_image_get_data)(other); CPL_FFTW_TYPE * in_bt; size_t alignmask; if (pplan != NULL && *pplan != NULL) { pforw = *pplan; } else { #ifdef _OPENMP #pragma omp critical(cpl_fft_fftw) #endif { /* FIXME: In-place faster (or at least not slower) ? */ *pbufin = CPL_FFTW_ADD(malloc)(nxin * sizeof(CPL_FFTW_TYPE) * nyin); *pbufout = CPL_FFTW_ADD(malloc)(nxin * sizeof(CPL_FFTW_TYPE) * nyin); /* FIXME: If unaligned then drop FFTW_PRESERVE_INPUT */ pforw = CPL_FFTW_ADD(plan_dft_2d)(nyin, nxin, *pbufin, *pbufout, FFTW_FORWARD, rigor | FFTW_PRESERVE_INPUT); } if (pplan != NULL) *pplan = pforw; } alignmask = (size_t)(*pbufin) | (size_t)(*pbufout); in_bt = cpl_fft_aligned((void*)in_b, *pbufin, alignmask); if (in_bt == *pbufin) { memcpy(in_bt, in_b, nxin * sizeof(CPL_FFTW_TYPE) * nyin); } out_bt = in_b == out_b ? *pbufout : cpl_fft_aligned((void*)out_b, *pbufout, alignmask); CPL_FFTW_ADD(execute_dft)(pforw, in_bt, out_bt); if (out_bt == *pbufout) { memcpy(out_b, *pbufout, nxin * sizeof(CPL_FFTW_TYPE) * nyin); } } else { const CPL_TYPE * in_b = CPL_TYPE_ADD_CONST(cpl_image_get_data)(other); CPL_TYPE * in_bt; size_t alignmask; /* For the real-to-complex transform, only the left half of the result is computed. The size of the output image may either match that, or the input buffer */ if (pplan != NULL && *pplan != NULL) { pforw = *pplan; } else { #ifdef _OPENMP #pragma omp critical(cpl_fft_fftw) #endif { *pbufin = CPL_FFTW_ADD(malloc)(nxin * sizeof(CPL_TYPE) * nyin); *pbufout = CPL_FFTW_ADD(malloc)(nxh * sizeof(CPL_FFTW_TYPE) * nyin); /* FIXME: If unaligned then drop FFTW_PRESERVE_INPUT */ pforw = CPL_FFTW_ADD(plan_dft_r2c_2d)(nyin, nxin, (CPL_TYPE*)*pbufin, *pbufout, rigor | FFTW_PRESERVE_INPUT); } if (pplan != NULL) *pplan = pforw; } alignmask = (size_t)(*pbufin) | (size_t)(*pbufout); in_bt = cpl_fft_aligned((void*)in_b, *pbufin, alignmask); if (in_bt == (CPL_TYPE*)*pbufin) { memcpy(in_bt, in_b, nxin * sizeof(CPL_TYPE) * nyin); } out_bt = nxout == nxh ? cpl_fft_aligned((void*)out_b, *pbufout, alignmask) : *pbufout; CPL_FFTW_ADD(execute_dft_r2c)(pforw, in_bt, out_bt); if (nxout != nxh) { /* Need to repack the transformed half */ const CPL_FFTW_TYPE * out_bhj = *pbufout; CPL_FFTW_TYPE * out_bj = out_b; int j; for (j = 0; j < nyin; j++, out_bhj += nxh, out_bj += nxin) { (void)memcpy(out_bj, out_bhj, nxh * sizeof(*out_bj)); } } else if (out_bt == *pbufout) { /* For the real-to-complex transform, only the left half of the transform is done. The output matches that, but is not aligned. */ (void)memcpy(out_b, out_bt, nxh * sizeof(CPL_FFTW_TYPE) * nyin); } } if (pplan == NULL || is_last) { double fl_add = 0.0, fl_mul = 0.0, fl_fma = 0.0; #ifdef _OPENMP #pragma omp critical(cpl_fft_fftw) #endif { CPL_FFTW_ADD(flops)(pforw, &fl_add, &fl_mul, &fl_fma); CPL_FFTW_ADD(destroy_plan)(pforw); CPL_FFTW_ADD(free)(*pbufin); CPL_FFTW_ADD(free)(*pbufout); } cpl_tools_add_flops((cpl_flops)(fl_add + fl_mul + 2.0 * fl_fma)); } } else if (mode & CPL_FFT_BACKWARD) { CPL_FFTW_ADD(plan) pback; const CPL_FFTW_TYPE * in_b = (const CPL_FFTW_TYPE *) CPL_TYPE_ADD_COMPLEX_CONST(cpl_image_get_data)(other); size_t alignmask; /* Make sure mode contains only the supported flags */ cpl_ensure_code(!(mode & ~(CPL_FFT_BACKWARD | CPL_FFT_NOSCALE)), CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(typin & CPL_TYPE_COMPLEX, CPL_ERROR_TYPE_MISMATCH); if (typout & CPL_TYPE_COMPLEX) { CPL_FFTW_TYPE * out_b = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(self); CPL_FFTW_TYPE * out_bt; CPL_FFTW_TYPE * in_bt; if (pplan != NULL && *pplan != NULL) { pback = *pplan; } else { #ifdef _OPENMP #pragma omp critical(cpl_fft_fftw) #endif { /* FIXME: In-place faster (or at least not slower) ? */ *pbufin = CPL_FFTW_ADD(malloc)(nxin * sizeof(CPL_FFTW_TYPE) * nyin); *pbufout = CPL_FFTW_ADD(malloc)(nxin * sizeof(CPL_FFTW_TYPE) * nyin); /* FIXME: If unaligned then drop FFTW_PRESERVE_INPUT */ pback = CPL_FFTW_ADD(plan_dft_2d)(nyin, nxin, *pbufin, *pbufout, FFTW_BACKWARD, FFTW_PRESERVE_INPUT | rigor); } if (pplan != NULL) *pplan = pback; } alignmask = (size_t)(*pbufin) | (size_t)(*pbufout); in_bt = cpl_fft_aligned((void*)in_b, *pbufin, alignmask); if (in_bt == *pbufin) { memcpy(in_bt, in_b, nxin * sizeof(CPL_FFTW_TYPE) * nyin); } out_bt = in_b == out_b ? *pbufout : cpl_fft_aligned((void*)out_b, *pbufout, alignmask); CPL_FFTW_ADD(execute_dft)(pback, in_bt, out_bt); if (out_bt == *pbufout) { memcpy(out_b, *pbufout, nxin * sizeof(CPL_FFTW_TYPE) * nyin); } } else { CPL_TYPE * out_b = CPL_TYPE_ADD(cpl_image_get_data)(self); CPL_TYPE * out_bt; /* FFTW always modifies the input array in the C2R transform, so pbufin is always required here */ if (pplan != NULL && *pplan != NULL) { pback = *pplan; } else { #ifdef _OPENMP #pragma omp critical(cpl_fft_fftw) #endif { *pbufin = CPL_FFTW_ADD(malloc)(nxh * sizeof(CPL_FFTW_TYPE) * nyin); *pbufout = CPL_FFTW_ADD(malloc)(nxout * sizeof(CPL_TYPE) * nyin); pback = CPL_FFTW_ADD(plan_dft_c2r_2d)(nyin, nxout, *pbufin, (CPL_TYPE*)*pbufout, FFTW_DESTROY_INPUT | rigor); } if (pplan != NULL) *pplan = pback; } if (nxin == nxh) { /* For the complex-to-real transform, only the left half of the input is transformed. The input matches that. */ (void)memcpy(*pbufin, in_b, nxh * sizeof(CPL_FFTW_TYPE) * nyin); } else { /* For the complex-to-real transform, only the left half of the input is transformed. It needs to be repacked first */ const CPL_FFTW_TYPE * in_bj = in_b; CPL_FFTW_TYPE * in_bhj = *pbufin; int j; for (j = 0; j < nyin; j++, in_bhj += nxh, in_bj += nxin) { (void)memcpy(in_bhj, in_bj, nxh * sizeof(*in_bhj)); } } alignmask = (size_t)(*pbufin) | (size_t)(*pbufout); out_bt = cpl_fft_aligned((void*)out_b, *pbufout, alignmask); CPL_FFTW_ADD(execute_dft_c2r)(pback, *pbufin, out_bt); if (out_bt == (CPL_TYPE*)*pbufout) { memcpy(out_b, *pbufout, nxout * sizeof(CPL_TYPE) * nyin); } } if (pplan == NULL || is_last) { double fl_add = 0.0, fl_mul = 0.0, fl_fma = 0.0; #ifdef _OPENMP #pragma omp critical(cpl_fft_fftw) #endif { CPL_FFTW_ADD(flops)(pback, &fl_add, &fl_mul, &fl_fma); CPL_FFTW_ADD(destroy_plan)(pback); CPL_FFTW_ADD(free)(*pbufin); CPL_FFTW_ADD(free)(*pbufout); } cpl_tools_add_flops((cpl_flops)(fl_add + fl_mul + 2.0 * fl_fma)); } if (!(mode & CPL_FFT_NOSCALE)) { error = cpl_image_divide_scalar(self, (double)(nxout * nyin)); } } else { error = CPL_ERROR_ILLEGAL_INPUT; } return cpl_error_set_(error); /* Set or propagate error, if any */ } #undef CPL_TYPE_ADD #undef CPL_TYPE_ADD_CONST #undef CPL_TYPE_ADD_COMPLEX #undef CPL_TYPE_ADD_COMPLEX_CONST cpl-6.4.1/cpldrs/cpl_fit.c0000644000460300003120000025511712253611520012275 00000000000000/* $Id: cpl_fit.c,v 1.46 2012-06-15 14:26:56 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-06-15 14:26:56 $ * $Revision: 1.46 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_vector_fit_impl.h" #include "cpl_mask_impl.h" #include "cpl_matrix_impl.h" #include "cpl_polynomial_impl.h" #include "cpl_math_const.h" #include #include /* Needed for memchr() */ #include /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_fit High-level functions for non-linear fitting * * This module provides a routine for non-linear fitting. * * @par Synopsis: * @code * #include "cpl_fit.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /* Used in cpl_fit_imagelist_polynomial_find_block_size() - it only needs to be corrected if it about 10 times too small, or a few times too big */ #ifndef L2_CACHE_BYTES #ifdef CPL_CPU_CACHE #define L2_CACHE_BYTES CPL_CPU_CACHE #else #define L2_CACHE_BYTES 262144 #endif #endif /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static cpl_error_code cpl_fit_imagelist_polynomial_window_(cpl_imagelist *, const cpl_vector *, const cpl_imagelist *, cpl_size, cpl_size, cpl_size, cpl_boolean, cpl_image *); static cpl_error_code cpl_fit_imagelist_polynomial_bpm(cpl_imagelist *, const cpl_mask *, const cpl_vector *, const cpl_imagelist *, cpl_size, cpl_size, cpl_size, cpl_image *); static cpl_error_code cpl_fit_imagelist_polynomial_one(cpl_imagelist *, cpl_polynomial *, double *, double *, cpl_size, cpl_size, const cpl_vector *, const cpl_imagelist *, cpl_size, cpl_size, cpl_size, cpl_image *); static cpl_error_code cpl_fit_imagelist_polynomial_double(cpl_imagelist *, const cpl_matrix *, const cpl_matrix *, const cpl_vector *, const cpl_imagelist *, cpl_size, cpl_size, const cpl_vector *, double, cpl_image *); static cpl_error_code cpl_fit_imagelist_polynomial_float(cpl_imagelist *, const cpl_matrix *, const cpl_matrix *, const cpl_vector *, const cpl_imagelist *, cpl_size, cpl_size, const cpl_vector *, double, cpl_image *); static cpl_error_code cpl_fit_imagelist_polynomial_int(cpl_imagelist *, const cpl_matrix *, const cpl_matrix *, const cpl_vector *, const cpl_imagelist *, cpl_size, cpl_size, const cpl_vector *, double, cpl_image *); static void cpl_fit_imagelist_residual_double(cpl_image *, cpl_size, cpl_size, const cpl_vector *, const cpl_vector *, const cpl_matrix *, const cpl_matrix *); static void cpl_fit_imagelist_residual_float(cpl_image *, cpl_size, cpl_size, const cpl_vector *, const cpl_vector *, const cpl_matrix *, const cpl_matrix *); static void cpl_fit_imagelist_residual_int(cpl_image *, cpl_size, cpl_size, const cpl_vector *, const cpl_vector *, const cpl_matrix *, const cpl_matrix *); static void cpl_fit_imagelist_fill_double(cpl_imagelist *, cpl_size, cpl_size, const cpl_matrix *); static void cpl_fit_imagelist_fill_float(cpl_imagelist *, cpl_size, cpl_size, const cpl_matrix *); static void cpl_fit_imagelist_fill_int(cpl_imagelist *, cpl_size, cpl_size, const cpl_matrix *); static cpl_size cpl_fit_imagelist_polynomial_find_block_size(cpl_size, cpl_size, cpl_boolean, cpl_type, cpl_type, cpl_type); static int bigauss(const double[], const double[], double *) CPL_ATTR_NONNULL; static int bigauss_derivative(const double[], const double[], double[]) CPL_ATTR_NONNULL; /*----------------------------------------------------------------------------- Function code -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Fit a function to a set of data @param x N x D matrix of the positions to fit. Each matrix row is a D-dimensional position. @param sigma_x Uncertainty (one sigma, gaussian errors assumed) assosiated with @em x. Taking into account the uncertainty of the independent variable is currently unsupported, and this parameter must therefore be set to NULL. @param y The N values to fit. @param sigma_y Vector of size N containing the uncertainties of the y-values. If this parameter is NULL, constant uncertainties are assumed. @param a Vector containing M fit parameters. Must contain a guess solution on input and contains the best fit parameters on output. @param ia Array of size M defining which fit parameters participate in the fit (non-zero) and which fit parameters are held constant (zero). At least one element must be non-zero. Alternatively, pass NULL to fit all parameters. @param f Function that evaluates the fit function at the position specified by the first argument (an array of size D) using the fit parameters specified by the second argument (an array of size M). The result must be output using the third parameter, and the function must return zero iff the evaluation succeded. @param dfda Function that evaluates the first order partial derivatives of the fit function with respect to the fit parameters at the position specified by the first argument (an array of size D) using the parameters specified by the second argument (an array of size M). The result must be output using the third parameter (array of size M), and the function must return zero iff the evaluation succeded. @param relative_tolerance The algorithm converges by definition if the relative decrease in chi squared is less than @em tolerance @em tolerance_count times in a row. Recommended default: CPL_FIT_LVMQ_TOLERANCE @param tolerance_count The algorithm converges by definition if the relative decrease in chi squared is less than @em tolerance @em tolerance_count times in a row. Recommended default: CPL_FIT_LVMQ_COUNT @param max_iterations If this number of iterations is reached without convergence, the algorithm diverges, by definition. Recommended default: CPL_FIT_LVMQ_MAXITER @param mse If non-NULL, the mean squared error of the best fit is computed. @param red_chisq If non-NULL, the reduced chi square of the best fit is computed. This requires @em sigma_y to be specified. @param covariance If non-NULL, the formal covariance matrix of the best fit parameters is computed (or NULL on error). On success the diagonal terms of the covariance matrix are guaranteed to be positive. However, terms that involve a constant parameter (as defined by the input array @em ia) are always set to zero. Computation of the covariacne matrix requires @em sigma_y to be specified. @return CPL_ERROR_NONE iff OK. This function makes a minimum chi squared fit of the specified function to the specified data set using a Levenberg-Marquardt algorithm. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer other than @em sigma_x, @em sigma_y, @em mse, @em red_chisq or @em covariance is NULL. - CPL_ERROR_ILLEGAL_INPUT if an input matrix/vector is empty, if @em ia contains only zero values, if any of @em relative_tolerance, @em tolerance_count or max_iterations @em is non-positive, if N <= M and @em red_chisq is non-NULL, if any element of @em sigma_x or @em sigma_y is non-positive, or if evaluation of the fit function or its derivative failed. - CPL_ERROR_INCOMPATIBLE_INPUT if the dimensions of the input vectors/matrices do not match, or if chi square or covariance computation is requested and @em sigma_y is NULL. - CPL_ERROR_ILLEGAL_OUTPUT if memory allocation failed. - CPL_ERROR_CONTINUE if the Levenberg-Marquardt algorithm failed to converge. - CPL_ERROR_SINGULAR_MATRIX if the covariance matrix could not be computed. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_fit_lvmq(const cpl_matrix *x, const cpl_matrix *sigma_x, const cpl_vector *y, const cpl_vector *sigma_y, cpl_vector *a, const int ia[], int (*f)(const double x[], const double a[], double *result), int (*dfda)(const double x[], const double a[], double result[]), double relative_tolerance, int tolerance_count, int max_iterations, double *mse, double *red_chisq, cpl_matrix **covariance) { return cpl_fit_lvmq_(x, sigma_x, y, sigma_y, a, ia, f, dfda, relative_tolerance, tolerance_count, max_iterations, mse, red_chisq, covariance) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Least-squares fit a polynomial to each pixel in a list of images @param x_pos The vector of positions to fit @param values The list of images with values to fit @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @param mindeg The smallest degree with a non-zero coefficient @param maxdeg The polynomial degree of the fit, at least mindeg @param is_symsamp True iff the x_pos values are symmetric around their mean @param pixeltype The (non-complex) pixel-type of the created image list @param fiterror When non-NULL, the error of the fit. Must be non-complex @note values and x_pos must have the same number of elements. @note The created imagelist must be deallocated with cpl_imagelist_delete(). @note x_pos must have at least 1 + (maxdeg - mindeg) distinct values. @return The image list of the fitted polynomial coefficients or NULL on error. @see cpl_polynomial_fit() For each pixel, a polynomial representing the relation value = P(x) is computed where: P(x) = x^{mindeg} * (a_0 + a_1 * x + ... + a_{nc-1} * x^{nc-1}), where mindeg >= 0 and maxdeg >= mindeg, and nc is the number of polynomial coefficients to determine, nc = 1 + (maxdeg - mindeg). The returned image list thus contains nc coefficient images, a_0, a_1, ..., a_{nc-1}. np is the number of sample points, i.e. the number of elements in x_pos and number of images in the input image list. If mindeg is nonzero then is_symsamp is ignored, otherwise is_symsamp may to be set to CPL_TRUE if and only if the values in x_pos are known a-priori to be symmetric around their mean, e.g. (1, 2, 4, 6, 10, 14, 16, 18, 19), but not (1, 2, 4, 6, 10, 14, 16). Setting is_symsamp to CPL_TRUE while mindeg is zero eliminates certain round-off errors. For higher order fitting the fitting problem known as "Runge's phenomenon" is minimized using the socalled "Chebyshev nodes" as sampling points. For Chebyshev nodes is_symsamp can be set to CPL_TRUE. Even though it is not an error, it is hardly useful to use an image of pixel type integer for the fitting error. An image of pixel type float should on the other hand be sufficient for most fitting errors. The call requires the following number of FLOPs, where nz is the number of pixels in any one image in the imagelist: 2 * nz * nc * (nc + np) + np * nc^2 + nc^3/3 + O(nc * (nc + np)). If mindeg is zero an additional nz * nc^2 FLOPs are required. If fiterror is non-NULL an additional 2 * nz * nc * np FLOPs are required. Bad pixels in the input is suported as follows: First all pixels are fitted ignoring any bad pixel maps in the input. If this succeeds then each fit, where bad pixel(s) are involved is redone. During this second pass all input pixels flagged as bad are ignored. For each pixel to be redone, the remaining good samples are passed to cpl_polynomial_fit(). The input is_symsamp is ignored in this second pass. The reduced number of samples may reduce the number of sampling points to equal the number of coefficients to fit. In this case the fit has another meaning (any non-zero residual is due to rounding errors, not a fitting error). If for a given fit bad pixels reduces the number of sampling points to less than the number of coefficients to fit, then as many coefficients are fit as there are sampling points. The higher order coefficients are set to zero and flagged as bad. If a given pixel has no good samples, then the resulting fit will consist of zeroes, all flagged as bad. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input const pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if mindeg is negative or maxdeg is less than mindeg or if llx or lly are smaller than 1 or if urx or ury is smaller than llx and lly respectively. - CPL_ERROR_ACCESS_OUT_OF_RANGE if urx or ury exceed the size of values. - CPL_ERROR_INCOMPATIBLE_INPUT if x_pos and values have different lengths, or if fiterror is non-NULL with a different size than that of values, or if the input images do not all have the same dimensions and pixel type. - CPL_ERROR_DATA_NOT_FOUND if x_pos contains less than nc values. - CPL_ERROR_SINGULAR_MATRIX if x_pos contains less than nc distinct values. - CPL_ERROR_UNSUPPORTED_MODE if the chosen pixel type is not one of CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT. */ /*----------------------------------------------------------------------------*/ cpl_imagelist * cpl_fit_imagelist_polynomial_window(const cpl_vector * x_pos, const cpl_imagelist * values, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size mindeg, cpl_size maxdeg, cpl_boolean is_symsamp, cpl_type pixeltype, cpl_image * fiterror) { cpl_imagelist * self; cpl_mask * redo = NULL; const cpl_image * first = cpl_imagelist_get_const(values, 0); const cpl_size mx = cpl_image_get_size_x(first); const cpl_size my = cpl_image_get_size_y(first); cpl_error_code error = CPL_ERROR_NONE; /* Number of unknowns to determine */ const cpl_size nc = 1 + maxdeg - mindeg; const cpl_size np = cpl_vector_get_size(x_pos); const cpl_size nx = urx - llx + 1; const cpl_size ny = ury - lly + 1; cpl_size i; cpl_ensure(x_pos != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(values != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(mindeg >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(maxdeg >= mindeg, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(np == cpl_imagelist_get_size(values), CPL_ERROR_INCOMPATIBLE_INPUT, NULL); cpl_ensure(cpl_imagelist_is_uniform(values)==0, CPL_ERROR_INCOMPATIBLE_INPUT, NULL); cpl_ensure(pixeltype == CPL_TYPE_DOUBLE || pixeltype == CPL_TYPE_FLOAT || pixeltype == CPL_TYPE_INT, CPL_ERROR_UNSUPPORTED_MODE, NULL); if (fiterror != NULL) { cpl_ensure(cpl_image_get_size_x(fiterror) == nx && cpl_image_get_size_y(fiterror) == ny, CPL_ERROR_INCOMPATIBLE_INPUT, NULL); } cpl_ensure(np >= nc, CPL_ERROR_DATA_NOT_FOUND, NULL); cpl_ensure(llx >= 1 && llx <= urx, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(lly >= 1 && lly <= ury, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(urx <= mx, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); cpl_ensure(ury <= my, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); /* The Hankel matrix may be singular in such a fashion, that the pivot points in its Cholesky decomposition are positive due to rounding errors. To ensure that such singular systems are robustly detected, the number of distinct sampling points is counted. */ cpl_ensure(!cpl_vector_ensure_distinct(x_pos, nc), CPL_ERROR_SINGULAR_MATRIX, NULL); /* Allocate nc images to store the results */ self = cpl_imagelist_new(); for (i=0; i < nc; i++) { cpl_image * image = cpl_image_wrap(nx, ny, pixeltype, cpl_malloc ((size_t)nx * (size_t)ny * cpl_type_get_sizeof(pixeltype))); (void)cpl_imagelist_set(self, image, i); } /* Find the bad input pixels and create a map of bpm-interpolations */ for (i = 0; i < np; i++) { const cpl_image * img = cpl_imagelist_get_const(values, i); const cpl_mask * mask = cpl_image_get_bpm_const(img); if (mask != NULL) { if (redo == NULL) { redo = cpl_mask_extract(mask, llx, lly, urx, ury); } else if (nx == mx && ny == my) { /* The below extraction is not needed */ cpl_mask_or(redo, mask); } else { cpl_mask * window = cpl_mask_extract(mask, llx, lly, urx, ury); cpl_mask_or(redo, window); cpl_mask_delete(window); } } } if (redo == NULL || cpl_mask_get_first_window(redo, 1, 1, nx, ny, CPL_BINARY_0) >= 0) { /* Some (or all) interpolations are free of bad pixels */ error = cpl_fit_imagelist_polynomial_window_(self, x_pos, values, llx, lly, mindeg, is_symsamp, fiterror); } if (!error && redo != NULL && cpl_mask_get_first_window(redo, 1, 1, nx, ny, CPL_BINARY_1) >= 0) { /* Some (or all) interpolations have bad pixels */ error = cpl_fit_imagelist_polynomial_bpm(self, redo, x_pos, values, llx, lly, mindeg, fiterror); } cpl_mask_delete(redo); if (error) { cpl_error_set_where_(); cpl_imagelist_delete(self); self = NULL; } return self; } /*----------------------------------------------------------------------------*/ /** @brief Least-squares fit a polynomial to each pixel in a list of images @param self The polynomiums as images, first has mindeg coefficients @param x_pos The vector of positions to fit @param values The list of images with values to fit @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param mindeg The smallest degree with a non-zero coefficient @param is_symsamp True iff the x_pos values are symmetric around their mean @param fiterror When non-NULL, the error of the fit. Must be non-complex @note values and x_pos must have the same number of elements. @note The created imagelist must be deallocated with cpl_imagelist_delete(). @note x_pos must have at least 1 + (maxdeg - mindeg) distinct values. @return The image list of the fitted polynomial coefficients or NULL on error. @see cpl_fit_imagelist_polynomial_window() @note Ignores bad pixel maps in input */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_fit_imagelist_polynomial_window_(cpl_imagelist * self, const cpl_vector * x_pos, const cpl_imagelist * values, cpl_size llx, cpl_size lly, cpl_size mindeg, cpl_boolean is_symsamp, cpl_image * fiterror) { const cpl_size nc = cpl_imagelist_get_size(self); const cpl_size np = cpl_vector_get_size(x_pos); const cpl_image * first = cpl_imagelist_get_const(values, 0); cpl_matrix * mv; /* The transpose of the Vandermonde matrix, V' */ cpl_matrix * mh; /* Upper triangular part of SPD Hankel matrix, H = V' * V */ const cpl_boolean is_eqzero = is_symsamp && mindeg == 0; const cpl_vector * xhat; cpl_vector * xtmp = NULL; const double * dx; double xmean; cpl_error_code error; int i, j, k; if (mindeg == 0) { /* Transform: xhat = x - mean(x) */ xhat = xtmp = cpl_vector_transform_mean(x_pos, &xmean); } else { xhat = x_pos; xmean = 0.0; } dx = cpl_vector_get_data_const(xhat); /* Create matrices */ mv = cpl_matrix_wrap(nc, np, cpl_malloc((size_t)nc * (size_t)np * sizeof(double))); /* Fill Vandermonde matrix */ for (j=0; j < np; j++) { double f_prod = cpl_tools_ipow(dx[j], (int)mindeg); cpl_matrix_set(mv, 0, j, f_prod); for (k=1; k < nc; k++) { f_prod *= dx[j]; cpl_matrix_set(mv, k, j, f_prod); } } cpl_tools_add_flops( (cpl_flops)(np * ( nc - 1))); cpl_vector_delete(xtmp); /* Form upper triangular part of the matrix of the normal equations, H = V' * V. As in cpl_polynomial_fit_1d_create() this could be done in O(nc * np) flops, rather than 2 * nc^2 * np, but this is negligible for any practical image size and is not done since mv still has to be formed in order to block-optimize the formation of the right-hand-size */ mh = cpl_matrix_product_normal_create(mv); if (is_eqzero) { /* Ensure that the Hankel matrix has zeros on all odd skew diagonals - above the (non-skew) main diagonal */ double * dmh = cpl_matrix_get_data(mh); for (i = 0; i < nc; i++) { for (j = i + 1; j < nc; j += 2) { dmh[nc * i + j] = 0.0; } } } /* Do an in-place Cholesky-decomposition of H into L, such that L * L' = H. This is an O(nc^3) operation, while the subsequent, repeated solve using L is only an O(nc^2) operation. Further, while the Cholesky-decomposition may fail, the subsequent solve is robust. */ error = cpl_matrix_decomp_chol(mh); if (!error) { const cpl_vector * xpow = NULL; xtmp = NULL; /* Should not be able to fail at this point */ if (mindeg == 1) { xpow = x_pos; } if (mindeg > 1) { const double * d_pos = cpl_vector_get_data_const(x_pos); double * ppow = (double*)cpl_malloc((size_t)np * sizeof(*ppow)); xpow = xtmp = cpl_vector_wrap(np, ppow); for (i = 0; i < np; i++) { ppow[i] = cpl_tools_ipow(d_pos[i], (int)mindeg); } } switch (cpl_image_get_type(first)) { case CPL_TYPE_DOUBLE: error = cpl_fit_imagelist_polynomial_double(self, mh, mv, x_pos, values, llx, lly, xpow, -xmean, fiterror); break; case CPL_TYPE_FLOAT: error = cpl_fit_imagelist_polynomial_float(self, mh, mv, x_pos, values, llx, lly, xpow, -xmean, fiterror); break; case CPL_TYPE_INT: error = cpl_fit_imagelist_polynomial_int(self, mh, mv, x_pos, values, llx, lly, xpow, -xmean, fiterror); break; default: error = CPL_ERROR_UNSUPPORTED_MODE; break; } cpl_vector_delete(xtmp); } cpl_matrix_delete(mh); cpl_matrix_delete(mv); return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Least-squares fit a polynomial to each pixel in a list of images @param x_pos The vector of positions to fit @param values The list of images with values to fit @param mindeg The smallest degree with a non-zero coefficient @param maxdeg The polynomial degree of the fit, at least mindeg @param is_symsamp True iff the x_pos values are symmetric around their mean @param pixeltype The pixel-type of the created image list @param fiterror When non-NULL, the error of the fit @note values and x_pos must have the same number of elements. @note The created imagelist must be deallocated with cpl_imagelist_delete(). @note x_pos must have at least 1 + (maxdeg - mindeg) distinct values. @return The image list of the fitted polynomial coefficients or NULL on error. @see cpl_fit_imagelist_polynomial_window() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input const pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if mindeg is negative or maxdeg is less than mindeg. - CPL_ERROR_INCOMPATIBLE_INPUT if x_pos and values have different lengths, or if fiterror is non-NULL with a different size than that of values, or if the input images do not all have the same dimensions and pixel type. - CPL_ERROR_DATA_NOT_FOUND if x_pos contains less than nc values. - CPL_ERROR_SINGULAR_MATRIX if x_pos contains less than nc distinct values. - CPL_ERROR_UNSUPPORTED_MODE if the chosen pixel type is not one of CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT. */ /*----------------------------------------------------------------------------*/ cpl_imagelist * cpl_fit_imagelist_polynomial(const cpl_vector * x_pos, const cpl_imagelist * values, cpl_size mindeg, cpl_size maxdeg, cpl_boolean is_symsamp, cpl_type pixeltype, cpl_image * fiterror) { const cpl_image * first = cpl_imagelist_get_const(values, 0); const cpl_size nx = cpl_image_get_size_x(first); const cpl_size ny = cpl_image_get_size_y(first); cpl_imagelist * self = cpl_fit_imagelist_polynomial_window(x_pos, values, 1, 1, nx, ny, mindeg, maxdeg, is_symsamp, pixeltype, fiterror); /* Propagate error, if any */ if (self == NULL) (void)cpl_error_set_where_(); return self; } /* * Section about bivariate gaussian fitting */ /* * @internal * @brief Evaluate a bivariate gaussian distribution * * @param x The evaluation point * @param a The parameters defining the gaussian * @param result The function value * * @return 0 if okay. * * @note The function always returns 0. Its prototype is given by cpl_fit_lvmq. * @see cpl_fit_lvmq * * This function computes * * @code * a0 + a1 * exp(-0.5/(1-a2*a2){[(x0-a3)/a5]^2 - 2*a2*(x0-a3)/a5*(x1-a4)/a6 * + [(x1-a4)/a6]^2} * @endcode * * where * @code * a0 = background level * a1 = max of gaussian * a2 = correlation xy * a3 = x position of max * a4 = y position of max * a5 = x sigma * a6 = y sigma * @endcode * * This function returns DBL_MAX if a5 = 0 and x0 = a3 or a6 = 0 and x1 = a4. * */ static int bigauss(const double x[], const double a[], double *result) { errno = 0; if (a[5] == 0.0) { *result = x[0] != a[3] ? 0.0 : DBL_MAX; } else if (a[6] == 0.0) { *result = x[1] != a[4] ? 0.0 : DBL_MAX; } else if (1.0 - a[2] * a[2] <= 0.0) { *result = a[1] != 0.0 ? DBL_MAX : 0.0; } else { const double b1 = -0.5 / (1.0 - a[2] * a[2]); const double b2 = (x[0] - a[3]) / a[5]; const double b3 = (x[1] - a[4]) / a[6]; *result = a[0] + a[1] / (CPL_MATH_2PI * a[5] * a[6] * sqrt(1.0 - a[2] * a[2])) * exp(b1 * (b2 * b2 - 2 * a[2] * b2 * b3 + b3 * b3)); if (errno) *result = 0.0; } return 0; } /* * @internal * @brief Evaluate the derivatives of a gaussian * @param x The evaluation point * @param a The parameters defining the gaussian * @param result The derivatives wrt to parameters * * @return 0 if okay. * * @note The function always returns 0. Its prototype is given by cpl_fit_lvmq. * @see cpl_fit_lvmq * * The i-th element of the returned @em result vector contains df/da[i]. * * This function sets the result to zero if a5 or a6 (or both) are zero. * This function sets the result to zero if a2 * a2 exceeds 1. */ static int bigauss_derivative(const double x[], const double a[], double result[]) { errno = 0; if (a[5] != 0.0 && a[6] != 0.0 && 1.0 - a[2] * a[2] >= 0.0) { const double b1 = 1 / (1 - a[2] * a[2]); const double b2 = (x[0] - a[3]) / a[5]; const double b3 = (x[1] - a[4]) / a[6]; const double b0 = b2 * b2 - 2 * a[2] * b2 * b3 + b3 * b3; const double b4 = exp(-0.5 * b1 * b0); const double b5 = sqrt(1.0 - a[2] * a[2]); const double b6 = CPL_MATH_PI * a[5] * a[6] * b5; const double b7 = 0.5 * a[1] * b4 / b6; result[0] = 1.0; result[1] = 0.5 * b4 / b6; result[2] = b7 * b1 * ((b2 * b3 - a[2] * b0 * b1) + a[2]); result[3] = b7 / a[5] * b1 * (b2 - a[2] * b3); result[4] = b7 / a[6] * b1 * (b3 - a[2] * b2); result[5] =-b7 / a[5] * (b1 * b2 * (a[2] * b3 - b2) + 1); result[6] =-b7 / a[6] * (b1 * b3 * (a[2] * b2 - b3) + 1); if (errno) { result[0] = result[1] = result[2] = result[3] = result[4] = result[5] = result[6] = 0.0; } } else { result[0] = result[1] = result[2] = result[3] = result[4] = result[5] = result[6] = 0.0; } return 0; } /** * @brief * Fit a 2D gaussian to image values. * * @param im Input image with data values to fit. * @param im_err Optional input image with statistical errors * associated to data. * @param xpos X position of center of fitting domain. * @param ypos Y position of center of fitting domain. * @param xsize X size of fitting domain. It must be at least 3 pixels. * @param ysize Y size of fitting domain. It must be at least 3 pixels. * @param parameters Preallocated array for returning the values of the * best-fit gaussian parameters (the parametrisation * of the fitted gaussian is described in the main * documentation section, below). This array must be * of type CPL_TYPE_DOUBLE, and it must have exactly * 7 elements. * Generally, when passed to this function, this array * would not be initialised (all elements are "invalid"). * A first-guess for the gaussian parameters is not * mandatory: but it is possible to specify here * a first-guess value for each parameter. First-guess * values can also be specified just for a subset of * parameters. * @param err_params Optional preallocated array for returning the * statistical error associated to each fitted * parameter. This array must be of type CPL_TYPE_DOUBLE, * and it must have exactly 7 elements. This makes * mandatory to specify @em im_err. Note that the * returned values are the square root of the diagonal * elements (variances) of the @em covariance matrix * (see ahead). * @param fit_params Optional array, used for flagging the parameters to * freeze. This array must be of type CPL_TYPE_INT, and * it must have exactly 7 elements. If an array element * is set to 0, the corresponding parameter will be * frozen. Any other value (including an "invalid" * array element) would indicate a free parameter. * If a parameter is frozen, a first-guess value * @em must be specified at the corresponding element * of the @em parameters array. If no array is specified * here (NULL pointer), all parameters are free. * @param rms If not NULL, returned standard deviation of fit * residuals. * @param red_chisq If not NULL, returned reduced chi-squared of fit. * This makes mandatory to specify @em im_err. * @param covariance If not NULL, a newly allocated covariance matrix * will be returned. This makes mandatory to specify * @em im_err. On error it is not modified. * @param major If not NULL, returned semi-major axis of ellipse * at 1-sigma. * @param minor If not NULL, returned semi-minor axis of ellipse * at 1-sigma. * @param angle If not NULL, returned angle between X axis and * major axis of ellipse, counted counterclockwise * (radians). * @param phys_cov If not NULL, a newly allocated 3x3 covariance matrix * for the derived physical parameters @em major, * @em minor, and @em angle, will be returned. This * makes mandatory to specify @em im_err. On error * it is not modified. * * @return CPL_ERROR_NONE on successful fit. * * This function fits a 2d gaussian to pixel values within a specified * region by minimizing \f$\chi^2\f$ using a Levenberg-Marquardt algorithm. * The gaussian model adopted here is based on the well-known cartesian form * * \f[ * z = B + \frac{A}{2 \pi \sigma_x \sigma_y \sqrt{1-\rho^2}} * \exp\left({-\frac{1}{2\left(1-\rho^2\right)} * \left(\left(\frac{x - \mu_x}{\sigma_x}\right)^2 * -2\rho\left(\frac{x - \mu_x}{\sigma_x}\right) * \left(\frac{y - \mu_y}{\sigma_y}\right) * + \left(\frac{y - \mu_y}{\sigma_y}\right)^2\right)}\right) * \f] * * where \f$B\f$ is a background level and \f$A\f$ the volume of the * gaussian (they both can be negative!), making 7 parameters altogether. * Conventionally the parameters are indexed from 0 to 6 in the elements * of the arrays @em parameters, @em err_params, @em fit_params, and of * the 7x7 @em covariance matrix: * * \f{eqnarray*}{ * \mathrm{parameters[0]} &=& B \\ * \mathrm{parameters[1]} &=& A \\ * \mathrm{parameters[2]} &=& \rho \\ * \mathrm{parameters[3]} &=& \mu_x \\ * \mathrm{parameters[4]} &=& \mu_y \\ * \mathrm{parameters[5]} &=& \sigma_x \\ * \mathrm{parameters[6]} &=& \sigma_y * \f} * * The semi-axes \f$a, b\f$ and the orientation \f$\theta\f$ of the * ellipse at 1-sigma level are finally derived from the fitting * parameters as: * \f{eqnarray*}{ * \theta &=& \frac{1}{2} \arctan \left(2 \rho \frac{\sigma_x \sigma_y} * {\sigma_x^2 - \sigma_y^2}\right) \\ * a &=& \sigma_x \sigma_y \sqrt{2(1-\rho^2) \frac{\cos 2\theta} * {\left(\sigma_x^2 + \sigma_y^2\right) \cos 2\theta * + \sigma_y^2 - \sigma_x^2}} \\ * b &=& \sigma_x \sigma_y \sqrt{2(1-\rho^2) \frac{\cos 2\theta} * {\left(\sigma_x^2 + \sigma_y^2\right) \cos 2\theta * - \sigma_y^2 + \sigma_x^2}} * \f} * * Note that \f$\theta\f$ is counted counterclockwise starting from the * positive direction of the \f$x\f$ axis, ranging bewteen \f$-\pi/2\f$ and * \f$+\pi/2\f$ radians. * * If the correlation \f$\rho = 0\f$ and \f$\sigma_x \geq \sigma_y\f$ * (within uncertainties) the ellipse is either a circle or its major axis * is aligned with the \f$x\f$ axis, so it is conventionally set * * \f{eqnarray*}{ * \theta &=& 0 \\ * a &=& \sigma_x \\ * b &=& \sigma_y * \f} * * If the correlation \f$\rho = 0\f$ and \f$\sigma_x < \sigma_y\f$ * (within uncertainties) the major axis of the ellipse * is aligned with the \f$y\f$ axis, so it is conventionally set * * \f{eqnarray*}{ * \theta &=& \frac{\pi}{2} \\ * a &=& \sigma_y \\ * b &=& \sigma_x * \f} * * If requested, the 3x3 covariance matrix G associated to the * derived physical quantities is also computed, applying the usual * \f[ * \mathrm{G} = \mathrm{J} \mathrm{C} \mathrm{J}^\mathrm{T} * \f] * where J is the Jacobian of the transformation * \f$ * (B, A, \rho, \mu_x, \mu_y, \sigma_x, \sigma_y) \rightarrow (\theta, a, b) * \f$ * and C is the 7x7 matrix of the gaussian parameters. */ cpl_error_code cpl_fit_image_gaussian(const cpl_image *im, const cpl_image *im_err, cpl_size xpos, cpl_size ypos, cpl_size xsize, cpl_size ysize, cpl_array *parameters, cpl_array *err_params, const cpl_array *fit_params, double *rms, double *red_chisq, cpl_matrix **covariance, double *major, double *minor, double *angle, cpl_matrix **phys_cov) { const cpl_size mx = cpl_image_get_size_x(im); const cpl_size my = cpl_image_get_size_y(im); /* * Extraction box */ const cpl_size llx = CX_MAX(xpos - xsize/2, 1); const cpl_size lly = CX_MAX(ypos - ysize/2, 1); const cpl_size urx = CX_MIN(xpos + xsize/2, mx); const cpl_size ury = CX_MIN(ypos + ysize/2, my); const cpl_size nx = urx - llx + 1; const cpl_size ny = ury - lly + 1; int ia[] = {1, 1, 1, 1, 1, 1, 1}; double background; double amplitude; double normalisation; double correlation; double xcen, ycen; double xsigma, ysigma; cpl_size ixcen, iycen; cpl_size nrow; int i, j, row; int invalid; cpl_image *ubox = NULL; const cpl_image *box = NULL; const cpl_image *ebox = NULL; cpl_image *fbox = NULL; cpl_vector *a = NULL; cpl_vector *values = NULL; cpl_vector *dvalues = NULL; cpl_matrix *positions = NULL; cpl_matrix *own_cov = NULL; cpl_errorstate prestate = cpl_errorstate_get(); cpl_error_code status = CPL_ERROR_NONE; /* * Always reset physical parameters */ if (major ) *major = 0.0; if (minor ) *minor = 0.0; if (angle ) *angle = 0.0; /* * Check input */ if (im == NULL) return cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "Missing input data image."); if (xpos < 1 || ypos < 1 || xpos > mx || ypos > my || xsize > mx || ysize > my) return cpl_error_set_message_(CPL_ERROR_ACCESS_OUT_OF_RANGE, "Fitting box extends beyond image."); if (xsize < 3 || ysize < 3) return cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Fitting box is too small."); if (im_err) if (cpl_image_get_size_x(im_err) != mx || cpl_image_get_size_y(im_err) != my) return cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "Input images must have same size."); if (parameters == NULL) return cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "Missing input parameters array."); if (cpl_array_get_type(parameters) != CPL_TYPE_DOUBLE) return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "Parameters array should be CPL_TYPE_DOUBLE."); if (err_params) if (cpl_array_get_type(err_params) != CPL_TYPE_DOUBLE) return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "Parameters error array should be CPL_TYPE_DOUBLE."); if (fit_params) if (cpl_array_get_type(fit_params) != CPL_TYPE_INT) return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "Parameters error array should be CPL_TYPE_INT."); if (err_params || covariance || red_chisq || phys_cov) if (im_err == NULL) return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "Missing input parameters errors."); switch(cpl_image_get_type(im)) { /* List of legal types, ended by break */ case CPL_TYPE_INT: case CPL_TYPE_FLOAT: case CPL_TYPE_DOUBLE: break; default: return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "Cannot fit a gaussian to %s values", cpl_type_get_name(cpl_image_get_type(im))); } if (im_err && cpl_image_get_type(im) != cpl_image_get_type(im_err)) { return cpl_error_set_message_(CPL_ERROR_TYPE_MISMATCH, "Data and error images must have " "same type, not %s and %s", cpl_type_get_name(cpl_image_get_type(im)), cpl_type_get_name(cpl_image_get_type (im_err))); } /* * Extract box and error box (if present) */ if (llx == 1 && lly == 1 && urx == mx && ury == my) { box = im; } else { box = ubox = cpl_image_extract(im, llx, lly, urx, ury); } if (im_err) { if (box == im) { ebox = im_err; } else { ebox = fbox = cpl_image_extract(im_err, llx, lly, urx, ury); } if (cpl_image_get_min(ebox) <= 0.0) { cpl_image_delete(ubox); cpl_image_delete(fbox); return cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Non-positive errors found in error image."); } } /* * Ensure that frozen parameters have a value (first-guess) */ if (fit_params) { int flag; int count = 0; for (i = 0; i < 7; i++) { flag = cpl_array_get_int(fit_params, i, &invalid); if (invalid || flag) continue; ia[i] = 0; /* Flag it as frozen */ count++; cpl_array_get_double(parameters, i, &invalid); if (invalid) { cpl_image_delete(ubox); cpl_image_delete(fbox); return cpl_error_set_message_( CPL_ERROR_ILLEGAL_INPUT, "Missing frozen value for parameter %d.", i); } } /* * Ensure that not all parameters are frozen */ if (count == 7) { cpl_image_delete(ubox); cpl_image_delete(fbox); return cpl_error_set_message_( CPL_ERROR_ILLEGAL_INPUT, "No free parameters"); } } /* * Determine first-guess for gaussian parameters. Check if * provided by caller - if not build own guesses... * * 0) Background level: if not given taken as median value within * fitting domain. It can be negative... */ background = cpl_array_get_double(parameters, 0, &invalid); if (invalid) background = cpl_image_get_median(box); /* * 1) Normalisation is computer later on, since it depends * on the sigma and the amplitude of the gaussian. Here * is just a quick estimation, to know whether there is * a peak or a hole. If it is flat, leave quickly this place... */ normalisation = (cpl_image_get_mean(box) - background) * (double)(nx * ny); if (fabs(normalisation) < FLT_EPSILON) { /* * Image is flat: return a flat gaussian, with undefined * position of max and sigmas... */ cpl_image_delete(ubox); cpl_image_delete(fbox); cpl_array_set_double (parameters, 0, background); cpl_array_set_double (parameters, 1, 0.0); cpl_array_set_invalid(parameters, 2); cpl_array_set_invalid(parameters, 3); cpl_array_set_invalid(parameters, 4); cpl_array_set_invalid(parameters, 5); cpl_array_set_double (parameters, 6, 0.0); return CPL_ERROR_NONE; } /* * 2) Correlation between x and y (tilted ellipse) */ correlation = cpl_array_get_double(parameters, 2, &invalid); if (invalid) correlation = 0.0; /* * 3) and 4) Position of center. */ if (normalisation > 0.0) { cpl_image_get_maxpos(box, &ixcen, &iycen); amplitude = cpl_image_get_max(box) - background; } else { cpl_image_get_minpos(box, &ixcen, &iycen); amplitude = cpl_image_get_min(box) - background; } xcen = cpl_array_get_double(parameters, 3, &invalid) - (double)(llx - 1); if (invalid) xcen = (double)ixcen; ycen = cpl_array_get_double(parameters, 4, &invalid) - (double)(lly - 1); if (invalid) ycen = (double)iycen; /* * 5) and 6) Sigma: if neither sigx nor sigy are given by the caller * the estimate for both is the distance (in pixel) of one * half-max (min) point from the max (min) point (here * conventionally made along the x direction). Very rough, * of course, but accuracy is not an issue on this phase * - we just need a rough starting value. If only one sig * is given by the caller, the other one is set to the same * value. */ xsigma = cpl_array_get_double(parameters, 5, &invalid); if (invalid) { ysigma = cpl_array_get_double(parameters, 6, &invalid); if (invalid) { int xhalf = 0; const double value = amplitude / 2.0 + background; cpl_boolean found = CPL_FALSE; if (normalisation > 0.0) { for (i = 1; i < nx; i++) { int bad; const double prev = cpl_image_get(box, i, iycen, &bad); const double next = cpl_image_get(box, i + 1, iycen, &bad); if (prev < value && value <= next) { xhalf = i - 1; found = CPL_TRUE; break; } else if (value < prev && next <= value) { xhalf = i + 1; found = CPL_TRUE; break; } } } else { for (i = 1; i < nx; i++) { int bad; const double prev = cpl_image_get(box, i, iycen, &bad); const double next = cpl_image_get(box, i + 1, iycen, &bad); if (value < prev && next <= value) { xhalf = i - 1; found = CPL_TRUE; break; } else if (prev < value && value <= next) { xhalf = i + 1; found = CPL_TRUE; break; } } } if (found) { xsigma = ysigma = fabs(xcen - xhalf); } else { xsigma = (double)xsize; ysigma = (double)ysize; } } else { xsigma = ysigma; } } else { ysigma = cpl_array_get_double(parameters, 6, &invalid); if (invalid) { ysigma = xsigma; } } /* * 1) Normalisation. If not given by the user, it is derived * from the max (min) value of the data distribution. */ normalisation = cpl_array_get_double(parameters, 1, &invalid); if (invalid) { /* * It would be possible to guess the normalisation * (i.e., the volume of the gaussian, i.e. the total * flux of the star) by simply computing the flux excess * above background: * * normalisation = (cpl_image_get_mean(box) - background) * nx * ny; * * However this is not a good first-guess. There is a * correlation between the parameters, which are not * really independent from each others. With our guess * for the sigma, we will choose a normalisation which * would actually make the surface of the gaussian cross * the observed point of max (min). So the first-guess * would be "in touch" with the data, and there would be * higher chance of convergence. */ normalisation = amplitude * CPL_MATH_2PI * xsigma * ysigma; } /* * Now prepare to fit! Whahahahahah! :-D * * 1) Vector with first-guess parameters: */ a = cpl_vector_new(7); cpl_vector_set(a, 0, background); cpl_vector_set(a, 1, normalisation); cpl_vector_set(a, 2, correlation); cpl_vector_set(a, 3, xcen); cpl_vector_set(a, 4, ycen); cpl_vector_set(a, 5, xsigma); cpl_vector_set(a, 6, ysigma); /* * Matrix with image positions and their values */ nrow = nx * ny - cpl_image_count_rejected(box); if (nrow < 7) { /* * Too few values for 7 free parameters! */ cpl_image_delete(ubox); cpl_image_delete(fbox); cpl_vector_delete(a); return cpl_error_set_message_(CPL_ERROR_SINGULAR_MATRIX, "%" CPL_SIZE_FORMAT " < 7 free parameters.", nrow); } positions = cpl_matrix_new(nrow, 2); values = cpl_vector_new(nrow); if (ebox) dvalues = cpl_vector_new(nrow); row = 0; for (j = 0; j < ny; j++) { for (i = 0; i < nx; i++) { int bad; const double value = cpl_image_get(box, i+1, j+1, &bad); if (!bad) { cpl_matrix_set(positions, row, 0, i+1); cpl_matrix_set(positions, row, 1, j+1); cpl_vector_set(values, row, value); if (ebox) { const double evalue = cpl_image_get(ebox, i+1, j+1, &bad); cpl_vector_set(dvalues, row, evalue); } if (!bad) row++; } } } cpl_image_delete(ubox); cpl_image_delete(fbox); /* * The "if" below may look absurd. But we need to compute * a covariance matrix anyway - even if the user didn't request one - * as soon as input errors are available. */ if (dvalues) { if (red_chisq != NULL) *red_chisq = 0.0; status = cpl_fit_lvmq(positions, NULL, values, dvalues, a, ia, bigauss, bigauss_derivative, CPL_FIT_LVMQ_TOLERANCE, CPL_FIT_LVMQ_COUNT, CPL_FIT_LVMQ_MAXITER, rms, red_chisq, &own_cov); } else { status = cpl_fit_lvmq(positions, NULL, values, NULL, a, ia, bigauss, bigauss_derivative, CPL_FIT_LVMQ_TOLERANCE, CPL_FIT_LVMQ_COUNT, CPL_FIT_LVMQ_MAXITER, rms, NULL, NULL); } if (status == CPL_ERROR_SINGULAR_MATRIX || status == CPL_ERROR_CONTINUE) { /* * Betting these two errors are really to be ignored... */ if (phys_cov == NULL || own_cov != NULL) { /* Well, the bet makes sense only in case phys_cov is NULL or own_cov is non-NULL, because otherwise the function will still fail when the NULL-valued own_cov is used. In that case, do not reset, in order to provide a less meaningless error. The guard prevents a reset with the current unit tests on a Darwin 10.7.0. */ status = CPL_ERROR_NONE; cpl_errorstate_set(prestate); } } cpl_matrix_delete(positions); cpl_vector_delete(values); cpl_vector_delete(dvalues); if (status == CPL_ERROR_NONE) { double S_x, S_y, R, theta, A, B; double DS_x, DS_y, DR; double S_x_plus, S_y_plus, R_plus; double theta_plus, A_plus, B_plus; if (rms) *rms = sqrt(*rms); /* * The LM algorithm converged. The computation of the covariance * matrix might have failed. All the above errors must be ignored * because of ticket DFS06126. */ /* * We could at least check whether the result makes sense at all... * but this would require the -std=c99 option. So we skip it. if (isfinite(cpl_vector_get(a, 0)) && isfinite(cpl_vector_get(a, 1)) && isfinite(cpl_vector_get(a, 2)) && isfinite(cpl_vector_get(a, 3)) && isfinite(cpl_vector_get(a, 4)) && isfinite(cpl_vector_get(a, 5)) && isfinite(cpl_vector_get(a, 6))) { End of check section, requiring -std=c99 */ /* * Save best fit parameters: center of gaussian is * converted to input image coordinates, evaluations * of sigmas are forced positive (they might be both * negative - it would generate the same gaussian). */ cpl_array_set_double(parameters, 0, cpl_vector_get(a, 0)); cpl_array_set_double(parameters, 1, cpl_vector_get(a, 1)); cpl_array_set_double(parameters, 2, cpl_vector_get(a, 2)); cpl_array_set_double(parameters, 3, cpl_vector_get(a, 3) + (double)(llx - 1)); cpl_array_set_double(parameters, 4, cpl_vector_get(a, 4) + (double)(lly - 1)); cpl_array_set_double(parameters, 5, fabs(cpl_vector_get(a, 5))); cpl_array_set_double(parameters, 6, fabs(cpl_vector_get(a, 6))); /* * Get from the diagonal of the covariance matrix the variances * and fill the error array: */ if (err_params && own_cov) { for (i = 0; i < 7; i++) { if (ia[i]) cpl_array_set_double(err_params, i, sqrt(cpl_matrix_get(own_cov, i, i))); } } /* * Obtain semiaxes and rotation angle of ellipse at 1-sigma level */ S_x = cpl_array_get_double(parameters, 5, NULL); S_y = cpl_array_get_double(parameters, 6, NULL); R = cpl_array_get_double(parameters, 2, NULL); if (err_params) { DS_x = cpl_array_get_double(err_params, 5, NULL); DS_y = cpl_array_get_double(err_params, 6, NULL); DR = cpl_array_get_double(err_params, 2, NULL); } else { DS_x = 0.0; DS_y = 0.0; DR = 0.0; } if (fabs(R) <= DR) { if (S_x - S_y >= - sqrt(DS_x * DS_x + DS_y * DS_y)) { /* * Circular distribution, or elongated along x axis * (within known uncertainties). */ theta = 0.0; A = S_x; B = S_y; } else { /* * Distribution elongated along y axis (within known * uncertainties). */ theta = CPL_MATH_PI_2; A = S_y; B = S_x; } } else { theta = 0.5 * atan2(2 * R, (S_x * S_x - S_y * S_y)/ S_x / S_y); A = S_x * S_y * sqrt(2 * (1 - R * R) * cos(2 * theta) / ((S_x * S_x + S_y * S_y) * cos(2 * theta) + S_y * S_y - S_x * S_x)); B = S_x * S_y * sqrt(2 * (1 - R * R) * cos(2 * theta) / ((S_x * S_x + S_y * S_y) * cos(2 * theta) - S_y * S_y + S_x * S_x)); } if (angle) *angle = theta; if (major) *major = A; if (minor) *minor = B; if (phys_cov) { /* * Compute the 3x3 covariance matrix G for the derived * quantities theta, A and B: * * G = J C t(J) * * where C is the 7x7 covariance matrix of the best fit * parameters (p0, p1, p2, p3, p4, p5, p6), J is the 3x7 * Jacobian of the transformation (p#) -> (theta, A, B), * and t(J) is its transpose. The Jacobian is computed * numerically when the analytical approach is impervious. */ cpl_matrix *jacobian = cpl_matrix_new(3, 7); /* * First row: derivatives of theta. */ cpl_matrix_set(jacobian, 0, 0, 0.0); /* d(theta)/d(p0) */ cpl_matrix_set(jacobian, 0, 1, 0.0); /* d(theta)/d(p1) */ R_plus = R + DR; S_x_plus = S_x + DS_x; S_y_plus = S_y + DS_y; if (fabs(R_plus) <= DR) { if (S_x - S_y >= - sqrt(DS_x * DS_x + DS_y * DS_y)) { theta_plus = 0.0; } else { theta_plus = CPL_MATH_PI_2; } } else { theta_plus = 0.5 * atan2(2 * R_plus, (S_x * S_x - S_y * S_y)/ S_x / S_y); } if (DR == 0.0) cpl_matrix_set(jacobian, 0, 2, 0.0); else cpl_matrix_set(jacobian, 0, 2, (theta_plus-theta) / DR); /* d(theta)/d(p2) */ cpl_matrix_set(jacobian, 0, 3, 0.0); /* d(theta)/d(p3) */ cpl_matrix_set(jacobian, 0, 4, 0.0); /* d(theta)/d(p4) */ if (fabs(R) <= DR) { if (S_x_plus - S_y >= - sqrt(DS_x * DS_x + DS_y * DS_y)) { theta_plus = 0.0; } else { theta_plus = CPL_MATH_PI_2; } } else { theta_plus = 0.5 * atan2(2 * R, (S_x_plus * S_x_plus - S_y * S_y) / S_x_plus / S_y); } if (DS_x == 0.0) cpl_matrix_set(jacobian, 0, 5, 0.0); else cpl_matrix_set(jacobian, 0, 5, (theta_plus-theta) / DS_x); /* d(theta)/d(p5) */ if (fabs(R) <= DR) { if (S_x - S_y_plus >= - sqrt(DS_x * DS_x + DS_y * DS_y)) { theta_plus = 0.0; } else { theta_plus = CPL_MATH_PI_2; } } else { theta_plus = 0.5 * atan2(2 * R, (S_x * S_x - S_y_plus * S_y_plus) / S_x / S_y_plus); } if (DS_y == 0.0) cpl_matrix_set(jacobian, 0, 6, 0.0); else cpl_matrix_set(jacobian, 0, 6, (theta_plus-theta) / DS_y); /* d(theta)/d(p6) */ /* * Second row: derivatives of A. */ cpl_matrix_set(jacobian, 1, 0, 0.0); /* d(A)/d(p0) */ cpl_matrix_set(jacobian, 1, 1, 0.0); /* d(A)/d(p1) */ if (fabs(R_plus) <= DR) { if (S_x - S_y >= - sqrt(DS_x * DS_x + DS_y * DS_y)) { A_plus = S_x; } else { A_plus = S_y; } } else { A_plus = S_x * S_y * sqrt(2 * (1 - R_plus * R_plus) * cos(2 * theta) / ((S_x * S_x + S_y * S_y) * cos(2 * theta) + S_y * S_y - S_x * S_x)); } if (DR == 0.0) cpl_matrix_set(jacobian, 1, 2, 0.0); else cpl_matrix_set(jacobian, 1, 2, (A_plus-A) / DR); /* d(A)/d(p2) */ cpl_matrix_set(jacobian, 1, 3, 0.0); /* d(A)/d(p3) */ cpl_matrix_set(jacobian, 1, 4, 0.0); /* d(A)/d(p4) */ if (fabs(R) <= DR) { if (S_x_plus - S_y >= - sqrt(DS_x * DS_x + DS_y * DS_y)) { A_plus = S_x_plus; } else { A_plus = S_y; } } else { A = S_x_plus * S_y * sqrt(2 * (1 - R * R) * cos(2 * theta) / ((S_x_plus * S_x_plus + S_y * S_y) * cos(2 * theta) + S_y * S_y - S_x_plus * S_x_plus)); } if (DS_x == 0.0) cpl_matrix_set(jacobian, 1, 5, 0.0); else cpl_matrix_set(jacobian, 1, 5, (A_plus-A) / DS_x); /* d(A)/d(p5) */ if (fabs(R) <= DR) { if (S_x - S_y_plus >= - sqrt(DS_x * DS_x + DS_y * DS_y)) { A_plus = S_x; } else { A_plus = S_y_plus; } } else { A = S_x * S_y_plus * sqrt(2 * (1 - R * R) * cos(2 * theta) / ((S_x * S_x + S_y_plus * S_y_plus) * cos(2 * theta) + S_y_plus * S_y_plus - S_x * S_x)); } if (DS_y == 0.0) cpl_matrix_set(jacobian, 1, 6, 0.0); else cpl_matrix_set(jacobian, 1, 6, (A_plus-A) / DS_y); /* d(A)/d(p6) */ /* * Third row: derivatives of B. */ cpl_matrix_set(jacobian, 2, 0, 0.0); /* d(B)/d(p0) */ cpl_matrix_set(jacobian, 2, 1, 0.0); /* d(B)/d(p1) */ if (fabs(R_plus) <= DR) { if (S_x - S_y >= - sqrt(DS_x * DS_x + DS_y * DS_y)) { B_plus = S_y; } else { B_plus = S_x; } } else { B_plus = S_x * S_y * sqrt(2 * (1 - R_plus * R_plus) * cos(2 * theta) / ((S_x * S_x + S_y * S_y) * cos(2 * theta) - S_y * S_y + S_x * S_x)); } if (DR == 0.0) cpl_matrix_set(jacobian, 2, 2, 0.0); else cpl_matrix_set(jacobian, 2, 2, (B_plus-B) / DR); /* d(B)/d(p2) */ cpl_matrix_set(jacobian, 2, 3, 0.0); /* d(B)/d(p3) */ cpl_matrix_set(jacobian, 2, 4, 0.0); /* d(B)/d(p4) */ if (fabs(R) <= DR) { if (S_x_plus - S_y >= - sqrt(DS_x * DS_x + DS_y * DS_y)) { B_plus = S_y; } else { B_plus = S_x_plus; } } else { B = S_x_plus * S_y * sqrt(2 * (1 - R * R) * cos(2 * theta) / ((S_x_plus * S_x_plus + S_y * S_y) * cos(2 * theta) - S_y * S_y + S_x_plus * S_x_plus)); } if (DS_x == 0.0) cpl_matrix_set(jacobian, 2, 5, 0.0); else cpl_matrix_set(jacobian, 2, 5, (B_plus-B) / DS_x); /* d(B)/d(p5) */ if (fabs(R) <= DR) { if (S_x - S_y_plus >= - sqrt(DS_x * DS_x + DS_y * DS_y)) { B_plus = S_y_plus; } else { B_plus = S_x; } } else { B = S_x * S_y_plus * sqrt(2 * (1 - R * R) * cos(2 * theta) / ((S_x * S_x + S_y_plus * S_y_plus) * cos(2 * theta) - S_y_plus * S_y_plus + S_x * S_x)); } if (DS_y == 0.0) cpl_matrix_set(jacobian, 2, 6, 0.0); else cpl_matrix_set(jacobian, 2, 6, (B_plus-B) / DS_y); /* d(B)/d(p6) */ /* * The jacobian is complete, now transpose it and * derive the covariance matrix for theta, A, and B: * C_{ph} = J * C * J' */ *phys_cov = cpl_matrix_new(3, 3); cpl_matrix_product_bilinear(*phys_cov, own_cov, jacobian); cpl_matrix_delete(jacobian); } /* This closing-block bracket is the one related to the isfinite() * check, which would require -std=c99. } */ } cpl_vector_delete(a); /* * Note that, until CPL_ERROR_CONTINUE is ignored, the following * condition will never be true. */ if (status) { /* * The LM algorithm did not converge, or it converged to * a non-sensical result. * In this case the covariance matrix will not make sense * so delete it */ cpl_matrix_delete(own_cov); return cpl_error_set_where_(); } if (covariance) { *covariance = own_cov; } else { cpl_matrix_delete(own_cov); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Evaluate the Gaussian in a 2D-point @param self The seven Gaussian parameters @param x The X-coordinate to evaluate @param y The Y-coordinate to evaluate @return The gaussian value or zero on error @see cpl_fit_image_gaussian() @note The function should not be able to fail if the parameters come from a succesful call to cpl_fit_image_gaussian() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if a pointer is NULL. - CPL_ERROR_TYPE_MISMATCH if the array is not of type double - CPL_ERROR_ILLEGAL_INPUT if the array has a length different from 7 - CPL_ERROR_ILLEGAL_OUTPUT if the (absolute value of the) radius exceeds 1 - CPL_ERROR_DIVISION_BY_ZERO if a sigma is 0, or the radius is 1 */ /*----------------------------------------------------------------------------*/ double cpl_gaussian_eval_2d(const cpl_array * self, double x, double y) { cpl_errorstate prestate = cpl_errorstate_get(); const double B = cpl_array_get_double(self, 0, NULL); const double A = cpl_array_get_double(self, 1, NULL); const double R = cpl_array_get_double(self, 2, NULL); const double M_x = cpl_array_get_double(self, 3, NULL); const double M_y = cpl_array_get_double(self, 4, NULL); const double S_x = cpl_array_get_double(self, 5, NULL); const double S_y = cpl_array_get_double(self, 6, NULL); double value = 0.0; if (!cpl_errorstate_is_equal(prestate)) { (void)cpl_error_set_where_(); } else if (cpl_array_get_size(self) != 7) { (void)cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } else if (fabs(R) < 1.0 && S_x != 0.0 && S_y != 0.0) { const double x_n = (x - M_x) / S_x; const double y_n = (y - M_y) / S_y; value = B + A / (CPL_MATH_2PI * S_x * S_y * sqrt(1 - R * R)) * exp(-0.5 / (1 - R * R) * ( x_n * x_n + y_n * y_n - 2.0 * R * x_n * y_n)); } else if (fabs(R) > 1.0) { (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_OUTPUT, "fabs(R=%g) > 1", R); } else { (void)cpl_error_set_message_(CPL_ERROR_DIVISION_BY_ZERO, "R=%g. Sigma=(%g, %g)", R, S_x, S_y); } return value; } /**@}*/ /*----------------------------------------------------------------------------*/ /** @brief Determine the number of pixels that can be processed within the L2 @param np The number of samplint points @param nc The number of coefficients to determine @param ip The pixel-type of the input image list @param op The pixel-type of the output image list @param ep The pixel-type of the fitting error @param do_err CPL_TRUE iff fiterror is to be computed @return The number of pixels, or 1 if the cache is too small The speed of cpl_fit_imagelist_polynomial() is only reduced significantly if the estimated size of the L2-cache is off by about an order of magnitude or more, especially if the actual cache size is much smaller than assumed here. */ /*----------------------------------------------------------------------------*/ static cpl_size cpl_fit_imagelist_polynomial_find_block_size(cpl_size np, cpl_size nc, cpl_boolean do_err, cpl_type ip, cpl_type op, cpl_type ep) { cpl_size blocksize; /* The storage [bytes] needed for mv and mh */ cpl_size c0 = (nc * nc + nc * np) * (cpl_size)sizeof(double); /* Storage per pixel needed for mx, mb and the input and output images */ cpl_size c1 = np * (cpl_size)cpl_type_get_sizeof(ip) + nc * (cpl_size)cpl_type_get_sizeof(op) + (nc + np) * (cpl_size)sizeof(double); if (do_err) { /* The storage [bytes] needed for xpos and xpow */ c0 += (2 * np) * (cpl_size)sizeof(double); /* Storage per pixel needed for fitting error */ c1 += (cpl_size)cpl_type_get_sizeof(ep); } /* In principle the number of pixels that can be processed within the L2 cache would be (L2_CACHE_BYTES - c0) / c1. Apparently, the effective size of the cache is observed to be about four times smaller */ blocksize = ((L2_CACHE_BYTES)/4 - 10 * c0 - 1024) / c1; return blocksize > 0 ? blocksize : 1; } /*----------------------------------------------------------------------------*/ /** @brief Least-squares fit a polynomial to each pixel in a list of images - bpm @param self The polynomiums as images, first has mindeg coefficients @param redo The map of pixels to redo, has same dimension as self @param x_pos The vector of positions to fit @param values The list of images with values to fit @param llx Lower left x coordinate @param lly Lower left y coordinate @param mindeg The smallest degree with a non-zero coefficient @param fiterror When non-NULL, the error of the fit @note values and mv must have the same number of elements. @return CPL_ERROR_NONE or the relevant CPL error code on error @see cpl_fit_imagelist_polynomial_window() */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_fit_imagelist_polynomial_bpm(cpl_imagelist * self, const cpl_mask * redo, const cpl_vector * x_pos, const cpl_imagelist * values, cpl_size llx, cpl_size lly, cpl_size mindeg, cpl_image * fiterror) { const cpl_image * first = cpl_imagelist_get_const(self, 0); const cpl_size nx = cpl_image_get_size_x(first); const cpl_size ny = cpl_image_get_size_y(first); const cpl_size np = cpl_imagelist_get_size(values); cpl_error_code error = CPL_ERROR_NONE; const cpl_binary * bpm = cpl_mask_get_data_const(redo); const cpl_binary * found = bpm - 1; /* Prepare iteration */ cpl_size todo = nx * ny; /* Number of pixels to search */ cpl_polynomial * fit1d = cpl_polynomial_new(1); double * xgood = cpl_malloc((size_t)np * sizeof(*xgood)); double * ygood = cpl_malloc((size_t)np * sizeof(*ygood)); while (!error && (found = memchr(found + 1, CPL_BINARY_1, (size_t)todo * sizeof(*bpm)))) { /* Found an interpolation to redo */ const cpl_size ij = found - bpm; const cpl_size j = ij / nx; const cpl_size i = ij - j * nx; error = cpl_fit_imagelist_polynomial_one(self, fit1d, xgood, ygood, i, j, x_pos, values, llx, lly, mindeg, fiterror); /* Update number of pixels to search. Can never become negative */ todo = nx * ny - ij - 1; /* This is invariant (true before and for each loop iteration) */ /* assert( found + todo + 1 == bpm + nx * ny); */ } cpl_polynomial_delete(fit1d); cpl_free(xgood); cpl_free(ygood); /* Propagate error, if any */ return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Least-squares fit a polynomial to one pixel in a list of images - bpm @param self The polynomiums as images, first has mindeg coefficients @param fit1d Temporary 1D-polynomial used internally @param xgood Temporary array for the usable sampling points @param ygood Temporary array for the usable values @param i The X-position (0 for first) of the pixel to (re)interpolate @param j The Y-position (0 for first) of the pixel to (re)interpolate @param mv The Vandermonde matrix of the sample positions @param values The list of images with values to fit @param llx Lower left x coordinate @param lly Lower left y coordinate @param mindeg The smallest degree with a non-zero coefficient @param fiterror When non-NULL, the error of the fit @note values and mv must have the same number of elements. @return CPL_ERROR_NONE or the relevant CPL error code on error @see cpl_fit_imagelist_polynomial_window() */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_fit_imagelist_polynomial_one(cpl_imagelist * self, cpl_polynomial * fit1d, double * xgood, double * ygood, cpl_size i, cpl_size j, const cpl_vector * x_pos, const cpl_imagelist * values, cpl_size llx, cpl_size lly, cpl_size mindeg, cpl_image * fiterror) { const cpl_image * first = cpl_imagelist_get_const(self, 0); const cpl_size nx = cpl_image_get_size_x(first); const cpl_size ny = cpl_image_get_size_y(first); const cpl_size np = cpl_imagelist_get_size(values); const cpl_size nc = cpl_imagelist_get_size(self); const int imindeg = (int)mindeg; cpl_size k; cpl_error_code error = CPL_ERROR_NONE; cpl_size igood = 0; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(x_pos != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(values != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(llx > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(lly > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(mindeg >= 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code((cpl_size)imindeg == mindeg, CPL_ERROR_ILLEGAL_INPUT); if (fiterror != NULL) { cpl_ensure_code(cpl_image_get_size_x(fiterror) == nx && cpl_image_get_size_y(fiterror) == ny, CPL_ERROR_INCOMPATIBLE_INPUT); } for (k = 0; k < np; k++) { const cpl_image * img = cpl_imagelist_get_const(values, k); int is_rejected = 0; const double value = cpl_image_get(img, llx + i, lly + j, &is_rejected); if (!is_rejected) { xgood[igood] = cpl_vector_get(x_pos, k); ygood[igood] = value; igood++; } } if (igood == 0) { /* No samples available for this pixel */ /* Bad pixels are set to zero. */ for (k = 0; k < nc; k++) { cpl_image * img = cpl_imagelist_get(self, k); cpl_image_set (img, 1 + i, 1 + j, 0.0); cpl_image_reject(img, 1 + i, 1 + j); } if (fiterror != NULL) { cpl_image_set(fiterror, 1 + i, 1 + j, 0.0); } } else { cpl_vector * vxgood = cpl_vector_wrap(igood, xgood); cpl_vector * vygood = cpl_vector_wrap(igood, ygood); cpl_vector * vxcopy = cpl_vector_duplicate(vxgood); /* If there is a shortage of usable samples the number of coefficients to fit is reduced to the number of distinct sample positions */ cpl_size ndistinct; const cpl_error_code err2 = cpl_vector_count_distinct(vxcopy, &ndistinct); const cpl_size ncfit = CX_MIN(nc, ndistinct); const cpl_size degree = ncfit + imindeg - 1; /* Do error estimate only if the system is overdetermined */ const cpl_boolean do_err = fiterror != NULL && (igood > nc); double mse = 0.0; /* assert(igood < np); */ error = err2 ? err2 : cpl_polynomial_fit_1d(fit1d, vxgood, vygood, imindeg, degree, CPL_FALSE, do_err ? &mse : NULL); cpl_vector_delete(vxcopy); (void)cpl_vector_unwrap(vxgood); (void)cpl_vector_unwrap(vygood); for (k = 0; k < ncfit; k++) { cpl_image * img = cpl_imagelist_get(self, k); const cpl_size kk = k + mindeg; const double value = cpl_polynomial_get_coeff(fit1d, &kk); cpl_image_set(img, 1 + i, 1 + j, cpl_image_get_type(img) == CPL_TYPE_INT ? floor(0.5 + value) : value); } /* Higher order terms that could not be fitted are rejected, and set to zero. The zero-value(s) means that the lower-degree polynomial is still usable */ for (; k < nc; k++) { cpl_image * img = cpl_imagelist_get(self, k); cpl_image_set (img, 1 + i, 1 + j, 0.0); cpl_image_reject(img, 1 + i, 1 + j); } if (fiterror != NULL) { /* In the non-bpm case, the error is set to zero for a non-overdetermined system. */ cpl_image_set(fiterror, 1 + i, 1 + j, cpl_image_get_type(fiterror) == CPL_TYPE_INT ? floor(0.5 + mse) : mse); } } return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /* Define the C-type dependent functions */ /* These two macros are needed for support of the different pixel types */ #define CONCAT(a,b) a ## _ ## b #define CONCAT2X(a,b) CONCAT(a,b) #define CONCAT3X(a,b,c) CONCAT2X(CONCAT2X(a,b),c) #define CPL_TYPE double #include "cpl_fit_body.h" #undef CPL_TYPE #define CPL_TYPE float #include "cpl_fit_body.h" #undef CPL_TYPE #define CPL_TYPE_INT_ROUND(A) ((int)floor(0.5 + (A))) #define CPL_TYPE int #include "cpl_fit_body.h" #undef CPL_TYPE #undef CPL_TYPE_INT_ROUND cpl-6.4.1/cpldrs/cpl_photom.h0000644000460300003120000000340511611772464013031 00000000000000/* $Id: cpl_photom.h,v 1.4 2011-07-21 09:45:24 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-21 09:45:24 $ * $Revision: 1.4 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_PHOTOM_H #define CPL_PHOTOM_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include "cpl_vector.h" /* This include will change with cpl_phys_const.h */ #include "cpl_phys_const.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_error_code cpl_photom_fill_blackbody(cpl_vector *, cpl_unit, const cpl_vector *, cpl_unit, double); CPL_END_DECLS #endif cpl-6.4.1/cpldrs/cpl_wlcalib.h0000644000460300003120000000752412124022370013126 00000000000000/* $Id: cpl_wlcalib.h,v 1.11 2013-03-25 10:20:40 cgarcia Exp $ * * This file is part of the CPL package * Copyright (C) 2002,2003 European Southern Observatory * * 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 2 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 */ /* * $Author: cgarcia $ * $Date: 2013-03-25 10:20:40 $ * $Revision: 1.11 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_WLCALIB_H #define CPL_WLCALIB_H /*----------------------------------------------------------------------------- Include -----------------------------------------------------------------------------*/ #include #include /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ typedef struct cpl_wlcalib_slitmodel_ cpl_wlcalib_slitmodel; /*----------------------------------------------------------------------------- Functions prototypes -----------------------------------------------------------------------------*/ /* Functions to create and destroy a slitmodel */ cpl_wlcalib_slitmodel * cpl_wlcalib_slitmodel_new(void) CPL_ATTR_ALLOC; void cpl_wlcalib_slitmodel_delete(cpl_wlcalib_slitmodel *); /* Functions to initialize the slitmodel */ cpl_error_code cpl_wlcalib_slitmodel_set_wslit(cpl_wlcalib_slitmodel *, double); cpl_error_code cpl_wlcalib_slitmodel_set_wfwhm(cpl_wlcalib_slitmodel *, double); cpl_error_code cpl_wlcalib_slitmodel_set_threshold(cpl_wlcalib_slitmodel *, double); cpl_error_code cpl_wlcalib_slitmodel_set_catalog(cpl_wlcalib_slitmodel *, cpl_bivector *); /* Functions to make a model spectrum using the slitmodel */ cpl_error_code cpl_wlcalib_fill_line_spectrum(cpl_vector *, void *, const cpl_polynomial *); cpl_error_code cpl_wlcalib_fill_logline_spectrum(cpl_vector *, void *, const cpl_polynomial *); cpl_error_code cpl_wlcalib_fill_line_spectrum_fast(cpl_vector *, void *, const cpl_polynomial *); cpl_error_code cpl_wlcalib_fill_logline_spectrum_fast(cpl_vector *, void *, const cpl_polynomial *); /* Function to calibrate a spectrum using a spectral model */ cpl_error_code cpl_wlcalib_find_best_1d(cpl_polynomial *, const cpl_polynomial *, const cpl_vector *, void *, cpl_error_code (*) (cpl_vector *, void *, const cpl_polynomial *), const cpl_vector *, cpl_size, cpl_size, double *, cpl_vector *); #endif cpl-6.4.1/cpldrs/Makefile.in0000644000460300003120000007010112310332724012542 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = cpldrs DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/admin/depcomp $(include_HEADERS) \ $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/cpl.m4 $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/omp.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = am_libcpldrs_la_OBJECTS = cpl_apertures.lo cpl_detector.lo \ cpl_geom_img.lo cpl_photom.lo cpl_fit.lo cpl_ppm.lo cpl_wcs.lo \ cpl_wlcalib.lo cpl_fft.lo libcpldrs_la_OBJECTS = $(am_libcpldrs_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libcpldrs_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libcpldrs_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcpldrs_la_SOURCES) DIST_SOURCES = $(libcpldrs_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(include_HEADERS) $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFITSIO_INCLUDES = @CFITSIO_INCLUDES@ CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@ CFLAGS = @CFLAGS@ CPLCORE_INCLUDES = @CPLCORE_INCLUDES@ CPLDFS_INCLUDES = @CPLDFS_INCLUDES@ CPLDRS_INCLUDES = @CPLDRS_INCLUDES@ CPLUI_INCLUDES = @CPLUI_INCLUDES@ CPL_BINARY_AGE = @CPL_BINARY_AGE@ CPL_BINARY_VERSION = @CPL_BINARY_VERSION@ CPL_CFLAGS = @CPL_CFLAGS@ CPL_INTERFACE_AGE = @CPL_INTERFACE_AGE@ CPL_LDFLAGS = @CPL_LDFLAGS@ CPL_MAJOR_VERSION = @CPL_MAJOR_VERSION@ CPL_MICRO_VERSION = @CPL_MICRO_VERSION@ CPL_MINOR_VERSION = @CPL_MINOR_VERSION@ CPL_VERSION = @CPL_VERSION@ CPL_VERSION_STRING = @CPL_VERSION_STRING@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_INCLUDES = @CX_INCLUDES@ CX_LDFLAGS = @CX_LDFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FFTWF_INCLUDES = @FFTWF_INCLUDES@ FFTWF_LDFLAGS = @FFTWF_LDFLAGS@ FFTW_INCLUDES = @FFTW_INCLUDES@ FFTW_LDFLAGS = @FFTW_LDFLAGS@ FGREP = @FGREP@ GASGANO_CLASSPATH = @GASGANO_CLASSPATH@ GASGANO_SHREXT = @GASGANO_SHREXT@ GREP = @GREP@ INCLTDL = @INCLTDL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JAVA_INCLUDES = @JAVA_INCLUDES@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCEXT = @LIBCEXT@ LIBCFITSIO = @LIBCFITSIO@ LIBCPLCORE = @LIBCPLCORE@ LIBCPLDFS = @LIBCPLDFS@ LIBCPLDRS = @LIBCPLDRS@ LIBCPLUI = @LIBCPLUI@ LIBFFTW = @LIBFFTW@ LIBFFTWF = @LIBFFTWF@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBWCS = @LIBWCS@ LIPO = @LIPO@ LN_S = @LN_S@ LTDLDEPS = @LTDLDEPS@ LTDLINCL = @LTDLINCL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ WCS_INCLUDES = @WCS_INCLUDES@ WCS_LDFLAGS = @WCS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ cpl_includes = @cpl_includes@ cpl_libraries = @cpl_libraries@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libcext = @libcext@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in SUBDIRS = tests # Place optional 3rd party components last since those locations may contain # obsolete and therefore unwanted CFITSIO installations AM_CPPFLAGS = -DCX_LOG_DOMAIN=\"CplDrs\" \ $(CPLDRS_INCLUDES) $(CPLCORE_INCLUDES) $(CX_INCLUDES) \ $(CFITSIO_INCLUDES) $(WCS_INCLUDES) $(FFTW_INCLUDES) \ $(FFTWF_INCLUDES) include_HEADERS = cpl_apertures.h \ cpl_apertures_img.h \ cpl_geom_img.h \ cpl_detector.h \ cpl_phys_const.h \ cpl_photom.h \ cpl_fit.h \ cpl_ppm.h \ cpl_wcs.h \ cpl_wlcalib.h \ cpl_fft.h noinst_HEADERS = cpl_geom_img_body.h \ cpl_fit_body.h \ cpl_fft_body.h \ cpl_wlcalib_impl.h \ cpl_detector_body.h lib_LTLIBRARIES = libcpldrs.la libcpldrs_la_SOURCES = cpl_apertures.c \ cpl_detector.c \ cpl_geom_img.c \ cpl_photom.c \ cpl_fit.c \ cpl_ppm.c \ cpl_wcs.c \ cpl_wlcalib.c \ cpl_fft.c # Place optional 3rd party components last since those locations may contain # obsolete and therefore unwanted CFITSIO installations libcpldrs_la_LDFLAGS = $(CX_LDFLAGS) $(CFITSIO_LDFLAGS) $(FFTW_LDFLAGS) $(FFTWF_LDFLAGS) $(WCS_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libcpldrs_la_LIBADD = $(LIBCPLCORE) $(LIBCFITSIO) $(LIBWCS) $(LIBCEXT) $(LIBFFTW) $(LIBFFTWF) -lm libcpldrs_la_DEPENDENCIES = $(LIBCPLCORE) all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cpldrs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign cpldrs/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libcpldrs.la: $(libcpldrs_la_OBJECTS) $(libcpldrs_la_DEPENDENCIES) $(EXTRA_libcpldrs_la_DEPENDENCIES) $(AM_V_CCLD)$(libcpldrs_la_LINK) -rpath $(libdir) $(libcpldrs_la_OBJECTS) $(libcpldrs_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_apertures.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_detector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_fft.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_fit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_geom_img.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_photom.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_ppm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_wcs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_wlcalib.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libLTLIBRARIES \ clean-libtool cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-includeHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-includeHEADERS uninstall-libLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/cpldrs/cpl_geom_img.c0000644000460300003120000013607411737037016013306 00000000000000/* $Id: cpl_geom_img.c,v 1.50 2012-04-04 12:26:54 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-04-04 12:26:54 $ * $Revision: 1.50 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "cpl_apertures.h" #include "cpl_geom_img.h" /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_geom_img High level functions for geometric transformations * * This module contains functions to compute the shift-and-add operation * on an image list. * * @par Synopsis: * @code * #include "cpl_geom_img.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef inline #define inline /* inline */ #endif #define CPL_SORT(a, i, j, tmp) do { \ if (a[i] < a[j]) { tmp = a[i]; a[i] = a[j]; a[j] = tmp; }} while (0) /*----------------------------------------------------------------------------- Static Function Prototypes -----------------------------------------------------------------------------*/ static void cpl_geom_img_get_min_max_double(double *, cpl_size, cpl_size, cpl_size) CPL_ATTR_NONNULL; static double cpl_geom_ima_offset_xcorr(const cpl_image *, const cpl_image *, const cpl_bivector *, cpl_size, cpl_size, cpl_size, cpl_size, double *, double *) CPL_ATTR_NONNULL; static double cpl_geom_ima_offset_xcorr_subw(double *, const cpl_image *, const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, double *, double *) CPL_ATTR_NONNULL; static void cpl_geom_ima_offset_xcorr_subw_double(double *, const cpl_image *, const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size *, cpl_size *) CPL_ATTR_NONNULL; static void cpl_geom_ima_offset_xcorr_subw_float(double *, const cpl_image *, const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size *, cpl_size *) CPL_ATTR_NONNULL; static void cpl_geom_img_offset_saa_double(cpl_image *, cpl_image *, cpl_size, cpl_size, double, double, const cpl_imagelist *, cpl_size, const cpl_bivector *, const cpl_vector *, cpl_size) CPL_ATTR_NONNULL; static void cpl_geom_img_offset_saa_float(cpl_image *, cpl_image *, cpl_size, cpl_size, double, double, const cpl_imagelist *, cpl_size, const cpl_bivector *, const cpl_vector *, cpl_size) CPL_ATTR_NONNULL; static void cpl_geom_img_offset_saa_all_double(cpl_image *, cpl_image *, double, double, const cpl_imagelist *, const cpl_bivector *, const cpl_vector *, cpl_size) CPL_ATTR_NONNULL; static void cpl_geom_img_offset_saa_all_float(cpl_image *, cpl_image *, double, double, const cpl_imagelist *, const cpl_bivector *, const cpl_vector *, cpl_size) CPL_ATTR_NONNULL; static cpl_imagelist * cpl_imagelist_wrap_all_but_first(cpl_imagelist *) CPL_ATTR_ALLOC; static cpl_bivector * cpl_bivector_wrap_all_but_first(cpl_bivector *) CPL_ATTR_ALLOC; static void cpl_bivector_unwrap(cpl_bivector *); /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Get the offsets by correlating the images @param ilist Input image list @param estimates First-guess estimation of the offsets @param anchors List of anchor points @param s_hx Half-width of search area @param s_hy Half-height of search area @param m_hx Half-width of measurement area @param m_hy Half-height of measurement area @param correl List of cross-correlation quality factors @return List of offsets or NULL on error The matching is performed using a 2d cross-correlation, using a minimal squared differences criterion. One measurement is performed per input anchor point, and the median offset is returned together with a measure of similarity for each plane. The images in the input list must only differ from a shift. In order from the correlation to work, they must have the same level (check the average values of your input images if the correlation does not work). The supported types are CPL_TYPE_DOUBLE and CPL_TYPE_FLOAT. The bad pixel maps are ignored by this function. The ith offset (offsx, offsy) in the returned offsets is the one that have to be used to shift the ith image to align it on the reference image (the first one). If not NULL, the returned cpl_bivector must be deallocated with cpl_bivector_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if ilist is not valid */ /*----------------------------------------------------------------------------*/ cpl_bivector * cpl_geom_img_offset_fine( const cpl_imagelist * ilist, const cpl_bivector * estimates, const cpl_bivector * anchors, cpl_size s_hx, cpl_size s_hy, cpl_size m_hx, cpl_size m_hy, cpl_vector * correl) { cpl_errorstate prevstate = cpl_errorstate_get(); const cpl_size nima = cpl_imagelist_get_size(ilist); const cpl_image * img1 = cpl_imagelist_get_const(ilist, 0); const cpl_type type = cpl_image_get_type(img1); const cpl_size nx = cpl_image_get_size_x(img1); const cpl_size ny = cpl_image_get_size_y(img1); cpl_image * med1; cpl_image * medi; cpl_mask * kernel; double * correl_data; const double * anchors_x_data = cpl_bivector_get_x_data_const(anchors); const double * anchors_y_data = cpl_bivector_get_y_data_const(anchors); const double * estim_x_data = cpl_bivector_get_x_data_const(estimates); const double * estim_y_data = cpl_bivector_get_y_data_const(estimates); cpl_bivector * offsets; double * offsets_x_data; double * offsets_y_data; double offsx, offsy; cpl_size i; /* Check entries */ cpl_ensure(ilist, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(estimates, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(anchors, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(correl, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(cpl_imagelist_is_uniform(ilist)==0, CPL_ERROR_ILLEGAL_INPUT, NULL); for (i = 0; i < cpl_bivector_get_size(anchors); i++) { cpl_ensure(anchors_x_data[i] >= 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(anchors_x_data[i] < nx, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(anchors_y_data[i] >= 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(anchors_y_data[i] < ny, CPL_ERROR_ILLEGAL_INPUT, NULL); } /* Create the kernel for the filtering operations */ kernel = cpl_mask_new(3, 3); cpl_mask_not(kernel); /* Filter the first image */ medi = cpl_image_new(nx, ny, type); med1 = cpl_image_new(nx, ny, type); cpl_image_filter_mask(med1, img1, kernel, CPL_FILTER_MEDIAN, CPL_BORDER_FILTER); /* Create the offsets container */ offsets = cpl_bivector_new(nima); offsets_x_data = cpl_bivector_get_x_data(offsets); offsets_y_data = cpl_bivector_get_y_data(offsets); correl_data = cpl_vector_get_data(correl); offsets_x_data[0] = 0.0; offsets_y_data[0] = 0.0; correl_data[0] = 0.0; for (i=1; i < nima; i++) { /* Filter the current image */ cpl_image_filter_mask(medi, cpl_imagelist_get_const(ilist, i), kernel, CPL_FILTER_MEDIAN, CPL_BORDER_FILTER); /* Set the estimates */ offsx = estim_x_data[i]; offsy = estim_y_data[i]; /* Perform cross-correlation */ correl_data[i] = cpl_geom_ima_offset_xcorr(med1, medi, anchors, s_hx, s_hy, m_hx, m_hy, &offsx, &offsy); cpl_errorstate_set(prevstate); if (correl_data[i] < 0.0) { /* Nothing was found. */ /* declare the offset as invalid: null offsets and dist=-1 */ offsets_x_data[i] = 0.0; offsets_y_data[i] = 0.0; } else { /* Something was found. */ /* One standard failure case is when the returned offset is */ /* located on the border of the search zone. Identify such */ /* cases and flag the frame as not registrable by setting */ /* the offset vector to nil and the distance to -1. */ if ((fabs(fabs(estim_x_data[i]-offsx)-(double)s_hx)<1) || (fabs(fabs(estim_y_data[i]-offsy)-(double)s_hy)<1)) { offsets_x_data[i] = 0.0; offsets_y_data[i] = 0.0; correl_data[i] = -1.0; } else { /* The returned offset is correct */ offsets_x_data[i] = offsx; offsets_y_data[i] = offsy; } } if (correl_data[i] < 0.0) { cpl_msg_debug(cpl_func, "Frame %" CPL_SIZE_FORMAT "/%" CPL_SIZE_FORMAT " does not correlate in window " " 1 + 2%" CPL_SIZE_FORMAT " X 1 + 2%" CPL_SIZE_FORMAT " sampling 1 + 2%" CPL_SIZE_FORMAT " X 1 + 2%" CPL_SIZE_FORMAT, 1 + i, nima, s_hx, s_hy, m_hx, m_hy); } } cpl_mask_delete(kernel); cpl_image_delete(med1); cpl_image_delete(medi); return offsets; } /*----------------------------------------------------------------------------*/ /** @brief Images list recombination @param self Input imagelist - with refining images may be erased @param offs List of offsets in x and y @param refine Iff non-zero, the offsets will be refined @param aperts List of correlation apertures or NULL if unknown @param sigmas Positive, decreasing sigmas to apply @param pisigma Index of the sigma that was used or undefined on error @param s_hx Search area half-width. @param s_hy Search area half-height. @param m_hx Measurement area half-width. @param m_hy Measurement area half-height. @param min_rej number of low values to reject in stacking @param max_rej number of high values to reject in stacking @param union_flag Combination mode (CPL_GEOM_UNION or CPL_GEOM_INTERSECT) @return Pointer to newly allocated images array, or NULL on error. @see cpl_geom_img_offset_saa() @see cpl_apertures_extract() @see cpl_geom_img_offset_fine() With offset refinement enabled: This function detects cross correlation points in the first image (if not provided by the user), use them to refine the provided offsets with a cross correlation method, and then apply the shift and add to recombine the images together. Non-correlating images are removed from self. Without offset refinement self is not modified. The supported types are CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT. The number of provided offsets shall be equal to the number of input images. The ith offset (offs_x, offs_y) is the offset that has to be used to shift the ith image to align it on the first one. sigmas may be NULL if offset refinement is disabled or if aperts is non-NULL. On success the returned image array contains 2 images: - the combined image - the contribution map The returned cpl_image array must be deallocated like this: @code if (array != NULL) { cpl_image_delete(array[0]); cpl_image_delete(array[1]); cpl_free(array); } @endcode Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if self or offs is NULL, or if sigmas is NULL with refinement enabled and aperts NULL. - CPL_ERROR_ILLEGAL_INPUT if self is not uniform - CPL_ERROR_INCOMPATIBLE_INPUT if self and offs have different sizes - CPL_ERROR_DATA_NOT_FOUND if the shift and add of the images fails */ /*----------------------------------------------------------------------------*/ cpl_image ** cpl_geom_img_offset_combine(const cpl_imagelist* self, const cpl_bivector * offs, int refine, const cpl_bivector * aperts, const cpl_vector * sigmas, cpl_size * pisigma, cpl_size s_hx, cpl_size s_hy, cpl_size m_hx, cpl_size m_hy, cpl_size min_rej, cpl_size max_rej, cpl_geom_combine union_flag) { const cpl_imagelist* uselist = self; cpl_imagelist * modlist = NULL; const cpl_bivector * use_offs = offs; cpl_bivector * offs_fine = NULL; const cpl_size nima = cpl_imagelist_get_size(self); cpl_image ** combined; /* Check inputs */ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(cpl_imagelist_is_uniform(self) == 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(offs != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(cpl_bivector_get_size(offs) == nima, CPL_ERROR_INCOMPATIBLE_INPUT, NULL); if (refine != 0 && nima > 1) { const cpl_bivector * use_aperts = aperts; /* May be NULL */ cpl_bivector * anchor = NULL; if (use_aperts == NULL) { /* No apertures are provided, look for a cross correlation point */ double * anchor_x; double * anchor_y; cpl_apertures * apertures = cpl_apertures_extract(cpl_imagelist_get_const(self, 0), sigmas, pisigma); if (apertures != NULL) { /* Found some, just pick a single point */ anchor = cpl_bivector_new(1); anchor_x = cpl_bivector_get_x_data(anchor); anchor_y = cpl_bivector_get_y_data(anchor); /* ... of the largest object */ cpl_apertures_sort_by_npix(apertures); anchor_x[0] = cpl_apertures_get_pos_x(apertures, 1); anchor_y[0] = cpl_apertures_get_pos_y(apertures, 1); cpl_apertures_delete(apertures); use_aperts = anchor; } } if (use_aperts != NULL) { /* Refine the offsets */ cpl_vector * correl = cpl_vector_new(nima); offs_fine = cpl_geom_img_offset_fine(self, offs, use_aperts, s_hx, s_hy, m_hx, m_hy, correl); cpl_bivector_delete(anchor); if (offs_fine != NULL) { const double * correl_data = cpl_vector_get_data_const(correl); double * offs_fine_x = cpl_bivector_get_x_data(offs_fine); double * offs_fine_y = cpl_bivector_get_y_data(offs_fine); cpl_size ngood = 0; cpl_size i; /* Create a modified list, with the correlating images */ modlist = cpl_imagelist_new(); /* Erase the non-correlating offsets and count the good ones */ for (i = 0; i < nima; i++) { if (correl_data[i] > -0.5) { offs_fine_x[ngood] = offs_fine_x[i]; offs_fine_y[ngood] = offs_fine_y[i]; /* modlist will _not_ be modified */ cpl_imagelist_set(modlist, (cpl_image*) cpl_imagelist_get_const(self, i), ngood); ngood++; } } if (ngood > 0) { if (ngood < nima) { cpl_vector_set_size(cpl_bivector_get_x(offs_fine), ngood); cpl_vector_set_size(cpl_bivector_get_y(offs_fine), ngood); uselist = modlist; assert( cpl_bivector_get_size(offs_fine) == ngood ); assert( cpl_imagelist_get_size(uselist) == ngood ); } use_offs = offs_fine; } } cpl_vector_delete(correl); } } /* Shift & add */ combined = cpl_geom_img_offset_saa(uselist, use_offs, CPL_KERNEL_DEFAULT, min_rej, max_rej, union_flag, NULL, NULL); cpl_bivector_delete(offs_fine); if (modlist != NULL) { cpl_size i = cpl_imagelist_get_size(modlist); while (i--) { (void)cpl_imagelist_unset(modlist, i); } cpl_imagelist_delete(modlist); } if (combined == NULL) { (void)cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "Could not " "shift and add %" CPL_SIZE_FORMAT " images", nima); } return combined; } /*----------------------------------------------------------------------------*/ /** @brief Shift and add an images list to a single image @param ilist Input image list @param offs List of offsets in x and y @param kernel Interpolation kernel to use for resampling @param rejmin Number of minimum value pixels to reject in stacking @param rejmax Number of maximum value pixels to reject in stacking @param union_flag Combination mode (CPL_GEOM_UNION or CPL_GEOM_INTERSECT) @param ppos_x If non-NULL, *ppos_x is the X-position of the first image in the combined image @param ppos_y If non-NULL, *ppos_y is the Y- position of the first image in the combined image @return Pointer to newly allocated images array, or NULL on error. The supported types are CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT. The number of provided offsets shall be equal to the number of inputs images. The ith offset (offs_x, offs_y) is the offset that has to be used to shift the ith image to align it on the first one. Provide the name of the kernel you want to generate. Supported kernel types are: - CPL_KERNEL_DEFAULT: default kernel, currently CPL_KERNEL_TANH - CPL_KERNEL_TANH: Hyperbolic tangent - CPL_KERNEL_SINC: Sinus cardinal - CPL_KERNEL_SINC2: Square sinus cardinal - CPL_KERNEL_LANCZOS: Lanczos2 kernel - CPL_KERNEL_HAMMING: Hamming kernel - CPL_KERNEL_HANN: Hann kernel - CPL_KERNEL_NEAREST: Nearest neighbor kernel (1 when dist < 0.5, else 0) If the number of input images is lower or equal to 3, the rejection parameters are ignored. If the number of input images is lower or equal to 2*(rejmin+rejmax), the rejection parameters are ignored. On success the returned image array contains 2 images: - the combined image - the contribution map Pixels with a zero in the contribution map are flagged as bad in the combined image. If not NULL, the returned cpl_image array arr must be deallocated like: @code if (arr[0] != NULL) cpl_image_delete(arr[0]); if (arr[1] != NULL) cpl_image_delete(arr[1]); cpl_free(arr); @endcode Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if ilist is invalid or if rejmin or rejmax is negative - CPL_ERROR_INCOMPATIBLE_INPUT if ilist and offs have different sizes - CPL_ERROR_ILLEGAL_OUTPUT if the CPL_GEOM_INTERSECT method is used with non-overlapping images. - CPL_ERROR_INVALID_TYPE if the passed image list type is not supported - CPL_ERROR_UNSUPPORTED_MODE if the union_flag is not one of the supported combination modes, which are @em CPL_GEOM_INTERSECT, @em CPL_GEOM_UNION, @em CPL_GEOM_FIRST. */ /*----------------------------------------------------------------------------*/ cpl_image ** cpl_geom_img_offset_saa(const cpl_imagelist * ilist, const cpl_bivector * offs, cpl_kernel kernel, cpl_size rejmin, cpl_size rejmax, cpl_geom_combine union_flag, double * ppos_x, double * ppos_y) { cpl_imagelist * copy = (cpl_imagelist *)ilist; /* Not modified */ cpl_bivector * offscopy = (cpl_bivector *)offs; /* Not modified */ const cpl_size nima = cpl_imagelist_get_size(ilist); const cpl_image * img1 = cpl_imagelist_get_const(ilist, 0); const cpl_size sizex = cpl_image_get_size_x(img1); const cpl_size sizey = cpl_image_get_size_y(img1); const cpl_type type = cpl_image_get_type(img1); const cpl_vector * voffsx; const cpl_vector * voffsy; /* Test rejection parameters */ const cpl_boolean do_rej = nima > 3 && nima > 2*(rejmin+rejmax) ? CPL_TRUE : CPL_FALSE; const cpl_size rmin = do_rej ? rejmin : 0; const cpl_size rmax = do_rej ? rejmax : 0; const cpl_size rtot = rmin + rmax; const cpl_size tabsperpix = CPL_KERNEL_TABSPERPIX; cpl_vector * xyprofile; cpl_size nx, ny; double start_x, start_y; cpl_image * final; cpl_image * contrib; cpl_image ** out_arr; cpl_size i_ima; cpl_size firstbpm; cpl_ensure(ilist != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(offs != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(cpl_imagelist_is_uniform(ilist) == 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(cpl_bivector_get_size(offs) == nima, CPL_ERROR_INCOMPATIBLE_INPUT, NULL); cpl_ensure(rejmin>=0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(rejmax>=0, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Compute output image size for union/intersection */ voffsx = cpl_bivector_get_x_const(offs); voffsy = cpl_bivector_get_y_const(offs); if (union_flag == CPL_GEOM_UNION) { /* Union image */ /* For this mode, the rejection arguments are also used to reduce the size of the resulting image */ cpl_vector * ox_tmp = cpl_vector_duplicate(voffsx); cpl_vector * oy_tmp = cpl_vector_duplicate(voffsy); const double * ox_data = cpl_vector_get_data_const(ox_tmp); const double * oy_data = cpl_vector_get_data_const(oy_tmp); double ox_max, oy_max; cpl_vector_sort(ox_tmp, 1); cpl_vector_sort(oy_tmp, 1); start_x = ox_data[rtot]; start_y = oy_data[rtot]; if (ppos_x != NULL) *ppos_x = 1.0 - start_x; if (ppos_y != NULL) *ppos_y = 1.0 - start_y; ox_max = ox_data[nima - rtot - 1]; oy_max = oy_data[nima - rtot - 1]; /* Round down */ nx = (cpl_size)((double)sizex + ox_max - start_x); ny = (cpl_size)((double)sizey + oy_max - start_y); cpl_vector_delete(ox_tmp); cpl_vector_delete(oy_tmp); } else if (union_flag == CPL_GEOM_INTERSECT) { /* Intersection image */ const double ox_min = cpl_vector_get_min(voffsx); const double oy_min = cpl_vector_get_min(voffsy); start_x = cpl_vector_get_max(voffsx); start_y = cpl_vector_get_max(voffsy); if (ppos_x != NULL) *ppos_x = start_x; if (ppos_y != NULL) *ppos_y = start_y; /* Round down */ nx = (cpl_size)((double)sizex - start_x + ox_min); ny = (cpl_size)((double)sizey - start_y + oy_min); cpl_ensure(nx > 0, CPL_ERROR_ILLEGAL_OUTPUT, NULL); cpl_ensure(ny > 0, CPL_ERROR_ILLEGAL_OUTPUT, NULL); } else if (union_flag == CPL_GEOM_FIRST) { /* First image as reference */ nx = sizex; ny = sizey; start_x = 0.0; start_y = 0.0; if (ppos_x != NULL) *ppos_x = 1.0; if (ppos_y != NULL) *ppos_y = 1.0; if (rtot == 0 && nima > 1) { /* Create shallow copies, without the 1st element */ copy = cpl_imagelist_wrap_all_but_first(copy); offscopy = cpl_bivector_wrap_all_but_first(offscopy); /* copy and offscopy are NOT modified below */ } } else { /* union_flag is not one of the three supported modes */ (void)cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); return NULL; } xyprofile = cpl_vector_new(CPL_KERNEL_DEF_SAMPLES); /* The resampling profile is for a resampling routine with a hard-coded radius of 2.0 */ if (cpl_vector_fill_kernel_profile(xyprofile, kernel, 2.0)) { cpl_vector_delete(xyprofile); if (copy != ilist) cpl_imagelist_unwrap(copy); if (offscopy != offs) cpl_bivector_unwrap(offscopy); (void)cpl_error_set_where_(); return NULL; } if (copy == ilist) { /* Create output image, initialized to zero */ final = cpl_image_new(nx, ny, type); /* Create output contribution image, initialized to zero */ contrib = cpl_image_new(nx, ny, CPL_TYPE_INT); } else { /* Create output image, duplicated from 1st image */ final = cpl_image_duplicate(img1); if (cpl_image_get_bpm_const(final) != NULL) { /* Check for bpm */ cpl_mask * mask1 = cpl_image_get_bpm(final); cpl_mask_not(mask1); contrib = cpl_image_new_from_mask(mask1); cpl_image_fill_rejected(final, 0.0); cpl_image_accept_all(final); } else { /* Create an integer image filled with 1's */ int * dcontrib = cpl_malloc((size_t)(nx * ny) * sizeof(*dcontrib)); contrib = cpl_image_wrap_int(nx, ny, dcontrib); (void)cpl_image_fill_int(contrib, 1); } } /* Find first plane with a non-empty bad pixel map - if any */ firstbpm = nima; for(i_ima=0; i_ima < nima; i_ima++) { const cpl_mask * bpm = cpl_image_get_bpm_const(cpl_imagelist_get_const(ilist, i_ima)); if(bpm != NULL && !cpl_mask_is_empty(bpm)) { firstbpm = i_ima; break; } } /* Switch on the data type */ if (type == CPL_TYPE_DOUBLE) { if (rtot > 0 || firstbpm < nima) { cpl_geom_img_offset_saa_double(final, contrib, rmin, rmax, start_x, start_y, ilist, firstbpm, offs, xyprofile, tabsperpix); } else { cpl_geom_img_offset_saa_all_double(final, contrib, start_x, start_y, copy, offscopy, xyprofile, tabsperpix); } } else if (type == CPL_TYPE_FLOAT) { if (rtot > 0 || firstbpm < nima) { cpl_geom_img_offset_saa_float(final, contrib, rmin, rmax, start_x, start_y, ilist, firstbpm, offs, xyprofile, tabsperpix); } else { cpl_geom_img_offset_saa_all_float(final, contrib, start_x, start_y, copy, offscopy, xyprofile, tabsperpix); } } else { cpl_vector_delete(xyprofile); cpl_image_delete(final); cpl_image_delete(contrib); if (copy != ilist) cpl_imagelist_unwrap(copy); if (offscopy != offs) cpl_bivector_unwrap(offscopy); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } cpl_vector_delete(xyprofile); out_arr = cpl_malloc(2*sizeof(cpl_image *)); out_arr[0] = final; out_arr[1] = contrib; if (copy != ilist) cpl_imagelist_unwrap(copy); if (offscopy != offs) cpl_bivector_unwrap(offscopy); return out_arr; } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Compute the median offset between 2 images @param im1 First input image @param im2 Second input image @param anchors List of cross-correlation points in the first image @param s_hx Search area half-width. @param s_hy Search area half-height. @param m_hx Measurement area half-width. @param m_hy Measurement area half-height. @param offs_x X offset estimate - updated with the computed offset. @param offs_y Y offset estimate - updated with the computed offset. @return The minimal squared difference factor or -1.0 on error @note No input validation! This function compares two images using a 2d cross-correlation. The input images are expected to be more or less the same, up to a shift in x and y. (offs_x, offs_y) has to be provided by the user. It is used as a first estimate, and updated with the computed subpixel precision offsets. The input/returned offsets (offs_x, offs_y) is the a priori offset that has to be used to shift im2 to align it on im1. The computed offset has a subpixel precision. The cross-correlation is carried out for each anchor point given in the list. It is Ok to provide only one anchor point. For each point, a cross-correlation criterion will be computed on a grid of 2m_hx+1 by 2m_hy+1, on the search area defined by 2s_hx+1 by 2s_hy+1. The total number of pixel operations is quite high: number of anchor points times number of search area pixels times number of measurement area pixels. The supported types are CPL_TYPE_DOUBLE and CPL_TYPE_FLOAT and the two input images have to be of the same type. The bad pixel maps are ignored by this function. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT - CPL_ERROR_INVALID_TYPE */ /*----------------------------------------------------------------------------*/ static double cpl_geom_ima_offset_xcorr(const cpl_image * im1, const cpl_image * im2, const cpl_bivector * anchors, cpl_size s_hx, cpl_size s_hy, cpl_size m_hx, cpl_size m_hy, double * offs_x, double * offs_y) { const cpl_size nx = cpl_image_get_size_x(im1); const cpl_size ny = cpl_image_get_size_y(im1); const cpl_size nanchors = cpl_bivector_get_size(anchors); const double * anchor_x = cpl_bivector_get_x_data_const(anchors); const double * anchor_y = cpl_bivector_get_y_data_const(anchors); cpl_bivector * delta = cpl_bivector_new(nanchors); double * delta_x = cpl_bivector_get_x_data(delta); double * delta_y = cpl_bivector_get_y_data(delta); cpl_vector * correl = cpl_vector_new(nanchors); double * correl_data = cpl_vector_get_data(correl); /* Temporary work array */ double * corr_tmp = cpl_malloc((size_t)(2*s_hx+1) * (size_t)(2*s_hy+1) * sizeof(double)); double best_xcorr = -1.0; /* Assume failure */ cpl_size nvalid = 0; cpl_size i; /* Loop on all correlating points */ for (i = 0; i < nanchors; i++) { const int x_1 = (int)(anchor_x[i]); const int y_1 = (int)(anchor_y[i]); const int x_2 = x_1 - (int)(*offs_x); const int y_2 = y_1 - (int)(*offs_y); correl_data[nvalid] = 0 <= x_2 && x_2 < nx && 0 <= y_2 && y_2 < ny ? cpl_geom_ima_offset_xcorr_subw(corr_tmp, im1, im2, x_1, y_1, x_2, y_2, s_hx, s_hy, m_hx, m_hy, delta_x+nvalid, delta_y+nvalid) : -1.0; if (correl_data[nvalid] >= 0.0) nvalid++; } cpl_free(corr_tmp); if (nvalid > 0) { /* There are valid points */ cpl_size best_rank = 0; if (nvalid > 1) { double median_dx, median_dy; double min_sqdist; if (nvalid < nanchors) { /* Resize for the median computation - invalidates the data pointers! */ cpl_vector_set_size(cpl_bivector_get_x(delta), nvalid); cpl_vector_set_size(cpl_bivector_get_y(delta), nvalid); delta_x = cpl_bivector_get_x_data(delta); delta_y = cpl_bivector_get_y_data(delta); } /* Compute a median offset from the correlations */ median_dx = cpl_vector_get_median_const(cpl_bivector_get_x(delta)); median_dy = cpl_vector_get_median_const(cpl_bivector_get_y(delta)); /* Find the offset measurement closest to this median */ min_sqdist = (delta_x[0]-median_dx) * (delta_x[0]-median_dx) + (delta_y[0]-median_dy) * (delta_y[0]-median_dy); for (i = 1; i < nvalid; i++) { const double sqdist = (delta_x[i]-median_dx) * (delta_x[i]-median_dx) + (delta_y[i]-median_dy) * (delta_y[i]-median_dy); if (sqdist < min_sqdist) { min_sqdist = sqdist; best_rank = i; } } } *offs_x = (int)(*offs_x) + delta_x[best_rank]; *offs_y = (int)(*offs_y) + delta_y[best_rank]; best_xcorr = correl_data[best_rank]; } cpl_bivector_delete(delta); cpl_vector_delete(correl); return best_xcorr; } /*----------------------------------------------------------------------------*/ /** @internal @brief Correlate two images subwindow @param correl Work-array for correlation @param im1 First input image @param im2 Second input image @param im1_posx X-coordinate of the subwindow center in im1 @param im1_posy Y-coordinate of the subwindow center in im1 @param im2_posx X-coordinate of the subwindow center in im2 @param im2_posy Y-coordinate of the subwindow center in im2 @param s_hx Search area half-width. @param s_hy Search area half-height. @param m_hx Measurement area half-width. @param m_hy Measurement area half-height. @param offs_x Returned apodised position in x. @param offs_y Returned apodised position in y. @return The minimal squared difference or -1.0 on error @note No input validation! The computed offset has subpixel precision. The double returned by the function measures the lowest squared difference between the two input images subwindows (in the search area and over the measurement area as requested by the caller). It is often a good indicator of how well the cross-correlation performed. (offs_x, offs_y) has to be subtracted to (im2_posx, im2_posy) to retrieve the exact position of the point in im2 corresponding to the point at position (im1_posx, im1_posy). The supported types are CPL_TYPE_DOUBLE and CPL_TYPE_FLOAT and the two input images have to be of the same type. The bad pixel maps are ignored by this function. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT - CPL_ERROR_ILLEGAL_INPUT - CPL_ERROR_INVALID_TYPE */ /*----------------------------------------------------------------------------*/ static double cpl_geom_ima_offset_xcorr_subw(double * correl, const cpl_image * im1, const cpl_image * im2, cpl_size im1_posx, cpl_size im1_posy, cpl_size im2_posx, cpl_size im2_posy, cpl_size s_hx, cpl_size s_hy, cpl_size m_hx, cpl_size m_hy, double * offs_x, double * offs_y) { const cpl_type type = cpl_image_get_type(im1); cpl_size k_min = 0; cpl_size l_min = 0; double inc_x, inc_y; cpl_size pos_min; double best_correl; /* Switch on the data type */ if (type == CPL_TYPE_DOUBLE) { cpl_geom_ima_offset_xcorr_subw_double(correl, im1, im2, im1_posx, im1_posy, im2_posx, im2_posy, s_hx, s_hy, m_hx, m_hy, &k_min, &l_min); } else if (type == CPL_TYPE_FLOAT) { cpl_geom_ima_offset_xcorr_subw_float(correl, im1, im2, im1_posx, im1_posy, im2_posx, im2_posy, s_hx, s_hy, m_hx, m_hy, &k_min, &l_min); } else { (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return -1.0; } /* Store results (pixel precision) */ pos_min = s_hx + k_min + (s_hy + l_min) * (1 + 2 * s_hx); best_correl = correl[pos_min]; /* Compute inc_x and inc_y (sub-pixel precision) */ if ((k_min == -s_hx) || (k_min == s_hx)) inc_x = 0.0; else inc_x = 0.5*((correl[pos_min-1]-correl[pos_min+1])/ (correl[pos_min-1]-(2.0*correl[pos_min])+correl[pos_min+1])); if ((l_min == -s_hy) || (l_min == s_hy)) inc_y = 0.0; else inc_y = 0.5*((correl[pos_min-(2*s_hx+1)]-correl[pos_min+(2*s_hx+1)])/ (correl[pos_min-(2*s_hx+1)]-(2.0*correl[pos_min])+ correl[pos_min+(2*s_hx+1)])); /* Return the sub-pixel precision offsets */ *offs_x = (double)k_min + inc_x; *offs_y = (double)l_min + inc_y; return best_correl; } /*----------------------------------------------------------------------------*/ /** @internal @brief Use bubble-sort to find the rmin smallest and rmax largest values @param a the double array @param n the array size @param rmin The 1st rmin values are the smallest @param rmax The last rmax values are the largest @note No error checking! The number of floating-point comparisons (possibly followed by a swap) is n * r - r * (r + 1) / 2, where r = rmin + rmax, which is better than sorting as long as r is small (compared to log(n)). */ /*----------------------------------------------------------------------------*/ inline static void cpl_geom_img_get_min_max_double(double * a, cpl_size n, cpl_size rmin, cpl_size rmax) { double tmp; const cpl_size jeq = CX_MIN(rmin, rmax); cpl_size i, j; /* Gain some locality */ for (j = 0; j < jeq; j++) { /* Bubble one minimum value into place */ for (i = n-j-1; i > j; i--) { CPL_SORT(a, i, i-1, tmp); } /* Bubble one maximum value into place */ for (i += 2; i < n - j; i++) { CPL_SORT(a, i, i-1, tmp); } } /* Will enter at most one of the below two loops */ /* Bubble one minimum value into place */ for (; j < rmin; j++) { for (i = n-rmax-1; i > j; i--) { CPL_SORT(a, i, i-1, tmp); } } /* Bubble one maximum value into place */ for (; j < rmax; j++) { for (i = rmin+1; i < n - j; i++) { CPL_SORT(a, i, i-1, tmp); } } cpl_tools_add_flops( n * (rmin + rmax) - ((rmin + rmax) * (rmin + rmax + 1)) / 2); } /*----------------------------------------------------------------------------*/ /** @internal @brief Shallow copy of all but one image in a list @param other The source list @return The created image list on success */ /*----------------------------------------------------------------------------*/ static cpl_imagelist * cpl_imagelist_wrap_all_but_first(cpl_imagelist * other) { cpl_imagelist * self; const cpl_size n = cpl_imagelist_get_size(other); cpl_size i; cpl_ensure(other != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_imagelist_new(); for (i=1; i < n; i++) { cpl_image * copy = cpl_imagelist_get(other, i); (void)cpl_imagelist_set(self, copy, i-1); } return self; } /*----------------------------------------------------------------------------*/ /** @internal @brief Shallow copy of all but the 1st element in a bivector @param self The source bivector @return The created bivector on success */ /*----------------------------------------------------------------------------*/ static cpl_bivector * cpl_bivector_wrap_all_but_first(cpl_bivector * self) { const cpl_size n = cpl_bivector_get_size(self); cpl_vector * xvec; cpl_vector * yvec; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(n > 1, CPL_ERROR_ILLEGAL_INPUT, NULL); xvec = cpl_vector_wrap(n-1, 1 + cpl_bivector_get_x_data(self)); yvec = cpl_vector_wrap(n-1, 1 + cpl_bivector_get_y_data(self)); return cpl_bivector_wrap_vectors(xvec, yvec); } /*----------------------------------------------------------------------------*/ /** @internal @brief Shallow delete of all but one image in a list @param self The destination list @return void */ /*----------------------------------------------------------------------------*/ static void cpl_bivector_unwrap(cpl_bivector * self) { if (self != NULL) { (void)cpl_vector_unwrap(cpl_bivector_get_x(self)); (void)cpl_vector_unwrap(cpl_bivector_get_y(self)); cpl_bivector_unwrap_vectors(self); } } /* Define the C-type dependent functions */ #define CPL_TYPE double #include "cpl_geom_img_body.h" #undef CPL_TYPE #define CPL_TYPE float #include "cpl_geom_img_body.h" #undef CPL_TYPE cpl-6.4.1/NEWS0000644000460300003120000006740012300400634007710 00000000000000What's new in CPL 6.4 ===================== - New functions and functionality cpl_image_reject_value(): Reject special values (NaN, +/-inf, zero) (this function was actually released in version 6.3) Various bit wise operations on an integer type image: cpl_image_and() cpl_image_or() cpl_image_xor() cpl_image_and_scalar() cpl_image_or_scalar() cpl_image_xor_scalar() cpl_image_not() cpl_image_hypot(): The pixel-wise Euclidean distance function of two images cpl_image_set_bpm(): Replaces the bad pixel map of the image cpl_image_fill_window(): Fill an image window with a constant cpl_imagelist_cast(): Casting of a CPL imagelist (this function was actually released in version 6.3) CPL_MIN(), CPL_MAX(): The minimum/maximum of two values CPL_STRINGIFY(): Concatenation of identifiers CPL_DIAG_PRAGMA_PUSH_IGN(), CPL_DIAG_PRAGMA_PUSH_ERR(), CPL_DIAG_PRAGMA_POP: Suppress various compiler (gcc) warnings CPL_INTERNAL, CPL_EXPORT: Control the visibility of non-static functions (these macros were actually released in version 6.3) cpl_wcs_get_ctype(), cpl_wcs_get_cunit(): Access the axis type and unit of a world coordinate system. cpl_table_set_column_savetype(): Added support for short integer save type What's new in CPL 6.3 ===================== - New functions and functionality cpl_vector_sum(): Sum the elements of a vector Two scaling filters for image filtering: CPL_FILTER_LINEAR_SCALE, CPL_FILTER_MORPHO_SCALE cpl_image_filter_mask(): Support the combination of CPL_FILTER_MEDIAN and CPL_BORDER_CROP and bad pixel(s) in the input Added support for table columns of type CPL_TYPE_LONG_LONG. - Deprecated functions cpl_frameset_get_frame(), cpl_frameset_get_frame_const(): Replaced by cpl_frameset_get_position() and cpl_frameset_get_position_const(). This fixes a flaw in the design of the old functions. New code should not use the old functions anymore, and old code should be ported as soon as possible, because it is intended to remove the old functions in version 7.0 - The release fixes the following bugs The interpolation profiles CPL_KERNEL_HAMMING and CPL_KERNEL_HANN are now multiplied by sinc(x), like CPL_KERNEL_LANCZOS. What's new in CPL 6.2 ===================== - New functions and functionality Support clang compiler: Stop CPLs usage of unsupported C99 operations cpl_test_get_tested() cpl_test_get_failed() CPL_WCS_REGEXP: Regexp matching the FITS keys used for WCS cpl_image_multiply(): Build with SSE2/3 enabled improves performance for complex pixel data. SSE2 is enabled by default on 64-bit operating systems. - The release fixes the following bugs cpl_image_get_fwhm(): gives wrong results cpl_matrix_dump(): Meaningless format string modification cpl_fit_image_gaussian(): No check of bad pixels in error map cpl_fit_image_gaussian(): Robustness issue cpl_imagelist_collapse_median_create(): Bad pixels ignored cpl_test_abs_complex(): Wrong number in message cpl_column_get_median(): Median of even number of samples ignores last sample cpl_matrix_get_median(): Ditto cpl_vector_get_median(): Ditto cpl_apertures_get_median(): Ditto cpl_wcs_platesol(): Ditto cpl_propertylist: Fixed handling of properties of type long long. - The release fixes the following documentation errors cpl_flux_get_noise_window(): Document randomness better cpl_image_get_median_dev_window(): Unclear doxygen cpl_bivector has wrong copy-pasted doxygen intro cpl_image_power_create(): Non-existing doxygen reference CPL_FILTER_LINEAR: Elaborate on the normalisation of the kernel CPL_FILTER_MORPHO: Ditto What's new in CPL 6.1 ===================== - New functions and functionality cpl_apertures_extract_mask() cpl_fits_get_mode() cpl_fits_set_mode() cpl_imagelist_unwrap() - The release fixes the following bugs cpl_apertures_new_from_image(): segfault on complex input cpl_flux_get_noise_window(): Incorrect error propagation cpl_image_move(): No support of complex pixels The caching of FITS files opened for reading did not support multi-threading cpl_plot_columns(), cpl_plot_vectors(): NULL-options not supported - The release fixes the following documentation errors Dropped documentation for the cpl_errorstate module Some internal and thus unavailable functions appeared in the documentation Usage example of cpl_error_set_message() clarified CPL_TYPE_COMPLEX was incorrecly documented from CPL 5.1.0 What's new in CPL 6.0 ===================== - New functions and functionality cpl_apertures_get_maxpos_x cpl_apertures_get_maxpos_y cpl_apertures_get_minpos_x cpl_apertures_get_minpos_y cpl_apertures_get_pos_x cpl_apertures_get_pos_y cpl_mask_load cpl_mask_load_window cpl_mask_save cpl_mask_threshold_image cpl_init Now supports a new, experimental and faster FITS I/O mode, which is enabled at run-time via the environment variable CPL_IO_MODE. Refer to the documentation of cpl_init() for more details. - Deprecated types and identifiers cpl_apertures_get_max_x Replace with cpl_apertures_get_pos_x cpl_apertures_get_max_y Replace with cpl_apertures_get_pos_y cpl_type_bpp Replace with cpl_type CPL_BPP_8_UNSIGNED Replace with CPL_TYPE_UCHAR CPL_BPP_16_SIGNED Replace with CPL_TYPE_SHORT CPL_BPP_16_UNSIGNED Replace with CPL_TYPE_USHORT CPL_BPP_32_SIGNED Replace with CPL_TYPE_INT CPL_BPP_IEEE_FLOAT Replace with CPL_TYPE_FLOAT CPL_BPP_IEEE_DOUBLE Replace with CPL_TYPE_DOUBLE No CPL_BPP macro should be used in a direct call to CFITSIO, this will no longer work. - Deprecated functions cpl_apertures_get_fwhm Replace with a loop over cpl_image_get_fwhm - No-cast image saving. cpl_image_save() and cpl_imagelist_save() now supports CPL_TYPE_UNSPECIFIED as file type, this ensures that the saving incurs no loss of information. - A new type - cpl_size - to be used for all size-related parameters in CPL. cpl_size is the largest possible signed integer type. The new type has its own format specifier, the string literal CPL_SIZE_FORMAT. - Functions with changed API (Parameter redeclaration to cpl_size*) Any call to one of the below functions must be modified accordingly cpl_apertures_extract cpl_apertures_extract_window cpl_array_get_maxpos cpl_array_get_minpos cpl_flux_get_bias_window cpl_flux_get_noise_window cpl_frameset_labelise cpl_frameset_extract cpl_geom_img_offset_combine cpl_image_get_maxpos cpl_image_get_maxpos_window cpl_image_get_minpos cpl_image_get_minpos_window cpl_image_labelise_mask_create cpl_image_move cpl_mask_move cpl_matrix_get_maxpos cpl_matrix_get_minpos cpl_polynomial_fit cpl_polynomial_get_coeff cpl_polynomial_set_coeff cpl_table_get_column_maxpos cpl_table_get_column_minpos - Functions with changed API (Parameter redeclaration to cpl_array*) Any call to one of the below functions must be modified accordingly (If a call passes NULL as the optional permutation parameter, then no change is required). cpl_matrix_decomp_lu cpl_matrix_solve_lu - Functions with changed API (Function or parameter redeclaration to cpl_size) Any call to one of the below functions must at least be recompiled, or better modified according to the new API cpl_apertures_get_bottom cpl_apertures_get_bottom_x cpl_apertures_get_centroid_x cpl_apertures_get_centroid_y cpl_apertures_get_flux cpl_apertures_get_left cpl_apertures_get_left_y cpl_apertures_get_max cpl_apertures_get_max_x cpl_apertures_get_max_y cpl_apertures_get_mean cpl_apertures_get_median cpl_apertures_get_min cpl_apertures_get_npix cpl_apertures_get_right cpl_apertures_get_right_y cpl_apertures_get_size cpl_apertures_get_stdev cpl_apertures_get_top cpl_apertures_get_top_x cpl_array_count_invalid cpl_array_dump cpl_array_erase_window cpl_array_extract cpl_array_fill_window cpl_array_fill_window_complex cpl_array_fill_window_double cpl_array_fill_window_double_complex cpl_array_fill_window_float cpl_array_fill_window_float_complex cpl_array_fill_window_int cpl_array_fill_window_invalid cpl_array_fill_window_string cpl_array_get cpl_array_get_complex cpl_array_get_double cpl_array_get_double_complex cpl_array_get_float cpl_array_get_float_complex cpl_array_get_int cpl_array_get_size cpl_array_get_string cpl_array_insert cpl_array_insert_window cpl_array_is_valid cpl_array_new cpl_array_set cpl_array_set_complex cpl_array_set_double cpl_array_set_double_complex cpl_array_set_float cpl_array_set_float_complex cpl_array_set_int cpl_array_set_invalid cpl_array_set_size cpl_array_set_string cpl_array_wrap_double cpl_array_wrap_double_complex cpl_array_wrap_float cpl_array_wrap_float_complex cpl_array_wrap_int cpl_array_wrap_string cpl_bivector_get_size cpl_bivector_new cpl_fit_image_gaussian cpl_fit_imagelist_polynomial cpl_fit_imagelist_polynomial_window cpl_fits_count_extensions cpl_fits_find_extension cpl_flux_get_noise_ring cpl_frame_get_nextensions cpl_frame_get_nplanes cpl_framedata_create cpl_framedata_get_min_count cpl_framedata_get_max_count cpl_framedata_set_min_count cpl_framedata_set_max_count cpl_framedata_set cpl_frameset_erase cpl_frameset_get_frame_const cpl_frameset_get_frame cpl_frameset_get_size cpl_geom_img_offset_fine cpl_geom_img_offset_saa cpl_image_accept cpl_image_collapse_median_create cpl_image_collapse_window_create cpl_image_copy cpl_image_count_rejected cpl_image_dump_window cpl_image_extract cpl_image_extract_subsample cpl_image_fill_test_create cpl_image_fit_gaussian cpl_image_get cpl_image_get_absflux_window cpl_image_get_centroid_x_window cpl_image_get_centroid_y_window cpl_image_get_complex cpl_image_get_flux_window cpl_image_get_fwhm cpl_image_get_max_window cpl_image_get_mean_window cpl_image_get_median_dev_window cpl_image_get_median_window cpl_image_get_min_window cpl_image_get_size_x cpl_image_get_size_y cpl_image_get_sqflux_window cpl_image_get_stdev_window cpl_image_iqe cpl_image_is_rejected cpl_imagelist_collapse_minmax_create cpl_imagelist_dump_window cpl_imagelist_get cpl_imagelist_get_const cpl_imagelist_get_size cpl_imagelist_load cpl_imagelist_load_frameset cpl_imagelist_load_window cpl_imagelist_set cpl_imagelist_unset cpl_image_load cpl_image_load_window cpl_image_new cpl_image_rebin cpl_image_reject cpl_image_set cpl_image_set_complex cpl_image_shift cpl_image_wrap cpl_image_wrap_double cpl_image_wrap_double_complex cpl_image_wrap_float cpl_image_wrap_float_complex cpl_image_wrap_int cpl_mask_copy cpl_mask_count cpl_mask_count_window cpl_mask_dump_window cpl_mask_extract cpl_mask_extract_subsample cpl_mask_get cpl_mask_get_size_x cpl_mask_get_size_y cpl_mask_is_empty_window cpl_mask_load cpl_mask_load_window cpl_mask_new cpl_mask_set cpl_mask_shift cpl_mask_wrap cpl_matrix_copy cpl_matrix_erase_columns cpl_matrix_erase_rows cpl_matrix_extract cpl_matrix_extract_column cpl_matrix_extract_diagonal cpl_matrix_extract_row cpl_matrix_fill_column cpl_matrix_fill_diagonal cpl_matrix_fill_row cpl_matrix_fill_window cpl_matrix_get cpl_matrix_get_ncol cpl_matrix_get_nrow cpl_matrix_new cpl_matrix_resize cpl_matrix_set cpl_matrix_set_size cpl_matrix_shift cpl_matrix_swap_columns cpl_matrix_swap_rowcolumn cpl_matrix_swap_rows cpl_matrix_wrap cpl_parameterlist_get_size cpl_plot_bivectors cpl_plot_columns cpl_plot_image_col cpl_plot_image_row cpl_plot_vectors cpl_polynomial_derivative cpl_polynomial_extract cpl_polynomial_fit_1d_create cpl_polynomial_fit_2d_create cpl_polynomial_get_degree cpl_polynomial_get_dimension cpl_polynomial_new cpl_polynomial_shift_1d cpl_polynomial_solve_1d cpl_property_get_size cpl_propertylist_load cpl_propertylist_load_regexp cpl_property_new_array cpl_recipeconfig_get_min_count cpl_recipeconfig_get_max_count cpl_recipeconfig_set_tag cpl_recipeconfig_set_input cpl_stats_get_max_x cpl_stats_get_max_y cpl_stats_get_min_x cpl_stats_get_min_y cpl_stats_get_npix cpl_stats_new_from_image_window cpl_table_and_selected cpl_table_and_selected_double cpl_table_and_selected_double_complex cpl_table_and_selected_float cpl_table_and_selected_float_complex cpl_table_and_selected_int cpl_table_and_selected_invalid cpl_table_and_selected_string cpl_table_and_selected_window cpl_table_count_invalid cpl_table_count_selected cpl_table_dump cpl_table_erase_window cpl_table_extract cpl_table_fill_column_window cpl_table_fill_column_window_array cpl_table_fill_column_window_complex cpl_table_fill_column_window_double cpl_table_fill_column_window_double_complex cpl_table_fill_column_window_float cpl_table_fill_column_window_float_complex cpl_table_fill_column_window_int cpl_table_fill_column_window_string cpl_table_get cpl_table_get_array cpl_table_get_column_depth cpl_table_get_column_dimension cpl_table_get_column_dimensions cpl_table_get_complex cpl_table_get_double cpl_table_get_double_complex cpl_table_get_float cpl_table_get_float_complex cpl_table_get_int cpl_table_get_ncol cpl_table_get_nrow cpl_table_get_string cpl_table_insert cpl_table_insert_window cpl_table_is_selected cpl_table_is_valid cpl_table_load_window cpl_table_new cpl_table_new_column_array cpl_table_not_selected cpl_table_or_selected cpl_table_or_selected_double cpl_table_or_selected_double_complex cpl_table_or_selected_float cpl_table_or_selected_float_complex cpl_table_or_selected_int cpl_table_or_selected_invalid cpl_table_or_selected_string cpl_table_or_selected_window cpl_table_select_row cpl_table_set cpl_table_set_array cpl_table_set_column_depth cpl_table_set_column_invalid cpl_table_set_complex cpl_table_set_double cpl_table_set_double_complex cpl_table_set_float cpl_table_set_float_complex cpl_table_set_int cpl_table_set_invalid cpl_table_set_size cpl_table_set_string cpl_table_shift_column cpl_table_unselect_row cpl_table_where_selected cpl_test_end cpl_test_eq_macro cpl_test_macro cpl_test_noneq_macro cpl_vector_correlate cpl_vector_extract cpl_vector_filter_lowpass_create cpl_vector_filter_median_create cpl_vector_find cpl_vector_get cpl_vector_get_size cpl_vector_load cpl_vector_new cpl_vector_new_from_image_column cpl_vector_new_from_image_row cpl_vector_set cpl_vector_set_size cpl_vector_wrap - Functions with changed API (Parameter redeclaration to cpl_type) Any call to one of the below functions must at least be recompiled, or better modified according to the new API cpl_dfs_save_image cpl_dfs_save_imagelist cpl_image_save cpl_imagelist_save - The release fixes the following bugs The use of an unnamed OpenMP critical section cpl_init() segfaults with OpenMP if OMP_NUM_THREADS is undefined cpl_fit_imagelist_polynomial() SIGABRT on complex input cpl_image_filter(), cpl_image_filter_mask(): Error handling bug cpl_imagelist_collapse_sigclip_create(): Nothing is rejected cpl_image_get_complex(): NULL input dereferenced cpl_geom_img_offset_combine(): Input imagelist is now const - The release fixes the following documentation errors Missing doxygen for cpl_stats modes, CPL_STATS_* cpl_dfs_save_propertylist: applist is no longer optional cpl_dfs_save_imagelist: applist is no longer optional cpl_dfs_save_table: applist is no longer optional What's new in CPL 5.2 ============================================ - New functions in CPL 5.2: cpl_array_cast() cpl_mask_filter() cpl_plot_mask() cpl_image_unset_bpm() - New functionality: cpl_table_cast_column() allows casting from array columns of depth one to plain columns, and viceversa. - Bug fixes: Casting table columns of type array to columns of type array. cpl_table_save() returns in case of ILLEGAL_OUTPUT caused by zero depth integer array columns; allocate empty integer arrays in case they must be written to file. cpl_image_new_from_accepted(): Older versions would force the creation of an empty bad pixel map in any image in the input image list, that did not already have one. cpl_detector_interpolate_rejected(): Older versions would use wrong interpolation values at the image border. cpl_wcs_platesol(): All previous versions computes a wrong solution. cpl_bivector_interpolate_linear(): Versions from 4.2.0 interpolates the first value wrongly. cpl_stats_dump(): Older versions do not dump median deviation cpl_geom_img_offset_combine(): Older versions would use the error code CPL_ERROR_ILLEGAL_OUTPUT instead of CPL_ERROR_DATA_NOT_FOUND. cpl_dfs_update_product_header(): Older versions would not work if the system macro L2_CACHE_BYTES was defined to 0. cpl_end(): Free any memory allocated internally by FFTW. cpl_vector_find(): Fail on non-sorted vector elements. - Deprecated functions cpl_mask_closing(): Use cpl_mask_filter() instead cpl_mask_opening(): Use cpl_mask_filter() instead cpl_mask_erosion(): Use cpl_mask_filter() instead cpl_mask_dilation(): Use cpl_mask_filter() instead - Doc fixes: Specify that all arrays in a column must have same length Complete doc of cpl_table_set_array() Fix wrong LaTex code in cpl_fit_image_gaussian() doc. Document that cpl_geom_img_offset_saa() handles bad pixels. The pixel indexing convention ((1,1) for lower left) is documented. The deprecated CPL functions are clearly documented as such. What's new in CPL 5.1 ============================================ - New functions in CPL 5.1 cpl_array_is_valid cpl_array_dump_structure cpl_array_dump cpl_fit_image_gaussian cpl_flux_get_bias_window cpl_mask_dump_window cpl_propertylist_append_property cpl_propertylist_prepend_property cpl_propertylist_insert_property cpl_propertylist_insert_after_property cpl_test_array_abs cpl_test_eq_error cpl_test_eq_ptr cpl_test_get_cputime cpl_test_get_walltime cpl_test_imagelist_abs cpl_test_noneq_ptr cpl_test_vector_abs - New function modes in CPL 5.1. CPL_IO_APPEND - Deprecated functions cpl_image_fit_gaussian: Use cpl_fit_image_gaussian instead. - Other Changes CPL functions with complex types in their API are only available (declared) when the CPL-based application #include's . The functions effected by this are: cpl_image_wrap_double_complex cpl_image_wrap_float_complex cpl_image_get_complex cpl_image_set_complex cpl_image_get_data_double_complex cpl_image_get_data_double_complex_const cpl_image_get_data_float_complex cpl_image_get_data_float_complex_const - Bug fixes The filtering mode CPL_FILTER_STDEV had a bug which could cause wrong outputs. This has been fixed. - Known Problems CPL release 5.1 (and all releases back to and including 4.1) has a documentation bug in both cpl_image_turn() and cpl_mask_turn(). The orientation of the rotation is opposite of what is stated in the documentation. Given a rotation of 1, the function will rotate by 90 degrees clockwise and given a rotation of -1 the function will rotate by 90 degrees counterclockwise. The documentation of rotation by any odd number is similarly wrong. The documentation of rotation by any even number is unaffected by the error. What's new in CPL 5.0 ============================================ - Deprecated functions. A number of functions are now deprecated. The deprecated functions will remain in CPL 5.X. The deprecated functions are: cpl_fits_get_nb_extensions cpl_fits_get_extension_nb cpl_image_filter_median cpl_image_filter_linear cpl_image_filter_stdev cpl_image_filter_morpho cpl_msg_progress cpl_polynomial_fit_1d_create cpl_polynomial_fit_2d_create cpl_vector_new_lss_kernel cpl_vector_convolve_symmetric - Warnings of use of deprecated functions. Using gcc to compile code using the above mentioned functions will lead to compiler warnings. These warnings can be suppressed with -Wno-deprecated-declarations. This gcc option can be applied with ./configure CFLAGS=-Wno-deprecated-declarations . - Functions with changed API cpl_dfs_save_image cpl_dfs_save_table cpl_dfs_save_propertylist cpl_dfs_save_imagelist cpl_dfs_setup_product_header cpl_geom_img_offset_saa cpl_propertylist_erase_regexp cpl_image_get_bpm_const cpl_polynomial_shift_1d cpl_imagelist_collapse_sigclip_create - How to replace deprecated functions cpl_fits_get_nb_extensions: Replace with cpl_fits_count_extensions cpl_fits_get_extension_nb: Replace with cpl_fits_find_extension cpl_image_filter_median: cpl_image * a = cpl_image_filter_median(b, k) can be replaced by int nx = cpl_image_get_size_x(b); int ny = cpl_image_get_size_y(b); int type = cpl_image_type(b); cpl_image * a = cpl_image_new(nx, ny, type); cpl_image_filter_mask(a, b, m, CPL_FILTER_MEDIAN, CPL_BORDER_FILTER); - where m is a cpl_mask with a CPL_BINARY_1 whereever k has a 1.0. cpl_image_filter_stdev: Same as for cpl_image_filter_median, but with CPL_FILTER_STDEV cpl_image_filter_linear: cpl_image * a = cpl_image_filter_linear(b, k) can be replaced by int nx = cpl_image_get_size_x(b); int ny = cpl_image_get_size_y(b); int type = cpl_image_type(b); cpl_image * a = cpl_image_new(nx, ny, type); cpl_image_filter(a, b, k, CPL_FILTER_LINEAR, CPL_BORDER_FILTER); - where m is the cpl_matrix with the weights. cpl_image_filter_morpho: Same as for cpl_image_filter_linear, but with CPL_FILTER_MORPHO cpl_polynomial_fit_1d_create: cpl_polynomial * fit1d = cpl_polynomial_fit_1d_create(x_pos, values, degree, mse); can be replaced by cpl_polynomial * fit1d = cpl_polynomial_new(1); cpl_matrix * samppos = cpl_matrix_wrap(1, cpl_vector_get_size(x_pos), cpl_vector_get_data(x_pos)); cpl_vector * fitresidual = cpl_vector_new(cpl_vector_get_size(x_pos)); cpl_polynomial_fit(fit1d, samppos, NULL, values, NULL, CPL_FALSE, NULL, °ree); cpl_vector_fill_polynomial_fit_residual(fitresidual, values, NULL, fit1d, samppos, NULL); cpl_matrix_unwrap(samppos); mse = cpl_vector_product(fitresidual, fitresidual) / cpl_vector_get_size(fitresidual); cpl_vector_delete(fitresidual); cpl_polynomial_fit_2d_create: Similar to 1D, and the samppos matrix must have two rows with copies of the two vectors in the x_pos bivector. cpl_msg_progress: This function has no CPL 5.X equivalent cpl_vector_new_lss_kernel: This function has no CPL 5.X equivalent cpl_vector_convolve_symmetric: This function has no CPL 5.X equivalent - How to change the calls to functions with new prototypes cpl_dfs_save_image(allframes, parlist, usedframes, image, bpp, recipe, procat, applist, remregexp, pipe_id, filename); can be replaced with: cpl_propertylist * prolist = applist ? cpl_propertylist_duplicate(applist) : cpl_propertylist_new(); cpl_propertylist_append_string(prolist, CPL_DFS_PRO_CATG, procat); cpl_dfs_save_image(allframes, NULL, parlist, usedframes, NULL, image, bpp, recipe, prolist, remregexp, pipe_id, filename); cpl_propertylist_delete(prolist); cpl_dfs_save_table: See cpl_dfs_save_image cpl_dfs_save_propertylist: See cpl_dfs_save_image cpl_dfs_save_imagelist: See cpl_dfs_save_image cpl_dfs_setup_product_header: Append a NULL pointer to the argument list, cpl_geom_img_offset_saa: : Append two NULL pointers to the argument list, cpl_propertylist_erase_regexp: In case of error, the return value is now -1 instead of 0. cpl_image_get_bpm_const: The function will now return NULL if the image does not have a bad pixel map, meaning no pixels are bad. If the input image is guaranteed to have a bad pixel map, then no change is needed. Otherwise, if the bad pixel map must be modified the call should be replaced with cpl_image_get_bpm(). If the bad pixel map will not be modified i.e. only read, then a NULL value indicates that no pixels are bad. This can be used both to determine if a pixel map exists for the image, and to choose faster methods when no pixels are bad. cpl_polynomial_shift_1d: Insert a 0 between the current two parameters. cpl_imagelist_collapse_sigclip_create: Extend the argument list with 0.0, 1.0, 1, NULL. - New functions in CPL cpl_image_filter_xyz cpl_fits_count_extensions cpl_fits_find_extension cpl_array_get_max cpl_array_get_min cpl_array_get_maxpos cpl_array_get_minpos cpl_array_get_mean cpl_array_get_median cpl_array_get_stdev cpl_array_extract cpl_array_insert_window cpl_array_erase_window cpl_array_insert cpl_array_add cpl_array_subtract cpl_array_multiply cpl_array_divide cpl_array_add_scalar cpl_array_subtract_scalar cpl_array_multiply_scalar cpl_array_divide_scalar cpl_array_set_size cpl_image_rebin cpl_image_fill_jacobian cpl_image_fill_jacobian_polynomial cpl_array_power cpl_array_abs cpl_array_logarithm cpl_array_exponential cpl_table_where_selected cpl_table_set_column_savetype cpl_image_wrap_double_complex cpl_image_wrap_float_complex cpl_image_get_data_double_complex cpl_image_get_data_double_complex_const cpl_image_get_data_float_complex cpl_image_get_data_float_complex_const cpl_image_get_complex cpl_image_set_complex - New types CPL_TYPE_DOUBLE_COMPLEX and CPL_TYPE_FLOAT_COMPLEX These 2 types are now supported for a limited set of image functions: cpl_image_new cpl_image_add cpl_image_subtract cpl_image_multiply cpl_image_divide cpl_image_add_create cpl_image_subtract_create cpl_image_multiply_create cpl_image_divide_create cpl_image_cast cpl_image_fill_rejected cpl_image_dump_window cpl_image_extract The purpose of the inclusion of these new types is to ease operations with the FFTW library on CPL images. With these new types, there is no need to remap the input pixel buffer before calling FFTW. Example (with FFTW 2.1.5): cpl_image * in = cpl_image_new(nx, ny, CPL_TYPE_FLOAT); cpl_image * out = cpl_image_new(nx, ny, CPL_TYPE_FLOAT_COMPLEX); float * in_b = cpl_image_get_data_float(in); float complex * out_b = cpl_image_get_data_float_complex(out); fftwnd_plan rp = rfftw2d_create_plan(nx, ny, FFTW_FORWARD, FFTW_ESTIMATE); cpl_image_fill_noise_uniform(in, 0.0, 10.0); rfftwnd_real_to_complex(rp, 1, (fftw_real *)in_b, 1, nx * ny, (fftw_complex *)out_b, 1, nx * ny); my_frequency_processing(out); cpl-6.4.1/cpldfs/0000755000460300003120000000000012310333012010531 500000000000000cpl-6.4.1/cpldfs/md5.c0000644000460300003120000002516012243372017011323 00000000000000/* $Id: md5.c,v 1.7 2013-07-22 14:55:50 llundin Exp $ * * This file is part of the ESO CPL Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-07-22 14:55:50 $ * $Revision: 1.7 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include "md5.h" /*----------------------------------------------------------------------------- Private Function prototypes -----------------------------------------------------------------------------*/ static void MD5Transform(word32 buf[4], word32 const in[16]) CPL_ATTR_NONNULL; #if defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN != 0 inline static void byteReverse(unsigned char * restrict buf, unsigned longs) CPL_ATTR_NONNULL; #else #define byteReverse(BUF, LONGS) /* Do nothing */ #endif /* This code is in the public domain */ /* Each function has been redeclared so: 1) each array argument is now a restricted pointer 2) the nonnull attribute is used when available 3) it is static (the whole md5.c code is included in the single source code file where it is used) And finally in MD5Final(): 4) the assignments causing a strict-aliasing warning have been rewritten 5) The widely noticed sizeof bug in the "In case it's sensitive" memset() has been fixed */ /*----------------------------------------------------------------------------*/ /** * 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 MD5Init, call MD5Update as needed on buffers full of * bytes, and then call MD5Final, which will fill a supplied 16-byte array with * the digest. */ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /* * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ static void MD5Init(struct MD5Context * restrict ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; ctx->buf[2] = 0x98badcfe; ctx->buf[3] = 0x10325476; ctx->bits[0] = 0; ctx->bits[1] = 0; } /* * Update context to reflect the concatenation of another buffer full * of bytes. */ static void MD5Update(struct MD5Context * restrict ctx, unsigned char const * restrict buf, unsigned len) { register word32 t; /* Update bitcount */ t = ctx->bits[0]; if ((ctx->bits[0] = t + ((word32) 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); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (word32 *) ctx->in); buf += t; len -= t; } /* Process data in 64-byte chunks */ while (len >= 64) { memcpy(ctx->in, buf, 64); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (word32 *) 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 MD5Final(unsigned char * restrict digest, struct MD5Context * restrict ctx) { unsigned int 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); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (word32 *) 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); } byteReverse(ctx->in, 14); /* Append length in bits and transform */ /* Change the original assigments to avoid the gcc-4.8.1 warning: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] */ (void)memcpy(ctx->in + 56, ctx->bits, 8); MD5Transform(ctx->buf, (word32 *) ctx->in); byteReverse((unsigned char *) ctx->buf, 4); memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } /* 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<>(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. MD5Update blocks * the data and converts bytes into longwords for this routine. */ static void MD5Transform(word32 buf[4], word32 const in[16]) { register word32 a, b, c, d; a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } #if defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN != 0 inline static void byteReverse(unsigned char * restrict buf, unsigned longs) { word32 t; do { t = (word32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | ((unsigned) buf[1] << 8 | buf[0]); *(word32 *) buf = t; buf += 4; } while (--longs); } #endif cpl-6.4.1/cpldfs/cpl_dfs.c0000644000460300003120000024015512277166746012274 00000000000000/* $Id: cpl_dfs.c,v 1.138 2013-10-21 07:57:46 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-10-21 07:57:46 $ * $Revision: 1.138 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include "cpl_dfs.h" #include #include #include #include #include /** * @defgroup cpl_dfs DFS related functions * */ /*----------------------------------------------------------------------------- Defines and Static variables -----------------------------------------------------------------------------*/ /* * Product keywords aliases */ #define DATAMD5 "DATAMD5" #define PIPEFILE "PIPEFILE" #define PRO_DID "ESO PRO DID" #define DPR_CATG "ESO DPR CATG" #define PRO_CATG CPL_DFS_PRO_CATG #define PRO_TYPE CPL_DFS_PRO_TYPE #define DPR_TECH "ESO DPR TECH" #define PRO_TECH CPL_DFS_PRO_TECH #define PRO_SCIENCE CPL_DFS_PRO_SCIENCE #define PRO_DATE "ESO PRO DATE" #define PRO_DATANCOM "ESO PRO DATANCOM" #define PRO_REC_ID "ESO PRO REC1 ID" #define PRO_REC_DRS_ID "ESO PRO REC1 DRS ID" #define PRO_REC_PIPE_ID "ESO PRO REC1 PIPE ID" #define PRO_REC_RAWi_NAME "ESO PRO REC1 RAW%d NAME" #define PRO_REC_RAWi_CATG "ESO PRO REC1 RAW%d CATG" #define PRO_REC_CALi_NAME "ESO PRO REC1 CAL%d NAME" #define PRO_REC_CALi_CATG "ESO PRO REC1 CAL%d CATG" #define PRO_REC_CALi_DATAMD5 "ESO PRO REC1 CAL%d " DATAMD5 #define PRO_REC_PARAMi_NAME "ESO PRO REC1 PARAM%d NAME" #define PRO_REC_PARAMi_VALUE "ESO PRO REC1 PARAM%d VALUE" #define MAX_PLENGTH (64) /* Size of a 128-bit MD5 hash in bytes */ #define MD5HASHSZ 32 /* Use at least this many places when printing the PAF key */ #define PAF_KEY_LEN 21 /* Right justify the PAF key and separate with an extra space */ #define PAF_KEY_FORMAT "%-21s " /* Support for MD5 sums for large files and CFITSIO 3.X/2.51 */ /* OFF_T causes trouble with -std=c99, so avoid it when possible */ #ifdef fits_get_hduaddrll #define CPL_OFF_FUNC fits_get_hduaddrll #define CPL_OFF_TYPE LONGLONG #else #define CPL_OFF_FUNC fits_get_hduoff #define CPL_OFF_TYPE OFF_T #endif #define CPL_DFS_PRO_DID "PRO-1.15" /*----------------------------------------------------------------------------- * Private function prototypes *----------------------------------------------------------------------------- */ /**@{*/ #ifdef HAVE_OPENSSL #include #else /* Declarations of static MD5 functions */ #include "md5.h" #endif #if defined CFITSIO_MAJOR && (CFITSIO_MAJOR > 3 || CFITSIO_MINOR >= 26) /* Not needed from 3.26 */ #else static char * cpl_dfs_extract_printable(const char *) CPL_ATTR_ALLOC; #endif static cpl_error_code cpl_dfs_update_product_header_(cpl_frameset *); static char * cpl_dfs_find_md5sum(fitsfile *) CPL_ATTR_ALLOC; static int cpl_is_fits(const char *); static const char *cpl_get_base_name(const char *) CPL_ATTR_PURE; static FILE * cpl_dfs_paf_init(const char *, const char *, const char *); static cpl_error_code cpl_dfs_paf_dump(const cpl_propertylist *, FILE *); static cpl_error_code cpl_dfs_paf_dump_string(const char *, const char *, const char *, FILE *); static cpl_error_code cpl_dfs_paf_dump_double(const char *, double, const char *, FILE *); static cpl_error_code cpl_dfs_paf_dump_int(const char *, cpl_size, const char *, FILE *); static cpl_error_code cpl_dfs_product_save(cpl_frameset *, cpl_propertylist *, const cpl_parameterlist *, const cpl_frameset *, const cpl_frame *, const cpl_imagelist *, const cpl_image *, cpl_type, const cpl_table *, const cpl_propertylist *, const char *, const cpl_propertylist *, const char *, const char *, const char *); /*----------------------------------------------------------------------------- * Function code *----------------------------------------------------------------------------- */ /*----------------------------------------------------------------------------*/ /** @brief Save an image as a DFS-compliant pipeline product @param allframes The list of input frames for the recipe @param header NULL, or filled with properties written to product header @param parlist The list of input parameters @param usedframes The list of raw/calibration frames used for this product @param inherit NULL or product frames inherit their header from this frame @param image The image to be saved @param type The type used to represent the data in the file @param recipe The recipe name @param applist Propertylist to append to primary header, w. PRO.CATG @param remregexp Optional regexp of properties not to put in main header @param pipe_id PACKAGE "/" PACKAGE_VERSION @param filename Filename of created product @note The image may be NULL in which case only the header information is saved but passing a NULL image is deprecated, use cpl_dfs_save_propertylist(). @note remregexp may be NULL @note applist must contain a string-property with key CPL_DFS_PRO_CATG @note On success and iff header is non-NULL, it will be emptied and then filled with the properties written to the primary header of the product @return CPL_ERROR_NONE or the relevant CPL error code on error @see cpl_dfs_setup_product_header(), cpl_image_save(). The FITS header of the created product is created from the provided applist and the cards copied by cpl_dfs_setup_product_header(), with exception of the cards whose keys match the provided remregexp. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_dfs_save_image(cpl_frameset * allframes, cpl_propertylist * header, const cpl_parameterlist * parlist, const cpl_frameset * usedframes, const cpl_frame * inherit, const cpl_image * image, cpl_type type, const char * recipe, const cpl_propertylist * applist, const char * remregexp, const char * pipe_id, const char * filename) { return cpl_dfs_product_save(allframes, header, parlist, usedframes, inherit, NULL, image, type, NULL, NULL, recipe, applist, remregexp, pipe_id, filename) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Save a propertylist as a DFS-compliant pipeline product @param allframes The list of input frames for the recipe @param header NULL, or filled with properties written to product header @param parlist The list of input parameters @param usedframes The list of raw/calibration frames used for this product @param inherit NULL or product frames inherit their header from this frame @param recipe The recipe name @param applist Propertylist to append to primary header, w. PRO.CATG @param remregexp Optional regexp of properties not to put in main header @param pipe_id PACKAGE "/" PACKAGE_VERSION @param filename Filename of created product @note remregexp may be NULL @return CPL_ERROR_NONE or the relevant CPL error code on error @see cpl_dfs_image_save(), cpl_propertylistlist_save(). The FITS header of the created product is created from the provided applist and the cards copied by cpl_dfs_setup_product_header(), with exception of the cards whose keys match the provided remregexp. The FITS data unit will be empty. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_dfs_save_propertylist(cpl_frameset * allframes, cpl_propertylist * header, const cpl_parameterlist * parlist, const cpl_frameset * usedframes, const cpl_frame * inherit, const char * recipe, const cpl_propertylist * applist, const char * remregexp, const char * pipe_id, const char * filename) { /* Use CPL_TYPE_INVALID to ensure it is not referenced */ return cpl_dfs_product_save(allframes, header, parlist, usedframes, inherit, NULL, NULL, CPL_TYPE_INVALID, NULL, NULL, recipe, applist, remregexp, pipe_id, filename) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Save an imagelist as a DFS-compliant pipeline product @param allframes The list of input frames for the recipe @param header NULL, or filled with properties written to product header @param parlist The list of input parameters @param usedframes The list of raw/calibration frames used for this product @param inherit NULL or product frames inherit their header from this frame @param imagelist The imagelist to be saved @param type The type used to represent the data in the file @param recipe The recipe name @param applist Propertylist to append to primary header, w. PRO.CATG @param remregexp Optional regexp of properties not to put in main header @param pipe_id PACKAGE "/" PACKAGE_VERSION @param filename Filename of created product @note remregexp may be NULL @return CPL_ERROR_NONE or the relevant CPL error code on error @see cpl_dfs_image_save(), cpl_imagelist_save(). */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_dfs_save_imagelist(cpl_frameset * allframes, cpl_propertylist * header, const cpl_parameterlist * parlist, const cpl_frameset * usedframes, const cpl_frame * inherit, const cpl_imagelist * imagelist, cpl_type type, const char * recipe, const cpl_propertylist * applist, const char * remregexp, const char * pipe_id, const char * filename) { cpl_ensure_code(imagelist != NULL, CPL_ERROR_NULL_INPUT); return cpl_dfs_product_save(allframes, header, parlist, usedframes, inherit, imagelist, NULL, type, NULL, NULL, recipe, applist, remregexp, pipe_id, filename) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Save a table as a DFS-compliant pipeline product @param allframes The list of input frames for the recipe @param header NULL, or filled with properties written to product header @param parlist The list of input parameters @param usedframes The list of raw/calibration frames used for this product @param inherit NULL or product frames inherit their header from this frame @param table The table to be saved @param tablelist Optional propertylist to use in table extension or NULL @param recipe The recipe name @param applist Propertylist to append to primary header, w. PRO.CATG @param remregexp Optional regexp of properties not to put in main header @param pipe_id PACKAGE "/" PACKAGE_VERSION @param filename Filename of created product @return CPL_ERROR_NONE or the relevant CPL error code on error @see cpl_dfs_save_image(), cpl_table_save(). */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_dfs_save_table(cpl_frameset * allframes, cpl_propertylist * header, const cpl_parameterlist * parlist, const cpl_frameset * usedframes, const cpl_frame * inherit, const cpl_table * table, const cpl_propertylist * tablelist, const char * recipe, const cpl_propertylist * applist, const char * remregexp, const char * pipe_id, const char * filename) { cpl_ensure_code(table != NULL, CPL_ERROR_NULL_INPUT); /* Use CPL_TYPE_INVALID to ensure it is not referenced */ return cpl_dfs_product_save(allframes, header, parlist, usedframes, inherit, NULL, NULL, CPL_TYPE_INVALID, table, tablelist, recipe, applist, remregexp, pipe_id, filename) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Create a new PAF file @param instrume Name of instrument in capitals (NACO, VISIR, etc.) @param recipe Name of recipe @param paflist Propertylist to save @param filename Filename of created PArameter File @return CPL_ERROR_NONE or the relevant CPL error code on error @see cpl_dfs_save_image(). The example below shows how to create a PAF from some FITS cards from the file ref_file and QC parameters in a propertylist qclist. Please note that qclist can be used also in calls to cpl_dfs_save_image() and cpl_dfs_save_table(). Error handling is omitted for brevity: @code const char pafcopy[] = "^(DATE-OBS|ARCFILE|ESO TPL ID|ESO DET DIT|MJD-OBS)$"; cpl_propertylist * paflist = cpl_propertylist_load_regexp(ref_file, 0, pafcopy, 0); cpl_propertylist_append(paflist, qclist); cpl_dfs_save_paf("IIINSTRUMENT", "rrrecipe", paflist, "rrrecipe.paf"); cpl_propertylist_delete(paflist); @endcode */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_dfs_save_paf(const char * instrume, const char *recipe, const cpl_propertylist * paflist, const char * filename) { FILE * paf; cpl_error_code status; cpl_ensure_code(instrume != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(recipe != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(paflist != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(filename != NULL, CPL_ERROR_NULL_INPUT); paf = cpl_dfs_paf_init(instrume, recipe, filename); cpl_ensure_code(paf != NULL, cpl_error_get_code()); status = cpl_dfs_paf_dump(paflist, paf); if (status == CPL_ERROR_NONE && fprintf(paf, "\n") != 1) status = CPL_ERROR_FILE_IO; if (status == CPL_ERROR_NONE) { cpl_ensure_code(fclose(paf) == 0, CPL_ERROR_FILE_IO); } else { (void)fclose(paf); } return status; } /** * @brief Add product keywords to a pipeline product property list. * * @param header Property list where keywords must be written * @param product_frame Frame describing the product * @param framelist List of frames including all input frames * @param parlist Recipe parameter list * @param recid Recipe name * @param pipeline_id Pipeline unique identifier * @param dictionary_id PRO dictionary identifier * @param inherit_frame Frame from which header information is inherited * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * An input pointer is NULL. *
CPL_ERROR_DATA_NOT_FOUND * The input framelist contains no input frames or * a frame in the input framelist does not specify a file. * In the former case the string "Empty set-of-frames" is appended * to the error message returned by cpl_error_get_message(). *
CPL_ERROR_ILLEGAL_INPUT * The product frame is not tagged or not grouped * as CPL_FRAME_GROUP_PRODUCT. * A specified @em inherit_frame doesn't belong to the input frame * list, or it is not in FITS format. *
CPL_ERROR_FILE_NOT_FOUND * A frame in the input framelist specifies a non-existing file. *
CPL_ERROR_BAD_FILE_FORMAT * A frame in the input framelist specifies an invalid file. *
* @enderror * * This function checks the @em header associated to a pipeline product, * to ensure that it is DICB compliant. In particular, this function does * the following: * * -# Selects a reference frame from which the primary and secondary * keyword information is inherited. The primary information is * contained in the FITS keywords ORIGIN, TELESCOPE, INSTRUME, * OBJECT, RA, DEC, EPOCH, EQUINOX, RADECSYS, DATE-OBS, MJD-OBS, * UTC, LST, PI-COI, OBSERVER, while the secondary information is * contained in all the other keywords. If the @em inherit_frame * is just a NULL pointer, both primary and secondary information * is inherited from the first frame in the input framelist with * group CPL_FRAME_GROUP_RAW, or if no such frames are present * the first frame with group CPL_FRAME_GROUP_CALIB. * If @em inherit_frame is non-NULL, the secondary information * is inherited from @em inherit_frame instead. * * -# Copy to @em header, if they are present, the following primary * FITS keywords from the first input frame in the @em framelist: * ORIGIN, TELESCOPE, INSTRUME, OBJECT, RA, DEC, EPOCH, EQUINOX, * RADECSYS, DATE-OBS, MJD-OBS, UTC, LST, PI-COI, OBSERVER. If those * keywords are already present in the @em header property list, they * are overwritten only in case they have the same type. If any of * these keywords are present with an unexpected type, a warning is * issued, but the keywords are copied anyway (provided that the * above conditions are fulfilled), and no error is set. * * -# Copy all the HIERARCH.ESO._ keywords from the primary FITS header * of the @em inherit_frame in @em framelist, with the exception of * the HIERARCH.ESO.DPR._, and of the .PRO._ and .DRS._ keywords if * the @em inherit_frame is a calibration. If those keywords are * already present in @em header, they are overwritten. * * -# If found, remove the HIERARCH.ESO.DPR._ keywords from @em header. * * -# If found, remove the ARCFILE and ORIGFILE keywords from @em header. * * -# Add to @em header the following mandatory keywords from the PRO * dictionary: PIPEFILE, PRO.DID, PRO.REC1.ID, PRO.REC1.DRS.ID, * PRO.REC1.PIPE.ID, and PRO.CATG. If those keywords are already * present in @em header, they are overwritten. The keyword * PRO.CATG is always set identical to the tag in @em product_frame. * * -# Only if missing, add to @em header the following mandatory keywords * from the PRO dictionary: PRO.TYPE, PRO.TECH, and PRO.SCIENCE. * The keyword PRO.TYPE will be set to "REDUCED". If the keyword * DPR.TECH is found in the header of the first frame, PRO.TECH is * given its value, alternatively if the keyword PRO.TECH is found * it is copied instead, and if all fails the value "UNDEFINED" is * set. Finally, if the keyword DPR.CATG is found in the header of * the first frame and is set to "SCIENCE", the boolean keyword * PRO.SCIENCE will be set to "true", otherwise it will be copied * from an existing PRO.SCIENCE jeyword, while it will be set to * "false" in all other cases. * * -# Check the existence of the keyword PRO.DATANCOM in @em header. If * this keyword is missing, one is added, with the value of the total * number of raw input frames. * * -# Add to @em header the keywords PRO.REC1.RAW1.NAME, PRO.REC1.RAW1.CATG, * PRO.REC1.CAL1.NAME, PRO.REC1.CAL1.CATG, to describe the content of * the input set-of-frames. * * See the DICB PRO dictionary to have details on the mentioned PRO keywords. * * @note * Non-FITS files are handled as files with an empty FITS header. */ cpl_error_code cpl_dfs_setup_product_header(cpl_propertylist *header, const cpl_frame *product_frame, const cpl_frameset *framelist, const cpl_parameterlist *parlist, const char *recid, const char *pipeline_id, const char *dictionary_id, const cpl_frame *inherit_frame) { char cval[FLEN_VALUE]; const char *datamd5; const cpl_frame *frame; const cpl_frame *first_frame = NULL; cpl_frameset_iterator *it = NULL; cpl_propertylist *plist; const cpl_parameter *param; int nraw; int ncal; int npar; int i; const char *kname; /* * Here is the list of mandatory keywords, first in input header, * second in output _image_ header: */ typedef struct { const char *key; cpl_type type; } klist; klist mandatory[] = {{"ORIGIN", CPL_TYPE_STRING}, {"TELESCOP", CPL_TYPE_STRING}, {"INSTRUME", CPL_TYPE_STRING}, {"OBJECT", CPL_TYPE_STRING}, {"RA", CPL_TYPE_DOUBLE}, {"DEC", CPL_TYPE_DOUBLE}, {"EPOCH", CPL_TYPE_STRING}, {"EQUINOX", CPL_TYPE_DOUBLE}, {"RADECSYS", CPL_TYPE_STRING}, {"DATE-OBS", CPL_TYPE_STRING}, {"MJD-OBS", CPL_TYPE_DOUBLE}, {"UTC", CPL_TYPE_DOUBLE}, {"LST", CPL_TYPE_DOUBLE}, {"PI-COI", CPL_TYPE_STRING}, {"OBSERVER", CPL_TYPE_STRING}}; const int count_mandatory = (int)(sizeof(mandatory) / sizeof(klist)); int pro_science = 0; /* Here are the same keywords - as a regular expression */ #define REGMANDATORY "^(ORIGIN|TELESCOP|INSTRUME|OBJECT|RA|DEC|EPOCH|EQUINOX" \ "|RADECSYS|DATE-OBS|MJD-OBS|UTC|LST|PI-COI|OBSERVER)$" cpl_ensure_code(header != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(product_frame != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(framelist != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(recid != NULL, CPL_ERROR_NULL_INPUT); /* * Forbidden keywords are removed from product header. */ cpl_propertylist_erase_regexp(header, "^ESO DPR |^ARCFILE$|^ORIGFILE$|" "^CHECKSUM$|^DATASUM$", 0); /* * Get the first input frame in the input set-of-frames. */ it = cpl_frameset_iterator_new(framelist); frame = cpl_frameset_iterator_get_const(it); while (frame != NULL) { cpl_errorstate status; if (cpl_frame_get_group(frame) == CPL_FRAME_GROUP_RAW) { first_frame = frame; break; } status = cpl_errorstate_get(); cpl_frameset_iterator_advance(it, 1); if (cpl_error_get_code() == CPL_ERROR_ACCESS_OUT_OF_RANGE) { cpl_errorstate_set(status); } frame = cpl_frameset_iterator_get_const(it); } if (first_frame == NULL) { cpl_frameset_iterator_reset(it); frame = cpl_frameset_iterator_get_const(it); while (frame != NULL) { cpl_errorstate status; if (cpl_frame_get_group(frame) == CPL_FRAME_GROUP_CALIB) { first_frame = frame; break; } status = cpl_errorstate_get(); cpl_frameset_iterator_advance(it, 1); if (cpl_error_get_code() == CPL_ERROR_ACCESS_OUT_OF_RANGE) { cpl_errorstate_set(status); } frame = cpl_frameset_iterator_get_const(it); } } cpl_frameset_iterator_delete(it); it = NULL; if (first_frame == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "Empty set-of-frames"); } if (inherit_frame) { int iframe = 0; if (cpl_frame_get_filename(inherit_frame) == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "Inherit frame has no filename"); } it = cpl_frameset_iterator_new(framelist); frame = cpl_frameset_iterator_get_const(it); while (frame != NULL) { cpl_errorstate status; iframe++; if (cpl_frame_get_filename(frame) == NULL) { cpl_frameset_iterator_delete(it); return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "Frame " "%d/%d has no filename", iframe, (int)cpl_frameset_get_size (framelist)); } if (strcmp(cpl_frame_get_filename(frame), cpl_frame_get_filename(inherit_frame)) == 0) { break; } status = cpl_errorstate_get(); cpl_frameset_iterator_advance(it, 1); if (cpl_error_get_code() == CPL_ERROR_ACCESS_OUT_OF_RANGE) { cpl_errorstate_set(status); } frame = cpl_frameset_iterator_get_const(it); } cpl_frameset_iterator_delete(it); it = NULL; if (frame != NULL) { switch (cpl_is_fits(cpl_frame_get_filename(inherit_frame))) { case 0: return cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Cannot inherit information from non-FITS file"); case 1: break; default: return cpl_error_set_(CPL_ERROR_FILE_NOT_FOUND); } } else { return cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "The reference frame does not belong to the input set-of-frames"); } } else { inherit_frame = first_frame; } /* * Now copy all the required entries, if present, from input to * product header. */ switch (cpl_is_fits(cpl_frame_get_filename(first_frame))) { case 0: plist = cpl_propertylist_new(); break; case 1: /* Load only the mandatory keywords and the HIERACH ESO keywords */ if (first_frame == inherit_frame) { plist = cpl_propertylist_load_regexp( cpl_frame_get_filename(first_frame), 0, REGMANDATORY "|^ESO ", 0); cpl_ensure_code(plist != NULL, cpl_error_get_code()); } else { cpl_propertylist *plist2; plist = cpl_propertylist_load_regexp( cpl_frame_get_filename(first_frame), 0, REGMANDATORY, 0); cpl_ensure_code(plist != NULL, cpl_error_get_code()); plist2 = cpl_propertylist_load_regexp( cpl_frame_get_filename(inherit_frame), 0, "^ESO", 0); cpl_ensure_code(plist2 != NULL, cpl_error_get_code()); if (cpl_propertylist_copy_property_regexp(plist, plist2, "^ESO", 0)) { cpl_propertylist_delete(plist2); return cpl_error_set_where_(); } cpl_propertylist_delete(plist2); } break; default: return cpl_error_get_code() == CPL_ERROR_NULL_INPUT ? cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND) : cpl_error_set_where_(); } for (i = 0; i < count_mandatory; i++) { if (cpl_propertylist_has(plist, mandatory[i].key)) { if (cpl_propertylist_get_type(plist, mandatory[i].key) != mandatory[i].type) { cpl_msg_warning(cpl_func, "Unexpected type for keyword %s in " "input header", mandatory[i].key); } if (cpl_propertylist_has(header, mandatory[i].key)) { if (cpl_propertylist_get_type(header, mandatory[i].key) != mandatory[i].type) { cpl_msg_warning(cpl_func, "Unexpected type for keyword %s " "in output header", mandatory[i].key); } if (cpl_propertylist_get_type(plist, mandatory[i].key) != cpl_propertylist_get_type(header, mandatory[i].key)) { /* Do not copy this keyword */ cpl_propertylist_erase(plist, mandatory[i].key); } } } } /* * Here copy all the HIERARCH.ESO._ keywords, excluding the * HIERARCH.ESO.DPR._ .PRO._, .DRS._, and .QC._ keywords. */ /* Also copy the mandatory keywords, if any */ cpl_propertylist_copy_property_regexp(header, plist, "^ESO (DPR|DRS|PRO|QC) ", 1); cpl_propertylist_delete(plist); /* * DATAMD5 (placeholder: will be computed by esorex) */ cpl_propertylist_update_string(header, DATAMD5, "Not computed"); cpl_propertylist_set_comment(header, DATAMD5, "MD5 checksum"); /* * PIPEFILE */ kname = cpl_frame_get_filename(product_frame); cpl_ensure_code(kname != NULL, cpl_error_get_code()); cpl_propertylist_update_string(header, PIPEFILE, kname); cpl_propertylist_set_comment(header, PIPEFILE, "Filename of data product"); /* * PRO DID */ cpl_propertylist_update_string(header, PRO_DID, dictionary_id); cpl_propertylist_set_comment(header, PRO_DID, "Data dictionary for PRO"); /* * PRO CATG */ kname = cpl_frame_get_tag(product_frame); if (kname == NULL) { return cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Product frame has no tag"); } cpl_propertylist_update_string(header, PRO_CATG, kname); cpl_propertylist_set_comment(header, PRO_CATG, "Category of pipeline product frame"); /* The product frame must be grouped correctly */ cpl_ensure_code(cpl_frame_get_group(product_frame) == CPL_FRAME_GROUP_PRODUCT, CPL_ERROR_ILLEGAL_INPUT); /* * Load only the HIERACH ESO DPR keywords */ if (cpl_is_fits(cpl_frame_get_filename(first_frame))) { plist = cpl_propertylist_load_regexp( cpl_frame_get_filename(first_frame), 0, "^ESO DPR ", 0); cpl_ensure_code(plist != NULL, cpl_error_get_code()); } else plist = NULL; /* * PRO TYPE * Check presence of PRO.TYPE already provided in the input header: * leave it alone if present, provide a default if missing. */ if (!cpl_propertylist_has(header, PRO_TYPE)) { cpl_propertylist_update_string(header, PRO_TYPE, "REDUCED"); cpl_propertylist_set_comment(header, PRO_TYPE, "Product type"); } /* * PRO TECH * Check presence of PRO.TECH already provided in the input header: * leave it alone if present, copy it from the first frame DPR.TECH * if present there, copy from the first frame PRO.TECH if present * there, set a default "UNDEFINED" if missing even there. */ if (!cpl_propertylist_has(header, PRO_TECH)) { if (plist && cpl_propertylist_has(plist, DPR_TECH)) { cpl_propertylist_update_string(header, PRO_TECH, cpl_propertylist_get_string(plist, DPR_TECH)); } else if (plist && cpl_propertylist_has(plist, PRO_TECH)) { cpl_propertylist_update_string(header, PRO_TECH, cpl_propertylist_get_string(plist, PRO_TECH)); } else { cpl_propertylist_update_string(header, PRO_TECH, "UNDEFINED"); } cpl_propertylist_set_comment(header, PRO_TECH, "Observation technique"); } /* * PRO SCIENCE * Check presence of PRO.SCIENCE already provided in the input header: * leave it alone if present, set it to "true" if DPR.CATG from the * first frame is "SCIENCE", set it to the value of PRO.SCIENCE if * present, set it to "false" in all other cases. */ if (!cpl_propertylist_has(header, PRO_SCIENCE)) { if (plist && cpl_propertylist_has(plist, DPR_CATG)) { pro_science = !strncmp(cpl_propertylist_get_string(plist, DPR_CATG), "SCIENCE", 7); } else if (plist && cpl_propertylist_has(plist, PRO_SCIENCE)) { pro_science = cpl_propertylist_get_bool(plist, PRO_SCIENCE); } cpl_propertylist_update_bool(header, PRO_SCIENCE, pro_science); cpl_propertylist_set_comment(header, PRO_SCIENCE, "Scientific product if T"); } cpl_propertylist_delete(plist); /* * PRO REC1 ID */ cpl_propertylist_update_string(header, PRO_REC_ID, recid); cpl_propertylist_set_comment(header, PRO_REC_ID, "Pipeline recipe (unique) identifier"); /* * PRO REC1 DRS ID */ /* cpl_propertylist_update_string(header, PRO_REC_DRS_ID, cpl_get_version()); */ cpl_propertylist_update_string(header, PRO_REC_DRS_ID, PACKAGE "-" PACKAGE_VERSION); cpl_propertylist_set_comment(header, PRO_REC_DRS_ID, "Data Reduction System identifier"); /* * PRO REC1 PIPE ID */ /* snprintf(cval, FLEN_VALUE, "%s/%s", PACKAGE, PACKAGE_VERSION); */ cpl_propertylist_update_string(header, PRO_REC_PIPE_ID, pipeline_id); cpl_propertylist_set_comment(header, PRO_REC_PIPE_ID, "Pipeline (unique) identifier"); /* * PRO REC1 RAWi NAME and PRO REC1 RAWi CATG */ nraw = 0; it = cpl_frameset_iterator_new(framelist); frame = cpl_frameset_iterator_get_const(it); while (frame != NULL) { cpl_errorstate status; if (cpl_frame_get_group(frame) == CPL_FRAME_GROUP_RAW) { ++nraw; snprintf(cval, FLEN_VALUE, PRO_REC_RAWi_NAME, nraw); cpl_propertylist_update_string(header, cval, cpl_get_base_name(cpl_frame_get_filename(frame))); cpl_propertylist_set_comment(header, cval, "File name of raw frame"); snprintf(cval, FLEN_VALUE, PRO_REC_RAWi_CATG, nraw); cpl_propertylist_update_string(header, cval, cpl_frame_get_tag(frame)); cpl_propertylist_set_comment(header, cval, "Category of raw frame"); } status = cpl_errorstate_get(); cpl_frameset_iterator_advance(it, 1); if (cpl_error_get_code() == CPL_ERROR_ACCESS_OUT_OF_RANGE) { cpl_errorstate_set(status); } frame = cpl_frameset_iterator_get_const(it); } cpl_frameset_iterator_delete(it); it = NULL; /* * PRO DATANCOM */ if (!cpl_propertylist_has(header, PRO_DATANCOM)) { cpl_propertylist_update_int(header, PRO_DATANCOM, nraw); cpl_propertylist_set_comment(header, PRO_DATANCOM, "Number of combined frames"); } /* * PRO REC1 CALi NAME, PRO REC1 CALi CATG, and PRO REC1 CALi DATAMD5 */ ncal = 0; it = cpl_frameset_iterator_new(framelist); frame = cpl_frameset_iterator_get_const(it); while (frame != NULL) { cpl_errorstate status; if (cpl_frame_get_group(frame) == CPL_FRAME_GROUP_CALIB) { ++ncal; snprintf(cval, FLEN_VALUE, PRO_REC_CALi_NAME, ncal); cpl_propertylist_update_string(header, cval, cpl_get_base_name(cpl_frame_get_filename(frame))); cpl_propertylist_set_comment(header, cval, "File name of calibration frame"); snprintf(cval, FLEN_VALUE, PRO_REC_CALi_CATG, ncal); cpl_propertylist_update_string(header, cval, cpl_frame_get_tag(frame)); cpl_propertylist_set_comment(header, cval, "Category of calibration frame"); snprintf(cval, FLEN_VALUE, PRO_REC_CALi_DATAMD5, ncal); switch (cpl_is_fits(cpl_frame_get_filename(frame))) { case 0: plist = cpl_propertylist_new(); break; case 1: plist = cpl_propertylist_load_regexp( cpl_frame_get_filename(frame), 0, "^" DATAMD5 "$", 0); cpl_ensure_code(plist != NULL, cpl_error_get_code()); break; default: cpl_frameset_iterator_delete(it); return cpl_error_get_code() == CPL_ERROR_NULL_INPUT ? cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND) : cpl_error_set_where_(); break; } if (cpl_propertylist_has(plist, DATAMD5)) { if (cpl_propertylist_get_type(plist, DATAMD5) != CPL_TYPE_STRING) { cpl_msg_warning(cpl_func, "Unexpected type for keyword " DATAMD5 " in input header"); } else { datamd5 = cpl_propertylist_get_string(plist, DATAMD5); cpl_propertylist_update_string(header, cval, datamd5); cpl_propertylist_set_comment(header, cval, "MD5 signature of calib frame"); } } cpl_propertylist_delete(plist); } status = cpl_errorstate_get(); cpl_frameset_iterator_advance(it, 1); if (cpl_error_get_code() == CPL_ERROR_ACCESS_OUT_OF_RANGE) { cpl_errorstate_set(status); } frame = cpl_frameset_iterator_get_const(it); } cpl_frameset_iterator_delete(it); it = NULL; npar = 0; param = cpl_parameterlist_get_first_const(parlist); while (param != NULL) { char * pval; char * dval; /* The default value for value comment */ #if defined CFITSIO_MAJOR && (CFITSIO_MAJOR > 3 || CFITSIO_MINOR >= 26) char * help = NULL; const char * comment = cpl_parameter_get_help(param); #else char * help = cpl_dfs_extract_printable(cpl_parameter_get_help(param)); const char * comment = help; #endif ++npar; kname = cpl_parameter_get_alias(param, CPL_PARAMETER_MODE_CLI); switch (cpl_parameter_get_type(param)) { case CPL_TYPE_BOOL: pval = cpl_strdup(cpl_parameter_get_bool(param) == 1 ? "true" : "false"); dval = cpl_sprintf("Default: %s", cpl_parameter_get_default_bool(param) == 1 ? "true" : "false"); if (!comment) comment = "Boolean recipe parameter"; break; case CPL_TYPE_INT: pval = cpl_sprintf("%d", cpl_parameter_get_int(param)); dval = cpl_sprintf("Default: %d", cpl_parameter_get_default_int(param)); if (!comment) comment = "Integer recipe parameter"; break; case CPL_TYPE_DOUBLE: pval = cpl_sprintf("%g", cpl_parameter_get_double(param)); dval = cpl_sprintf("Default: %g", cpl_parameter_get_default_double(param)); if (!comment) comment = "Floating point recipe parameter"; break; case CPL_TYPE_STRING: pval = cpl_strdup(cpl_parameter_get_string(param)); dval = cpl_sprintf("Default: '%s'", cpl_parameter_get_default_string(param)); if (!comment) comment = "String recipe parameter"; break; default: /* * Theoretically impossible to get here */ cpl_free((void*)help); return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } snprintf(cval, FLEN_VALUE, PRO_REC_PARAMi_NAME, npar); cpl_propertylist_update_string(header, cval, kname); cpl_propertylist_set_comment(header, cval, comment); snprintf(cval, FLEN_VALUE, PRO_REC_PARAMi_VALUE, npar); cpl_propertylist_update_string(header, cval, pval); cpl_propertylist_set_comment(header, cval, dval); cpl_free((void*)help); cpl_free((void*)pval); cpl_free((void*)dval); param = cpl_parameterlist_get_next_const(parlist); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Perform any DFS-compliancy required actions (DATAMD5/PIPEFILE update) @param self The list of frames with FITS products created by the recipe @return CPL_ERROR_NONE or the relevant CPL error code on error @note Each product frame must correspond to a FITS file created with a CPL FITS saving function. @error
CPL_ERROR_NULL_INPUT An input pointer is NULL.
CPL_ERROR_DATA_NOT_FOUND The input framelist contains a frame of type product with a missing filename.
CPL_ERROR_BAD_FILE_FORMAT The input framelist contains a frame of type product without a FITS card with key 'DATAMD5'.
CPL_ERROR_FILE_IO The input framelist contains a frame of type product for which the FITS card with key 'DATAMD5' could not be updated.
@enderror */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_dfs_update_product_header(cpl_frameset * self) { return cpl_dfs_update_product_header_(self) | cpl_io_fits_close_tid(CPL_IO_FITS_ALL) /* FIXME: Close only writers */ ? cpl_error_set_where_() : CPL_ERROR_NONE; } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Perform any DFS-compliancy required actions (DATAMD5/PIPEFILE update) @param self The list of frames with FITS products created by the recipe @return CPL_ERROR_NONE or the relevant CPL error code on error @see cpl_dfs_update_product_header() */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_dfs_update_product_header_(cpl_frameset * self) { const cpl_frame * frame; cpl_frameset_iterator *it; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); it = cpl_frameset_iterator_new(self); while ((frame = cpl_frameset_iterator_get_const(it)) != NULL) { cpl_errorstate status; if (cpl_frame_get_group(frame) == CPL_FRAME_GROUP_PRODUCT) { const char * filename = cpl_frame_get_filename(frame); if (filename == NULL) { cpl_frameset_iterator_delete(it); cpl_error_set(cpl_func, CPL_ERROR_DATA_NOT_FOUND); return CPL_ERROR_DATA_NOT_FOUND; } if (cpl_is_fits(filename)) { fitsfile * fproduct = NULL; char card[FLEN_CARD]; int error = 0; /* CFITSIO requires this to be zero */ cpl_error_code code = CPL_ERROR_NONE; if (cpl_io_fits_open_diskfile(&fproduct, filename, READWRITE, &error)) { cpl_frameset_iterator_delete(it); return cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_open_diskfile, "filename='%s'", filename); } #ifndef CPL_IO_FITS_REWIND /* The previous call may be reusing file handle opened for previous I/O, so the file pointer needs to be moved */ if (fits_movabs_hdu(fproduct, 1, NULL, &error)) { code = cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_movabs_hdu, "filename='%s'", filename); } #endif if (fits_read_card(fproduct, DATAMD5, card, &error)) { code = cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_read_card, "filename='%s', " "key='" DATAMD5 "'", filename); error = 0; } else { /* The fits header has the MD5-card, update it */ char * md5sum = cpl_dfs_find_md5sum(fproduct); if (!md5sum) { code = cpl_error_set_where_(); } else { if (fits_update_key_str(fproduct, DATAMD5, md5sum, "MD5 checksum", &error)) { code = cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_update_key_str, "filename='%s', key='" DATAMD5 "', value='%s'", filename, md5sum); error = 0; } else if (fits_update_key_str(fproduct, PIPEFILE, filename, "Filename of data" " product", &error)) { code = cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_update_key_str, "filename='%s', key='" PIPEFILE "'", filename); error = 0; } cpl_free(md5sum); } } if (cpl_io_fits_close_file(fproduct, &error)) { cpl_frameset_iterator_delete(it); return cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_close_file, "filename='%s'", filename); } if (code) { cpl_frameset_iterator_delete(it); return code; } } } status = cpl_errorstate_get(); cpl_frameset_iterator_advance(it, 1); if (cpl_error_get_code() == CPL_ERROR_ACCESS_OUT_OF_RANGE) { cpl_errorstate_set(status); } } cpl_frameset_iterator_delete(it); it = NULL; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Compute the MD5 hash of the data units in a FITS file. @param fproduct A CFITSIO FITS file structure @return CPL_ERROR_NONE or the relevant CPL error code on error @note Upon success the created string must be deallocated with cpl_free() and the CFITSIO FITS file structure is reset to the 1st HDU */ /*----------------------------------------------------------------------------*/ static char * cpl_dfs_find_md5sum(fitsfile * fproduct) { /* The MD5sum needs to be updated with calls to MD5Update(). For performance reasons the number of bytes read and passed to this function should be: 1) A multiple of a FITS block, 2880 (64 * 45) bytes 2) A multiple of file-system block size, likely a power of two. 3) Not exceed the size of the CPU cache (assuming that ffgbyt() will cause the loaded data to be placed in the cache where it will be readily available for MD5Update(). If this does not happen, nothing is gained - and no harm is done. 4) On cache-less architectures, the block size should simply prevent significant amounts of memory to be allocated. Oops: Disable blocking, because it causes the wrong MD5 sum for some blocksizes. For r.1.8 of tests/cpl_dfs-test.c blocking works for sizes greater or equal to the maximum data unit size, 362*2280, and for 2880 and 2 * 2880, but not for 181 * 2880 and not for 64 * 2880. This may be due to undocumented behaviour of ffgbyt() or MD5Update(). */ #ifdef HAVE_OPENSSL EVP_MD_CTX ctx; unsigned char digest[EVP_MAX_MD_SIZE]; unsigned int md_len; #else struct MD5Context ctx; unsigned char digest[(MD5HASHSZ)>>1]; #endif int error = 0; int next = 0; #if defined L2_CACHE_BYTES && L2_CACHE_BYTES <= 0 #undef L2_CACHE_BYTES #endif #ifndef L2_CACHE_BYTES /* The size in bytes of the cache level, with most importance (probably related to size times penalty for a miss) */ /* FIXME: Assume 256kB (L2) Cache. Many CPUs have more (e.g. 512kB), but the performance on those does not seem to suffer much */ #if defined CPL_CPU_CACHE && CPL_CPU_CACHE > 0 #define L2_CACHE_BYTES CPL_CPU_CACHE #else #define L2_CACHE_BYTES 262144 #endif #endif /* A whole number of FITS Blocks fitting the L2. Is this a good idea ? */ const long maxblocksize = 2880 * (L2_CACHE_BYTES/4096); cpl_ensure(fproduct != NULL, CPL_ERROR_NULL_INPUT, NULL); #ifdef HAVE_OPENSSL assert( (EVP_MAX_MD_SIZE) >= (MD5HASHSZ) ); EVP_DigestInit(&ctx, EVP_md5()); #else MD5Init(&ctx); #endif /* Iterate through main HDU and all extensions */ do { CPL_OFF_TYPE datastart, dataend; /* FIXME: fits_get_hduaddr() supports filesizes less than 2GiB, fits_get_hduaddrll() supports sizes less than 2^63 B, but is introduced after CFITSIO version 2.510 */ /* Using fits_get_hduoff() instead as per DFS05866 */ if (CPL_OFF_FUNC(fproduct, NULL, &datastart, &dataend, &error)) { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, CPL_OFF_FUNC, "HDU#=%d", next); return NULL; } if (dataend > datastart) { void * buffer = cpl_malloc((size_t)maxblocksize); CPL_OFF_TYPE datasize = dataend - datastart; long blocksize = maxblocksize; do { if (datasize < blocksize) blocksize = (long)datasize; /* Seek to beginning of Data Unit block */ if (ffmbyt(fproduct, datastart, 0, &error)) { cpl_free(buffer); (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, ffmbyt, "HDU#=%d, datastart=%lu", next, (unsigned long)datastart); return NULL; } /* Try to read blocksize bytes */ if (ffgbyt(fproduct, blocksize, buffer, &error)) { cpl_free(buffer); (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, ffgbyt, "HDU#=%d, blocksize=%ld", next, blocksize); return NULL; } /* Compute MD5 sum here */ #ifdef HAVE_OPENSSL EVP_DigestUpdate(&ctx, (const void *)buffer, (size_t) blocksize); #else MD5Update(&ctx, (const unsigned char *)buffer, (unsigned)blocksize); #endif datasize -= blocksize; datastart += blocksize;; } while (datasize > 0); cpl_free(buffer); } else if (dataend != datastart) { (void)cpl_error_set_fits(CPL_ERROR_ILLEGAL_OUTPUT, error, CPL_OFF_FUNC, "HDU#=%d, datastart=%lu != " "dataend=%lu, sizeof(" CPL_STRINGIFY(CPL_OFF_TYPE) ")=%u", next, (long unsigned)datastart, (long unsigned)dataend, (unsigned)sizeof(CPL_OFF_TYPE)); return NULL; } next++; } while (!fits_movabs_hdu(fproduct, 1 + next, NULL, &error)); if (error == END_OF_FILE) { error = 0; /* Reset CFITSIO error */ } else { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_movabs_hdu, "HDU#=%d", next); return NULL; } /* Move back to beginning */ if (fits_movabs_hdu(fproduct, 1, NULL, &error)) { (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_movabs_hdu,"HDU#=%d", next); return NULL; } #ifdef HAVE_OPENSSL EVP_DigestFinal_ex(&ctx, digest, &md_len); EVP_MD_CTX_cleanup(&ctx); #else MD5Final(digest, &ctx); #endif /* Write digest into a string */ return cpl_sprintf ("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", digest[ 0], digest[ 1], digest[ 2], digest[ 3], digest[ 4], digest[ 5], digest[ 6], digest[ 7], digest[ 8], digest[ 9], digest[10], digest[11], digest[12], digest[13], digest[14], digest[15]); } /*----------------------------------------------------------------------------*/ /** @internal @brief Determine whether a given file is a FITS file @param self The name of the fits @return 1 if the file is FITS, 0 if not, negative on error */ /*----------------------------------------------------------------------------*/ static int cpl_is_fits(const char * self) { int error = 0; int is_fits = 1; fitsfile * fptr; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); if (cpl_io_fits_open_diskfile(&fptr, self, READONLY, &error)) { is_fits = error == FILE_NOT_OPENED ? -2 : 0; if (is_fits < 0) (void)cpl_error_set_fits(CPL_ERROR_FILE_NOT_FOUND, error, fits_open_diskfile, "filename='%s'", self); error = 0; #ifndef CPL_IO_FITS_REWIND } else if (fits_movabs_hdu(fptr, 1, NULL, &error)) { /* The open call may be reusing file handle opened for previous I/O, so the file pointer needs to be moved */ is_fits = error == FILE_NOT_OPENED ? -2 : 0; if (is_fits < 0) (void)cpl_error_set_fits(CPL_ERROR_FILE_NOT_FOUND, error, fits_movabs_hdu, "filename='%s'", self); error = 0; #endif } else if (fits_read_imghdr(fptr, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &error)) { is_fits = error == FILE_NOT_OPENED ? -2 : 0; if (is_fits < 0) (void)cpl_error_set_fits(CPL_ERROR_FILE_NOT_FOUND, error, fits_read_imghdr, "filename='%s'", self); error = 0; } if (fptr != NULL && cpl_io_fits_close_file(fptr, &error) != 0) { /* FIXME: Is this even possible ? */ is_fits = -1; (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_close_file, "filename='%s'", self); } return is_fits; } /*----------------------------------------------------------------------------*/ /** @internal @brief Return a pointer to the basename of a full-path filename @param self The filename @return The pointer (possibly self, which may be NULL) @note The pointer returned by this function may not be used after self is de/re-allocated, nor after a call of the function with another string. */ /*----------------------------------------------------------------------------*/ static const char * cpl_get_base_name(const char * self) { const char * p = self ? strrchr(self, '/') : NULL; return p ? p + 1 : self; } /*----------------------------------------------------------------------------*/ /** @brief Open a new PAF file, output a default header. @param instrume Name of instrument in capitals (NACO, VISIR, etc.) @param recipe Name of recipe @param filename Filename of created product @return PAF stream or NULL on error This function creates a new PAF file with the requested file name. If another file already exists with the same name, it will be overwritten (if the file access rights allow it). This function returns an opened file pointer, ready to receive more data through fprintf()'s. The caller is responsible for fclose()ing the file. Possible _cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_FILE_IO if fopen(), or fprintf() fails */ /*----------------------------------------------------------------------------*/ static FILE * cpl_dfs_paf_init(const char * instrume, const char * recipe, const char * filename) { FILE * paf = NULL; char * paf_id = NULL; const char paf_desc[] = "QC file"; int nlen; cpl_error_code error = CPL_ERROR_NONE; cpl_ensure(instrume != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(recipe != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(filename != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_msg_info(cpl_func, "Writing PAF: %s" , filename); paf_id = cpl_sprintf("%s/%s", instrume, recipe); assert( paf_id != NULL); paf = fopen(filename, "w"); if (paf == NULL) error = CPL_ERROR_FILE_IO; /* Some ugly, traditional error handling that obscures the actual functionality (i.e. to fprintf() some strings) */ if (!error) { nlen = fprintf(paf, "PAF.HDR.START ;# start of header\n"); if (nlen <= PAF_KEY_LEN) error = CPL_ERROR_FILE_IO; } if (!error) { nlen = fprintf(paf, "PAF.TYPE \"pipeline product\" ;\n"); if (nlen <= PAF_KEY_LEN) error = CPL_ERROR_FILE_IO; } if (!error) { nlen = fprintf(paf, "PAF.ID \"%s\"\n", paf_id); if (nlen <= PAF_KEY_LEN) error = CPL_ERROR_FILE_IO; } cpl_free(paf_id); if (!error) { nlen = fprintf(paf, "PAF.NAME \"%s\"\n", filename); if (nlen <= PAF_KEY_LEN) error = CPL_ERROR_FILE_IO; } if (!error) { nlen = fprintf(paf, "PAF.DESC \"%s\"\n", paf_desc); if (nlen <= PAF_KEY_LEN) error = CPL_ERROR_FILE_IO; } if (!error) { nlen = fprintf(paf, "PAF.CHCK.CHECKSUM \"\"\n"); if (nlen <= PAF_KEY_LEN) error = CPL_ERROR_FILE_IO; } if (!error) { nlen = fprintf(paf, "PAF.HDR.END ;# end of header\n"); if (nlen <= PAF_KEY_LEN) error = CPL_ERROR_FILE_IO; } if (!error) { nlen = fprintf(paf, "\n"); if (nlen != 1) error = CPL_ERROR_FILE_IO; } if (error) { if (paf != NULL) { (void)fclose(paf); paf = NULL; } (void)cpl_error_set_message_(error, "Could not write PAF, instrume=%s, " "recipe=%s, filename=%s", instrume, recipe, filename); } return paf; } /*----------------------------------------------------------------------------*/ /** @brief Print a propertylist as PAF @param self Propertylist to be printed @param paf PAF stream @return CPL_ERROR_NONE or the relevant _cpl_error_code_ on error The property names are printed with these modifications: 1) The prefix "ESO " is dropped. 2) Any space-character is replaced by a . (dot). Thus a property name ESO QC PART1 PART2 PART3 will cause the printing of a line with QC.PART1.PART2.PART3 as key. Supported property-types: CPL_TYPE_CHAR (cast to cpl_size) CPL_TYPE_INT (cast to cpl_size) CPL_TYPE_LONG (cast to cpl_size) CPL_TYPE_LONG_LONG (cast to cpl_size) CPL_TYPE_FLOAT (cast to double) CPL_TYPE_DOUBLE CPL_TYPE_STRING Possible _cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_FILE_IO if fprintf() fails - CPL_ERROR_UNSUPPORTED_MODE if the list contains unsupported property-types */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_dfs_paf_dump(const cpl_propertylist * self, FILE * paf) { const cpl_size nproperties = cpl_propertylist_get_size(self); cpl_size i; cpl_ensure_code(self, CPL_ERROR_NULL_INPUT); cpl_ensure_code(paf, CPL_ERROR_NULL_INPUT); for (i=0; i < nproperties; i++) { const cpl_property * prop = cpl_propertylist_get_const(self, i); const char * name = cpl_property_get_name(prop); const char * comment = cpl_property_get_comment(prop); const char * usekey; const char * usecom; char * qckey = NULL; char * qccom = NULL; /* Initialization needed in absence of #if for CPL_TYPE_LONG */ cpl_error_code err = CPL_ERROR_UNSUPPORTED_MODE; if (strstr(name, "ESO ") == name) { /* Drop prefix "ESO " */ qckey = cpl_sprintf("%s", name+4); } else if (strchr(name, ' ')) { qckey = cpl_strdup(name); } if (qckey != NULL) { /* Replace with . */ char * p; for (p = qckey; *p != '\0'; p++) if (*p == ' ') *p = '.'; usekey = qckey; } else { usekey = name; } if (comment != NULL && strchr(comment, '\n')) { char * p; /* Replace line-feed with space */ qccom = cpl_strdup(comment); for (p = qccom; *p != '\0'; p++) if (*p == '\n') *p = ' '; usecom = qccom; } else { usecom = comment; } /* Print the property as PAF */ switch (cpl_property_get_type(prop)) { case CPL_TYPE_CHAR: err = cpl_dfs_paf_dump_int(usekey, cpl_property_get_char(prop), usecom, paf); break; case CPL_TYPE_BOOL: err = cpl_dfs_paf_dump_int(usekey, cpl_property_get_bool(prop), usecom, paf); break; case CPL_TYPE_INT: err = cpl_dfs_paf_dump_int(usekey, cpl_property_get_int(prop), usecom, paf); break; case CPL_TYPE_LONG: err = cpl_dfs_paf_dump_int(usekey, cpl_property_get_long(prop), usecom, paf); break; case CPL_TYPE_LONG_LONG: err = cpl_dfs_paf_dump_int(usekey, cpl_property_get_long_long(prop), usecom, paf); break; case CPL_TYPE_FLOAT: err = cpl_dfs_paf_dump_double(usekey, cpl_property_get_float(prop), usecom, paf); break; case CPL_TYPE_DOUBLE: err = cpl_dfs_paf_dump_double(usekey, cpl_property_get_double(prop), usecom, paf); break; case CPL_TYPE_STRING: err = cpl_dfs_paf_dump_string(usekey, cpl_property_get_string(prop), usecom, paf); break; default: err = CPL_ERROR_UNSUPPORTED_MODE; } cpl_free(qckey); cpl_free(qccom); if (err) return cpl_error_set_(err); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Print a string-property as PAF @param key Property key @param value Property value @param comment Optional property comment @param paf PAF stream @return CPL_ERROR_NONE or the relevant _cpl_error_code_ on error Possible _cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if a non-optional input pointer is NULL - CPL_ERROR_FILE_IO if fprintf() fails */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_dfs_paf_dump_string(const char * key, const char * value, const char * comment, FILE * paf) { cpl_ensure_code(paf, CPL_ERROR_NULL_INPUT); cpl_ensure_code(key, CPL_ERROR_NULL_INPUT); cpl_ensure_code(value, CPL_ERROR_NULL_INPUT); if (comment == NULL) cpl_ensure_code(fprintf(paf, PAF_KEY_FORMAT "\"%s\"\n", key, value) > PAF_KEY_LEN, CPL_ERROR_FILE_IO); else cpl_ensure_code(fprintf(paf, PAF_KEY_FORMAT "\"%s\" ; # %s\n", key, value, comment) > PAF_KEY_LEN, CPL_ERROR_FILE_IO); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Print a double-property as PAF @param key Property key @param value Property value @param comment Optional property comment @param paf PAF stream @return CPL_ERROR_NONE or the relevant _cpl_error_code_ on error @see cpl_dfs_paf_dump_string */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_dfs_paf_dump_double(const char * key, double value, const char * comment, FILE * paf) { cpl_ensure_code(paf, CPL_ERROR_NULL_INPUT); cpl_ensure_code(key, CPL_ERROR_NULL_INPUT); /* The number of decimals for double keywords in CFITSIO is 15 * (see putkey.c in cfitsio). So we match here that number not to * lose precision */ if (comment == NULL) cpl_ensure_code(fprintf(paf, PAF_KEY_FORMAT "%.15g\n", key, value) > PAF_KEY_LEN, CPL_ERROR_FILE_IO); else cpl_ensure_code(fprintf(paf, PAF_KEY_FORMAT "%.15g ; # %s\n", key, value, comment) > PAF_KEY_LEN, CPL_ERROR_FILE_IO); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Print an int-property as PAF @param key Property key @param value Property value @param comment Optional property comment @param paf PAF stream @return CPL_ERROR_NONE or the relevant _cpl_error_code_ on error @see cpl_dfs_paf_dump_string */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_dfs_paf_dump_int(const char * key, cpl_size value, const char * comment, FILE * paf) { cpl_ensure_code(paf, CPL_ERROR_NULL_INPUT); cpl_ensure_code(key, CPL_ERROR_NULL_INPUT); if (comment == NULL) cpl_ensure_code(fprintf(paf, PAF_KEY_FORMAT "%" CPL_SIZE_FORMAT "\n", key, value) > PAF_KEY_LEN, CPL_ERROR_FILE_IO); else cpl_ensure_code(fprintf(paf, PAF_KEY_FORMAT "%" CPL_SIZE_FORMAT "; # %s\n", key, value, comment) > PAF_KEY_LEN, CPL_ERROR_FILE_IO); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Save either an image or table as a pipeline product @param allframes The list of input frames for the recipe @param header NULL, or filled with properties written to product header @param parlist The list of input parameters @param usedframes The list of raw/calibration frames used for this product @param inherit NULL, or frame from which header information is inherited @param imagelist The imagelist to be saved or NULL @param image The image to be saved or NULL @param type The type used to represent the data in the file @param table The table to be saved or NULL @param tablelist Optional propertylist to use in table extension or NULL @param recipe The recipe name @param applist Propertylist to append to primary header, w. PRO.CATG @param remregexp Optional regexp of properties not to put in main header @param pipe_id PACKAGE "/" PACKAGE_VERSION @param filename Filename of created product @return CPL_ERROR_NONE or the relevant CPL error code on error @note At most one of imagelist, image and table may be non-NULL, if all are NULL the product frame type will be that of an image @see cpl_dfs_save_image() */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_dfs_product_save(cpl_frameset * allframes, cpl_propertylist * header, const cpl_parameterlist * parlist, const cpl_frameset * usedframes, const cpl_frame * inherit, const cpl_imagelist * imagelist, const cpl_image * image, cpl_type type, const cpl_table * table, const cpl_propertylist * tablelist, const char * recipe, const cpl_propertylist * applist, const char * remregexp, const char * pipe_id, const char * filename) { const char * procat; cpl_propertylist * plist; cpl_frame * product_frame; /* Inside this function the product-types are numbered: 0: imagelist 1: table 2: image 3: propertylist only */ const unsigned pronum = imagelist != NULL ? 0 : table != NULL ? 1 : (image != NULL ? 2 : 3); const char * proname[] = {"imagelist", "table", "image", "propertylist"}; /* FIXME: Define a frame type for an imagelist and when data-less */ const int protype[] = {CPL_FRAME_TYPE_ANY, CPL_FRAME_TYPE_TABLE, CPL_FRAME_TYPE_IMAGE, CPL_FRAME_TYPE_ANY}; cpl_error_code error = CPL_ERROR_NONE; /* No more than one of imagelist, table and image may be non-NULL */ /* tablelist may only be non-NULL when table is non-NULL */ if (imagelist != NULL) { assert(pronum == 0); assert(image == NULL); assert(table == NULL); assert(tablelist == NULL); } else if (table != NULL) { assert(pronum == 1); assert(imagelist == NULL); assert(image == NULL); } else if (image != NULL) { assert(pronum == 2); assert(imagelist == NULL); assert(table == NULL); assert(tablelist == NULL); } else { assert(pronum == 3); assert(imagelist == NULL); assert(table == NULL); assert(tablelist == NULL); assert(image == NULL); } cpl_ensure_code(allframes != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(parlist != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(usedframes != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(recipe != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(applist != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pipe_id != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(filename != NULL, CPL_ERROR_NULL_INPUT); procat = cpl_propertylist_get_string(applist, CPL_DFS_PRO_CATG); cpl_ensure_code(procat != NULL, cpl_error_get_code()); cpl_msg_info(cpl_func, "Writing FITS %s product(%s): %s", proname[pronum], procat, filename); product_frame = cpl_frame_new(); /* Create product frame */ error |= cpl_frame_set_filename(product_frame, filename); error |= cpl_frame_set_tag(product_frame, procat); error |= cpl_frame_set_type(product_frame, protype[pronum]); error |= cpl_frame_set_group(product_frame, CPL_FRAME_GROUP_PRODUCT); error |= cpl_frame_set_level(product_frame, CPL_FRAME_LEVEL_FINAL); if (error) { cpl_frame_delete(product_frame); return cpl_error_set_where_(); } if (header != NULL) { cpl_propertylist_empty(header); plist = header; } else { plist = cpl_propertylist_new(); } /* Add any QC parameters here */ error = cpl_propertylist_append(plist, applist); /* Add DataFlow keywords */ if (!error) error = cpl_dfs_setup_product_header(plist, product_frame, usedframes, parlist, recipe, pipe_id, CPL_DFS_PRO_DID, inherit); if (remregexp != NULL && !error) { cpl_errorstate prestate = cpl_errorstate_get(); (void)cpl_propertylist_erase_regexp(plist, remregexp, 0); if (!cpl_errorstate_is_equal(prestate)) error = cpl_error_get_code(); } if (!error) { switch (pronum) { case 0: error = cpl_imagelist_save(imagelist, filename, type, plist, CPL_IO_CREATE); break; case 1: error = cpl_table_save(table, plist, tablelist, filename, CPL_IO_CREATE); break; case 2: error = cpl_image_save(image, filename, type, plist, CPL_IO_CREATE); break; default: /* case 3: */ error = cpl_propertylist_save(plist, filename, CPL_IO_CREATE); } } if (!error) { /* Insert the frame of the saved file in the input frameset */ error = cpl_frameset_insert(allframes, product_frame); } else { cpl_frame_delete(product_frame); } if (plist != header) cpl_propertylist_delete(plist); cpl_ensure_code(!error, error); return CPL_ERROR_NONE; } #if defined CFITSIO_MAJOR && (CFITSIO_MAJOR > 3 || CFITSIO_MINOR >= 26) /* Not needed from 3.26 */ #else /*----------------------------------------------------------------------------*/ /** @brief Extract the initial, printable part of a NULL-terminated string @param card The NULL-terminated input string to extract from @return The created, printable string or NULL on empty input or NULL input @see fftrec() of CFITSIO v. 3.090. @note The returned string can be written to a FITS card. A single space replaces various (forbidden) white-space characters: TAB char Line Feed char Vertical Tab Form Feed char Carriage Return With CFITSIO 3.09 and 3.24 this extraction is necessary, while for 3.26 it is not necessary. */ /*----------------------------------------------------------------------------*/ static char * cpl_dfs_extract_printable(const char * self) { char * card = NULL; if (self != NULL) { int ii; card = cpl_strdup(self); for (ii = 0; ; ii++) { /* Transform various white-space characters to a space */ /* The if-statements have been copied from fftrec() in fitscore.c */ if (card[ii] == 9) card[ii] = ' '; else if (card[ii] == 10) card[ii] = ' '; else if (card[ii] == 11) card[ii] = ' '; else if (card[ii] == 12) card[ii] = ' '; else if (card[ii] == 13) card[ii] = ' '; else /* All of the above cases are OK and need no check below */ /* This line has been copied from fftrec() in fitscore.c */ if (card[ii] < 32 || card[ii] > 126) break; /* Will at the latest break on the NULL-terminator */ } card[ii] = '\0'; } return card; } #endif #ifndef HAVE_OPENSSL /* Definitions of static MD5 functions */ #include "md5.c" #endif cpl-6.4.1/cpldfs/tests/0000755000460300003120000000000012310333012011673 500000000000000cpl-6.4.1/cpldfs/tests/cpl_dfs-test.c0000644000460300003120000010765312277166746014420 00000000000000/* $Id: cpl_dfs-test.c,v 1.64 2013-10-21 07:57:47 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-10-21 07:57:47 $ * $Revision: 1.64 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include #include "cpl_dfs.h" #include "cpl_memory.h" #include "cpl_test.h" #include "cpl_image.h" #include "cpl_io_fits.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define IMAGE_SIZE_X 1009 #define IMAGE_SIZE_Y 1031 #define IMAGE_NEXT 32 #define CPL_DFS_RAW_ASCII "ascii.txt" #define CPL_DFS_FITSFILE "product.fits" /*----------------------------------------------------------------------------- Private declarations -----------------------------------------------------------------------------*/ static void cpl_dfs_product_tests(const char *); static void cpl_dfs_save_tests(const char *); static void cpl_dfs_save_txt(const char *); static void cpl_dfs_parameterlist_fill(cpl_parameterlist *); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_propertylist * plist = NULL; cpl_error_code code; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); cpl_dfs_save_txt(CPL_DFS_RAW_ASCII); plist = cpl_propertylist_new(); /* This card is of floating point type, but make sure it is written as an integer, since that format is also valid */ code = cpl_propertylist_append_int(plist, "EQUINOX", 2000); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_image_save(NULL, "inherit.fits", CPL_TYPE_FLOAT, plist, CPL_IO_CREATE); cpl_propertylist_delete(plist); /* Insert tests here */ cpl_dfs_product_tests(CPL_DFS_RAW_ASCII); cpl_dfs_save_tests(CPL_DFS_RAW_ASCII); remove(CPL_DFS_RAW_ASCII); /* Testing finished */ return cpl_test_end(0); } static void cpl_dfs_product_tests(const char * rawname) { cpl_frame * rawframe; cpl_frame * inhframe; cpl_frame * proframe; cpl_frame * emptyframe; cpl_frameset * frameset = NULL; cpl_propertylist * plist = NULL; cpl_parameterlist * parlist = NULL; cpl_image * image; const char * md5sum; cpl_error_code error; const int next = IMAGE_NEXT; int fstatus = 0; /* CFITSIO error status */ int i; /* Test 1: Check the error handling of NULL-pointer(s) */ error = cpl_dfs_setup_product_header(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); cpl_test_eq_error( error, CPL_ERROR_NULL_INPUT); /* Test 1a: Check the error handling of NULL-pointer(s) */ error = cpl_dfs_update_product_header(NULL); cpl_test_eq_error( error, CPL_ERROR_NULL_INPUT); /* Test 2: Check the error handling of an empty frame/frameset */ proframe = cpl_frame_new(); frameset = cpl_frameset_new(); plist = cpl_propertylist_new(); parlist = cpl_parameterlist_new(); /* Insert CHECKSUM and DATASUM (with wrong values) */ error = cpl_propertylist_append_string(plist, "CHECKSUM", "BADAKIZUEUSKARAZ"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_propertylist_set_comment(plist, "CHECKSUM", "HDU checksum"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_propertylist_append_string(plist, "DATASUM", "3141592653"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_propertylist_set_comment(plist, "DATASUM", "data unit checksum"); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_dfs_parameterlist_fill(parlist); error = cpl_dfs_setup_product_header(plist, proframe, frameset, parlist, "Recipe", "Pipeline", "PRO-1.15", NULL); cpl_test_eq_error( error, CPL_ERROR_DATA_NOT_FOUND); /* Test 2a: Check the handling of an empty frameset */ error = cpl_dfs_update_product_header(frameset); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Test 3: Check the error handling of a rawframe without a filename */ rawframe = cpl_frame_new(); error = cpl_frame_set_tag(rawframe, "TAG"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_group(rawframe, CPL_FRAME_GROUP_RAW); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frameset_insert(frameset, rawframe); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_dfs_setup_product_header(plist, proframe, frameset, parlist, "Recipe", "Pipeline", "PRO-1.15", NULL); cpl_test_eq_error( error, CPL_ERROR_DATA_NOT_FOUND); cpl_frameset_delete(frameset); /* Test 4: Check the error handling of an empty product frame (and a valid, non-fits rawframe) - should fail on missing filename */ frameset = cpl_frameset_new(); rawframe = cpl_frame_new(); error = cpl_frame_set_tag(rawframe, "TAG"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_group(rawframe, CPL_FRAME_GROUP_RAW); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_filename(rawframe, rawname); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frameset_insert(frameset, rawframe); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_dfs_setup_product_header(plist, proframe, frameset, parlist, "Recipe", "Pipeline", "PRO-1.15", NULL); cpl_test_eq_error( error, CPL_ERROR_DATA_NOT_FOUND); /* Test 4c: Check the error handling of an product frame with a (non-fits) filename as the only attribute (and a valid, non-fits rawframe) - should fail on missing tag */ error = cpl_frame_set_filename(proframe, CPL_DFS_FITSFILE); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_dfs_setup_product_header(plist, proframe, frameset, parlist, "Recipe", "Pipeline", "PRO-1.15", NULL); cpl_test_eq_error( error, CPL_ERROR_ILLEGAL_INPUT); /* Test 4d: Check the error handling of an product frame with a filename and tagged (and a valid, non-fits rawframe) - should fail on missing group */ error = cpl_frame_set_tag(proframe, "PRODUCT"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_dfs_setup_product_header(plist, proframe, frameset, parlist, "Recipe", "Pipeline", "PRO-1.15", NULL); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Set product group */ error = cpl_frame_set_group(proframe, CPL_FRAME_GROUP_PRODUCT); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Test 5c: Check the error handling of an inherit-frame not present in the frameset */ error = cpl_dfs_setup_product_header(plist, proframe, frameset, parlist, "Recipe", "Pipeline", "PRO-1.15", proframe); cpl_test_eq_error( error, CPL_ERROR_ILLEGAL_INPUT); /* Test 5: 2 simple successful calls */ error = cpl_dfs_setup_product_header(plist, proframe, frameset, parlist, "Recipe", "Pipeline", "PRO-1.15", NULL); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_propertylist_has(plist, "CHECKSUM")); cpl_test_zero(cpl_propertylist_has(plist, "DATASUM")); cpl_msg_debug("","Size of product header: %" CPL_SIZE_FORMAT, cpl_propertylist_get_size(plist)); inhframe = cpl_frame_new(); error = cpl_frame_set_tag(inhframe, "TAG"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_group(inhframe, CPL_FRAME_GROUP_RAW); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_filename(inhframe, "inherit.fits"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frameset_insert(frameset, inhframe); cpl_test_eq_error(error, CPL_ERROR_NONE); /* This card is of floating point type, but make sure it is written as an integer, since that format is also valid */ cpl_propertylist_append_int(plist, "EQUINOX", 2000); error = cpl_dfs_setup_product_header(plist, proframe, frameset, parlist, "Recipe", "Pipeline", "PRO-1.15", inhframe); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_propertylist_has(plist, "CHECKSUM")); cpl_test_zero(cpl_propertylist_has(plist, "DATASUM")); cpl_msg_debug("","Size of product header: %" CPL_SIZE_FORMAT, cpl_propertylist_get_size(plist)); cpl_propertylist_append_char(plist, "ESO QC MYCHAR", 42); cpl_propertylist_set_comment(plist, "ESO QC MYCHAR", "42"); cpl_propertylist_append_string(plist, "ARCFILE", "IIINSTRUME.2013-08-28T12:50:43.3381"); error = cpl_dfs_save_paf("IIINSTRUME", "RRRECIPE", plist, "cpl_dfs-test.paf"); cpl_test_eq_error(error, CPL_ERROR_NONE); #if 0 /* * FIXME: It fails if inherit_frame is an ASCII file, what is * allowed for the first frame. See below: rawframe points to the * first frame in frameset. */ cpl_test_zero(cpl_dfs_setup_product_header(plist, proframe, frameset, parlist, "Recipe", "Pipeline", "PRO-1.15", rawframe)); cpl_msg_debug("","Size of product header: %" CPL_SIZE_FORMAT, cpl_propertylist_get_size(plist)); #endif /* Test 5a: A failure due to a missing product file */ error = cpl_frameset_insert(frameset, proframe); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_dfs_update_product_header(frameset); cpl_test_eq_error( error, CPL_ERROR_BAD_FILE_FORMAT); /* Test 5b: Check the error handling of an inherit-frame present in the frameset, but not present on the filesystem */ error = cpl_dfs_setup_product_header(plist, proframe, frameset, parlist, "Recipe", "Pipeline", "PRO-1.15", proframe); cpl_test_eq_error( error, CPL_ERROR_FILE_NOT_FOUND); /* Test 5c: Check error handling when given an empty frame with no filename set. */ emptyframe = cpl_frame_new(); error = cpl_dfs_setup_product_header(plist, proframe, frameset, parlist, "Recipe", "Pipeline", "PRO-1.15", emptyframe); cpl_test_eq_error(error, CPL_ERROR_DATA_NOT_FOUND); cpl_frame_delete(emptyframe); /* Test 6a: A failure on file format (missing file) */ /* Need to close file due to non CPL access */ cpl_test_zero(cpl_io_fits_close(CPL_DFS_FITSFILE, &fstatus)); cpl_test_zero(fstatus); /* Make sure file does not exist (from a previously failed test) */ (void)remove(CPL_DFS_FITSFILE); error = cpl_frame_set_type(proframe, CPL_FRAME_TYPE_IMAGE); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_dfs_update_product_header(frameset); cpl_test_eq_error( error, CPL_ERROR_BAD_FILE_FORMAT); /* Test 6a: Also support non-fits */ cpl_dfs_save_txt(CPL_DFS_FITSFILE); error = cpl_dfs_update_product_header(frameset); cpl_test_error(error); /* Test 7a: A successful call of cpl_dfs_update_product_header() with an empty data-unit */ /* This card is of floating point type, but make sure it is written as an integer, since that format is also valid */ cpl_propertylist_append_int(plist, "EQUINOX", 2000); cpl_test_zero(cpl_image_save(NULL, CPL_DFS_FITSFILE, CPL_TYPE_UCHAR, plist, CPL_IO_CREATE)); cpl_test_fits(CPL_DFS_FITSFILE); error = cpl_dfs_update_product_header(frameset); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(CPL_DFS_FITSFILE); cpl_propertylist_delete(plist); plist = cpl_propertylist_load(CPL_DFS_FITSFILE, 0); cpl_test_nonnull(plist); cpl_test(cpl_propertylist_has(plist, "EQUINOX")); md5sum = cpl_propertylist_get_string(plist, "DATAMD5"); cpl_test_nonnull(md5sum); /* The created Data Unit is empty */ /* The corresponding 32-byte reference MD5 sum is found with: md5sum - < /dev/null */ cpl_test_eq_string(md5sum, "d41d8cd98f00b204e9800998ecf8427e"); /* Test 7b: A successful call of cpl_dfs_update_product_header() */ image = cpl_image_new(2, 3, CPL_TYPE_INT); /* This card is of floating point type, but make sure it is written as an integer, since that format is also valid */ cpl_propertylist_append_int(plist, "EQUINOX", 2000); cpl_test(cpl_propertylist_has(plist, "EQUINOX")); cpl_test_zero(cpl_image_save(image, CPL_DFS_FITSFILE, CPL_TYPE_UCHAR, plist, CPL_IO_CREATE)); cpl_test_fits(CPL_DFS_FITSFILE); error = cpl_dfs_update_product_header(frameset); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(CPL_DFS_FITSFILE); cpl_propertylist_delete(plist); plist = cpl_propertylist_load(CPL_DFS_FITSFILE, 0); cpl_test_nonnull(plist); md5sum = cpl_propertylist_get_string(plist, "DATAMD5"); cpl_test_nonnull(md5sum); /* The created Data Unit consists of one FITS block of zero-bytes */ /* The 32-byte reference MD5 sum of such a string is found with: perl -e 'print "\0" x 2880' | md5sum - */ cpl_test_eq_string(md5sum, "b4a11922757e107a2c10306867f52601"); /* Test 7c: A successful call of cpl_dfs_update_product_header() with a main HDU and one data-less extension */ cpl_test_zero(cpl_image_save(NULL, CPL_DFS_FITSFILE, CPL_TYPE_UCHAR, plist, CPL_IO_EXTEND)); cpl_test_fits(CPL_DFS_FITSFILE); error = cpl_dfs_update_product_header(frameset); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(CPL_DFS_FITSFILE); cpl_propertylist_delete(plist); plist = cpl_propertylist_load(CPL_DFS_FITSFILE, 0); cpl_test_nonnull(plist); md5sum = cpl_propertylist_get_string(plist, "DATAMD5"); cpl_test_nonnull(md5sum); /* The created Data Unit consists of one FITS block of zero-bytes */ /* The 32-byte reference MD5 sum of such a string is found with: perl -e 'print "\0" x 2880' | md5sum - */ cpl_test_eq_string(md5sum, "b4a11922757e107a2c10306867f52601"); /* Test 7d: A successful call of cpl_dfs_update_product_header() with a main HDU, one data-less extension and one non-empty extension. */ cpl_test_zero(cpl_image_save(image, CPL_DFS_FITSFILE, CPL_TYPE_UCHAR, plist, CPL_IO_EXTEND)); cpl_test_fits(CPL_DFS_FITSFILE); error = cpl_dfs_update_product_header(frameset); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(CPL_DFS_FITSFILE); cpl_propertylist_delete(plist); plist = cpl_propertylist_load(CPL_DFS_FITSFILE, 0); cpl_test_nonnull(plist); cpl_test(cpl_propertylist_has(plist, "EQUINOX")); md5sum = cpl_propertylist_get_string(plist, "DATAMD5"); cpl_test_nonnull(md5sum); /* The created Data Unit consists of two FITS blocks of zero-bytes */ /* The 32-byte reference MD5 sum of such a string is found with: perl -e 'print "\0" x (2880*2)' | md5sum - */ cpl_test_eq_string(md5sum, "1c94f1009ff65c0a499040c0d1ae082f"); cpl_image_delete(image); /* Test 8: A successful call of cpl_dfs_update_product_header() - on a multi-extension file of flat integer images*/ image = cpl_image_new(IMAGE_SIZE_X, IMAGE_SIZE_Y, CPL_TYPE_INT); for (i = 0; i < next; i++) { error = cpl_image_add_scalar(image, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_save(image, i % 2 ? CPL_DFS_FITSFILE : "./" CPL_DFS_FITSFILE, i >= 255 ? CPL_TYPE_INT : CPL_TYPE_UCHAR, plist, CPL_IO_EXTEND); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(CPL_DFS_FITSFILE); } error = cpl_dfs_update_product_header(frameset); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(CPL_DFS_FITSFILE); cpl_propertylist_delete(plist); plist = cpl_propertylist_load(CPL_DFS_FITSFILE, 0); cpl_test_nonnull(plist); md5sum = cpl_propertylist_get_string(plist, "DATAMD5"); cpl_test_nonnull(md5sum); /* The created Data Units are two FITS blocks of zero-bytes, and 32 each with a BITPIX-8 1009 by 1031 flat image with values 1 through 32 */ /* The 32-byte reference MD5 sum of such a string is found with: perl -e 'print "\0" x ( 2880*2);' -e 'grep(print(sprintf("%c",$_) x (1009*1031)."\0"x(1042560-1009*1031)),' -e '1..32)' | md5sum - */ #if defined IMAGE_NEXT && IMAGE_NEXT == 32 #if defined IMAGE_SIZE_X && IMAGE_SIZE_X == 1009 #if defined IMAGE_SIZE_Y && IMAGE_SIZE_X == 1031 cpl_test_eq_string(md5sum, "503bcbb6fd6606ac1d035e2a43f0229c"); #endif #endif #endif cpl_image_delete(image); /* Test 9: A successful call of cpl_dfs_update_product_header() - after renaming the file */ do { /* Renaming the file attribute of a frame belonging to a frameset is not allowed. This strange limitation requires a cumbersome work-around :-( */ cpl_frameset * newframes = cpl_frameset_new(); const char * newformat = "newname_%04d.fits"; cpl_frame * newframe; cpl_frameset_iterator *it = cpl_frameset_iterator_new(frameset); const cpl_frame *frame = cpl_frameset_iterator_get_const(it); /* * Create new frameset of products with new filenames * - and rename product files */ i = 0; while (frame != NULL) { if (cpl_frame_get_group(frame) == CPL_FRAME_GROUP_PRODUCT) { const cpl_frame_type type = cpl_frame_get_type(frame); if (type == CPL_FRAME_TYPE_TABLE || type == CPL_FRAME_TYPE_IMAGE) { const char * oldname = cpl_frame_get_filename(frame); char * newname = cpl_sprintf(newformat, ++i); /* Rename product */ cpl_test_zero(rename(oldname, newname)); newframe = cpl_frame_duplicate(frame); error = cpl_frame_set_filename(newframe, newname); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_free(newname); error = cpl_frameset_insert(newframes, newframe); cpl_test_eq_error(error, CPL_ERROR_NONE); } } cpl_errorstate status = cpl_errorstate_get(); cpl_frameset_iterator_advance(it, 1); if (cpl_error_get_code() == CPL_ERROR_ACCESS_OUT_OF_RANGE) { cpl_errorstate_set(status); } frame = cpl_frameset_iterator_get_const(it); } cpl_frameset_iterator_delete(it); it = NULL; cpl_msg_info("", "Renamed %d product(s)", i); error = cpl_dfs_update_product_header(newframes); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_frameset_delete(newframes); /* Do not remove file(s) if there was a failure */ if (cpl_error_get_code() == CPL_ERROR_NONE) { for (; i; i--) { char * newname = cpl_sprintf(newformat, i); error = remove(newname); cpl_free(newname); if (error) break; } cpl_test_zero(i); } } while (0); cpl_frameset_delete(frameset); cpl_propertylist_delete(plist); cpl_parameterlist_delete(parlist); return; } static void cpl_dfs_save_tests(const char * rawname) { const cpl_boolean is_debug = cpl_msg_get_level() <= CPL_MSG_DEBUG? CPL_TRUE : CPL_FALSE; cpl_error_code error; const char * remregexp = "DROP"; cpl_frameset * frames = NULL; cpl_propertylist * tlist = NULL; cpl_propertylist * qclist = NULL; cpl_parameterlist * parlist = NULL; cpl_image * image = NULL; cpl_imagelist * imlist = NULL; cpl_table * table = NULL; cpl_frame * rawframe = cpl_frame_new(); int framesetsize; /* Test 1: Check the error handling of NULL-pointer(s) */ error = cpl_dfs_save_image(frames, NULL, parlist, frames, NULL, image, CPL_TYPE_UCHAR, "recipe", qclist, "none", "pipe_id", CPL_DFS_FITSFILE); cpl_test_eq(error, CPL_ERROR_NULL_INPUT); error = cpl_dfs_save_imagelist(frames, NULL, parlist, frames, NULL, imlist, CPL_TYPE_UCHAR, "recipe", qclist, "none", "pipe_id", CPL_DFS_FITSFILE); cpl_test_eq_error( error, CPL_ERROR_NULL_INPUT); error = cpl_dfs_save_table(frames, NULL, parlist, frames, NULL, table, tlist, "recipe", qclist, "none", "pipe_id", CPL_DFS_FITSFILE); cpl_test_eq_error( error, CPL_ERROR_NULL_INPUT); error = cpl_dfs_save_paf("INSTRUME", "recipe", qclist, CPL_DFS_FITSFILE); cpl_test_eq_error( error, CPL_ERROR_NULL_INPUT); frames = cpl_frameset_new(); tlist = cpl_propertylist_new(); qclist = cpl_propertylist_new(); parlist = cpl_parameterlist_new(); table = cpl_table_new(1); imlist = cpl_imagelist_new(); cpl_dfs_parameterlist_fill(parlist); /* This card is of floating point type, but make sure it is written as an integer, since that format is also valid */ error = cpl_propertylist_append_int(qclist, "EQUINOX", 2000); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_propertylist_append_string(qclist, CPL_DFS_PRO_CATG, "procat")); /* Test 1a: Try an illegal filename */ error = cpl_dfs_save_paf("INSTRUME", "recipe", qclist, "."); cpl_test_eq_error( error, CPL_ERROR_FILE_IO); /* Test 2: Check handling of empty objects (frameset) */ error = cpl_dfs_save_image(frames, NULL, parlist, frames, NULL, image, CPL_TYPE_UCHAR, "recipe", qclist, "none", "pipe_id", "image" CPL_DFS_FITS); cpl_test_eq_error( error, CPL_ERROR_DATA_NOT_FOUND); error = cpl_dfs_save_imagelist(frames, NULL, parlist, frames, NULL, imlist, CPL_TYPE_UCHAR, "recipe", qclist, "none", "pipe_id", "imlist" CPL_DFS_FITS); cpl_test_eq_error( error, CPL_ERROR_DATA_NOT_FOUND); error = cpl_dfs_save_table(frames, NULL, parlist, frames, NULL, table, tlist, "recipe", qclist, "none", "pipe_id", "table" CPL_DFS_FITS); cpl_test_eq_error( error, CPL_ERROR_DATA_NOT_FOUND); /* Test 3A: Check handling of empty objects (except frameset) - using a non-existing input file */ /* Make sure file does not exist */ (void)remove("table" CPL_DFS_FITS); error = cpl_frame_set_tag(rawframe, "TAG"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_group(rawframe, CPL_FRAME_GROUP_RAW); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_filename(rawframe, "table" CPL_DFS_FITS); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frameset_insert(frames, rawframe); cpl_test_eq_error(error, CPL_ERROR_NONE); framesetsize = cpl_frameset_get_size(frames); error = cpl_dfs_save_image(frames, NULL, parlist, frames, NULL, image, CPL_TYPE_UCHAR, "recipe", qclist, "none", "pipe_id", "image" CPL_DFS_FITS); cpl_test_eq_error( error, CPL_ERROR_FILE_NOT_FOUND); cpl_test_eq( cpl_frameset_get_size(frames), framesetsize); error = cpl_dfs_save_imagelist(frames, NULL, parlist, frames, NULL, imlist, CPL_TYPE_UCHAR, "recipe", qclist, "none", "pipe_id", "imlist" CPL_DFS_FITS); cpl_test_eq_error( error, CPL_ERROR_FILE_NOT_FOUND); cpl_test_eq( cpl_frameset_get_size(frames), framesetsize); /* Test 3B: Check handling of empty objects (except frameset) */ cpl_frameset_delete(frames); frames = cpl_frameset_new(); rawframe = cpl_frame_new(); error = cpl_frame_set_tag(rawframe, "TAG"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_group(rawframe, CPL_FRAME_GROUP_RAW); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_filename(rawframe, rawname); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frameset_insert(frames, rawframe); cpl_test_eq_error(error, CPL_ERROR_NONE); framesetsize = cpl_frameset_get_size(frames); /* Make sure file does not exist */ (void)remove("imlist" CPL_DFS_FITS); error = cpl_dfs_save_imagelist(frames, NULL, parlist, frames, NULL, imlist, CPL_TYPE_UCHAR, "recipe", qclist, "none", "pipe_id", "imlist" CPL_DFS_FITS); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq( cpl_frameset_get_size(frames), framesetsize); /* Test 3: Check handling of empty objects (except frameset + imagelist) */ /* Insert an image into the imagelist */ error = cpl_imagelist_set(imlist, cpl_image_new(3, 2, CPL_TYPE_INT), 0); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Make sure file does not exist */ (void)remove("image" CPL_DFS_FITS); error = cpl_dfs_save_image(frames, NULL, parlist, frames, NULL, image, CPL_TYPE_UCHAR, "recipe", qclist, "none", "pipe_id", "image" CPL_DFS_FITS); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_frameset_get_size(frames), ++framesetsize); cpl_test_fits("image" CPL_DFS_FITS); /* Make sure file does not exist */ (void)remove("imlist" CPL_DFS_FITS); error = cpl_dfs_save_imagelist(frames, NULL, parlist, frames, NULL, imlist, CPL_TYPE_UCHAR, "recipe", qclist, "none", "pipe_id", "imlist" CPL_DFS_FITS); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_frameset_get_size(frames), ++framesetsize); cpl_test_fits("imlist" CPL_DFS_FITS); /* Make sure file does not exist */ (void)remove("table" CPL_DFS_FITS); error = cpl_dfs_save_table(frames, NULL, parlist, frames, NULL, table, tlist, "recipe", qclist, "none", "pipe_id", "table" CPL_DFS_FITS); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_frameset_get_size(frames), ++framesetsize); cpl_test_fits("table" CPL_DFS_FITS); /* Make sure file does not exist */ (void)remove("recipe" CPL_DFS_PAF); error = cpl_dfs_save_paf("INSTRUME", "recipe", qclist, "recipe" CPL_DFS_PAF); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_dfs_update_product_header(frames); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Test 4: Check handling of empty objects (except frameset and qclist) */ /* And remove one property */ cpl_test_zero(cpl_propertylist_append_string(qclist, "ESO QC STRING", "'Lorem ipsum'")); error = cpl_propertylist_append_int(qclist, "ESO QC INT", 42); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Use the value 1/3 to see the accuracy in the FITS header */ error = cpl_propertylist_append_float(qclist, "ESO QC FLOAT", 1.0F/3.0F); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_propertylist_append_double(qclist, "ESO QC DOUBLE", 1.0/3.0)); error = cpl_propertylist_append_string(qclist, "ESO QC DROP", "image"); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_propertylist_set_comment(qclist, "ESO QC STRING", "string")); error = cpl_propertylist_set_comment(qclist, "ESO QC INT", "int"); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_propertylist_set_comment(qclist, "ESO QC FLOAT", "float")); cpl_test_zero(cpl_propertylist_set_comment(qclist, "ESO QC DOUBLE", "double")); /* Make sure file does not exist */ (void)remove("image" CPL_DFS_FITS); image = cpl_image_new(1, 41, CPL_TYPE_FLOAT); error = cpl_dfs_save_image(frames, NULL, parlist, frames, NULL, image, CPL_TYPE_UCHAR, "recipe", qclist, remregexp, "pipe_id", "image" CPL_DFS_FITS); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_frameset_get_size(frames), ++framesetsize); cpl_test_fits("image" CPL_DFS_FITS); /* Insert the image also as a calibration frame */ rawframe = cpl_frame_new(); error = cpl_frame_set_tag(rawframe, "IMAGECALIB"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_group(rawframe, CPL_FRAME_GROUP_CALIB); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frame_set_filename(rawframe, "image" CPL_DFS_FITS); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_frameset_insert(frames, rawframe); cpl_test_eq_error(error, CPL_ERROR_NONE); framesetsize++; /* Make sure file does not exist */ (void)remove("table" CPL_DFS_FITS); error = cpl_dfs_save_table(frames, NULL, parlist, frames, NULL, table, tlist, "recipe", qclist, "none", "pipe_id", "table" CPL_DFS_FITS); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_frameset_get_size(frames), ++framesetsize); cpl_test_fits("table" CPL_DFS_FITS); /* Make sure file does not exist */ (void)remove("imlist" CPL_DFS_FITS); error = cpl_dfs_save_imagelist(frames, NULL, parlist, frames, NULL, imlist, CPL_TYPE_UCHAR, "recipe", qclist, "none", "pipe_id", "imlist" CPL_DFS_FITS); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_frameset_get_size(frames), ++framesetsize); cpl_test_fits("imlist" CPL_DFS_FITS); /* Make sure file does not exist */ (void)remove("nullimage" CPL_DFS_FITS); error = cpl_dfs_save_image(frames, NULL, parlist, frames, NULL, NULL, CPL_TYPE_UCHAR, "recipe", qclist, remregexp, "pipe_id", "nullimage" CPL_DFS_FITS); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_frameset_get_size(frames), ++framesetsize); cpl_test_fits("nullimage" CPL_DFS_FITS); /* Make sure file does not exist */ (void)remove("dataless" CPL_DFS_FITS); error = cpl_dfs_save_propertylist(frames, NULL, parlist, frames, NULL, "recipe", qclist, remregexp, "pipe_id", "dataless" CPL_DFS_FITS); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_frameset_get_size(frames), ++framesetsize); cpl_test_fits("dataless" CPL_DFS_FITS); /* Make sure file does not exist */ (void)remove("recipe" CPL_DFS_PAF); error = cpl_dfs_save_paf("INSTRUME", "recipe", qclist, "recipe" CPL_DFS_PAF); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Final test: Update the headers as well */ error = cpl_dfs_update_product_header(frames); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_msg_info(cpl_func, "New size of frameset: %d", framesetsize); if (error == CPL_ERROR_NONE && !is_debug) { cpl_test_zero(remove("image" CPL_DFS_FITS)); cpl_test_zero(remove("table" CPL_DFS_FITS)); cpl_test_zero(remove("recipe" CPL_DFS_PAF)); } cpl_frameset_delete(frames); cpl_propertylist_delete(tlist); cpl_propertylist_delete(qclist); cpl_parameterlist_delete(parlist); cpl_image_delete(image); cpl_imagelist_delete(imlist); cpl_table_delete(table); return; } static void cpl_dfs_save_txt(const char * self) { FILE * stream = fopen(self, "w"); cpl_test_nonnull( stream ); cpl_test_leq(1, fprintf(stream, self, "SIMPLE ASCII file - not FITS\n")); cpl_test_zero( fclose(stream)); } /*----------------------------------------------------------------------------*/ /** @internal @brief Fill a parameterlist with all supported parameter types @param self Parameterlist to fill @return void */ /*----------------------------------------------------------------------------*/ static void cpl_dfs_parameterlist_fill(cpl_parameterlist * self) { cpl_error_code error; error = cpl_parameterlist_append (self, cpl_parameter_new_value("my_bool", CPL_TYPE_BOOL, "test bool", "bool context", CPL_TRUE)); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_parameterlist_append (self, cpl_parameter_new_value("my_int", CPL_TYPE_INT, "test integer", "int context", 42)); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Use the value 1/3 to see the accuracy in the FITS header */ error = cpl_parameterlist_append (self, cpl_parameter_new_value("my_double", CPL_TYPE_DOUBLE, "test double", "double context", 1.0/3.0)); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_parameterlist_append (self, cpl_parameter_new_value("my_string", CPL_TYPE_STRING, "test string", "string context", "Hello, World")); cpl_test_eq_error(error, CPL_ERROR_NONE); /* The help text here has a newline and a tab both of which are not allowed in a FITS card. */ error = cpl_parameterlist_append (self, cpl_parameter_new_range("my_range", CPL_TYPE_INT, "1 == Median,\n 2 == Mean.\t last word.", "range context", 1, 1, 2)); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl-6.4.1/cpldfs/tests/Makefile.am0000644000460300003120000000334012127227645013673 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO Common Pipeline Library ## Copyright (C) 2001-2008 European Southern Observatory ## 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 2 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 02111-1307 USA AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ if MAINTAINER_MODE MAINTAINERCLEANFILES = $(srcdir)/Makefile.in endif AM_CPPFLAGS = $(CPLDFS_INCLUDES) $(CPLCORE_INCLUDES) \ $(CPLUI_INCLUDES) $(CX_INCLUDES) $(CFITSIO_INCLUDES) LDADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLCORE) check_PROGRAMS = cpl_dfs-test cpl_dfs_test_SOURCES = cpl_dfs-test.c # Be sure to reexport important environment variables. TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" TESTS = cpl_dfs-test XFAIL_TESTS = # We need to remove any files that the above tests created. clean-local: $(RM) *.fits *.paf if USE_PURIFY include $(top_builddir)/Makefile.purify endif cpl-6.4.1/cpldfs/tests/Makefile.in0000644000460300003120000010017612310332724013676 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = cpl_dfs-test$(EXEEXT) TESTS = cpl_dfs-test$(EXEEXT) XFAIL_TESTS = subdir = cpldfs/tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/admin/depcomp $(top_srcdir)/admin/test-driver ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/cpl.m4 $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/omp.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_cpl_dfs_test_OBJECTS = cpl_dfs-test.$(OBJEXT) cpl_dfs_test_OBJECTS = $(am_cpl_dfs_test_OBJECTS) cpl_dfs_test_LDADD = $(LDADD) am__DEPENDENCIES_1 = cpl_dfs_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(cpl_dfs_test_SOURCES) DIST_SOURCES = $(cpl_dfs_test_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/admin/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/admin/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFITSIO_INCLUDES = @CFITSIO_INCLUDES@ CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@ CFLAGS = @CFLAGS@ CPLCORE_INCLUDES = @CPLCORE_INCLUDES@ CPLDFS_INCLUDES = @CPLDFS_INCLUDES@ CPLDRS_INCLUDES = @CPLDRS_INCLUDES@ CPLUI_INCLUDES = @CPLUI_INCLUDES@ CPL_BINARY_AGE = @CPL_BINARY_AGE@ CPL_BINARY_VERSION = @CPL_BINARY_VERSION@ CPL_CFLAGS = @CPL_CFLAGS@ CPL_INTERFACE_AGE = @CPL_INTERFACE_AGE@ CPL_LDFLAGS = @CPL_LDFLAGS@ CPL_MAJOR_VERSION = @CPL_MAJOR_VERSION@ CPL_MICRO_VERSION = @CPL_MICRO_VERSION@ CPL_MINOR_VERSION = @CPL_MINOR_VERSION@ CPL_VERSION = @CPL_VERSION@ CPL_VERSION_STRING = @CPL_VERSION_STRING@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_INCLUDES = @CX_INCLUDES@ CX_LDFLAGS = @CX_LDFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FFTWF_INCLUDES = @FFTWF_INCLUDES@ FFTWF_LDFLAGS = @FFTWF_LDFLAGS@ FFTW_INCLUDES = @FFTW_INCLUDES@ FFTW_LDFLAGS = @FFTW_LDFLAGS@ FGREP = @FGREP@ GASGANO_CLASSPATH = @GASGANO_CLASSPATH@ GASGANO_SHREXT = @GASGANO_SHREXT@ GREP = @GREP@ INCLTDL = @INCLTDL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JAVA_INCLUDES = @JAVA_INCLUDES@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCEXT = @LIBCEXT@ LIBCFITSIO = @LIBCFITSIO@ LIBCPLCORE = @LIBCPLCORE@ LIBCPLDFS = @LIBCPLDFS@ LIBCPLDRS = @LIBCPLDRS@ LIBCPLUI = @LIBCPLUI@ LIBFFTW = @LIBFFTW@ LIBFFTWF = @LIBFFTWF@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBWCS = @LIBWCS@ LIPO = @LIPO@ LN_S = @LN_S@ LTDLDEPS = @LTDLDEPS@ LTDLINCL = @LTDLINCL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ WCS_INCLUDES = @WCS_INCLUDES@ WCS_LDFLAGS = @WCS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ cpl_includes = @cpl_includes@ cpl_libraries = @cpl_libraries@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libcext = @libcext@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in AM_CPPFLAGS = $(CPLDFS_INCLUDES) $(CPLCORE_INCLUDES) \ $(CPLUI_INCLUDES) $(CX_INCLUDES) $(CFITSIO_INCLUDES) LDADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLCORE) cpl_dfs_test_SOURCES = cpl_dfs-test.c # Be sure to reexport important environment variables. TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cpldfs/tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign cpldfs/tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list cpl_dfs-test$(EXEEXT): $(cpl_dfs_test_OBJECTS) $(cpl_dfs_test_DEPENDENCIES) $(EXTRA_cpl_dfs_test_DEPENDENCIES) @rm -f cpl_dfs-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_dfs_test_OBJECTS) $(cpl_dfs_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_dfs-test.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # exand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ else \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? cpl_dfs-test.log: cpl_dfs-test$(EXEEXT) @p='cpl_dfs-test$(EXEEXT)'; \ b='cpl_dfs-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool clean-local \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am # We need to remove any files that the above tests created. clean-local: $(RM) *.fits *.paf @USE_PURIFY_TRUE@include $(top_builddir)/Makefile.purify # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/cpldfs/Makefile.am0000644000460300003120000000320512207316040012514 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO Common Pipeline Library ## Copyright (C) 2001-2008 European Southern Observatory ## 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 2 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 02111-1307 USA AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ if MAINTAINER_MODE MAINTAINERCLEANFILES = $(srcdir)/Makefile.in endif SUBDIRS = tests AM_CPPFLAGS = -DCX_LOG_DOMAIN=\"CplDfs\" \ $(CPLDFS_INCLUDES) $(CPLUI_INCLUDES) \ $(CPLCORE_INCLUDES) $(CX_INCLUDES) $(CFITSIO_INCLUDES) include_HEADERS = cpl_dfs.h noinst_HEADERS = md5.h md5.c lib_LTLIBRARIES = libcpldfs.la libcpldfs_la_SOURCES = cpl_dfs.c libcpldfs_la_LDFLAGS = $(CX_LDFLAGS) $(CFITSIO_LDFLAGS) -version-info \ $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libcpldfs_la_LIBADD = $(LIBCPLUI) $(LIBCPLCORE) $(LIBCFITSIO) \ $(LIBCEXT) -lm libcpldfs_la_DEPENDENCIES = $(LIBCPLCORE) cpl_dfs.c: $(srcdir)/md5.h $(srcdir)/md5.c cpl-6.4.1/cpldfs/cpl_dfs.h0000644000460300003120000001455311545320622012260 00000000000000/* $Id: cpl_dfs.h,v 1.17 2011-04-01 09:57:38 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-04-01 09:57:38 $ * $Revision: 1.17 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_DFS_H #define CPL_DFS_H #include #include #include #include #include #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define CPL_DFS_FITS ".fits" #define CPL_DFS_PAF ".paf" /*----------------------------------------------------------------------------*/ /** @ingroup cpl_dfs @brief The name of the Product Category key @see cpl_dfs_save_image() @note A pipeline product must contain a string property with this name */ /*----------------------------------------------------------------------------*/ #define CPL_DFS_PRO_CATG "ESO PRO CATG" /*----------------------------------------------------------------------------*/ /** @ingroup cpl_dfs @brief The name of the Product Type key @see cpl_dfs_save_image() @note A pipeline product should contain a string property with this name */ /*----------------------------------------------------------------------------*/ #define CPL_DFS_PRO_TYPE "ESO PRO TYPE" /*----------------------------------------------------------------------------*/ /** @ingroup cpl_dfs @brief The name of the Product Tech key @see cpl_dfs_save_image() @note A pipeline product should contain a string property with this name */ /*----------------------------------------------------------------------------*/ #define CPL_DFS_PRO_TECH "ESO PRO TECH" /*----------------------------------------------------------------------------*/ /** @ingroup cpl_dfs @brief The name of the Product Science key @see cpl_dfs_save_image() @note A pipeline product should contain a boolean property with this name */ /*----------------------------------------------------------------------------*/ #define CPL_DFS_PRO_SCIENCE "ESO PRO SCIENCE" /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_error_code cpl_dfs_save_image(cpl_frameset *, cpl_propertylist *, const cpl_parameterlist *, const cpl_frameset *, const cpl_frame *, const cpl_image *, cpl_type, const char *, const cpl_propertylist *, const char *, const char *, const char *); cpl_error_code cpl_dfs_save_propertylist(cpl_frameset *, cpl_propertylist *, const cpl_parameterlist *, const cpl_frameset *, const cpl_frame *, const char *, const cpl_propertylist *, const char *, const char *, const char *); cpl_error_code cpl_dfs_save_imagelist(cpl_frameset *, cpl_propertylist *, const cpl_parameterlist *, const cpl_frameset *, const cpl_frame *, const cpl_imagelist *, cpl_type, const char *, const cpl_propertylist *, const char *, const char *, const char *); cpl_error_code cpl_dfs_save_table(cpl_frameset *, cpl_propertylist *, const cpl_parameterlist *, const cpl_frameset *, const cpl_frame *, const cpl_table *, const cpl_propertylist *, const char *, const cpl_propertylist *, const char *, const char *, const char *); cpl_error_code cpl_dfs_save_paf(const char *, const char *, const cpl_propertylist *, const char *); cpl_error_code cpl_dfs_setup_product_header(cpl_propertylist *, const cpl_frame *, const cpl_frameset *, const cpl_parameterlist *, const char *, const char *, const char *, const cpl_frame *); cpl_error_code cpl_dfs_update_product_header(cpl_frameset *); CPL_END_DECLS #endif cpl-6.4.1/cpldfs/md5.h0000644000460300003120000000316712243371503011332 00000000000000/* $Id: md5.h,v 1.5 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO CPL Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.5 $ * $Name: not supported by cvs2svn $ */ #ifndef MD5_H #define MD5_H typedef unsigned int word32; struct MD5Context { word32 buf[4]; word32 bits[2]; unsigned char in[64]; }; static void MD5Init(struct MD5Context * restrict context) CPL_ATTR_NONNULL; static void MD5Update(struct MD5Context * restrict context, unsigned char const * restrict buf, unsigned len) CPL_ATTR_NONNULL; static void MD5Final(unsigned char * restrict digest, struct MD5Context * restrict context) CPL_ATTR_NONNULL; /* * This is needed to make RSAREF happy on some MS-DOS compilers. */ typedef struct MD5Context MD5_CTX; #endif cpl-6.4.1/cpldfs/Makefile.in0000644000460300003120000006441712310332724012543 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = cpldfs DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/admin/depcomp $(include_HEADERS) \ $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/cpl.m4 $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/omp.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = am_libcpldfs_la_OBJECTS = cpl_dfs.lo libcpldfs_la_OBJECTS = $(am_libcpldfs_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libcpldfs_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libcpldfs_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcpldfs_la_SOURCES) DIST_SOURCES = $(libcpldfs_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(include_HEADERS) $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFITSIO_INCLUDES = @CFITSIO_INCLUDES@ CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@ CFLAGS = @CFLAGS@ CPLCORE_INCLUDES = @CPLCORE_INCLUDES@ CPLDFS_INCLUDES = @CPLDFS_INCLUDES@ CPLDRS_INCLUDES = @CPLDRS_INCLUDES@ CPLUI_INCLUDES = @CPLUI_INCLUDES@ CPL_BINARY_AGE = @CPL_BINARY_AGE@ CPL_BINARY_VERSION = @CPL_BINARY_VERSION@ CPL_CFLAGS = @CPL_CFLAGS@ CPL_INTERFACE_AGE = @CPL_INTERFACE_AGE@ CPL_LDFLAGS = @CPL_LDFLAGS@ CPL_MAJOR_VERSION = @CPL_MAJOR_VERSION@ CPL_MICRO_VERSION = @CPL_MICRO_VERSION@ CPL_MINOR_VERSION = @CPL_MINOR_VERSION@ CPL_VERSION = @CPL_VERSION@ CPL_VERSION_STRING = @CPL_VERSION_STRING@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_INCLUDES = @CX_INCLUDES@ CX_LDFLAGS = @CX_LDFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FFTWF_INCLUDES = @FFTWF_INCLUDES@ FFTWF_LDFLAGS = @FFTWF_LDFLAGS@ FFTW_INCLUDES = @FFTW_INCLUDES@ FFTW_LDFLAGS = @FFTW_LDFLAGS@ FGREP = @FGREP@ GASGANO_CLASSPATH = @GASGANO_CLASSPATH@ GASGANO_SHREXT = @GASGANO_SHREXT@ GREP = @GREP@ INCLTDL = @INCLTDL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JAVA_INCLUDES = @JAVA_INCLUDES@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCEXT = @LIBCEXT@ LIBCFITSIO = @LIBCFITSIO@ LIBCPLCORE = @LIBCPLCORE@ LIBCPLDFS = @LIBCPLDFS@ LIBCPLDRS = @LIBCPLDRS@ LIBCPLUI = @LIBCPLUI@ LIBFFTW = @LIBFFTW@ LIBFFTWF = @LIBFFTWF@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBWCS = @LIBWCS@ LIPO = @LIPO@ LN_S = @LN_S@ LTDLDEPS = @LTDLDEPS@ LTDLINCL = @LTDLINCL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ WCS_INCLUDES = @WCS_INCLUDES@ WCS_LDFLAGS = @WCS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ cpl_includes = @cpl_includes@ cpl_libraries = @cpl_libraries@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libcext = @libcext@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in SUBDIRS = tests AM_CPPFLAGS = -DCX_LOG_DOMAIN=\"CplDfs\" \ $(CPLDFS_INCLUDES) $(CPLUI_INCLUDES) \ $(CPLCORE_INCLUDES) $(CX_INCLUDES) $(CFITSIO_INCLUDES) include_HEADERS = cpl_dfs.h noinst_HEADERS = md5.h md5.c lib_LTLIBRARIES = libcpldfs.la libcpldfs_la_SOURCES = cpl_dfs.c libcpldfs_la_LDFLAGS = $(CX_LDFLAGS) $(CFITSIO_LDFLAGS) -version-info \ $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libcpldfs_la_LIBADD = $(LIBCPLUI) $(LIBCPLCORE) $(LIBCFITSIO) \ $(LIBCEXT) -lm libcpldfs_la_DEPENDENCIES = $(LIBCPLCORE) all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cpldfs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign cpldfs/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libcpldfs.la: $(libcpldfs_la_OBJECTS) $(libcpldfs_la_DEPENDENCIES) $(EXTRA_libcpldfs_la_DEPENDENCIES) $(AM_V_CCLD)$(libcpldfs_la_LINK) -rpath $(libdir) $(libcpldfs_la_OBJECTS) $(libcpldfs_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_dfs.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libLTLIBRARIES \ clean-libtool cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-includeHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-includeHEADERS uninstall-libLTLIBRARIES cpl_dfs.c: $(srcdir)/md5.h $(srcdir)/md5.c # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/README0000644000460300003120000002725612111353713010103 00000000000000 In this file: * About CPL * Prerequisites * Required dependencies * Optional dependencies * Links * Installation * Installing CFITSIO * Gasgano Support * Third party libraries * Installing CPL * Installing CPL on Mac OSX * Reporting Bugs About CPL --------- This is version 6.3 of the ESO Common Pipeline libraries (CPL). This package includes libraries that are central to the development and execution of pipeline recipes as they are operated by ESO for all VLT instruments, miscellaneous HTML documentation and regression tests. Prerequisites ------------- For installing the CPL or to use it for your own software project you, at least, need a C99 compliant compiler (gcc version 4.4 or newer). In addition, a few third party libraries are used, which are listed below. If the target system provides these dependencies they may be used, however the system provided libraries must meet certain requirements which are given in the Installation section. The recommended way of installing the third party libraries for CPL is to re-compile them from source. The references for obtaining the third party (source) packages are given in the Links section. Required dependencies: ---------------------- - CFITSIO v3.310 or newer Optional dependencies: ---------------------- - Gasgano 2.4.3 - Oracle Java JDK 6 or newer - wcslib 4.16 - FFTW 3.3.3 Note that in order to build and install the CPL Gasgano interface both dependencies, the Gasgano package and the Java Development Kit must be installed. Links: ------ CFITSIO: http://heasarc.gsfc.nasa.gov/fitsio Gasgano: http://www.eso.org/sci/software/gasgano Java JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html wcslib: http://www.atnf.csiro.au/people/mcalabre/WCS Installation ------------ This section gives an overview of the CPL installation process. Before the CPL package itself can be installed, all required dependencies must be installed, as well as all selected optional packages. Note that for the Gasgano support, both the Gasgano package and the Java JDK must be installed. All dependencies are independent of each other and may be installed in any order. With the exception of the Gasgano package, and the Java JDK, it is recommended that all dependencies are installed into a single, separate directory tree, i.e a single, common directory should be given as '--prefix' option when running the configure script of the different packages. If the target directory of the installation is not a system directory like '/usr' or '/usr/local' (which would require superuser privileges!) it is recommended to setup the search path environment variable of the runtime linker so that it includes the the directory where the third party libraries will be located. The environment variable to be used is LD_LIBRARY_PATH on Linux based systems. For other systems one may have to consult the system documentation to find the equivalent environment variable. The environment variable should then be set such that the library search path contains the location of the libraries in the target directory structure, i.e the directory '/lib' or '/lib64' depending on what is the default name for library locations on the target system. The latter may be used on 64 bit Linux systems, while the first one may be used on both, 32 bit and 64 bit systems. Actually on 64 bit systems it is recommended to put both in the library search path, however care should be taken that '/lib64' comes first. As an example, for a 64 bit Linux system the LD_LIBRARY_PATH may be set as follows, assuming that is '$HOME/cpl', and a Bourne type shell is used: $ export LD_LIBRARY_PATH=$HOME/cpl/lib64:$HOME/cpl/lib:$LD_LIBRARY_PATH Installing CFITSIO: ------------------- By default CPL is built as a thread safe library, and unless the thread support is explicitly disabled, CPL relies on the presence of a thread safe CFITSIO library. In order to build a thread safe version of the CFITSIO library it has to be configured as outlined below (for detailed installation instructions please refer to the CFITSIO documentation). 1. Unpack the CFITSIO tar-archive in a temporary place, where a directory 'cfitsio' will be created, and enter it. 2. Configure the package. For being used with CPL it should be configured with the options shown here (build a shared object library, thread support compiled in): $ ./configure --prefix= --enable-shared --enable-reentrant 3. Build and install the package by running $ make $ make shared $ make install 4. If the search path of the runtime loader does not yet include the location of the CFITSIO libraries, it should be added, for instance by prepending it to the environment variable LD_LIBRARY_PATH or the appropriate equivalent (see above). Note that step 4 is essential if the system provides already a CFITSIO library which is not properly configured for CPL. After the installation is successfully completed, the CFITSIO sources are no longer needed, and may be removed. Gasgano support: ---------------- If the support library for ESO's Java based data organizing tool should be built, both, the Gasgano tool itself, and the Java Development Kit (JDK) must be present on the system. Please note that the Java Runtime Environment (JRE), which whould be sufficient to run Gasgano, is not enough to build CPL's Gasgano support library! Both packages are installed by unpacking the respective tar-archives in a suitable place, and adding the location of the executables to the PATH environment variable. In addition to that the JAVA_HOME environment variable should point to the root directory of the JDK installation. Third party libraries: ---------------------- Please follow the installation instructions shipped with the respective source packages. Installing CPL -------------- Package configuration: After all dependencies were successfully installed, the system is ready to install the CPL itself. To do so, unpack the CPL tar-archive in a directory of your choice (if you are reading this file you probably managed to do so already) and change directory into the top-level directory of the CPL source tree. The CPL source tree is setup for the target system by running the configure script found in the top-level directory of the source tree. In general, i.e. if the third party libraries were installed into non-standard directories, the configure script must be told where these libraries can be found. This can be done by either setting environment variables, which may be convenient if it is planned to install CPL more than once, or one can use command line options (if both, environment variables and command line options are used, the command line options take precedence). The following table shows for each of the third party libraries the command line option, and the equivalent environment variable which can be used to specify their location. library option environment ------- ------ ----------- CFITSIO --with-cfitsio CFITSIODIR libwcs --with-wcs WCSDIR fftw --with-fftw FFTWDIR Both, the command line option and the environment variable expect as an argument or value respectively the path to the root directory of the library installation, i.e. if, for instance, '$HOME/cpl' is given as location of one of the third party libraries, it is expected that the header files are found in '$HOME/cpl/include' and the libraries in '$HOME/cpl/lib', or '$HOME/cpl/lib64'. In case a more fine grained control is needed when specifying third party library locations, there are also command line options which allow to give the location of headers and libraries directly. Run 'configure --h' for details. These (expert) command line options have no environment variable counterpart. If the Gasgano support library should be built and installed, the configure script has to find the JDK and the Gasgano installation. The configure script tries to find both in a few default places, but in case this does not succeed, the location of both packages can be given similar to the third party library packages. The root directory of the Gasgano installation my be given on the command line of the configure script using the option '--with-gasgano', or setting the environment variable 'GASGANODIR'. An expert option '--with-gasgano-classpath' allows to directly specify the location of the Gasgano jar files, if using the standard option '--with-gasgano' does not succeed. Usually they can be found in the subdirectory 'share' of the Gasgano installation. By default, the JDK installation is searched at the location given by the JAVA_HOME environment variable. However the root directory of the JDK installation may also be passed to 'configure' using the command line option '--with-java'. Using this option 'configure' assumes that the required C header files are found in the subdirectories 'includes' and 'includes/' of the JDK installation. Here, is usually the name of your operating system, for instance 'linux' on a Linux system, but this may not be true in all cases. If running configure using '--with-java' does not succeed, you may want to try the expert options '--with-java-includes' and '--with-java-includes-md' to set the include directories explicitly to the subdirectories of the JDK containing the files 'jni.h' and 'jni_md.h' respectively. The target directory of the CPL installation is specified by either setting the environment variable CPLDIR to the desired path, or by using the configure command line option `--prefix'. If the target directory does not yet exist it will be created. If nothing is specified the CPL will be installed into `/usr/local' by default. Note that in this case you must have superuser privileges to install CPL! Building and Installing CPL: The following shows the necessary steps to build and install a minimal CPL. For that, it is assumed that CFITSIO was installed in $HOME/cpl/lib and $HOME/cpl/include and CPL should be installed in $HOME/cpl. To configure, build and install CPL one needs to execute the following commands in the top-level directory of the source tree: $ ./configure --prefix=$HOME/cpl --with-cfitsio=$HOME/cpl $ make $ make install Optionally, the HTML reference manual can be installed executing also the command: $ make install-doxygen By default this installs the HTML reference manual into the subdirectory 'share/doc/cpl/html' of the installation tree. Finally, if the CPL was not installed in one of the standard system directories, the location of the CPL libraries has to be added to the runtime loader's search path by properly setting the LD_LIBRARY_PATH variable (or the target system's equivalent). Installing CPL on Mac OSX ------------------------- Although the Mac OSX platform is not a CPL target platform, it is known that CPL can be successfully built, installed and used on this platform. To build CPL on Mac OSX, the following has to be taken into account: - On Mac OSX 10.8 or newer a gcc installation is recommended to build CPL. The Mac OSX 10.8 default compiler (clang) is not supported by CPL versions prior to and including CPL 6.1.1! - The symbol for the runtime loader search path is DYLD_LIBRARY_PATH and it has to replace LD_LIBRARY_PATH in the installation instructions. - When specifying the location of the JDK by setting the JAVA_HOME variable, it should be set as follows: $ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home in order to avoid compilation errors due to not finding the appropriate 'javah' executable. Please note that support for CPL on Mac OSX can only be provided on a best effort basis. Reporting Bugs -------------- Please report any bugs to cpl-6.4.1/m4/0000755000460300003120000000000012310333010007574 500000000000000cpl-6.4.1/m4/omp.m40000644000460300003120000001100212112640627010562 00000000000000# NOTE: # The macros in this file were taken from c.m4 which is shipped with # Autoconf. Newer version of Autoconf provide these macros to check for # OpenMP support. For preparing CPL releases it would be sufficient to use # a recent Autotools installation, however the nightly build system, is still # using an Autotools installation which is too old, and there is no plan for # upgrading it yet, hence the macros have been copied and the renamed so that # there are no name clashes in case a new version of Autoconf is used. # # However the symbols produced by these macros are kept identical to the # official macro versions, so that removing this file will have (almost) no # impact when the Autotools installation of the nightly build system will # be upgraded. # # In addition, the command line option to disable OpenMP support has been # remove, so that the macro just reports the results, which can be used # by a calling custom macro. # # _CPL_LANG_OPENMP # --------------- # Expands to some language dependent source code for testing the presence of # OpenMP. AC_DEFUN([_CPL_LANG_OPENMP], [AC_LANG_SOURCE([_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])]) # _CPL_LANG_OPENMP(C) # ------------------ # This tries to see if linking properly resolves omp_get_num_threads() object. # It also checks that the #pragma omp threadprivate directive is supported, # since some combinations of compiler/OS do not support it (e.g. gcc/OSX). m4_define([_CPL_LANG_OPENMP(C)], [ #ifndef _OPENMP choke me #endif #include int var; #pragma omp threadprivate(var) int main () { return omp_get_num_threads (); } ]) # _CPL_LANG_OPENMP(C++) # -------------------- m4_copy([_CPL_LANG_OPENMP(C)], [_CPL_LANG_OPENMP(C++)]) # _CPL_LANG_OPENMP(Fortran 77) # --------------------------- m4_define([_CPL_LANG_OPENMP(Fortran 77)], [ program main implicit none !$ integer tid tid = 42 call omp_set_num_threads(2) end ]) # _CPL_LANG_OPENMP(Fortran) # ------------------------- m4_copy([_CPL_LANG_OPENMP(Fortran 77)], [_CPL_LANG_OPENMP(Fortran)]) # CPL_OPENMP # ---------- # Check which options need to be passed to the C compiler to support OpenMP. # Set the OPENMP_CFLAGS / OPENMP_CXXFLAGS / OPENMP_FFLAGS variable to these # options. # The options are necessary at compile time (so the #pragmas are understood) # and at link time (so the appropriate library is linked with). # This macro takes care to not produce redundant options if $CC $CFLAGS already # supports OpenMP. It also is careful to not pass options to compilers that # misinterpret them; for example, most compilers accept "-openmp" and create # an output file called 'penmp' rather than activating OpenMP support. AC_DEFUN([CPL_OPENMP], [ OPENMP_[]_AC_LANG_PREFIX[]FLAGS= dnl AC_ARG_ENABLE([openmp], dnl [AS_HELP_STRING([--disable-openmp], [do not use OpenMP])]) dnl if test "$enable_openmp" != no; then AC_CACHE_CHECK([for the compiler option to support OpenMP], [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp], [AC_LINK_IFELSE([_CPL_LANG_OPENMP], [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='none needed'], [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='unsupported' dnl Try these flags: dnl GCC >= 4.2 -fopenmp dnl SunPRO C -xopenmp dnl Intel C -openmp dnl SGI C, PGI C -mp dnl Tru64 Compaq C -omp dnl IBM C (AIX, Linux) -qsmp=omp dnl Cray CCE -homp dnl NEC SX -Popenmp dnl Lahey Fortran (Linux) --openmp dnl If in this loop a compiler is passed an option that it doesn't dnl understand or that it misinterprets, the AC_LINK_IFELSE test dnl will fail (since we know that it failed without the option), dnl therefore the loop will continue searching for an option, and dnl no output file called 'penmp' or 'mp' is created. for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \ -Popenmp --openmp; do ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option" AC_LINK_IFELSE([_CPL_LANG_OPENMP], [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp=$ac_option]) _AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS if test "$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp" != unsupported; then break fi done])]) case $ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp in #( "none needed" | unsupported) ;; #( *) OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp ;; esac dnl fi AC_SUBST([OPENMP_]_AC_LANG_PREFIX[FLAGS]) ]) cpl-6.4.1/m4/ltversion.m40000644000460300003120000000126212310332714012016 00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) cpl-6.4.1/m4/libtool.m40000644000460300003120000105721612310332714011450 00000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS cpl-6.4.1/m4/ltoptions.m40000644000460300003120000003007312310332714012026 00000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) cpl-6.4.1/m4/lt~obsolete.m40000644000460300003120000001375612310332714012356 00000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) cpl-6.4.1/m4/eso.m40000644000460300003120000006703012231463661010574 00000000000000# ESO_PROG_CC_FLAG(FLAG, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) #----------------------------------------------------------------- AC_DEFUN([ESO_PROG_CC_FLAG], [ AC_REQUIRE([AC_PROG_CC]) flag=`echo $1 | sed 'y%.=/+-%___p_%'` AC_CACHE_CHECK([whether $CC supports -$1], [eso_cv_prog_cc_$flag], [ eval "eso_cv_prog_cc_$flag=no" AC_LANG_PUSH(C) echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -$1 -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -$1 -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* AC_LANG_POP(C) ]) if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : $2 else : $3 fi ]) # ESO_PROG_CC_ATTRIBUTE(VARIANT1, [VARIANT2], [CODE], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) #---------------------------------------------------------------------------------------------- AC_DEFUN([ESO_PROG_CC_ATTRIBUTE], [ AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))], AS_TR_SH([eso_cv_prog_cc_attribute_$1]), [ eso_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS" AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])], [eval "AS_TR_SH([eso_cv_prog_cc_attribute_$1])='yes'"], [eval "AS_TR_SH([eso_cv_prog_cc_attribute_$1])='no'"]) CFLAGS="$eso_save_CFLAGS" ]) if eval "test x\$AS_TR_SH([eso_cv_prog_cc_attribute_$1]) = xyes"; then : $4 else : $5 fi ]) # ESO_PROG_CC_ATTRIBUTE_VISIBILITY(ARG, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) #-------------------------------------------------------------------------------- AC_DEFUN([ESO_PROG_CC_ATTRIBUTE_VISIBILITY], [ ESO_PROG_CC_ATTRIBUTE([visibility_$1], [visibility("$1")], [void __attribute__((visibility("$1"))) $1_function() { }], [$2], [$3]) ]) # ESO_ENABLE_DEBUG(debug=no) #--------------------------- AC_DEFUN([ESO_ENABLE_DEBUG], [ AC_REQUIRE([AC_PROG_CC]) AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [creates debugging code [[default=$1]]]), eso_enable_debug=$enableval, eso_enable_debug=$1) AC_CACHE_CHECK([whether debugging code should be created], eso_cv_enable_debug, eso_cv_enable_debug=$eso_enable_debug) if test x"$eso_cv_enable_debug" = xyes; then eso_clean_CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]//g' \ -e 's/-g[[0-9]]//g' \ -e 's/-g[[a-z,A-Z]]* / /g' \ -e 's/-[[Og]]//g'`" ESO_PROG_CC_FLAG([g3], [CFLAGS="$CFLAGS -g3"]) if test x"$eso_cv_prog_cc_g3" = xyes; then CFLAGS="-g3" else if test x"$ac_cv_prog_cc_g" = xyes; then CFLAGS="-g" else CFLAGS="" fi fi ESO_PROG_CC_FLAG([ggdb], [CFLAGS="$CFLAGS -ggdb"]) ESO_PROG_CC_FLAG([O0], [CFLAGS="$CFLAGS -O0"]) ESO_PROG_CC_FLAG([rdynamic], [CFLAGS="$CFLAGS -rdynamic"]) ESO_PROG_CC_FLAG([Wall], [CFLAGS="$CFLAGS -Wall"]) ESO_PROG_CC_FLAG([W], [CFLAGS="$CFLAGS -W"]) CFLAGS="$CFLAGS $eso_clean_CFLAGS" ESO_DEBUG_FLAGS="-DESO_ENABLE_DEBUG" else ESO_DEBUG_FLAGS="-DNDEBUG" fi AC_SUBST(ESO_DEBUG_FLAGS) ]) # ESO_ENABLE_STRICT(strict=no) #----------------------------- AC_DEFUN([ESO_ENABLE_STRICT], [ AC_REQUIRE([AC_PROG_EGREP]) AC_REQUIRE([AC_PROG_CC]) AC_ARG_ENABLE(strict, AC_HELP_STRING([--enable-strict], [compiles with strict compiler options (may not work!) [[default=$1]]]), eso_enable_strict=$enableval, eso_enable_strict=$1) AC_CACHE_CHECK([whether strict compiler options should be used], eso_cv_enable_strict, eso_cv_enable_strict=$eso_enable_strict) if test x"$eso_cv_enable_strict" = xyes; then eso_enable_strict_std_set=no if test -n "$CFLAGS"; then echo $CFLAGS | $EGREP '(\-std=|-ansi)' >/dev/null 2>&1 if test x"$?" = x0; then eso_enable_strict_std_set=yes fi fi if test x"$eso_enable_strict_std_set" = xno; then ESO_PROG_CC_FLAG([std=c99], [CFLAGS="$CFLAGS -std=c99"]) fi ESO_PROG_CC_FLAG([pedantic], [CFLAGS="$CFLAGS -pedantic"]) fi ]) # ESO_ENABLE_PROFILE(profile=no) #----------------------------- AC_DEFUN([ESO_ENABLE_PROFILE], [ AC_REQUIRE([AC_PROG_CC]) AC_ARG_ENABLE(profile, AC_HELP_STRING([--enable-profile], [compiles with compiler options necessary for profiling (may not work!) [[default=$1]]]), eso_enable_profile=$enableval, eso_enable_profile=$1) AC_CACHE_CHECK([whether profiling compiler options should be used], eso_cv_enable_profile, eso_cv_enable_profile=$eso_enable_profile) if test x"$eso_cv_enable_profile" = xyes; then ESO_PROG_CC_FLAG([pg], [CFLAGS="$CFLAGS -pg"]) ESO_PROG_CC_FLAG([g], [CFLAGS="$CFLAGS -g"]) ESO_PROG_CC_FLAG([static-libgcc], [CFLAGS="$CFLAGS -static-libgcc"]) AC_ENABLE_SHARED(no) AC_ENABLE_STATIC(yes) fi ]) # ESO_CHECK_DOCTOOLS #------------------- AC_DEFUN([ESO_CHECK_DOCTOOLS], [ AC_ARG_VAR([DOXYGEN], [doxygen command]) AC_PATH_PROG([DOXYGEN], [doxygen]) AC_ARG_VAR([LATEX], [latex command]) AC_PATH_PROG([LATEX], [latex]) if test -z "${DOXYGEN}"; then DOXYGEN=":" fi if test -z "${LATEX}"; then LATEX=":" fi ]) # ESO_PROG_AR #------------ # Checks if ar is in the path AC_DEFUN([ESO_PROG_AR], [ AC_CHECK_PROG(AR, ar, ar, NONE) if test x"$AR" = xNONE; then AC_MSG_ERROR([Cannot find \'ar\']) fi ]) # ESO_PROG_PKGCONFIG #------------------- # Checks if pkg-config is in the path AC_DEFUN([ESO_PROG_PKGCONFIG], [ AC_ARG_VAR([PKGCONFIG], [pkg-config command]) AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config]) ]) # ESO_CHECK_EXTRA_LIBS #--------------------- # Check for non-standard headers and libraries AC_DEFUN([ESO_CHECK_EXTRA_LIBS], [ AC_ARG_WITH(extra-includes, AC_HELP_STRING([--with-extra-includes=DIR], [adds non standard include paths]), eso_with_extra_includes=$withval, eso_with_extra_includes=NONE) AC_ARG_WITH(extra-libs, AC_HELP_STRING([--with-extra-libs=DIR], [adds non standard library paths]), eso_with_extra_libs=$withval, eso_with_extra_libs=NONE) AC_MSG_CHECKING([for extra includes]) AC_CACHE_VAL([eso_cv_with_extra_includes], [ eso_cv_with_extra_includes=$eso_with_extra_includes ]) if test x"$eso_cv_with_extra_includes" != xNONE; then eso_save_IFS=$IFS IFS=':' for dir in $eso_cv_with_extra_includes; do EXTRA_INCLUDES="$EXTRA_INCLUDES -I$dir" done IFS=$eso_save_IFS AC_MSG_RESULT(added) else AC_MSG_RESULT(no) fi AC_MSG_CHECKING([for extra libs]) AC_CACHE_VAL([eso_cv_with_extra_libs], [ eso_cv_with_extra_libs=$eso_with_extra_libs ]) if test x"$eso_cv_with_extra_libs" != xNONE; then eso_save_IFS=$IFS IFS=':' for dir in $eso_cv_with_extra_libs; do EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$dir" done IFS=$eso_save_IFS AC_MSG_RESULT(added) else AC_MSG_RESULT(no) fi ]) # ESO_CHECK_THREADS_POSIX #------------------------ # Check whether the POSIX threads are available. The cached result is # set to 'yes' if either the compiler supports the '-pthread' flag, or linking # with the POSIX thread library works, and the header file defining the POSIX # threads symbols is present. If POSIX threads are not supported, the # result is set to 'no'. Whether the compiler supports POSIX threads, # or whether the library, and the header are available is stored in cache # variables. AC_DEFUN([ESO_CHECK_THREADS_POSIX], [ AC_REQUIRE([AC_PROG_CC]) ESO_PROG_CC_FLAG([pthread], [], []) AC_CHECK_LIB([pthread], [pthread_create], [eso_threads_have_libpthread=yes], [eso_threads_have_libpthread=no]) AC_CHECK_HEADER([pthread.h], [eso_threads_have_pthread_h=yes], [eso_threads_have_pthread_h=no]) if test x"$eso_threads_have_pthread_h" != xyes; then eso_threads_posix=no else if test x"$eso_threads_have_libpthread" != xyes && \ test x"$eso_cv_prog_cc_pthread" != xyes; then eso_threads_posix=no else eso_threads_posix=yes fi fi # Setup the POSIX thread symbols if test x"$eso_threads_have_pthread_h" = xyes; then AC_DEFINE([HAVE_PTHREAD_H], [1], [Define to 1 if you have .]) fi if test x"$eso_threads_posix" = xyes; then if test x"$eso_cv_prog_cc_pthread" = xyes; then PTHREAD_CFLAGS="-pthread" else PTHREAD_CFLAGS="" fi if test x"$eso_threads_have_libpthread" = xyes; then LIBPTHREAD="-lpthread" else LIBPTHREAD="" fi fi AC_CACHE_VAL(eso_cv_threads_posix_header, eso_cv_threads_posix_header=$eso_threads_have_pthread_h) AC_CACHE_VAL(eso_cv_threads_posix_lib, eso_cv_threads_posix_lib=$eso_threads_have_libpthread) AC_CACHE_VAL(eso_cv_threads_posix_flags, eso_cv_threads_posix_flags=$eso_cv_prog_cc_pthread) AC_CACHE_VAL(eso_cv_threads_posix, eso_cv_threads_posix=$eso_threads_posix) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(LIBPTHREAD) ]) # ESO_CHECK_FUNC(FUNCTION, INCLUDES, SYMBOL) #------------------------------------------- # Checks whether a function is available and declared. AC_DEFUN([ESO_CHECK_FUNC], [ AC_LANG_PUSH(C) AC_CHECK_DECL($1, [], [], [$2]) eso_save_CFLAGS="$CFLAGS" if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -pedantic-errors" fi AC_CHECK_FUNC($1) CFLAGS="$eso_save_CFLAGS" AC_LANG_POP(C) if test x"$ac_cv_have_decl_$1" = xyes && test x"$ac_cv_func_$1" = xyes; then AC_DEFINE($3) fi ]) # ESO_FUNC_VSNPRINTF_C99 #----------------------- # Check whether vsnprintf() has C99 semantics. AC_DEFUN([ESO_FUNC_VSNPRINTF_C99], [ AH_TEMPLATE([HAVE_VSNPRINTF_C99], [Define if you have the C99 `vsnprintf' function.]) AC_CACHE_CHECK([whether vsnprintf has C99 semantics], [eso_cv_func_vsnprintf_c99], [ AC_LANG_PUSH(C) eso_cppflags_save="$CPPFLAGS" eso_cflags_save="$CFLAGS" eso_ldflags_save="$LDFLAGS" eso_libs_save="$LIBS" if test x$GCC = xyes; then CFLAGS="$CFLAGS -pedantic-errors" CPPFLAGS="$CPPFLAGS $CFLAGS" fi AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include #include #include int doit(char * s, ...) { char buffer[32]; va_list args; int q, r; va_start(args, s); q = vsnprintf(NULL, 0, s, args); r = vsnprintf(buffer, 5, s, args); va_end(args); if (q != 7 || r != 7) exit(1); exit(0); } ]], [[ doit((char*)"1234567"); exit(1); ]]) ], [eso_cv_func_vsnprintf_c99=yes], [eso_cv_func_vsnprintf_c99=no], [eso_cv_func_vsnprintf_c99=no]) CPPFLAGS="$eso_cppflags_save" CFLAGS="$eso_cflags_save" LDFLAGS="$eso_ldflags_save" LIBS="$eso_libs_save" AC_LANG_POP(C) ]) # Note that the default is to be pessimistic in the case of cross compilation. # If you know that the target has a C99 vsnprintf(), you can get around this # by setting eso_func_vsnprintf_c99 to yes, as described in the Autoconf # manual. if test x$eso_cv_func_vsnprintf_c99 = xyes; then AC_DEFINE(HAVE_VSNPRINTF_C99) fi ]) # ESO_CHECK_PRINTF_FORMATS #------------------------- # Checks for printf() format peculiarities. AC_DEFUN([ESO_CHECK_PRINTF_FORMATS], [ # Check if string format for NULL is `(null)' AH_TEMPLATE([HAVE_PRINTF_STR_FMT_NULL], [Define if printf outputs `(null)' when printing NULL using `%s']) AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include #include ]], [[ char s[128]; sprintf(s, "%s", NULL); return strncmp(s, "(null)", 6) ? 1 : 0; ]]) ], [eso_have_printf_str_format_null=yes], [eso_have_printf_str_format_null=no], [eso_have_printf_str_format_null=no]) if test x$eso_have_printf_str_format_null = xyes; then AC_DEFINE(HAVE_PRINTF_STR_FMT_NULL) fi # Check if pointer format for NULL is `(nil)' AH_TEMPLATE([HAVE_PRINTF_PTR_FMT_NIL], [Define if printf outputs `(nil)' when printing NULL using `%p']) AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include #include ]], [[ char s[128]; sprintf(s, "%p", NULL); return strncmp(s, "(nil)", 5) ? 1 : 0; ]]) ], [eso_have_printf_ptr_format_nil=yes], [eso_have_printf_ptr_format_nil=no], [eso_have_printf_ptr_format_nil=no]) if test x$eso_have_printf_ptr_format_nil = xyes; then AC_DEFINE(HAVE_PRINTF_PTR_FMT_NIL) fi # Check if output for `%p' is the same as `%#x' AH_TEMPLATE([HAVE_PRINTF_PTR_FMT_ALTERNATE], [Define if printf format `%p' produces the same output as `%#x' or `%#lx']) AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include #include ]], [[ char s1[128], s2[128]; sprintf(s1, "%p", s1); sprintf(s2, "%#x", s1); return strncmp(s1, s2, 3) ? 1 : 0; ]]) ], [eso_have_printf_ptr_format_alternate=yes], [eso_have_printf_ptr_format_alternate=no], [eso_have_printf_ptr_format_alternate=no]) if test x$eso_have_printf_ptr_format_alternate = xyes; then AC_DEFINE(HAVE_PRINTF_PTR_FMT_ALTERNATE) fi # Check if pointers are treated as signed AH_TEMPLATE([HAVE_PRINTF_PTR_FMT_SIGNED], [Define if printf treats pointers as signed when using a sign flag]) AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include ]], [[ char s[128]; sprintf(s, "%+p", s); return s[0] == '+' ? 0 : 1; ]]) ], [eso_have_printf_ptr_format_signed=yes], [eso_have_printf_ptr_format_signed=no], [eso_have_printf_ptr_format_signed=no]) if test x$eso_have_printf_ptr_format_signed = xyes; then AC_DEFINE(HAVE_PRINTF_PTR_FMT_SIGNED) fi # Check if default precision for conversion specifier `g' is 1 (as # required by ISO C) or 6. AH_TEMPLATE([HAVE_PRINTF_FLT_FMT_G_STD], [Define if printf default precision for format `g' is 1 (ISO C standard) or 6]) AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include ]], [[ char s1[128], s2[128]; int n1, n2; sprintf(s1, "%g%n", 1.123456, &n1); sprintf(s2, "%.1g%n", 1.123456, &n2); return n1 > n2 ? 1 : 0; ]]) ], [eso_have_printf_flt_format_g_std=yes], [eso_have_printf_flt_format_g_std=no], [eso_have_printf_flt_format_g_std=no]) if test x$eso_have_printf_flt_format_g_std = xyes; then AC_DEFINE(HAVE_PRINTF_FLT_FMT_G_STD) fi ]) # ESO_FUNC_VSNPRINTF #------------------- # Checks for vsnprintf and snprintf declaration and function. AC_DEFUN([ESO_FUNC_VSNPRINTF], [ eso_compile_snprintf=no AH_TEMPLATE([HAVE_VSNPRINTF], [Define if you have the `vsnprintf' function]) ESO_CHECK_FUNC(vsnprintf, [ #include #include ], HAVE_VSNPRINTF) if test x$ac_cv_func_vsnprintf = xyes && test x$ac_cv_have_decl_vsnprintf = xyes; then ESO_FUNC_VSNPRINTF_C99 if test x$eso_cv_func_vsnprintf_c99 != xyes; then eso_compile_snprintf=yes fi else eso_compile_snprintf=yes fi if test x$eso_compile_snprintf = xyes; then if test -n "$LIBTOOL"; then SNPRINTF=snprintf.lo else SNPRINTF=snprintf.$ac_objext fi fi AC_SUBST(SNPRINTF) # The symbols defined by the following macro are only needed to setup the # vsnprintf() replacement. May be useless if the vsnprintf implementation # changes. ESO_CHECK_PRINTF_FORMATS AH_TEMPLATE([HAVE_SNPRINTF], [Define if you have the `snprintf' function]) ESO_CHECK_FUNC(snprintf, [#include ], HAVE_SNPRINTF) ]) # ESO_FUNC_VASPRINTF #------------------- # Checks for vasprintf and asprintf declaration and function. AC_DEFUN([ESO_FUNC_VASPRINTF], [ AH_TEMPLATE([HAVE_VASPRINTF], [Define if you have the `vasprintf' function]) ESO_CHECK_FUNC(vasprintf, [ #include #include ], HAVE_VASPRINTF) AH_TEMPLATE([HAVE_ASPRINTF], [Define if you have the `asprintf' function]) ESO_CHECK_FUNC(asprintf, [ #include ], HAVE_ASPRINTF) ]) # ESO_FUNC_FPATHCONF #------------------- # Checks for fpathconf declaration and function. AC_DEFUN([ESO_FUNC_FPATHCONF], [ AH_TEMPLATE([HAVE_FPATHCONF], [Define if you have the `fpathconf' function]) ESO_CHECK_FUNC(fpathconf, [#include ], HAVE_FPATHCONF) # If we have fpathconf we should also have pathconf, but who knows. AH_TEMPLATE([HAVE_PATHCONF], [Define if you have the `pathconf' function]) ESO_CHECK_FUNC(pathconf, [#include ], HAVE_PATHCONF) ]) # ESO_FUNC_SYSCONF #----------------- # Checks for sysconf declaration and function. AC_DEFUN([ESO_FUNC_SYSCONF], [ AH_TEMPLATE([HAVE_SYSCONF], [Define if you have the `sysconf' function]) ESO_CHECK_FUNC(sysconf, [#include ], HAVE_SYSCONF) ]) # ESO_FUNC_GETOPT #---------------- # Checks for GNU getopt_long declaration and function. AC_DEFUN([ESO_FUNC_GETOPT], [ AH_TEMPLATE([HAVE_GETOPT_LONG], [Define if you have the `getopt_long' function]) ESO_CHECK_FUNC(getopt_long, [#include ], HAVE_GETOPT_LONG) if test x"$ac_cv_func_getopt_long" = xno || test x"$eso_cv_have_decl_getopt_long" = xno; then if test -n "$LIBTOOL"; then GETOPT="getopt.lo getopt1.lo" else GETOPT="getopt.$ac_objext getopt1.$ac_objext" fi fi AC_SUBST(GETOPT) ]) # ESO_FUNC_GETPWUID #------------------ # Checks for getpwuid declaration and function. AC_DEFUN([ESO_FUNC_GETPWUID], [ AH_TEMPLATE([HAVE_GETPWUID], [Define if you have the `getpwuid' function]) ESO_CHECK_FUNC(getpwuid, [#include ], HAVE_GETPWUID) ]) # ESO_FUNC_GETUID #---------------- AC_DEFUN([ESO_FUNC_GETUID], [ AH_TEMPLATE([HAVE_GETUID], [Define if you have the `getuid' function]) ESO_CHECK_FUNC(getuid, [#include ], HAVE_GETUID) ]) # ESO_FUNC_LSTAT #--------------- AC_DEFUN([ESO_FUNC_LSTAT], [ AH_TEMPLATE([HAVE_LSTAT], [Define if you have the `lstat' function]) ESO_CHECK_FUNC(lstat, [#include ], HAVE_LSTAT) ]) # ESO_FUNC_STRDUP #---------------- AC_DEFUN([ESO_FUNC_STRDUP], [ AH_TEMPLATE([HAVE_STRDUP], [Define if you have the `strdup' function]) ESO_CHECK_FUNC(strdup, [#include ], HAVE_STRDUP) AH_BOTTOM([ #ifndef HAVE_STRDUP # define strdup cx_strdup #endif ]) ]) # ESO_FUNC_STPCPY #---------------- AC_DEFUN([ESO_FUNC_STPCPY], [ AH_TEMPLATE([HAVE_STPCPY], [Define if you have the `stpcpy' function]) ESO_CHECK_FUNC(stpcpy, [#include ], HAVE_STPCPY) ]) # ESO_FUNC_SYMLINK #----------------- AC_DEFUN([ESO_FUNC_SYMLINK], [ AH_TEMPLATE([HAVE_SYMLINK], [Define if you have the `symlink' function]) ESO_CHECK_FUNC(symlink, [#include ], HAVE_SYMLINK) ]) # ESO_FUNC_WORDEXP #----------------- AC_DEFUN([ESO_FUNC_WORDEXP], [ AH_TEMPLATE([HAVE_WORDEXP], [Define if you have the `wordexp' function]) ESO_CHECK_FUNC(wordexp, [#include ], HAVE_WORDEXP) ]) # ESO_FUNC_GETTIMEOFDAY #---------------------- AC_DEFUN([ESO_FUNC_GETTIMEOFDAY], [ AH_TEMPLATE([HAVE_GETTIMEOFDAY], [Define if you have the `gettimeofday' function]) ESO_CHECK_FUNC(gettimeofday, [ #include #include ], HAVE_GETTIMEOFDAY) ]) # ESO_FUNC_VA_COPY(symbol) #------------------------- # Check for an implementation of va_copy(). The argument which must be # given is the preprocessor symbol that is defined to be either va_copy # or __va_copy depending on the available function, provided that an # implementation of va_copy is available at all. AC_DEFUN([ESO_FUNC_VA_COPY], [ # Check for all three va_copy possibilities, so we get # all results in config.log for bug reports. # Check for availability of va_copy(). This is ISO C. Available with # gcc since version 3.0. AC_CACHE_CHECK([for an implementation of va_copy()], [eso_cv_have_va_copy], [ AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #ifdef HAVE_STDARG_H #include #endif void f(int i, ...) { va_list args1, args2; va_start (args1, i); va_copy (args2, args1); if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) exit (1); va_end (args1); va_end (args2); } ]], [[ f(0, 42); ]]) ], [eso_cv_have_va_copy=yes], [eso_cv_have_va_copy=no], [eso_cv_have_va_copy=no]) ]) # Check for availability of __va_copy(). Some compilers provide # this. Available with gcc since version 2.8.1. AC_CACHE_CHECK([for an implementation of __va_copy()], [eso_cv_have__va_copy], [ AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #ifdef HAVE_STDARG_H #include #endif void f(int i, ...) { va_list args1, args2; va_start (args1, i); __va_copy (args2, args1); if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) exit (1); va_end (args1); va_end (args2); } ]], [[ f(0, 42); ]]) ], [eso_cv_have__va_copy=yes], [eso_cv_have__va_copy=no], [eso_cv_have__va_copy=no]) ]) AH_TEMPLATE([HAVE_VA_COPY], [Define if you have an implementation of `va_copy()'.]) AH_TEMPLATE([HAVE___VA_COPY], [Define if you have an implementation of `__va_copy()'.]) if test "x$eso_cv_have_va_copy" = "xyes"; then eso_func_va_copy=va_copy AC_DEFINE(HAVE_VA_COPY) else if test "x$eso_cv_have__va_copy" = "xyes"; then eso_func_va_copy=__va_copy AC_DEFINE(HAVE___VA_COPY) fi fi AH_TEMPLATE([HAVE_VA_COPY_STYLE_FUNCTION], [Define if you have an implementation of a `va_copy()' style function.]) AH_TEMPLATE([$1], [A `va_copy()' style function]) if test -n "$eso_func_va_copy"; then AC_DEFINE_UNQUOTED([$1], $eso_func_va_copy) AC_DEFINE(HAVE_VA_COPY_STYLE_FUNCTION) fi # Check whether va_lists can be copied by value AC_CACHE_CHECK([whether va_lists can be copied by value], [eso_cv_have_va_value_copy], [ AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #ifdef HAVE_STDARG_H #include #endif void f(int i, ...) { va_list args1, args2; va_start (args1, i); args2 = args1; if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) exit (1); va_end (args1); va_end (args2); } ]], [[ f(0, 42); ]]) ], [eso_cv_have_va_value_copy=yes], [eso_cv_have_va_value_copy=no], [eso_cv_have_va_value_copy=no]) ]) AH_TEMPLATE([HAVE_VA_LIST_COPY_BY_VALUE], [Define if `va_lists' can be copied by value]) if test "x$eso_cv_have_va_value_copy" = "xyes"; then AC_DEFINE(HAVE_VA_LIST_COPY_BY_VALUE) fi ]) # ESO_FUNC_REALLOC_SANITY #------------------------- # Check whether realloc(NULL,) works. AC_DEFUN([ESO_FUNC_REALLOC_SANITY], [ AC_CACHE_CHECK([whether realloc(NULL,) works], [eso_cv_have_sane_realloc], [ AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include ]], [[ return realloc (0, sizeof (int)) == 0; ]]) ], [eso_cv_have_sane_realloc=yes], [eso_cv_have_sane_realloc=no], [eso_cv_have_sane_realloc=no]) ]) AH_TEMPLATE([HAVE_WORKING_REALLOC], [Define if realloc(NULL,) works]) if test x$eso_cv_have_sane_realloc = xyes; then AC_DEFINE(HAVE_WORKING_REALLOC) fi ]) # ESO_FIND_FILE(file, directories, variable) #------------------------------------------ # Search for file in directories. Set variable to the first location # where file was found, if file is not found at all variable is set to NO. AC_DEFUN([ESO_FIND_FILE], [ $3=no for i in $2; do for j in $1; do echo "configure: __oline__: $i/$j" >&AC_FD_CC if test -r "$i/$j"; then echo "taking that" >&AC_FD_CC $3=$i break 2 fi done done ]) # ESO_SET_LIBRARY_VERSION([CURRENT], [REVISION], [AGE]) #------------------------------------------------------ # Sets the libtool versioning symbols LT_CURRENT, LT_REVISION, LT_AGE. AC_DEFUN([ESO_SET_LIBRARY_VERSION], [ if test -z "$1"; then LT_CURRENT=0 else LT_CURRENT="$1" fi if test -z "$2"; then LT_REVISION=0 else LT_REVISION="$2" fi if test -z "$3"; then LT_AGE=0 else LT_AGE="$3" fi AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) ]) cpl-6.4.1/m4/ltdl.m40000644000460300003120000006466312310332714010746 00000000000000# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- # # Copyright (C) 1999-2006, 2007, 2008, 2011 Free Software Foundation, Inc. # Written by Thomas Tanner, 1999 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 18 LTDL_INIT # LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) # ------------------------------------------ # DIRECTORY contains the libltdl sources. It is okay to call this # function multiple times, as long as the same DIRECTORY is always given. AC_DEFUN([LT_CONFIG_LTDL_DIR], [AC_BEFORE([$0], [LTDL_INIT]) _$0($*) ])# LT_CONFIG_LTDL_DIR # We break this out into a separate macro, so that we can call it safely # internally without being caught accidentally by the sed scan in libtoolize. m4_defun([_LT_CONFIG_LTDL_DIR], [dnl remove trailing slashes m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$])) m4_case(_LTDL_DIR, [], [dnl only set lt_ltdl_dir if _ARG_DIR is not simply `.' m4_if(_ARG_DIR, [.], [], [m4_define([_LTDL_DIR], _ARG_DIR) _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])])], [m4_if(_ARG_DIR, _LTDL_DIR, [], [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', `]_ARG_DIR['])])]) m4_popdef([_ARG_DIR]) ])# _LT_CONFIG_LTDL_DIR # Initialise: m4_define([_LTDL_DIR], []) # _LT_BUILD_PREFIX # ---------------- # If Autoconf is new enough, expand to `${top_build_prefix}', otherwise # to `${top_builddir}/'. m4_define([_LT_BUILD_PREFIX], [m4_ifdef([AC_AUTOCONF_VERSION], [m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.62]), [-1], [m4_ifdef([_AC_HAVE_TOP_BUILD_PREFIX], [${top_build_prefix}], [${top_builddir}/])], [${top_build_prefix}])], [${top_builddir}/])[]dnl ]) # LTDL_CONVENIENCE # ---------------- # sets LIBLTDL to the link flags for the libltdl convenience library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-convenience to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called here. LIBLTDL will be prefixed with # '${top_build_prefix}' if available, otherwise with '${top_builddir}/', # and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single # quotes!). If your package is not flat and you're not using automake, # define top_build_prefix, top_builddir, and top_srcdir appropriately # in your Makefiles. AC_DEFUN([LTDL_CONVENIENCE], [AC_BEFORE([$0], [LTDL_INIT])dnl dnl Although the argument is deprecated and no longer documented, dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one dnl here make sure it is the same as any other declaration of libltdl's dnl location! This also ensures lt_ltdl_dir is set when configure.ac is dnl not yet using an explicit LT_CONFIG_LTDL_DIR. m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl _$0() ])# LTDL_CONVENIENCE # AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools, # now we have LT_CONFIG_LTDL_DIR: AU_DEFUN([AC_LIBLTDL_CONVENIENCE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) _LTDL_CONVENIENCE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], []) # _LTDL_CONVENIENCE # ----------------- # Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]). m4_defun([_LTDL_CONVENIENCE], [case $enable_ltdl_convenience in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" LTDLDEPS=$LIBLTDL LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" AC_SUBST([LIBLTDL]) AC_SUBST([LTDLDEPS]) AC_SUBST([LTDLINCL]) # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" AC_SUBST([INCLTDL]) ])# _LTDL_CONVENIENCE # LTDL_INSTALLABLE # ---------------- # sets LIBLTDL to the link flags for the libltdl installable library # and LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-install to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called from here. If an installed libltdl # is not found, LIBLTDL will be prefixed with '${top_build_prefix}' if # available, otherwise with '${top_builddir}/', and LTDLINCL will be # prefixed with '${top_srcdir}/' (note the single quotes!). If your # package is not flat and you're not using automake, define top_build_prefix, # top_builddir, and top_srcdir appropriately in your Makefiles. # In the future, this macro may have to be called after LT_INIT. AC_DEFUN([LTDL_INSTALLABLE], [AC_BEFORE([$0], [LTDL_INIT])dnl dnl Although the argument is deprecated and no longer documented, dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one dnl here make sure it is the same as any other declaration of libltdl's dnl location! This also ensures lt_ltdl_dir is set when configure.ac is dnl not yet using an explicit LT_CONFIG_LTDL_DIR. m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl _$0() ])# LTDL_INSTALLABLE # AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools, # now we have LT_CONFIG_LTDL_DIR: AU_DEFUN([AC_LIBLTDL_INSTALLABLE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) _LTDL_INSTALLABLE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], []) # _LTDL_INSTALLABLE # ----------------- # Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]). m4_defun([_LTDL_INSTALLABLE], [if test -f $prefix/lib/libltdl.la; then lt_save_LDFLAGS="$LDFLAGS" LDFLAGS="-L$prefix/lib $LDFLAGS" AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes]) LDFLAGS="$lt_save_LDFLAGS" if test x"${lt_lib_ltdl-no}" = xyes; then if test x"$enable_ltdl_install" != xyes; then # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install AC_MSG_WARN([not overwriting libltdl at $prefix, force with `--enable-ltdl-install']) enable_ltdl_install=no fi elif test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) fi fi # If configure.ac declared an installable ltdl, and the user didn't override # with --disable-ltdl-install, we will install the shipped libltdl. case $enable_ltdl_install in no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" LTDLDEPS= LTDLINCL= ;; *) enable_ltdl_install=yes ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la" LTDLDEPS=$LIBLTDL LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" ;; esac AC_SUBST([LIBLTDL]) AC_SUBST([LTDLDEPS]) AC_SUBST([LTDLINCL]) # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" AC_SUBST([INCLTDL]) ])# LTDL_INSTALLABLE # _LTDL_MODE_DISPATCH # ------------------- m4_define([_LTDL_MODE_DISPATCH], [dnl If _LTDL_DIR is `.', then we are configuring libltdl itself: m4_if(_LTDL_DIR, [], [], dnl if _LTDL_MODE was not set already, the default value is `subproject': [m4_case(m4_default(_LTDL_MODE, [subproject]), [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR) _LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"])], [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"; lt_libobj_prefix="$lt_ltdl_dir/"])], [recursive], [], [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl dnl Be careful not to expand twice: m4_define([$0], []) ])# _LTDL_MODE_DISPATCH # _LT_LIBOBJ(MODULE_NAME) # ----------------------- # Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS instead # of into LIBOBJS. AC_DEFUN([_LT_LIBOBJ], [ m4_pattern_allow([^_LT_LIBOBJS$]) _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" ])# _LT_LIBOBJS # LTDL_INIT([OPTIONS]) # -------------------- # Clients of libltdl can use this macro to allow the installer to # choose between a shipped copy of the ltdl sources or a preinstalled # version of the library. If the shipped ltdl sources are not in a # subdirectory named libltdl, the directory name must be given by # LT_CONFIG_LTDL_DIR. AC_DEFUN([LTDL_INIT], [dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) dnl We need to keep our own list of libobjs separate from our parent project, dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while dnl we look for our own LIBOBJs. m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) m4_pushdef([AC_LIBSOURCES]) dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: m4_if(_LTDL_MODE, [], [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) AC_ARG_WITH([included_ltdl], [AS_HELP_STRING([--with-included-ltdl], [use the GNU ltdl sources included here])]) if test "x$with_included_ltdl" != xyes; then # We are not being forced to use the included libltdl sources, so # decide whether there is a useful installed version we can use. AC_CHECK_HEADER([ltdl.h], [AC_CHECK_DECL([lt_dlinterface_register], [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], [with_included_ltdl=no], [with_included_ltdl=yes])], [with_included_ltdl=yes], [AC_INCLUDES_DEFAULT #include ])], [with_included_ltdl=yes], [AC_INCLUDES_DEFAULT] ) fi dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE dnl was called yet, then for old times' sake, we assume libltdl is in an dnl eponymous directory: AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) AC_ARG_WITH([ltdl_include], [AS_HELP_STRING([--with-ltdl-include=DIR], [use the ltdl headers installed in DIR])]) if test -n "$with_ltdl_include"; then if test -f "$with_ltdl_include/ltdl.h"; then : else AC_MSG_ERROR([invalid ltdl include directory: `$with_ltdl_include']) fi else with_ltdl_include=no fi AC_ARG_WITH([ltdl_lib], [AS_HELP_STRING([--with-ltdl-lib=DIR], [use the libltdl.la installed in DIR])]) if test -n "$with_ltdl_lib"; then if test -f "$with_ltdl_lib/libltdl.la"; then : else AC_MSG_ERROR([invalid ltdl library directory: `$with_ltdl_lib']) fi else with_ltdl_lib=no fi case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in ,yes,no,no,) m4_case(m4_default(_LTDL_TYPE, [convenience]), [convenience], [_LTDL_CONVENIENCE], [installable], [_LTDL_INSTALLABLE], [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) ;; ,no,no,no,) # If the included ltdl is not to be used, then use the # preinstalled libltdl we found. AC_DEFINE([HAVE_LTDL], [1], [Define this if a modern libltdl is already installed]) LIBLTDL=-lltdl LTDLDEPS= LTDLINCL= ;; ,no*,no,*) AC_MSG_ERROR([`--with-ltdl-include' and `--with-ltdl-lib' options must be used together]) ;; *) with_included_ltdl=no LIBLTDL="-L$with_ltdl_lib -lltdl" LTDLDEPS= LTDLINCL="-I$with_ltdl_include" ;; esac INCLTDL="$LTDLINCL" # Report our decision... AC_MSG_CHECKING([where to find libltdl headers]) AC_MSG_RESULT([$LTDLINCL]) AC_MSG_CHECKING([where to find libltdl library]) AC_MSG_RESULT([$LIBLTDL]) _LTDL_SETUP dnl restore autoconf definition. m4_popdef([AC_LIBOBJ]) m4_popdef([AC_LIBSOURCES]) AC_CONFIG_COMMANDS_PRE([ _ltdl_libobjs= _ltdl_ltlibobjs= if test -n "$_LT_LIBOBJS"; then # Remove the extension. _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" done fi AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) ]) # Only expand once: m4_define([LTDL_INIT]) ])# LTDL_INIT # Old names: AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIB_LTDL], []) dnl AC_DEFUN([AC_WITH_LTDL], []) dnl AC_DEFUN([LT_WITH_LTDL], []) # _LTDL_SETUP # ----------- # Perform all the checks necessary for compilation of the ltdl objects # -- including compiler checks and header checks. This is a public # interface mainly for the benefit of libltdl's own configure.ac, most # other users should call LTDL_INIT instead. AC_DEFUN([_LTDL_SETUP], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_SYS_MODULE_EXT])dnl AC_REQUIRE([LT_SYS_MODULE_PATH])dnl AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl AC_REQUIRE([LT_LIB_DLLOAD])dnl AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl AC_REQUIRE([gl_FUNC_ARGZ])dnl m4_require([_LT_CHECK_OBJDIR])dnl m4_require([_LT_HEADER_DLFCN])dnl m4_require([_LT_CHECK_DLPREOPEN])dnl m4_require([_LT_DECL_SED])dnl dnl Don't require this, or it will be expanded earlier than the code dnl that sets the variables it relies on: _LT_ENABLE_INSTALL dnl _LTDL_MODE specific code must be called at least once: _LTDL_MODE_DISPATCH # In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS # the user used. This is so that ltdl.h can pick up the parent projects # config.h file, The first file in AC_CONFIG_HEADERS must contain the # definitions required by ltdl.c. # FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). AC_CONFIG_COMMANDS_PRE([dnl m4_pattern_allow([^LT_CONFIG_H$])dnl m4_ifset([AH_HEADER], [LT_CONFIG_H=AH_HEADER], [m4_ifset([AC_LIST_HEADERS], [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[ ]]*,,;s,[[ :]].*$,,'`], [])])]) AC_SUBST([LT_CONFIG_H]) AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], [], [], [AC_INCLUDES_DEFAULT]) AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) m4_pattern_allow([LT_LIBEXT])dnl AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) name= eval "lt_libprefix=\"$libname_spec\"" m4_pattern_allow([LT_LIBPREFIX])dnl AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix]) name=ltdl eval "LTDLOPEN=\"$libname_spec\"" AC_SUBST([LTDLOPEN]) ])# _LTDL_SETUP # _LT_ENABLE_INSTALL # ------------------ m4_define([_LT_ENABLE_INSTALL], [AC_ARG_ENABLE([ltdl-install], [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])]) case ,${enable_ltdl_install},${enable_ltdl_convenience} in *yes*) ;; *) enable_ltdl_convenience=yes ;; esac m4_ifdef([AM_CONDITIONAL], [AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno) AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)]) ])# _LT_ENABLE_INSTALL # LT_SYS_DLOPEN_DEPLIBS # --------------------- AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_CACHE_CHECK([whether deplibs are loaded by dlopen], [lt_cv_sys_dlopen_deplibs], [# PORTME does your system automatically load deplibs for dlopen? # or its logical equivalent (e.g. shl_load for HP-UX < 11) # For now, we just catch OSes we know something about -- in the # future, we'll try test this programmatically. lt_cv_sys_dlopen_deplibs=unknown case $host_os in aix3*|aix4.1.*|aix4.2.*) # Unknown whether this is true for these versions of AIX, but # we want this `case' here to explicitly catch those versions. lt_cv_sys_dlopen_deplibs=unknown ;; aix[[4-9]]*) lt_cv_sys_dlopen_deplibs=yes ;; amigaos*) case $host_cpu in powerpc) lt_cv_sys_dlopen_deplibs=no ;; esac ;; darwin*) # Assuming the user has installed a libdl from somewhere, this is true # If you are looking for one http://www.opendarwin.org/projects/dlcompat lt_cv_sys_dlopen_deplibs=yes ;; freebsd* | dragonfly*) lt_cv_sys_dlopen_deplibs=yes ;; gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) # GNU and its variants, using gnu ld.so (Glibc) lt_cv_sys_dlopen_deplibs=yes ;; hpux10*|hpux11*) lt_cv_sys_dlopen_deplibs=yes ;; interix*) lt_cv_sys_dlopen_deplibs=yes ;; irix[[12345]]*|irix6.[[01]]*) # Catch all versions of IRIX before 6.2, and indicate that we don't # know how it worked for any of those versions. lt_cv_sys_dlopen_deplibs=unknown ;; irix*) # The case above catches anything before 6.2, and it's known that # at 6.2 and later dlopen does load deplibs. lt_cv_sys_dlopen_deplibs=yes ;; netbsd*) lt_cv_sys_dlopen_deplibs=yes ;; openbsd*) lt_cv_sys_dlopen_deplibs=yes ;; osf[[1234]]*) # dlopen did load deplibs (at least at 4.x), but until the 5.x series, # it did *not* use an RPATH in a shared library to find objects the # library depends on, so we explicitly say `no'. lt_cv_sys_dlopen_deplibs=no ;; osf5.0|osf5.0a|osf5.1) # dlopen *does* load deplibs and with the right loader patch applied # it even uses RPATH in a shared library to search for shared objects # that the library depends on, but there's no easy way to know if that # patch is installed. Since this is the case, all we can really # say is unknown -- it depends on the patch being installed. If # it is, this changes to `yes'. Without it, it would be `no'. lt_cv_sys_dlopen_deplibs=unknown ;; osf*) # the two cases above should catch all versions of osf <= 5.1. Read # the comments above for what we know about them. # At > 5.1, deplibs are loaded *and* any RPATH in a shared library # is used to find them so we can finally say `yes'. lt_cv_sys_dlopen_deplibs=yes ;; qnx*) lt_cv_sys_dlopen_deplibs=yes ;; solaris*) lt_cv_sys_dlopen_deplibs=yes ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) libltdl_cv_sys_dlopen_deplibs=yes ;; esac ]) if test "$lt_cv_sys_dlopen_deplibs" != yes; then AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], [Define if the OS needs help to load dependent libraries for dlopen().]) fi ])# LT_SYS_DLOPEN_DEPLIBS # Old name: AU_ALIAS([AC_LTDL_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], []) # LT_SYS_MODULE_EXT # ----------------- AC_DEFUN([LT_SYS_MODULE_EXT], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([which extension is used for runtime loadable modules], [libltdl_cv_shlibext], [ module=yes eval libltdl_cv_shlibext=$shrext_cmds module=no eval libltdl_cv_shrext=$shrext_cmds ]) if test -n "$libltdl_cv_shlibext"; then m4_pattern_allow([LT_MODULE_EXT])dnl AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], [Define to the extension used for runtime loadable modules, say, ".so".]) fi if test "$libltdl_cv_shrext" != "$libltdl_cv_shlibext"; then m4_pattern_allow([LT_SHARED_EXT])dnl AC_DEFINE_UNQUOTED([LT_SHARED_EXT], ["$libltdl_cv_shrext"], [Define to the shared library suffix, say, ".dylib".]) fi ])# LT_SYS_MODULE_EXT # Old name: AU_ALIAS([AC_LTDL_SHLIBEXT], [LT_SYS_MODULE_EXT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SHLIBEXT], []) # LT_SYS_MODULE_PATH # ------------------ AC_DEFUN([LT_SYS_MODULE_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([which variable specifies run-time module search path], [lt_cv_module_path_var], [lt_cv_module_path_var="$shlibpath_var"]) if test -n "$lt_cv_module_path_var"; then m4_pattern_allow([LT_MODULE_PATH_VAR])dnl AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], [Define to the name of the environment variable that determines the run-time module search path.]) fi ])# LT_SYS_MODULE_PATH # Old name: AU_ALIAS([AC_LTDL_SHLIBPATH], [LT_SYS_MODULE_PATH]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SHLIBPATH], []) # LT_SYS_DLSEARCH_PATH # -------------------- AC_DEFUN([LT_SYS_DLSEARCH_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([for the default library search path], [lt_cv_sys_dlsearch_path], [lt_cv_sys_dlsearch_path="$sys_lib_dlsearch_path_spec"]) if test -n "$lt_cv_sys_dlsearch_path"; then sys_dlsearch_path= for dir in $lt_cv_sys_dlsearch_path; do if test -z "$sys_dlsearch_path"; then sys_dlsearch_path="$dir" else sys_dlsearch_path="$sys_dlsearch_path$PATH_SEPARATOR$dir" fi done m4_pattern_allow([LT_DLSEARCH_PATH])dnl AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], [Define to the system default library search path.]) fi ])# LT_SYS_DLSEARCH_PATH # Old name: AU_ALIAS([AC_LTDL_SYSSEARCHPATH], [LT_SYS_DLSEARCH_PATH]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SYSSEARCHPATH], []) # _LT_CHECK_DLPREOPEN # ------------------- m4_defun([_LT_CHECK_DLPREOPEN], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], [libltdl_cv_preloaded_symbols], [if test -n "$lt_cv_sys_global_symbol_pipe"; then libltdl_cv_preloaded_symbols=yes else libltdl_cv_preloaded_symbols=no fi ]) if test x"$libltdl_cv_preloaded_symbols" = xyes; then AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1], [Define if libtool can extract symbol lists from object files.]) fi ])# _LT_CHECK_DLPREOPEN # LT_LIB_DLLOAD # ------------- AC_DEFUN([LT_LIB_DLLOAD], [m4_pattern_allow([^LT_DLLOADERS$]) LT_DLLOADERS= AC_SUBST([LT_DLLOADERS]) AC_LANG_PUSH([C]) LIBADD_DLOPEN= AC_SEARCH_LIBS([dlopen], [dl], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) if test "$ac_cv_search_dlopen" != "none required" ; then LIBADD_DLOPEN="-ldl" fi libltdl_cv_lib_dl_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H # include #endif ]], [[dlopen(0, 0);]])], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) libltdl_cv_func_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], [AC_CHECK_LIB([svld], [dlopen], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes then lt_save_LIBS="$LIBS" LIBS="$LIBS $LIBADD_DLOPEN" AC_CHECK_FUNCS([dlerror]) LIBS="$lt_save_LIBS" fi AC_SUBST([LIBADD_DLOPEN]) LIBADD_SHL_LOAD= AC_CHECK_FUNC([shl_load], [AC_DEFINE([HAVE_SHL_LOAD], [1], [Define if you have the shl_load function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], [AC_CHECK_LIB([dld], [shl_load], [AC_DEFINE([HAVE_SHL_LOAD], [1], [Define if you have the shl_load function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" LIBADD_SHL_LOAD="-ldld"])]) AC_SUBST([LIBADD_SHL_LOAD]) case $host_os in darwin[[1567]].*) # We only want this for pre-Mac OS X 10.4. AC_CHECK_FUNC([_dyld_func_lookup], [AC_DEFINE([HAVE_DYLD], [1], [Define if you have the _dyld_func_lookup function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) ;; beos*) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" ;; cygwin* | mingw* | os2* | pw32*) AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" ;; esac AC_CHECK_LIB([dld], [dld_link], [AC_DEFINE([HAVE_DLD], [1], [Define if you have the GNU dld library.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) AC_SUBST([LIBADD_DLD_LINK]) m4_pattern_allow([^LT_DLPREOPEN$]) LT_DLPREOPEN= if test -n "$LT_DLLOADERS" then for lt_loader in $LT_DLLOADERS; do LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " done AC_DEFINE([HAVE_LIBDLLOADER], [1], [Define if libdlloader will be built on this platform]) fi AC_SUBST([LT_DLPREOPEN]) dnl This isn't used anymore, but set it for backwards compatibility LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" AC_SUBST([LIBADD_DL]) AC_LANG_POP ])# LT_LIB_DLLOAD # Old name: AU_ALIAS([AC_LTDL_DLLIB], [LT_LIB_DLLOAD]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_DLLIB], []) # LT_SYS_SYMBOL_USCORE # -------------------- # does the compiler prefix global symbols with an underscore? AC_DEFUN([LT_SYS_SYMBOL_USCORE], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl AC_CACHE_CHECK([for _ prefix in compiled symbols], [lt_cv_sys_symbol_underscore], [lt_cv_sys_symbol_underscore=no cat > conftest.$ac_ext <<_LT_EOF void nm_test_func(){} int main(){nm_test_func;return 0;} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. ac_nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then # See whether the symbols have a leading underscore. if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then lt_cv_sys_symbol_underscore=yes else if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then : else echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD fi fi else echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.c >&AS_MESSAGE_LOG_FD fi rm -rf conftest* ]) sys_symbol_underscore=$lt_cv_sys_symbol_underscore AC_SUBST([sys_symbol_underscore]) ])# LT_SYS_SYMBOL_USCORE # Old name: AU_ALIAS([AC_LTDL_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SYMBOL_USCORE], []) # LT_FUNC_DLSYM_USCORE # -------------------- AC_DEFUN([LT_FUNC_DLSYM_USCORE], [AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl if test x"$lt_cv_sys_symbol_underscore" = xyes; then if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then AC_CACHE_CHECK([whether we have to add an underscore for dlsym], [libltdl_cv_need_uscore], [libltdl_cv_need_uscore=unknown save_LIBS="$LIBS" LIBS="$LIBS $LIBADD_DLOPEN" _LT_TRY_DLOPEN_SELF( [libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes], [], [libltdl_cv_need_uscore=cross]) LIBS="$save_LIBS" ]) fi fi if test x"$libltdl_cv_need_uscore" = xyes; then AC_DEFINE([NEED_USCORE], [1], [Define if dlsym() requires a leading underscore in symbol names.]) fi ])# LT_FUNC_DLSYM_USCORE # Old name: AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) cpl-6.4.1/m4/purify.m40000644000460300003120000000121212111147377011312 00000000000000# ESO_PROG_PURIFY #---------------- # Checks for the availability of purify AC_DEFUN([ESO_PROG_PURIFY], [ AC_ARG_VAR([PURIFY], [Purify command]) AC_ARG_ENABLE(purify, AC_HELP_STRING([--disable-purify], [disables the check for the Purify installation]), enable_purify=$enableval, enable_purify=yes) if test x"$enable_purify" = xyes ; then AC_PATH_PROG([PURIFY], [purify]) if test -z "${PURIFY}"; then enable_purify=no PURIFY=":" fi fi AM_CONDITIONAL([USE_PURIFY], [test "x$enable_purify" = "xyes"]) ]) cpl-6.4.1/m4/cpl.m40000644000460300003120000012772312110715617010567 00000000000000# CPL_CHECK_CFITSIO(version) #--------------------------- # Checks for the cfitsio library and header files. AC_DEFUN([CPL_CHECK_CFITSIO], [ AC_REQUIRE([AC_SYS_LARGEFILE]) AC_REQUIRE([ESO_CHECK_THREADS_POSIX]) cpl_cfitsio_check_version="$1" cpl_cfitsio_check_header="fitsio.h" cpl_cfitsio_check_lib="libcfitsio.a" cpl_cfitsio_incdirs="" cpl_cfitsio_libdirs="" cpl_cfitsio_includes="" cpl_cfitsio_libraries="" AC_ARG_WITH(cfitsio, AC_HELP_STRING([--with-cfitsio], [location where cfitsio is installed]), [ cpl_with_cfitsio=$withval ]) AC_ARG_WITH(cfitsio-includes, AC_HELP_STRING([--with-cfitsio-includes], [location of the cfitsio header files]), cpl_with_cfitsio_includes=$withval) AC_ARG_WITH(cfitsio-libs, AC_HELP_STRING([--with-cfitsio-libs], [location of the cfitsio library]), cpl_with_cfitsio_libs=$withval) AC_ARG_ENABLE(cfitsio-test, AC_HELP_STRING([--disable-cfitsio-test], [disables checks for the cfitsio library and headers]), cpl_enable_cfitsio_test=$enableval, cpl_enable_cfitsio_test=yes) # We need libpthread for the folloing tests if test -z "$LIBPTHREAD"; then AC_MSG_ERROR([POSIX thread library was not found on your system! Please check!]) fi AC_MSG_CHECKING([for cfitsio]) if test "x$cpl_enable_cfitsio_test" = xyes; then # Check for the cfitsio includes if test -z "$cpl_with_cfitsio_includes"; then if test -z "$cpl_with_cfitsio"; then # Try some known system locations cpl_cfitsio_incdirs="/opt/cfitsio/include" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/local/include/libcfitsio0" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/local/include/cfitsio" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/local/include" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/include/libcfitsio0" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/include/cfitsio" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/include" test -n "$CFITSIODIR" && \ cpl_cfitsio_incdirs="$CFITSIODIR/include/libcfitsio0 \ $CFITSIODIR/include/cfitsio \ $CFITSIODIR/include \ $cpl_cfitsio_incdirs" test -n "$CPLDIR" && \ cpl_cfitsio_incdirs="$CPLDIR/include/libcfitsio0 \ $CPLDIR/include/cfitsio \ $CPLDIR/include \ $cpl_cfitsio_incdirs" else cpl_cfitsio_incdirs="$cpl_with_cfitsio/include/libcfitsio0" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs $cpl_with_cfitsio/include/cfitsio" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs $cpl_with_cfitsio/include" fi else cpl_cfitsio_incdirs="$cpl_with_cfitsio_includes" fi ESO_FIND_FILE($cpl_cfitsio_check_header, $cpl_cfitsio_incdirs, cpl_cfitsio_includes) # Check for the cfitsio library if test -z "$cpl_with_cfitsio_libs"; then if test -z "$cpl_with_cfitsio"; then # Try some known system locations cpl_cfitsio_libdirs="/opt/cfitsio/lib" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/local/lib64" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/local/lib" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/local/lib32" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/lib64" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/lib" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/lib32" test -n "$CFITSIODIR" && \ cpl_cfitsio_libdirs="$CFITSIODIR/lib64 $CFITSIODIR/lib \ $CFITSIODIR/lib32 $cpl_cfitsio_libdirs" test -n "$CPLDIR" && \ cpl_cfitsio_libdirs="$CPLDIR/lib64 $CPLDIR/lib $CPLDIR/lib32 \ $cpl_cfitsio_libdirs" else cpl_cfitsio_libdirs="$cpl_with_cfitsio/lib64" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs $cpl_with_cfitsio/lib" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs $cpl_with_cfitsio/lib32" fi else cpl_cfitsio_libdirs="$cpl_with_cfitsio_libs" fi ESO_FIND_FILE($cpl_cfitsio_check_lib, $cpl_cfitsio_libdirs, cpl_cfitsio_libraries) if test x"$cpl_cfitsio_includes" = xno || \ test x"$cpl_cfitsio_libraries" = xno; then cpl_cfitsio_notfound="" if test x"$cpl_cfitsio_includes" = xno; then if test x"$cpl_cfitsio_libraries" = xno; then cpl_cfitsio_notfound="(headers and libraries)" else cpl_cfitsio_notfound="(headers)" fi else cpl_cfitsio_notfound="(libraries)" fi AC_MSG_ERROR([cfitsio $cpl_cfitsio_notfound was not found on your system. Please check!]) else AC_MSG_RESULT([libraries $cpl_cfitsio_libraries, headers $cpl_cfitsio_includes]) fi # Set up the symbols # Add '-lz' to the static library symbol, as distributors apparently # remove the libz code from the cfitsio sources. CFITSIO_INCLUDES="-I$cpl_cfitsio_includes" CFITSIO_LDFLAGS="-L$cpl_cfitsio_libraries" LIBCFITSIO="-lcfitsio" LIBCFITSIO_STATIC="$cpl_cfitsio_libraries/$cpl_cfitsio_check_lib" # Do not add redundant libraries echo $LIBS | grep -q -e '-lm' || LIBS="-lm $LIBS" # Check whether cfitsio can be used AC_MSG_CHECKING([whether cfitsio can be used]) AC_LANG_PUSH(C) cpl_cfitsio_cflags_save="$CFLAGS" cpl_cfitsio_ldflags_save="$LDFLAGS" cpl_cfitsio_libs_save="$LIBS" CFLAGS="$CFITSIO_INCLUDES $CFLAGS" LDFLAGS="$CFITSIO_LDFLAGS $LDFLAGS" LIBS="$LIBCFITSIO_STATIC $LIBPTHREAD -lm" AC_LINK_IFELSE([AC_LANG_PROGRAM( [[ #include ]], [ float v; fits_get_version(&v); ])], [cpl_cfitsio_is_usable="yes"], [cpl_cfitsio_is_usable="no"]) AC_MSG_RESULT([$cpl_cfitsio_is_usable]) AC_LANG_POP(C) CFLAGS="$cpl_cfitsio_cflags_save" LDFLAGS="$cpl_cfitsio_ldflags_save" LIBS="$cpl_cfitsio_libs_save" if test x"$cpl_cfitsio_is_usable" = xno; then AC_MSG_ERROR([Linking with cfitsio failed! Please check architecture!]) fi # Check cfitsio version AC_MSG_CHECKING([for a cfitsio version >= $cpl_cfitsio_check_version]) AC_LANG_PUSH(C) cpl_cfitsio_cflags_save="$CFLAGS" cpl_cfitsio_ldflags_save="$LDFLAGS" cpl_cfitsio_libs_save="$LIBS" CFLAGS="$CFITSIO_INCLUDES $CFLAGS" AC_RUN_IFELSE([AC_LANG_PROGRAM( [[ #include #include ]], [ int vlib = 0; int vmin = (int)(1000. * $cpl_cfitsio_check_version + 0.5); float v = CFITSIO_VERSION; vlib = (int)(v * 1000 + 0.5); FILE* f = fopen("conftest.out", "w"); fprintf(f, "%5.3f\n", v); fclose(f); if (vlib < vmin) { return 1; } return 0; ])], [cpl_cfitsio_version="`cat conftest.out`"], [ cpl_cfitsio_version="no"; cpl_cfitsio_version_found="`cat conftest.out`" ]) AC_MSG_RESULT([$cpl_cfitsio_version]) AC_LANG_POP(C) CFLAGS="$cpl_cfitsio_cflags_save" LDFLAGS="$cpl_cfitsio_ldflags_save" LIBS="$cpl_cfitsio_libs_save" if test x"$cpl_cfitsio_version" = xno; then AC_MSG_ERROR([Installed cfitsio ($cpl_cfitsio_version_found) is too old. Please update to version $cpl_cfitsio_check_version or newer.]) fi # Check whether cfitsio has large file support AC_LANG_PUSH(C) cpl_cfitsio_cflags_save="$CFLAGS" cpl_cfitsio_ldflags_save="$LDFLAGS" cpl_cfitsio_libs_save="$LIBS" CFLAGS="$CFITSIO_INCLUDES $CFLAGS" LDFLAGS="$CFITSIO_LDFLAGS $LDFLAGS" LIBS="$LIBCFITSIO_STATIC -lm $LIBPTHREAD" AC_MSG_CHECKING([whether cfitsio provides fits_hdu_getoff()]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #include ]], [ fitsfile f; int sts; fits_get_hduoff(&f, NULL, NULL, NULL, &sts); ])], [cpl_cfitsio_have_fits_get_hduoff="yes"], [cpl_cfitsio_have_fits_get_hduoff="no"]) AC_MSG_RESULT([$cpl_cfitsio_have_fits_get_hduoff]) AC_MSG_CHECKING([whether cfitsio provides fits_get_hduaddrll()]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #include ]], [ fitsfile f; int sts; fits_get_hduaddrll(&f, NULL, NULL, NULL, &sts); ])], [cpl_cfitsio_have_fits_get_hduaddrll="yes"], [cpl_cfitsio_have_fits_get_hduaddrll="no"]) AC_MSG_RESULT([$cpl_cfitsio_have_fits_get_hduaddrll]) AC_LANG_POP(C) CFLAGS="$cpl_cfitsio_cflags_save" LDFLAGS="$cpl_cfitsio_ldflags_save" LIBS="$cpl_cfitsio_libs_save" # Check whether cfitsio is thread-safe AC_MSG_CHECKING([whether cfitsio was compiled with thread support]) AC_LANG_PUSH(C) cpl_cfitsio_cflags_save="$CFLAGS" cpl_cfitsio_ldflags_save="$LDFLAGS" cpl_cfitsio_libs_save="$LIBS" CFLAGS="$CFITSIO_INCLUDES $CFLAGS" LDFLAGS="$CFITSIO_LDFLAGS $LDFLAGS" LIBS="$LIBCFITSIO_STATIC -lm" AC_RUN_IFELSE([AC_LANG_PROGRAM( [[ #include ]], [ if (fits_is_reentrant() == 0) { return 1; } return 0; ])], [cpl_cfitsio_is_thread_safe=yes], [cpl_cfitsio_is_thread_safe=no]) AC_MSG_RESULT([$cpl_cfitsio_is_thread_safe]) AC_LANG_POP(C) CFLAGS="$cpl_cfitsio_cflags_save" LDFLAGS="$cpl_cfitsio_ldflags_save" LIBS="$cpl_cfitsio_libs_save" # Set compiler flags and libraries if test x"$cpl_cfitsio_have_fits_get_hduoff" = xyes || \ test x"$cpl_cfitsio_have_fits_get_hduaddrll" = xyes; then if test x"$cpl_cfitsio_have_fits_get_hduoff"; then AC_DEFINE([HAVE_FITS_GET_HDUOFF], [1], [Define if you have the `fits_get_hduoff' function]) else AC_DEFINE([HAVE_FITS_GET_HDUADDRLL], [1], [Define if you have the `fits_get_hduaddrll' function]) fi fi else AC_MSG_RESULT([disabled]) AC_MSG_WARN([cfitsio checks have been disabled! This package may not build!]) CFITSIO_INCLUDES="" CFITSIO_LDFLAGS="" LIBCFITSIO="" cpl_cfitsio_is_thread_safe="undefined" fi AC_CACHE_VAL(cpl_cv_cfitsio_is_thread_safe, cpl_cv_cfitsio_is_thread_safe=$cpl_cfitsio_is_thread_safe) AC_SUBST(CFITSIO_INCLUDES) AC_SUBST(CFITSIO_LDFLAGS) AC_SUBST(LIBCFITSIO) ]) # CPL_CHECK_CEXT(incdirs=[], libdirs=[]) #--------------------------------------- # Checks for the C extension library and header files. AC_DEFUN([CPL_CHECK_CEXT], [ AC_MSG_CHECKING([for libcext]) cpl_cext_check_header="cxtypes.h" cpl_cext_check_lib="libcext.a" cpl_cext_incdirs="" cpl_cext_libdirs="" cpl_cext_includes="" cpl_cext_libraries="" # Initialize directory search paths with the arguments provided if test -n "$1"; then cpl_cext_incdirs="$1" fi if test -n "$2"; then cpl_cext_libdirs="$2" fi AC_ARG_WITH(cext, AC_HELP_STRING([--with-cext], [location where libcext is installed]), [ cpl_with_cext=$withval ]) AC_ARG_WITH(cext-includes, AC_HELP_STRING([--with-cext-includes], [location of the libcext header files]), cpl_with_cext_includes=$withval) AC_ARG_WITH(cext-libs, AC_HELP_STRING([--with-cext-libs], [location of the libcext library]), cpl_with_cext_libs=$withval) AC_ARG_ENABLE(cext-test, AC_HELP_STRING([--disable-cext-test], [disables checks for the libcext library and headers]), cpl_enable_cext_test=$enableval, cpl_enable_cext_test=yes) if test "x$cpl_enable_cext_test" = xyes; then # Check for the libcext includes if test -z "$cpl_with_cext_includes"; then if test -z "$cpl_with_cext"; then if test -z "$cpl_cext_incdirs"; then # Try some known system locations cpl_cext_incdirs="/opt/cext/include" cpl_cext_incdirs="$cpl_cext_incdirs /usr/local/include/cext" cpl_cext_incdirs="$cpl_cext_incdirs /usr/local/include" cpl_cext_incdirs="$cpl_cext_incdirs /usr/include/cext" cpl_cext_incdirs="$cpl_cext_incdirs /usr/include" test -n "$CPLDIR" && \ cpl_cext_incdirs="$CPLDIR/include/cext \ $CPLDIR/include \ $cpl_cext_incdirs" fi else cpl_cext_incdirs="$cpl_with_cext/include/cext" cpl_cext_incdirs="$cpl_cext_incdirs $cpl_with_cext/include" fi else cpl_cext_incdirs="$cpl_with_cext_includes" fi ESO_FIND_FILE($cpl_cext_check_header, $cpl_cext_incdirs, cpl_cext_includes) # Check for the libcext library if test -z "$cpl_with_cext_libs"; then if test -z "$cpl_with_cext"; then if test -z "$cpl_cext_libdirs"; then # Try some known system locations cpl_cext_libdirs="/opt/cext/lib" cpl_cext_libdirs="$cpl_cext_libdirs /usr/local/lib64" cpl_cext_libdirs="$cpl_cext_libdirs /usr/local/lib" cpl_cext_libdirs="$cpl_cext_libdirs /usr/local/lib32" cpl_cext_libdirs="$cpl_cext_libdirs /usr/lib64" cpl_cext_libdirs="$cpl_cext_libdirs /usr/lib" cpl_cext_libdirs="$cpl_cext_libdirs /usr/lib32" test -n "$CPLDIR" && \ cpl_cext_libdirs="$CPLDIR/lib64 \ $CPLDIR/lib \ $CPLDIR/lib32 \ $cpl_cext_libdirs" fi else cpl_cext_libdirs="$cpl_with_cext/lib64" cpl_cext_libdirs="$cpl_cext_libdirs $cpl_with_cext/lib" cpl_cext_libdirs="$cpl_cext_libdirs $cpl_with_cext/lib32" fi else cpl_cext_libdirs="$cpl_with_cext_libs" fi ESO_FIND_FILE($cpl_cext_check_lib, $cpl_cext_libdirs, cpl_cext_libraries) if test x"$cpl_cext_includes" = xno || \ test x"$cpl_cext_libraries" = xno; then cpl_cext_notfound="" if test x"$cpl_cext_includes" = xno; then if test x"$cpl_cext_libraries" = xno; then cpl_cext_notfound="(headers and libraries)" else cpl_cext_notfound="(headers)" fi else cpl_cext_notfound="(libraries)" fi AC_MSG_ERROR([libcext $cpl_cext_notfound was not found on your system. Please check!]) else AC_MSG_RESULT([libraries $cpl_cext_libraries, headers $cpl_cext_includes]) fi # Set up the symbols CX_INCLUDES="-I$cpl_cext_includes" CX_LDFLAGS="-L$cpl_cext_libraries" LIBCEXT="-lcext" AC_MSG_CHECKING([whether libcext can be used]) AC_LANG_PUSH(C) cpl_cext_cflags_save="$CFLAGS" cpl_cext_ldflags_save="$LDFLAGS" cpl_cext_libs_save="$LIBS" CFLAGS="$CX_INCLUDES $CFLAGS" LDFLAGS="$CX_LDFLAGS $LDFLAGS" LIBS="$LIBCEXT" AC_LINK_IFELSE([AC_LANG_PROGRAM( [[ #include ]], [ cx_program_set_name("MyProgram"); ])], [cpl_cext_is_usable="yes"], [cpl_cext_is_usable="no"]) AC_MSG_RESULT([$cpl_cext_is_usable]) AC_LANG_POP(C) CFLAGS="$cpl_cext_cflags_save" LDFLAGS="$cpl_cext_ldflags_save" LIBS="$cpl_cext_libs_save" if test x"$cpl_cext_is_usable" = xno; then AC_MSG_ERROR([Linking with libcext failed! Please check architecture!]) fi else AC_MSG_RESULT([disabled]) AC_MSG_WARN([libcext checks have been disabled! This package may not build!]) CX_INCLUDES="" CX_LDFLAGS="" LIBCEXT="" fi AC_SUBST(CX_INCLUDES) AC_SUBST(CX_LDFLAGS) AC_SUBST(LIBCEXT) ]) # CPL_CHECK_WCS(version) #----------------------- # Checks for the wcs library and header files. AC_DEFUN([CPL_CHECK_WCS], [ AC_MSG_CHECKING([for libwcs]) cpl_wcs_check_version="$1" cpl_wcs_check_header="wcslib/wcslib.h" cpl_wcs_check_lib="libwcs.a" cpl_wcs_includes="" cpl_wcs_libraries="" AC_ARG_WITH(wcs, AC_HELP_STRING([--with-wcs], [location where wcs is installed]), [ cpl_with_wcs=$withval ]) AC_ARG_WITH(wcs-includes, AC_HELP_STRING([--with-wcs-includes], [location of the libwcs header files]), cpl_with_wcs_includes=$withval) AC_ARG_WITH(wcs-libs, AC_HELP_STRING([--with-wcs-libs], [location of the libwcs library]), cpl_with_wcs_libs=$withval) # Check for the wcs includes if test -z "$cpl_with_wcs_includes"; then if test -z "$cpl_with_wcs"; then # Try some known system locations cpl_wcs_incdirs="/opt/wcslib/include/wcslib" cpl_wcs_incdirs="$cpl_wcs_incdirs /usr/local/include/wcslib" cpl_wcs_incdirs="$cpl_wcs_incdirs /usr/local/include" cpl_wcs_incdirs="$cpl_wcs_incdirs /usr/include/wcslib" cpl_wcs_incdirs="$cpl_wcs_incdirs /usr/include" test -n "$WCSDIR" && \ cpl_wcs_incdirs="$WCSDIR/include \ $cpl_wcs_incdirs" else cpl_wcs_incdirs="$cpl_with_wcs/include" fi else cpl_wcs_incdirs="$cpl_with_wcs_includes" fi ESO_FIND_FILE($cpl_wcs_check_header, $cpl_wcs_incdirs, cpl_wcs_includes) # Check for the wcs library if test -z "$cpl_with_wcs_libs"; then if test -z "$cpl_with_wcs"; then # Try some known system locations cpl_wcs_libdirs="/opt/wcslib/lib64" cpl_wcs_libdirs="$cpl_wcs_libdirs /opt/wcslib/lib" cpl_wcs_libdirs="$cpl_wcs_libdirs /opt/wcslib/lib32" cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/local/lib64" cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/local/lib" cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/local/lib32" cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/lib64" cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/lib" cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/lib32" test -n "$WCSDIR" && \ cpl_wcs_libdirs="$WCSDIR/lib64 \ $WCSDIR/lib \ $WCSDIR/lib32 \ $cpl_wcs_libdirs" else cpl_wcs_libdirs="$cpl_with_wcs/lib64" cpl_wcs_libdirs="$cpl_wcs_libdirs $cpl_with_wcs/lib" cpl_wcs_libdirs="$cpl_wcs_libdirs $cpl_with_wcs/lib32" fi else cpl_wcs_libdirs="$cpl_with_wcs_libs" fi ESO_FIND_FILE($cpl_wcs_check_lib, $cpl_wcs_libdirs, cpl_wcs_libraries) if test x"$cpl_wcs_includes" = xno || \ test x"$cpl_wcs_libraries" = xno; then cpl_wcs_notfound="" if test x"$cpl_wcs_includes" = xno; then if test x"$cpl_wcs_libraries" = xno; then cpl_wcs_notfound="(headers and libraries)" else cpl_wcs_notfound="(headers)" fi else cpl_wcs_notfound="(libraries)" fi AC_MSG_WARN([libwcs $cpl_wcs_notfound was not found on your system. WCS support will be disabled!]) else AC_MSG_RESULT([libraries $cpl_wcs_libraries, headers $cpl_wcs_includes]) # Setup the symbols WCS_INCLUDES="-I$cpl_wcs_includes/wcslib" WCS_LDFLAGS="-L$cpl_wcs_libraries" LIBWCS="-lwcs -lm" LIBWCS_STATIC="$cpl_wcs_libraries/$cpl_wcs_check_lib -lm" # Check wcs library version AC_MSG_CHECKING([for a libwcs version >= $cpl_wcs_check_version]) AC_LANG_PUSH(C) cpl_wcs_cflags_save="$CFLAGS" cpl_wcs_ldflags_save="$LDFLAGS" cpl_wcs_libs_save="$LIBS" CFLAGS="$WCS_INCLUDES $CFLAGS" LDFLAGS="$WCS_LDFLAGS $LDFLAGS" LIBS="$LIBWCS_STATIC" AC_RUN_IFELSE([AC_LANG_PROGRAM( [[ #include #include #define stringify(v) stringify_arg(v) #define stringify_arg(v) #v ]], [ char vmin[[]] = "$cpl_wcs_check_version"; char vlib[[]] = stringify(WCSLIB_VERSION); int min_major = 0; int min_minor = 0; int min_micro = 0; int lib_major = 0; int lib_minor = 0; int lib_micro = 0; sscanf(vmin, "%d.%d.%d", &min_major, &min_minor, &min_micro); sscanf(vlib, "%d.%d.%d", &lib_major, &lib_minor, &lib_micro); FILE* f = fopen("conftest.out", "w"); fprintf(f, "%s\n", vlib); fclose(f); if (lib_major < min_major) { return 1; } else { if (lib_major == min_major) { if (lib_minor < min_minor) { return 1; } else { if (lib_minor == min_minor) { if (lib_micro < min_micro) { return 1; } } } } } return 0; ])], [cpl_wcs_version="`cat conftest.out`"], [ cpl_wcs_version="no"; cpl_wcs_version_found="`cat conftest.out`" ]) AC_MSG_RESULT([$cpl_wcs_version]) AC_LANG_POP(C) CFLAGS="$cpl_wcs_cflags_save" LDFLAGS="$cpl_wcs_ldflags_save" LIBS="$cpl_wcs_libs_save" if test x"$cpl_wcs_version" = xno; then AC_MSG_WARN([Installed libwcs ($cpl_wcs_version_found) is too old. WCS support will not be available!]) WCS_INCLUDES="" WCS_LDFLAGS="" LIBWCS="" else AC_DEFINE_UNQUOTED(CPL_WCS_INSTALLED, 1, [Defined if WCS is available]) fi AC_SUBST(WCS_INCLUDES) AC_SUBST(WCS_LDFLAGS) AC_SUBST(LIBWCS) fi ]) # CPL_CHECK_FFTW(version) #------------------------ # Checks for the FFTW library and header files. AC_DEFUN([CPL_CHECK_FFTW], [ cpl_fftw_check_version="$1" cpl_fftw_check_header="fftw3.h" cpl_fftw_check_lib="libfftw3.a" cpl_fftwf_check_lib="libfftw3f.a" cpl_fftw_includes="" cpl_fftw_libraries="" cpl_fftwf_libraries="" AC_ARG_WITH(fftw, AC_HELP_STRING([--with-fftw], [location where fftw is installed]), [ cpl_with_fftw=$withval ]) AC_ARG_WITH(fftw-includes, AC_HELP_STRING([--with-fftw-includes], [location of the fftw header files]), cpl_with_fftw_includes=$withval) AC_ARG_WITH(fftw-libs, AC_HELP_STRING([--with-fftw-libs], [location of the fftw libraries]), cpl_with_fftw_libs=$withval) AC_MSG_CHECKING([for fftw (normal-precision)]) # Check for the fftw includes if test -z "$cpl_with_fftw_includes"; then if test -z "$cpl_with_fftw"; then # Try some known system locations cpl_fftw_incdirs="/opt/fftw/include" cpl_fftw_incdirs="$cpl_fftw_incdirs /usr/local/include" cpl_fftw_incdirs="$cpl_fftw_incdirs /usr/include" test -n "$FFTWDIR" && \ cpl_fftw_incdirs="$FFTWDIR/include \ $cpl_fftw_incdirs" else cpl_fftw_incdirs="$cpl_with_fftw/include" fi else cpl_fftw_incdirs="$cpl_with_fftw_includes" fi ESO_FIND_FILE($cpl_fftw_check_header, $cpl_fftw_incdirs, cpl_fftw_includes) # Check for normal-precision fftw library if test -z "$cpl_with_fftw_libs"; then if test -z "$cpl_with_fftw"; then # Try some known system locations cpl_fftw_libdirs="/opt/fftw/lib64" cpl_fftw_libdirs="$cpl_fftw_libdirs /opt/fftw/lib" cpl_fftw_libdirs="$cpl_fftw_libdirs /opt/fftw/lib32" cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/local/lib64" cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/local/lib" cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/local/lib32" cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/lib64" cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/lib" cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/lib32" test -n "$FFTWDIR" && \ cpl_fftw_libdirs="$FFTWDIR/lib64 \ $FFTWDIR/lib \ $FFTWDIR/lib32 \ $cpl_fftw_libdirs" else cpl_fftw_libdirs="$cpl_with_fftw/lib64" cpl_fftw_libdirs="$cpl_fftw_libdirs $cpl_with_fftw/lib" cpl_fftw_libdirs="$cpl_fftw_libdirs $cpl_with_fftw/lib32" fi else cpl_fftw_libdirs="$cpl_with_fftw_libs" fi ESO_FIND_FILE($cpl_fftw_check_lib, $cpl_fftw_libdirs, cpl_fftw_libraries) if test x"$cpl_fftw_includes" = xno || \ test x"$cpl_fftw_libraries" = xno; then cpl_fftw_notfound="" if test x"$cpl_fftw_includes" = xno; then if test x"$cpl_fftw_libraries" = xno; then cpl_fftw_notfound="(headers and libraries)" else cpl_fftw_notfound="(headers)" fi else cpl_fftw_notfound="(libraries)" fi AC_MSG_RESULT([no]) AC_MSG_WARN([fftw (normal-precision) $cpl_fftw_notfound was not found on your system.]) else AC_MSG_RESULT([libraries $cpl_fftw_libraries, headers $cpl_fftw_includes]) # Set up the symbols FFTW_INCLUDES="-I$cpl_fftw_includes" FFTW_LDFLAGS="-L$cpl_fftw_libraries" LIBFFTW="-lfftw3 -lm" LIBFFTW_STATIC="$cpl_fftw_libraries/$cpl_fftw_check_lib -lm" # Check fftw (normal-precision) library version AC_MSG_CHECKING([for a fftw (normal-precision) version >= $cpl_fftw_check_version]) AC_LANG_PUSH(C) cpl_fftw_cflags_save="$CFLAGS" cpl_fftw_ldflags_save="$LDFLAGS" cpl_fftw_libs_save="$LIBS" CFLAGS="$FFTW_INCLUDES $CFLAGS" LDFLAGS="$FFTW_LDFLAGS $LDFLAGS" LIBS="$LIBFFTW_STATIC" AC_RUN_IFELSE([AC_LANG_PROGRAM( [[ #include #include #include #include ]], [ char vmin[[]] = "$cpl_fftw_check_version"; char *vstr = strdup(fftw_version); char *vlib = vstr; char *suffix = NULL; int min_major = 0; int min_minor = 0; int min_micro = 0; int lib_major = 0; int lib_minor = 0; int lib_micro = 0; vlib = strchr(vstr, '-') + 1; suffix = strrchr(vlib, '-'); if (suffix) { *suffix = '\0'; } sscanf(vmin, "%d.%d.%d", &min_major, &min_minor, &min_micro); sscanf(vlib, "%d.%d.%d", &lib_major, &lib_minor, &lib_micro); FILE* f = fopen("conftest.out", "w"); fprintf(f, "%s\n", vlib); fclose(f); free(vstr); if (lib_major < min_major) { return 1; } else { if (lib_major == min_major) { if (lib_minor < min_minor) { return 1; } else { if (lib_minor == min_minor) { if (lib_micro < min_micro) { return 1; } } } } } return 0; ])], [cpl_fftw_version="`cat conftest.out`"], [ cpl_fftw_version="no"; cpl_fftw_version_found="`cat conftest.out`" ]) AC_MSG_RESULT([$cpl_fftw_version]) AC_LANG_POP(C) CFLAGS="$cpl_fftw_cflags_save" LDFLAGS="$cpl_fftw_ldflags_save" LIBS="$cpl_fftw_libs_save" if test x"$cpl_fftw_version" = xno; then AC_MSG_WARN([Installed normal-precision fftw ($cpl_fftw_version_found) is too old]) FFTW_INCLUDES="" FFTW_LDFLAGS="" LIBFFTW="" else AC_DEFINE_UNQUOTED(CPL_FFTW_INSTALLED, 1, [Defined if FFTW (normal-precision) is available]) fi AC_SUBST(FFTW_INCLUDES) AC_SUBST(FFTW_LDFLAGS) AC_SUBST(LIBFFTW) fi # Check for single-precision fftw AC_MSG_CHECKING([for fftw (single-precision)]) ESO_FIND_FILE($cpl_fftwf_check_lib, $cpl_fftw_libdirs, cpl_fftwf_libraries) if test x"$cpl_fftw_includes" = xno || \ test x"$cpl_fftwf_libraries" = xno; then cpl_fftw_notfound="" if test x"$cpl_fftw_includes" = xno; then if test x"$cpl_fftwf_libraries" = xno; then cpl_fftw_notfound="(headers and libraries)" else cpl_fftw_notfound="(headers)" fi else cpl_fftw_notfound="(libraries)" fi AC_MSG_RESULT([no]) AC_MSG_WARN([fftw (single-precision) $cpl_fftw_notfound was not found on your system.]) else AC_MSG_RESULT([libraries $cpl_fftwf_libraries, headers $cpl_fftw_includes]) # Set up the symbols FFTWF_INCLUDES="-I$cpl_fftw_includes" FFTWF_LDFLAGS="-L$cpl_fftwf_libraries" LIBFFTWF="-lfftw3f -lm" LIBFFTWF_STATIC="$cpl_fftwf_libraries/$cpl_fftwf_check_lib -lm" # Check fftw (single-precision) library version AC_MSG_CHECKING([for a fftw (single-precision) version >= $cpl_fftw_check_version]) AC_LANG_PUSH(C) cpl_fftw_cflags_save="$CFLAGS" cpl_fftw_ldflags_save="$LDFLAGS" cpl_fftw_libs_save="$LIBS" CFLAGS="$FFTWF_INCLUDES $CFLAGS" LDFLAGS="$FFTWF_LDFLAGS $LDFLAGS" LIBS="$LIBFFTWF" AC_RUN_IFELSE([AC_LANG_PROGRAM( [[ #include #include #include #include ]], [ char vmin[[]] = "$cpl_fftw_check_version"; char *vstr = strdup(fftwf_version); char *vlib = vstr; char *suffix = NULL; int min_major = 0; int min_minor = 0; int min_micro = 0; int lib_major = 0; int lib_minor = 0; int lib_micro = 0; vlib = strchr(vstr, '-') + 1; suffix = strrchr(vlib, '-'); if (suffix) { *suffix = '\0'; } sscanf(vmin, "%d.%d.%d", &min_major, &min_minor, &min_micro); sscanf(vlib, "%d.%d.%d", &lib_major, &lib_minor, &lib_micro); FILE* f = fopen("conftest.out", "w"); fprintf(f, "%s\n", vlib); fclose(f); free(vstr); if (lib_major < min_major) { return 1; } else { if (lib_major == min_major) { if (lib_minor < min_minor) { return 1; } else { if (lib_minor == min_minor) { if (lib_micro < min_micro) { return 1; } } } } } return 0; ])], [cpl_fftwf_version="`cat conftest.out`"], [ cpl_fftwf_version="no"; cpl_fftwf_version_found="`cat conftest.out`" ]) AC_MSG_RESULT([$cpl_fftwf_version]) AC_LANG_POP(C) CFLAGS="$cpl_fftw_cflags_save" LDFLAGS="$cpl_fftw_ldflags_save" LIBS="$cpl_fftw_libs_save" if test x"$cpl_fftwf_version" = xno; then AC_MSG_WARN([Installed single-precision fftw ($cpl_fftw_version_found) is too old!]) FFTWF_INCLUDES="" FFTWF_LDFLAGS="" LIBFFTWF="" else AC_DEFINE_UNQUOTED(CPL_FFTWF_INSTALLED, 1, [Defined if FFTW (single-precision) is available]) fi AC_SUBST(FFTWF_INCLUDES) AC_SUBST(FFTWF_LDFLAGS) AC_SUBST(LIBFFTWF) fi ]) # # CPL_CREATE_SYMBOLS(build=[]) #----------------------------- # Sets the Makefile symbols for the CPL libraries. If an argument is # provided the symbols are setup for building CPL, if no argument is # given (default) the symbols are set for using the libraries # for external package development. AC_DEFUN([CPL_CREATE_SYMBOLS], [ if test -z "$1"; then LIBCPLCORE='-lcplcore' LIBCPLDRS='-lcpldrs' LIBCPLUI='-lcplui' LIBCPLDFS='-lcpldfs' else LIBCPLCORE='$(top_builddir)/cplcore/libcplcore.la' LIBCPLDRS='$(top_builddir)/cpldrs/libcpldrs.la' LIBCPLUI='$(top_builddir)/cplui/libcplui.la' LIBCPLDFS='$(top_builddir)/cpldfs/libcpldfs.la' fi AC_SUBST(LIBCPLCORE) AC_SUBST(LIBCPLDRS) AC_SUBST(LIBCPLUI) AC_SUBST(LIBCPLDFS) ]) # CPL_CHECK_LIBS #--------------- # Checks for the CPL libraries and header files. AC_DEFUN([CPL_CHECK_LIBS], [ AC_MSG_CHECKING([for CPL]) cpl_check_cpl_header="cpl.h" cpl_check_cpl_lib="libcplcore.a" cpl_incdirs="" cpl_libdirs="" cpl_includes="" cpl_libraries="" AC_ARG_WITH(cpl, AC_HELP_STRING([--with-cpl], [location where CPL is installed]), [ cpl_with_cpl=$withval ]) AC_ARG_WITH(cpl-includes, AC_HELP_STRING([--with-cpl-includes], [location of the CPL header files]), cpl_with_cpl_includes=$withval) AC_ARG_WITH(cpl-libs, AC_HELP_STRING([--with-cpl-libs], [location of the CPL library]), cpl_with_cpl_libs=$withval) AC_ARG_ENABLE(cpl-test, AC_HELP_STRING([--disable-cpl-test], [disables checks for the CPL library and headers]), cpl_enable_cpl_test=$enableval, cpl_enable_cpl_test=yes) if test "x$cpl_enable_cpl_test" = xyes; then # Check for the CPL includes if test -z "$cpl_with_cpl_includes"; then if test -z "$cpl_with_cpl"; then # Try some known system locations cpl_incdirs="/opt/cpl/include" cpl_incdirs="$cpl_incdirs /usr/local/include" cpl_incdirs="$cpl_incdirs /usr/include" test -n "$CPLDIR" && \ cpl_incdirs="$CPLDIR/include \ $cpl_incdirs" else cpl_incdirs="$cpl_with_cpl/include" fi else cpl_incdirs="$cpl_with_cpl_includes" fi ESO_FIND_FILE($cpl_check_cpl_header, $cpl_incdirs, cpl_includes) # Check for the CPL libraries if test -z "$cpl_with_cpl_libs"; then if test -z "$cpl_with_cpl"; then # Try some known system locations cpl_libdirs="/opt/cpl/lib" cpl_libdirs="$cpl_libdirs /usr/local/lib64" cpl_libdirs="$cpl_libdirs /usr/local/lib" cpl_libdirs="$cpl_libdirs /usr/local/lib32" cpl_libdirs="$cpl_libdirs /usr/lib64" cpl_libdirs="$cpl_libdirs /usr/lib" cpl_libdirs="$cpl_libdirs /usr/lib32" test -n "$CPLDIR" && \ cpl_libdirs="$CPLDIR/lib64 $CPLDIR/lib $CPLDIR/lib32 \ $cpl_libdirs" else cpl_libdirs="$cpl_with_cpl/lib64" cpl_libdirs="$cpl_libdirs $cpl_with_cpl/lib" cpl_libdirs="$cpl_libdirs $cpl_with_cpl/lib32" fi else cpl_libdirs="$cpl_with_cpl_libs" fi ESO_FIND_FILE($cpl_check_cpl_lib, $cpl_libdirs, cpl_libraries) if test x"$cpl_includes" = xno || test x"$cpl_libraries" = xno; then cpl_notfound="" if test x"$cpl_includes" = xno; then if test x"$cpl_libraries" = xno; then cpl_notfound="(headers and libraries)" else cpl_notfound="(headers)" fi else cpl_notfound="(libraries)" fi AC_MSG_ERROR([CPL $cpl_notfound was not found on your system. Please check!]) else AC_MSG_RESULT([libraries $cpl_libraries, headers $cpl_includes]) fi # The libcext headers are required. By default it part of the # CPL installation and it is assumed that the cext headers are # present in the same location as the CPL headers CPL_CHECK_CEXT($cpl_includes, $cpl_libraries) # Set up the symbols CPL_INCLUDES="-I$cpl_includes $CX_INCLUDES $CFITSIO_INCLUDES" CPL_LDFLAGS="-L$cpl_libraries $CX_LDFLAGS $CFITSIO_LDFLAGS" CPL_CREATE_SYMBOLS AC_MSG_CHECKING([whether CPL can be used]) AC_LANG_PUSH(C) cpl_cflags_save="$CFLAGS" cpl_ldflags_save="$LDFLAGS" cpl_libs_save="$LIBS" CFLAGS="$CPL_INCLUDES $CFLAGS" LDFLAGS="$CPL_LDFLAGS $LDFLAGS" LIBS="$LIBCPLCORE $LIBCEXT $LIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM( [[ #include ]], [ cpl_init(CPL_INIT_DEFAULT); ])], [cpl_is_usable="yes"], [cpl_is_usable="no"]) AC_MSG_RESULT([$cpl_is_usable]) AC_LANG_POP(C) CFLAGS="$cpl_cflags_save" LDFLAGS="$cpl_ldflags_save" LIBS="$cpl_libs_save" if test x"$cpl_is_usable" = xno; then AC_MSG_ERROR([Linking with CPL failed! Please check architecture!]) fi else AC_MSG_RESULT([disabled]) AC_MSG_WARN([CPL checks have been disabled! This package may not build!]) CPL_INCLUDES="" CPL_LDFLAGS="" LIBCPLCORE="" LIBCPLDRS="" LIBCPLUI="" LIBCPLDFS="" fi AC_SUBST(CPL_INCLUDES) AC_SUBST(CPL_LDFLAGS) AC_SUBST(LIBCPLCORE) AC_SUBST(LIBCPLDRS) AC_SUBST(LIBCPLUI) AC_SUBST(LIBCPLDFS) ]) cpl-6.4.1/m4/ltsugar.m40000644000460300003120000001042412310332714011452 00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) cpl-6.4.1/Makefile.purify.in0000644000460300003120000000425711011054467012603 00000000000000#******************************************************************************* # E.S.O. - VLT project # # "@(#) $Id: Makefile.purify.in,v 1.2 2008-05-09 14:01:27 cguirao Exp $" # # Makefile of Pipeline subsystem. # # who when what # -------- ---------- ---------------------------------------------- # ifdef MAKE_PURE ENABLE_PURIFY=on ENABLE_PURECOV=on ENABLE_PURE=on endif ifdef MAKE_PUREGUI ENABLE_PURIFY=on ENABLE_PURECOV=on endif ifdef MAKE_PURIFY ENABLE_PURIFY=on endif ifdef MAKE_PURECOV ENABLE_PURECOV=on endif # -user-path="../test:../src:src:test" \ ifdef ENABLE_PURIFY PURIFY = purify \ -always-use-cache-dir \ -g++=yes \ -log-file=./.purifydir/MemoryReport \ -linker=$(GNU_ROOT)/bin/ld \ -append-logfile=yes \ -messages=batch \ -dlclose-mode=2 \ -view-file=./.purifydir/purify-%v.pv \ -chain-length=100 else PURIFY = endif ifdef MAKE_PUREGUI PURIFY = purify \ -always-use-cache-dir \ -user-path="../test:../src:src:test" \ -g++=yes \ -linker=$(GNU_ROOT)/bin/ld endif ifdef ENABLE_PURECOV PURECOV = purecov \ -always-use-cache-dir \ -counts-file=./.purifydir/purecov-%v.pcv ifdef MAKE_PUREGUI PURECOV = purecov -always-use-cache-dir endif else PURECOV = endif ifdef ENABLE_PURIFY CCLD = "$(PURIFY)" $(CC) endif ifdef ENABLE_PURECOV CCLD = "$(PURECOV)" $(CC) endif ifdef ENABLE_PURE CCLD = "$(PURIFY) $(PURECOV)" $(CC) endif pureReport: @ purecov -export=.purifydir/CoverageReport .purifydir/*.pcv @ echo "== Purify coverage report in '.purifydir/CoverageReport'." pureGUI: @ ls purecov*.pcv > /dev/null 2>&1; if [ $$? = "0" ]; then purecov -view purecov*.pcv &; fi @ ls purify*.pv > /dev/null 2>&1; if [ $$? = "0" ]; then \ for member in `ls purify*.pv`; \ do purify -view $$member & \ done \ fi check-am: make_links make_links: ifeq ($(ENABLE_PURIFY),on) -@if [ ! -d .purifydir ]; then mkdir .purifydir ; fi endif ifeq ($(ENABLE_PURECOV),on) -@if [ ! -d .purifydir ]; then mkdir .purifydir ;fi endif clean-am: pureClean pureClean: -@ rm -rf .purifydir/* cpl-6.4.1/libcext/0000755000460300003120000000000012310333011010707 500000000000000cpl-6.4.1/libcext/cext/0000755000460300003120000000000012310333010011651 500000000000000cpl-6.4.1/libcext/cext/cxmap.h0000644000460300003120000000740211530471603013073 00000000000000/* $Id: cxmap.h,v 1.5 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.5 $ * $Name: not supported by cvs2svn $ */ #ifndef CX_MAP_H #define CX_MAP_H #include #include CX_BEGIN_DECLS /** * @ingroup cxmap * * @brief * The map datatype. * * The internal representation of a map is a balanced binary tree. For * this reason cx_map is just an alias for cx_tree. */ typedef cx_tree cx_map; /** * @ingroup cxmap * * @brief * The map iterator datatype. * * The map iterator is just an alias for the cx_tree_iterator datatype. */ typedef cx_tree_iterator cx_map_iterator; /** * @ingroup cxmap * * @brief * The map constant iterator datatype. * * The map constant iterator is just an alias for the cx_tree_const_iterator * datatype. */ typedef cx_tree_const_iterator cx_map_const_iterator; /** * @ingroup cxmap * * @brief * The map's key comparison operator function. * * This type of function is used internally by a map when key comparisons * are necessary. It must return @c TRUE if the comparison of its first * argument with the second argument succeeds, and @c FALSE otherwise. * It is actually an alias for cx_tree_compare_func. * * @see cx_tree_compare_func */ typedef cx_tree_compare_func cx_map_compare_func; /* * Create, copy and destroy operations */ cx_map *cx_map_new(cx_compare_func, cx_free_func, cx_free_func); void cx_map_delete(cx_map *); /* * Nonmodifying operations */ cxsize cx_map_size(const cx_map *); cxbool cx_map_empty(const cx_map *); cxsize cx_map_max_size(const cx_map *); cx_map_compare_func cx_map_key_comp(const cx_map *); /* * Special search operations */ cxsize cx_map_count(const cx_map *, cxcptr); cx_map_iterator cx_map_find(const cx_map *, cxcptr); cx_map_iterator cx_map_lower_bound(const cx_map *, cxcptr); cx_map_iterator cx_map_upper_bound(const cx_map *, cxcptr); void cx_map_equal_range(const cx_map *, cxcptr, cx_map_iterator *, cx_map_iterator *); /* * Assignment operations */ void cx_map_swap(cx_map *, cx_map *); cxptr cx_map_assign(cx_map *, cx_map_iterator, cxcptr); cxptr cx_map_put(cx_map *, cxcptr, cxcptr); /* * Element access */ cxptr cx_map_get_key(const cx_map *, cx_map_const_iterator); cxptr cx_map_get_value(const cx_map *, cx_map_const_iterator); cxptr cx_map_get(cx_map *, cxcptr); /* * Iterator functions */ cx_map_iterator cx_map_begin(const cx_map *); cx_map_iterator cx_map_end(const cx_map *); cx_map_iterator cx_map_next(const cx_map *, cx_map_const_iterator); cx_map_iterator cx_map_previous(const cx_map *, cx_map_const_iterator); /* * Inserting and removing elements */ cx_map_iterator cx_map_insert(cx_map *, cxcptr, cxcptr); void cx_map_erase_position(cx_map *, cx_map_iterator); void cx_map_erase_range(cx_map *, cx_map_iterator, cx_map_iterator); cxsize cx_map_erase(cx_map *, cxcptr); void cx_map_clear(cx_map *); CX_END_DECLS #endif /* CX_MAP_H */ cpl-6.4.1/libcext/cext/cxdeque.c0000644000460300003120000010572112243415467013427 00000000000000/* $Id: cxdeque.c,v 1.13 2012-12-18 16:05:45 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-12-18 16:05:45 $ * $Revision: 1.13 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include "cxmemory.h" #include "cxmessages.h" #include "cxdeque.h" /** * @defgroup cxdeque Double-ended queue. * * The module implements a double-ended queue. This is a linear list * which is optimized for insertions and deletions that are made at the * ends of the list. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * Double-ended queue structure and data types */ struct _cx_deque_ { cxptr *members; cxsize front; cxsize size; cxsize back; }; inline static cxsize _cx_deque_capacity(const cx_deque *deque); /* * Reserve space at the beginning of a deque. If there is still enough * space left, nothing is done. */ inline static void _cx_deque_reserve_at_front(cx_deque *deque, cxsize size) { if (deque->front < size) { cxptr *_members = NULL; deque->front = size; _members = cx_calloc(_cx_deque_capacity(deque), sizeof(cxptr)); memcpy(&_members[deque->front], deque->members, deque->size * sizeof(cxptr)); cx_free(deque->members); deque->members = _members; } return; } /* * Reserve space at the end of a deque. If there is still enough * space left, nothing is done. */ inline static void _cx_deque_reserve_at_back(cx_deque *deque, cxsize size) { if (deque->back < size) { cxptr *_members = NULL; deque->back = size; _members = cx_calloc(_cx_deque_capacity(deque), sizeof(cxptr)); memcpy(&_members[deque->front], &deque->members[deque->front], deque->size * sizeof(cxptr)); cx_free(deque->members); deque->members = _members; } return; } /* * Shifts size number of deque members staring at position to the left * by n nodes. * * Note: No checks on the array sizes are done and no adjustment of * the front, size or back are performed! The node at the position * one before the start of the given range is overwritten! */ inline static void _cx_deque_shift_left(cx_deque *deque, cxsize n, cxsize position, cxsize size) { #if 0 cxsize i = 0; for (i = 0; i < size; ++i) { register cxsize current = deque->front + position + i; deque->members[current - n] = deque->members[current]; } return; #else if (n > 0) { register cxsize start = deque->front + position; memmove(&deque->members[start - n], &deque->members[start], size * sizeof(cxptr)); } return; #endif } /* * Shifts size number of deque members staring at position to the right * by n nodes. * * Note: No checks on the array sizes are done and no adjustment of * the front, size or back are performed! The node at the position * one after the end of the given range is overwritten! */ inline static void _cx_deque_shift_right(cx_deque *deque, cxsize n, cxsize position, cxsize size) { #if 0 cxsize i = 0; for (i = size; i > 0; --i) { register cxsize current = deque->front + position + i - 1; deque->members[current + n] = deque->members[current]; } return; #else if (n > 0) { register cxsize start = deque->front + position; memmove(&deque->members[start + n], &deque->members[start], size * sizeof(cxptr)); } return; #endif } /* * Balance the head and the tail buffer sections of a deque. */ inline static void _cx_deque_balance(cx_deque *deque, cxsize limit) { if ((deque->front != 0) && (deque->back != 0)) { if (deque->front > limit * deque->back) { cxsize difference = deque->front - deque->back; cxsize shift = difference / 2; _cx_deque_shift_left(deque, shift, deque->front, deque->size); deque->front -= shift; deque->back += difference - shift; } else { if (deque->back > limit * deque->front) { cxsize difference = deque->back - deque->front; cxsize shift = difference / 2; _cx_deque_shift_right(deque, shift, deque->front, deque->size); deque->back -= shift; deque->front += difference - shift; } } } return; } /* * Get the position of the first node in the map array. */ inline static cxsize _cx_deque_first(const cx_deque *deque) { return deque->front; } /* * Get the position of the last node in the map array. */ inline static cxsize _cx_deque_last(const cx_deque *deque) { return deque->front + deque->size - 1; } /* * Initialize a deque object */ inline static void _cx_deque_init(cx_deque *deque, cxsize front, cxsize back) { deque->members = NULL; deque->front = front; deque->size = 0; deque->back = back; if (front + back > 0) { deque->members = cx_calloc(_cx_deque_capacity(deque), sizeof(cxptr)); } return; } /* * Remove all elements from a deque */ inline static void _cx_deque_clear(cx_deque *deque) { if (!deque) return; cx_free(deque->members); _cx_deque_init(deque, 0, 0); return; } /* * Get the current size of a deque. */ inline static cxsize _cx_deque_size(const cx_deque *deque) { return deque->size; } /* * Get the current capacity of a deque */ inline static cxsize _cx_deque_capacity(const cx_deque *deque) { return deque->front + deque->size + deque->back; } /* * Check whether a deque is empty */ inline static cxbool _cx_deque_empty(const cx_deque *deque) { return (_cx_deque_size(deque) == 0); } /* * Add a data element at the beginning */ inline static void _cx_deque_push_front(cx_deque *deque, cxcptr data) { --deque->front; ++deque->size; deque->members[deque->front] = (cxptr)data; return; } /* * Add a data element at the end */ inline static void _cx_deque_push_back(cx_deque *deque, cxcptr data) { deque->members[deque->front + deque->size] = (cxptr)data; --deque->back; ++deque->size; return; } /* * Assign data to a given position */ inline static void _cx_deque_assign(cx_deque *deque, cxsize position, cxcptr data) { deque->members[deque->front + position] = (cxptr)data; return; } /* * Get the data element at the given position from a deque object */ inline static cxptr _cx_deque_get(const cx_deque *deque, cxsize position) { return deque->members[deque->front + position]; } /* * Set the data element at the given position */ inline static void _cx_deque_put(cx_deque *deque, cxsize position, cxptr data) { deque->members[deque->front + position] = data; return; } /* * Get an iterator to the beginning of the deque */ inline static cx_deque_iterator _cx_deque_begin(const cx_deque *deque) { (void) deque; /* To avoid a compiler warning */ return 0; } /* * Get an iterator to the end of the deque */ inline static cx_deque_iterator _cx_deque_end(const cx_deque *deque) { return _cx_deque_size(deque); } /* * Returns the position of the next element of a deque, i.e. the element * immediately following the current position */ inline static cx_deque_iterator _cx_deque_next(const cx_deque *deque, cx_deque_const_iterator position) { if (_cx_deque_empty(deque) || (position == _cx_deque_end(deque))) { return _cx_deque_end(deque); } return ++position; } /* * Returns the position of the previous element of a deque, i.e. the element * immediately preceding the current position */ inline static cx_deque_iterator _cx_deque_previous(const cx_deque *deque, cx_deque_const_iterator position) { if (_cx_deque_empty(deque) || (position == _cx_deque_begin(deque))) { return _cx_deque_end(deque); } return --position; } /* * Check whether the given queue is sorted using the provided comparison * function. Returns 1 if the deque is sorted, and 0 otherwise. */ inline static cxbool _cx_deque_sorted(const cx_deque *deque, cx_compare_func compare) { cxsize i = 0; for (i = 0; i < deque->size - 1; ++i) { register cxsize current = deque->front + i; if (compare(deque->members[current], deque->members[current + 1]) > 0) { return 0; } } return 1; } /* * Remove the deque node at the given position from the deque */ inline static cxptr _cx_deque_extract(cx_deque *deque, cxsize position) { cxptr data = _cx_deque_get(deque, position); _cx_deque_shift_left(deque, 1, position + 1, _cx_deque_end(deque) - position - 1); --deque->size; ++deque->back; return data; } /* * Move a range of deque nodes in front of position */ inline static void _cx_deque_transfer(cx_deque *deque, cxsize position, cx_deque *other, cxsize first, cxsize last) { if (deque == other) { if (position != last) { cxsize n_members = last - first; /* * Reserve space in the target */ _cx_deque_reserve_at_back(deque, n_members); if (position != _cx_deque_end(deque)) { register cxsize n = _cx_deque_size(deque) - position; _cx_deque_shift_right(deque, n_members, position, n); /* * Adjust source range start and end position */ if (first > position) { first += n_members; } } /* * Transfer [first, last) to the target. No adjustment of the * size is needed, since the number of nodes is conserved. */ memcpy(&deque->members[position], &other->members[first], n_members * sizeof(cxptr)); /* * Remove [first, last) from its old position. Again, there is * no change in the size of the source deque. */ if (last != _cx_deque_end(other)) { register cxsize n = _cx_deque_size(other) - last; if (last > position) { last += n_members; } else { n += n_members; } _cx_deque_shift_left(other, n_members, last, n); } } } else { cxsize n_members = last - first; /* * Reserve space in the target */ _cx_deque_reserve_at_back(deque, n_members); if (position != _cx_deque_end(deque)) { register cxsize n = _cx_deque_size(deque) - position; _cx_deque_shift_right(deque, n_members, position, n); } /* * Transfer [first, last) to the target */ memcpy(&deque->members[position], &other->members[first], n_members * sizeof(cxptr)); deque->size += n_members; deque->back -= n_members; /* * Remove [first, last) from its old position. */ if (last != _cx_deque_end(other)) { register cxsize n = _cx_deque_size(other) - last; _cx_deque_shift_left(other, n_members, last, n); } other->size -= n_members; other->back += n_members; } return; } /* * Merge two sorted deques keeping the sorting order with respect to the * given comparison function. */ inline static void _cx_deque_merge(cx_deque *deque1, cx_deque *deque2, cx_compare_func compare) { if (deque1 != deque2) { cx_deque_iterator first1 = _cx_deque_begin(deque1); cx_deque_iterator first2 = _cx_deque_begin(deque2); cx_assert(_cx_deque_size(deque1) + _cx_deque_size(deque2) >= _cx_deque_size(deque1)); cx_assert(_cx_deque_sorted(deque1, compare)); cx_assert(_cx_deque_sorted(deque2, compare)); while ((first1 != _cx_deque_end(deque1)) && (first2 != _cx_deque_end(deque2))) { if (compare(_cx_deque_get(deque2, first2), _cx_deque_get(deque1, first1)) < 0) { _cx_deque_transfer(deque1, first1, deque2, first2, first2 + 1); first1 = _cx_deque_next(deque2, first1); } else { first1 = _cx_deque_next(deque1, first1); } } if (first2 != _cx_deque_end(deque2)) { _cx_deque_transfer(deque1, _cx_deque_end(deque1), deque2, first2, _cx_deque_end(deque2)); } } return; } /* * Sort a deque using the given comparison function. */ inline static void _cx_deque_sort(cx_deque *deque, cx_compare_func compare) { #if 0 struct stable *ss; unsigned long i; current_compare = compare; /* * create temporary copy of array, including the * indices. note that the execution time is dominated * by the actual sorting */ ss = cx_malloc(deque->size * sizeof(struct stable)); for (i = 0; i < deque->size; ++i) { ss[i].indx = i; ss[i].member = deque->members[deque->front + i]; } qsort(ss, deque->size, sizeof(struct stable), compare_stable); for (i = 0; i < deque->size; ++i) { deque->members[deque->front + i] = ss[i].member; } cx_free(ss); #else if (_cx_deque_size(deque) > 1 && !_cx_deque_sorted(deque, compare)) { cx_deque tmp; cxsize middle = _cx_deque_size(deque) / 2; _cx_deque_init(&tmp, 0, 0); _cx_deque_transfer(&tmp, _cx_deque_end(&tmp), deque, middle, _cx_deque_end(deque)); _cx_deque_sort(deque, compare); _cx_deque_sort(&tmp, compare); _cx_deque_merge(deque, &tmp, compare); _cx_deque_clear(&tmp); } #endif return; } /** * @brief * Create a new deque without any elements. * * @return Handle to the newly allocated deque. * * The function allocates memory for a deque object and initializes * it to an empty deque. */ cx_deque * cx_deque_new(void) { cx_deque *deque = cx_malloc(sizeof *deque); _cx_deque_init(deque, 0, 0); return deque; } /** * @brief * Destroy a deque. * * @param deque The deque to delete. * * @return Nothing. * * The function deallocates the deque object, but not the data objects * currently stored in the deque. */ void cx_deque_delete(cx_deque *deque) { _cx_deque_clear(deque); cx_assert(cx_deque_empty(deque)); cx_free(deque); return; } /** * @brief * Destroy a deque and all its elements. * * @param deque Deque container to destroy. * @param deallocate Data deallocator. * * @return Nothing. * * The function deallocates all data objects referenced by @em deque using * the data deallocation function @em deallocate and finally deallocates * the deque object itself. */ void cx_deque_destroy(cx_deque *deque, cx_free_func deallocate) { if (deque != NULL) { if (deallocate != NULL) { cxsize i = 0; for (i = 0; i < deque->size; ++i) { deallocate(_cx_deque_get(deque, i)); } } cx_free(deque->members); cx_free(deque); } return; } /** * @brief * Get the actual number of deque elements. * * @param deque A deque. * * @return The current number of elements the deque contains, or 0 if the * deque is empty. * * Retrieves the number of elements currently stored in the deque @em deque. */ cxsize cx_deque_size(const cx_deque *deque) { cx_assert(deque != NULL); return _cx_deque_size(deque); } /** * @brief * Check whether a deque is empty. * * @param deque A deque. * * @return The function returns @c TRUE if the deque is empty, and @c FALSE * otherwise. * * The function tests if the deque @em deque contains data. */ cxbool cx_deque_empty(const cx_deque *deque) { cx_assert(deque != NULL); return _cx_deque_empty(deque); } /** * @brief * Get the maximum number of deque elements possible. * * @param deque A deque. * * @return The maximum number of elements that can be stored in the deque. * * Retrieves the deques capacity, i.e. the maximum possible number of data * items a deque can hold. */ cxsize cx_deque_max_size(const cx_deque *deque) { (void) deque; /* Prevent warnings if cx_assert is disabled. */ cx_assert(deque != NULL); return (cxsize)(-1); } /** * @brief * Swap the data of two deques. * * @param deque The first deque. * @param other The second deque. * * @return Nothing. * * The contents of the deque @em other will be moved to the deque @em deque, * while the contents of @em deque is moved to @em other. */ void cx_deque_swap(cx_deque *deque, cx_deque *other) { cx_deque tmp = {NULL, 0, 0, 0}; cx_assert(deque != NULL); cx_assert(other != NULL); tmp.front = other->front; tmp.back = other->back; tmp.size = other->size; tmp.members = other->members; other->front = deque->front; other->back = deque->back; other->size = deque->size; other->members = deque->members; deque->front = tmp.front; deque->back = tmp.back; deque->size = tmp.size; deque->members = tmp.members; return; } /** * @brief * Assign data to a deque element. * * @param deque A deque. * @param position Position of the deque element where the data will be stored. * @param data Data to store. * * @return Handle to the previously stored data object. * * The function assigns the data object reference @em data * to the iterator position @em position of the deque @em deque. */ cxptr cx_deque_assign(cx_deque *deque, cx_deque_iterator position, cxptr data) { cxptr tmp = NULL; cx_assert(deque != NULL); cx_assert((position >= _cx_deque_begin(deque)) && (position < _cx_deque_end(deque))); tmp = _cx_deque_get(deque, position); _cx_deque_put(deque, position, data); return tmp; } /** * @brief * Get the first element of a deque. * * @param deque The deque to query. * * @return Handle to the data object stored in the first deque element. * * The function returns a reference to the first data item in the deque * @em deque. */ cxptr cx_deque_front(const cx_deque *deque) { cx_assert(deque != NULL); cx_assert(!_cx_deque_empty(deque)); return _cx_deque_get(deque, _cx_deque_begin(deque)); } /** * @brief * Get the last element of a deque. * * @param deque The deque to query. * * @return Handle to the data object stored in the last deque element. * * The function returns a reference to the last data item in the deque * @em deque. */ cxptr cx_deque_back(const cx_deque *deque) { cx_assert(deque != NULL); cx_assert(!_cx_deque_empty(deque)); return _cx_deque_get(deque, _cx_deque_previous(deque, _cx_deque_end(deque))); } /** * @brief * Retrieve an element from a deque. * * @param deque The deque to query. * @param position The position of the element to get. * * @return A handle to the data object. * * The function returns a reference to the data item stored in the deque * @em deque at the iterator position @em position. * */ cxptr cx_deque_get(const cx_deque *deque, cx_deque_const_iterator position) { cx_assert(deque != NULL); cx_assert((position >= _cx_deque_begin(deque)) && (position < _cx_deque_end(deque))); return _cx_deque_get(deque, position); } /** * @brief * Get an iterator for the first deque element. * * @param deque A deque. * * @return Iterator for the first element in the deque or @b cx_deque_end() * if the deque is empty. * * The function returns a handle to the first element of @em deque. The * handle cannot be used directly to access the element data, but only * through the appropriate functions. */ cx_deque_iterator cx_deque_begin(const cx_deque *deque) { cx_assert(deque != NULL); return _cx_deque_begin(deque); } /** * @brief * Get an iterator for the position after the last deque element. * * @param deque A deque. * * @return Iterator for the end of the deque. * * The function returns an iterator for the position one past the last * element of the deque @em deque. The handle cannot be used to directly * access the element data, but only through the appropriate functions. */ cx_deque_iterator cx_deque_end(const cx_deque *deque) { cx_assert(deque != NULL); return _cx_deque_end(deque); } /** * @brief * Get an iterator for the next deque element. * * @param deque A deque. * @param position Current iterator position. * * @return Iterator for the next deque element. * * The function returns an iterator for the next element in the deque * @em deque with respect to the current iterator position @em position. * If the deque @em deque is empty or @em position points to the deque end * the function returns @b cx_deque_end(). */ cx_deque_iterator cx_deque_next(const cx_deque *deque, cx_deque_const_iterator position) { cx_assert(deque != NULL); return _cx_deque_next(deque, position); } /** * @brief * Get an iterator for the previous deque element. * * @param deque A deque. * @param position Current iterator position. * * @return Iterator for the previous deque element. * * The function returns an iterator for the previous element in the deque * @em deque with respect to the current iterator position @em position. * If the deque @em deque is empty or @em position points to the beginning * of the deque the function returns @b cx_deque_end(). */ cx_deque_iterator cx_deque_previous(const cx_deque *deque, cx_deque_const_iterator position) { cx_assert(deque != NULL); return _cx_deque_previous(deque, position); } /** * @brief * Insert data at the beginning of a deque. * * @param deque The deque to update. * @param data Data to add to the deque. * * @return Nothing. * * The data @em data is inserted into the deque @em deque before the first * element of the deque, so that it becomes the new deque head. * * It is equivalent to the statement * @code * cx_deque_insert(deque, cx_deque_begin(deque), data); * @endcode */ void cx_deque_push_front(cx_deque *deque, cxcptr data) { cx_assert(deque != NULL); if (deque->front == 0) { _cx_deque_reserve_at_front(deque, _cx_deque_size(deque) + 1); } _cx_deque_push_front(deque, data); return; } /** * @brief * Remove the first deque element. * * @param deque The deque to update. * * @return Handle to the data object previously stored as the first * deque element. * * The function removes the first element from the deque @em deque returning * a handle to the previously stored data. * * It is equivalent to the statement * @code * cx_deque_extract(deque, cx_deque_begin(deque)); * @endcode */ cxptr cx_deque_pop_front(cx_deque *deque) { cx_assert(deque != NULL); cx_assert(!_cx_deque_empty(deque)); return _cx_deque_extract(deque, _cx_deque_begin(deque)); } /** * @brief * Append data at the end of a deque. * * @param deque The deque to update. * @param data Data to append. * * @return Nothing. * * The data @em data is inserted into the deque @em deque after the last * element, so that it becomes the new deque tail. * * It is equivalent to the statement * @code * cx_deque_insert(deque, cx_deque_end(deque), data); * @endcode */ void cx_deque_push_back(cx_deque *deque, cxcptr data) { cx_assert(deque != NULL); /* * If back is 0, the maximum allocated memory has been * reached. This means, it's necessary to allocate new * memory for inserting new members. */ if (deque->back == 0) { _cx_deque_reserve_at_back(deque, _cx_deque_size(deque) + 1); } _cx_deque_push_back(deque, data); return; } /** * @brief * Remove the last deque element. * * @param deque The deque to update. * * @return Handle to the data object previously stored as the last * deque element. * * The function removes the last element from the deque @em deque returning * a handle to the previously stored data. * * It is equivalent to the statement * @code * cx_deque_extract(deque, cx_deque_previous(deque, cx_deque_end(deque))); * @endcode */ cxptr cx_deque_pop_back(cx_deque *deque) { cx_deque_iterator position; cx_assert(deque != NULL); cx_assert(!_cx_deque_empty(deque)); position = _cx_deque_previous(deque, _cx_deque_end(deque)); return _cx_deque_extract(deque, position); } /** * @brief * Insert data into a deque at a given iterator position. * * @param deque The deque to update. * @param position List iterator position. * @param data Data item to insert. * * @return Deque iterator position of the inserted data item. * * The function inserts the data object reference @em data into the deque * @em deque at the position given by the deque iterator @em position. */ cx_deque_iterator cx_deque_insert(cx_deque *deque, cx_deque_iterator position, cxcptr data) { cx_assert(deque != NULL); cx_assert(position <= _cx_deque_size(deque)); if (position == _cx_deque_size(deque)) { cx_deque_push_back(deque, data); } else { cx_assert(position < _cx_deque_size(deque)); cx_assert(_cx_deque_size(deque) > 1); cx_deque_push_back(deque, _cx_deque_get(deque, _cx_deque_size(deque) - 1)); _cx_deque_shift_right(deque, 1, position, _cx_deque_size(deque) - position - 1); _cx_deque_assign(deque, position, data); } return position; } /** * @brief * Erase a deque element. * * @param deque The deque to update. * @param position Deque iterator position. * @param deallocate Data deallocator. * * @return The iterator for the deque position after @em position. * * The function removes the data object stored at position @em position * from the deque @em deque. The data object itself is deallocated by * calling the data deallocator @em deallocate. */ cx_deque_iterator cx_deque_erase(cx_deque *deque, cx_deque_iterator position, cx_free_func deallocate) { cxsize next = position + 1; cx_assert(deque != NULL); cx_assert(deallocate != NULL); cx_assert((position >= _cx_deque_begin(deque)) && (position < _cx_deque_size(deque))); deallocate(_cx_deque_get(deque, position)); _cx_deque_shift_left(deque, 1, next, _cx_deque_size(deque) - next); --deque->size; ++deque->back; return position; } /** * @brief * Remove all elements from a deque. * * @param deque Deque to be cleared. * * @return Nothing. * * The deque @em deque is cleared, i.e. all elements are removed from the * deque. The removed data objects are left untouched, in particular they * are not deallocated. It is the responsibility of the caller to ensure * that there are still other references to the removed data objects. * After calling @b cx_deque_clear() the deque @em deque is empty. */ void cx_deque_clear(cx_deque *deque) { _cx_deque_clear(deque); return; } /** * @brief * Extract a deque element. * * @param deque A deque. * @param position Deque iterator position. * * @return Handle to the previously stored data object. * * The function removes a data object from the deque @em deque located at the * iterator position @em position without destroying the data object. * * @see cx_deque_erase(), cx_deque_remove() */ cxptr cx_deque_extract(cx_deque *deque, cx_deque_iterator position) { cx_assert(deque != NULL); cx_assert((position >= _cx_deque_begin(deque)) && (position < _cx_deque_end(deque))); return _cx_deque_extract(deque, position); } /** * @brief * Remove all elements with a given value from a deque. * * @param deque A deque. * @param data Data to remove. * * @return Nothing. * * The value @em data is searched in the deque @em deque. If the data is * found it is removed from the deque. The data object itself is not * deallocated. */ void cx_deque_remove(cx_deque *deque, cxcptr data) { cx_deque_iterator first; cx_assert(deque != NULL); first = _cx_deque_begin(deque); while (first != _cx_deque_end(deque)) { if (_cx_deque_get(deque, first) == data) { _cx_deque_extract(deque, first); } else { first = _cx_deque_next(deque, first); } } return; } /** * @brief * Remove duplicates of consecutive elements. * * @param deque A deque. * @param compare Function comparing the deque elements. * * @return Nothing. * * The function removes duplicates of consecutive deque elements, i.e. deque * elements with the same value, from the deque @em deque. The equality of * the deque elements is checked using the comparison function @em compare. * The comparison function @em compare must return an integer less than, * equal or greater than zero if the first argument passed to it is found, * respectively, to be less than, match, or be greater than the second * argument. */ void cx_deque_unique(cx_deque *deque, cx_compare_func compare) { cx_assert(deque != NULL); cx_assert(compare != NULL); if (!_cx_deque_empty(deque)) { cx_deque_iterator first = _cx_deque_begin(deque); cx_deque_iterator next = _cx_deque_next(deque, first); while (next != _cx_deque_end(deque)) { if (compare(_cx_deque_get(deque, first), _cx_deque_get(deque, next)) == 0) { _cx_deque_extract(deque, next); } else { first = next; next = _cx_deque_next(deque, next); } } } return; } /** * @brief * Move a range of elements in front of a given position. * * @param deque Target deque. * @param position Target iterator position. * @param other Source deque. * @param first Position of the first element to move. * @param last Position of the last element to move. * * @return Nothing. * * The range of deque elements from the iterator position @em first to * @em last, but not including @em last, is moved from the source deque * @em other in front of the position @em position of the target deque * @em deque. Target and source deque may be identical, provided that the * target position @em position does not fall within the range of deque * elements to move. */ void cx_deque_splice(cx_deque *deque, cx_deque_iterator position, cx_deque *other, cx_deque_iterator first, cx_deque_iterator last) { cx_assert(other != NULL); cx_assert((first == _cx_deque_end(other)) || ((first >= _cx_deque_begin(other)) && (first < _cx_deque_end(other)))); cx_assert((last == _cx_deque_end(other)) || ((last > first) && (last < _cx_deque_end(other)))); if (first != last) { cx_assert(deque != NULL); cx_assert((position == _cx_deque_end(deque)) || ((position >= _cx_deque_begin(deque)) && (position < _cx_deque_end(deque)))); cx_assert((deque != other) || ((position < first) || (position > last))); _cx_deque_transfer(deque, position, other, first, last); } return; } /** * @brief * Merge two sorted deques. * * @param deque Target deque of the merge operation. * @param other The deque to merge into the target. * @param compare Function comparing the deque elements. * * @return Nothing. * * The function combines the two deques @em deque and @em other by moving all * elements from @em other into @em deque, so that all elements are still * sorted. The function requires that both input deques are already sorted. * The sorting order in which the elements of @em other are inserted * into @em deque is determined by the comparison function @em compare. * The comparison function @em compare must return an integer less than, equal * or greater than zero if the first argument passed to it is found, * respectively, to be less than, match, or be greater than the second * argument. * * The deque @em other is consumed by this process, i.e. after the successful * merging of the two deques, deque @em other will be empty. */ void cx_deque_merge(cx_deque *deque, cx_deque *other, cx_compare_func compare) { cx_assert(deque != NULL); cx_assert(other != NULL); cx_assert(compare != NULL); _cx_deque_merge(deque, other, compare); return; } /** * @brief * Sort all elements of a deque using the given comparison function. * * @param deque The deque to sort. * @param compare Function comparing the deque elements. * * @return Nothing. * * The input deque @em deque is sorted using the comparison function * @em compare to determine the order of two deque elements. The comparison * function @em compare must return an integer less than, equal * or greater than zero if the first argument passed to it is found, * respectively, to be less than, equal, or be greater than the second * argument. This function uses the stdlib function qsort(). */ void cx_deque_sort(cx_deque *deque, cx_compare_func compare) { cx_assert(deque != NULL); cx_assert(compare != NULL); _cx_deque_sort(deque, compare); return; } /** * @brief * Reverse the order of all deque elements. * * @param deque The deque to reverse. * * @return Nothing. * * The order of the elements of the deque @em deque is reversed. */ void cx_deque_reverse(cx_deque *deque) { cx_assert(deque != NULL); if (!_cx_deque_empty(deque)) { cx_deque_iterator current = _cx_deque_begin(deque); cx_deque_iterator middle = current + _cx_deque_size(deque) / 2; cx_deque_iterator last = _cx_deque_previous(deque, _cx_deque_end(deque)); while (current < middle) { cxptr data = _cx_deque_get(deque, last); _cx_deque_put(deque, last, _cx_deque_get(deque, current)); _cx_deque_put(deque, current, data); current = _cx_deque_next(deque, current); last = _cx_deque_previous(deque, last); } } return; } /**@}*/ cpl-6.4.1/libcext/cext/cxslist.h0000644000460300003120000000561211530471603013455 00000000000000/* $Id: cxslist.h,v 1.7 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.7 $ * $Name: not supported by cvs2svn $ */ #ifndef CX_SLIST_H #define CX_SLIST_H #include CX_BEGIN_DECLS typedef struct _cx_slnode_ *cx_slist_iterator; typedef const struct _cx_slnode_ *cx_slist_const_iterator; typedef struct _cx_slist_ cx_slist; /* * Create, copy and destroy operations */ cx_slist *cx_slist_new(void); void cx_slist_delete(cx_slist *); void cx_slist_destroy(cx_slist *, cx_free_func); /* * Nonmodifying operations */ cxsize cx_slist_size(const cx_slist *); cxbool cx_slist_empty(const cx_slist *); cxsize cx_slist_max_size(const cx_slist *); /* * Assignment operations */ void cx_slist_swap(cx_slist *, cx_slist *); cxptr cx_slist_assign(cx_slist *, cx_slist_iterator, cxcptr); /* * Element access */ cxptr cx_slist_front(const cx_slist *); cxptr cx_slist_back(const cx_slist *); cxptr cx_slist_get(const cx_slist *, cx_slist_const_iterator); /* * Iterator functions */ cx_slist_iterator cx_slist_begin(const cx_slist *); cx_slist_iterator cx_slist_end(const cx_slist *); cx_slist_iterator cx_slist_next(const cx_slist *, cx_slist_const_iterator); /* * Inserting and removing elements */ void cx_slist_push_front(cx_slist *, cxcptr); cxptr cx_slist_pop_front(cx_slist *); void cx_slist_push_back(cx_slist *, cxcptr); cxptr cx_slist_pop_back(cx_slist *); cx_slist_iterator cx_slist_insert(cx_slist *, cx_slist_iterator, cxcptr); cx_slist_iterator cx_slist_erase(cx_slist *, cx_slist_iterator, cx_free_func); cxptr cx_slist_extract(cx_slist *, cx_slist_iterator); void cx_slist_remove(cx_slist *, cxcptr); void cx_slist_clear(cx_slist *); /* * Splice functions */ void cx_slist_unique(cx_slist *, cx_compare_func); void cx_slist_splice(cx_slist *, cx_slist_iterator, cx_slist *, cx_slist_iterator, cx_slist_iterator); void cx_slist_merge(cx_slist *, cx_slist *, cx_compare_func); void cx_slist_sort(cx_slist *, cx_compare_func); void cx_slist_reverse(cx_slist *); CX_END_DECLS #endif /* CX_SLIST_H */ cpl-6.4.1/libcext/cext/cxtree.c0000644000460300003120000012602012243415467013256 00000000000000/* $Id: cxtree.c,v 1.10 2012-12-10 14:36:49 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-12-10 14:36:49 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include "cxmemory.h" #include "cxmessages.h" #include "cxtree.h" /** * @defgroup cxtree Balanced Binary Trees * * The module implements a balanced binary tree type, i.e. a container * managing key/value pairs as elements. The container is optimized for * lookup operations. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * Tree node color, tree node and tree opaque data types */ enum _cx_tnode_color_ { CX_TNODE_RED = 0, CX_TNODE_BLACK }; typedef enum _cx_tnode_color_ cx_tnode_color; struct _cx_tnode_ { struct _cx_tnode_ *left; struct _cx_tnode_ *right; struct _cx_tnode_ *parent; cx_tnode_color color; cxptr key; cxptr value; }; typedef struct _cx_tnode_ cx_tnode; struct _cx_tree_ { cx_tnode *header; cxsize node_count; cx_tree_compare_func key_compare; cx_free_func key_destroy; cx_free_func value_destroy; }; /* * Some macros, mostly defined for readability purposes. */ #define _cx_tnode_left(node) ((node)->left) #define _cx_tnode_right(node) ((node)->right) #define _cx_tnode_parent(node) ((node)->parent) #define _cx_tnode_grandpa(node) ((node)->parent->parent) #define _cx_tnode_color(node) ((node)->color) #define _cx_tnode_key(node) ((node)->key) #define _cx_tnode_value(node) ((node)->value) #define _cx_tree_head(tree) ((tree)->header) #define _cx_tree_root(tree) ((tree)->header->parent) #define _cx_tree_leftmost(tree) ((tree)->header->left) #define _cx_tree_rightmost(tree) ((tree)->header->right) #define _cx_tree_node_count(tree) ((tree)->node_count) #define _cx_tree_key_destroy(tree) ((tree)->key_destroy) #define _cx_tree_value_destroy(tree) ((tree)->value_destroy) #define _cx_tree_compare(tree) ((tree)->key_compare) #define _cx_tree_key_compare(tree, a, b) ((tree)->key_compare((a), (b))) /* * Internal, node related methods */ inline static cx_tnode * _cx_tnode_create(cxcptr key, cxcptr value) { cx_tnode *node = cx_malloc(sizeof(cx_tnode)); _cx_tnode_left(node) = NULL; _cx_tnode_right(node) = NULL; _cx_tnode_parent(node) = NULL; _cx_tnode_key(node) = (cxptr)key; _cx_tnode_value(node) = (cxptr)value; return node; } inline static void _cx_tnode_destroy(cx_tnode *node, cx_free_func key_destroy, cx_free_func value_destroy) { if (node) { if (key_destroy) { key_destroy(_cx_tnode_key(node)); _cx_tnode_key(node) = NULL; } if (value_destroy) { value_destroy(_cx_tnode_value(node)); _cx_tnode_value(node) = NULL; } _cx_tnode_left(node) = NULL; _cx_tnode_right(node) = NULL; _cx_tnode_parent(node) = NULL; cx_free(node); } return; } inline static cx_tnode * _cx_tnode_minimum(const cx_tnode *node) { register cx_tnode *n = (cx_tnode *)node; while (_cx_tnode_left(n) != NULL) n = _cx_tnode_left(n); return n; } inline static cx_tnode * _cx_tnode_maximum(const cx_tnode *node) { register cx_tnode *n = (cx_tnode *)node; while (_cx_tnode_right(n) != NULL) n = _cx_tnode_right(n); return n; } inline static cxptr _cx_tnode_get_key(const cx_tnode *node) { return node->key; } inline static void _cx_tnode_set_key(cx_tnode *node, cxcptr key) { node->key = (cxptr)key; return; } inline static cxptr _cx_tnode_get_value(const cx_tnode *node) { return node->value; } inline static void _cx_tnode_set_value(cx_tnode *node, cxcptr value) { node->value = (cxptr)value; return; } inline static cx_tnode * _cx_tnode_next(const cx_tnode *node) { register cx_tnode *n = (cx_tnode *)node; if (_cx_tnode_right(n) != NULL) { n = _cx_tnode_right(n); while (_cx_tnode_left(n) != NULL) n = _cx_tnode_left(n); } else { cx_tnode *m = _cx_tnode_parent(n); while (n == _cx_tnode_right(m)) { n = m; m = _cx_tnode_parent(m); } if (_cx_tnode_right(n) != m) n = m; } return n; } inline static cx_tnode * _cx_tnode_previous(const cx_tnode *node) { register cx_tnode *n = (cx_tnode *)node; if (_cx_tnode_color(n) == CX_TNODE_RED && _cx_tnode_grandpa(n) == n) n = _cx_tnode_right(n); else if (_cx_tnode_left(n) != NULL) { cx_tnode *m = _cx_tnode_left(n); while (_cx_tnode_right(m) != NULL) m = _cx_tnode_right(m); n = m; } else { cx_tnode *m = _cx_tnode_parent(n); while (n == _cx_tnode_left(m)) { n = m; m = _cx_tnode_parent(m); } n = m; } return n; } /* * Internal, tree related methods */ inline static void _cx_tree_rotate_left(cx_tnode *node, cx_tnode **root) { register cx_tnode *y = _cx_tnode_right(node); _cx_tnode_right(node) = _cx_tnode_left(y); if (_cx_tnode_left(y) != NULL) _cx_tnode_parent(_cx_tnode_left(y)) = node; _cx_tnode_parent(y) = _cx_tnode_parent(node); if (node == *root) *root = y; else if (node == _cx_tnode_left(_cx_tnode_parent(node))) _cx_tnode_left(_cx_tnode_parent(node)) = y; else _cx_tnode_right(_cx_tnode_parent(node)) = y; _cx_tnode_left(y) = node; _cx_tnode_parent(node) = y; return; } inline static void _cx_tree_rotate_right(cx_tnode *node, cx_tnode **root) { register cx_tnode *y = _cx_tnode_left(node); _cx_tnode_left(node) = _cx_tnode_right(y); if (_cx_tnode_right(y) != NULL) _cx_tnode_parent(_cx_tnode_right(y)) = node; _cx_tnode_parent(y) = _cx_tnode_parent(node); if (node == *root) *root = y; else if (node == _cx_tnode_right(_cx_tnode_parent(node))) _cx_tnode_right(_cx_tnode_parent(node)) = y; else _cx_tnode_left(_cx_tnode_parent(node)) = y; _cx_tnode_right(y) = node; _cx_tnode_parent(node) = y; return; } inline static void _cx_tree_rebalance(cx_tnode *node, cx_tnode **root) { _cx_tnode_color(node) = CX_TNODE_RED; while (node != *root && _cx_tnode_color(_cx_tnode_parent(node)) == CX_TNODE_RED) { if (_cx_tnode_parent(node) == _cx_tnode_left(_cx_tnode_grandpa(node))) { cx_tnode *y = _cx_tnode_right(_cx_tnode_grandpa(node)); if (y && _cx_tnode_color(y) == CX_TNODE_RED) { _cx_tnode_color(_cx_tnode_parent(node)) = CX_TNODE_BLACK; _cx_tnode_color(_cx_tnode_grandpa(node)) = CX_TNODE_RED; _cx_tnode_color(y) = CX_TNODE_BLACK; node = _cx_tnode_grandpa(node); } else { if (node == _cx_tnode_right(_cx_tnode_parent(node))) { node = _cx_tnode_parent(node); _cx_tree_rotate_left(node, root); } _cx_tnode_color(_cx_tnode_parent(node)) = CX_TNODE_BLACK; _cx_tnode_color(_cx_tnode_grandpa(node)) = CX_TNODE_RED; _cx_tree_rotate_right(_cx_tnode_grandpa(node), root); } } else { cx_tnode *y = _cx_tnode_left(_cx_tnode_grandpa(node)); if (y && _cx_tnode_color(y) == CX_TNODE_RED) { _cx_tnode_color(_cx_tnode_parent(node)) = CX_TNODE_BLACK; _cx_tnode_color(_cx_tnode_grandpa(node)) = CX_TNODE_RED; _cx_tnode_color(y) = CX_TNODE_BLACK; node = _cx_tnode_grandpa(node); } else { if (node == _cx_tnode_left(_cx_tnode_parent(node))) { node = _cx_tnode_parent(node); _cx_tree_rotate_right(node, root); } _cx_tnode_color(_cx_tnode_parent(node)) = CX_TNODE_BLACK; _cx_tnode_color(_cx_tnode_grandpa(node)) = CX_TNODE_RED; _cx_tree_rotate_left(_cx_tnode_grandpa(node), root); } } } _cx_tnode_color((*root)) = CX_TNODE_BLACK; return; } inline static cx_tnode * _cx_tree_rebalance_for_erase(cx_tnode *node, cx_tnode **root, cx_tnode **leftmost, cx_tnode **rightmost) { cx_tnode *y = node; cx_tnode *x = NULL; cx_tnode *x_parent = NULL; if (_cx_tnode_left(y) == NULL) { /* * node has at most one non-null child. y == node. x might be null. */ x = _cx_tnode_right(y); } else { if (_cx_tnode_right(y) == NULL) { /* * node has exactly one non-null child. y == node. x is not null. */ x = _cx_tnode_left(y); } else { /* * node has 2 non-null children. Set y to node's successor. * x might be null. */ y = _cx_tnode_right(y); while (_cx_tnode_left(y) != NULL) y = _cx_tnode_left(y); x = _cx_tnode_right(y); } } if (y != node) { cx_tnode_color tcolor; /* * relink y in place of node. y is node's successor */ _cx_tnode_parent(_cx_tnode_left(node)) = y; _cx_tnode_left(y) = _cx_tnode_left(node); if (y != _cx_tnode_right(node)) { x_parent = _cx_tnode_parent(y); if (x) _cx_tnode_parent(x) = _cx_tnode_parent(y); _cx_tnode_left(_cx_tnode_parent(y)) = x; _cx_tnode_right(y) = _cx_tnode_right(node); _cx_tnode_parent(_cx_tnode_right(node)) = y; } else x_parent = y; if (*root == node) *root = y; else if (_cx_tnode_left(_cx_tnode_parent(node)) == node) _cx_tnode_left(_cx_tnode_parent(node)) = y; else _cx_tnode_right(_cx_tnode_parent(node)) = y; _cx_tnode_parent(y) = _cx_tnode_parent(node); /* * Swap the colors of y an node. */ tcolor = _cx_tnode_color(node); _cx_tnode_color(node) = _cx_tnode_color(y); _cx_tnode_color(y) = tcolor; /* * Make y point to the node to be actually deleted. */ y = node; } else { /* * y == node */ x_parent = _cx_tnode_parent(y); if (x) _cx_tnode_parent(x) = _cx_tnode_parent(y); if (*root == node) *root = x; else if (_cx_tnode_left(_cx_tnode_parent(node)) == node) _cx_tnode_left(_cx_tnode_parent(node)) = x; else _cx_tnode_right(_cx_tnode_parent(node)) = x; if (*leftmost == node) { if (_cx_tnode_right(node) == NULL) { /* * If node == *root, *leftmost will be the header node. */ *leftmost = _cx_tnode_parent(node); } else *leftmost = _cx_tnode_minimum(x); } if (*rightmost == node) { if (_cx_tnode_left(node) == NULL) { /* * If node == *root, *rightmost will be the header node. */ *rightmost = _cx_tnode_parent(node); } else *rightmost = _cx_tnode_maximum(x); } } if (_cx_tnode_color(y) != CX_TNODE_RED) { while (x != *root && (x == NULL || _cx_tnode_color(x) == CX_TNODE_BLACK)) if (x == _cx_tnode_left(x_parent)) { cx_tnode *w = _cx_tnode_right(x_parent); if (_cx_tnode_color(w) == CX_TNODE_RED) { _cx_tnode_color(w) = CX_TNODE_BLACK; _cx_tnode_color(x_parent) = CX_TNODE_RED; _cx_tree_rotate_left(x_parent, root); w = _cx_tnode_right(x_parent); } if ((_cx_tnode_left(w) == NULL || _cx_tnode_color(_cx_tnode_left(w)) == CX_TNODE_BLACK) && (_cx_tnode_right(w) == NULL || _cx_tnode_color(_cx_tnode_right(w)) == CX_TNODE_BLACK)) { _cx_tnode_color(w) = CX_TNODE_RED; x = x_parent; x_parent = _cx_tnode_parent(x_parent); } else { if (_cx_tnode_right(w) == NULL || _cx_tnode_color(_cx_tnode_right(w)) == CX_TNODE_BLACK) { if (_cx_tnode_left(w)) { cx_tnode *v = _cx_tnode_left(w); _cx_tnode_color(v) = CX_TNODE_BLACK; } _cx_tnode_color(w) = CX_TNODE_RED; _cx_tree_rotate_right(w, root); w = _cx_tnode_right(x_parent); } _cx_tnode_color(w) = _cx_tnode_color(x_parent); _cx_tnode_color(x_parent) = CX_TNODE_BLACK; if (_cx_tnode_right(w)) _cx_tnode_color(_cx_tnode_right(w)) = CX_TNODE_BLACK; _cx_tree_rotate_left(x_parent, root); break; } } else { /* * Same as above with left and right exchanged. */ cx_tnode *w = _cx_tnode_left(x_parent); if (_cx_tnode_color(w) == CX_TNODE_RED) { _cx_tnode_color(w) = CX_TNODE_BLACK; _cx_tnode_color(x_parent) = CX_TNODE_RED; _cx_tree_rotate_right(x_parent, root); w = _cx_tnode_left(x_parent); } if ((_cx_tnode_right(w) == NULL || _cx_tnode_color(_cx_tnode_right(w)) == CX_TNODE_BLACK) && (_cx_tnode_left(w) == NULL || _cx_tnode_color(_cx_tnode_left(w)) == CX_TNODE_BLACK)) { _cx_tnode_color(w) = CX_TNODE_RED; x = x_parent; x_parent = _cx_tnode_parent(x_parent); } else { if (_cx_tnode_left(w) == NULL || _cx_tnode_color(_cx_tnode_left(w)) == CX_TNODE_BLACK) { if (_cx_tnode_right(w)) { cx_tnode *v = _cx_tnode_right(w); _cx_tnode_color(v) = CX_TNODE_BLACK; } _cx_tnode_color(w) = CX_TNODE_RED; _cx_tree_rotate_left(w, root); w = _cx_tnode_left(x_parent); } _cx_tnode_color(w) = _cx_tnode_color(x_parent); _cx_tnode_color(x_parent) = CX_TNODE_BLACK; if (_cx_tnode_left(w)) _cx_tnode_color(_cx_tnode_left(w)) = CX_TNODE_BLACK; _cx_tree_rotate_right(x_parent, root); break; } } if (x) _cx_tnode_color(x) = CX_TNODE_BLACK; } return y; } /* * Convenience function used in cx_tree_verify() */ inline static cxsize _cx_tree_black_count(cx_tnode *node, cx_tnode *root) { cxsize sum = 0; if (node == NULL) return 0; do { if (_cx_tnode_color(node) == CX_TNODE_BLACK) ++sum; if (node == root) break; node = _cx_tnode_parent(node); } while (1); return sum; } /* * Initialize a tree to a valid empty tree. */ inline static void _cx_tree_initialize(cx_tree *tree, cx_tree_compare_func compare, cx_free_func key_destroy, cx_free_func value_destroy) { /* * Used to distinguish header from root in the next operator. * Check this!! */ _cx_tnode_color(_cx_tree_head(tree)) = CX_TNODE_RED; _cx_tree_root(tree) = NULL; _cx_tree_leftmost(tree) = _cx_tree_head(tree); _cx_tree_rightmost(tree) = _cx_tree_head(tree); _cx_tree_node_count(tree) = 0; _cx_tree_compare(tree) = compare; _cx_tree_key_destroy(tree) = key_destroy; _cx_tree_value_destroy(tree) = value_destroy; return; } /* * Inserting elements */ inline static cx_tnode * _cx_tree_insert(cx_tree *tree, cx_tnode *x, cx_tnode *y, cxcptr key, cxcptr value) { cx_tnode *z; if (y == _cx_tree_head(tree) || x != NULL || _cx_tree_key_compare(tree, key, _cx_tnode_key(y))) { z = _cx_tnode_create(key, value); /* * This also makes _cx_tree_leftmost(tree) = z, if * y == _cx_tree_head(tree). */ _cx_tnode_left(y) = z; if (y == _cx_tree_head(tree)) { _cx_tree_root(tree) = z; _cx_tree_rightmost(tree) = z; } else { if (y == _cx_tree_leftmost(tree)) { /* * Maintain _cx_tree_leftmost(tree) pointing to the * minimum node. */ _cx_tree_leftmost(tree) = z; } } } else { z = _cx_tnode_create(key, value); _cx_tnode_right(y) = z; if (y == _cx_tree_rightmost(tree)) { /* * Maintain _cx_tree_rightmost(tree) pointing to the * maximum node. */ _cx_tree_rightmost(tree) = z; } } _cx_tnode_parent(z) = y; _cx_tnode_left(z) = NULL; _cx_tnode_right(z) = NULL; _cx_tree_rebalance(z, &_cx_tree_root(tree)); ++_cx_tree_node_count(tree); return z; } inline static cx_tnode * _cx_tree_insert_equal(cx_tree *tree, cxcptr key, cxcptr value) { cx_tnode *x = _cx_tree_root(tree); cx_tnode *y = _cx_tree_head(tree); while (x != NULL) { cxbool result; y = x; result = _cx_tree_key_compare(tree, key, _cx_tnode_key(x)); x = result ? _cx_tnode_left(x) : _cx_tnode_right(x); } return _cx_tree_insert(tree, x, y, key, value); } inline static cx_tnode * _cx_tree_insert_unique(cx_tree *tree, cxcptr key, cxcptr value) { cx_tnode *x = _cx_tree_root(tree); cx_tnode *y = _cx_tree_head(tree); cx_tnode *pos; cxbool result = TRUE; while (x != NULL) { y = x; result = _cx_tree_key_compare(tree, key, _cx_tnode_key(x)); x = result ? _cx_tnode_left(x) : _cx_tnode_right(x); } pos = y; if (result) { if (pos == _cx_tree_leftmost(tree)) return _cx_tree_insert(tree, x, y, key, value); else pos = _cx_tnode_previous(pos); } if (_cx_tree_key_compare(tree, _cx_tnode_key(pos), key)) return _cx_tree_insert(tree, x, y, key, value); return NULL; } /* * Element removal */ /* * Recursive erase without rebalancing */ inline static void _cx_tree_erase_all(cx_tree *tree, cx_tnode *x) { while (x != NULL) { cx_tnode *y; _cx_tree_erase_all(tree, _cx_tnode_right(x)); y = _cx_tnode_left(x); _cx_tnode_destroy(x, _cx_tree_key_destroy(tree), _cx_tree_value_destroy(tree)); --_cx_tree_node_count(tree); x = y; } return; } inline static void _cx_tree_erase(cx_tree *tree, cx_tnode *x) { cx_tnode *y = _cx_tree_rebalance_for_erase(x, &_cx_tree_root(tree), &_cx_tree_leftmost(tree), &_cx_tree_rightmost(tree)); _cx_tnode_destroy(y, _cx_tree_key_destroy(tree), _cx_tree_value_destroy(tree)); --_cx_tree_node_count(tree); return; } inline static void _cx_tree_clear(cx_tree *tree) { cx_assert(tree != NULL); if (_cx_tree_node_count(tree) != 0) { _cx_tree_erase_all(tree, _cx_tree_root(tree)); _cx_tree_root(tree) = NULL; _cx_tree_leftmost(tree) = _cx_tree_head(tree); _cx_tree_rightmost(tree) = _cx_tree_head(tree); cx_assert(_cx_tree_node_count(tree) == 0); } return; } /* * Iteration */ inline static cx_tree_iterator _cx_tree_begin(const cx_tree *tree) { return _cx_tree_leftmost(tree); } inline static cx_tree_iterator _cx_tree_end(const cx_tree *tree) { return _cx_tree_head(tree); } /* * Basic search */ inline static cx_tnode * _cx_tree_lower_bound(const cx_tree *tree, cxcptr key) { cx_tnode *x = _cx_tree_root(tree); /* Last node not less than key */ cx_tnode *y = _cx_tree_head(tree); /* Current node */ while (x != NULL) { if (!_cx_tree_key_compare(tree, _cx_tnode_key(x), key)) { y = x; x = _cx_tnode_left(x); } else x = _cx_tnode_right(x); } return y; } inline static cx_tnode * _cx_tree_upper_bound(const cx_tree *tree, cxcptr key) { cx_tnode *x = _cx_tree_root(tree); /* Last node greater than key */ cx_tnode *y = _cx_tree_head(tree); /* Current node */ while (x != NULL) { if (_cx_tree_key_compare(tree, key, _cx_tnode_key(x))) { y = x; x = _cx_tnode_left(x); } else x = _cx_tnode_right(x); } return y; } inline static cx_tnode * _cx_tree_find(const cx_tree *tree, cxcptr key) { cx_tnode *x = _cx_tree_root(tree); cx_tnode *y = _cx_tree_head(tree); cx_tnode *pos; while (x != NULL) { if (!_cx_tree_key_compare(tree, _cx_tnode_key(x), key)) { y = x; x = _cx_tnode_left(x); } else x = _cx_tnode_right(x); } pos = y; if (pos == _cx_tree_head(tree) || _cx_tree_key_compare(tree, key, _cx_tnode_key(pos))) return _cx_tree_head(tree); return pos; } inline static cxbool _cx_tree_exists(const cx_tree *tree, cx_tnode *x) { cx_tnode *y; cxptr key = _cx_tnode_key(x); y = _cx_tree_lower_bound(tree, key); if (y != x) { cx_tnode *z = _cx_tree_upper_bound(tree, key); y = _cx_tnode_next(y); while (y != x && y != z) y = _cx_tnode_next(y); } return x == y ? TRUE : FALSE; } /* * Public methods */ /** * @brief * Get an iterator to the first pair in the tree. * * @param tree The tree to query. * * @return Iterator for the first pair or @b cx_tree_end() if the tree is * empty. * * The function returns a handle for the first pair in the tree @em tree. * The returned iterator cannot be used directly to access the value field * of the key/value pair, but only through the appropriate methods. */ cx_tree_iterator cx_tree_begin(const cx_tree *tree) { cx_assert(tree != NULL); return _cx_tree_begin(tree); } /** * @brief * Get an iterator for the position after the last pair in the tree. * * @param tree The tree to query. * * @return Iterator for the end of the tree. * * The function returns an iterator for the position one past the last pair * in the tree @em tree. The iteration is done in ascending order according * to the keys. The returned iterator cannot be used directly to access the * value field of the key/value pair, but only through the appropriate * methods. */ cx_tree_iterator cx_tree_end(const cx_tree *tree) { cx_assert(tree != NULL); return _cx_tree_end(tree); } /** * @brief * Get an iterator for the next pair in the tree. * * @param tree A tree. * @param position Current iterator position. * * @return Iterator for the pair immediately following @em position. * * The function returns an iterator for the next pair in the tree @em tree * with respect to the current iterator position @em position. Iteration * is done in ascending order according to the keys. If the tree is empty * or @em position points to the end of the tree the function returns * @b cx_tree_end(). */ cx_tree_iterator cx_tree_next(const cx_tree *tree, cx_tree_const_iterator position) { cx_assert(tree != NULL); cx_assert(position != NULL); cx_assert(position == _cx_tree_end(tree) || _cx_tree_exists(tree, (cx_tree_iterator)position)); if (position == _cx_tree_end(tree)) { return _cx_tree_end(tree); } return _cx_tnode_next(position); } /** * @brief * Get an iterator for the previous pair in the tree. * * @param tree A tree. * @param position Current iterator position. * * @return Iterator for the pair immediately preceding @em position. * * The function returns an iterator for the previous pair in the tree * @em tree with respect to the current iterator position @em position. * Iteration is done in ascending order according to the keys. If the * tree is empty or @em position points to the beginning of the tree the * function returns @b cx_tree_end(). */ cx_tree_iterator cx_tree_previous(const cx_tree *tree, cx_tree_const_iterator position) { cx_assert(tree != NULL); cx_assert(position != NULL); cx_assert(position == _cx_tree_end(tree) || _cx_tree_exists(tree, (cx_tree_iterator)position)); if (position == _cx_tree_begin(tree)) { return _cx_tree_begin(tree); } return _cx_tnode_previous(position); } /** * @brief * Remove all pairs from a tree. * * @param tree Tree to be cleared. * * @return Nothing. * * The tree @em tree is cleared, i.e. all pairs are removed from the tree. * Keys and values are destroyed using the key and value destructors set up * during tree creation. After calling this function the tree is empty. */ void cx_tree_clear(cx_tree *tree) { cx_assert(tree != NULL); _cx_tree_clear(tree); return; } /** * @brief * Check whether a tree is empty. * * @param tree A tree. * * @return The function returns @c TRUE if the tree is empty, and @c FALSE * otherwise. * * The function checks if the tree contains any pairs. Calling this function * is equivalent to the statement: * @code * return (cx_tree_size(tree) == 0); * @endcode */ cxbool cx_tree_empty(const cx_tree *tree) { return (_cx_tree_node_count(tree) == 0); } /** * @brief * Create a new tree without any elements. * * @param compare Function used to compare keys. * @param key_destroy Destructor for the keys. * @param value_destroy Destructor for the value field. * * @return Handle for the newly allocated tree. * * Memory for a new tree is allocated and the tree is initialized to be a * valid empty tree. * * The tree's key comparison function is set to @em compare. It must * return @c TRUE or @c FALSE if the comparison of the first argument * passed to it with the second argument is found to be true or false * respectively. * * The destructors for a tree node's key and value field are set to * @em key_destroy and @em value_destroy. Whenever a tree node is * destroyed these functions are used to deallocate the memory used * by the key and the value. Each of the destructors might be @c NULL, i.e. * keys and values are not deallocated during destroy operations. * * @see cx_tree_compare_func() */ cx_tree * cx_tree_new(cx_tree_compare_func compare, cx_free_func key_destroy, cx_free_func value_destroy) { cx_tree *tree; cx_assert(compare != NULL); tree = cx_malloc(sizeof *tree); _cx_tree_head(tree) = cx_malloc(sizeof(cx_tnode)); _cx_tree_initialize(tree, compare, key_destroy, value_destroy); return tree; } /** * @brief * Destroy a tree and all its elements. * * @param tree The tree to destroy. * * @return Nothing. * * The tree @em tree is deallocated. All data values and keys are * deallocated using the tree's key and value destructor. If no * key and/or value destructor was set when the @em tree was created * the keys and the stored data values are left untouched. In this * case the key and value deallocation is the responsibility of the * user. * * @see cx_tree_new() */ void cx_tree_delete(cx_tree *tree) { if (tree) { _cx_tree_clear(tree); cx_free(_cx_tree_head(tree)); cx_free(tree); } return; } /** * @brief * Get the actual number of pairs in the tree. * * @param tree A tree. * * @return The current number of pairs, or 0 if the tree is empty. * * Retrieves the current number of pairs stored in the tree. */ cxsize cx_tree_size(const cx_tree *tree) { cx_assert(tree != NULL); return _cx_tree_node_count(tree); } /** * @brief * Get the maximum number of pairs possible. * * @param tree A tree. * * @return The maximum number of pairs that can be stored in the tree. * * Retrieves the tree's capacity, i.e. the maximum possible number of * pairs a tree can manage. */ cxsize cx_tree_max_size(const cx_tree *tree) { (void) tree; /* Prevent warnings if cx_assert is disabled. */ cx_assert(tree != NULL); return (cxsize)(-1); } /** * @brief * Get the key comparison function. * * @param tree The tree to query. * * @return Handle for the tree's key comparison function. * * The function retrieves the function used by the tree methods * for comparing keys. The key comparison function is set during * tree creation. * * @see cx_tree_new() */ cx_tree_compare_func cx_tree_key_comp(const cx_tree *tree) { cx_assert(tree != NULL); return _cx_tree_compare(tree); } /** * @brief * Swap the contents of two trees. * * @param tree1 First tree. * @param tree2 Second tree. * * @return Nothing. * * All pairs stored in the first tree @em tree1 are moved to the second tree * @em tree2, while the pairs from @em tree2 are moved to @em tree1. Also * the key comparison function, the key and the value destructor are * exchanged. */ void cx_tree_swap(cx_tree *tree1, cx_tree *tree2) { cx_tnode *tmp; cxsize sz; cx_tree_compare_func cmp; cx_free_func destroy; cx_assert(tree1 != NULL); cx_assert(tree2 != NULL); tmp = _cx_tree_head(tree2); _cx_tree_head(tree2) = _cx_tree_head(tree1); _cx_tree_head(tree1) = tmp; sz = _cx_tree_node_count(tree2); _cx_tree_node_count(tree2) = _cx_tree_node_count(tree1); _cx_tree_node_count(tree1) = sz; cmp = _cx_tree_compare(tree2); _cx_tree_compare(tree2) = _cx_tree_compare(tree1); _cx_tree_compare(tree1) = cmp; destroy = _cx_tree_key_destroy(tree2); _cx_tree_key_destroy(tree2) = _cx_tree_key_destroy(tree1); _cx_tree_key_destroy(tree1) = destroy; destroy = _cx_tree_value_destroy(tree2); _cx_tree_value_destroy(tree2) = _cx_tree_value_destroy(tree1); _cx_tree_value_destroy(tree1) = destroy; return; } /** * @brief * Assign data to an iterator position. * * @param tree A tree. * @param position Iterator positions where the data will be stored. * @param data Data to store. * * @return Handle to the previously stored data object. * * The function assigns a data object reference @em data to the iterator * position @em position of the tree @em tree. */ cxptr cx_tree_assign(cx_tree *tree, cx_tree_iterator position, cxcptr data) { cxptr tmp; (void) tree; /* Prevent warnings if cx_assert is disabled. */ cx_assert(tree != NULL); cx_assert(position != NULL); cx_assert(_cx_tree_exists(tree, position)); tmp = _cx_tnode_get_value(position); _cx_tnode_set_value(position, data); return tmp; } /** * @brief * Get the key from a given iterator position. * * @param tree A tree. * @param position Iterator position the data is retrieved from. * * @return Reference for the key. * * The function returns a reference to the key associated with the iterator * position @em position in the tree @em tree. * * @note * One must not modify the key of @em position through the returned * reference, since this might corrupt the tree! */ cxptr cx_tree_get_key(const cx_tree *tree, cx_tree_const_iterator position) { (void) tree; /* Prevent warnings if cx_assert is disabled. */ cx_assert(tree != NULL); cx_assert(position != NULL); cx_assert(_cx_tree_exists(tree, (cx_tree_iterator)position)); return _cx_tnode_get_key(position); } /** * @brief * Get the data from a given iterator position. * * @param tree A tree. * @param position Iterator position the data is retrieved from. * * @return Handle for the data object. * * The function returns a reference to the data stored at iterator position * @em position in the tree @em tree. */ cxptr cx_tree_get_value(const cx_tree *tree, cx_tree_const_iterator position) { (void) tree; /* Prevent warnings if cx_assert is disabled. */ cx_assert(tree != NULL); cx_assert(position != NULL); cx_assert(_cx_tree_exists(tree, (cx_tree_iterator)position)); return _cx_tnode_get_value(position); } /** * @brief * Locate an element in the tree. * * @param tree A tree. * @param key Key of the (key, value) pair to locate. * * @return Iterator pointing to the sought-after element, or @b cx_tree_end() * if it was not found. * * The function searches the tree @em tree for an element with a key * matching @em key. If the search was successful an iterator to the * sought-after pair is returned. If the search did not succeed, i.e. * @em key is not present in the tree, a one past the end iterator is * returned. */ cx_tree_iterator cx_tree_find(const cx_tree *tree, cxcptr key) { cx_assert(tree != NULL); cx_assert(key != NULL); return _cx_tree_find(tree, key); } /** * @brief * Find the beginning of a subsequence. * * @param tree A tree. * @param key Key of the (key, value) pair(s) to locate. * * @return Iterator pointing to the first position where an element with * key @em key would get inserted, i.e. the first element with a key greater * or equal than @em key. * * The function returns the first element of a subsequence of elements in the * tree that match the given key @em key. If @em key is not present in the * tree @em tree an iterator pointing to the first element that has a greater * key than @em key or @b cx_tree_end() if no such element exists. */ cx_tree_iterator cx_tree_lower_bound(const cx_tree *tree, cxcptr key) { cx_assert(tree != NULL); cx_assert(key != NULL); return _cx_tree_lower_bound(tree, key); } /** * @brief * Find the end of a subsequence. * * @param tree A tree. * @param key Key of the (key, value) pair(s) to locate. * * @return Iterator pointing to the last position where an element with * key @em key would get inserted, i.e. the first element with a key * greater than @em key. * * The function returns the last element of a subsequence of elements in the * tree that match the given key @em key. If @em key is not present in the * tree @em tree an iterator pointing to the first element that has a greater * key than @em key or @b cx_tree_end() if no such element exists. */ cx_tree_iterator cx_tree_upper_bound(const cx_tree *tree, cxcptr key) { cx_assert(tree != NULL); cx_assert(key != NULL); return _cx_tree_upper_bound(tree, key); } /** * @brief * Find a subsequence matching a given key. * * @param tree A tree. * @param key The key of the (key, value) pair(s) to be located. * @param begin First element with key @em key. * @param end Last element with key @em key. * * @return Nothing. * * The function returns the beginning and the end of a subsequence of * tree elements with the key @em key through through the @em begin and * @em end arguments. After calling this function @em begin possibly points * to the first element of @em tree matching the key @em key and @em end * possibly points to the last element of the sequence. If key is not * present in the tree @em begin points to the next greater element or, * if no such element exists, to @b cx_tree_end(). */ void cx_tree_equal_range(const cx_tree *tree, cxcptr key, cx_tree_iterator *begin, cx_tree_iterator *end) { cx_assert(tree != NULL); cx_assert(key != NULL); *begin = _cx_tree_lower_bound(tree, key); *end = _cx_tree_upper_bound(tree, key); return; } /** * @brief * Get the number of elements matching a key. * * @param tree A tree. * @param key Key of the (key, value) pair(s) to locate. * * @return The number of elements with the specified key. * * Counts all elements of the tree @em tree matching the key @em key. */ cxsize cx_tree_count(const cx_tree *tree, cxcptr key) { cx_tnode *x, *y; cxsize count = 0; cx_assert(tree != NULL); cx_assert(key != NULL); x = _cx_tree_lower_bound(tree, key); y = _cx_tree_upper_bound(tree, key); /* * Only if key is not present in the tree x and y are identical, * pointing to the element with the next greater key. */ while (x != y) { ++count; x = _cx_tnode_next(x); } return count; } /** * @brief * Attempt to insert data into a tree. * * @param tree A tree. * @param key Key used to store the data. * @param data Data to insert. * * @return An iterator that points to the inserted pair, or @c NULL if the * pair could not be inserted. * * This function attempts to insert a (key, value) pair into the tree * @em tree. The insertion fails if the key already present in the tree, * i.e. if the key is not unique. */ cx_tree_iterator cx_tree_insert_unique(cx_tree *tree, cxcptr key, cxcptr data) { cx_assert(tree != NULL); cx_assert(key != NULL); return _cx_tree_insert_unique(tree, key, data); } /** * @brief * Insert data into a tree. * * @param tree A tree. * @param key Key used to store the data. * @param data Data to insert. * * @return An iterator that points to the inserted pair. * * This function inserts a (key, value) pair into the tree @em tree. * Contrary to @b cx_tree_insert_unique() the key @em key used for inserting * @em data may already be present in the tree. */ cx_tree_iterator cx_tree_insert_equal(cx_tree *tree, cxcptr key, cxcptr data) { cx_assert(tree != NULL); cx_assert(key != NULL); return _cx_tree_insert_equal(tree, key, data); } /** * @brief * Erase an element from a tree. * * @param tree A tree. * @param position Iterator position of the element to be erased. * * @return Nothing. * * This function erases an element, specified by the iterator @em position, * from @em tree. Key and value associated with the erased pair are * deallocated using the tree's key and value destructors, provided * they have been set. */ void cx_tree_erase_position(cx_tree *tree, cx_tree_iterator position) { cx_assert(tree != NULL); if (!position || _cx_tree_node_count(tree) == 0) { return; } cx_assert(_cx_tree_exists(tree, position)); _cx_tree_erase(tree, position); return; } /** * @brief * Erase a range of elements from a tree. * * @param tree A tree. * @param begin Iterator pointing to the start of the range to erase. * @param end Iterator pointing to the end of the range to erase. * * @return Nothing. * * This function erases all elements in the range [begin, end) from * the tree @em tree. Key and value associated with the erased pair(s) are * deallocated using the tree's key and value destructors, provided * they have been set. */ void cx_tree_erase_range(cx_tree *tree, cx_tree_iterator begin, cx_tree_iterator end) { cx_assert(tree != NULL); cx_assert(begin == _cx_tree_head(tree) || _cx_tree_exists(tree, begin)); cx_assert(end == _cx_tree_head(tree) || _cx_tree_exists(tree, end)); while (begin != end) { cx_tnode *pos = begin; begin = _cx_tnode_next(pos); _cx_tree_erase(tree, pos); } return; } /** * @brief * Erase all elements from a tree matching the provided key. * * @param tree A tree. * @param key Key of the element to be erased. * * @return The number of removed elements. * * This function erases all elements with the specified key @em key, * from @em tree. Key and value associated with the erased pairs are * deallocated using the tree's key and value destructors, provided * they have been set. */ cxsize cx_tree_erase(cx_tree *tree, cxcptr key) { cx_tnode *x, *y; cxsize count = 0; cx_assert(tree != NULL); cx_assert(key != NULL); x = _cx_tree_lower_bound(tree, key); y = _cx_tree_upper_bound(tree, key); while (x != y) { cx_tnode *pos = x; x = _cx_tnode_next(x); _cx_tree_erase(tree, pos); ++count; } return count; } /** * @brief * Validate a tree. * * @param tree The tree to verify. * * @return Returns @c TRUE if the tree is valid, or @c FALSE otherwise. * * The function is provided for debugging purposes. It verifies that * the internal tree structure of @em tree is valid. */ cxbool cx_tree_verify(const cx_tree *tree) { cx_tnode *it; cxsize len = 0; cx_assert(tree != NULL); if (_cx_tree_node_count(tree) == 0 || _cx_tree_begin(tree) == _cx_tree_end(tree)) { if (_cx_tree_node_count(tree) == 0 && _cx_tree_begin(tree) == _cx_tree_end(tree) && _cx_tnode_left(_cx_tree_head(tree)) == _cx_tree_head(tree) && _cx_tnode_right(_cx_tree_head(tree)) == _cx_tree_head(tree)) return TRUE; else return FALSE; } len = _cx_tree_black_count(_cx_tree_leftmost(tree), _cx_tree_root(tree)); for (it = _cx_tree_begin(tree); it != _cx_tree_end(tree); it = _cx_tnode_next(it)) { cx_tnode *x = it; cx_tnode *L = _cx_tnode_left(x); cx_tnode *R = _cx_tnode_right(x); if (_cx_tnode_color(x) == CX_TNODE_RED) if ((L && _cx_tnode_color(L) == CX_TNODE_RED) || (R && _cx_tnode_color(R) == CX_TNODE_RED)) return FALSE; if (L && _cx_tree_key_compare(tree, _cx_tnode_key(x), _cx_tnode_key(L))) return FALSE; if (R && _cx_tree_key_compare(tree, _cx_tnode_key(R), _cx_tnode_key(x))) return FALSE; if (!L && !R && _cx_tree_black_count(x, _cx_tree_root(tree)) != len) return FALSE; } if (_cx_tree_leftmost(tree) != _cx_tnode_minimum(_cx_tree_root(tree))) return FALSE; if (_cx_tree_rightmost(tree) != _cx_tnode_maximum(_cx_tree_root(tree))) return FALSE; return TRUE; } /**@}*/ cpl-6.4.1/libcext/cext/cxmessages.h0000644000460300003120000001202011530471603014115 00000000000000/* $Id: cxmessages.h,v 1.10 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ #ifndef CX_MESSAGES_H #define CX_MESSAGES_H #include #include #include CX_BEGIN_DECLS /* * Message level offset for user defined message levels * (0 - 7 are used internally). */ #define CX_LOG_LEVEL_USER_SHIFT (8) /* * Log levels and flags */ typedef enum { /* flags */ CX_LOG_FLAG_RECURSION = 1 << 0, CX_LOG_FLAG_FATAL = 1 << 1, /* levels */ CX_LOG_LEVEL_ERROR = 1 << 2, CX_LOG_LEVEL_CRITICAL = 1 << 3, CX_LOG_LEVEL_WARNING = 1 << 4, CX_LOG_LEVEL_MESSAGE = 1 << 5, CX_LOG_LEVEL_INFO = 1 << 6, CX_LOG_LEVEL_DEBUG = 1 << 7, CX_LOG_LEVEL_MASK = ~(CX_LOG_FLAG_RECURSION | CX_LOG_FLAG_FATAL) } cx_log_level_flags; #define CX_LOG_FATAL_MASK (CX_LOG_FLAG_RECURSION | CX_LOG_LEVEL_ERROR) /* * Message handlers */ typedef void (*cx_log_func) (const cxchar *, cx_log_level_flags, const cxchar *, cxptr); typedef void (*cx_print_func) (const cxchar *); /* * Messaging mechanisms */ void cx_log_default_handler(const cxchar *, cx_log_level_flags, const cxchar *, cxptr); cx_log_func cx_log_set_default_handler(cx_log_func); cxuint cx_log_set_handler(const cxchar *, cx_log_level_flags, cx_log_func, cxptr); void cx_log_remove_handler(const cxchar *, cxuint); cx_log_level_flags cx_log_set_fatal_mask(const cxchar *, cx_log_level_flags); cx_log_level_flags cx_log_set_always_fatal(cx_log_level_flags); cxsize cx_log_get_domain_count(void); const cxchar *cx_log_get_domain_name(cxsize); void cx_log(const cxchar *, cx_log_level_flags, const cxchar *, ...) CX_GNUC_PRINTF(3, 4); void cx_logv(const cxchar *, cx_log_level_flags, const cxchar *, va_list) CX_GNUC_PRINTF(3, 0); cx_print_func cx_print_set_handler(cx_print_func); cx_print_func cx_printerr_set_handler(cx_print_func); void cx_print(const cxchar *, ...) CX_GNUC_PRINTF(1, 2); void cx_printerr(const cxchar *, ...) CX_GNUC_PRINTF(1, 0); /* * Convenience functions */ void cx_error(const cxchar *, ...) CX_GNUC_PRINTF(1, 2); void cx_critical(const cxchar *, ...) CX_GNUC_PRINTF(1, 2); void cx_warning(const cxchar *, ...) CX_GNUC_PRINTF(1, 2); void cx_message(const cxchar *, ...) CX_GNUC_PRINTF(1, 2); #ifndef CX_LOG_DOMAIN # define CX_LOG_DOMAIN ((cxchar *)0) #endif /* * Macros for error handling. */ #ifdef CX_DISABLE_ASSERT # define cx_assert(expr) /* empty */ #else /* !CX_DISABLE_ASSERT */ # ifdef __GNUC__ # define cx_assert(expr) \ do { \ if (expr) { \ ; \ } \ else { \ cx_log(CX_LOG_DOMAIN, CX_LOG_LEVEL_ERROR, \ "file %s: line %d (%s): assertion failed: (%s)", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ } \ } while (0) # else /* !__GNUC__ */ # define cx_assert(expr) \ do { \ if (expr) { \ ; \ } \ else { \ cx_log(CX_LOG_DOMAIN,CX_LOG_LEVEL_ERROR, \ "file %s: line %d: assertion failed: (%s)", \ __FILE__, __LINE__, #expr); \ } \ } while (0) # endif /* !__GNUC__ */ #endif /* !CX_DISABLE_ASSERT */ CX_END_DECLS #endif /* CX_MESSAGES_H */ cpl-6.4.1/libcext/cext/cxdeque.h0000644000460300003120000000674011530471603013425 00000000000000/* $Id: cxdeque.h,v 1.3 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.3 $ * $Name: not supported by cvs2svn $ */ #ifndef CX_DEQUE_H #define CX_DEQUE_H #include #include CX_BEGIN_DECLS typedef struct _cx_deque_ cx_deque; typedef cxsize cx_deque_const_iterator; typedef cxsize cx_deque_iterator; /* * Create, copy and destroy operations */ cx_deque *cx_deque_new(void); void cx_deque_delete(cx_deque* deque); void cx_deque_destroy(cx_deque *deque, cx_free_func deallocate); /* * Non-modifying operations */ cxsize cx_deque_size(const cx_deque *deque); cxbool cx_deque_empty(const cx_deque *deque); cxsize cx_deque_max_size(const cx_deque *deque); /* * Assignment operations */ void cx_deque_swap(cx_deque *deque, cx_deque *other); cxptr cx_deque_assign(cx_deque *deque, cx_deque_iterator position, cxptr data); /* * Element access */ cxptr cx_deque_front(const cx_deque *deque); cxptr cx_deque_back(const cx_deque *deque); cxptr cx_deque_get(const cx_deque *deque, cx_deque_const_iterator position); /* * Iterator functions */ cx_deque_iterator cx_deque_begin(const cx_deque *deque); cx_deque_iterator cx_deque_end(const cx_deque *deque); cx_deque_iterator cx_deque_next(const cx_deque *deque, cx_deque_const_iterator position); cx_deque_iterator cx_deque_previous(const cx_deque *deque, cx_deque_const_iterator position); /* * Inserting and removing elements */ void cx_deque_push_front(cx_deque *deque, cxcptr data); cxptr cx_deque_pop_front(cx_deque *deque); void cx_deque_push_back(cx_deque *deque, cxcptr data); cxptr cx_deque_pop_back(cx_deque *deque); cx_deque_iterator cx_deque_insert(cx_deque *deque, cx_deque_iterator position, cxcptr data); cx_deque_iterator cx_deque_erase(cx_deque *deque, cx_deque_iterator position, cx_free_func deallocate); void cx_deque_clear(cx_deque *deque); /* * Extra deque interfaces */ /* * Removing elements */ cxptr cx_deque_extract(cx_deque *deque, cx_deque_iterator position); void cx_deque_remove(cx_deque *deque, cxcptr data); /* * Splice functions */ void cx_deque_unique(cx_deque *deque, cx_compare_func compare); void cx_deque_splice(cx_deque *deque, cx_deque_iterator position, cx_deque *other, cx_deque_iterator start, cx_deque_iterator end); void cx_deque_merge(cx_deque *deque, cx_deque *other, cx_compare_func compare); void cx_deque_sort(cx_deque *deque, cx_compare_func compare); void cx_deque_reverse(cx_deque *deque); CX_END_DECLS #endif /* CX_DEQUE_H */ cpl-6.4.1/libcext/cext/cxmessages.c0000644000460300003120000010262012243415467014126 00000000000000/* $Id: cxmessages.c,v 1.10 2013-02-08 09:11:27 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-02-08 09:11:27 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_CHAR_BIT # include #endif #include "cxthread.h" #include "cxmemory.h" #include "cxstring.h" #include "cxmessages.h" #include "cxstrutils.h" #include "cxutils.h" #define CX_MSG_FORMAT_UNSIGNED_BUFFER_SIZE ((3 * SIZEOF_LONG) + 3) #define CX_MSG_PREFIX_BUFFER_SIZE \ (CX_MSG_FORMAT_UNSIGNED_BUFFER_SIZE + 32) #define CX_MSG_ALERT_LEVELS \ (CX_LOG_LEVEL_ERROR | CX_LOG_LEVEL_CRITICAL | CX_LOG_LEVEL_WARNING) /** * @defgroup cxmessages Message Logging * * The module implements a flexible logging facility. It can be customized * to fit into the application environment. Log levels and functions can be * defined and used in addition to or as replacement of the built in levels * and log functions. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ typedef cxint cx_file_descriptor; /* * Log handler and log domain structures. */ typedef struct _cx_log_domain_ cx_log_domain; typedef struct _cx_log_handler_ cx_log_handler; struct _cx_log_handler_ { cxuint id; cx_log_level_flags log_level; cx_log_func log_func; cxptr data; cx_log_handler *next; }; struct _cx_log_domain_ { cxchar *name; cx_log_level_flags fatal_mask; cx_log_handler *handlers; cx_log_domain *next; }; /* * Messaging system mutexes */ CX_LOCK_DEFINE_STATIC(cx_messages_lock); CX_ONCE_DEFINE_INITIALIZED_STATIC(cx_messages_once); /* * Built in system defaults */ static cx_log_domain *cx_log_domains = NULL; static cx_log_level_flags cx_log_always_fatal = CX_LOG_FATAL_MASK; static cx_log_func cx_log_handler_func = cx_log_default_handler; static cx_print_func cx_print_message_printer = NULL; static cx_print_func cx_print_error_printer = NULL; CX_PRIVATE_DEFINE_STATIC(cx_log_depth); static cx_log_level_flags cx_log_prefix = (CX_LOG_LEVEL_ERROR | CX_LOG_LEVEL_WARNING | CX_LOG_LEVEL_CRITICAL | CX_LOG_LEVEL_DEBUG); /* * Library debugging system */ typedef struct _cx_debug_key_ cx_debug_key; struct _cx_debug_key_ { const cxchar *key; cxuint value; }; typedef enum { CX_DEBUG_FATAL_WARNINGS = 1 << 0, CX_DEBUG_FATAL_CRITICALS = 1 << 1 } cx_debug_flag; static cxbool cx_debug_initialized = FALSE; static cxuint cx_debug_flags = 0; static cxuint cx_debug_parse_string(const cxchar *string, const cx_debug_key *keys, cxuint nkeys) { cxuint i; cxuint result = 0; if (string == 0) return 0; if (!cx_strcasecmp(string, "all")) { for (i = 0; i < nkeys; i++) result |= keys[i].value; } else { const cxchar *p = string; const cxchar *q; cxbool done = FALSE; while (*p && !done) { q = strchr(p, ':'); if (!q) { q = p + strlen(p); done = TRUE; } for (i = 0; i < nkeys; i++) { if (cx_strncasecmp(keys[i].key, p, q - p) == 0 && keys[i].key[q - p] == '\0') result |= keys[i].value; } } } return result; } static void cx_debug_init(void) { const cxchar *value; cx_debug_initialized = TRUE; value = getenv("CX_DEBUG"); if (value != NULL) { static const cx_debug_key keys[] = { {"fatal_warnings", CX_DEBUG_FATAL_WARNINGS}, {"fatal_criticals", CX_DEBUG_FATAL_CRITICALS} }; cx_debug_flags = cx_debug_parse_string(value, keys, CX_N_ELEMENTS(keys)); } if (cx_debug_flags & CX_DEBUG_FATAL_WARNINGS) { cx_log_level_flags fatal_mask; fatal_mask = cx_log_set_always_fatal(CX_LOG_FATAL_MASK); fatal_mask |= CX_LOG_LEVEL_WARNING | CX_LOG_LEVEL_CRITICAL; cx_log_set_always_fatal(fatal_mask); } if (cx_debug_flags & CX_DEBUG_FATAL_CRITICALS) { cx_log_level_flags fatal_mask; fatal_mask = cx_log_set_always_fatal(CX_LOG_FATAL_MASK); fatal_mask |= CX_LOG_LEVEL_CRITICAL; cx_log_set_always_fatal(fatal_mask); } return; } /* * Write a string to a file descriptor. */ inline static void cx_msg_write_string(cx_file_descriptor fd, const cxchar *string) { write(fd, string, strlen(string)); return; } /* * Write an unsigned integer value as formatted string to a file * descriptor. The format is determined by the given radix, which * has to be in the range 2 <= radix <= 36. */ inline static void cx_msg_format_unsigned(cxchar *buffer, cxulong value, cxuint radix) { cxchar c; cxint i, n; cxulong tmp; /* Do not use any cext library functions here! */ if ((radix != 8) && (radix != 10) && (radix !=16)) { *buffer = '\0'; return; } if (!value) { *buffer++ = '0'; *buffer = '\0'; return; } /* Hexadecimal or octal prefix for radix 16 or 8. */ if (radix == 16) { *buffer++ = '0'; *buffer++ = 'x'; } else if (radix == 8) *buffer++ = '0'; /* Number of digits needed. */ n = 0; tmp = value; while (tmp) { tmp /= radix; ++n; } /* Fill buffer with character representation */ i = n; if (n > CX_MSG_FORMAT_UNSIGNED_BUFFER_SIZE - 3) { *buffer = '\0'; return; } while (value) { --i; c = (value % radix); if (c < 10) buffer[i] = c + '0'; else buffer[i] = c + 'a' - 10; value /= radix; } buffer[n] = '\0'; return; } /* * Fill a buffer with the formatted log message prefix. The return value is * the target file descriptor of the message. */ inline static cx_file_descriptor cx_msg_format_prefix(cxchar prefix[], cx_log_level_flags level) { cxbool is_normal = TRUE; /* Do not use any cext library functions here! */ switch (level & CX_LOG_LEVEL_MASK) { case CX_LOG_LEVEL_ERROR: strcpy(prefix, "ERROR"); is_normal = FALSE; break; case CX_LOG_LEVEL_CRITICAL: strcpy(prefix, "CRITICAL"); is_normal = FALSE; break; case CX_LOG_LEVEL_WARNING: strcpy(prefix, "WARNING"); is_normal = FALSE; break; case CX_LOG_LEVEL_MESSAGE: strcpy(prefix, "Message"); is_normal = FALSE; break; case CX_LOG_LEVEL_INFO: strcpy(prefix, "INFO"); break; case CX_LOG_LEVEL_DEBUG: strcpy(prefix, "DEBUG"); break; default: if (level) { strcpy(prefix, "LOG-"); cx_msg_format_unsigned(prefix + 4, level & CX_LOG_LEVEL_MASK, 16); } else strcpy(prefix, "LOG"); break; } if (level & CX_LOG_FLAG_RECURSION) strcat(prefix, " (recursed)"); if (level & CX_MSG_ALERT_LEVELS) strcat(prefix, " **"); return is_normal ? 1 : 2; } /* * Initialize the log message prefix */ inline static void cx_log_prefix_init(void) { static cxbool initialized = FALSE; if (!initialized) { const cxchar *value; initialized = TRUE; value = getenv("CX_MESSAGES_PREFIXED"); if (value) { static const cx_debug_key keys[] = { {"error", CX_LOG_LEVEL_ERROR}, {"critical", CX_LOG_LEVEL_CRITICAL}, {"warning", CX_LOG_LEVEL_WARNING}, {"message", CX_LOG_LEVEL_MESSAGE}, {"info", CX_LOG_LEVEL_INFO}, {"debug", CX_LOG_LEVEL_DEBUG} }; cx_log_prefix = cx_debug_parse_string(value, keys, CX_N_ELEMENTS(keys)); } } return; } /* * Last resort print handler */ static void cx_log_fallback_handler(const cxchar *name, cx_log_level_flags level, const cxchar *message, cxptr data) { cxchar prefix[CX_MSG_PREFIX_BUFFER_SIZE]; cxchar strpid[CX_MSG_FORMAT_UNSIGNED_BUFFER_SIZE]; cxbool is_fatal = (level & CX_LOG_FLAG_FATAL) != 0; cx_file_descriptor fd = cx_msg_format_prefix(prefix, level); /* Keep complier quiet */ (void) data; if (!message) message = "(NULL) message"; cx_msg_format_unsigned(strpid, getpid(), 10); if (name) cx_msg_write_string(fd, "\n"); else cx_msg_write_string(fd, "\n**"); cx_msg_write_string(fd, "(process:"); cx_msg_write_string(fd, strpid); cx_msg_write_string(fd, "): "); if (name) { cx_msg_write_string(fd, name); cx_msg_write_string(fd, "-"); } cx_msg_write_string(fd, prefix); cx_msg_write_string(fd, ": "); cx_msg_write_string(fd, message); if (is_fatal) cx_msg_write_string(fd, "\naborting...\n"); else cx_msg_write_string(fd, "\n"); return; } /* * Create a new domain. */ inline static cx_log_domain * cx_log_domain_new(const cxchar *domain_name) { register cx_log_domain *domain; domain = cx_malloc(sizeof *domain); domain->name = cx_strdup(domain_name); domain->fatal_mask = CX_LOG_FATAL_MASK; domain->handlers = NULL; domain->next = cx_log_domains; cx_log_domains = domain; return domain; } /* * Log domain garbage collector */ inline static void cx_log_domain_cleanup(cx_log_domain *domain) { if (domain->fatal_mask == CX_LOG_FATAL_MASK && domain->handlers == NULL) { register cx_log_domain *last, *current; last = NULL; current = cx_log_domains; while (current) { if (current == domain) { if (last) last->next = domain->next; else cx_log_domains = domain->next; cx_free(domain->name); cx_free(domain); break; } last = current; current = last->next; } } return; } /* * Lookup a log domain */ inline static cx_log_domain * cx_log_domain_find(const cxchar *log_domain) { register cx_log_domain *domain; domain = cx_log_domains; while (domain) { if (strcmp(domain->name, log_domain) == 0) return domain; domain = domain->next; } return NULL; } /* * Get a log domains handler for the given log level */ inline static cx_log_func cx_log_domain_get_handler(cx_log_domain *domain, cx_log_level_flags level, cxptr *data) { if (domain && level) { register cx_log_handler *handler; handler = domain->handlers; while (handler) { if ((handler->log_level & level) == level) { *data = handler->data; return handler->log_func; } handler = handler->next; } } return cx_log_handler_func; } /* * Message system initialization function for threaded environments. * For library internal use only! * * The current thread support does not need a initialization of the * thread environment. If this should ever be needed this function should * be called from the thread initialization function. This means that * This function has to be become a global function. To restrict the * visibility of the function to the library itself add the attribute * macro CX_GNUC_INTERNAL to the function declaration. */ static void _cx_log_thread_init(void) { CX_INITLOCK(cx_messages_lock, CX_MUTEX_TYPE_RECURSIVE); cx_private_init(cx_log_depth, NULL); cx_log_prefix_init(); cx_debug_init(); return; } /** * @brief * Set log levels to be always fatal. * * @param mask Log message level flags. * * @return Previous mask. * * Log levels set in the log message level flags mask @em mask will always be * treated as fatal. This applies only to the internally known log levels. * User defined log levels are not taken into account. * * In any case, the function forces errors to be fatal even if the error * level was not set in @em mask. The priviously set mask is replaced by * @em mask and is passed back to the caller as the return value. */ cx_log_level_flags cx_log_set_always_fatal(cx_log_level_flags mask) { cx_log_level_flags previous; /* * Restrict the global mask to internally known levels, force * errors to be fatal and remove a bogus flag */ mask &= (1 << CX_LOG_LEVEL_USER_SHIFT) - 1; mask |= CX_LOG_LEVEL_ERROR; mask &= ~CX_LOG_FLAG_FATAL; CX_LOCK(cx_messages_lock); previous = cx_log_always_fatal; cx_log_always_fatal = mask; CX_UNLOCK(cx_messages_lock); return previous; } /** * @brief * Get the number of registered log domains. * * @return The number of currently registered log domains. * * The function counts the registered log domains and returns the * total number of log domains. The returned number may be 0 if no * log domain was previously registered. */ cxsize cx_log_get_domain_count(void) { register cxsize count = 0; register cx_log_domain *domain = cx_log_domains; while (domain) { ++count; domain = domain->next; } return count; } /** * @brief * Get the name of a log domain. * * @param position Index of the log domain to lookup. * * @return The function returns the name of the log domain, or @c NULL * if @em position is out of range. * * The function retrieves the name of the log domain registered at index * position @em position. The valid range for @em position is from 0 to 1 * less than the number of domains registered. If an invalid log domain is * requested, i.e. no log domain has been previously registered for the given * position, the function returns @c NULL. * * @see cx_log_get_domain_count() */ const cxchar * cx_log_get_domain_name(cxsize position) { register cx_log_domain *domain = cx_log_domains; while (domain) { if (position == 0) { return domain->name; } --position; domain = domain->next; } return NULL; } /** * @brief * Sets the log message level which are fatal for a given domain. * * @param name Name of the log domain. * @param fatal_mask The log domains new fatal mask. * * @return Previously installed fatal mask for the domain. * * The log message levels set in the flag mask @em fatal_mask are treated * as being fatal for the log domain with the name @em name. Even if the * error level is not set in @em fatal_mask the function forces errors to * be fatal. */ cx_log_level_flags cx_log_set_fatal_mask(const cxchar *name, cx_log_level_flags fatal_mask) { cx_log_level_flags previous; register cx_log_domain *domain; if (!name) name = ""; /* Force errors to be fatal. Remove bogus flag. */ fatal_mask |= CX_LOG_LEVEL_ERROR; fatal_mask &= ~CX_LOG_FLAG_FATAL; CX_LOCK(cx_messages_lock); domain = cx_log_domain_find(name); if (!domain) domain = cx_log_domain_new(name); previous = domain->fatal_mask; domain->fatal_mask = fatal_mask; cx_log_domain_cleanup(domain); CX_UNLOCK(cx_messages_lock); return previous; } /** * @brief * Set the default log handler. * * @param func New handler function. * * @return The previously set print handler. * * The function @em func is installed as the new default log handler function. * Any message passed to @b cx_log() or @b cx_logv() is printed using this * handler unless a domain and level specific handler has been set for the * current message. * * @see cx_log_set_handler() */ cx_log_func cx_log_set_default_handler(cx_log_func func) { cx_log_func previous; CX_LOCK(cx_messages_lock); previous = cx_log_handler_func; cx_log_handler_func = func; CX_UNLOCK(cx_messages_lock); return previous; } /** * @brief * Set the log handler for a log domain. * * @param name Name of the log domain. * @param levels Log levels. * @param func log function. * @param data User data. * * @return The handler's id for this domain. * * The log function @em func is set for the domain with the name @em name, * applicable for the log levels given by the flag mask @em levels. If * the log function @em func requires extra data this can be passed to * @em func through the user data @em data. */ cxuint cx_log_set_handler(const cxchar *name, cx_log_level_flags levels, cx_log_func func, cxptr data) { register cx_log_domain *domain; register cx_log_handler *handler; static cxuint handler_id = 0; if ((levels & CX_LOG_LEVEL_MASK) == 0) return 0; if (func == NULL) return 0; if (!name) name = ""; CX_LOCK(cx_messages_lock); domain = cx_log_domain_find(name); if (!domain) domain = cx_log_domain_new(name); handler = cx_malloc(sizeof *handler); handler->id = ++handler_id; handler->log_level = levels; handler->log_func = func; handler->data = data; handler->next = domain->handlers; domain->handlers = handler; CX_UNLOCK(cx_messages_lock); return handler_id; } /** * @brief * Remove a log handler from a domain. * * @param name Name of the log domain. * @param id Id number of the handler. * * Removes the log handler, i.e. in principle the log function, registered * with the id number @em id, from the list of log handlers for the log * domain @em name. */ void cx_log_remove_handler(const cxchar *name, cxuint id) { register cx_log_domain *domain; if (id == 0) return; if (!name) name = ""; CX_LOCK(cx_messages_lock); domain = cx_log_domain_find(name); if (domain) { register cx_log_handler *last, *current; last = NULL; current = domain->handlers; while (current) { if (current->id == id) { if (last) last->next = current->next; else domain->handlers = current->next; cx_log_domain_cleanup(domain); CX_UNLOCK(cx_messages_lock); cx_free(current); return; } last = current; current = last->next; } } CX_UNLOCK(cx_messages_lock); cx_warning("cx_log_remove_handler(): could not find handler with " "id `%d' for domain \"%s\"", id, name); return; } /** * @brief * Log a formatted message using a variable-length argument. * * @param name Name of the log domain. * @param level The message log level. * @param format Format string defining output converstions. * @param args Variable-length argument list. * * The log message, as defined by the format string @em format and arguments * given by the variable-length argument @em args is formatted according to * the conversion directives present in the format string. All standard * @b printf() conversion directives are supported. * * The formatted message is logged for the level @em level, if it is enabled, * using the log function set for the log domain @em name. */ void cx_logv(const cxchar *name, cx_log_level_flags level, const cxchar *format, va_list args) { cxbool is_fatal = (level & CX_LOG_FLAG_FATAL) != 0; cxbool in_recursion = (level & CX_LOG_FLAG_RECURSION) != 0; register cxint i; level &= CX_LOG_LEVEL_MASK; if (!level) return; /* * Logging system initialization. Takes place only once. */ cx_thread_once(cx_messages_once, _cx_log_thread_init, NULL); for (i = cx_bits_find(level, -1); i >= 0; i = cx_bits_find(level, i)) { register cx_log_level_flags test_level; test_level = 1 << i; if (level & test_level) { cxuint depth = CX_POINTER_TO_UINT(cx_private_get(cx_log_depth)); cx_log_level_flags fatal_mask; cx_log_domain *domain; cx_log_func log_func; cxptr data = NULL; if (is_fatal) test_level |= CX_LOG_FLAG_FATAL; if (in_recursion) test_level |= CX_LOG_FLAG_RECURSION; /* * Lookup handler */ CX_LOCK(cx_messages_lock); domain = cx_log_domain_find(name ? name : ""); if (depth) test_level |= CX_LOG_FLAG_RECURSION; ++depth; fatal_mask = domain ? domain->fatal_mask : CX_LOG_FATAL_MASK; if (((fatal_mask | cx_log_always_fatal) & test_level) != 0) test_level |= CX_LOG_FLAG_FATAL; if (test_level & CX_LOG_FLAG_RECURSION) log_func = cx_log_fallback_handler; else log_func = cx_log_domain_get_handler(domain, test_level, &data); domain = NULL; CX_UNLOCK(cx_messages_lock); cx_private_set(cx_log_depth, CX_UINT_TO_POINTER(depth)); /* * Debug initialization */ if (!(test_level & CX_LOG_FLAG_RECURSION) && !cx_debug_initialized) { cx_log_level_flags test_level_saved = test_level; cx_debug_init(); if (((fatal_mask | cx_log_always_fatal) & test_level) != 0) test_level |= CX_LOG_FLAG_FATAL; if (test_level != test_level_saved) { CX_LOCK(cx_messages_lock); domain = cx_log_domain_find(name ? name : ""); log_func = cx_log_domain_get_handler(domain, test_level, &data); domain = NULL; CX_UNLOCK(cx_messages_lock); } } if (test_level & CX_LOG_FLAG_RECURSION) { /* * Use fixed size stack buffer, because we might be out of * memory. */ cxchar buffer[1025]; va_list args2; CX_VA_COPY(args2, args); cx_vsnprintf(buffer, 1024, format, args); va_end(args2); log_func(name, test_level, buffer, data); } else { cxchar *buffer; va_list args2; CX_VA_COPY(args2, args); buffer = cx_strvdupf(format, args2); va_end(args2); log_func(name, test_level, buffer, data); cx_free(buffer); } if (test_level & CX_LOG_FLAG_FATAL) abort(); --depth; cx_private_set(cx_log_depth, CX_UINT_TO_POINTER(depth)); } } return; } /** * @brief * Log a formatted message. * * @param name Name of the log domain. * @param level The message log level. * @param format Format string defining output converstions. * @param ... Argument list. * * The log message, as defined by the format string @em format and the * corresponding argument list is logged with the level @em level, if it * is enabled, using the log function set for the log domain @em name. * given by the variable-length argument is formatted according to the * All standard @b printf() conversion directives are supported. */ void cx_log(const cxchar *name, cx_log_level_flags level, const cxchar *format, ...) { va_list args; va_start(args, format); cx_logv(name, level, format, args); va_end(args); return; } /** * @brief * Default log handler. * * @param name The message's log domain name * @param level Log level of the message * @param message The message text * @param data Extra data passed by the caller (ignored!) * * @return Nothing. * * The default log handler, which is used if no log handler has been set by a * call to @b cx_log_set_handler() for the combination domain @em name and * log level @em level. The message text @em message is written to @c stdout, * or @c stderr if the level is one of @c CX_LOG_LEVEL_ERROR, * @c CX_LOG_LEVEL_CRITICAL and @c CX_LOG_LEVEL_WARNING. In addition, if the * log level is fatal the program is aborted by a call to @b abort(). * * @see cx_log_set_handler() */ void cx_log_default_handler(const cxchar *name, cx_log_level_flags level, const cxchar *message, cxptr data) { cxchar prefix[CX_MSG_PREFIX_BUFFER_SIZE]; cxbool is_fatal = (level & CX_LOG_FLAG_FATAL) != 0; cx_string* msg = NULL; cx_file_descriptor fd; if (level & CX_LOG_FLAG_RECURSION) { cx_log_fallback_handler(name, level, message, data); return; } cx_log_prefix_init(); fd = cx_msg_format_prefix(prefix, level); msg = cx_string_new(); if ((cx_log_prefix & level) == level) { const cxchar *program = cx_program_get_name(); if (program) cx_string_sprintf(msg, "(%s:%lu): ", program, (cxulong)getpid()); else cx_string_sprintf(msg, "(process:%lu): ", (cxulong)getpid()); } if (!name) cx_string_prepend(msg, "** "); if (level & CX_MSG_ALERT_LEVELS) cx_string_prepend(msg, "\n"); if (name) { cx_string_append(msg, name); cx_string_append(msg, "-"); } cx_string_append(msg, prefix); cx_string_append(msg, ": "); if (!message) cx_string_append(msg, "(NULL) message"); else cx_string_append(msg, message); if (is_fatal) cx_string_append(msg, "\naborting...\n"); else cx_string_append(msg, "\n"); cx_msg_write_string(fd, cx_string_get(msg)); cx_string_delete(msg); return; } /** * @brief * Set handler for message output. * * @param func New handler function. * * @return The previously set print handler. * * The function @em func is installed as the new message printing function. * Any message passed to @b cx_print() is printed using this handler. The * default print handler just outputs the message text to @c stdout. * * @see cx_print() */ cx_print_func cx_print_set_handler(cx_print_func func) { cx_print_func previous; CX_LOCK(cx_messages_lock); previous = cx_print_message_printer; cx_print_message_printer = func; CX_UNLOCK(cx_messages_lock); return previous; } /** * @brief * Output a formatted message via the print handler. * * @param format The message format. * @param ... Argument list. * * @return Nothing. * * The output message created from the format string @em format and the * converted arguments from the argument list is output via the currently * set print handler. The format string may contain all conversion * directives supported by @b printf(). The default print handler outputs * messages to @c stdout. * * The @b cx_print() function should not be from within libraries for * debugging messages, since it may be redirected by applications. Instead, * libraries should use @b cx_log(), or the convenience functions * @b cx_error(), @b cx_critical(), @b cx_warning() and @b cx_message(). * * @see cx_print_set_handler() */ void cx_print(const cxchar *format, ...) { va_list args; cxchar *string; cx_print_func printer; if (format == NULL) return; va_start(args, format); string = cx_strvdupf(format, args); va_end(args); CX_LOCK(cx_messages_lock); printer = cx_print_message_printer; CX_UNLOCK(cx_messages_lock); if (printer) printer(string); else { fputs(string, stdout); fflush(stdout); } cx_free(string); return; } /** * @brief * Set handler for error message output. * * @param func New handler function. * * @return The previously set error message handler. * * The function @em func is installed as the new error message printing * function. Any message passed to @b cx_printerr() is printed using this * handler. The default print handler just outputs the error message text * to @c stderr. * * @see cx_printerr() */ cx_print_func cx_printerr_set_handler(cx_print_func func) { cx_print_func previous; CX_LOCK(cx_messages_lock); previous = cx_print_error_printer; cx_print_error_printer = func; CX_UNLOCK(cx_messages_lock); return previous; } /** * @brief * Output a formatted message via the error message handler. * * @param format The message format. * @param ... Argument list. * * @return Nothing. * * The output error message created from the format string @em format and the * converted arguments from the argument list is output via the currently * set error message handler. The format string may contain all conversion * directives supported by @b printf(). The default error message handler * outputs messages to @c stderr. * * The @b cx_printerr() function should not be from within libraries for * debugging messages, since it may be redirected by applications. Instead, * libraries should use @b cx_log(), or the convenience functions * @b cx_error(), @b cx_critical(), @b cx_warning() and @b cx_message(). * * @see cx_printerr_set_handler() */ void cx_printerr(const cxchar *format, ...) { va_list args; cxchar *string; cx_print_func printer; if (format == NULL) return; va_start(args, format); string = cx_strvdupf(format, args); va_end(args); CX_LOCK(cx_messages_lock); printer = cx_print_error_printer; CX_UNLOCK(cx_messages_lock); if (printer) printer(string); else { fputs(string, stderr); fflush(stderr); } cx_free(string); return; } /** * @brief * Log an error message. * * @param format The format string. * @param ... Arguments to be inserted into the format string. * * @return Nothing. * * This is a convenience function to log an error message specified by the * format string @em format and the following list of arguments via the * installed log handler. * * Error messages are always considered fatal, i.e. the application is * immediately terminated by a call to @b abort() causing a core dump. Do * not use this function for expected (recoverable) errors. * This function should be used to indicate a bug (assertion failure) in the * application. * * @see cx_critical() */ void cx_error(const cxchar *format, ...) { va_list args; va_start(args, format); cx_logv(CX_LOG_DOMAIN, CX_LOG_LEVEL_ERROR, format, args); va_end(args); return; } /** * @brief * Log a "critical" warning. * * @param format The format string. * @param ... Arguments to be inserted into the format string. * * @return Nothing. * * This is a convenience function to log a message with level * @c CX_LOG_LEVEL_CRITICAL, as specified by the format string @em format and * the following list of arguments, via the installed log handler. * * It is up to the application to decide which warnings are critical and * which are not. To cause a termination of the application on critical * warnings you may call @b cx_log_set_always_fatal(). * * @see cx_warning() */ void cx_critical(const cxchar *format, ...) { va_list args; va_start(args, format); cx_logv(CX_LOG_DOMAIN, CX_LOG_LEVEL_CRITICAL, format, args); va_end(args); return; } /** * @brief * Log a warning. * * @param format The format string. * @param ... Arguments to be inserted into the format string. * * @return Nothing. * * This is a convenience function to log a warning message, as specified * by the format string @em format and the following list of arguments, * via the installed log handler. * * @see cx_critical() */ void cx_warning(const cxchar *format, ...) { va_list args; va_start(args, format); cx_logv(CX_LOG_DOMAIN, CX_LOG_LEVEL_WARNING, format, args); va_end(args); return; } /** * @brief * Log a normal message. * * @param format The format string. * @param ... Arguments to be inserted into the format string. * * @return Nothing. * * This is a convenience function to log an ordinary message, as specified * by the format string @em format and the following list of arguments, * via the installed log handler. * */ void cx_message(const cxchar *format, ...) { va_list args; va_start(args, format); cx_logv(CX_LOG_DOMAIN, CX_LOG_LEVEL_MESSAGE, format, args); va_end(args); return; } /**@}*/ cpl-6.4.1/libcext/cext/cxstrutils.c0000644000460300003120000004031011530471603014175 00000000000000/* $Id: cxstrutils.c,v 1.6 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.6 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include "cxmemory.h" #include "cxmessages.h" #include "cxslist.h" #include "cxstrutils.h" #include "cxutils.h" /** * @defgroup cxstrutils String Utility Functions * * The module implements various string-related utility functions suitable * for creating, searching and modifying C strings. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ inline static cxchar * _cx_strskip(const cxchar *string, int (*ctype)(int)) { cx_assert(string != NULL); cx_assert(ctype != NULL); while (*string && ctype((cxuchar)*string)) { string++; } return (cxchar *)string; } /* * Remove leading whitespace characters from a string. */ inline static cxchar * _cx_strtrim(cxchar *string) { register cxchar *t = string; if (!string) { return NULL; } if (!*string) { return string; } while (*t && isspace((cxuchar)*t)) { t++; } memmove(string, t, strlen((cxchar *)t) + 1); return string; } /* * Remove trailing whitespace characters from a string. */ inline static cxchar * _cx_strrtrim(cxchar *string) { register cxchar *t; if (!string) { return NULL; } if (!*string) { return string; } t = string + strlen(string) - 1; while (isspace((cxuchar)*t)) { t--; } *++t = '\0'; return string; } /* * Clone a zero terminated C string. */ inline static cxchar * _cx_strdup(const cxchar *string) { cxchar *s; cxsize sz; if (string) { sz = strlen(string) + 1; s = cx_malloc(sz * sizeof(cxchar)); memcpy(s, string, sz); } else { s = NULL; } return s; } /* * Copy a C string returning a pointer to the terminating zero. */ inline static cxchar * _cx_stpcpy(cxchar *dest, const cxchar *src) { #ifdef HAVE_STPCPY if (dest == NULL || src == NULL) { return NULL; } return stpcpy(dest, src); #else register cxchar *d = dest; register const cxchar *s = src; if (dest == NULL || src == NULL) { return NULL; } while ((*d++ = *s++)) { ; } return d - 1; #endif } /** * @brief * Compare two strings ignoring the case of ASCII characters. * * @param s1 First string. * @param s2 Second string. * * @return An integer less than, equal to, or greater than zero if @em s1 * is found, respectively, to be less than, to match, or be greater than * @em s2. * * The function compares the two strings @em s1 and @em s2 as @b strcmp() * does, but ignores the case of ASCII characters. */ cxint cx_strcasecmp(const cxchar *s1, const cxchar *s2) { cxint c1, c2; cx_assert(s1 != NULL); cx_assert(s2 != NULL); while (*s1 && *s2) { c1 = tolower(*s1); c2 = tolower(*s2); if (c1 != c2) return c1 - c2; s1++; s2++; } return ((cxint) *s1 - (cxint) *s2); } /** * @brief * Compare the first n characters of two strings ignoring the case of * ASCII characters. * * @param s1 First string. * @param s2 Second string. * @param n Number of characters to compare. * * @return An integer less than, equal to, or greater than zero if the first * @em n characters of @em s1 are found, respectively, to be less than, to * match, or be greater than the first @em n characters of @em s2. * * The function compares the first @em n characters of the two strings @em s1 * and @em s2 as @b strncmp() does, but ignores the case of ASCII characters. */ cxint cx_strncasecmp(const cxchar *s1, const cxchar *s2, cxsize n) { cxint c1, c2; cx_assert(s1 != NULL); cx_assert(s2 != NULL); while (n && *s1 && *s2) { --n; c1 = tolower(*s1); c2 = tolower(*s2); if (c1 != c2) return c1 - c2; s1++; s2++; } if (!n) return 0; return ((cxint) *s1 - (cxint) *s2); } /** * @brief * Test if a string represents an empty string. * * @param string String to be tested. * @param pattern String containing all allowed comment characters. * * @return The function returns 1 if the string is found to be empty or if * the first non--whitespace character is one out of the set of provided * comment characters. Otherwise the function returns 0. * * The function skips all leading whitespace characters in the string * @em string. Whitespace characters are recognized by @b isspace(). * If the first character which is not a whitespace character is either * '\\0' or one out of the pattern string @em pattern, the string is * considered as empty and the function returns 1. * * If @em pattern is set to @c NULL there is no checking for special * characters that should be considered as whitespaces. */ cxint cx_strempty(const cxchar *string, const cxchar *pattern) { cx_assert(string != NULL); string = _cx_strskip(string, isspace); if (*string) { if (!pattern || !strchr(pattern, *string)) return 0; } return 1; } /** * @brief * Convert all uppercase characters in a string into lowercase * characters. * * @param s The string to convert. * * @return Returns a pointer to the converted string. * * Walks through the given string and turns uppercase characters into * lowercase characters using @b tolower(). * * @see cx_strupper() */ cxchar * cx_strlower(cxchar *s) { cxchar *t = s; cx_assert(s != NULL); while (*t) { *t = tolower(*t); t++; } return s; } /** * @brief * Convert all lowercase characters in a string into uppercase * characters. * * @param s The string to convert. * * @return Returns a pointer to the converted string. * * Walks through the given string and turns lowercase characters into * uppercase characters using @b toupper(). * * @see strlower() */ cxchar * cx_strupper(cxchar *s) { cxchar *t = s; cx_assert(s != NULL); while (*t) { *t = toupper(*t); t++; } return s; } /** * @brief * Remove leading whitespace characters from a string. * * @param string String to be processed. * * @return The function returns a pointer to the modified string if no * error occurred, otherwise @c NULL. * * The function removes leading whitespace characters, or from the string * @em string. Whitespace characters are recognized by @b isspace(). */ cxchar * cx_strtrim(cxchar *string) { return _cx_strtrim(string); } /** * @brief * Remove trailing whitespace characters from a string. * * @param string String to be processed. * * @return The function returns a pointer to the modified string if no * error occurred, otherwise @c NULL. * * The function removes trailing whitespace characters, or from the string * @em string. Whitespace characters are recognized by @b isspace(). * */ cxchar * cx_strrtrim(cxchar *string) { return _cx_strrtrim(string); } /** * @brief * Remove leading and trailing whitespace characters from a string. * * @return The function returns a pointer to the modified string if no * error occurred, otherwise @c NULL. * * @param string String to be processed. * * The function removes leading and trailing whitespace characters from * the string @em string. Whitespace characters are recognized * by @b isspace(). */ cxchar * cx_strstrip(cxchar *string) { return _cx_strrtrim(_cx_strtrim(string)); } /** * @brief * Locate the first character in a string that does not belong to a * given character class. * * @param string String to be processed. * @param ctype Character class test function. * * @return Pointer to the first character that is not a member of * the character class described by @em ctype. * * Searches the string @em string for the first occurence of a character * which does not belong to a certain character class. The character * class is represented through a function that returns a non zero value * if a character belongs to that class and 0 otherwise. Such functions * are the character classification routines like @b isspace() for * instance. It is expected that the input string is properly terminated. * In case the whole string consists of characters of the specified class * the function will return the location of the terminating '\\0'. */ cxchar * cx_strskip(const cxchar *string, int (*ctype)(int)) { if (!string) { return NULL; } return _cx_strskip(string, ctype); } /** * @brief * Duplicate a string. * * @param string String to be duplicated. * * @return Newly allocated copy of the original string. * * Duplicates the input string @em string. The newly allocated copy returned * to the caller can be deallocated using @b cx_free(). */ cxchar * cx_strdup(const cxchar *string) { return _cx_strdup(string); } /** * @brief * Duplicate the first n charactes of a string. * * @param string Source string * @param n Maximum number of characters to be duplicated. * * @return Newly allocated copy of the first @em n characters of @em string. * * Duplicates the first @em n characters of the source string @em string, * returning the copied characters in newly allocated string of the size * @em n + 1. The returned string is always null terminated. If the length * of @em string is less than @em n the returned string is padded with nulls. * The newly allocated string can be deallocated using @b cx_free(). */ cxchar * cx_strndup(const cxchar *string, cxsize n) { cxchar *s; if (string) { s = cx_calloc(n + 1, sizeof(cxchar)); memcpy(s, string, n); s[n] = '\0'; } else s = NULL; return s; } /** * @brief * Create a string from a variable-length argument list under format * control. * * @param format The format string. * @param args Variable-length arguments to be inserted into @em format. * * @return An newly allocated string containing the formatted result. * * The function is similar to @b vsprintf() but calculates the size needed * to store the formatted result string and allocates the memory. The * newly allocated string can be deallocated using @b cx_free(). */ cxchar * cx_strvdupf(const cxchar *format, va_list args) { cxchar *buffer; if (format == NULL) return NULL; cx_vasprintf(&buffer, format, args); return buffer; } /** * @brief * Copy a string returning a pointer to its end. * * @param dest Destination string. * @param src Source string. * * @return Pointer to the terminating '\\0' of the concatenated string. * * The function copies the string @em src, including its terminating '\\0', * to the string @em dest. The source and the destination string may not * overlap and the destination buffer must be large enough to receive the * copy. */ cxchar * cx_stpcpy(cxchar *dest, const cxchar *src) { return _cx_stpcpy(dest, src); } /** * @brief * Deallocate a @c NULL terminated string array. * * @param sarray String array to deallocate * * @return Nothing. * * The function deallocates the array of strings @em sarray and any string * it possibly contains. */ void cx_strfreev(cxchar **sarray) { if (sarray) { register int i = 0; while (sarray[i]) { cx_free(sarray[i]); i++; } cx_free(sarray); } return; } /** * @brief * Split a string into pieces at a given delimiter. * * @param string The string to split. * @param delimiter String specifying the locations where to split. * @param max_tokens The maximum number of tokens the string is split into. * * @return The function returns a newly allocated, @c NULL terminated * array of strings, or @c NULL in case of an error. * * The function breaks up the string @em string into, at most, @em max_tokens * pieces at the places indicated by @em delimiter. If @em max_tokens is * reached, the remainder of the string is appended to the last token. If * @em max_tokens is less than 1 the string @em string is split completely. * * The delimiter string @em delimiter never shows up in any of the resulting * strings, unless @em max_tokens is reached. * * As a special case, the result of splitting the empty string "" is an empty * vector, not a vector containing a single string. * * The created result vector can be deallocated using @b cx_strfreev(). */ cxchar ** cx_strsplit(const cxchar *string, const cxchar *delimiter, cxint max_tokens) { cxchar **sarray, *s; cxuint n = 0; cx_slist *slist = cx_slist_new(); cx_slist_iterator sl; const cxchar *remainder = string; if (!string || !delimiter) return NULL; if (*delimiter == '\0') return NULL; if (max_tokens < 1) max_tokens = CX_MAXINT; s = strstr(remainder, delimiter); if (s) { cxsize sz = strlen(delimiter); while (--max_tokens && s) { cxsize length; cxchar *token; length = s - remainder; token = cx_malloc((length + 1) * sizeof(cxchar)); strncpy(token, remainder, length); token[length] = '\0'; cx_slist_push_front(slist, token); n++; remainder = s + sz; s = strstr(remainder, delimiter); } } if (*string) { n++; cx_slist_push_front(slist, _cx_strdup(remainder)); } sarray = cx_malloc((n + 1) * sizeof(cxchar *)); sarray[n--] = NULL; sl = cx_slist_begin(slist); while (sl != cx_slist_end(slist)) { sarray[n--] = cx_slist_get(slist, sl); sl = cx_slist_next(slist, sl); } cx_slist_delete(slist); return sarray; } /** * @brief * Join strings from an array of strings. * * @param separator Optional separator string. * @param sarray Array of strings to join. * * @return A newly allocated string containing the joined input strings * separated by @em separator, or @c NULL in case of error. * * The function builds a single string from the strings referenced by * @em sarray. The array of input strings @em sarray has to be @c NULL * terminated. Optionally, a separator string can be passed through * @em separator which will then be inserted between two strings. If no * separator should be inserted when joining, @em separator must be set * to @c NULL. */ cxchar * cx_strjoinv(const cxchar *separator, cxchar **sarray) { cxchar *string, *s; if (!sarray) return NULL; if (separator == NULL) separator = ""; if (*sarray) { cxint i; cxsize sz; /* * Compute the required size of the result string */ sz = 1 + strlen(sarray[0]); i = 1; while (sarray[i]) { sz += strlen(sarray[i]); ++i; } sz += strlen(separator) * (i - 1); /* * Join the elements */ string = cx_malloc(sz * sizeof(cxchar)); s = _cx_stpcpy(string, sarray[0]); i = 1; while (sarray[i]) { s = _cx_stpcpy(s, separator); s = _cx_stpcpy(s, sarray[i]); ++i; } } else { string = _cx_strdup(""); } return string; } /**@}*/ cpl-6.4.1/libcext/cext/cxlist.c0000644000460300003120000007215112243415467013277 00000000000000/* $Id: cxlist.c,v 1.8 2011-12-22 14:33:32 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-12-22 14:33:32 $ * $Revision: 1.8 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include "cxmemory.h" #include "cxmessages.h" #include "cxlist.h" /** * @defgroup cxlist Doubly Linked Lists * * The module implements a doubly linked list object which can be traversed * in both directions, forward and backward, and methods to create, destroy * and manipulate it. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * Doubly linked list node and list opaque data types */ typedef struct _cx_lnode_ cx_lnode; struct _cx_lnode_ { cxptr data; struct _cx_lnode_ *prev; struct _cx_lnode_ *next; }; struct _cx_list_ { cx_lnode head; }; /* * Attach data to a list node. */ inline static void _cx_lnode_put(cx_lnode *node, cxcptr data) { cx_assert(node != NULL); node->data = (cxptr)data; return; } /* * Retrieve data from a list node. The previously stored data is returned * to the caller. */ inline static cxptr _cx_lnode_get(const cx_lnode *node) { if (!node) return NULL; return node->data; } /* * Create a new list node. */ inline static cx_lnode * _cx_lnode_create(cxcptr data) { cx_lnode *node = cx_malloc(sizeof *node); _cx_lnode_put(node, data); node->next = NULL; node->prev = NULL; return node; } /* * Deallocate a list node. A handle to the node's data is returned to the * caller. */ inline static cxptr _cx_lnode_delete(cx_lnode *node) { cxptr data; if (!node) return NULL; data = _cx_lnode_get(node); cx_free(node); return data; } /* * Destroy a list node, i.e. at first the node's data is deallocated using * the passed deallocator and then the node itself. If NULL is passed as * deallocator the data is not deallocated and the function call is * equivalent to _cx_lnode_delete(). */ inline static void _cx_lnode_destroy(cx_lnode *node, cx_free_func dealloc) { if (!node) return; if (dealloc && node->data) dealloc(node->data); cx_free(node); return; } /* * Check if the given list node follows another. */ inline static cxbool _cx_lnode_follows(const cx_list *list, const cx_lnode *head, const cx_lnode *node) { cx_lnode *n = head->next; while (n != &list->head) { if (n == node) return TRUE; n = n->next; } return FALSE; } /* * Check if the given list node is in a list or not. Note that according * to this function the head node is not part of the list! */ inline static cxbool _cx_lnode_exists(const cx_list *list, const cx_lnode *node) { return _cx_lnode_follows(list, &list->head, node); } /* * Initialize a newly created list object */ inline static void _cx_list_init(cx_list *list) { if (!list) return; list->head.next = &list->head; list->head.prev = &list->head; } /* * Get an iterator to the beginning of a list. */ inline static cx_list_iterator _cx_list_begin(const cx_list *list) { return list->head.next; } /* * Get an iterator to the end of a list. */ inline static cx_list_iterator _cx_list_end(const cx_list *list) { return &(((cx_list *)list)->head); } /* * Calculate the distance between two list nodes. */ inline static cxsize _cx_list_distance(const cx_lnode *first, const cx_lnode *last) { register cxsize sz = 0; register cx_lnode *node; for (node = (cx_lnode *)first; node != last; node = node->next) ++sz; return sz; } /* * Extract a single node at the given position. */ inline static cx_lnode * _cx_list_extract(cx_lnode *node) { cx_lnode *prev, *next; prev = node->prev; next = node->next; prev->next = next; next->prev = prev; return node; } /* * Insert a single node at the given position. */ inline static cx_lnode * _cx_list_insert(cx_lnode *position, cx_lnode *node) { node->next = position; node->prev = position->prev; position->prev->next = node; position->prev = node; return node; } /* * Move a range of list nodes in front of position. */ inline static void _cx_list_transfer(cx_lnode *position, cx_lnode *first, cx_lnode *last) { if (position != last) { cx_lnode *tmp; /* * Remove [first, last) from its old position. */ last->prev->next = position; first->prev->next = last; position->prev->next = first; /* * Splice [first, last) into its new position. */ tmp = position->prev; position->prev = last->prev; last->prev = first->prev; first->prev = tmp; } return; } /* * Check if a given list is sorted using the provided comparison function. * Returns 1 if the list is sorted, 0 otherwise. */ inline static cxbool _cx_list_sorted(cx_list *list, cx_compare_func compare) { cx_lnode *node = list->head.next; cx_lnode *next = node != NULL ? node->next : NULL; while (next != &list->head) { if (compare(_cx_lnode_get(node), _cx_lnode_get(next)) > 0) return 0; node = next; next = next->next; } return 1; } /* * Get the next element of a list, i.e. the element directly following the * current position in the list. * * Note that there are no checks whether the current list position actually * exists in the given list. */ inline static cx_list_iterator _cx_list_next(const cx_list *list, cx_list_const_iterator position) { if (position == _cx_list_end(list)) return _cx_list_end(list); return position->next; } /* * Get the previous element of a list, i.e. the element directly preceding * the current position in the list. * * Note that there are no checks whether the current list position actually * exists in the given list. */ inline static cx_list_iterator _cx_list_previous(const cx_list *list, cx_list_const_iterator position) { if (position == _cx_list_begin(list)) return _cx_list_end(list); return position->prev; } /* * Remove all elements from a list */ inline static void _cx_list_clear(cx_list *list) { cx_list_iterator l; if (!list) return; l = _cx_list_begin(list); while (l != _cx_list_end(list)) { cx_lnode *node = l; l = _cx_list_next(list, l); _cx_lnode_delete(_cx_list_extract(node)); } _cx_list_init(list); return; } /* * Check whether a list is empty. */ inline static cxbool _cx_list_empty(const cx_list *list) { return (list->head.next == &list->head); } /* * Compute the size of a list as the distance between the first and the * sentinel element. */ inline static cxsize _cx_list_size(const cx_list *list) { return _cx_list_distance(_cx_list_begin(list), _cx_list_end(list)); } /* * Merge two sorted lists keeping the sorting order with respect to the * given comparison function. */ inline static void _cx_list_merge(cx_list *list1, cx_list *list2, cx_compare_func compare) { if (list1 != list2) { cx_lnode *first1, *last1; cx_lnode *first2, *last2; cx_assert(_cx_list_size(list1) + _cx_list_size(list2) >= _cx_list_size(list1)); cx_assert(_cx_list_sorted(list1, compare)); cx_assert(_cx_list_sorted(list2, compare)); first1 = _cx_list_begin(list1); last1 = _cx_list_end(list1); first2 = _cx_list_begin(list2); last2 = _cx_list_end(list2); while (first1 != last1 && first2 != last2) if (compare(_cx_lnode_get(first2), _cx_lnode_get(first1)) < 0) { cx_lnode *next = _cx_list_next(list2, first2); _cx_list_transfer(first1, first2, next); first2 = next; } else first1 = _cx_list_next(list1, first1); if (first2 != last2) _cx_list_transfer(last1, first2, last2); } return; } /* * Sort the elements of a list with respect to the given comparison function. */ inline static void _cx_list_sort(cx_list *list, cx_compare_func compare) { if (_cx_list_size(list) > 1 && !_cx_list_sorted(list, compare)) { cx_list tmp; cx_lnode *node; cxsize middle = _cx_list_size(list) / 2; _cx_list_init(&tmp); node = _cx_list_begin(list); while (middle--) node = _cx_list_next(list, node); _cx_list_transfer(_cx_list_begin(&tmp), node, _cx_list_end(list)); _cx_list_sort(list, compare); _cx_list_sort(&tmp, compare); _cx_list_merge(list, &tmp, compare); } return; } /** * @brief * Get an iterator for the first list element. * * @param list A list. * * @return Iterator for the first element in the list or @b cx_list_end() * if the list is empty. * * The function returns a handle to the first element of @em list. The * handle cannot be used directly to access the element data, but only * through the appropriate functions. */ cx_list_iterator cx_list_begin(const cx_list *list) { cx_assert(list != NULL); return _cx_list_begin(list); } /** * @brief * Get an iterator for the position after the last list element. * * @param list A list. * * @return Iterator for the end of the list. * * The function returns an iterator for the position one past the last * element of the list @em list. The handle cannot be used to directly * access the element data, but only through the appropriate functions. */ cx_list_iterator cx_list_end(const cx_list *list) { cx_assert(list != NULL); return _cx_list_end(list); } /** * @brief * Get an iterator for the next list element. * * @param list A list. * @param position Current iterator position. * * @return Iterator for the next list element. * * The function returns an iterator for the next element in the list * @em list with respect to the current iterator position @em position. * If the list @em list is empty or @em position points to the list end * the function returns @b cx_list_end(). */ cx_list_iterator cx_list_next(const cx_list *list, cx_list_const_iterator position) { cx_assert(list != NULL); cx_assert(position == _cx_list_end(list) || _cx_lnode_exists(list, position)); return _cx_list_next(list, position); } /** * @brief * Get an iterator for the previous list element. * * @param list A list. * @param position Current iterator position. * * @return Iterator for the previous list element. * * The function returns an iterator for the previous element in the list * @em list with respect to the current iterator position @em position. * If the list @em list is empty or @em position points to the beginning * of the list the function returns @b cx_list_end(). */ cx_list_iterator cx_list_previous(const cx_list *list, cx_list_const_iterator position) { cx_assert(list != NULL); cx_assert(position == _cx_list_end(list) || _cx_lnode_exists(list, position)); return _cx_list_previous(list, position); } /** * @brief * Remove all elements from a list. * * @param list List to be cleared. * * @return Nothing. * * The list @em list is cleared, i.e. all elements are removed from the list. * The removed data objects are left untouched, in particular they are not * deallocated. It is the responsibility of the caller to ensure that there * are still other references to the removed data objects. After calling * @b cx_list_clear() the list @em list is empty. */ void cx_list_clear(cx_list *list) { _cx_list_clear(list); return; } /** * @brief * Check whether a list is empty. * * @param list A list. * * @return The function returns @c TRUE if the list is empty, and @c FALSE * otherwise. * * The function tests if the list @em list contains data. A call to this * function is equivalent to the statement: * * @code * return (cx_list_size(list) == 0); * @endcode */ cxbool cx_list_empty(const cx_list *list) { cx_assert(list != NULL); return _cx_list_empty(list); } /** * @brief * Create a new list without any elements. * * @return Handle to the newly allocated list. * * The function allocates memory for the list object and initializes * it to a empty list. */ cx_list * cx_list_new(void) { cx_list *list = cx_malloc(sizeof *list); _cx_list_init(list); return list; } /** * @brief * Destroy a list. * * @param list The list to delete. * * @return Nothing. * * The function deallocates the list object, but not the data objects * currently stored in the list. */ void cx_list_delete(cx_list *list) { _cx_list_clear(list); cx_assert(cx_list_empty(list)); cx_free(list); return; } /** * @brief * Destroy a list and all its elements. * * @param list List container to destroy. * @param deallocate Data deallocator. * * @return Nothing. * * The function deallocates all data objects referenced by the list using * the data deallocation function @em deallocate and finally deallocates * the list itself. */ void cx_list_destroy(cx_list *list, cx_free_func deallocate) { cx_list_iterator l; if (!list) return; cx_assert(deallocate != NULL); l = _cx_list_begin(list); while (l != _cx_list_end(list)) { cx_lnode *node = l; l = _cx_list_next(list, l); _cx_lnode_destroy(_cx_list_extract(node), deallocate); } cx_assert(cx_list_empty(list)); cx_free(list); return; } /** * @brief * Get the actual number of list elements. * * @param list A list. * * @return The current number of elements the list contains, or 0 if the * list is empty. * * Retrieves the number of elements currently stored in the list @em list. */ cxsize cx_list_size(const cx_list *list) { cx_assert(list != NULL); return _cx_list_size(list); } /** * @brief * Get the maximum number of list elements possible. * * @param list A list. * * @return The maximum number of elements that can be stored in the list. * * Retrieves the lists capacity, i.e. the maximum possible number of data * items a list can hold. */ cxsize cx_list_max_size(const cx_list *list) { (void) list; /* Prevent warnings if cx_assert is disabled. */ cx_assert(list != NULL); return (cxsize)(-1); } /** * @brief * Swap the data of two lists. * * @param list1 First list. * @param list2 Second list. * * @return Nothing. * * The contents of the first list @em list1 will be moved to the second * list @em list2, while the contents of @em list2 is moved to @em list1. */ void cx_list_swap(cx_list *list1, cx_list *list2) { cx_lnode *tmp; tmp = list1->head.next; list1->head.next = list2->head.next; list1->head.next->prev = &list1->head; list2->head.next = tmp; list2->head.next->prev = &list2->head; tmp = list1->head.prev; list1->head.prev = list2->head.prev; list1->head.prev->next = &list1->head; list2->head.prev = tmp; list2->head.prev->next = &list2->head; return; } /** * @brief * Assign data to a list element. * * @param list A list. * @param position List position where the data will be stored * @param data Data to store. * * @return Handle to the previously stored data object. * * The function assigns the data object reference @em data * to the iterator position @em position of the list @em list. */ cxptr cx_list_assign(cx_list *list, cx_list_iterator position, cxcptr data) { cxptr tmp; (void) list; /* Prevent warnings if cx_assert is disabled. */ cx_assert(list != NULL); cx_assert(_cx_lnode_exists(list, position)); tmp = _cx_lnode_get(position); _cx_lnode_put(position, data); return tmp; } /** * @brief * Get the first element of a list. * * @param list The list to query. * * @return Handle to the data object stored in the first list element. * * The function returns a reference to the first data item in the list * @em list. * * Calling this function with an empty list is an invalid operation, and * the result is undefined. */ cxptr cx_list_front(const cx_list *list) { cx_assert(list != NULL); cx_assert(!cx_list_empty(list)); return _cx_lnode_get(_cx_list_begin(list)); } /** * @brief * Get the last element of a list. * * @param list The list to query. * * @return Handle to the data object stored in the last list element. * * The function returns a reference to the last data item in the list * @em list. * * Calling this function with an empty list is an invalid operation, and * the result is undefined. * */ cxptr cx_list_back(const cx_list *list) { cx_assert(list != NULL); cx_assert(!cx_list_empty(list)); return _cx_lnode_get(_cx_list_previous(list, _cx_list_end(list))); } /** * @brief * Get the data at a given iterator position. * * @param list A list. * @param position List position the data is retrieved from. * * @return Handle to the data object. * * The function returns a reference to the data item stored in the list * @em list at the iterator position @em position. */ cxptr cx_list_get(const cx_list *list, cx_list_const_iterator position) { (void) list; /* Prevent warnings if cx_assert is disabled. */ cx_assert(list != NULL); cx_assert(_cx_lnode_exists(list, position)); return _cx_lnode_get(position); } /** * @brief * Insert data into a list at a given iterator position. * * @param list The list to update. * @param position List iterator position. * @param data Data item to insert. * * @return List iterator position of the inserted data item. * * The function inserts the data object reference @em data into the list * @em list at the list position given by the list iterator @em position. */ cx_list_iterator cx_list_insert(cx_list *list, cx_list_iterator position, cxcptr data) { cx_lnode *node; (void) list; /* Prevent warnings if cx_assert is disabled. */ cx_assert(list != NULL); cx_assert(position == _cx_list_end(list) || _cx_lnode_exists(list, position)); cx_assert(_cx_list_size(list) + 1 > _cx_list_size(list)); node = _cx_list_insert(position, _cx_lnode_create(data)); cx_assert(_cx_list_size(list) <= cx_list_max_size(list)); return node; } /** * @brief * Insert data at the beginning of a list. * * @param list The list to update. * @param data Data to add to the list. * * @return Nothing. * * The data @em data is inserted into the list @em list before the first * element of the list, so that it becomes the new list head. * * It is equivalent to the statement * @code * cx_list_insert(list, cx_list_begin(list), data); * @endcode */ void cx_list_push_front(cx_list *list, cxcptr data) { cx_assert(list != NULL); _cx_list_insert(_cx_list_begin(list), _cx_lnode_create(data)); return; } /** * @brief * Append data at the end of a list. * * @param list The list to update. * @param data Data to append. * * @return Nothing. * * The data @em data is inserted into the list @em list after the last * element, so that it becomes the new list tail. * * It is equivalent to the statement * @code * cx_list_insert(list, cx_list_end(list), data); * @endcode */ void cx_list_push_back(cx_list *list, cxcptr data) { cx_assert(list != NULL); _cx_list_insert(_cx_list_end(list), _cx_lnode_create(data)); return; } /** * @brief * Erase a list element. * * @param list The list to update. * @param position List iterator position. * @param deallocate Data deallocator. * * @return The iterator for the list position after @em position. * * The function removes the data object stored at position @em position * from the list @em list. The data object itself is deallocated by calling * the data deallocator @em deallocate. */ cx_list_iterator cx_list_erase(cx_list *list, cx_list_iterator position, cx_free_func deallocate) { cx_lnode *next; cx_assert(list != NULL); cx_assert(deallocate != NULL); cx_assert(_cx_lnode_exists(list, position)); next = _cx_list_next(list, position); _cx_lnode_destroy(_cx_list_extract(position), deallocate); return next; } /** * @brief * Extract a list element. * * @param list A list. * @param position List iterator position. * * @return Handle to the previously stored data object. * * The function removes a data object from the list @em list located at the * iterator position @em position without destroying the data object. * * @see cx_list_erase(), cx_list_remove() */ cxptr cx_list_extract(cx_list *list, cx_list_iterator position) { (void) list; /* Prevent warnings if cx_assert is disabled. */ cx_assert(list != NULL); cx_assert(_cx_lnode_exists(list, position)); _cx_list_extract(position); return _cx_lnode_delete(position); } /** * @brief * Remove the first list element. * * @param list The list to update. * * @return Handle to the data object previously stored as the first * list element. * * The function removes the first element from the list @em list returning * a handle to the previously stored data. * * It is equivalent to the statement * @code * cx_list_extract(list, cx_list_begin(list)); * @endcode * * Calling this function with an empty list is an invalid operation, and * the result is undefined. */ cxptr cx_list_pop_front(cx_list *list) { cx_assert(!cx_list_empty(list)); return _cx_lnode_delete(_cx_list_extract(cx_list_begin(list))); } /** * @brief * Remove the last element of a list. * * @param list The list to update. * * @return Handle to the data object previously stored as the last * list element. * * The function removes the last element from the list @em list returning * a handle to the previously stored data. * * It is equivalent to the statement * @code * cx_list_extract(list, cx_list_previous(list, cx_list_end(list))); * @endcode * * Calling this function with an empty list is an invalid operation, and * the result is undefined. */ cxptr cx_list_pop_back(cx_list *list) { cx_lnode *position = NULL; cx_assert(!cx_list_empty(list)); position = _cx_list_previous(list, cx_list_end(list)); return _cx_lnode_delete(_cx_list_extract(position)); } /** * @brief * Remove all elements with a given value from a list. * * @param list A list object. * @param data Data to remove. * * @return Nothing. * * The value @em data is searched in the list @em list. If the data is * found it is removed from the list. The data object itself is not * deallocated. */ void cx_list_remove(cx_list *list, cxcptr data) { cx_lnode *first, *last; first = cx_list_begin(list); last = _cx_list_end(list); while (first != last) { cx_lnode *next = _cx_list_next(list, first); if (_cx_lnode_get(first) == data) { _cx_list_extract(first); _cx_lnode_delete(first); } first = next; } return; } /** * @brief * Remove duplicates of consecutive elements. * * @param list A list. * @param compare Function comparing the list elements. * * @return Nothing. * * The function removes duplicates of consecutive list elements, i.e. list * elements with the same value, from the list @em list. The equality of * the list elements is checked using the comparison function @em compare. * The comparison function @em compare must return an integer less than, * equal or greater than zero if the first argument passed to it is found, * respectively, to be less than, match, or be greater than the second * argument. */ void cx_list_unique(cx_list *list, cx_compare_func compare) { cx_lnode *first, *last, *next; cx_assert(list != NULL); cx_assert(compare != NULL); if (cx_list_empty(list)) return; first = _cx_list_begin(list); last = _cx_list_end(list); next = _cx_list_next(list, first); while (next != last) { if (compare(_cx_lnode_get(first), _cx_lnode_get(next)) == 0) { _cx_list_extract(next); _cx_lnode_delete(next); } else first = next; next = _cx_list_next(list, first); } return; } /** * @brief * Move a range of list elements in front of a given position. * * @param tlist Target list. * @param position Target iterator position. * @param slist Source list. * @param first Position of the first element to move. * @param last Position of the last element to move. * * @return Nothing. * * The range of list elements from the iterator position @em first to * @em last, but not including @em last, is moved from the source list * @em slist in front of the position @em position of the target list * @em tlist. Target and source list may be identical, provided that the * target position @em position does not fall within the range of list * elements to move. */ void cx_list_splice(cx_list *tlist, cx_list_iterator position, cx_list *slist, cx_list_iterator first, cx_list_iterator last) { (void)slist; (void)tlist; /* Prevent warnings if cx_assert is disabled. */ cx_assert(slist != NULL); cx_assert(first == _cx_list_end(slist) || _cx_lnode_exists(slist, first)); cx_assert(last == _cx_list_end(slist) || _cx_lnode_follows(slist, first, last)); if (first != last) { cx_assert(tlist != NULL); cx_assert(position == _cx_list_end(tlist) || _cx_lnode_exists(tlist, position)); cx_assert(slist != tlist || (_cx_lnode_follows(slist, position, first) || _cx_lnode_follows(slist, last, position))); _cx_list_transfer(position, first, last); } return; } /** * @brief * Merge two sorted lists. * * @param list1 First list to merge. * @param list2 Second list to merge. * @param compare Function comparing the list elements. * * @return Nothing. * * The function combines the two lists @em list1 and @em list2 by moving all * elements from @em list2 into @em list1, so that all elements are still * sorted. The function requires that both input lists are already sorted. * The sorting order in which the elements of @em list2 are inserted * into @em list1 is determined by the comparison function @em compare. * The comparison function @em compare must return an integer less than, equal * or greater than zero if the first argument passed to it is found, * respectively, to be less than, match, or be greater than the second * argument. * * The list @em list2 is consumed by this process, i.e. after the successful * merging of the two lists, list @em list2 will be empty. */ void cx_list_merge(cx_list *list1, cx_list *list2, cx_compare_func compare) { cx_assert(list1 != NULL); cx_assert(list2 != NULL); cx_assert(compare != NULL); _cx_list_merge(list1, list2, compare); return; } /** * @brief * Sort all elements of a list using the given comparison function. * * @param list The list to sort. * @param compare Function comparing the list elements. * * @return Nothing. * * The input list @em list is sorted using the comparison function * @em compare to determine the order of two list elements. The comparison * function @em compare must return an integer less than, equal * or greater than zero if the first argument passed to it is found, * respectively, to be less than, match, or be greater than the second * argument. */ void cx_list_sort(cx_list *list, cx_compare_func compare) { cx_assert(list != NULL); cx_assert(compare != NULL); _cx_list_sort(list, compare); return; } /** * @brief * Reverse the order of all list elements. * * @param list The list to reverse. * * @return Nothing. * * The order of the elements of the list @em list is reversed. */ void cx_list_reverse(cx_list *list) { cx_assert(list != NULL); /* * Nothing to be done if the list has length 0 or 1 */ if (list->head.next != &list->head && list->head.next->next != &list->head) { cx_lnode *first = _cx_list_begin(list); first = _cx_list_next(list, first); while (first != _cx_list_end(list)) { cx_lnode *old = first; first = _cx_list_next(list, first); _cx_list_transfer(_cx_list_begin(list), old, first); } } return; } /**@}*/ cpl-6.4.1/libcext/cext/cxtree.h0000644000460300003120000000746711530471603013270 00000000000000/* $Id: cxtree.h,v 1.5 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.5 $ * $Name: not supported by cvs2svn $ */ #ifndef CX_TREE_H #define CX_TREE_H #include CX_BEGIN_DECLS typedef struct _cx_tnode_ *cx_tree_iterator; typedef const struct _cx_tnode_ *cx_tree_const_iterator; typedef struct _cx_tree_ cx_tree; /** * @ingroup cxtree * * @brief * The tree's key comparison operator function. * * This type of function is used by a tree internally to compare the * keys of its elements. A key comparison operator returns @c TRUE * if the comparison of its first argument with the second argument * succeeds, and @c FALSE otherwise, as, for instance, the logical * operators < or > do. * * Examples: * - A less than operator for integer values * @code * #include * * cxbool less_int(cxcptr i1, cxcptr i2) * { * return *i1 < *i2; * } * @endcode * * - A less than operator for strings * @code * #include * #include * * cxbool less_string(cxcptr s1, cxcptr s2) * { * return strcmp(s1, s2) < 0; * } * @endcode */ typedef cxbool (*cx_tree_compare_func)(cxcptr, cxcptr); /* * Create, copy and destroy operations */ cx_tree *cx_tree_new(cx_tree_compare_func, cx_free_func, cx_free_func); void cx_tree_delete(cx_tree *); /* * Nonmodifying operations */ cxsize cx_tree_size(const cx_tree *); cxbool cx_tree_empty(const cx_tree *); cxsize cx_tree_max_size(const cx_tree *); cx_tree_compare_func cx_tree_key_comp(const cx_tree *); /* * Special search operations */ cxsize cx_tree_count(const cx_tree *, cxcptr); cx_tree_iterator cx_tree_find(const cx_tree *, cxcptr); cx_tree_iterator cx_tree_lower_bound(const cx_tree *, cxcptr); cx_tree_iterator cx_tree_upper_bound(const cx_tree *, cxcptr); void cx_tree_equal_range(const cx_tree *, cxcptr, cx_tree_iterator *, cx_tree_iterator *); /* * Assignment operations */ void cx_tree_swap(cx_tree *, cx_tree *); cxptr cx_tree_assign(cx_tree *, cx_tree_iterator, cxcptr); /* * Element access */ cxptr cx_tree_get_key(const cx_tree *, cx_tree_const_iterator); cxptr cx_tree_get_value(const cx_tree *, cx_tree_const_iterator); /* * Iterator functions */ cx_tree_iterator cx_tree_begin(const cx_tree *); cx_tree_iterator cx_tree_end(const cx_tree *); cx_tree_iterator cx_tree_next(const cx_tree *, cx_tree_const_iterator); cx_tree_iterator cx_tree_previous(const cx_tree *, cx_tree_const_iterator); /* * Inserting and removing elements */ cx_tree_iterator cx_tree_insert_unique(cx_tree *, cxcptr, cxcptr); cx_tree_iterator cx_tree_insert_equal(cx_tree *, cxcptr, cxcptr); void cx_tree_erase_position(cx_tree *, cx_tree_iterator); void cx_tree_erase_range(cx_tree *, cx_tree_iterator, cx_tree_iterator); cxsize cx_tree_erase(cx_tree *, cxcptr); void cx_tree_clear(cx_tree *); /* * Debugging */ cxbool cx_tree_verify(const cx_tree *); CX_END_DECLS #endif /* CX_TREE_H */ cpl-6.4.1/libcext/cext/cxstring.h0000644000460300003120000000606411530471603013627 00000000000000/* $Id: cxstring.h,v 1.8 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.8 $ * $Name: not supported by cvs2svn $ */ #ifndef CX_STRING_H_ #define CX_STRING_H_ 1 #include #include #include #include #include #include #include CX_BEGIN_DECLS struct _cx_string_ { /* */ cxchar *data; cxsize sz; }; /** * @ingroup cxstring * * @brief * The cx_string data type. */ typedef struct _cx_string_ cx_string; /* * Create, copy and destroy operations */ cx_string *cx_string_new(void); cx_string *cx_string_copy(const cx_string *); cx_string *cx_string_create(const cxchar *); void cx_string_delete(cx_string *); /* * Non modifying operations */ cxsize cx_string_size(const cx_string *); cxbool cx_string_empty(const cx_string *); /* * Data access */ const cxchar *cx_string_get(const cx_string *); /* * Assignment operations */ void cx_string_set(cx_string *, const cxchar *); /* * Modifying operations */ cx_string *cx_string_upper(cx_string *); cx_string *cx_string_lower(cx_string *); cx_string *cx_string_trim(cx_string *); cx_string *cx_string_rtrim(cx_string *); cx_string *cx_string_strip(cx_string *); /* * Inserting and removing elements */ cx_string *cx_string_prepend(cx_string *, const cxchar *); cx_string *cx_string_append(cx_string *, const cxchar *); cx_string *cx_string_insert(cx_string *, cxssize, const cxchar *); cx_string *cx_string_erase(cx_string *, cxssize, cxssize); cx_string *cx_string_truncate(cx_string *, cxsize); /* * Comparison functions */ cxbool cx_string_equal (const cx_string *, const cx_string *); cxint cx_string_compare(const cx_string *, const cx_string *); cxint cx_string_casecmp(const cx_string *, const cx_string *); cxint cx_string_ncasecmp(const cx_string *, const cx_string *, cxsize); /* * I/O functions */ cxint cx_string_sprintf(cx_string *, const cxchar *, ...) CX_GNUC_PRINTF(2, 3); cxint cx_string_vsprintf(cx_string *, const cxchar *, va_list) CX_GNUC_PRINTF(2, 0); /* * Debugging utilities */ void cx_string_print(const cx_string *); CX_END_DECLS #endif /* CX_STRING_H */ cpl-6.4.1/libcext/cext/cxmemory.h0000644000460300003120000000313311530471603013623 00000000000000/* $Id: cxmemory.h,v 1.5 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.5 $ * $Name: not supported by cvs2svn $ */ #ifndef CX_MEMORY_H #define CX_MEMORY_H #include CX_BEGIN_DECLS struct _cx_memory_vtable_ { cxptr (*malloc) (cxsize); cxptr (*calloc) (cxsize, cxsize); cxptr (*realloc) (cxptr, cxsize); void (*free) (cxptr); }; typedef struct _cx_memory_vtable_ cx_memory_vtable; /* * Memory allocation functions */ void cx_memory_vtable_set(const cx_memory_vtable *); cxbool cx_memory_is_system_malloc(void); cxptr cx_malloc(cxsize); cxptr cx_malloc_clear(cxsize); cxptr cx_calloc(cxsize, cxsize); cxptr cx_realloc(cxptr, cxsize); void cx_free(cxptr); CX_END_DECLS #endif /* CX_MEMORY_H */ cpl-6.4.1/libcext/cext/cxtypes.h0000644000460300003120000000576712013447025013474 00000000000000/* $Id: cxtypes.h,v 1.4 2012-08-17 13:58:45 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _CX_TYPES_H #define _CX_TYPES_H #include #include CX_BEGIN_DECLS /* * Some mathematical constants. Some strict ISO C implementations * don't provide them as symbols. The constants provide enough * digits for the 128 bit IEEE quad */ #define CX_E 2.7182818284590452353602874713526625L #define CX_LN2 0.6931471805599453094172321214581766L #define CX_LN10 2.3025850929940456840179914546843642L #define CX_PI 3.1415926535897932384626433832795029L #define CX_PI_2 1.5707963267948966192313216916397514L #define CX_PI_4 0.7853981633974483096156608458198757L #define CX_SQRT2 1.4142135623730950488016887242096981L /* * Minimum and maximum constants for fixed size integer types */ #define CX_MININT8 ((cxint8) 0x80) #define CX_MAXINT8 ((cxint8) 0x7f) #define CX_MAXUINT8 ((cxuint8) 0xff) #define CX_MININT16 ((cxint16) 0x8000) #define CX_MAXINT16 ((cxint16) 0x7fff) #define CX_MAXUINT16 ((cxuint16) 0xffff) #define CX_MININT32 ((cxint32) 0x80000000) #define CX_MAXINT32 ((cxint32) 0x7fffffff) #define CX_MAXUINT32 ((cxuint32) 0xffffffff) #define CX_MININT64 ((cxint64) CX_INT64_CONSTANT(0x8000000000000000)) #define CX_MAXINT64 CX_INT64_CONSTANT(0x7fffffffffffffff) #define CX_MAXUINT64 CX_INT64_CONSTANT(0xffffffffffffffffU) /* * For completeness: Definitions for standard types */ typedef char cxchar; typedef short cxshort; typedef int cxint; typedef long cxlong; typedef long long cxllong; typedef cxint cxbool; typedef unsigned char cxuchar; typedef unsigned short cxushort; typedef unsigned int cxuint; typedef unsigned long cxulong; typedef unsigned long long cxullong; typedef cxuchar cxbyte; typedef float cxfloat; typedef double cxdouble; typedef void * cxptr; typedef const void * cxcptr; /* * Generic, frequently used types. */ typedef cxint (*cx_compare_func) (cxcptr a, cxcptr b); typedef cxint (*cx_compare_data_func) (cxcptr a, cxcptr b, cxptr data); typedef cxbool (*cx_equal_func) (cxcptr a, cxcptr b); typedef void (*cx_free_func) (cxptr data); CX_END_DECLS #endif /* _CX_TYPES_H */ cpl-6.4.1/libcext/cext/cxfileutils.h0000644000460300003120000000230111530471603014307 00000000000000/* $Id: cxfileutils.h,v 1.4 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.4 $ * $Name: not supported by cvs2svn $ */ #ifndef CX_FILEUTILS_H #define CX_FILEUTILS_H #include CX_BEGIN_DECLS cxlong cx_path_max(const cxchar *); cxchar *cx_path_alloc(const cxchar *); CX_END_DECLS #endif /* CX_FILEUTILS_H */ cpl-6.4.1/libcext/cext/cxlist.h0000644000460300003120000000560311530471603013272 00000000000000/* $Id: cxlist.h,v 1.4 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.4 $ * $Name: not supported by cvs2svn $ */ #ifndef CX_LIST_H #define CX_LIST_H #include CX_BEGIN_DECLS typedef struct _cx_lnode_ *cx_list_iterator; typedef const struct _cx_lnode_ *cx_list_const_iterator; typedef struct _cx_list_ cx_list; /* * Create, copy and destroy operations */ cx_list *cx_list_new(void); void cx_list_delete(cx_list *); void cx_list_destroy(cx_list *, cx_free_func); /* * Non-modifying operations */ cxsize cx_list_size(const cx_list *); cxbool cx_list_empty(const cx_list *); cxsize cx_list_max_size(const cx_list *); /* * Assignment operations */ void cx_list_swap(cx_list *, cx_list *); cxptr cx_list_assign(cx_list *, cx_list_iterator, cxcptr); /* * Element access */ cxptr cx_list_front(const cx_list *); cxptr cx_list_back(const cx_list *); cxptr cx_list_get(const cx_list *, cx_list_const_iterator); /* * Iterator functions */ cx_list_iterator cx_list_begin(const cx_list *); cx_list_iterator cx_list_end(const cx_list *); cx_list_iterator cx_list_next(const cx_list *, cx_list_const_iterator); cx_list_iterator cx_list_previous(const cx_list *, cx_list_const_iterator); /* * Inserting and removing elements */ void cx_list_push_front(cx_list *, cxcptr); cxptr cx_list_pop_front(cx_list *); void cx_list_push_back(cx_list *, cxcptr); cxptr cx_list_pop_back(cx_list *); cx_list_iterator cx_list_insert(cx_list *, cx_list_iterator, cxcptr); cx_list_iterator cx_list_erase(cx_list *, cx_list_iterator, cx_free_func); cxptr cx_list_extract(cx_list *, cx_list_iterator); void cx_list_remove(cx_list *, cxcptr); void cx_list_clear(cx_list *); /* * Splice functions */ void cx_list_unique(cx_list *, cx_compare_func); void cx_list_splice(cx_list *, cx_list_iterator, cx_list *, cx_list_iterator, cx_list_iterator); void cx_list_merge(cx_list *, cx_list *, cx_compare_func); void cx_list_sort(cx_list *, cx_compare_func); void cx_list_reverse(cx_list *); CX_END_DECLS #endif /* CX_LIST_H */ cpl-6.4.1/libcext/cext/Makefile.am0000644000460300003120000000363312105141313013637 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO C Extension Library ## Copyright (C) 2001-2011 European Southern Observatory ## 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ cxconfig-stamp cxconfig.h if MAINTAINER_MODE MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(BUILT_SOURCES) endif AM_CPPFLAGS = -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=500 \ $(CEXT_INCLUDES) @CX_DEBUG_FLAGS@ BUILT_SOURCES = cxconfig-stamp include_HEADERS = cxdeque.h cxfileutils.h cxlist.h cxmap.h \ cxmacros.h cxmemory.h cxmessages.h cxmultimap.h cxslist.h \ cxstrutils.h cxtree.h cxutils.h cxstring.h cxtypes.h noinst_HEADERS = cxthread.h nodist_config_HEADERS = cxconfig.h lib_LTLIBRARIES = libcext.la libcext_la_SOURCES = cxfileutils.c cxlist.c cxmap.c cxmemory.c \ cxmessages.c cxmultimap.c cxslist.c cxstring.c cxstrutils.c cxtree.c \ cxutils.c cxdeque.c EXTRA_libcext_la_SOURCES = snprintf.h snprintf.c libcext_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libcext_la_LIBADD = @SNPRINTF@ libcext_la_DEPENDENCIES = @SNPRINTF@ cxconfig-stamp: $(top_builddir)/config.status $(AM_V_GEN) cd $(top_builddir) && $(SHELL) ./config.status cxconfig.h @touch cxconfig-stamp cpl-6.4.1/libcext/cext/cxthread.h0000644000460300003120000001321412105137753013567 00000000000000/* $Id$ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author$ * $Date$ * $Revision$ * $Name$ */ #ifndef CXTHREAD_H_ #define CXTHREAD_H_ #if HAVE_CONFIG_H # include "config.h" #endif #ifdef HAVE_PTHREAD_H # include #endif #include /* * Map local types and functions to the POSIX thread model implementation */ #if defined(CX_THREADS_ENABLED) #if defined(HAVE_PTHREAD_H) #define CX_STATIC_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER #define CX_STATIC_ONCE_INIT PTHREAD_ONCE_INIT #define CX_MUTEX_TYPE_DEFAULT PTHREAD_MUTEX_DEFAULT #define CX_MUTEX_TYPE_NORMAL PTHREAD_MUTEX_NORMAL #define CX_MUTEX_TYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE typedef pthread_mutex_t cx_mutex; typedef pthread_once_t cx_once; typedef pthread_key_t cx_private; #define cx_mutex_init(mutex, type) \ do { \ pthread_mutexattr_t attr; \ \ pthread_mutexattr_init(&attr); \ pthread_mutexattr_settype(&attr, (type)); \ \ pthread_mutex_init(mutex, &attr); \ \ pthread_mutexattr_destroy(&attr); \ } \ while (0) #define cx_mutex_lock(mutex) pthread_mutex_lock((mutex)) #define cx_mutex_trylock(mutex) pthread_mutex_trylock((mutex)) #define cx_mutex_unlock(mutex) pthread_mutex_unlock((mutex)) #define cx_thread_once(name, func, args) pthread_once(&(name), (func)) #define cx_private_init(name, func) pthread_key_create(&(name), (func)) #define cx_private_set(name, data) pthread_setspecific((name), (data)) #define cx_private_get(name) pthread_getspecific((name)) #else /* !HAVE_PTHREAD_H */ # error "Thread support is requested, but POSIX thread model is not present!" #endif /* !HAVE_PTHREAD_H */ #else /* !CX_THREADS_ENABLED */ typedef struct cx_private cx_private; #define cx_mutex_init(mutex, type) /* empty */ #define cx_mutex_lock(mutex) /* empty */ #define cx_mutex_trylock(mutex) /* empty */ #define cx_mutex_unlock(mutex) /* empty */ #define cx_thread_once(name, func, args) (func)() #define cx_private_init(name, func) /* empty */ #define cx_private_set(name, data) ((name) = (data)) #define cx_private_get(name) (name) #endif /* !CX_THREADS_ENABLED */ /* * Convenience macros to setup locks for global variables. * These macros expand to nothing, if thread support was not enabled. */ #define CX_LOCK_NAME(name) _cx__ ## name ## _lock #if defined(CX_THREADS_ENABLED) # define CX_LOCK_DEFINE_STATIC(name) static CX_LOCK_DEFINE(name) # define CX_LOCK_DEFINE(name) cx_mutex CX_LOCK_NAME(name) # define CX_LOCK_EXTERN(name) extern cx_mutex CX_LOCK_NAME(name) # define CX_LOCK_DEFINE_INITIALIZED_STATIC(name) \ static CX_LOCK_DEFINE_INITIALIZED(name) # define CX_LOCK_DEFINE_INITIALIZED(name) \ CX_LOCK_DEFINE(name) = CX_STATIC_MUTEX_INIT # define CX_INITLOCK(name, type) cx_mutex_init(&CX_LOCK_NAME(name), (type)) # define CX_LOCK(name) cx_mutex_lock(&CX_LOCK_NAME(name)) # define CX_TRYLOCK(name) cx_mutex_trylock(&CX_LOCK_NAME(name)) # define CX_UNLOCK(name) cx_mutex_unlock(&CX_LOCK_NAME(name)) #else /* !CX_THREADS_ENABLED */ # define CX_LOCK_DEFINE_STATIC(name) /* empty */ # define CX_LOCK_DEFINE(name) /* empty */ # define CX_LOCK_EXTERN(name) /* empty */ # define CX_LOCK_DEFINE_INITIALIZED_STATIC(name) /* empty */ # define CX_LOCK_DEFINE_INITIALIZED(name) /* empty */ # define CX_INITLOCK(name, type) /* empty */ # define CX_LOCK(name) /* empty */ # define CX_TRYLOCK(name) (TRUE) # define CX_UNLOCK(name) /* empty */ #endif /* !CX_THREADS_ENABLED */ /* * Convenience macros for setting up mutexes for one time initalizations */ #if defined(CX_THREADS_ENABLED) # define CX_ONCE_DEFINE_STATIC(name) static CX_ONCE_DEFINE(name) # define CX_ONCE_DEFINE(name) cx_once (name) # define CX_ONCE_DEFINE_INITIALIZED_STATIC(name) \ static CX_ONCE_DEFINE_INITIALIZED(name) # define CX_ONCE_DEFINE_INITIALIZED(name) \ cx_once (name) = CX_STATIC_ONCE_INIT #else /* !CX_THREADS_ENABLED */ # define CX_ONCE_DEFINE_STATIC(name) /* empty */ # define CX_ONCE_DEFINE(name) /* empty */ # define CX_ONCE_DEFINE_INITIALIZED_STATIC(name) /* empty */ # define CX_ONCE_DEFINE_INITIALIZED(name) /* empty */ #endif /* !CX_THREADS_ENABLED */ /* * Convenience macros for setting up thread-specific data */ #if defined(CX_THREADS_ENABLED) # define CX_PRIVATE_DEFINE_STATIC(name) cx_private (name) #else /* !CX_THREADS_ENABLED */ # define CX_PRIVATE_DEFINE_STATIC(name) static cx_private *(name) #endif /* !CX_THREADS_ENABLED */ #endif /* CXTHREAD_H_ */ cpl-6.4.1/libcext/cext/cxutils.c0000644000460300003120000003264712243415467013472 00000000000000/* $Id: cxutils.c,v 1.16 2013-02-08 09:07:13 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-02-08 09:07:13 $ * $Revision: 1.16 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #if defined(HAVE_VSNPRINTF_C99) || defined(HAVE_VASPRINTF) # include #endif #ifdef HAVE_VASPRINTF # include #endif #if ! defined(HAVE_VA_COPY_STYLE_FUNCTION) && ! defined(HAVE_VA_LIST_COPY_BY_VALUE) # include #endif #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_LIMITS_H # include #endif #include #include "cxthread.h" #include "cxmemory.h" #include "cxmessages.h" #include "cxstrutils.h" #include "cxutils.h" #ifndef HAVE_VSNPRINTF_C99 # include "snprintf.h" #endif #ifndef HAVE_VA_COPY_STYLE_FUNCTION # if defined(__GNUC__) && defined(__PPC__) && defined(_CALL_SYSV) # define CX_VA_COPY(ap1, ap2) (*(ap1) = *(ap2)) # elif !defined(HAVE_VA_LIST_COPY_BY_VALUE) # define CX_VA_COPY(ap1, ap2) memmove((ap1), (ap2), sizeof(va_list)) # else # define CX_VA_COPY(ap1, ap2) ((ap1) = (ap2)) # endif #endif /** * @defgroup cxutils Miscellaneous Utilities * * The module provides a portable implementation of a selection of * miscellaneous utility functions. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * Identifier for applications */ static cxchar *cx_program_name = NULL; CX_LOCK_DEFINE_INITIALIZED_STATIC(cx_program_name); /** * @brief * Get the name of the application. * * @return The program's name string. * * The program's name is retrieved and returned to the caller. The returned * pointer is a library resource and must not be freed or modified. */ const cxchar * cx_program_get_name(void) { const cxchar* name = NULL; CX_LOCK(cx_program_name); name = cx_program_name; CX_UNLOCK(cx_program_name); return name; } /** * @brief * Set the name of the application. * * @param name The program name. * * @return Nothing. * * The program's name is set to the string @em name. * * @attention For thread-safety reasons this function may be called only once! */ void cx_program_set_name(const cxchar *name) { CX_LOCK(cx_program_name); cx_free(cx_program_name); cx_program_name = cx_strdup(name); CX_UNLOCK(cx_program_name); return; } /** * @brief * Get the position of the first bit set, searching from left to right. * * @param mask A 32 bit integer containing bit flags. * @param start Bit position where the search starts. * * @return The bit position of the first bit set which is lower than * @em start. If no bit is set -1 is returned. * * The function searches for the first bit set in @em mask, starting at * the bit position @em start - 1. The bit mask @em mask is searched from * left to right. If @em start is less than 0 or bigger than 32 the search * starts at the 31st bit. * * @see cx_bits_rfind() */ cxint cx_bits_find(cxuint32 mask, cxint start) { register cxint n = (cxint)(sizeof(cxuint32) * 8); if (start < 0 || start > n) start = n; while (start > 0) { start--; if (mask & (1 << (cxuint32)start)) return start; } return -1; } /** * @brief * Get the position of the first bit set, searching from right to left. * * @param mask A 32 bit integer containing bit flags. * @param start Bit position where the search starts. * * @return The bit position of the first bit set which is higher than * @em start. If no bit is set -1 is returned. * * The function searches for the first bit set in @em mask, starting at * the bit position @em start + 1. The bit mask @em mask is searched from * right to left. If @em start is less than 0 the search starts at the 1st * bit. * * @see cx_bits_find() */ cxint cx_bits_rfind(cxuint32 mask, cxint start) { register cxint n = (cxint)(sizeof(cxuint32) * 8); if (start < 0) start = -1; while (start < n) { start++; if (mask & (1 << (cxuint32)start)) return start; } return -1; } /** * @brief * Safe version of @b sprintf(). * * @param string Destination string. * @param n Maximum number of characters to be written. * @param format The format string. * @param ... Arguments to be inserted into the format string. * * @return The number of characters (excluding the trailing null) which * would have been written to the destination string if enough space * had been available, i.e. if the destination string is large enough * the function returns the number of characters written to the string. * * The function is a safe form of @b sprintf(). It writes output to * the string @em string, under the control of the format string @em format. * The format string specifies how the arguments are formatted for output. * All standard C conversion directives are supported. * * The difference compared to @b sprintf() is that the produced number of * characters does not exceed @em n (including the trailing null). * * @note * The return value of @b cx_snprintf() conforms to the @b snprintf() * function as standardized in ISO C99. This might be different from * traditional implementations. * * @see cx_asprintf(), cx_strdupf() */ cxint cx_snprintf(cxchar *string, cxsize n, const cxchar *format, ...) { va_list args; cxint nc; va_start(args, format); nc = cx_vsnprintf(string, n, format, args); va_end(args); return nc; } /** * @brief * Safe version of @b vsprintf(). * * @param string Destination string. * @param n Maximum number of characters to be written. * @param format The format string. * @param args List of arguments to be inserted into the format string. * * @return The number of characters (excluding the trailing null) which * would have been written to the destination string if enough space * had been available, i.e. if the destination string is large enough * the function returns the number of characters written to the string. * * The function is a safe form of @b vsprintf(). It writes output to * the string @em string, under the control of the format string @em format. * The format string specifies how the arguments, provided through the * variable-length argument list @em args, are formatted for output. * All standard C conversion directives are supported. * * The difference compared to @b vsprintf() is that the produced number of * characters does not exceed @em n (including the trailing null). * * @note * The return value of @b cx_vsnprintf() conforms to the @b vsnprintf() * function as standardized in ISO C99. This might be different from * traditional implementations. * * @see cx_vasprintf(), cx_strvdupf() */ cxint cx_vsnprintf(cxchar *string, cxsize n, const cxchar *format, va_list args) { if (n != 0 && string == NULL) return 0; if (format == NULL) return 0; /* * No availablility checks needed here. If the system does not provide * a vsnprintf() function with C99 semantics a local implementation * is used (see inclusion of snprintf.h at the beginning of this file), * i.e. vsnprintf will always be available. For further details check * the implementation itself in snprintf.c. */ return vsnprintf(string, n, format, args); } /** * @brief * Write formatted output to a newly allocated string. * * @param string Address where the allocated string is stored. * @param format The format string. * @param ... Arguments to be inserted into the format string. * * @return The number of characters (excluding the trailing null) written to * allocated string, i.e. its length. If sufficient space cannot be * allocated, -1 is returned. * * The function is similar to @b cx_snprintf() or @b sprintf(). The difference * to @b cx_snprintf() is that the output created from the format string * @em format and the formatted arguments is placed into a string which is * allocated using @b cx_malloc(). All standard C conversion directives are * supported. The allocated string is always null terminated. * * The pointer to the allocated string buffer sufficiently large to hold * the string is returned to the caller in the @em string argument. This * pointer should be passed to @b cx_free to release the allocated storage * when it is no longer needed. If sufficient memory cannot be allocated * @em is set to @c NULL. * * @see cx_snprintf(), cx_strdupf(), cx_malloc(), cx_free() */ cxint cx_asprintf(cxchar **string, const cxchar *format, ...) { va_list args; cxint nc; va_start(args, format); nc = cx_vasprintf(string, format, args); va_end(args); return nc; } /** * @brief * Write formatted output to a newly allocated string with a * variable-length argument list. * * @param string Address where the allocated string is stored. * @param format The format string. * @param args List of arguments to be inserted into the format string. * * @return The number of characters (excluding the trailing null) written to * allocated string, i.e. its length. If sufficient space cannot be * allocated, -1 is returned. * * The function is similar to @b cx_vsnprintf() or @b vsprintf(). The * difference to @b cx_vsnprintf() is that the output, created from the * format string @em format and the arguments given by the variable-length * argument list @em args, is placed into a string which is allocated using * @b cx_malloc(). All standard C conversion directives are supported. The * allocated string is always null terminated. * * The pointer to the allocated string buffer sufficiently large to hold * the string is returned to the caller in the @em string argument. This * pointer should be passed to @b cx_free to release the allocated storage * when it is no longer needed. If sufficient memory cannot be allocated * @em is set to @c NULL. * * @see cx_vsnprintf(), cx_strvdupf(), cx_malloc(), cx_free() */ cxint cx_vasprintf(cxchar **string, const cxchar *format, va_list args) { cxint nc; if (format == NULL) return 0; else { #ifdef HAVE_VASPRINTF if (!cx_memory_is_system_malloc()) { cxchar *buffer; nc = vasprintf(&buffer, format, args); *string = cx_strdup(buffer); /* * vasprintf() uses system services for the buffer allocation, * therefore it has to be released again with the system free() */ free(buffer); } else { nc = vasprintf(string, format, args); } #else /* !HAVE_VASPRINTF */ va_list args2; *string = NULL; /* * Just get the required buffer size. Don't consume the original * args, we'll need it again. */ CX_VA_COPY(args2, args); nc = cx_vsnprintf(NULL, 0, format, args2); #ifdef HAVE_VA_COPY_STYLE_FUNCTION va_end(args2); /* Only if va_copy() or __va_copy() was used */ #endif cx_assert(nc >= -1); /* possible integer overflow if nc > INT_MAX */ if (nc >= 0) { *string = (cxchar *)cx_malloc((cxsize)nc + 1); if (*string == NULL) { nc = -1; } else { int nc2 = cx_vsnprintf(*string, nc + 1, format, args); (void) nc2; /* Prevent warnings if cx_assert is disabled. */ cx_assert(nc2 == nc); } } #endif /* !HAVE_VASPRINTF */ } return nc; } /** * @brief * Get the maximum length of a line supported by the system. * * @return The length of a line including the trailing zero. * * The function uses the @b sysconf() function to determine the maximum * length of a line buffer that is supported by the system and available * for utility programs. If the @b sysconf() facility is not available * the function returns a guessed value of 4096 characters as the maximum * length of a line taking into account the trailing zero. */ cxlong cx_line_max(void) { cxlong sz = 4096; /* Guessed default */ #if defined(HAVE_SYSCONF) && defined(_SC_LINE_MAX) sz = sysconf(_SC_LINE_MAX); #endif return sz; } /** * @brief * Allocate a line buffer with the maximum size supported by the system. * * @return A pointer allocated memory. * * The function creates a line buffer with the maximum length supported * by the system. The size of the buffer is determined calling * @b cx_line_max() which gives the maximum size including the * trailing zero. */ cxchar * cx_line_alloc(void) { cxlong sz = cx_line_max(); return (cxchar *)cx_calloc(sz, sizeof(cxchar)); } /**@}*/ cpl-6.4.1/libcext/cext/cxslist.c0000644000460300003120000006754312243415467013473 00000000000000/* $Id: cxslist.c,v 1.10 2012-03-06 12:33:15 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-03-06 12:33:15 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include "cxmemory.h" #include "cxmessages.h" #include "cxslist.h" /** * @defgroup cxslist Singly Linked Lists * * The module implements a linked list object restricted to iterations in * just one direction and methods to create, destroy and manipulate it. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * Singly linked list node and list opaque data types */ typedef struct _cx_slnode_ cx_slnode; struct _cx_slnode_ { cxptr data; struct _cx_slnode_ *next; }; struct _cx_slist_ { cx_slnode head; }; /* * Attach data to a list node. */ inline static void _cx_slnode_put(cx_slnode *node, cxcptr data) { cx_assert(node != NULL); node->data = (cxptr)data; return; } /* * Retrieve data from a list node. The previously stored data is returned * to the caller. */ inline static cxptr _cx_slnode_get(const cx_slnode *node) { if (!node) return NULL; return node->data; } /* * Create a new list node. */ inline static cx_slnode * _cx_slnode_create(cxcptr data) { cx_slnode *node = cx_malloc(sizeof *node); _cx_slnode_put(node, data); node->next = NULL; return node; } /* * Deallocate a list node. A handle to the node's data is returned to the * caller. */ inline static cxptr _cx_slnode_delete(cx_slnode *node) { cxptr data; if (!node) return NULL; data = _cx_slnode_get(node); cx_free(node); return data; } /* * Destroy a list node, i.e. at first the node's data is deallocated using * the passed deallocator and then the node itself. If NULL is passed as * deallocator the data is not deallocated and the function call is * equivalent to _cx_slnode_delete(). */ inline static void _cx_slnode_destroy(cx_slnode *node, cx_free_func dealloc) { if (!node) return; if (dealloc && node->data) dealloc(node->data); cx_free(node); return; } /* * Check if the given list node follows another. */ inline static cxbool _cx_slnode_follows(const cx_slnode *head, const cx_slnode *node) { cx_slnode *n = head->next; while (n) { if (n == node) return TRUE; n = n->next; } return FALSE; } /* * Check if the given list node is in a list or not. Note that according * to this function the head node is not part of the list! */ inline static cxbool _cx_slnode_exists(const cx_slist *list, const cx_slnode *node) { return _cx_slnode_follows(&list->head, node); } /* * Initialize a newly created list object */ inline static void _cx_slist_init(cx_slist *list) { if (!list) return; list->head.next = NULL; } /* * Get an iterator to the beginning of a list. */ inline static cx_slist_iterator _cx_slist_begin(const cx_slist *list) { return list->head.next; } /* * Get an iterator for the end of a list. */ inline static cx_slist_iterator _cx_slist_end(const cx_slist *list) { (void) list; /* unused parameter */ return NULL; } /* * Calculate the distance between two list nodes. */ inline static cxsize _cx_slist_distance(const cx_slnode *first, const cx_slnode *last) { register cxsize sz = 0; register cx_slnode *node; for (node = (cx_slnode *)first; node != last; node = node->next) ++sz; return sz; } /* * Inserts a single node. */ inline static cx_slnode * _cx_slist_make_link(cx_slnode *position, cx_slnode *node) { node->next = position->next; position->next = node; return node; } /* * Returns the previous list node. */ inline static cx_slnode * _cx_slist_previous(const cx_slnode *head, const cx_slnode *node) { while (head && head->next != node) head = head->next; return (cx_slnode *)head; } /* * Insert data into a list after a given iterator position. Returns the * iterator position of the inserted item. */ inline static cx_slnode * _cx_slist_insert_after(cx_slist_iterator position, cxcptr data) { return _cx_slist_make_link(position, _cx_slnode_create(data)); } /* * Erase a list element after a given position. Returns the node immediately * following the erased list node. The data is deallocated using the provided * deallocator function. If this is NULL, the data is not destroyed. */ inline static cx_slnode * _cx_slist_erase_after(cx_slist_iterator position, cx_free_func deallocate) { cx_slnode *next = position->next; if (!next) return NULL; position->next = next->next; _cx_slnode_destroy(next, deallocate); return position->next; } /* * Extract a list element after a given position. Returns a handle to the * data previously stored at this list position. */ inline static cxptr _cx_slist_extract_after(cx_slist_iterator position) { cx_slnode *next = position->next; if (!next) return NULL; position->next = next->next; return _cx_slnode_delete(next); } /* * Move a range of list nodes in front of the node following the given * position. */ inline static void _cx_slist_splice_after(cx_slnode *position, cx_slnode *before_first, cx_slnode *before_last) { if (position != before_first && position != before_last) { cx_slnode *first = before_first->next; cx_slnode *after = position->next; before_first->next = before_last->next; position->next = first; before_last->next = after; } } /* * Reverse the list starting at the given node */ inline static cx_slnode * _cx_slist_reverse(cx_slnode *node) { cx_slnode *result = node; node = node->next; result->next = NULL; while (node) { cx_slnode *next = node->next; node->next = result; result = node; node = next; } return result; } /* * Check if a given list is sorted using the provided comparison function. * Returns 1 if the list is sorted, 0 otherwise. */ inline static cxbool _cx_slist_sorted(cx_slist *list, cx_compare_func compare) { cx_slnode *node = list->head.next; cx_slnode *next = NULL; if (node != NULL) next = node->next; while (next != NULL) { if (compare(_cx_slnode_get(node), _cx_slnode_get(next)) > 0) return 0; node = next; next = next->next; } return 1; } /* * Get an iterator for the list element directly following the * given list node. */ inline static cx_slist_iterator _cx_slist_next(cx_slist_const_iterator position) { return position->next; } /* * Remove all elements from a list. The data object pointed to by the list * nodes are not deallocated! */ inline static void _cx_slist_clear(cx_slist *list) { cx_slist_iterator sl; if (!list) return; sl = _cx_slist_begin(list); while (sl != _cx_slist_end(list)) { cx_slnode *node = sl; sl = _cx_slist_next(sl); list->head.next = sl; _cx_slnode_delete(node); } _cx_slist_init(list); return; } /* * Get the size of a list as the distance between the first and the sentinel * element of the list. */ inline static cxsize _cx_slist_size(const cx_slist *list) { return _cx_slist_distance(_cx_slist_begin(list), _cx_slist_end(list)); } /* * Extract the list element at the given position from the list. * A handle to the data object, which is associated to the list * element is returned. */ inline static cxptr _cx_slist_extract(cx_slist *list, cx_slist_iterator position) { cx_slnode *prev = _cx_slist_previous(&list->head, position); return _cx_slist_extract_after(prev); } /* * Merge two sorted lists keeping the sorting order with respect to the * given comparison function. */ inline static void _cx_slist_merge(cx_slist *list1, cx_slist *list2, cx_compare_func compare) { cx_slnode *n1; if (list1 == list2) return; cx_assert(_cx_slist_size(list1) + _cx_slist_size(list2) >= _cx_slist_size(list1)); cx_assert(_cx_slist_sorted(list1, compare)); cx_assert(_cx_slist_sorted(list2, compare)); n1 = &list1->head; while (n1->next && list2->head.next) { if (compare(_cx_slnode_get(list2->head.next), _cx_slnode_get(n1->next)) < 0) _cx_slist_splice_after(n1, &list2->head, list2->head.next); n1 = n1->next; } if (list2->head.next) { n1->next = list2->head.next; list2->head.next = NULL; } return; } /* * Sort the elements of a list with respect to the given comparison function. */ inline static void _cx_slist_sort(cx_slist *list, cx_compare_func compare) { if (_cx_slist_size(list) > 1) { cx_slist tmp; cx_slnode *node; cxsize middle = _cx_slist_size(list) / 2; _cx_slist_init(&tmp); node = list->head.next; while (--middle) node = node->next; _cx_slist_splice_after(&tmp.head, &list->head, node); _cx_slist_sort(list, compare); _cx_slist_sort(&tmp, compare); _cx_slist_merge(list, &tmp, compare); } return; } /** * @brief * Get list iterator to the beginning of a list. * * @param list A list. * * @return Iterator for the first element in the list, or @b cx_slist_end() * if the list is empty. * * The function returns a handle to the first element of @em list. The * handle cannot be used directly to access the element data, but only * through the appropriate functions. */ cx_slist_iterator cx_slist_begin(const cx_slist *list) { cx_assert(list != NULL); return _cx_slist_begin(list); } /** * @brief * Get a list iterator to the end of a list. * * @param list A list. * * @return Iterator for the end of the list. * * The function returns an iterator for the position one past the last * element of the list @em list. The handle cannot be used to directly * access the element data, but only through the appropriate functions. */ cx_slist_iterator cx_slist_end(const cx_slist *list) { cx_assert(list != NULL); return _cx_slist_end(list); } /** * @brief * Get a list iterator to the next list element * * @param list A list. * @param position Current iterator position. * * @return Iterator for the next list element. * * The function returns an iterator for the next element in the list * @em list with respect to the current iterator position @em position. * If the list @em list is empty or @em position points to the list end * the function returns @b cx_slist_end(). * * @see cx_slist_empty() */ cx_slist_iterator cx_slist_next(const cx_slist *list, cx_slist_const_iterator position) { (void) list; /* Prevent warnings if cx_assert is disabled. */ cx_assert(list != NULL); cx_assert(_cx_slnode_exists(list, position)); return _cx_slist_next(position); } /** * @brief * Remove all elements from a list. * * @param list List to be cleared. * * @return Nothing. * * The list @em list is cleared, i.e. all elements are removed from the list. * The removed data objects are left untouched, in particular they are not * deallocated. It is the responsibility of the caller to ensure that there * still are other references to the removed data objects. After calling * @b cx_slist_clear() the list @em list is empty. */ void cx_slist_clear(cx_slist *list) { cx_assert(list != NULL); _cx_slist_clear(list); return; } /** * @brief * Check whether a list is empty. * * @param list A list. * * @return The function returns @c TRUE if the list is empty, and @c FALSE * otherwise. * * The function tests if the list @em list contains data. A call to this * function is equivalent to the statement: * * @code * return (cx_slist_size(list) == 0); * @endcode */ cxbool cx_slist_empty(const cx_slist *list) { cx_assert(list != NULL); return (list->head.next == NULL); } /** * @brief * Create a new list without any elements. * * @return Handle to the newly allocated list. * * The function allocates memory for the list object and initializes * it to a empty list. */ cx_slist * cx_slist_new(void) { cx_slist *list = cx_malloc(sizeof *list); _cx_slist_init(list); return list; } /** * @brief * Destroy a list. * * @param list The list to delete. * * @return Nothing. * * The function deallocates the list object, but not the data objects * currently stored in the list. */ void cx_slist_delete(cx_slist *list) { _cx_slist_clear(list); cx_assert(cx_slist_empty(list)); cx_free(list); return; } /** * @brief * Destroy a list and all its elements. * * @param list List container to destroy. * @param deallocate Data deallocator. * * @return Nothing. * * The function deallocates all data objects referenced by the list using * the data deallocation function @em deallocate and finally dealocates * the list object itself. */ void cx_slist_destroy(cx_slist *list, cx_free_func deallocate) { cx_slist_iterator sl; if (!list) return; cx_assert(deallocate != NULL); sl = _cx_slist_begin(list); while (sl != _cx_slist_end(list)) { cx_slnode *node = sl; sl = _cx_slist_next(sl); list->head.next = sl; _cx_slnode_destroy(node, deallocate); } cx_assert(cx_slist_empty(list)); cx_free(list); return; } /** * @brief * Get the actual number of list elements. * * @param list A list. * * @return The current number of elements the list contains, or 0 if the * list is empty. * * Retrieves the number of elements currently stored in the list @em list. */ cxsize cx_slist_size(const cx_slist *list) { cx_assert(list != NULL); return _cx_slist_size(list); } /** * @brief * Get the maximum number of list elements possible. * * @param list A list. * * @return The maximum number of elements that can be stored in the list. * * Retrieves the lists capacity, i.e. the maximum possible number of data * items a list can hold. */ cxsize cx_slist_max_size(const cx_slist *list) { (void) list; /* Prevent warnings if cx_assert is disabled. */ cx_assert(list != NULL); return (cxsize)(-1); } /** * @brief * Swap the data of two lists. * * @param list1 First list. * @param list2 Second list. * * @return Nothing. * * The contents of the first list @em list1 will be moved to the second * list @em list2, while the contents of @em list2 is moved to @em list1. */ void cx_slist_swap(cx_slist *list1, cx_slist *list2) { cx_slnode *tmp; tmp = list1->head.next; list1->head.next = list2->head.next; list2->head.next = tmp; return; } /** * @brief * Assign data to a list position. * * @param list A list. * @param position List position where the data will be stored * @param data Data to store. * * @return Handle to the previously stored data object. * * The function assigns the data object reference @em data * to the iterator position @em position of the list @em list. */ cxptr cx_slist_assign(cx_slist *list, cx_slist_iterator position, cxcptr data) { cxptr tmp; (void) list; /* Prevent warnings if cx_assert is disabled. */ cx_assert(list != NULL); cx_assert(_cx_slnode_exists(list, position)); tmp = _cx_slnode_get(position); _cx_slnode_put(position, data); return tmp; } /** * @brief * Get the first element of a list. * * @param list The list to query. * * @return Handle to the data object stored as the first list element. * * The function returns a reference to the first data item in the list * @em list. */ cxptr cx_slist_front(const cx_slist *list) { cx_assert(list != NULL); cx_assert(!cx_slist_empty(list)); return _cx_slnode_get(_cx_slist_begin(list)); } /** * @brief * Get the last element of a list. * * @param list The list to query. * * @return Handle to the data object stored as the last list element. * * The function returns a reference to the last data item in the list * @em list. */ cxptr cx_slist_back(const cx_slist *list) { cx_slnode *tail; cx_assert(list != NULL); cx_assert(!cx_slist_empty(list)); tail = _cx_slist_previous(&list->head, _cx_slist_end(list)); return _cx_slnode_get(tail); } /** * @brief * Get the data at a given iterator position. * * @param list A list. * @param position List position the data is retrieved from. * * @return Handle to the data object. * * The function returns a reference to the data item stored in the list * @em list at the iterator position @em position. */ cxptr cx_slist_get(const cx_slist *list, cx_slist_const_iterator position) { (void) list; /* Prevent warnings if cx_assert is disabled. */ cx_assert(list != NULL); cx_assert(_cx_slnode_exists(list, position)); return _cx_slnode_get(position); } /** * @brief * Insert data into a list at a given iterator position. * * @param list The list to update. * @param position List iterator position. * @param data Data item to insert. * * @return List iterator position of the inserted data item. * * The function inserts the data handle @em data into the list @em list * at the list position given by the list iterator @em position. */ cx_slist_iterator cx_slist_insert(cx_slist *list, cx_slist_iterator position, cxcptr data) { cx_slist_iterator prev, node; cx_assert(list != NULL); cx_assert(position == _cx_slist_end(list) || _cx_slnode_exists(list, position)); cx_assert(_cx_slist_size(list) + 1 > _cx_slist_size(list)); prev = _cx_slist_previous(&list->head, position); node = _cx_slist_insert_after(prev, data); cx_assert(_cx_slist_size(list) <= cx_slist_max_size(list)); return node; } /** * @brief * Insert data at the beginning of a list. * * @param list The list to update. * @param data Data to add to the list. * * @return Nothing * * The data @em data is inserted into the list @em list before the first * element of the list, so that it becomes the new list head. * * It is equivalent to the statement * @code * cx_slist_insert(list, cx_slist_begin(list), data); * @endcode */ void cx_slist_push_front(cx_slist *list, cxcptr data) { cx_assert(list != NULL); _cx_slist_make_link(&list->head, _cx_slnode_create(data)); return; } /** * @brief * Append data at the end of a list. * * @param list The list to update. * @param data Data to append. * * @return Nothing. * * The data @em data is inserted into the list @em list after the last * element, so that it becomes the new list tail. * * It is equivalent to the statement * @code * cx_slist_insert(list, cx_slist_end(list), data); * @endcode */ void cx_slist_push_back(cx_slist *list, cxcptr data) { cx_slnode *tail; cx_assert(list != NULL); tail = _cx_slist_previous(&list->head, _cx_slist_end(list)); _cx_slist_make_link(tail, _cx_slnode_create(data)); return; } /** * @brief * Erase a list list element. * * @param list The list to update. * @param position List iterator position. * @param deallocate Data deallocator. * * @return The iterator for the list position after @em position. * * The function removes the data object stored at position @em position * from the list @em list. The data object is deallocated bz calling * the data deallocator @em deallocate. */ cx_slist_iterator cx_slist_erase(cx_slist *list, cx_slist_iterator position, cx_free_func deallocate) { cx_slnode *prev; cx_assert(list != NULL); cx_assert(deallocate != NULL); cx_assert(_cx_slnode_exists(list, position)); prev = _cx_slist_previous(&list->head, position); return _cx_slist_erase_after(prev, deallocate); } /** * @brief * Extract a list element. * * @param list A list. * @param position List iterator position. * * @return Handle to the previously stored data object. * * The function removes a data object from the list @em list located at the * iterator position @em position without destroying the data object. * * @see cx_slist_erase(), cx_slist_remove() */ cxptr cx_slist_extract(cx_slist *list, cx_slist_iterator position) { cx_assert(list != NULL); cx_assert(_cx_slnode_exists(list, position)); return _cx_slist_extract(list, position); } /** * @brief * Remove the first list element. * * @param list The list to update. * * @return Handle to the data object previously stored as the last * list element. * * The function removes the first element from the list @em list returning * a handle to the previously stored data. */ cxptr cx_slist_pop_front(cx_slist *list) { cx_slnode *node; cx_assert(list != NULL); node = list->head.next; list->head.next = node->next; return _cx_slnode_delete(node); } /** * @brief * Remove the last element of a list. * * @param list The list to update. * * @return Handle to the data object previously stored as the last * list element. * * The function removes the last element from the list @em list returning * a handle to the previously stored data. */ cxptr cx_slist_pop_back(cx_slist *list) { cx_slnode *node; cx_assert(list != NULL); node = _cx_slist_previous(&list->head, _cx_slist_end(list)); return _cx_slist_extract(list, node); } /** * @brief * Remove all elements with a given value from a list. * * @param list A list object. * @param data Data to remove. * * @return Nothing. * * The value @em data is searched in the list @em list. If the data is * found it is removed from the list. The data object itself is not * deallocated. */ void cx_slist_remove(cx_slist *list, cxcptr data) { cx_slnode *node; cx_assert(list != NULL); node = &list->head; while (node && node->next) { if (_cx_slnode_get(node->next) == data) _cx_slist_extract_after(node); else node = node->next; } return; } /** * @brief * Remove duplicates of consecutive elements. * * @param list A list. * @param compare Function comparing the list elements. * * @return Nothing. * * The function removes duplicates of consecutive list elements, i.e. list * elements with the same value, from the list @em list. The equality of * the list elements is checked using the comparison function @em compare. * The comparison function @em compare must return an integer less than, * equal or greater than zero if the first argument passed to it is found, * respectively, to be less than, match, or be greater than the second * argument. */ void cx_slist_unique(cx_slist *list, cx_compare_func compare) { cx_slnode *first, *next; cx_assert(list != NULL); cx_assert(compare != NULL); first = _cx_slist_begin(list); if (first) { next = _cx_slist_next(first); while (next) { if (compare(_cx_slnode_get(first), _cx_slnode_get(next)) == 0) _cx_slist_extract_after(first); else first = next; next = _cx_slist_next(first); } } return; } /** * @brief * Move a range of list elements in front of a given position. * * @param tlist Target list. * @param position Target iterator position. * @param slist Source list. * @param first Position of the first element to move. * @param last Position of the last element to move. * * @return Nothing. * * The range of list elements from the iterator position @em first to * @em last, but not including @em last, is moved from the source list * @em slist in front of the position @em position of the target list * @em tlist. Target and source list may be identical, provided that the * target position @em position does not fall within the range of list * elements to move. */ void cx_slist_splice(cx_slist *tlist, cx_slist_iterator position, cx_slist *slist, cx_slist_iterator first, cx_slist_iterator last) { cx_slnode *before_first, *before_last; cx_assert(slist != NULL); cx_assert(first == _cx_slist_end(slist) || _cx_slnode_exists(slist, first)); cx_assert(last == _cx_slist_end(slist) || _cx_slnode_follows(first, last)); before_first = _cx_slist_previous(&slist->head, first); before_last = _cx_slist_previous(&slist->head, last); if (before_first != before_last) { cx_slnode *before_pos; cx_assert(tlist != NULL); cx_assert(position == _cx_slist_end(tlist) || _cx_slnode_exists(tlist, position)); before_pos = _cx_slist_previous(&tlist->head, position); cx_assert(slist != tlist || (_cx_slnode_follows(position, first) || _cx_slnode_follows(last, position))); _cx_slist_splice_after(before_pos, before_first, before_last); } return; } /** * @brief * Merge two sorted lists. * * @param list1 First list to merge. * @param list2 Second list to merge. * @param compare Function comparing the list elements. * * @return Nothing. * * The function combines the two lists @em list1 and @em list2 by moving all * elements from @em list2 into @em list1, so that all elements are still * sorted. The function requires that both input lists are already sorted. * The sorting order in which the elements of @em list2 are inserted * into @em list1 is determined by the comparison function @em compare. * The comparison function @em compare must return an integer less than, equal * or greater than zero if the first argument passed to it is found, * respectively, to be less than, match, or be greater than the second * argument. * * The list @em list2 is consumed by this process, i.e. after the successful * merging of the two lists, list @em list2 will be empty. */ void cx_slist_merge(cx_slist *list1, cx_slist *list2, cx_compare_func compare) { cx_assert(list1 != NULL); cx_assert(list2 != NULL); cx_assert(compare != NULL); _cx_slist_merge(list1, list2, compare); return; } /** * @brief * Sort all elements of a list using the given comparison function. * * @param list The list to sort. * @param compare Function comparing the list elements. * * @return Nothing. * * The input list @em list is sorted using the comparison function * @em compare to determine the order of two list elements. The comparison * function @em compare must return an integer less than, equal * or greater than zero if the first argument passed to it is found, * respectively, to be less than, match, or be greater than the second * argument. */ void cx_slist_sort(cx_slist *list, cx_compare_func compare) { cx_assert(list != NULL); cx_assert(compare != NULL); _cx_slist_sort(list, compare); return; } /** * @brief * Reverse the order of all list elements. * * @param list The list to reverse. * * @return Nothing. * * The order of the elements of the list @em list is reversed. */ void cx_slist_reverse(cx_slist *list) { cx_assert(list != NULL); if (list->head.next) list->head.next = _cx_slist_reverse(list->head.next); return; } /**@}*/ cpl-6.4.1/libcext/cext/cxstrutils.h0000644000460300003120000000406311530471603014207 00000000000000/* $Id: cxstrutils.h,v 1.6 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.6 $ * $Name: not supported by cvs2svn $ */ #ifndef CX_STRUTILS_H #define CX_STRUTILS_H #include #include CX_BEGIN_DECLS /* * String comparison functions. */ cxint cx_strcasecmp(const cxchar *, const cxchar *); cxint cx_strncasecmp(const cxchar *, const cxchar *, cxsize); cxint cx_strempty(const cxchar *, const cxchar *); /* * Utility functions modifing their string argument */ cxchar *cx_strlower(cxchar *); cxchar *cx_strupper(cxchar *); cxchar *cx_strtrim(cxchar *); cxchar *cx_strrtrim(cxchar *); cxchar *cx_strstrip(cxchar *); /* * Utility functions which do not create a new string */ cxchar *cx_strskip(const cxchar *, cxint (*)(cxint)); /* * Utilities returning a newly allocated string. */ cxchar *cx_strdup(const cxchar *); cxchar *cx_strndup(const cxchar *, cxsize); cxchar *cx_strvdupf(const cxchar *, va_list) CX_GNUC_PRINTF(1, 0); cxchar *cx_stpcpy(cxchar *, const cxchar *); cxchar **cx_strsplit(const cxchar *, const cxchar *, cxint); void cx_strfreev(cxchar **sarray); cxchar *cx_strjoinv(const cxchar *, cxchar **); CX_END_DECLS #endif /* CX_STRUTILS_H */ cpl-6.4.1/libcext/cext/cxmultimap.h0000644000460300003120000001044411530471603014146 00000000000000/* $Id: cxmultimap.h,v 1.6 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.6 $ * $Name: not supported by cvs2svn $ */ #ifndef CX_MULTIMAP_H #define CX_MULTIMAP_H #include #include CX_BEGIN_DECLS /** * @ingroup cxmultimap * * @brief * The multimap datatype. * * The internal representation of a mutimap is, as for ordinary maps too, a * balanced binary tree. For this reason cx_multimap is just an alias for * cx_tree. */ typedef cx_tree cx_multimap; /** * @ingroup cxmultimap * * @brief * The multimap iterator datatype. * * The multimap iterator is just an alias for the cx_tree_iterator datatype. */ typedef cx_tree_iterator cx_multimap_iterator; /** * @ingroup cxmultimap * * @brief * The multimap constant iterator datatype. * * The multimap constant iterator is just an alias for the * cx_tree_const_iterator datatype. */ typedef cx_tree_const_iterator cx_multimap_const_iterator; /** * @ingroup cxmultimap * * @brief * The multimap's key comparison operator function. * * This type of function is used internally by a multimap when key * comparisons are necessary. It must return @c TRUE if the comparison * of its first argument with the second argument succeeds, and @c FALSE * otherwise. It is actually an alias for cx_tree_compare_func. * * @see cx_tree_compare_func */ typedef cx_tree_compare_func cx_multimap_compare_func; /* * Create, copy and destroy operations */ cx_multimap *cx_multimap_new(cx_multimap_compare_func, cx_free_func, cx_free_func); void cx_multimap_delete(cx_multimap *); /* * Nonmodifying operations */ cxsize cx_multimap_size(const cx_multimap *); cxbool cx_multimap_empty(const cx_multimap *); cxsize cx_multimap_max_size(const cx_multimap *); cx_multimap_compare_func cx_multimap_key_comp(const cx_multimap *); /* * Special search operations */ cxsize cx_multimap_count(const cx_multimap *, cxcptr); cx_multimap_iterator cx_multimap_find(const cx_multimap *, cxcptr); cx_multimap_iterator cx_multimap_lower_bound(const cx_multimap *, cxcptr); cx_multimap_iterator cx_multimap_upper_bound(const cx_multimap *, cxcptr); void cx_multimap_equal_range(const cx_multimap *, cxcptr, cx_multimap_iterator *, cx_multimap_iterator *); /* * Assignment operations */ void cx_multimap_swap(cx_multimap *, cx_multimap *); cxptr cx_multimap_assign(cx_multimap *, cx_multimap_iterator, cxcptr); /* * Element access */ cxptr cx_multimap_get_key(const cx_multimap *, cx_multimap_const_iterator); cxptr cx_multimap_get_value(const cx_multimap *, cx_multimap_const_iterator); /* * Iterator functions */ cx_multimap_iterator cx_multimap_begin(const cx_multimap *); cx_multimap_iterator cx_multimap_end(const cx_multimap *); cx_multimap_iterator cx_multimap_next(const cx_multimap *, cx_multimap_const_iterator); cx_multimap_iterator cx_multimap_previous(const cx_multimap *, cx_multimap_const_iterator); /* * Inserting and removing elements */ cx_multimap_iterator cx_multimap_insert(cx_multimap *, cxcptr, cxcptr); void cx_multimap_erase_position(cx_multimap *, cx_multimap_iterator); void cx_multimap_erase_range(cx_multimap *, cx_multimap_iterator, cx_multimap_iterator); cxsize cx_multimap_erase(cx_multimap *, cxcptr); void cx_multimap_clear(cx_multimap *); CX_END_DECLS #endif /* CX_MULTIMAP_H */ cpl-6.4.1/libcext/cext/cxmap.c0000644000460300003120000004235411530471603013073 00000000000000/* $Id: cxmap.c,v 1.5 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.5 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include "cxmemory.h" #include "cxmessages.h" #include "cxmap.h" /** * @defgroup cxmap Maps * * The module implements a map data type, i.e. a container managing key/value * pairs as elements. Their elements are automatically sorted according to * a sorting criterion used for the key. The container is optimized for * lookup operations. Maps are restriced to unique keys, i.e. a key can * only appear once in a map. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /** * @brief * Get an iterator to the first pair in a map. * * @param map The map to query. * * @return Iterator for the first pair or @b cx_map_end() if the map is * empty. * * The function returns a handle for the first pair in the map @em map. * The returned iterator cannot be used directly to access the value field * of the key/value pair, but only through the appropriate methods. */ cx_map_iterator cx_map_begin(const cx_map *map) { return cx_tree_begin(map); } /** * @brief * Get an iterator for the position after the last pair in the map. * * @param map The map to query. * * @return Iterator for the end of the map. * * The function returns an iterator for the position one past the last pair * in the map @em map. The iteration is done in ascending order according * to the keys. The returned iterator cannot be used directly to access the * value field of the key/value pair, but only through the appropriate * methods. */ cx_map_iterator cx_map_end(const cx_map *map) { return cx_tree_end(map); } /** * @brief * Get an iterator for the next pair in the map. * * @param map A map. * @param position Current iterator position. * * @return Iterator for the pair immediately following @em position. * * The function returns an iterator for the next pair in the map @em map * with respect to the current iterator position @em position. Iteration * is done in ascending order according to the keys. If the map is empty * or @em position points to the end of the map the function returns * @b cx_map_end(). */ cx_map_iterator cx_map_next(const cx_map *map, cx_map_const_iterator position) { return cx_tree_next(map, position); } /** * @brief * Get an iterator for the previous pair in the map. * * @param map A map. * @param position Current iterator position. * * @return Iterator for the pair immediately preceding @em position. * * The function returns an iterator for the previous pair in the map * @em map with respect to the current iterator position @em position. * Iteration is done in ascending order according to the keys. If the * map is empty or @em position points to the beginning of the map the * function returns @b cx_map_end(). */ cx_map_iterator cx_map_previous(const cx_map *map, cx_map_const_iterator position) { return cx_tree_previous(map, position); } /** * @brief * Remove all pairs from a map. * * @param map Map to be cleared. * * @return Nothing. * * The map @em map is cleared, i.e. all pairs are removed from the map. * Keys and values are destroyed using the key and value destructors set up * during map creation. After calling this function the map is empty. */ void cx_map_clear(cx_map *map) { cx_tree_clear(map); return; } /** * @brief * Check whether a map is empty. * * @param map A map. * * @return The function returns @c TRUE if the map is empty, and @c FALSE * otherwise. * * The function checks if the map contains any pairs. Calling this function * is equivalent to the statement: * @code * return (cx_map_size(map) == 0); * @endcode */ cxbool cx_map_empty(const cx_map *map) { return cx_tree_empty(map); } /** * @brief * Create a new map without any elements. * * @param compare Function used to compare keys. * @param key_destroy Destructor for the keys. * @param value_destroy Destructor for the value field. * * @return Handle for the newly allocated map. * * Memory for a new map is allocated and the map is initialized to be a * valid empty map. * * The map's key comparison function is set to @em compare. It must * return @c TRUE or @c FALSE if the comparison of the first argument * passed to it with the second argument is found to be true or false * respectively. * * The destructors for a map node's key and value field are set to * @em key_destroy and @em value_destroy. Whenever a map node is * destroyed these functions are used to deallocate the memory used * by the key and the value. Each of the destructors might be @c NULL, i.e. * keys and values are not deallocated during destroy operations. * * @see cx_map_compare_func() */ cx_map * cx_map_new(cx_map_compare_func compare, cx_free_func key_destroy, cx_free_func value_destroy) { return cx_tree_new(compare, key_destroy, value_destroy); } /** * @brief * Destroy a map and all its elements. * * @param map The map to destroy. * * @return Nothing. * * The map @em map is deallocated. All data values and keys are * deallocated using the map's key and value destructor. If no * key and/or value destructor was set when the @em map was created * the keys and the stored data values are left untouched. In this * case the key and value deallocation is the responsibility of the * user. * * @see cx_map_new() */ void cx_map_delete(cx_map *map) { cx_tree_delete(map); return; } /** * @brief * Get the actual number of pairs in the map. * * @param map A map. * * @return The current number of pairs, or 0 if the map is empty. * * Retrieves the current number of pairs stored in the map. */ cxsize cx_map_size(const cx_map *map) { return cx_tree_size(map); } /** * @brief * Get the maximum number of pairs possible. * * @param map A map. * * @return The maximum number of pairs that can be stored in the map. * * Retrieves the map's capacity, i.e. the maximum possible number of * pairs a map can manage. */ cxsize cx_map_max_size(const cx_map *map) { return cx_tree_max_size(map); } /** * @brief * Retrieve a map's key comparison function. * * @param map The map to query. * * @return Handle for the map's key comparison function. * * The function retrieves the function used by the map methods * for comparing keys. The key comparison function is set during * map creation. * * @see cx_map_new() */ cx_map_compare_func cx_map_key_comp(const cx_map *map) { return cx_tree_key_comp(map); } /** * @brief * Swap the contents of two maps. * * @param map1 First map. * @param map2 Second map. * * @return Nothing. * * All pairs stored in the first map @em map1 are moved to the second map * @em map2, while the pairs from @em map2 are moved to @em map1. Also * the key comparison function, the key and the value destructor are * exchanged. */ void cx_map_swap(cx_map *map1, cx_map *map2) { cx_tree_swap(map1, map2); return; } /** * @brief * Assign data to an iterator position. * * @param map A map. * @param position Iterator positions where the data will be stored. * @param data Data to store. * * @return Handle to the previously stored data object. * * The function assigns a data object reference @em data to the iterator * position @em position of the map @em map. */ cxptr cx_map_assign(cx_map *map, cx_map_iterator position, cxcptr data) { return cx_tree_assign(map, position, data); } /** * @brief * Set the value of a pair matching the given key. * * @param map A map. * @param key The key of the map element to be changed. * @param data Data value to be stored. * * @return Previously stored data value of the (key, value) pair. * * The function replaces the value of the map element with the key @em key * with @em value, if the @em key is present in the map @em map. The old * value of the map element is returned. If the key is not yet present in * the map the pair (@em key, @em data) is inserted in the map. In this case * the returned handle to the previously stored data points to @em data. */ cxptr cx_map_put(cx_map *map, cxcptr key, cxcptr data) { cxptr value = NULL; cx_map_iterator pos; pos = cx_tree_lower_bound(map, key); if (pos == cx_tree_end(map)) { value = (cxptr)data; cx_tree_insert_unique(map, key, value); } else value = cx_tree_assign(map, pos, data); return value; } /** * @brief * Get the key from a given iterator position. * * @param map A map. * @param position Iterator position the data is retrieved from. * * @return Reference for the key. * * The function returns a reference to the key associated with the iterator * position @em position in the map @em map. * * @note * One must not modify the key of @em position through the returned * reference, since this might corrupt the map! */ cxptr cx_map_get_key(const cx_map *map, cx_map_const_iterator position) { return cx_tree_get_key(map, position); } /** * @brief * Get the data from a given iterator position. * * @param map A map. * @param position Iterator position the data is retrieved from. * * @return Handle for the data object. * * The function returns a reference to the data stored at iterator position * @em position in the map @em map. */ cxptr cx_map_get_value(const cx_map *map, cx_map_const_iterator position) { return cx_tree_get_value(map, position); } /** * @brief * Get the data for a given key. * * @param map A map. * @param key Key for which the data should be retrieved. * * @return Handle to the value of the (key, value) pair matching the key * @em key. * * The function looks for the key @em key in the map @em map and returns * the data associated with this key. If @em key is not present in @em map * it is inserted using @c NULL as the associated default value, which is * then returned. */ cxptr cx_map_get(cx_map *map, cxcptr key) { cx_map_iterator i = cx_tree_lower_bound(map, key); cx_map_compare_func keycmp = cx_tree_key_comp(map); if (i == cx_tree_end(map) || keycmp(key, cx_tree_get_key(map, i))) i = cx_tree_insert_unique(map, key, NULL); return cx_tree_get_value(map, i); } /** * @brief * Locate an element in the map. * * @param map A map. * @param key Key of the (key, value) pair to locate. * * @return Iterator pointing to the sought-after element, or @b cx_map_end() * if it was not found. * * The function searches the map @em map for an element with a key * matching @em key. If the search was successful an iterator to the * sought-after pair is returned. If the search did not succeed, i.e. * @em key is not present in the map, a one past the end iterator is * returned. */ cx_map_iterator cx_map_find(const cx_map *map, cxcptr key) { return cx_tree_find(map, key); } /** * @brief * Find the beginning of a subsequence matching a given key. * * @param map A map. * @param key Key of the (key, value) pair(s) to locate. * * @return Iterator pointing to the first position where an element with * key @em key would get inserted, i.e. the first element with a key greater * or equal than @em key. * * The function returns the first element of a subsequence of elements in the * map that match the given key @em key. If @em key is not present in the * map @em map an iterator pointing to the first element that has a greater * key than @em key or @b cx_map_end() if no such element exists. * * @note * For maps, where a key can occur only once, is a call to this function * equivalent to calling @b cx_map_find(). */ cx_map_iterator cx_map_lower_bound(const cx_map *map, cxcptr key) { return cx_tree_lower_bound(map, key); } /** * @brief * Find the end of a subsequence matching a given key. * * @param map A map. * @param key Key of the (key, value) pair(s) to locate. * * @return Iterator pointing to the last position where an element with * key @em key would get inserted, i.e. the first element with a key * greater than @em key. * * The function returns the last element of a subsequence of elements in the * map that match the given key @em key. If @em key is not present in the * map @em map an iterator pointing to the first element that has a greater * key than @em key or @b cx_map_end() if no such element exists. * * @note * For maps, calling this function is equivalent to: * @code * cx_map_iterator it; * * it = cx_map_find(map, key); * it = cx_map_next(map, it); * @endcode * omitting all error checks. */ cx_map_iterator cx_map_upper_bound(const cx_map *map, cxcptr key) { return cx_tree_upper_bound(map, key); } /** * @brief * Find a subsequence matching a given key. * * @param map A map. * @param key The key of the (key, value) pair(s) to be located. * @param begin First element with key @em key. * @param end Last element with key @em key. * * @return Nothing. * * The function returns the beginning and the end of a subsequence of * map elements with the key @em key through through the @em begin and * @em end arguments. After calling this function @em begin possibly points * to the first element of @em map matching the key @em key and @em end * possibly points to the last element of the sequence. If key is not * present in the map @em begin and @em end point to the next greater * element or, if no such element exists, to @b cx_map_end(). */ void cx_map_equal_range(const cx_map *map, cxcptr key, cx_map_iterator *begin, cx_map_iterator *end) { cx_tree_equal_range(map, key, begin, end); return; } /** * @brief * Get the number of elements matching a key. * * @param map A map. * @param key Key of the (key, value) pair(s) to locate. * * @return The number of elements with the specified key. * * Counts all elements of the map @em map matching the key @em key. */ cxsize cx_map_count(const cx_map *map, cxcptr key) { return cx_tree_find(map, key) == cx_tree_end(map) ? 0 : 1; } /** * @brief * Attempt to insert data into a map. * * @param map A map. * @param key Key used to store the data. * @param data Data to insert. * * @return An iterator that points to the inserted pair, or @c NULL if the * pair could not be inserted. * * This function attempts to insert a (key, value) pair into the map * @em map. The insertion fails if the key already present in the map, * since a key may only occur once in a map. */ cx_map_iterator cx_map_insert(cx_map *map, cxcptr key, cxcptr data) { return cx_tree_insert_unique(map, key, data); } /** * @brief * Erase an element from a map. * * @param map A map. * @param position Iterator position of the element to be erased. * * @return Nothing. * * This function erases an element, specified by the iterator @em position, * from @em map. Key and value associated with the erased pair are * deallocated using the map's key and value destructors, provided * they have been set. */ void cx_map_erase_position(cx_map *map, cx_map_iterator position) { cx_tree_erase_position(map, position); return; } /** * @brief * Erase a range of elements from a map. * * @param map A map. * @param begin Iterator pointing to the start of the range to erase. * @param end Iterator pointing to the end of the range to erase. * * @return Nothing. * * This function erases all elements in the range [begin, end) from * the map @em map. Key and value associated with the erased pair(s) are * deallocated using the map's key and value destructors, provided * they have been set. */ void cx_map_erase_range(cx_map *map, cx_map_iterator begin, cx_map_iterator end) { cx_tree_erase_range(map, begin, end); return; } /** * @brief * Erase an element from a map according to the provided key. * * @param map A map. * @param key Key of the element to be erased. * * @return The number of removed elements. * * This function erases the element with the specified key @em key, * from @em map. Key and value associated with the erased pair are * deallocated using the map's key and value destructors, provided * they have been set. * * @note * For maps the the returned number should only be 0 or 1, due to the * nature of maps. */ cxsize cx_map_erase(cx_map *map, cxcptr key) { return cx_tree_erase(map, key); } /**@}*/ cpl-6.4.1/libcext/cext/cxmemory.c0000644000460300003120000003070412105140101013603 00000000000000/* $Id: cxmemory.c,v 1.11 2013-02-08 09:07:13 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-02-08 09:07:13 $ * $Revision: 1.11 $ * $Name: not supported by cvs2svn $ */ /* * Acknowledgements: The cxmemory module implementation was inherited * from GLib (see http://www.gtk.org) and is basically a stripped down * version of the GLib gmem module. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include "cxthread.h" #include "cxmessages.h" #include "cxmemory.h" // TODO: This might be removed in the final version. It is here to switch // between proper locking and sloppy locking until it is decided on // how the final implementation is going to look like. #define CX_MEMORY_ENABLE_STRICT_LOCKING /** * @defgroup cxmemory Memory Management Utilities * * The module provides wrapper routines for the standard C memory management * functions. The wrappers for the system memory allocators guarantee to * always return valid pointer to the allocated memory block of memory. If * the requested memory cannot be allocated the functions stop the program * calling @b abort(), following the philosophy that it is better to * terminate the application immediately when running out of resources. The * memory deallocator is protected against* passing @c NULL. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * Flag indicating if a cx_memory_vtable may be set or not. * A cx_memory_vtable may be set only once during startup! */ static cxbool cx_memory_vtable_lock = FALSE; CX_LOCK_DEFINE_INITIALIZED_STATIC(cx_memory_vtable_lock); /* * Control variable to guarantee that the memory system initialization * function is executed only once! The argument must be the name of the * initialization function. */ CX_ONCE_DEFINE_INITIALIZED_STATIC(cx_memory_once); /* * Internal initialization functions for the memory system. This * function sets the cx_memory_vtable flag indicating whether the * memory services have been initialized. */ inline static void cx_memory_vtable_set_lock(void) { cx_memory_vtable_lock = TRUE; return; } inline static cxbool cx_memory_vtable_locked(void) { return cx_memory_vtable_lock == TRUE; } static void cx_memory_init(void) { CX_LOCK(cx_memory_vtable_lock); if (!cx_memory_vtable_locked()) { cx_memory_vtable_set_lock(); } CX_UNLOCK(cx_memory_vtable_lock); return; } /* * Standard memory services have to be encapsulated in functions, * to allow for assignement and or the comparison of memory services. * Otherwise the HP-UX compiler complains if the prototypes do not * match. Maybe a prototype verifications should be added? */ /* * Define our own version of realloc() in case NULL cannot be passed * to realloc() as first argument. */ #ifdef HAVE_WORKING_REALLOC static cxptr cx_memory_realloc_std(cxptr memory, cxsize nbytes) { return realloc(memory, nbytes); } #else /* !HAVE_WORKING_REALLOC */ static cxptr cx_memory_realloc_std(cxptr memory, cxsize nbytes) { if (!memory) return malloc(nbytes); else return realloc(memory, nbytes); } #endif /* !HAVE_WORKING_REALLOC */ static cxptr cx_memory_malloc_std(cxsize nbytes) { return malloc(nbytes); } static cxptr cx_memory_calloc_std(cxsize natoms, cxsize nbytes) { return calloc(natoms, nbytes); } static void cx_memory_free_std(cxptr memory) { free(memory); return; } /* * Internal allocator vtable initialized to system defaults. */ static cx_memory_vtable cx_memory_services = { cx_memory_malloc_std, cx_memory_calloc_std, cx_memory_realloc_std, cx_memory_free_std, }; /* * Fallback calloc implementation. It utilizes the malloc() implementation * provided by the memory vtable. */ static cxptr cx_memory_calloc_fallback(cxsize natoms, cxsize nbytes) { cxsize sz = natoms * nbytes; cxptr mblk = cx_memory_services.malloc(sz); if (mblk) memset(mblk, 0, sz); return mblk; } /** * @brief * Install a new set of memory managmement functions. * * @param table Set of memory management functions. * * @return Nothing. * * The function installs the replacements for @b malloc(), @b calloc(), * @b realloc() and @b free() provided by @em table in the internal * vtable. * * @attention * The function can be called only @b once before any of the memory * handling functions are called, either explicitly or implicitly through * another library functions! For thread-safety reasons the function may * @b only be called from the @em main thread! */ void cx_memory_vtable_set(const cx_memory_vtable *table) { CX_LOCK(cx_memory_vtable_lock); if (!cx_memory_vtable_locked()) { cx_memory_vtable_set_lock(); if (table->malloc && table->realloc && table->free) { cx_memory_services.malloc = table->malloc; cx_memory_services.realloc = table->realloc; cx_memory_services.free = table->free; cx_memory_services.calloc = (table->calloc ? table->calloc : cx_memory_calloc_fallback); } else { cx_warning(CX_CODE_POS ": Memory allocation vtable lacks one of " "malloc(), realloc() or free()"); } } else { cx_warning(CX_CODE_POS ": Memory allocation vtable can only be set " "once"); } CX_UNLOCK(cx_memory_vtable_lock); return; } /** * @brief * Allocate @em nbytes bytes. * * @param nbytes Number of bytes. * * @return Pointer to the allocated memory block. * * The function allocates @em nbytes bytes of memory. The allocated memory * is not cleared. If the allocation fails the function does not return, * but the program execution is stopped printing a message to the error * channel showing the current code position. * * @see cx_malloc_clear() */ cxptr cx_malloc(cxsize nbytes) { /* * Lock memory vtable on first entry. */ #ifdef CX_MEMORY_ENABLE_STRICT_LOCKING cx_thread_once(cx_memory_once, cx_memory_init, NULL); #else if (!cx_memory_vtable_locked()) { CX_LOCK(cx_memory_vtable_lock); cx_memory_vtable_set_lock(); CX_UNLOCK(cx_memory_vtable_lock); } #endif if (nbytes) { cxptr mblk = cx_memory_services.malloc(nbytes); if (mblk) return mblk; cx_error(CX_CODE_POS ": failed to allocate %" CX_PRINTF_FORMAT_SIZE_TYPE " bytes", nbytes); } return NULL; } /** * @brief * Allocate @em nbytes bytes and clear them * * @param nbytes Number of bytes. * * @return Pointer to the allocated memory block. * * The function works as @b cx_malloc(), but the allocated memory is * cleared, i.e. a 0 is written to each byte of the allocated block. * * @see cx_malloc() * */ cxptr cx_malloc_clear(cxsize nbytes) { /* * Lock memory vtable on first entry. */ #ifdef CX_MEMORY_ENABLE_STRICT_LOCKING cx_thread_once(cx_memory_once, cx_memory_init, NULL); #else if (!cx_memory_vtable_locked()) { CX_LOCK(cx_memory_vtable_lock); cx_memory_vtable_set_lock(); CX_UNLOCK(cx_memory_vtable_lock); } #endif if (nbytes) { cxptr mblk = cx_memory_services.calloc(1, nbytes); if (mblk) return mblk; cx_error(CX_CODE_POS ": failed to allocate %" CX_PRINTF_FORMAT_SIZE_TYPE " bytes", nbytes); } return NULL; } /** * @brief * Allocate memory for @em natoms elements of size @em size. * * @param natoms Number of atomic elements. * @param nbytes Element size in bytes. * * @return Pointer to the allocated memory block. * * The function allocates memory suitable for storage of @em natoms * elements of size @em nbytes bytes. The allocated memory is cleared, * i.e. the value 0 is written to each single byte. If the allocation * fails the function does not return, but the program execution is * stopped printing a message to the error channel showing the current * code position. */ cxptr cx_calloc(cxsize natoms, cxsize nbytes) { /* * Lock memory vtable on first entry. */ #ifdef CX_MEMORY_ENABLE_STRICT_LOCKING cx_thread_once(cx_memory_once, cx_memory_init, NULL); #else if (!cx_memory_vtable_locked()) { CX_LOCK(cx_memory_vtable_lock); cx_memory_vtable_set_lock(); CX_UNLOCK(cx_memory_vtable_lock); } #endif if (natoms && nbytes) { cxptr mblk = cx_memory_services.calloc(natoms, nbytes); if (mblk) return mblk; cx_error(CX_CODE_POS ": failed to allocate %" CX_PRINTF_FORMAT_SIZE_TYPE " bytes", natoms * nbytes); } return NULL; } /** * @brief * Change the size of a memory block. * * @param memory Number of atomic elements. * @param nbytes New memory block size in bytes. * * @return Pointer to the allocated memory block. * * The function changes the size of an already allocated memory block * @em memory to the new size @em nbytes bytes. The contents is unchanged * to the minimum of old and new size; newly allocated memory is not * initialized. If @em memory is @c NULL the call to @b cx_realloc() * is equivalent to @b cx_malloc(), and if @em nbytes is 0 the call * is equivalent to @b cx_free(). Unless @em memory is @c NULL, it must * have been returned by a previous call to @b cx_malloc(), * @b cx_malloc_clear(), @b cx_calloc(), or @b cx_realloc(). * * @note * The returned memory block returned on successfull allocation may * not be the same as the one pointed to by @em memory. Existing * references pointing to locations within the original memory block * might be invalidated! * * @see cx_malloc(), cx_malloc_clear(), cx_calloc() */ cxptr cx_realloc(cxptr memory, cxsize nbytes) { cxptr mblk; /* * Lock memory vtable on first entry. */ #ifdef CX_MEMORY_ENABLE_STRICT_LOCKING cx_thread_once(cx_memory_once, cx_memory_init, NULL); #else if (!cx_memory_vtable_locked()) { CX_LOCK(cx_memory_vtable_lock); cx_memory_vtable_set_lock(); CX_UNLOCK(cx_memory_vtable_lock); } #endif mblk = cx_memory_services.realloc(memory, nbytes); if (mblk == NULL && nbytes != 0) { cx_error(CX_CODE_POS ": failed to allocate %" CX_PRINTF_FORMAT_SIZE_TYPE " bytes", nbytes); } return mblk; } /** * @brief * Memory block deallocation. * * @return Nothing. * * Deallocates a memory block previously allocated by @b cx_malloc(), * @b cx_malloc_clear(), @b cx_calloc(), or @b cx_realloc(). * * @see cx_malloc(), cx_malloc_clear(), cx_calloc() */ void cx_free(cxptr memory) { /* * Lock memory vtable on first entry. */ #ifdef CX_MEMORY_ENABLE_STRICT_LOCKING cx_thread_once(cx_memory_once, cx_memory_init, NULL); #else if (!cx_memory_vtable_locked()) { CX_LOCK(cx_memory_vtable_lock); cx_memory_vtable_set_lock(); CX_UNLOCK(cx_memory_vtable_lock); } #endif if (memory) cx_memory_services.free(memory); return; } /** * @brief * Check if the system's defaults are used for memory allocation. * * @return It returns @c TRUE if memory is allocated through the system's * @b malloc() implementation, it not it returns @c FALSE. * * Checks whether the allocator used by @b cx_malloc() is the system's * malloc implementation. If the system's malloc implementation is used * memory allocated with the system's @b malloc() call can be used * interchangeable with memory allocated by @b cx_malloc(). * * @see cx_memory_vtable_set() */ cxbool cx_memory_is_system_malloc(void) { return cx_memory_services.malloc == cx_memory_malloc_std; } /**@}*/ cpl-6.4.1/libcext/cext/cxutils.h0000644000460300003120000000343211530471603013455 00000000000000/* $Id: cxutils.h,v 1.6 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.6 $ * $Name: not supported by cvs2svn $ */ #ifndef CX_UTILS_H #define CX_UTILS_H #include #include CX_BEGIN_DECLS /* * Static information retrieval */ const cxchar *cx_program_get_name(void); void cx_program_set_name(const cxchar *); cxlong cx_line_max(void); /* * Bit tests */ cxint cx_bits_find(cxuint32, cxint); cxint cx_bits_rfind(cxuint32, cxint); /* * Miscellaneous utility functions */ cxint cx_snprintf(cxchar *, cxsize, const cxchar *, ...) CX_GNUC_PRINTF(3, 4); cxint cx_vsnprintf(cxchar *, cxsize, const cxchar *, va_list) CX_GNUC_PRINTF(3, 0); cxint cx_asprintf(cxchar **, const cxchar *, ...) CX_GNUC_PRINTF(2, 3); cxint cx_vasprintf(cxchar **, const cxchar *, va_list) CX_GNUC_PRINTF(2, 0); cxchar *cx_line_alloc(void); CX_END_DECLS #endif /* CX_UTILS_H */ cpl-6.4.1/libcext/cext/cxstring.c0000644000460300003120000005206612062307646013633 00000000000000/* $Id: cxstring.c,v 1.11 2012-12-13 08:19:50 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-12-13 08:19:50 $ * $Revision: 1.11 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include "cxmemory.h" #include "cxstrutils.h" #include "cxstring.h" /** * @defgroup cxstring Strings * * A @b cx_string is similar to a standard C string, except that it grows * automatically as text is appended or inserted. The character data the * string contains is '\\0' terminated in order to guarantee full * compatibility with string utility functions processing standard C strings. * Together with the character data it also stores the length of the string. */ /**@{*/ /* * Forward declaration. Needed because of attributes specification. */ inline static cxint _cx_string_vsprintf(cx_string *, const cxchar *, va_list) CX_GNUC_PRINTF(2, 0); /* * Create a new, empty string */ inline static cx_string * _cx_string_new(void) { cx_string *self = (cx_string *)cx_malloc(sizeof(cx_string)); self->data = NULL; self->sz = 0; return self; } /* * Sets a string's value from a character array. */ inline static void _cx_string_set(cx_string *self, const cxchar *data) { cx_assert(self != NULL); if (self->data != NULL) { cx_free(self->data); self->data = NULL; self->sz = 0; } if (data) { self->data = cx_strdup(data); cx_assert(self->data != NULL); self->sz = strlen(self->data); } return; } /* * Gets a string's value */ inline static const cxchar * _cx_string_get(const cx_string *self) { return self->data; } /* * Write to a string under format control */ inline static cxint _cx_string_vsprintf(cx_string *string, const cxchar *format, va_list args) { cxint n; cxchar *tmp = NULL; n = cx_vasprintf(&tmp, format, args); if (tmp) { if (string->data != NULL) { cx_free(string->data); } string->data = tmp; string->sz = (cxsize) strlen(tmp); } return n; } /* * Remove leading whitespaces */ inline static cx_string * _cx_string_trim(cx_string *self) { cxchar *tmp = NULL; cxsize i = 0; cx_assert(self != NULL); tmp = self->data; while (*tmp && isspace((cxint)*tmp)) { tmp++; i++; } memmove(self->data, tmp, strlen((cxchar*)tmp) + 1); self->sz -= i; return self; } /* * Remove trailing whitespaces */ inline static cx_string * _cx_string_rtrim(cx_string *self) { cxchar *tmp = NULL; cxsize i = 0; cx_assert(self != NULL); tmp = self->data + self->sz - 1; while (isspace((cxint)*tmp)) { tmp--; i++; } *++tmp = (cxchar) '\0'; self->sz -= i; return self; } /** * @brief * Create a new, initialized string container * * @return Pointer to newly created string. * * The function allocates memory for the string and initializes it, i.e. * the member functions are hooked into the newly created string. * * Using this constructor is the @b only way to correctly create and setup * a new string. */ cx_string * cx_string_new(void) { return _cx_string_new(); } /** * @brief * Create a copy a cx_string. * * @param self The string to copy. * * @return Pointer to the newly created copy of @em string. */ cx_string * cx_string_copy(const cx_string *self) { cx_string *tmp; if (self == NULL) return NULL; tmp = _cx_string_new(); _cx_string_set(tmp, _cx_string_get(self)); return tmp; } /** * @brief * Create a new string from a standard C string. * * @param value The initial text to copy into the string. * * @return Pointer to newly created string. * * A new string is created and the text @em value is initially copied * into the string. */ cx_string * cx_string_create(const cxchar *value) { cx_string *self; self = _cx_string_new(); _cx_string_set(self, value); return self; } /** * @brief * Destroy a string. * * @param self The string to destroy. * * @return Nothing. * * The function deallocates @em string's character buffer and finally * frees the memory allocated for @em string itself. */ void cx_string_delete(cx_string *self) { if (self == NULL) return; if (self->data != NULL) { cx_free(self->data); self->data = NULL; self->sz = 0; } cx_free(self); } /** * @brief * Computes the length of the string. * * @param self The string. * * @return The string's length, or 0 for uninitialized or empty strings. * * Computes the length of the string. */ cxsize cx_string_size(const cx_string *self) { cx_assert(self != NULL); return self->sz; } /** * @brief * Checks whether a string contains any characters. * * @param self The string. * * @return The function returns TRUE if the string is empty, or FALSE * otherwise. * * A string is considered to be empty if its size is 0 or if it has not * been initialized, i.e. no value has been assigned yet. */ cxbool cx_string_empty(const cx_string *self) { cx_assert(self != NULL); if (self->data == NULL) return TRUE; return self->sz == 0 ? TRUE : FALSE; } /** * @brief * Assign a value to a string. * * @param self The string. * @param data Character array to be assigned. * * @return Nothing. * * Stores the contents of the character array pointed to by @em data * into the string. */ void cx_string_set(cx_string *self, const cxchar *data) { if (self == NULL) { return; } _cx_string_set(self, data); return; } /** * @brief * Get the string's value. * * @param self The string. * * @return A constant pointer to the string's @em data member, or @c NULL * if the string is uninitialized. * * A pointer to the strings character data. The character array pointed * to by this pointer is an standard C string, i.e. '\\0' terminated and * can be used together with any string processing function from the * standard C library (but see below). * * @warning * The string's data @b must @b not be modified using the returned * pointer, otherwise the internal consistency may be lost. */ const cxchar * cx_string_get(const cx_string *self) { if (self == NULL) { return NULL; } return _cx_string_get(self); } /** * @brief * Converts the string into uppercase. * * @param self The string. * * @return The passed string @em self with all characters converted to * uppercase, or @c NULL in case of errors. * * All lowercase letters stored in the string are converted to uppercase * letters. The conversion is done using the standard C function * @b toupper(). */ cx_string * cx_string_upper(cx_string *self) { cxsize position = 0; if (self == NULL || self->data == NULL) { return NULL; } for (position = 0; position < self->sz; position++) { self->data[position] = toupper(self->data[position]); } self->data[self->sz] = '\0'; return self; } /** * @brief * Converts the string into lowercase. * * @param self The string. * * @return The passed string @em self with all characters converted to * lowercase, or @c NULL in case of errors. * * All uppercase letters stored in the string are converted to lowercase * letters. The conversion is done using the standard C function * @b tolower(). */ cx_string * cx_string_lower(cx_string *self) { cxsize position = 0; if (self == NULL || self->data == NULL) { return NULL; } for (position = 0; position < self->sz; position++) { self->data[position] = tolower(self->data[position]); } self->data[self->sz] = '\0'; return self; } /** * @brief * Remove leading whitespaces from the string. * * @param self The string. * * @return The passed string @em self with leading whitespaces removed, * or @c NULL in case of errors. * * The function removes leading whitespace characters from the string. * Whitespace characters are recognized by the standard C function * @b isspace(). */ cx_string * cx_string_trim(cx_string *self) { if (self == NULL || self->data == NULL) { return NULL; } return _cx_string_trim(self); } /** * @brief * Remove trailing whitespaces from the string. * * @param self The string. * * @return The passed string @em self with trailing whitespaces revoved, * or @c NULL in case of errors. * * The function removes trailing whitespace characters from the string. * Whitespace characters are recognized by the standard C function * @b isspace(). */ cx_string * cx_string_rtrim(cx_string *self) { if (self == NULL || self->data == NULL) { return NULL; } return _cx_string_rtrim(self); } /** * @brief * Remove leading and trailing whitespaces from the string. * * @param self The string. * * @return The passed string @em self with leading and trailing whitespaces * removed, or @c NULL in case of errors. * * The function removes leading and trailing whitespace characters * from the string. Whitespace characters are recognized by the * standard C function @b isspace(). */ cx_string * cx_string_strip(cx_string *self) { if (self == NULL || self->data == NULL) { return NULL; } return _cx_string_rtrim(_cx_string_trim(self)); } /** * @brief * Prepend an array of characters to the string. * * @param self The string. * @param data Pointer to character array to be prepended. * * @return The passed string @em self with the characters prepended, * or @c NULL in case of errors. * * The function adds the contents of the character buffer @em data to * the beginning of the string. If @em data is a @c NULL pointer the * string @em self is not modified. */ cx_string * cx_string_prepend(cx_string *self, const cxchar *data) { if (self == NULL) { return NULL; } if (data) { cxchar *tmp = NULL; cxsize ts = 0; cxsize lv = 0; lv = (cxsize) strlen(data); ts = self->sz + lv; tmp = (cxchar *) cx_malloc(sizeof(cxchar) * (ts + 1)); strncpy(tmp, data, lv); strncpy(tmp + lv, self->data, self->sz); if (self->data != NULL) { cx_free(self->data); } self->data = tmp; self->sz = ts; self->data[self->sz] = '\0'; } return self; } /** * @brief * Append an array of characters to the string. * * @param self The string. * @param data Pointer to character array to be appended. * * @return The passed string @em self with the characters appended, * or @c NULL in case of errors. * * The function adds the contents of the character buffer @em data to * the end of the string. If @em data is a @c NULL pointer the string * @em self is not modified. */ cx_string * cx_string_append(cx_string *self, const cxchar *data) { if (self == NULL) { return NULL; } if (data) { cxchar *tmp = NULL; cxsize ts = 0; cxsize lv = 0; lv = (cxsize) strlen(data); ts = self->sz + lv; tmp = (cxchar*) cx_malloc(sizeof(cxchar) * (ts + 1)); strncpy(tmp, self->data, self->sz); strncpy(tmp + self->sz, data, lv); if (self->data != NULL) cx_free(self->data); self->data = tmp; self->sz = ts; self->data[self->sz] = '\0'; } return self; } /** * @brief * Inserts a copy of a string at a given position. * * @param self The string. * @param position Character position at which the data is inserted. * @param data Pointer to character array to be inserted. * * @return The passed string @em self with the characters inserted, * or @c NULL in case of errors. * * The function inserts the contents of the character buffer @em data at * the character index @em position into the string, expanding the string * if necessary. Character positions start counting from 0. If @em data is * a @c NULL pointer the string @em self is not modified. */ cx_string * cx_string_insert(cx_string *self, cxssize position, const cxchar *data) { if (self == NULL) { return NULL; } if (position < 0 || position > (cxssize)self->sz) { return NULL; } if (data) { cxchar *tmp = NULL; cxsize vl = (cxsize)strlen(data); tmp = (cxchar *)cx_malloc(sizeof(cxchar) * (self->sz + vl + 1)); strncpy(tmp, self->data, position); strncpy(tmp + position, data, vl); strncpy(tmp + position + vl, self->data + position, self->sz - position); if (self->data != NULL) { cx_free(self->data); } self->data = tmp; self->sz += vl; self->data[self->sz] = '\0'; } return self; } /** * @brief * Erase a portion of the string. * * @param self The string. * @param position Position of the first character to be erased. * @param length Number of characters to erase. * * @return The passed string @em self with the characters removed, or * @c NULL in case of errors. * * The function removes @em length characters from the string starting * at the character index @em position. The number of characters to be * removed is inclusive the character at index @em position. * The characters following the removed portion are shifted to fill * the gap. Character positions start counting from 0. * * If the number of characters to erase @em length is less the @c 0 all * characters starting at @em position up to the end of the string are * erased. */ cx_string * cx_string_erase(cx_string *self, cxssize position, cxssize length) { cxchar *tmp = NULL; if (self == NULL) { return NULL; } if (position < 0 || position > (cxssize)self->sz) { return NULL; } if (length < 0) { length = self->sz - position; } else { if (position + length > (cxssize)self->sz) { return NULL; } } if (position + length < (cxssize)self->sz) { tmp = (cxchar *) cx_malloc(sizeof(cxchar) * (self->sz - length + 1)); strncpy(tmp, self->data, position); strncpy(tmp + position, self->data + position + length, self->sz - (position + length)); if (self->data != NULL) { cx_free(self->data); } self->data = tmp; } self->sz -= length; if (self->data != NULL) { self->data[self->sz] = '\0'; } return self; } /** * @brief * Truncate the string. * * @param self The string. * @param length The length to which the string is truncated. * * @return The truncated string @em self, or @c NULL in case of errors. * * The function removes all characters from the string starting at * the character index @em length up to the end of the string, effectively * truncating the string from its original size to a string of length * @em length. * * Calling the truncate method is equivalent to: * @code * cx_string *s; * * cx_string_erase(s, length, -1); * @endcode */ cx_string * cx_string_truncate(cx_string *self, cxsize length) { if (self == NULL) { return NULL; } self->sz = CX_MIN(length, self->sz); self->data[self->sz] = '\0'; return self; } /** * @brief * Compare two cx_string for equality. * * @param string1 First cx_string. * @param string2 Second cx_string. * * @return TRUE if equal, FALSE if not. * * The function checks whether two strings are equal. Two strings are equal * if their values match on a character by character basis. */ cxbool cx_string_equal(const cx_string *string1, const cx_string *string2) { cxchar *p, *q; cxsize i = string1->sz; if (i != string2->sz) { return FALSE; } p = string1->data; q = string2->data; while (i) { if(*p != *q) { return FALSE; } p++; q++; i--; } return TRUE; } /** * @brief * Compare two strings. * * @param string1 First cx_string. * @param string2 Second cx_string. * * @return The function returns an interger less than, equal to, or greater * than @c 0 if @em string1 is found, respectively, to be less than, to * match, or to be greater than @em string2. * * The function compares @em string2 with @em string in the same way as * the standard C function @b strcmp() does. */ cxint cx_string_compare(const cx_string *string1, const cx_string *string2) { return (cxint) strcmp(string1->data, string2->data); } /** * @brief * Compare two strings ignoring the case of characters. * * @param string1 First cx_string. * @param string2 Second cx_string. * * @return The function returns an interger less than, equal to, or greater * than @c 0 if @em string1 is found, respectively, to be less than, to * match, or to be greater than @em string2. * * The function compares @em string2 with @em string in the same way as * the standard C function @b strcmp() does, but ignores the case of * ASCII characters. */ cxint cx_string_casecmp(const cx_string *string1, const cx_string *string2) { if (string1 == NULL) { return -1; } if (string2 == NULL) { return 1; } return cx_strcasecmp(string1->data, string2->data); } /** * @brief * Compare the first n characters of two strings ignoring the case of * characters. * * @param string1 First string. * @param string2 Second string. * @param n Number of characters to compare. * * @return An integer less than, equal to, or greater than zero if the first * @em n characters of @em string1 are found, respectively, to be less than, * to match, or be greater than the first @em n characters of @em string2. * * The function compares the first @em n characters of the two strings * @em string1 and @em string2 as @b strncmp() does, but ignores the case of * ASCII characters. */ cxint cx_string_ncasecmp(const cx_string *string1, const cx_string *string2, cxsize n) { if (string1 == NULL) return -1; if (string2 == NULL) return 1; return cx_strncasecmp(string1->data, string2->data, n); } /** * @brief * Writes to a string under format control. * * @param self The string to write to. * @param format The format string. * @param ... The arguments to insert into @em format. * * @return The number of characters (excluding the trailing null) written to * @em self, i.e. its length. If sufficient space cannot be allocated, -1 is * returned. * * The function writes the formatted character array to the string. * The function works similar to @b sprintf() function, except that * the string's buffer expands automatically to contain the formatted * result. The previous contents of the string is destroyed. */ cxint cx_string_sprintf(cx_string *self, const char *format, ...) { cxint n; va_list ap; cx_assert(self != NULL); cx_assert(format != NULL); va_start(ap, format); n = _cx_string_vsprintf(self, format, ap); va_end(ap); return n; } /** * @brief * Write to the string from a variable-length argument list under * format control. * * @param self The string. * @param format The format string. * @param args Variable-length arguments to be inserted into @em format. * * @return The number of characters (excluding the trailing null) written to * @em self, i.e. its length. If sufficient space cannot be allocated, -1 is * returned. * * The function writes the formatted character array to the string. * The function works similar to @b vsprintf() function, except that * the string's buffer expands automatically to contain the formatted * result. The previous contents of the string is destroyed. */ cxint cx_string_vsprintf(cx_string *self, const cxchar *format, va_list args) { cx_assert(self != NULL); cx_assert(format != NULL); return _cx_string_vsprintf(self, format, args); } /** * @brief * Print the value of a cx_string to the standard output. * * @param string A cx_string. * * This function is provided for debugging purposes. It just writes the * strings contents to the standard output using @b cx_print(). */ void cx_string_print(const cx_string *string) { if (string == NULL) return; cx_print("%s", _cx_string_get(string)); } /**@}*/ cpl-6.4.1/libcext/cext/cxmacros.h0000644000460300003120000001070411530471603013601 00000000000000/* $Id: cxmacros.h,v 1.7 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.7 $ * $Name: not supported by cvs2svn $ */ /* * This file MUST not include any other cext header file. */ #ifndef CX_MACROS_H #define CX_MACROS_H /* * Get the system's definition of NULL from stddef.h */ #include /* * An alias for __extension__ */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) # define CX_GNUC_EXTENSION __extension__ #else # define CX_GNUC_EXTENSION #endif /* * Macros for the GNU compiler function attributes */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define CX_GNUC_PURE __attribute__((__pure__)) # define CX_GNUC_MALLOC __attribute__((__malloc__)) #else # define G_GNUC_PURE # define G_GNUC_MALLOC #endif #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) # define CX_GNUC_PRINTF(fmt_idx, arg_idx) \ __attribute__((__format__ (__printf__, fmt_idx, arg_idx))) # define CX_GNUC_SCANF(fmt_idx, arg_idx) \ __attribute__((__format__ (__scanf__, fmt_idx, arg_idx))) # define CX_GNUC_FORMAT(arg_idx) __attribute__((__format_arg__ (arg_idx))) # define CX_GNUC_NORETURN __attribute__((__noreturn__)) # define CX_GNUC_CONST __attribute__((__const__)) # define CX_GNUC_UNUSED __attribute__((__unused__)) #else # define CX_GNUC_PRINTF(fmt_idx, arg_idx) # define CX_GNUC_SCANF(fmt_idx, arg_idx) # define CX_GNUC_FORMAT(arg_idx) # define CX_GNUC_NORETURN # define CX_GNUC_CONST # define CX_GNUC_UNUSED #endif /* * Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with macros. */ #if defined (__GNUC__) && (__GNUC__ < 3) # define CX_GNUC_FUNCTION __FUNCTION__ # define CX_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__ #else /* !__GNUC__ */ # define CX_GNUC_FUNCTION "" # define CX_GNUC_PRETTY_FUNCTION "" #endif /* !__GNUC__ */ #define CX_STRINGIFY(macro) CX_STRINGIFY_ARG(macro) #define CX_STRINGIFY_ARG(contents) #contents /* * String identifier for the current code position */ #if defined (__GNUC__) && (__GNUC__ < 3) # define CX_CODE_POS __FILE__ ":" CX_STRINGIFY(__LINE__) ":" __PRETTY_FUNCTION__ "()" #else # define CX_CODE_POS __FILE__ ":" CX_STRINGIFY(__LINE__) #endif /* * Current function identifier */ #if defined (__GNUC__) # define CX_FUNC_NAME ((const char*) (__PRETTY_FUNCTION__)) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L # define CX_FUNC_NAME ((const char*) (__func__)) #else # define CX_FUNC_NAME ((const char*) ("???")) #endif /* * C code guard */ #undef CX_BEGIN_DECLS #undef CX_END_DECLS #ifdef __cplusplus # define CX_BEGIN_DECLS extern "C" { # define CX_END_DECLS } #else # define CX_BEGIN_DECLS /* empty */ # define CX_END_DECLS /* empty */ #endif /* * Some popular macros. If the system provides already a definition for some * of them this definition is used, assuming the definition is correct. */ #ifndef NULL # ifdef __cplusplus # define NULL (0L) # else /* !__cplusplus */ # define NULL ((void *) 0) # endif /* !__cplusplus */ #endif #ifndef FALSE # define FALSE (0) #endif #ifndef TRUE # define TRUE (!FALSE) #endif #ifndef CX_MIN # define CX_MIN(a, b) ((a) < (b) ? (a) : (b)) #endif #ifndef CX_MAX # define CX_MAX(a, b) ((a) > (b) ? (a) : (b)) #endif #ifndef CX_ABS # define CX_ABS(a) ((a) < (0) ? -(a) : (a)) #endif #ifndef CX_CLAMP # define CX_CLAMP(a, low, high) (((a) > (high)) ? (high) : (((a) < (low)) ? (low) : (a))) #endif /* * Number of elements in an array */ #define CX_N_ELEMENTS(array) (sizeof (array) / sizeof ((array)[0])) #endif /* CX_MACROS_H */ cpl-6.4.1/libcext/cext/snprintf.c0000644000460300003120000017247011725436346013644 00000000000000/* $Id: snprintf.c,v 1.10 2012-03-06 16:35:50 rpalsa Exp $ */ /* * Copyright (c) 1995 Patrick Powell. * * This code is based on code written by Patrick Powell . * It may be used for any purpose as long as this notice remains intact on all * source code distributions. */ /* * Copyright (c) 2008 Holger Weiss. * * This version of the code is maintained by Holger Weiss . * My changes to the code may freely be used, modified and/or redistributed for * any purpose. It would be nice if additions and fixes to this file (including * trivial code cleanups) would be sent back in order to let me include them in * the version available at . * However, this is not a requirement for using or redistributing (possibly * modified) versions of this file, nor is leaving this notice intact mandatory. */ /* * History * * 2008-01-20 Holger Weiss for C99-snprintf 1.1: * * Fixed the detection of infinite floating point values on IRIX (and * possibly other systems) and applied another few minor cleanups. * * 2008-01-06 Holger Weiss for C99-snprintf 1.0: * * Added a lot of new features, fixed many bugs, and incorporated various * improvements done by Andrew Tridgell , Russ Allbery * , Hrvoje Niksic , Damien Miller * , and others for the Samba, INN, Wget, and OpenSSH * projects. The additions include: support the "e", "E", "g", "G", and * "F" conversion specifiers (and use conversion style "f" or "F" for the * still unsupported "a" and "A" specifiers); support the "hh", "ll", "j", * "t", and "z" length modifiers; support the "#" flag and the (non-C99) * "'" flag; use localeconv(3) (if available) to get both the current * locale's decimal point character and the separator between groups of * digits; fix the handling of various corner cases of field width and * precision specifications; fix various floating point conversion bugs; * handle infinite and NaN floating point values; don't attempt to write to * the output buffer (which may be NULL) if a size of zero was specified; * check for integer overflow of the field width, precision, and return * values and during the floating point conversion; use the OUTCHAR() macro * instead of a function for better performance; provide asprintf(3) and * vasprintf(3) functions; add new test cases. The replacement functions * have been renamed to use an "rpl_" prefix, the function calls in the * main project (and in this file) must be redefined accordingly for each * replacement function which is needed (by using Autoconf or other means). * Various other minor improvements have been applied and the coding style * was cleaned up for consistency. * * 2007-07-23 Holger Weiss for Mutt 1.5.13: * * C99 compliant snprintf(3) and vsnprintf(3) functions return the number * of characters that would have been written to a sufficiently sized * buffer (excluding the '\0'). The original code simply returned the * length of the resulting output string, so that's been fixed. * * 1998-03-05 Michael Elkins for Mutt 0.90.8: * * The original code assumed that both snprintf(3) and vsnprintf(3) were * missing. Some systems only have snprintf(3) but not vsnprintf(3), so * the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF. * * 1998-01-27 Thomas Roessler for Mutt 0.89i: * * The PGP code was using unsigned hexadecimal formats. Unfortunately, * unsigned formats simply didn't work. * * 1997-10-22 Brandon Long for Mutt 0.87.1: * * Ok, added some minimal floating point support, which means this probably * requires libm on most operating systems. Don't yet support the exponent * (e,E) and sigfig (g,G). Also, fmtint() was pretty badly broken, it just * wasn't being exercised in ways which showed it, so that's been fixed. * Also, formatted the code to Mutt conventions, and removed dead code left * over from the original. Also, there is now a builtin-test, run with: * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm && ./snprintf * * 2996-09-15 Brandon Long for Mutt 0.43: * * This was ugly. It is still ugly. I opted out of floating point * numbers, but the formatter understands just about everything from the * normal C string format, at least as far as I can tell from the Solaris * 2.5 printf(3S) man page. */ /* * ToDo * * - Add wide character support. * - Add support for "%a" and "%A" conversions. * - Create test routines which predefine the expected results. Our test cases * usually expose bugs in system implementations rather than in ours :-) */ /* * Usage * * 1) The following preprocessor macros should be defined to 1 if the feature or * file in question is available on the target system (by using Autoconf or * other means), though basic functionality should be available as long as * HAVE_STDARG_H and HAVE_STDLIB_H are defined correctly: * * HAVE_VSNPRINTF * HAVE_SNPRINTF * HAVE_VASPRINTF * HAVE_ASPRINTF * HAVE_STDARG_H * HAVE_STDDEF_H * HAVE_STDINT_H * HAVE_STDLIB_H * HAVE_INTTYPES_H * HAVE_LOCALE_H * HAVE_LOCALECONV * HAVE_LCONV_DECIMAL_POINT * HAVE_LCONV_THOUSANDS_SEP * HAVE_LONG_DOUBLE * HAVE_LONG_LONG_INT * HAVE_UNSIGNED_LONG_LONG_INT * HAVE_INTMAX_T * HAVE_UINTMAX_T * HAVE_UINTPTR_T * HAVE_PTRDIFF_T * HAVE_VA_COPY * HAVE___VA_COPY * * 2) The calls to the functions which should be replaced must be redefined * throughout the project files (by using Autoconf or other means): * * #define vsnprintf rpl_vsnprintf * #define snprintf rpl_snprintf * #define vasprintf rpl_vasprintf * #define asprintf rpl_asprintf * * 3) The required replacement functions should be declared in some header file * included throughout the project files: * * #if HAVE_CONFIG_H * #include * #endif * #if HAVE_STDARG_H * #include * #if !HAVE_VSNPRINTF * int rpl_vsnprintf(char *, size_t, const char *, va_list); * #endif * #if !HAVE_SNPRINTF * int rpl_snprintf(char *, size_t, const char *, ...); * #endif * #if !HAVE_VASPRINTF * int rpl_vasprintf(char **, const char *, va_list); * #endif * #if !HAVE_ASPRINTF * int rpl_asprintf(char **, const char *, ...); * #endif * #endif * * Autoconf macros for handling step 1 and step 2 are available at * . */ #if HAVE_CONFIG_H # include #endif #if defined(TEST_SNPRINTF) #include /* For pow(3), NAN, and INFINITY. */ #include /* For strcmp(3). */ #if defined(__NetBSD__) || \ defined(__FreeBSD__) || \ defined(__OpenBSD__) || \ defined(__NeXT__) || \ defined(__bsd__) #define OS_BSD 1 #elif defined(sgi) || defined(__sgi) #ifndef __c99 #define __c99 /* Force C99 mode to get included on IRIX 6.5.30. */ #endif /* !defined(__c99) */ #define OS_IRIX 1 #define OS_SYSV 1 #elif defined(__svr4__) #define OS_SYSV 1 #elif defined(__linux__) #define OS_LINUX 1 #endif /* defined(__NetBSD__) || defined(__FreeBSD__) || [...] */ #if HAVE_CONFIG_H /* Undefine definitions possibly done in config.h. */ #ifdef HAVE_SNPRINTF #undef HAVE_SNPRINTF #endif /* defined(HAVE_SNPRINTF) */ #ifdef HAVE_VSNPRINTF #undef HAVE_VSNPRINTF #endif /* defined(HAVE_VSNPRINTF) */ #ifdef HAVE_ASPRINTF #undef HAVE_ASPRINTF #endif /* defined(HAVE_ASPRINTF) */ #ifdef HAVE_VASPRINTF #undef HAVE_VASPRINTF #endif /* defined(HAVE_VASPRINTF) */ #ifdef snprintf #undef snprintf #endif /* defined(snprintf) */ #ifdef vsnprintf #undef vsnprintf #endif /* defined(vsnprintf) */ #ifdef asprintf #undef asprintf #endif /* defined(asprintf) */ #ifdef vasprintf #undef vasprintf #endif /* defined(vasprintf) */ #else /* By default, we assume a modern system for testing. */ #ifndef HAVE_STDARG_H #define HAVE_STDARG_H 1 #endif /* HAVE_STDARG_H */ #ifndef HAVE_STDDEF_H #define HAVE_STDDEF_H 1 #endif /* HAVE_STDDEF_H */ #ifndef HAVE_STDINT_H #define HAVE_STDINT_H 1 #endif /* HAVE_STDINT_H */ #ifndef HAVE_STDLIB_H #define HAVE_STDLIB_H 1 #endif /* HAVE_STDLIB_H */ #ifndef HAVE_INTTYPES_H #define HAVE_INTTYPES_H 1 #endif /* HAVE_INTTYPES_H */ #ifndef HAVE_LOCALE_H #define HAVE_LOCALE_H 1 #endif /* HAVE_LOCALE_H */ #ifndef HAVE_LOCALECONV #define HAVE_LOCALECONV 1 #endif /* !defined(HAVE_LOCALECONV) */ #ifndef HAVE_LCONV_DECIMAL_POINT #define HAVE_LCONV_DECIMAL_POINT 1 #endif /* HAVE_LCONV_DECIMAL_POINT */ #ifndef HAVE_LCONV_THOUSANDS_SEP #define HAVE_LCONV_THOUSANDS_SEP 1 #endif /* HAVE_LCONV_THOUSANDS_SEP */ #ifndef HAVE_LONG_DOUBLE #define HAVE_LONG_DOUBLE 1 #endif /* !defined(HAVE_LONG_DOUBLE) */ #ifndef HAVE_LONG_LONG_INT #define HAVE_LONG_LONG_INT 1 #endif /* !defined(HAVE_LONG_LONG_INT) */ #ifndef HAVE_UNSIGNED_LONG_LONG_INT #define HAVE_UNSIGNED_LONG_LONG_INT 1 #endif /* !defined(HAVE_UNSIGNED_LONG_LONG_INT) */ #ifndef HAVE_INTMAX_T #define HAVE_INTMAX_T 1 #endif /* !defined(HAVE_INTMAX_T) */ #ifndef HAVE_UINTMAX_T #define HAVE_UINTMAX_T 1 #endif /* !defined(HAVE_UINTMAX_T) */ #ifndef HAVE_UINTPTR_T #define HAVE_UINTPTR_T 1 #endif /* !defined(HAVE_UINTPTR_T) */ #ifndef HAVE_PTRDIFF_T #define HAVE_PTRDIFF_T 1 #endif /* !defined(HAVE_PTRDIFF_T) */ #ifndef HAVE_VA_COPY #define HAVE_VA_COPY 1 #endif /* !defined(HAVE_VA_COPY) */ #ifndef HAVE___VA_COPY #define HAVE___VA_COPY 1 #endif /* !defined(HAVE___VA_COPY) */ #endif /* HAVE_CONFIG_H */ #define snprintf rpl_snprintf #define vsnprintf rpl_vsnprintf #define asprintf rpl_asprintf #define vasprintf rpl_vasprintf #else #include "snprintf.h" #endif /* TEST_SNPRINTF */ #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) || \ !defined(HAVE_ASPRINTF) || !defined(HAVE_VASPRINTF) #include /* For NULL, size_t, vsnprintf(3), and vasprintf(3). */ #ifdef VA_START #undef VA_START #endif /* defined(VA_START) */ #ifdef VA_SHIFT #undef VA_SHIFT #endif /* defined(VA_SHIFT) */ #ifdef HAVE_STDARG_H #include #define VA_START(ap, last) va_start(ap, last) #define VA_SHIFT(ap, value, type) /* No-op for ANSI C. */ #else /* Assume is available. */ #include #define VA_START(ap, last) va_start(ap) /* "last" is ignored. */ #define VA_SHIFT(ap, value, type) value = va_arg(ap, type) #endif /* HAVE_STDARG_H */ #if !defined(HAVE_VASPRINTF) #ifdef HAVE_STDLIB_H #include /* For malloc(3). */ #endif /* HAVE_STDLIB_H */ #ifdef VA_COPY #undef VA_COPY #endif /* defined(VA_COPY) */ #ifdef VA_END_COPY #undef VA_END_COPY #endif /* defined(VA_END_COPY) */ #if defined(HAVE_VA_COPY) #define VA_COPY(dest, src) va_copy(dest, src) #define VA_END_COPY(ap) va_end(ap) #elif defined(HAVE___VA_COPY) #define VA_COPY(dest, src) __va_copy(dest, src) #define VA_END_COPY(ap) va_end(ap) #else #define VA_COPY(dest, src) (void)mymemcpy(&dest, &src, sizeof(va_list)) #define VA_END_COPY(ap) /* No-op. */ #define NEED_MYMEMCPY 1 static void *mymemcpy(void *, void *, size_t); #endif /* HAVE_VA_COPY */ #endif /* !HAVE_VASPRINTF */ #if !defined(HAVE_VSNPRINTF) #include /* For ERANGE and errno. */ #include /* For *_MAX. */ #ifdef HAVE_INTTYPES_H #include /* For intmax_t (if not defined in ). */ #endif /* HAVE_INTTYPES_H */ #ifdef HAVE_LOCALE_H #include /* For localeconv(3). */ #endif /* HAVE_LOCALE_H */ #ifdef HAVE_STDDEF_H #include /* For ptrdiff_t. */ #endif /* HAVE_STDDEF_H */ #ifdef HAVE_STDINT_H #include /* For intmax_t. */ #endif /* HAVE_STDINT_H */ /* Support for unsigned long long int. We may also need ULLONG_MAX. */ #ifndef ULONG_MAX /* We may need ULONG_MAX as a fallback. */ #ifdef UINT_MAX #define ULONG_MAX UINT_MAX #else #define ULONG_MAX INT_MAX #endif /* defined(UINT_MAX) */ #endif /* !defined(ULONG_MAX) */ #ifdef ULLONG #undef ULLONG #endif /* defined(ULLONG) */ #ifdef HAVE_UNSIGNED_LONG_LONG_INT #define ULLONG unsigned long long int #ifndef ULLONG_MAX #define ULLONG_MAX ULONG_MAX #endif /* !defined(ULLONG_MAX) */ #else #define ULLONG unsigned long int #ifdef ULLONG_MAX #undef ULLONG_MAX #endif /* defined(ULLONG_MAX) */ #define ULLONG_MAX ULONG_MAX #endif /* HAVE_LONG_LONG_INT */ /* Support for uintmax_t. We also need UINTMAX_MAX. */ #ifdef UINTMAX_T #undef UINTMAX_T #endif /* defined(UINTMAX_T) */ #if defined(HAVE_UINTMAX_T) || defined(uintmax_t) #define UINTMAX_T uintmax_t #ifndef UINTMAX_MAX #define UINTMAX_MAX ULLONG_MAX #endif /* !defined(UINTMAX_MAX) */ #else #define UINTMAX_T ULLONG #ifdef UINTMAX_MAX #undef UINTMAX_MAX #endif /* defined(UINTMAX_MAX) */ #define UINTMAX_MAX ULLONG_MAX #endif /* HAVE_UINTMAX_T || defined(uintmax_t) */ /* Support for long double. */ #ifndef LDOUBLE #ifdef HAVE_LONG_DOUBLE #define LDOUBLE long double #else #define LDOUBLE double #endif /* HAVE_LONG_DOUBLE */ #endif /* !defined(LDOUBLE) */ /* Support for long long int. */ #ifndef LLONG #ifdef HAVE_LONG_LONG_INT #define LLONG long long int #else #define LLONG long int #endif /* HAVE_LONG_LONG_INT */ #endif /* !defined(LLONG) */ /* Support for intmax_t. */ #ifndef INTMAX_T #if defined(HAVE_INTMAX_T) || defined(intmax_t) #define INTMAX_T intmax_t #else #define INTMAX_T LLONG #endif /* HAVE_INTMAX_T || defined(intmax_t) */ #endif /* !defined(INTMAX_T) */ /* Support for uintptr_t. */ #ifndef UINTPTR_T #if defined(HAVE_UINTPTR_T) || defined(uintptr_t) #define UINTPTR_T uintptr_t #else #define UINTPTR_T unsigned long int #endif /* HAVE_UINTPTR_T || defined(uintptr_t) */ #endif /* !defined(UINTPTR_T) */ /* Support for ptrdiff_t. */ #ifndef PTRDIFF_T #if defined(HAVE_PTRDIFF_T) || defined(ptrdiff_t) #define PTRDIFF_T ptrdiff_t #else #define PTRDIFF_T long int #endif /* HAVE_PTRDIFF_T || defined(ptrdiff_t) */ #endif /* !defined(PTRDIFF_T) */ /* * We need an unsigned integer type corresponding to ptrdiff_t (cf. C99: * 7.19.6.1, 7). However, we'll simply use PTRDIFF_T and convert it to an * unsigned type if necessary. This should work just fine in practice. */ #ifndef UPTRDIFF_T #define UPTRDIFF_T PTRDIFF_T #endif /* !defined(UPTRDIFF_T) */ /* * We need a signed integer type corresponding to size_t (cf. C99: 7.19.6.1, 7). * However, we'll simply use size_t and convert it to a signed type if * necessary. This should work just fine in practice. */ #ifndef SSIZE_T #define SSIZE_T size_t #endif /* !defined(SSIZE_T) */ /* Either ERANGE or E2BIG should be available everywhere. */ #ifndef ERANGE #define ERANGE E2BIG #endif /* !defined(ERANGE) */ #ifndef EOVERFLOW #define EOVERFLOW ERANGE #endif /* !defined(EOVERFLOW) */ /* * Buffer size to hold the octal string representation of UINT128_MAX without * nul-termination ("3777777777777777777777777777777777777777777"). */ #ifdef MAX_CONVERT_LENGTH #undef MAX_CONVERT_LENGTH #endif /* defined(MAX_CONVERT_LENGTH) */ #define MAX_CONVERT_LENGTH 43 /* Format read states. */ #define PRINT_S_DEFAULT 0 #define PRINT_S_FLAGS 1 #define PRINT_S_WIDTH 2 #define PRINT_S_DOT 3 #define PRINT_S_PRECISION 4 #define PRINT_S_MOD 5 #define PRINT_S_CONV 6 /* Format flags. */ #define PRINT_F_MINUS (1 << 0) #define PRINT_F_PLUS (1 << 1) #define PRINT_F_SPACE (1 << 2) #define PRINT_F_NUM (1 << 3) #define PRINT_F_ZERO (1 << 4) #define PRINT_F_QUOTE (1 << 5) #define PRINT_F_UP (1 << 6) #define PRINT_F_UNSIGNED (1 << 7) #define PRINT_F_TYPE_G (1 << 8) #define PRINT_F_TYPE_E (1 << 9) /* Conversion flags. */ #define PRINT_C_CHAR 1 #define PRINT_C_SHORT 2 #define PRINT_C_LONG 3 #define PRINT_C_LLONG 4 #define PRINT_C_LDOUBLE 5 #define PRINT_C_SIZE 6 #define PRINT_C_PTRDIFF 7 #define PRINT_C_INTMAX 8 #ifndef MAX #define MAX(x, y) ((x >= y) ? x : y) #endif /* !defined(MAX) */ #ifndef CHARTOINT #define CHARTOINT(ch) (ch - '0') #endif /* !defined(CHARTOINT) */ #ifndef ISDIGIT #define ISDIGIT(ch) ('0' <= (unsigned char)ch && (unsigned char)ch <= '9') #endif /* !defined(ISDIGIT) */ #ifndef ISNAN #define ISNAN(x) (x != x) #endif /* !defined(ISNAN) */ #ifndef ISINF #define ISINF(x) (x != 0.0 && x + x == x) #endif /* !defined(ISINF) */ #ifdef OUTCHAR #undef OUTCHAR #endif /* defined(OUTCHAR) */ #define OUTCHAR(str, len, size, ch) \ do { \ if (len + 1 < size) \ str[len] = ch; \ (len)++; \ } while (/* CONSTCOND */ 0) static void fmtstr(char *, size_t *, size_t, const char *, int, int, int); static void fmtint(char *, size_t *, size_t, INTMAX_T, int, int, int, int); static void fmtflt(char *, size_t *, size_t, LDOUBLE, int, int, int, int *); static void printsep(char *, size_t *, size_t); static int getnumsep(int); static int getexponent(LDOUBLE); static int convert(UINTMAX_T, char *, size_t, int, int); static UINTMAX_T cast(LDOUBLE); static UINTMAX_T myround(LDOUBLE); static LDOUBLE mypow10(int); extern int errno; int rpl_vsnprintf(char *str, size_t size, const char *format, va_list args) { LDOUBLE fvalue; INTMAX_T value; unsigned char cvalue; const char *strvalue; INTMAX_T *intmaxptr; PTRDIFF_T *ptrdiffptr; SSIZE_T *sizeptr; LLONG *llongptr; long int *longptr; int *intptr; short int *shortptr; signed char *charptr; size_t len = 0; int overflow = 0; int base = 0; int cflags = 0; int flags = 0; int width = 0; int precision = -1; int state = PRINT_S_DEFAULT; char ch = *format++; /* * C99 says: "If `n' is zero, nothing is written, and `s' may be a null * pointer." (7.19.6.5, 2) We're forgiving and allow a NULL pointer * even if a size larger than zero was specified. At least NetBSD's * snprintf(3) does the same, as well as other versions of this file. * (Though some of these versions will write to a non-NULL buffer even * if a size of zero was specified, which violates the standard.) */ if (str == NULL && size != 0) size = 0; while (ch != '\0') switch (state) { case PRINT_S_DEFAULT: if (ch == '%') state = PRINT_S_FLAGS; else OUTCHAR(str, len, size, ch); ch = *format++; break; case PRINT_S_FLAGS: switch (ch) { case '-': flags |= PRINT_F_MINUS; ch = *format++; break; case '+': flags |= PRINT_F_PLUS; ch = *format++; break; case ' ': flags |= PRINT_F_SPACE; ch = *format++; break; case '#': flags |= PRINT_F_NUM; ch = *format++; break; case '0': flags |= PRINT_F_ZERO; ch = *format++; break; case '\'': /* SUSv2 flag (not in C99). */ flags |= PRINT_F_QUOTE; ch = *format++; break; default: state = PRINT_S_WIDTH; break; } break; case PRINT_S_WIDTH: if (ISDIGIT(ch)) { ch = CHARTOINT(ch); if (width > (INT_MAX - ch) / 10) { overflow = 1; goto out; } width = 10 * width + ch; ch = *format++; } else if (ch == '*') { /* * C99 says: "A negative field width argument is * taken as a `-' flag followed by a positive * field width." (7.19.6.1, 5) */ if ((width = va_arg(args, int)) < 0) { flags |= PRINT_F_MINUS; width = -width; } ch = *format++; state = PRINT_S_DOT; } else state = PRINT_S_DOT; break; case PRINT_S_DOT: if (ch == '.') { state = PRINT_S_PRECISION; ch = *format++; } else state = PRINT_S_MOD; break; case PRINT_S_PRECISION: if (precision == -1) precision = 0; if (ISDIGIT(ch)) { ch = CHARTOINT(ch); if (precision > (INT_MAX - ch) / 10) { overflow = 1; goto out; } precision = 10 * precision + ch; ch = *format++; } else if (ch == '*') { /* * C99 says: "A negative precision argument is * taken as if the precision were omitted." * (7.19.6.1, 5) */ if ((precision = va_arg(args, int)) < 0) precision = -1; ch = *format++; state = PRINT_S_MOD; } else state = PRINT_S_MOD; break; case PRINT_S_MOD: switch (ch) { case 'h': ch = *format++; if (ch == 'h') { /* It's a char. */ ch = *format++; cflags = PRINT_C_CHAR; } else cflags = PRINT_C_SHORT; break; case 'l': ch = *format++; if (ch == 'l') { /* It's a long long. */ ch = *format++; cflags = PRINT_C_LLONG; } else cflags = PRINT_C_LONG; break; case 'L': cflags = PRINT_C_LDOUBLE; ch = *format++; break; case 'j': cflags = PRINT_C_INTMAX; ch = *format++; break; case 't': cflags = PRINT_C_PTRDIFF; ch = *format++; break; case 'z': cflags = PRINT_C_SIZE; ch = *format++; break; } state = PRINT_S_CONV; break; case PRINT_S_CONV: switch (ch) { case 'd': /* FALLTHROUGH */ case 'i': switch (cflags) { case PRINT_C_CHAR: value = (signed char)va_arg(args, int); break; case PRINT_C_SHORT: value = (short int)va_arg(args, int); break; case PRINT_C_LONG: value = va_arg(args, long int); break; case PRINT_C_LLONG: value = va_arg(args, LLONG); break; case PRINT_C_SIZE: value = va_arg(args, SSIZE_T); break; case PRINT_C_INTMAX: value = va_arg(args, INTMAX_T); break; case PRINT_C_PTRDIFF: value = va_arg(args, PTRDIFF_T); break; default: value = va_arg(args, int); break; } fmtint(str, &len, size, value, 10, width, precision, flags); break; case 'X': flags |= PRINT_F_UP; /* FALLTHROUGH */ case 'x': base = 16; /* FALLTHROUGH */ case 'o': if (base == 0) base = 8; /* FALLTHROUGH */ case 'u': if (base == 0) base = 10; flags |= PRINT_F_UNSIGNED; switch (cflags) { case PRINT_C_CHAR: value = (unsigned char)va_arg(args, unsigned int); break; case PRINT_C_SHORT: value = (unsigned short int)va_arg(args, unsigned int); break; case PRINT_C_LONG: value = va_arg(args, unsigned long int); break; case PRINT_C_LLONG: value = va_arg(args, ULLONG); break; case PRINT_C_SIZE: value = va_arg(args, size_t); break; case PRINT_C_INTMAX: value = va_arg(args, UINTMAX_T); break; case PRINT_C_PTRDIFF: value = va_arg(args, UPTRDIFF_T); break; default: value = va_arg(args, unsigned int); break; } fmtint(str, &len, size, value, base, width, precision, flags); break; case 'A': /* Not yet supported, we'll use "%F". */ /* FALLTHROUGH */ case 'F': flags |= PRINT_F_UP; case 'a': /* Not yet supported, we'll use "%f". */ /* FALLTHROUGH */ case 'f': if (cflags == PRINT_C_LDOUBLE) fvalue = va_arg(args, LDOUBLE); else fvalue = va_arg(args, double); fmtflt(str, &len, size, fvalue, width, precision, flags, &overflow); if (overflow) goto out; break; case 'E': flags |= PRINT_F_UP; /* FALLTHROUGH */ case 'e': flags |= PRINT_F_TYPE_E; if (cflags == PRINT_C_LDOUBLE) fvalue = va_arg(args, LDOUBLE); else fvalue = va_arg(args, double); fmtflt(str, &len, size, fvalue, width, precision, flags, &overflow); if (overflow) goto out; break; case 'G': flags |= PRINT_F_UP; /* FALLTHROUGH */ case 'g': flags |= PRINT_F_TYPE_G; if (cflags == PRINT_C_LDOUBLE) fvalue = va_arg(args, LDOUBLE); else fvalue = va_arg(args, double); /* * If the precision is zero, it is treated as * one (cf. C99: 7.19.6.1, 8). */ if (precision == 0) precision = 1; fmtflt(str, &len, size, fvalue, width, precision, flags, &overflow); if (overflow) goto out; break; case 'c': cvalue = va_arg(args, int); OUTCHAR(str, len, size, cvalue); break; case 's': strvalue = va_arg(args, char *); fmtstr(str, &len, size, strvalue, width, precision, flags); break; case 'p': /* * C99 says: "The value of the pointer is * converted to a sequence of printing * characters, in an implementation-defined * manner." (C99: 7.19.6.1, 8) */ if ((strvalue = va_arg(args, void *)) == NULL) /* * We use the glibc format. BSD prints * "0x0", SysV "0". */ fmtstr(str, &len, size, "(nil)", width, -1, flags); else { /* * We use the BSD/glibc format. SysV * omits the "0x" prefix (which we emit * using the PRINT_F_NUM flag). */ flags |= PRINT_F_NUM; flags |= PRINT_F_UNSIGNED; fmtint(str, &len, size, (UINTPTR_T)strvalue, 16, width, precision, flags); } break; case 'n': switch (cflags) { case PRINT_C_CHAR: charptr = va_arg(args, signed char *); *charptr = len; break; case PRINT_C_SHORT: shortptr = va_arg(args, short int *); *shortptr = len; break; case PRINT_C_LONG: longptr = va_arg(args, long int *); *longptr = len; break; case PRINT_C_LLONG: llongptr = va_arg(args, LLONG *); *llongptr = len; break; case PRINT_C_SIZE: /* * C99 says that with the "z" length * modifier, "a following `n' conversion * specifier applies to a pointer to a * signed integer type corresponding to * size_t argument." (7.19.6.1, 7) */ sizeptr = va_arg(args, SSIZE_T *); *sizeptr = len; break; case PRINT_C_INTMAX: intmaxptr = va_arg(args, INTMAX_T *); *intmaxptr = len; break; case PRINT_C_PTRDIFF: ptrdiffptr = va_arg(args, PTRDIFF_T *); *ptrdiffptr = len; break; default: intptr = va_arg(args, int *); *intptr = len; break; } break; case '%': /* Print a "%" character verbatim. */ OUTCHAR(str, len, size, ch); break; default: /* Skip other characters. */ break; } ch = *format++; state = PRINT_S_DEFAULT; base = cflags = flags = width = 0; precision = -1; break; } out: if (len < size) str[len] = '\0'; else if (size > 0) str[size - 1] = '\0'; if (overflow || len >= INT_MAX) { errno = overflow ? EOVERFLOW : ERANGE; return -1; } return (int)len; } static void fmtstr(char *str, size_t *len, size_t size, const char *value, int width, int precision, int flags) { int padlen, strln; /* Amount to pad. */ int noprecision = (precision == -1); if (value == NULL) /* We're forgiving. */ value = "(null)"; /* If a precision was specified, don't read the string past it. */ for (strln = 0; value[strln] != '\0' && (noprecision || strln < precision); strln++) continue; if ((padlen = width - strln) < 0) padlen = 0; if (flags & PRINT_F_MINUS) /* Left justify. */ padlen = -padlen; while (padlen > 0) { /* Leading spaces. */ OUTCHAR(str, *len, size, ' '); padlen--; } while (*value != '\0' && (noprecision || precision-- > 0)) { OUTCHAR(str, *len, size, *value); value++; } while (padlen < 0) { /* Trailing spaces. */ OUTCHAR(str, *len, size, ' '); padlen++; } } static void fmtint(char *str, size_t *len, size_t size, INTMAX_T value, int base, int width, int precision, int flags) { UINTMAX_T uvalue; char iconvert[MAX_CONVERT_LENGTH]; char sign = 0; char hexprefix = 0; int spadlen = 0; /* Amount to space pad. */ int zpadlen = 0; /* Amount to zero pad. */ int pos; int separators = (flags & PRINT_F_QUOTE); int noprecision = (precision == -1); if (flags & PRINT_F_UNSIGNED) uvalue = value; else { uvalue = (value >= 0) ? value : -value; if (value < 0) sign = '-'; else if (flags & PRINT_F_PLUS) /* Do a sign. */ sign = '+'; else if (flags & PRINT_F_SPACE) sign = ' '; } pos = convert(uvalue, iconvert, sizeof(iconvert), base, flags & PRINT_F_UP); if (flags & PRINT_F_NUM && uvalue != 0) { /* * C99 says: "The result is converted to an `alternative form'. * For `o' conversion, it increases the precision, if and only * if necessary, to force the first digit of the result to be a * zero (if the value and precision are both 0, a single 0 is * printed). For `x' (or `X') conversion, a nonzero result has * `0x' (or `0X') prefixed to it." (7.19.6.1, 6) */ switch (base) { case 8: if (precision <= pos) precision = pos + 1; break; case 16: hexprefix = (flags & PRINT_F_UP) ? 'X' : 'x'; break; } } if (separators) /* Get the number of group separators we'll print. */ separators = getnumsep(pos); zpadlen = precision - pos - separators; spadlen = width /* Minimum field width. */ - separators /* Number of separators. */ - MAX(precision, pos) /* Number of integer digits. */ - ((sign != 0) ? 1 : 0) /* Will we print a sign? */ - ((hexprefix != 0) ? 2 : 0); /* Will we print a prefix? */ if (zpadlen < 0) zpadlen = 0; if (spadlen < 0) spadlen = 0; /* * C99 says: "If the `0' and `-' flags both appear, the `0' flag is * ignored. For `d', `i', `o', `u', `x', and `X' conversions, if a * precision is specified, the `0' flag is ignored." (7.19.6.1, 6) */ if (flags & PRINT_F_MINUS) /* Left justify. */ spadlen = -spadlen; else if (flags & PRINT_F_ZERO && noprecision) { zpadlen += spadlen; spadlen = 0; } while (spadlen > 0) { /* Leading spaces. */ OUTCHAR(str, *len, size, ' '); spadlen--; } if (sign != 0) /* Sign. */ OUTCHAR(str, *len, size, sign); if (hexprefix != 0) { /* A "0x" or "0X" prefix. */ OUTCHAR(str, *len, size, '0'); OUTCHAR(str, *len, size, hexprefix); } while (zpadlen > 0) { /* Leading zeros. */ OUTCHAR(str, *len, size, '0'); zpadlen--; } while (pos > 0) { /* The actual digits. */ pos--; OUTCHAR(str, *len, size, iconvert[pos]); if (separators > 0 && pos > 0 && pos % 3 == 0) printsep(str, len, size); } while (spadlen < 0) { /* Trailing spaces. */ OUTCHAR(str, *len, size, ' '); spadlen++; } } static void fmtflt(char *str, size_t *len, size_t size, LDOUBLE fvalue, int width, int precision, int flags, int *overflow) { LDOUBLE ufvalue; UINTMAX_T intpart; UINTMAX_T fracpart; UINTMAX_T mask; const char *infnan = NULL; char iconvert[MAX_CONVERT_LENGTH]; char fconvert[MAX_CONVERT_LENGTH]; char econvert[4]; /* "e-12" (without nul-termination). */ char esign = 0; char sign = 0; int leadfraczeros = 0; int exponent = 0; int emitpoint = 0; int omitzeros = 0; int omitcount = 0; int padlen = 0; int epos = 0; int fpos = 0; int ipos = 0; int separators = (flags & PRINT_F_QUOTE); int estyle = (flags & PRINT_F_TYPE_E); #if defined(HAVE_LOCALECONV) && defined(HAVE_LCONV_DECIMAL_POINT) struct lconv *lc = localeconv(); #endif /* HAVE_LOCALECONV && HAVE_LCONV_DECIMAL_POINT */ /* * AIX' man page says the default is 0, but C99 and at least Solaris' * and NetBSD's man pages say the default is 6, and sprintf(3) on AIX * defaults to 6. */ if (precision == -1) precision = 6; if (fvalue < 0.0) sign = '-'; else if (flags & PRINT_F_PLUS) /* Do a sign. */ sign = '+'; else if (flags & PRINT_F_SPACE) sign = ' '; if (ISNAN(fvalue)) infnan = (flags & PRINT_F_UP) ? "NAN" : "nan"; else if (ISINF(fvalue)) infnan = (flags & PRINT_F_UP) ? "INF" : "inf"; if (infnan != NULL) { if (sign != 0) iconvert[ipos++] = sign; while (*infnan != '\0') iconvert[ipos++] = *infnan++; fmtstr(str, len, size, iconvert, width, ipos, flags); return; } /* "%e" (or "%E") or "%g" (or "%G") conversion. */ if (flags & PRINT_F_TYPE_E || flags & PRINT_F_TYPE_G) { if (flags & PRINT_F_TYPE_G) { /* * For "%g" (and "%G") conversions, the precision * specifies the number of significant digits, which * includes the digits in the integer part. The * conversion will or will not be using "e-style" (like * "%e" or "%E" conversions) depending on the precision * and on the exponent. However, the exponent can be * affected by rounding the converted value, so we'll * leave this decision for later. Until then, we'll * assume that we're going to do an "e-style" conversion * (in order to get the exponent calculated). For * "e-style", the precision must be decremented by one. */ precision--; /* * For "%g" (and "%G") conversions, trailing zeros are * removed from the fractional portion of the result * unless the "#" flag was specified. */ if (!(flags & PRINT_F_NUM)) omitzeros = 1; } exponent = getexponent(fvalue); estyle = 1; } again: /* * Sorry, we only support 9, 19, or 38 digits (that is, the number of * digits of the 32-bit, the 64-bit, or the 128-bit UINTMAX_MAX value * minus one) past the decimal point due to our conversion method. */ switch (sizeof(UINTMAX_T)) { case 16: if (precision > 38) precision = 38; break; case 8: if (precision > 19) precision = 19; break; default: if (precision > 9) precision = 9; break; } ufvalue = (fvalue >= 0.0) ? fvalue : -fvalue; if (estyle) /* We want exactly one integer digit. */ ufvalue /= mypow10(exponent); if ((intpart = cast(ufvalue)) == UINTMAX_MAX) { *overflow = 1; return; } /* * Factor of ten with the number of digits needed for the fractional * part. For example, if the precision is 3, the mask will be 1000. */ mask = mypow10(precision); /* * We "cheat" by converting the fractional part to integer by * multiplying by a factor of ten. */ if ((fracpart = myround(mask * (ufvalue - intpart))) >= mask) { /* * For example, ufvalue = 2.99962, intpart = 2, and mask = 1000 * (because precision = 3). Now, myround(1000 * 0.99962) will * return 1000. So, the integer part must be incremented by one * and the fractional part must be set to zero. */ intpart++; fracpart = 0; if (estyle && intpart == 10) { /* * The value was rounded up to ten, but we only want one * integer digit if using "e-style". So, the integer * part must be set to one and the exponent must be * incremented by one. */ intpart = 1; exponent++; } } /* * Now that we know the real exponent, we can check whether or not to * use "e-style" for "%g" (and "%G") conversions. If we don't need * "e-style", the precision must be adjusted and the integer and * fractional parts must be recalculated from the original value. * * C99 says: "Let P equal the precision if nonzero, 6 if the precision * is omitted, or 1 if the precision is zero. Then, if a conversion * with style `E' would have an exponent of X: * * - if P > X >= -4, the conversion is with style `f' (or `F') and * precision P - (X + 1). * * - otherwise, the conversion is with style `e' (or `E') and precision * P - 1." (7.19.6.1, 8) * * Note that we had decremented the precision by one. */ if (flags & PRINT_F_TYPE_G && estyle && precision + 1 > exponent && exponent >= -4) { precision -= exponent; estyle = 0; goto again; } if (estyle) { if (exponent < 0) { exponent = -exponent; esign = '-'; } else esign = '+'; /* * Convert the exponent. The sizeof(econvert) is 4. So, the * econvert buffer can hold e.g. "e+99" and "e-99". We don't * support an exponent which contains more than two digits. * Therefore, the following stores are safe. */ epos = convert(exponent, econvert, 2, 10, 0); /* * C99 says: "The exponent always contains at least two digits, * and only as many more digits as necessary to represent the * exponent." (7.19.6.1, 8) */ if (epos == 1) econvert[epos++] = '0'; econvert[epos++] = esign; econvert[epos++] = (flags & PRINT_F_UP) ? 'E' : 'e'; } /* Convert the integer part and the fractional part. */ ipos = convert(intpart, iconvert, sizeof(iconvert), 10, 0); if (fracpart != 0) /* convert() would return 1 if fracpart == 0. */ fpos = convert(fracpart, fconvert, sizeof(fconvert), 10, 0); leadfraczeros = precision - fpos; if (omitzeros) { if (fpos > 0) /* Omit trailing fractional part zeros. */ while (omitcount < fpos && fconvert[omitcount] == '0') omitcount++; else { /* The fractional part is zero, omit it completely. */ omitcount = precision; leadfraczeros = 0; } precision -= omitcount; } /* * Print a decimal point if either the fractional part is non-zero * and/or the "#" flag was specified. */ if (precision > 0 || flags & PRINT_F_NUM) emitpoint = 1; if (separators) /* Get the number of group separators we'll print. */ separators = getnumsep(ipos); padlen = width /* Minimum field width. */ - ipos /* Number of integer digits. */ - epos /* Number of exponent characters. */ - precision /* Number of fractional digits. */ - separators /* Number of group separators. */ - (emitpoint ? 1 : 0) /* Will we print a decimal point? */ - ((sign != 0) ? 1 : 0); /* Will we print a sign character? */ if (padlen < 0) padlen = 0; /* * C99 says: "If the `0' and `-' flags both appear, the `0' flag is * ignored." (7.19.6.1, 6) */ if (flags & PRINT_F_MINUS) /* Left justifty. */ padlen = -padlen; else if (flags & PRINT_F_ZERO && padlen > 0) { if (sign != 0) { /* Sign. */ OUTCHAR(str, *len, size, sign); sign = 0; } while (padlen > 0) { /* Leading zeros. */ OUTCHAR(str, *len, size, '0'); padlen--; } } while (padlen > 0) { /* Leading spaces. */ OUTCHAR(str, *len, size, ' '); padlen--; } if (sign != 0) /* Sign. */ OUTCHAR(str, *len, size, sign); while (ipos > 0) { /* Integer part. */ ipos--; OUTCHAR(str, *len, size, iconvert[ipos]); if (separators > 0 && ipos > 0 && ipos % 3 == 0) printsep(str, len, size); } if (emitpoint) { /* Decimal point. */ #if defined(HAVE_LOCALECONV) && defined(HAVE_LCONV_DECIMAL_POINT) if (lc->decimal_point != NULL && *lc->decimal_point != '\0') OUTCHAR(str, *len, size, *lc->decimal_point); else /* We'll always print some decimal point character. */ #endif /* HAVE_LOCALECONV && HAVE_LCONV_DECIMAL_POINT */ OUTCHAR(str, *len, size, '.'); } while (leadfraczeros > 0) { /* Leading fractional part zeros. */ OUTCHAR(str, *len, size, '0'); leadfraczeros--; } while (fpos > omitcount) { /* The remaining fractional part. */ fpos--; OUTCHAR(str, *len, size, fconvert[fpos]); } while (epos > 0) { /* Exponent. */ epos--; OUTCHAR(str, *len, size, econvert[epos]); } while (padlen < 0) { /* Trailing spaces. */ OUTCHAR(str, *len, size, ' '); padlen++; } } static void printsep(char *str, size_t *len, size_t size) { #if defined(HAVE_LOCALECONV) && defined(HAVE_LCONV_THOUSANDS_SEP) struct lconv *lc = localeconv(); int i; if (lc->thousands_sep != NULL) for (i = 0; lc->thousands_sep[i] != '\0'; i++) OUTCHAR(str, *len, size, lc->thousands_sep[i]); else #endif /* HAVE_LOCALECONV && HAVE_LCONV_THOUSANDS_SEP */ OUTCHAR(str, *len, size, ','); } static int getnumsep(int digits) { int separators = (digits - ((digits % 3 == 0) ? 1 : 0)) / 3; #if defined(HAVE_LOCALECONV) && defined(HAVE_LCONV_THOUSANDS_SEP) int strln; struct lconv *lc = localeconv(); /* We support an arbitrary separator length (including zero). */ if (lc->thousands_sep != NULL) { for (strln = 0; lc->thousands_sep[strln] != '\0'; strln++) continue; separators *= strln; } #endif /* HAVE_LOCALECONV && HAVE_LCONV_THOUSANDS_SEP */ return separators; } static int getexponent(LDOUBLE value) { LDOUBLE tmp = (value >= 0.0) ? value : -value; int exponent = 0; /* * We check for 99 > exponent > -99 in order to work around possible * endless loops which could happen (at least) in the second loop (at * least) if we're called with an infinite value. However, we checked * for infinity before calling this function using our ISINF() macro, so * this might be somewhat paranoid. */ while (tmp < 1.0 && tmp > 0.0 && --exponent > -99) tmp *= 10; while (tmp >= 10.0 && ++exponent < 99) tmp /= 10; return exponent; } static int convert(UINTMAX_T value, char *buf, size_t size, int base, int caps) { const char *digits = caps ? "0123456789ABCDEF" : "0123456789abcdef"; size_t pos = 0; /* We return an unterminated buffer with the digits in reverse order. */ do { buf[pos++] = digits[value % base]; value /= base; } while (value != 0 && pos < size); return (int)pos; } static UINTMAX_T cast(LDOUBLE value) { UINTMAX_T result; /* * We check for ">=" and not for ">" because if UINTMAX_MAX cannot be * represented exactly as an LDOUBLE value (but is less than LDBL_MAX), * it may be increased to the nearest higher representable value for the * comparison (cf. C99: 6.3.1.4, 2). It might then equal the LDOUBLE * value although converting the latter to UINTMAX_T would overflow. */ if (value >= UINTMAX_MAX) return UINTMAX_MAX; result = value; /* * At least on NetBSD/sparc64 3.0.2 and 4.99.30, casting long double to * an integer type converts e.g. 1.9 to 2 instead of 1 (which violates * the standard). Sigh. */ return (result <= value) ? result : result - 1; } static UINTMAX_T myround(LDOUBLE value) { UINTMAX_T intpart = cast(value); return ((value -= intpart) < 0.5) ? intpart : intpart + 1; } static LDOUBLE mypow10(int exponent) { LDOUBLE result = 1; while (exponent > 0) { result *= 10; exponent--; } while (exponent < 0) { result /= 10; exponent++; } return result; } #endif /* !HAVE_VSNPRINTF */ #if !defined(HAVE_VASPRINTF) #ifdef NEED_MYMEMCPY void * mymemcpy(void *dst, void *src, size_t len) { const char *from = src; char *to = dst; /* No need for optimization, we use this only to replace va_copy(3). */ while (len-- > 0) *to++ = *from++; return dst; } #endif /* NEED_MYMEMCPY */ int rpl_vasprintf(char **ret, const char *format, va_list ap) { size_t size; int len; va_list aq; VA_COPY(aq, ap); len = vsnprintf(NULL, 0, format, aq); VA_END_COPY(aq); if (len < 0 || (*ret = malloc(size = len + 1)) == NULL) return -1; return vsnprintf(*ret, size, format, ap); } #endif /* !HAVE_VASPRINTF */ #if !defined(HAVE_SNPRINTF) #ifdef HAVE_STDARG_H int rpl_snprintf(char *str, size_t size, const char *format, ...) #else int rpl_snprintf(va_alist) va_dcl #endif /* HAVE_STDARG_H */ { #ifndef HAVE_STDARG_H char *str; size_t size; char *format; #endif /* HAVE_STDARG_H */ va_list ap; int len; VA_START(ap, format); VA_SHIFT(ap, str, char *); VA_SHIFT(ap, size, size_t); VA_SHIFT(ap, format, const char *); len = vsnprintf(str, size, format, ap); va_end(ap); return len; } #endif /* !HAVE_SNPRINTF */ #if !defined(HAVE_ASPRINTF) #ifdef HAVE_STDARG_H int rpl_asprintf(char **ret, const char *format, ...) #else int rpl_asprintf(va_alist) va_dcl #endif /* HAVE_STDARG_H */ { #ifndef HAVE_STDARG_H char **ret; char *format; #endif /* HAVE_STDARG_H */ va_list ap; int len; VA_START(ap, format); VA_SHIFT(ap, ret, char **); VA_SHIFT(ap, format, const char *); len = vasprintf(ret, format, ap); va_end(ap); return len; } #endif /* !HAVE_ASPRINTF */ #else /* Dummy declaration to avoid empty translation unit warnings. */ int main(void); #endif /* !HAVE_SNPRINTF || !HAVE_VSNPRINTF || !HAVE_ASPRINTF || [...] */ #if defined(TEST_SNPRINTF) int main(void) { const char *float_fmt[] = { /* "%E" and "%e" formats. */ #if defined(HAVE_LONG_LONG_INT) && !defined(OS_BSD) && !defined(OS_IRIX) "%.16e", "%22.16e", "%022.16e", "%-22.16e", "%#+'022.16e", #endif /* HAVE_LONG_LONG_INT && !OS_BSD && !OS_IRIX */ "foo|%#+0123.9E|bar", "%-123.9e", "%123.9e", "%+23.9e", "%+05.8e", "%-05.8e", "%05.8e", "%+5.8e", "%-5.8e", "% 5.8e", "%5.8e", "%+4.9e", #if !defined(OS_LINUX) /* glibc sometimes gets these wrong. */ "%+#010.0e", "%#10.1e", "%10.5e", "% 10.5e", "%5.0e", "%5.e", "%#5.0e", "%#5.e", "%3.2e", "%3.1e", "%-1.5e", "%1.5e", "%01.3e", "%1.e", "%.1e", "%#.0e", "%+.0e", "% .0e", "%.0e", "%#.e", "%+.e", "% .e", "%.e", "%4e", "%e", "%E", #endif /* !OS_LINUX */ /* "%F" and "%f" formats. */ #if !defined(OS_BSD) && !defined(OS_IRIX) "% '022f", "%+'022f", "%-'22f", "%'22f", #ifdef HAVE_LONG_LONG_INT "%.16f", "%22.16f", "%022.16f", "%-22.16f", "%#+'022.16f", #endif /* HAVE_LONG_LONG_INT */ #endif /* !OS_BSD && !OS_IRIX */ "foo|%#+0123.9F|bar", "%-123.9f", "%123.9f", "%+23.9f", "%+#010.0f", "%#10.1f", "%10.5f", "% 10.5f", "%+05.8f", "%-05.8f", "%05.8f", "%+5.8f", "%-5.8f", "% 5.8f", "%5.8f", "%5.0f", "%5.f", "%#5.0f", "%#5.f", "%+4.9f", "%3.2f", "%3.1f", "%-1.5f", "%1.5f", "%01.3f", "%1.f", "%.1f", "%#.0f", "%+.0f", "% .0f", "%.0f", "%#.f", "%+.f", "% .f", "%.f", "%4f", "%f", "%F", /* "%G" and "%g" formats. */ #if !defined(OS_BSD) && !defined(OS_IRIX) && !defined(OS_LINUX) "% '022g", "%+'022g", "%-'22g", "%'22g", #ifdef HAVE_LONG_LONG_INT "%.16g", "%22.16g", "%022.16g", "%-22.16g", "%#+'022.16g", #endif /* HAVE_LONG_LONG_INT */ #endif /* !OS_BSD && !OS_IRIX && !OS_LINUX */ "foo|%#+0123.9G|bar", "%-123.9g", "%123.9g", "%+23.9g", "%+05.8g", "%-05.8g", "%05.8g", "%+5.8g", "%-5.8g", "% 5.8g", "%5.8g", "%+4.9g", #if !defined(OS_LINUX) /* glibc sometimes gets these wrong. */ "%+#010.0g", "%#10.1g", "%10.5g", "% 10.5g", "%5.0g", "%5.g", "%#5.0g", "%#5.g", "%3.2g", "%3.1g", "%-1.5g", "%1.5g", "%01.3g", "%1.g", "%.1g", "%#.0g", "%+.0g", "% .0g", "%.0g", "%#.g", "%+.g", "% .g", "%.g", "%4g", "%g", "%G", #endif /* !OS_LINUX */ NULL }; double float_val[] = { -4.136, -134.52, -5.04030201, -3410.01234, -999999.999999, -913450.29876, -913450.2, -91345.2, -9134.2, -913.2, -91.2, -9.2, -9.9, 4.136, 134.52, 5.04030201, 3410.01234, 999999.999999, 913450.29876, 913450.2, 91345.2, 9134.2, 913.2, 91.2, 9.2, 9.9, 9.96, 9.996, 9.9996, 9.99996, 9.999996, 9.9999996, 9.99999996, 0.99999996, 0.99999999, 0.09999999, 0.00999999, 0.00099999, 0.00009999, 0.00000999, 0.00000099, 0.00000009, 0.00000001, 0.0000001, 0.000001, 0.00001, 0.0001, 0.001, 0.01, 0.1, 1.0, 1.5, -1.5, -1.0, -0.1, #if !defined(OS_BSD) /* BSD sometimes gets these wrong. */ #ifdef INFINITY INFINITY, -INFINITY, #endif /* defined(INFINITY) */ #ifdef NAN NAN, #endif /* defined(NAN) */ #endif /* !OS_BSD */ 0 }; const char *long_fmt[] = { "foo|%0123ld|bar", #if !defined(OS_IRIX) "% '0123ld", "%+'0123ld", "%-'123ld", "%'123ld", #endif /* !OS_IRiX */ "%123.9ld", "% 123.9ld", "%+123.9ld", "%-123.9ld", "%0123ld", "% 0123ld", "%+0123ld", "%-0123ld", "%10.5ld", "% 10.5ld", "%+10.5ld", "%-10.5ld", "%010ld", "% 010ld", "%+010ld", "%-010ld", "%4.2ld", "% 4.2ld", "%+4.2ld", "%-4.2ld", "%04ld", "% 04ld", "%+04ld", "%-04ld", "%5.5ld", "%+22.33ld", "%01.3ld", "%1.5ld", "%-1.5ld", "%44ld", "%4ld", "%4.0ld", "%4.ld", "%.44ld", "%.4ld", "%.0ld", "%.ld", "%ld", NULL }; long int long_val[] = { #ifdef LONG_MAX LONG_MAX, #endif /* LONG_MAX */ #ifdef LONG_MIN LONG_MIN, #endif /* LONG_MIN */ -91340, 91340, 341, 134, 0203, -1, 1, 0 }; const char *ulong_fmt[] = { /* "%u" formats. */ "foo|%0123lu|bar", #if !defined(OS_IRIX) "% '0123lu", "%+'0123lu", "%-'123lu", "%'123lu", #endif /* !OS_IRiX */ "%123.9lu", "% 123.9lu", "%+123.9lu", "%-123.9lu", "%0123lu", "% 0123lu", "%+0123lu", "%-0123lu", "%5.5lu", "%+22.33lu", "%01.3lu", "%1.5lu", "%-1.5lu", "%44lu", "%lu", /* "%o" formats. */ "foo|%#0123lo|bar", "%#123.9lo", "%# 123.9lo", "%#+123.9lo", "%#-123.9lo", "%#0123lo", "%# 0123lo", "%#+0123lo", "%#-0123lo", "%#5.5lo", "%#+22.33lo", "%#01.3lo", "%#1.5lo", "%#-1.5lo", "%#44lo", "%#lo", "%123.9lo", "% 123.9lo", "%+123.9lo", "%-123.9lo", "%0123lo", "% 0123lo", "%+0123lo", "%-0123lo", "%5.5lo", "%+22.33lo", "%01.3lo", "%1.5lo", "%-1.5lo", "%44lo", "%lo", /* "%X" and "%x" formats. */ "foo|%#0123lX|bar", "%#123.9lx", "%# 123.9lx", "%#+123.9lx", "%#-123.9lx", "%#0123lx", "%# 0123lx", "%#+0123lx", "%#-0123lx", "%#5.5lx", "%#+22.33lx", "%#01.3lx", "%#1.5lx", "%#-1.5lx", "%#44lx", "%#lx", "%#lX", "%123.9lx", "% 123.9lx", "%+123.9lx", "%-123.9lx", "%0123lx", "% 0123lx", "%+0123lx", "%-0123lx", "%5.5lx", "%+22.33lx", "%01.3lx", "%1.5lx", "%-1.5lx", "%44lx", "%lx", "%lX", NULL }; unsigned long int ulong_val[] = { #ifdef ULONG_MAX ULONG_MAX, #endif /* ULONG_MAX */ 91340, 341, 134, 0203, 1, 0 }; const char *llong_fmt[] = { "foo|%0123lld|bar", "%123.9lld", "% 123.9lld", "%+123.9lld", "%-123.9lld", "%0123lld", "% 0123lld", "%+0123lld", "%-0123lld", "%5.5lld", "%+22.33lld", "%01.3lld", "%1.5lld", "%-1.5lld", "%44lld", "%lld", NULL }; LLONG llong_val[] = { #ifdef LLONG_MAX LLONG_MAX, #endif /* LLONG_MAX */ #ifdef LLONG_MIN LLONG_MIN, #endif /* LLONG_MIN */ -91340, 91340, 341, 134, 0203, -1, 1, 0 }; const char *string_fmt[] = { "foo|%10.10s|bar", "%-10.10s", "%10.10s", "%10.5s", "%5.10s", "%10.1s", "%1.10s", "%10.0s", "%0.10s", "%-42.5s", "%2.s", "%.10s", "%.1s", "%.0s", "%.s", "%4s", "%s", NULL }; const char *string_val[] = { "Hello", "Hello, world!", "Sound check: One, two, three.", "This string is a little longer than the other strings.", "1", "", NULL }; #if !defined(OS_SYSV) /* SysV uses a different format than we do. */ const char *pointer_fmt[] = { "foo|%p|bar", "%42p", "%p", NULL }; const char *pointer_val[] = { *pointer_fmt, *string_fmt, *string_val, NULL }; #endif /* !OS_SYSV */ char buf1[1024], buf2[1024]; double value, digits = 9.123456789012345678901234567890123456789; int i, j, r1, r2, failed = 0, num = 0; /* * Use -DTEST_NILS in order to also test the conversion of nil values. Might * segfault on systems which don't support converting a NULL pointer with "%s" * and lets some test cases fail against BSD and glibc due to bugs in their * implementations. */ #ifndef TEST_NILS #define TEST_NILS 0 #elif TEST_NILS #undef TEST_NILS #define TEST_NILS 1 #endif /* !defined(TEST_NILS) */ #ifdef TEST #undef TEST #endif /* defined(TEST) */ #define TEST(fmt, val) \ do { \ for (i = 0; fmt[i] != NULL; i++) \ for (j = 0; j == 0 || val[j - TEST_NILS] != 0; j++) { \ r1 = sprintf(buf1, fmt[i], val[j]); \ r2 = snprintf(buf2, sizeof(buf2), fmt[i], val[j]); \ if (strcmp(buf1, buf2) != 0 || r1 != r2) { \ (void)printf("Results don't match, " \ "format string: %s\n" \ "\t sprintf(3): [%s] (%d)\n" \ "\tsnprintf(3): [%s] (%d)\n", \ fmt[i], buf1, r1, buf2, r2); \ failed++; \ } \ num++; \ } \ } while (/* CONSTCOND */ 0) #ifdef HAVE_LOCALE_H (void)setlocale(LC_ALL, ""); #endif /* HAVE_LOCALE_H */ (void)puts("Testing our snprintf(3) against your system's sprintf(3)."); TEST(float_fmt, float_val); TEST(long_fmt, long_val); TEST(ulong_fmt, ulong_val); TEST(llong_fmt, llong_val); TEST(string_fmt, string_val); #if !defined(OS_SYSV) /* SysV uses a different format than we do. */ TEST(pointer_fmt, pointer_val); #endif /* !OS_SYSV */ (void)printf("Result: %d out of %d tests failed.\n", failed, num); (void)fputs("Checking how many digits we support: ", stdout); for (i = 0; i < 100; i++) { value = pow(10, i) * digits; (void)sprintf(buf1, "%.1f", value); (void)snprintf(buf2, sizeof(buf2), "%.1f", value); if (strcmp(buf1, buf2) != 0) { (void)printf("apparently %d.\n", i); break; } } return (failed == 0) ? 0 : 1; } #endif /* TEST_SNPRINTF */ /* vim: set joinspaces textwidth=80: */ cpl-6.4.1/libcext/cext/cxfileutils.c0000644000460300003120000000754311530471603014317 00000000000000/* $Id: cxfileutils.c,v 1.7 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.7 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #include #ifdef HAVE_UNISTD_H # include #endif #include "cxmemory.h" #include "cxfileutils.h" #ifdef STAT_MACROS_BROKEN #undef S_ISDIR #endif #if !defined S_ISDIR && defined S_IFMT && defined S_IFDIR #define S_ISDIR(mode) ((mode) & S_IFMT == S_IFDIR) #endif /** * @defgroup cxfileutils File Utilities * * The module provides a collection of useful file and file path related * utility functions. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /** * @brief * Get the maximum length of a path relative to the given directory. * * @param path Directory name. * * @return Maximum path length. * * The function returns the maximum length a relative path when @em path * is the current working directory. To get the maximum possible length * of an absolute path pass "/" for @em path, but see the note below. * The size is determined through the @b pathconf() function, or if this * is not available the maximum length is simply set to the ad hoc length * of 4095 characters. * * @note * The maximum length of a pathname depends on the underlying filesystem. * This means that the method to determine the maximum possible length * of an absolute pathname might be incorrect if the root directory * and the actual location of the file under consideration are located * on different filesystems. */ cxlong cx_path_max(const cxchar *path) { cxlong sz = 4095; if (path == NULL) return sz; #ifdef HAVE_PATHCONF sz = pathconf(path, _PC_PATH_MAX); #endif return sz; } /** * @brief * Allocate a buffer suitable for storing a relative pathname staring at * a given directory. * * @param path Directory name the relative path should start from. * * @return Allocated buffer of appropriate size, or @c NULL in case of an * error. * * The function determines the maximum possible length of a relative * path name when @em path is the current working directory. A buffer * with the appropriate length for the relative pathname including the * trailing zero. The argument @em path must be the name of an existing, * or the function fails. The allocated buffer can be destroyed by calling * @b cx_free(). * * IF the string "/" is used for @em path the returned buffer will have the * maximum length possible for an absolute path supported by the system * (but see the note for @b cx_path_max() for pitfalls). */ cxchar * cx_path_alloc(const char *path) { #ifdef S_ISDIR struct stat sb; #endif if (!path || path[0] == '\0') return NULL; #ifdef S_ISDIR /* * Check that path is a directory */ if (stat(path, &sb) != 0 || !S_ISDIR(sb.st_mode)) return NULL; #endif return cx_calloc(cx_path_max(path) + 1, sizeof(cxchar)); } /**@}*/ cpl-6.4.1/libcext/cext/cxmultimap.c0000644000460300003120000004067411530471603014151 00000000000000/* $Id: cxmultimap.c,v 1.5 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.5 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include "cxmemory.h" #include "cxmessages.h" #include "cxmultimap.h" /** * @defgroup cxmultimap Multi Maps * * The module implements a map data type, i.e. a container managing key/value * pairs as elements. Their elements are automatically sorted according to * a sorting criterion used for the key. The container is optimized for * lookup operations. Contrary to ordinary maps a multimap is not restricted * to unique keys, but may contain multiple duplicate keys. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /** * @brief * Get an iterator to the first pair in a multimap. * * @param multimap The multimap to query. * * @return Iterator for the first pair or @b cx_multimap_end() if the * multimap is empty. * * The function returns a handle for the first pair in the multimap * @em multimap. The returned iterator cannot be used directly to access * the value field of the key/value pair, but only through the appropriate * methods. */ cx_multimap_iterator cx_multimap_begin(const cx_multimap *multimap) { return cx_tree_begin(multimap); } /** * @brief * Get an iterator for the position after the last pair in the multimap. * * @param multimap The multimap to query. * * @return Iterator for the end of the multimap. * * The function returns an iterator for the position one past the last pair * in the multimap @em multimap. The iteration is done in ascending order * according to the keys. The returned iterator cannot be used directly to * access the value field of the key/value pair, but only through the * appropriate methods. */ cx_multimap_iterator cx_multimap_end(const cx_multimap *multimap) { return cx_tree_end(multimap); } /** * @brief * Get an iterator for the next pair in the multimap. * * @param multimap A multimap. * @param position Current iterator position. * * @return Iterator for the pair immediately following @em position. * * The function returns an iterator for the next pair in the multimap * @em multimap with respect to the current iterator position @em position. * Iteration is done in ascending order according to the keys. If the * multimap is empty or @em position points to the end of the multimap the * function returns @b cx_multimap_end(). */ cx_multimap_iterator cx_multimap_next(const cx_multimap *multimap, cx_multimap_const_iterator position) { return cx_tree_next(multimap, position); } /** * @brief * Get an iterator for the previous pair in the multimap. * * @param multimap A multimap. * @param position Current iterator position. * * @return Iterator for the pair immediately preceding @em position. * * The function returns an iterator for the previous pair in the multimap * @em multimap with respect to the current iterator position @em position. * Iteration is done in ascending order according to the keys. If the * multimap is empty or @em position points to the beginning of the multimap * the function returns @b cx_multimap_end(). */ cx_multimap_iterator cx_multimap_previous(const cx_multimap *multimap, cx_multimap_const_iterator position) { return cx_tree_previous(multimap, position); } /** * @brief * Remove all pairs from a multimap. * * @param multimap Multimap to be cleared. * * @return Nothing. * * The multimap @em multimap is cleared, i.e. all pairs are removed from * the multimap. Keys and values are destroyed using the key and value * destructors set up during multimap creation. After calling this function * the multimap is empty. */ void cx_multimap_clear(cx_multimap *multimap) { cx_tree_clear(multimap); return; } /** * @brief * Check whether a multimap is empty. * * @param multimap A multimap. * * @return The function returns @c TRUE if the multimap is empty, and * @c FALSE otherwise. * * The function checks if the multimap contains any pairs. Calling this * function is equivalent to the statement: * @code * return (cx_multimap_size(multimap) == 0); * @endcode */ cxbool cx_multimap_empty(const cx_multimap *multimap) { return cx_tree_empty(multimap); } /** * @brief * Create a new multimap without any elements. * * @param compare Function used to compare keys. * @param key_destroy Destructor for the keys. * @param value_destroy Destructor for the value field. * * @return Handle for the newly allocated multimap. * * Memory for a new multimap is allocated and the multimap is initialized * to be a valid empty multimap. * * The multimap's key comparison function is set to @em compare. It must * return @c TRUE or @c FALSE if the comparison of the first argument * passed to it with the second argument is found to be true or false * respectively. * * The destructors for a multimap node's key and value field are set to * @em key_destroy and @em value_destroy. Whenever a multimap node is * destroyed these functions are used to deallocate the memory used * by the key and the value. Each of the destructors might be @c NULL, i.e. * keys and values are not deallocated during destroy operations. * * @see cx_multimap_compare_func() */ cx_multimap * cx_multimap_new(cx_multimap_compare_func compare, cx_free_func key_destroy, cx_free_func value_destroy) { return cx_tree_new(compare, key_destroy, value_destroy); } /** * @brief * Destroy a multimap and all its elements. * * @param multimap The multimap to destroy. * * @return Nothing. * * The multimap @em multimap is deallocated. All data values and keys are * deallocated using the multimap's key and value destructor. If no * key and/or value destructor was set when the @em multimap was created * the keys and the stored data values are left untouched. In this * case the key and value deallocation is the responsibility of the * user. * * @see cx_multimap_new() */ void cx_multimap_delete(cx_multimap *multimap) { cx_tree_delete(multimap); return; } /** * @brief * Get the actual number of pairs in the multimap. * * @param multimap A multimap. * * @return The current number of pairs, or 0 if the multimap is empty. * * Retrieves the current number of pairs stored in the multimap. */ cxsize cx_multimap_size(const cx_multimap *multimap) { return cx_tree_size(multimap); } /** * @brief * Get the maximum number of pairs possible. * * @param multimap A multimap. * * @return The maximum number of pairs that can be stored in the multimap. * * Retrieves the multimap's capacity, i.e. the maximum possible number of * pairs a multimap can manage. */ cxsize cx_multimap_max_size(const cx_multimap *multimap) { return cx_tree_max_size(multimap); } /** * @brief * Retrieve a multimap's key comparison function. * * @param multimap The multimap to query. * * @return Handle for the multimap's key comparison function. * * The function retrieves the function used by the multimap methods * for comparing keys. The key comparison function is set during * multimap creation. * * @see cx_multimap_new() */ cx_multimap_compare_func cx_multimap_key_comp(const cx_multimap *multimap) { return cx_tree_key_comp(multimap); } /** * @brief * Swap the contents of two multimaps. * * @param multimap1 First multimap. * @param multimap2 Second multimap. * * @return Nothing. * * All pairs stored in the first multimap @em multimap1 are moved to the * second multimap @em multimap2, while the pairs from @em multimap2 are * moved to @em multimap1. Also the key comparison function, the key and * the value destructor are exchanged. */ void cx_multimap_swap(cx_multimap *multimap1, cx_multimap *multimap2) { cx_tree_swap(multimap1, multimap2); return; } /** * @brief * Assign data to an iterator position. * * @param multimap A multimap. * @param position Iterator positions where the data will be stored. * @param data Data to store. * * @return Handle to the previously stored data object. * * The function assigns a data object reference @em data to the iterator * position @em position of the multimap @em multimap. */ cxptr cx_multimap_assign(cx_multimap *multimap, cx_multimap_iterator position, cxcptr data) { return cx_tree_assign(multimap, position, data); } /** * @brief * Get the key from a given iterator position. * * @param multimap A multimap. * @param position Iterator position the data is retrieved from. * * @return Reference for the key. * * The function returns a reference to the key associated with the iterator * position @em position in the multimap @em multimap. * * @note * One must not modify the key of @em position through the returned * reference, since this might corrupt the multimap! */ cxptr cx_multimap_get_key(const cx_multimap *multimap, cx_multimap_const_iterator position) { return cx_tree_get_key(multimap, position); } /** * @brief * Get the data from a given iterator position. * * @param multimap A multimap. * @param position Iterator position the data is retrieved from. * * @return Handle for the data object. * * The function returns a reference to the data stored at iterator position * @em position in the multimap @em multimap. */ cxptr cx_multimap_get_value(const cx_multimap *multimap, cx_multimap_const_iterator position) { return cx_tree_get_value(multimap, position); } /** * @brief * Locate an element in the multimap. * * @param multimap A multimap. * @param key Key of the (key, value) pair to locate. * * @return Iterator pointing to the sought-after element, or * @b cx_multimap_end() if it was not found. * * The function searches the multimap @em multimap for the first element * with a key matching @em key. If the search was successful an iterator * to the sought-after pair is returned. If the search did not succeed, i.e. * @em key is not present in the multimap, a one past the end iterator is * returned. */ cx_multimap_iterator cx_multimap_find(const cx_multimap *multimap, cxcptr key) { return cx_tree_find(multimap, key); } /** * @brief * Find the beginning of a subsequence matching a given key. * * @param multimap A multimap. * @param key Key of the (key, value) pair(s) to locate. * * @return Iterator pointing to the first position where an element with * key @em key would get inserted, i.e. the first element with a key greater * or equal than @em key. * * The function returns the first element of a subsequence of elements in the * multimap that match the given key @em key. If @em key is not present in the * multimap @em multimap an iterator pointing to the first element that has * a greater key than @em key or @b cx_multimap_end() if no such element * exists. */ cx_multimap_iterator cx_multimap_lower_bound(const cx_multimap *multimap, cxcptr key) { return cx_tree_lower_bound(multimap, key); } /** * @brief * Find the end of a subsequence matching a given key. * * @param multimap A multimap. * @param key Key of the (key, value) pair(s) to locate. * * @return Iterator pointing to the last position where an element with * key @em key would get inserted, i.e. the first element with a key * greater than @em key. * * The function returns the last element of a subsequence of elements in the * multimap that match the given key @em key. If @em key is not present in the * multimap @em multimap an iterator pointing to the first element that has * a greater key than @em key or @b cx_multimap_end() if no such element * exists. */ cx_multimap_iterator cx_multimap_upper_bound(const cx_multimap *multimap, cxcptr key) { return cx_tree_upper_bound(multimap, key); } /** * @brief * Find a subsequence matching a given key. * * @param multimap A multimap. * @param key The key of the (key, value) pair(s) to be located. * @param begin First element with key @em key. * @param end Last element with key @em key. * * @return Nothing. * * The function returns the beginning and the end of a subsequence of * multimap elements with the key @em key through through the @em begin and * @em end arguments. After calling this function @em begin possibly points * to the first element of @em multimap matching the key @em key and @em end * possibly points to the last element of the sequence. If key is not * present in the multimap @em begin and @em end point to the next greater * element or, if no such element exists, to @b cx_multimap_end(). */ void cx_multimap_equal_range(const cx_multimap *multimap, cxcptr key, cx_multimap_iterator *begin, cx_multimap_iterator *end) { cx_tree_equal_range(multimap, key, begin, end); return; } /** * @brief * Get the number of elements matching a key. * * @param multimap A multimap. * @param key Key of the (key, value) pair(s) to locate. * * @return The number of elements with the specified key. * * Counts all elements of the multimap @em multimap matching the key @em key. */ cxsize cx_multimap_count(const cx_multimap *multimap, cxcptr key) { return cx_tree_count(multimap, key); } /** * @brief * Insert data into a multimap. * * @param multimap A multimap. * @param key Key used to store the data. * @param data Data to insert. * * @return An iterator that points to the inserted pair. * * This function inserts a (key, value) pair into the multimap @em multimap. * The same key may be inserted with different data values. */ cx_multimap_iterator cx_multimap_insert(cx_multimap *multimap, cxcptr key, cxcptr data) { return cx_tree_insert_equal(multimap, key, data); } /** * @brief * Erase an element from a multimap. * * @param multimap A multimap. * @param position Iterator position of the element to be erased. * * @return Nothing. * * This function erases an element, specified by the iterator @em position, * from @em multimap. Key and value associated with the erased pair are * deallocated using the multimap's key and value destructors, provided * they have been set. */ void cx_multimap_erase_position(cx_multimap *multimap, cx_multimap_iterator position) { cx_tree_erase_position(multimap, position); return; } /** * @brief * Erase a range of elements from a multimap. * * @param multimap A multimap. * @param begin Iterator pointing to the start of the range to erase. * @param end Iterator pointing to the end of the range to erase. * * @return Nothing. * * This function erases all elements in the range [begin, end) from * the multimap @em multimap. Key and value associated with the erased * pair(s) are deallocated using the multimap's key and value destructors, * provided they have been set. */ void cx_multimap_erase_range(cx_multimap *multimap, cx_multimap_iterator begin, cx_multimap_iterator end) { cx_tree_erase_range(multimap, begin, end); return; } /** * @brief * Erase an element from a multimap according to the provided key. * * @param multimap A multimap. * @param key Key of the element to be erased. * * @return The number of removed elements. * * This function erases the element with the specified key @em key, * from @em multimap. Key and value associated with the erased pair are * deallocated using the multimap's key and value destructors, provided * they have been set. */ cxsize cx_multimap_erase(cx_multimap *multimap, cxcptr key) { return cx_tree_erase(multimap, key); } /**@}*/ cpl-6.4.1/libcext/cext/Makefile.in0000644000460300003120000005623212310332713013657 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = cext DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/admin/depcomp $(include_HEADERS) \ $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" \ "$(DESTDIR)$(configdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am_libcext_la_OBJECTS = cxfileutils.lo cxlist.lo cxmap.lo cxmemory.lo \ cxmessages.lo cxmultimap.lo cxslist.lo cxstring.lo \ cxstrutils.lo cxtree.lo cxutils.lo cxdeque.lo libcext_la_OBJECTS = $(am_libcext_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libcext_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libcext_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcext_la_SOURCES) $(EXTRA_libcext_la_SOURCES) DIST_SOURCES = $(libcext_la_SOURCES) $(EXTRA_libcext_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(include_HEADERS) $(nodist_config_HEADERS) \ $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CEXT_INCLUDES = @CEXT_INCLUDES@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_DEBUG_FLAGS = @CX_DEBUG_FLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNPRINTF = @SNPRINTF@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ cxconfig-stamp cxconfig.h @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(BUILT_SOURCES) AM_CPPFLAGS = -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=500 \ $(CEXT_INCLUDES) @CX_DEBUG_FLAGS@ BUILT_SOURCES = cxconfig-stamp include_HEADERS = cxdeque.h cxfileutils.h cxlist.h cxmap.h \ cxmacros.h cxmemory.h cxmessages.h cxmultimap.h cxslist.h \ cxstrutils.h cxtree.h cxutils.h cxstring.h cxtypes.h noinst_HEADERS = cxthread.h nodist_config_HEADERS = cxconfig.h lib_LTLIBRARIES = libcext.la libcext_la_SOURCES = cxfileutils.c cxlist.c cxmap.c cxmemory.c \ cxmessages.c cxmultimap.c cxslist.c cxstring.c cxstrutils.c cxtree.c \ cxutils.c cxdeque.c EXTRA_libcext_la_SOURCES = snprintf.h snprintf.c libcext_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libcext_la_LIBADD = @SNPRINTF@ libcext_la_DEPENDENCIES = @SNPRINTF@ all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cext/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign cext/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libcext.la: $(libcext_la_OBJECTS) $(libcext_la_DEPENDENCIES) $(EXTRA_libcext_la_DEPENDENCIES) $(AM_V_CCLD)$(libcext_la_LINK) -rpath $(libdir) $(libcext_la_OBJECTS) $(libcext_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxdeque.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxfileutils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxlist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxmap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxmemory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxmessages.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxmultimap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxslist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxstring.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxstrutils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxtree.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxutils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) install-nodist_configHEADERS: $(nodist_config_HEADERS) @$(NORMAL_INSTALL) @list='$(nodist_config_HEADERS)'; test -n "$(configdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(configdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(configdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(configdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(configdir)" || exit $$?; \ done uninstall-nodist_configHEADERS: @$(NORMAL_UNINSTALL) @list='$(nodist_config_HEADERS)'; test -n "$(configdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(configdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(configdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-includeHEADERS install-nodist_configHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \ uninstall-nodist_configHEADERS .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am \ install-includeHEADERS install-info install-info-am \ install-libLTLIBRARIES install-man \ install-nodist_configHEADERS install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-includeHEADERS \ uninstall-libLTLIBRARIES uninstall-nodist_configHEADERS cxconfig-stamp: $(top_builddir)/config.status $(AM_V_GEN) cd $(top_builddir) && $(SHELL) ./config.status cxconfig.h @touch cxconfig-stamp # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/libcext/cext/snprintf.h0000644000460300003120000000367511725436346013651 00000000000000/* $Id: snprintf.h,v 1.8 2012-03-06 16:35:50 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CX_SNPRINTF_H #define CX_SNPRINTF_H #ifdef HAVE_CONFIG_H # include #endif #ifdef HAVE_STDDEF_H # include #endif #ifdef HAVE_STDDEF_H # include #endif /* Just for defining the CX_BEGIN_DECLS and CX_END_DECLS symbols. */ #include /* Define aliases for the replacement functions */ #if ! defined(HAVE_SNPRINTF) # define snprintf rpl_snprintf #endif #if ! defined(HAVE_VSNPRINTF) # define vsnprintf rpl_vsnprintf #endif #if ! defined(HAVE_ASPRINTF) # define asprintf rpl_asprintf #endif #if ! defined(HAVE_VASPRINTF) # define vasprintf rpl_vasprintf #endif CX_BEGIN_DECLS #if ! defined(HAVE_SNPRINTF) int rpl_snprintf(char *str, size_t size, const char *fmt, ...); #endif #if ! defined(HAVE_VSNPRINTF) int rpl_vsnprintf(char *str, size_t size, const char *fmt, va_list args); #endif #if ! defined(HAVE_ASPRINTF) int rpl_asprintf(char **str, const char *fmt, ...); #endif #if ! defined(HAVE_VASPRINTF) int rpl_vasprintf(char **str, const char *fmt, va_list args); #endif CX_END_DECLS #endif /* CX_SNPRINTF_H */ cpl-6.4.1/libcext/TODO0000644000460300003120000000000007774033725011340 00000000000000cpl-6.4.1/libcext/ChangeLog0000644000460300003120000002740610574300140012421 000000000000002007-01-29 Monday rpalsa * autogen.sh: Function bt_libtoolize() added and libltdl support added. 2007-01-29 Monday rpalsa * autogen.sh: Command 'grep -E' replaced by oldfashioned 'egrep' to make SunOS and HP-UX happy. 2006-11-13 Monday llundin * tests/cxlist-test.c, tests/cxmap-test.c, tests/cxslist-test.c, tests/cxstring-test.c, tests/cxtree-test.c: main(): Explicitly declare argument as void 2006-07-25 Tuesday rpalsa * cext/cxmemory.c: cx_memory_calloc_fallback(): Inline function specifier removed to avoid problems with gcc 4.1.x. 2006-07-24 Monday cplmgr * ChangeLog: Updated. 2006-07-21 Friday rpalsa * m4/eso.m4: Definition of ESO_ENABLE_DEBUG: Typo fixed in check for support of the gcc compiler option -g3. 2006-06-13 Tuesday rpalsa * tests/Makefile.am: AM_LDFLAGS: Changed from -all-static to -static, so that the tests may be used with valgrind. 2006-06-13 Tuesday rpalsa * .cvsignore: Updated to package version 1.0.5. 2006-06-13 Tuesday rpalsa * cext/cxlist.c, cext/cxfileutils.h, cext/cxfileutils.c, admin/html.am: Updated to package version 1.0.5. 2006-06-13 Tuesday rpalsa * cext/Makefile.am, cext/cxutils.h, cext/cxutils.c, cext/cxtypes.h.top, cext/cxtree.h, cext/cxtree.c, cext/cxstrutils.h, cext/cxstrutils.c, cext/cxstring.h, cext/cxstring.c, cext/cxslist.h, cext/cxslist.c, cext/cxmultimap.h, cext/cxmultimap.c, cext/cxmessages.h, cext/cxmessages.c, cext/cxmemory.h, cext/cxmemory.c, cext/cxmap.h, cext/cxmap.c, cext/cxmacros.h, cext/cxlist.h: Updated to package version 1.0.5. 2006-06-13 Tuesday rpalsa * cext/snprintf.c: Beautified. 2006-06-13 Tuesday rpalsa * tests/cxtree-test.c, tests/cxstring-test.c, tests/cxslist-test.c, tests/cxmap-test.c, tests/cxlist-test.c, cext/snprintf.h: Updated to package version 1.0.5. 2006-06-13 Tuesday rpalsa * tests/Makefile.am: Updated to package version 1.0.5. AM_LDFLAGS: Changed from -all-static to -static, so that tests can be used with valgrind. 2006-06-13 Tuesday rpalsa * Makefile.am, Doxyfile.in, COPYING, configure.ac: Updated to package version 1.0.5. 2006-06-12 Monday rpalsa * cext/cxslist.c: Extra empty line added. 2006-06-12 Monday rpalsa * cext/cxmessages.h: Extra line at the end removed. 2006-06-12 Monday rpalsa * tests/cxmap-test.c: cx_test_map_greater_char(): Put back. 2006-06-12 Monday rpalsa * tests/cxmap-test.c: cx_test_map_dump(): keyword static added to function definition 2006-06-12 Monday rpalsa * tests/cxtree-test.c: cx_test_tree_dump(): keyword static added to function definition 2006-06-12 Monday rpalsa * tests/cxslist-test.c: cx_test_slist_dump(): keyword static added to function definition 2006-06-12 Monday rpalsa * tests/cxlist-test.c: cx_test_list_dump(): keyword static added to function definition 2006-06-12 Monday rpalsa * cext/cxslist.h, cext/cxstring.c, cext/cxstring.h, cext/cxstrutils.h, cext/cxtree.c, cext/cxtree.h, cext/cxtypes.h.top, cext/cxutils.c, cext/cxutils.h, cext/snprintf.h, cext/cxfileutils.c, cext/cxfileutils.h, cext/cxlist.h, cext/cxmacros.h, cext/cxmap.c, cext/cxmap.h, cext/cxmemory.c, cext/cxmemory.h, cext/cxmessages.c, cext/cxmessages.h, cext/cxmultimap.c, cext/cxmultimap.h: Copyright and FSF address updated. 2006-06-12 Monday rpalsa * tests/cxstring-test.c: Copyright updated. 2006-06-12 Monday rpalsa * COPYING: Copyright and FSF address updated. 2006-06-12 Monday rpalsa * tests/Makefile.am, tests/cxlist-test.c, tests/cxmap-test.c, tests/cxslist-test.c, tests/cxtree-test.c, cext/Makefile.am, Makefile.am: Copyright and FSF address updated. 2006-06-12 Monday rpalsa * cext/cxlist.c, cext/cxslist.c, cext/cxstrutils.c: Fixes from CPL-1_0-BRANCH for non-standard (non C99) usage of the inline function specifier merged in. 2006-06-12 Monday rpalsa * tests/cxstring-test.c: Disable terminal output from individual tests by default. Environment variable VERBOSE is used to enable verbose output from the tests. 2006-06-12 Monday rpalsa * configure.ac: Package and library version updated. 2006-06-09 Friday rpalsa * cext/cxlist.c, cext/cxslist.c, cext/cxstrutils.c: Non standard (C99) usage of inline function specifier fixed. 2006-06-09 Friday rpalsa * tests/cxstring-test.c: Disable terminal output from individual tests by default. (Needs to be improved!) 2006-05-04 Thursday rpalsa * admin/html.am: Move definition of HTML_BUILD_DIR outside of MAINTAINER_MODE conditional. 2006-05-04 Thursday rpalsa * Makefile.am: Set SUBDIRS variable without using indirection. 2006-05-04 Thursday rpalsa * Doxyfile.in: OUTPUT_DIRECTORY setting corrected. 2006-05-04 Thursday rpalsa * autogen.sh: Workaround for autoreconf problem with libltdl convenience library implemented. 2006-04-21 Friday rpalsa * .cvsignore: Updated. 2006-04-21 Friday rpalsa * admin/.cvsignore: Added. 2006-04-21 Friday rpalsa * cext/cxstring.c, cext/cxtree.c: Compiler warnings fixed. 2006-04-21 Friday rpalsa * cext/cxmessages.c: Compiler warnings fixed. 2006-04-21 Friday rpalsa * cext/Makefile.am: Add cxtypes.h to DISTCLEANFILES. Rule for creating cxtypes.h updated with explicit directory prefixes. 2006-04-21 Friday rpalsa * configure.ac: Package and library version updated. 2006-04-21 Friday rpalsa * Makefile.am: Various directory prefixes adapted. 2006-04-21 Friday rpalsa * bootstrap: Updated to call autogen.sh. Kept for backwards compatibility. 2006-04-21 Friday rpalsa * autogen.sh: Added. 2006-04-21 Friday rpalsa * acinclude.m4: Macro ESO_ENABLE_DEBUG(): Logic inverted in check whether debugging code should be generated. 2006-04-21 Friday rpalsa * tests/Makefile.am: Build directory added to INCLUDES. Symbol AM_LDFLAGS added. 2006-04-21 Friday rpalsa * admin/config.guess, admin/config.sub, admin/depcomp, admin/install-sh, admin/ltmain.sh, admin/missing, admin/mkinstalldirs: Obsolete. 2006-04-21 Friday rpalsa * admin/html.am: Use build directory instead of source directory as target for doxygen output. 2006-04-21 Friday rpalsa * Doxyfile.in: Added. 2006-04-21 Friday rpalsa * m4/eso.m4: Added. 2006-04-20 Thursday rpalsa * cext/cxstrutils.c: cx_strjoinv(): Increment local variable i properly, when joining the array elements. 2006-04-07 Friday rpalsa * m4/eso.m4: Macro definition ESO_CHECK_FUNC: Move AC_CHECK_DECL call before the option pedantic errors is added to the CFLAGS. Otherwise the ISO C Standard compliance makes this macro not working as intended, since it contains a conversion from function pointer to object pointer. 2006-04-07 Friday rpalsa * configure.ac: Pacakge and library version updated. 2006-04-07 Friday rpalsa * tests/Makefile.am: Add build directory to INCLUDES. 2006-04-07 Friday rpalsa * cext/Makefile.am: Target cxtypes.h: Use proper directory prefix for built sources. 2006-04-07 Friday rpalsa * cext/cxmessages.c, cext/cxstring.c, cext/cxstrutils.c: Compiler warnings fixed. 2006-04-07 Friday rpalsa * acinclude.m4: Macro definition CEXT_ENABLE_DEBUG: Logic inverted in check for debug code generation. 2006-04-07 Friday rpalsa * autogen.sh: Added. 2006-04-07 Friday rpalsa * autogen.sh: file autogen.sh was initially added on branch CPL-1_0-BRANCH. 2006-04-07 Friday rpalsa * bootstrap: Updated to use autoreconf. 2006-04-07 Friday rpalsa * Makefile.am: Updated for changed location of the M4 macro files. 2006-04-04 Tuesday rpalsa * m4/eso.m4: Added. 2006-04-04 Tuesday rpalsa * m4/eso.m4: file eso.m4 was initially added on branch CPL-1_0-BRANCH. 2006-04-04 Tuesday rpalsa * admin/.cvsignore: Added. 2006-04-04 Tuesday rpalsa * admin/.cvsignore: file .cvsignore was initially added on branch CPL-1_0-BRANCH. 2006-04-04 Tuesday rpalsa * admin/config.guess, admin/config.sub, admin/depcomp, admin/install-sh, admin/ltmain.sh, admin/missing, admin/mkinstalldirs: Obsolete. 2005-12-02 Friday cplmgr * ChangeLog: Updated. 2005-12-02 Friday rpalsa * tests/Makefile.am: Symbol AM_LDFLAGS added. 2005-08-16 Tuesday rpalsa * cext/cxtree.c: Use inline function specifier according to ISO/IEC 9899:1999(E) 6.7.4 3 2005-08-16 Tuesday rpalsa * configure.ac: Package and library version updated. ESO_SET_LIBRARY_VERSION: Comment indicating its calling sequence added. 2005-08-16 Tuesday rpalsa * cext/cxstring.c: Use inline function specifier according to ISO/IEC 9899:1999(E) 6.7.4 3 2005-04-15 Friday rpalsa * m4macros/eso.m4: Fixes from revision 1.2.2.5 imported. 2005-03-23 Wednesday cplmgr * tests/cxmap-test.c: Function cx_test_map_greater_char() removed. 2004-11-30 Tuesday rpalsa * configure.ac: Change required version of aoutoconf to 2.59 2004-11-09 Tuesday rpalsa * bootstrap: Make the script tolerant in case the libltdl directory exists, but is empty 2004-06-23 Wednesday rpalsa * cext/snprintf.c: Fix bug with %% conversion code 2004-06-15 Tuesday rpalsa * acinclude.m4: Use correct quoting in macro definitions. 2004-06-15 Tuesday rpalsa * bootstrap: Required version of GNU build tools updated. 2004-06-15 Tuesday rpalsa * configure.ac: Required version of autoconf updated. 2004-06-15 Tuesday rpalsa * admin/ltmain.sh: Updated to new version from libtool 1.5.6 2004-06-15 Tuesday rpalsa * admin/html.am: Definition of target html removed. Already provided by automake 1.8.5 2004-06-15 Tuesday rpalsa * admin/config.guess, admin/config.sub, admin/depcomp, admin/install-sh, admin/missing, admin/mkinstalldirs: Updated to new version from automake 1.8.5 2004-06-15 Tuesday rpalsa * Makefile.am, cext/Makefile.am, tests/Makefile.am: Required version of automake updated. 2004-06-15 Tuesday rpalsa * m4macros/eso.m4: Use correct quoting in macro definitions. Use the AC_RUN_IFELSE macro instead of AC_TRY_RUN 2004-06-11 Friday rpalsa * m4macros/eso.m4: Replace macro AC_TRY_RUN with AC_RUN_IFELSE 2004-05-19 Wednesday cplmgr * tests/Makefile.am: Remove -all-static from LDFLAGS. Seems to cause problems on Mac OS X 2004-05-19 Wednesday cplmgr * ChangeLog: Updated. 2004-05-18 Tuesday rpalsa * admin/html.am: Definition of target html removed. Already provided by automake. 2004-05-18 Tuesday rpalsa * admin/config.guess, admin/config.sub, admin/depcomp, admin/install-sh, admin/missing, admin/mkinstalldirs: Updated with new version from automake 1.8.5 2004-05-18 Tuesday rpalsa * admin/ltmain.sh: Updated with new version from libtool 1.5.6 2004-05-18 Tuesday rpalsa * Makefile.am, cext/Makefile.am, tests/Makefile.am: Update required automake version. 2004-05-18 Tuesday rpalsa * bootstrap: Update required build tool versions 2004-05-18 Tuesday rpalsa * acinclude.m4, m4macros/eso.m4: Add proper quoting to macro definitions. 2004-05-14 Friday cplmgr * ChangeLog: Updated. 2004-04-08 Thursday rpalsa * m4macros/eso.m4: In ESO_FUNC_STRDUP: Change pil_strdup to cx_strdup in the symbol definition 2004-01-02 Friday rpalsa * cext/Makefile.am, tests/Makefile.am: MAINTAINER_MODE conditional added. 2003-12-29 Monday rpalsa * cext/cxmemory.c, cext/cxmemory.h, cext/cxmessages.c, cext/cxmessages.h, cext/cxmultimap.c, cext/cxmultimap.h, cext/cxslist.c, cext/cxslist.h, cext/cxstring.c, cext/cxstring.h, cext/cxstrutils.c, cext/cxstrutils.h, cext/cxtree.c, cext/cxtree.h, cext/cxtypes.h.bot, cext/cxtypes.h.top, cext/cxutils.c, cext/cxutils.h, cext/snprintf.c, cext/snprintf.h, cext/Makefile.am, cext/cxfileutils.c, cext/cxfileutils.h, cext/cxlist.c, cext/cxlist.h, cext/cxmacros.h, cext/cxmap.c, cext/cxmap.h, AUTHORS, BUGS, COPYING, ChangeLog, INSTALL, Makefile.am, NEWS, README, TODO, configure.ac: Merged in changes from CPL-1_0-BRANCH, release cpl-1_0 2003-12-29 Monday rpalsa * tests/Makefile.am, tests/cxlist-test.c, tests/cxmap-test.c, tests/cxslist-test.c, tests/cxstring-test.c, tests/cxtree-test.c: Merged in changes from CPL-1_0-BRANCH cpl-6.4.1/libcext/admin/0000755000460300003120000000000012310333010011776 500000000000000cpl-6.4.1/libcext/admin/compile0000744000460300003120000001624512310332713013313 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2012 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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 2, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/libcext/admin/ltmain.sh0000644000460300003120000105152212310332704013555 00000000000000 # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.2 TIMESTAMP="" package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 cpl-6.4.1/libcext/admin/doxygen.am0000644000460300003120000000446212112623623013734 00000000000000DOXYGEN_BUILD_DIR = $(top_builddir) if MAINTAINER_MODE DOXYGEN_RECURSIVE_TARGETS = install-doxygen-recursive doxygen: doxygen-am doxygen-am: @if test -f $(DOXYGEN_BUILD_DIR)/Doxyfile; then \ echo "cd $(DOXYGEN_BUILD_DIR) && $(DOXYGEN)"; \ d=`pwd`; cd $(DOXYGEN_BUILD_DIR) && $(DOXYGEN); cd $$d; \ if test -n "$(POST_DOXYGEN_CLEANFILES)"; then \ cd $(DOXYGEN_BUILD_DIR)/html && rm -f $(POST_DOXYGEN_CLEANFILES); \ fi; \ else \ echo "Nothing to be done for \`$@'."; \ fi clean-doxygen: clean-doxygen-am clean-doxygen-am: -rm -rf $(DOXYGEN_BUILD_DIR)/html DOXYGEN_INSTALL_TARGETS = doxygen-am install-doxygen-generic else DOXYGEN_RECURSIVE_TARGETS = install-doxygen-recursive DOXYGEN_INSTALL_TARGETS = install-doxygen-generic endif install-doxygen: install-doxygen-recursive install-doxygen-am: $(DOXYGEN_INSTALL_TARGETS) install-doxygen-generic: @$(NORMAL_INSTALL) @if test -d $(DOXYGEN_BUILD_DIR)/html; then \ echo "$(mkinstalldirs) $(DESTDIR)$(apidocdir)"; \ $(mkinstalldirs) $(DESTDIR)$(apidocdir); \ list="`ls -1 $(DOXYGEN_BUILD_DIR)/html`"; \ for p in $$list; do \ if test -f $(DOXYGEN_BUILD_DIR)/html/$$p; then \ echo " $(INSTALL_DATA) $(DOXYGEN_BUILD_DIR)/html/$$p $(DESTDIR)$(apidocdir)/$$p"; \ $(INSTALL_DATA) $(DOXYGEN_BUILD_DIR)/html/$$p $(DESTDIR)$(apidocdir)/$$p; \ else if test -f $$p; then \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(apidocdir)/$$p"; \ $(INSTALL_DATA) $$p $(DESTDIR)$(apidocdir)/$$p; \ fi; fi; \ done; \ fi uninstall-doxygen: @$(NORMAL_UNINSTALL) @list="`ls -1 $(DESTDIR)$(apidocdir)`"; \ for p in $$list; do \ echo " rm -f $(DESTDIR)$(apidocdir)/$$p"; \ rm -f $(DESTDIR)$(apidocdir)/$$p; \ done $(DOXYGEN_RECURSIVE_TARGETS): @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(DOXYGEN_SUBDIRS)'; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" cpl-6.4.1/libcext/admin/depcomp0000744000460300003120000005570312310332713013314 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2012-10-18.11; # UTC # Copyright (C) 1999-2012 Free Software Foundation, Inc. # 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 2, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/libcext/admin/config.guess0000744000460300003120000012760712310332713014262 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-09-25' # This file 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 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, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cpl-6.4.1/libcext/admin/config.sub0000744000460300003120000010565612310332713013725 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-12-06' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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 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, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cpl-6.4.1/libcext/admin/test-driver0000744000460300003120000000761112310332713014130 00000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2012-06-27.10; # UTC # Copyright (C) 2011-2012 Free Software Foundation, Inc. # # 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 2, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then estatus=1 fi case $estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/libcext/admin/install-sh0000744000460300003120000003325512310332713013741 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/libcext/admin/missing0000744000460300003120000001533112310332713013327 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2012-06-26.16; # UTC # Copyright (C) 1996-2012 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # 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 2, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'automa4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/libcext/Doxyfile.in0000644000460300003120000002363212063623666012777 00000000000000# Doxyfile 1.7.5.1 #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = "C Standard Library Extensions" PROJECT_NUMBER = @VERSION@ PROJECT_BRIEF = PROJECT_LOGO = OUTPUT_DIRECTORY = . CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ABBREVIATE_BRIEF = ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO STRIP_FROM_PATH = STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 4 ALIASES = doc= OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_JAVA = NO OPTIMIZE_FOR_FORTRAN = NO OPTIMIZE_OUTPUT_VHDL = NO EXTENSION_MAPPING = BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO SIP_SUPPORT = NO IDL_PROPERTY_SUPPORT = YES DISTRIBUTE_GROUP_DOC = NO SUBGROUPING = YES INLINE_GROUPED_CLASSES = NO INLINE_SIMPLE_STRUCTS = NO TYPEDEF_HIDES_STRUCT = NO SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = NO EXTRACT_PRIVATE = NO EXTRACT_STATIC = NO EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_METHODS = NO EXTRACT_ANON_NSPACES = NO HIDE_UNDOC_MEMBERS = YES HIDE_UNDOC_CLASSES = YES HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO CASE_SENSE_NAMES = YES HIDE_SCOPE_NAMES = NO SHOW_INCLUDE_FILES = YES FORCE_LOCAL_INCLUDES = NO INLINE_INFO = NO SORT_MEMBER_DOCS = YES SORT_BRIEF_DOCS = NO SORT_MEMBERS_CTORS_1ST = NO SORT_GROUP_NAMES = YES SORT_BY_SCOPE_NAME = NO STRICT_PROTO_MATCHING = NO GENERATE_TODOLIST = YES GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES GENERATE_DEPRECATEDLIST= YES ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = YES SHOW_DIRECTORIES = YES SHOW_FILES = YES SHOW_NAMESPACES = YES FILE_VERSION_FILTER = LAYOUT_FILE = CITE_BIB_FILES = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO WARN_FORMAT = WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = @top_srcdir@/cext INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.dox \ *.h \ *.c RECURSIVE = NO EXCLUDE = CVS EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXCLUDE_SYMBOLS = EXAMPLE_PATH = EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO IMAGE_PATH = INPUT_FILTER = FILTER_PATTERNS = FILTER_SOURCE_FILES = NO FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = NO INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES REFERENCES_LINK_SOURCE = YES USE_HTAGS = NO VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = YES COLS_IN_ALPHA_INDEX = 5 IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = HTML_EXTRA_FILES = HTML_COLORSTYLE_HUE = 220 HTML_COLORSTYLE_SAT = 100 HTML_COLORSTYLE_GAMMA = 80 HTML_TIMESTAMP = NO HTML_ALIGN_MEMBERS = YES HTML_DYNAMIC_SECTIONS = NO GENERATE_DOCSET = NO DOCSET_FEEDNAME = "Doxygen generated docs" DOCSET_BUNDLE_ID = org.doxygen.Project DOCSET_PUBLISHER_ID = org.doxygen.Publisher DOCSET_PUBLISHER_NAME = Publisher GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO CHM_INDEX_ENCODING = BINARY_TOC = NO TOC_EXPAND = NO GENERATE_QHP = NO QCH_FILE = QHP_NAMESPACE = org.doxygen.Project QHP_VIRTUAL_FOLDER = doc QHP_CUST_FILTER_NAME = QHP_CUST_FILTER_ATTRS = QHP_SECT_FILTER_ATTRS = QHG_LOCATION = GENERATE_ECLIPSEHELP = NO ECLIPSE_DOC_ID = org.doxygen.Project DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = NO USE_INLINE_TREES = NO TREEVIEW_WIDTH = 250 EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES USE_MATHJAX = NO MATHJAX_RELPATH = http://www.mathjax.org/mathjax MATHJAX_EXTENSIONS = SEARCHENGINE = NO SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = NO LATEX_OUTPUT = latex LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex COMPACT_LATEX = NO PAPER_TYPE = a4wide EXTRA_PACKAGES = LATEX_HEADER = LATEX_FOOTER = PDF_HYPERLINKS = NO USE_PDFLATEX = NO LATEX_BATCHMODE = NO LATEX_HIDE_INDICES = NO LATEX_SOURCE_CODE = NO LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- GENERATE_RTF = NO RTF_OUTPUT = COMPACT_RTF = NO RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- GENERATE_MAN = NO MAN_OUTPUT = MAN_EXTENSION = MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = NO XML_OUTPUT = xml XML_SCHEMA = XML_DTD = XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- GENERATE_PERLMOD = NO PERLMOD_LATEX = NO PERLMOD_PRETTY = YES PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = "CX_BEGIN_DECLS= " \ "CX_END_DECLS= " EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- TAGFILES = GENERATE_TAGFILE = ALLEXTERNALS = NO EXTERNAL_GROUPS = YES PERL_PATH = #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = YES MSCGEN_PATH = HIDE_UNDOC_RELATIONS = YES HAVE_DOT = NO DOT_NUM_THREADS = 0 DOT_FONTNAME = Helvetica DOT_FONTSIZE = 10 DOT_FONTPATH = CLASS_GRAPH = YES COLLABORATION_GRAPH = YES GROUP_GRAPHS = YES UML_LOOK = NO TEMPLATE_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO CALLER_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png INTERACTIVE_SVG = NO DOT_PATH = DOTFILE_DIRS = MSCFILE_DIRS = DOT_GRAPH_MAX_NODES = 50 MAX_DOT_GRAPH_DEPTH = 0 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES DOT_CLEANUP = YES cpl-6.4.1/libcext/NEWS0000644000460300003120000000000007774033725011347 00000000000000cpl-6.4.1/libcext/README0000644000460300003120000000131307774033725011540 00000000000000 In this file: * About libcext * Prerequisites * Installation * Reporting Bugs About libcext ------------- This is version 1.0 of libcext, ESO's C Library Extensions. It is a C utility library, which is used to implement ESO's Common Pipeline Library (CPL). This package provides the libcext library including the on-line reference manual. Prerequisites -------------- For installing libcext or to use it for your own software project you need an ANSI-C compiler (gcc version 3.2 or newer for instance). Installation ------------ For generic installation instructions please refer to the file INSTALL coming with this package. Reporting Bugs -------------- Please report any bugs to cpl-6.4.1/libcext/m4/0000755000460300003120000000000012310333010011226 500000000000000cpl-6.4.1/libcext/m4/ltversion.m40000644000460300003120000000126212310332704013447 00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) cpl-6.4.1/libcext/m4/libtool.m40000644000460300003120000105721612310332704013101 00000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS cpl-6.4.1/libcext/m4/ltoptions.m40000644000460300003120000003007312310332704013457 00000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) cpl-6.4.1/libcext/m4/lt~obsolete.m40000644000460300003120000001375612310332704014007 00000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) cpl-6.4.1/libcext/m4/eso.m40000644000460300003120000006703012231463331012220 00000000000000# ESO_PROG_CC_FLAG(FLAG, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) #----------------------------------------------------------------- AC_DEFUN([ESO_PROG_CC_FLAG], [ AC_REQUIRE([AC_PROG_CC]) flag=`echo $1 | sed 'y%.=/+-%___p_%'` AC_CACHE_CHECK([whether $CC supports -$1], [eso_cv_prog_cc_$flag], [ eval "eso_cv_prog_cc_$flag=no" AC_LANG_PUSH(C) echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -$1 -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -$1 -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* AC_LANG_POP(C) ]) if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : $2 else : $3 fi ]) # ESO_PROG_CC_ATTRIBUTE(VARIANT1, [VARIANT2], [CODE], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) #---------------------------------------------------------------------------------------------- AC_DEFUN([ESO_PROG_CC_ATTRIBUTE], [ AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))], AS_TR_SH([eso_cv_prog_cc_attribute_$1]), [ eso_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS" AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])], [eval "AS_TR_SH([eso_cv_prog_cc_attribute_$1])='yes'"], [eval "AS_TR_SH([eso_cv_prog_cc_attribute_$1])='no'"]) CFLAGS="$eso_save_CFLAGS" ]) if eval "test x\$AS_TR_SH([eso_cv_prog_cc_attribute_$1]) = xyes"; then : $4 else : $5 fi ]) # ESO_PROG_CC_ATTRIBUTE_VISIBILITY(ARG, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) #-------------------------------------------------------------------------------- AC_DEFUN([ESO_PROG_CC_ATTRIBUTE_VISIBILITY], [ ESO_PROG_CC_ATTRIBUTE([visibility_$1], [visibility("$1")], [void __attribute__((visibility("$1"))) $1_function() { }], [$2], [$3]) ]) # ESO_ENABLE_DEBUG(debug=no) #--------------------------- AC_DEFUN([ESO_ENABLE_DEBUG], [ AC_REQUIRE([AC_PROG_CC]) AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [creates debugging code [[default=$1]]]), eso_enable_debug=$enableval, eso_enable_debug=$1) AC_CACHE_CHECK([whether debugging code should be created], eso_cv_enable_debug, eso_cv_enable_debug=$eso_enable_debug) if test x"$eso_cv_enable_debug" = xyes; then eso_clean_CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]//g' \ -e 's/-g[[0-9]]//g' \ -e 's/-g[[a-z,A-Z]]* / /g' \ -e 's/-[[Og]]//g'`" ESO_PROG_CC_FLAG([g3], [CFLAGS="$CFLAGS -g3"]) if test x"$eso_cv_prog_cc_g3" = xyes; then CFLAGS="-g3" else if test x"$ac_cv_prog_cc_g" = xyes; then CFLAGS="-g" else CFLAGS="" fi fi ESO_PROG_CC_FLAG([ggdb], [CFLAGS="$CFLAGS -ggdb"]) ESO_PROG_CC_FLAG([O0], [CFLAGS="$CFLAGS -O0"]) ESO_PROG_CC_FLAG([rdynamic], [CFLAGS="$CFLAGS -rdynamic"]) ESO_PROG_CC_FLAG([Wall], [CFLAGS="$CFLAGS -Wall"]) ESO_PROG_CC_FLAG([W], [CFLAGS="$CFLAGS -W"]) CFLAGS="$CFLAGS $eso_clean_CFLAGS" ESO_DEBUG_FLAGS="-DESO_ENABLE_DEBUG" else ESO_DEBUG_FLAGS="-DNDEBUG" fi AC_SUBST(ESO_DEBUG_FLAGS) ]) # ESO_ENABLE_STRICT(strict=no) #----------------------------- AC_DEFUN([ESO_ENABLE_STRICT], [ AC_REQUIRE([AC_PROG_EGREP]) AC_REQUIRE([AC_PROG_CC]) AC_ARG_ENABLE(strict, AC_HELP_STRING([--enable-strict], [compiles with strict compiler options (may not work!) [[default=$1]]]), eso_enable_strict=$enableval, eso_enable_strict=$1) AC_CACHE_CHECK([whether strict compiler options should be used], eso_cv_enable_strict, eso_cv_enable_strict=$eso_enable_strict) if test x"$eso_cv_enable_strict" = xyes; then eso_enable_strict_std_set=no if test -n "$CFLAGS"; then echo $CFLAGS | $EGREP '(\-std=|-ansi)' >/dev/null 2>&1 if test x"$?" = x0; then eso_enable_strict_std_set=yes fi fi if test x"$eso_enable_strict_std_set" = xno; then ESO_PROG_CC_FLAG([std=c99], [CFLAGS="$CFLAGS -std=c99"]) fi ESO_PROG_CC_FLAG([pedantic], [CFLAGS="$CFLAGS -pedantic"]) fi ]) # ESO_ENABLE_PROFILE(profile=no) #----------------------------- AC_DEFUN([ESO_ENABLE_PROFILE], [ AC_REQUIRE([AC_PROG_CC]) AC_ARG_ENABLE(profile, AC_HELP_STRING([--enable-profile], [compiles with compiler options necessary for profiling (may not work!) [[default=$1]]]), eso_enable_profile=$enableval, eso_enable_profile=$1) AC_CACHE_CHECK([whether profiling compiler options should be used], eso_cv_enable_profile, eso_cv_enable_profile=$eso_enable_profile) if test x"$eso_cv_enable_profile" = xyes; then ESO_PROG_CC_FLAG([pg], [CFLAGS="$CFLAGS -pg"]) ESO_PROG_CC_FLAG([g], [CFLAGS="$CFLAGS -g"]) ESO_PROG_CC_FLAG([static-libgcc], [CFLAGS="$CFLAGS -static-libgcc"]) AC_ENABLE_SHARED(no) AC_ENABLE_STATIC(yes) fi ]) # ESO_CHECK_DOCTOOLS #------------------- AC_DEFUN([ESO_CHECK_DOCTOOLS], [ AC_ARG_VAR([DOXYGEN], [doxygen command]) AC_PATH_PROG([DOXYGEN], [doxygen]) AC_ARG_VAR([LATEX], [latex command]) AC_PATH_PROG([LATEX], [latex]) if test -z "${DOXYGEN}"; then DOXYGEN=":" fi if test -z "${LATEX}"; then LATEX=":" fi ]) # ESO_PROG_AR #------------ # Checks if ar is in the path AC_DEFUN([ESO_PROG_AR], [ AC_CHECK_PROG(AR, ar, ar, NONE) if test x"$AR" = xNONE; then AC_MSG_ERROR([Cannot find \'ar\']) fi ]) # ESO_PROG_PKGCONFIG #------------------- # Checks if pkg-config is in the path AC_DEFUN([ESO_PROG_PKGCONFIG], [ AC_ARG_VAR([PKGCONFIG], [pkg-config command]) AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config]) ]) # ESO_CHECK_EXTRA_LIBS #--------------------- # Check for non-standard headers and libraries AC_DEFUN([ESO_CHECK_EXTRA_LIBS], [ AC_ARG_WITH(extra-includes, AC_HELP_STRING([--with-extra-includes=DIR], [adds non standard include paths]), eso_with_extra_includes=$withval, eso_with_extra_includes=NONE) AC_ARG_WITH(extra-libs, AC_HELP_STRING([--with-extra-libs=DIR], [adds non standard library paths]), eso_with_extra_libs=$withval, eso_with_extra_libs=NONE) AC_MSG_CHECKING([for extra includes]) AC_CACHE_VAL([eso_cv_with_extra_includes], [ eso_cv_with_extra_includes=$eso_with_extra_includes ]) if test x"$eso_cv_with_extra_includes" != xNONE; then eso_save_IFS=$IFS IFS=':' for dir in $eso_cv_with_extra_includes; do EXTRA_INCLUDES="$EXTRA_INCLUDES -I$dir" done IFS=$eso_save_IFS AC_MSG_RESULT(added) else AC_MSG_RESULT(no) fi AC_MSG_CHECKING([for extra libs]) AC_CACHE_VAL([eso_cv_with_extra_libs], [ eso_cv_with_extra_libs=$eso_with_extra_libs ]) if test x"$eso_cv_with_extra_libs" != xNONE; then eso_save_IFS=$IFS IFS=':' for dir in $eso_cv_with_extra_libs; do EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$dir" done IFS=$eso_save_IFS AC_MSG_RESULT(added) else AC_MSG_RESULT(no) fi ]) # ESO_CHECK_THREADS_POSIX #------------------------ # Check whether the POSIX threads are available. The cached result is # set to 'yes' if either the compiler supports the '-pthread' flag, or linking # with the POSIX thread library works, and the header file defining the POSIX # threads symbols is present. If POSIX threads are not supported, the # result is set to 'no'. Whether the compiler supports POSIX threads, # or whether the library, and the header are available is stored in cache # variables. AC_DEFUN([ESO_CHECK_THREADS_POSIX], [ AC_REQUIRE([AC_PROG_CC]) ESO_PROG_CC_FLAG([pthread], [], []) AC_CHECK_LIB([pthread], [pthread_create], [eso_threads_have_libpthread=yes], [eso_threads_have_libpthread=no]) AC_CHECK_HEADER([pthread.h], [eso_threads_have_pthread_h=yes], [eso_threads_have_pthread_h=no]) if test x"$eso_threads_have_pthread_h" != xyes; then eso_threads_posix=no else if test x"$eso_threads_have_libpthread" != xyes && \ test x"$eso_cv_prog_cc_pthread" != xyes; then eso_threads_posix=no else eso_threads_posix=yes fi fi # Setup the POSIX thread symbols if test x"$eso_threads_have_pthread_h" = xyes; then AC_DEFINE([HAVE_PTHREAD_H], [1], [Define to 1 if you have .]) fi if test x"$eso_threads_posix" = xyes; then if test x"$eso_cv_prog_cc_pthread" = xyes; then PTHREAD_CFLAGS="-pthread" else PTHREAD_CFLAGS="" fi if test x"$eso_threads_have_libpthread" = xyes; then LIBPTHREAD="-lpthread" else LIBPTHREAD="" fi fi AC_CACHE_VAL(eso_cv_threads_posix_header, eso_cv_threads_posix_header=$eso_threads_have_pthread_h) AC_CACHE_VAL(eso_cv_threads_posix_lib, eso_cv_threads_posix_lib=$eso_threads_have_libpthread) AC_CACHE_VAL(eso_cv_threads_posix_flags, eso_cv_threads_posix_flags=$eso_cv_prog_cc_pthread) AC_CACHE_VAL(eso_cv_threads_posix, eso_cv_threads_posix=$eso_threads_posix) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(LIBPTHREAD) ]) # ESO_CHECK_FUNC(FUNCTION, INCLUDES, SYMBOL) #------------------------------------------- # Checks whether a function is available and declared. AC_DEFUN([ESO_CHECK_FUNC], [ AC_LANG_PUSH(C) AC_CHECK_DECL($1, [], [], [$2]) eso_save_CFLAGS="$CFLAGS" if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -pedantic-errors" fi AC_CHECK_FUNC($1) CFLAGS="$eso_save_CFLAGS" AC_LANG_POP(C) if test x"$ac_cv_have_decl_$1" = xyes && test x"$ac_cv_func_$1" = xyes; then AC_DEFINE($3) fi ]) # ESO_FUNC_VSNPRINTF_C99 #----------------------- # Check whether vsnprintf() has C99 semantics. AC_DEFUN([ESO_FUNC_VSNPRINTF_C99], [ AH_TEMPLATE([HAVE_VSNPRINTF_C99], [Define if you have the C99 `vsnprintf' function.]) AC_CACHE_CHECK([whether vsnprintf has C99 semantics], [eso_cv_func_vsnprintf_c99], [ AC_LANG_PUSH(C) eso_cppflags_save="$CPPFLAGS" eso_cflags_save="$CFLAGS" eso_ldflags_save="$LDFLAGS" eso_libs_save="$LIBS" if test x$GCC = xyes; then CFLAGS="$CFLAGS -pedantic-errors" CPPFLAGS="$CPPFLAGS $CFLAGS" fi AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include #include #include int doit(char * s, ...) { char buffer[32]; va_list args; int q, r; va_start(args, s); q = vsnprintf(NULL, 0, s, args); r = vsnprintf(buffer, 5, s, args); va_end(args); if (q != 7 || r != 7) exit(1); exit(0); } ]], [[ doit((char*)"1234567"); exit(1); ]]) ], [eso_cv_func_vsnprintf_c99=yes], [eso_cv_func_vsnprintf_c99=no], [eso_cv_func_vsnprintf_c99=no]) CPPFLAGS="$eso_cppflags_save" CFLAGS="$eso_cflags_save" LDFLAGS="$eso_ldflags_save" LIBS="$eso_libs_save" AC_LANG_POP(C) ]) # Note that the default is to be pessimistic in the case of cross compilation. # If you know that the target has a C99 vsnprintf(), you can get around this # by setting eso_func_vsnprintf_c99 to yes, as described in the Autoconf # manual. if test x$eso_cv_func_vsnprintf_c99 = xyes; then AC_DEFINE(HAVE_VSNPRINTF_C99) fi ]) # ESO_CHECK_PRINTF_FORMATS #------------------------- # Checks for printf() format peculiarities. AC_DEFUN([ESO_CHECK_PRINTF_FORMATS], [ # Check if string format for NULL is `(null)' AH_TEMPLATE([HAVE_PRINTF_STR_FMT_NULL], [Define if printf outputs `(null)' when printing NULL using `%s']) AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include #include ]], [[ char s[128]; sprintf(s, "%s", NULL); return strncmp(s, "(null)", 6) ? 1 : 0; ]]) ], [eso_have_printf_str_format_null=yes], [eso_have_printf_str_format_null=no], [eso_have_printf_str_format_null=no]) if test x$eso_have_printf_str_format_null = xyes; then AC_DEFINE(HAVE_PRINTF_STR_FMT_NULL) fi # Check if pointer format for NULL is `(nil)' AH_TEMPLATE([HAVE_PRINTF_PTR_FMT_NIL], [Define if printf outputs `(nil)' when printing NULL using `%p']) AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include #include ]], [[ char s[128]; sprintf(s, "%p", NULL); return strncmp(s, "(nil)", 5) ? 1 : 0; ]]) ], [eso_have_printf_ptr_format_nil=yes], [eso_have_printf_ptr_format_nil=no], [eso_have_printf_ptr_format_nil=no]) if test x$eso_have_printf_ptr_format_nil = xyes; then AC_DEFINE(HAVE_PRINTF_PTR_FMT_NIL) fi # Check if output for `%p' is the same as `%#x' AH_TEMPLATE([HAVE_PRINTF_PTR_FMT_ALTERNATE], [Define if printf format `%p' produces the same output as `%#x' or `%#lx']) AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include #include ]], [[ char s1[128], s2[128]; sprintf(s1, "%p", s1); sprintf(s2, "%#x", s1); return strncmp(s1, s2, 3) ? 1 : 0; ]]) ], [eso_have_printf_ptr_format_alternate=yes], [eso_have_printf_ptr_format_alternate=no], [eso_have_printf_ptr_format_alternate=no]) if test x$eso_have_printf_ptr_format_alternate = xyes; then AC_DEFINE(HAVE_PRINTF_PTR_FMT_ALTERNATE) fi # Check if pointers are treated as signed AH_TEMPLATE([HAVE_PRINTF_PTR_FMT_SIGNED], [Define if printf treats pointers as signed when using a sign flag]) AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include ]], [[ char s[128]; sprintf(s, "%+p", s); return s[0] == '+' ? 0 : 1; ]]) ], [eso_have_printf_ptr_format_signed=yes], [eso_have_printf_ptr_format_signed=no], [eso_have_printf_ptr_format_signed=no]) if test x$eso_have_printf_ptr_format_signed = xyes; then AC_DEFINE(HAVE_PRINTF_PTR_FMT_SIGNED) fi # Check if default precision for conversion specifier `g' is 1 (as # required by ISO C) or 6. AH_TEMPLATE([HAVE_PRINTF_FLT_FMT_G_STD], [Define if printf default precision for format `g' is 1 (ISO C standard) or 6]) AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include ]], [[ char s1[128], s2[128]; int n1, n2; sprintf(s1, "%g%n", 1.123456, &n1); sprintf(s2, "%.1g%n", 1.123456, &n2); return n1 > n2 ? 1 : 0; ]]) ], [eso_have_printf_flt_format_g_std=yes], [eso_have_printf_flt_format_g_std=no], [eso_have_printf_flt_format_g_std=no]) if test x$eso_have_printf_flt_format_g_std = xyes; then AC_DEFINE(HAVE_PRINTF_FLT_FMT_G_STD) fi ]) # ESO_FUNC_VSNPRINTF #------------------- # Checks for vsnprintf and snprintf declaration and function. AC_DEFUN([ESO_FUNC_VSNPRINTF], [ eso_compile_snprintf=no AH_TEMPLATE([HAVE_VSNPRINTF], [Define if you have the `vsnprintf' function]) ESO_CHECK_FUNC(vsnprintf, [ #include #include ], HAVE_VSNPRINTF) if test x$ac_cv_func_vsnprintf = xyes && test x$ac_cv_have_decl_vsnprintf = xyes; then ESO_FUNC_VSNPRINTF_C99 if test x$eso_cv_func_vsnprintf_c99 != xyes; then eso_compile_snprintf=yes fi else eso_compile_snprintf=yes fi if test x$eso_compile_snprintf = xyes; then if test -n "$LIBTOOL"; then SNPRINTF=snprintf.lo else SNPRINTF=snprintf.$ac_objext fi fi AC_SUBST(SNPRINTF) # The symbols defined by the following macro are only needed to setup the # vsnprintf() replacement. May be useless if the vsnprintf implementation # changes. ESO_CHECK_PRINTF_FORMATS AH_TEMPLATE([HAVE_SNPRINTF], [Define if you have the `snprintf' function]) ESO_CHECK_FUNC(snprintf, [#include ], HAVE_SNPRINTF) ]) # ESO_FUNC_VASPRINTF #------------------- # Checks for vasprintf and asprintf declaration and function. AC_DEFUN([ESO_FUNC_VASPRINTF], [ AH_TEMPLATE([HAVE_VASPRINTF], [Define if you have the `vasprintf' function]) ESO_CHECK_FUNC(vasprintf, [ #include #include ], HAVE_VASPRINTF) AH_TEMPLATE([HAVE_ASPRINTF], [Define if you have the `asprintf' function]) ESO_CHECK_FUNC(asprintf, [ #include ], HAVE_ASPRINTF) ]) # ESO_FUNC_FPATHCONF #------------------- # Checks for fpathconf declaration and function. AC_DEFUN([ESO_FUNC_FPATHCONF], [ AH_TEMPLATE([HAVE_FPATHCONF], [Define if you have the `fpathconf' function]) ESO_CHECK_FUNC(fpathconf, [#include ], HAVE_FPATHCONF) # If we have fpathconf we should also have pathconf, but who knows. AH_TEMPLATE([HAVE_PATHCONF], [Define if you have the `pathconf' function]) ESO_CHECK_FUNC(pathconf, [#include ], HAVE_PATHCONF) ]) # ESO_FUNC_SYSCONF #----------------- # Checks for sysconf declaration and function. AC_DEFUN([ESO_FUNC_SYSCONF], [ AH_TEMPLATE([HAVE_SYSCONF], [Define if you have the `sysconf' function]) ESO_CHECK_FUNC(sysconf, [#include ], HAVE_SYSCONF) ]) # ESO_FUNC_GETOPT #---------------- # Checks for GNU getopt_long declaration and function. AC_DEFUN([ESO_FUNC_GETOPT], [ AH_TEMPLATE([HAVE_GETOPT_LONG], [Define if you have the `getopt_long' function]) ESO_CHECK_FUNC(getopt_long, [#include ], HAVE_GETOPT_LONG) if test x"$ac_cv_func_getopt_long" = xno || test x"$eso_cv_have_decl_getopt_long" = xno; then if test -n "$LIBTOOL"; then GETOPT="getopt.lo getopt1.lo" else GETOPT="getopt.$ac_objext getopt1.$ac_objext" fi fi AC_SUBST(GETOPT) ]) # ESO_FUNC_GETPWUID #------------------ # Checks for getpwuid declaration and function. AC_DEFUN([ESO_FUNC_GETPWUID], [ AH_TEMPLATE([HAVE_GETPWUID], [Define if you have the `getpwuid' function]) ESO_CHECK_FUNC(getpwuid, [#include ], HAVE_GETPWUID) ]) # ESO_FUNC_GETUID #---------------- AC_DEFUN([ESO_FUNC_GETUID], [ AH_TEMPLATE([HAVE_GETUID], [Define if you have the `getuid' function]) ESO_CHECK_FUNC(getuid, [#include ], HAVE_GETUID) ]) # ESO_FUNC_LSTAT #--------------- AC_DEFUN([ESO_FUNC_LSTAT], [ AH_TEMPLATE([HAVE_LSTAT], [Define if you have the `lstat' function]) ESO_CHECK_FUNC(lstat, [#include ], HAVE_LSTAT) ]) # ESO_FUNC_STRDUP #---------------- AC_DEFUN([ESO_FUNC_STRDUP], [ AH_TEMPLATE([HAVE_STRDUP], [Define if you have the `strdup' function]) ESO_CHECK_FUNC(strdup, [#include ], HAVE_STRDUP) AH_BOTTOM([ #ifndef HAVE_STRDUP # define strdup cx_strdup #endif ]) ]) # ESO_FUNC_STPCPY #---------------- AC_DEFUN([ESO_FUNC_STPCPY], [ AH_TEMPLATE([HAVE_STPCPY], [Define if you have the `stpcpy' function]) ESO_CHECK_FUNC(stpcpy, [#include ], HAVE_STPCPY) ]) # ESO_FUNC_SYMLINK #----------------- AC_DEFUN([ESO_FUNC_SYMLINK], [ AH_TEMPLATE([HAVE_SYMLINK], [Define if you have the `symlink' function]) ESO_CHECK_FUNC(symlink, [#include ], HAVE_SYMLINK) ]) # ESO_FUNC_WORDEXP #----------------- AC_DEFUN([ESO_FUNC_WORDEXP], [ AH_TEMPLATE([HAVE_WORDEXP], [Define if you have the `wordexp' function]) ESO_CHECK_FUNC(wordexp, [#include ], HAVE_WORDEXP) ]) # ESO_FUNC_GETTIMEOFDAY #---------------------- AC_DEFUN([ESO_FUNC_GETTIMEOFDAY], [ AH_TEMPLATE([HAVE_GETTIMEOFDAY], [Define if you have the `gettimeofday' function]) ESO_CHECK_FUNC(gettimeofday, [ #include #include ], HAVE_GETTIMEOFDAY) ]) # ESO_FUNC_VA_COPY(symbol) #------------------------- # Check for an implementation of va_copy(). The argument which must be # given is the preprocessor symbol that is defined to be either va_copy # or __va_copy depending on the available function, provided that an # implementation of va_copy is available at all. AC_DEFUN([ESO_FUNC_VA_COPY], [ # Check for all three va_copy possibilities, so we get # all results in config.log for bug reports. # Check for availability of va_copy(). This is ISO C. Available with # gcc since version 3.0. AC_CACHE_CHECK([for an implementation of va_copy()], [eso_cv_have_va_copy], [ AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #ifdef HAVE_STDARG_H #include #endif void f(int i, ...) { va_list args1, args2; va_start (args1, i); va_copy (args2, args1); if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) exit (1); va_end (args1); va_end (args2); } ]], [[ f(0, 42); ]]) ], [eso_cv_have_va_copy=yes], [eso_cv_have_va_copy=no], [eso_cv_have_va_copy=no]) ]) # Check for availability of __va_copy(). Some compilers provide # this. Available with gcc since version 2.8.1. AC_CACHE_CHECK([for an implementation of __va_copy()], [eso_cv_have__va_copy], [ AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #ifdef HAVE_STDARG_H #include #endif void f(int i, ...) { va_list args1, args2; va_start (args1, i); __va_copy (args2, args1); if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) exit (1); va_end (args1); va_end (args2); } ]], [[ f(0, 42); ]]) ], [eso_cv_have__va_copy=yes], [eso_cv_have__va_copy=no], [eso_cv_have__va_copy=no]) ]) AH_TEMPLATE([HAVE_VA_COPY], [Define if you have an implementation of `va_copy()'.]) AH_TEMPLATE([HAVE___VA_COPY], [Define if you have an implementation of `__va_copy()'.]) if test "x$eso_cv_have_va_copy" = "xyes"; then eso_func_va_copy=va_copy AC_DEFINE(HAVE_VA_COPY) else if test "x$eso_cv_have__va_copy" = "xyes"; then eso_func_va_copy=__va_copy AC_DEFINE(HAVE___VA_COPY) fi fi AH_TEMPLATE([HAVE_VA_COPY_STYLE_FUNCTION], [Define if you have an implementation of a `va_copy()' style function.]) AH_TEMPLATE([$1], [A `va_copy()' style function]) if test -n "$eso_func_va_copy"; then AC_DEFINE_UNQUOTED([$1], $eso_func_va_copy) AC_DEFINE(HAVE_VA_COPY_STYLE_FUNCTION) fi # Check whether va_lists can be copied by value AC_CACHE_CHECK([whether va_lists can be copied by value], [eso_cv_have_va_value_copy], [ AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #ifdef HAVE_STDARG_H #include #endif void f(int i, ...) { va_list args1, args2; va_start (args1, i); args2 = args1; if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) exit (1); va_end (args1); va_end (args2); } ]], [[ f(0, 42); ]]) ], [eso_cv_have_va_value_copy=yes], [eso_cv_have_va_value_copy=no], [eso_cv_have_va_value_copy=no]) ]) AH_TEMPLATE([HAVE_VA_LIST_COPY_BY_VALUE], [Define if `va_lists' can be copied by value]) if test "x$eso_cv_have_va_value_copy" = "xyes"; then AC_DEFINE(HAVE_VA_LIST_COPY_BY_VALUE) fi ]) # ESO_FUNC_REALLOC_SANITY #------------------------- # Check whether realloc(NULL,) works. AC_DEFUN([ESO_FUNC_REALLOC_SANITY], [ AC_CACHE_CHECK([whether realloc(NULL,) works], [eso_cv_have_sane_realloc], [ AC_RUN_IFELSE( [ AC_LANG_PROGRAM( [[ #include ]], [[ return realloc (0, sizeof (int)) == 0; ]]) ], [eso_cv_have_sane_realloc=yes], [eso_cv_have_sane_realloc=no], [eso_cv_have_sane_realloc=no]) ]) AH_TEMPLATE([HAVE_WORKING_REALLOC], [Define if realloc(NULL,) works]) if test x$eso_cv_have_sane_realloc = xyes; then AC_DEFINE(HAVE_WORKING_REALLOC) fi ]) # ESO_FIND_FILE(file, directories, variable) #------------------------------------------ # Search for file in directories. Set variable to the first location # where file was found, if file is not found at all variable is set to NO. AC_DEFUN([ESO_FIND_FILE], [ $3=no for i in $2; do for j in $1; do echo "configure: __oline__: $i/$j" >&AC_FD_CC if test -r "$i/$j"; then echo "taking that" >&AC_FD_CC $3=$i break 2 fi done done ]) # ESO_SET_LIBRARY_VERSION([CURRENT], [REVISION], [AGE]) #------------------------------------------------------ # Sets the libtool versioning symbols LT_CURRENT, LT_REVISION, LT_AGE. AC_DEFUN([ESO_SET_LIBRARY_VERSION], [ if test -z "$1"; then LT_CURRENT=0 else LT_CURRENT="$1" fi if test -z "$2"; then LT_REVISION=0 else LT_REVISION="$2" fi if test -z "$3"; then LT_AGE=0 else LT_AGE="$3" fi AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) ]) cpl-6.4.1/libcext/m4/purify.m40000644000460300003120000000121211530471603012740 00000000000000# ESO_PROG_PURIFY #---------------- # Checks for the availability of purify AC_DEFUN([ESO_PROG_PURIFY], [ AC_ARG_VAR([PURIFY], [Purify command]) AC_ARG_ENABLE(purify, AC_HELP_STRING([--disable-purify], [disables the check for the Purify installation]), enable_purify=$enableval, enable_purify=yes) if test x"$enable_purify" = xyes ; then AC_PATH_PROG([PURIFY], [purify]) if test -z "${PURIFY}"; then enable_purify=no PURIFY=":" fi fi AM_CONDITIONAL([USE_PURIFY], [test "x$enable_purify" = "xyes"]) ]) cpl-6.4.1/libcext/m4/ltsugar.m40000644000460300003120000001042412310332704013103 00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) cpl-6.4.1/libcext/tests/0000755000460300003120000000000012310333010012050 500000000000000cpl-6.4.1/libcext/tests/cxslist-test.c0000644000460300003120000003631611530471603014631 00000000000000/* $Id: cxslist-test.c,v 1.8 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.8 $ * $Name: not supported by cvs2svn $ */ #undef CX_DISABLE_ASSERT #undef CX_LOG_DOMAIN #include #include #include "cxmemory.h" #include "cxmessages.h" #include "cxslist.h" static cxint cx_test_slist_compare1(cxcptr a, cxcptr b) { cxint _a = *((const cxint *)a); cxint _b = *((const cxint *)b); return _a - _b; } static cxint cx_test_slist_compare2(cxcptr a, cxcptr b) { cxint _a = *((const cxint *)a); cxint _b = *((const cxint *)b); return _b - _a; } #ifdef CX_TEST_SLIST_DUMP static void cx_test_slist_dump(cx_slist *list, cxint fmt) { cxint i; cx_slist_iterator pos; fprintf(stderr, "list at start address %p:\n", list); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { fprintf(stderr, "list element %d at address %p has value ", i + 1, pos); switch (fmt) { case 0: fprintf(stderr, "%s", (cxchar *)cx_slist_get(list, pos)); break; case 1: fprintf(stderr, "%d", *((cxint *)cx_slist_get(list, pos))); break; default: fprintf(stderr, "at address %p of unknown type", cx_slist_get(list, pos)); break; } fprintf(stderr, "\n"); pos = cx_slist_next(list, pos); i++; } return; } #endif int main(void) { cx_slist *list, *_list; cx_slist_iterator pos, first, last; cxchar letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; cxint i, ival; cxint num1[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; cxint num2[10] = {8, 9, 7, 0, 3, 2, 5, 1, 4, 6}; /* * Test 1: Create a list, check that it is a valid empty list and * destroy it again. */ list = cx_slist_new(); cx_assert(list != NULL); cx_assert(cx_slist_empty(list)); cx_assert(cx_slist_size(list) == 0); cx_assert(cx_slist_begin(list) == cx_slist_end(list)); cx_slist_delete(list); /* * Test 2: Create a list and append the numbers num1, check that * the data were properly appended, thereby verifying that * we can properly step through the list. */ list = cx_slist_new(); for (i = 0; i < 10; i++) cx_slist_push_back(list, &num1[i]); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cx_assert(*((cxint *)data) == i); pos = cx_slist_next(list, pos); i++; } cx_slist_delete(list); /* * Test 3: Same as test 2, but insert the numbers as head of the list. */ list = cx_slist_new(); for (i = 0; i < 10; i++) cx_slist_push_front(list, &num1[i]); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cx_assert(*((cxint *)data) == (9 - i)); pos = cx_slist_next(list, pos); i++; } /* * Test 4: Use the list created in the previous test for removing * elements from the head and the tail. Check the data. */ first = cx_slist_next(list, cx_slist_begin(list)); ival = *((cxint *)cx_slist_pop_front(list)); cx_assert(ival == 9); ival = *((cxint *)cx_slist_pop_back(list)); cx_assert(ival == 0); i = 1; pos = cx_slist_begin(list); cx_assert(pos == first); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cx_assert(*((cxint *)data) == (9 - i)); pos = cx_slist_next(list, pos); i++; } /* * Test 5: Use the list from the previous test and remove all * elements from the list. Check that the list is empty. */ cx_assert(!cx_slist_empty(list)); cx_slist_clear(list); cx_assert(cx_slist_empty(list)); cx_assert(cx_slist_size(list) == 0); cx_slist_delete(list); /* * Test 6: Create lists different sizes using the numbers num1 as * elements and check that the list size is properly reported. */ /* 10 elements */ list = cx_slist_new(); for (i = 0; i < 10; i++) cx_slist_push_back(list, &num1[i]); cx_assert(!cx_slist_empty(list)); cx_assert(cx_slist_size(list) == 10); cx_slist_clear(list); /* 5 elements */ for (i = 0; i < 5; i++) cx_slist_push_back(list, &num1[i]); cx_assert(!cx_slist_empty(list)); cx_assert(cx_slist_size(list) == 5); cx_slist_clear(list); /* 1 element */ for (i = 0; i < 1; i++) cx_slist_push_back(list, &num1[i]); cx_assert(!cx_slist_empty(list)); cx_assert(cx_slist_size(list) == 1); cx_slist_delete(list); /* * Test 7: Create a list from the numbers num1. Remove the element * at the 6th position from the list and verify the data. */ list = cx_slist_new(); for (i = 0; i < 10; i++) cx_slist_push_back(list, &num1[i]); pos = cx_slist_begin(list); for (i = 0; i < 5; i++) pos = cx_slist_next(list, pos); ival = *((cxint *)cx_slist_extract(list, pos)); cx_assert(ival == 5); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); if (i == 5) i++; cx_assert(*((cxint *)data) == i); pos = cx_slist_next(list, pos); i++; } /* * Test 7: Reinsert the number num1[5] as the 6th list element * and verify the data. */ pos = cx_slist_begin(list); for (i = 0; i < 5; i++) pos = cx_slist_next(list, pos); pos = cx_slist_insert(list, pos, &num1[5]); cx_assert(*((cxint *)cx_slist_get(list, pos)) == 5); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cx_assert(*((cxint *)data) == i); pos = cx_slist_next(list, pos); i++; } /* * Test 8: Assign the number num1[4] to the 6th and 9th list position. * Verify the data. */ pos = cx_slist_begin(list); for (i = 0; i < 5; i++) pos = cx_slist_next(list, pos); ival = *((cxint *)cx_slist_assign(list, pos, &num1[4])); cx_assert(ival == 5); for (i = 5; i < 8; i++) pos = cx_slist_next(list, pos); ival = *((cxint *)cx_slist_assign(list, pos, &num1[4])); cx_assert(ival == 8); /* * Test 9: Remove consecutive duplicates from the list. This should * happen for list position 6 only. Verify the data. */ cx_slist_unique(list, cx_test_slist_compare1); cx_assert(cx_slist_size(list) == 9); pos = cx_slist_begin(list); for (i = 0; i < 5; i++) pos = cx_slist_next(list, pos); ival = *((cxint *)cx_slist_get(list, pos)); cx_assert(ival == 6); /* * Test 10: Remove all list elements with value num1[4] from the list. * Verify the data. */ cx_slist_remove(list, &num1[4]); cx_assert(cx_slist_size(list) == 7); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cx_assert(*((cxint *)data) != num1[4]); pos = cx_slist_next(list, pos); i++; } cx_slist_delete(list); /* * Test 11: Create a list from the numbers num1, reverse the list and * check the data. */ list = cx_slist_new(); for (i = 0; i < 10; i++) cx_slist_push_back(list, &num1[i]); cx_slist_reverse(list); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cx_assert(*((cxint *)data) == (9 - i)); pos = cx_slist_next(list, pos); i++; } cx_slist_delete(list); /* * Test 12: Create two lists from the numbers num1 splice both lists * by moving all elements of the second list to the first * inserting the range of elements before the first element * of the first list. */ list = cx_slist_new(); _list = cx_slist_new(); for (i = 0; i < 5; i++) cx_slist_push_back(list, &num1[i]); for (i = 5; i < 10; i++) cx_slist_push_back(_list, &num1[i]); /* Target position */ pos = cx_slist_begin(list); /* Range to move */ first = cx_slist_begin(_list); last = cx_slist_end(_list); cx_slist_splice(list, pos, _list, first, last); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cxint val = i < 5 ? (i + 5) : (i - 5); cx_assert(*((cxint *)data) == val); pos = cx_slist_next(list, pos); i++; } cx_assert(cx_slist_empty(_list)); cx_slist_delete(list); cx_slist_delete(_list); /* * Test 13: Create two lists from the numbers num1 splice both lists * by moving all elements of the second list to the first * inserting the range of elements before the end of the * first list. */ list = cx_slist_new(); _list = cx_slist_new(); for (i = 0; i < 5; i++) cx_slist_push_back(_list, &num1[i]); for (i = 5; i < 10; i++) cx_slist_push_back(list, &num1[i]); /* Target position */ pos = cx_slist_end(list); /* Range to move */ first = cx_slist_begin(_list); last = cx_slist_end(_list); cx_slist_splice(list, pos, _list, first, last); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cxint val = i < 5 ? (i + 5) : (i - 5); cx_assert(*((cxint *)data) == val); pos = cx_slist_next(list, pos); i++; } cx_assert(cx_slist_empty(_list)); cx_slist_delete(list); cx_slist_delete(_list); /* * Test 14: Create a list from the numbers num1 move the tail of the * list immediately in front of the first element using * the splice function with source and target list being * identical. */ list = cx_slist_new(); for (i = 0; i < 10; i++) cx_slist_push_back(list, &num1[i]); /* Target position */ pos = cx_slist_begin(list); /* Range to move */ first = cx_slist_begin(list); for (i = 0; i < 5; i++) first = cx_slist_next(list, first); last = cx_slist_end(list); cx_slist_splice(list, pos, list, first, last); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cxint val = i < 5 ? (i + 5) : (i - 5); cx_assert(*((cxint *)data) == val); pos = cx_slist_next(list, pos); i++; } cx_slist_delete(list); /* * Test 15: Create two sorted lists from the numbers num1 and merge * them into a single list. Verify the data. */ list = cx_slist_new(); _list = cx_slist_new(); for (i = 0; i < 5; i++) { cx_slist_push_back(list, &num1[2*i]); cx_slist_push_back(_list, &num1[2*i + 1]); } cx_slist_merge(list, _list, cx_test_slist_compare1); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cx_assert(*((cxint *)data) == i); pos = cx_slist_next(list, pos); i++; } cx_assert(cx_slist_empty(_list)); cx_slist_delete(list); cx_slist_delete(_list); /* * Test 16: Create a list from the numbers num2 and sort it using both * comparison functions. Verify the data. */ list = cx_slist_new(); for (i = 0; i < 10; i++) cx_slist_push_back(list, &num2[i]); cx_slist_sort(list, cx_test_slist_compare1); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cx_assert(*((cxint *)data) == i); pos = cx_slist_next(list, pos); i++; } cx_slist_clear(list); for (i = 0; i < 10; i++) cx_slist_push_back(list, &num2[i]); cx_slist_sort(list, cx_test_slist_compare2); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cx_assert(*((cxint *)data) == (9 - i)); pos = cx_slist_next(list, pos); i++; } cx_slist_delete(list); /* * Test 17: Create two lists from the numbers num1 and num2. Swap * thei contents and verify the data. */ list = cx_slist_new(); _list = cx_slist_new(); for (i = 0; i < 10; i++) cx_slist_push_back(list, &num1[i]); for (i = 0; i < 10; i++) cx_slist_push_back(_list, &num2[i]); cx_slist_swap(list, _list); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cx_assert(*((cxint *)data) == num2[i]); pos = cx_slist_next(list, pos); i++; } i = 0; pos = cx_slist_begin(_list); while (pos != cx_slist_end(_list)) { cxptr data = cx_slist_get(_list, pos); cx_assert(*((cxint *)data) == num1[i]); pos = cx_slist_next(_list, pos); i++; } cx_slist_delete(list); cx_slist_delete(_list); /* * Test 18: Create a list from allocated strings. Erase an element from * the list destroying the stored data too. Verify the data. */ list = cx_slist_new(); for (i = 0; (cxsize)i < strlen(letters); i++) { cxchar *s = cx_malloc(4 * sizeof(cxchar)); memset(s, letters[i], 3); s[3] = '\0'; cx_slist_push_back(list, s); } pos = cx_slist_begin(list); for (i = 0; i < 5; i++) pos = cx_slist_next(list, pos); cx_slist_erase(list, pos, cx_free); cx_assert(cx_slist_size(list) == (strlen(letters) - 1)); i = 0; pos = cx_slist_begin(list); while (pos != cx_slist_end(list)) { cxptr data = cx_slist_get(list, pos); cxchar c = i < 5 ? letters[i] : letters[i + 1]; cx_assert(*((cxchar *)data) == c); pos = cx_slist_next(list, pos); i++; } cx_slist_destroy(list, cx_free); /* * All tests succeeded */ return 0; } cpl-6.4.1/libcext/tests/cxstring-test.c0000644000460300003120000003163312062050121014763 00000000000000/* $Id: cxstring-test.c,v 1.10 2012-12-12 09:37:21 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-12-12 09:37:21 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ #undef CX_DISABLE_ASSERT #undef CX_LOG_DOMAIN #include #include #include "cxmemory.h" #include "cxmessages.h" #include "cxstring.h" /* * Switch to turn messages from the individual tests on and off. */ static cxbool verbose = FALSE; static cxbool test1(void) { cx_string *tmp = NULL; cxbool f_passed = TRUE; tmp = cx_string_new(); if (tmp != NULL) { if (verbose == TRUE) { cx_print("cx_string_new : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_new : FAILED\n"); } f_passed = FALSE; } if (tmp != NULL) { cx_string_set(tmp, "Test single set..."); if (strcmp(cx_string_get(tmp), "Test single set...") == 0) { if (verbose == TRUE) { cx_print("cx_string_set (SINGLE) : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_set (SINGLE) : FAILED\n"); } f_passed = FALSE; } cx_string_delete(tmp); } return f_passed; } static cxbool test2(void) { cx_string *tmp = NULL; cxbool f_passed = TRUE; tmp = cx_string_new(); if (tmp == NULL) { return FALSE; } cx_string_set(tmp, "Test Multi Set 1"); cx_string_set(tmp, "Test Multi Set 2"); cx_string_set(tmp, "Test Multi Set 3"); cx_string_set(tmp, "Test Multi Set 4"); cx_string_set(tmp, "Test Multi Set 5"); cx_string_set(tmp, "Test Multi Set 6"); cx_string_set(tmp, "Test Multi Set 7"); cx_string_set(tmp, "Test Multi Set 8"); cx_string_set(tmp, "Test Multi Set 9"); if (strcmp(cx_string_get(tmp), "Test Multi Set 9") == 0) { if (verbose == TRUE) { cx_print("cx_string_set (MULTIPLE) : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_set (MULTIPLE) : FAILED\n"); } f_passed = FALSE; } cx_string_delete(tmp); return f_passed; } static cxbool test3(void) { cx_string *tmp = NULL; cxbool f_passed = TRUE; tmp = cx_string_create("Test Create With Value"); if (tmp == NULL) { return FALSE; } if (strcmp(cx_string_get(tmp), "Test Create With Value") == 0) { if (verbose == TRUE) { cx_print("cx_string_create : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_create : FAILED\n"); } f_passed = FALSE; } cx_string_delete(tmp); return f_passed; } static cxbool test4(void) { cx_string *tmp = NULL; cxbool f_passed = TRUE; tmp = cx_string_new(); if (tmp == NULL) { return FALSE; } cx_string_set(tmp, "PASSED"); if (verbose == TRUE) { cx_print("cx_string_get : %s\n", cx_string_get(tmp)); } if (strcmp(cx_string_get(tmp), "PASSED") == 0) { if (verbose == TRUE) { cx_print("cx_string_set/get : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_set/get : FAILED\n"); } f_passed = FALSE; } cx_string_delete(tmp); return f_passed; } static cxbool test5(void) { cx_string *tmp = NULL; cxbool f_passed = TRUE; tmp = cx_string_new(); if (tmp == NULL) { return FALSE; } cx_string_set(tmp, " ***AaBbCcDd12345*** "); /* to upper */ cx_string_upper(tmp); if (strcmp(cx_string_get(tmp), " ***AABBCCDD12345*** ") == 0) { if (verbose == TRUE) { cx_print("cx_string_upper : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_upper : FAILED\n"); } f_passed = FALSE; } /* to lower */ cx_string_lower(tmp); if (strcmp(cx_string_get(tmp), " ***aabbccdd12345*** ") == 0) { if (verbose == TRUE) { cx_print("cx_string_lower : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_lower : FAILED\n"); } f_passed = FALSE; } /* prepend */ cx_string_prepend(tmp, " -->"); if (strcmp(cx_string_get(tmp), " --> ***aabbccdd12345*** ") == 0) { if (verbose == TRUE) { cx_print("cx_string_prepend : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_prepend : FAILED\n"); } f_passed = FALSE; } /* append */ cx_string_append(tmp, "<- * ** "); if (strcmp(cx_string_get(tmp), " --> ***aabbccdd12345*** <- * ** ") == 0) { if (verbose == TRUE) { cx_print("cx_string_append : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_append : FAILED\n"); } f_passed = FALSE; } /* truncate */ cx_string_truncate(tmp, 35); if (strcmp(cx_string_get(tmp), " --> ***aabbccdd12345*** " "<- * ") == 0) { if (verbose == TRUE) { cx_print("cx_string_truncate : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_truncate : FAILED\n"); } f_passed = FALSE; } /* erase */ cx_string_erase(tmp, 19, 5); if (strcmp(cx_string_get(tmp), " --> ***aabbccdd*** <- * ") == 0) { if (verbose == TRUE) { cx_print("cx_string_erase : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_erase : FAILED\n"); } f_passed = FALSE; } /* insert */ cx_string_insert(tmp, 19, "54321"); if (strcmp(cx_string_get(tmp), " --> ***aabbccdd54321*** " "<- * ") == 0) { if (verbose == TRUE) { cx_print("cx_string_insert : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_insert : FAILED\n"); } f_passed = FALSE; } /* trim */ cx_string_trim(tmp); if (strcmp(cx_string_get(tmp), "--> ***aabbccdd54321*** <- * ") == 0) { if (verbose == TRUE) { cx_print("cx_string_trim : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_trim : FAILED\n"); } f_passed = FALSE; } /* rtrim */ cx_string_rtrim(tmp); if (strcmp(cx_string_get(tmp), "--> ***aabbccdd54321*** <- *") == 0) { if (verbose == TRUE) { cx_print("cx_string_rtrim : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_rtrim : FAILED\n"); } f_passed = FALSE; } /* strip */ cx_string_strip(tmp); if (strcmp(cx_string_get(tmp), "--> ***aabbccdd54321*** <- *") == 0) { if (verbose == TRUE) { cx_print("cx_string_strip : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_strip : FAILED\n"); } f_passed = FALSE; } cx_string_delete(tmp); return f_passed; } static cxbool test6(void) { cx_string *ac = NULL; cx_string *bc = NULL; cx_string *cc = NULL; cxbool f_passed = TRUE; ac = cx_string_new(); bc = cx_string_new(); if (ac == NULL) { return FALSE; } if (bc == NULL) { return FALSE; } cx_string_set(ac, "comparison"); cx_string_set(bc, "COMPARISON"); if (cx_string_equal(ac, bc) == FALSE) { if (verbose == TRUE) { cx_print("cx_string_equal : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_equal : FAILED\n"); } f_passed = FALSE; } if (cx_string_compare(ac, bc) > 0) { if (verbose == TRUE) { cx_print("cx_string_compare : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_compare : FAILED\n"); } f_passed = FALSE; } /* copy */ cc = cx_string_copy(bc); if (cx_string_equal(cc, bc) == TRUE) { if (verbose == TRUE) { cx_print("cx_string_equal : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_equal : FAILED\n"); } f_passed = FALSE; } if (cx_string_compare(cc, bc) == 0) { if (verbose == TRUE) { cx_print("cx_string_compare : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_compare : FAILED\n"); } f_passed = FALSE; } cx_string_delete(ac); cx_string_delete(bc); cx_string_delete(cc); return f_passed; } static cxbool test7(void) { cx_string *tmp = NULL; cx_string *tmp2 = NULL; cxbool f_passed = TRUE; tmp = cx_string_new(); tmp2 = cx_string_new(); if (tmp == NULL) { return FALSE; } if (tmp2 == NULL) { return FALSE; } cx_string_set(tmp, "cx_string_print : PASSED\n"); if (verbose == TRUE) { cx_string_print(tmp); } cx_string_sprintf(tmp2, "This is a %s test %d", "second", 2); if (strcmp(cx_string_get(tmp2), "This is a second test 2") == 0) { if (verbose == TRUE) { cx_print("cx_string_sprintf : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_sprintf : FAILED\n"); } f_passed = FALSE; } cx_string_delete(tmp2); cx_string_delete(tmp); return f_passed; } static cxbool test8(void) { cx_string *a = NULL; cx_string *b = NULL; cxbool f_passed = TRUE; a = cx_string_create("this is a test string"); b = cx_string_create("this is a test"); if (cx_string_erase(a, 14, -1) != NULL) { if (verbose == TRUE) { cx_print("cx_string_erase : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_erase : FAILED\n"); } f_passed = FALSE; } if (cx_string_compare(a, b) == 0) { if (verbose == TRUE) { cx_print("cx_string_compare : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_compare : FAILED\n"); } f_passed = FALSE; } cx_string_delete(b); cx_string_delete(a); a = cx_string_new(); if (cx_string_erase(a, 0, 0) != NULL) { if (verbose == TRUE) { cx_print("cx_string_erase : PASSED\n"); } } else { if (verbose == TRUE) { cx_print("cx_string_erase : FAILED\n"); } f_passed = FALSE; } cx_string_delete(a); return f_passed; } int main(void) { cxbool f_passed = TRUE; verbose = getenv("VERBOSE") != NULL ? TRUE : FALSE; /* Test 1 : cx_string_new */ f_passed = f_passed && test1(); /* Test 2 : cx_string_set, single time */ f_passed = f_passed && test2(); /* Test 3 : cx_string_set, multiple times */ f_passed = f_passed && test3(); /* Test 4 : cx_string_create */ f_passed = f_passed && test4(); /* Test 5: cx_string get/set */ f_passed = f_passed && test5(); /* Test 6: cx_string in-place functions */ f_passed = f_passed && test6(); /* Test 7: cx_string with copy functions */ f_passed = f_passed && test7(); /* Test 8: cx_string erase function, end of string removal */ f_passed = f_passed && test8(); if (f_passed != TRUE) { return 1; } return 0; } cpl-6.4.1/libcext/tests/cxtypes-test.c0000644000460300003120000000305111530471603014625 00000000000000/* $Id: cxtypes-test.c,v 1.2 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.2 $ * $Name: not supported by cvs2svn $ */ #undef CX_DISABLE_ASSERT #undef CX_LOG_DOMAIN #include "cxmemory.h" #include "cxmessages.h" #include "cxtypes.h" int main(void) { /* * Test 1: Verify the size of the cxtypes. */ cx_assert(sizeof(cxint8) == 1); cx_assert(sizeof(cxuint8) == 1); cx_assert(sizeof(cxint16) == 2); cx_assert(sizeof(cxuint16) == 2); cx_assert(sizeof(cxint32) == 4); cx_assert(sizeof(cxuint32) == 4); cx_assert(sizeof(cxint64) == 8); cx_assert(sizeof(cxuint64) == 8); /* * All tests succeeded */ return 0; } cpl-6.4.1/libcext/tests/cxdeque-test.c0000644000460300003120000005532011530471603014572 00000000000000/* $Id: cxdeque-test.c,v 1.4 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.4 $ * $Name: not supported by cvs2svn $ */ #undef CX_DISABLE_ASSERT #undef CX_LOG_DOMAIN #include #include #include "cxmemory.h" #include "cxmessages.h" #include "cxdeque.h" /* * Compares letters as small integer numbers */ static cxint _cx_test_compare_letters(cxcptr first, cxcptr second) { cxint _first = *(cxchar *)first; cxint _second = *(cxchar *)second; return _first - _second; } static cxint _cx_test_compare_numbers(cxcptr first, cxcptr second) { cxint _first = *(const cxint *)first; cxint _second = *(const cxint *)second; return _first - _second; } #ifdef CX_TEST_DEQUE_DUMP static void _cx_test_deque_dump(cx_deque *deque, cxint fmt) { cxsize i; cx_deque_iterator pos; fprintf(stderr, "deque at start address %p:\n", deque); i = 0; pos = cx_deque_begin(deque); while (pos != cx_deque_end(deque)) { fprintf(stderr, "deque element %d at position %d has value ", i + 1, pos); switch (fmt) { case 0: fprintf(stderr, "%s", (cxchar *)cx_deque_get(deque, pos)); break; case 1: fprintf(stderr, "%d", *((cxint *)cx_deque_get(deque, pos))); break; default: fprintf(stderr, "of unknown type at address %p", cx_deque_get(deque, pos)); break; } fprintf(stderr, "\n"); pos = cx_deque_next(deque, pos); ++i; } return; } #endif int main(void) { cxchar letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; cxchar unsorted[] = "ZYXWVUTSRQPONMLKJIHGFEDCBA"; cxint ival = 0; cxint num1[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; cxint num2[10] = {8, 9, 7, 0, 3, 2, 5, 1, 4, 6}; cxsize i = 0; cxsize sz = 0; cx_deque *d1 = NULL; cx_deque *d2 = NULL; cx_deque_iterator pos; cx_deque_iterator next; /* * Test 1: Create a deque, check that it is a valid empty deque and * destroy it again. */ d1 = cx_deque_new(); cx_assert(d1 != NULL); cx_assert(cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 0); cx_assert(cx_deque_begin(d1) == cx_deque_end(d1)); cx_deque_delete(d1); /* * Test 2: Create a deque and append the numbers num1, check that * the data were properly appended, thereby verifying that * we can properly step through the array. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } cx_assert(cx_deque_size(d1) == 10); i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cx_assert(*((cxint *)data) == num1[i]); pos = cx_deque_next(d1, pos); ++i; } i = 0; pos = cx_deque_previous(d1, cx_deque_end(d1)); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cx_assert(*((cxint *)data) == num1[9 - i]); pos = cx_deque_previous(d1, pos); ++i; } cx_deque_destroy(d1, NULL); /* * Test 3: Same as test 2, but insert the numbers as head of the array. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_front(d1, &num1[i]); } i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cx_assert(*((cxint *)data) == num1[9 - i]); pos = cx_deque_next(d1, pos); i++; } cx_deque_destroy(d1, NULL); /* * Test 4: Check accessors to the first and the last element of a deque */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_front(d1, &num1[i]); } cx_assert(*(cxint *)cx_deque_front(d1) == num1[9]); cx_assert(*(cxint *)cx_deque_back(d1) == num1[0]); cx_deque_destroy(d1, NULL); /* * Test 5: Create deques with different sizes using the numbers num1 as * elements and check that the size of the deque is properly * reported. */ /* 10 elements */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 10); cx_deque_clear(d1); /* 5 elements */ for (i = 0; i < 5; ++i) { cx_deque_push_back(d1, &num1[i]); } cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 5); cx_deque_clear(d1); /* 1 element */ for (i = 0; i < 1; ++i) { cx_deque_push_back(d1, &num1[i]); } cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 1); cx_deque_destroy(d1, NULL); /* * Test 6: Swap the data of 2 deques and check the element assignment */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } d2 = cx_deque_new(); for (i = 0; i < 5; ++i) { cx_deque_push_back(d2, &num2[i]); } cx_deque_swap(d1, d2); cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 5); cx_assert(!cx_deque_empty(d2)); cx_assert(cx_deque_size(d2) == 10); i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cx_assert(*(cxint *)data == num2[i]); pos = cx_deque_next(d1, pos); ++i; } i = 0; pos = cx_deque_begin(d2); while (pos != cx_deque_end(d2)) { cxptr data = cx_deque_get(d2, pos); cx_assert(*(cxint *)data == num1[i]); pos = cx_deque_next(d2, pos); ++i; } cx_deque_destroy(d2, NULL); cx_deque_destroy(d1, NULL); /* * Test 7: Assign the number num1[4] to the 6th and 9th position of the * deque. Verify the data. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } pos = cx_deque_begin(d1); for (i = 0; i < 5; ++i) { pos = cx_deque_next(d1, pos); } cx_assert(cx_deque_get(d1, pos) != &num1[4]); ival = *(cxint *)cx_deque_assign(d1, pos, &num1[4]); cx_assert(ival == 5); cx_assert(cx_deque_get(d1, pos) == &num1[4]); cx_assert(*(cxint *)cx_deque_get(d1, pos) == num1[4]); for (i = 5; i < 8; ++i) { pos = cx_deque_next(d1, pos); } cx_assert(cx_deque_get(d1, pos) != &num1[4]); ival = *(cxint *)cx_deque_assign(d1, pos, &num1[4]); cx_assert(ival == 8); cx_assert(cx_deque_get(d1, pos) == &num1[4]); cx_assert(*(cxint *)cx_deque_get(d1, pos) == num1[4]); cx_deque_destroy(d1, NULL); /* * Test 8: Create a deque and remove elements from the head and * the tail. Check the data. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_front(d1, &num1[i]); } cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 10); ival = *((cxint *)cx_deque_pop_front(d1)); cx_assert(ival == 9); cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 9); ival = *((cxint *)cx_deque_pop_back(d1)); cx_assert(ival == 0); cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 8); i = 1; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cx_assert(*((cxint *)data) == num1[9 - i]); pos = cx_deque_next(d1, pos); ++i; } cx_deque_destroy(d1, NULL); /* * Test 9: Remove all elements from a deque and verify that the * deque is empty. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } cx_assert(!cx_deque_empty(d1)); cx_deque_clear(d1); cx_assert(cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 0); cx_deque_delete(d1); /* * Test 10: Create a deque from allocated strings. Erase the element * at the 6th position from the deque and verify the data. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cxchar *s = cx_malloc(4 * sizeof(cxchar)); memset(s, letters[i], 3); s[3] = '\0'; cx_deque_push_back(d1, s); } cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 10); pos = cx_deque_begin(d1); for (i = 0; i < 5; ++i) { pos = cx_deque_next(d1, pos); } next = cx_deque_erase(d1, pos, cx_free); cx_assert(next == pos); cx_assert(cx_deque_size(d1) == 9); i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cxchar c = i < 5 ? letters[i] : letters[i + 1]; cx_assert(*((cxchar *)data) == c); pos =cx_deque_next(d1, pos); ++i; } cx_deque_destroy(d1, cx_free); /* * Test 11: Create a deque from the numbers num1. Insert the * number num1[5] as the 6th deque element and verify * the data. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 10); next = cx_deque_begin(d1); for (i = 0; i < 5; ++i) { next = cx_deque_next(d1, next); } pos = cx_deque_insert(d1, next, &num1[5]); cx_assert(pos == next); cx_assert(cx_deque_size(d1) == 11); cx_assert(*((cxint *)cx_deque_get(d1, pos)) == 5); i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cx_assert(*((cxint *)data) == num1[i]); if (pos != next) { ++i; } pos = cx_deque_next(d1, pos); } cx_deque_destroy(d1, NULL); /* * Test 12: Create a deque from the numbers num1. Extract the element * at the 6th position from the deque and verify the data. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 10); pos = cx_deque_begin(d1); for (i = 0; i < 5; ++i) { pos = cx_deque_next(d1, pos); } ival = *((cxint *)cx_deque_extract(d1, pos)); cx_assert(ival == 5); cx_assert(cx_deque_size(d1) == 9); i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); if (i == 5) { ++i; } cx_assert(*(cxint *)data == num1[i]); pos = cx_deque_next(d1, pos); ++i; } cx_deque_destroy(d1, NULL); /* * Test 13: Create a deque from the numbers num1, with multiple * occurrences of num[4]. Remove all deque elements with value * num1[4] from the deque. Verify the data. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } cx_deque_insert(d1, cx_deque_begin(d1) + 5, &num1[4]); cx_deque_insert(d1, cx_deque_begin(d1) + 8, &num1[4]); cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 12); cx_deque_remove(d1, &num1[4]); cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 9); i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cx_assert(data != &num1[4]); cx_assert(*(cxint *)data != num1[4]); pos = cx_deque_next(d1, pos); ++i; } cx_deque_destroy(d1, NULL); /* * Test 14: Create a deque from the numbers num1 with a duplicates * immediately following each other at position 6. Remove * consecutive duplicates from the deque. Verify the data. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } cx_deque_insert(d1, cx_deque_begin(d1) + 5, &num1[4]); cx_deque_insert(d1, cx_deque_begin(d1) + 5, &num1[4]); cx_assert(cx_deque_size(d1) == 12); cx_assert(*(cxint *)cx_deque_get(d1, cx_deque_begin(d1) + 4) == num1[4]); cx_assert(*(cxint *)cx_deque_get(d1, cx_deque_begin(d1) + 5) == num1[4]); cx_assert(*(cxint *)cx_deque_get(d1, cx_deque_begin(d1) + 6) == num1[4]); cx_deque_unique(d1, _cx_test_compare_numbers); cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 10); i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cx_assert(*(cxint *)data == num1[i]); pos = cx_deque_next(d1, pos); ++i; } cx_deque_destroy(d1, NULL); /* * Test 15: Splice two deques together. Check this for various * combinations of source and target positions. * */ sz = CX_N_ELEMENTS(unsorted) - 1; /* beginning of source to end of target */ d1 = cx_deque_new(); for (i = 0; i < sz; ++i) { cx_deque_push_back(d1, &unsorted[i]); } d2 = cx_deque_new(); cx_assert(cx_deque_empty(d2)); cx_deque_splice(d2, cx_deque_end(d2), d1, cx_deque_begin(d1), cx_deque_begin(d1) + 5); cx_assert(cx_deque_size(d2) == 5); cx_assert(cx_deque_size(d1) == sz - 5); pos = cx_deque_begin(d2); for (i = 0; i < 5; ++i) { cxptr data = cx_deque_get(d2, pos); cx_assert(*((cxchar *)data) == unsorted[i]); pos = cx_deque_next(d2, pos); } pos = cx_deque_begin(d1); for (i = 5; i < sz; ++i) { cxptr data = cx_deque_get(d1, pos); cx_assert(*((cxchar *)data) == unsorted[i]); pos = cx_deque_next(d1, pos); } cx_deque_destroy(d2, NULL); cx_deque_destroy(d1, NULL); /* end of source to end of target */ d1 = cx_deque_new(); for (i = 0; i < sz; ++i) { cx_deque_push_back(d1, &unsorted[i]); } d2 = cx_deque_new(); cx_assert(cx_deque_empty(d2)); cx_deque_splice(d2, cx_deque_end(d2), d1, cx_deque_end(d1) - 5, cx_deque_end(d1)); cx_assert(cx_deque_size(d2) == 5); cx_assert(cx_deque_size(d1) == sz - 5); pos = cx_deque_begin(d2); for (i = 0; i < 5; ++i) { cxsize k = sz - 5 + i; cxptr data = cx_deque_get(d2, pos); cx_assert(*((cxchar *)data) == unsorted[k]); pos = cx_deque_next(d2, pos); } pos = cx_deque_begin(d1); for (i = 0; i < sz - 5; ++i) { cxptr data = cx_deque_get(d1, pos); cx_assert(*((cxchar *)data) == unsorted[i]); pos = cx_deque_next(d1, pos); } cx_deque_destroy(d2, NULL); cx_deque_destroy(d1, NULL); /* middle of source to middle of target */ d1 = cx_deque_new(); for (i = 0; i < sz; ++i) { cx_deque_push_back(d1, &unsorted[i]); } d2 = cx_deque_new(); for (i = 0; i < sz; ++i) { cx_deque_push_back(d2, &letters[i]); } cx_assert(cx_deque_size(d2) == sz); cx_deque_splice(d2, cx_deque_begin(d2) + 5, d1, cx_deque_begin(d1) + 5, cx_deque_begin(d1) + 10); cx_assert(cx_deque_size(d2) == sz + 5); cx_assert(cx_deque_size(d1) == sz - 5); pos = cx_deque_begin(d2); for (i = 0; i < 5; ++i) { cxptr data = cx_deque_get(d2, pos); cx_assert(*((cxchar *)data) == letters[i]); pos = cx_deque_next(d2, pos); } for (i = 5; i < 10; ++i) { cxptr data = cx_deque_get(d2, pos); cx_assert(*((cxchar *)data) == unsorted[i]); pos = cx_deque_next(d2, pos); } for (i = 5; i < sz; ++i) { cxptr data = cx_deque_get(d2, pos); cx_assert(*((cxchar *)data) == letters[i]); pos = cx_deque_next(d2, pos); } pos = cx_deque_begin(d1); for (i = 0; i < 5; ++i) { cxptr data = cx_deque_get(d1, pos); cx_assert(*((cxchar *)data) == unsorted[i]); pos = cx_deque_next(d1, pos); } for (i = 10; i < sz; ++i) { cxptr data = cx_deque_get(d1, pos); cx_assert(*((cxchar *)data) == unsorted[i]); pos = cx_deque_next(d1, pos); } cx_deque_destroy(d2, NULL); cx_deque_destroy(d1, NULL); /* * Test 16: Create a deque from the numbers num1. Test the moving of a * range of deque nodes using the splice function for several * use cases in case the source and the target deque are identical. * Move the tail of the * deque immediately in front of the first element using * the splice function with source and target deque being * identical. */ /* Move the tail of the deque immediately in front of the first element */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } pos = cx_deque_begin(d1) + 5; cx_deque_splice(d1, cx_deque_begin(d1), d1, pos, cx_deque_end(d1)); cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 10); #ifdef CX_TEST_DEQUE_DUMP _cx_test_deque_dump(d1, 1); #endif i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cxint val = i < 5 ? num1[i + 5] : num1[i - 5]; cx_assert(*((cxint *)data) == val); pos = cx_deque_next(d1, pos); ++i; } cx_deque_destroy(d1, NULL); /* Move the head of the deque to the end */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } pos = cx_deque_begin(d1) + 5; cx_deque_splice(d1, cx_deque_end(d1), d1, cx_deque_begin(d1), pos); cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 10); #ifdef CX_TEST_DEQUE_DUMP _cx_test_deque_dump(d1, 1); #endif i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cxint val = i < 5 ? num1[i + 5] : num1[i - 5]; cx_assert(*((cxint *)data) == val); pos = cx_deque_next(d1, pos); ++i; } cx_deque_destroy(d1, NULL); /* Move a range of nodes following the insertion position. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } pos = cx_deque_begin(d1) + 2; cx_deque_splice(d1, pos, d1, cx_deque_end(d1) - 5, cx_deque_end(d1) - 2); cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 10); #ifdef CX_TEST_DEQUE_DUMP _cx_test_deque_dump(d1, 1); #endif i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cxint val = num1[i]; if ((i >= 2) && (i < 8)) { val = (i < 5) ? num1[i + 3] : num1[i - 3]; } cx_assert(*((cxint *)data) == val); pos = cx_deque_next(d1, pos); ++i; } cx_deque_destroy(d1, NULL); /* Move a range of nodes preceding the insertion position. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } pos = cx_deque_end(d1) - 5; cx_deque_splice(d1, cx_deque_begin(d1) + 2, d1, pos, pos + 3); cx_assert(!cx_deque_empty(d1)); cx_assert(cx_deque_size(d1) == 10); #ifdef CX_TEST_DEQUE_DUMP _cx_test_deque_dump(d1, 1); #endif i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cxint val = num1[i]; if ((i >= 2) && (i < 8)) { val = (i < 5) ? num1[i + 3] : num1[i - 3]; } cx_assert(*((cxint *)data) == val); pos = cx_deque_next(d1, pos); ++i; } cx_deque_destroy(d1, NULL); /* * Test 17: Create two sorted deques from the numbers num1 and merge * them into a single deque. Verify the data. */ d1 = cx_deque_new(); d2 = cx_deque_new(); for (i = 0; i < 5; ++i) { cx_deque_push_back(d1, &num1[2 * i]); cx_deque_push_back(d2, &num1[2 * i + 1]); } cx_deque_merge(d1, d2, _cx_test_compare_numbers); cx_assert(cx_deque_size(d1) == 10); cx_assert(cx_deque_empty(d2)); i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cx_assert(*((cxint *)data) == num1[i]); pos = cx_deque_next(d1, pos); ++i; } cx_deque_destroy(d1, NULL); cx_deque_destroy(d2, NULL); /* * Test 18: Verify that the sorted version of unsorted[] is * equal to letters[] */ d1 = cx_deque_new(); /* Ignore the trailing '\0' of the string literal */ sz = CX_N_ELEMENTS(unsorted) - 1; for (i = 0; i < sz; ++i) { cx_deque_push_back(d1, &unsorted[i]); } cx_assert(cx_deque_size(d1) == sz); cx_deque_sort(d1, _cx_test_compare_letters); cx_assert(cx_deque_size(d1) == sz); i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); #ifdef CX_TEST_VERBOSE fprintf(stderr, "deque: %c, letters[%d]: %c\n", *(cxchar *)data, i, letters[i]); #endif cx_assert((*(cxchar *)data) == letters[i]); pos = cx_deque_next(d1, pos); ++i; } cx_deque_destroy(d1, NULL); /* * Test 19: Create a deque from the numbers num1, reverse the deque and * check the data. */ d1 = cx_deque_new(); for (i = 0; i < 10; ++i) { cx_deque_push_back(d1, &num1[i]); } cx_assert(cx_deque_size(d1) == 10); cx_deque_reverse(d1); cx_assert(cx_deque_size(d1) == 10); i = 0; pos = cx_deque_begin(d1); while (pos != cx_deque_end(d1)) { cxptr data = cx_deque_get(d1, pos); cx_assert(*((cxint *)data) == num1[9 - i]); pos = cx_deque_next(d1, pos); ++i; } cx_deque_destroy(d1, NULL); /* * All tests succeeded */ return 0; } cpl-6.4.1/libcext/tests/cxlist-test.c0000644000460300003120000003652311530471603014446 00000000000000/* $Id: cxlist-test.c,v 1.8 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.8 $ * $Name: not supported by cvs2svn $ */ #undef CX_DISABLE_ASSERT #undef CX_LOG_DOMAIN #include #include #include "cxmemory.h" #include "cxmessages.h" #include "cxlist.h" static cxint cx_test_list_compare1(cxcptr a, cxcptr b) { cxint _a = *((const cxint *)a); cxint _b = *((const cxint *)b); return _a - _b; } static cxint cx_test_list_compare2(cxcptr a, cxcptr b) { cxint _a = *((const cxint *)a); cxint _b = *((const cxint *)b); return _b - _a; } #ifdef CX_TEST_LIST_DUMP static void cx_test_list_dump(cx_list *list, cxint fmt) { cxint i; cx_list_iterator pos; fprintf(stderr, "list at start address %p:\n", list); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { fprintf(stderr, "list element %d at address %p has value ", i + 1, pos); switch (fmt) { case 0: fprintf(stderr, "%s", (cxchar *)cx_list_get(list, pos)); break; case 1: fprintf(stderr, "%d", *((cxint *)cx_list_get(list, pos))); break; default: fprintf(stderr, "at address %p of unknown type", cx_list_get(list, pos)); break; } fprintf(stderr, "\n"); pos = cx_list_next(list, pos); i++; } return; } #endif int main(void) { cx_list *list, *_list; cx_list_iterator pos, first, last; cxchar letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; cxint i, ival; cxint num1[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; cxint num2[10] = {8, 9, 7, 0, 3, 2, 5, 1, 4, 6}; /* * Test 1: Create a list, check that it is a valid empty list and * destroy it again. */ list = cx_list_new(); cx_assert(list != NULL); cx_assert(cx_list_empty(list)); cx_assert(cx_list_size(list) == 0); cx_assert(cx_list_begin(list) == cx_list_end(list)); cx_list_delete(list); /* * Test 2: Create a list and append the numbers num1, check that * the data were properly appended, thereby verifying that * we can properly step through the list. Finally, step * through list backwards starting at the end. */ list = cx_list_new(); for (i = 0; i < 10; i++) cx_list_push_back(list, &num1[i]); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cx_assert(*((cxint *)data) == i); pos = cx_list_next(list, pos); i++; } i = 0; pos = cx_list_previous(list, cx_list_end(list)); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cx_assert(*((cxint *)data) == (9 - i)); pos = cx_list_previous(list, pos); i++; } cx_list_delete(list); /* * Test 3: Same as test 2, but insert the numbers as head of the list. */ list = cx_list_new(); for (i = 0; i < 10; i++) cx_list_push_front(list, &num1[i]); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cx_assert(*((cxint *)data) == (9 - i)); pos = cx_list_next(list, pos); i++; } /* * Test 4: Use the list created in the previous test for removing * elements from the head and the tail. Check the data. */ first = cx_list_next(list, cx_list_begin(list)); ival = *((cxint *)cx_list_pop_front(list)); cx_assert(ival == 9); ival = *((cxint *)cx_list_pop_back(list)); cx_assert(ival == 0); i = 1; pos = cx_list_begin(list); cx_assert(pos == first); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cx_assert(*((cxint *)data) == (9 - i)); pos = cx_list_next(list, pos); i++; } /* * Test 5: Use the list from the previous test and remove all * elements from the list. Check that the list is empty. */ cx_assert(!cx_list_empty(list)); cx_list_clear(list); cx_assert(cx_list_empty(list)); cx_assert(cx_list_size(list) == 0); cx_list_delete(list); /* * Test 6: Create lists different sizes using the numbers num1 as * elements and check that the list size is properly reported. */ /* 10 elements */ list = cx_list_new(); for (i = 0; i < 10; i++) cx_list_push_back(list, &num1[i]); cx_assert(!cx_list_empty(list)); cx_assert(cx_list_size(list) == 10); cx_list_clear(list); /* 5 elements */ for (i = 0; i < 5; i++) cx_list_push_back(list, &num1[i]); cx_assert(!cx_list_empty(list)); cx_assert(cx_list_size(list) == 5); cx_list_clear(list); /* 1 element */ for (i = 0; i < 1; i++) cx_list_push_back(list, &num1[i]); cx_assert(!cx_list_empty(list)); cx_assert(cx_list_size(list) == 1); cx_list_delete(list); /* * Test 7: Create a list from the numbers num1. Remove the element * at the 6th position from the list and verify the data. */ list = cx_list_new(); for (i = 0; i < 10; i++) cx_list_push_back(list, &num1[i]); pos = cx_list_begin(list); for (i = 0; i < 5; i++) pos = cx_list_next(list, pos); ival = *((cxint *)cx_list_extract(list, pos)); cx_assert(ival == 5); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); if (i == 5) i++; cx_assert(*((cxint *)data) == i); pos = cx_list_next(list, pos); i++; } /* * Test 7: Reinsert the number num1[5] as the 6th list element * and verify the data. */ pos = cx_list_begin(list); for (i = 0; i < 5; i++) pos = cx_list_next(list, pos); pos = cx_list_insert(list, pos, &num1[5]); cx_assert(*((cxint *)cx_list_get(list, pos)) == 5); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cx_assert(*((cxint *)data) == i); pos = cx_list_next(list, pos); i++; } /* * Test 8: Assign the number num1[4] to the 6th and 9th list position. * Verify the data. */ pos = cx_list_begin(list); for (i = 0; i < 5; i++) pos = cx_list_next(list, pos); ival = *((cxint *)cx_list_assign(list, pos, &num1[4])); cx_assert(ival == 5); for (i = 5; i < 8; i++) pos = cx_list_next(list, pos); ival = *((cxint *)cx_list_assign(list, pos, &num1[4])); cx_assert(ival == 8); /* * Test 9: Remove consecutive duplicates from the list. This should * happen for list position 6 only. Verify the data. */ cx_list_unique(list, cx_test_list_compare1); cx_assert(cx_list_size(list) == 9); pos = cx_list_begin(list); for (i = 0; i < 5; i++) pos = cx_list_next(list, pos); ival = *((cxint *)cx_list_get(list, pos)); cx_assert(ival == 6); /* * Test 10: Remove all list elements with value num1[4] from the list. * Verify the data. */ cx_list_remove(list, &num1[4]); cx_assert(cx_list_size(list) == 7); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cx_assert(*((cxint *)data) != num1[4]); pos = cx_list_next(list, pos); i++; } cx_list_delete(list); /* * Test 11: Create a list from the numbers num1, reverse the list and * check the data. */ list = cx_list_new(); for (i = 0; i < 10; i++) cx_list_push_back(list, &num1[i]); cx_list_reverse(list); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cx_assert(*((cxint *)data) == (9 - i)); pos = cx_list_next(list, pos); i++; } cx_list_delete(list); /* * Test 12: Create two lists from the numbers num1 splice both lists * by moving all elements of the second list to the first, * inserting the range of elements before the first element * of the first list. */ list = cx_list_new(); _list = cx_list_new(); for (i = 0; i < 5; i++) cx_list_push_back(list, &num1[i]); for (i = 5; i < 10; i++) cx_list_push_back(_list, &num1[i]); /* Target position */ pos = cx_list_begin(list); /* Range to move */ first = cx_list_begin(_list); last = cx_list_end(_list); cx_list_splice(list, pos, _list, first, last); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cxint val = i < 5 ? (i + 5) : (i - 5); cx_assert(*((cxint *)data) == val); pos = cx_list_next(list, pos); i++; } cx_assert(cx_list_empty(_list)); cx_list_delete(list); cx_list_delete(_list); /* * Test 13: Create two lists from the numbers num1 splice both lists * by moving all elements of the second list to the first * inserting the range of elements before the end of the * first list. */ list = cx_list_new(); _list = cx_list_new(); for (i = 0; i < 5; i++) cx_list_push_back(_list, &num1[i]); for (i = 5; i < 10; i++) cx_list_push_back(list, &num1[i]); /* Target position */ pos = cx_list_end(list); /* Range to move */ first = cx_list_begin(_list); last = cx_list_end(_list); cx_list_splice(list, pos, _list, first, last); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cxint val = i < 5 ? (i + 5) : (i - 5); cx_assert(*((cxint *)data) == val); pos = cx_list_next(list, pos); i++; } cx_assert(cx_list_empty(_list)); cx_list_delete(list); cx_list_delete(_list); /* * Test 14: Create a list from the numbers num1 move the tail of the * list immediately in front of the first element using * the splice function with source and target list being * identical. */ list = cx_list_new(); for (i = 0; i < 10; i++) cx_list_push_back(list, &num1[i]); /* Target position */ pos = cx_list_begin(list); /* Range to move */ first = cx_list_begin(list); for (i = 0; i < 5; i++) first = cx_list_next(list, first); last = cx_list_end(list); cx_list_splice(list, pos, list, first, last); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cxint val = i < 5 ? (i + 5) : (i - 5); cx_assert(*((cxint *)data) == val); pos = cx_list_next(list, pos); i++; } cx_list_delete(list); /* * Test 15: Create two sorted lists from the numbers num1 and merge * them into a single list. Verify the data. */ list = cx_list_new(); _list = cx_list_new(); for (i = 0; i < 5; i++) { cx_list_push_back(list, &num1[2*i]); cx_list_push_back(_list, &num1[2*i + 1]); } cx_list_merge(list, _list, cx_test_list_compare1); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cx_assert(*((cxint *)data) == i); pos = cx_list_next(list, pos); i++; } cx_assert(cx_list_empty(_list)); cx_list_delete(list); cx_list_delete(_list); /* * Test 16: Create a list from the numbers num2 and sort it using both * comparison functions. Verify the data. */ list = cx_list_new(); for (i = 0; i < 10; i++) cx_list_push_back(list, &num2[i]); cx_list_sort(list, cx_test_list_compare1); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cx_assert(*((cxint *)data) == i); pos = cx_list_next(list, pos); i++; } cx_list_clear(list); for (i = 0; i < 10; i++) cx_list_push_back(list, &num2[i]); cx_list_sort(list, cx_test_list_compare2); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cx_assert(*((cxint *)data) == (9 - i)); pos = cx_list_next(list, pos); i++; } cx_list_delete(list); /* * Test 17: Create two lists from the numbers num1 and num2. Swap * thei contents and verify the data. */ list = cx_list_new(); _list = cx_list_new(); for (i = 0; i < 10; i++) cx_list_push_back(list, &num1[i]); for (i = 0; i < 10; i++) cx_list_push_back(_list, &num2[i]); cx_list_swap(list, _list); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cx_assert(*((cxint *)data) == num2[i]); pos = cx_list_next(list, pos); i++; } i = 0; pos = cx_list_begin(_list); while (pos != cx_list_end(_list)) { cxptr data = cx_list_get(_list, pos); cx_assert(*((cxint *)data) == num1[i]); pos = cx_list_next(_list, pos); i++; } cx_list_delete(list); cx_list_delete(_list); /* * Test 18: Create a list from allocated strings. Erase an element from * the list destroying the stored data too. Verify the data. */ list = cx_list_new(); for (i = 0; (cxsize)i < strlen(letters); i++) { cxchar *s = cx_malloc(4 * sizeof(cxchar)); memset(s, letters[i], 3); s[3] = '\0'; cx_list_push_back(list, s); } pos = cx_list_begin(list); for (i = 0; i < 5; i++) pos = cx_list_next(list, pos); cx_list_erase(list, pos, cx_free); cx_assert(cx_list_size(list) == (strlen(letters) - 1)); i = 0; pos = cx_list_begin(list); while (pos != cx_list_end(list)) { cxptr data = cx_list_get(list, pos); cxchar c = i < 5 ? letters[i] : letters[i + 1]; cx_assert(*((cxchar *)data) == c); pos = cx_list_next(list, pos); i++; } cx_list_destroy(list, cx_free); /* * All tests succeeded */ return 0; } cpl-6.4.1/libcext/tests/Makefile.am0000644000460300003120000000402612110707030014033 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO C Extension Library ## Copyright (C) 2001-2011 European Southern Observatory ## 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ if MAINTAINER_MODE MAINTAINERCLEANFILES = $(srcdir)/Makefile.in endif EXTRA_DIST = LIBCEXT = $(top_builddir)/cext/libcext.la AM_CPPFLAGS = -I$(top_srcdir)/cext -I$(top_builddir)/cext AM_LDFLAGS = -static LDADD = $(LIBCEXT) check_PROGRAMS = cxslist-test cxlist-test cxtree-test cxmap-test \ cxstring-test cxdeque-test cxtypes-test cxslist_test_SOURCES = cxslist-test.c cxlist_test_SOURCES = cxlist-test.c cxtree_test_SOURCES = cxtree-test.c cxmap_test_SOURCES = cxmap-test.c cxstring_test_SOURCES = cxstring-test.c cxdeque_test_SOURCES = cxdeque-test.c cxtypes_test_SOURCES = cxtypes-test.c # Be sure to reexport important environment variables. TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" TESTS = cxslist-test cxlist-test cxtree-test cxmap-test cxstring-test \ cxdeque-test cxtypes-test XFAIL_TESTS = # We need to remove any files that the above tests created. clean-local: if USE_PURIFY include $(top_builddir)/Makefile.purify endif cpl-6.4.1/libcext/tests/cxmap-test.c0000644000460300003120000000740511530471603014245 00000000000000/* $Id: cxmap-test.c,v 1.9 2011-02-21 14:15:31 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-02-21 14:15:31 $ * $Revision: 1.9 $ * $Name: not supported by cvs2svn $ */ #undef CX_DISABLE_ASSERT #undef CX_LOG_DOMAIN #include #include #include "cxmemory.h" #include "cxmessages.h" #include "cxmap.h" static cxbool cx_test_map_less_char(cxcptr a, cxcptr b) { cxchar _a = *((const cxchar *)a); cxchar _b = *((const cxchar *)b); return _a - _b < 0 ? TRUE : FALSE; } #ifdef CX_TEST_MAP_GREATER_CHAR static cxbool cx_test_map_greater_char(cxcptr a, cxcptr b) { cxchar _a = *((const cxchar *)a); cxchar _b = *((const cxchar *)b); return _a - _b > 0 ? TRUE : FALSE; } #endif #ifdef CX_TEST_MAP_DUMP static void cx_test_map_dump(cx_map *map, cxint fmt) { cxint i; cx_map_iterator pos; fprintf(stderr, "map at address %p:\n", map); i = 0; pos = cx_map_begin(map); while (pos != cx_map_end(map)) { fprintf(stderr, "pair %d at address %p has value ", i + 1, pos); switch (fmt) { case 0: fprintf(stderr, "%s", (cxchar *)cx_map_get_value(map, pos)); break; case 1: fprintf(stderr, "%c", *((cxint *)cx_map_get_value(map, pos))); break; default: fprintf(stderr, "at address %p of unknown type", cx_map_get_value(map, pos)); break; } fprintf(stderr, "\n"); pos = cx_map_next(map, pos); i++; } return; } #endif int main(void) { cxchar letters[] = "0123456789" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz"; cxsize i; cx_map *map; cx_map_iterator pos; /* * Note: * The tests for maps only cover reimplementations or additions * compared to the cx_tree base class, since all other tests are * already done for cx_tree. */ /* * Test 1: Create a map from the characters letters[], update the * value of a pair through its key. Verify data and tree * structure. */ map = cx_map_new(cx_test_map_less_char, NULL, NULL); for (i = 0; i < strlen(letters); i++) cx_map_insert(map, &letters[i], &letters[i]); cx_assert(cx_tree_verify(map) != FALSE); cx_map_put(map, &letters[25], &letters[23]); pos = cx_map_lower_bound(map, &letters[25]); cx_assert(cx_tree_verify(map) != FALSE); cx_assert(cx_map_upper_bound(map, &letters[25]) == cx_map_next(map, pos)); cx_assert(*((cxchar *)cx_map_get_value(map, pos)) == letters[23]); /* * Test 2: Check that the pair modified in the previous test can be * properly retrieved again. */ cx_assert(*((cxchar *)cx_map_get(map, &letters[25])) == letters[23]); cx_map_delete(map); /* * All tests succeeded */ return 0; } cpl-6.4.1/libcext/tests/cxtree-test.c0000644000460300003120000004501712061372456014436 00000000000000/* $Id: cxtree-test.c,v 1.10 2012-12-10 14:43:58 rpalsa Exp $ * * This file is part of the ESO C Extension Library * Copyright (C) 2001-2011 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-12-10 14:43:58 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #undef CX_DISABLE_ASSERT #undef CX_LOG_DOMAIN /* * FIXME: Needed to get sigaction when C standard is set to strict c99. * A more portable way of asynchronously checking for a timeout * would be preferred! */ #if !defined(_POSIX_C_SOURCE) #define _POSIX_C_SOURCE 200112L #endif #ifdef HAVE_UNISTD_H # include #endif #include #include #include #include #include #include "cxmemory.h" #include "cxmessages.h" #include "cxtree.h" /* * The name of the current test being run. This should be updated just before * calling the alarm() routine in a test for infinite loops so we can print * a more informative message in the signal handler. */ static const cxchar* current_test_name = "unknown"; /* * Signal handler for the alarm timer to prevent the infinit loop test from * actually hanging forever. */ static void cx_signal_handler(cxint signo) { if (signo == SIGALRM) { /* * Should normally be very careful about what we call inside an * asynchronous signal handler. But if we arrived at this point then * we assume we have an infinit loop, which is an error condition. * Anyway cx_error() will abort the process, so we dont care so much. */ cx_error("An infinite loop detected in: %s.", current_test_name); } return; } static cxbool cx_test_tree_less_char(cxcptr a, cxcptr b) { cxchar _a = *((const cxchar *)a); cxchar _b = *((const cxchar *)b); return _a - _b < 0 ? TRUE : FALSE; } static cxbool cx_test_tree_greater_char(cxcptr a, cxcptr b) { cxchar _a = *((const cxchar *)a); cxchar _b = *((const cxchar *)b); return _a - _b > 0 ? TRUE : FALSE; } #ifdef CX_TEST_TREE_DUMP static void cx_test_tree_dump(cx_tree *tree, cxint fmt) { cxint i; cx_tree_iterator pos; fprintf(stderr, "tree at address %p:\n", tree); i = 0; pos = cx_tree_begin(tree); while (pos != cx_tree_end(tree)) { fprintf(stderr, "tree node %d at address %p has value ", i + 1, pos); switch (fmt) { case 0: fprintf(stderr, "%s", (cxchar *)cx_tree_get_value(tree, pos)); break; case 1: fprintf(stderr, "%c", *((cxint *)cx_tree_get_value(tree, pos))); break; default: fprintf(stderr, "at address %p of unknown type", cx_tree_get_value(tree, pos)); break; } fprintf(stderr, "\n"); pos = cx_tree_next(tree, pos); i++; } return; } #endif int main(void) { cxchar letters[] = "0123456789" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz"; cxsize i, j; cx_tree *tree, *_tree; cx_tree_iterator pos, _pos; cx_tree_iterator first, last; struct sigaction signal_info; /* * Register the signal handler for the alarm signal which is used during * the infinite loop tests. */ memset(&signal_info, 0x0, sizeof signal_info); signal_info.sa_handler = &cx_signal_handler; sigemptyset(&signal_info.sa_mask); if (sigaction(SIGALRM, &signal_info, NULL) != 0) { cx_error("Could not set signal handler: %s", strerror(errno)); return EXIT_FAILURE; } /* * Test 1: Create a tree, check that it is a valid empty tree, do * some consistency checks and destroy it again. */ tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); cx_assert(tree != NULL); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert(cx_tree_empty(tree)); cx_assert(cx_tree_size(tree) == 0); cx_assert(cx_tree_begin(tree) == cx_tree_end(tree)); cx_assert(cx_tree_begin(tree) == cx_tree_next(tree, cx_tree_end(tree))); cx_assert(cx_tree_begin(tree) == cx_tree_previous(tree, cx_tree_end(tree))); cx_assert(cx_test_tree_less_char == cx_tree_key_comp(tree)); cx_tree_delete(tree); /* * Test 2: Create two trees and fill them with the characters letters[] * using both insertion methods. Check that the tree structures * are valid, verify the data of both trees and compare the * contents of both trees. */ /* insert unique */ tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); for (i = 0; i < strlen(letters); i++) cx_tree_insert_unique(tree, &letters[i], &letters[i]); cx_assert(cx_tree_verify(tree) != FALSE); i = 0; pos = cx_tree_begin(tree); while (pos != cx_tree_end(tree)) { cxptr data = cx_tree_get_value(tree, pos); cx_assert(*((cxchar *)data) == letters[i]); pos = cx_tree_next(tree, pos); i++; } /* insert equal */ _tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); for (i = 0; i < strlen(letters); i++) cx_tree_insert_equal(_tree, &letters[i], &letters[i]); cx_assert(cx_tree_verify(_tree) != FALSE); i = 0; pos = cx_tree_begin(_tree); while (pos != cx_tree_end(_tree)) { cxptr data = cx_tree_get_value(_tree, pos); cx_assert(*((cxchar *)data) == letters[i]); pos = cx_tree_next(_tree, pos); i++; } /* Compare data of both trees */ i = 0; pos = cx_tree_begin(tree); _pos = cx_tree_begin(_tree); while (pos != cx_tree_end(tree)) { cxptr data; data = cx_tree_get_key(tree, pos); cx_assert(*((cxchar *)data) == letters[i]); data = cx_tree_get_value(tree, pos); cx_assert(*((cxchar *)data) == letters[i]); data = cx_tree_get_key(_tree, _pos); cx_assert(*((cxchar *)data) == letters[i]); data = cx_tree_get_value(_tree, _pos); cx_assert(*((cxchar *)data) == letters[i]); pos = cx_tree_next(tree, pos); _pos = cx_tree_next(_tree, _pos); i++; } cx_tree_delete(tree); cx_tree_delete(_tree); /* * Test 3: Create a tree and fill it with the characters letters[], * verify that we can walk through the tree forwards and * backwards. */ tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); for (i = 0; i < strlen(letters); i++) cx_tree_insert_unique(tree, &letters[i], &letters[i]); /* forwards */ pos = cx_tree_begin(tree); for (i = 0; i < strlen(letters); i++) pos = cx_tree_next(tree, pos); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert(pos == cx_tree_end(tree)); /* backwards */ pos = cx_tree_end(tree); for (i = 0; i < strlen(letters); i++) pos = cx_tree_previous(tree, pos); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert(pos == cx_tree_begin(tree)); cx_tree_delete(tree); /* * Test 4: Create a tree and fill it with the characters letters[], * remove some elements and verify the tree structure. */ tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); for (i = 0; i < strlen(letters); i++) cx_tree_insert_unique(tree, &letters[i], &letters[i]); for (i = 0; i < 10; i++) cx_tree_erase(tree, &letters[i]); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert(cx_tree_size(tree) == strlen(letters) - 10); cx_tree_delete(tree); /* * Test 5: Create a tree and fill it with the characters letters[], * erase nodes by position and verify the tree structure. */ tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); for (i = 0; i < strlen(letters); i++) cx_tree_insert_unique(tree, &letters[i], &letters[i]); first = cx_tree_begin(tree); for (i = 0; i < 10; i++) first = cx_tree_next(tree, first); for (i = 10; i < 36; i++) { pos = cx_tree_next(tree, first); cx_tree_erase_position(tree, first); first = pos; cx_assert(cx_tree_verify(tree) != FALSE); } cx_assert(cx_tree_verify(tree) != FALSE); cx_assert((cx_tree_size(tree) == strlen(letters) - 26)); cx_tree_delete(tree); /* * Test 6: Create a tree and fill it with the characters letters[], * erase a range of nodes and verify the tree structure. */ tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); for (i = 0; i < strlen(letters); i++) cx_tree_insert_unique(tree, &letters[i], &letters[i]); first = cx_tree_begin(tree); for (i = 0; i < 10; i++) first = cx_tree_next(tree, first); last = first; for (i = 10; i < 36; i++) last = cx_tree_next(tree, last); cx_tree_erase_range(tree, first, last); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert((cx_tree_size(tree) == strlen(letters) - 26)); cx_tree_delete(tree); /* * Test 7: Create a tree and fill it with the characters letters[] and * clear it again. Verify the tree structure and check that the * tree is empty. */ tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); for (i = 0; i < strlen(letters); i++) cx_tree_insert_unique(tree, &letters[i], &letters[i]); cx_tree_clear(tree); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert(cx_tree_empty(tree)); cx_assert(cx_tree_size(tree) == 0); cx_tree_delete(tree); /* * Test 7: Create a tree and fill it with characters from letters[] and * verify that the size of the tree is reported correctly. */ tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); for (i = 0; i < 5; i++) cx_tree_insert_unique(tree, &letters[i], &letters[i]); cx_assert(cx_tree_size(tree) == 5); for (i = 5; i < 26; i++) cx_tree_insert_unique(tree, &letters[i], &letters[i]); cx_assert(cx_tree_size(tree) == 5 + 21); for (i = 26; i < strlen(letters); i++) cx_tree_insert_unique(tree, &letters[i], &letters[i]); cx_assert(cx_tree_size(tree) == strlen(letters)); cx_tree_delete(tree); /* * Test 8: Create a tree and fill it with characters from letters[], * try to locate a particular value by looking for its key. * Verify that the entry found is the correct one. */ tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); for (i = 0; i < strlen(letters); i++) cx_tree_insert_unique(tree, &letters[i], &letters[i]); pos = cx_tree_find(tree, &letters[25]); cx_assert(pos != cx_tree_end(tree)); cx_assert(*((cxchar *)cx_tree_get_key(tree, pos)) == 'P'); cx_assert(*((cxchar *)cx_tree_get_value(tree, pos)) == 'P'); /* * Test 9: Assign a new value to the tree node from the previous test * and verify the data and the tree structure. */ cx_tree_assign(tree, pos, &letters[23]); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert(*((cxchar *)cx_tree_get_key(tree, pos)) == 'P'); cx_assert(*((cxchar *)cx_tree_get_value(tree, pos)) == 'N'); cx_tree_assign(tree, pos, &letters[25]); /* * Test 10: Count the occurrences of a prticular key in the tree from * the previous test. For this tree the result should be 1 * for any key. */ for (i = 0; i < strlen(letters); i++) cx_assert(cx_tree_count(tree, &letters[i]) == 1); /* * Test 10: Using the tree from the previous test check the lower * and upper bounds for a particular key. With this tree * the upper bound should always be the successor of the * lower bound. */ for (i = 0; i < strlen(letters); i++) { pos = cx_tree_lower_bound(tree, &letters[i]); _pos = cx_tree_upper_bound(tree, &letters[i]); cx_assert(*((cxchar *)cx_tree_get_value(tree, pos)) == letters[i]); cx_assert(_pos == cx_tree_end(tree) || *((cxchar *)cx_tree_get_value(tree, _pos)) == letters[i + 1]); cx_assert(_pos == cx_tree_next(tree, pos)); } pos = cx_tree_lower_bound(tree, &letters[25]); _pos = cx_tree_upper_bound(tree, &letters[25]); cx_tree_equal_range(tree, &letters[25], &first, &last); cx_assert(first == pos); cx_assert(last == _pos); cx_tree_delete(tree); /* * Test 11: Create two trees, an empty one and one filled with the * characters letters[]. Swap the contents of the two trees * and validate the tree structure and the data. */ tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); _tree = cx_tree_new(cx_test_tree_greater_char, NULL, NULL); for (i = 0; i < strlen(letters); i++) { cx_tree_insert_unique(tree, &letters[i], &letters[i]); cx_tree_insert_unique(_tree, &letters[i], &letters[i]); } cx_tree_swap(tree, _tree); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert(cx_tree_verify(_tree) != FALSE); cx_assert(cx_tree_key_comp(tree) == cx_test_tree_greater_char); cx_assert(cx_tree_key_comp(_tree) == cx_test_tree_less_char); i = 0; pos = cx_tree_begin(tree); while (pos != cx_tree_end(tree)) { cxptr data = cx_tree_get_value(tree, pos); cx_assert(*((cxchar *)data) == letters[strlen(letters) - i - 1]); pos = cx_tree_next(tree, pos); i++; } i = 0; pos = cx_tree_begin(_tree); while (pos != cx_tree_end(_tree)) { cxptr data = cx_tree_get_value(_tree, pos); cx_assert(*((cxchar *)data) == letters[i]); pos = cx_tree_next(_tree, pos); i++; } cx_tree_delete(tree); cx_tree_delete(_tree); /* * Redo some of the tests above for trees with multiple occurrence * of the same key. */ /* * Test 12: Create a tree and insert the characters letters[] several * times */ tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); for (j = 0; j < 5; j++) for (i = 0; i < strlen(letters); i++) cx_tree_insert_equal(tree, &letters[i], &letters[i]); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert(cx_tree_size(tree) == (5 * strlen(letters))); i = 0; pos = cx_tree_begin(tree); while (pos != cx_tree_end(tree)) { cxptr data = cx_tree_get_value(tree, pos); cx_assert(*((cxchar *)data) == letters[i / 5]); pos = cx_tree_next(tree, pos); i++; } /* * Test 13: Use the tree from the previous test to verify that keys * are properly looked up. */ cx_assert(cx_tree_lower_bound(tree, &letters[25]) == cx_tree_find(tree, &letters[25])); for (i = 0; i < strlen(letters); i++) cx_assert(cx_tree_count(tree, &letters[i]) == 5); pos = cx_tree_lower_bound(tree, &letters[25]); for (i = 0; i < 5; i++) pos = cx_tree_next(tree, pos); cx_assert(pos == cx_tree_upper_bound(tree, &letters[25])); cx_tree_equal_range(tree, &letters[25], &first, &last); cx_assert(first == cx_tree_lower_bound(tree, &letters[25])); cx_assert(last == cx_tree_upper_bound(tree, &letters[25])); /* * Test 14: Use the tree from the previous test to verify that element * removal works properly. */ pos = cx_tree_lower_bound(tree, &letters[25]); cx_tree_erase_position(tree, pos); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert(cx_tree_size(tree) == (5 * strlen(letters) - 1)); cx_assert(cx_tree_count(tree, &letters[25]) == 4); /* * Test 14: Use the tree from the previous test to verify that removing * a range of elements works. */ first = cx_tree_lower_bound(tree, &letters[23]); last = cx_tree_upper_bound(tree, &letters[25]); cx_tree_erase_range(tree, first, last); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert(cx_tree_size(tree) == (5 * (strlen(letters) - 3))); cx_assert(cx_tree_count(tree, &letters[23]) == 0); cx_assert(cx_tree_find(tree, &letters[23]) == cx_tree_end(tree)); cx_assert(cx_tree_lower_bound(tree, &letters[25]) == cx_tree_upper_bound(tree, &letters[25])); /* * Test 14: Use the tree from the previous test to verify that removing * all elements with a particular key works. */ cx_assert(cx_tree_erase(tree, &letters[27]) == 5); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert(cx_tree_size(tree) == (5 * (strlen(letters) - 4))); cx_assert(cx_tree_count(tree, &letters[27]) == 0); cx_assert(cx_tree_find(tree, &letters[27]) == cx_tree_end(tree)); cx_assert(cx_tree_lower_bound(tree, &letters[27]) == cx_tree_upper_bound(tree, &letters[27])); /* * Test 15: Use the tree from the previous test to verify that removing * all elements works. */ cx_tree_clear(tree); cx_assert(cx_tree_verify(tree) != FALSE); cx_assert(cx_tree_empty(tree)); cx_assert(cx_tree_size(tree) == 0); cx_tree_delete(tree); /* * Test 16: The following code sequence causes an infinite loop at * cxtree.c:447 for broken versions of libcext 0.1.0. * Should check if this still happens for new versions. */ current_test_name = "Test 16 for infinite loop in cx_tree_erase_position"; /* * Set the alarm for 10 seconds. If this test is not done by then we have * to assume we are in an infinite loop. */ alarm(10); tree = cx_tree_new(cx_test_tree_less_char, NULL, NULL); cx_assert(tree != NULL); cx_tree_erase_position(tree, cx_tree_begin(tree)); cx_tree_delete(tree); /* * Will stop any more alarm signals for subsequent tests. */ alarm(0); /* * All tests succeeded */ return 0; } cpl-6.4.1/libcext/tests/Makefile.in0000644000460300003120000010761012310332713014053 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = cxslist-test$(EXEEXT) cxlist-test$(EXEEXT) \ cxtree-test$(EXEEXT) cxmap-test$(EXEEXT) \ cxstring-test$(EXEEXT) cxdeque-test$(EXEEXT) \ cxtypes-test$(EXEEXT) TESTS = cxslist-test$(EXEEXT) cxlist-test$(EXEEXT) \ cxtree-test$(EXEEXT) cxmap-test$(EXEEXT) \ cxstring-test$(EXEEXT) cxdeque-test$(EXEEXT) \ cxtypes-test$(EXEEXT) XFAIL_TESTS = subdir = tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/admin/depcomp $(top_srcdir)/admin/test-driver ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_cxdeque_test_OBJECTS = cxdeque-test.$(OBJEXT) cxdeque_test_OBJECTS = $(am_cxdeque_test_OBJECTS) cxdeque_test_LDADD = $(LDADD) cxdeque_test_DEPENDENCIES = $(LIBCEXT) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_cxlist_test_OBJECTS = cxlist-test.$(OBJEXT) cxlist_test_OBJECTS = $(am_cxlist_test_OBJECTS) cxlist_test_LDADD = $(LDADD) cxlist_test_DEPENDENCIES = $(LIBCEXT) am_cxmap_test_OBJECTS = cxmap-test.$(OBJEXT) cxmap_test_OBJECTS = $(am_cxmap_test_OBJECTS) cxmap_test_LDADD = $(LDADD) cxmap_test_DEPENDENCIES = $(LIBCEXT) am_cxslist_test_OBJECTS = cxslist-test.$(OBJEXT) cxslist_test_OBJECTS = $(am_cxslist_test_OBJECTS) cxslist_test_LDADD = $(LDADD) cxslist_test_DEPENDENCIES = $(LIBCEXT) am_cxstring_test_OBJECTS = cxstring-test.$(OBJEXT) cxstring_test_OBJECTS = $(am_cxstring_test_OBJECTS) cxstring_test_LDADD = $(LDADD) cxstring_test_DEPENDENCIES = $(LIBCEXT) am_cxtree_test_OBJECTS = cxtree-test.$(OBJEXT) cxtree_test_OBJECTS = $(am_cxtree_test_OBJECTS) cxtree_test_LDADD = $(LDADD) cxtree_test_DEPENDENCIES = $(LIBCEXT) am_cxtypes_test_OBJECTS = cxtypes-test.$(OBJEXT) cxtypes_test_OBJECTS = $(am_cxtypes_test_OBJECTS) cxtypes_test_LDADD = $(LDADD) cxtypes_test_DEPENDENCIES = $(LIBCEXT) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(cxdeque_test_SOURCES) $(cxlist_test_SOURCES) \ $(cxmap_test_SOURCES) $(cxslist_test_SOURCES) \ $(cxstring_test_SOURCES) $(cxtree_test_SOURCES) \ $(cxtypes_test_SOURCES) DIST_SOURCES = $(cxdeque_test_SOURCES) $(cxlist_test_SOURCES) \ $(cxmap_test_SOURCES) $(cxslist_test_SOURCES) \ $(cxstring_test_SOURCES) $(cxtree_test_SOURCES) \ $(cxtypes_test_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/admin/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/admin/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CEXT_INCLUDES = @CEXT_INCLUDES@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_DEBUG_FLAGS = @CX_DEBUG_FLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNPRINTF = @SNPRINTF@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in EXTRA_DIST = LIBCEXT = $(top_builddir)/cext/libcext.la AM_CPPFLAGS = -I$(top_srcdir)/cext -I$(top_builddir)/cext AM_LDFLAGS = -static LDADD = $(LIBCEXT) cxslist_test_SOURCES = cxslist-test.c cxlist_test_SOURCES = cxlist-test.c cxtree_test_SOURCES = cxtree-test.c cxmap_test_SOURCES = cxmap-test.c cxstring_test_SOURCES = cxstring-test.c cxdeque_test_SOURCES = cxdeque-test.c cxtypes_test_SOURCES = cxtypes-test.c # Be sure to reexport important environment variables. TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list cxdeque-test$(EXEEXT): $(cxdeque_test_OBJECTS) $(cxdeque_test_DEPENDENCIES) $(EXTRA_cxdeque_test_DEPENDENCIES) @rm -f cxdeque-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cxdeque_test_OBJECTS) $(cxdeque_test_LDADD) $(LIBS) cxlist-test$(EXEEXT): $(cxlist_test_OBJECTS) $(cxlist_test_DEPENDENCIES) $(EXTRA_cxlist_test_DEPENDENCIES) @rm -f cxlist-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cxlist_test_OBJECTS) $(cxlist_test_LDADD) $(LIBS) cxmap-test$(EXEEXT): $(cxmap_test_OBJECTS) $(cxmap_test_DEPENDENCIES) $(EXTRA_cxmap_test_DEPENDENCIES) @rm -f cxmap-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cxmap_test_OBJECTS) $(cxmap_test_LDADD) $(LIBS) cxslist-test$(EXEEXT): $(cxslist_test_OBJECTS) $(cxslist_test_DEPENDENCIES) $(EXTRA_cxslist_test_DEPENDENCIES) @rm -f cxslist-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cxslist_test_OBJECTS) $(cxslist_test_LDADD) $(LIBS) cxstring-test$(EXEEXT): $(cxstring_test_OBJECTS) $(cxstring_test_DEPENDENCIES) $(EXTRA_cxstring_test_DEPENDENCIES) @rm -f cxstring-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cxstring_test_OBJECTS) $(cxstring_test_LDADD) $(LIBS) cxtree-test$(EXEEXT): $(cxtree_test_OBJECTS) $(cxtree_test_DEPENDENCIES) $(EXTRA_cxtree_test_DEPENDENCIES) @rm -f cxtree-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cxtree_test_OBJECTS) $(cxtree_test_LDADD) $(LIBS) cxtypes-test$(EXEEXT): $(cxtypes_test_OBJECTS) $(cxtypes_test_DEPENDENCIES) $(EXTRA_cxtypes_test_DEPENDENCIES) @rm -f cxtypes-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cxtypes_test_OBJECTS) $(cxtypes_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxdeque-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxlist-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxmap-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxslist-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxstring-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxtree-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxtypes-test.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # exand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ else \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? cxslist-test.log: cxslist-test$(EXEEXT) @p='cxslist-test$(EXEEXT)'; \ b='cxslist-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cxlist-test.log: cxlist-test$(EXEEXT) @p='cxlist-test$(EXEEXT)'; \ b='cxlist-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cxtree-test.log: cxtree-test$(EXEEXT) @p='cxtree-test$(EXEEXT)'; \ b='cxtree-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cxmap-test.log: cxmap-test$(EXEEXT) @p='cxmap-test$(EXEEXT)'; \ b='cxmap-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cxstring-test.log: cxstring-test$(EXEEXT) @p='cxstring-test$(EXEEXT)'; \ b='cxstring-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cxdeque-test.log: cxdeque-test$(EXEEXT) @p='cxdeque-test$(EXEEXT)'; \ b='cxdeque-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cxtypes-test.log: cxtypes-test$(EXEEXT) @p='cxtypes-test$(EXEEXT)'; \ b='cxtypes-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool clean-local \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am # We need to remove any files that the above tests created. clean-local: @USE_PURIFY_TRUE@include $(top_builddir)/Makefile.purify # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/libcext/Makefile.purify.in0000644000460300003120000000422111530471603014225 00000000000000#******************************************************************************* # E.S.O. - VLT project # # "@(#) $Id: Makefile.purify.in,v 1.2 2011-02-21 14:15:31 rpalsa Exp $" # # Makefile of Pipeline subsystem. # # who when what # -------- ---------- ---------------------------------------------- # ifdef MAKE_PURE ENABLE_PURIFY=on ENABLE_PURECOV=on ENABLE_PURE=on endif ifdef MAKE_PUREGUI ENABLE_PURIFY=on ENABLE_PURECOV=on endif ifdef MAKE_PURIFY ENABLE_PURIFY=on endif ifdef MAKE_PURECOV ENABLE_PURECOV=on endif # -user-path="../test:../src:src:test" \ ifdef ENABLE_PURIFY PURIFY = purify \ -always-use-cache-dir \ -g++=yes \ -log-file=./.purifydir/MemoryReport \ -linker=$(GNU_ROOT)/bin/ld \ -append-logfile=yes \ -messages=batch \ -view-file=./.purifydir/purify-%v.pv \ -chain-length=100 else PURIFY = endif ifdef MAKE_PUREGUI PURIFY = purify \ -always-use-cache-dir \ -user-path="../test:../src:src:test" \ -g++=yes \ -linker=$(GNU_ROOT)/bin/ld endif ifdef ENABLE_PURECOV PURECOV = purecov \ -always-use-cache-dir \ -counts-file=./.purifydir/purecov-%v.pcv ifdef MAKE_PUREGUI PURECOV = purecov -always-use-cache-dir endif else PURECOV = endif ifdef ENABLE_PURIFY CCLD = "$(PURIFY)" $(CC) endif ifdef ENABLE_PURECOV CCLD = "$(PURECOV)" $(CC) endif ifdef ENABLE_PURE CCLD = "$(PURIFY) $(PURECOV)" $(CC) endif pureReport: @ purecov -export=.purifydir/CoverageReport .purifydir/*.pcv @ echo "== Purify coverage report in '.purifydir/CoverageReport'." pureGUI: @ ls purecov*.pcv > /dev/null 2>&1; if [ $$? = "0" ]; then purecov -view purecov*.pcv &; fi @ ls purify*.pv > /dev/null 2>&1; if [ $$? = "0" ]; then \ for member in `ls purify*.pv`; \ do purify -view $$member & \ done \ fi check-am: make_links make_links: ifeq ($(ENABLE_PURIFY),on) -@if [ ! -d .purifydir ]; then mkdir .purifydir ; fi endif ifeq ($(ENABLE_PURECOV),on) -@if [ ! -d .purifydir ]; then mkdir .purifydir ;fi endif clean-am: pureClean pureClean: -@ rm -rf .purifydir/* cpl-6.4.1/libcext/AUTHORS0000644000460300003120000000032307774033725011730 00000000000000This package is maintained by Carlo Izzo , Yves Jung and Lars Lundin Ralf Palsa on behalf of the European Southern Observatory (ESO). cpl-6.4.1/libcext/BUGS0000644000460300003120000000030707774033725011345 00000000000000This file lists the bugs you must be aware of. Be sure to check this file before using the CPL. Limitations: On HP-UX and Sun Solaris platforms only the GNU C compiler is currently supported. cpl-6.4.1/libcext/acinclude.m40000644000460300003120000010205612110707314013035 00000000000000# CEXT_ENABLE_DEBUG(debug=no) #---------------------------- AC_DEFUN([CEXT_ENABLE_DEBUG], [ AC_REQUIRE([AC_PROG_CC]) ESO_ENABLE_DEBUG([$1]) if test x"$eso_cv_enable_debug" != xno; then CX_DEBUG_FLAGS="-DCX_ENABLE_DEBUG" else CX_DEBUG_FLAGS="-DCX_DISABLE_ASSERT" fi AC_SUBST(CX_DEBUG_FLAGS) ]) # CEXT_ENABLE_THREADS(threads=yes) #--------------------------------- AC_DEFUN([CEXT_ENABLE_THREADS], [ AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads], [enables thread support [[default=$1]]]), cext_enable_threads=$enableval, cext_enable_threads=$1) AH_TEMPLATE([CX_THREADS_ENABLED], [Define if thread support is enabled.]) if test x"$cext_enable_threads" = xyes; then ESO_CHECK_THREADS_POSIX AC_MSG_CHECKING([whether POSIX threads are available]) if test x"$eso_cv_threads_posix" = xno; then AC_MSG_RESULT([no]) else CFLAGS="$CFLAGS -D_REENTRANT" AC_DEFINE_UNQUOTED([CX_THREADS_ENABLED]) if test x"$eso_cv_threads_posix_lib" = xyes; then echo $LIBS | grep -q -e "$LIBPTHREAD" || LIBS="$LIBPTHREAD $LIBS" else CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS" fi AC_MSG_RESULT([yes]) fi fi ]) # CEXT_CHECK_CHAR_BIT #-------------------- # Check number of bits used per char. AC_DEFUN([CEXT_CHECK_CHAR_BIT], [ cext_have_char_bit=no cext_have_char_8_bits=no AC_MSG_CHECKING([for bits per char]) AC_CACHE_VAL(cext_cv_have_char_8_bits, [ AC_LANG_PUSH(C) cext_cppflags_save="$CPPFLAGS" cext_cflags_save="$CFLAGS" cext_ldflags_save="$LDFLAGS" cext_libs_save="$LIBS" if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -pedantic-errors" CPPFLAGS="$CPPFLAGS $CFLAGS" fi AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [int i = CHAR_BIT;])], cext_have_char_bit=yes, cext_have_char_bit=no) if test "x$cext_have_char_bit" = "xyes"; then AC_RUN_IFELSE([AC_LANG_SOURCE( [ #include int main() { if (CHAR_BIT != 8) return 1; return 0; } ])], cext_have_char_8_bits=yes, cext_have_char_8_bits=no) else AC_RUN_IFELSE([AC_LANG_SOURCE( [ #include int main() { char c = 1; int i = 0; while (c) { c <<= 1; i++; } if (i != 8) return 1; return 0; } ])], cext_have_char_8_bits=yes, cext_have_char_8_bits=no) fi CPPFLAGS="$cext_cppflags_save" CFLAGS="$cext_cflags_save" LDFLAGS="$cext_ldflags_save" LIBS="$cext_libs_save" AC_LANG_POP(C) cext_cv_have_char_8_bits="cext_have_char_bit=$cext_have_char_bit \ cext_have_char_8_bits=$cext_have_char_8_bits" ]) eval "$cext_cv_have_char_8_bits" if test "$cext_have_char_8_bits" = "no"; then AC_MSG_ERROR([C type char is not 8 bits wide!]) else if test x"$cext_have_char_bit" = xno; then AC_DEFINE(CHAR_BIT, 8, [Width of type 'char']) else AC_DEFINE(HAVE_CHAR_BIT, 1, [Define if CHAR_BIT is defined in limits.h and equals 8]) fi AC_MSG_RESULT([8]) fi ]) # # CEXT_CHECK_SIZE_T #------------------ # Check for an integer type with an equal size AC_DEFUN([CEXT_CHECK_SIZE_T], [ AC_MSG_CHECKING([for an integer type with the same size as size_t]) case $ac_cv_sizeof_size_t in $ac_cv_sizeof_short) cext_size_type='short' ;; $ac_cv_sizeof_int) cext_size_type='int' ;; $ac_cv_sizeof_long) cext_size_type='long' ;; $ac_cv_sizeof_long_long) cext_size_type='long long' ;; *) AC_MSG_ERROR([No integer type matches size_t in size]) ;; esac AC_MSG_RESULT([$cext_size_type]) AC_CACHE_VAL(cext_cv_type_size_type, [ cext_cv_type_size_type=$cext_size_type ]) ]) # # CEXT_CHECK_FORMAT_LONG_LONG #---------------------------- # Check printing format specifier used for long long integers AC_DEFUN([CEXT_CHECK_FORMAT_INT64], [ # List of printf formats to check for format_list="ll q" if test x"$ac_cv_sizeof_long_long" = x8; then AC_MSG_CHECKING([for printf format used for 64-bit integers]) AC_CACHE_VAL(cext_cv_format_long_long, [ for format in $format_list; do AC_RUN_IFELSE([AC_LANG_SOURCE( [ #include int main() { long long b, a = -0x3AFAFAFAFAFAFAFALL; char buffer[1000]; sprintf (buffer, "%${fmt}u", a); sscanf (buffer, "%${fmt}u", &b); return b != a; } ])], [cext_cv_format_long_long=${fmt}; break], [], [:]) done ]) if test -n "$cext_cv_format_long_long"; then AC_MSG_RESULT([%${cext_cv_format_long_long}u]) AC_DEFINE(HAVE_LONG_LONG_FORMAT, 1, [Define if the system printf can print a long long]) else AC_MSG_RESULT([none]) fi fi ]) # The following type check macros are replacement versions for the actual # autoconf checks, which are more type specific. However the actual autoconf # macros are not available for autoconf version 2.59 (and older) which we # still need to support for a while. # CEXT_TYPE_LONG_LONG_INT #------------------------ # Check whether the compiler supports the 'long long int' type. AC_DEFUN([CEXT_TYPE_LONG_LONG_INT], [ AC_CHECK_TYPE([long long int], [], [], []) if test x"$ac_cv_type_long_long_int" = xyes; then AC_DEFINE([HAVE_LONG_LONG_INT], [1], [Define to 1 if the system has the type `long long int'.]) fi ]) # CEXT_TYPE_UNSIGNED_LONG_LONG_INT #--------------------------------- # Check whether the compiler supports the 'unsigned long long int' type. AC_DEFUN([CEXT_TYPE_UNSIGNED_LONG_LONG_INT], [ AC_CHECK_TYPE([unsigned long long int], [], [], []) if test x"$ac_cv_type_unsigned_long_long_int" = xyes; then AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], [Define to 1 if the system has the type `unsigned long long int'.]) fi ]) # CEXT_TYPE_INTMAX_T # ------------------ # Check whether the compiler supports the 'intmax_t' type. AC_DEFUN([CEXT_TYPE_INTMAX_T], [ AC_REQUIRE([CEXT_TYPE_LONG_LONG_INT]) AC_CHECK_TYPE([intmax_t], [ AC_DEFINE([HAVE_INTMAX_T], [1], [Define to 1 if the system has the type `intmax_t'.]) ], [ test $ac_cv_type_long_long_int = yes \ && ac_type='long long int' \ || ac_type='long int' AC_DEFINE_UNQUOTED([intmax_t], [$ac_type], [Define to the widest signed integer type if and do not define.]) ]) ]) # CEXT_TYPE_UINTMAX_T # ------------------- # Check whether the compiler supports the 'uintmax_t' type. AC_DEFUN([CEXT_TYPE_UINTMAX_T], [ AC_REQUIRE([CEXT_TYPE_UNSIGNED_LONG_LONG_INT]) AC_CHECK_TYPE([uintmax_t], [ AC_DEFINE([HAVE_UINTMAX_T], [1], [Define to 1 if the system has the type `uintmax_t'.]) ], [ test $ac_cv_type_long_long_int = yes \ && ac_type='unsigned long long int' \ || ac_type='unsigned long int' AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type], [Define to the widest unsigned integer type if and do not define.]) ]) ]) # CEXT_TYPE_UINTPTR_T # ------------------- # Check whether the compiler supports the 'uintptr_t' type. AC_DEFUN([CEXT_TYPE_UINTPTR_T], [ AC_CHECK_TYPE([uintptr_t], [ AC_DEFINE([HAVE_UINTPTR_T], 1, [Define to 1 if the system has the type `uintptr_t'.]) ], [ for ac_type in 'unsigned int' 'unsigned long int' \ 'unsigned long long int'; do AC_COMPILE_IFELSE( [ AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT], [[sizeof (void *) <= sizeof ($ac_type)]]) ], [ AC_DEFINE_UNQUOTED([uintptr_t], [$ac_type], [Define to the type of an unsigned integer type wide enough to hold a pointer, if such a type exists, and if the system does not define it.]) ac_type= ]) test -z "$ac_type" && break done ]) ]) # CEXT_TYPE_LONG_DOUBLE # --------------------- # Check whether the compiler supports the 'long double' type. AC_DEFUN([CEXT_TYPE_LONG_DOUBLE], [ AC_CACHE_CHECK([for long double], [ac_cv_type_long_double], [ if test "$GCC" = yes; then ac_cv_type_long_double=yes else AC_COMPILE_IFELSE( [ AC_LANG_BOOL_COMPILE_TRY( [[ /* The Stardent Vistra knows sizeof (long double), but does not support it. */ long double foo = 0.0L; ]], [[/* On Ultrix 4.3 cc, long double is 4 and double is 8. */ sizeof (double) <= sizeof (long double)]])], [ac_cv_type_long_double=yes], [ac_cv_type_long_double=no]) fi ]) if test $ac_cv_type_long_double = yes; then AC_DEFINE([HAVE_LONG_DOUBLE], [1], [Define to 1 if the system has the type `long double'.]) fi ]) # # CEXT_SET_PATHS #--------------- # Define auxiliary directories of the installed directory tree. AC_DEFUN([CEXT_SET_PATHS], [ if test -z "$apidocdir"; then apidocdir='${datadir}/doc/${PACKAGE}/html' fi AC_SUBST(apidocdir) if test -z "$pkgincludedir"; then pkgincludedir='${includedir}/cext' fi if test -z "$configdir"; then configdir='${includedir}' fi AC_SUBST(configdir) ]) # CEXT_SET_SYMBOLS #----------------- # Setup various Makefile symbols used for building the package AC_DEFUN([CEXT_SET_SYMBOLS], [ CEXT_INCLUDES='-I$(top_builddir)/cext -I$(top_srcdir)' AC_SUBST(CEXT_INCLUDES) ]) # CEXT_CREATE_CXCONFIG #--------------------- # Create the source for cxconfig.h in cext AC_DEFUN([CEXT_CREATE_CXCONFIG], [ AC_REQUIRE([CEXT_CHECK_CHAR_BIT]) AC_CONFIG_COMMANDS(cxconfig.h, [cfgfile="cext/cxconfig.h" tcfgfile="$cfgfile-tmp" cat > $tcfgfile << _CEXTEOF /* * cxconfig.h: This is a generated file! Do not edit this file! * All changes will be lost! */ #ifndef CXCONFIG_H_ #define CXCONFIG_H_ _CEXTEOF if test x$cext_have_limits_h = xyes; then echo '#include ' >> $tcfgfile fi if test x$cext_have_float_h = xyes; then echo '#include ' >> $tcfgfile fi if test x$cext_have_values_h = xyes; then echo '#include ' >> $tcfgfile fi if test x$cext_have_stdint_h = xyes; then echo '#include ' >> $tcfgfile fi if test x$cext_have_inttypes_h = xyes; then echo '#include ' >> $tcfgfile fi cat >> $tcfgfile << _CEXTEOF #include CX_BEGIN_DECLS /* * Limits for numerical data types */ #define CX_MINSHORT $cext_cxshort_min #define CX_MAXSHORT $cext_cxshort_max #define CX_MAXUSHORT $cext_cxushort_max #define CX_MININT $cext_cxint_min #define CX_MAXINT $cext_cxint_max #define CX_MAXUINT $cext_cxuint_max #define CX_MINLONG $cext_cxlong_min #define CX_MAXLONG $cext_cxlong_max #define CX_MAXULONG $cext_cxulong_max #define CX_MINFLOAT $cext_cxfloat_min #define CX_MAXFLOAT $cext_cxfloat_max #define CX_MINDOUBLE $cext_cxdouble_min #define CX_MAXDOUBLE $cext_cxdouble_max _CEXTEOF # This should be true for any modern C/C++ compiler # In addition this has been verified before by # the CX_CHECK_CHAR_BITS() call. if test x"$cext_have_char_8_bits" = xyes; then cat >> $tcfgfile << _CEXTEOF /* * Number of bits per char */ #define CX_CHAR_BIT 8 _CEXTEOF else echo '#error "Type char is not 8 bits wide!"' >> $tcfgfile fi cat >> $tcfgfile << _CEXTEOF /* * Fixed size integer types */ _CEXTEOF cat >> $tcfgfile << _CEXTEOF /* Macros for formatted output */ #define CX_PRINTF_FORMAT_INT8 $cxint8_print_format #define CX_PRINTF_FORMAT_UINT8 $cxuint8_print_format #define CX_PRINTF_FORMAT_INT16 $cxint16_print_format #define CX_PRINTF_FORMAT_UINT16 $cxuint16_print_format #define CX_PRINTF_FORMAT_INT32 $cxint32_print_format #define CX_PRINTF_FORMAT_UINT32 $cxuint32_print_format #define CX_PRINTF_FORMAT_INT64 $cxint64_print_format #define CX_PRINTF_FORMAT_UINT64 $cxuint64_print_format /* Macros for formatted output */ #define CX_SCANF_FORMAT_INT8 $cxint8_scan_format #define CX_SCANF_FORMAT_UINT8 $cxuint8_scan_format #define CX_SCANF_FORMAT_INT16 $cxint16_scan_format #define CX_SCANF_FORMAT_UINT16 $cxuint16_scan_format #define CX_SCANF_FORMAT_INT32 $cxint32_scan_format #define CX_SCANF_FORMAT_UINT32 $cxuint32_scan_format #define CX_SCANF_FORMAT_INT64 $cxint64_scan_format #define CX_SCANF_FORMAT_UINT64 $cxuint64_scan_format _CEXTEOF if test -n "$cxint8"; then cat >> $tcfgfile << _CEXTEOF /* Type definitions */ typedef $cxint8 cxint8; typedef $cxuint8 cxuint8; _CEXTEOF fi if test -n "$cxint16"; then cat >> $tcfgfile << _CEXTEOF typedef $cxint16 cxint16; typedef $cxuint16 cxuint16; _CEXTEOF fi if test -n "$cxint32"; then cat >> $tcfgfile << _CEXTEOF typedef $cxint32 cxint32; typedef $cxuint32 cxuint32; _CEXTEOF fi if test -n "$cxint64"; then cat >> $tcfgfile << _CEXTEOF ${cext_extension} typedef $cxint64 cxint64; ${cext_extension} typedef $cxuint64 cxuint64; #define CX_INT64_CONSTANT(val) $cxint64_constant #define CX_UINT64_CONSTANT(val) $cxuint64_constant _CEXTEOF fi cat >> $tcfgfile << _CEXTEOF #define CX_SIZEOF_VOID_P $cext_void_p #define CX_SIZEOF_SIZE_T $cext_size_t _CEXTEOF cat >> $tcfgfile << _CEXTEOF /* * Size type */ #define CX_PRINTF_FORMAT_SIZE_TYPE $cxsize_print_format #define CX_PRINTF_FORMAT_SSIZE_TYPE $cxssize_print_format #define CX_SCANF_FORMAT_SIZE_TYPE $cxsize_scan_format #define CX_SCANF_FORMAT_SSIZE_TYPE $cxssize_scan_format typedef signed $cext_size_type_define cxssize; typedef unsigned $cext_size_type_define cxsize; #define CX_MINSSIZE CX_MIN$cext_msize_type #define CX_MAXSSIZE CX_MAX$cext_msize_type #define CX_MAXSIZE CX_MAXU$cext_msize_type typedef cxint64 cxoffset; #define CX_MINOFFSET CX_MININT64 #define CX_MAXOFFSET CX_MAXINT64 _CEXTEOF if test -z "$cext_unknown_void_p"; then cat >> $tcfgfile << _CEXTEOF /* * Pointer to integer conversion */ #define CX_POINTER_TO_INT(ptr) ((cxint) ${cext_ptoi_cast} (ptr)) #define CX_POINTER_TO_UINT(ptr) ((cxint) ${cext_ptoui_cast} (ptr)) #define CX_INT_TO_POINTER(val) ((cxptr) ${cext_ptoi_cast} (val)) #define CX_UINT_TO_POINTER(val) ((cxptr) ${cext_ptoui_cast} (val)) _CEXTEOF else echo '#error Size of generic pointer is unknown - This should never happen' >> $tcfgfile fi cat >> $tcfgfile << _CEXTEOF #ifdef __cplusplus # define CX_HAVE_INLINE 1 #else $cext_inline #endif #ifdef __cplusplus # define CX_CAN_INLINE 1 _CEXTEOF if test x"$cext_can_inline" = xyes; then cat >> $tcfgfile << _CEXTEOF #else # define CX_CAN_INLINE 1 _CEXTEOF fi cat >> $tcfgfile << _CEXTEOF #endif _CEXTEOF if test x"$cext_have_gnuc_visibility" = xyes; then cat >> $tcfgfile << _CEXTEOF #define CX_HAVE_GNUC_VISIBILITY 1 _CEXTEOF fi cat >> $tcfgfile << _CEXTEOF #if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) # define CX_GNUC_INTERNAL __attribute__((visibility("hidden"))) #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) # define CX_GNUC_INTERNAL __hidden #elif defined (__GNUC__) && defined (CX_HAVE_GNUC_VISIBILITY) # define CX_GNUC_INTERNAL __attribute__((visibility("hidden"))) #else # define CX_GNUC_INTERNAL /* empty */ #endif _CEXTEOF cat >> $tcfgfile << _CEXTEOF CX_END_DECLS #endif /* CXCONFIG_H_ */ _CEXTEOF if test -f $cfgfile; then if cmp -s $tcfgfile $cfgfile; then AC_MSG_NOTICE([$cfgfile is unchanged]) rm -f $tcfgfile else mv $tcfgfile $cfgfile fi else mv $tcfgfile $cfgfile fi ], [ # Supported compiler attributes if test x"$eso_cv_prog_cc_attribute_visibility_hidden" = xyes; then cext_have_gnuc_visibility=yes fi # Number of bits per char eval $cext_cv_have_char_8_bits if test x"$ac_cv_type_int8_t" = xyes; then cxint8=int8_t cxuint8=uint8_t cxint8_print_format='PRIi8' cxuint8_print_format='PRIu8' cxint8_scan_format='SCNi8' cxuint8_scan_format='SCNu8' else cxint8='signed char' cxuint8='unsigned char' cxint8_print_format='"hhi"' cxuint8_print_format='"hhu"' cxint8_scan_format='"hhi"' cxuint8_scan_format='"hhu"' fi # 16 bit integers if test x"$ac_cv_type_int16_t" = xyes; then cxint16=int16_t cxuint16=uint16_t cxint16_print_format='PRIi16' cxuint16_print_format='PRIu16' cxint16_scan_format='SCNi16' cxuint16_scan_format='SCNu16' else case 2 in $ac_cv_sizeof_short) cxint16='signed short' cxuint16='unsigned short' cxint16_print_format='"hi"' cxuint16_print_format='"hu"' cxint16_scan_format='"hi"' cxuint16_scan_format='"hu"' ;; $ac_cv_sizeof_int) cxint16='signed int' cxuint16='unsigned int' cxint16_print_format='"i"' cxuint16_print_format='"u"' cxint16_scan_format='"i"' cxuint16_scan_format='"u"' ;; esac fi # 32 bit integers if test x"$ac_cv_type_int32_t" = xyes; then cxint32=int32_t cxuint32=uint32_t cxint32_print_format='PRIi32' cxuint32_print_format='PRIu32' cxint32_scan_format='SCNi32' cxuint32_scan_format='SCNu32' else case 4 in $ac_cv_sizeof_short) cxint32='signed short' cxuint32='unsigned short' cxint32_print_format='"hi"' cxuint32_print_format='"hu"' cxint32_scan_format='"hi"' cxuint32_scan_format='"hu"' ;; $ac_cv_sizeof_int) cxint32='signed int' cxuint32='unsigned int' cxint32_print_format='"i"' cxuint32_print_format='"u"' cxint32_scan_format='"i"' cxuint32_scan_format='"u"' ;; $ac_cv_sizeof_long) cxint32='signed long' cxuint32='unsigned long' cxint32_print_format='"li"' cxuint32_print_format='"lu"' cxint32_scan_format='"li"' cxuint32_scan_format='"lu"' ;; esac fi # 64 bit integers if test x"$ac_cv_type_int64_t" = xyes; then cxint64=int64_t cxuint64=uint64_t cxint64_print_format='PRIi64' cxuint64_print_format='PRIu64' cxint64_scan_format='SCNi64' cxuint64_scan_format='SCNu64' case 8 in $ac_cv_sizeof_int) cxint64_constant='(val)' cxuint64_constant='(val)' ;; $ac_cv_sizeof_long) cxint64_constant='(val##L)' cxuint64_constant='(val##UL)' ;; $ac_cv_sizeof_long_long) cext_extension="CX_GNUC_EXTENSION " cxint64_constant='(CX_GNUC_EXTENSION (val##LL))' cxuint64_constant='(CX_GNUC_EXTENSION (val##ULL))' ;; esac else case 8 in $ac_cv_sizeof_int) cxint64='signed int' cxuint64='unsigned int' cxint64_print_format='"i"' cxuint64_print_format='"u"' cxint64_scan_format='"i"' cxuint64_scan_format='"u"' cext_extension="" cxint64_constant='(val)' cxuint64_constant='(val)' ;; $ac_cv_sizeof_long) cxint64='signed long' cxuint64='unsigned long' cxint64_print_format='"li"' cxuint64_print_format='"lu"' cxint64_scan_format='"li"' cxuint64_scan_format='"lu"' cext_extension="" cxint64_constant='(val##L)' cxuint64_constant='(val##UL)' ;; $ac_cv_sizeof_long_long) cxint64='signed long long' cxuint64='unsigned long long' if test -n "$cext_cv_format_long_long"; then cxint64_print_format='"'$cext_cv_format_long_long'i"' cxuint64_print_format='"'$cext_cv_format_long_long'u"' cxint64_scan_format='"'$cext_cv_format_long_long'i"' cxuint64_scan_format='"'$cext_cv_format_long_long'u"' fi cext_extension="CX_GNUC_EXTENSION " cxint64_constant='(CX_GNUC_EXTENSION (val##LL))' cxuint64_constant='(CX_GNUC_EXTENSION (val##ULL))' ;; esac fi # Sizes of types cext_size_t="$ac_cv_sizeof_size_t" cext_void_p="$ac_cv_sizeof_void_p" # Size type cext_size_type_define="$cext_cv_type_size_type" case $cext_cv_type_size_type in short) cxsize_print_format='"hu"' cxssize_print_format='"hi"' cxsize_scan_format='"hu"' cxssize_scan_format='"hi"' cext_msize_type='SHRT' ;; int) cxsize_print_format='"u"' cxssize_print_format='"i"' cxsize_scan_format='"u"' cxssize_scan_format='"i"' cext_msize_type='INT' ;; long) cxsize_print_format='"lu"' cxssize_print_format='"li"' cxsize_scan_format='"lu"' cxssize_scan_format='"li"' cext_msize_type='LONG' ;; "long long") cxsize_print_format='"'$cext_cv_format_long_long'u"' cxssize_print_format='"'$cext_cv_format_long_long'i"' cxsize_scan_format='"'$cext_cv_format_long_long'u"' cxssize_scan_format='"'$cext_cv_format_long_long'i"' cext_msize_type='INT64' ;; esac # Pointer integer conversions case $ac_cv_sizeof_void_p in $ac_cv_sizeof_int) cext_ptoi_cast='' cext_ptoui_cast='' ;; $ac_cv_sizeof_long) cext_ptoi_cast='(cxlong)' cext_ptoui_cast='(cxlong)' ;; $ac_cv_sizeof_long_long) cext_ptoi_cast='(cxint64)' cext_ptoui_cast='(cxint64)' ;; *) cext_unknown_void_p=yes ;; esac # Standard integer types if test x$ac_cv_header_stdint_h = xyes; then cext_have_stdint_h=yes fi if test x$ac_cv_header_inttypes_h = xyes; then cext_have_inttypes_h=yes fi # type limits case xyes in x$ac_cv_header_limits_h) cext_have_limits_h=yes cext_cxshort_min=SHRT_MIN cext_cxshort_max=SHRT_MAX cext_cxushort_max=USHRT_MAX cext_cxint_min=INT_MIN cext_cxint_max=INT_MAX cext_cxuint_max=UINT_MAX cext_cxlong_min=LONG_MIN cext_cxlong_max=LONG_MAX cext_cxulong_max=ULONG_MAX ;; x$ac_cv_header_values_h) cext_have_values_h=yes cext_cxshort_min=MINSHORT cext_cxshort_max=MAXSHORT cext_cxushort_max="(((cxushort)CX_MAXSHORT)*2+1)" cext_cxint_min=MININT cext_cxint_max=MAXINT cext_cxuint_max="(((cxuint)CX_MAXINT)*2+1)" cext_cxlong_min=MINLONG cext_cxlong_max=MAXLONG cext_cxulong_max="(((cxulong)CX_MAXLONG)*2+1)" ;; esac case xyes in x$ac_cv_header_float_h) cext_have_float_h=yes cext_cxfloat_min=FLT_MIN cext_cxfloat_max=FLT_MAX cext_cxdouble_min=DBL_MIN cext_cxdouble_max=DBL_MAX ;; x$ac_cv_header_values_h) cext_have_values_h=yes cext_cxfloat_min=MINFLOAT cext_cxfloat_max=MAXFLOAT cext_cxdouble_min=MINDOUBLE cext_cxdouble_max=MAXDOUBLE ;; esac ]) ]) cpl-6.4.1/libcext/html/0000755000460300003120000000000012310333011011653 500000000000000cpl-6.4.1/libcext/html/doxygen.png0000644000460300003120000000730312310333010013760 00000000000000‰PNG  IHDRh ;ˆØŠIDATxí]y\•Õº~45%TL Q”PE"q–Û11±]8a„w*©¨(*â" ˆzÀè`8 ¨‰¢mÅ,’òà„p$%”œBó(8k†Ü÷ýÜû6lòö»§k÷Ç÷[ÏÞß·Ö;?k½ëßÕÕÕPxÑêÏ't´ÏùÈ€zÀÇÅ3_€Q4€g@œmÿ ¾ò‰âci‰ôçÿ{ ðÇð¬ù~½Á€4:õHcÂü ðŸÁ³„ª'ÕPÆæ P7^h،♠zb„cóP¨„ 3‚† Ò}çÿO²qÁºNkÝTÛ(É?d Ç~z<’«4Óǡ؞Þv­zµÙ¦õ¬ZâdÛ,Ë6Ók±]Fz< ¾ZçƒsÕ?ìƒsUø2SÉåwê1”c`[ì—}%ѽ.Ô¼6‚BLZ˜û!F8[ ¹…×TéÛ— »Þ#gó]å:vžu?‡vèbÙR˜?wùŽŸ¾ÊÐgbÑÉÌÕ$kF~Ê;عÆ•¢ïX®?ÉèlÆÙôõà»Nʪ¼­,ìHC§gAz•ÆlÓº­gÑú ]œjÎñåM…3ÓÚæoÒ³'=‘$Ò÷f}G•ŸS_‡öèco.Êȹ :ó£ Ãds®Ù:1=¼{ƒå9?÷ý…zqÛvîÓi‰D’p¿Ë šmÙíoÛâýaÖüEqÒµwÌ}¿~{òj€ç{ôºŸFNëí[ëOq·ÇOSúXO]°>‚‚muæÄ¾e¤“5Ë{¨JÕ¯£(›´«bÂçû’ÍlÓÅ}žïú`éUÞy„ac§Á†ÔCºŠóAkl‘±y¥†ô¢ùôs÷Aø¬7ÄõôoJ±äÄ ù.¥Be. Z¬Ð×ÇÈöå¹­ù'Ù-PëìŠyF.ž‚žÝÚ€lp&.êˆð•jò7’re’z19»ã§HGíø%œüq°ïüz׈c¬_k_")ŸHJnÐÑ~ˆÐÖ˜á´äÕ5 µÁq€ÿ5#¸·îà¶+9T‘‚ ðŽ÷Rܸrz“Ï´Ì =Ï…{ðáO£Èf ¡Íwg|Ž’Ü/¢Þ$÷¯¢ëðúÀ;¿à¨Ö™âÒÆ­]¯ÜW"Þ/< ‡÷DÏà°½üB}çyIEc^—ƒ=[V“Ýh²ëMä$l];Kû®¸ýr¦È*Åò ÿtÒõ$]•MŸ÷´;×I€1èó!‚œõ¸M õ¨(fÌæ<ÁÎÎò5~z¿ù¶ž mÌêÕ >–âÚ©âëˆIÎÞçz;ãu[i·eç^ÆÜÙÓ³NÞëF6B\}7†»+üŽÓ,Ã'a ½˜-yHY¿,‘^—ñfú~ß?Hcø¸…¸ñó{Z+4\såƒû·¯Ù·nߣð«íFÆ¡sغëû§D¾?ò<–Ævkx0ÅM±ælذÁIÓxÿd”žÜÉ÷EE»AªM«g*È£YEí7Û™^[uíý®v[wGå†=Ed¼n×¶ÆæÖÅl¡'¨pGÚk+‹æ¢À¬¨C8ªâš2 dz3H£ß ¡¨BÒûSÃÅù[wŘ ~xpçútÁæmö¤Å£¥iQæ­‰AB1ÉfÙ‰›4u¹ïìIÒ]Ë6äò%ÿ†† 1t.’NJph¬zÌ ÎR1Ž"3-"¸‡‹&ìó°1âüžìó[:‡ï„¼‘……N m–“W0®_èÜœ ×õ6ùò&»)Æìꦬýæ}¬ñ~»{múù]z½£M•ºP~^Îá:eQTÙ_*7ÕÄ9É8—·Ëï 3°¶47E•î¿u÷“SÉ»U¯ _ NíºôW¬e¸ÄNÓ|»;™¿;ŒæÅd"ȉôøòÞµõï¾®½"èÄ´ÖMM+bYµ‘_ÉæEÝüÎ]P»¹XKÐI½Þ¥oE<_¹(„EP±Œ|mÇÁ¡‘Ý,ŠÓ©ººZ±Îߺ§×kÝ,kÍMš`Äø…jzeU»æ ™Át3ÓÀ½˜6—ÒöùË·r¨¹Ñ}““wö:Χùë¼ ¿|‚TܵÉQˆKßç_ÁâÀ™œ”pÑÐóໃ¼Ydâ0!®àa –øöçW$ÃÁ‘Á$/\¬$ð 2ÞímÞLH‹Ÿ èd£HVÜ,:ò½»RÍZšJ­a„z*>‹_…NT(ù‚^SVF­U¹8ñEþôñ܈óùnd;«®8™\C]ø=Èêm¬Æ:‚´ÆbãDd=Áãßžˆ‹UU5O‹|]þð®Pèêv‰á\]2ßìÿ"yÈ[ïyʧz£g{Y«{„Ùø5©ÿ;w{N3é­nâĨw§Á¢ÍK¢Ý­ûÏ29Id¿’ì y)ìPÞò8ŒÅ©¯‰±@mPÔñwjl,6 áhWÕ˜d öà uõmÁp®.™á£Ç…twöR x­BδYcŒxg*vo  yò‘•“[¬?ÜVœ˜0ÒN¡O난~Žó’¯·h#´Hkýœ±8kÓß^Àq@]àÓ“ø,56´¯÷Í-κU»n…[>]@nîøÏœp›[œ6# €4tën¯:ŽÒþ}…—8äT9_žY$/´G’K™©ù†•(óÑ’Mø©`ŸÉdѺ;ùO‹B Ó&P{qöhJÉ+Úé–§¦l2«MïöÝ_1ÑÓ«’t¸½±l€ëØya ¦ô©«®½ÆL^¬žêñš¸ùy.¾Û½Š[ u/]½‹iS}øN>²e1™q‡jfÚ&¢©iT\=kÏ›ÀXô-.84V5ðu!TE˜ þ.ŒOH´¶4—zwTr.ï‰¦Ë xõµ·œÖ„HÆù£žÈHùg Ñhñ’T$ßyq¸zþ¨p¿´ë< q•ró÷š‰wÿÍÑð–I]´–æI²é²˜sÂ"×:Õ–bÕ¦“ÈÙL6¢9VÊÓWž§<æ;”3?ý©Mê3AV#µ±ËÞ¯‘ž K£UrÝ9!›qát¦H£Ù+6ÇV…/TS^pÃùqgLP'Ú5E ‚–ÀÞºîÄ Ën"2|Ÿ;®W»Îý"Ö¬TwÖâµtúŽO'› á+W Ã+¦âZÌ–<ÕÆ&nOÝ,IŠ£06.ÁZ.Çñúøh*INÚ’Oe½ÉgBXÐÔZóäøä9èü“hÒíDSš¥¡Ê µA¯/Ôc¸ö“`A§¯"zå|‘ €ÅŸ¨ú;HÍ#‚Î|%ÄOˆƒ«OàÌÉÐÜD ž mÜðâc–ƤÉÂqm¶uË&~÷núÒË £ÇÏ€ZÕj =«_n[‡‡÷nN§ÏÝ$_¾bE˜‚€Õ)ù8¾?6‘lú“ÍÙæÖ}#bW( œ³d-®•p&¡ý’œÖa”"9öõņÐ$’Ú›AÜ!ä;ÐÑõè{~á¹8‘ÛÞ£1ÛÓÉ0ž`²#´kÒuäNÅÖ Q¹bhæ ”8ûÓMáŽa›•¿”w±h²¢®qŠæ°(bK ‚’Z¾Ò%ÐÆémáãÖË(Éý‚ÛJ)@> þ›7% ï{y Á“¾ÆÒîohfòô>{pÿ.­_Î%±ÉèägëlZØ\B2B #™¸ÚüÒºp‚hÝšü®[¥Ü<‹#SpñÌA7’ãØHƒt4:Ÿ|g¨tÓL¶*($Æ©»ì…®ù’ó÷$;b›ÔÙ`=¶£¦M„MÌÄ5ò«·Ç¾“H·ÌH.¼žHeAîº5}r­dõ¨±)ÀT};€Q5iÖ2…O0ü…0óñÃ;óæ,Š´²µ냔}g‘£]‹7å9ˆà©_{üèîêžC>úhê{Ž .ÈìðIIð€?[Kswz6Òuíý¬;µ€ç§OåâJÉa˶zv°éd† ¤µâ‚l´é舊«Åüy¾c÷ÁèÖÍ'ràúÅ™TWÕôÓ°¡L €|ʽŒ¼ì­høBã ÝTëî'ò]Kø£ìâÏ(=¹Kx €¿ LÌ,Pý¤Êµu‡¹…׈ §Å¾÷à1Ý«Äý;¿pGDäxZYÛ kfæ6¸ùóæ7®œ®þ6·ÕoÚ¾ÔH~ò®Þ¸â 8Uø“p<ºw3¡a£ÏÑ’‘3èÏ"€bˆ-ÎܺÏ_ªÅ]+ËM©zü°s“f-êçhÇãÑýÊãôÿ5}ZQNb{Ó?å%ÿ\SUõعIÓæ}~}p[œoÔÄ„êÐMMZáNÅå@>Œ„²á6(?¡Åé âK½+ü?À%ÝÝ·/Ç1‚9áUø?B)”ÕèâÞlÈÒêÏ @=àùÄÞžk­®ÅIEND®B`‚cpl-6.4.1/libcext/html/ftv2cl.png0000644000460300003120000000070512310333010013502 00000000000000‰PNG  IHDRÚ}\ˆŒIDATxíÝ;H#AÇño4Љႇ œ„K‰‡‚á ’ê,m„ØØ vÚžJ°²¹ÚÎþî‚§ XY ÅB|dr³cvo—˜Ä°Ý ù0Ã’™3ÿͤõ”Ëe×´¸Éõ¯1XÞ8Œ‰nQˆ88ööÖ§3*rbñ¯¢û-$¨‚þ´˜“P1Žè@Z…-# Ïú01ÑÏÎêÄ1HkKŸ w¶O@¥ªÈóñ!f§ñu˜åác÷;’sá×Bý[E´Añ±—Í\ß>°ùý¿ÏËÊÂ]–P€zØf| Íñ¯“+Ù´gð5…b  i5ümM³œ_æÍq,ÒcŽõèoÓd´ !¶äò©ô•,ôðÀ{¹¨µYß,€zTÍ8H]𤕘ï7¼»/òó8ËQæ !F€~6ãá?Y ÀA@ŨÁ.@ƒ¶TäÄYïŠËë±r‘µ8Ð*·é>€Šçÿ?€×þŸe[6«xÂIEND®B`‚cpl-6.4.1/libcext/html/jquery.js0000644000460300003120000026726112310333010013465 00000000000000/*! jQuery v1.7.1 jquery.com | jquery.org/license */ (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")), f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() {for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c) {if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); cpl-6.4.1/libcext/html/doxygen.css0000644000460300003120000004740312310333010013771 00000000000000/* The standard CSS for doxygen */ body, table, div, p, dl { font: 400 14px/19px Roboto,sans-serif; } /* @group Heading Levels */ h1.groupheader { font-size: 150%; } .title { font-size: 150%; font-weight: bold; margin: 10px 2px; } h2.groupheader { border-bottom: 1px solid #879ECB; color: #354C7B; font-size: 150%; font-weight: normal; margin-top: 1.75em; padding-top: 8px; padding-bottom: 4px; width: 100%; } h3.groupheader { font-size: 100%; } h1, h2, h3, h4, h5, h6 { -webkit-transition: text-shadow 0.5s linear; -moz-transition: text-shadow 0.5s linear; -ms-transition: text-shadow 0.5s linear; -o-transition: text-shadow 0.5s linear; transition: text-shadow 0.5s linear; margin-right: 15px; } h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { text-shadow: 0 0 15px cyan; } dt { font-weight: bold; } div.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; } p.startli, p.startdd, p.starttd { margin-top: 2px; } p.endli { margin-bottom: 0px; } p.enddd { margin-bottom: 4px; } p.endtd { margin-bottom: 2px; } /* @end */ caption { font-weight: bold; } span.legend { font-size: 70%; text-align: center; } h3.version { font-size: 90%; text-align: center; } div.qindex, div.navtab{ background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; } div.qindex, div.navpath { width: 100%; line-height: 140%; } div.navtab { margin-right: 15px; } /* @group Link Styling */ a { color: #3D578C; font-weight: normal; text-decoration: none; } .contents a:visited { color: #4665A2; } a:hover { text-decoration: underline; } a.qindex { font-weight: bold; } a.qindexHL { font-weight: bold; background-color: #9CAFD4; color: #ffffff; border: 1px double #869DCA; } .contents a.qindexHL:visited { color: #ffffff; } a.el { font-weight: bold; } a.elRef { } a.code, a.code:visited { color: #4665A2; } a.codeRef, a.codeRef:visited { color: #4665A2; } /* @end */ dl.el { margin-left: -1cm; } pre.fragment { border: 1px solid #C4CFE5; background-color: #FBFCFD; padding: 4px 6px; margin: 4px 8px 4px 2px; overflow: auto; word-wrap: break-word; font-size: 9pt; line-height: 125%; font-family: monospace, fixed; font-size: 105%; } div.fragment { padding: 4px; margin: 4px; background-color: #FBFCFD; border: 1px solid #C4CFE5; } div.line { font-family: monospace, fixed; font-size: 13px; min-height: 13px; line-height: 1.0; text-wrap: unrestricted; white-space: -moz-pre-wrap; /* Moz */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: pre-wrap; /* CSS3 */ word-wrap: break-word; /* IE 5.5+ */ text-indent: -53px; padding-left: 53px; padding-bottom: 0px; margin: 0px; -webkit-transition-property: background-color, box-shadow; -webkit-transition-duration: 0.5s; -moz-transition-property: background-color, box-shadow; -moz-transition-duration: 0.5s; -ms-transition-property: background-color, box-shadow; -ms-transition-duration: 0.5s; -o-transition-property: background-color, box-shadow; -o-transition-duration: 0.5s; transition-property: background-color, box-shadow; transition-duration: 0.5s; } div.line.glow { background-color: cyan; box-shadow: 0 0 10px cyan; } span.lineno { padding-right: 4px; text-align: right; border-right: 2px solid #0F0; background-color: #E8E8E8; white-space: pre; } span.lineno a { background-color: #D8D8D8; } span.lineno a:hover { background-color: #C8C8C8; } div.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px; padding: 0.2em; border: solid thin #333; border-radius: 0.5em; -webkit-border-radius: .5em; -moz-border-radius: .5em; box-shadow: 2px 2px 3px #999; -webkit-box-shadow: 2px 2px 3px #999; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); } div.groupHeader { margin-left: 16px; margin-top: 12px; font-weight: bold; } div.groupText { margin-left: 16px; font-style: italic; } body { background-color: white; color: black; margin: 0; } div.contents { margin-top: 10px; margin-left: 12px; margin-right: 8px; } td.indexkey { background-color: #EBEFF6; font-weight: bold; border: 1px solid #C4CFE5; margin: 2px 0px 2px 0; padding: 2px 10px; white-space: nowrap; vertical-align: top; } td.indexvalue { background-color: #EBEFF6; border: 1px solid #C4CFE5; padding: 2px 10px; margin: 2px 0px; } tr.memlist { background-color: #EEF1F7; } p.formulaDsp { text-align: center; } img.formulaDsp { } img.formulaInl { vertical-align: middle; } div.center { text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { border: 0px; } address.footer { text-align: right; padding-right: 12px; } img.footer { border: 0px; vertical-align: middle; } /* @group Code Colorization */ span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } span.vhdldigit { color: #ff00ff } span.vhdlchar { color: #000000 } span.vhdlkeyword { color: #700070 } span.vhdllogic { color: #ff0000 } blockquote { background-color: #F7F8FB; border-left: 2px solid #9CAFD4; margin: 0 24px 0 4px; padding: 0 12px 0 16px; } /* @end */ /* .search { color: #003399; font-weight: bold; } form.search { margin-bottom: 0px; margin-top: 0px; } input.search { font-size: 75%; color: #000080; font-weight: normal; background-color: #e8eef2; } */ td.tiny { font-size: 75%; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #A3B4D7; } th.dirtab { background: #EBEFF6; font-weight: bold; } hr { height: 0px; border: none; border-top: 1px solid #4A6AAA; } hr.footer { height: 1px; } /* @group Member Descriptions */ table.memberdecls { border-spacing: 0px; padding: 0px; } .memberdecls td, .fieldtable tr { -webkit-transition-property: background-color, box-shadow; -webkit-transition-duration: 0.5s; -moz-transition-property: background-color, box-shadow; -moz-transition-duration: 0.5s; -ms-transition-property: background-color, box-shadow; -ms-transition-duration: 0.5s; -o-transition-property: background-color, box-shadow; -o-transition-duration: 0.5s; transition-property: background-color, box-shadow; transition-duration: 0.5s; } .memberdecls td.glow, .fieldtable tr.glow { background-color: cyan; box-shadow: 0 0 15px cyan; } .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { background-color: #F9FAFC; border: none; margin: 4px; padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { padding: 0px 8px 4px 8px; color: #555; } .memSeparator { border-bottom: 1px solid #DEE4F0; line-height: 1px; margin: 0px; padding: 0px; } .memItemLeft, .memTemplItemLeft { white-space: nowrap; } .memItemRight { width: 100%; } .memTemplParams { color: #4665A2; white-space: nowrap; font-size: 80%; } /* @end */ /* @group Member Details */ /* Styles for detailed member documentation */ .memtemplate { font-size: 80%; color: #4665A2; font-weight: normal; margin-left: 9px; } .memnav { background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .mempage { width: 100%; } .memitem { padding: 0; margin-bottom: 10px; margin-right: 5px; -webkit-transition: box-shadow 0.5s linear; -moz-transition: box-shadow 0.5s linear; -ms-transition: box-shadow 0.5s linear; -o-transition: box-shadow 0.5s linear; transition: box-shadow 0.5s linear; display: table !important; width: 100%; } .memitem.glow { box-shadow: 0 0 15px cyan; } .memname { font-weight: bold; margin-left: 6px; } .memname td { vertical-align: bottom; } .memproto, dl.reflist dt { border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 0px 6px 0px; color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; /* opera specific markup */ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); border-top-right-radius: 4px; border-top-left-radius: 4px; /* firefox specific markup */ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; -moz-border-radius-topright: 4px; -moz-border-radius-topleft: 4px; /* webkit specific markup */ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -webkit-border-top-right-radius: 4px; -webkit-border-top-left-radius: 4px; } .memdoc, dl.reflist dd { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 10px 2px 10px; background-color: #FBFCFD; border-top-width: 0; background-image:url('nav_g.png'); background-repeat:repeat-x; background-color: #FFFFFF; /* opera specific markup */ border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); /* firefox specific markup */ -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; /* webkit specific markup */ -webkit-border-bottom-left-radius: 4px; -webkit-border-bottom-right-radius: 4px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); } dl.reflist dt { padding: 5px; } dl.reflist dd { margin: 0px 0px 10px 0px; padding: 5px; } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; white-space: nowrap; } .paramname em { font-style: normal; } .paramname code { line-height: 14px; } .params, .retval, .exception, .tparams { margin-left: 0px; padding-left: 0px; } .params .paramname, .retval .paramname { font-weight: bold; vertical-align: top; } .params .paramtype { font-style: italic; vertical-align: top; } .params .paramdir { font-family: "courier new",courier,monospace; vertical-align: top; } table.mlabels { border-spacing: 0px; } td.mlabels-left { width: 100%; padding: 0px; } td.mlabels-right { vertical-align: bottom; padding: 0px; white-space: nowrap; } span.mlabels { margin-left: 8px; } span.mlabel { background-color: #728DC1; border-top:1px solid #5373B4; border-left:1px solid #5373B4; border-right:1px solid #C4CFE5; border-bottom:1px solid #C4CFE5; text-shadow: none; color: white; margin-right: 4px; padding: 2px 3px; border-radius: 3px; font-size: 7pt; white-space: nowrap; vertical-align: middle; } /* @end */ /* these are for tree view when not used as main index */ div.directory { margin: 10px 0px; border-top: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; width: 100%; } .directory table { border-collapse:collapse; } .directory td { margin: 0px; padding: 0px; vertical-align: top; } .directory td.entry { white-space: nowrap; padding-right: 6px; } .directory td.entry a { outline:none; } .directory td.entry a img { border: none; } .directory td.desc { width: 100%; padding-left: 6px; padding-right: 6px; padding-top: 3px; border-left: 1px solid rgba(0,0,0,0.05); } .directory tr.even { padding-left: 6px; background-color: #F7F8FB; } .directory img { vertical-align: -30%; } .directory .levels { white-space: nowrap; width: 100%; text-align: right; font-size: 9pt; } .directory .levels span { cursor: pointer; padding-left: 2px; padding-right: 2px; color: #3D578C; } div.dynheader { margin-top: 8px; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } address { font-style: normal; color: #2A3D61; } table.doxtable { border-collapse:collapse; margin-top: 4px; margin-bottom: 4px; } table.doxtable td, table.doxtable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.doxtable th { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; } table.fieldtable { width: 100%; margin-bottom: 10px; border: 1px solid #A8B8D9; border-spacing: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); } .fieldtable td, .fieldtable th { padding: 3px 7px 2px; } .fieldtable td.fieldtype, .fieldtable td.fieldname { white-space: nowrap; border-right: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; vertical-align: top; } .fieldtable td.fielddoc { border-bottom: 1px solid #A8B8D9; width: 100%; } .fieldtable tr:last-child td { border-bottom: none; } .fieldtable th { background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; font-size: 90%; color: #253555; padding-bottom: 4px; padding-top: 5px; text-align:left; -moz-border-radius-topleft: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom: 1px solid #A8B8D9; } .tabsearch { top: 0px; left: 10px; height: 36px; background-image: url('tab_b.png'); z-index: 101; overflow: hidden; font-size: 13px; } .navpath ul { font-size: 11px; background-image:url('tab_b.png'); background-repeat:repeat-x; background-position: 0 -5px; height:30px; line-height:30px; color:#8AA0CC; border:solid 1px #C2CDE4; overflow:hidden; margin:0px; padding:0px; } .navpath li { list-style-type:none; float:left; padding-left:10px; padding-right:15px; background-image:url('bc_s.png'); background-repeat:no-repeat; background-position:right; color:#364D7C; } .navpath li.navelem a { height:32px; display:block; text-decoration: none; outline: none; color: #283A5D; font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); text-decoration: none; } .navpath li.navelem a:hover { color:#6884BD; } .navpath li.footer { list-style-type:none; float:right; padding-left:10px; padding-right:15px; background-image:none; background-repeat:no-repeat; background-position:right; color:#364D7C; font-size: 8pt; } div.summary { float: right; font-size: 8pt; padding-right: 5px; width: 50%; text-align: right; } div.summary a { white-space: nowrap; } div.ingroups { font-size: 8pt; width: 50%; text-align: left; } div.ingroups a { white-space: nowrap; } div.header { background-image:url('nav_h.png'); background-repeat:repeat-x; background-color: #F9FAFC; margin: 0px; border-bottom: 1px solid #C4CFE5; } div.headertitle { padding: 5px 5px 5px 10px; } dl { padding: 0 0 0 10px; } /* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ dl.section { margin-left: 0px; padding-left: 0px; } dl.note { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #D0C000; } dl.warning, dl.attention { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #FF0000; } dl.pre, dl.post, dl.invariant { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #00D000; } dl.deprecated { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #505050; } dl.todo { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #00C0E0; } dl.test { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #3030E0; } dl.bug { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #C08050; } dl.section dd { margin-bottom: 6px; } #projectlogo { text-align: center; vertical-align: bottom; border-collapse: separate; } #projectlogo img { border: 0px none; } #projectname { font: 300% Tahoma, Arial,sans-serif; margin: 0px; padding: 2px 0px; } #projectbrief { font: 120% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #projectnumber { font: 50% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #titlearea { padding: 0px; margin: 0px; width: 100%; border-bottom: 1px solid #5373B4; } .image { text-align: center; } .dotgraph { text-align: center; } .mscgraph { text-align: center; } .caption { font-weight: bold; } div.zoom { border: 1px solid #90A5CE; } dl.citelist { margin-bottom:50px; } dl.citelist dt { color:#334975; float:left; font-weight:bold; margin-right:10px; padding:5px; } dl.citelist dd { margin:2px 0; padding:5px 0; } div.toc { padding: 14px 25px; background-color: #F4F6FA; border: 1px solid #D8DFEE; border-radius: 7px 7px 7px 7px; float: right; height: auto; margin: 0 20px 10px 10px; width: 200px; } div.toc li { background: url("bdwn.png") no-repeat scroll 0 5px transparent; font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; margin-top: 5px; padding-left: 10px; padding-top: 2px; } div.toc h3 { font: bold 12px/1.2 Arial,FreeSans,sans-serif; color: #4665A2; border-bottom: 0 none; margin: 0; } div.toc ul { list-style: none outside none; border: medium none; padding: 0px; } div.toc li.level1 { margin-left: 0px; } div.toc li.level2 { margin-left: 15px; } div.toc li.level3 { margin-left: 30px; } div.toc li.level4 { margin-left: 45px; } .inherit_header { font-weight: bold; color: gray; cursor: pointer; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .inherit_header td { padding: 6px 0px 2px 5px; } .inherit { display: none; } tr.heading h2 { margin-top: 12px; margin-bottom: 4px; } @media print { #top { display: none; } #side-nav { display: none; } #nav-path { display: none; } body { overflow:visible; } h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } .summary { display: none; } .memitem { page-break-inside: avoid; } #doc-content { margin-left:0 !important; height:auto !important; width:auto !important; overflow:inherit; display:inline; } } cpl-6.4.1/libcext/html/open.png0000644000460300003120000000017312310333010013242 00000000000000‰PNG  IHDR à‘BIDATxíÝÁ €0 Ð׬ՙ\Àº€39—b!©9{|ðI>$#Àß´ý8/¨ÄØzƒ/Ï>2À[ÎgiU,/¬~¼Ï\ Ä9Ù¸IEND®B`‚cpl-6.4.1/libcext/html/cxtypes_8h_source.html0000644000460300003120000004226012310333011016143 00000000000000 C Standard Library Extensions: cxtypes.h Source File
C Standard Library Extensions  1.1.2
cxtypes.h
1 /* $Id: cxtypes.h,v 1.4 2012-08-17 13:58:45 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef _CX_TYPES_H
22 #define _CX_TYPES_H
23 
24 #include <cxconfig.h>
25 #include <cxmacros.h>
26 
27 
28 CX_BEGIN_DECLS
29 
30 /*
31  * Some mathematical constants. Some strict ISO C implementations
32  * don't provide them as symbols. The constants provide enough
33  * digits for the 128 bit IEEE quad
34  */
35 
36 #define CX_E 2.7182818284590452353602874713526625L
37 #define CX_LN2 0.6931471805599453094172321214581766L
38 #define CX_LN10 2.3025850929940456840179914546843642L
39 #define CX_PI 3.1415926535897932384626433832795029L
40 #define CX_PI_2 1.5707963267948966192313216916397514L
41 #define CX_PI_4 0.7853981633974483096156608458198757L
42 #define CX_SQRT2 1.4142135623730950488016887242096981L
43 
44 
45 /*
46  * Minimum and maximum constants for fixed size integer types
47  */
48 
49 #define CX_MININT8 ((cxint8) 0x80)
50 #define CX_MAXINT8 ((cxint8) 0x7f)
51 #define CX_MAXUINT8 ((cxuint8) 0xff)
52 
53 #define CX_MININT16 ((cxint16) 0x8000)
54 #define CX_MAXINT16 ((cxint16) 0x7fff)
55 #define CX_MAXUINT16 ((cxuint16) 0xffff)
56 
57 #define CX_MININT32 ((cxint32) 0x80000000)
58 #define CX_MAXINT32 ((cxint32) 0x7fffffff)
59 #define CX_MAXUINT32 ((cxuint32) 0xffffffff)
60 
61 #define CX_MININT64 ((cxint64) CX_INT64_CONSTANT(0x8000000000000000))
62 #define CX_MAXINT64 CX_INT64_CONSTANT(0x7fffffffffffffff)
63 #define CX_MAXUINT64 CX_INT64_CONSTANT(0xffffffffffffffffU)
64 
65 
66 /*
67  * For completeness: Definitions for standard types
68  */
69 
70 typedef char cxchar;
71 typedef short cxshort;
72 typedef int cxint;
73 typedef long cxlong;
74 typedef long long cxllong;
75 typedef cxint cxbool;
76 
77 typedef unsigned char cxuchar;
78 typedef unsigned short cxushort;
79 typedef unsigned int cxuint;
80 typedef unsigned long cxulong;
81 typedef unsigned long long cxullong;
82 typedef cxuchar cxbyte;
83 
84 typedef float cxfloat;
85 typedef double cxdouble;
86 
87 typedef void * cxptr;
88 typedef const void * cxcptr;
89 
90 
91 /*
92  * Generic, frequently used types.
93  */
94 
95 typedef cxint (*cx_compare_func) (cxcptr a, cxcptr b);
96 typedef cxint (*cx_compare_data_func) (cxcptr a, cxcptr b, cxptr data);
97 typedef cxbool (*cx_equal_func) (cxcptr a, cxcptr b);
98 typedef void (*cx_free_func) (cxptr data);
99 
100 CX_END_DECLS
101 
102 #endif /* _CX_TYPES_H */
cpl-6.4.1/libcext/html/sync_off.png0000644000460300003120000000152512310333010014111 00000000000000‰PNG  IHDRàw=øIDATxíÝKhTWÀñÿä1I&3™8M¦Iš™†I3Ú©b$cÌ I1V1±-(Tö±±Ð.* t!‚K[¥Ä¥ˆ„¨´f£`l(øl©"Y”¤6ÆgÌTú}·sgîܹ ±d{8?æÌ¹÷;çÜuíÚ`:!±F¬¢BäŠ?ŰÄm'yÊÅ>ÑlU¯½üý‰è_‹?€Œê ]€Y(ŠNñ±8fý1°Öqún-eâ¨øtºmâÈ Ó0}b›ù%·©µ×Œ®=Ÿ0´³?Š1sŸ‹0€¯8À‘;_ ‹W|%\ Zð— >舽ln¨p©.aÇ{ )t;Ú b nŸš¯›65°¢¡2çÅÔ?Žž>Oдàuönm¤¢Ì`×­Z¬WjC~>‘Ö¾0+á {{©fÝ×Mæ·æÅ•ìÙ¼˜` Ý›%uA6´½ÅÆö¨Á,]k¢ÄW¼™u±›]‹ˆ7§¯iòh€ ¶¶¬ÏÖu1 ló —Ҷ̺–:ÞÍ\ÄcãÏxøhR²Êè‡Qt$¿ß§¨ ª fdºü<4BÿÙ[•f¸d7=.Mé9/—éªÃëù/ÿO Üaàò}€,‘j?Ÿõ.5Úšm?œÿŸ®ŽXÿ2¬#¸d píæ(£?cÛú¼!½›a1¥Þ—ŽòØ©ܾ7dÔK:‚ùÒ‰ì)Ê3‚Ü™àÌà]€,±H€µ+køöäu<|`·LhC7¹ÔeÍ Ÿ×Ÿ˜tÜ‹ óH$^2%l.êaeÐäýE”ÌÉ|ÅÜìî‰Ýsä }¸ýDû^hzé~ðR›¦Ã¡¿]|#ü¯@×—Ö‡[k¹–<|š(Ç*€Ý¹dÇtMé:Ýñø«Ø,êÅû¢]”' øXÓ_nò¡Æ|Øý /c§fžâOIEND®B`‚cpl-6.4.1/libcext/html/group__cxstring.html0000644000460300003120000016257212310333011015712 00000000000000 C Standard Library Extensions: Strings
C Standard Library Extensions  1.1.2
Strings

Typedefs

typedef struct _cx_string_ cx_string
 The cx_string data type.
 

Functions

cx_stringcx_string_new (void)
 Create a new, initialized string container.
 
cx_stringcx_string_copy (const cx_string *self)
 Create a copy a cx_string.
 
cx_stringcx_string_create (const cxchar *value)
 Create a new string from a standard C string.
 
void cx_string_delete (cx_string *self)
 Destroy a string.
 
cxsize cx_string_size (const cx_string *self)
 Computes the length of the string.
 
cxbool cx_string_empty (const cx_string *self)
 Checks whether a string contains any characters.
 
void cx_string_set (cx_string *self, const cxchar *data)
 Assign a value to a string.
 
const cxchar * cx_string_get (const cx_string *self)
 Get the string's value.
 
cx_stringcx_string_upper (cx_string *self)
 Converts the string into uppercase.
 
cx_stringcx_string_lower (cx_string *self)
 Converts the string into lowercase.
 
cx_stringcx_string_trim (cx_string *self)
 Remove leading whitespaces from the string.
 
cx_stringcx_string_rtrim (cx_string *self)
 Remove trailing whitespaces from the string.
 
cx_stringcx_string_strip (cx_string *self)
 Remove leading and trailing whitespaces from the string.
 
cx_stringcx_string_prepend (cx_string *self, const cxchar *data)
 Prepend an array of characters to the string.
 
cx_stringcx_string_append (cx_string *self, const cxchar *data)
 Append an array of characters to the string.
 
cx_stringcx_string_insert (cx_string *self, cxssize position, const cxchar *data)
 Inserts a copy of a string at a given position.
 
cx_stringcx_string_erase (cx_string *self, cxssize position, cxssize length)
 Erase a portion of the string.
 
cx_stringcx_string_truncate (cx_string *self, cxsize length)
 Truncate the string.
 
cxbool cx_string_equal (const cx_string *string1, const cx_string *string2)
 Compare two cx_string for equality.
 
cxint cx_string_compare (const cx_string *string1, const cx_string *string2)
 Compare two strings.
 
cxint cx_string_casecmp (const cx_string *string1, const cx_string *string2)
 Compare two strings ignoring the case of characters.
 
cxint cx_string_ncasecmp (const cx_string *string1, const cx_string *string2, cxsize n)
 Compare the first n characters of two strings ignoring the case of characters.
 
cxint cx_string_sprintf (cx_string *self, const char *format,...)
 Writes to a string under format control.
 
cxint cx_string_vsprintf (cx_string *self, const cxchar *format, va_list args)
 Write to the string from a variable-length argument list under format control.
 
void cx_string_print (const cx_string *string)
 Print the value of a cx_string to the standard output.
 

Detailed Description

A cx_string is similar to a standard C string, except that it grows automatically as text is appended or inserted. The character data the string contains is '\0' terminated in order to guarantee full compatibility with string utility functions processing standard C strings. Together with the character data it also stores the length of the string.

Function Documentation

cx_string* cx_string_append ( cx_string self,
const cxchar *  data 
)

Append an array of characters to the string.

Parameters
selfThe string.
dataPointer to character array to be appended.
Returns
The passed string self with the characters appended, or NULL in case of errors.

The function adds the contents of the character buffer data to the end of the string. If data is a NULL pointer the string self is not modified.

References cx_free(), and cx_malloc().

Referenced by cx_log_default_handler().

cxint cx_string_casecmp ( const cx_string string1,
const cx_string string2 
)

Compare two strings ignoring the case of characters.

Parameters
string1First cx_string.
string2Second cx_string.
Returns
The function returns an interger less than, equal to, or greater than 0 if string1 is found, respectively, to be less than, to match, or to be greater than string2.

The function compares string2 with string in the same way as the standard C function strcmp() does, but ignores the case of ASCII characters.

References cx_strcasecmp().

cxint cx_string_compare ( const cx_string string1,
const cx_string string2 
)

Compare two strings.

Parameters
string1First cx_string.
string2Second cx_string.
Returns
The function returns an interger less than, equal to, or greater than 0 if string1 is found, respectively, to be less than, to match, or to be greater than string2.

The function compares string2 with string in the same way as the standard C function strcmp() does.

cx_string* cx_string_copy ( const cx_string self)

Create a copy a cx_string.

Parameters
selfThe string to copy.
Returns
Pointer to the newly created copy of string.
cx_string* cx_string_create ( const cxchar *  value)

Create a new string from a standard C string.

Parameters
valueThe initial text to copy into the string.
Returns
Pointer to newly created string.

A new string is created and the text value is initially copied into the string.

void cx_string_delete ( cx_string self)

Destroy a string.

Parameters
selfThe string to destroy.
Returns
Nothing.

The function deallocates string's character buffer and finally frees the memory allocated for string itself.

References cx_free().

Referenced by cx_log_default_handler().

cxbool cx_string_empty ( const cx_string self)

Checks whether a string contains any characters.

Parameters
selfThe string.
Returns
The function returns TRUE if the string is empty, or FALSE otherwise.

A string is considered to be empty if its size is 0 or if it has not been initialized, i.e. no value has been assigned yet.

cxbool cx_string_equal ( const cx_string string1,
const cx_string string2 
)

Compare two cx_string for equality.

Parameters
string1First cx_string.
string2Second cx_string.
Returns
TRUE if equal, FALSE if not.

The function checks whether two strings are equal. Two strings are equal if their values match on a character by character basis.

cx_string* cx_string_erase ( cx_string self,
cxssize  position,
cxssize  length 
)

Erase a portion of the string.

Parameters
selfThe string.
positionPosition of the first character to be erased.
lengthNumber of characters to erase.
Returns
The passed string self with the characters removed, or NULL in case of errors.

The function removes length characters from the string starting at the character index position. The number of characters to be removed is inclusive the character at index position. The characters following the removed portion are shifted to fill the gap. Character positions start counting from 0.

If the number of characters to erase length is less the 0 all characters starting at position up to the end of the string are erased.

References cx_free(), and cx_malloc().

const cxchar* cx_string_get ( const cx_string self)

Get the string's value.

Parameters
selfThe string.
Returns
A constant pointer to the string's data member, or NULL if the string is uninitialized.

A pointer to the strings character data. The character array pointed to by this pointer is an standard C string, i.e. '\0' terminated and can be used together with any string processing function from the standard C library (but see below).

Warning
The string's data must not be modified using the returned pointer, otherwise the internal consistency may be lost.

Referenced by cx_log_default_handler().

cx_string* cx_string_insert ( cx_string self,
cxssize  position,
const cxchar *  data 
)

Inserts a copy of a string at a given position.

Parameters
selfThe string.
positionCharacter position at which the data is inserted.
dataPointer to character array to be inserted.
Returns
The passed string self with the characters inserted, or NULL in case of errors.

The function inserts the contents of the character buffer data at the character index position into the string, expanding the string if necessary. Character positions start counting from 0. If data is a NULL pointer the string self is not modified.

References cx_free(), and cx_malloc().

cx_string* cx_string_lower ( cx_string self)

Converts the string into lowercase.

Parameters
selfThe string.
Returns
The passed string self with all characters converted to lowercase, or NULL in case of errors.

All uppercase letters stored in the string are converted to lowercase letters. The conversion is done using the standard C function tolower().

cxint cx_string_ncasecmp ( const cx_string string1,
const cx_string string2,
cxsize  n 
)

Compare the first n characters of two strings ignoring the case of characters.

Parameters
string1First string.
string2Second string.
nNumber of characters to compare.
Returns
An integer less than, equal to, or greater than zero if the first n characters of string1 are found, respectively, to be less than, to match, or be greater than the first n characters of string2.

The function compares the first n characters of the two strings string1 and string2 as strncmp() does, but ignores the case of ASCII characters.

References cx_strncasecmp().

cx_string* cx_string_new ( void  )

Create a new, initialized string container.

Returns
Pointer to newly created string.

The function allocates memory for the string and initializes it, i.e. the member functions are hooked into the newly created string.

Using this constructor is the only way to correctly create and setup a new string.

Referenced by cx_log_default_handler().

cx_string* cx_string_prepend ( cx_string self,
const cxchar *  data 
)

Prepend an array of characters to the string.

Parameters
selfThe string.
dataPointer to character array to be prepended.
Returns
The passed string self with the characters prepended, or NULL in case of errors.

The function adds the contents of the character buffer data to the beginning of the string. If data is a NULL pointer the string self is not modified.

References cx_free(), and cx_malloc().

Referenced by cx_log_default_handler().

void cx_string_print ( const cx_string string)

Print the value of a cx_string to the standard output.

Parameters
stringA cx_string.

This function is provided for debugging purposes. It just writes the strings contents to the standard output using cx_print().

References cx_print().

cx_string* cx_string_rtrim ( cx_string self)

Remove trailing whitespaces from the string.

Parameters
selfThe string.
Returns
The passed string self with trailing whitespaces revoved, or NULL in case of errors.

The function removes trailing whitespace characters from the string. Whitespace characters are recognized by the standard C function isspace().

void cx_string_set ( cx_string self,
const cxchar *  data 
)

Assign a value to a string.

Parameters
selfThe string.
dataCharacter array to be assigned.
Returns
Nothing.

Stores the contents of the character array pointed to by data into the string.

cxsize cx_string_size ( const cx_string self)

Computes the length of the string.

Parameters
selfThe string.
Returns
The string's length, or 0 for uninitialized or empty strings.

Computes the length of the string.

cxint cx_string_sprintf ( cx_string self,
const char *  format,
  ... 
)

Writes to a string under format control.

Parameters
selfThe string to write to.
formatThe format string.
...The arguments to insert into format.
Returns
The number of characters (excluding the trailing null) written to self, i.e. its length. If sufficient space cannot be allocated, -1 is returned.

The function writes the formatted character array to the string. The function works similar to sprintf() function, except that the string's buffer expands automatically to contain the formatted result. The previous contents of the string is destroyed.

Referenced by cx_log_default_handler().

cx_string* cx_string_strip ( cx_string self)

Remove leading and trailing whitespaces from the string.

Parameters
selfThe string.
Returns
The passed string self with leading and trailing whitespaces removed, or NULL in case of errors.

The function removes leading and trailing whitespace characters from the string. Whitespace characters are recognized by the standard C function isspace().

cx_string* cx_string_trim ( cx_string self)

Remove leading whitespaces from the string.

Parameters
selfThe string.
Returns
The passed string self with leading whitespaces removed, or NULL in case of errors.

The function removes leading whitespace characters from the string. Whitespace characters are recognized by the standard C function isspace().

cx_string* cx_string_truncate ( cx_string self,
cxsize  length 
)

Truncate the string.

Parameters
selfThe string.
lengthThe length to which the string is truncated.
Returns
The truncated string self, or NULL in case of errors.

The function removes all characters from the string starting at the character index length up to the end of the string, effectively truncating the string from its original size to a string of length length.

Calling the truncate method is equivalent to:

cx_string_erase(s, length, -1);
cx_string* cx_string_upper ( cx_string self)

Converts the string into uppercase.

Parameters
selfThe string.
Returns
The passed string self with all characters converted to uppercase, or NULL in case of errors.

All lowercase letters stored in the string are converted to uppercase letters. The conversion is done using the standard C function toupper().

cxint cx_string_vsprintf ( cx_string self,
const cxchar *  format,
va_list  args 
)

Write to the string from a variable-length argument list under format control.

Parameters
selfThe string.
formatThe format string.
argsVariable-length arguments to be inserted into format.
Returns
The number of characters (excluding the trailing null) written to self, i.e. its length. If sufficient space cannot be allocated, -1 is returned.

The function writes the formatted character array to the string. The function works similar to vsprintf() function, except that the string's buffer expands automatically to contain the formatted result. The previous contents of the string is destroyed.

cpl-6.4.1/libcext/html/group__cxstrutils.html0000644000460300003120000010774112310333011016272 00000000000000 C Standard Library Extensions: String Utility Functions
C Standard Library Extensions  1.1.2
String Utility Functions

Functions

cxint cx_strcasecmp (const cxchar *s1, const cxchar *s2)
 Compare two strings ignoring the case of ASCII characters.
 
cxint cx_strncasecmp (const cxchar *s1, const cxchar *s2, cxsize n)
 Compare the first n characters of two strings ignoring the case of ASCII characters.
 
cxint cx_strempty (const cxchar *string, const cxchar *pattern)
 Test if a string represents an empty string.
 
cxchar * cx_strlower (cxchar *s)
 Convert all uppercase characters in a string into lowercase characters.
 
cxchar * cx_strupper (cxchar *s)
 Convert all lowercase characters in a string into uppercase characters.
 
cxchar * cx_strtrim (cxchar *string)
 Remove leading whitespace characters from a string.
 
cxchar * cx_strrtrim (cxchar *string)
 Remove trailing whitespace characters from a string.
 
cxchar * cx_strstrip (cxchar *string)
 Remove leading and trailing whitespace characters from a string.
 
cxchar * cx_strskip (const cxchar *string, int(*ctype)(int))
 Locate the first character in a string that does not belong to a given character class.
 
cxchar * cx_strdup (const cxchar *string)
 Duplicate a string.
 
cxchar * cx_strndup (const cxchar *string, cxsize n)
 Duplicate the first n charactes of a string.
 
cxchar * cx_strvdupf (const cxchar *format, va_list args)
 Create a string from a variable-length argument list under format control.
 
cxchar * cx_stpcpy (cxchar *dest, const cxchar *src)
 Copy a string returning a pointer to its end.
 
void cx_strfreev (cxchar **sarray)
 Deallocate a NULL terminated string array.
 
cxchar ** cx_strsplit (const cxchar *string, const cxchar *delimiter, cxint max_tokens)
 Split a string into pieces at a given delimiter.
 
cxchar * cx_strjoinv (const cxchar *separator, cxchar **sarray)
 Join strings from an array of strings.
 

Detailed Description

The module implements various string-related utility functions suitable for creating, searching and modifying C strings.

Synopsis:
#include <cxstrutils.h>

Function Documentation

cxchar* cx_stpcpy ( cxchar *  dest,
const cxchar *  src 
)

Copy a string returning a pointer to its end.

Parameters
destDestination string.
srcSource string.
Returns
Pointer to the terminating '\0' of the concatenated string.

The function copies the string src, including its terminating '\0', to the string dest. The source and the destination string may not overlap and the destination buffer must be large enough to receive the copy.

cxint cx_strcasecmp ( const cxchar *  s1,
const cxchar *  s2 
)

Compare two strings ignoring the case of ASCII characters.

Parameters
s1First string.
s2Second string.
Returns
An integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2.

The function compares the two strings s1 and s2 as strcmp() does, but ignores the case of ASCII characters.

Referenced by cx_string_casecmp().

cxchar* cx_strdup ( const cxchar *  string)

Duplicate a string.

Parameters
stringString to be duplicated.
Returns
Newly allocated copy of the original string.

Duplicates the input string string. The newly allocated copy returned to the caller can be deallocated using cx_free().

Referenced by cx_program_set_name(), and cx_vasprintf().

cxint cx_strempty ( const cxchar *  string,
const cxchar *  pattern 
)

Test if a string represents an empty string.

Parameters
stringString to be tested.
patternString containing all allowed comment characters.
Returns
The function returns 1 if the string is found to be empty or if the first non–whitespace character is one out of the set of provided comment characters. Otherwise the function returns 0.

The function skips all leading whitespace characters in the string string. Whitespace characters are recognized by isspace(). If the first character which is not a whitespace character is either '\0' or one out of the pattern string pattern, the string is considered as empty and the function returns 1.

If pattern is set to NULL there is no checking for special characters that should be considered as whitespaces.

void cx_strfreev ( cxchar **  sarray)

Deallocate a NULL terminated string array.

Parameters
sarrayString array to deallocate
Returns
Nothing.

The function deallocates the array of strings sarray and any string it possibly contains.

References cx_free().

cxchar* cx_strjoinv ( const cxchar *  separator,
cxchar **  sarray 
)

Join strings from an array of strings.

Parameters
separatorOptional separator string.
sarrayArray of strings to join.
Returns
A newly allocated string containing the joined input strings separated by separator, or NULL in case of error.

The function builds a single string from the strings referenced by sarray. The array of input strings sarray has to be NULL terminated. Optionally, a separator string can be passed through separator which will then be inserted between two strings. If no separator should be inserted when joining, separator must be set to NULL.

References cx_malloc().

cxchar* cx_strlower ( cxchar *  s)

Convert all uppercase characters in a string into lowercase characters.

Parameters
sThe string to convert.
Returns
Returns a pointer to the converted string.

Walks through the given string and turns uppercase characters into lowercase characters using tolower().

See Also
cx_strupper()
cxint cx_strncasecmp ( const cxchar *  s1,
const cxchar *  s2,
cxsize  n 
)

Compare the first n characters of two strings ignoring the case of ASCII characters.

Parameters
s1First string.
s2Second string.
nNumber of characters to compare.
Returns
An integer less than, equal to, or greater than zero if the first n characters of s1 are found, respectively, to be less than, to match, or be greater than the first n characters of s2.

The function compares the first n characters of the two strings s1 and s2 as strncmp() does, but ignores the case of ASCII characters.

Referenced by cx_string_ncasecmp().

cxchar* cx_strndup ( const cxchar *  string,
cxsize  n 
)

Duplicate the first n charactes of a string.

Parameters
stringSource string
nMaximum number of characters to be duplicated.
Returns
Newly allocated copy of the first n characters of string.

Duplicates the first n characters of the source string string, returning the copied characters in newly allocated string of the size n + 1. The returned string is always null terminated. If the length of string is less than n the returned string is padded with nulls. The newly allocated string can be deallocated using cx_free().

References cx_calloc().

cxchar* cx_strrtrim ( cxchar *  string)

Remove trailing whitespace characters from a string.

Parameters
stringString to be processed.
Returns
The function returns a pointer to the modified string if no error occurred, otherwise NULL.

The function removes trailing whitespace characters, or from the string string. Whitespace characters are recognized by isspace().

cxchar* cx_strskip ( const cxchar *  string,
int(*)(int)  ctype 
)

Locate the first character in a string that does not belong to a given character class.

Parameters
stringString to be processed.
ctypeCharacter class test function.
Returns
Pointer to the first character that is not a member of the character class described by ctype.

Searches the string string for the first occurence of a character which does not belong to a certain character class. The character class is represented through a function that returns a non zero value if a character belongs to that class and 0 otherwise. Such functions are the character classification routines like isspace() for instance. It is expected that the input string is properly terminated. In case the whole string consists of characters of the specified class the function will return the location of the terminating '\0'.

cxchar** cx_strsplit ( const cxchar *  string,
const cxchar *  delimiter,
cxint  max_tokens 
)

Split a string into pieces at a given delimiter.

Parameters
stringThe string to split.
delimiterString specifying the locations where to split.
max_tokensThe maximum number of tokens the string is split into.
Returns
The function returns a newly allocated, NULL terminated array of strings, or NULL in case of an error.

The function breaks up the string string into, at most, max_tokens pieces at the places indicated by delimiter. If max_tokens is reached, the remainder of the string is appended to the last token. If max_tokens is less than 1 the string string is split completely.

The delimiter string delimiter never shows up in any of the resulting strings, unless max_tokens is reached.

As a special case, the result of splitting the empty string "" is an empty vector, not a vector containing a single string.

The created result vector can be deallocated using cx_strfreev().

References cx_malloc(), cx_slist_begin(), cx_slist_delete(), cx_slist_end(), cx_slist_get(), cx_slist_new(), cx_slist_next(), and cx_slist_push_front().

cxchar* cx_strstrip ( cxchar *  string)

Remove leading and trailing whitespace characters from a string.

Returns
The function returns a pointer to the modified string if no error occurred, otherwise NULL.
Parameters
stringString to be processed.

The function removes leading and trailing whitespace characters from the string string. Whitespace characters are recognized by isspace().

cxchar* cx_strtrim ( cxchar *  string)

Remove leading whitespace characters from a string.

Parameters
stringString to be processed.
Returns
The function returns a pointer to the modified string if no error occurred, otherwise NULL.

The function removes leading whitespace characters, or from the string string. Whitespace characters are recognized by isspace().

cxchar* cx_strupper ( cxchar *  s)

Convert all lowercase characters in a string into uppercase characters.

Parameters
sThe string to convert.
Returns
Returns a pointer to the converted string.

Walks through the given string and turns lowercase characters into uppercase characters using toupper().

See Also
strlower()
cxchar* cx_strvdupf ( const cxchar *  format,
va_list  args 
)

Create a string from a variable-length argument list under format control.

Parameters
formatThe format string.
argsVariable-length arguments to be inserted into format.
Returns
An newly allocated string containing the formatted result.

The function is similar to vsprintf() but calculates the size needed to store the formatted result string and allocates the memory. The newly allocated string can be deallocated using cx_free().

References cx_vasprintf().

Referenced by cx_logv(), cx_print(), and cx_printerr().

cpl-6.4.1/libcext/html/group__cxtree.html0000644000460300003120000017676112310333011015350 00000000000000 C Standard Library Extensions: Balanced Binary Trees
C Standard Library Extensions  1.1.2
Balanced Binary Trees

Typedefs

typedef cxbool(* cx_tree_compare_func )(cxcptr, cxcptr)
 The tree's key comparison operator function.
 

Functions

cx_tree_iterator cx_tree_begin (const cx_tree *tree)
 Get an iterator to the first pair in the tree.
 
cx_tree_iterator cx_tree_end (const cx_tree *tree)
 Get an iterator for the position after the last pair in the tree.
 
cx_tree_iterator cx_tree_next (const cx_tree *tree, cx_tree_const_iterator position)
 Get an iterator for the next pair in the tree.
 
cx_tree_iterator cx_tree_previous (const cx_tree *tree, cx_tree_const_iterator position)
 Get an iterator for the previous pair in the tree.
 
void cx_tree_clear (cx_tree *tree)
 Remove all pairs from a tree.
 
cxbool cx_tree_empty (const cx_tree *tree)
 Check whether a tree is empty.
 
cx_tree * cx_tree_new (cx_tree_compare_func compare, cx_free_func key_destroy, cx_free_func value_destroy)
 Create a new tree without any elements.
 
void cx_tree_delete (cx_tree *tree)
 Destroy a tree and all its elements.
 
cxsize cx_tree_size (const cx_tree *tree)
 Get the actual number of pairs in the tree.
 
cxsize cx_tree_max_size (const cx_tree *tree)
 Get the maximum number of pairs possible.
 
cx_tree_compare_func cx_tree_key_comp (const cx_tree *tree)
 Get the key comparison function.
 
void cx_tree_swap (cx_tree *tree1, cx_tree *tree2)
 Swap the contents of two trees.
 
cxptr cx_tree_assign (cx_tree *tree, cx_tree_iterator position, cxcptr data)
 Assign data to an iterator position.
 
cxptr cx_tree_get_key (const cx_tree *tree, cx_tree_const_iterator position)
 Get the key from a given iterator position.
 
cxptr cx_tree_get_value (const cx_tree *tree, cx_tree_const_iterator position)
 Get the data from a given iterator position.
 
cx_tree_iterator cx_tree_find (const cx_tree *tree, cxcptr key)
 Locate an element in the tree.
 
cx_tree_iterator cx_tree_lower_bound (const cx_tree *tree, cxcptr key)
 Find the beginning of a subsequence.
 
cx_tree_iterator cx_tree_upper_bound (const cx_tree *tree, cxcptr key)
 Find the end of a subsequence.
 
void cx_tree_equal_range (const cx_tree *tree, cxcptr key, cx_tree_iterator *begin, cx_tree_iterator *end)
 Find a subsequence matching a given key.
 
cxsize cx_tree_count (const cx_tree *tree, cxcptr key)
 Get the number of elements matching a key.
 
cx_tree_iterator cx_tree_insert_unique (cx_tree *tree, cxcptr key, cxcptr data)
 Attempt to insert data into a tree.
 
cx_tree_iterator cx_tree_insert_equal (cx_tree *tree, cxcptr key, cxcptr data)
 Insert data into a tree.
 
void cx_tree_erase_position (cx_tree *tree, cx_tree_iterator position)
 Erase an element from a tree.
 
void cx_tree_erase_range (cx_tree *tree, cx_tree_iterator begin, cx_tree_iterator end)
 Erase a range of elements from a tree.
 
cxsize cx_tree_erase (cx_tree *tree, cxcptr key)
 Erase all elements from a tree matching the provided key.
 
cxbool cx_tree_verify (const cx_tree *tree)
 Validate a tree.
 

Detailed Description

The module implements a balanced binary tree type, i.e. a container managing key/value pairs as elements. The container is optimized for lookup operations.

Synopsis:
#include <cxtree.h>

Typedef Documentation

typedef cxbool(* cx_tree_compare_func)(cxcptr, cxcptr)

The tree's key comparison operator function.

This type of function is used by a tree internally to compare the keys of its elements. A key comparison operator returns TRUE if the comparison of its first argument with the second argument succeeds, and FALSE otherwise, as, for instance, the logical operators < or > do.

Examples:

  • A less than operator for integer values
    #include <cxtree.h>
    cxbool less_int(cxcptr i1, cxcptr i2)
    {
    return *i1 < *i2;
    }
  • A less than operator for strings
    #include <string.h>
    #include <cxtree.h>
    cxbool less_string(cxcptr s1, cxcptr s2)
    {
    return strcmp(s1, s2) < 0;
    }

Function Documentation

cxptr cx_tree_assign ( cx_tree *  tree,
cx_tree_iterator  position,
cxcptr  data 
)

Assign data to an iterator position.

Parameters
treeA tree.
positionIterator positions where the data will be stored.
dataData to store.
Returns
Handle to the previously stored data object.

The function assigns a data object reference data to the iterator position position of the tree tree.

Referenced by cx_map_assign(), cx_map_put(), and cx_multimap_assign().

cx_tree_iterator cx_tree_begin ( const cx_tree *  tree)

Get an iterator to the first pair in the tree.

Parameters
treeThe tree to query.
Returns
Iterator for the first pair or cx_tree_end() if the tree is empty.

The function returns a handle for the first pair in the tree tree. The returned iterator cannot be used directly to access the value field of the key/value pair, but only through the appropriate methods.

Referenced by cx_map_begin(), and cx_multimap_begin().

void cx_tree_clear ( cx_tree *  tree)

Remove all pairs from a tree.

Parameters
treeTree to be cleared.
Returns
Nothing.

The tree tree is cleared, i.e. all pairs are removed from the tree. Keys and values are destroyed using the key and value destructors set up during tree creation. After calling this function the tree is empty.

Referenced by cx_map_clear(), and cx_multimap_clear().

cxsize cx_tree_count ( const cx_tree *  tree,
cxcptr  key 
)

Get the number of elements matching a key.

Parameters
treeA tree.
keyKey of the (key, value) pair(s) to locate.
Returns
The number of elements with the specified key.

Counts all elements of the tree tree matching the key key.

Referenced by cx_multimap_count().

void cx_tree_delete ( cx_tree *  tree)

Destroy a tree and all its elements.

Parameters
treeThe tree to destroy.
Returns
Nothing.

The tree tree is deallocated. All data values and keys are deallocated using the tree's key and value destructor. If no key and/or value destructor was set when the tree was created the keys and the stored data values are left untouched. In this case the key and value deallocation is the responsibility of the user.

See Also
cx_tree_new()

References cx_free().

Referenced by cx_map_delete(), and cx_multimap_delete().

cxbool cx_tree_empty ( const cx_tree *  tree)

Check whether a tree is empty.

Parameters
treeA tree.
Returns
The function returns TRUE if the tree is empty, and FALSE otherwise.

The function checks if the tree contains any pairs. Calling this function is equivalent to the statement:

return (cx_tree_size(tree) == 0);

Referenced by cx_map_empty(), and cx_multimap_empty().

cx_tree_iterator cx_tree_end ( const cx_tree *  tree)

Get an iterator for the position after the last pair in the tree.

Parameters
treeThe tree to query.
Returns
Iterator for the end of the tree.

The function returns an iterator for the position one past the last pair in the tree tree. The iteration is done in ascending order according to the keys. The returned iterator cannot be used directly to access the value field of the key/value pair, but only through the appropriate methods.

Referenced by cx_map_count(), cx_map_end(), cx_map_get(), cx_map_put(), and cx_multimap_end().

void cx_tree_equal_range ( const cx_tree *  tree,
cxcptr  key,
cx_tree_iterator *  begin,
cx_tree_iterator *  end 
)

Find a subsequence matching a given key.

Parameters
treeA tree.
keyThe key of the (key, value) pair(s) to be located.
beginFirst element with key key.
endLast element with key key.
Returns
Nothing.

The function returns the beginning and the end of a subsequence of tree elements with the key key through through the begin and end arguments. After calling this function begin possibly points to the first element of tree matching the key key and end possibly points to the last element of the sequence. If key is not present in the tree begin points to the next greater element or, if no such element exists, to cx_tree_end().

Referenced by cx_map_equal_range(), and cx_multimap_equal_range().

cxsize cx_tree_erase ( cx_tree *  tree,
cxcptr  key 
)

Erase all elements from a tree matching the provided key.

Parameters
treeA tree.
keyKey of the element to be erased.
Returns
The number of removed elements.

This function erases all elements with the specified key key, from tree. Key and value associated with the erased pairs are deallocated using the tree's key and value destructors, provided they have been set.

Referenced by cx_map_erase(), and cx_multimap_erase().

void cx_tree_erase_position ( cx_tree *  tree,
cx_tree_iterator  position 
)

Erase an element from a tree.

Parameters
treeA tree.
positionIterator position of the element to be erased.
Returns
Nothing.

This function erases an element, specified by the iterator position, from tree. Key and value associated with the erased pair are deallocated using the tree's key and value destructors, provided they have been set.

Referenced by cx_map_erase_position(), and cx_multimap_erase_position().

void cx_tree_erase_range ( cx_tree *  tree,
cx_tree_iterator  begin,
cx_tree_iterator  end 
)

Erase a range of elements from a tree.

Parameters
treeA tree.
beginIterator pointing to the start of the range to erase.
endIterator pointing to the end of the range to erase.
Returns
Nothing.

This function erases all elements in the range [begin, end) from the tree tree. Key and value associated with the erased pair(s) are deallocated using the tree's key and value destructors, provided they have been set.

Referenced by cx_map_erase_range(), and cx_multimap_erase_range().

cx_tree_iterator cx_tree_find ( const cx_tree *  tree,
cxcptr  key 
)

Locate an element in the tree.

Parameters
treeA tree.
keyKey of the (key, value) pair to locate.
Returns
Iterator pointing to the sought-after element, or cx_tree_end() if it was not found.

The function searches the tree tree for an element with a key matching key. If the search was successful an iterator to the sought-after pair is returned. If the search did not succeed, i.e. key is not present in the tree, a one past the end iterator is returned.

Referenced by cx_map_count(), cx_map_find(), and cx_multimap_find().

cxptr cx_tree_get_key ( const cx_tree *  tree,
cx_tree_const_iterator  position 
)

Get the key from a given iterator position.

Parameters
treeA tree.
positionIterator position the data is retrieved from.
Returns
Reference for the key.

The function returns a reference to the key associated with the iterator position position in the tree tree.

Note
One must not modify the key of position through the returned reference, since this might corrupt the tree!

Referenced by cx_map_get(), cx_map_get_key(), and cx_multimap_get_key().

cxptr cx_tree_get_value ( const cx_tree *  tree,
cx_tree_const_iterator  position 
)

Get the data from a given iterator position.

Parameters
treeA tree.
positionIterator position the data is retrieved from.
Returns
Handle for the data object.

The function returns a reference to the data stored at iterator position position in the tree tree.

Referenced by cx_map_get(), cx_map_get_value(), and cx_multimap_get_value().

cx_tree_iterator cx_tree_insert_equal ( cx_tree *  tree,
cxcptr  key,
cxcptr  data 
)

Insert data into a tree.

Parameters
treeA tree.
keyKey used to store the data.
dataData to insert.
Returns
An iterator that points to the inserted pair.

This function inserts a (key, value) pair into the tree tree. Contrary to cx_tree_insert_unique() the key key used for inserting data may already be present in the tree.

Referenced by cx_multimap_insert().

cx_tree_iterator cx_tree_insert_unique ( cx_tree *  tree,
cxcptr  key,
cxcptr  data 
)

Attempt to insert data into a tree.

Parameters
treeA tree.
keyKey used to store the data.
dataData to insert.
Returns
An iterator that points to the inserted pair, or NULL if the pair could not be inserted.

This function attempts to insert a (key, value) pair into the tree tree. The insertion fails if the key already present in the tree, i.e. if the key is not unique.

Referenced by cx_map_get(), cx_map_insert(), and cx_map_put().

cx_tree_compare_func cx_tree_key_comp ( const cx_tree *  tree)

Get the key comparison function.

Parameters
treeThe tree to query.
Returns
Handle for the tree's key comparison function.

The function retrieves the function used by the tree methods for comparing keys. The key comparison function is set during tree creation.

See Also
cx_tree_new()

Referenced by cx_map_get(), cx_map_key_comp(), and cx_multimap_key_comp().

cx_tree_iterator cx_tree_lower_bound ( const cx_tree *  tree,
cxcptr  key 
)

Find the beginning of a subsequence.

Parameters
treeA tree.
keyKey of the (key, value) pair(s) to locate.
Returns
Iterator pointing to the first position where an element with key key would get inserted, i.e. the first element with a key greater or equal than key.

The function returns the first element of a subsequence of elements in the tree that match the given key key. If key is not present in the tree tree an iterator pointing to the first element that has a greater key than key or cx_tree_end() if no such element exists.

Referenced by cx_map_get(), cx_map_lower_bound(), cx_map_put(), and cx_multimap_lower_bound().

cxsize cx_tree_max_size ( const cx_tree *  tree)

Get the maximum number of pairs possible.

Parameters
treeA tree.
Returns
The maximum number of pairs that can be stored in the tree.

Retrieves the tree's capacity, i.e. the maximum possible number of pairs a tree can manage.

Referenced by cx_map_max_size(), and cx_multimap_max_size().

cx_tree* cx_tree_new ( cx_tree_compare_func  compare,
cx_free_func  key_destroy,
cx_free_func  value_destroy 
)

Create a new tree without any elements.

Parameters
compareFunction used to compare keys.
key_destroyDestructor for the keys.
value_destroyDestructor for the value field.
Returns
Handle for the newly allocated tree.

Memory for a new tree is allocated and the tree is initialized to be a valid empty tree.

The tree's key comparison function is set to compare. It must return TRUE or FALSE if the comparison of the first argument passed to it with the second argument is found to be true or false respectively.

The destructors for a tree node's key and value field are set to key_destroy and value_destroy. Whenever a tree node is destroyed these functions are used to deallocate the memory used by the key and the value. Each of the destructors might be NULL, i.e. keys and values are not deallocated during destroy operations.

See Also
cx_tree_compare_func()

References cx_malloc().

Referenced by cx_map_new(), and cx_multimap_new().

cx_tree_iterator cx_tree_next ( const cx_tree *  tree,
cx_tree_const_iterator  position 
)

Get an iterator for the next pair in the tree.

Parameters
treeA tree.
positionCurrent iterator position.
Returns
Iterator for the pair immediately following position.

The function returns an iterator for the next pair in the tree tree with respect to the current iterator position position. Iteration is done in ascending order according to the keys. If the tree is empty or position points to the end of the tree the function returns cx_tree_end().

Referenced by cx_map_next(), and cx_multimap_next().

cx_tree_iterator cx_tree_previous ( const cx_tree *  tree,
cx_tree_const_iterator  position 
)

Get an iterator for the previous pair in the tree.

Parameters
treeA tree.
positionCurrent iterator position.
Returns
Iterator for the pair immediately preceding position.

The function returns an iterator for the previous pair in the tree tree with respect to the current iterator position position. Iteration is done in ascending order according to the keys. If the tree is empty or position points to the beginning of the tree the function returns cx_tree_end().

Referenced by cx_map_previous(), and cx_multimap_previous().

cxsize cx_tree_size ( const cx_tree *  tree)

Get the actual number of pairs in the tree.

Parameters
treeA tree.
Returns
The current number of pairs, or 0 if the tree is empty.

Retrieves the current number of pairs stored in the tree.

Referenced by cx_map_size(), and cx_multimap_size().

void cx_tree_swap ( cx_tree *  tree1,
cx_tree *  tree2 
)

Swap the contents of two trees.

Parameters
tree1First tree.
tree2Second tree.
Returns
Nothing.

All pairs stored in the first tree tree1 are moved to the second tree tree2, while the pairs from tree2 are moved to tree1. Also the key comparison function, the key and the value destructor are exchanged.

Referenced by cx_map_swap(), and cx_multimap_swap().

cx_tree_iterator cx_tree_upper_bound ( const cx_tree *  tree,
cxcptr  key 
)

Find the end of a subsequence.

Parameters
treeA tree.
keyKey of the (key, value) pair(s) to locate.
Returns
Iterator pointing to the last position where an element with key key would get inserted, i.e. the first element with a key greater than key.

The function returns the last element of a subsequence of elements in the tree that match the given key key. If key is not present in the tree tree an iterator pointing to the first element that has a greater key than key or cx_tree_end() if no such element exists.

Referenced by cx_map_upper_bound(), and cx_multimap_upper_bound().

cxbool cx_tree_verify ( const cx_tree *  tree)

Validate a tree.

Parameters
treeThe tree to verify.
Returns
Returns TRUE if the tree is valid, or FALSE otherwise.

The function is provided for debugging purposes. It verifies that the internal tree structure of tree is valid.

cpl-6.4.1/libcext/html/ftv2splitbar.png0000644000460300003120000000047212310333010014725 00000000000000‰PNG  IHDRM¸¿IDATxíÝ¡JCa‡ñç(˜ ëƒ%±Ø4 b±È˜Í¶3˜v^Á±˜…ãó–ŽELƒõ…¥•³ ,ÿb;íç{Ã/¼ðÞÀaYÕ¯åóøq:¼º¹›\òIIIIIIIIIIIIIIIIII-Òçl¹›«õ抢è_t/Ï»ã£ÑíYQVõðêäíã÷´×ùY¬Úÿµ§¦ivók¾_íåýÛ£I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$ýC[Vì=ü[„fÆIEND®B`‚cpl-6.4.1/libcext/html/ftv2mlastnode.png0000644000460300003120000000036612310333010015075 00000000000000‰PNG  IHDRɪ|½IDATxíÝ!NAÅñ¤‡à\ ÷à Um@`Ô5iÒ`ëh ‚ÅW7] b§ÝˆŠ&oföÍd¾YÔ4 üšcø ‡€´‹Åòù3v=¼]†§µ\B… I¿‹=B·™B¡®;¸k´µ W°ÍN@vyÍÑÖ4ãß÷]ÈâYìã§|M}]ÔÚx6a }ôdׇØYüú¨>¤||5?Ó>|žB"¡î'¡IEND®B`‚cpl-6.4.1/libcext/html/nav_h.png0000644000460300003120000000014212310333010013370 00000000000000‰PNG  IHDR ,é@)IDATxíÝA @BQ­³šÛ›Ð¢Žáà) )ëý éaÅèÜ¿Æo‡RlÐßIEND®B`‚cpl-6.4.1/libcext/html/cxmemory_8h_source.html0000644000460300003120000002561612310333010016314 00000000000000 C Standard Library Extensions: cxmemory.h Source File
C Standard Library Extensions  1.1.2
cxmemory.h
1 /* $Id: cxmemory.h,v 1.5 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.5 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_MEMORY_H
29 #define CX_MEMORY_H
30 
31 #include <cxtypes.h>
32 
33 
34 CX_BEGIN_DECLS
35 
36 struct _cx_memory_vtable_ {
37  cxptr (*malloc) (cxsize);
38  cxptr (*calloc) (cxsize, cxsize);
39  cxptr (*realloc) (cxptr, cxsize);
40  void (*free) (cxptr);
41 };
42 
43 typedef struct _cx_memory_vtable_ cx_memory_vtable;
44 
45 
46 
47 /*
48  * Memory allocation functions
49  */
50 
51 void cx_memory_vtable_set(const cx_memory_vtable *);
52 cxbool cx_memory_is_system_malloc(void);
53 
54 cxptr cx_malloc(cxsize);
55 cxptr cx_malloc_clear(cxsize);
56 cxptr cx_calloc(cxsize, cxsize);
57 cxptr cx_realloc(cxptr, cxsize);
58 void cx_free(cxptr);
59 
60 CX_END_DECLS
61 
62 #endif /* CX_MEMORY_H */
cpl-6.4.1/libcext/html/group__cxutils.html0000644000460300003120000007253412310333011015542 00000000000000 C Standard Library Extensions: Miscellaneous Utilities
C Standard Library Extensions  1.1.2
Miscellaneous Utilities

Functions

const cxchar * cx_program_get_name (void)
 Get the name of the application.
 
void cx_program_set_name (const cxchar *name)
 Set the name of the application.
 
cxint cx_bits_find (cxuint32 mask, cxint start)
 Get the position of the first bit set, searching from left to right.
 
cxint cx_bits_rfind (cxuint32 mask, cxint start)
 Get the position of the first bit set, searching from right to left.
 
cxint cx_snprintf (cxchar *string, cxsize n, const cxchar *format,...)
 Safe version of sprintf().
 
cxint cx_vsnprintf (cxchar *string, cxsize n, const cxchar *format, va_list args)
 Safe version of vsprintf().
 
cxint cx_asprintf (cxchar **string, const cxchar *format,...)
 Write formatted output to a newly allocated string.
 
cxint cx_vasprintf (cxchar **string, const cxchar *format, va_list args)
 Write formatted output to a newly allocated string with a variable-length argument list.
 
cxlong cx_line_max (void)
 Get the maximum length of a line supported by the system.
 
cxchar * cx_line_alloc (void)
 Allocate a line buffer with the maximum size supported by the system.
 

Detailed Description

The module provides a portable implementation of a selection of miscellaneous utility functions.

Synopsis:
#include <cxutils.h>

Function Documentation

cxint cx_asprintf ( cxchar **  string,
const cxchar *  format,
  ... 
)

Write formatted output to a newly allocated string.

Parameters
stringAddress where the allocated string is stored.
formatThe format string.
...Arguments to be inserted into the format string.
Returns
The number of characters (excluding the trailing null) written to allocated string, i.e. its length. If sufficient space cannot be allocated, -1 is returned.

The function is similar to cx_snprintf() or sprintf(). The difference to cx_snprintf() is that the output created from the format string format and the formatted arguments is placed into a string which is allocated using cx_malloc(). All standard C conversion directives are supported. The allocated string is always null terminated.

The pointer to the allocated string buffer sufficiently large to hold the string is returned to the caller in the string argument. This pointer should be passed to cx_free to release the allocated storage when it is no longer needed. If sufficient memory cannot be allocated is set to NULL.

See Also
cx_snprintf(), cx_strdupf(), cx_malloc(), cx_free()

References cx_vasprintf().

cxint cx_bits_find ( cxuint32  mask,
cxint  start 
)

Get the position of the first bit set, searching from left to right.

Parameters
maskA 32 bit integer containing bit flags.
startBit position where the search starts.
Returns
The bit position of the first bit set which is lower than start. If no bit is set -1 is returned.

The function searches for the first bit set in mask, starting at the bit position start - 1. The bit mask mask is searched from left to right. If start is less than 0 or bigger than 32 the search starts at the 31st bit.

See Also
cx_bits_rfind()

Referenced by cx_logv().

cxint cx_bits_rfind ( cxuint32  mask,
cxint  start 
)

Get the position of the first bit set, searching from right to left.

Parameters
maskA 32 bit integer containing bit flags.
startBit position where the search starts.
Returns
The bit position of the first bit set which is higher than start. If no bit is set -1 is returned.

The function searches for the first bit set in mask, starting at the bit position start + 1. The bit mask mask is searched from right to left. If start is less than 0 the search starts at the 1st bit.

See Also
cx_bits_find()
cxchar* cx_line_alloc ( void  )

Allocate a line buffer with the maximum size supported by the system.

Returns
A pointer allocated memory.

The function creates a line buffer with the maximum length supported by the system. The size of the buffer is determined calling cx_line_max() which gives the maximum size including the trailing zero.

References cx_calloc(), and cx_line_max().

cxlong cx_line_max ( void  )

Get the maximum length of a line supported by the system.

Returns
The length of a line including the trailing zero.

The function uses the sysconf() function to determine the maximum length of a line buffer that is supported by the system and available for utility programs. If the sysconf() facility is not available the function returns a guessed value of 4096 characters as the maximum length of a line taking into account the trailing zero.

Referenced by cx_line_alloc().

const cxchar* cx_program_get_name ( void  )

Get the name of the application.

Returns
The program's name string.

The program's name is retrieved and returned to the caller. The returned pointer is a library resource and must not be freed or modified.

Referenced by cx_log_default_handler().

void cx_program_set_name ( const cxchar *  name)

Set the name of the application.

Parameters
nameThe program name.
Returns
Nothing.

The program's name is set to the string name.

Attention
For thread-safety reasons this function may be called only once!

References cx_free(), and cx_strdup().

cxint cx_snprintf ( cxchar *  string,
cxsize  n,
const cxchar *  format,
  ... 
)

Safe version of sprintf().

Parameters
stringDestination string.
nMaximum number of characters to be written.
formatThe format string.
...Arguments to be inserted into the format string.
Returns
The number of characters (excluding the trailing null) which would have been written to the destination string if enough space had been available, i.e. if the destination string is large enough the function returns the number of characters written to the string.

The function is a safe form of sprintf(). It writes output to the string string, under the control of the format string format. The format string specifies how the arguments are formatted for output. All standard C conversion directives are supported.

The difference compared to sprintf() is that the produced number of characters does not exceed n (including the trailing null).

Note
The return value of cx_snprintf() conforms to the snprintf() function as standardized in ISO C99. This might be different from traditional implementations.
See Also
cx_asprintf(), cx_strdupf()

References cx_vsnprintf().

cxint cx_vasprintf ( cxchar **  string,
const cxchar *  format,
va_list  args 
)

Write formatted output to a newly allocated string with a variable-length argument list.

Parameters
stringAddress where the allocated string is stored.
formatThe format string.
argsList of arguments to be inserted into the format string.
Returns
The number of characters (excluding the trailing null) written to allocated string, i.e. its length. If sufficient space cannot be allocated, -1 is returned.

The function is similar to cx_vsnprintf() or vsprintf(). The difference to cx_vsnprintf() is that the output, created from the format string format and the arguments given by the variable-length argument list args, is placed into a string which is allocated using cx_malloc(). All standard C conversion directives are supported. The allocated string is always null terminated.

The pointer to the allocated string buffer sufficiently large to hold the string is returned to the caller in the string argument. This pointer should be passed to cx_free to release the allocated storage when it is no longer needed. If sufficient memory cannot be allocated is set to NULL.

See Also
cx_vsnprintf(), cx_strvdupf(), cx_malloc(), cx_free()

References cx_malloc(), cx_memory_is_system_malloc(), cx_strdup(), and cx_vsnprintf().

Referenced by cx_asprintf(), and cx_strvdupf().

cxint cx_vsnprintf ( cxchar *  string,
cxsize  n,
const cxchar *  format,
va_list  args 
)

Safe version of vsprintf().

Parameters
stringDestination string.
nMaximum number of characters to be written.
formatThe format string.
argsList of arguments to be inserted into the format string.
Returns
The number of characters (excluding the trailing null) which would have been written to the destination string if enough space had been available, i.e. if the destination string is large enough the function returns the number of characters written to the string.

The function is a safe form of vsprintf(). It writes output to the string string, under the control of the format string format. The format string specifies how the arguments, provided through the variable-length argument list args, are formatted for output. All standard C conversion directives are supported.

The difference compared to vsprintf() is that the produced number of characters does not exceed n (including the trailing null).

Note
The return value of cx_vsnprintf() conforms to the vsnprintf() function as standardized in ISO C99. This might be different from traditional implementations.
See Also
cx_vasprintf(), cx_strvdupf()

Referenced by cx_logv(), cx_snprintf(), and cx_vasprintf().

cpl-6.4.1/libcext/html/group__cxfileutils.html0000644000460300003120000001612212310333011016371 00000000000000 C Standard Library Extensions: File Utilities
C Standard Library Extensions  1.1.2
File Utilities

Functions

cxlong cx_path_max (const cxchar *path)
 Get the maximum length of a path relative to the given directory.
 
cxchar * cx_path_alloc (const char *path)
 Allocate a buffer suitable for storing a relative pathname staring at a given directory.
 

Detailed Description

The module provides a collection of useful file and file path related utility functions.

Synopsis:
#include <cxfileutils.h>

Function Documentation

cxchar* cx_path_alloc ( const char *  path)

Allocate a buffer suitable for storing a relative pathname staring at a given directory.

Parameters
pathDirectory name the relative path should start from.
Returns
Allocated buffer of appropriate size, or NULL in case of an error.

The function determines the maximum possible length of a relative path name when path is the current working directory. A buffer with the appropriate length for the relative pathname including the trailing zero. The argument path must be the name of an existing, or the function fails. The allocated buffer can be destroyed by calling cx_free().

IF the string "/" is used for path the returned buffer will have the maximum length possible for an absolute path supported by the system (but see the note for cx_path_max() for pitfalls).

References cx_calloc(), and cx_path_max().

cxlong cx_path_max ( const cxchar *  path)

Get the maximum length of a path relative to the given directory.

Parameters
pathDirectory name.
Returns
Maximum path length.

The function returns the maximum length a relative path when path is the current working directory. To get the maximum possible length of an absolute path pass "/" for path, but see the note below. The size is determined through the pathconf() function, or if this is not available the maximum length is simply set to the ad hoc length of 4095 characters.

Note
The maximum length of a pathname depends on the underlying filesystem. This means that the method to determine the maximum possible length of an absolute pathname might be incorrect if the root directory and the actual location of the file under consideration are located on different filesystems.

Referenced by cx_path_alloc().

cpl-6.4.1/libcext/html/ftv2link.png0000644000460300003120000000135212310333010014040 00000000000000‰PNG  IHDRÚ}\ˆ±IDATxíMOS[…Ÿžsúa?-XZ(PD4‚ AWbu`b 77wäHFÆCËÔÂÿà/`vo„ˆAPòq‹P @ ­ûÝè980 îà¤+»§Ýy×^ïZï9SW¹\83g‰3'°Nâçl¹¸_b¯p ïåûÆVÜÖ¡€Ÿ×"¬Ö†X€d]Ðà3“ÉÃÄÌ™xŸ ßMàœ[<çSPkvc—hÈ'…™˜^Åm™hØ7 `Û™¦ èÀåráq›‘œ¾!daeKŸþÆÕ˜:Ì*³_דâèi?I–eP*B7Ÿ¿åô!¹Ýgr6Ër6oKbëþãðôrI”ËTˆüªŒ¨xóö=›ù¢&‰(e+ßóÄkýÇ`ëÁÜb.“¸ÐW×w0¥°jÑzN™¬|©WEãµ¢a¯6[öX†AkÓù*/œ¨‰€ÉY­ ÿV’§–u²jÂ>1W *½·°PGŽzÿ¨/Eg{ ŸÇâaoŠÁVú:è¿™¤1$ôR§W,–ªà¨@ŠË56¾ÀÔÜ-¾,mê¸Î/æè¹– òr5¥T*S(Vf8ö9u’ Õ£w›ùóa=Í<{Ò¡UŒ÷r¯+ÉådDÏF$è°…£é¿`zþ»ÎúöN‘µÜ®0Q3£~_^Ëóâ¯N=ˆvpTà±LžT}ˆîkq†Òm<¼ÎÓ?Zh¿X£ï_þÝ¥[)ƒ `gêÃa_Ô*äÔ2`'=õ´Fÿ2EâÁPú ÷»›l=8‹Wv°%THqÉ¿<"¤ïG¾ÆxH{#ÆÖ«aÔJÕÞ‡—m‹„ çñKsÿàñVŠØ¡°·MâÒ^ TÁ– Ý›r¥ß½ømüÿ_™?ªWİ÷#uIEND®B`‚cpl-6.4.1/libcext/html/modules.html0000644000460300003120000001042312310333011014131 00000000000000 C Standard Library Extensions: Modules
C Standard Library Extensions  1.1.2
Modules
cpl-6.4.1/libcext/html/ftv2plastnode.png0000644000460300003120000000034512310333010015075 00000000000000‰PNG  IHDRɪ|¬IDATxí=QF‘Ø¥D«ÔkÄ:‰F©PK؃=V@§Õ³ Õ8SHxñÌ0bnrróŠ{ò½¿¾’$ ÀÏTŠP  ö¼X¬OÛd6êìòð"°²S´±O¥B€(¡àQé)š+YĈ ÒªËRÉÐ>VtÉsˆm9(ê„䜥k‚-@ȧ-Ü$ó b Ò[he ¿Kp-ôl|CùÿApRG'rÍ­aIEND®B`‚cpl-6.4.1/libcext/html/group__cxlist.html0000644000460300003120000017050312310333011015350 00000000000000 C Standard Library Extensions: Doubly Linked Lists
C Standard Library Extensions  1.1.2
Doubly Linked Lists

Functions

cx_list_iterator cx_list_begin (const cx_list *list)
 Get an iterator for the first list element.
 
cx_list_iterator cx_list_end (const cx_list *list)
 Get an iterator for the position after the last list element.
 
cx_list_iterator cx_list_next (const cx_list *list, cx_list_const_iterator position)
 Get an iterator for the next list element.
 
cx_list_iterator cx_list_previous (const cx_list *list, cx_list_const_iterator position)
 Get an iterator for the previous list element.
 
void cx_list_clear (cx_list *list)
 Remove all elements from a list.
 
cxbool cx_list_empty (const cx_list *list)
 Check whether a list is empty.
 
cx_list * cx_list_new (void)
 Create a new list without any elements.
 
void cx_list_delete (cx_list *list)
 Destroy a list.
 
void cx_list_destroy (cx_list *list, cx_free_func deallocate)
 Destroy a list and all its elements.
 
cxsize cx_list_size (const cx_list *list)
 Get the actual number of list elements.
 
cxsize cx_list_max_size (const cx_list *list)
 Get the maximum number of list elements possible.
 
void cx_list_swap (cx_list *list1, cx_list *list2)
 Swap the data of two lists.
 
cxptr cx_list_assign (cx_list *list, cx_list_iterator position, cxcptr data)
 Assign data to a list element.
 
cxptr cx_list_front (const cx_list *list)
 Get the first element of a list.
 
cxptr cx_list_back (const cx_list *list)
 Get the last element of a list.
 
cxptr cx_list_get (const cx_list *list, cx_list_const_iterator position)
 Get the data at a given iterator position.
 
cx_list_iterator cx_list_insert (cx_list *list, cx_list_iterator position, cxcptr data)
 Insert data into a list at a given iterator position.
 
void cx_list_push_front (cx_list *list, cxcptr data)
 Insert data at the beginning of a list.
 
void cx_list_push_back (cx_list *list, cxcptr data)
 Append data at the end of a list.
 
cx_list_iterator cx_list_erase (cx_list *list, cx_list_iterator position, cx_free_func deallocate)
 Erase a list element.
 
cxptr cx_list_extract (cx_list *list, cx_list_iterator position)
 Extract a list element.
 
cxptr cx_list_pop_front (cx_list *list)
 Remove the first list element.
 
cxptr cx_list_pop_back (cx_list *list)
 Remove the last element of a list.
 
void cx_list_remove (cx_list *list, cxcptr data)
 Remove all elements with a given value from a list.
 
void cx_list_unique (cx_list *list, cx_compare_func compare)
 Remove duplicates of consecutive elements.
 
void cx_list_splice (cx_list *tlist, cx_list_iterator position, cx_list *slist, cx_list_iterator first, cx_list_iterator last)
 Move a range of list elements in front of a given position.
 
void cx_list_merge (cx_list *list1, cx_list *list2, cx_compare_func compare)
 Merge two sorted lists.
 
void cx_list_sort (cx_list *list, cx_compare_func compare)
 Sort all elements of a list using the given comparison function.
 
void cx_list_reverse (cx_list *list)
 Reverse the order of all list elements.
 

Detailed Description

The module implements a doubly linked list object which can be traversed in both directions, forward and backward, and methods to create, destroy and manipulate it.

Synopsis:
#include <cxlist.h>

Function Documentation

cxptr cx_list_assign ( cx_list *  list,
cx_list_iterator  position,
cxcptr  data 
)

Assign data to a list element.

Parameters
listA list.
positionList position where the data will be stored
dataData to store.
Returns
Handle to the previously stored data object.

The function assigns the data object reference data to the iterator position position of the list list.

cxptr cx_list_back ( const cx_list *  list)

Get the last element of a list.

Parameters
listThe list to query.
Returns
Handle to the data object stored in the last list element.

The function returns a reference to the last data item in the list list.

Calling this function with an empty list is an invalid operation, and the result is undefined.

References cx_list_empty().

cx_list_iterator cx_list_begin ( const cx_list *  list)

Get an iterator for the first list element.

Parameters
listA list.
Returns
Iterator for the first element in the list or cx_list_end() if the list is empty.

The function returns a handle to the first element of list. The handle cannot be used directly to access the element data, but only through the appropriate functions.

Referenced by cx_list_pop_front(), and cx_list_remove().

void cx_list_clear ( cx_list *  list)

Remove all elements from a list.

Parameters
listList to be cleared.
Returns
Nothing.

The list list is cleared, i.e. all elements are removed from the list. The removed data objects are left untouched, in particular they are not deallocated. It is the responsibility of the caller to ensure that there are still other references to the removed data objects. After calling cx_list_clear() the list list is empty.

void cx_list_delete ( cx_list *  list)

Destroy a list.

Parameters
listThe list to delete.
Returns
Nothing.

The function deallocates the list object, but not the data objects currently stored in the list.

References cx_free(), and cx_list_empty().

void cx_list_destroy ( cx_list *  list,
cx_free_func  deallocate 
)

Destroy a list and all its elements.

Parameters
listList container to destroy.
deallocateData deallocator.
Returns
Nothing.

The function deallocates all data objects referenced by the list using the data deallocation function deallocate and finally deallocates the list itself.

References cx_free(), and cx_list_empty().

cxbool cx_list_empty ( const cx_list *  list)

Check whether a list is empty.

Parameters
listA list.
Returns
The function returns TRUE if the list is empty, and FALSE otherwise.

The function tests if the list list contains data. A call to this function is equivalent to the statement:

return (cx_list_size(list) == 0);

Referenced by cx_list_back(), cx_list_delete(), cx_list_destroy(), cx_list_front(), cx_list_pop_back(), cx_list_pop_front(), and cx_list_unique().

cx_list_iterator cx_list_end ( const cx_list *  list)

Get an iterator for the position after the last list element.

Parameters
listA list.
Returns
Iterator for the end of the list.

The function returns an iterator for the position one past the last element of the list list. The handle cannot be used to directly access the element data, but only through the appropriate functions.

Referenced by cx_list_pop_back().

cx_list_iterator cx_list_erase ( cx_list *  list,
cx_list_iterator  position,
cx_free_func  deallocate 
)

Erase a list element.

Parameters
listThe list to update.
positionList iterator position.
deallocateData deallocator.
Returns
The iterator for the list position after position.

The function removes the data object stored at position position from the list list. The data object itself is deallocated by calling the data deallocator deallocate.

cxptr cx_list_extract ( cx_list *  list,
cx_list_iterator  position 
)

Extract a list element.

Parameters
listA list.
positionList iterator position.
Returns
Handle to the previously stored data object.

The function removes a data object from the list list located at the iterator position position without destroying the data object.

See Also
cx_list_erase(), cx_list_remove()
cxptr cx_list_front ( const cx_list *  list)

Get the first element of a list.

Parameters
listThe list to query.
Returns
Handle to the data object stored in the first list element.

The function returns a reference to the first data item in the list list.

Calling this function with an empty list is an invalid operation, and the result is undefined.

References cx_list_empty().

cxptr cx_list_get ( const cx_list *  list,
cx_list_const_iterator  position 
)

Get the data at a given iterator position.

Parameters
listA list.
positionList position the data is retrieved from.
Returns
Handle to the data object.

The function returns a reference to the data item stored in the list list at the iterator position position.

cx_list_iterator cx_list_insert ( cx_list *  list,
cx_list_iterator  position,
cxcptr  data 
)

Insert data into a list at a given iterator position.

Parameters
listThe list to update.
positionList iterator position.
dataData item to insert.
Returns
List iterator position of the inserted data item.

The function inserts the data object reference data into the list list at the list position given by the list iterator position.

References cx_list_max_size().

cxsize cx_list_max_size ( const cx_list *  list)

Get the maximum number of list elements possible.

Parameters
listA list.
Returns
The maximum number of elements that can be stored in the list.

Retrieves the lists capacity, i.e. the maximum possible number of data items a list can hold.

Referenced by cx_list_insert().

void cx_list_merge ( cx_list *  list1,
cx_list *  list2,
cx_compare_func  compare 
)

Merge two sorted lists.

Parameters
list1First list to merge.
list2Second list to merge.
compareFunction comparing the list elements.
Returns
Nothing.

The function combines the two lists list1 and list2 by moving all elements from list2 into list1, so that all elements are still sorted. The function requires that both input lists are already sorted. The sorting order in which the elements of list2 are inserted into list1 is determined by the comparison function compare. The comparison function compare must return an integer less than, equal or greater than zero if the first argument passed to it is found, respectively, to be less than, match, or be greater than the second argument.

The list list2 is consumed by this process, i.e. after the successful merging of the two lists, list list2 will be empty.

cx_list* cx_list_new ( void  )

Create a new list without any elements.

Returns
Handle to the newly allocated list.

The function allocates memory for the list object and initializes it to a empty list.

References cx_malloc().

cx_list_iterator cx_list_next ( const cx_list *  list,
cx_list_const_iterator  position 
)

Get an iterator for the next list element.

Parameters
listA list.
positionCurrent iterator position.
Returns
Iterator for the next list element.

The function returns an iterator for the next element in the list list with respect to the current iterator position position. If the list list is empty or position points to the list end the function returns cx_list_end().

cxptr cx_list_pop_back ( cx_list *  list)

Remove the last element of a list.

Parameters
listThe list to update.
Returns
Handle to the data object previously stored as the last list element.

The function removes the last element from the list list returning a handle to the previously stored data.

It is equivalent to the statement

Calling this function with an empty list is an invalid operation, and the result is undefined.

References cx_list_empty(), and cx_list_end().

cxptr cx_list_pop_front ( cx_list *  list)

Remove the first list element.

Parameters
listThe list to update.
Returns
Handle to the data object previously stored as the first list element.

The function removes the first element from the list list returning a handle to the previously stored data.

It is equivalent to the statement

Calling this function with an empty list is an invalid operation, and the result is undefined.

References cx_list_begin(), and cx_list_empty().

cx_list_iterator cx_list_previous ( const cx_list *  list,
cx_list_const_iterator  position 
)

Get an iterator for the previous list element.

Parameters
listA list.
positionCurrent iterator position.
Returns
Iterator for the previous list element.

The function returns an iterator for the previous element in the list list with respect to the current iterator position position. If the list list is empty or position points to the beginning of the list the function returns cx_list_end().

void cx_list_push_back ( cx_list *  list,
cxcptr  data 
)

Append data at the end of a list.

Parameters
listThe list to update.
dataData to append.
Returns
Nothing.

The data data is inserted into the list list after the last element, so that it becomes the new list tail.

It is equivalent to the statement

cx_list_insert(list, cx_list_end(list), data);
void cx_list_push_front ( cx_list *  list,
cxcptr  data 
)

Insert data at the beginning of a list.

Parameters
listThe list to update.
dataData to add to the list.
Returns
Nothing.

The data data is inserted into the list list before the first element of the list, so that it becomes the new list head.

It is equivalent to the statement

cx_list_insert(list, cx_list_begin(list), data);
void cx_list_remove ( cx_list *  list,
cxcptr  data 
)

Remove all elements with a given value from a list.

Parameters
listA list object.
dataData to remove.
Returns
Nothing.

The value data is searched in the list list. If the data is found it is removed from the list. The data object itself is not deallocated.

References cx_list_begin().

void cx_list_reverse ( cx_list *  list)

Reverse the order of all list elements.

Parameters
listThe list to reverse.
Returns
Nothing.

The order of the elements of the list list is reversed.

cxsize cx_list_size ( const cx_list *  list)

Get the actual number of list elements.

Parameters
listA list.
Returns
The current number of elements the list contains, or 0 if the list is empty.

Retrieves the number of elements currently stored in the list list.

void cx_list_sort ( cx_list *  list,
cx_compare_func  compare 
)

Sort all elements of a list using the given comparison function.

Parameters
listThe list to sort.
compareFunction comparing the list elements.
Returns
Nothing.

The input list list is sorted using the comparison function compare to determine the order of two list elements. The comparison function compare must return an integer less than, equal or greater than zero if the first argument passed to it is found, respectively, to be less than, match, or be greater than the second argument.

void cx_list_splice ( cx_list *  tlist,
cx_list_iterator  position,
cx_list *  slist,
cx_list_iterator  first,
cx_list_iterator  last 
)

Move a range of list elements in front of a given position.

Parameters
tlistTarget list.
positionTarget iterator position.
slistSource list.
firstPosition of the first element to move.
lastPosition of the last element to move.
Returns
Nothing.

The range of list elements from the iterator position first to last, but not including last, is moved from the source list slist in front of the position position of the target list tlist. Target and source list may be identical, provided that the target position position does not fall within the range of list elements to move.

void cx_list_swap ( cx_list *  list1,
cx_list *  list2 
)

Swap the data of two lists.

Parameters
list1First list.
list2Second list.
Returns
Nothing.

The contents of the first list list1 will be moved to the second list list2, while the contents of list2 is moved to list1.

void cx_list_unique ( cx_list *  list,
cx_compare_func  compare 
)

Remove duplicates of consecutive elements.

Parameters
listA list.
compareFunction comparing the list elements.
Returns
Nothing.

The function removes duplicates of consecutive list elements, i.e. list elements with the same value, from the list list. The equality of the list elements is checked using the comparison function compare. The comparison function compare must return an integer less than, equal or greater than zero if the first argument passed to it is found, respectively, to be less than, match, or be greater than the second argument.

References cx_list_empty().

cpl-6.4.1/libcext/html/ftv2node.png0000644000460300003120000000012612310333010014026 00000000000000‰PNG  IHDRɪ|IDATxíݱðøScOx@ –¨y}IEND®B`‚cpl-6.4.1/libcext/html/dir_c2959b2ad5731f3b356ab222d87e802c.html0000644000460300003120000002363512310333011017623 00000000000000 C Standard Library Extensions: cext Directory Reference
C Standard Library Extensions  1.1.2
cext Directory Reference

Files

file  cxconfig.h [code]
 
file  cxdeque.c
 
file  cxdeque.h [code]
 
file  cxfileutils.c
 
file  cxfileutils.h [code]
 
file  cxlist.c
 
file  cxlist.h [code]
 
file  cxmacros.h [code]
 
file  cxmap.c
 
file  cxmap.h [code]
 
file  cxmemory.c
 
file  cxmemory.h [code]
 
file  cxmessages.c
 
file  cxmessages.h [code]
 
file  cxmultimap.c
 
file  cxmultimap.h [code]
 
file  cxslist.c
 
file  cxslist.h [code]
 
file  cxstring.c
 
file  cxstring.h [code]
 
file  cxstrutils.c
 
file  cxstrutils.h [code]
 
file  cxthread.h [code]
 
file  cxtree.c
 
file  cxtree.h [code]
 
file  cxtypes.h [code]
 
file  cxutils.c
 
file  cxutils.h [code]
 
file  snprintf.c
 
file  snprintf.h [code]
 
cpl-6.4.1/libcext/html/ftv2mo.png0000644000460300003120000000062312310333010013516 00000000000000‰PNG  IHDRÚ}\ˆZIDATxí1Kû@ÆiƒØB…Ò¡(h¬"EÄI'ÁoàªèÚ©ßÀáâä 8ùçR-‚â B«TPˆï]z¥B’3 _Þã’»ç}ŸË]VÇ÷}€ÌÈdIæ®i쟯JØ–b¸šÍÃõ+º™|KÂ…°,[Pï\ʘMÆ¢#€ä…F`JݤìÛk³úA±àþè?ØY4ck6"¹Z)ê¸0SHM¨@ï㋺WÖmo¼4èHJ¨Àÿö+…QobŒút ¤ú’*Ð~êè8_+3Y-ñðÜå½÷ ˜PwA¶+^ý}ºì£+xìhÏ•MAE]€TD~EÞߴ^R)`ÖAùŸÏ9©pÔq-Û¾õÛ3tÝÊÆ›ˆÃTÐHÈ)€ ½Š’ICªxëd#1ôú§é€ m@Vüý?Zæßgo_½3-³\IEND®B`‚cpl-6.4.1/libcext/html/cxthread_8h_source.html0000644000460300003120000007702412310333010016253 00000000000000 C Standard Library Extensions: cxthread.h Source File
C Standard Library Extensions  1.1.2
cxthread.h
1 /* $Id$
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author$
23  * $Date$
24  * $Revision$
25  * $Name$
26  */
27 
28 #ifndef CXTHREAD_H_
29 #define CXTHREAD_H_
30 
31 #if HAVE_CONFIG_H
32 # include "config.h"
33 #endif
34 
35 #ifdef HAVE_PTHREAD_H
36 # include <pthread.h>
37 #endif
38 
39 #include <cxtypes.h>
40 
41 
42 /*
43  * Map local types and functions to the POSIX thread model implementation
44  */
45 
46 #if defined(CX_THREADS_ENABLED)
47 
48 #if defined(HAVE_PTHREAD_H)
49 
50 #define CX_STATIC_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
51 #define CX_STATIC_ONCE_INIT PTHREAD_ONCE_INIT
52 
53 #define CX_MUTEX_TYPE_DEFAULT PTHREAD_MUTEX_DEFAULT
54 #define CX_MUTEX_TYPE_NORMAL PTHREAD_MUTEX_NORMAL
55 #define CX_MUTEX_TYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE
56 
57 typedef pthread_mutex_t cx_mutex;
58 typedef pthread_once_t cx_once;
59 typedef pthread_key_t cx_private;
60 
61 #define cx_mutex_init(mutex, type) \
62  do { \
63  pthread_mutexattr_t attr; \
64  \
65  pthread_mutexattr_init(&attr); \
66  pthread_mutexattr_settype(&attr, (type)); \
67  \
68  pthread_mutex_init(mutex, &attr); \
69  \
70  pthread_mutexattr_destroy(&attr); \
71  } \
72  while (0)
73 
74 #define cx_mutex_lock(mutex) pthread_mutex_lock((mutex))
75 #define cx_mutex_trylock(mutex) pthread_mutex_trylock((mutex))
76 #define cx_mutex_unlock(mutex) pthread_mutex_unlock((mutex))
77 
78 #define cx_thread_once(name, func, args) pthread_once(&(name), (func))
79 
80 #define cx_private_init(name, func) pthread_key_create(&(name), (func))
81 #define cx_private_set(name, data) pthread_setspecific((name), (data))
82 #define cx_private_get(name) pthread_getspecific((name))
83 
84 #else /* !HAVE_PTHREAD_H */
85 # error "Thread support is requested, but POSIX thread model is not present!"
86 #endif /* !HAVE_PTHREAD_H */
87 
88 #else /* !CX_THREADS_ENABLED */
89 
90 typedef struct cx_private cx_private;
91 
92 #define cx_mutex_init(mutex, type) /* empty */
93 
94 #define cx_mutex_lock(mutex) /* empty */
95 #define cx_mutex_trylock(mutex) /* empty */
96 #define cx_mutex_unlock(mutex) /* empty */
97 
98 #define cx_thread_once(name, func, args) (func)()
99 
100 #define cx_private_init(name, func) /* empty */
101 #define cx_private_set(name, data) ((name) = (data))
102 #define cx_private_get(name) (name)
103 
104 #endif /* !CX_THREADS_ENABLED */
105 
106 
107 /*
108  * Convenience macros to setup locks for global variables.
109  * These macros expand to nothing, if thread support was not enabled.
110  */
111 
112 #define CX_LOCK_NAME(name) _cx__ ## name ## _lock
113 
114 #if defined(CX_THREADS_ENABLED)
115 
116 # define CX_LOCK_DEFINE_STATIC(name) static CX_LOCK_DEFINE(name)
117 # define CX_LOCK_DEFINE(name) cx_mutex CX_LOCK_NAME(name)
118 # define CX_LOCK_EXTERN(name) extern cx_mutex CX_LOCK_NAME(name)
119 
120 # define CX_LOCK_DEFINE_INITIALIZED_STATIC(name) \
121  static CX_LOCK_DEFINE_INITIALIZED(name)
122 # define CX_LOCK_DEFINE_INITIALIZED(name) \
123  CX_LOCK_DEFINE(name) = CX_STATIC_MUTEX_INIT
124 
125 # define CX_INITLOCK(name, type) cx_mutex_init(&CX_LOCK_NAME(name), (type))
126 
127 # define CX_LOCK(name) cx_mutex_lock(&CX_LOCK_NAME(name))
128 # define CX_TRYLOCK(name) cx_mutex_trylock(&CX_LOCK_NAME(name))
129 # define CX_UNLOCK(name) cx_mutex_unlock(&CX_LOCK_NAME(name))
130 
131 #else /* !CX_THREADS_ENABLED */
132 
133 # define CX_LOCK_DEFINE_STATIC(name) /* empty */
134 # define CX_LOCK_DEFINE(name) /* empty */
135 # define CX_LOCK_EXTERN(name) /* empty */
136 
137 # define CX_LOCK_DEFINE_INITIALIZED_STATIC(name) /* empty */
138 # define CX_LOCK_DEFINE_INITIALIZED(name) /* empty */
139 
140 # define CX_INITLOCK(name, type) /* empty */
141 
142 # define CX_LOCK(name) /* empty */
143 # define CX_TRYLOCK(name) (TRUE)
144 # define CX_UNLOCK(name) /* empty */
145 
146 #endif /* !CX_THREADS_ENABLED */
147 
148 
149 /*
150  * Convenience macros for setting up mutexes for one time initalizations
151  */
152 
153 #if defined(CX_THREADS_ENABLED)
154 
155 # define CX_ONCE_DEFINE_STATIC(name) static CX_ONCE_DEFINE(name)
156 # define CX_ONCE_DEFINE(name) cx_once (name)
157 
158 # define CX_ONCE_DEFINE_INITIALIZED_STATIC(name) \
159  static CX_ONCE_DEFINE_INITIALIZED(name)
160 # define CX_ONCE_DEFINE_INITIALIZED(name) \
161  cx_once (name) = CX_STATIC_ONCE_INIT
162 
163 #else /* !CX_THREADS_ENABLED */
164 
165 # define CX_ONCE_DEFINE_STATIC(name) /* empty */
166 # define CX_ONCE_DEFINE(name) /* empty */
167 
168 # define CX_ONCE_DEFINE_INITIALIZED_STATIC(name) /* empty */
169 # define CX_ONCE_DEFINE_INITIALIZED(name) /* empty */
170 
171 #endif /* !CX_THREADS_ENABLED */
172 
173 
174 /*
175  * Convenience macros for setting up thread-specific data
176  */
177 
178 #if defined(CX_THREADS_ENABLED)
179 
180 # define CX_PRIVATE_DEFINE_STATIC(name) cx_private (name)
181 
182 #else /* !CX_THREADS_ENABLED */
183 
184 # define CX_PRIVATE_DEFINE_STATIC(name) static cx_private *(name)
185 
186 #endif /* !CX_THREADS_ENABLED */
187 
188 #endif /* CXTHREAD_H_ */
cpl-6.4.1/libcext/html/nav_f.png0000644000460300003120000000023112310333010013365 00000000000000‰PNG  IHDR8³»`IDATxíÝK€ EÑ–·[†øBÑmkâÄÂH—prÓ¼.‚Žó‚ꎤR6Z VI±E‚5j³„lóš›iI˜¬ÞêçJ0ŒÑÑ/Žû›™uøñóÞ¿6sH ÝõyIEND®B`‚cpl-6.4.1/libcext/html/cxstring_8h_source.html0000644000460300003120000006446212310333010016314 00000000000000 C Standard Library Extensions: cxstring.h Source File
C Standard Library Extensions  1.1.2
cxstring.h
1 /* $Id: cxstring.h,v 1.8 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.8 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_STRING_H_
29 #define CX_STRING_H_ 1
30 
31 #include <stdarg.h>
32 #include <string.h>
33 #include <ctype.h>
34 
35 #include <cxtypes.h>
36 #include <cxmemory.h>
37 #include <cxmessages.h>
38 #include <cxutils.h>
39 
40 
41 CX_BEGIN_DECLS
42 
43 struct _cx_string_ {
44 
45  /* <private> */
46 
47  cxchar *data;
48  cxsize sz;
49 
50 };
51 
52 
60 typedef struct _cx_string_ cx_string;
61 
62 
63 /*
64  * Create, copy and destroy operations
65  */
66 
69 cx_string *cx_string_create(const cxchar *);
71 
72 /*
73  * Non modifying operations
74  */
75 
76 cxsize cx_string_size(const cx_string *);
77 cxbool cx_string_empty(const cx_string *);
78 
79 /*
80  * Data access
81  */
82 
83 const cxchar *cx_string_get(const cx_string *);
84 
85 /*
86  * Assignment operations
87  */
88 
89 void cx_string_set(cx_string *, const cxchar *);
90 
91 /*
92  * Modifying operations
93  */
94 
100 
101 /*
102  * Inserting and removing elements
103  */
104 
105 cx_string *cx_string_prepend(cx_string *, const cxchar *);
106 cx_string *cx_string_append(cx_string *, const cxchar *);
107 cx_string *cx_string_insert(cx_string *, cxssize, const cxchar *);
108 cx_string *cx_string_erase(cx_string *, cxssize, cxssize);
110 
111 /*
112  * Comparison functions
113  */
114 
115 cxbool cx_string_equal (const cx_string *, const cx_string *);
116 cxint cx_string_compare(const cx_string *, const cx_string *);
117 cxint cx_string_casecmp(const cx_string *, const cx_string *);
118 cxint cx_string_ncasecmp(const cx_string *, const cx_string *, cxsize);
119 
120 /*
121  * I/O functions
122  */
123 
125  const cxchar *, ...) CX_GNUC_PRINTF(2, 3);
127  const cxchar *, va_list) CX_GNUC_PRINTF(2, 0);
128 
129 /*
130  * Debugging utilities
131  */
132 
133 void cx_string_print(const cx_string *);
134 
135 CX_END_DECLS
136 
137 #endif /* CX_STRING_H */
cpl-6.4.1/libcext/html/ftv2ns.png0000644000460300003120000000060412310333010013522 00000000000000‰PNG  IHDRÚ}\ˆKIDATxíÝ1K1Àñ­ž ØG•â‚n‚Šà ‚âælÁE¿€‹“ (nºêââêäࢋƒÐMAá@°‹ µât¾ÄK¡à%Ü•Û ý]BIïå%áuÍ…a™€,e × v¯ç¥«ˆi‹º¨Õö–î\tòòuénÄ0ã æÜÉoV\Ì$G.&@Y=ÆË%$um·¢ûÛ6–'Úß«9Qó\bÙ)²º0Ðë-Zœ¥TèHÍ`pÀcsm µö5:>Áë‡Þ¦I µØ ‚F‹Çà]» ›jg—ìoÏáõ©[ œõ š­onë €Ô¬¨vqõ„?\Ðç”  6»øüÒTe ÃÉéŸeç ÀÅlQ ¡c”€ª¬ü3*d€ÅWTMÏ\rÿÿh6™ø1±F ‹°fžIEND®B`‚cpl-6.4.1/libcext/html/cxdeque_8h_source.html0000644000460300003120000005402012310333010016076 00000000000000 C Standard Library Extensions: cxdeque.h Source File
C Standard Library Extensions  1.1.2
cxdeque.h
1 /* $Id: cxdeque.h,v 1.3 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.3 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_DEQUE_H
29 #define CX_DEQUE_H
30 
31 #include <cxtypes.h>
32 #include <cxmemory.h>
33 
34 CX_BEGIN_DECLS
35 
36 typedef struct _cx_deque_ cx_deque;
37 
38 typedef cxsize cx_deque_const_iterator;
39 typedef cxsize cx_deque_iterator;
40 
41 
42 /*
43  * Create, copy and destroy operations
44  */
45 
46 cx_deque *cx_deque_new(void);
47 void cx_deque_delete(cx_deque* deque);
48 void cx_deque_destroy(cx_deque *deque, cx_free_func deallocate);
49 
50 /*
51  * Non-modifying operations
52  */
53 
54 cxsize cx_deque_size(const cx_deque *deque);
55 cxbool cx_deque_empty(const cx_deque *deque);
56 cxsize cx_deque_max_size(const cx_deque *deque);
57 
58 /*
59  * Assignment operations
60  */
61 
62 void cx_deque_swap(cx_deque *deque, cx_deque *other);
63 cxptr cx_deque_assign(cx_deque *deque, cx_deque_iterator position, cxptr data);
64 
65 /*
66  * Element access
67  */
68 
69 cxptr cx_deque_front(const cx_deque *deque);
70 cxptr cx_deque_back(const cx_deque *deque);
71 cxptr cx_deque_get(const cx_deque *deque, cx_deque_const_iterator position);
72 
73 /*
74  * Iterator functions
75  */
76 
77 cx_deque_iterator cx_deque_begin(const cx_deque *deque);
78 cx_deque_iterator cx_deque_end(const cx_deque *deque);
79 cx_deque_iterator cx_deque_next(const cx_deque *deque,
80  cx_deque_const_iterator position);
81 cx_deque_iterator cx_deque_previous(const cx_deque *deque,
82  cx_deque_const_iterator position);
83 
84 /*
85  * Inserting and removing elements
86  */
87 
88 void cx_deque_push_front(cx_deque *deque, cxcptr data);
89 cxptr cx_deque_pop_front(cx_deque *deque);
90 void cx_deque_push_back(cx_deque *deque, cxcptr data);
91 cxptr cx_deque_pop_back(cx_deque *deque);
92 
93 cx_deque_iterator cx_deque_insert(cx_deque *deque, cx_deque_iterator position,
94  cxcptr data);
95 cx_deque_iterator cx_deque_erase(cx_deque *deque, cx_deque_iterator position,
96  cx_free_func deallocate);
97 void cx_deque_clear(cx_deque *deque);
98 
99 
100 /*
101  * Extra deque interfaces
102  */
103 
104 /*
105  * Removing elements
106  */
107 
108 cxptr cx_deque_extract(cx_deque *deque, cx_deque_iterator position);
109 void cx_deque_remove(cx_deque *deque, cxcptr data);
110 
111 /*
112  * Splice functions
113  */
114 
115 void cx_deque_unique(cx_deque *deque, cx_compare_func compare);
116 void cx_deque_splice(cx_deque *deque, cx_deque_iterator position,
117  cx_deque *other, cx_deque_iterator start,
118  cx_deque_iterator end);
119 void cx_deque_merge(cx_deque *deque, cx_deque *other, cx_compare_func compare);
120 void cx_deque_sort(cx_deque *deque, cx_compare_func compare);
121 void cx_deque_reverse(cx_deque *deque);
122 
123 CX_END_DECLS
124 
125 #endif /* CX_DEQUE_H */
cpl-6.4.1/libcext/html/group__cxmessages.html0000644000460300003120000013467712310333011016220 00000000000000 C Standard Library Extensions: Message Logging
C Standard Library Extensions  1.1.2
Message Logging

Functions

cx_log_level_flags cx_log_set_always_fatal (cx_log_level_flags mask)
 Set log levels to be always fatal.
 
cxsize cx_log_get_domain_count (void)
 Get the number of registered log domains.
 
const cxchar * cx_log_get_domain_name (cxsize position)
 Get the name of a log domain.
 
cx_log_level_flags cx_log_set_fatal_mask (const cxchar *name, cx_log_level_flags fatal_mask)
 Sets the log message level which are fatal for a given domain.
 
cx_log_func cx_log_set_default_handler (cx_log_func func)
 Set the default log handler.
 
cxuint cx_log_set_handler (const cxchar *name, cx_log_level_flags levels, cx_log_func func, cxptr data)
 Set the log handler for a log domain.
 
void cx_log_remove_handler (const cxchar *name, cxuint id)
 Remove a log handler from a domain.
 
void cx_logv (const cxchar *name, cx_log_level_flags level, const cxchar *format, va_list args)
 Log a formatted message using a variable-length argument.
 
void cx_log (const cxchar *name, cx_log_level_flags level, const cxchar *format,...)
 Log a formatted message.
 
void cx_log_default_handler (const cxchar *name, cx_log_level_flags level, const cxchar *message, cxptr data)
 Default log handler.
 
cx_print_func cx_print_set_handler (cx_print_func func)
 Set handler for message output.
 
void cx_print (const cxchar *format,...)
 Output a formatted message via the print handler.
 
cx_print_func cx_printerr_set_handler (cx_print_func func)
 Set handler for error message output.
 
void cx_printerr (const cxchar *format,...)
 Output a formatted message via the error message handler.
 
void cx_error (const cxchar *format,...)
 Log an error message.
 
void cx_critical (const cxchar *format,...)
 Log a "critical" warning.
 
void cx_warning (const cxchar *format,...)
 Log a warning.
 
void cx_message (const cxchar *format,...)
 Log a normal message.
 

Detailed Description

The module implements a flexible logging facility. It can be customized to fit into the application environment. Log levels and functions can be defined and used in addition to or as replacement of the built in levels and log functions.

Synopsis:
#include <cxmessages.h>

Function Documentation

void cx_critical ( const cxchar *  format,
  ... 
)

Log a "critical" warning.

Parameters
formatThe format string.
...Arguments to be inserted into the format string.
Returns
Nothing.

This is a convenience function to log a message with level CX_LOG_LEVEL_CRITICAL, as specified by the format string format and the following list of arguments, via the installed log handler.

It is up to the application to decide which warnings are critical and which are not. To cause a termination of the application on critical warnings you may call cx_log_set_always_fatal().

See Also
cx_warning()

References cx_logv().

void cx_error ( const cxchar *  format,
  ... 
)

Log an error message.

Parameters
formatThe format string.
...Arguments to be inserted into the format string.
Returns
Nothing.

This is a convenience function to log an error message specified by the format string format and the following list of arguments via the installed log handler.

Error messages are always considered fatal, i.e. the application is immediately terminated by a call to abort() causing a core dump. Do not use this function for expected (recoverable) errors. This function should be used to indicate a bug (assertion failure) in the application.

See Also
cx_critical()

References cx_logv().

Referenced by cx_calloc(), cx_malloc(), cx_malloc_clear(), and cx_realloc().

void cx_log ( const cxchar *  name,
cx_log_level_flags  level,
const cxchar *  format,
  ... 
)

Log a formatted message.

Parameters
nameName of the log domain.
levelThe message log level.
formatFormat string defining output converstions.
...Argument list.

The log message, as defined by the format string format and the corresponding argument list is logged with the level level, if it is enabled, using the log function set for the log domain name. given by the variable-length argument is formatted according to the All standard printf() conversion directives are supported.

References cx_logv().

void cx_log_default_handler ( const cxchar *  name,
cx_log_level_flags  level,
const cxchar *  message,
cxptr  data 
)

Default log handler.

Parameters
nameThe message's log domain name
levelLog level of the message
messageThe message text
dataExtra data passed by the caller (ignored!)
Returns
Nothing.

The default log handler, which is used if no log handler has been set by a call to cx_log_set_handler() for the combination domain name and log level level. The message text message is written to stdout, or stderr if the level is one of CX_LOG_LEVEL_ERROR, CX_LOG_LEVEL_CRITICAL and CX_LOG_LEVEL_WARNING. In addition, if the log level is fatal the program is aborted by a call to abort().

See Also
cx_log_set_handler()

References cx_program_get_name(), cx_string_append(), cx_string_delete(), cx_string_get(), cx_string_new(), cx_string_prepend(), and cx_string_sprintf().

cxsize cx_log_get_domain_count ( void  )

Get the number of registered log domains.

Returns
The number of currently registered log domains.

The function counts the registered log domains and returns the total number of log domains. The returned number may be 0 if no log domain was previously registered.

const cxchar* cx_log_get_domain_name ( cxsize  position)

Get the name of a log domain.

Parameters
positionIndex of the log domain to lookup.
Returns
The function returns the name of the log domain, or NULL if position is out of range.

The function retrieves the name of the log domain registered at index position position. The valid range for position is from 0 to 1 less than the number of domains registered. If an invalid log domain is requested, i.e. no log domain has been previously registered for the given position, the function returns NULL.

See Also
cx_log_get_domain_count()
void cx_log_remove_handler ( const cxchar *  name,
cxuint  id 
)

Remove a log handler from a domain.

Parameters
nameName of the log domain.
idId number of the handler.

Removes the log handler, i.e. in principle the log function, registered with the id number id, from the list of log handlers for the log domain name.

References cx_free(), and cx_warning().

cx_log_level_flags cx_log_set_always_fatal ( cx_log_level_flags  mask)

Set log levels to be always fatal.

Parameters
maskLog message level flags.
Returns
Previous mask.

Log levels set in the log message level flags mask mask will always be treated as fatal. This applies only to the internally known log levels. User defined log levels are not taken into account.

In any case, the function forces errors to be fatal even if the error level was not set in mask. The priviously set mask is replaced by mask and is passed back to the caller as the return value.

cx_log_func cx_log_set_default_handler ( cx_log_func  func)

Set the default log handler.

Parameters
funcNew handler function.
Returns
The previously set print handler.

The function func is installed as the new default log handler function. Any message passed to cx_log() or cx_logv() is printed using this handler unless a domain and level specific handler has been set for the current message.

See Also
cx_log_set_handler()
cx_log_level_flags cx_log_set_fatal_mask ( const cxchar *  name,
cx_log_level_flags  fatal_mask 
)

Sets the log message level which are fatal for a given domain.

Parameters
nameName of the log domain.
fatal_maskThe log domains new fatal mask.
Returns
Previously installed fatal mask for the domain.

The log message levels set in the flag mask fatal_mask are treated as being fatal for the log domain with the name name. Even if the error level is not set in fatal_mask the function forces errors to be fatal.

cxuint cx_log_set_handler ( const cxchar *  name,
cx_log_level_flags  levels,
cx_log_func  func,
cxptr  data 
)

Set the log handler for a log domain.

Parameters
nameName of the log domain.
levelsLog levels.
funclog function.
dataUser data.
Returns
The handler's id for this domain.

The log function func is set for the domain with the name name, applicable for the log levels given by the flag mask levels. If the log function func requires extra data this can be passed to func through the user data data.

References cx_malloc().

void cx_logv ( const cxchar *  name,
cx_log_level_flags  level,
const cxchar *  format,
va_list  args 
)

Log a formatted message using a variable-length argument.

Parameters
nameName of the log domain.
levelThe message log level.
formatFormat string defining output converstions.
argsVariable-length argument list.

The log message, as defined by the format string format and arguments given by the variable-length argument args is formatted according to the conversion directives present in the format string. All standard printf() conversion directives are supported.

The formatted message is logged for the level level, if it is enabled, using the log function set for the log domain name.

References cx_bits_find(), cx_free(), cx_strvdupf(), and cx_vsnprintf().

Referenced by cx_critical(), cx_error(), cx_log(), cx_message(), and cx_warning().

void cx_message ( const cxchar *  format,
  ... 
)

Log a normal message.

Parameters
formatThe format string.
...Arguments to be inserted into the format string.
Returns
Nothing.

This is a convenience function to log an ordinary message, as specified by the format string format and the following list of arguments, via the installed log handler.

References cx_logv().

void cx_print ( const cxchar *  format,
  ... 
)

Output a formatted message via the print handler.

Parameters
formatThe message format.
...Argument list.
Returns
Nothing.

The output message created from the format string format and the converted arguments from the argument list is output via the currently set print handler. The format string may contain all conversion directives supported by printf(). The default print handler outputs messages to stdout.

The cx_print() function should not be from within libraries for debugging messages, since it may be redirected by applications. Instead, libraries should use cx_log(), or the convenience functions cx_error(), cx_critical(), cx_warning() and cx_message().

See Also
cx_print_set_handler()

References cx_free(), and cx_strvdupf().

Referenced by cx_string_print().

cx_print_func cx_print_set_handler ( cx_print_func  func)

Set handler for message output.

Parameters
funcNew handler function.
Returns
The previously set print handler.

The function func is installed as the new message printing function. Any message passed to cx_print() is printed using this handler. The default print handler just outputs the message text to stdout.

See Also
cx_print()
void cx_printerr ( const cxchar *  format,
  ... 
)

Output a formatted message via the error message handler.

Parameters
formatThe message format.
...Argument list.
Returns
Nothing.

The output error message created from the format string format and the converted arguments from the argument list is output via the currently set error message handler. The format string may contain all conversion directives supported by printf(). The default error message handler outputs messages to stderr.

The cx_printerr() function should not be from within libraries for debugging messages, since it may be redirected by applications. Instead, libraries should use cx_log(), or the convenience functions cx_error(), cx_critical(), cx_warning() and cx_message().

See Also
cx_printerr_set_handler()

References cx_free(), and cx_strvdupf().

cx_print_func cx_printerr_set_handler ( cx_print_func  func)

Set handler for error message output.

Parameters
funcNew handler function.
Returns
The previously set error message handler.

The function func is installed as the new error message printing function. Any message passed to cx_printerr() is printed using this handler. The default print handler just outputs the error message text to stderr.

See Also
cx_printerr()
void cx_warning ( const cxchar *  format,
  ... 
)

Log a warning.

Parameters
formatThe format string.
...Arguments to be inserted into the format string.
Returns
Nothing.

This is a convenience function to log a warning message, as specified by the format string format and the following list of arguments, via the installed log handler.

See Also
cx_critical()

References cx_logv().

Referenced by cx_log_remove_handler(), and cx_memory_vtable_set().

cpl-6.4.1/libcext/html/group__cxmultimap.html0000644000460300003120000020707112310333011016226 00000000000000 C Standard Library Extensions: Multi Maps
C Standard Library Extensions  1.1.2
Multi Maps

Typedefs

typedef cx_tree cx_multimap
 The multimap datatype.
 
typedef cx_tree_iterator cx_multimap_iterator
 The multimap iterator datatype.
 
typedef cx_tree_const_iterator cx_multimap_const_iterator
 The multimap constant iterator datatype.
 
typedef cx_tree_compare_func cx_multimap_compare_func
 The multimap's key comparison operator function.
 

Functions

cx_multimap_iterator cx_multimap_begin (const cx_multimap *multimap)
 Get an iterator to the first pair in a multimap.
 
cx_multimap_iterator cx_multimap_end (const cx_multimap *multimap)
 Get an iterator for the position after the last pair in the multimap.
 
cx_multimap_iterator cx_multimap_next (const cx_multimap *multimap, cx_multimap_const_iterator position)
 Get an iterator for the next pair in the multimap.
 
cx_multimap_iterator cx_multimap_previous (const cx_multimap *multimap, cx_multimap_const_iterator position)
 Get an iterator for the previous pair in the multimap.
 
void cx_multimap_clear (cx_multimap *multimap)
 Remove all pairs from a multimap.
 
cxbool cx_multimap_empty (const cx_multimap *multimap)
 Check whether a multimap is empty.
 
cx_multimapcx_multimap_new (cx_multimap_compare_func compare, cx_free_func key_destroy, cx_free_func value_destroy)
 Create a new multimap without any elements.
 
void cx_multimap_delete (cx_multimap *multimap)
 Destroy a multimap and all its elements.
 
cxsize cx_multimap_size (const cx_multimap *multimap)
 Get the actual number of pairs in the multimap.
 
cxsize cx_multimap_max_size (const cx_multimap *multimap)
 Get the maximum number of pairs possible.
 
cx_multimap_compare_func cx_multimap_key_comp (const cx_multimap *multimap)
 Retrieve a multimap's key comparison function.
 
void cx_multimap_swap (cx_multimap *multimap1, cx_multimap *multimap2)
 Swap the contents of two multimaps.
 
cxptr cx_multimap_assign (cx_multimap *multimap, cx_multimap_iterator position, cxcptr data)
 Assign data to an iterator position.
 
cxptr cx_multimap_get_key (const cx_multimap *multimap, cx_multimap_const_iterator position)
 Get the key from a given iterator position.
 
cxptr cx_multimap_get_value (const cx_multimap *multimap, cx_multimap_const_iterator position)
 Get the data from a given iterator position.
 
cx_multimap_iterator cx_multimap_find (const cx_multimap *multimap, cxcptr key)
 Locate an element in the multimap.
 
cx_multimap_iterator cx_multimap_lower_bound (const cx_multimap *multimap, cxcptr key)
 Find the beginning of a subsequence matching a given key.
 
cx_multimap_iterator cx_multimap_upper_bound (const cx_multimap *multimap, cxcptr key)
 Find the end of a subsequence matching a given key.
 
void cx_multimap_equal_range (const cx_multimap *multimap, cxcptr key, cx_multimap_iterator *begin, cx_multimap_iterator *end)
 Find a subsequence matching a given key.
 
cxsize cx_multimap_count (const cx_multimap *multimap, cxcptr key)
 Get the number of elements matching a key.
 
cx_multimap_iterator cx_multimap_insert (cx_multimap *multimap, cxcptr key, cxcptr data)
 Insert data into a multimap.
 
void cx_multimap_erase_position (cx_multimap *multimap, cx_multimap_iterator position)
 Erase an element from a multimap.
 
void cx_multimap_erase_range (cx_multimap *multimap, cx_multimap_iterator begin, cx_multimap_iterator end)
 Erase a range of elements from a multimap.
 
cxsize cx_multimap_erase (cx_multimap *multimap, cxcptr key)
 Erase an element from a multimap according to the provided key.
 

Detailed Description

The module implements a map data type, i.e. a container managing key/value pairs as elements. Their elements are automatically sorted according to a sorting criterion used for the key. The container is optimized for lookup operations. Contrary to ordinary maps a multimap is not restricted to unique keys, but may contain multiple duplicate keys.

Synopsis:
#include <cxmultimap.h>

Typedef Documentation

typedef cx_tree cx_multimap

The multimap datatype.

The internal representation of a mutimap is, as for ordinary maps too, a balanced binary tree. For this reason cx_multimap is just an alias for cx_tree.

The multimap's key comparison operator function.

This type of function is used internally by a multimap when key comparisons are necessary. It must return TRUE if the comparison of its first argument with the second argument succeeds, and FALSE otherwise. It is actually an alias for cx_tree_compare_func.

See Also
cx_tree_compare_func
typedef cx_tree_const_iterator cx_multimap_const_iterator

The multimap constant iterator datatype.

The multimap constant iterator is just an alias for the cx_tree_const_iterator datatype.

typedef cx_tree_iterator cx_multimap_iterator

The multimap iterator datatype.

The multimap iterator is just an alias for the cx_tree_iterator datatype.

Function Documentation

cxptr cx_multimap_assign ( cx_multimap multimap,
cx_multimap_iterator  position,
cxcptr  data 
)

Assign data to an iterator position.

Parameters
multimapA multimap.
positionIterator positions where the data will be stored.
dataData to store.
Returns
Handle to the previously stored data object.

The function assigns a data object reference data to the iterator position position of the multimap multimap.

References cx_tree_assign().

cx_multimap_iterator cx_multimap_begin ( const cx_multimap multimap)

Get an iterator to the first pair in a multimap.

Parameters
multimapThe multimap to query.
Returns
Iterator for the first pair or cx_multimap_end() if the multimap is empty.

The function returns a handle for the first pair in the multimap multimap. The returned iterator cannot be used directly to access the value field of the key/value pair, but only through the appropriate methods.

References cx_tree_begin().

void cx_multimap_clear ( cx_multimap multimap)

Remove all pairs from a multimap.

Parameters
multimapMultimap to be cleared.
Returns
Nothing.

The multimap multimap is cleared, i.e. all pairs are removed from the multimap. Keys and values are destroyed using the key and value destructors set up during multimap creation. After calling this function the multimap is empty.

References cx_tree_clear().

cxsize cx_multimap_count ( const cx_multimap multimap,
cxcptr  key 
)

Get the number of elements matching a key.

Parameters
multimapA multimap.
keyKey of the (key, value) pair(s) to locate.
Returns
The number of elements with the specified key.

Counts all elements of the multimap multimap matching the key key.

References cx_tree_count().

void cx_multimap_delete ( cx_multimap multimap)

Destroy a multimap and all its elements.

Parameters
multimapThe multimap to destroy.
Returns
Nothing.

The multimap multimap is deallocated. All data values and keys are deallocated using the multimap's key and value destructor. If no key and/or value destructor was set when the multimap was created the keys and the stored data values are left untouched. In this case the key and value deallocation is the responsibility of the user.

See Also
cx_multimap_new()

References cx_tree_delete().

cxbool cx_multimap_empty ( const cx_multimap multimap)

Check whether a multimap is empty.

Parameters
multimapA multimap.
Returns
The function returns TRUE if the multimap is empty, and FALSE otherwise.

The function checks if the multimap contains any pairs. Calling this function is equivalent to the statement:

return (cx_multimap_size(multimap) == 0);

References cx_tree_empty().

cx_multimap_iterator cx_multimap_end ( const cx_multimap multimap)

Get an iterator for the position after the last pair in the multimap.

Parameters
multimapThe multimap to query.
Returns
Iterator for the end of the multimap.

The function returns an iterator for the position one past the last pair in the multimap multimap. The iteration is done in ascending order according to the keys. The returned iterator cannot be used directly to access the value field of the key/value pair, but only through the appropriate methods.

References cx_tree_end().

void cx_multimap_equal_range ( const cx_multimap multimap,
cxcptr  key,
cx_multimap_iterator begin,
cx_multimap_iterator end 
)

Find a subsequence matching a given key.

Parameters
multimapA multimap.
keyThe key of the (key, value) pair(s) to be located.
beginFirst element with key key.
endLast element with key key.
Returns
Nothing.

The function returns the beginning and the end of a subsequence of multimap elements with the key key through through the begin and end arguments. After calling this function begin possibly points to the first element of multimap matching the key key and end possibly points to the last element of the sequence. If key is not present in the multimap begin and end point to the next greater element or, if no such element exists, to cx_multimap_end().

References cx_tree_equal_range().

cxsize cx_multimap_erase ( cx_multimap multimap,
cxcptr  key 
)

Erase an element from a multimap according to the provided key.

Parameters
multimapA multimap.
keyKey of the element to be erased.
Returns
The number of removed elements.

This function erases the element with the specified key key, from multimap. Key and value associated with the erased pair are deallocated using the multimap's key and value destructors, provided they have been set.

References cx_tree_erase().

void cx_multimap_erase_position ( cx_multimap multimap,
cx_multimap_iterator  position 
)

Erase an element from a multimap.

Parameters
multimapA multimap.
positionIterator position of the element to be erased.
Returns
Nothing.

This function erases an element, specified by the iterator position, from multimap. Key and value associated with the erased pair are deallocated using the multimap's key and value destructors, provided they have been set.

References cx_tree_erase_position().

void cx_multimap_erase_range ( cx_multimap multimap,
cx_multimap_iterator  begin,
cx_multimap_iterator  end 
)

Erase a range of elements from a multimap.

Parameters
multimapA multimap.
beginIterator pointing to the start of the range to erase.
endIterator pointing to the end of the range to erase.
Returns
Nothing.

This function erases all elements in the range [begin, end) from the multimap multimap. Key and value associated with the erased pair(s) are deallocated using the multimap's key and value destructors, provided they have been set.

References cx_tree_erase_range().

cx_multimap_iterator cx_multimap_find ( const cx_multimap multimap,
cxcptr  key 
)

Locate an element in the multimap.

Parameters
multimapA multimap.
keyKey of the (key, value) pair to locate.
Returns
Iterator pointing to the sought-after element, or cx_multimap_end() if it was not found.

The function searches the multimap multimap for the first element with a key matching key. If the search was successful an iterator to the sought-after pair is returned. If the search did not succeed, i.e. key is not present in the multimap, a one past the end iterator is returned.

References cx_tree_find().

cxptr cx_multimap_get_key ( const cx_multimap multimap,
cx_multimap_const_iterator  position 
)

Get the key from a given iterator position.

Parameters
multimapA multimap.
positionIterator position the data is retrieved from.
Returns
Reference for the key.

The function returns a reference to the key associated with the iterator position position in the multimap multimap.

Note
One must not modify the key of position through the returned reference, since this might corrupt the multimap!

References cx_tree_get_key().

cxptr cx_multimap_get_value ( const cx_multimap multimap,
cx_multimap_const_iterator  position 
)

Get the data from a given iterator position.

Parameters
multimapA multimap.
positionIterator position the data is retrieved from.
Returns
Handle for the data object.

The function returns a reference to the data stored at iterator position position in the multimap multimap.

References cx_tree_get_value().

cx_multimap_iterator cx_multimap_insert ( cx_multimap multimap,
cxcptr  key,
cxcptr  data 
)

Insert data into a multimap.

Parameters
multimapA multimap.
keyKey used to store the data.
dataData to insert.
Returns
An iterator that points to the inserted pair.

This function inserts a (key, value) pair into the multimap multimap. The same key may be inserted with different data values.

References cx_tree_insert_equal().

cx_multimap_compare_func cx_multimap_key_comp ( const cx_multimap multimap)

Retrieve a multimap's key comparison function.

Parameters
multimapThe multimap to query.
Returns
Handle for the multimap's key comparison function.

The function retrieves the function used by the multimap methods for comparing keys. The key comparison function is set during multimap creation.

See Also
cx_multimap_new()

References cx_tree_key_comp().

cx_multimap_iterator cx_multimap_lower_bound ( const cx_multimap multimap,
cxcptr  key 
)

Find the beginning of a subsequence matching a given key.

Parameters
multimapA multimap.
keyKey of the (key, value) pair(s) to locate.
Returns
Iterator pointing to the first position where an element with key key would get inserted, i.e. the first element with a key greater or equal than key.

The function returns the first element of a subsequence of elements in the multimap that match the given key key. If key is not present in the multimap multimap an iterator pointing to the first element that has a greater key than key or cx_multimap_end() if no such element exists.

References cx_tree_lower_bound().

cxsize cx_multimap_max_size ( const cx_multimap multimap)

Get the maximum number of pairs possible.

Parameters
multimapA multimap.
Returns
The maximum number of pairs that can be stored in the multimap.

Retrieves the multimap's capacity, i.e. the maximum possible number of pairs a multimap can manage.

References cx_tree_max_size().

cx_multimap* cx_multimap_new ( cx_multimap_compare_func  compare,
cx_free_func  key_destroy,
cx_free_func  value_destroy 
)

Create a new multimap without any elements.

Parameters
compareFunction used to compare keys.
key_destroyDestructor for the keys.
value_destroyDestructor for the value field.
Returns
Handle for the newly allocated multimap.

Memory for a new multimap is allocated and the multimap is initialized to be a valid empty multimap.

The multimap's key comparison function is set to compare. It must return TRUE or FALSE if the comparison of the first argument passed to it with the second argument is found to be true or false respectively.

The destructors for a multimap node's key and value field are set to key_destroy and value_destroy. Whenever a multimap node is destroyed these functions are used to deallocate the memory used by the key and the value. Each of the destructors might be NULL, i.e. keys and values are not deallocated during destroy operations.

See Also
cx_multimap_compare_func()

References cx_tree_new().

cx_multimap_iterator cx_multimap_next ( const cx_multimap multimap,
cx_multimap_const_iterator  position 
)

Get an iterator for the next pair in the multimap.

Parameters
multimapA multimap.
positionCurrent iterator position.
Returns
Iterator for the pair immediately following position.

The function returns an iterator for the next pair in the multimap multimap with respect to the current iterator position position. Iteration is done in ascending order according to the keys. If the multimap is empty or position points to the end of the multimap the function returns cx_multimap_end().

References cx_tree_next().

cx_multimap_iterator cx_multimap_previous ( const cx_multimap multimap,
cx_multimap_const_iterator  position 
)

Get an iterator for the previous pair in the multimap.

Parameters
multimapA multimap.
positionCurrent iterator position.
Returns
Iterator for the pair immediately preceding position.

The function returns an iterator for the previous pair in the multimap multimap with respect to the current iterator position position. Iteration is done in ascending order according to the keys. If the multimap is empty or position points to the beginning of the multimap the function returns cx_multimap_end().

References cx_tree_previous().

cxsize cx_multimap_size ( const cx_multimap multimap)

Get the actual number of pairs in the multimap.

Parameters
multimapA multimap.
Returns
The current number of pairs, or 0 if the multimap is empty.

Retrieves the current number of pairs stored in the multimap.

References cx_tree_size().

void cx_multimap_swap ( cx_multimap multimap1,
cx_multimap multimap2 
)

Swap the contents of two multimaps.

Parameters
multimap1First multimap.
multimap2Second multimap.
Returns
Nothing.

All pairs stored in the first multimap multimap1 are moved to the second multimap multimap2, while the pairs from multimap2 are moved to multimap1. Also the key comparison function, the key and the value destructor are exchanged.

References cx_tree_swap().

cx_multimap_iterator cx_multimap_upper_bound ( const cx_multimap multimap,
cxcptr  key 
)

Find the end of a subsequence matching a given key.

Parameters
multimapA multimap.
keyKey of the (key, value) pair(s) to locate.
Returns
Iterator pointing to the last position where an element with key key would get inserted, i.e. the first element with a key greater than key.

The function returns the last element of a subsequence of elements in the multimap that match the given key key. If key is not present in the multimap multimap an iterator pointing to the first element that has a greater key than key or cx_multimap_end() if no such element exists.

References cx_tree_upper_bound().

cpl-6.4.1/libcext/html/cxlist_8h_source.html0000644000460300003120000004771612310333010015764 00000000000000 C Standard Library Extensions: cxlist.h Source File
C Standard Library Extensions  1.1.2
cxlist.h
1 /* $Id: cxlist.h,v 1.4 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.4 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_LIST_H
29 #define CX_LIST_H
30 
31 #include <cxmemory.h>
32 
33 CX_BEGIN_DECLS
34 
35 typedef struct _cx_lnode_ *cx_list_iterator;
36 typedef const struct _cx_lnode_ *cx_list_const_iterator;
37 
38 typedef struct _cx_list_ cx_list;
39 
40 
41 /*
42  * Create, copy and destroy operations
43  */
44 
45 cx_list *cx_list_new(void);
46 void cx_list_delete(cx_list *);
47 void cx_list_destroy(cx_list *, cx_free_func);
48 
49 /*
50  * Non-modifying operations
51  */
52 
53 cxsize cx_list_size(const cx_list *);
54 cxbool cx_list_empty(const cx_list *);
55 cxsize cx_list_max_size(const cx_list *);
56 
57 /*
58  * Assignment operations
59  */
60 
61 void cx_list_swap(cx_list *, cx_list *);
62 cxptr cx_list_assign(cx_list *, cx_list_iterator, cxcptr);
63 
64 /*
65  * Element access
66  */
67 
68 cxptr cx_list_front(const cx_list *);
69 cxptr cx_list_back(const cx_list *);
70 cxptr cx_list_get(const cx_list *, cx_list_const_iterator);
71 
72 /*
73  * Iterator functions
74  */
75 
76 cx_list_iterator cx_list_begin(const cx_list *);
77 cx_list_iterator cx_list_end(const cx_list *);
78 cx_list_iterator cx_list_next(const cx_list *, cx_list_const_iterator);
79 cx_list_iterator cx_list_previous(const cx_list *, cx_list_const_iterator);
80 
81 /*
82  * Inserting and removing elements
83  */
84 
85 void cx_list_push_front(cx_list *, cxcptr);
86 cxptr cx_list_pop_front(cx_list *);
87 void cx_list_push_back(cx_list *, cxcptr);
88 cxptr cx_list_pop_back(cx_list *);
89 
90 cx_list_iterator cx_list_insert(cx_list *, cx_list_iterator, cxcptr);
91 cx_list_iterator cx_list_erase(cx_list *, cx_list_iterator, cx_free_func);
92 cxptr cx_list_extract(cx_list *, cx_list_iterator);
93 void cx_list_remove(cx_list *, cxcptr);
94 void cx_list_clear(cx_list *);
95 
96 /*
97  * Splice functions
98  */
99 
100 void cx_list_unique(cx_list *, cx_compare_func);
101 void cx_list_splice(cx_list *, cx_list_iterator, cx_list *,
102  cx_list_iterator, cx_list_iterator);
103 void cx_list_merge(cx_list *, cx_list *, cx_compare_func);
104 void cx_list_sort(cx_list *, cx_compare_func);
105 void cx_list_reverse(cx_list *);
106 
107 CX_END_DECLS
108 
109 #endif /* CX_LIST_H */
cpl-6.4.1/libcext/html/cxconfig_8h_source.html0000644000460300003120000005766012310333010016255 00000000000000 C Standard Library Extensions: cxconfig.h Source File
C Standard Library Extensions  1.1.2
cxconfig.h
1 /*
2  * cxconfig.h: This is a generated file! Do not edit this file!
3  * All changes will be lost!
4  */
5 
6 #ifndef CXCONFIG_H_
7 #define CXCONFIG_H_
8 
9 #include <limits.h>
10 #include <float.h>
11 #include <stdint.h>
12 #include <inttypes.h>
13 
14 #include <cxmacros.h>
15 
16 
17 CX_BEGIN_DECLS
18 
19 /*
20  * Limits for numerical data types
21  */
22 
23 #define CX_MINSHORT SHRT_MIN
24 #define CX_MAXSHORT SHRT_MAX
25 #define CX_MAXUSHORT USHRT_MAX
26 
27 #define CX_MININT INT_MIN
28 #define CX_MAXINT INT_MAX
29 #define CX_MAXUINT UINT_MAX
30 
31 #define CX_MINLONG LONG_MIN
32 #define CX_MAXLONG LONG_MAX
33 #define CX_MAXULONG ULONG_MAX
34 
35 #define CX_MINFLOAT FLT_MIN
36 #define CX_MAXFLOAT FLT_MAX
37 
38 #define CX_MINDOUBLE DBL_MIN
39 #define CX_MAXDOUBLE DBL_MAX
40 
41 
42 /*
43  * Number of bits per char
44  */
45 
46 #define CX_CHAR_BIT 8
47 
48 /*
49  * Fixed size integer types
50  */
51 
52 /* Macros for formatted output */
53 
54 #define CX_PRINTF_FORMAT_INT8 PRIi8
55 #define CX_PRINTF_FORMAT_UINT8 PRIu8
56 
57 #define CX_PRINTF_FORMAT_INT16 PRIi16
58 #define CX_PRINTF_FORMAT_UINT16 PRIu16
59 
60 #define CX_PRINTF_FORMAT_INT32 PRIi32
61 #define CX_PRINTF_FORMAT_UINT32 PRIu32
62 
63 #define CX_PRINTF_FORMAT_INT64 PRIi64
64 #define CX_PRINTF_FORMAT_UINT64 PRIu64
65 
66 /* Macros for formatted output */
67 
68 #define CX_SCANF_FORMAT_INT8 SCNi8
69 #define CX_SCANF_FORMAT_UINT8 SCNu8
70 
71 #define CX_SCANF_FORMAT_INT16 SCNi16
72 #define CX_SCANF_FORMAT_UINT16 SCNu16
73 
74 #define CX_SCANF_FORMAT_INT32 SCNi32
75 #define CX_SCANF_FORMAT_UINT32 SCNu32
76 
77 #define CX_SCANF_FORMAT_INT64 SCNi64
78 #define CX_SCANF_FORMAT_UINT64 SCNu64
79 
80 /* Type definitions */
81 
82 typedef int8_t cxint8;
83 typedef uint8_t cxuint8;
84 
85 typedef int16_t cxint16;
86 typedef uint16_t cxuint16;
87 
88 typedef int32_t cxint32;
89 typedef uint32_t cxuint32;
90 
91  typedef int64_t cxint64;
92  typedef uint64_t cxuint64;
93 
94 #define CX_INT64_CONSTANT(val) (val##L)
95 #define CX_UINT64_CONSTANT(val) (val##UL)
96 
97 #define CX_SIZEOF_VOID_P 8
98 #define CX_SIZEOF_SIZE_T 8
99 
100 /*
101  * Size type
102  */
103 
104 #define CX_PRINTF_FORMAT_SIZE_TYPE "lu"
105 #define CX_PRINTF_FORMAT_SSIZE_TYPE "li"
106 
107 #define CX_SCANF_FORMAT_SIZE_TYPE "lu"
108 #define CX_SCANF_FORMAT_SSIZE_TYPE "li"
109 
110 typedef signed long cxssize;
111 typedef unsigned long cxsize;
112 
113 #define CX_MINSSIZE CX_MINLONG
114 #define CX_MAXSSIZE CX_MAXLONG
115 #define CX_MAXSIZE CX_MAXULONG
116 
117 
118 typedef cxint64 cxoffset;
119 
120 #define CX_MINOFFSET CX_MININT64
121 #define CX_MAXOFFSET CX_MAXINT64
122 
123 /*
124  * Pointer to integer conversion
125  */
126 
127 #define CX_POINTER_TO_INT(ptr) ((cxint) (cxlong) (ptr))
128 #define CX_POINTER_TO_UINT(ptr) ((cxint) (cxlong) (ptr))
129 
130 #define CX_INT_TO_POINTER(val) ((cxptr) (cxlong) (val))
131 #define CX_UINT_TO_POINTER(val) ((cxptr) (cxlong) (val))
132 
133 #ifdef __cplusplus
134 # define CX_HAVE_INLINE 1
135 #else
136 
137 #endif
138 
139 #ifdef __cplusplus
140 # define CX_CAN_INLINE 1
141 #endif
142 
143 #define CX_HAVE_GNUC_VISIBILITY 1
144 
145 #if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
146 # define CX_GNUC_INTERNAL __attribute__((visibility("hidden")))
147 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
148 # define CX_GNUC_INTERNAL __hidden
149 #elif defined (__GNUC__) && defined (CX_HAVE_GNUC_VISIBILITY)
150 # define CX_GNUC_INTERNAL __attribute__((visibility("hidden")))
151 #else
152 # define CX_GNUC_INTERNAL /* empty */
153 #endif
154 
155 CX_END_DECLS
156 
157 #endif /* CXCONFIG_H_ */
cpl-6.4.1/libcext/html/tabs.css0000644000460300003120000000221312310333010013233 00000000000000.tabs, .tabs2, .tabs3 { background-image: url('tab_b.png'); width: 100%; z-index: 101; font-size: 13px; font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; } .tabs2 { font-size: 10px; } .tabs3 { font-size: 9px; } .tablist { margin: 0; padding: 0; display: table; } .tablist li { float: left; display: table-cell; background-image: url('tab_b.png'); line-height: 36px; list-style: none; } .tablist a { display: block; padding: 0 20px; font-weight: bold; background-image:url('tab_s.png'); background-repeat:no-repeat; background-position:right; color: #283A5D; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); text-decoration: none; outline: none; } .tabs3 .tablist a { padding: 0 10px; } .tablist a:hover { background-image: url('tab_h.png'); background-repeat:repeat-x; color: #fff; text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); text-decoration: none; } .tablist li.current a { background-image: url('tab_a.png'); background-repeat:repeat-x; color: #fff; text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); } cpl-6.4.1/libcext/html/group__cxmemory.html0000644000460300003120000005426112310333011015707 00000000000000 C Standard Library Extensions: Memory Management Utilities
C Standard Library Extensions  1.1.2
Memory Management Utilities

Functions

void cx_memory_vtable_set (const cx_memory_vtable *table)
 Install a new set of memory managmement functions.
 
cxptr cx_malloc (cxsize nbytes)
 Allocate nbytes bytes.
 
cxptr cx_malloc_clear (cxsize nbytes)
 Allocate nbytes bytes and clear them.
 
cxptr cx_calloc (cxsize natoms, cxsize nbytes)
 Allocate memory for natoms elements of size size.
 
cxptr cx_realloc (cxptr memory, cxsize nbytes)
 Change the size of a memory block.
 
void cx_free (cxptr memory)
 Memory block deallocation.
 
cxbool cx_memory_is_system_malloc (void)
 Check if the system's defaults are used for memory allocation.
 

Detailed Description

The module provides wrapper routines for the standard C memory management functions. The wrappers for the system memory allocators guarantee to always return valid pointer to the allocated memory block of memory. If the requested memory cannot be allocated the functions stop the program calling abort(), following the philosophy that it is better to terminate the application immediately when running out of resources. The memory deallocator is protected against* passing NULL.

Synopsis:
#include <cxmemory.h>

Function Documentation

cxptr cx_calloc ( cxsize  natoms,
cxsize  nbytes 
)

Allocate memory for natoms elements of size size.

Parameters
natomsNumber of atomic elements.
nbytesElement size in bytes.
Returns
Pointer to the allocated memory block.

The function allocates memory suitable for storage of natoms elements of size nbytes bytes. The allocated memory is cleared, i.e. the value 0 is written to each single byte. If the allocation fails the function does not return, but the program execution is stopped printing a message to the error channel showing the current code position.

References cx_error().

Referenced by cx_line_alloc(), cx_path_alloc(), and cx_strndup().

cxptr cx_malloc ( cxsize  nbytes)

Allocate nbytes bytes.

Parameters
nbytesNumber of bytes.
Returns
Pointer to the allocated memory block.

The function allocates nbytes bytes of memory. The allocated memory is not cleared. If the allocation fails the function does not return, but the program execution is stopped printing a message to the error channel showing the current code position.

See Also
cx_malloc_clear()

References cx_error().

Referenced by cx_deque_new(), cx_list_new(), cx_log_set_handler(), cx_slist_new(), cx_string_append(), cx_string_erase(), cx_string_insert(), cx_string_prepend(), cx_strjoinv(), cx_strsplit(), cx_tree_new(), and cx_vasprintf().

cxptr cx_malloc_clear ( cxsize  nbytes)

Allocate nbytes bytes and clear them.

Parameters
nbytesNumber of bytes.
Returns
Pointer to the allocated memory block.

The function works as cx_malloc(), but the allocated memory is cleared, i.e. a 0 is written to each byte of the allocated block.

See Also
cx_malloc()

References cx_error().

cxbool cx_memory_is_system_malloc ( void  )

Check if the system's defaults are used for memory allocation.

Returns
It returns TRUE if memory is allocated through the system's malloc() implementation, it not it returns FALSE.

Checks whether the allocator used by cx_malloc() is the system's malloc implementation. If the system's malloc implementation is used memory allocated with the system's malloc() call can be used interchangeable with memory allocated by cx_malloc().

See Also
cx_memory_vtable_set()

Referenced by cx_vasprintf().

void cx_memory_vtable_set ( const cx_memory_vtable *  table)

Install a new set of memory managmement functions.

Parameters
tableSet of memory management functions.
Returns
Nothing.

The function installs the replacements for malloc(), calloc(), realloc() and free() provided by table in the internal vtable.

Attention
The function can be called only once before any of the memory handling functions are called, either explicitly or implicitly through another library functions! For thread-safety reasons the function may only be called from the main thread!

References cx_warning().

cxptr cx_realloc ( cxptr  memory,
cxsize  nbytes 
)

Change the size of a memory block.

Parameters
memoryNumber of atomic elements.
nbytesNew memory block size in bytes.
Returns
Pointer to the allocated memory block.

The function changes the size of an already allocated memory block memory to the new size nbytes bytes. The contents is unchanged to the minimum of old and new size; newly allocated memory is not initialized. If memory is NULL the call to cx_realloc() is equivalent to cx_malloc(), and if nbytes is 0 the call is equivalent to cx_free(). Unless memory is NULL, it must have been returned by a previous call to cx_malloc(), cx_malloc_clear(), cx_calloc(), or cx_realloc().

Note
The returned memory block returned on successfull allocation may not be the same as the one pointed to by memory. Existing references pointing to locations within the original memory block might be invalidated!
See Also
cx_malloc(), cx_malloc_clear(), cx_calloc()

References cx_error().

cpl-6.4.1/libcext/html/ftv2doc.png0000644000460300003120000000135212310333010013650 00000000000000‰PNG  IHDRÚ}\ˆ±IDATxíMOS[…Ÿžsúa?-XZ(PD4‚ AWbu`b 77wäHFÆCËÔÂÿà/`vo„ˆAPòq‹P @ ­ûÝè980 îà¤+»§Ýy×^ïZï9SW¹\83g‰3'°Nâçl¹¸_b¯p ïåûÆVÜÖ¡€Ÿ×"¬Ö†X€d]Ðà3“ÉÃÄÌ™xŸ ßMàœ[<çSPkvc—hÈ'…™˜^Åm™hØ7 `Û™¦ èÀåráq›‘œ¾!daeKŸþÆÕ˜:Ì*³_דâèi?I–eP*B7Ÿ¿åô!¹Ýgr6Ër6oKbëþãðôrI”ËTˆüªŒ¨xóö=›ù¢&‰(e+ßóÄkýÇ`ëÁÜb.“¸ÐW×w0¥°jÑzN™¬|©WEãµ¢a¯6[öX†AkÓù*/œ¨‰€ÉY­ ÿV’§–u²jÂ>1W *½·°PGŽzÿ¨/Eg{ ŸÇâaoŠÁVú:è¿™¤1$ôR§W,–ªà¨@ŠË56¾ÀÔÜ-¾,mê¸Î/æè¹– òr5¥T*S(Vf8ö9u’ Õ£w›ùóa=Í<{Ò¡UŒ÷r¯+ÉådDÏF$è°…£é¿`zþ»ÎúöN‘µÜ®0Q3£~_^Ëóâ¯N=ˆvpTà±LžT}ˆîkq†Òm<¼ÎÓ?Zh¿X£ï_þÝ¥[)ƒ `gêÃa_Ô*äÔ2`'=õ´Fÿ2EâÁPú ÷»›l=8‹Wv°%THqÉ¿<"¤ïG¾ÆxH{#ÆÖ«aÔJÕÞ‡—m‹„ çñKsÿàñVŠØ¡°·MâÒ^ TÁ– Ý›r¥ß½ømüÿ_™?ªWİ÷#uIEND®B`‚cpl-6.4.1/libcext/html/ftv2blank.png0000644000460300003120000000012612310333010014170 00000000000000‰PNG  IHDRɪ|IDATxíݱðøScOx@ –¨y}IEND®B`‚cpl-6.4.1/libcext/html/cxmap_8h_source.html0000644000460300003120000006273412310333010015563 00000000000000 C Standard Library Extensions: cxmap.h Source File
C Standard Library Extensions  1.1.2
cxmap.h
1 /* $Id: cxmap.h,v 1.5 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.5 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_MAP_H
29 #define CX_MAP_H
30 
31 #include <cxmemory.h>
32 #include <cxtree.h>
33 
34 CX_BEGIN_DECLS
35 
46 typedef cx_tree cx_map;
47 
57 typedef cx_tree_iterator cx_map_iterator;
58 
69 typedef cx_tree_const_iterator cx_map_const_iterator;
70 
86 
87 /*
88  * Create, copy and destroy operations
89  */
90 
91 
92 cx_map *cx_map_new(cx_compare_func, cx_free_func, cx_free_func);
93 void cx_map_delete(cx_map *);
94 
95 /*
96  * Nonmodifying operations
97  */
98 
99 cxsize cx_map_size(const cx_map *);
100 cxbool cx_map_empty(const cx_map *);
101 cxsize cx_map_max_size(const cx_map *);
103 
104 /*
105  * Special search operations
106  */
107 
108 cxsize cx_map_count(const cx_map *, cxcptr);
109 cx_map_iterator cx_map_find(const cx_map *, cxcptr);
110 cx_map_iterator cx_map_lower_bound(const cx_map *, cxcptr);
111 cx_map_iterator cx_map_upper_bound(const cx_map *, cxcptr);
112 void cx_map_equal_range(const cx_map *, cxcptr, cx_map_iterator *,
113  cx_map_iterator *);
114 
115 /*
116  * Assignment operations
117  */
118 
119 void cx_map_swap(cx_map *, cx_map *);
120 cxptr cx_map_assign(cx_map *, cx_map_iterator, cxcptr);
121 cxptr cx_map_put(cx_map *, cxcptr, cxcptr);
122 
123 /*
124  * Element access
125  */
126 
129 cxptr cx_map_get(cx_map *, cxcptr);
130 
131 /*
132  * Iterator functions
133  */
134 
139 
140 
141 /*
142  * Inserting and removing elements
143  */
144 
145 cx_map_iterator cx_map_insert(cx_map *, cxcptr, cxcptr);
148 cxsize cx_map_erase(cx_map *, cxcptr);
149 void cx_map_clear(cx_map *);
150 
151 CX_END_DECLS
152 
153 #endif /* CX_MAP_H */
cpl-6.4.1/libcext/html/bc_s.png0000644000460300003120000000124412310333010013207 00000000000000‰PNG  IHDR€_ kIDATxíËkQÆÏ¹É̤I&“¦mš&156*nÄ…”ܸR,4 +Hµ(U­b”ª1‚ŠˆJ.º(E·mßúhëJmKS'C›(‚èäÑ…¤ï &äÖþ ‡ïrÎåü3gö(z÷ýÒ&_9ó}’ÕŸ@‰mÚu ` Øh`ñ÷Ô¯  „ú&·ññ×Ù~“½—Üò‡ÎÝÑM4¸%‰3²§?Êêh)€ÿù™\ÄYi>Jb @gûßiÞˆú²Ñkg§ãê\è½­šEUæv+?E€î"pæÖÛB\ƒY&ðØó$vM+ê’Dn¼)}òþ:§Xoâ ƒ3ŠÚ¯'¯¿.‚fÁ0ìuŠ9òLýj€f6¸%«3Gf”Ô#Ôsm(,ùÃk*Ê’³Jª…¯¼JË¢o䆔¼u_~ °r]%%mnu]z°r5[ÍÆ°«Úò•Xeµ’†Iù<ÈèÐÅg@IÔÚÞàµë3‚:/<JÇ’ÐQ) ñ¹…tÚß÷(Mû\63éCgl!ýí;ÿ¸4Ùhâñ=÷Zë29­w’ÝÒ´·ˆV;ÊL3ƒj&7©·º½÷a!I†)ëë$-öÇÓú³›‹7tIV¾VàñÔübf¨8¡ÈƒB<﫵imnÿœÈ‡„ lߣù‡ÛD —#É5“­'Æ4?쬲øM’™›°»g¬‚|5Åçµ½GNdÓÐr|ô”Ã&„ì"7+'³@ 5‡G➑Džâɬ^;õã–.3Òr"ý_R³¿Â@²oI¾å$IEND®B`‚cpl-6.4.1/libcext/html/tab_s.png0000644000460300003120000000027012310333010013367 00000000000000‰PNG  IHDR$ÇÇ[IDATxíÝ ‚@@Ñ£?Q…¤"š¢%¦I‘—Šf–6[´HÃäQƒ<Þâõþ]ždr Í’s?ˆO=Ñññw'ÌF‡Ž íðö-~rÃ[œèŠ­ì¬mƒÖ¬ƒݯнŠÕF)Yº% §`nÌ,9B ™’©!ÑŒ\ý<Å#üîî•IEND®B`‚cpl-6.4.1/libcext/html/ftv2mnode.png0000644000460300003120000000036612310333010014211 00000000000000‰PNG  IHDRɪ|½IDATxíÝ!NAÅñ¤‡à\ ÷à Um@`Ô5iÒ`ëh ‚ÅW7] b§ÝˆŠ&oföÍd¾YÔ4 üšcø ‡€´‹Åòù3v=¼]†§µ\B… I¿‹=B·™B¡®;¸k´µ W°ÍN@vyÍÑÖ4ãß÷]ÈâYìã§|M}]ÔÚx6a }ôdׇØYüú¨>¤||5?Ó>|žB"¡î'¡IEND®B`‚cpl-6.4.1/libcext/html/closed.png0000644000460300003120000000020412310333010013545 00000000000000‰PNG  IHDR à‘KIDATxíÝm @!†ÑGk™É7À-`&séts¦Àñþòð@åk}ª2€… P%Á_Ëþ¿N² .:0Dk¥‹Â›x" Ö›)¡xÒ5õIEND®B`‚cpl-6.4.1/libcext/html/cxslist_8h_source.html0000644000460300003120000004736112310333010016143 00000000000000 C Standard Library Extensions: cxslist.h Source File
C Standard Library Extensions  1.1.2
cxslist.h
1 /* $Id: cxslist.h,v 1.7 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.7 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_SLIST_H
29 #define CX_SLIST_H
30 
31 #include <cxmemory.h>
32 
33 CX_BEGIN_DECLS
34 
35 typedef struct _cx_slnode_ *cx_slist_iterator;
36 typedef const struct _cx_slnode_ *cx_slist_const_iterator;
37 
38 typedef struct _cx_slist_ cx_slist;
39 
40 
41 /*
42  * Create, copy and destroy operations
43  */
44 
45 cx_slist *cx_slist_new(void);
46 void cx_slist_delete(cx_slist *);
47 void cx_slist_destroy(cx_slist *, cx_free_func);
48 
49 /*
50  * Nonmodifying operations
51  */
52 
53 cxsize cx_slist_size(const cx_slist *);
54 cxbool cx_slist_empty(const cx_slist *);
55 cxsize cx_slist_max_size(const cx_slist *);
56 
57 /*
58  * Assignment operations
59  */
60 
61 void cx_slist_swap(cx_slist *, cx_slist *);
62 cxptr cx_slist_assign(cx_slist *, cx_slist_iterator, cxcptr);
63 
64 /*
65  * Element access
66  */
67 
68 cxptr cx_slist_front(const cx_slist *);
69 cxptr cx_slist_back(const cx_slist *);
70 cxptr cx_slist_get(const cx_slist *, cx_slist_const_iterator);
71 
72 /*
73  * Iterator functions
74  */
75 
76 cx_slist_iterator cx_slist_begin(const cx_slist *);
77 cx_slist_iterator cx_slist_end(const cx_slist *);
78 cx_slist_iterator cx_slist_next(const cx_slist *, cx_slist_const_iterator);
79 
80 /*
81  * Inserting and removing elements
82  */
83 
84 void cx_slist_push_front(cx_slist *, cxcptr);
85 cxptr cx_slist_pop_front(cx_slist *);
86 void cx_slist_push_back(cx_slist *, cxcptr);
87 cxptr cx_slist_pop_back(cx_slist *);
88 
89 cx_slist_iterator cx_slist_insert(cx_slist *, cx_slist_iterator, cxcptr);
90 cx_slist_iterator cx_slist_erase(cx_slist *, cx_slist_iterator, cx_free_func);
91 cxptr cx_slist_extract(cx_slist *, cx_slist_iterator);
92 void cx_slist_remove(cx_slist *, cxcptr);
93 void cx_slist_clear(cx_slist *);
94 
95 /*
96  * Splice functions
97  */
98 
99 void cx_slist_unique(cx_slist *, cx_compare_func);
100 void cx_slist_splice(cx_slist *, cx_slist_iterator, cx_slist *,
101  cx_slist_iterator, cx_slist_iterator);
102 void cx_slist_merge(cx_slist *, cx_slist *, cx_compare_func);
103 void cx_slist_sort(cx_slist *, cx_compare_func);
104 void cx_slist_reverse(cx_slist *);
105 
106 CX_END_DECLS
107 
108 #endif /* CX_SLIST_H */
cpl-6.4.1/libcext/html/index.html0000644000460300003120000000334112310333011013571 00000000000000 C Standard Library Extensions: Main Page
C Standard Library Extensions  1.1.2
C Standard Library Extensions Documentation
cpl-6.4.1/libcext/html/tab_a.png0000644000460300003120000000021612310333010013345 00000000000000‰PNG  IHDR$ÇÇ[UIDATxíK €0C'o¤(Šˆ[Žà%Üxÿ#Ù©­ç ùÁöó¦W¦e# 3t I 3+¼øEã~\D½9¯Ûàè’wM·¿öÿ}Yõ_êA4Yžã}IEND®B`‚cpl-6.4.1/libcext/html/ftv2folderopen.png0000644000460300003120000000112512310333010015236 00000000000000‰PNG  IHDRÚ}\ˆIDATxí]?oÓPÿ9iš4i°;ii“¶‰ZЉ‘‰ÀÀ7`bèÔÙ¬Øù,HìU'ô$*Tµ]‚T¡DPÚÄ6wÏ}‰;¡C; a¿ÓߟûÝïîž¼jAÀ­InSþ}€9H“ÓŽ|?íÁ÷ =_ÊÆŠ­†¥Àue*;¯YEäsYäæB¢Ÿ¿þÄ—£sÙ½½ÙŒ† É«›©ÀYÇq !GÇ¿v̇¹ÑØ®š °Œ‚ÔF¹}q¥b]÷7í·0)Úd›¾ÿð-èº}Pfä£ÖY{4™ÑÂ@}úæôñ2ÛüÔ—ñúåNŒI‚ÁǃcçÁº%£¬UаI³mc±ô˜å¼ÔÆüÈ>é¸xþt9Æ$µý OæVE*õU´Ì‚ç#ž×ˆ•ïûr@l$øPÿrHaaÇ¥ ²›dZ®rè‘ãqI„o¼øT\Ž,tªj2FAxv-LŸp׌p TÄI/ \¥sfí½; jViTƒèú¤o^cpÅü¼ûû»Ïb]”€¢¤<†aþÕœ²“ßÓ˜y“£§9:Œîù+À³€ñà,E žf³6éNˆÄE£KU}Ü^;¶ØnZ¢uß­US4— ѬëbížN¶.Úk¦ØjTÄöº%µªâ i¯VÄÊÝò§™ Èù¸)ùÿG€™òºJ@T x”IEND®B`‚cpl-6.4.1/libcext/html/snprintf_8h_source.html0000644000460300003120000003334412310333011016312 00000000000000 C Standard Library Extensions: snprintf.h Source File
C Standard Library Extensions  1.1.2
snprintf.h
1 /* $Id: snprintf.h,v 1.8 2012-03-06 16:35:50 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef CX_SNPRINTF_H
22 #define CX_SNPRINTF_H
23 
24 #ifdef HAVE_CONFIG_H
25 # include <config.h>
26 #endif
27 
28 #ifdef HAVE_STDDEF_H
29 # include <stdarg.h>
30 #endif
31 
32 #ifdef HAVE_STDDEF_H
33 # include <stddef.h>
34 #endif
35 
36 /* Just for defining the CX_BEGIN_DECLS and CX_END_DECLS symbols. */
37 #include <cxtypes.h>
38 
39 
40 /* Define aliases for the replacement functions */
41 
42 #if ! defined(HAVE_SNPRINTF)
43 # define snprintf rpl_snprintf
44 #endif
45 
46 #if ! defined(HAVE_VSNPRINTF)
47 # define vsnprintf rpl_vsnprintf
48 #endif
49 
50 #if ! defined(HAVE_ASPRINTF)
51 # define asprintf rpl_asprintf
52 #endif
53 
54 #if ! defined(HAVE_VASPRINTF)
55 # define vasprintf rpl_vasprintf
56 #endif
57 
58 
59 CX_BEGIN_DECLS
60 
61 #if ! defined(HAVE_SNPRINTF)
62 int rpl_snprintf(char *str, size_t size, const char *fmt, ...);
63 #endif
64 
65 #if ! defined(HAVE_VSNPRINTF)
66 int rpl_vsnprintf(char *str, size_t size, const char *fmt, va_list args);
67 #endif
68 
69 #if ! defined(HAVE_ASPRINTF)
70 int rpl_asprintf(char **str, const char *fmt, ...);
71 #endif
72 
73 #if ! defined(HAVE_VASPRINTF)
74 int rpl_vasprintf(char **str, const char *fmt, va_list args);
75 #endif
76 
77 CX_END_DECLS
78 
79 #endif /* CX_SNPRINTF_H */
cpl-6.4.1/libcext/html/tab_b.png0000644000460300003120000000025212310333010013346 00000000000000‰PNG  IHDR$ÇÇ[qIDATxíÝM‚@Dáî.ÑÄx56.\ÀŠÊß Ì„“²ãžÁš˜è5¾z©[ȶ¿írÎìtü²bò+Ü+ÂMý1<š! u ûuïgb»uÒz\ËÎT•äWÎÿ ¿©R“ìÀ˜¢¨Fä·Çës{‹ú;IEND®B`‚cpl-6.4.1/libcext/html/ftv2folderclosed.png0000644000460300003120000000115012310333010015544 00000000000000‰PNG  IHDRÚ}\ˆ/IDATxí]MOÔ@~ÚúuØlp]ö¿#›Å]PYECˆ\9ù¼yÑß`ÖÄÿàÿÀÉxóâ¢C &=qÐÄ£—vZçv¶3m؃‡vžLûNç}Þ÷}Þ½ZA@n° OäNp ’xóþK°ññ€xÜj”°8sÑ€“ “€œ_¼[Âíæ§ïD'‚•yye+ø¼û 7#rNŸlïük* ¾0Ь_d«_(àñÖ±àôz=ñxõv§÷h©‰z¹€šØP-äóä’̪uý¼$»\DãJc—B4¯ãÝÖ.:£Ï-ÑÏß}µŠLEíºþ #—ûáºÀÏgN;BŠ€6ïýñ䬜…ö@’Ðåñp&™h>p9¤™EEά¨ÎÊ‘" u¥n€$R"?{¹<˜…ë…%PNtâ$‰ß¶±úá+^<é"§2 ªDq”q´\¬«Ò™a–Œ‘©Aÿ€"Ôµ ™êŸèP£}#Eàz{û.8i îp³ê(ADwD¦E<ê¬cE¦$ HdÊÄ ”.:Ù GŽ-`ŒL‚ý¾'¢‰Ä<¤CIª½;ÙÇTZd±i};>èôß‚z×;K×§8t ¤Ž q”:uvÿv•Ý›¬²ÙvEân{„M·FXg¼ÌfZÖ¨°¹‰*›ßÌß©±ù©:›j–YqèÜë#3çÏSøWøÿÿÑr'ø Ôùù‚ ©¡IEND®B`‚cpl-6.4.1/libcext/html/dynsections.js0000644000460300003120000000413412310333010014474 00000000000000function toggleVisibility(linkObj) { var base = $(linkObj).attr('id'); var summary = $('#'+base+'-summary'); var content = $('#'+base+'-content'); var trigger = $('#'+base+'-trigger'); var src=$(trigger).attr('src'); if (content.is(':visible')===true) { content.hide(); summary.show(); $(linkObj).addClass('closed').removeClass('opened'); $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); } else { content.show(); summary.hide(); $(linkObj).removeClass('closed').addClass('opened'); $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); } return false; } function updateStripes() { $('table.directory tr'). removeClass('even').filter(':visible:even').addClass('even'); } function toggleLevel(level) { $('table.directory tr').each(function(){ var l = this.id.split('_').length-1; var i = $('#img'+this.id.substring(3)); var a = $('#arr'+this.id.substring(3)); if (lìK-+KÁ²Ñ.Y”¾dEPaA‰ø°¥¶›ZSÓïÜ;3wºŠ–¯—߯gfîïœsçœWKÇñ.€ÉøD­¨a‘'¬âq_ôˆk¢ÀŒ ÀDŽøQ´ÄïC¨¶åñÏÿgÅ ñ 0„Y‚:qZ¦Á)~õâ€èLý0HVñ× žz-¿‰C“%¨g¦˜6€é8%Úõ¬ëwêÙUÏ¿˜ª³Ä }? ?€·3ÀÀž©Š À”K• @hà a±ðaÇæUe‹ sù~ë2²ì“&Ú&B*AÄljæºììi*˨,Ëçí»÷oÆ£T”,d[˜¼3-*ÁÀ…>å‡Ë çLÉŸçfk˜Ò éw#*AEjKUy>ûšËÉõ&{µ¢8—m5Ki¬ jjƒD*¿NŽÖigwÃ7Dª’mz骹úKÛ¾±ˆ¶M!æ¤ÍkÐ?šoý¬_åÓlXí#Ò~–¸¬ê×ÒÑXŠÓ‘ùRÙ*Eû‚ՂדðEÜ;6«e"Q(²Ù=–¿Ezæ5Kؼָ_ 1òzBªJë ±XŒì96åªjL^7{ùãJÑ÷1½i@%8'7M©_\Qœ#ÓUŒËñýÿyõ Wo Éx8¼s¥v¯ªì|×SnÜ q_m Ýé î>bèÕí[JX,½4[Tú{R£ë¼ôˆ¾þa€tÝjjzzÅ'ÅìȶiIžŽòwÏs ¡€—ÕKøõâC^ŽŒ˜Y­¨µÉ%6¨´êˆº]vÛðhâ½iWv–hôëê°Ò¨¾'æÌ‚·ñ|[ßìúÅ^€YrD=<ýDû]äÇ÷s€Ïõ‹8™ºCì? À ¨—t4õᩎ¡Jã‡W‹É± îr¼cjMɘìx| šE©øNÔ‰œøA¢þ«–€Z¼ñ‡jó î#™§¢¢4gIEND®B`‚cpl-6.4.1/libcext/html/tab_h.png0000644000460300003120000000026112310333010013354 00000000000000‰PNG  IHDR$ÇÇ[xIDATxíÝMÁ@†áž~¥ÜÆÎ’Evˆ¿"!•²‘d*×rGq=Š{¼ßSݧçë­ÓÉHÇ uO^õø[À_‡¢ãXvyËþÒ±=·VCffææ{°öŠó´Rçœ%_õçÿŽ¢ö·°Çrug¶(?gh\i>|sIEND®B`‚cpl-6.4.1/libcext/html/cxtree_8h_source.html0000644000460300003120000005075512310333011015746 00000000000000 C Standard Library Extensions: cxtree.h Source File
C Standard Library Extensions  1.1.2
cxtree.h
1 /* $Id: cxtree.h,v 1.5 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.5 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_TREE_H
29 #define CX_TREE_H
30 
31 #include <cxmemory.h>
32 
33 CX_BEGIN_DECLS
34 
35 typedef struct _cx_tnode_ *cx_tree_iterator;
36 typedef const struct _cx_tnode_ *cx_tree_const_iterator;
37 
38 typedef struct _cx_tree_ cx_tree;
39 
75 typedef cxbool (*cx_tree_compare_func)(cxcptr, cxcptr);
76 
77 /*
78  * Create, copy and destroy operations
79  */
80 
81 cx_tree *cx_tree_new(cx_tree_compare_func, cx_free_func, cx_free_func);
82 void cx_tree_delete(cx_tree *);
83 
84 /*
85  * Nonmodifying operations
86  */
87 
88 cxsize cx_tree_size(const cx_tree *);
89 cxbool cx_tree_empty(const cx_tree *);
90 cxsize cx_tree_max_size(const cx_tree *);
91 cx_tree_compare_func cx_tree_key_comp(const cx_tree *);
92 
93 /*
94  * Special search operations
95  */
96 
97 cxsize cx_tree_count(const cx_tree *, cxcptr);
98 cx_tree_iterator cx_tree_find(const cx_tree *, cxcptr);
99 cx_tree_iterator cx_tree_lower_bound(const cx_tree *, cxcptr);
100 cx_tree_iterator cx_tree_upper_bound(const cx_tree *, cxcptr);
101 void cx_tree_equal_range(const cx_tree *, cxcptr, cx_tree_iterator *,
102  cx_tree_iterator *);
103 
104 /*
105  * Assignment operations
106  */
107 
108 void cx_tree_swap(cx_tree *, cx_tree *);
109 cxptr cx_tree_assign(cx_tree *, cx_tree_iterator, cxcptr);
110 
111 /*
112  * Element access
113  */
114 
115 cxptr cx_tree_get_key(const cx_tree *, cx_tree_const_iterator);
116 cxptr cx_tree_get_value(const cx_tree *, cx_tree_const_iterator);
117 
118 /*
119  * Iterator functions
120  */
121 
122 cx_tree_iterator cx_tree_begin(const cx_tree *);
123 cx_tree_iterator cx_tree_end(const cx_tree *);
124 cx_tree_iterator cx_tree_next(const cx_tree *, cx_tree_const_iterator);
125 cx_tree_iterator cx_tree_previous(const cx_tree *, cx_tree_const_iterator);
126 
127 
128 /*
129  * Inserting and removing elements
130  */
131 
132 cx_tree_iterator cx_tree_insert_unique(cx_tree *, cxcptr, cxcptr);
133 cx_tree_iterator cx_tree_insert_equal(cx_tree *, cxcptr, cxcptr);
134 void cx_tree_erase_position(cx_tree *, cx_tree_iterator);
135 void cx_tree_erase_range(cx_tree *, cx_tree_iterator, cx_tree_iterator);
136 cxsize cx_tree_erase(cx_tree *, cxcptr);
137 void cx_tree_clear(cx_tree *);
138 
139 /*
140  * Debugging
141  */
142 
143 cxbool cx_tree_verify(const cx_tree *);
144 
145 CX_END_DECLS
146 
147 #endif /* CX_TREE_H */
cpl-6.4.1/libcext/html/group__cxslist.html0000644000460300003120000016117412310333011015537 00000000000000 C Standard Library Extensions: Singly Linked Lists
C Standard Library Extensions  1.1.2
Singly Linked Lists

Functions

cx_slist_iterator cx_slist_begin (const cx_slist *list)
 Get list iterator to the beginning of a list.
 
cx_slist_iterator cx_slist_end (const cx_slist *list)
 Get a list iterator to the end of a list.
 
cx_slist_iterator cx_slist_next (const cx_slist *list, cx_slist_const_iterator position)
 Get a list iterator to the next list element.
 
void cx_slist_clear (cx_slist *list)
 Remove all elements from a list.
 
cxbool cx_slist_empty (const cx_slist *list)
 Check whether a list is empty.
 
cx_slist * cx_slist_new (void)
 Create a new list without any elements.
 
void cx_slist_delete (cx_slist *list)
 Destroy a list.
 
void cx_slist_destroy (cx_slist *list, cx_free_func deallocate)
 Destroy a list and all its elements.
 
cxsize cx_slist_size (const cx_slist *list)
 Get the actual number of list elements.
 
cxsize cx_slist_max_size (const cx_slist *list)
 Get the maximum number of list elements possible.
 
void cx_slist_swap (cx_slist *list1, cx_slist *list2)
 Swap the data of two lists.
 
cxptr cx_slist_assign (cx_slist *list, cx_slist_iterator position, cxcptr data)
 Assign data to a list position.
 
cxptr cx_slist_front (const cx_slist *list)
 Get the first element of a list.
 
cxptr cx_slist_back (const cx_slist *list)
 Get the last element of a list.
 
cxptr cx_slist_get (const cx_slist *list, cx_slist_const_iterator position)
 Get the data at a given iterator position.
 
cx_slist_iterator cx_slist_insert (cx_slist *list, cx_slist_iterator position, cxcptr data)
 Insert data into a list at a given iterator position.
 
void cx_slist_push_front (cx_slist *list, cxcptr data)
 Insert data at the beginning of a list.
 
void cx_slist_push_back (cx_slist *list, cxcptr data)
 Append data at the end of a list.
 
cx_slist_iterator cx_slist_erase (cx_slist *list, cx_slist_iterator position, cx_free_func deallocate)
 Erase a list list element.
 
cxptr cx_slist_extract (cx_slist *list, cx_slist_iterator position)
 Extract a list element.
 
cxptr cx_slist_pop_front (cx_slist *list)
 Remove the first list element.
 
cxptr cx_slist_pop_back (cx_slist *list)
 Remove the last element of a list.
 
void cx_slist_remove (cx_slist *list, cxcptr data)
 Remove all elements with a given value from a list.
 
void cx_slist_unique (cx_slist *list, cx_compare_func compare)
 Remove duplicates of consecutive elements.
 
void cx_slist_splice (cx_slist *tlist, cx_slist_iterator position, cx_slist *slist, cx_slist_iterator first, cx_slist_iterator last)
 Move a range of list elements in front of a given position.
 
void cx_slist_merge (cx_slist *list1, cx_slist *list2, cx_compare_func compare)
 Merge two sorted lists.
 
void cx_slist_sort (cx_slist *list, cx_compare_func compare)
 Sort all elements of a list using the given comparison function.
 
void cx_slist_reverse (cx_slist *list)
 Reverse the order of all list elements.
 

Detailed Description

The module implements a linked list object restricted to iterations in just one direction and methods to create, destroy and manipulate it.

Synopsis:
#include <cxslist.h>

Function Documentation

cxptr cx_slist_assign ( cx_slist *  list,
cx_slist_iterator  position,
cxcptr  data 
)

Assign data to a list position.

Parameters
listA list.
positionList position where the data will be stored
dataData to store.
Returns
Handle to the previously stored data object.

The function assigns the data object reference data to the iterator position position of the list list.

cxptr cx_slist_back ( const cx_slist *  list)

Get the last element of a list.

Parameters
listThe list to query.
Returns
Handle to the data object stored as the last list element.

The function returns a reference to the last data item in the list list.

References cx_slist_empty().

cx_slist_iterator cx_slist_begin ( const cx_slist *  list)

Get list iterator to the beginning of a list.

Parameters
listA list.
Returns
Iterator for the first element in the list, or cx_slist_end() if the list is empty.

The function returns a handle to the first element of list. The handle cannot be used directly to access the element data, but only through the appropriate functions.

Referenced by cx_strsplit().

void cx_slist_clear ( cx_slist *  list)

Remove all elements from a list.

Parameters
listList to be cleared.
Returns
Nothing.

The list list is cleared, i.e. all elements are removed from the list. The removed data objects are left untouched, in particular they are not deallocated. It is the responsibility of the caller to ensure that there still are other references to the removed data objects. After calling cx_slist_clear() the list list is empty.

void cx_slist_delete ( cx_slist *  list)

Destroy a list.

Parameters
listThe list to delete.
Returns
Nothing.

The function deallocates the list object, but not the data objects currently stored in the list.

References cx_free(), and cx_slist_empty().

Referenced by cx_strsplit().

void cx_slist_destroy ( cx_slist *  list,
cx_free_func  deallocate 
)

Destroy a list and all its elements.

Parameters
listList container to destroy.
deallocateData deallocator.
Returns
Nothing.

The function deallocates all data objects referenced by the list using the data deallocation function deallocate and finally dealocates the list object itself.

References cx_free(), and cx_slist_empty().

cxbool cx_slist_empty ( const cx_slist *  list)

Check whether a list is empty.

Parameters
listA list.
Returns
The function returns TRUE if the list is empty, and FALSE otherwise.

The function tests if the list list contains data. A call to this function is equivalent to the statement:

return (cx_slist_size(list) == 0);

Referenced by cx_slist_back(), cx_slist_delete(), cx_slist_destroy(), and cx_slist_front().

cx_slist_iterator cx_slist_end ( const cx_slist *  list)

Get a list iterator to the end of a list.

Parameters
listA list.
Returns
Iterator for the end of the list.

The function returns an iterator for the position one past the last element of the list list. The handle cannot be used to directly access the element data, but only through the appropriate functions.

Referenced by cx_strsplit().

cx_slist_iterator cx_slist_erase ( cx_slist *  list,
cx_slist_iterator  position,
cx_free_func  deallocate 
)

Erase a list list element.

Parameters
listThe list to update.
positionList iterator position.
deallocateData deallocator.
Returns
The iterator for the list position after position.

The function removes the data object stored at position position from the list list. The data object is deallocated bz calling the data deallocator deallocate.

cxptr cx_slist_extract ( cx_slist *  list,
cx_slist_iterator  position 
)

Extract a list element.

Parameters
listA list.
positionList iterator position.
Returns
Handle to the previously stored data object.

The function removes a data object from the list list located at the iterator position position without destroying the data object.

See Also
cx_slist_erase(), cx_slist_remove()
cxptr cx_slist_front ( const cx_slist *  list)

Get the first element of a list.

Parameters
listThe list to query.
Returns
Handle to the data object stored as the first list element.

The function returns a reference to the first data item in the list list.

References cx_slist_empty().

cxptr cx_slist_get ( const cx_slist *  list,
cx_slist_const_iterator  position 
)

Get the data at a given iterator position.

Parameters
listA list.
positionList position the data is retrieved from.
Returns
Handle to the data object.

The function returns a reference to the data item stored in the list list at the iterator position position.

Referenced by cx_strsplit().

cx_slist_iterator cx_slist_insert ( cx_slist *  list,
cx_slist_iterator  position,
cxcptr  data 
)

Insert data into a list at a given iterator position.

Parameters
listThe list to update.
positionList iterator position.
dataData item to insert.
Returns
List iterator position of the inserted data item.

The function inserts the data handle data into the list list at the list position given by the list iterator position.

References cx_slist_max_size().

cxsize cx_slist_max_size ( const cx_slist *  list)

Get the maximum number of list elements possible.

Parameters
listA list.
Returns
The maximum number of elements that can be stored in the list.

Retrieves the lists capacity, i.e. the maximum possible number of data items a list can hold.

Referenced by cx_slist_insert().

void cx_slist_merge ( cx_slist *  list1,
cx_slist *  list2,
cx_compare_func  compare 
)

Merge two sorted lists.

Parameters
list1First list to merge.
list2Second list to merge.
compareFunction comparing the list elements.
Returns
Nothing.

The function combines the two lists list1 and list2 by moving all elements from list2 into list1, so that all elements are still sorted. The function requires that both input lists are already sorted. The sorting order in which the elements of list2 are inserted into list1 is determined by the comparison function compare. The comparison function compare must return an integer less than, equal or greater than zero if the first argument passed to it is found, respectively, to be less than, match, or be greater than the second argument.

The list list2 is consumed by this process, i.e. after the successful merging of the two lists, list list2 will be empty.

cx_slist* cx_slist_new ( void  )

Create a new list without any elements.

Returns
Handle to the newly allocated list.

The function allocates memory for the list object and initializes it to a empty list.

References cx_malloc().

Referenced by cx_strsplit().

cx_slist_iterator cx_slist_next ( const cx_slist *  list,
cx_slist_const_iterator  position 
)

Get a list iterator to the next list element.

Parameters
listA list.
positionCurrent iterator position.
Returns
Iterator for the next list element.

The function returns an iterator for the next element in the list list with respect to the current iterator position position. If the list list is empty or position points to the list end the function returns cx_slist_end().

See Also
cx_slist_empty()

Referenced by cx_strsplit().

cxptr cx_slist_pop_back ( cx_slist *  list)

Remove the last element of a list.

Parameters
listThe list to update.
Returns
Handle to the data object previously stored as the last list element.

The function removes the last element from the list list returning a handle to the previously stored data.

cxptr cx_slist_pop_front ( cx_slist *  list)

Remove the first list element.

Parameters
listThe list to update.
Returns
Handle to the data object previously stored as the last list element.

The function removes the first element from the list list returning a handle to the previously stored data.

void cx_slist_push_back ( cx_slist *  list,
cxcptr  data 
)

Append data at the end of a list.

Parameters
listThe list to update.
dataData to append.
Returns
Nothing.

The data data is inserted into the list list after the last element, so that it becomes the new list tail.

It is equivalent to the statement

cx_slist_insert(list, cx_slist_end(list), data);
void cx_slist_push_front ( cx_slist *  list,
cxcptr  data 
)

Insert data at the beginning of a list.

Parameters
listThe list to update.
dataData to add to the list.
Returns
Nothing

The data data is inserted into the list list before the first element of the list, so that it becomes the new list head.

It is equivalent to the statement

cx_slist_insert(list, cx_slist_begin(list), data);

Referenced by cx_strsplit().

void cx_slist_remove ( cx_slist *  list,
cxcptr  data 
)

Remove all elements with a given value from a list.

Parameters
listA list object.
dataData to remove.
Returns
Nothing.

The value data is searched in the list list. If the data is found it is removed from the list. The data object itself is not deallocated.

void cx_slist_reverse ( cx_slist *  list)

Reverse the order of all list elements.

Parameters
listThe list to reverse.
Returns
Nothing.

The order of the elements of the list list is reversed.

cxsize cx_slist_size ( const cx_slist *  list)

Get the actual number of list elements.

Parameters
listA list.
Returns
The current number of elements the list contains, or 0 if the list is empty.

Retrieves the number of elements currently stored in the list list.

void cx_slist_sort ( cx_slist *  list,
cx_compare_func  compare 
)

Sort all elements of a list using the given comparison function.

Parameters
listThe list to sort.
compareFunction comparing the list elements.
Returns
Nothing.

The input list list is sorted using the comparison function compare to determine the order of two list elements. The comparison function compare must return an integer less than, equal or greater than zero if the first argument passed to it is found, respectively, to be less than, match, or be greater than the second argument.

void cx_slist_splice ( cx_slist *  tlist,
cx_slist_iterator  position,
cx_slist *  slist,
cx_slist_iterator  first,
cx_slist_iterator  last 
)

Move a range of list elements in front of a given position.

Parameters
tlistTarget list.
positionTarget iterator position.
slistSource list.
firstPosition of the first element to move.
lastPosition of the last element to move.
Returns
Nothing.

The range of list elements from the iterator position first to last, but not including last, is moved from the source list slist in front of the position position of the target list tlist. Target and source list may be identical, provided that the target position position does not fall within the range of list elements to move.

void cx_slist_swap ( cx_slist *  list1,
cx_slist *  list2 
)

Swap the data of two lists.

Parameters
list1First list.
list2Second list.
Returns
Nothing.

The contents of the first list list1 will be moved to the second list list2, while the contents of list2 is moved to list1.

void cx_slist_unique ( cx_slist *  list,
cx_compare_func  compare 
)

Remove duplicates of consecutive elements.

Parameters
listA list.
compareFunction comparing the list elements.
Returns
Nothing.

The function removes duplicates of consecutive list elements, i.e. list elements with the same value, from the list list. The equality of the list elements is checked using the comparison function compare. The comparison function compare must return an integer less than, equal or greater than zero if the first argument passed to it is found, respectively, to be less than, match, or be greater than the second argument.

cpl-6.4.1/libcext/html/cxfileutils_8h_source.html0000644000460300003120000001773112310333010017003 00000000000000 C Standard Library Extensions: cxfileutils.h Source File
C Standard Library Extensions  1.1.2
cxfileutils.h
1 /* $Id: cxfileutils.h,v 1.4 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.4 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_FILEUTILS_H
29 #define CX_FILEUTILS_H
30 
31 #include <cxtypes.h>
32 
33 
34 CX_BEGIN_DECLS
35 
36 cxlong cx_path_max(const cxchar *);
37 cxchar *cx_path_alloc(const cxchar *);
38 
39 CX_END_DECLS
40 
41 #endif /* CX_FILEUTILS_H */
cpl-6.4.1/libcext/html/ftv2pnode.png0000644000460300003120000000034512310333010014211 00000000000000‰PNG  IHDRɪ|¬IDATxí=QF‘Ø¥D«ÔkÄ:‰F©PK؃=V@§Õ³ Õ8SHxñÌ0bnrróŠ{ò½¿¾’$ ÀÏTŠP  ö¼X¬OÛd6êìòð"°²S´±O¥B€(¡àQé)š+YĈ ÒªËRÉÐ>VtÉsˆm9(ê„䜥k‚-@ȧ-Ü$ó b Ò[he ¿Kp-ôl|CùÿApRG'rÍ­aIEND®B`‚cpl-6.4.1/libcext/html/bdwn.png0000644000460300003120000000022312310333010013227 00000000000000‰PNG  IHDR5åZIDATxíË € DŸP–1ñlžmÀ r±j².e è†D[ØÉ¾ÙÏÔ¼µ¦ã´Þ|陣6€Všë3´Å?Ls'(}¬>+ žKó÷¥¿ch`‚ ^׃ÞnIEND®B`‚cpl-6.4.1/libcext/html/files.html0000644000460300003120000001405112310333011013564 00000000000000 C Standard Library Extensions: File List
C Standard Library Extensions  1.1.2
File List
Here is a list of all documented files with brief descriptions:
o*cxconfig.h
o*cxdeque.h
o*cxfileutils.h
o*cxlist.h
o*cxmacros.h
o*cxmap.h
o*cxmemory.h
o*cxmessages.h
o*cxmultimap.h
o*cxslist.h
o*cxstring.h
o*cxstrutils.h
o*cxthread.h
o*cxtree.h
o*cxtypes.h
o*cxutils.h
\*snprintf.h
cpl-6.4.1/libcext/html/cxstrutils_8h_source.html0000644000460300003120000003537312310333010016676 00000000000000 C Standard Library Extensions: cxstrutils.h Source File
C Standard Library Extensions  1.1.2
cxstrutils.h
1 /* $Id: cxstrutils.h,v 1.6 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.6 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_STRUTILS_H
29 #define CX_STRUTILS_H
30 
31 #include <stdarg.h>
32 #include <cxtypes.h>
33 
34 CX_BEGIN_DECLS
35 
36 /*
37  * String comparison functions.
38  */
39 
40 cxint cx_strcasecmp(const cxchar *, const cxchar *);
41 cxint cx_strncasecmp(const cxchar *, const cxchar *, cxsize);
42 cxint cx_strempty(const cxchar *, const cxchar *);
43 
44 
45 /*
46  * Utility functions modifing their string argument
47  */
48 
49 cxchar *cx_strlower(cxchar *);
50 cxchar *cx_strupper(cxchar *);
51 
52 cxchar *cx_strtrim(cxchar *);
53 cxchar *cx_strrtrim(cxchar *);
54 cxchar *cx_strstrip(cxchar *);
55 
56 
57 /*
58  * Utility functions which do not create a new string
59  */
60 
61 cxchar *cx_strskip(const cxchar *, cxint (*)(cxint));
62 
63 
64 /*
65  * Utilities returning a newly allocated string.
66  */
67 
68 cxchar *cx_strdup(const cxchar *);
69 cxchar *cx_strndup(const cxchar *, cxsize);
70 cxchar *cx_strvdupf(const cxchar *, va_list) CX_GNUC_PRINTF(1, 0);
71 
72 cxchar *cx_stpcpy(cxchar *, const cxchar *);
73 
74 cxchar **cx_strsplit(const cxchar *, const cxchar *, cxint);
75 void cx_strfreev(cxchar **sarray);
76 
77 cxchar *cx_strjoinv(const cxchar *, cxchar **);
78 
79 CX_END_DECLS
80 
81 #endif /* CX_STRUTILS_H */
cpl-6.4.1/libcext/html/group__cxdeque.html0000644000460300003120000016441712310333011015507 00000000000000 C Standard Library Extensions: Double-ended queue.
C Standard Library Extensions  1.1.2
Double-ended queue.

Functions

cx_deque * cx_deque_new (void)
 Create a new deque without any elements.
 
void cx_deque_delete (cx_deque *deque)
 Destroy a deque.
 
void cx_deque_destroy (cx_deque *deque, cx_free_func deallocate)
 Destroy a deque and all its elements.
 
cxsize cx_deque_size (const cx_deque *deque)
 Get the actual number of deque elements.
 
cxbool cx_deque_empty (const cx_deque *deque)
 Check whether a deque is empty.
 
cxsize cx_deque_max_size (const cx_deque *deque)
 Get the maximum number of deque elements possible.
 
void cx_deque_swap (cx_deque *deque, cx_deque *other)
 Swap the data of two deques.
 
cxptr cx_deque_assign (cx_deque *deque, cx_deque_iterator position, cxptr data)
 Assign data to a deque element.
 
cxptr cx_deque_front (const cx_deque *deque)
 Get the first element of a deque.
 
cxptr cx_deque_back (const cx_deque *deque)
 Get the last element of a deque.
 
cxptr cx_deque_get (const cx_deque *deque, cx_deque_const_iterator position)
 Retrieve an element from a deque.
 
cx_deque_iterator cx_deque_begin (const cx_deque *deque)
 Get an iterator for the first deque element.
 
cx_deque_iterator cx_deque_end (const cx_deque *deque)
 Get an iterator for the position after the last deque element.
 
cx_deque_iterator cx_deque_next (const cx_deque *deque, cx_deque_const_iterator position)
 Get an iterator for the next deque element.
 
cx_deque_iterator cx_deque_previous (const cx_deque *deque, cx_deque_const_iterator position)
 Get an iterator for the previous deque element.
 
void cx_deque_push_front (cx_deque *deque, cxcptr data)
 Insert data at the beginning of a deque.
 
cxptr cx_deque_pop_front (cx_deque *deque)
 Remove the first deque element.
 
void cx_deque_push_back (cx_deque *deque, cxcptr data)
 Append data at the end of a deque.
 
cxptr cx_deque_pop_back (cx_deque *deque)
 Remove the last deque element.
 
cx_deque_iterator cx_deque_insert (cx_deque *deque, cx_deque_iterator position, cxcptr data)
 Insert data into a deque at a given iterator position.
 
cx_deque_iterator cx_deque_erase (cx_deque *deque, cx_deque_iterator position, cx_free_func deallocate)
 Erase a deque element.
 
void cx_deque_clear (cx_deque *deque)
 Remove all elements from a deque.
 
cxptr cx_deque_extract (cx_deque *deque, cx_deque_iterator position)
 Extract a deque element.
 
void cx_deque_remove (cx_deque *deque, cxcptr data)
 Remove all elements with a given value from a deque.
 
void cx_deque_unique (cx_deque *deque, cx_compare_func compare)
 Remove duplicates of consecutive elements.
 
void cx_deque_splice (cx_deque *deque, cx_deque_iterator position, cx_deque *other, cx_deque_iterator first, cx_deque_iterator last)
 Move a range of elements in front of a given position.
 
void cx_deque_merge (cx_deque *deque, cx_deque *other, cx_compare_func compare)
 Merge two sorted deques.
 
void cx_deque_sort (cx_deque *deque, cx_compare_func compare)
 Sort all elements of a deque using the given comparison function.
 
void cx_deque_reverse (cx_deque *deque)
 Reverse the order of all deque elements.
 

Detailed Description

The module implements a double-ended queue. This is a linear list which is optimized for insertions and deletions that are made at the ends of the list.

Synopsis:
#include <cxdeque.h>

Function Documentation

cxptr cx_deque_assign ( cx_deque *  deque,
cx_deque_iterator  position,
cxptr  data 
)

Assign data to a deque element.

Parameters
dequeA deque.
positionPosition of the deque element where the data will be stored.
dataData to store.
Returns
Handle to the previously stored data object.

The function assigns the data object reference data to the iterator position position of the deque deque.

cxptr cx_deque_back ( const cx_deque *  deque)

Get the last element of a deque.

Parameters
dequeThe deque to query.
Returns
Handle to the data object stored in the last deque element.

The function returns a reference to the last data item in the deque deque.

cx_deque_iterator cx_deque_begin ( const cx_deque *  deque)

Get an iterator for the first deque element.

Parameters
dequeA deque.
Returns
Iterator for the first element in the deque or cx_deque_end() if the deque is empty.

The function returns a handle to the first element of deque. The handle cannot be used directly to access the element data, but only through the appropriate functions.

void cx_deque_clear ( cx_deque *  deque)

Remove all elements from a deque.

Parameters
dequeDeque to be cleared.
Returns
Nothing.

The deque deque is cleared, i.e. all elements are removed from the deque. The removed data objects are left untouched, in particular they are not deallocated. It is the responsibility of the caller to ensure that there are still other references to the removed data objects. After calling cx_deque_clear() the deque deque is empty.

void cx_deque_delete ( cx_deque *  deque)

Destroy a deque.

Parameters
dequeThe deque to delete.
Returns
Nothing.

The function deallocates the deque object, but not the data objects currently stored in the deque.

References cx_deque_empty(), and cx_free().

void cx_deque_destroy ( cx_deque *  deque,
cx_free_func  deallocate 
)

Destroy a deque and all its elements.

Parameters
dequeDeque container to destroy.
deallocateData deallocator.
Returns
Nothing.

The function deallocates all data objects referenced by deque using the data deallocation function deallocate and finally deallocates the deque object itself.

References cx_free().

cxbool cx_deque_empty ( const cx_deque *  deque)

Check whether a deque is empty.

Parameters
dequeA deque.
Returns
The function returns TRUE if the deque is empty, and FALSE otherwise.

The function tests if the deque deque contains data.

Referenced by cx_deque_delete().

cx_deque_iterator cx_deque_end ( const cx_deque *  deque)

Get an iterator for the position after the last deque element.

Parameters
dequeA deque.
Returns
Iterator for the end of the deque.

The function returns an iterator for the position one past the last element of the deque deque. The handle cannot be used to directly access the element data, but only through the appropriate functions.

cx_deque_iterator cx_deque_erase ( cx_deque *  deque,
cx_deque_iterator  position,
cx_free_func  deallocate 
)

Erase a deque element.

Parameters
dequeThe deque to update.
positionDeque iterator position.
deallocateData deallocator.
Returns
The iterator for the deque position after position.

The function removes the data object stored at position position from the deque deque. The data object itself is deallocated by calling the data deallocator deallocate.

cxptr cx_deque_extract ( cx_deque *  deque,
cx_deque_iterator  position 
)

Extract a deque element.

Parameters
dequeA deque.
positionDeque iterator position.
Returns
Handle to the previously stored data object.

The function removes a data object from the deque deque located at the iterator position position without destroying the data object.

See Also
cx_deque_erase(), cx_deque_remove()
cxptr cx_deque_front ( const cx_deque *  deque)

Get the first element of a deque.

Parameters
dequeThe deque to query.
Returns
Handle to the data object stored in the first deque element.

The function returns a reference to the first data item in the deque deque.

cxptr cx_deque_get ( const cx_deque *  deque,
cx_deque_const_iterator  position 
)

Retrieve an element from a deque.

Parameters
dequeThe deque to query.
positionThe position of the element to get.
Returns
A handle to the data object.

The function returns a reference to the data item stored in the deque deque at the iterator position position.

cx_deque_iterator cx_deque_insert ( cx_deque *  deque,
cx_deque_iterator  position,
cxcptr  data 
)

Insert data into a deque at a given iterator position.

Parameters
dequeThe deque to update.
positionList iterator position.
dataData item to insert.
Returns
Deque iterator position of the inserted data item.

The function inserts the data object reference data into the deque deque at the position given by the deque iterator position.

References cx_deque_push_back().

cxsize cx_deque_max_size ( const cx_deque *  deque)

Get the maximum number of deque elements possible.

Parameters
dequeA deque.
Returns
The maximum number of elements that can be stored in the deque.

Retrieves the deques capacity, i.e. the maximum possible number of data items a deque can hold.

void cx_deque_merge ( cx_deque *  deque,
cx_deque *  other,
cx_compare_func  compare 
)

Merge two sorted deques.

Parameters
dequeTarget deque of the merge operation.
otherThe deque to merge into the target.
compareFunction comparing the deque elements.
Returns
Nothing.

The function combines the two deques deque and other by moving all elements from other into deque, so that all elements are still sorted. The function requires that both input deques are already sorted. The sorting order in which the elements of other are inserted into deque is determined by the comparison function compare. The comparison function compare must return an integer less than, equal or greater than zero if the first argument passed to it is found, respectively, to be less than, match, or be greater than the second argument.

The deque other is consumed by this process, i.e. after the successful merging of the two deques, deque other will be empty.

cx_deque* cx_deque_new ( void  )

Create a new deque without any elements.

Returns
Handle to the newly allocated deque.

The function allocates memory for a deque object and initializes it to an empty deque.

References cx_malloc().

cx_deque_iterator cx_deque_next ( const cx_deque *  deque,
cx_deque_const_iterator  position 
)

Get an iterator for the next deque element.

Parameters
dequeA deque.
positionCurrent iterator position.
Returns
Iterator for the next deque element.

The function returns an iterator for the next element in the deque deque with respect to the current iterator position position. If the deque deque is empty or position points to the deque end the function returns cx_deque_end().

cxptr cx_deque_pop_back ( cx_deque *  deque)

Remove the last deque element.

Parameters
dequeThe deque to update.
Returns
Handle to the data object previously stored as the last deque element.

The function removes the last element from the deque deque returning a handle to the previously stored data.

It is equivalent to the statement

cxptr cx_deque_pop_front ( cx_deque *  deque)

Remove the first deque element.

Parameters
dequeThe deque to update.
Returns
Handle to the data object previously stored as the first deque element.

The function removes the first element from the deque deque returning a handle to the previously stored data.

It is equivalent to the statement

cx_deque_iterator cx_deque_previous ( const cx_deque *  deque,
cx_deque_const_iterator  position 
)

Get an iterator for the previous deque element.

Parameters
dequeA deque.
positionCurrent iterator position.
Returns
Iterator for the previous deque element.

The function returns an iterator for the previous element in the deque deque with respect to the current iterator position position. If the deque deque is empty or position points to the beginning of the deque the function returns cx_deque_end().

void cx_deque_push_back ( cx_deque *  deque,
cxcptr  data 
)

Append data at the end of a deque.

Parameters
dequeThe deque to update.
dataData to append.
Returns
Nothing.

The data data is inserted into the deque deque after the last element, so that it becomes the new deque tail.

It is equivalent to the statement

cx_deque_insert(deque, cx_deque_end(deque), data);

Referenced by cx_deque_insert().

void cx_deque_push_front ( cx_deque *  deque,
cxcptr  data 
)

Insert data at the beginning of a deque.

Parameters
dequeThe deque to update.
dataData to add to the deque.
Returns
Nothing.

The data data is inserted into the deque deque before the first element of the deque, so that it becomes the new deque head.

It is equivalent to the statement

cx_deque_insert(deque, cx_deque_begin(deque), data);
void cx_deque_remove ( cx_deque *  deque,
cxcptr  data 
)

Remove all elements with a given value from a deque.

Parameters
dequeA deque.
dataData to remove.
Returns
Nothing.

The value data is searched in the deque deque. If the data is found it is removed from the deque. The data object itself is not deallocated.

void cx_deque_reverse ( cx_deque *  deque)

Reverse the order of all deque elements.

Parameters
dequeThe deque to reverse.
Returns
Nothing.

The order of the elements of the deque deque is reversed.

cxsize cx_deque_size ( const cx_deque *  deque)

Get the actual number of deque elements.

Parameters
dequeA deque.
Returns
The current number of elements the deque contains, or 0 if the deque is empty.

Retrieves the number of elements currently stored in the deque deque.

void cx_deque_sort ( cx_deque *  deque,
cx_compare_func  compare 
)

Sort all elements of a deque using the given comparison function.

Parameters
dequeThe deque to sort.
compareFunction comparing the deque elements.
Returns
Nothing.

The input deque deque is sorted using the comparison function compare to determine the order of two deque elements. The comparison function compare must return an integer less than, equal or greater than zero if the first argument passed to it is found, respectively, to be less than, equal, or be greater than the second argument. This function uses the stdlib function qsort().

void cx_deque_splice ( cx_deque *  deque,
cx_deque_iterator  position,
cx_deque *  other,
cx_deque_iterator  first,
cx_deque_iterator  last 
)

Move a range of elements in front of a given position.

Parameters
dequeTarget deque.
positionTarget iterator position.
otherSource deque.
firstPosition of the first element to move.
lastPosition of the last element to move.
Returns
Nothing.

The range of deque elements from the iterator position first to last, but not including last, is moved from the source deque other in front of the position position of the target deque deque. Target and source deque may be identical, provided that the target position position does not fall within the range of deque elements to move.

void cx_deque_swap ( cx_deque *  deque,
cx_deque *  other 
)

Swap the data of two deques.

Parameters
dequeThe first deque.
otherThe second deque.
Returns
Nothing.

The contents of the deque other will be moved to the deque deque, while the contents of deque is moved to other.

void cx_deque_unique ( cx_deque *  deque,
cx_compare_func  compare 
)

Remove duplicates of consecutive elements.

Parameters
dequeA deque.
compareFunction comparing the deque elements.
Returns
Nothing.

The function removes duplicates of consecutive deque elements, i.e. deque elements with the same value, from the deque deque. The equality of the deque elements is checked using the comparison function compare. The comparison function compare must return an integer less than, equal or greater than zero if the first argument passed to it is found, respectively, to be less than, match, or be greater than the second argument.

cpl-6.4.1/libcext/html/cxmultimap_8h_source.html0000644000460300003120000006470312310333010016634 00000000000000 C Standard Library Extensions: cxmultimap.h Source File
C Standard Library Extensions  1.1.2
cxmultimap.h
1 /* $Id: cxmultimap.h,v 1.6 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.6 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_MULTIMAP_H
29 #define CX_MULTIMAP_H
30 
31 #include <cxmemory.h>
32 #include <cxtree.h>
33 
34 CX_BEGIN_DECLS
35 
47 typedef cx_tree cx_multimap;
48 
58 typedef cx_tree_iterator cx_multimap_iterator;
59 
70 typedef cx_tree_const_iterator cx_multimap_const_iterator;
71 
87 
88 /*
89  * Create, copy and destroy operations
90  */
91 
92 
94  cx_free_func);
96 
97 /*
98  * Nonmodifying operations
99  */
100 
101 cxsize cx_multimap_size(const cx_multimap *);
102 cxbool cx_multimap_empty(const cx_multimap *);
103 cxsize cx_multimap_max_size(const cx_multimap *);
105 
106 /*
107  * Special search operations
108  */
109 
110 cxsize cx_multimap_count(const cx_multimap *, cxcptr);
114 void cx_multimap_equal_range(const cx_multimap *, cxcptr,
116 
117 /*
118  * Assignment operations
119  */
120 
123 
124 /*
125  * Element access
126  */
127 
130 
131 /*
132  * Iterator functions
133  */
134 
141 
142 
143 /*
144  * Inserting and removing elements
145  */
146 
151 cxsize cx_multimap_erase(cx_multimap *, cxcptr);
153 
154 CX_END_DECLS
155 
156 #endif /* CX_MULTIMAP_H */
cpl-6.4.1/libcext/html/cxutils_8h_source.html0000644000460300003120000003067312310333011016144 00000000000000 C Standard Library Extensions: cxutils.h Source File
C Standard Library Extensions  1.1.2
cxutils.h
1 /* $Id: cxutils.h,v 1.6 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.6 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_UTILS_H
29 #define CX_UTILS_H
30 
31 #include <stdarg.h>
32 #include <cxtypes.h>
33 
34 
35 CX_BEGIN_DECLS
36 
37 /*
38  * Static information retrieval
39  */
40 
41 const cxchar *cx_program_get_name(void);
42 void cx_program_set_name(const cxchar *);
43 
44 cxlong cx_line_max(void);
45 
46 
47 /*
48  * Bit tests
49  */
50 
51 cxint cx_bits_find(cxuint32, cxint);
52 cxint cx_bits_rfind(cxuint32, cxint);
53 
54 
55 /*
56  * Miscellaneous utility functions
57  */
58 
59 cxint cx_snprintf(cxchar *, cxsize,
60  const cxchar *, ...) CX_GNUC_PRINTF(3, 4);
61 cxint cx_vsnprintf(cxchar *, cxsize,
62  const cxchar *, va_list) CX_GNUC_PRINTF(3, 0);
63 cxint cx_asprintf(cxchar **, const cxchar *, ...) CX_GNUC_PRINTF(2, 3);
64 cxint cx_vasprintf(cxchar **, const cxchar *, va_list) CX_GNUC_PRINTF(2, 0);
65 
66 cxchar *cx_line_alloc(void);
67 
68 CX_END_DECLS
69 
70 #endif /* CX_UTILS_H */
cpl-6.4.1/libcext/html/nav_g.png0000644000460300003120000000013712310333010013373 00000000000000‰PNG  IHDRô1&IDATxíÝ1 ÁOHf„á_ ->~¸åM iËMèÀƒS½ü‚<IEND®B`‚cpl-6.4.1/libcext/html/cxmacros_8h_source.html0000644000460300003120000007320012310333010016260 00000000000000 C Standard Library Extensions: cxmacros.h Source File
C Standard Library Extensions  1.1.2
cxmacros.h
1 /* $Id: cxmacros.h,v 1.7 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.7 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 
29 /*
30  * This file MUST not include any other cext header file.
31  */
32 
33 #ifndef CX_MACROS_H
34 #define CX_MACROS_H
35 
36 
37 /*
38  * Get the system's definition of NULL from stddef.h
39  */
40 
41 #include <stddef.h>
42 
43 
44 /*
45  * An alias for __extension__
46  */
47 
48 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
49 # define CX_GNUC_EXTENSION __extension__
50 #else
51 # define CX_GNUC_EXTENSION
52 #endif
53 
54 
55 /*
56  * Macros for the GNU compiler function attributes
57  */
58 
59 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
60 # define CX_GNUC_PURE __attribute__((__pure__))
61 # define CX_GNUC_MALLOC __attribute__((__malloc__))
62 #else
63 # define G_GNUC_PURE
64 # define G_GNUC_MALLOC
65 #endif
66 
67 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
68 # define CX_GNUC_PRINTF(fmt_idx, arg_idx) \
69  __attribute__((__format__ (__printf__, fmt_idx, arg_idx)))
70 # define CX_GNUC_SCANF(fmt_idx, arg_idx) \
71  __attribute__((__format__ (__scanf__, fmt_idx, arg_idx)))
72 # define CX_GNUC_FORMAT(arg_idx) __attribute__((__format_arg__ (arg_idx)))
73 # define CX_GNUC_NORETURN __attribute__((__noreturn__))
74 # define CX_GNUC_CONST __attribute__((__const__))
75 # define CX_GNUC_UNUSED __attribute__((__unused__))
76 #else
77 # define CX_GNUC_PRINTF(fmt_idx, arg_idx)
78 # define CX_GNUC_SCANF(fmt_idx, arg_idx)
79 # define CX_GNUC_FORMAT(arg_idx)
80 # define CX_GNUC_NORETURN
81 # define CX_GNUC_CONST
82 # define CX_GNUC_UNUSED
83 #endif
84 
85 
86 /*
87  * Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with macros.
88  */
89 
90 #if defined (__GNUC__) && (__GNUC__ < 3)
91 # define CX_GNUC_FUNCTION __FUNCTION__
92 # define CX_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__
93 #else /* !__GNUC__ */
94 # define CX_GNUC_FUNCTION ""
95 # define CX_GNUC_PRETTY_FUNCTION ""
96 #endif /* !__GNUC__ */
97 
98 #define CX_STRINGIFY(macro) CX_STRINGIFY_ARG(macro)
99 #define CX_STRINGIFY_ARG(contents) #contents
100 
101 
102 /*
103  * String identifier for the current code position
104  */
105 
106 #if defined (__GNUC__) && (__GNUC__ < 3)
107 # define CX_CODE_POS __FILE__ ":" CX_STRINGIFY(__LINE__) ":" __PRETTY_FUNCTION__ "()"
108 #else
109 # define CX_CODE_POS __FILE__ ":" CX_STRINGIFY(__LINE__)
110 #endif
111 
112 
113 /*
114  * Current function identifier
115  */
116 #if defined (__GNUC__)
117 # define CX_FUNC_NAME ((const char*) (__PRETTY_FUNCTION__))
118 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L
119 # define CX_FUNC_NAME ((const char*) (__func__))
120 #else
121 # define CX_FUNC_NAME ((const char*) ("???"))
122 #endif
123 
124 
125 /*
126  * C code guard
127  */
128 
129 #undef CX_BEGIN_DECLS
130 #undef CX_END_DECLS
131 
132 #ifdef __cplusplus
133 # define CX_BEGIN_DECLS extern "C" {
134 # define CX_END_DECLS }
135 #else
136 # define CX_BEGIN_DECLS /* empty */
137 # define CX_END_DECLS /* empty */
138 #endif
139 
140 
141 /*
142  * Some popular macros. If the system provides already a definition for some
143  * of them this definition is used, assuming the definition is correct.
144  */
145 
146 #ifndef NULL
147 # ifdef __cplusplus
148 # define NULL (0L)
149 # else /* !__cplusplus */
150 # define NULL ((void *) 0)
151 # endif /* !__cplusplus */
152 #endif
153 
154 #ifndef FALSE
155 # define FALSE (0)
156 #endif
157 
158 #ifndef TRUE
159 # define TRUE (!FALSE)
160 #endif
161 
162 #ifndef CX_MIN
163 # define CX_MIN(a, b) ((a) < (b) ? (a) : (b))
164 #endif
165 
166 #ifndef CX_MAX
167 # define CX_MAX(a, b) ((a) > (b) ? (a) : (b))
168 #endif
169 
170 #ifndef CX_ABS
171 # define CX_ABS(a) ((a) < (0) ? -(a) : (a))
172 #endif
173 
174 #ifndef CX_CLAMP
175 # define CX_CLAMP(a, low, high) (((a) > (high)) ? (high) : (((a) < (low)) ? (low) : (a)))
176 #endif
177 
178 
179 /*
180  * Number of elements in an array
181  */
182 
183 #define CX_N_ELEMENTS(array) (sizeof (array) / sizeof ((array)[0]))
184 
185 #endif /* CX_MACROS_H */
cpl-6.4.1/libcext/html/group__cxmap.html0000644000460300003120000021757712310333011015167 00000000000000 C Standard Library Extensions: Maps
C Standard Library Extensions  1.1.2

Typedefs

typedef cx_tree cx_map
 The map datatype.
 
typedef cx_tree_iterator cx_map_iterator
 The map iterator datatype.
 
typedef cx_tree_const_iterator cx_map_const_iterator
 The map constant iterator datatype.
 
typedef cx_tree_compare_func cx_map_compare_func
 The map's key comparison operator function.
 

Functions

cx_map_iterator cx_map_begin (const cx_map *map)
 Get an iterator to the first pair in a map.
 
cx_map_iterator cx_map_end (const cx_map *map)
 Get an iterator for the position after the last pair in the map.
 
cx_map_iterator cx_map_next (const cx_map *map, cx_map_const_iterator position)
 Get an iterator for the next pair in the map.
 
cx_map_iterator cx_map_previous (const cx_map *map, cx_map_const_iterator position)
 Get an iterator for the previous pair in the map.
 
void cx_map_clear (cx_map *map)
 Remove all pairs from a map.
 
cxbool cx_map_empty (const cx_map *map)
 Check whether a map is empty.
 
cx_mapcx_map_new (cx_map_compare_func compare, cx_free_func key_destroy, cx_free_func value_destroy)
 Create a new map without any elements.
 
void cx_map_delete (cx_map *map)
 Destroy a map and all its elements.
 
cxsize cx_map_size (const cx_map *map)
 Get the actual number of pairs in the map.
 
cxsize cx_map_max_size (const cx_map *map)
 Get the maximum number of pairs possible.
 
cx_map_compare_func cx_map_key_comp (const cx_map *map)
 Retrieve a map's key comparison function.
 
void cx_map_swap (cx_map *map1, cx_map *map2)
 Swap the contents of two maps.
 
cxptr cx_map_assign (cx_map *map, cx_map_iterator position, cxcptr data)
 Assign data to an iterator position.
 
cxptr cx_map_put (cx_map *map, cxcptr key, cxcptr data)
 Set the value of a pair matching the given key.
 
cxptr cx_map_get_key (const cx_map *map, cx_map_const_iterator position)
 Get the key from a given iterator position.
 
cxptr cx_map_get_value (const cx_map *map, cx_map_const_iterator position)
 Get the data from a given iterator position.
 
cxptr cx_map_get (cx_map *map, cxcptr key)
 Get the data for a given key.
 
cx_map_iterator cx_map_find (const cx_map *map, cxcptr key)
 Locate an element in the map.
 
cx_map_iterator cx_map_lower_bound (const cx_map *map, cxcptr key)
 Find the beginning of a subsequence matching a given key.
 
cx_map_iterator cx_map_upper_bound (const cx_map *map, cxcptr key)
 Find the end of a subsequence matching a given key.
 
void cx_map_equal_range (const cx_map *map, cxcptr key, cx_map_iterator *begin, cx_map_iterator *end)
 Find a subsequence matching a given key.
 
cxsize cx_map_count (const cx_map *map, cxcptr key)
 Get the number of elements matching a key.
 
cx_map_iterator cx_map_insert (cx_map *map, cxcptr key, cxcptr data)
 Attempt to insert data into a map.
 
void cx_map_erase_position (cx_map *map, cx_map_iterator position)
 Erase an element from a map.
 
void cx_map_erase_range (cx_map *map, cx_map_iterator begin, cx_map_iterator end)
 Erase a range of elements from a map.
 
cxsize cx_map_erase (cx_map *map, cxcptr key)
 Erase an element from a map according to the provided key.
 

Detailed Description

The module implements a map data type, i.e. a container managing key/value pairs as elements. Their elements are automatically sorted according to a sorting criterion used for the key. The container is optimized for lookup operations. Maps are restriced to unique keys, i.e. a key can only appear once in a map.

Synopsis:
#include <cxmap.h>

Typedef Documentation

typedef cx_tree cx_map

The map datatype.

The internal representation of a map is a balanced binary tree. For this reason cx_map is just an alias for cx_tree.

The map's key comparison operator function.

This type of function is used internally by a map when key comparisons are necessary. It must return TRUE if the comparison of its first argument with the second argument succeeds, and FALSE otherwise. It is actually an alias for cx_tree_compare_func.

See Also
cx_tree_compare_func
typedef cx_tree_const_iterator cx_map_const_iterator

The map constant iterator datatype.

The map constant iterator is just an alias for the cx_tree_const_iterator datatype.

typedef cx_tree_iterator cx_map_iterator

The map iterator datatype.

The map iterator is just an alias for the cx_tree_iterator datatype.

Function Documentation

cxptr cx_map_assign ( cx_map map,
cx_map_iterator  position,
cxcptr  data 
)

Assign data to an iterator position.

Parameters
mapA map.
positionIterator positions where the data will be stored.
dataData to store.
Returns
Handle to the previously stored data object.

The function assigns a data object reference data to the iterator position position of the map map.

References cx_tree_assign().

cx_map_iterator cx_map_begin ( const cx_map map)

Get an iterator to the first pair in a map.

Parameters
mapThe map to query.
Returns
Iterator for the first pair or cx_map_end() if the map is empty.

The function returns a handle for the first pair in the map map. The returned iterator cannot be used directly to access the value field of the key/value pair, but only through the appropriate methods.

References cx_tree_begin().

void cx_map_clear ( cx_map map)

Remove all pairs from a map.

Parameters
mapMap to be cleared.
Returns
Nothing.

The map map is cleared, i.e. all pairs are removed from the map. Keys and values are destroyed using the key and value destructors set up during map creation. After calling this function the map is empty.

References cx_tree_clear().

cxsize cx_map_count ( const cx_map map,
cxcptr  key 
)

Get the number of elements matching a key.

Parameters
mapA map.
keyKey of the (key, value) pair(s) to locate.
Returns
The number of elements with the specified key.

Counts all elements of the map map matching the key key.

References cx_tree_end(), and cx_tree_find().

void cx_map_delete ( cx_map map)

Destroy a map and all its elements.

Parameters
mapThe map to destroy.
Returns
Nothing.

The map map is deallocated. All data values and keys are deallocated using the map's key and value destructor. If no key and/or value destructor was set when the map was created the keys and the stored data values are left untouched. In this case the key and value deallocation is the responsibility of the user.

See Also
cx_map_new()

References cx_tree_delete().

cxbool cx_map_empty ( const cx_map map)

Check whether a map is empty.

Parameters
mapA map.
Returns
The function returns TRUE if the map is empty, and FALSE otherwise.

The function checks if the map contains any pairs. Calling this function is equivalent to the statement:

return (cx_map_size(map) == 0);

References cx_tree_empty().

cx_map_iterator cx_map_end ( const cx_map map)

Get an iterator for the position after the last pair in the map.

Parameters
mapThe map to query.
Returns
Iterator for the end of the map.

The function returns an iterator for the position one past the last pair in the map map. The iteration is done in ascending order according to the keys. The returned iterator cannot be used directly to access the value field of the key/value pair, but only through the appropriate methods.

References cx_tree_end().

void cx_map_equal_range ( const cx_map map,
cxcptr  key,
cx_map_iterator begin,
cx_map_iterator end 
)

Find a subsequence matching a given key.

Parameters
mapA map.
keyThe key of the (key, value) pair(s) to be located.
beginFirst element with key key.
endLast element with key key.
Returns
Nothing.

The function returns the beginning and the end of a subsequence of map elements with the key key through through the begin and end arguments. After calling this function begin possibly points to the first element of map matching the key key and end possibly points to the last element of the sequence. If key is not present in the map begin and end point to the next greater element or, if no such element exists, to cx_map_end().

References cx_tree_equal_range().

cxsize cx_map_erase ( cx_map map,
cxcptr  key 
)

Erase an element from a map according to the provided key.

Parameters
mapA map.
keyKey of the element to be erased.
Returns
The number of removed elements.

This function erases the element with the specified key key, from map. Key and value associated with the erased pair are deallocated using the map's key and value destructors, provided they have been set.

Note
For maps the the returned number should only be 0 or 1, due to the nature of maps.

References cx_tree_erase().

void cx_map_erase_position ( cx_map map,
cx_map_iterator  position 
)

Erase an element from a map.

Parameters
mapA map.
positionIterator position of the element to be erased.
Returns
Nothing.

This function erases an element, specified by the iterator position, from map. Key and value associated with the erased pair are deallocated using the map's key and value destructors, provided they have been set.

References cx_tree_erase_position().

void cx_map_erase_range ( cx_map map,
cx_map_iterator  begin,
cx_map_iterator  end 
)

Erase a range of elements from a map.

Parameters
mapA map.
beginIterator pointing to the start of the range to erase.
endIterator pointing to the end of the range to erase.
Returns
Nothing.

This function erases all elements in the range [begin, end) from the map map. Key and value associated with the erased pair(s) are deallocated using the map's key and value destructors, provided they have been set.

References cx_tree_erase_range().

cx_map_iterator cx_map_find ( const cx_map map,
cxcptr  key 
)

Locate an element in the map.

Parameters
mapA map.
keyKey of the (key, value) pair to locate.
Returns
Iterator pointing to the sought-after element, or cx_map_end() if it was not found.

The function searches the map map for an element with a key matching key. If the search was successful an iterator to the sought-after pair is returned. If the search did not succeed, i.e. key is not present in the map, a one past the end iterator is returned.

References cx_tree_find().

cxptr cx_map_get ( cx_map map,
cxcptr  key 
)

Get the data for a given key.

Parameters
mapA map.
keyKey for which the data should be retrieved.
Returns
Handle to the value of the (key, value) pair matching the key key.

The function looks for the key key in the map map and returns the data associated with this key. If key is not present in map it is inserted using NULL as the associated default value, which is then returned.

References cx_tree_end(), cx_tree_get_key(), cx_tree_get_value(), cx_tree_insert_unique(), cx_tree_key_comp(), and cx_tree_lower_bound().

cxptr cx_map_get_key ( const cx_map map,
cx_map_const_iterator  position 
)

Get the key from a given iterator position.

Parameters
mapA map.
positionIterator position the data is retrieved from.
Returns
Reference for the key.

The function returns a reference to the key associated with the iterator position position in the map map.

Note
One must not modify the key of position through the returned reference, since this might corrupt the map!

References cx_tree_get_key().

cxptr cx_map_get_value ( const cx_map map,
cx_map_const_iterator  position 
)

Get the data from a given iterator position.

Parameters
mapA map.
positionIterator position the data is retrieved from.
Returns
Handle for the data object.

The function returns a reference to the data stored at iterator position position in the map map.

References cx_tree_get_value().

cx_map_iterator cx_map_insert ( cx_map map,
cxcptr  key,
cxcptr  data 
)

Attempt to insert data into a map.

Parameters
mapA map.
keyKey used to store the data.
dataData to insert.
Returns
An iterator that points to the inserted pair, or NULL if the pair could not be inserted.

This function attempts to insert a (key, value) pair into the map map. The insertion fails if the key already present in the map, since a key may only occur once in a map.

References cx_tree_insert_unique().

cx_map_compare_func cx_map_key_comp ( const cx_map map)

Retrieve a map's key comparison function.

Parameters
mapThe map to query.
Returns
Handle for the map's key comparison function.

The function retrieves the function used by the map methods for comparing keys. The key comparison function is set during map creation.

See Also
cx_map_new()

References cx_tree_key_comp().

cx_map_iterator cx_map_lower_bound ( const cx_map map,
cxcptr  key 
)

Find the beginning of a subsequence matching a given key.

Parameters
mapA map.
keyKey of the (key, value) pair(s) to locate.
Returns
Iterator pointing to the first position where an element with key key would get inserted, i.e. the first element with a key greater or equal than key.

The function returns the first element of a subsequence of elements in the map that match the given key key. If key is not present in the map map an iterator pointing to the first element that has a greater key than key or cx_map_end() if no such element exists.

Note
For maps, where a key can occur only once, is a call to this function equivalent to calling cx_map_find().

References cx_tree_lower_bound().

cxsize cx_map_max_size ( const cx_map map)

Get the maximum number of pairs possible.

Parameters
mapA map.
Returns
The maximum number of pairs that can be stored in the map.

Retrieves the map's capacity, i.e. the maximum possible number of pairs a map can manage.

References cx_tree_max_size().

cx_map* cx_map_new ( cx_map_compare_func  compare,
cx_free_func  key_destroy,
cx_free_func  value_destroy 
)

Create a new map without any elements.

Parameters
compareFunction used to compare keys.
key_destroyDestructor for the keys.
value_destroyDestructor for the value field.
Returns
Handle for the newly allocated map.

Memory for a new map is allocated and the map is initialized to be a valid empty map.

The map's key comparison function is set to compare. It must return TRUE or FALSE if the comparison of the first argument passed to it with the second argument is found to be true or false respectively.

The destructors for a map node's key and value field are set to key_destroy and value_destroy. Whenever a map node is destroyed these functions are used to deallocate the memory used by the key and the value. Each of the destructors might be NULL, i.e. keys and values are not deallocated during destroy operations.

See Also
cx_map_compare_func()

References cx_tree_new().

cx_map_iterator cx_map_next ( const cx_map map,
cx_map_const_iterator  position 
)

Get an iterator for the next pair in the map.

Parameters
mapA map.
positionCurrent iterator position.
Returns
Iterator for the pair immediately following position.

The function returns an iterator for the next pair in the map map with respect to the current iterator position position. Iteration is done in ascending order according to the keys. If the map is empty or position points to the end of the map the function returns cx_map_end().

References cx_tree_next().

cx_map_iterator cx_map_previous ( const cx_map map,
cx_map_const_iterator  position 
)

Get an iterator for the previous pair in the map.

Parameters
mapA map.
positionCurrent iterator position.
Returns
Iterator for the pair immediately preceding position.

The function returns an iterator for the previous pair in the map map with respect to the current iterator position position. Iteration is done in ascending order according to the keys. If the map is empty or position points to the beginning of the map the function returns cx_map_end().

References cx_tree_previous().

cxptr cx_map_put ( cx_map map,
cxcptr  key,
cxcptr  data 
)

Set the value of a pair matching the given key.

Parameters
mapA map.
keyThe key of the map element to be changed.
dataData value to be stored.
Returns
Previously stored data value of the (key, value) pair.

The function replaces the value of the map element with the key key with value, if the key is present in the map map. The old value of the map element is returned. If the key is not yet present in the map the pair (key, data) is inserted in the map. In this case the returned handle to the previously stored data points to data.

References cx_tree_assign(), cx_tree_end(), cx_tree_insert_unique(), and cx_tree_lower_bound().

cxsize cx_map_size ( const cx_map map)

Get the actual number of pairs in the map.

Parameters
mapA map.
Returns
The current number of pairs, or 0 if the map is empty.

Retrieves the current number of pairs stored in the map.

References cx_tree_size().

void cx_map_swap ( cx_map map1,
cx_map map2 
)

Swap the contents of two maps.

Parameters
map1First map.
map2Second map.
Returns
Nothing.

All pairs stored in the first map map1 are moved to the second map map2, while the pairs from map2 are moved to map1. Also the key comparison function, the key and the value destructor are exchanged.

References cx_tree_swap().

cx_map_iterator cx_map_upper_bound ( const cx_map map,
cxcptr  key 
)

Find the end of a subsequence matching a given key.

Parameters
mapA map.
keyKey of the (key, value) pair(s) to locate.
Returns
Iterator pointing to the last position where an element with key key would get inserted, i.e. the first element with a key greater than key.

The function returns the last element of a subsequence of elements in the map that match the given key key. If key is not present in the map map an iterator pointing to the first element that has a greater key than key or cx_map_end() if no such element exists.

Note
For maps, calling this function is equivalent to:
it = cx_map_find(map, key);
it = cx_map_next(map, it);
omitting all error checks.

References cx_tree_upper_bound().

cpl-6.4.1/libcext/html/cxmessages_8h_source.html0000644000460300003120000006645112310333010016615 00000000000000 C Standard Library Extensions: cxmessages.h Source File
C Standard Library Extensions  1.1.2
cxmessages.h
1 /* $Id: cxmessages.h,v 1.10 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.10 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_MESSAGES_H
29 #define CX_MESSAGES_H
30 
31 #include <stdarg.h>
32 
33 #include <cxmacros.h>
34 #include <cxtypes.h>
35 
36 
37 CX_BEGIN_DECLS
38 
39 /*
40  * Message level offset for user defined message levels
41  * (0 - 7 are used internally).
42  */
43 
44 #define CX_LOG_LEVEL_USER_SHIFT (8)
45 
46 
47 /*
48  * Log levels and flags
49  */
50 
51 typedef enum
52 {
53  /* flags */
54  CX_LOG_FLAG_RECURSION = 1 << 0,
55  CX_LOG_FLAG_FATAL = 1 << 1,
56 
57  /* levels */
58  CX_LOG_LEVEL_ERROR = 1 << 2,
59  CX_LOG_LEVEL_CRITICAL = 1 << 3,
60  CX_LOG_LEVEL_WARNING = 1 << 4,
61  CX_LOG_LEVEL_MESSAGE = 1 << 5,
62  CX_LOG_LEVEL_INFO = 1 << 6,
63  CX_LOG_LEVEL_DEBUG = 1 << 7,
64 
65  CX_LOG_LEVEL_MASK = ~(CX_LOG_FLAG_RECURSION | CX_LOG_FLAG_FATAL)
66 } cx_log_level_flags;
67 
68 #define CX_LOG_FATAL_MASK (CX_LOG_FLAG_RECURSION | CX_LOG_LEVEL_ERROR)
69 
70 
71 /*
72  * Message handlers
73  */
74 
75 typedef void (*cx_log_func) (const cxchar *, cx_log_level_flags,
76  const cxchar *, cxptr);
77 typedef void (*cx_print_func) (const cxchar *);
78 
79 
80 /*
81  * Messaging mechanisms
82  */
83 
84 void cx_log_default_handler(const cxchar *, cx_log_level_flags,
85  const cxchar *, cxptr);
86 cx_log_func cx_log_set_default_handler(cx_log_func);
87 cxuint cx_log_set_handler(const cxchar *, cx_log_level_flags,
88  cx_log_func, cxptr);
89 void cx_log_remove_handler(const cxchar *, cxuint);
90 
91 cx_log_level_flags cx_log_set_fatal_mask(const cxchar *, cx_log_level_flags);
92 cx_log_level_flags cx_log_set_always_fatal(cx_log_level_flags);
93 
94 cxsize cx_log_get_domain_count(void);
95 const cxchar *cx_log_get_domain_name(cxsize);
96 
97 void cx_log(const cxchar *, cx_log_level_flags,
98  const cxchar *, ...) CX_GNUC_PRINTF(3, 4);
99 void cx_logv(const cxchar *, cx_log_level_flags,
100  const cxchar *, va_list) CX_GNUC_PRINTF(3, 0);
101 
102 cx_print_func cx_print_set_handler(cx_print_func);
103 cx_print_func cx_printerr_set_handler(cx_print_func);
104 
105 void cx_print(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
106 void cx_printerr(const cxchar *, ...) CX_GNUC_PRINTF(1, 0);
107 
108 
109 /*
110  * Convenience functions
111  */
112 
113 void cx_error(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
114 void cx_critical(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
115 void cx_warning(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
116 void cx_message(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
117 
118 
119 #ifndef CX_LOG_DOMAIN
120 # define CX_LOG_DOMAIN ((cxchar *)0)
121 #endif
122 
123 
124 /*
125  * Macros for error handling.
126  */
127 
128 #ifdef CX_DISABLE_ASSERT
129 
130 # define cx_assert(expr) /* empty */
131 
132 #else /* !CX_DISABLE_ASSERT */
133 
134 # ifdef __GNUC__
135 # define cx_assert(expr) \
136  do { \
137  if (expr) { \
138  ; \
139  } \
140  else { \
141  cx_log(CX_LOG_DOMAIN, CX_LOG_LEVEL_ERROR, \
142  "file %s: line %d (%s): assertion failed: (%s)", \
143  __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
144  } \
145  } while (0)
146 # else /* !__GNUC__ */
147 # define cx_assert(expr) \
148  do { \
149  if (expr) { \
150  ; \
151  } \
152  else { \
153  cx_log(CX_LOG_DOMAIN,CX_LOG_LEVEL_ERROR, \
154  "file %s: line %d: assertion failed: (%s)", \
155  __FILE__, __LINE__, #expr); \
156  } \
157  } while (0)
158 # endif /* !__GNUC__ */
159 
160 #endif /* !CX_DISABLE_ASSERT */
161 
162 CX_END_DECLS
163 
164 #endif /* CX_MESSAGES_H */
165 
cpl-6.4.1/libcext/html/ftv2lastnode.png0000644000460300003120000000012612310333010014712 00000000000000‰PNG  IHDRɪ|IDATxíݱðøScOx@ –¨y}IEND®B`‚cpl-6.4.1/libcext/html/ftv2vertline.png0000644000460300003120000000012612310333010014731 00000000000000‰PNG  IHDRɪ|IDATxíݱðøScOx@ –¨y}IEND®B`‚cpl-6.4.1/libcext/Makefile.am0000644000460300003120000000321712111162405012674 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO C Extension Library ## Copyright (C) 2001-2011 European Southern Observatory ## 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA AUTOMAKE_OPTIONS = 1.8 foreign ACLOCAL_AMFLAGS = -I m4 DISTCLEANFILES = *~ SUBDIRS = cext tests DOXYGEN_SUBDIRS = EXTRA_DIST = BUGS Doxyfile.in m4/eso.m4 m4/purify.m4 admin/doxygen.am if MAINTAINER_MODE MAINTAINERCLEANFILES = $(top_srcdir)/Makefile.in $(top_srcdir)/aclocal.m4 \ $(top_srcdir)/config.h.in $(top_srcdir)/configure config.log \ config.status clean-local: clean-doxygen dist-hook: doxygen @if test -d $(top_builddir)/html; then \ echo "cp -pr $(top_builddir)/html $(distdir)"; \ cp -pr $(top_builddir)/html $(distdir); \ fi find $(distdir) -type d ! -perm -222 -exec chmod u+w {} \; -o \ -type f ! -perm -222 -exec chmod u+w {} \; || chmod -R u+w $(distdir) else clean-local: endif uninstall-local: uninstall-doxygen include $(top_srcdir)/admin/doxygen.am cpl-6.4.1/libcext/config.h.in0000644000460300003120000001654012310332712012667 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Width of type 'char' */ #undef CHAR_BIT /* Log domain internally used by the library */ #undef CX_LOG_DOMAIN /* Define if thread support is enabled. */ #undef CX_THREADS_ENABLED /* A `va_copy()' style function */ #undef CX_VA_COPY /* Define if you have the `asprintf' function */ #undef HAVE_ASPRINTF /* Define if CHAR_BIT is defined in limits.h and equals 8 */ #undef HAVE_CHAR_BIT /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define if you have the `fpathconf' function */ #undef HAVE_FPATHCONF /* Define to 1 if the system has the type `intmax_t'. */ #undef HAVE_INTMAX_T /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the `localeconv' function. */ #undef HAVE_LOCALECONV /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H /* Define to 1 if the system has the type `long double'. */ #undef HAVE_LONG_DOUBLE /* Define to 1 if the system has the type `long long int'. */ #undef HAVE_LONG_LONG_INT /* Define to 1 if `lstat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_LSTAT_EMPTY_STRING_BUG /* Define to 1 if you have the `memcpy' function. */ #undef HAVE_MEMCPY /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define if you have the `pathconf' function */ #undef HAVE_PATHCONF /* Define if printf default precision for format `g' is 1 (ISO C standard) or 6 */ #undef HAVE_PRINTF_FLT_FMT_G_STD /* Define if printf format `%p' produces the same output as `%#x' or `%#lx' */ #undef HAVE_PRINTF_PTR_FMT_ALTERNATE /* Define if printf outputs `(nil)' when printing NULL using `%p' */ #undef HAVE_PRINTF_PTR_FMT_NIL /* Define if printf treats pointers as signed when using a sign flag */ #undef HAVE_PRINTF_PTR_FMT_SIGNED /* Define if printf outputs `(null)' when printing NULL using `%s' */ #undef HAVE_PRINTF_STR_FMT_NULL /* Define to 1 if you have . */ #undef HAVE_PTHREAD_H /* Define to 1 if the system has the type `ptrdiff_t'. */ #undef HAVE_PTRDIFF_T /* Define if you have the `snprintf' function */ #undef HAVE_SNPRINTF /* Define to 1 if you have the `sprintf' function. */ #undef HAVE_SPRINTF /* Define to 1 if `stat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_STAT_EMPTY_STRING_BUG /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define if you have the `stpcpy' function */ #undef HAVE_STPCPY /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define if you have the `strdup' function */ #undef HAVE_STRDUP /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if `decimal_point' is a member of `struct lconv'. */ #undef HAVE_STRUCT_LCONV_DECIMAL_POINT /* Define to 1 if `thousands_sep' is a member of `struct lconv'. */ #undef HAVE_STRUCT_LCONV_THOUSANDS_SEP /* Define if you have the `sysconf' function */ #undef HAVE_SYSCONF /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if the system has the type `uintmax_t'. */ #undef HAVE_UINTMAX_T /* Define to 1 if the system has the type `uintptr_t'. */ #undef HAVE_UINTPTR_T /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if the system has the type `unsigned long long int'. */ #undef HAVE_UNSIGNED_LONG_LONG_INT /* Define to 1 if you have the header file. */ #undef HAVE_VALUES_H /* Define if you have the `vasprintf' function */ #undef HAVE_VASPRINTF /* Define if you have an implementation of `va_copy()'. */ #undef HAVE_VA_COPY /* Define if you have an implementation of a `va_copy()' style function. */ #undef HAVE_VA_COPY_STYLE_FUNCTION /* Define if `va_lists' can be copied by value */ #undef HAVE_VA_LIST_COPY_BY_VALUE /* Define if you have the `vsnprintf' function */ #undef HAVE_VSNPRINTF /* Define if you have the C99 `vsnprintf' function. */ #undef HAVE_VSNPRINTF_C99 /* Define if realloc(NULL,) works */ #undef HAVE_WORKING_REALLOC /* Define if you have an implementation of `__va_copy()'. */ #undef HAVE___VA_COPY /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* The size of `char', as computed by sizeof. */ #undef SIZEOF_CHAR /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* The size of `size_t', as computed by sizeof. */ #undef SIZEOF_SIZE_T /* The size of `void *', as computed by sizeof. */ #undef SIZEOF_VOID_P /* Define to 1 if the `S_IS*' macros in do not work properly. */ #undef STAT_MACROS_BROKEN /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to the widest signed integer type if and do not define. */ #undef intmax_t /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to the widest unsigned integer type if and do not define. */ #undef uintmax_t /* Define to the type of an unsigned integer type wide enough to hold a pointer, if such a type exists, and if the system does not define it. */ #undef uintptr_t #ifndef HAVE_STRDUP # define strdup cx_strdup #endif cpl-6.4.1/libcext/configure0000744000460300003120000201561212310332711012551 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for C Extension Library 1.1.2. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and cpl-help@eso.org $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='C Extension Library' PACKAGE_TARNAME='cext' PACKAGE_VERSION='1.1.2' PACKAGE_STRING='C Extension Library 1.1.2' PACKAGE_BUGREPORT='cpl-help@eso.org' PACKAGE_URL='' ac_unique_file="Makefile.am" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS CEXT_INCLUDES configdir apidocdir SNPRINTF LIBOBJS LIBPTHREAD PTHREAD_CFLAGS LIBTOOL_DEPS CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL USE_PURIFY_FALSE USE_PURIFY_TRUE PURIFY LATEX DOXYGEN EGREP GREP CX_DEBUG_FLAGS ESO_DEBUG_FLAGS am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC LT_AGE LT_REVISION LT_CURRENT MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_dependency_tracking enable_debug enable_strict enable_purify enable_static enable_shared with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock enable_threads enable_largefile ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS DOXYGEN LATEX PURIFY CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures C Extension Library 1.1.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/cext] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of C Extension Library 1.1.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-debug creates debugging code [[default=no]] --enable-strict compiles with strict compiler options (may not work!) [[default=no]] --disable-purify disables the check for the Purify installation --enable-static[=PKGS] build static libraries [default=yes] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-threads enables thread support [[default=yes]] --disable-largefile omit support for large files Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory DOXYGEN doxygen command LATEX latex command PURIFY Purify command CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF C Extension Library configure 1.1.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ------------------------------- ## ## Report this to cpl-help@eso.org ## ## ------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 &5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by C Extension Library $as_me 1.1.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in admin "$srcdir"/admin; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in admin \"$srcdir\"/admin" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ac_config_headers="$ac_config_headers config.h" am__api_version='1.13' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='cext' VERSION='1.1.2' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE # Immediately before every release do: #------------------------------------- # if (the interface is totally unchanged from previous release) # REVISION++; # else { # /* interfaces have been added, removed or changed */ # REVISION = 0; # CURRENT++; # if (any interfaces have been _added_ since last release) # AGE++; # if (any interfaces have been _removed_ or incompatibly changed) # AGE = 0; # } # # Order of arguments: CURRENT, REVISION, AGE if test -z "1"; then LT_CURRENT=0 else LT_CURRENT="1" fi if test -z "1"; then LT_REVISION=0 else LT_REVISION="1" fi if test -z "1"; then LT_AGE=0 else LT_AGE="1" fi # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi if test "x$CC" != xcc; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi flag=`echo fno-builtin | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-builtin" >&5 $as_echo_n "checking whether $CC supports -fno-builtin... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -fno-builtin -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -fno-builtin -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -fno-builtin" else : fi flag=`echo fno-common | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-common" >&5 $as_echo_n "checking whether $CC supports -fno-common... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -fno-common -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -fno-common -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -fno-common" else : fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; eso_enable_debug=$enableval else eso_enable_debug=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether debugging code should be created" >&5 $as_echo_n "checking whether debugging code should be created... " >&6; } if ${eso_cv_enable_debug+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_enable_debug=$eso_enable_debug fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_enable_debug" >&5 $as_echo "$eso_cv_enable_debug" >&6; } if test x"$eso_cv_enable_debug" = xyes; then eso_clean_CFLAGS="`echo $CFLAGS | sed -e 's/-O[0-9]//g' \ -e 's/-g[0-9]//g' \ -e 's/-g[a-z,A-Z]* / /g' \ -e 's/-[Og]//g'`" flag=`echo g3 | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -g3" >&5 $as_echo_n "checking whether $CC supports -g3... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -g3 -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -g3 -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -g3" else : fi if test x"$eso_cv_prog_cc_g3" = xyes; then CFLAGS="-g3" else if test x"$ac_cv_prog_cc_g" = xyes; then CFLAGS="-g" else CFLAGS="" fi fi flag=`echo ggdb | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -ggdb" >&5 $as_echo_n "checking whether $CC supports -ggdb... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -ggdb -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -ggdb -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -ggdb" else : fi flag=`echo O0 | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O0" >&5 $as_echo_n "checking whether $CC supports -O0... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -O0 -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -O0 -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -O0" else : fi flag=`echo rdynamic | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -rdynamic" >&5 $as_echo_n "checking whether $CC supports -rdynamic... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -rdynamic -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -rdynamic -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -rdynamic" else : fi flag=`echo Wall | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5 $as_echo_n "checking whether $CC supports -Wall... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -Wall -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -Wall -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -Wall" else : fi flag=`echo W | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -W" >&5 $as_echo_n "checking whether $CC supports -W... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -W -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -W -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -W" else : fi CFLAGS="$CFLAGS $eso_clean_CFLAGS" ESO_DEBUG_FLAGS="-DESO_ENABLE_DEBUG" else ESO_DEBUG_FLAGS="-DNDEBUG" fi if test x"$eso_cv_enable_debug" != xno; then CX_DEBUG_FLAGS="-DCX_ENABLE_DEBUG" else CX_DEBUG_FLAGS="-DCX_DISABLE_ASSERT" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" # Check whether --enable-strict was given. if test "${enable_strict+set}" = set; then : enableval=$enable_strict; eso_enable_strict=$enableval else eso_enable_strict=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strict compiler options should be used" >&5 $as_echo_n "checking whether strict compiler options should be used... " >&6; } if ${eso_cv_enable_strict+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_enable_strict=$eso_enable_strict fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_enable_strict" >&5 $as_echo "$eso_cv_enable_strict" >&6; } if test x"$eso_cv_enable_strict" = xyes; then eso_enable_strict_std_set=no if test -n "$CFLAGS"; then echo $CFLAGS | $EGREP '(\-std=|-ansi)' >/dev/null 2>&1 if test x"$?" = x0; then eso_enable_strict_std_set=yes fi fi if test x"$eso_enable_strict_std_set" = xno; then flag=`echo std=c99 | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 $as_echo_n "checking whether $CC supports -std=c99... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -std=c99 -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -std=c99 -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -std=c99" else : fi fi flag=`echo pedantic | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -pedantic" >&5 $as_echo_n "checking whether $CC supports -pedantic... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -pedantic -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -pedantic -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -pedantic" else : fi fi # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DOXYGEN+:} false; then : $as_echo_n "(cached) " >&6 else case $DOXYGEN in [\\/]* | ?:[\\/]*) ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DOXYGEN="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DOXYGEN=$ac_cv_path_DOXYGEN if test -n "$DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5 $as_echo "$DOXYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "latex", so it can be a program name with args. set dummy latex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LATEX+:} false; then : $as_echo_n "(cached) " >&6 else case $LATEX in [\\/]* | ?:[\\/]*) ac_cv_path_LATEX="$LATEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LATEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi LATEX=$ac_cv_path_LATEX if test -n "$LATEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LATEX" >&5 $as_echo "$LATEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "${DOXYGEN}"; then DOXYGEN=":" fi if test -z "${LATEX}"; then LATEX=":" fi # Check whether --enable-purify was given. if test "${enable_purify+set}" = set; then : enableval=$enable_purify; enable_purify=$enableval else enable_purify=yes fi if test x"$enable_purify" = xyes ; then # Extract the first word of "purify", so it can be a program name with args. set dummy purify; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PURIFY+:} false; then : $as_echo_n "(cached) " >&6 else case $PURIFY in [\\/]* | ?:[\\/]*) ac_cv_path_PURIFY="$PURIFY" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PURIFY="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PURIFY=$ac_cv_path_PURIFY if test -n "$PURIFY"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PURIFY" >&5 $as_echo "$PURIFY" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "${PURIFY}"; then enable_purify=no PURIFY=":" fi fi if test "x$enable_purify" = "xyes"; then USE_PURIFY_TRUE= USE_PURIFY_FALSE='#' else USE_PURIFY_TRUE='#' USE_PURIFY_FALSE= fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: # Check whether --enable-threads was given. if test "${enable_threads+set}" = set; then : enableval=$enable_threads; cext_enable_threads=$enableval else cext_enable_threads=yes fi if test x"$cext_enable_threads" = xyes; then flag=`echo pthread | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -pthread" >&5 $as_echo_n "checking whether $CC supports -pthread... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -pthread -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -pthread -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : else : fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : eso_threads_have_libpthread=yes else eso_threads_have_libpthread=no fi ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes; then : eso_threads_have_pthread_h=yes else eso_threads_have_pthread_h=no fi if test x"$eso_threads_have_pthread_h" != xyes; then eso_threads_posix=no else if test x"$eso_threads_have_libpthread" != xyes && \ test x"$eso_cv_prog_cc_pthread" != xyes; then eso_threads_posix=no else eso_threads_posix=yes fi fi # Setup the POSIX thread symbols if test x"$eso_threads_have_pthread_h" = xyes; then $as_echo "#define HAVE_PTHREAD_H 1" >>confdefs.h fi if test x"$eso_threads_posix" = xyes; then if test x"$eso_cv_prog_cc_pthread" = xyes; then PTHREAD_CFLAGS="-pthread" else PTHREAD_CFLAGS="" fi if test x"$eso_threads_have_libpthread" = xyes; then LIBPTHREAD="-lpthread" else LIBPTHREAD="" fi fi if ${eso_cv_threads_posix_header+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_threads_posix_header=$eso_threads_have_pthread_h fi if ${eso_cv_threads_posix_lib+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_threads_posix_lib=$eso_threads_have_libpthread fi if ${eso_cv_threads_posix_flags+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_threads_posix_flags=$eso_cv_prog_cc_pthread fi if ${eso_cv_threads_posix+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_threads_posix=$eso_threads_posix fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads are available" >&5 $as_echo_n "checking whether POSIX threads are available... " >&6; } if test x"$eso_cv_threads_posix" = xno; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } else CFLAGS="$CFLAGS -D_REENTRANT" cat >>confdefs.h <<_ACEOF #define CX_THREADS_ENABLED 1 _ACEOF if test x"$eso_cv_threads_posix_lib" = xyes; then echo $LIBS | grep -q -e "$LIBPTHREAD" || LIBS="$LIBPTHREAD $LIBS" else CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi fi # Checks for header files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in stddef.h stdint.h stdarg.h inttypes.h \ float.h limits.h locale.h values.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 $as_echo_n "checking whether stat file-mode macros are broken... " >&6; } if ${ac_cv_header_stat_broken+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if defined S_ISBLK && defined S_IFDIR extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; #endif #if defined S_ISBLK && defined S_IFCHR extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; #endif #if defined S_ISLNK && defined S_IFREG extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; #endif #if defined S_ISSOCK && defined S_IFREG extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stat_broken=no else ac_cv_header_stat_broken=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 $as_echo "$ac_cv_header_stat_broken" >&6; } if test $ac_cv_header_stat_broken = yes; then $as_echo "#define STAT_MACROS_BROKEN 1" >>confdefs.h fi # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports __attribute__(( visibility(\"hidden\") ))" >&5 $as_echo_n "checking if $CC supports __attribute__(( visibility(\"hidden\") ))... " >&6; } if ${eso_cv_prog_cc_attribute_visibility_hidden+:} false; then : $as_echo_n "(cached) " >&6 else eso_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ void __attribute__((visibility("hidden"))) hidden_function() { } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "eso_cv_prog_cc_attribute_visibility_hidden='yes'" else eval "eso_cv_prog_cc_attribute_visibility_hidden='no'" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$eso_save_CFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_prog_cc_attribute_visibility_hidden" >&5 $as_echo "$eso_cv_prog_cc_attribute_visibility_hidden" >&6; } if eval "test x\$eso_cv_prog_cc_attribute_visibility_hidden = xyes"; then : else : fi ac_fn_c_check_type "$LINENO" "long long int" "ac_cv_type_long_long_int" "$ac_includes_default" if test "x$ac_cv_type_long_long_int" = xyes; then : fi if test x"$ac_cv_type_long_long_int" = xyes; then $as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "unsigned long long int" "ac_cv_type_unsigned_long_long_int" "$ac_includes_default" if test "x$ac_cv_type_unsigned_long_long_int" = xyes; then : fi if test x"$ac_cv_type_unsigned_long_long_int" = xyes; then $as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "intmax_t" "ac_cv_type_intmax_t" "$ac_includes_default" if test "x$ac_cv_type_intmax_t" = xyes; then : $as_echo "#define HAVE_INTMAX_T 1" >>confdefs.h else test $ac_cv_type_long_long_int = yes \ && ac_type='long long int' \ || ac_type='long int' cat >>confdefs.h <<_ACEOF #define intmax_t $ac_type _ACEOF fi ac_fn_c_check_type "$LINENO" "uintmax_t" "ac_cv_type_uintmax_t" "$ac_includes_default" if test "x$ac_cv_type_uintmax_t" = xyes; then : $as_echo "#define HAVE_UINTMAX_T 1" >>confdefs.h else test $ac_cv_type_long_long_int = yes \ && ac_type='unsigned long long int' \ || ac_type='unsigned long int' cat >>confdefs.h <<_ACEOF #define uintmax_t $ac_type _ACEOF fi ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default" if test "x$ac_cv_type_uintptr_t" = xyes; then : $as_echo "#define HAVE_UINTPTR_T 1" >>confdefs.h else for ac_type in 'unsigned int' 'unsigned long int' \ 'unsigned long long int'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat >>confdefs.h <<_ACEOF #define uintptr_t $ac_type _ACEOF ac_type= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test -z "$ac_type" && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double" >&5 $as_echo_n "checking for long double... " >&6; } if ${ac_cv_type_long_double+:} false; then : $as_echo_n "(cached) " >&6 else if test "$GCC" = yes; then ac_cv_type_long_double=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* The Stardent Vistra knows sizeof (long double), but does not support it. */ long double foo = 0.0L; int main () { static int test_array [1 - 2 * !(/* On Ultrix 4.3 cc, long double is 4 and double is 8. */ sizeof (double) <= sizeof (long double))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_long_double=yes else ac_cv_type_long_double=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_double" >&5 $as_echo "$ac_cv_type_long_double" >&6; } if test $ac_cv_type_long_double = yes; then $as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi if test x"$ac_cv_header_stdint_h" = xyes; then ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "#include " if test "x$ac_cv_type_int8_t" = xyes; then : fi ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "#include " if test "x$ac_cv_type_int16_t" = xyes; then : fi ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "#include " if test "x$ac_cv_type_int32_t" = xyes; then : fi ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "#include " if test "x$ac_cv_type_int64_t" = xyes; then : fi fi ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" if test "x$ac_cv_type_ptrdiff_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTRDIFF_T 1 _ACEOF fi cext_have_char_bit=no cext_have_char_8_bits=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bits per char" >&5 $as_echo_n "checking for bits per char... " >&6; } if ${cext_cv_have_char_8_bits+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cext_cppflags_save="$CPPFLAGS" cext_cflags_save="$CFLAGS" cext_ldflags_save="$LDFLAGS" cext_libs_save="$LIBS" if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -pedantic-errors" CPPFLAGS="$CPPFLAGS $CFLAGS" fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int i = CHAR_BIT; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cext_have_char_bit=yes else cext_have_char_bit=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "x$cext_have_char_bit" = "xyes"; then if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main() { if (CHAR_BIT != 8) return 1; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : cext_have_char_8_bits=yes else cext_have_char_8_bits=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main() { char c = 1; int i = 0; while (c) { c <<= 1; i++; } if (i != 8) return 1; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : cext_have_char_8_bits=yes else cext_have_char_8_bits=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi CPPFLAGS="$cext_cppflags_save" CFLAGS="$cext_cflags_save" LDFLAGS="$cext_ldflags_save" LIBS="$cext_libs_save" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cext_cv_have_char_8_bits="cext_have_char_bit=$cext_have_char_bit \ cext_have_char_8_bits=$cext_have_char_8_bits" fi eval "$cext_cv_have_char_8_bits" if test "$cext_have_char_8_bits" = "no"; then as_fn_error $? "C type char is not 8 bits wide!" "$LINENO" 5 else if test x"$cext_have_char_bit" = xno; then $as_echo "#define CHAR_BIT 8" >>confdefs.h else $as_echo "#define HAVE_CHAR_BIT 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: 8" >&5 $as_echo "8" >&6; } fi if test x$cext_have_char_8_bits != xyes; then as_fn_error $? "cext requires the type char to be 8 bits wide." "$LINENO" 5 fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5 $as_echo_n "checking size of char... " >&6; } if ${ac_cv_sizeof_char+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char" "$ac_includes_default"; then : else if test "$ac_cv_type_char" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (char) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_char=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char" >&5 $as_echo "$ac_cv_sizeof_char" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_CHAR $ac_cv_sizeof_char _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } if ${ac_cv_sizeof_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : else if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_short=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 $as_echo "$ac_cv_sizeof_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : else if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 $as_echo "$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } if ${ac_cv_sizeof_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 $as_echo "$ac_cv_sizeof_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 $as_echo_n "checking size of size_t... " >&6; } if ${ac_cv_sizeof_size_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : else if test "$ac_cv_type_size_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (size_t) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_size_t=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5 $as_echo "$ac_cv_sizeof_size_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SIZE_T $ac_cv_sizeof_size_t _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 $as_echo_n "checking size of void *... " >&6; } if ${ac_cv_sizeof_void_p+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : else if test "$ac_cv_type_void_p" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void *) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_void_p=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 $as_echo "$ac_cv_sizeof_void_p" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_VOID_P $ac_cv_sizeof_void_p _ACEOF if test x"$ac_cv_type_int64_t" = xno && test x"$ac_cv_sizeof_long" != x8 && test x"$ac_cv_sizeof_long_long" != x8; then as_fn_error $? "A 64 bit integer type is required. Consider using the GNU C compiler" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an integer type with the same size as size_t" >&5 $as_echo_n "checking for an integer type with the same size as size_t... " >&6; } case $ac_cv_sizeof_size_t in $ac_cv_sizeof_short) cext_size_type='short' ;; $ac_cv_sizeof_int) cext_size_type='int' ;; $ac_cv_sizeof_long) cext_size_type='long' ;; $ac_cv_sizeof_long_long) cext_size_type='long long' ;; *) as_fn_error $? "No integer type matches size_t in size" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cext_size_type" >&5 $as_echo "$cext_size_type" >&6; } if ${cext_cv_type_size_type+:} false; then : $as_echo_n "(cached) " >&6 else cext_cv_type_size_type=$cext_size_type fi ac_fn_c_check_member "$LINENO" "struct lconv" "decimal_point" "ac_cv_member_struct_lconv_decimal_point" "#include " if test "x$ac_cv_member_struct_lconv_decimal_point" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_LCONV_DECIMAL_POINT 1 _ACEOF fi ac_fn_c_check_member "$LINENO" "struct lconv" "thousands_sep" "ac_cv_member_struct_lconv_thousands_sep" "#include " if test "x$ac_cv_member_struct_lconv_thousands_sep" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_LCONV_THOUSANDS_SEP 1 _ACEOF fi # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi # Checks for library functions. for ac_func in strchr memcpy sprintf localeconv do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then : ac_cv_func_lstat_dereferences_slashed_symlink=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail, as required by POSIX. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_lstat_dereferences_slashed_symlink=yes else ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat accepts an empty string" >&5 $as_echo_n "checking whether lstat accepts an empty string... " >&6; } if ${ac_cv_func_lstat_empty_string_bug+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_lstat_empty_string_bug=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return lstat ("", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_lstat_empty_string_bug=no else ac_cv_func_lstat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_empty_string_bug" >&5 $as_echo "$ac_cv_func_lstat_empty_string_bug" >&6; } if test $ac_cv_func_lstat_empty_string_bug = yes; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_LSTAT_EMPTY_STRING_BUG 1 _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 $as_echo_n "checking whether stat accepts an empty string... " >&6; } if ${ac_cv_func_stat_empty_string_bug+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_stat_empty_string_bug=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return stat ("", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_stat_empty_string_bug=no else ac_cv_func_stat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 $as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 _ACEOF fi # Check for all three va_copy possibilities, so we get # all results in config.log for bug reports. # Check for availability of va_copy(). This is ISO C. Available with # gcc since version 3.0. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an implementation of va_copy()" >&5 $as_echo_n "checking for an implementation of va_copy()... " >&6; } if ${eso_cv_have_va_copy+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : eso_cv_have_va_copy=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_STDARG_H #include #endif void f(int i, ...) { va_list args1, args2; va_start (args1, i); va_copy (args2, args1); if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) exit (1); va_end (args1); va_end (args2); } int main () { f(0, 42); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : eso_cv_have_va_copy=yes else eso_cv_have_va_copy=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_have_va_copy" >&5 $as_echo "$eso_cv_have_va_copy" >&6; } # Check for availability of __va_copy(). Some compilers provide # this. Available with gcc since version 2.8.1. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an implementation of __va_copy()" >&5 $as_echo_n "checking for an implementation of __va_copy()... " >&6; } if ${eso_cv_have__va_copy+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : eso_cv_have__va_copy=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_STDARG_H #include #endif void f(int i, ...) { va_list args1, args2; va_start (args1, i); __va_copy (args2, args1); if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) exit (1); va_end (args1); va_end (args2); } int main () { f(0, 42); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : eso_cv_have__va_copy=yes else eso_cv_have__va_copy=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_have__va_copy" >&5 $as_echo "$eso_cv_have__va_copy" >&6; } if test "x$eso_cv_have_va_copy" = "xyes"; then eso_func_va_copy=va_copy $as_echo "#define HAVE_VA_COPY 1" >>confdefs.h else if test "x$eso_cv_have__va_copy" = "xyes"; then eso_func_va_copy=__va_copy $as_echo "#define HAVE___VA_COPY 1" >>confdefs.h fi fi if test -n "$eso_func_va_copy"; then cat >>confdefs.h <<_ACEOF #define CX_VA_COPY $eso_func_va_copy _ACEOF $as_echo "#define HAVE_VA_COPY_STYLE_FUNCTION 1" >>confdefs.h fi # Check whether va_lists can be copied by value { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether va_lists can be copied by value" >&5 $as_echo_n "checking whether va_lists can be copied by value... " >&6; } if ${eso_cv_have_va_value_copy+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : eso_cv_have_va_value_copy=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_STDARG_H #include #endif void f(int i, ...) { va_list args1, args2; va_start (args1, i); args2 = args1; if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) exit (1); va_end (args1); va_end (args2); } int main () { f(0, 42); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : eso_cv_have_va_value_copy=yes else eso_cv_have_va_value_copy=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_have_va_value_copy" >&5 $as_echo "$eso_cv_have_va_value_copy" >&6; } if test "x$eso_cv_have_va_value_copy" = "xyes"; then $as_echo "#define HAVE_VA_LIST_COPY_BY_VALUE 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether realloc(NULL,) works" >&5 $as_echo_n "checking whether realloc(NULL,) works... " >&6; } if ${eso_cv_have_sane_realloc+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : eso_cv_have_sane_realloc=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { return realloc (0, sizeof (int)) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : eso_cv_have_sane_realloc=yes else eso_cv_have_sane_realloc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_have_sane_realloc" >&5 $as_echo "$eso_cv_have_sane_realloc" >&6; } if test x$eso_cv_have_sane_realloc = xyes; then $as_echo "#define HAVE_WORKING_REALLOC 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_decl "$LINENO" "strdup" "ac_cv_have_decl_strdup" "#include " if test "x$ac_cv_have_decl_strdup" = xyes; then : fi eso_save_CFLAGS="$CFLAGS" if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -pedantic-errors" fi ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" if test "x$ac_cv_func_strdup" = xyes; then : fi CFLAGS="$eso_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$ac_cv_have_decl_strdup" = xyes && test x"$ac_cv_func_strdup" = xyes; then $as_echo "#define HAVE_STRDUP 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_decl "$LINENO" "stpcpy" "ac_cv_have_decl_stpcpy" "#include " if test "x$ac_cv_have_decl_stpcpy" = xyes; then : fi eso_save_CFLAGS="$CFLAGS" if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -pedantic-errors" fi ac_fn_c_check_func "$LINENO" "stpcpy" "ac_cv_func_stpcpy" if test "x$ac_cv_func_stpcpy" = xyes; then : fi CFLAGS="$eso_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$ac_cv_have_decl_stpcpy" = xyes && test x"$ac_cv_func_stpcpy" = xyes; then $as_echo "#define HAVE_STPCPY 1" >>confdefs.h fi eso_compile_snprintf=no ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" " #include #include " if test "x$ac_cv_have_decl_vsnprintf" = xyes; then : fi eso_save_CFLAGS="$CFLAGS" if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -pedantic-errors" fi ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" if test "x$ac_cv_func_vsnprintf" = xyes; then : fi CFLAGS="$eso_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$ac_cv_have_decl_vsnprintf" = xyes && test x"$ac_cv_func_vsnprintf" = xyes; then $as_echo "#define HAVE_VSNPRINTF 1" >>confdefs.h fi if test x$ac_cv_func_vsnprintf = xyes && test x$ac_cv_have_decl_vsnprintf = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vsnprintf has C99 semantics" >&5 $as_echo_n "checking whether vsnprintf has C99 semantics... " >&6; } if ${eso_cv_func_vsnprintf_c99+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu eso_cppflags_save="$CPPFLAGS" eso_cflags_save="$CFLAGS" eso_ldflags_save="$LDFLAGS" eso_libs_save="$LIBS" if test x$GCC = xyes; then CFLAGS="$CFLAGS -pedantic-errors" CPPFLAGS="$CPPFLAGS $CFLAGS" fi if test "$cross_compiling" = yes; then : eso_cv_func_vsnprintf_c99=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int doit(char * s, ...) { char buffer[32]; va_list args; int q, r; va_start(args, s); q = vsnprintf(NULL, 0, s, args); r = vsnprintf(buffer, 5, s, args); va_end(args); if (q != 7 || r != 7) exit(1); exit(0); } int main () { doit((char*)"1234567"); exit(1); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : eso_cv_func_vsnprintf_c99=yes else eso_cv_func_vsnprintf_c99=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi CPPFLAGS="$eso_cppflags_save" CFLAGS="$eso_cflags_save" LDFLAGS="$eso_ldflags_save" LIBS="$eso_libs_save" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_func_vsnprintf_c99" >&5 $as_echo "$eso_cv_func_vsnprintf_c99" >&6; } # Note that the default is to be pessimistic in the case of cross compilation. # If you know that the target has a C99 vsnprintf(), you can get around this # by setting eso_func_vsnprintf_c99 to yes, as described in the Autoconf # manual. if test x$eso_cv_func_vsnprintf_c99 = xyes; then $as_echo "#define HAVE_VSNPRINTF_C99 1" >>confdefs.h fi if test x$eso_cv_func_vsnprintf_c99 != xyes; then eso_compile_snprintf=yes fi else eso_compile_snprintf=yes fi if test x$eso_compile_snprintf = xyes; then if test -n "$LIBTOOL"; then SNPRINTF=snprintf.lo else SNPRINTF=snprintf.$ac_objext fi fi # The symbols defined by the following macro are only needed to setup the # vsnprintf() replacement. May be useless if the vsnprintf implementation # changes. # Check if string format for NULL is `(null)' if test "$cross_compiling" = yes; then : eso_have_printf_str_format_null=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { char s[128]; sprintf(s, "%s", NULL); return strncmp(s, "(null)", 6) ? 1 : 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : eso_have_printf_str_format_null=yes else eso_have_printf_str_format_null=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test x$eso_have_printf_str_format_null = xyes; then $as_echo "#define HAVE_PRINTF_STR_FMT_NULL 1" >>confdefs.h fi # Check if pointer format for NULL is `(nil)' if test "$cross_compiling" = yes; then : eso_have_printf_ptr_format_nil=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { char s[128]; sprintf(s, "%p", NULL); return strncmp(s, "(nil)", 5) ? 1 : 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : eso_have_printf_ptr_format_nil=yes else eso_have_printf_ptr_format_nil=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test x$eso_have_printf_ptr_format_nil = xyes; then $as_echo "#define HAVE_PRINTF_PTR_FMT_NIL 1" >>confdefs.h fi # Check if output for `%p' is the same as `%#x' if test "$cross_compiling" = yes; then : eso_have_printf_ptr_format_alternate=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { char s1[128], s2[128]; sprintf(s1, "%p", s1); sprintf(s2, "%#x", s1); return strncmp(s1, s2, 3) ? 1 : 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : eso_have_printf_ptr_format_alternate=yes else eso_have_printf_ptr_format_alternate=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test x$eso_have_printf_ptr_format_alternate = xyes; then $as_echo "#define HAVE_PRINTF_PTR_FMT_ALTERNATE 1" >>confdefs.h fi # Check if pointers are treated as signed if test "$cross_compiling" = yes; then : eso_have_printf_ptr_format_signed=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char s[128]; sprintf(s, "%+p", s); return s[0] == '+' ? 0 : 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : eso_have_printf_ptr_format_signed=yes else eso_have_printf_ptr_format_signed=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test x$eso_have_printf_ptr_format_signed = xyes; then $as_echo "#define HAVE_PRINTF_PTR_FMT_SIGNED 1" >>confdefs.h fi # Check if default precision for conversion specifier `g' is 1 (as # required by ISO C) or 6. if test "$cross_compiling" = yes; then : eso_have_printf_flt_format_g_std=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char s1[128], s2[128]; int n1, n2; sprintf(s1, "%g%n", 1.123456, &n1); sprintf(s2, "%.1g%n", 1.123456, &n2); return n1 > n2 ? 1 : 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : eso_have_printf_flt_format_g_std=yes else eso_have_printf_flt_format_g_std=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test x$eso_have_printf_flt_format_g_std = xyes; then $as_echo "#define HAVE_PRINTF_FLT_FMT_G_STD 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "#include " if test "x$ac_cv_have_decl_snprintf" = xyes; then : fi eso_save_CFLAGS="$CFLAGS" if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -pedantic-errors" fi ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" if test "x$ac_cv_func_snprintf" = xyes; then : fi CFLAGS="$eso_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$ac_cv_have_decl_snprintf" = xyes && test x"$ac_cv_func_snprintf" = xyes; then $as_echo "#define HAVE_SNPRINTF 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_decl "$LINENO" "vasprintf" "ac_cv_have_decl_vasprintf" " #include #include " if test "x$ac_cv_have_decl_vasprintf" = xyes; then : fi eso_save_CFLAGS="$CFLAGS" if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -pedantic-errors" fi ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf" if test "x$ac_cv_func_vasprintf" = xyes; then : fi CFLAGS="$eso_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$ac_cv_have_decl_vasprintf" = xyes && test x"$ac_cv_func_vasprintf" = xyes; then $as_echo "#define HAVE_VASPRINTF 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_decl "$LINENO" "asprintf" "ac_cv_have_decl_asprintf" " #include " if test "x$ac_cv_have_decl_asprintf" = xyes; then : fi eso_save_CFLAGS="$CFLAGS" if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -pedantic-errors" fi ac_fn_c_check_func "$LINENO" "asprintf" "ac_cv_func_asprintf" if test "x$ac_cv_func_asprintf" = xyes; then : fi CFLAGS="$eso_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$ac_cv_have_decl_asprintf" = xyes && test x"$ac_cv_func_asprintf" = xyes; then $as_echo "#define HAVE_ASPRINTF 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_decl "$LINENO" "sysconf" "ac_cv_have_decl_sysconf" "#include " if test "x$ac_cv_have_decl_sysconf" = xyes; then : fi eso_save_CFLAGS="$CFLAGS" if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -pedantic-errors" fi ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf" if test "x$ac_cv_func_sysconf" = xyes; then : fi CFLAGS="$eso_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$ac_cv_have_decl_sysconf" = xyes && test x"$ac_cv_func_sysconf" = xyes; then $as_echo "#define HAVE_SYSCONF 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_decl "$LINENO" "fpathconf" "ac_cv_have_decl_fpathconf" "#include " if test "x$ac_cv_have_decl_fpathconf" = xyes; then : fi eso_save_CFLAGS="$CFLAGS" if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -pedantic-errors" fi ac_fn_c_check_func "$LINENO" "fpathconf" "ac_cv_func_fpathconf" if test "x$ac_cv_func_fpathconf" = xyes; then : fi CFLAGS="$eso_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$ac_cv_have_decl_fpathconf" = xyes && test x"$ac_cv_func_fpathconf" = xyes; then $as_echo "#define HAVE_FPATHCONF 1" >>confdefs.h fi # If we have fpathconf we should also have pathconf, but who knows. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_decl "$LINENO" "pathconf" "ac_cv_have_decl_pathconf" "#include " if test "x$ac_cv_have_decl_pathconf" = xyes; then : fi eso_save_CFLAGS="$CFLAGS" if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -pedantic-errors" fi ac_fn_c_check_func "$LINENO" "pathconf" "ac_cv_func_pathconf" if test "x$ac_cv_func_pathconf" = xyes; then : fi CFLAGS="$eso_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$ac_cv_have_decl_pathconf" = xyes && test x"$ac_cv_func_pathconf" = xyes; then $as_echo "#define HAVE_PATHCONF 1" >>confdefs.h fi if test -z "$apidocdir"; then apidocdir='${datadir}/doc/${PACKAGE}/html' fi if test -z "$pkgincludedir"; then pkgincludedir='${includedir}/cext' fi if test -z "$configdir"; then configdir='${includedir}' fi CEXT_INCLUDES='-I$(top_builddir)/cext -I$(top_srcdir)' ac_config_commands="$ac_config_commands cxconfig.h" # Library log domain $as_echo "#define CX_LOG_DOMAIN \"CxLib\"" >>confdefs.h ac_config_files="$ac_config_files Makefile Makefile.purify Doxyfile cext/Makefile tests/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_PURIFY_TRUE}" && test -z "${USE_PURIFY_FALSE}"; then as_fn_error $? "conditional \"USE_PURIFY\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by C Extension Library $as_me 1.1.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ C Extension Library config.status 1.1.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' # Supported compiler attributes if test x"$eso_cv_prog_cc_attribute_visibility_hidden" = xyes; then cext_have_gnuc_visibility=yes fi # Number of bits per char eval $cext_cv_have_char_8_bits if test x"$ac_cv_type_int8_t" = xyes; then cxint8=int8_t cxuint8=uint8_t cxint8_print_format='PRIi8' cxuint8_print_format='PRIu8' cxint8_scan_format='SCNi8' cxuint8_scan_format='SCNu8' else cxint8='signed char' cxuint8='unsigned char' cxint8_print_format='"hhi"' cxuint8_print_format='"hhu"' cxint8_scan_format='"hhi"' cxuint8_scan_format='"hhu"' fi # 16 bit integers if test x"$ac_cv_type_int16_t" = xyes; then cxint16=int16_t cxuint16=uint16_t cxint16_print_format='PRIi16' cxuint16_print_format='PRIu16' cxint16_scan_format='SCNi16' cxuint16_scan_format='SCNu16' else case 2 in $ac_cv_sizeof_short) cxint16='signed short' cxuint16='unsigned short' cxint16_print_format='"hi"' cxuint16_print_format='"hu"' cxint16_scan_format='"hi"' cxuint16_scan_format='"hu"' ;; $ac_cv_sizeof_int) cxint16='signed int' cxuint16='unsigned int' cxint16_print_format='"i"' cxuint16_print_format='"u"' cxint16_scan_format='"i"' cxuint16_scan_format='"u"' ;; esac fi # 32 bit integers if test x"$ac_cv_type_int32_t" = xyes; then cxint32=int32_t cxuint32=uint32_t cxint32_print_format='PRIi32' cxuint32_print_format='PRIu32' cxint32_scan_format='SCNi32' cxuint32_scan_format='SCNu32' else case 4 in $ac_cv_sizeof_short) cxint32='signed short' cxuint32='unsigned short' cxint32_print_format='"hi"' cxuint32_print_format='"hu"' cxint32_scan_format='"hi"' cxuint32_scan_format='"hu"' ;; $ac_cv_sizeof_int) cxint32='signed int' cxuint32='unsigned int' cxint32_print_format='"i"' cxuint32_print_format='"u"' cxint32_scan_format='"i"' cxuint32_scan_format='"u"' ;; $ac_cv_sizeof_long) cxint32='signed long' cxuint32='unsigned long' cxint32_print_format='"li"' cxuint32_print_format='"lu"' cxint32_scan_format='"li"' cxuint32_scan_format='"lu"' ;; esac fi # 64 bit integers if test x"$ac_cv_type_int64_t" = xyes; then cxint64=int64_t cxuint64=uint64_t cxint64_print_format='PRIi64' cxuint64_print_format='PRIu64' cxint64_scan_format='SCNi64' cxuint64_scan_format='SCNu64' case 8 in $ac_cv_sizeof_int) cxint64_constant='(val)' cxuint64_constant='(val)' ;; $ac_cv_sizeof_long) cxint64_constant='(val##L)' cxuint64_constant='(val##UL)' ;; $ac_cv_sizeof_long_long) cext_extension="CX_GNUC_EXTENSION " cxint64_constant='(CX_GNUC_EXTENSION (val##LL))' cxuint64_constant='(CX_GNUC_EXTENSION (val##ULL))' ;; esac else case 8 in $ac_cv_sizeof_int) cxint64='signed int' cxuint64='unsigned int' cxint64_print_format='"i"' cxuint64_print_format='"u"' cxint64_scan_format='"i"' cxuint64_scan_format='"u"' cext_extension="" cxint64_constant='(val)' cxuint64_constant='(val)' ;; $ac_cv_sizeof_long) cxint64='signed long' cxuint64='unsigned long' cxint64_print_format='"li"' cxuint64_print_format='"lu"' cxint64_scan_format='"li"' cxuint64_scan_format='"lu"' cext_extension="" cxint64_constant='(val##L)' cxuint64_constant='(val##UL)' ;; $ac_cv_sizeof_long_long) cxint64='signed long long' cxuint64='unsigned long long' if test -n "$cext_cv_format_long_long"; then cxint64_print_format='"'$cext_cv_format_long_long'i"' cxuint64_print_format='"'$cext_cv_format_long_long'u"' cxint64_scan_format='"'$cext_cv_format_long_long'i"' cxuint64_scan_format='"'$cext_cv_format_long_long'u"' fi cext_extension="CX_GNUC_EXTENSION " cxint64_constant='(CX_GNUC_EXTENSION (val##LL))' cxuint64_constant='(CX_GNUC_EXTENSION (val##ULL))' ;; esac fi # Sizes of types cext_size_t="$ac_cv_sizeof_size_t" cext_void_p="$ac_cv_sizeof_void_p" # Size type cext_size_type_define="$cext_cv_type_size_type" case $cext_cv_type_size_type in short) cxsize_print_format='"hu"' cxssize_print_format='"hi"' cxsize_scan_format='"hu"' cxssize_scan_format='"hi"' cext_msize_type='SHRT' ;; int) cxsize_print_format='"u"' cxssize_print_format='"i"' cxsize_scan_format='"u"' cxssize_scan_format='"i"' cext_msize_type='INT' ;; long) cxsize_print_format='"lu"' cxssize_print_format='"li"' cxsize_scan_format='"lu"' cxssize_scan_format='"li"' cext_msize_type='LONG' ;; "long long") cxsize_print_format='"'$cext_cv_format_long_long'u"' cxssize_print_format='"'$cext_cv_format_long_long'i"' cxsize_scan_format='"'$cext_cv_format_long_long'u"' cxssize_scan_format='"'$cext_cv_format_long_long'i"' cext_msize_type='INT64' ;; esac # Pointer integer conversions case $ac_cv_sizeof_void_p in $ac_cv_sizeof_int) cext_ptoi_cast='' cext_ptoui_cast='' ;; $ac_cv_sizeof_long) cext_ptoi_cast='(cxlong)' cext_ptoui_cast='(cxlong)' ;; $ac_cv_sizeof_long_long) cext_ptoi_cast='(cxint64)' cext_ptoui_cast='(cxint64)' ;; *) cext_unknown_void_p=yes ;; esac # Standard integer types if test x$ac_cv_header_stdint_h = xyes; then cext_have_stdint_h=yes fi if test x$ac_cv_header_inttypes_h = xyes; then cext_have_inttypes_h=yes fi # type limits case xyes in x$ac_cv_header_limits_h) cext_have_limits_h=yes cext_cxshort_min=SHRT_MIN cext_cxshort_max=SHRT_MAX cext_cxushort_max=USHRT_MAX cext_cxint_min=INT_MIN cext_cxint_max=INT_MAX cext_cxuint_max=UINT_MAX cext_cxlong_min=LONG_MIN cext_cxlong_max=LONG_MAX cext_cxulong_max=ULONG_MAX ;; x$ac_cv_header_values_h) cext_have_values_h=yes cext_cxshort_min=MINSHORT cext_cxshort_max=MAXSHORT cext_cxushort_max="(((cxushort)CX_MAXSHORT)*2+1)" cext_cxint_min=MININT cext_cxint_max=MAXINT cext_cxuint_max="(((cxuint)CX_MAXINT)*2+1)" cext_cxlong_min=MINLONG cext_cxlong_max=MAXLONG cext_cxulong_max="(((cxulong)CX_MAXLONG)*2+1)" ;; esac case xyes in x$ac_cv_header_float_h) cext_have_float_h=yes cext_cxfloat_min=FLT_MIN cext_cxfloat_max=FLT_MAX cext_cxdouble_min=DBL_MIN cext_cxdouble_max=DBL_MAX ;; x$ac_cv_header_values_h) cext_have_values_h=yes cext_cxfloat_min=MINFLOAT cext_cxfloat_max=MAXFLOAT cext_cxdouble_min=MINDOUBLE cext_cxdouble_max=MAXDOUBLE ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "cxconfig.h") CONFIG_COMMANDS="$CONFIG_COMMANDS cxconfig.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "Makefile.purify") CONFIG_FILES="$CONFIG_FILES Makefile.purify" ;; "Doxyfile") CONFIG_FILES="$CONFIG_FILES Doxyfile" ;; "cext/Makefile") CONFIG_FILES="$CONFIG_FILES cext/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; "cxconfig.h":C) cfgfile="cext/cxconfig.h" tcfgfile="$cfgfile-tmp" cat > $tcfgfile << _CEXTEOF /* * cxconfig.h: This is a generated file! Do not edit this file! * All changes will be lost! */ #ifndef CXCONFIG_H_ #define CXCONFIG_H_ _CEXTEOF if test x$cext_have_limits_h = xyes; then echo '#include ' >> $tcfgfile fi if test x$cext_have_float_h = xyes; then echo '#include ' >> $tcfgfile fi if test x$cext_have_values_h = xyes; then echo '#include ' >> $tcfgfile fi if test x$cext_have_stdint_h = xyes; then echo '#include ' >> $tcfgfile fi if test x$cext_have_inttypes_h = xyes; then echo '#include ' >> $tcfgfile fi cat >> $tcfgfile << _CEXTEOF #include CX_BEGIN_DECLS /* * Limits for numerical data types */ #define CX_MINSHORT $cext_cxshort_min #define CX_MAXSHORT $cext_cxshort_max #define CX_MAXUSHORT $cext_cxushort_max #define CX_MININT $cext_cxint_min #define CX_MAXINT $cext_cxint_max #define CX_MAXUINT $cext_cxuint_max #define CX_MINLONG $cext_cxlong_min #define CX_MAXLONG $cext_cxlong_max #define CX_MAXULONG $cext_cxulong_max #define CX_MINFLOAT $cext_cxfloat_min #define CX_MAXFLOAT $cext_cxfloat_max #define CX_MINDOUBLE $cext_cxdouble_min #define CX_MAXDOUBLE $cext_cxdouble_max _CEXTEOF # This should be true for any modern C/C++ compiler # In addition this has been verified before by # the CX_CHECK_CHAR_BITS() call. if test x"$cext_have_char_8_bits" = xyes; then cat >> $tcfgfile << _CEXTEOF /* * Number of bits per char */ #define CX_CHAR_BIT 8 _CEXTEOF else echo '#error "Type char is not 8 bits wide!"' >> $tcfgfile fi cat >> $tcfgfile << _CEXTEOF /* * Fixed size integer types */ _CEXTEOF cat >> $tcfgfile << _CEXTEOF /* Macros for formatted output */ #define CX_PRINTF_FORMAT_INT8 $cxint8_print_format #define CX_PRINTF_FORMAT_UINT8 $cxuint8_print_format #define CX_PRINTF_FORMAT_INT16 $cxint16_print_format #define CX_PRINTF_FORMAT_UINT16 $cxuint16_print_format #define CX_PRINTF_FORMAT_INT32 $cxint32_print_format #define CX_PRINTF_FORMAT_UINT32 $cxuint32_print_format #define CX_PRINTF_FORMAT_INT64 $cxint64_print_format #define CX_PRINTF_FORMAT_UINT64 $cxuint64_print_format /* Macros for formatted output */ #define CX_SCANF_FORMAT_INT8 $cxint8_scan_format #define CX_SCANF_FORMAT_UINT8 $cxuint8_scan_format #define CX_SCANF_FORMAT_INT16 $cxint16_scan_format #define CX_SCANF_FORMAT_UINT16 $cxuint16_scan_format #define CX_SCANF_FORMAT_INT32 $cxint32_scan_format #define CX_SCANF_FORMAT_UINT32 $cxuint32_scan_format #define CX_SCANF_FORMAT_INT64 $cxint64_scan_format #define CX_SCANF_FORMAT_UINT64 $cxuint64_scan_format _CEXTEOF if test -n "$cxint8"; then cat >> $tcfgfile << _CEXTEOF /* Type definitions */ typedef $cxint8 cxint8; typedef $cxuint8 cxuint8; _CEXTEOF fi if test -n "$cxint16"; then cat >> $tcfgfile << _CEXTEOF typedef $cxint16 cxint16; typedef $cxuint16 cxuint16; _CEXTEOF fi if test -n "$cxint32"; then cat >> $tcfgfile << _CEXTEOF typedef $cxint32 cxint32; typedef $cxuint32 cxuint32; _CEXTEOF fi if test -n "$cxint64"; then cat >> $tcfgfile << _CEXTEOF ${cext_extension} typedef $cxint64 cxint64; ${cext_extension} typedef $cxuint64 cxuint64; #define CX_INT64_CONSTANT(val) $cxint64_constant #define CX_UINT64_CONSTANT(val) $cxuint64_constant _CEXTEOF fi cat >> $tcfgfile << _CEXTEOF #define CX_SIZEOF_VOID_P $cext_void_p #define CX_SIZEOF_SIZE_T $cext_size_t _CEXTEOF cat >> $tcfgfile << _CEXTEOF /* * Size type */ #define CX_PRINTF_FORMAT_SIZE_TYPE $cxsize_print_format #define CX_PRINTF_FORMAT_SSIZE_TYPE $cxssize_print_format #define CX_SCANF_FORMAT_SIZE_TYPE $cxsize_scan_format #define CX_SCANF_FORMAT_SSIZE_TYPE $cxssize_scan_format typedef signed $cext_size_type_define cxssize; typedef unsigned $cext_size_type_define cxsize; #define CX_MINSSIZE CX_MIN$cext_msize_type #define CX_MAXSSIZE CX_MAX$cext_msize_type #define CX_MAXSIZE CX_MAXU$cext_msize_type typedef cxint64 cxoffset; #define CX_MINOFFSET CX_MININT64 #define CX_MAXOFFSET CX_MAXINT64 _CEXTEOF if test -z "$cext_unknown_void_p"; then cat >> $tcfgfile << _CEXTEOF /* * Pointer to integer conversion */ #define CX_POINTER_TO_INT(ptr) ((cxint) ${cext_ptoi_cast} (ptr)) #define CX_POINTER_TO_UINT(ptr) ((cxint) ${cext_ptoui_cast} (ptr)) #define CX_INT_TO_POINTER(val) ((cxptr) ${cext_ptoi_cast} (val)) #define CX_UINT_TO_POINTER(val) ((cxptr) ${cext_ptoui_cast} (val)) _CEXTEOF else echo '#error Size of generic pointer is unknown - This should never happen' >> $tcfgfile fi cat >> $tcfgfile << _CEXTEOF #ifdef __cplusplus # define CX_HAVE_INLINE 1 #else $cext_inline #endif #ifdef __cplusplus # define CX_CAN_INLINE 1 _CEXTEOF if test x"$cext_can_inline" = xyes; then cat >> $tcfgfile << _CEXTEOF #else # define CX_CAN_INLINE 1 _CEXTEOF fi cat >> $tcfgfile << _CEXTEOF #endif _CEXTEOF if test x"$cext_have_gnuc_visibility" = xyes; then cat >> $tcfgfile << _CEXTEOF #define CX_HAVE_GNUC_VISIBILITY 1 _CEXTEOF fi cat >> $tcfgfile << _CEXTEOF #if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) # define CX_GNUC_INTERNAL __attribute__((visibility("hidden"))) #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) # define CX_GNUC_INTERNAL __hidden #elif defined (__GNUC__) && defined (CX_HAVE_GNUC_VISIBILITY) # define CX_GNUC_INTERNAL __attribute__((visibility("hidden"))) #else # define CX_GNUC_INTERNAL /* empty */ #endif _CEXTEOF cat >> $tcfgfile << _CEXTEOF CX_END_DECLS #endif /* CXCONFIG_H_ */ _CEXTEOF if test -f $cfgfile; then if cmp -s $tcfgfile $cfgfile; then { $as_echo "$as_me:${as_lineno-$LINENO}: $cfgfile is unchanged" >&5 $as_echo "$as_me: $cfgfile is unchanged" >&6;} rm -f $tcfgfile else mv $tcfgfile $cfgfile fi else mv $tcfgfile $cfgfile fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cpl-6.4.1/libcext/configure.ac0000644000460300003120000000632312145111164013132 00000000000000# Process this file with autoconf to produce a configure script. AC_INIT([C Extension Library], [1.1.2], [cpl-help@eso.org], [cext]) AC_PREREQ([2.59]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_AUX_DIR([admin]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE AM_MAINTAINER_MODE # Immediately before every release do: #------------------------------------- # if (the interface is totally unchanged from previous release) # REVISION++; # else { # /* interfaces have been added, removed or changed */ # REVISION = 0; # CURRENT++; # if (any interfaces have been _added_ since last release) # AGE++; # if (any interfaces have been _removed_ or incompatibly changed) # AGE = 0; # } # # Order of arguments: CURRENT, REVISION, AGE ESO_SET_LIBRARY_VERSION([1], [1], [1]) # Checks for programs. AC_PROG_CC AM_PROG_CC_C_O ESO_PROG_CC_FLAG([fno-builtin], [CFLAGS="$CFLAGS -fno-builtin"]) ESO_PROG_CC_FLAG([fno-common], [CFLAGS="$CFLAGS -fno-common"]) CEXT_ENABLE_DEBUG(no) ESO_ENABLE_STRICT(no) ESO_CHECK_DOCTOOLS ESO_PROG_PURIFY AC_ENABLE_STATIC(yes) AC_ENABLE_SHARED(yes) AC_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) CEXT_ENABLE_THREADS(yes) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([stddef.h stdint.h stdarg.h inttypes.h \ float.h limits.h locale.h values.h unistd.h]) AC_HEADER_STAT # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE ESO_PROG_CC_ATTRIBUTE_VISIBILITY([hidden]) CEXT_TYPE_LONG_LONG_INT CEXT_TYPE_UNSIGNED_LONG_LONG_INT CEXT_TYPE_INTMAX_T CEXT_TYPE_UINTMAX_T CEXT_TYPE_UINTPTR_T CEXT_TYPE_LONG_DOUBLE AC_TYPE_SIZE_T if test x"$ac_cv_header_stdint_h" = xyes; then AC_CHECK_TYPE(int8_t, [], [], [#include ]) AC_CHECK_TYPE(int16_t, [], [], [#include ]) AC_CHECK_TYPE(int32_t, [], [], [#include ]) AC_CHECK_TYPE(int64_t, [], [], [#include ]) fi AC_CHECK_TYPES([ptrdiff_t]) CEXT_CHECK_CHAR_BIT if test x$cext_have_char_8_bits != xyes; then AC_MSG_ERROR([cext requires the type char to be 8 bits wide.]) fi AC_CHECK_SIZEOF(char) AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(size_t) AC_CHECK_SIZEOF(void *) if test x"$ac_cv_type_int64_t" = xno && test x"$ac_cv_sizeof_long" != x8 && test x"$ac_cv_sizeof_long_long" != x8; then AC_MSG_ERROR([A 64 bit integer type is required. Consider using the GNU C compiler]) fi CEXT_CHECK_SIZE_T AC_CHECK_MEMBERS([struct lconv.decimal_point, struct lconv.thousands_sep], [], [], [#include ]) AC_SYS_LARGEFILE # Checks for library functions. AC_CHECK_FUNCS([strchr memcpy sprintf localeconv]) AC_FUNC_LSTAT AC_FUNC_STAT ESO_FUNC_VA_COPY([CX_VA_COPY]) ESO_FUNC_REALLOC_SANITY ESO_FUNC_STRDUP ESO_FUNC_STPCPY ESO_FUNC_VSNPRINTF ESO_FUNC_VASPRINTF ESO_FUNC_SYSCONF ESO_FUNC_FPATHCONF CEXT_SET_PATHS CEXT_SET_SYMBOLS CEXT_CREATE_CXCONFIG # Library log domain AC_DEFINE([CX_LOG_DOMAIN], ["CxLib"], [Log domain internally used by the library]) AC_CONFIG_FILES(Makefile Makefile.purify Doxyfile cext/Makefile tests/Makefile) AC_OUTPUT cpl-6.4.1/libcext/COPYING0000644000460300003120000004313310443227230011700 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. cpl-6.4.1/libcext/aclocal.m40000644000460300003120000011525012310332710012500 00000000000000# generated automatically by aclocal 1.13 -*- Autoconf -*- # Copyright (C) 1996-2012 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.13' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.13], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.13])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of '-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/eso.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) m4_include([m4/purify.m4]) m4_include([acinclude.m4]) cpl-6.4.1/libcext/INSTALL0000644000460300003120000002200507774033725011712 00000000000000Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for variables by setting them in the environment. You can do that on the command line like this: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Environment Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it cannot guess the host type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the host platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. In this case, you should also specify the build platform with `--build=TYPE', because, in this case, it may not be possible to guess the build platform (it sometimes involves compiling and running simple test programs, and this can't be done if the compiler is a cross compiler). Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Environment Variables ===================== Variables not defined in a site shell script can be set in the environment passed to configure. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. cpl-6.4.1/libcext/Makefile.in0000644000460300003120000007035612310332713012717 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/admin/doxygen.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(srcdir)/config.h.in \ $(srcdir)/Makefile.purify.in $(srcdir)/Doxyfile.in AUTHORS \ COPYING ChangeLog INSTALL NEWS README TODO admin/compile \ admin/config.guess admin/config.sub admin/install-sh \ admin/missing admin/ltmain.sh $(top_srcdir)/admin/compile \ $(top_srcdir)/admin/config.guess \ $(top_srcdir)/admin/config.sub $(top_srcdir)/admin/install-sh \ $(top_srcdir)/admin/ltmain.sh $(top_srcdir)/admin/missing subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = Makefile.purify Doxyfile CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CEXT_INCLUDES = @CEXT_INCLUDES@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_DEBUG_FLAGS = @CX_DEBUG_FLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNPRINTF = @SNPRINTF@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign ACLOCAL_AMFLAGS = -I m4 DISTCLEANFILES = *~ SUBDIRS = cext tests DOXYGEN_SUBDIRS = EXTRA_DIST = BUGS Doxyfile.in m4/eso.m4 m4/purify.m4 admin/doxygen.am @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(top_srcdir)/Makefile.in $(top_srcdir)/aclocal.m4 \ @MAINTAINER_MODE_TRUE@ $(top_srcdir)/config.h.in $(top_srcdir)/configure config.log \ @MAINTAINER_MODE_TRUE@ config.status DOXYGEN_BUILD_DIR = $(top_builddir) @MAINTAINER_MODE_FALSE@DOXYGEN_RECURSIVE_TARGETS = install-doxygen-recursive @MAINTAINER_MODE_TRUE@DOXYGEN_RECURSIVE_TARGETS = install-doxygen-recursive @MAINTAINER_MODE_FALSE@DOXYGEN_INSTALL_TARGETS = install-doxygen-generic @MAINTAINER_MODE_TRUE@DOXYGEN_INSTALL_TARGETS = doxygen-am install-doxygen-generic all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/admin/doxygen.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/admin/doxygen.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 Makefile.purify: $(top_builddir)/config.status $(srcdir)/Makefile.purify.in cd $(top_builddir) && $(SHELL) ./config.status $@ Doxyfile: $(top_builddir)/config.status $(srcdir)/Doxyfile.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files @MAINTAINER_MODE_FALSE@dist-hook: distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-local .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool clean-local cscope cscopelist-am ctags ctags-am \ dist dist-all dist-bzip2 dist-gzip dist-hook dist-lzip \ dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-local @MAINTAINER_MODE_TRUE@clean-local: clean-doxygen @MAINTAINER_MODE_TRUE@dist-hook: doxygen @MAINTAINER_MODE_TRUE@ @if test -d $(top_builddir)/html; then \ @MAINTAINER_MODE_TRUE@ echo "cp -pr $(top_builddir)/html $(distdir)"; \ @MAINTAINER_MODE_TRUE@ cp -pr $(top_builddir)/html $(distdir); \ @MAINTAINER_MODE_TRUE@ fi @MAINTAINER_MODE_TRUE@ find $(distdir) -type d ! -perm -222 -exec chmod u+w {} \; -o \ @MAINTAINER_MODE_TRUE@ -type f ! -perm -222 -exec chmod u+w {} \; || chmod -R u+w $(distdir) @MAINTAINER_MODE_FALSE@clean-local: uninstall-local: uninstall-doxygen @MAINTAINER_MODE_TRUE@doxygen: doxygen-am @MAINTAINER_MODE_TRUE@doxygen-am: @MAINTAINER_MODE_TRUE@ @if test -f $(DOXYGEN_BUILD_DIR)/Doxyfile; then \ @MAINTAINER_MODE_TRUE@ echo "cd $(DOXYGEN_BUILD_DIR) && $(DOXYGEN)"; \ @MAINTAINER_MODE_TRUE@ d=`pwd`; cd $(DOXYGEN_BUILD_DIR) && $(DOXYGEN); cd $$d; \ @MAINTAINER_MODE_TRUE@ if test -n "$(POST_DOXYGEN_CLEANFILES)"; then \ @MAINTAINER_MODE_TRUE@ cd $(DOXYGEN_BUILD_DIR)/html && rm -f $(POST_DOXYGEN_CLEANFILES); \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ else \ @MAINTAINER_MODE_TRUE@ echo "Nothing to be done for \`$@'."; \ @MAINTAINER_MODE_TRUE@ fi @MAINTAINER_MODE_TRUE@clean-doxygen: clean-doxygen-am @MAINTAINER_MODE_TRUE@clean-doxygen-am: @MAINTAINER_MODE_TRUE@ -rm -rf $(DOXYGEN_BUILD_DIR)/html install-doxygen: install-doxygen-recursive install-doxygen-am: $(DOXYGEN_INSTALL_TARGETS) install-doxygen-generic: @$(NORMAL_INSTALL) @if test -d $(DOXYGEN_BUILD_DIR)/html; then \ echo "$(mkinstalldirs) $(DESTDIR)$(apidocdir)"; \ $(mkinstalldirs) $(DESTDIR)$(apidocdir); \ list="`ls -1 $(DOXYGEN_BUILD_DIR)/html`"; \ for p in $$list; do \ if test -f $(DOXYGEN_BUILD_DIR)/html/$$p; then \ echo " $(INSTALL_DATA) $(DOXYGEN_BUILD_DIR)/html/$$p $(DESTDIR)$(apidocdir)/$$p"; \ $(INSTALL_DATA) $(DOXYGEN_BUILD_DIR)/html/$$p $(DESTDIR)$(apidocdir)/$$p; \ else if test -f $$p; then \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(apidocdir)/$$p"; \ $(INSTALL_DATA) $$p $(DESTDIR)$(apidocdir)/$$p; \ fi; fi; \ done; \ fi uninstall-doxygen: @$(NORMAL_UNINSTALL) @list="`ls -1 $(DESTDIR)$(apidocdir)`"; \ for p in $$list; do \ echo " rm -f $(DESTDIR)$(apidocdir)/$$p"; \ rm -f $(DESTDIR)$(apidocdir)/$$p; \ done $(DOXYGEN_RECURSIVE_TARGETS): @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(DOXYGEN_SUBDIRS)'; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/AUTHORS0000644000460300003120000000030112111162124010243 00000000000000This package is maintained by Ralf Palsa , C. Enrique Garcia , and Lars Lundin on behalf of the European Southern Observatory (ESO). cpl-6.4.1/BUGS0000644000460300003120000000156210730171025007675 00000000000000This file lists the bugs you must be aware of. Be sure to check this file before using the CPL. Bugs in other libraries: When running valgrind and if using cpl_wcs, you might get the following memory leak. This should be fixed in the next release of WCSLIB. 16,426 bytes in 2 blocks are still reachable in loss record 1 of 1 at 0x40235B5: malloc (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so) by 0x405B36E: yy_flex_alloc (lex.wcspih.c:10316) by 0x405AFB1: wcspih_create_buffer (lex.wcspih.c:9987) by 0x4057962: wcspih (lex.wcspih.c:8294) Warnings might happen of type "Uninitialized memory read: regcomp [libc.so.6] re_compile_internal [libc.so.6] parse_reg_exp [libc.so.6] These warnings come from a regular expression parser in the C libray. Limitations: On HP-UX and Sun Solaris platforms only the GNU C compiler is currently supported. cpl-6.4.1/acinclude.m40000644000460300003120000007125412300410026011400 00000000000000# CPL_SET_PREFIX #--------------- # Sets and the directory prefix for the package installation. If no # directory prefix was given on the command line the default prefix # is appended to the configure argument list and thus passed to # the subdirs configure. AC_DEFUN([CPL_SET_PREFIX], [ unset CDPATH # make $CPLDIR the default for the installation AC_PREFIX_DEFAULT(${CPLDIR:-/usr/local}) if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix ac_configure_args="$ac_configure_args --prefix $prefix" fi ]) # CPL_CONFIG_VERSION(VERSION, [CURRENT], [REVISION], [AGE]) #---------------------------------------------------------- # Setup various version information, especially the libtool versioning AC_DEFUN([CPL_CONFIG_VERSION], [ cpl_version_string="$1" cpl_version=`echo "$1" | sed -e 's/[[a-z,A-Z]].*$//'` cpl_major_version=`echo "$cpl_version" | \ sed 's/\([[0-9]]*\).\(.*\)/\1/'` cpl_minor_version=`echo "$cpl_version" | \ sed 's/\([[0-9]]*\).\([[0-9]]*\)\(.*\)/\2/'` cpl_micro_version=`echo "$cpl_version" | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test -z "$cpl_major_version"; then cpl_major_version=0 fi if test -z "$cpl_minor_version"; then cpl_minor_version=0 fi if test -z "$cpl_micro_version"; then cpl_micro_version=0 fi CPL_VERSION="$cpl_version" CPL_VERSION_STRING="$cpl_version_string" CPL_MAJOR_VERSION=$cpl_major_version CPL_MINOR_VERSION=$cpl_minor_version CPL_MICRO_VERSION=$cpl_micro_version if test -z "$4"; then CPL_INTERFACE_AGE=0 else CPL_INTERFACE_AGE="$4" fi CPL_BINARY_AGE=`expr 256 '*' $CPL_MINOR_VERSION + $CPL_MICRO_VERSION` CPL_BINARY_VERSION=`expr 65536 '*' $CPL_MAJOR_VERSION + $CPL_BINARY_AGE` AC_SUBST(CPL_VERSION) AC_SUBST(CPL_VERSION_STRING) AC_SUBST(CPL_MAJOR_VERSION) AC_SUBST(CPL_MINOR_VERSION) AC_SUBST(CPL_MICRO_VERSION) AC_SUBST(CPL_INTERFACE_AGE) AC_SUBST(CPL_BINARY_VERSION) AC_SUBST(CPL_BINARY_AGE) AC_DEFINE_UNQUOTED(CPL_MAJOR_VERSION, $CPL_MAJOR_VERSION, [CPL major version number]) AC_DEFINE_UNQUOTED(CPL_MINOR_VERSION, $CPL_MINOR_VERSION, [CPL minor version number]) AC_DEFINE_UNQUOTED(CPL_MICRO_VERSION, $CPL_MICRO_VERSION, [CPL micro version number]) AC_DEFINE_UNQUOTED(CPL_INTERFACE_AGE, $CPL_INTERFACE_AGE, [CPL interface age]) AC_DEFINE_UNQUOTED(CPL_BINARY_VERSION, $CPL_BINARY_VERSION, [CPL binary version number]) AC_DEFINE_UNQUOTED(CPL_BINARY_AGE, $CPL_BINARY_AGE, [CPL binary age]) ESO_SET_LIBRARY_VERSION([$2], [$3], [$4]) AC_CONFIG_COMMANDS([cplcore/cpl_version.h.in], [cfgfile="cplcore/cpl_version.h.in" cat > $cfgfile << _CPLEOF _CPLEOF echo '#define CPL_VERSION_STRING "'$version_string'"' >> $cfgfile echo "#define CPL_VERSION_CODE $version_code" >> $cfgfile cat >> $cfgfile << _CPLEOF #define CPL_VERSION(major, minor, micro) \\ (((major) * 65536) + ((minor) * 256) + (micro)) _CPLEOF ], [version_code=$CPL_BINARY_VERSION version_string=$CPL_VERSION_STRING]) ]) # CPL_BASE_PATHS #--------------- AC_DEFUN([CPL_BASE_PATHS], [ AC_REQUIRE([ESO_CHECK_EXTRA_LIBS]) AC_MSG_CHECKING([for CPL]) if test x"${prefix}" = xNONE; then cpl_prefix="$ac_default_prefix" else cpl_prefix="$prefix" fi if test x"$exec_prefix" = xNONE; then cpl_exec_prefix="$cpl_prefix" AC_MSG_RESULT([will be installed in $cpl_prefix]) else cpl_exec_prefix="$exec_prefix" AC_MSG_RESULT([will be installed in $cpl_prefix and $cpl_exec_prefix]) fi cpl_libraries="${cpl_exec_prefix}/lib" cpl_includes=${cpl_prefix}/include AC_SUBST(cpl_includes) AC_SUBST(cpl_libraries) CPLCORE_INCLUDES='-I$(top_srcdir)/cplcore -I$(top_builddir)/cplcore' CPLDRS_INCLUDES="-I\$(top_srcdir)/cpldrs -I\$(top_builddir)/cpldrs" CPLUI_INCLUDES='-I$(top_srcdir)/cplui -I$(top_builddir)/cplui' CPLDFS_INCLUDES='-I$(top_srcdir)/cpldfs -I$(top_builddir)/cpldfs' CPL_INCLUDES="$CPLDFS_INCLUDES $CPLUI_INCLUDES $CPLDRS_INCLUDES $CPLCORE_INCLUDES" CPL_LDFLAGS="" AC_SUBST(CPLCORE_INCLUDES) AC_SUBST(CPLDRS_INCLUDES) AC_SUBST(CPLUI_INCLUDES) AC_SUBST(CPLDFS_INCLUDES) AC_SUBST(CPL_LDFLAGS) ]) # CPL_SET_PATHS #-------------- # Define auxiliary directories of the CPL tree. AC_DEFUN([CPL_SET_PATHS], [ AC_REQUIRE([CPL_BASE_PATHS]) if test -z "$apidocdir"; then apidocdir='${datadir}/doc/${PACKAGE}/html' fi AC_SUBST(apidocdir) if test -z "$configdir"; then configdir='${datadir}/${PACKAGE}/config' fi AC_SUBST(configdir) # Define a preprocesor symbol for the application search paths # Need to evaluate the expression 3 times to get to the full name config_dir="`eval echo $configdir`" config_dir="`eval echo $config_dir`" config_dir="`eval echo $config_dir`" AC_DEFINE_UNQUOTED(CPL_CONFIG_DIR, "$config_dir", [Directory prefix for system configuration files]) ]) # CPL_EXPORT_DIRS(dir=directory-list) #------------------------------------ # Add extra directories to the command line arguments when configuring # subdirectories. AC_DEFUN([CPL_EXPORT_DIRS], [ for d in $1; do eval cpl_propagate_dir="\$$d" ac_configure_args="$ac_configure_args $d='$cpl_propagate_dir'" done ]) # CPL_FUNC_GETOPT #---------------- # Checks for GNU getopt_long declaration and function. AC_DEFUN([CPL_FUNC_GETOPT], [ AH_TEMPLATE([HAVE_GETOPT_LONG], [Define if you have the `getopt_long' function]) ESO_CHECK_FUNC(getopt_long, [#include ], HAVE_GETOPT_LONG) if test x"$ac_cv_func_getopt_long" = xno || test x"$eso_cv_have_decl_getopt_long" = xno; then if test -n "$LIBTOOL"; then GETOPT="getopt.lo getopt1.lo" else GETOPT="getopt.$ac_objext getopt1.$ac_objext" fi fi AC_SUBST(GETOPT) ]) # CPL_CONFIG_FUNC() #---------------------------------------------------------- # Setup creation of body of cpl_func.h AC_DEFUN([CPL_CONFIG_FUNC], [ AC_LINK_IFELSE([AC_LANG_SOURCE( [ int main(void) { return (int)__func__; } ])], cpl_cv_func_has_func=__func__, cpl_cv_func_has_func='"\"\""', cpl_cv_func_has_func='"\"\""') AC_CONFIG_COMMANDS([cplcore/cpl_func.h.in], [cfgfile="cplcore/cpl_func.h.in" echo "#define cpl_func $cpl_func_value" > $cfgfile ], [cpl_func_value=$cpl_cv_func_has_func]) ]) # CPL_PATH_JAVA #-------------- # Checks for an existing java installation AC_DEFUN([CPL_PATH_JAVA], [ AC_REQUIRE([AC_CANONICAL_BUILD]) cpl_java_check_java="java" cpl_java_check_javac="javac" cpl_java_check_javah="javah" cpl_java_check_header="jni.h" cpl_java_check_header_md="jni_md.h" cpl_java_path="" AC_ARG_WITH(java, AC_HELP_STRING([--with-java], [location where java is installed]), [ cpl_with_java=$withval ]) AC_ARG_WITH(java-includes, AC_HELP_STRING([--with-java-includes], [location of the java header files]), [ cpl_with_java_includes=$withval ]) AC_ARG_WITH(java-includes-md, AC_HELP_STRING([--with-java-includes-md], [location of the machine dependent java header files]), [ cpl_with_java_includes_md=$withval ]) AC_MSG_CHECKING([for Java Development Kit]) AC_ARG_VAR([JAVA], [Java application launcher]) AC_ARG_VAR([JAVAC], [Java compiler command]) AC_ARG_VAR([JAVAH], [Java C header and stub file generator]) AC_CACHE_VAL([cpl_cv_path_java], [ if test x"$cpl_with_java" != xno; then if test -z "$cpl_with_java"; then test -n "$JAVA_HOME" && cpl_java_dirs="$JAVA_HOME/bin $JAVA_HOME/Commands" else cpl_java_dirs="$cpl_with_java/bin $cpl_with_java/Commands" fi ESO_FIND_FILE($cpl_java_check_java, $cpl_java_dirs, cpl_java_path) else cpl_java_path="no" fi if test x"$cpl_java_path" = xno; then cpl_cv_path_java="no" JAVA=":" JAVAC=":" else JAVA="$cpl_java_path/$cpl_java_check_java" if test -x $cpl_java_path/$cpl_java_check_javac; then JAVAC="$cpl_java_path/$cpl_java_check_javac" else JAVAC=":" fi if test -x $cpl_java_path/$cpl_java_check_javah; then JAVAH="$cpl_java_path/$cpl_java_check_javah" else JAVAH=":" fi cpl_cv_path_java="`echo $cpl_java_path | sed -e 's;/bin$;;'`" if test $cpl_cv_path_java = $cpl_java_path ; then cpl_cv_path_java="`echo $cpl_java_path | sed -e 's;/Commands$;;'`" fi fi ]) AC_CACHE_VAL([cpl_cv_env_java_os], [ if test x"$cpl_cv_path_java" = xno; then cpl_cv_env_java_os="unknown" else case $build in *-*-linux*) cpl_cv_env_java_os="linux" ;; *-*-freebsd*) cpl_cv_env_java_os="bsd" ;; *-*-solaris*) cpl_cv_env_java_os="solaris" ;; *-*-hpux*) cpl_cv_env_java_os="hp-ux" ;; *-*-irix*) cpl_cv_env_java_os="irix" ;; *-*-aix*) cpl_cv_env_java_os="aix" ;; *-*-sequent*) cpl_cv_env_java_os="ptx" ;; *-*-os390*) cpl_cv_env_java_os="os390" ;; *-*-os400*) cpl_cv_env_java_os="os400" ;; *-apple-darwin*|*-apple-rhapsody*) cpl_cv_env_java_os="darwin" ;; *-*-cygwin*|*-*-mingw*) cpl_cv_env_java_os="win32" ;; *) if test -d $cpl_cv_path_java/include/genunix; then cpl_cv_env_java_os="genunix" else cpl_cv_env_java_os="unknown" fi ;; esac fi ]) AC_CACHE_VAL([cpl_cv_header_java], [ if test x"$cpl_cv_path_java" = xno; then cpl_java_includes="no" else if test -z "$cpl_with_java_includes"; then cpl_java_incdirs="$cpl_cv_path_java/include $cpl_cv_path_java/Headers" else cpl_java_incdirs="$cpl_with_java_includes" fi ESO_FIND_FILE($cpl_java_check_header, $cpl_java_incdirs, cpl_java_includes) fi if test x"$cpl_java_includes" = xno; then cpl_cv_header_java="no" else cpl_cv_header_java="$cpl_java_includes" fi ]) AC_CACHE_VAL([cpl_cv_header_java_md], [ if test x"$cpl_cv_path_java" = xno || test x"$cpl_cv_header_java" = xno; then cpl_cv_header_java_md="no" else cpl_java_includes_md="no" if test -z "$cpl_with_java_includes_md"; then cpl_java_incdirs="$cpl_cv_header_java" if test x"$cpl_cv_env_java_os" != xunknown; then cpl_java_incdirs="$cpl_cv_header_java/$cpl_cv_env_java_os $cpl_java_incdirs" fi ESO_FIND_FILE($cpl_java_check_header_md, $cpl_java_incdirs, cpl_java_includes_md) else cpl_java_incdirs="$cpl_with_java_includes_md" ESO_FIND_FILE($cpl_java_check_header_md, $cpl_java_incdirs, cpl_java_includes_md) fi cpl_cv_header_java_md="$cpl_java_includes_md" fi ]) if test x"$cpl_cv_path_java" = xno; then AC_MSG_RESULT([no]) else if test x"$cpl_cv_header_java" = xno || test x"$cpl_cv_header_java_md" = xno; then if test x"$cpl_cv_header_java" = xno; then if test x"$cpl_cv_header_java_md" = xno; then cpl_java_notfound="$cpl_java_check_header and $cpl_java_check_header_md" else cpl_java_notfound="$cpl_java_check_header" fi else cpl_java_notfound="$cpl_java_check_header_md" fi AC_MSG_RESULT([$cpl_cv_path_java, headers $cpl_java_notfound not found]) else AC_MSG_RESULT([$cpl_cv_path_java, headers $cpl_cv_header_java, $cpl_cv_header_java_md]) fi fi # Setup the Makefile symbols if test x"$cpl_cv_path_java" != xno; then if test -f "$cpl_cv_path_java/Commands/java" ; then JAVA="$cpl_cv_path_java/Commands/java" else JAVA="$cpl_cv_path_java/bin/java" fi if test x"$cpl_cv_header_java" != xno && test x"$cpl_cv_header_java_md" != xno; then JAVA_INCLUDES="-I$cpl_cv_header_java -I$cpl_cv_header_java_md" else JAVA_INCLUDES="" fi else JAVA=":" JAVA_INCLUDES="" fi AC_SUBST([JAVA]) AC_SUBST([JAVAC]) AC_SUBST([JAVAH]) AC_SUBST([JAVA_INCLUDES]) ]) # CPL_PATH_GASGANO #------------------ # Checks for an existing Gasgano installation. AC_DEFUN([CPL_PATH_GASGANO], [ cpl_gasgano_check_prog="gasgano" cpl_gasgano_prog="no" AC_ARG_WITH(gasgano, AC_HELP_STRING([--with-gasgano], [location where Gasgano is installed]), [ cpl_with_gasgano=$withval ]) AC_MSG_CHECKING([for $cpl_gasgano_check_prog]) AC_CACHE_VAL([cpl_cv_path_gasgano], [ if test x"$cpl_with_gasgano" != xno; then if test -z "$cpl_with_gasgano"; then cpl_gasgano_dirs="$HOME/gasgano/bin /opt/gasgano/bin /usr/local/gasgano/bin" test -n "$GASGANODIR" && cpl_gasgano_dirs="$GASGANODIR/bin \ $cpl_gasgano_dirs" else cpl_gasgano_dirs="$cpl_with_gasgano/bin" fi ESO_FIND_FILE($cpl_gasgano_check_prog, $cpl_gasgano_dirs, cpl_gasgano_prog) fi if test "x$cpl_gasgano_prog" = xno; then cpl_cv_path_gasgano="no" else cpl_cv_path_gasgano="`echo $cpl_gasgano_prog | sed -e 's/\/bin$//'`" fi ]) AC_CACHE_VAL([cpl_cv_prog_gasgano], [ if test -n "$cpl_cv_path_gasgano"; then if test -x "$cpl_cv_path_gasgano/bin/$cpl_gasgano_check_prog"; then cpl_cv_prog_gasgano="$cpl_cv_path_gasgano/bin/$cpl_gasgano_check_prog" else cpl_cv_prog_gasgano="no" fi fi ]) if test x"$cpl_cv_prog_gasgano" = xno; then AC_MSG_RESULT([no]) else AC_MSG_RESULT([$cpl_cv_prog_gasgano]) fi ]) # CPL_CLASSPATH_GASGANO #---------------------- # Checks for the location of the Gasgano jar files. AC_DEFUN([CPL_CLASSPATH_GASGANO], [ AC_REQUIRE([CPL_PATH_GASGANO]) AC_MSG_CHECKING([for gasgano jar files]) cpl_gasgano_check_jar="gasgano.jar" cpl_gasgano_jarfiles="no" GASGANO_CLASSPATH="" AC_ARG_WITH(gasgano-classpath, AC_HELP_STRING([--with-gasgano-classpath], [location where the Gasgano jar files are installed]), [ cpl_with_gasgano_jarfiles=$withval ]) AC_CACHE_VAL([cpl_cv_classpath_gasgano], [ if test x"$cpl_cv_path_gasgano" != xno; then if test -z "$cpl_with_gasgano_jarfiles"; then cpl_gasgano_jardirs="$cpl_cv_path_gasgano/share" else cpl_gasgano_jardirs="$cpl_with_gasgano_jarfiles" fi ESO_FIND_FILE($cpl_gasgano_check_jar, $cpl_gasgano_jardirs, cpl_gasgano_jarfiles) if test "x$cpl_gasgano_jarfiles" = xno; then cpl_cv_path_gasgano_jarfiles="no" else cpl_cv_path_gasgano_jarfiles="$cpl_gasgano_jarfiles" fi else cpl_cv_path_gasgano_jarfiles="no" fi ]) if test x"$cpl_cv_path_gasgano_jarfiles" = xno; then GASGANO_CLASSPATH="" AC_MSG_RESULT([no]) else GASGANO_CLASSPATH="" for f in `ls -1 $cpl_cv_path_gasgano_jarfiles/*.jar`; do if test -z "$GASGANO_CLASSPATH"; then GASGANO_CLASSPATH="$f" else GASGANO_CLASSPATH="$GASGANO_CLASSPATH:$f" fi done AC_MSG_RESULT([$cpl_cv_path_gasgano_jarfiles]) fi AC_SUBST([GASGANO_CLASSPATH]) ]) # CPL_ENABLE_GASGANO #------------------ # Check whether the Gasgano interface library should/can be built. AC_DEFUN([CPL_ENABLE_GASGANO], [ AC_REQUIRE([CPL_PATH_JAVA]) AC_REQUIRE([CPL_CLASSPATH_GASGANO]) AC_ARG_ENABLE(gasgano, AC_HELP_STRING([--enable-gasgano], [build the gasgano support library [[default=yes]]]), cpl_enable_gasgano=$enableval, cpl_enable_gasgano=yes) AC_MSG_CHECKING([whether the Gasgano interface library can be built]) if test x"$cpl_enable_gasgano" != xyes; then cpl_gasgano_support="no" AC_MSG_RESULT([no]) else if test -n "$JAVA_INCLUDES" && test -n "$GASGANO_CLASSPATH"; then cpl_gasgano_support="yes" AC_MSG_RESULT([yes]) else cpl_gasgano_support="no" AC_MSG_RESULT([no]) fi fi AM_CONDITIONAL([GASGANO_SUPPORT], [test x"$cpl_gasgano_support" = xyes]) GASGANO_SHREXT="" if test x"$cpl_gasgano_support" = xyes; then case $cpl_cv_env_java_os in darwin) GASGANO_SHREXT="-shrext .jnilib" ;; *) ;; esac fi AC_SUBST([GASGANO_SHREXT]) ]) # CPL_ENABLE_THREADS(threads=yes) #-------------------------------- AC_DEFUN([CPL_ENABLE_THREADS], [ AC_REQUIRE([ESO_CHECK_THREADS_POSIX]) AC_REQUIRE([CPL_OPENMP]) AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads], [enables thread support [default=$1]]), cpl_enable_threads=$enableval, cpl_enable_threads=$1) AH_TEMPLATE([CPL_THREADS_ENABLED], [Define if thread support is enabled.]) AC_MSG_CHECKING([whether thread support is available]) if test x"$cpl_enable_threads" = xyes; then if test x"$eso_cv_threads_posix" = xno && \ test x"$ac_cv_prog_c_openmp" = xno; then AC_MSG_RESULT([no]) AC_MSG_ERROR([Thread support was requested, but the system does not support it!]) else CFLAGS="-D_REENTRANT $CFLAGS" AC_DEFINE_UNQUOTED([CPL_THREADS_ENABLED]) AC_MSG_RESULT([yes]) case $ac_cv_prog_c_openmp in "none needed" | unsupported) if test x"$eso_cv_threads_posix_lib" = xyes; then echo $LIBS | grep -q -e "$LIBPTHREAD" || LIBS="$LIBPTHREAD $LIBS" else CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS" fi ;; *) # FIXME: Explicitly add the OpenMP runtime library, since libtool # removes the compiler flag when linking! AC_SEARCH_LIBS([omp_get_num_threads], [gomp mtsk omp], [], AC_MSG_ERROR([OpenMP runtime environment not found!])) CFLAGS="$CFLAGS $OPENMP_CFLAGS" LDFLAGS="$LDFLAGS $OPENMP_CFLAGS" ;; esac cpl_threads_enabled=yes fi else cpl_threads_enabled=no AC_MSG_RESULT([disabled]) fi AC_CACHE_VAL(cpl_cv_threads_enabled, cpl_cv_threads_enabled=$cpl_threads_enabled) ]) # CPL_CONFIG_CFITSIO(version) #---------------------------- # Adds an extra check to CPL_CHECK_CFITSIO. It checks whether the libcfitsio # found is thread-safe in case building CPL with thread support was enabled. # Otherwise the package configuration is aborted. # # This macro has to be called after CPL_ENABLE_THREADS has been called! AC_DEFUN([CPL_CONFIG_CFITSIO], [ CPL_CHECK_CFITSIO([$1]) if test x"$cpl_cv_threads_enabled" = xyes && \ test x"$cpl_cv_cfitsio_is_thread_safe" = xno; then AC_MSG_ERROR([Building with thread support requires a thread-safe libcfitsio! Please update your cfitsio installation]) fi ]) # CPL_CONFIG_CEXT(srcdir=libcext) #-------------------------------- # Checks whether libcext provided by the system should be used for building # CPL, or the packaged version in the subdirectory 'srcdir'. If 'srcdir' is # not given it defaults to 'libcext' AC_DEFUN([CPL_CONFIG_CEXT], [ libcext="libcext" AC_ARG_WITH(system-cext, AC_HELP_STRING([--with-system-cext], [Use the system cext installation for building [default=no]]), [ cpl_with_system_cext=$withval ]) if test x"$cpl_with_system_cext" = xyes; then CPL_CHECK_CEXT libcext="" else if test -n "$1"; then libcext="$1" fi if test ! -d "$srcdir/$libcext"; then AC_MSG_ERROR([libcext source tree was not found in `$srcdir/$libcext']) else AC_CACHE_VAL(cpl_cv_with_system_cext, cpl_cv_with_system_cext=$cpl_with_system_cext) # Setup the symbols CX_INCLUDES="-I\$(top_builddir)/libcext/cext" CX_INCLUDES="$CX_INCLUDES -I\$(top_srcdir)/$libcext/cext" CX_LDFLAGS="" LIBCEXT="\$(top_builddir)/libcext/cext/libcext.la" AC_SUBST([CX_INCLUDES]) AC_SUBST([CX_LDFLAGS]) AC_SUBST([LIBCEXT]) fi fi AC_SUBST([libcext]) ]) # CHECK MEMORY MODE #------------------ AC_DEFUN([CPL_CHECK_MEMORYMODE], [ AC_MSG_CHECKING([for extended memory mode]) AC_ARG_ENABLE(memory-mode, AC_HELP_STRING([--enable-memory-mode=M], [where M=0 switches off the internal memory handling (default), M=1 exits the program whenever a memory allocation fails, M=2 switches on the internal memory handling]), [ cpl_memory_flag=yes # $enableval=yes when no argument is given cpl_memory_mode=$enableval ]) AC_ARG_ENABLE(max-ptrs, AC_HELP_STRING([--enable-max-ptrs=MAXPTRS], [MAXPTRS Set MAXPTRS as the maximum number of pointers allowed when using memory-mode=2 (200003)]), [ cpl_max_ptrs_flag=yes cpl_max_ptrs=$enableval ]) # Pending: check cpl_max_ptrs is numeric, otherwise AC_MSG_ERROR if test "x$cpl_max_ptrs_flag" = xyes ; then CPL_MAXPTRS_CFLAGS="-DCPL_XMEMORY_MAXPTRS=$cpl_max_ptrs" else CPL_MAXPTRS_CFLAGS="-DCPL_XMEMORY_MAXPTRS=200003" fi if test "x$cpl_memory_flag" = xyes ; then CPL_CFLAGS="-DCPL_XMEMORY_MODE=$cpl_memory_mode" case $cpl_memory_mode in yes) CPL_CFLAGS="-DCPL_XMEMORY_MODE=0 -DCPL_XMEMORY_MAXPTRS=1" break ;; 0|1) CPL_CFLAGS="-DCPL_XMEMORY_MODE=$cpl_memory_mode -DCPL_XMEMORY_MAXPTRS=1" break ;; 2) CPL_CFLAGS="-DCPL_XMEMORY_MODE=2 $CPL_MAXPTRS_CFLAGS" break ;; *) AC_MSG_ERROR([Option --enable-memory-mode=$cpl_memory_mode not valid. Please check!]) break ;; esac else CPL_CFLAGS="-DCPL_XMEMORY_MODE=0 -DCPL_XMEMORY_MAXPTRS=1" fi AC_MSG_RESULT([CPL_CFLAGS=$CPL_CFLAGS]) AC_SUBST(CPL_CFLAGS) ]) # CPL_CHECK_VA_ARGS #------------------ # Checks for the support of variadic macros AC_DEFUN([CPL_CHECK_VA_ARGS], [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#define cpl_check_va_args(A, ...) printf(A, __VA_ARGS__)]], [[]])], AC_DEFINE(CPL_HAVE_VA_ARGS, 1, Define to 1 if you have variadic macros.), AC_MSG_WARN([Variadic macros are not available])) ]) # CPL_CHECK_COMPLEX #------------------ # Checks for the support of complex primitive types AC_DEFUN([CPL_CHECK_COMPLEX], [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include ]], [[ double complex a, b; a = 2.0 + 2.0 * I; b = cabs(a); ]])], AC_DEFINE(CPL_HAVE_COMPLEX, 1, Define to 1 if you have complex primitive types.), AC_MSG_WARN([Complex primitive types are not available])) ]) # CPL_CHECK_CPU #-------------- # Try to determine the Cache size - using /proc/cpuinfo AC_DEFUN([CPL_CHECK_CPU], [ AC_MSG_CHECKING([/proc/cpuinfo for the CPU cache and cores]) if test -r "/proc/cpuinfo"; then cpl_cpu_cache_string=`grep "cache size" /proc/cpuinfo | head -1 | perl -ne 's/^\D+//;s/\b\s*kB\b\D*/<<10/i || s/\b\s*MB\b\D*/<<20/i;/^\d+/ and print eval'` if test -n "$cpl_cpu_cache_string"; then AC_DEFINE_UNQUOTED(CPL_CPU_CACHE, $cpl_cpu_cache_string, [Defined to number of bytes in (L2) Cache]) AC_MSG_RESULT([CPU cache $cpl_cpu_cache_string B]) fi cpl_cpu_core_string=`grep "cpu cores" /proc/cpuinfo | head -1 | perl -ne 's/^\D+//g;/^\d+/ and print'` if test -n "$cpl_cpu_core_string"; then AC_DEFINE_UNQUOTED(CPL_CPU_CORES, $cpl_cpu_core_string, [Defined to number of cores (possibly sharing the (L2) Cache)]) AC_MSG_RESULT([CPU cores $cpl_cpu_core_string]) fi fi ]) cpl-6.4.1/cpljava/0000755000460300003120000000000012310333012010676 500000000000000cpl-6.4.1/cpljava/Makefile.am0000644000460300003120000000401112127227645012672 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO Common Pipeline Library ## Copyright (C) 2001-2006 European Southern Observatory ## 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 2 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 02111-1307 USA AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ CLEANFILES = $(BUILT_SOURCES) if MAINTAINER_MODE MAINTAINERCLEANFILES = $(srcdir)/Makefile.in endif AM_CPPFLAGS = $(CPLCORE_INCLUDES) $(CPLUI_INCLUDES) $(CPLDFS_INCLUDES) \ $(CX_INCLUDES) $(JAVA_INCLUDES) $(INCLTDL) GASGANO_NATIVE_INCLUDES = org_eso_cpl_jni_CPLControl.h \ org_eso_cpl_jni_JNIParameterImp.h \ org_eso_cpl_jni_JNIRecipe.h \ org_eso_cpl_jni_LibraryLoader.h \ org_eso_cpl_jni_PluginLibrary.h BUILT_SOURCES = $(GASGANO_NATIVE_INCLUDES) lib_LTLIBRARIES = libcplgasgano.la nodist_noinst_HEADERS = $(GASGANO_NATIVE_INCLUDES) libcplgasgano_la_SOURCES = cpl_gasgano.c libcplgasgano_la_LDFLAGS = $(CX_LDFLAGS) $(GASGANO_SHREXT) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libcplgasgano_la_LIBADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLCORE) $(LIBCEXT) $(LIBLTDL) libcplgasgano_la_DEPENDENCIES = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLCORE) $(LIBLTDL) $(GASGANO_NATIVE_INCLUDES): @class="`echo $@ | sed -e 's/\.h$$//' | sed -e 's/_/\./g'`"; \ echo "$(JAVAH) -classpath $(GASGANO_CLASSPATH) $$class"; \ $(JAVAH) -classpath $(GASGANO_CLASSPATH) $$class; cpl-6.4.1/cpljava/cpl_gasgano.c0000644000460300003120000020043412252327513013260 00000000000000/* $Id: cpl_gasgano.c,v 1.23 2013-01-30 15:59:18 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-01-30 15:59:18 $ * $Revision: 1.23 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #ifdef HAVE_UNISTD_H # include #endif #include #include "ltdl.h" #include "cxmessages.h" #include "cpl_init.h" #include "cpl_frame.h" #include "cpl_frameset.h" #include "cpl_msg.h" #include "cpl_parameter.h" #include "cpl_parameterlist.h" #include "cpl_plugin.h" #include "cpl_pluginlist.h" #include "cpl_recipe.h" #include "cpl_dfs.h" #include "cpl_errorstate.h" #include "cpl_version.h" #include "cpl_memory.h" #include "org_eso_cpl_jni_CPLControl.h" #include "org_eso_cpl_jni_JNIParameterImp.h" #include "org_eso_cpl_jni_JNIRecipe.h" #include "org_eso_cpl_jni_LibraryLoader.h" #include "org_eso_cpl_jni_PluginLibrary.h" #if defined (HAVE_ORG_ESO_CPL_TEST_NATIVE_TEST_H) && \ defined (ENABLE_NATIVE_TESTS) # include "org_eso_cpl_test_NativeTest.h" #endif #ifdef _OPENMP #include #endif /* *Library version. */ #define JAVACPL_VERSION "1.0" /* * Macro for executing one of the named cpl_plugin_func functions defined * in the cpl_plugin structure. Xname gives the name of the member of * the cpl_plugin structure to execute. */ #define EXECUTE_CPL_PLUGIN_FUNC(env, this, Xname) \ { \ jbyteArray jState = NULL; \ cpl_plugin *plugin = NULL; \ int ok = 1; \ int status; \ \ /* Get the pointer to the function to execute. */ \ ok = ok && \ (jState = (*env)->GetObjectField(env, this, JNIRecipeStateField)) && \ (plugin = (cpl_plugin *) \ (*env)->GetByteArrayElements(env, jState, NULL)); \ \ /* Execute the function if it is non-NULL. */ \ if (ok) { \ const cpl_plugin_func cplfunc = plugin->Xname; \ if (cplfunc) { \ currentEnv = env; \ status = (*cplfunc)(plugin); \ currentEnv = NULL; \ } \ else { \ status = 0; \ } \ } \ else { \ status = -1; \ } \ \ /* Release array elements. */ \ if (plugin) { \ (*env)->ReleaseByteArrayElements(env, jState, (jbyte *) plugin, 0); \ } \ \ /* Return the execution status. */ \ return status; \ } /* * Static variables. */ static int isConstantsSetup = 0; static int isHandlersSetup = 0; static cpl_errorstate inistate; static JNIEnv *currentEnv; static jclass AssertionErrorClass; static jclass BooleanClass; static jclass DoubleClass; static jclass FileClass; static jclass IllegalArgumentExceptionClass; static jclass IllegalStateExceptionClass; static jclass IntegerClass; static jclass LinkageErrorClass; static jclass NullPointerExceptionClass; static jclass ObjectClass; static jclass PrintStreamClass; static jclass RuntimeExceptionClass; static jclass StringClass; static jclass BadAPIPluginClass; static jclass CPLControlClass; static jclass CPLExceptionClass; static jclass EnumConstraintClass; static jclass FrameClass; static jclass FrameGroupClass; static jclass FrameLevelClass; static jclass FrameTypeClass; static jclass JNIParameterImpClass; static jclass JNIRecipeClass; static jclass LTDLExceptionClass; static jclass NonRecipePluginClass; static jclass OtherPluginClass; static jclass ParameterClass; static jclass ParameterTypeClass; static jclass ParameterValueExceptionClass; static jclass PluginLibraryClass; static jclass RangeConstraintClass; static jmethodID BadAPIPluginConstructor; static jmethodID DoubleConstructor; static jmethodID EnumConstraintConstructor; static jmethodID FileConstructor; static jmethodID FrameConstructor; static jmethodID IntegerConstructor; static jmethodID JNIParameterImpConstructor; static jmethodID JNIRecipeConstructor; static jmethodID LTDLExceptionConstructor; static jmethodID NonRecipePluginConstructor; static jmethodID ParameterConstructor; static jmethodID PluginLibraryConstructor; static jmethodID RangeConstraintConstructor; static jmethodID BooleanBooleanValueMethod; static jmethodID CPLControlErrMessageMethod; static jmethodID CPLControlLogMessageMethod; static jmethodID CPLControlOutMessageMethod; static jmethodID DoubleDoubleValueMethod; static jmethodID IntegerIntValueMethod; static jmethodID PrintStreamPrintlnMethod; static jfieldID FrameCanonicalPathField; static jfieldID FrameGroupField; static jfieldID FrameLevelField; static jfieldID FrameTagField; static jfieldID FrameTypeField; static jfieldID FrameGroupIDNameField; static jfieldID FrameLevelIDNameField; static jfieldID FrameTypeIDNameField; static jfieldID JNIParameterImpContextField; static jfieldID JNIParameterImpHelpField; static jfieldID JNIParameterImpNameField; static jfieldID JNIParameterImpStateField; static jfieldID JNIParameterImpTagField; static jfieldID JNIRecipeAuthorField; static jfieldID JNIRecipeCopyrightField; static jfieldID JNIRecipeDescriptionField; static jfieldID JNIRecipeEmailField; static jfieldID JNIRecipeNameField; static jfieldID JNIRecipeStateField; static jfieldID JNIRecipeSynopsisField; static jfieldID JNIRecipeVersionField; static jfieldID PluginLibraryStateField; static jobject BooleanFALSEConstant; static jobject BooleanTRUEConstant; static jobject FrameGroupRAWConstant; static jobject FrameGroupCALIBConstant; static jobject FrameGroupPRODUCTConstant; static jobject FrameLevelTEMPORARYConstant; static jobject FrameLevelINTERMEDIATEConstant; static jobject FrameLevelFINALConstant; static jobject FrameTypeIMAGEConstant; static jobject FrameTypeMATRIXConstant; static jobject FrameTypeTABLEConstant; static jobject ParameterTypeBOOLConstant; static jobject ParameterTypeDOUBLEConstant; static jobject ParameterTypeINTConstant; static jobject ParameterTypeSTRINGConstant; static jstring VersionString; /* * Static function prototypes. */ static int doExec(JNIEnv *env, jobject recipe); static int ensureConstantsSetup(JNIEnv *env); static int ensureHandlersSetup(JNIEnv *env); static void out_message_handler(const cxchar *msg); static void err_message_handler(const cxchar *msg); static void default_log_message_handler(const cxchar *msg, cx_log_level_flags flags, const cxchar *, cxptr); static cpl_error_code setCplMessaging(cpl_boolean); static cpl_frame_group getFrameGroupID(JNIEnv *env, jobject jFgroup); static cpl_frame_level getFrameLevelID(JNIEnv *env, jobject jFlevel); static cpl_frame_type getFrameTypeID(JNIEnv *env, jobject jFtype); static cpl_frame *makeCplFrame(JNIEnv *env, jobject jFrame); static cpl_frameset *makeFrameSet(JNIEnv *env, jobjectArray jFrames); static jobject makeBoolean(int val); static jobject makeDouble(JNIEnv *env, double val); static jobject makeInteger(JNIEnv *env, int val); static jobject makeJavaFrame(JNIEnv *env, cpl_frame *frame); static jobject makeJNIRecipe(JNIEnv *env, const cpl_recipe *recipe, jobject jPluglib); static jobject makeParameter(JNIEnv *env, cpl_parameter *param, jobject jRecipe); static jobject makePluginLibrary(JNIEnv *env, jstring jLocation, lt_dlhandle dlhandle); static jobject makeString(JNIEnv *env, const char *val); static jobjectArray makeFrameArray(JNIEnv *env, cpl_frameset *fset); static jobjectArray makeParameterArray(JNIEnv *env, cpl_parameterlist *parlist, jobject jRecipe); static jthrowable makeLTDLException(JNIEnv *env); /* * CPLControl native methods. */ /* * Ensures that all the static initialisation required for this library * has been done. */ JNIEXPORT void JNICALL Java_org_eso_cpl_jni_CPLControl_nativeEnsureSetup(JNIEnv *env, jclass class) { if (class) { ensureConstantsSetup(env); ensureHandlersSetup(env); } } JNIEXPORT jstring JNICALL Java_org_eso_cpl_jni_CPLControl_nativeGetVersion(JNIEnv *env, jclass class) { return env && class ? VersionString : NULL; } /* * LibraryLoader native methods. */ /* * Calls lt_dlinit. */ JNIEXPORT void JNICALL Java_org_eso_cpl_jni_LibraryLoader_nativeLTDLInit(JNIEnv *env, jclass class) { if (class == NULL || lt_dlinit()) { (*env)->Throw(env, makeLTDLException(env)); } } /* * Calls lt_dlexit. */ JNIEXPORT void JNICALL Java_org_eso_cpl_jni_LibraryLoader_nativeLTDLExit(JNIEnv *env, jclass class) { if (lt_dlexit() || class == NULL) { (*env)->Throw(env, makeLTDLException(env)); } } /* * Attempts to open a library using LTDL with a given user search path, */ JNIEXPORT jobject JNICALL Java_org_eso_cpl_jni_LibraryLoader_nativeMakeLibrary(JNIEnv *env, jclass class, jstring jFilename, jstring jPath) { const char *filename = NULL; const char *path = NULL; lt_dlhandle dlhandle = NULL; jthrowable error = NULL; if (class == NULL) { error = makeLTDLException(env); } /* * Get C strings from the java ones. */ if (jFilename) { filename = (*env)->GetStringUTFChars(env, jFilename, NULL); } if (jPath) { path = (*env)->GetStringUTFChars(env, jPath, NULL); } /* * Attempt the open. */ if (path) { if (lt_dlsetsearchpath(path)) { error = makeLTDLException(env); } } if (!error) { dlhandle = lt_dlopen(filename); if (!dlhandle) { error = makeLTDLException(env); } } /* * Release the strings. */ if (filename) { (*env)->ReleaseStringUTFChars(env, jFilename, filename); } if (path) { (*env)->ReleaseStringUTFChars(env, jPath, path); } /* * Throw an exception if we picked one up. */ if (error) { (*env)->Throw(env, error); return NULL; } /* * Otherwise return a PluginLibrary object based on the returned handle. */ return dlhandle ? makePluginLibrary(env, jFilename, dlhandle) : NULL; } /* * JNIRecipe native methods. */ JNIEXPORT jint JNICALL Java_org_eso_cpl_jni_JNIRecipe_nativeInitialize(JNIEnv *env, jobject this) { EXECUTE_CPL_PLUGIN_FUNC(env, this, initialize) } JNIEXPORT jint JNICALL Java_org_eso_cpl_jni_JNIRecipe_nativeDeinitialize(JNIEnv *env, jobject this) { EXECUTE_CPL_PLUGIN_FUNC(env, this, deinitialize) } int doExec(JNIEnv *env, jobject recipe) { jbyteArray jState = NULL; cpl_plugin *plugin = NULL; int ok = 1; int status; /* Get the pointer to the function to execute. */ ok = ok && (jState = (*env)->GetObjectField(env, recipe, JNIRecipeStateField)) && (plugin = (cpl_plugin *) (*env)->GetByteArrayElements(env, jState, NULL)); /* Execute the function if it is non-NULL. */ if (ok) { const cpl_plugin_func cplfunc = cpl_plugin_get_exec(plugin); if (cplfunc) { currentEnv = env; status = (*cplfunc)(plugin); currentEnv = NULL; if (cpl_plugin_get_type(plugin) & CPL_PLUGIN_TYPE_RECIPE) { cpl_recipe* _recipe = (cpl_recipe*)plugin; /* Ignore a failure here */ (void)cpl_dfs_update_product_header(_recipe->frames); } } else { status = 0; } cpl_errorstate_set(inistate); /* Recover from recipe errors */ } else { status = -1; } /* Release array elements. */ if (plugin) { (*env)->ReleaseByteArrayElements(env, jState, (jbyte *) plugin, 0); } /* Return the execution status. */ return status; } JNIEXPORT jint JNICALL Java_org_eso_cpl_jni_JNIRecipe_nativeExecute(JNIEnv *env, jobject this, jstring jCurrentDir, jstring jExecDir) { const char *currentDir; const char *execDir; int status = 0; int ok = 1; int errnum = 0; int dirChanged = 0; /* * Try to change directory to execution directory if one is defined. */ if (jExecDir) { execDir = (*env)->GetStringUTFChars(env, jExecDir, NULL); dirChanged = !chdir(execDir); ok = ok && dirChanged; if (!ok) { errnum = errno; } (*env)->ReleaseStringUTFChars(env, jExecDir, execDir); } /* * Execute the recipe. */ if (ok) { status = doExec(env, this); } /* * Try to change back to the orginal directory if we changed before. */ if (dirChanged) { currentDir = (*env)->GetStringUTFChars(env, jCurrentDir, NULL); dirChanged = !chdir(currentDir); ok = ok && dirChanged; if (!dirChanged) { errnum = errno; } (*env)->ReleaseStringUTFChars(env, jCurrentDir, currentDir); } if (errnum) { (*env)->ThrowNew(env, CPLExceptionClass, strerror(errnum)); } return status; } JNIEXPORT jobjectArray JNICALL Java_org_eso_cpl_jni_JNIRecipe_nativeGetParameterArray(JNIEnv *env, jobject this) { int ok = 1; cpl_recipe *recipe = NULL; cpl_parameterlist *parlist = NULL; jbyteArray jState = NULL; /* * Get the pointer to the parameter list. */ ok = ok && (jState = (*env)->GetObjectField(env, this, JNIRecipeStateField)) && (recipe = (cpl_recipe *) (*env)->GetByteArrayElements(env, jState, NULL)) && (parlist = recipe->parameters); /* * Release array elements. */ if (recipe) { (*env)->ReleaseByteArrayElements(env, jState, (jbyte *) recipe, 0); } /* * Return an array of Parameter objects based on the parlist. */ return ok ? makeParameterArray(env, parlist, this) : NULL; } JNIEXPORT jobjectArray JNICALL Java_org_eso_cpl_jni_JNIRecipe_nativeGetFrameArray(JNIEnv *env, jobject this) { int ok = 1; cpl_recipe *recipe = NULL; cpl_frameset *fset = NULL; jbyteArray jState = NULL; jobjectArray rc; /* * Get the pointer to the frameset. */ ok = ok && (jState = (*env)->GetObjectField(env, this, JNIRecipeStateField)) && (recipe = (cpl_recipe *) (*env)->GetByteArrayElements(env, jState, NULL)) && (fset = recipe->frames); /* * Release array elements. */ if (recipe) { (*env)->ReleaseByteArrayElements(env, jState, (jbyte *) recipe, 0); } /* * Return an array of Frame objects based on the frameset. */ rc = ok ? makeFrameArray(env, fset) : NULL; return rc; } JNIEXPORT void JNICALL Java_org_eso_cpl_jni_JNIRecipe_nativeSetFrameArray(JNIEnv *env, jobject this, jobjectArray jFrames) { int ok = 1; cpl_recipe *recipe = NULL; cpl_frameset *fset = NULL; jbyteArray jState = NULL; /* * Create a new frameset based on the frames we have been given. */ ok = ok && (fset = makeFrameSet(env, jFrames)); /* * Get the pointer to the recipe structure. */ ok = ok && (jState = (*env)->GetObjectField(env, this, JNIRecipeStateField)) && (recipe = (cpl_recipe *) (*env)->GetByteArrayElements(env, jState, NULL)); /* * If a frameset exists there, destroy it. */ if (ok && recipe->frames) { cpl_frameset_delete(recipe->frames); } /* * And write the new frameset in. */ if (ok) { recipe->frames = fset; } /* * Release resources. */ if (recipe) { (*env)->ReleaseByteArrayElements(env, jState, (jbyte *) recipe, 0); } return; } /* * JNIParameterImp native methods. */ JNIEXPORT void JNICALL Java_org_eso_cpl_jni_JNIParameterImp_nativeSetValue(JNIEnv *env, jobject this, jobject jVal) { const char *strVal; int boolVal; int intVal; int ok = 1; double doubleVal; cpl_parameter **param_p = (cpl_parameter **)0; cpl_parameter *param = (cpl_parameter *)0; jbyteArray jState; /* * Get the parameter structure that this object refers to. */ ok = ok && (jState = (*env)->GetObjectField(env, this, JNIParameterImpStateField)) && (param_p = (cpl_parameter **) (*env)->GetByteArrayElements(env, jState, NULL)) && (param = *param_p); if (param_p) { (*env)->ReleaseByteArrayElements(env, jState, (jbyte *) param_p, 0); } /* * Set the value. */ switch (cpl_parameter_get_type(param)) { case CPL_TYPE_BOOL: boolVal = (*env)->CallBooleanMethod(env, jVal, BooleanBooleanValueMethod); ok = ok && !(*env)->ExceptionCheck(env) && !cpl_parameter_set_bool(param, boolVal); break; case CPL_TYPE_INT: intVal = (*env)->CallIntMethod(env, jVal, IntegerIntValueMethod); ok = ok && !(*env)->ExceptionCheck(env) && !cpl_parameter_set_int(param, intVal); break; case CPL_TYPE_DOUBLE: doubleVal = (*env)->CallDoubleMethod(env, jVal, DoubleDoubleValueMethod); ok = ok && !(*env)->ExceptionCheck(env) && !cpl_parameter_set_double(param, doubleVal); break; case CPL_TYPE_STRING: strVal = NULL; ok = ok && (strVal = (*env)->GetStringUTFChars(env, (jstring) jVal, NULL)) && !cpl_parameter_set_string(param, strVal); if (strVal) { (*env)->ReleaseStringUTFChars(env, (jstring) jVal, strVal); } break; default: (*env)->ThrowNew(env, IllegalStateExceptionClass, "Unknown parameter type" ); return; } /* * An error shouldn't happen here, since validation before this stage * should have caught bad values, but better check. */ if (!ok && !(*env)->ExceptionCheck(env)) { (*env)->ThrowNew(env, IllegalArgumentExceptionClass, "Error setting value"); } return; } /********************************************************************** * PluginLibrary native methods. **********************************************************************/ JNIEXPORT void JNICALL Java_org_eso_cpl_jni_PluginLibrary_nativeUnload(JNIEnv *env, jobject this) { jobject jState = NULL; lt_dlhandle *handle_p = NULL; int ok = 1; jthrowable error = NULL; ok = ok && (jState = (*env)->GetObjectField(env, this, PluginLibraryStateField)) && (handle_p = (lt_dlhandle *) (*env)->GetByteArrayElements(env, jState, NULL)); if (ok) { if (!lt_dlclose(*handle_p)) { error = makeLTDLException(env); } } if (handle_p) { (*env)->ReleaseByteArrayElements(env, jState, (jbyte *) handle_p, 0); } if (error) { (*env)->Throw(env, error); } return; } /* * NativeTest native methods. */ #if defined (HAVE_ORG_ESO_CPL_TEST_NATIVE_TEST_H) && \ defined (ENABLE_NATIVE_TESTS) JNIEXPORT void JNICALL Java_org_eso_cpl_test_NativeTest_nativeLTDLTest(JNIEnv *env, jclass class) { const char *lname = "gimasterbias.so"; lt_dlhandle dlhandle; lt_dlinit(); dlhandle = lt_dlopen(lname); /* * FIXME: It's not found because the path is wrong - this * doesn't prove much. */ lt_dlexit(); } #endif /********************************************************************** * Static functions for determining compile-time constant values. **********************************************************************/ #define TEST_ID_NAME(Xname) \ if (!strcmp(idname, #Xname)) { \ id = Xname; \ done = 1; \ } static cpl_frame_group getFrameGroupID(JNIEnv *env, jobject jFgroup) { cpl_frame_group id = CPL_FRAME_GROUP_NONE; jstring jIdname = (jstring)0; const char *idname = (char *)0; int done = 0; int ok = 1; ok = ok && jFgroup && (!(*env)->ExceptionCheck(env)) && (jIdname = (*env)->GetObjectField(env, jFgroup, FrameGroupIDNameField)) && (idname = (*env)->GetStringUTFChars(env, jIdname, NULL)); if (ok) { TEST_ID_NAME(CPL_FRAME_GROUP_NONE) else TEST_ID_NAME(CPL_FRAME_GROUP_RAW) else TEST_ID_NAME(CPL_FRAME_GROUP_CALIB) else TEST_ID_NAME(CPL_FRAME_GROUP_PRODUCT) (*env)->ReleaseStringUTFChars(env, jIdname, idname); } if (!done && !(*env)->ExceptionCheck(env)) { (*env)->ThrowNew(env, RuntimeExceptionClass, "Unknown frame group ID"); } return id; } static cpl_frame_level getFrameLevelID(JNIEnv *env, jobject jFlevel) { cpl_frame_level id = CPL_FRAME_LEVEL_NONE; jstring jIdname = (jstring)0; const char *idname = (char *)0; int done = 0; int ok = 1; ok = ok && jFlevel && (!(*env)->ExceptionCheck(env)) && (jIdname = (*env)->GetObjectField(env, jFlevel, FrameLevelIDNameField)) && (idname = (*env)->GetStringUTFChars(env, jIdname, NULL)); if (ok) { TEST_ID_NAME(CPL_FRAME_LEVEL_NONE) else TEST_ID_NAME(CPL_FRAME_LEVEL_TEMPORARY) else TEST_ID_NAME(CPL_FRAME_LEVEL_INTERMEDIATE) else TEST_ID_NAME(CPL_FRAME_LEVEL_FINAL) (*env)->ReleaseStringUTFChars(env, jIdname, idname); } if (!done && (*env)->ExceptionCheck(env)) { (*env)->ThrowNew(env, RuntimeExceptionClass, "Unknown frame level ID"); } return id; } static cpl_frame_type getFrameTypeID(JNIEnv *env, jobject jFtype) { cpl_frame_type id = CPL_FRAME_TYPE_NONE; jstring jIdname = (jstring)0; const char *idname = (char *)0; int done = 0; int ok = 1; ok = ok && jFtype && (!(*env)->ExceptionCheck(env)) && (jIdname = (*env)->GetObjectField(env, jFtype, FrameTypeIDNameField)) && (idname = (*env)->GetStringUTFChars(env, jIdname, NULL)); if (ok) { TEST_ID_NAME(CPL_FRAME_TYPE_NONE) else TEST_ID_NAME(CPL_FRAME_TYPE_IMAGE) else TEST_ID_NAME(CPL_FRAME_TYPE_MATRIX) else TEST_ID_NAME(CPL_FRAME_TYPE_TABLE) } if (!done && (*env)->ExceptionCheck(env)) { (*env)->ThrowNew(env, RuntimeExceptionClass, "Unknown frame type ID"); } return id; } #undef TEST_ID_NAME /********************************************************************** * Static functions. **********************************************************************/ /* Define some macros for doing the reflection which provides some of * the static variables required here. Each of these macros returns * true (non-zero) only if the reflection has gone according to plan; * if a false (zero) value is returned then something has gone wrong, * and no further JNI methods should be called since an exception is * probably pending. */ #define DEFINE_CLASS(Xname, Xpath) \ (Xname = (*env)->NewGlobalRef(env, (*env)->FindClass(env, Xpath))) #define DEFINE_CONSTRUCTOR(Xname, Xclass, Xargs) \ (Xname = (*env)->GetMethodID(env, Xclass, "", "(" Xargs ")V")) #define DEFINE_METHOD(Xname, Xclass, Xmethod, Xsig) \ (Xname = (*env)->GetMethodID(env, Xclass, Xmethod, Xsig)) #define DEFINE_STATICMETHOD(Xname, Xclass, Xmethod, Xsig) \ (Xname = (*env)->GetStaticMethodID(env, Xclass, Xmethod, Xsig)) #define DEFINE_FIELD(Xname, Xclass, Xfield, Xsig) \ (Xname = (*env)->GetFieldID(env, Xclass, Xfield, Xsig)) #define DEFINE_CONSTANT(Xname, Xclass, Xfield, Xsig) \ ((constField = (*env)->GetStaticFieldID(env, Xclass, Xfield, Xsig)) && \ (Xname = (*env)->NewGlobalRef(env, \ (*env)->GetStaticObjectField(env, Xclass, constField)))) /* * Lazily performs initialization of some static variables required here. * If the initialization succeeds, a non-zero value is returned. * If it fails, there is a zero return and an exception is thrown. */ static int ensureConstantsSetup(JNIEnv *env) { jfieldID constField; if (!isConstantsSetup) { int ok = 1; /* Do the reflection. */ ok = ok && DEFINE_CLASS(AssertionErrorClass, "java/lang/AssertionError") && DEFINE_CLASS(BooleanClass, "java/lang/Boolean") && DEFINE_CLASS(DoubleClass, "java/lang/Double") && DEFINE_CLASS(FileClass, "java/io/File") && DEFINE_CLASS(IllegalArgumentExceptionClass, "java/lang/IllegalArgumentException") && DEFINE_CLASS(IllegalStateExceptionClass, "java/lang/IllegalStateException") && DEFINE_CLASS(IntegerClass, "java/lang/Integer") && DEFINE_CLASS(LinkageErrorClass, "java/lang/LinkageError") && DEFINE_CLASS(NullPointerExceptionClass, "java/lang/NullPointerException") && DEFINE_CLASS(ObjectClass, "java/lang/Object") && DEFINE_CLASS(PrintStreamClass, "java/io/PrintStream") && DEFINE_CLASS(RuntimeExceptionClass, "java/lang/RuntimeException") && DEFINE_CLASS(StringClass, "java/lang/String") && DEFINE_CLASS(BadAPIPluginClass, "org/eso/cpl/jni/OtherPlugin$BadAPIPlugin") && DEFINE_CLASS(CPLControlClass, "org/eso/cpl/jni/CPLControl") && DEFINE_CLASS(CPLExceptionClass, "org/eso/cpl/CPLException") && DEFINE_CLASS(EnumConstraintClass, "org/eso/cpl/EnumConstraint") && DEFINE_CLASS(FrameClass, "org/eso/cpl/Frame") && DEFINE_CLASS(FrameGroupClass, "org/eso/cpl/FrameGroup") && DEFINE_CLASS(FrameLevelClass, "org/eso/cpl/FrameLevel") && DEFINE_CLASS(FrameTypeClass, "org/eso/cpl/FrameType") && DEFINE_CLASS(JNIParameterImpClass, "org/eso/cpl/jni/JNIParameterImp") && DEFINE_CLASS(JNIRecipeClass, "org/eso/cpl/jni/JNIRecipe") && DEFINE_CLASS(LTDLExceptionClass, "org/eso/cpl/jni/LTDLException") && DEFINE_CLASS(NonRecipePluginClass, "org/eso/cpl/jni/OtherPlugin$NonRecipePlugin") && DEFINE_CLASS(OtherPluginClass, "org/eso/cpl/jni/OtherPlugin") && DEFINE_CLASS(ParameterClass, "org/eso/cpl/Parameter") && DEFINE_CLASS(ParameterTypeClass, "org/eso/cpl/ParameterType") && DEFINE_CLASS(ParameterValueExceptionClass, "org/eso/cpl/ParameterValueException") && DEFINE_CLASS(PluginLibraryClass, "org/eso/cpl/jni/PluginLibrary") && DEFINE_CLASS(RangeConstraintClass, "org/eso/cpl/RangeConstraint") && DEFINE_CONSTRUCTOR(BadAPIPluginConstructor, BadAPIPluginClass, "Ljava/lang/String;II") && DEFINE_CONSTRUCTOR(DoubleConstructor, DoubleClass, "D") && DEFINE_CONSTRUCTOR(EnumConstraintConstructor, EnumConstraintClass, "[Ljava/lang/Object;") && DEFINE_CONSTRUCTOR(FileConstructor, FileClass, "Ljava/lang/String;") && DEFINE_CONSTRUCTOR(FrameConstructor, FrameClass, "Ljava/io/File;") && DEFINE_CONSTRUCTOR(IntegerConstructor, IntegerClass, "I") && DEFINE_CONSTRUCTOR(JNIParameterImpConstructor, JNIParameterImpClass, "[BLorg/eso/cpl/jni/JNIRecipe;" "Lorg/eso/cpl/ParameterType;" "Lorg/eso/cpl/ParameterConstraint;" "Ljava/lang/Object;") && DEFINE_CONSTRUCTOR(JNIRecipeConstructor, JNIRecipeClass, "[BLorg/eso/cpl/jni/PluginLibrary;") && DEFINE_CONSTRUCTOR(LTDLExceptionConstructor, LTDLExceptionClass, "Ljava/lang/String;") && DEFINE_CONSTRUCTOR(NonRecipePluginConstructor, NonRecipePluginClass, "Ljava/lang/String;") && DEFINE_CONSTRUCTOR(ParameterConstructor, ParameterClass, "Lorg/eso/cpl/ParameterImp;") && DEFINE_CONSTRUCTOR(PluginLibraryConstructor, PluginLibraryClass, "[BLjava/lang/String;[Lorg/eso/cpl/jni/JNIRecipe;" "[Lorg/eso/cpl/jni/OtherPlugin;") && DEFINE_CONSTRUCTOR(RangeConstraintConstructor, RangeConstraintClass, "Lorg/eso/cpl/ParameterType;" "Ljava/lang/Object;Ljava/lang/Object;") && DEFINE_METHOD(BooleanBooleanValueMethod, BooleanClass, "booleanValue", "()Z") && DEFINE_METHOD(DoubleDoubleValueMethod, DoubleClass, "doubleValue", "()D") && DEFINE_METHOD(IntegerIntValueMethod, IntegerClass, "intValue", "()I") && DEFINE_METHOD(PrintStreamPrintlnMethod, PrintStreamClass, "println", "(Ljava/lang/String;)V") && DEFINE_STATICMETHOD(CPLControlErrMessageMethod, CPLControlClass, "errMessage", "(Ljava/lang/String;)V") && DEFINE_STATICMETHOD(CPLControlLogMessageMethod, CPLControlClass, "logMessage", "(Ljava/lang/String;Ljava/lang/String;I)V") && DEFINE_STATICMETHOD(CPLControlOutMessageMethod, CPLControlClass, "outMessage", "(Ljava/lang/String;)V") && DEFINE_FIELD(FrameCanonicalPathField, FrameClass, "canonicalPath_", "Ljava/lang/String;") && DEFINE_FIELD(FrameGroupField, FrameClass, "group_", "Lorg/eso/cpl/FrameGroup;") && DEFINE_FIELD(FrameLevelField, FrameClass, "level_", "Lorg/eso/cpl/FrameLevel;") && DEFINE_FIELD(FrameTagField, FrameClass, "tag_", "Ljava/lang/String;") && DEFINE_FIELD(FrameTypeField, FrameClass, "type_", "Lorg/eso/cpl/FrameType;") && DEFINE_FIELD(FrameGroupIDNameField, FrameGroupClass, "idName_", "Ljava/lang/String;") && DEFINE_FIELD(FrameLevelIDNameField, FrameLevelClass, "idName_", "Ljava/lang/String;") && DEFINE_FIELD(FrameTypeIDNameField, FrameTypeClass, "idName_", "Ljava/lang/String;") && DEFINE_FIELD(JNIParameterImpStateField, JNIParameterImpClass, "nativeState_", "[B") && DEFINE_FIELD(JNIParameterImpContextField, JNIParameterImpClass, "context_", "Ljava/lang/String;") && DEFINE_FIELD(JNIParameterImpHelpField, JNIParameterImpClass, "help_", "Ljava/lang/String;") && DEFINE_FIELD(JNIParameterImpNameField, JNIParameterImpClass, "name_", "Ljava/lang/String;") && DEFINE_FIELD(JNIParameterImpTagField, JNIParameterImpClass, "tag_", "Ljava/lang/String;") && DEFINE_FIELD(JNIRecipeAuthorField, JNIRecipeClass, "author_", "Ljava/lang/String;") && DEFINE_FIELD(JNIRecipeCopyrightField, JNIRecipeClass, "copyright_", "Ljava/lang/String;") && DEFINE_FIELD(JNIRecipeDescriptionField, JNIRecipeClass, "description_", "Ljava/lang/String;") && DEFINE_FIELD(JNIRecipeEmailField, JNIRecipeClass, "email_", "Ljava/lang/String;") && DEFINE_FIELD(JNIRecipeNameField, JNIRecipeClass, "name_", "Ljava/lang/String;") && DEFINE_FIELD(JNIRecipeStateField, JNIRecipeClass, "nativeState_", "[B") && DEFINE_FIELD(JNIRecipeSynopsisField, JNIRecipeClass, "synopsis_", "Ljava/lang/String;") && DEFINE_FIELD(JNIRecipeVersionField, JNIRecipeClass, "version_", "J") && DEFINE_FIELD(PluginLibraryStateField, PluginLibraryClass, "nativeState_", "[B") && DEFINE_CONSTANT(BooleanFALSEConstant, BooleanClass, "FALSE", "Ljava/lang/Boolean;") && DEFINE_CONSTANT(BooleanTRUEConstant, BooleanClass, "TRUE", "Ljava/lang/Boolean;") && DEFINE_CONSTANT(FrameGroupRAWConstant, FrameGroupClass, "RAW", "Lorg/eso/cpl/FrameGroup;") && DEFINE_CONSTANT(FrameGroupCALIBConstant, FrameGroupClass, "CALIB", "Lorg/eso/cpl/FrameGroup;") && DEFINE_CONSTANT(FrameGroupPRODUCTConstant, FrameGroupClass, "PRODUCT", "Lorg/eso/cpl/FrameGroup;") && DEFINE_CONSTANT(FrameLevelTEMPORARYConstant, FrameLevelClass, "TEMPORARY", "Lorg/eso/cpl/FrameLevel;") && DEFINE_CONSTANT(FrameLevelINTERMEDIATEConstant, FrameLevelClass, "INTERMEDIATE", "Lorg/eso/cpl/FrameLevel;") && DEFINE_CONSTANT(FrameLevelFINALConstant, FrameLevelClass, "FINAL", "Lorg/eso/cpl/FrameLevel;") && DEFINE_CONSTANT(FrameTypeIMAGEConstant, FrameTypeClass, "IMAGE", "Lorg/eso/cpl/FrameType;") && DEFINE_CONSTANT(FrameTypeMATRIXConstant, FrameTypeClass, "MATRIX", "Lorg/eso/cpl/FrameType;") && DEFINE_CONSTANT(FrameTypeTABLEConstant, FrameTypeClass, "TABLE", "Lorg/eso/cpl/FrameType;") && DEFINE_CONSTANT(ParameterTypeBOOLConstant, ParameterTypeClass, "BOOL", "Lorg/eso/cpl/ParameterType;") && DEFINE_CONSTANT(ParameterTypeDOUBLEConstant, ParameterTypeClass, "DOUBLE", "Lorg/eso/cpl/ParameterType;") && DEFINE_CONSTANT(ParameterTypeINTConstant, ParameterTypeClass, "INT", "Lorg/eso/cpl/ParameterType;") && DEFINE_CONSTANT(ParameterTypeSTRINGConstant, ParameterTypeClass, "STRING", "Lorg/eso/cpl/ParameterType;") && (VersionString = (*env)->NewGlobalRef(env, (*env)->NewStringUTF(env, JAVACPL_VERSION))) && 1; /* If there was a failure but we don't have an exception to show * for it, throw an exception here. */ if (!ok && !(*env)->ExceptionOccurred(env)) { (*env)->ThrowNew(env, RuntimeExceptionClass, "Reflection trouble"); } isConstantsSetup = ok; } return isConstantsSetup; } #undef DEFINE_CLASS #undef DEFINE_CONSTRUCTOR #undef DEFINE_METHOD #undef DEFINE_STATICMETHOD #undef DEFINE_FIELD #undef DEFINE_CONSTANT static int ensureHandlersSetup(JNIEnv *env) { if (!isHandlersSetup) { int ok = 1; cpl_init(CPL_INIT_DEFAULT); if (cpl_error_get_code()) { cpl_msg_warning("Java CPL", "CPL initialization failed: '%s' at %s\n", cpl_error_get_message(), cpl_error_get_where()); } else { (void)setCplMessaging(CPL_TRUE); } #ifndef GASGANO_HAS_NO_CPL_EXCEPTION_HANDLER if (cpl_error_get_code() && !(*env)->ExceptionCheck(env)) { /* The only option for handling the error at this point is to throw an exception. */ (*env)->ThrowNew(env, CPLExceptionClass, "CPL initialization failed"); } #endif inistate = cpl_errorstate_get(); isHandlersSetup = ok; } return isHandlersSetup; } /* * Sets up the stdout, stderr and default logging handlers that are used by * cext's message handling facilities. */ static cpl_error_code setCplMessaging(cpl_boolean startlog) { cpl_errorstate prestate = cpl_errorstate_get(); /* cx_log_level_flags cx_level = CX_LOG_LEVEL_DEBUG; */ /* cpl_msg_severity cpl_level = CPL_MSG_DEBUG; */ cpl_msg_severity cpl_level = CPL_MSG_INFO; cpl_msg_severity cpl_log_level = CPL_MSG_INFO; cpl_msg_set_domain("JavaCPL"); cpl_msg_set_domain_on(); cx_print_set_handler(out_message_handler); cx_printerr_set_handler(err_message_handler); cx_log_set_default_handler(default_log_message_handler); cpl_msg_set_time_on(); cpl_msg_set_component_off(); cpl_msg_set_domain_off(); cpl_msg_set_width(132); cpl_msg_set_indentation(4); cpl_msg_set_level(cpl_level); if (startlog) cpl_msg_set_log_level(cpl_log_level); /* Do this only once */ if (!cpl_errorstate_is_equal(prestate)) { cpl_msg_warning("Java CPL", "CPL-messaging initialization failed:\n"); cpl_errorstate_dump(prestate, CPL_FALSE, NULL); return cpl_error_set_where(cpl_func); } else { return CPL_ERROR_NONE; } } static void out_message_handler(const cxchar *msg) { JNIEnv *env; jstring jMsg = (jstring)0; int ok = 1; /* java method cannot be called from multiple threads * for unknown reasons a lock is insufficient too */ #ifdef _OPENMP ok = omp_get_thread_num() == 0; #endif ok = ok && (env = currentEnv); if (msg) { ok = ok && (jMsg = (*env)->NewStringUTF(env, msg)); } if (ok) { (*env)->CallStaticVoidMethod(env, CPLControlClass, CPLControlOutMessageMethod, jMsg); } else { fprintf(stdout, "Lost output message: %s\n", msg ? msg : "null"); } } static void err_message_handler(const cxchar *msg) { JNIEnv *env; jstring jMsg = (jstring)0; int ok = 1; /* java method cannot be called from multiple threads * for unknown reasons a lock is insufficient too */ #ifdef _OPENMP ok = omp_get_thread_num() == 0; #endif ok = ok && (env = currentEnv); if (msg) { ok = ok && (jMsg = (*env)->NewStringUTF(env, msg)); } if (ok) { (*env)->CallStaticVoidMethod(env, CPLControlClass, CPLControlErrMessageMethod, jMsg); } else { fprintf(stderr, "Lost error message: %s\n", msg ? msg : "null"); } } static void default_log_message_handler(const cxchar *domain, cx_log_level_flags flags, const cxchar *msg, cxptr ptr) { JNIEnv *env; jstring jDomain; jstring jMsg; int ok = 1; /* java method cannot be called from multiple threads * for unknown reasons a lock is insufficient too */ #ifdef _OPENMP ok = omp_get_thread_num() == 0; #endif ok = ok && (env = currentEnv); jMsg = NULL; if (msg) { ok = ok && (jMsg = (*env)->NewStringUTF(env, msg)); } jDomain = NULL; if (domain) { ok = ok && (jDomain = (*env)->NewStringUTF(env, domain)); } if (ok) { (*env)->CallStaticVoidMethod(env, CPLControlClass, CPLControlLogMessageMethod, jDomain, jMsg, (jint) flags); } else { /* Use ptr to avoid compiler warning */ char * nullmsg = cpl_sprintf("null (ptr=%p)", (const void*)ptr); fprintf(stderr, "Lost log message: %s\n", msg ? msg : nullmsg); cpl_free(nullmsg); } } /* * Returns an LTDLException with a message taken from LTDL's record of * the most recent error to occur. */ static jthrowable makeLTDLException(JNIEnv *env) { const char *msg; jstring jMsg; jthrowable error = (jthrowable)0; /* Check that some constants have been initialized. If they have not * for some reason, throw the exception which describes why not. */ if (!ensureConstantsSetup(env)) { error = (*env)->ExceptionOccurred(env); (*env)->ExceptionClear(env); return error; } /* Get the error message. */ msg = lt_dlerror(); if (!msg) { msg = "no error"; } jMsg = (*env)->NewStringUTF(env, msg); if (jMsg) { error = (*env)->NewObject(env, LTDLExceptionClass, LTDLExceptionConstructor, jMsg); } /* If for some reason construction of the exception failed, return the * reason for its failure, and clear the exception. */ if (!error) { error = (*env)->ExceptionOccurred(env); (*env)->ExceptionClear(env); } /* Return the exception. */ return error; } /* * Constructs and returns a PluginLibrary object from a DLL handle. */ static jobject makePluginLibrary(JNIEnv *env, jstring jLocation, lt_dlhandle dlhandle) { jobject jPluglib = (jobject)0; #ifdef GASGANO_HAS_NO_CPL_EXCEPTION_HANDLER (void)setCplMessaging(CPL_FALSE); inistate = cpl_errorstate_get(); #else if (cpl_error_get_code() || setCplMessaging(CPL_FALSE) != CPL_ERROR_NONE) { cpl_msg_warning("Java CPL", "Not loading plugins due to pre-existing " "CPL error\n"); } else #endif if (1) { const char * cpl_version; int (*list_function)(cpl_pluginlist *); const cpl_plugin *plugin; cpl_pluginlist *pluginlist; jsize nplugin; jsize nrec; jsize nother; jsize irec; jsize iother; jobjectArray jRecipes = (jobjectArray)0; jobjectArray jOthers = (jobjectArray)0; jbyteArray jState = (jobjectArray)0; jbyte *state = NULL; int ok = 1; /* Get the listing function from the DLL. The listing function * is declared like this in cpl_plugininfo.h: * * int cpl_plugin_get_info(cpl_pluginlist *); */ /* Cast from object pointer to function pointer is not allowed in ISO C. Circumvent the cast with a union... */ union cast_dl_ { void * address; int (*function)(cpl_pluginlist *); } cast_dl; if (sizeof(cast_dl.address) != sizeof(cast_dl.function)) { /* Something serious is wrong, bail out */ #ifndef GASGANO_HAS_NO_CPL_EXCEPTION_HANDLER (*env)->Throw(env, makeLTDLException(env)); #endif return jPluglib; } cast_dl.address = (void*)lt_dlsym(dlhandle, "cpl_plugin_get_info"); list_function = cast_dl.function; if (list_function == NULL) { /* The listing function is not available */ #ifndef GASGANO_HAS_NO_CPL_EXCEPTION_HANDLER (*env)->Throw(env, makeLTDLException(env)); #endif return jPluglib; } cpl_version = cpl_version_get_version(); if (cpl_version != NULL && strcmp(PACKAGE_VERSION, cpl_version)) { /* The plugin has caused functions from libcplcore.so that have not already been loaded, to be loaded from the wrong libcplcore.so, f.ex. the libcplcore.so used to compile the plugin */ #ifndef GASGANO_HAS_NO_CPL_EXCEPTION_HANDLER (*env)->ThrowNew(env, CPLExceptionClass, "CPL " PACKAGE_VERSION " library version error"); #endif return jPluglib; } /* Populate a plugin list with all the plugins known by this DLL. * list_function returns an int, zero on success and one on failure. */ pluginlist = cpl_pluginlist_new(); ok = ok && !( (*list_function)(pluginlist) ); /* Split the list of plugins into two mutually exclusive sublists; * usable recipes and the rest. */ nplugin = cpl_pluginlist_get_size(pluginlist); /* Count the number of recipes */ nrec = 0; for (plugin = cpl_pluginlist_get_first(pluginlist); plugin; plugin = cpl_pluginlist_get_next(pluginlist)) { const unsigned int papi = cpl_plugin_get_api(plugin); const cpl_plugin_type ptype = cpl_plugin_get_type(plugin); if ((papi == CPL_PLUGIN_API) && (ptype & CPL_PLUGIN_TYPE_RECIPE)) { nrec++; } } nother = nplugin - nrec; /* Construct a new PluginLibrary object which will contain the recipes. */ ok = ok && (jState = (*env)->NewByteArray(env, sizeof(lt_dlhandle))) && (state = (*env)->GetByteArrayElements(env, jState, NULL)) && (jRecipes = (*env)->NewObjectArray(env, nrec, JNIRecipeClass, NULL)) && (jOthers = (*env)->NewObjectArray(env, nother, OtherPluginClass, NULL)) && (jPluglib = (*env)->NewObject(env, PluginLibraryClass, PluginLibraryConstructor, jState, jLocation, jRecipes, jOthers)); if (state && ok) { *((lt_dlhandle *) state) = dlhandle; (*env)->ReleaseByteArrayElements(env, jState, state, 0); } /* Populate the array of recipe objects. */ /* Populate the array of other plugins. */ irec = 0; iother = 0; for (plugin = cpl_pluginlist_get_first(pluginlist); ok && plugin; plugin = cpl_pluginlist_get_next(pluginlist)) { const unsigned int papi = cpl_plugin_get_api(plugin); const cpl_plugin_type ptype = cpl_plugin_get_type(plugin); if ((papi == CPL_PLUGIN_API) && (ptype & CPL_PLUGIN_TYPE_RECIPE)) { const cpl_recipe *recipe = (const cpl_recipe *)plugin; jobject jRecipe = (jobject)0; ok = ok && (jRecipe = makeJNIRecipe(env, recipe, jPluglib)); if (ok) { (*env)->SetObjectArrayElement(env, jRecipes, irec, jRecipe); } irec++; } else { jstring jName; jobject jOther = (jobject)0; const char *name = cpl_plugin_get_name(plugin); /* If we were truly paranoid we wouldn't attempt to read the name * unless we know the API versions match, but it's probably OK... */ jName = (*env)->NewStringUTF(env, name); if (papi != CPL_PLUGIN_API) { ok = ok && (jOther = (*env)->NewObject(env, BadAPIPluginClass, BadAPIPluginConstructor, jName, (jint) CPL_PLUGIN_API, (jint) papi)); } else { cx_assert((ptype & CPL_PLUGIN_TYPE_RECIPE) == 0); ok = ok && (jOther = (*env)->NewObject(env, NonRecipePluginClass, NonRecipePluginConstructor, jName)); } if (ok) { (*env)->SetObjectArrayElement(env, jOthers, iother, jOther); } iother++; } } cx_assert( irec == nrec ); cx_assert( iother == nother ); cx_assert( nother + nrec == nplugin ); /* Free workspace. */ cpl_pluginlist_delete(pluginlist); } /* Return the library object. */ return jPluglib; } /* * Turns a CPL frameset into an array of java Frame objects. */ static jobjectArray makeFrameArray(JNIEnv *env, cpl_frameset *fset) { jobject jFrame = (jobject)0; jobjectArray jFrames = (jobjectArray)0; cpl_frame *frame; jsize ifrm; jsize nfrm; int ok = 1; /* Determine the size of the frameset. */ nfrm = cpl_frameset_get_size(fset); /* Construct an empty array to hold the new Frame objects. */ ok = ok && (jFrames = (*env)->NewObjectArray(env, nfrm, FrameClass, NULL)); /* Populate the array with new Frame objects constructed from the frames * in the frameset. */ ifrm = 0; cpl_frameset_iterator *it = cpl_frameset_iterator_new(fset); while (ok && (frame = cpl_frameset_iterator_get(it))) { ok = ok && (jFrame = makeJavaFrame(env, frame)); if (ok) { (*env)->SetObjectArrayElement(env, jFrames, ifrm++, jFrame); } cpl_frameset_iterator_advance(it, 1); } cpl_frameset_iterator_delete(it); /* Return the array. */ return ok ? jFrames : NULL; } /* * Turns a CPL frame into a java Frame object. */ static jobject makeJavaFrame(JNIEnv *env, cpl_frame *frame) { jobject jFrame; const char *filename; const char *tag; jstring jFilename; jobject jFile; jstring jTag; jobject jFtype; jobject jFgroup; jobject jFlevel; int frameType; int frameGroup; int frameLevel; /* Get the frame's filename as a java string. */ filename = cpl_frame_get_filename(frame); jFilename = filename ? (*env)->NewStringUTF(env, filename) : NULL; jFile = jFilename ? (*env)->NewObject(env, FileClass, FileConstructor, jFilename) : NULL; /* Get the tag as a java string. */ tag = cpl_frame_get_tag(frame); jTag = tag ? (*env)->NewStringUTF(env, tag) : NULL; /* Get the frame type. */ jFtype = NULL; /* In order to handle the possible addition of "new" frame types without throwing an exception, the default case behaves the same as type NONE. */ frameType = cpl_frame_get_type(frame); switch (frameType) { case CPL_FRAME_TYPE_NONE: jFtype = NULL; break; case CPL_FRAME_TYPE_IMAGE: jFtype = FrameTypeIMAGEConstant; break; case CPL_FRAME_TYPE_MATRIX: jFtype = FrameTypeMATRIXConstant; break; case CPL_FRAME_TYPE_TABLE: jFtype = FrameTypeTABLEConstant; break; default: /* (*env)->ThrowNew(env, RuntimeExceptionClass, "Unknown frame type"); return NULL; map unexpected values to NULL */ cpl_msg_warning("Java CPL", "Frame %s has unexpected frame type: %d\n", filename, frameType); jFtype = NULL; } /* Get the frame group. */ jFgroup = NULL; /* In order to handle the possible addition of "new" frame groups without throwing an exception, the default case behaves the same as group NONE. */ frameGroup = cpl_frame_get_group(frame); switch (frameGroup) { case CPL_FRAME_GROUP_NONE: jFgroup = NULL; break; case CPL_FRAME_GROUP_RAW: jFgroup = FrameGroupRAWConstant; break; case CPL_FRAME_GROUP_CALIB: jFgroup = FrameGroupCALIBConstant; break; case CPL_FRAME_GROUP_PRODUCT: jFgroup = FrameGroupPRODUCTConstant; break; default: /* (*env)->ThrowNew(env, RuntimeExceptionClass, "Unknown frame group"); return NULL; */ cpl_msg_warning("Java CPL", "Frame %s has unexpected frame group: %d\n", filename, frameGroup); jFgroup = NULL; } /* Get the frame level. */ /* In order to handle the possible addition of "new" frame levels without throwing an exception, the default case behaves the same as level NONE. */ jFlevel = NULL; frameLevel = cpl_frame_get_level(frame); switch (frameLevel) { case CPL_FRAME_LEVEL_NONE: jFlevel = NULL; break; case CPL_FRAME_LEVEL_TEMPORARY: jFlevel = FrameLevelTEMPORARYConstant; break; case CPL_FRAME_LEVEL_INTERMEDIATE: jFlevel = FrameLevelINTERMEDIATEConstant; break; case CPL_FRAME_LEVEL_FINAL: jFlevel = FrameLevelFINALConstant; break; default: /* (*env)->ThrowNew(env, RuntimeExceptionClass, "Unknown frame level"); return NULL; */ cpl_msg_warning("Java CPL", "Frame %s has unexpected frame level: %d\n", filename, frameLevel); jFlevel = NULL; } /* Construct a new Frame object and populate its fields with the * values we have calculated. */ jFrame = (*env)->NewObject(env, FrameClass, FrameConstructor, jFile); (*env)->SetObjectField(env, jFrame, FrameTagField, jTag); (*env)->SetObjectField(env, jFrame, FrameTypeField, jFtype); (*env)->SetObjectField(env, jFrame, FrameGroupField, jFgroup); (*env)->SetObjectField(env, jFrame, FrameLevelField, jFlevel); /* Return the populated object. */ return jFrame; } /* * Turns an array of java Frame objects into a CPL frameset. */ static cpl_frameset *makeFrameSet(JNIEnv *env, jobjectArray jFrames) { cpl_frameset *fset = (cpl_frameset *)0; cpl_frame *frame = (cpl_frame *)0; jobject jFrame = (jobject)0; jsize nfrm; jsize ifrm; int ok = 1; /* Get the size of the frame array. */ nfrm = (*env)->GetArrayLength(env, jFrames); if ((*env)->ExceptionCheck(env)) { return NULL; } ok = ok && (fset = cpl_frameset_new()); for (ifrm = 0; ok && ifrm < nfrm; ifrm++) { ok = ok && (jFrame = (*env)->GetObjectArrayElement(env, jFrames, ifrm)) && (frame = makeCplFrame(env, jFrame)) && (!cpl_frameset_insert(fset, frame)); if (!jFrame && !(*env)->ExceptionCheck(env)) { (*env)->ThrowNew(env, NullPointerExceptionClass, NULL); return NULL; } } return ok ? fset : NULL; } static cpl_frame *makeCplFrame(JNIEnv *env, jobject jFrame) { cpl_frame *frame; jstring jFilename; jstring jTag; jobject jFtype; jobject jFgroup; jobject jFlevel; frame = cpl_frame_new(); if (!frame) { return NULL; } jFilename = (*env)->GetObjectField(env, jFrame, FrameCanonicalPathField); if (jFilename) { const char *filename = (*env)->GetStringUTFChars(env, jFilename, NULL); cpl_frame_set_filename(frame, filename); (*env)->ReleaseStringUTFChars(env, jFilename, filename); } jTag = (*env)->GetObjectField(env, jFrame, FrameTagField); if (jTag) { const char *tag = (*env)->GetStringUTFChars(env, jTag, NULL); cpl_frame_set_tag(frame, tag); (*env)->ReleaseStringUTFChars(env, jTag, tag); } jFtype = (*env)->GetObjectField(env, jFrame, FrameTypeField); if (jFtype) { cpl_frame_set_type(frame, getFrameTypeID(env, jFtype)); } jFgroup = (*env)->GetObjectField(env, jFrame, FrameGroupField); if (jFgroup) { cpl_frame_set_group(frame, getFrameGroupID(env, jFgroup)); } jFlevel = (*env)->GetObjectField(env, jFrame, FrameLevelField); if (jFlevel) { cpl_frame_set_level(frame, getFrameLevelID(env, jFlevel)); } return frame; } /* * Constructs and returns a new JNIRecipe object from a java byte[] array * which contains a cpl_recipe structure. If it can't be done, returns * NULL. */ static jobject makeJNIRecipe(JNIEnv *env, const cpl_recipe *recipe, jobject jPluglib) { int ok = 1; jbyteArray jState = NULL; cpl_recipe *state = NULL; jobject jRecipe = NULL; /* Copy the recipe struct into a java byte array. */ ok = ok && (jState = (*env)->NewByteArray(env, sizeof(cpl_recipe))) && (state = (cpl_recipe *) (*env)->GetByteArrayElements(env, jState, NULL)); if (ok) { *state = *recipe; } if (state) { (*env)->ReleaseByteArrayElements(env, jState, (jbyte *) state, 0); } /* Construct a new JNIRecipe object. */ ok = ok && (jRecipe = (*env)->NewObject(env, JNIRecipeClass, JNIRecipeConstructor, jState, jPluglib)); /* Populate the JNIRecipe object's fields from the contents of the * cpl_recipe structure. * TODO: the struct members should not be used directly, instead * they should be accessed through functions of the form: * cpl_plugin_get_name() * cpl_plugin_get_version(), etc. */ if (ok) { const cpl_plugin *plugin = (const cpl_plugin *) recipe; (*env)->SetObjectField(env, jRecipe, JNIRecipeAuthorField, (*env)->NewStringUTF(env, plugin->author)); (*env)->SetObjectField(env, jRecipe, JNIRecipeCopyrightField, (*env)->NewStringUTF(env, plugin->copyright)); (*env)->SetObjectField(env, jRecipe, JNIRecipeDescriptionField, (*env)->NewStringUTF(env, plugin->description)); (*env)->SetObjectField(env, jRecipe, JNIRecipeEmailField, (*env)->NewStringUTF(env, plugin->email)); (*env)->SetObjectField(env, jRecipe, JNIRecipeNameField, (*env)->NewStringUTF(env, plugin->name)); (*env)->SetObjectField(env, jRecipe, JNIRecipeSynopsisField, (*env)->NewStringUTF(env, plugin->synopsis)); (*env)->SetLongField(env, jRecipe, JNIRecipeVersionField, (jlong) plugin->version); } /* Return the new object. */ return ok ? jRecipe : NULL; } /* * Constructs and returns a new Parameter[] array built from the contents * of a cpl_parameterlist structure. */ static jobjectArray makeParameterArray(JNIEnv *env, cpl_parameterlist *parlist, jobject jRecipe) { int ok = 1; int npar; int ip; cpl_parameter *param; jobject jParam = (jobject)0; jobjectArray jParray = NULL; /* Null in, null out. */ if (!parlist || (*env)->ExceptionCheck(env)) { return NULL; } /* Assemble a java array of all the cpl_parameters in this cpl_parameterlist. */ ok = ok && ((npar = cpl_parameterlist_get_size(parlist)) >= 0) && (jParray = (*env)->NewObjectArray(env, npar, ParameterClass, NULL)); ip = 0; for (param = cpl_parameterlist_get_first(parlist); ok && (param != NULL); param = cpl_parameterlist_get_next(parlist)) { ok = ok && (jParam = makeParameter(env, param, jRecipe)); if (ok) { (*env)->SetObjectArrayElement(env, jParray, ip++, jParam); } } /* Return the populated array. */ return ok ? jParray : NULL; } /* * Constructs a Parameter object from a cpl_parameter in a cpl_parameterlist. */ static jobject makeParameter(JNIEnv *env, cpl_parameter *param, jobject jRecipe) { cpl_type ptype; cpl_parameter_class pclass; jbyteArray jState = NULL; jbyte *state = NULL; jobject jPtype = NULL; jobject jInitval = NULL; jobject jConstraint = NULL; jobject jMin; jobject jMax; jobjectArray jOptions; jobject jOpt; jobject jParimp; int ptrsz; int nopt; int iopt; /* Prepare a byte array containing a pointer to the parameter object. */ ptrsz = sizeof(cpl_parameter *); jState = (*env)->NewByteArray(env, ptrsz); if (jState) { state = (*env)->GetByteArrayElements(env, jState, NULL); memcpy(state, ¶m, ptrsz); (*env)->ReleaseByteArrayElements(env, jState, state, 0); } else { return NULL; } /* Ascertain the parameter type and its initial value. */ ptype = cpl_parameter_get_type(param); switch (ptype) { case CPL_TYPE_BOOL: jPtype = ParameterTypeBOOLConstant; jInitval = makeBoolean(cpl_parameter_get_default_bool(param)); break; case CPL_TYPE_INT: jPtype = ParameterTypeINTConstant; jInitval = makeInteger(env, cpl_parameter_get_default_int(param)); break; case CPL_TYPE_DOUBLE: jPtype = ParameterTypeDOUBLEConstant; jInitval = makeDouble(env, cpl_parameter_get_default_double(param)); break; case CPL_TYPE_STRING: jPtype = ParameterTypeSTRINGConstant; jInitval = makeString(env, cpl_parameter_get_default_string(param)); break; default: (*env)->ThrowNew(env, IllegalStateExceptionClass, "Unknown parameter type" ); return NULL; } /* Construct a suitable ParameterConstraint object. */ pclass = cpl_parameter_get_class(param); switch (pclass) { /* Value class - no restrictions. */ case CPL_PARAMETER_CLASS_VALUE: jConstraint = NULL; break; /* Range class - minimum and maximum values are set. */ case CPL_PARAMETER_CLASS_RANGE: jMin = NULL; jMax = NULL; switch (ptype) { case CPL_TYPE_INT: jMin = makeInteger(env, cpl_parameter_get_range_min_int(param)); jMax = makeInteger(env, cpl_parameter_get_range_max_int(param)); break; case CPL_TYPE_DOUBLE: jMin = makeDouble(env, cpl_parameter_get_range_min_double(param)); jMax = makeDouble(env, cpl_parameter_get_range_max_double(param)); break; default: (*env)->ThrowNew(env, IllegalStateExceptionClass, "Bad type for range parameter" ); return NULL; } jConstraint = (*env)->NewObject(env, RangeConstraintClass, RangeConstraintConstructor, jPtype, jMin, jMax); if (!jConstraint) { return NULL; } break; /* Enum class - a discrete list of options is set. */ case CPL_PARAMETER_CLASS_ENUM: nopt = cpl_parameter_get_enum_size(param); jOptions = (*env)->NewObjectArray(env, nopt, ObjectClass, NULL); jOpt = NULL; for (iopt = 0; iopt < nopt; iopt++) { switch (ptype) { case CPL_TYPE_INT: jOpt = makeInteger(env, cpl_parameter_get_enum_int(param, iopt)); break; case CPL_TYPE_DOUBLE: jOpt = makeDouble(env, cpl_parameter_get_enum_double(param, iopt)); break; case CPL_TYPE_STRING: jOpt = makeString(env, cpl_parameter_get_enum_string(param, iopt)); break; default: (*env)->ThrowNew(env, AssertionErrorClass, NULL); return NULL; } if ((*env)->ExceptionCheck(env)) { return NULL; } (*env)->SetObjectArrayElement(env, jOptions, iopt, jOpt); } jConstraint = (*env)->NewObject(env, EnumConstraintClass, EnumConstraintConstructor, jOptions); break; /* Unknown. */ default: (*env)->ThrowNew(env, IllegalStateExceptionClass, "Unknown parameter class"); return NULL; } /* Construct a JNIParameterImp object from the objects we have made. */ jParimp = (*env)->NewObject(env, JNIParameterImpClass, JNIParameterImpConstructor, jState, jRecipe, jPtype, jConstraint, jInitval); if (!jParimp) { return NULL; } /* Initialise the remaining fields in the ParameterImp. */ (*env)->SetObjectField(env, jParimp, JNIParameterImpContextField, (*env)->NewStringUTF(env, cpl_parameter_get_context(param))); (*env)->SetObjectField(env, jParimp, JNIParameterImpHelpField, (*env)->NewStringUTF(env, cpl_parameter_get_help(param))); (*env)->SetObjectField(env, jParimp, JNIParameterImpNameField, (*env)->NewStringUTF(env, cpl_parameter_get_name(param))); (*env)->SetObjectField(env, jParimp, JNIParameterImpTagField, (*env)->NewStringUTF(env, cpl_parameter_get_tag(param))); /* Make and return a Parameter object from the ParameterImp. */ return (*env)->NewObject(env, ParameterClass, ParameterConstructor, jParimp); } /* * Makes a java Boolean object from a boolean (int) value. */ static jobject makeBoolean(int val) { return val ? BooleanTRUEConstant : BooleanFALSEConstant; } /* * Makes a java Integer object from an int value. */ static jobject makeInteger(JNIEnv *env, int val) { return (*env)->NewObject(env, IntegerClass, IntegerConstructor, (jint) val); } /* * Makes a java Double object from a double value. */ static jobject makeDouble(JNIEnv *env, double val) { return (*env)->NewObject(env, DoubleClass, DoubleConstructor, (jdouble) val); } /* * Makes a java String object from a char* value. */ static jobject makeString(JNIEnv *env, const char *val) { return (*env)->NewStringUTF(env, val); } #undef EXECUTE_CPL_PLUGIN_FUNC cpl-6.4.1/cpljava/Makefile.in0000644000460300003120000005330512310332724012702 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = cpljava DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/admin/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/cpl.m4 $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/omp.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = am_libcplgasgano_la_OBJECTS = cpl_gasgano.lo libcplgasgano_la_OBJECTS = $(am_libcplgasgano_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libcplgasgano_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libcplgasgano_la_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcplgasgano_la_SOURCES) DIST_SOURCES = $(libcplgasgano_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(nodist_noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFITSIO_INCLUDES = @CFITSIO_INCLUDES@ CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@ CFLAGS = @CFLAGS@ CPLCORE_INCLUDES = @CPLCORE_INCLUDES@ CPLDFS_INCLUDES = @CPLDFS_INCLUDES@ CPLDRS_INCLUDES = @CPLDRS_INCLUDES@ CPLUI_INCLUDES = @CPLUI_INCLUDES@ CPL_BINARY_AGE = @CPL_BINARY_AGE@ CPL_BINARY_VERSION = @CPL_BINARY_VERSION@ CPL_CFLAGS = @CPL_CFLAGS@ CPL_INTERFACE_AGE = @CPL_INTERFACE_AGE@ CPL_LDFLAGS = @CPL_LDFLAGS@ CPL_MAJOR_VERSION = @CPL_MAJOR_VERSION@ CPL_MICRO_VERSION = @CPL_MICRO_VERSION@ CPL_MINOR_VERSION = @CPL_MINOR_VERSION@ CPL_VERSION = @CPL_VERSION@ CPL_VERSION_STRING = @CPL_VERSION_STRING@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_INCLUDES = @CX_INCLUDES@ CX_LDFLAGS = @CX_LDFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FFTWF_INCLUDES = @FFTWF_INCLUDES@ FFTWF_LDFLAGS = @FFTWF_LDFLAGS@ FFTW_INCLUDES = @FFTW_INCLUDES@ FFTW_LDFLAGS = @FFTW_LDFLAGS@ FGREP = @FGREP@ GASGANO_CLASSPATH = @GASGANO_CLASSPATH@ GASGANO_SHREXT = @GASGANO_SHREXT@ GREP = @GREP@ INCLTDL = @INCLTDL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JAVA_INCLUDES = @JAVA_INCLUDES@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCEXT = @LIBCEXT@ LIBCFITSIO = @LIBCFITSIO@ LIBCPLCORE = @LIBCPLCORE@ LIBCPLDFS = @LIBCPLDFS@ LIBCPLDRS = @LIBCPLDRS@ LIBCPLUI = @LIBCPLUI@ LIBFFTW = @LIBFFTW@ LIBFFTWF = @LIBFFTWF@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBWCS = @LIBWCS@ LIPO = @LIPO@ LN_S = @LN_S@ LTDLDEPS = @LTDLDEPS@ LTDLINCL = @LTDLINCL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ WCS_INCLUDES = @WCS_INCLUDES@ WCS_LDFLAGS = @WCS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ cpl_includes = @cpl_includes@ cpl_libraries = @cpl_libraries@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libcext = @libcext@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ CLEANFILES = $(BUILT_SOURCES) @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in AM_CPPFLAGS = $(CPLCORE_INCLUDES) $(CPLUI_INCLUDES) $(CPLDFS_INCLUDES) \ $(CX_INCLUDES) $(JAVA_INCLUDES) $(INCLTDL) GASGANO_NATIVE_INCLUDES = org_eso_cpl_jni_CPLControl.h \ org_eso_cpl_jni_JNIParameterImp.h \ org_eso_cpl_jni_JNIRecipe.h \ org_eso_cpl_jni_LibraryLoader.h \ org_eso_cpl_jni_PluginLibrary.h BUILT_SOURCES = $(GASGANO_NATIVE_INCLUDES) lib_LTLIBRARIES = libcplgasgano.la nodist_noinst_HEADERS = $(GASGANO_NATIVE_INCLUDES) libcplgasgano_la_SOURCES = cpl_gasgano.c libcplgasgano_la_LDFLAGS = $(CX_LDFLAGS) $(GASGANO_SHREXT) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libcplgasgano_la_LIBADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLCORE) $(LIBCEXT) $(LIBLTDL) libcplgasgano_la_DEPENDENCIES = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLCORE) $(LIBLTDL) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cpljava/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign cpljava/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libcplgasgano.la: $(libcplgasgano_la_OBJECTS) $(libcplgasgano_la_DEPENDENCIES) $(EXTRA_libcplgasgano_la_DEPENDENCIES) $(AM_V_CCLD)$(libcplgasgano_la_LINK) -rpath $(libdir) $(libcplgasgano_la_OBJECTS) $(libcplgasgano_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_gasgano.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES $(GASGANO_NATIVE_INCLUDES): @class="`echo $@ | sed -e 's/\.h$$//' | sed -e 's/_/\./g'`"; \ echo "$(JAVAH) -classpath $(GASGANO_CLASSPATH) $$class"; \ $(JAVAH) -classpath $(GASGANO_CLASSPATH) $$class; # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/html/0000755000460300003120000000000012310333020010221 500000000000000cpl-6.4.1/html/group__cpl__plot.html0000644000460300003120000011632112310333014014364 00000000000000 Common Pipeline Library Reference Manual: Plotting of CPL objects
Common Pipeline Library Reference Manual  6.4.1
Plotting of CPL objects

Functions

cpl_error_code cpl_plot_bivector (const char *pre, const char *options, const char *post, const cpl_bivector *bivector)
 Plot a bivector.
 
cpl_error_code cpl_plot_bivectors (const char *pre, const char **options, const char *post, const cpl_bivector **bivectors, cpl_size nbvec)
 Plot an array of bivectors.
 
cpl_error_code cpl_plot_column (const char *pre, const char *options, const char *post, const cpl_table *tab, const char *xlab, const char *ylab)
 Plot a column of a table.
 
cpl_error_code cpl_plot_columns (const char *pre, const char *options, const char *post, const cpl_table *tab, const char **labels, cpl_size nlabels)
 Plot severals column of a table.
 
cpl_error_code cpl_plot_image (const char *pre, const char *options, const char *post, const cpl_image *image)
 Plot an image.
 
cpl_error_code cpl_plot_image_col (const char *pre, const char *options, const char *post, const cpl_image *image, cpl_size firstcol, cpl_size lastcol, cpl_size colstep)
 Plot a range of image columns.
 
cpl_error_code cpl_plot_image_row (const char *pre, const char *options, const char *post, const cpl_image *image, cpl_size firstrow, cpl_size lastrow, cpl_size rowstep)
 Plot a range of image rows.
 
cpl_error_code cpl_plot_mask (const char *pre, const char *options, const char *post, const cpl_mask *mask)
 Plot a mask.
 
cpl_error_code cpl_plot_vector (const char *pre, const char *options, const char *post, const cpl_vector *vector)
 Plot a vector.
 
cpl_error_code cpl_plot_vectors (const char *pre, const char *options, const char *post, const cpl_vector **vectors, cpl_size nvec)
 Plot an array of vectors.
 

Detailed Description

This module provides functions to plot basic CPL objects

This module is offered to help during the development process. The functions offered should NOT be used in any operational environment. For that reason, the support of those remains limited, and no functionality extension can be expected from the CPL team.

The created plot windows can be closed by pressing the 'q' key like you would do with a normal gnuplot window.

The default behaviour of the plotting is to use gnuplot (with option -persist). The user can control the actual plotting-command used to create the plot by setting the environment variable CPL_PLOTTER. Currently, if CPL_PLOTTER is set it must contain the string 'gnuplot'. Setting it to 'cat > my_gnuplot_$$.txt' causes a number of ASCII-files to be created, which each produce a plot when given as standard input to gnuplot.

A finer control of the plotting options can be obtained by writing an executable script, e.g. my_gnuplot, that executes gnuplot after setting the desired gnuplot options (e.g. set terminal pslatex color) and then setting CPL_PLOTTER to my_gnuplot.

Images can be plotted not only with gnuplot, but also using the pnm format. This is controlled with the environment variable CPL_IMAGER. If CPL_IMAGER is set to a string that does not contain the word gnuplot, the recipe will generate the plot in pnm format. E.g. setting CPL_IMAGER to 'display - &' will produce a gray-scale image using the image viewer display.

#include "cpl_plot.h"

Function Documentation

cpl_error_code cpl_plot_bivector ( const char *  pre,
const char *  options,
const char *  post,
const cpl_bivector *  bivector 
)

Plot a bivector.

Parameters
preAn optional string with pre-plot commands
optionsAn optional string with plotting options
postAn optional string with post-plot commands
bivectorThe bivector to plot
Returns
CPL_ERROR_NONE or the relevant CPL_ERROR_# on error

The bivector must have a positive number of elements.

See Also
also cpl_mplot_open().

Possible cpl_error_code set in this function:

  • CPL_ERROR_FILE_IO
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT
  • CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system.
cpl_error_code cpl_plot_bivectors ( const char *  pre,
const char **  options,
const char *  post,
const cpl_bivector **  bivectors,
cpl_size  nbvec 
)

Plot an array of bivectors.

Parameters
preAn optional string with pre-plot commands
optionsArray of strings with plotting options
postAn optional string with post-plot commands
bivectorsThe bivectors array to plot
nbvecThe number of bivectors, at least one is required
Returns
CPL_ERROR_NONE or the relevant CPL_ERROR_# on error

Each bivector in the array defines a sequence of points to be plotted. The bivectors can have different size.

The options array must be of same size as the bivectors array. The i'th string in the array specifies the plotting options for the i'th bivector.

See Also
also cpl_mplot_open().

Possible cpl_error_code set in this function:

  • CPL_ERROR_FILE_IO
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_DATA_NOT_FOUND
  • CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system.
cpl_error_code cpl_plot_column ( const char *  pre,
const char *  options,
const char *  post,
const cpl_table *  tab,
const char *  xlab,
const char *  ylab 
)

Plot a column of a table.

Parameters
preAn optional string with pre-plot commands
optionsAn optional string with plotting options
postAn optional string with post-plot commands
tabThe table to plot
xlabThe label of the column used in x
ylabThe label of the column used in y
Returns
CPL_ERROR_NONE or the relevant CPL_ERROR_# on error
See Also
also cpl_mplot_open().

If xlab is NULL, the sequence number is used for X.

Possible cpl_error_code set in this function:

  • CPL_ERROR_FILE_IO
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT
  • CPL_ERROR_DATA_NOT_FOUND
  • CPL_ERROR_INVALID_TYPE
  • CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system.
cpl_error_code cpl_plot_columns ( const char *  pre,
const char *  options,
const char *  post,
const cpl_table *  tab,
const char **  labels,
cpl_size  nlabels 
)

Plot severals column of a table.

Parameters
preAn optional string with pre-plot commands
optionsAn optional string with plotting options
postAn optional string with post-plot commands
tabThe table to plot
labelsThe labels of the columns
nlabelsThe number of labels
Returns
CPL_ERROR_NONE or the relevant CPL_ERROR_# on error
See Also
also cpl_mplot_open().

If xlab is NULL, the sequence number is used for X.

Possible cpl_error_code set in this function:

  • CPL_ERROR_FILE_IO
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT
  • CPL_ERROR_DATA_NOT_FOUND
  • CPL_ERROR_INVALID_TYPE
  • CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system.
cpl_error_code cpl_plot_image ( const char *  pre,
const char *  options,
const char *  post,
const cpl_image *  image 
)

Plot an image.

Parameters
preAn optional string with pre-plot commands
optionsAn optional string with plotting options
postAn optional string with post-plot commands
imageThe image to plot
Returns
CPL_ERROR_NONE or the relevant CPL_ERROR_# on error

The image must have a positive number of pixels.

See Also
also cpl_image_open().

If the specified plotting command does not contain the string 'gnuplot', the plotting command is assumed to be able to parse a pgm (P5) image from stdin. Valid examples of such a command may include 'cat > myplot$$.pgm' and 'display - &'.

The 'pre' and 'post' commands are ignored in PGM-plots, while the 'options' string is written as a comment in the header of the image.

See also cpl_plot_vector().

Possible cpl_error_code set in this function:

  • CPL_ERROR_FILE_IO
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT
  • CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system.
cpl_error_code cpl_plot_image_col ( const char *  pre,
const char *  options,
const char *  post,
const cpl_image *  image,
cpl_size  firstcol,
cpl_size  lastcol,
cpl_size  colstep 
)

Plot a range of image columns.

Parameters
preAn optional string with pre-plot commands
optionsAn optional string with plotting options
postAn optional string with post-plot commands
imageThe image to plot
firstcolThe first column to plot (1 for first)
lastcolThe last column to plot
colstepThe positive column stride
Returns
CPL_ERROR_NONE or the relevant CPL_ERROR_# on error

The image must have a positive number of pixels.

lastcol shall be greater than or equal to firstcol.

See Also
also cpl_mplot_open().

Possible cpl_error_code set in this function:

  • CPL_ERROR_FILE_IO
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT
  • CPL_ERROR_ACCESS_OUT_OF_RANGE (firstcol or lastcol are out of range)
  • CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system.
cpl_error_code cpl_plot_image_row ( const char *  pre,
const char *  options,
const char *  post,
const cpl_image *  image,
cpl_size  firstrow,
cpl_size  lastrow,
cpl_size  rowstep 
)

Plot a range of image rows.

Parameters
preAn optional string with pre-plot commands
optionsAn optional string with plotting options
postAn optional string with post-plot commands
imageThe image to plot
firstrowThe first row to plot (1 for first)
lastrowThe last row to plot
rowstepThe positive row stride
Returns
CPL_ERROR_NONE or the relevant CPL_ERROR_# on error

The image must have a positive number of pixels.

lastrow shall be greater than or equal to firstrow.

See Also
also cpl_mplot_open().

Possible cpl_error_code set in this function:

  • CPL_ERROR_FILE_IO
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT
  • CPL_ERROR_ACCESS_OUT_OF_RANGE (firstrow or lastrow are out of range)
  • CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system.
cpl_error_code cpl_plot_mask ( const char *  pre,
const char *  options,
const char *  post,
const cpl_mask *  mask 
)

Plot a mask.

Parameters
preAn optional string with pre-plot commands
optionsAn optional string with plotting options
postAn optional string with post-plot commands
maskThe mask to plot
Returns
CPL_ERROR_NONE or the relevant CPL_ERROR_# on error

If the specified plotting command does not contain the string 'gnuplot', the plotting command is assumed to be able to parse a pgm (P5) mask from stdin. Valid examples of such a command may include 'cat > myplot$$.pgm' and 'display - &'.

The 'pre' and 'post' commands are ignored in PGM-plots, while the 'options' string is written as a comment in the header of the mask.

See also cpl_plot_vector().

Possible cpl_error_code set in this function:

  • CPL_ERROR_FILE_IO
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT
  • CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system.
cpl_error_code cpl_plot_vector ( const char *  pre,
const char *  options,
const char *  post,
const cpl_vector *  vector 
)

Plot a vector.

Parameters
preAn optional string with pre-plot commands
optionsAn optional string with plotting options
postAn optional string with post-plot commands
vectorThe vector to plot
Returns
CPL_ERROR_NONE or the relevant CPL_ERROR_# on error

The vector must have a positive number of elements.

Possible cpl_error_code set in this function:

  • CPL_ERROR_FILE_IO
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT
  • CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system.
cpl_error_code cpl_plot_vectors ( const char *  pre,
const char *  options,
const char *  post,
const cpl_vector **  vectors,
cpl_size  nvec 
)

Plot an array of vectors.

Parameters
preAn optional string with pre-plot commands
optionsAn optional string with plotting options
postAn optional string with post-plot commands
vectorsThe vectors array to plot
nvecThe number of vectors
Returns
CPL_ERROR_NONE or the relevant CPL_ERROR_# on error

The array should contain at least 3 vectors, the first one can be NULL.

The non-NULL vectors must have the same number of elements. The first vector gives the x-axis. If NULL, the index is used.

See Also
also cpl_mplot_open().

Possible cpl_error_code set in this function:

  • CPL_ERROR_FILE_IO
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT
  • CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system.
cpl-6.4.1/html/form_9.png0000644000460300003120000000755112310333016012057 00000000000000‰PNG  IHDR*oÐí0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïØIDATxíçšê<„_EKÂáþïv»%6Ïæ ó-~\…êªê¿¼Àãxòu€¿‚ÀH+—€{Ñ[€gpøs\?܉ž‚þÜTÙàIÄð—ðU½¸…0LÓxÊ2ÛË¿MMàáªìn¼…,,¬xØf6ʃPU:€[Ðñ†“`T€i;ÙÌ#) ð[x€ª]ç8Í1Ó{Ú¯QÚeð¸Ë®9ìúà½p?Uv÷ WÄZ"£`“ªI¼jåJ°#ý%Ué÷hã®C€ó™û©8€ï£;F¶Ý|1…yúJM4»ä;q•í~3íþL+îÁ6‡Ç¨*]œ¶žhöLfD xÊ,W œÏß+IÒ$šxš5Z:ÑD¼½Y}\8ÎÆÃµÔwCà‡¡áS¡ÊYyL&ˆTB’È““+óeëã¼±YJA¨ru³ÆÏÅm»¤êNë¼E´>]Tкù¸bŒlÜLAäR²9tn*ÂN»ÌT³ƒZHªª(Ûú[®`‹ÍYŸ¿‚ñ¯2ÄÇùVg#°epué“üñÂ@ôm'óeÁ±Wž©²£<¬‰#†wιoãM¨šöÛù²Ö¥uÅ>ÅI©"ªXæÌ—7©:(Ç)I—6ð,!߬äF–Ú(lÃûE+Ô²ü ¤|(w`­ÖJÂÞΈ½#Ú増¼74aÇ;¹:¥r#î:¦Ò¾¯ú£–´wü ôã©ß| q…×L…•+䓨üð—Pz€ïÃÞ 6Ó4&eJú"Àe”Û^™:²›÷9x/Ø»Ãuû…"]Sdâ§a8éfm»Nb-OÃxL¨ñZ‘ï‹St| ›jPš;cÌL…Ïí¨Ä)M5îO·ÿXTé¾íFÜ܆UF€Õ™:!ç¶•)H–G–oü1ÿïÜz_à°á°NÚ^¹-Ð^´tAäUžä¸»ºf£u™ì;eЇœÔhÀòtÉ'%2öbÌ?)*€Ðmm³ec8†°8ëU+ÕÂËÞÙwþ$ÊÍ|3 {áŠÜ¯&¾»›üE”méH u%ìPås¨M¡ºàÿnÕ›®v‘ÿ#¦A w÷[€>øà€>øQ¤a†ÿ~® Œ1æ¿€ŸAøà ¸ðÀè,À_ ¼LjU ±ü`Ü<Šw¡Êgã''PH àýð.T ƒ¬e„É’ÞFéÀù´À¿†-9ˆb”O¼®!ÊG ÂVÿžTY,À?…éLÞ #%"j:–kêèÇ”¦÷lÊù7"´ô")”?1•0¯!geË!àÝ «ø·ªÃ”*7{˜¦&pMs¡É‹ÎÞ ¿BUQ2ì$Ô„ !¬×ð^8zéƒo³¢J pV·Ãóö0S Y7Z3ͪ"C†i†LoŠ àÍàk‚º¶û®~Ý//”úwÏÇ›ÉIæ²)‹€¼*#i‡1:Œ6E€·C’m‡‡™6×í´ŸÐá4e~Å´¿ ݹ’#miK¹»º¨T ï ì÷åo›­U_•W{Tª¡Iz’­mé&U^[z®îðAVö =XœJH=€ÕÙ—i*§çÃ0•«ÄɽþT¢ùI¹üý£Gwßã#×uªØBæ'« C쪕zgÕ™^RïHUVÝÊÍz]þl8|èüìÕ6òœ Vƒß ¢L`Ž<ï÷èn³<†äúÚ¶N™•dOF2Zå±ÚÞK—XwÝãŽ>Œ§ p©‚âÈ1À%Lj• ±ÜdÊ«vºï< ÀCaY|ùÛôÔë~Ãzéi·ˆªU8ßêæ­Oxä¹øÀê”'us;ä|6~’Z‰¹ÓiÜËqŒTc''çY^Û…¶¤ƒæuýÌ­4+Ïù×Ip8ÿÝà¼M»ìÁÀâd=E¢B ©Áxsœ¼#Ìã,/€›]ÔS7eð%š+M'MAÊ¿`j9®—»²þy}+†-ºcŶHVçFùH#Aت‚¿'È0òò ¦Ö³¼v’?³®Reûx%M‡èΚQ%6Ò‡‚…­}k“&'ùaSyTFÒÕNF›âõ8â·:KÌ[ò™g¦¿èÃ/´ÀE/¸š¦kœ¼ ¬Ny´Þ¿Ó&WãônLJ[Qð<&Í€GajþÎvv=;ÁÚ;¹/[yrFñ|ºÍ†÷½µWì<‹¡5e€ÑÉ !ìÑ`ãA·ø¤ãušEÛèâ9/^…Òz4À£Èß ÑR³¿{¶6¶ +Óü tÏSð-ØUÛýˆ¿váj“ø`æ'ú*À|ðÀ¼Ê8Žã àGP>ø&|ð\øà $ðN°à ñ6Qr ú}yS®Þ…ª®ÃL1‘Þ4>ßeYÃ$a ˜ é=›òï¤zè³”(Å(Ÿ1x¥Æ:)Û@7k頻NVðOáU=¾K2}A~Ë5WÎêC€7ïh½?Tb„71NÇ?H¬ëEñ À»áW´>Ô5ªŒ‰‡ÆMÒ(?C%à½ð+Tub:ãz™[~‰ ‹:®muJÕ0‹ à¸×f‹•…žÿ|•Ñ©ÿ ’dÈ.cÆF‹œ*²<ÉQ(.ª¸žEî^† ëêr©¨´%°‰ñ¢„W4M_ù¨ŸÆ6nŒzíEš’å.eð²¬îà$2dYà»öc,A§ÿ•Vp†×P£Jd_ƒ¶éuØÓŒ­‰ß³™«s ]ð ø~†Óöȿ+=è•ü˜ôØ¡ÊG™W˜R{¸?!+7[ÀâŒy>€å²‰CíÂMV3°:Íü’P’è6U^ؙܔÛC#À»#‰J®w p £Œž÷$}†3qg­œï^PS;ZÊj–M.ÆX‡aí0 Ã;â¤x‰*¡*ëæXœ° Îé¯å‹­Ï¥F^Q>.U¥©5¥Æûb^­€1Ƽ#Ωn(=ÐK­ë,NÝy–6ìCN¥Æ‹šÈ‹,5¾MÓ[+صævÀAÞ9Ïkj¸k¾¥ï‹òü Dï[£Ø…Ímó®ù®˜Æ.w¨Àbsq¥j˜ä­»¹4mqUŠ™™¬[>þ¼3Þvø¸ôÀ6Œv6ùjôß^—(7nªkªu[k°”ð¢ïŠËĵüâ0·–‰ùÖ·÷9×x1*°:£Ï;ûŸgx}WÂbøÞâÊÙgnUfwsžÚ"®ÛæBßbw-ÀÄîú°FÀB.uaÙ+°†áŸâ`y€WÀ›6×AWÝ­KoUlMâ‘’¶µ™>{̺:°:eà:íEGZv¡N "ïÅDºÍ¹ÃœÉ¸9 Àó°ÝÜý“æúe‘¿mîæÊ•jÔ]¹ä·iùf²ÂbÈ Ò…¶±0ýÍY^ˆÚúïŒe`qήôý0 2µ¹‰,w¥Ô9´6Ò”ú,¤å3†jK+eÊ<;lp`‹ #ÏIvs€¨&ž¢ÊUªB6QZ¬²ÄÕõ&ÞŽÞP†&•ö©eš|'´uE=y|QÚð0å¬>–§=X§ éló›³¼“7<ŠJU•–xÙÆkEM’cT«ÙµRb¬ÿÛVúêUeDƧSC÷èÅfì¨ÉQoŽò)12K ‰ã,•ÕËY^ iá)gWªTv•¥FŽ"hõPb بR'©2&7IW#?Ãz:Ð Common Pipeline Library Reference Manual: Deprecated List
Common Pipeline Library Reference Manual  6.4.1
Deprecated List
Member cpl_apertures_get_fwhm (const cpl_image *self, const cpl_apertures *aperts)
Replace this call with a loop over cpl_image_get_fwhm()
Member cpl_apertures_get_max_x (const cpl_apertures *self, cpl_size ind)
Replace this function with cpl_apertures_get_pos_x()
Member cpl_apertures_get_max_y (const cpl_apertures *self, cpl_size ind)
Replace this function with cpl_apertures_get_pos_y()
Member CPL_BPP_16_SIGNED
Use CPL_TYPE_SHORT
Member CPL_BPP_16_UNSIGNED
Use CPL_TYPE_USHORT
Member CPL_BPP_32_SIGNED
Use CPL_TYPE_INT
Member CPL_BPP_8_UNSIGNED
Use CPL_TYPE_UCHAR
Member CPL_BPP_IEEE_DOUBLE
Use CPL_TYPE_DOUBLE
Member CPL_BPP_IEEE_FLOAT
Use CPL_TYPE_FLOAT
Member cpl_fits_get_extension_nb (const char *filename, const char *extname)
Replace this call with cpl_fits_find_extension().
Member cpl_fits_get_nb_extensions (const char *filename)
Replace this call with cpl_fits_count_extensions().
Member cpl_frameset_get_first (cpl_frameset *self)
This function will be removed from CPL version 7. Code using these functions should be ported to make use of frame set iterators instead!
Member cpl_frameset_get_first_const (const cpl_frameset *self)
This function will be removed from CPL version 7. Code using these functions should be ported to make use of frame set iterators instead!
Member cpl_frameset_get_frame (cpl_frameset *set, cpl_size position)
This function will be removed from CPL version 7. Code using these functions should use cpl_frameset_get_position() instead!
Member cpl_frameset_get_frame_const (const cpl_frameset *set, cpl_size position)
This function will be removed from CPL version 7. Code using these functions should use cpl_frameset_get_position_const() instead!
Member cpl_frameset_get_next (cpl_frameset *self)
This function will be removed from CPL version 7. Code using these functions should be ported to make use of frame set iterators instead!
Member cpl_frameset_get_next_const (const cpl_frameset *self)
This function will be removed from CPL version 7. Code using these functions should be ported to make use of frame set iterators instead!
Member cpl_image_filter_linear (const cpl_image *in, const cpl_matrix *ker)
Replace this call with cpl_image_filter() using CPL_FILTER_LINEAR and CPL_BORDER_FILTER.
Member cpl_image_filter_median (const cpl_image *in, const cpl_matrix *ker)
Replace this call with cpl_image_filter_mask() using CPL_FILTER_MEDIAN and CPL_BORDER_FILTER.
Member cpl_image_filter_morpho (const cpl_image *in, const cpl_matrix *ker)
Replace this call with cpl_image_filter() using CPL_FILTER_MORPHO and CPL_BORDER_FILTER.
Member cpl_image_filter_stdev (const cpl_image *in, const cpl_matrix *ker)
Replace this call with cpl_image_filter_mask() using CPL_FILTER_STDEV and CPL_BORDER_FILTER.
Member cpl_image_fit_gaussian (const cpl_image *im, cpl_size xpos, cpl_size ypos, cpl_size size, double *norm, double *xcen, double *ycen, double *sig_x, double *sig_y, double *fwhm_x, double *fwhm_y)
If you need a 2D gaussian fit please use the function cpl_fit_image_gaussian(). Please note that on CPL versions earlier than 5.1.0 this function was wrongly documented: the parameters sig_x and sig_y were defined as "the sigma in x (or y) of the gaussian", while actually they returned the semi-major and semi-minor axes of the gaussian distribution at 1-sigma. PLEASE NOTE THAT IF YOU USED THIS FUNCTION FOR DETERMINING THE SPREAD OF A DISTRIBUTION ALONG THE X DIRECTION, THIS WAS VERY LIKELY OVERESTIMATED (because sig_x was always assigned the semi-major axis of the distribution ignoring the rotation), WHILE THE SPREAD ALONG THE Y DIRECTION WOULD BE UNDERESTIMATED. In addition to that, even with circular distributions this function may lead to an underestimation of sig_x and sig_y (up to 25% underestimation in the case of noiseless data with a box 4 times the sigma, 1% underestimation in the case of noiseless data with a box 7 times the sigma). This latter problem is related to the function cpl_image_iqe().
Member cpl_mask_closing (cpl_mask *in, const cpl_matrix *ker)
Replace this call with cpl_mask_filter() using CPL_FILTER_CLOSING and CPL_BORDER_ZERO.
Member cpl_mask_dilation (cpl_mask *in, const cpl_matrix *ker)
Replace this call with cpl_mask_filter() using CPL_FILTER_DILATION and CPL_BORDER_ZERO.
Member cpl_mask_erosion (cpl_mask *in, const cpl_matrix *ker)
Replace this call with cpl_mask_filter() using CPL_FILTER_EROSION and CPL_BORDER_ZERO.
Member cpl_mask_opening (cpl_mask *in, const cpl_matrix *ker)
Replace this call with cpl_mask_filter() using CPL_FILTER_OPENING and CPL_BORDER_ZERO.
Member cpl_msg_progress (const char *component, int i, int iter, const char *format,...)
Use standard calls such as cpl_msg_info() instead.
Member cpl_polynomial_fit_1d_create (const cpl_vector *x_pos, const cpl_vector *values, cpl_size degree, double *mse)
Replace this call with cpl_polynomial_fit() and optionally cpl_vector_fill_polynomial_fit_residual().
Member cpl_polynomial_fit_2d_create (cpl_bivector *xy_pos, cpl_vector *values, cpl_size degree, double *mse)
Replace this call with cpl_polynomial_fit() and optionally cpl_vector_fill_polynomial_fit_residual().
Member CPL_RECIPE_DEFINE (RECIPE_NAME, RECIPE_VERSION, RECIPE_FILL_PARAMS,RECIPE_AUTHOR, RECIPE_AUTHOR_EMAIL, RECIPE_YEAR,RECIPE_SYNOPSIS, RECIPE_DESCRIPTION)
Use cpl_recipe_define()
Member cpl_table_get_column_name (const cpl_table *table)
This function is deprecated, because its usage could create serious problems in case it is attempted to get names from different tables simultaneously. For instance, a programmer may call cpl_table_get_column_name() in a loop, and in the same loop call a CPL function that calls as well the same function. The behaviour in this case would be unpredictable. The function cpl_table_get_column_names() should be used instead.
Member cpl_test_memory_is_empty ()
Called by cpl_test_end()
Member cpl_type_bpp
Use cpl_type
Member cpl_vector_convolve_symmetric (cpl_vector *smoothed, const cpl_vector *conv_kernel)
Unstable API, may change or disappear. Do not use in new code!
Member cpl_vector_new_lss_kernel (double slitw, double fwhm)
Unstable API, may change or disappear. Do not use in new code!
cpl-6.4.1/html/group__cpl__io.html0000644000460300003120000004024212310333014014013 00000000000000 Common Pipeline Library Reference Manual: I/O
Common Pipeline Library Reference Manual  6.4.1

Macros

#define CPL_BPP_16_SIGNED   CPL_TYPE_SHORT
 
#define CPL_BPP_16_UNSIGNED   CPL_TYPE_USHORT
 
#define CPL_BPP_32_SIGNED   CPL_TYPE_INT
 
#define CPL_BPP_8_UNSIGNED   CPL_TYPE_UCHAR
 
#define CPL_BPP_IEEE_DOUBLE   CPL_TYPE_DOUBLE
 
#define CPL_BPP_IEEE_FLOAT   CPL_TYPE_FLOAT
 
#define cpl_type_bpp   cpl_type
 

Typedefs

typedef enum _cpl_io_type_ cpl_io_type
 The file I/O modes.
 

Enumerations

enum  _cpl_io_type_ {
  CPL_IO_CREATE,
  CPL_IO_EXTEND,
  CPL_IO_APPEND,
  CPL_IO_COMPRESS_GZIP,
  CPL_IO_COMPRESS_RICE,
  CPL_IO_COMPRESS_HCOMPRESS,
  CPL_IO_COMPRESS_PLIO,
  CPL_IO_MAX,
  CPL_IO_DEFAULT
}
 These are the file I/O modes. More...
 

Detailed Description

This module provides definitions related to I/O. The actual I/O functions are defined in the respective CPL modules.

Synopsis:
#include "cpl_io.h"

Macro Definition Documentation

#define CPL_BPP_16_SIGNED   CPL_TYPE_SHORT
Deprecated:
Use CPL_TYPE_SHORT
#define CPL_BPP_16_UNSIGNED   CPL_TYPE_USHORT
Deprecated:
Use CPL_TYPE_USHORT
#define CPL_BPP_32_SIGNED   CPL_TYPE_INT
Deprecated:
Use CPL_TYPE_INT
#define CPL_BPP_8_UNSIGNED   CPL_TYPE_UCHAR
Deprecated:
Use CPL_TYPE_UCHAR
#define CPL_BPP_IEEE_DOUBLE   CPL_TYPE_DOUBLE
Deprecated:
Use CPL_TYPE_DOUBLE
#define CPL_BPP_IEEE_FLOAT   CPL_TYPE_FLOAT
Deprecated:
Use CPL_TYPE_FLOAT
#define cpl_type_bpp   cpl_type
Deprecated:
Use cpl_type

Typedef Documentation

typedef enum _cpl_io_type_ cpl_io_type

The file I/O modes.

Enumeration Type Documentation

These are the file I/O modes.

For the compression modes, see http://heasarc.nasa.gov/docs/software/fitsio/compression.html

Enumerator:
CPL_IO_CREATE 

Overwrite the file, if it already exists.

CPL_IO_EXTEND 

Append a new extension to the file.

CPL_IO_APPEND 

Append to the last data unit of the file.

CPL_IO_COMPRESS_GZIP 

Use FITS tiled-image compression with GZIP algorithm.

CPL_IO_COMPRESS_RICE 

Use FITS tiled-image compression with RICE algorithm.

CPL_IO_COMPRESS_HCOMPRESS 

Use FITS tiled-image compression with HCOMPRESS algorithm.

CPL_IO_COMPRESS_PLIO 

Use FITS tiled-image compression with PLIO algorithm.

CPL_IO_MAX 

Reserved for internal CPL usage.

CPL_IO_DEFAULT 

Deprecated, kept only for backwards compatibility

cpl-6.4.1/html/group__cpl__errorstate.html0000644000460300003120000006362012310333014015603 00000000000000 Common Pipeline Library Reference Manual: Handling of multiple CPL errors
Common Pipeline Library Reference Manual  6.4.1
Handling of multiple CPL errors

Functions

void cpl_errorstate_dump (cpl_errorstate self, cpl_boolean reverse, void(*dump_one)(unsigned, unsigned, unsigned))
 Dump the CPL error state.
 
void cpl_errorstate_dump_one (unsigned self, unsigned first, unsigned last)
 Dump a single CPL error.
 
void cpl_errorstate_dump_one_debug (unsigned self, unsigned first, unsigned last)
 Dump a single CPL error using cpl_msg_debug()
 
void cpl_errorstate_dump_one_info (unsigned self, unsigned first, unsigned last)
 Dump a single CPL error using cpl_msg_info()
 
void cpl_errorstate_dump_one_warning (unsigned self, unsigned first, unsigned last)
 Dump a single CPL error using cpl_msg_warning()
 
cpl_errorstate cpl_errorstate_get (void)
 Get the CPL errorstate.
 
cpl_boolean cpl_errorstate_is_equal (cpl_errorstate self)
 Detect a change in the CPL error state.
 
void cpl_errorstate_set (cpl_errorstate self)
 Set the CPL errorstate.
 

Detailed Description

This module provides functions for error detection and recovery and for producing an error traceback.

It is built on top of the cpl_error module.

Synopsis:
#include <cpl_errorstate.h>

Function Documentation

void cpl_errorstate_dump ( cpl_errorstate  self,
cpl_boolean  reverse,
void(*)(unsigned, unsigned, unsigned)  dump_one 
)

Dump the CPL error state.

Parameters
selfDump errors more recent than self
reverseReverse the chronological order of the dump
dump_oneFunction that dumps a single CPL error, or NULL
Returns
void
Note
dump_one may be NULL, in that case cpl_errorstate_dump_one() is called. If there are no CPL errors to be dumped, (*dump_one)() is called once with all zeros, which allows the dump-function to report that there are no errors to dump. During calls to (*dump_one)() the CPL error system has been put into a special read-only mode that prevents any change of the CPL error state. This means that any calls from (*dump_one)() to cpl_error_reset(), cpl_error_set(), cpl_error_set_where() and cpl_errorstate_set() have no effect. Also calls from (*dump_one)() to cpl_errorstate_dump() have no effect.
See Also
cpl_errorstate_dump_one

CPL-based code with insufficient error checking can generate a large number of CPL errors. To avoid that a subsequent call to cpl_errorstate_dump() will fill up the output device, calls to the dump-function are skipped and only counted and the count reported when dump_one is NULL and the CPL error code is CPL_ERROR_HISTORY_LOST.

Example of usage:

cpl_errorstate prev_state = cpl_errorstate_get();
// Call one or more CPL functions
if (cpl_errorstate_is_equal(prev_state)) {
// No error happened
} else {
// One or more errors happened
// Dump the error(s) in chronological order
cpl_errorstate_dump(prev_state, CPL_FALSE,
// Recover from the error(s)
cpl_errorstate_set(prev_state);
}
void cpl_errorstate_dump_one ( unsigned  self,
unsigned  first,
unsigned  last 
)

Dump a single CPL error.

Parameters
selfThe number of the current error to be dumped
firstThe number of the first error to be dumped
lastThe number of the last error to be dumped
Returns
void
Note
This function is implemented using only exported CPL functions.
See Also
cpl_errorstate_dump

This function will dump a single CPL error, using the CPL error accessor functions. The error is numbered with the value of self.

The actual output is produced by cpl_msg_error().

first and last are provided in the API to allow for special messaging in the dump of the first and last errors.

Alternative functions for use with cpl_errorstate_dump() may use all accessor functions of the CPL error module and those functions of the CPL message module that produce messages. Additionally, the indentation functions of the CPL message module may be used, provided that the indentation is set back to its original state after the last error has been processed.

void cpl_errorstate_dump_one_debug ( unsigned  self,
unsigned  first,
unsigned  last 
)

Dump a single CPL error using cpl_msg_debug()

Parameters
selfThe number of the current error to be dumped
firstThe number of the first error to be dumped
lastThe number of the last error to be dumped
Returns
void
See Also
cpl_errorstate_dump_one, cpl_msg_debug()
void cpl_errorstate_dump_one_info ( unsigned  self,
unsigned  first,
unsigned  last 
)

Dump a single CPL error using cpl_msg_info()

Parameters
selfThe number of the current error to be dumped
firstThe number of the first error to be dumped
lastThe number of the last error to be dumped
Returns
void
See Also
cpl_errorstate_dump_one, cpl_msg_info()
void cpl_errorstate_dump_one_warning ( unsigned  self,
unsigned  first,
unsigned  last 
)

Dump a single CPL error using cpl_msg_warning()

Parameters
selfThe number of the current error to be dumped
firstThe number of the first error to be dumped
lastThe number of the last error to be dumped
Returns
void
See Also
cpl_errorstate_dump_one, cpl_msg_warning()
cpl_errorstate cpl_errorstate_get ( void  )

Get the CPL errorstate.

Returns
The CPL errorstate
Note
The caller should not modify the returned value nor transfer it to another function/scope.

Example of usage:

cpl_errorstate prev_state = cpl_errorstate_get();
// (Call one or more CPL functions here)
if (cpl_errorstate_is_equal(prev_state)) {
// No error happened
} else {
// One or more errors happened
// Recover from the error(s)
cpl_errorstate_set(prev_state);
}
cpl_boolean cpl_errorstate_is_equal ( cpl_errorstate  self)

Detect a change in the CPL error state.

Parameters
selfThe return value of a previous call to cpl_errorstate_get()
Returns
CPL_TRUE iff the current error state is equal to self.
See Also
cpl_errorstate_get
void cpl_errorstate_set ( cpl_errorstate  self)

Set the CPL errorstate.

Parameters
selfThe return value of a previous call to cpl_errorstate_get()
Returns
void
See Also
cpl_errorstate_get
Note
If a CPL error was created before the call to cpl_errorstate_get() that returned self and if more than CPL_ERROR_HISTORY_SIZE CPL errors was created after that, then the accessor functions of the CPL error object (cpl_error_get_code() etc.) will return wrong values. In this case cpl_error_get_code() is still guaranteed not to return CPL_ERROR_NONE. Moreover, the default value of CPL_ERROR_HISTORY_SIZE is guaranteed to be large enough to prevent this situation from arising due to a call of a CPL function.
cpl-6.4.1/html/struct__cpl__plugin__.html0000644000460300003120000004153512310333015015377 00000000000000 Common Pipeline Library Reference Manual: _cpl_plugin_ Struct Reference
Common Pipeline Library Reference Manual  6.4.1
_cpl_plugin_ Struct Reference

The type representation of the generic plugin interface. More...

Public Attributes

unsigned int api
 The API version the Plugin complies to.
 
const char * author
 Name of the plugin's author.
 
const char * copyright
 Plugin's copyright.
 
cpl_plugin_func deinitialize
 Deinitialization a plugin instance.
 
const char * description
 Plugin's detailed description.
 
const char * email
 Author's email address.
 
cpl_plugin_func execute
 Executes a plugin instance.
 
cpl_plugin_func initialize
 Initalizes a plugin instance.
 
const char * name
 Plugin's unique name.
 
const char * synopsis
 Plugin's short help string.
 
unsigned long type
 The Plugin type.
 
unsigned long version
 The Plugin version.
 

Detailed Description

The type representation of the generic plugin interface.

Member Data Documentation

unsigned int _cpl_plugin_::api

The API version the Plugin complies to.

The API version number identifies the internal layout of the plugin interface structure. It may be used by an application calling a plugin to setup the correct interface to communicate with the plugin or, in the simplest case, to ignore any plugin which does not match the plugin API an application has been buid for.

const char* _cpl_plugin_::author

Name of the plugin's author.

Variable contains the null-terminated identifier string of the plugins author. If the plugin does not specify an author this pointer should be set to a NULL pointer.

const char* _cpl_plugin_::copyright

Plugin's copyright.

Variable contains the copyright and license string applying to the plugin. The returned string must be null-terminated. If no copyright applies this pointer should be set to a NULL pointer.

cpl_plugin_func _cpl_plugin_::deinitialize

Deinitialization a plugin instance.

Returns
The function must return 0 on success, and a non-zero value if the plugin deinitalization failed.

The function to deinitialize the plugin instance plugin. If this is NULL no deinitialization of the plugin instance is needed.

const char* _cpl_plugin_::description

Plugin's detailed description.

Variable contains the plugin's null-terminated detailed description string. The description is the detailed help for the plugin. For formatting the output the C special characters '\n', '\t' maybe embedded in the returned string. If the plugin does not provide a detailed description the pointer should be set to a NULL pointer.

const char* _cpl_plugin_::email

Author's email address.

Variable contains the null-terminated string of the author's email address. If the plugin does not specify an email address this pointer should be set to a NULL pointer.

cpl_plugin_func _cpl_plugin_::execute

Executes a plugin instance.

Parameters
pluginThe plugin to execute.
Returns
The function must return 0 on success, and a non-zero value if the plugin execution failed.

The function executes the plugin instance plugin.

cpl_plugin_func _cpl_plugin_::initialize

Initalizes a plugin instance.

Parameters
pluginThe plugin to instantiate.
Returns
The function must return 0 on success, and a non-zero value if the plugin instatiation failed.

The function to initialize a plugin instance. This maybe NULL if the initialization of the plugin is not needed. Otherwise it has to be called before plugin type specific members are accessed.

const char* _cpl_plugin_::name

Plugin's unique name.

Variable contains the unique name of the Plugin. To ensure uniqueness across all possible Plugins one should follow the hierarchical naming convention mentioned in the CPL documentation.

const char* _cpl_plugin_::synopsis

Plugin's short help string.

Variable contains the plugin's null-terminated short help string. The short help string should summarize the plugin's purpose in not more than a few lines. It may contain new line characters. If the plugin does not provide a short help the pointer should be set to a NULL pointer.

unsigned long _cpl_plugin_::type

The Plugin type.

The Plugin type identifies the type of plugin. The data type is not a cpl_plugin_type in order to keep this interface as generic as possible.

unsigned long _cpl_plugin_::version

The Plugin version.

The Plugin version number defines the version number for the plugin. The Plugin version number is an encoded version of the usual MAJOR.MINOR.MICRO form for version numbers.

cpl-6.4.1/html/doxygen.png0000644000460300003120000000730312310333014012332 00000000000000‰PNG  IHDRh ;ˆØŠIDATxí]y\•Õº~45%TL Q”PE"q–Û11±]8a„w*©¨(*â" ˆzÀè`8 ¨‰¢mÅ,’òà„p$%”œBó(8k†Ü÷ýÜû6lòö»§k÷Ç÷[ÏÞß·Ö;?k½ëßÕÕÕPxÑêÏ't´ÏùÈ€zÀÇÅ3_€Q4€g@œmÿ ¾ò‰âci‰ôçÿ{ ðÇð¬ù~½Á€4:õHcÂü ðŸÁ³„ª'ÕPÆæ P7^h،♠zb„cóP¨„ 3‚† Ò}çÿO²qÁºNkÝTÛ(É?d Ç~z<’«4Óǡ؞Þv­zµÙ¦õ¬ZâdÛ,Ë6Ók±]Fz< ¾ZçƒsÕ?ìƒsUø2SÉåwê1”c`[ì—}%ѽ.Ô¼6‚BLZ˜û!F8[ ¹…×TéÛ— »Þ#gó]å:vžu?‡vèbÙR˜?wùŽŸ¾ÊÐgbÑÉÌÕ$kF~Ê;عÆ•¢ïX®?ÉèlÆÙôõà»Nʪ¼­,ìHC§gAz•ÆlÓº­gÑú ]œjÎñåM…3ÓÚæoÒ³'=‘$Ò÷f}G•ŸS_‡öèco.Êȹ :ó£ Ãds®Ù:1=¼{ƒå9?÷ý…zqÛvîÓi‰D’p¿Ë šmÙíoÛâýaÖüEqÒµwÌ}¿~{òj€ç{ôºŸFNëí[ëOq·ÇOSúXO]°>‚‚muæÄ¾e¤“5Ë{¨JÕ¯£(›´«bÂçû’ÍlÓÅ}žïú`éUÞy„ac§Á†ÔCºŠóAkl‘±y¥†ô¢ùôs÷Aø¬7ÄõôoJ±äÄ ù.¥Be. Z¬Ð×ÇÈöå¹­ù'Ù-PëìŠyF.ž‚žÝÚ€lp&.êˆð•jò7’re’z19»ã§HGíø%œüq°ïüz׈c¬_k_")ŸHJnÐÑ~ˆÐÖ˜á´äÕ5 µÁq€ÿ5#¸·îà¶+9T‘‚ ðŽ÷Rܸrz“Ï´Ì =Ï…{ðáO£Èf ¡Íwg|Ž’Ü/¢Þ$÷¯¢ëðúÀ;¿à¨Ö™âÒÆ­]¯ÜW"Þ/< ‡÷DÏà°½üB}çyIEc^—ƒ=[V“Ýh²ëMä$l];Kû®¸ýr¦È*Åò ÿtÒõ$]•MŸ÷´;×I€1èó!‚œõ¸M õ¨(fÌæ<ÁÎÎò5~z¿ù¶ž mÌêÕ >–âÚ©âëˆIÎÞçz;ãu[i·eç^ÆÜÙÓ³NÞëF6B\}7†»+üŽÓ,Ã'a ½˜-yHY¿,‘^—ñfú~ß?Hcø¸…¸ñó{Z+4\såƒû·¯Ù·nߣð«íFÆ¡sغëû§D¾?ò<–Ævkx0ÅM±ælذÁIÓxÿd”žÜÉ÷EE»AªM«g*È£YEí7Û™^[uíý®v[wGå†=Ed¼n×¶ÆæÖÅl¡'¨pGÚk+‹æ¢À¬¨C8ªâš2 dz3H£ß ¡¨BÒûSÃÅù[wŘ ~xpçútÁæmö¤Å£¥iQæ­‰AB1ÉfÙ‰›4u¹ïìIÒ]Ë6äò%ÿ†† 1t.’NJph¬zÌ ÎR1Ž"3-"¸‡‹&ìó°1âüžìó[:‡ï„¼‘……N m–“W0®_èÜœ ×õ6ùò&»)Æìꦬýæ}¬ñ~»{múù]z½£M•ºP~^Îá:eQTÙ_*7ÕÄ9É8—·Ëï 3°¶47E•î¿u÷“SÉ»U¯ _ NíºôW¬e¸ÄNÓ|»;™¿;ŒæÅd"ȉôøòÞµõï¾®½"èÄ´ÖMM+bYµ‘_ÉæEÝüÎ]P»¹XKÐI½Þ¥oE<_¹(„EP±Œ|mÇÁ¡‘Ý,ŠÓ©ººZ±Îߺ§×kÝ,kÍMš`Äø…jzeU»æ ™Át3ÓÀ½˜6—ÒöùË·r¨¹Ñ}““wö:Χùë¼ ¿|‚TܵÉQˆKßç_ÁâÀ™œ”pÑÐóໃ¼Ydâ0!®àa –øöçW$ÃÁ‘Á$/\¬$ð 2ÞímÞLH‹Ÿ èd£HVÜ,:ò½»RÍZšJ­a„z*>‹_…NT(ù‚^SVF­U¹8ñEþôñ܈óùnd;«®8™\C]ø=Èêm¬Æ:‚´ÆbãDd=Áãßžˆ‹UU5O‹|]þð®Pèêv‰á\]2ßìÿ"yÈ[ïyʧz£g{Y«{„Ùø5©ÿ;w{N3é­nâĨw§Á¢ÍK¢Ý­ûÏ29Id¿’ì y)ìPÞò8ŒÅ©¯‰±@mPÔñwjl,6 áhWÕ˜d öà uõmÁp®.™á£Ç…twöR x­BδYcŒxg*vo  yò‘•“[¬?ÜVœ˜0ÒN¡O난~Žó’¯·h#´Hkýœ±8kÓß^Àq@]àÓ“ø,56´¯÷Í-κU»n…[>]@nîøÏœp›[œ6# €4tën¯:ŽÒþ}…—8äT9_žY$/´G’K™©ù†•(óÑ’Mø©`ŸÉdѺ;ùO‹B Ó&P{qöhJÉ+Úé–§¦l2«MïöÝ_1ÑÓ«’t¸½±l€ëØya ¦ô©«®½ÆL^¬žêñš¸ùy.¾Û½Š[ u/]½‹iS}øN>²e1™q‡jfÚ&¢©iT\=kÏ›ÀXô-.84V5ðu!TE˜ þ.ŒOH´¶4—zwTr.ï‰¦Ë xõµ·œÖ„HÆù£žÈHùg Ñhñ’T$ßyq¸zþ¨p¿´ë< q•ró÷š‰wÿÍÑð–I]´–æI²é²˜sÂ"×:Õ–bÕ¦“ÈÙL6¢9VÊÓWž§<æ;”3?ý©Mê3AV#µ±ËÞ¯‘ž K£UrÝ9!›qát¦H£Ù+6ÇV…/TS^pÃùqgLP'Ú5E ‚–ÀÞºîÄ Ën"2|Ÿ;®W»Îý"Ö¬TwÖâµtúŽO'› á+W Ã+¦âZÌ–<ÕÆ&nOÝ,IŠ£06.ÁZ.Çñúøh*INÚ’Oe½ÉgBXÐÔZóäøä9èü“hÒíDSš¥¡Ê µA¯/Ôc¸ö“`A§¯"zå|‘ €ÅŸ¨ú;HÍ#‚Î|%ÄOˆƒ«OàÌÉÐÜD ž mÜðâc–ƤÉÂqm¶uË&~÷núÒË £ÇÏ€ZÕj =«_n[‡‡÷nN§ÏÝ$_¾bE˜‚€Õ)ù8¾?6‘lú“ÍÙæÖ}#bW( œ³d-®•p&¡ý’œÖa”"9öõņÐ$’Ú›AÜ!ä;ÐÑõè{~á¹8‘ÛÞ£1ÛÓÉ0ž`²#´kÒuäNÅÖ Q¹bhæ ”8ûÓMáŽa›•¿”w±h²¢®qŠæ°(bK ‚’Z¾Ò%ÐÆémáãÖË(Éý‚ÛJ)@> þ›7% ï{y Á“¾ÆÒîohfòô>{pÿ.­_Î%±ÉèägëlZØ\B2B #™¸ÚüÒºp‚hÝšü®[¥Ü<‹#SpñÌA7’ãØHƒt4:Ÿ|g¨tÓL¶*($Æ©»ì…®ù’ó÷$;b›ÔÙ`=¶£¦M„MÌÄ5ò«·Ç¾“H·ÌH.¼žHeAîº5}r­dõ¨±)ÀT};€Q5iÖ2…O0ü…0óñÃ;óæ,Š´²µ냔}g‘£]‹7å9ˆà©_{üèîêžC>úhê{Ž .ÈìðIIð€?[Kswz6Òuíý¬;µ€ç§OåâJÉa˶zv°éd† ¤µâ‚l´é舊«Åüy¾c÷ÁèÖÍ'ràúÅ™TWÕôÓ°¡L €|ʽŒ¼ì­høBã ÝTëî'ò]Kø£ìâÏ(=¹Kx €¿ LÌ,Pý¤Êµu‡¹…׈ §Å¾÷à1Ý«Äý;¿pGDäxZYÛ kfæ6¸ùóæ7®œ®þ6·ÕoÚ¾ÔH~ò®Þ¸â 8Uø“p<ºw3¡a£ÏÑ’‘3èÏ"€bˆ-ÎܺÏ_ªÅ]+ËM©zü°s“f-êçhÇãÑýÊãôÿ5}ZQNb{Ó?å%ÿ\SUõعIÓæ}~}p[œoÔÄ„êÐMMZáNÅå@>Œ„²á6(?¡Åé âK½+ü?À%ÝÝ·/Ç1‚9áUø?B)”ÕèâÞlÈÒêÏ @=àùÄÞžk­®ÅIEND®B`‚cpl-6.4.1/html/ftv2cl.png0000644000460300003120000000070512310333014012054 00000000000000‰PNG  IHDRÚ}\ˆŒIDATxíÝ;H#AÇño4Љႇ œ„K‰‡‚á ’ê,m„ØØ vÚžJ°²¹ÚÎþî‚§ XY ÅB|dr³cvo—˜Ä°Ý ù0Ã’™3ÿͤõ”Ëe×´¸Éõ¯1XÞ8Œ‰nQˆ88ööÖ§3*rbñ¯¢û-$¨‚þ´˜“P1Žè@Z…-# Ïú01ÑÏÎêÄ1HkKŸ w¶O@¥ªÈóñ!f§ñu˜åác÷;’sá×Bý[E´Añ±—Í\ß>°ùý¿ÏËÊÂ]–P€zØf| Íñ¯“+Ù´gð5…b  i5ümM³œ_æÍq,ÒcŽõèoÓd´ !¶äò©ô•,ôðÀ{¹¨µYß,€zTÍ8H]𤕘ï7¼»/òó8ËQæ !F€~6ãá?Y ÀA@ŨÁ.@ƒ¶TäÄYïŠËë±r‘µ8Ð*·é>€Šçÿ?€×þŸe[6«xÂIEND®B`‚cpl-6.4.1/html/jquery.js0000644000460300003120000026726112310333014012037 00000000000000/*! jQuery v1.7.1 jquery.com | jquery.org/license */ (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")), f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() {for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c) {if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); cpl-6.4.1/html/group__cpl__type.html0000644000460300003120000005663112310333015014377 00000000000000 Common Pipeline Library Reference Manual: Type codes
Common Pipeline Library Reference Manual  6.4.1
Type codes

Functions

const char * cpl_type_get_name (cpl_type type)
 Get a string with the name of a type, e.g. "char", "int", "float".
 
size_t cpl_type_get_sizeof (cpl_type type)
 Compute the size of a type.
 
enum  _cpl_type_ {
  CPL_TYPE_FLAG_ARRAY,
  CPL_TYPE_INVALID,
  CPL_TYPE_CHAR,
  CPL_TYPE_UCHAR,
  CPL_TYPE_BOOL,
  CPL_TYPE_SHORT,
  CPL_TYPE_USHORT,
  CPL_TYPE_INT,
  CPL_TYPE_UINT,
  CPL_TYPE_LONG,
  CPL_TYPE_ULONG,
  CPL_TYPE_LONG_LONG,
  CPL_TYPE_SIZE,
  CPL_TYPE_FLOAT,
  CPL_TYPE_DOUBLE,
  CPL_TYPE_POINTER,
  CPL_TYPE_COMPLEX,
  CPL_TYPE_UNSPECIFIED,
  CPL_TYPE_BITMASK,
  CPL_TYPE_STRING,
  CPL_TYPE_FLOAT_COMPLEX,
  CPL_TYPE_DOUBLE_COMPLEX
}
 The CPL type codes and flags. More...
 
typedef enum _cpl_type_ cpl_type
 The type code type.
 
typedef long long cpl_size
 The type used for sizes and indices in CPL.
 
typedef uint64_t cpl_bitmask
 The CPL bitmask type for bitmask operations.
 
#define CPL_SIZE_MIN
 Minimum value a variable of type cpl_size can hold.
 
#define CPL_SIZE_MAX
 Maximum value a variable of type cpl_size can hold.
 
#define CPL_SIZE_FORMAT
 The format specifier for the type cpl_size.
 

Detailed Description

This module provides codes for the basic types (including char, int, float, etc.) used in CPL. These type codes may be used to indicate the type of a value stored in another object, the value of a property or the pixel of an image for instance. In addition, a utility function is provided to compute the size, which is required to store a value of the type indicated by a given type code.

The module

Synopsis
#include <cpl_type.h>

Macro Definition Documentation

#define CPL_SIZE_FORMAT

The format specifier for the type cpl_size.

Note
It is "ld" when cpl_size is a long int and "d" when it is an int
See Also
cpl_size

It can be used like this:

cpl_size i = my_index();
return cpl_sprintf("The index is %" CPL_SIZE_FORMAT "\n", i);
#define CPL_SIZE_MAX

Maximum value a variable of type cpl_size can hold.

#define CPL_SIZE_MIN

Minimum value a variable of type cpl_size can hold.

Typedef Documentation

typedef uint64_t cpl_bitmask

The CPL bitmask type for bitmask operations.

Note
The CPL bitmask is currently used only for bit-wise operations on CPL images of integer pixel type, which are 32-bits wide. For forward compatibility the CPL bitmask is 64 bits wide, which is cast to 32 bits when used with a CPL_TYPE_INT.
static cpl_image cpl_size

The type used for sizes and indices in CPL.

typedef enum _cpl_type_ cpl_type

The type code type.

Enumeration Type Documentation

enum _cpl_type_

The CPL type codes and flags.

Enumerator:
CPL_TYPE_FLAG_ARRAY 

Flag indicating whether a type is an array or a basic type.

CPL_TYPE_INVALID 

Invalid or undetermined type.

CPL_TYPE_CHAR 

Type code corresponding to type char.

CPL_TYPE_UCHAR 

Type code corresponding to type unsigned char.

CPL_TYPE_BOOL 

Type code corresponding to the boolean type.

CPL_TYPE_SHORT 

Type code corresponding to type short.

CPL_TYPE_USHORT 

Type code corresponding to type unsigned short.

CPL_TYPE_INT 

Type code corresponding to type int.

CPL_TYPE_UINT 

Type code corresponding to type unsigned int.

CPL_TYPE_LONG 

Type code corresponding to type long.

CPL_TYPE_ULONG 

Type code corresponding to type unsigned long.

CPL_TYPE_LONG_LONG 

Type code corresponding to type long long.

CPL_TYPE_SIZE 

Type code corresponding to type cpl_size

CPL_TYPE_FLOAT 

Type code corresponding to type float.

CPL_TYPE_DOUBLE 

Type code corresponding to type double.

CPL_TYPE_POINTER 

Type code corresponding to a pointer type.

CPL_TYPE_COMPLEX 

Type code corresponding to a complex type.

CPL_TYPE_UNSPECIFIED 

Type code to be used for inheritance of original FITS type.

CPL_TYPE_BITMASK 

Type code corresponding to type cpl_bitmask

CPL_TYPE_STRING 

Type code corresponding to a character array.

CPL_TYPE_FLOAT_COMPLEX 

Type code corresponding to type float complex.

CPL_TYPE_DOUBLE_COMPLEX 

Type code corresponding to type double complex.

Function Documentation

const char* cpl_type_get_name ( cpl_type  type)

Get a string with the name of a type, e.g. "char", "int", "float".

Parameters
typeType code to be evaluated.
Returns
A pointer to a string literal with the name or empty string on error.
size_t cpl_type_get_sizeof ( cpl_type  type)

Compute the size of a type.

Parameters
typeType code to be evaluated.
Returns
The size of the fundamental type, or 0 in case an invalid type code was given.

The function computes the atomic size of the type type. The result for fundamental types like CPL_TYPE_FLOAT is what you would expect from the C sizeof() operator. For arrays, i.e. types having the CPL_TYPE_FLAG_ARRAY set the returned size is not the size of a pointer to CPL_TYPE_FLOAT for instance, but the size of its fundamental type, i.e. the returned size is same as for the type CPL_TYPE_FLOAT.

Especially for the type CPL_TYPE_STRING, which is explicitly defined for convenience reasons, the size returned by this function is the size of CPL_TYPE_CHAR!

cpl-6.4.1/html/struct__cpl__recipe__-members.html0000644000460300003120000000575612310333015017005 00000000000000 Common Pipeline Library Reference Manual: Member List
Common Pipeline Library Reference Manual  6.4.1
_cpl_recipe_ Member List

This is the complete list of members for _cpl_recipe_, including all inherited members.

frames_cpl_recipe_
interface_cpl_recipe_
parameters_cpl_recipe_
cpl-6.4.1/html/doxygen.css0000644000460300003120000004740312310333014012343 00000000000000/* The standard CSS for doxygen */ body, table, div, p, dl { font: 400 14px/19px Roboto,sans-serif; } /* @group Heading Levels */ h1.groupheader { font-size: 150%; } .title { font-size: 150%; font-weight: bold; margin: 10px 2px; } h2.groupheader { border-bottom: 1px solid #879ECB; color: #354C7B; font-size: 150%; font-weight: normal; margin-top: 1.75em; padding-top: 8px; padding-bottom: 4px; width: 100%; } h3.groupheader { font-size: 100%; } h1, h2, h3, h4, h5, h6 { -webkit-transition: text-shadow 0.5s linear; -moz-transition: text-shadow 0.5s linear; -ms-transition: text-shadow 0.5s linear; -o-transition: text-shadow 0.5s linear; transition: text-shadow 0.5s linear; margin-right: 15px; } h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { text-shadow: 0 0 15px cyan; } dt { font-weight: bold; } div.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; } p.startli, p.startdd, p.starttd { margin-top: 2px; } p.endli { margin-bottom: 0px; } p.enddd { margin-bottom: 4px; } p.endtd { margin-bottom: 2px; } /* @end */ caption { font-weight: bold; } span.legend { font-size: 70%; text-align: center; } h3.version { font-size: 90%; text-align: center; } div.qindex, div.navtab{ background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; } div.qindex, div.navpath { width: 100%; line-height: 140%; } div.navtab { margin-right: 15px; } /* @group Link Styling */ a { color: #3D578C; font-weight: normal; text-decoration: none; } .contents a:visited { color: #4665A2; } a:hover { text-decoration: underline; } a.qindex { font-weight: bold; } a.qindexHL { font-weight: bold; background-color: #9CAFD4; color: #ffffff; border: 1px double #869DCA; } .contents a.qindexHL:visited { color: #ffffff; } a.el { font-weight: bold; } a.elRef { } a.code, a.code:visited { color: #4665A2; } a.codeRef, a.codeRef:visited { color: #4665A2; } /* @end */ dl.el { margin-left: -1cm; } pre.fragment { border: 1px solid #C4CFE5; background-color: #FBFCFD; padding: 4px 6px; margin: 4px 8px 4px 2px; overflow: auto; word-wrap: break-word; font-size: 9pt; line-height: 125%; font-family: monospace, fixed; font-size: 105%; } div.fragment { padding: 4px; margin: 4px; background-color: #FBFCFD; border: 1px solid #C4CFE5; } div.line { font-family: monospace, fixed; font-size: 13px; min-height: 13px; line-height: 1.0; text-wrap: unrestricted; white-space: -moz-pre-wrap; /* Moz */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: pre-wrap; /* CSS3 */ word-wrap: break-word; /* IE 5.5+ */ text-indent: -53px; padding-left: 53px; padding-bottom: 0px; margin: 0px; -webkit-transition-property: background-color, box-shadow; -webkit-transition-duration: 0.5s; -moz-transition-property: background-color, box-shadow; -moz-transition-duration: 0.5s; -ms-transition-property: background-color, box-shadow; -ms-transition-duration: 0.5s; -o-transition-property: background-color, box-shadow; -o-transition-duration: 0.5s; transition-property: background-color, box-shadow; transition-duration: 0.5s; } div.line.glow { background-color: cyan; box-shadow: 0 0 10px cyan; } span.lineno { padding-right: 4px; text-align: right; border-right: 2px solid #0F0; background-color: #E8E8E8; white-space: pre; } span.lineno a { background-color: #D8D8D8; } span.lineno a:hover { background-color: #C8C8C8; } div.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px; padding: 0.2em; border: solid thin #333; border-radius: 0.5em; -webkit-border-radius: .5em; -moz-border-radius: .5em; box-shadow: 2px 2px 3px #999; -webkit-box-shadow: 2px 2px 3px #999; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); } div.groupHeader { margin-left: 16px; margin-top: 12px; font-weight: bold; } div.groupText { margin-left: 16px; font-style: italic; } body { background-color: white; color: black; margin: 0; } div.contents { margin-top: 10px; margin-left: 12px; margin-right: 8px; } td.indexkey { background-color: #EBEFF6; font-weight: bold; border: 1px solid #C4CFE5; margin: 2px 0px 2px 0; padding: 2px 10px; white-space: nowrap; vertical-align: top; } td.indexvalue { background-color: #EBEFF6; border: 1px solid #C4CFE5; padding: 2px 10px; margin: 2px 0px; } tr.memlist { background-color: #EEF1F7; } p.formulaDsp { text-align: center; } img.formulaDsp { } img.formulaInl { vertical-align: middle; } div.center { text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { border: 0px; } address.footer { text-align: right; padding-right: 12px; } img.footer { border: 0px; vertical-align: middle; } /* @group Code Colorization */ span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } span.vhdldigit { color: #ff00ff } span.vhdlchar { color: #000000 } span.vhdlkeyword { color: #700070 } span.vhdllogic { color: #ff0000 } blockquote { background-color: #F7F8FB; border-left: 2px solid #9CAFD4; margin: 0 24px 0 4px; padding: 0 12px 0 16px; } /* @end */ /* .search { color: #003399; font-weight: bold; } form.search { margin-bottom: 0px; margin-top: 0px; } input.search { font-size: 75%; color: #000080; font-weight: normal; background-color: #e8eef2; } */ td.tiny { font-size: 75%; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #A3B4D7; } th.dirtab { background: #EBEFF6; font-weight: bold; } hr { height: 0px; border: none; border-top: 1px solid #4A6AAA; } hr.footer { height: 1px; } /* @group Member Descriptions */ table.memberdecls { border-spacing: 0px; padding: 0px; } .memberdecls td, .fieldtable tr { -webkit-transition-property: background-color, box-shadow; -webkit-transition-duration: 0.5s; -moz-transition-property: background-color, box-shadow; -moz-transition-duration: 0.5s; -ms-transition-property: background-color, box-shadow; -ms-transition-duration: 0.5s; -o-transition-property: background-color, box-shadow; -o-transition-duration: 0.5s; transition-property: background-color, box-shadow; transition-duration: 0.5s; } .memberdecls td.glow, .fieldtable tr.glow { background-color: cyan; box-shadow: 0 0 15px cyan; } .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { background-color: #F9FAFC; border: none; margin: 4px; padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { padding: 0px 8px 4px 8px; color: #555; } .memSeparator { border-bottom: 1px solid #DEE4F0; line-height: 1px; margin: 0px; padding: 0px; } .memItemLeft, .memTemplItemLeft { white-space: nowrap; } .memItemRight { width: 100%; } .memTemplParams { color: #4665A2; white-space: nowrap; font-size: 80%; } /* @end */ /* @group Member Details */ /* Styles for detailed member documentation */ .memtemplate { font-size: 80%; color: #4665A2; font-weight: normal; margin-left: 9px; } .memnav { background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .mempage { width: 100%; } .memitem { padding: 0; margin-bottom: 10px; margin-right: 5px; -webkit-transition: box-shadow 0.5s linear; -moz-transition: box-shadow 0.5s linear; -ms-transition: box-shadow 0.5s linear; -o-transition: box-shadow 0.5s linear; transition: box-shadow 0.5s linear; display: table !important; width: 100%; } .memitem.glow { box-shadow: 0 0 15px cyan; } .memname { font-weight: bold; margin-left: 6px; } .memname td { vertical-align: bottom; } .memproto, dl.reflist dt { border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 0px 6px 0px; color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; /* opera specific markup */ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); border-top-right-radius: 4px; border-top-left-radius: 4px; /* firefox specific markup */ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; -moz-border-radius-topright: 4px; -moz-border-radius-topleft: 4px; /* webkit specific markup */ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -webkit-border-top-right-radius: 4px; -webkit-border-top-left-radius: 4px; } .memdoc, dl.reflist dd { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 10px 2px 10px; background-color: #FBFCFD; border-top-width: 0; background-image:url('nav_g.png'); background-repeat:repeat-x; background-color: #FFFFFF; /* opera specific markup */ border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); /* firefox specific markup */ -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; /* webkit specific markup */ -webkit-border-bottom-left-radius: 4px; -webkit-border-bottom-right-radius: 4px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); } dl.reflist dt { padding: 5px; } dl.reflist dd { margin: 0px 0px 10px 0px; padding: 5px; } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; white-space: nowrap; } .paramname em { font-style: normal; } .paramname code { line-height: 14px; } .params, .retval, .exception, .tparams { margin-left: 0px; padding-left: 0px; } .params .paramname, .retval .paramname { font-weight: bold; vertical-align: top; } .params .paramtype { font-style: italic; vertical-align: top; } .params .paramdir { font-family: "courier new",courier,monospace; vertical-align: top; } table.mlabels { border-spacing: 0px; } td.mlabels-left { width: 100%; padding: 0px; } td.mlabels-right { vertical-align: bottom; padding: 0px; white-space: nowrap; } span.mlabels { margin-left: 8px; } span.mlabel { background-color: #728DC1; border-top:1px solid #5373B4; border-left:1px solid #5373B4; border-right:1px solid #C4CFE5; border-bottom:1px solid #C4CFE5; text-shadow: none; color: white; margin-right: 4px; padding: 2px 3px; border-radius: 3px; font-size: 7pt; white-space: nowrap; vertical-align: middle; } /* @end */ /* these are for tree view when not used as main index */ div.directory { margin: 10px 0px; border-top: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; width: 100%; } .directory table { border-collapse:collapse; } .directory td { margin: 0px; padding: 0px; vertical-align: top; } .directory td.entry { white-space: nowrap; padding-right: 6px; } .directory td.entry a { outline:none; } .directory td.entry a img { border: none; } .directory td.desc { width: 100%; padding-left: 6px; padding-right: 6px; padding-top: 3px; border-left: 1px solid rgba(0,0,0,0.05); } .directory tr.even { padding-left: 6px; background-color: #F7F8FB; } .directory img { vertical-align: -30%; } .directory .levels { white-space: nowrap; width: 100%; text-align: right; font-size: 9pt; } .directory .levels span { cursor: pointer; padding-left: 2px; padding-right: 2px; color: #3D578C; } div.dynheader { margin-top: 8px; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } address { font-style: normal; color: #2A3D61; } table.doxtable { border-collapse:collapse; margin-top: 4px; margin-bottom: 4px; } table.doxtable td, table.doxtable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.doxtable th { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; } table.fieldtable { width: 100%; margin-bottom: 10px; border: 1px solid #A8B8D9; border-spacing: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); } .fieldtable td, .fieldtable th { padding: 3px 7px 2px; } .fieldtable td.fieldtype, .fieldtable td.fieldname { white-space: nowrap; border-right: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; vertical-align: top; } .fieldtable td.fielddoc { border-bottom: 1px solid #A8B8D9; width: 100%; } .fieldtable tr:last-child td { border-bottom: none; } .fieldtable th { background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; font-size: 90%; color: #253555; padding-bottom: 4px; padding-top: 5px; text-align:left; -moz-border-radius-topleft: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom: 1px solid #A8B8D9; } .tabsearch { top: 0px; left: 10px; height: 36px; background-image: url('tab_b.png'); z-index: 101; overflow: hidden; font-size: 13px; } .navpath ul { font-size: 11px; background-image:url('tab_b.png'); background-repeat:repeat-x; background-position: 0 -5px; height:30px; line-height:30px; color:#8AA0CC; border:solid 1px #C2CDE4; overflow:hidden; margin:0px; padding:0px; } .navpath li { list-style-type:none; float:left; padding-left:10px; padding-right:15px; background-image:url('bc_s.png'); background-repeat:no-repeat; background-position:right; color:#364D7C; } .navpath li.navelem a { height:32px; display:block; text-decoration: none; outline: none; color: #283A5D; font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); text-decoration: none; } .navpath li.navelem a:hover { color:#6884BD; } .navpath li.footer { list-style-type:none; float:right; padding-left:10px; padding-right:15px; background-image:none; background-repeat:no-repeat; background-position:right; color:#364D7C; font-size: 8pt; } div.summary { float: right; font-size: 8pt; padding-right: 5px; width: 50%; text-align: right; } div.summary a { white-space: nowrap; } div.ingroups { font-size: 8pt; width: 50%; text-align: left; } div.ingroups a { white-space: nowrap; } div.header { background-image:url('nav_h.png'); background-repeat:repeat-x; background-color: #F9FAFC; margin: 0px; border-bottom: 1px solid #C4CFE5; } div.headertitle { padding: 5px 5px 5px 10px; } dl { padding: 0 0 0 10px; } /* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ dl.section { margin-left: 0px; padding-left: 0px; } dl.note { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #D0C000; } dl.warning, dl.attention { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #FF0000; } dl.pre, dl.post, dl.invariant { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #00D000; } dl.deprecated { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #505050; } dl.todo { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #00C0E0; } dl.test { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #3030E0; } dl.bug { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #C08050; } dl.section dd { margin-bottom: 6px; } #projectlogo { text-align: center; vertical-align: bottom; border-collapse: separate; } #projectlogo img { border: 0px none; } #projectname { font: 300% Tahoma, Arial,sans-serif; margin: 0px; padding: 2px 0px; } #projectbrief { font: 120% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #projectnumber { font: 50% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #titlearea { padding: 0px; margin: 0px; width: 100%; border-bottom: 1px solid #5373B4; } .image { text-align: center; } .dotgraph { text-align: center; } .mscgraph { text-align: center; } .caption { font-weight: bold; } div.zoom { border: 1px solid #90A5CE; } dl.citelist { margin-bottom:50px; } dl.citelist dt { color:#334975; float:left; font-weight:bold; margin-right:10px; padding:5px; } dl.citelist dd { margin:2px 0; padding:5px 0; } div.toc { padding: 14px 25px; background-color: #F4F6FA; border: 1px solid #D8DFEE; border-radius: 7px 7px 7px 7px; float: right; height: auto; margin: 0 20px 10px 10px; width: 200px; } div.toc li { background: url("bdwn.png") no-repeat scroll 0 5px transparent; font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; margin-top: 5px; padding-left: 10px; padding-top: 2px; } div.toc h3 { font: bold 12px/1.2 Arial,FreeSans,sans-serif; color: #4665A2; border-bottom: 0 none; margin: 0; } div.toc ul { list-style: none outside none; border: medium none; padding: 0px; } div.toc li.level1 { margin-left: 0px; } div.toc li.level2 { margin-left: 15px; } div.toc li.level3 { margin-left: 30px; } div.toc li.level4 { margin-left: 45px; } .inherit_header { font-weight: bold; color: gray; cursor: pointer; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .inherit_header td { padding: 6px 0px 2px 5px; } .inherit { display: none; } tr.heading h2 { margin-top: 12px; margin-bottom: 4px; } @media print { #top { display: none; } #side-nav { display: none; } #nav-path { display: none; } body { overflow:visible; } h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } .summary { display: none; } .memitem { page-break-inside: avoid; } #doc-content { margin-left:0 !important; height:auto !important; width:auto !important; overflow:inherit; display:inline; } } cpl-6.4.1/html/open.png0000644000460300003120000000017312310333014011614 00000000000000‰PNG  IHDR à‘BIDATxíÝÁ €0 Ð׬ՙ\Àº€39—b!©9{|ðI>$#Àß´ý8/¨ÄØzƒ/Ï>2À[ÎgiU,/¬~¼Ï\ Ä9Ù¸IEND®B`‚cpl-6.4.1/html/sync_off.png0000644000460300003120000000152512310333014012463 00000000000000‰PNG  IHDRàw=øIDATxíÝKhTWÀñÿä1I&3™8M¦Iš™†I3Ú©b$cÌ I1V1±-(Tö±±Ð.* t!‚K[¥Ä¥ˆ„¨´f£`l(øl©"Y”¤6ÆgÌTú}·sgîܹ ±d{8?æÌ¹÷;çÜuíÚ`:!±F¬¢BäŠ?ŰÄm'yÊÅ>ÑlU¯½üý‰è_‹?€Œê ]€Y(ŠNñ±8fý1°Öqún-eâ¨øtºmâÈ Ó0}b›ù%·©µ×Œ®=Ÿ0´³?Š1sŸ‹0€¯8À‘;_ ‹W|%\ Zð— >舽ln¨p©.aÇ{ )t;Ú b nŸš¯›65°¢¡2çÅÔ?Žž>Oдàuönm¤¢Ì`×­Z¬WjC~>‘Ö¾0+á {{©fÝ×Mæ·æÅ•ìÙ¼˜` Ý›%uA6´½ÅÆö¨Á,]k¢ÄW¼™u±›]‹ˆ7§¯iòh€ ¶¶¬ÏÖu1 ló —Ҷ̺–:ÞÍ\ÄcãÏxøhR²Êè‡Qt$¿ß§¨ ª fdºü<4BÿÙ[•f¸d7=.Mé9/—éªÃëù/ÿO Üaàò}€,‘j?Ÿõ.5Úšm?œÿŸ®ŽXÿ2¬#¸d píæ(£?cÛú¼!½›a1¥Þ—ŽòØ©ܾ7dÔK:‚ùÒ‰ì)Ê3‚Ü™àÌà]€,±H€µ+køöäu<|`·LhC7¹ÔeÍ Ÿ×Ÿ˜tÜ‹ óH$^2%l.êaeÐäýE”ÌÉ|ÅÜìî‰Ýsä }¸ýDû^hzé~ðR›¦Ã¡¿]|#ü¯@×—Ö‡[k¹–<|š(Ç*€Ý¹dÇtMé:Ýñø«Ø,êÅû¢]”' øXÓ_nò¡Æ|Øý /c§fžâOIEND®B`‚cpl-6.4.1/html/form_0.png0000644000460300003120000000243512310333015012041 00000000000000‰PNG  IHDR(DÞñB0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïŒIDATxí]Û’Ü* l@`ì±Çÿÿ·iµðØÎ&›¼¤Î™ªÙŠ&„Zjty€ÀßH€À·’'þع.ƒ>ú³zЙmèš]ÎÖNÕ—€ó_½XwòÅ@:€ùŠƒÂÅ~~EÈ¥”a_Eº7„‹t¸ÆP_Ú‡ªHhc{ñƒçI›¯©2#bŸC'=^>v¡ô¬›èn2¯XœoþµŽ§BæÝÕ/î/º.Ò£ »H¹Aàû.ôœ¶ z–ªˆR|%¬MT²¼X¹ 1ºW§¡ÁC¹a̼à™@‘—n—×¢’ÞBVe`eqZŠ3—þÞì¡]G˜ÛÈ—BöøÃ@FTÃPôâO“"òžUFwØ©à7éêæûƒ„x–V|»»ÅA”o‹½ñŒùb³Xäu5ˆB¥W“5âg‡ ;Nî00ù!¤:˜fú¢ cjy¦–ëáÓ‰ÐwßÂöH³åŽà)s¸}à@¢lg¦Bßu0½–p‘ôïÚL'Q¶>xáF”™­æÐäÉËÃvŽÖ£F¡O+•VqøðçŠ0Š ˜7(Gt„v¤¤Â897æ'ù©'º!x¹>aîÑkÃÅi¤ä@˜f³œ–4±úÁ¦´¨Zni²µ‡‹¥ÕÝ#D…¿ž^áÙ<ûKj—ºÓµ'c¹Îé[=êäŽè©ý‡É66¯iƃUØ}’’Zw$ŒM„Bµk“ùWPŹ+°ï0É[™™VD^ÝÀ ]-ûŠ @ÂE¯9wñ@PFùï:‚óÈþöÉfRÉE’M¸ D ø¹yV¨¾ÛbH´Ð"ÿËmz7 jÝŸ,vv*>@”®œjæÕù ¥V^¡6ŸåìÕ´·ñP7ò¼ð}Ù˜=Q©&mµo 3gß­y|ŽàtýÁ³ÕßÚuB”^mÒð©ÒÖÏ%Î]šŸŸ$PS0× wà ~)A'üFþdàß#±¿‘? ÃR‰€/Ò”¶mÛ¶í#Û¶m߈çlJ)}$¥”¾ø—±¯âV ¯M«­­q¸ÔfbÁ¬\?Õ@´(½ûÀ«d7ƒ1Aàý¤,—Á©ñþöºvÇHœÕ/c¼õë­GŽVªEãä{{ß:8sjÙð?•xÿ…#c;Ù`J‡ ªÚ…¨3]Gi·ªMéñKƒ¨mÎa\$ ï)W¢È€Æë ª®'QÙÊ…(C~%[Ù™)ªÐAT}îZêh*Xßœ¨b¶š±,œ§lö¨f‰ÉQŸà6 zik>Ž2U_Ge÷dy™)fÓl–s'çQ³%X€·“kF1…‰Òfê¨g¦¤4k¡#6ï¢Ô‹Î–¢³EFEâEFeZ;Û\«Ñ°àý¤L1—"že¹”ÓâR•yê>èâˆIr¥Ö4‡^¥—¯G©ÆÞWnƒû>›þöè¶È¢ÿ—Gðøä€õ-Ò)`IEND®B`‚cpl-6.4.1/html/form_23.png0000644000460300003120000000152012310333020012114 00000000000000‰PNG  IHDR¬:sJ0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ï¿IDATxí]Ûnä: £¯±dòÿ{H)“[Ï¢»@ ‹5"3ò…¦)åþ|°¾² øùF`€Ÿcùp®O¿<'«%9MpßaºçI;¤Ç6Ï@_àfY`“€f¹0½|ƒMÜ%W ô:Ï·!ÞÛS¡“ÈQ›ìUÍÀ×›ø[„„¸¶+)Úýøvð< ˜9®«š`îh‰   ~!ð[›Èagåf×Ôo¼áG@`K±ûæO .:Yo›Æiˆá¼€-˼;ªP[³·šÒÀø£bÓHŽ‘bhÊÐÍ?»D´ iA]r oÙˆ]‡8Åœkš±/Zª7ËÉHõØJäjZsžz|Mˆ[Fœ9;¾jí‰^¾†¶i¼hë›î<›Dì#@°ðÈ É$3ÃH]%›ñž¼¸X?Þœç¯Ñ’³0ËÊZ 6"ÚIuU2Lâ [YÜí‹ÏW¦õo59l•ÌÂÞÁF'øÁÊv¥÷½ùmq E5rMØQ¶¹iK©ÓBag–m7ÙË|]§Zì²î‚µ²°¥Øì6²kóìxê™ó\¤àòpn _Ú`+ªHh=Çæ"a?„.1·õòV¦oZÖÖlãÜɺ6‘vž8õdµWÄE…µ˜^œ^9Wyªõ’Χ•LkÌʪ }æŒ&Á:ÙfûNŸµ³OéÀŸàúά2$Ƹû¡<Žz½r œÀìæÎñ™P½Þ‡›ûúonõ3ß­¼ §ýcàü;gŸz`r6Ý÷¢ðý÷ à/±ÿÙ ¿¥&qIEND®B`‚cpl-6.4.1/html/group__cpl__propertylist.html0000644000460300003120000115325512310333014016176 00000000000000 Common Pipeline Library Reference Manual: Property Lists
Common Pipeline Library Reference Manual  6.4.1
Property Lists

Typedefs

typedef struct _cpl_propertylist_ cpl_propertylist
 The opaque property list data type.
 
typedef int(* cpl_propertylist_compare_func )(const cpl_property *first, const cpl_property *second)
 The property comparison function data type.
 

Functions

cpl_error_code cpl_propertylist_append (cpl_propertylist *self, const cpl_propertylist *other)
 Append a property list..
 
cpl_error_code cpl_propertylist_append_bool (cpl_propertylist *self, const char *name, int value)
 Append a boolean value to a property list.
 
cpl_error_code cpl_propertylist_append_char (cpl_propertylist *self, const char *name, char value)
 Append a character value to a property list.
 
cpl_error_code cpl_propertylist_append_double (cpl_propertylist *self, const char *name, double value)
 Append a double value to a property list.
 
cpl_error_code cpl_propertylist_append_double_complex (cpl_propertylist *self, const char *name, double complex value)
 Append a double complex value to a property list.
 
cpl_error_code cpl_propertylist_append_float (cpl_propertylist *self, const char *name, float value)
 Append a float value to a property list.
 
cpl_error_code cpl_propertylist_append_float_complex (cpl_propertylist *self, const char *name, float complex value)
 Append a float complex value to a property list.
 
cpl_error_code cpl_propertylist_append_int (cpl_propertylist *self, const char *name, int value)
 Append an integer value to a property list.
 
cpl_error_code cpl_propertylist_append_long (cpl_propertylist *self, const char *name, long value)
 Append a long value to a property list.
 
cpl_error_code cpl_propertylist_append_long_long (cpl_propertylist *self, const char *name, long long value)
 Append a long long value to a property list.
 
cpl_error_code cpl_propertylist_append_property (cpl_propertylist *self, const cpl_property *property)
 Append a property to a property list.
 
cpl_error_code cpl_propertylist_append_string (cpl_propertylist *self, const char *name, const char *value)
 Append a string value to a property list.
 
cpl_error_code cpl_propertylist_copy_property (cpl_propertylist *self, const cpl_propertylist *other, const char *name)
 Copy a property from another property list.
 
cpl_error_code cpl_propertylist_copy_property_regexp (cpl_propertylist *self, const cpl_propertylist *other, const char *regexp, int invert)
 Copy matching properties from another property list.
 
void cpl_propertylist_delete (cpl_propertylist *self)
 Destroy a property list.
 
void cpl_propertylist_dump (const cpl_propertylist *self, FILE *stream)
 Print a property list.
 
cpl_propertylistcpl_propertylist_duplicate (const cpl_propertylist *self)
 Create a copy of the given property list.
 
void cpl_propertylist_empty (cpl_propertylist *self)
 Remove all properties from a property list.
 
int cpl_propertylist_erase (cpl_propertylist *self, const char *name)
 Erase the given property from a property list.
 
int cpl_propertylist_erase_regexp (cpl_propertylist *self, const char *regexp, int invert)
 Erase all properties with name matching a given regular expression.
 
cpl_propertycpl_propertylist_get (cpl_propertylist *self, long position)
 Access property list elements by index.
 
int cpl_propertylist_get_bool (const cpl_propertylist *self, const char *name)
 Get the boolean value of the given property list entry.
 
char cpl_propertylist_get_char (const cpl_propertylist *self, const char *name)
 Get the character value of the given property list entry.
 
const char * cpl_propertylist_get_comment (const cpl_propertylist *self, const char *name)
 Get the comment of the given property list entry.
 
const cpl_propertycpl_propertylist_get_const (const cpl_propertylist *self, long position)
 Access property list elements by index.
 
double cpl_propertylist_get_double (const cpl_propertylist *self, const char *name)
 Get the double value of the given property list entry.
 
double complex cpl_propertylist_get_double_complex (const cpl_propertylist *self, const char *name)
 Get the double complex value of the given property list entry.
 
float cpl_propertylist_get_float (const cpl_propertylist *self, const char *name)
 Get the float value of the given property list entry.
 
float complex cpl_propertylist_get_float_complex (const cpl_propertylist *self, const char *name)
 Get the float complex value of the given property list entry.
 
int cpl_propertylist_get_int (const cpl_propertylist *self, const char *name)
 Get the integer value of the given property list entry.
 
long cpl_propertylist_get_long (const cpl_propertylist *self, const char *name)
 Get the long value of the given property list entry.
 
long long cpl_propertylist_get_long_long (const cpl_propertylist *self, const char *name)
 Get the long long value of the given property list entry.
 
cpl_propertycpl_propertylist_get_property (cpl_propertylist *self, const char *name)
 Access property list elements by property name.
 
const cpl_propertycpl_propertylist_get_property_const (const cpl_propertylist *self, const char *name)
 Access property list elements by property name.
 
cpl_size cpl_propertylist_get_size (const cpl_propertylist *self)
 Get the current size of a property list.
 
const char * cpl_propertylist_get_string (const cpl_propertylist *self, const char *name)
 Get the string value of the given property list entry.
 
cpl_type cpl_propertylist_get_type (const cpl_propertylist *self, const char *name)
 Get the the type of a property list entry.
 
int cpl_propertylist_has (const cpl_propertylist *self, const char *name)
 Check whether a property is present in a property list.
 
cpl_error_code cpl_propertylist_insert_after_bool (cpl_propertylist *self, const char *after, const char *name, int value)
 Insert a boolean value into a property list after the given position.
 
cpl_error_code cpl_propertylist_insert_after_char (cpl_propertylist *self, const char *after, const char *name, char value)
 Insert a character value into a property list after the given position.
 
cpl_error_code cpl_propertylist_insert_after_double (cpl_propertylist *self, const char *after, const char *name, double value)
 Insert a double value into a property list after the given position.
 
cpl_error_code cpl_propertylist_insert_after_double_complex (cpl_propertylist *self, const char *after, const char *name, double complex value)
 Insert a double complex value into a property list after the given position.
 
cpl_error_code cpl_propertylist_insert_after_float (cpl_propertylist *self, const char *after, const char *name, float value)
 Insert a float value into a property list after the given position.
 
cpl_error_code cpl_propertylist_insert_after_float_complex (cpl_propertylist *self, const char *after, const char *name, float complex value)
 Insert a float complex value into a property list after the given position.
 
cpl_error_code cpl_propertylist_insert_after_int (cpl_propertylist *self, const char *after, const char *name, int value)
 Insert a integer value into a property list after the given position.
 
cpl_error_code cpl_propertylist_insert_after_long (cpl_propertylist *self, const char *after, const char *name, long value)
 Insert a long value into a property list after the given position.
 
cpl_error_code cpl_propertylist_insert_after_long_long (cpl_propertylist *self, const char *after, const char *name, long long value)
 Insert a long long value into a property list after the given position.
 
cpl_error_code cpl_propertylist_insert_after_property (cpl_propertylist *self, const char *after, const cpl_property *property)
 Insert a property into a property list after the given position.
 
cpl_error_code cpl_propertylist_insert_after_string (cpl_propertylist *self, const char *after, const char *name, const char *value)
 Insert a string value into a property list after the given position.
 
cpl_error_code cpl_propertylist_insert_bool (cpl_propertylist *self, const char *here, const char *name, int value)
 Insert a boolean value into a property list at the given position.
 
cpl_error_code cpl_propertylist_insert_char (cpl_propertylist *self, const char *here, const char *name, char value)
 Insert a character value into a property list at the given position.
 
cpl_error_code cpl_propertylist_insert_double (cpl_propertylist *self, const char *here, const char *name, double value)
 Insert a double value into a property list at the given position.
 
cpl_error_code cpl_propertylist_insert_double_complex (cpl_propertylist *self, const char *here, const char *name, double complex value)
 Insert a double complex value into a property list at the given position.
 
cpl_error_code cpl_propertylist_insert_float (cpl_propertylist *self, const char *here, const char *name, float value)
 Insert a float value into a property list at the given position.
 
cpl_error_code cpl_propertylist_insert_float_complex (cpl_propertylist *self, const char *here, const char *name, float complex value)
 Insert a float complex value into a property list at the given position.
 
cpl_error_code cpl_propertylist_insert_int (cpl_propertylist *self, const char *here, const char *name, int value)
 Insert a integer value into a property list at the given position.
 
cpl_error_code cpl_propertylist_insert_long (cpl_propertylist *self, const char *here, const char *name, long value)
 Insert a long value into a property list at the given position.
 
cpl_error_code cpl_propertylist_insert_long_long (cpl_propertylist *self, const char *here, const char *name, long long value)
 Insert a long long value into a property list at the given position.
 
cpl_error_code cpl_propertylist_insert_property (cpl_propertylist *self, const char *here, const cpl_property *property)
 Insert a property into a property list at the given position.
 
cpl_error_code cpl_propertylist_insert_string (cpl_propertylist *self, const char *here, const char *name, const char *value)
 Insert a string value into a property list at the given position.
 
int cpl_propertylist_is_empty (const cpl_propertylist *self)
 Check whether a property list is empty.
 
cpl_propertylistcpl_propertylist_load (const char *name, cpl_size position)
 Create a property list from a file.
 
cpl_propertylistcpl_propertylist_load_regexp (const char *name, cpl_size position, const char *regexp, int invert)
 Create a filtered property list from a file.
 
cpl_propertylistcpl_propertylist_new (void)
 Create an empty property list.
 
cpl_error_code cpl_propertylist_prepend_bool (cpl_propertylist *self, const char *name, int value)
 Prepend a boolean value to a property list.
 
cpl_error_code cpl_propertylist_prepend_char (cpl_propertylist *self, const char *name, char value)
 Prepend a character value to a property list.
 
cpl_error_code cpl_propertylist_prepend_double (cpl_propertylist *self, const char *name, double value)
 Prepend a double value to a property list.
 
cpl_error_code cpl_propertylist_prepend_double_complex (cpl_propertylist *self, const char *name, double complex value)
 Prepend a double complex value to a property list.
 
cpl_error_code cpl_propertylist_prepend_float (cpl_propertylist *self, const char *name, float value)
 Prepend a float value to a property list.
 
cpl_error_code cpl_propertylist_prepend_float_complex (cpl_propertylist *self, const char *name, float complex value)
 Prepend a float complex value to a property list.
 
cpl_error_code cpl_propertylist_prepend_int (cpl_propertylist *self, const char *name, int value)
 Prepend a integer value to a property list.
 
cpl_error_code cpl_propertylist_prepend_long (cpl_propertylist *self, const char *name, long value)
 Prepend a long value to a property list.
 
cpl_error_code cpl_propertylist_prepend_long_long (cpl_propertylist *self, const char *name, long long value)
 Prepend a long long value to a property list.
 
cpl_error_code cpl_propertylist_prepend_property (cpl_propertylist *self, const cpl_property *property)
 Prepend a property to a property list.
 
cpl_error_code cpl_propertylist_prepend_string (cpl_propertylist *self, const char *name, const char *value)
 Prepend a string value to a property list.
 
cpl_error_code cpl_propertylist_save (const cpl_propertylist *self, const char *filename, unsigned mode)
 Save a property list to a FITS file.
 
cpl_error_code cpl_propertylist_set_bool (cpl_propertylist *self, const char *name, int value)
 Set the value of the given boolean property list entry.
 
cpl_error_code cpl_propertylist_set_char (cpl_propertylist *self, const char *name, char value)
 Set the value of the given character property list entry.
 
cpl_error_code cpl_propertylist_set_comment (cpl_propertylist *self, const char *name, const char *comment)
 Modify the comment field of the given property list entry.
 
cpl_error_code cpl_propertylist_set_double (cpl_propertylist *self, const char *name, double value)
 Set the value of the given double property list entry.
 
cpl_error_code cpl_propertylist_set_double_complex (cpl_propertylist *self, const char *name, double complex value)
 Set the value of the given double complex property list entry.
 
cpl_error_code cpl_propertylist_set_float (cpl_propertylist *self, const char *name, float value)
 Set the value of the given float property list entry.
 
cpl_error_code cpl_propertylist_set_float_complex (cpl_propertylist *self, const char *name, float complex value)
 Set the value of the given float complex property list entry.
 
cpl_error_code cpl_propertylist_set_int (cpl_propertylist *self, const char *name, int value)
 Set the value of the given integer property list entry.
 
cpl_error_code cpl_propertylist_set_long (cpl_propertylist *self, const char *name, long value)
 Set the value of the given long property list entry.
 
cpl_error_code cpl_propertylist_set_long_long (cpl_propertylist *self, const char *name, long long value)
 Set the value of the given long long property list entry.
 
cpl_error_code cpl_propertylist_set_string (cpl_propertylist *self, const char *name, const char *value)
 Set the value of the given string property list entry.
 
cpl_error_code cpl_propertylist_sort (cpl_propertylist *self, cpl_propertylist_compare_func compare)
 Sort a property list.
 
cpl_error_code cpl_propertylist_update_bool (cpl_propertylist *self, const char *name, int value)
 Update a property list with a boolean value.
 
cpl_error_code cpl_propertylist_update_char (cpl_propertylist *self, const char *name, char value)
 Update a property list with a character value.
 
cpl_error_code cpl_propertylist_update_double (cpl_propertylist *self, const char *name, double value)
 Update a property list with a double value.
 
cpl_error_code cpl_propertylist_update_double_complex (cpl_propertylist *self, const char *name, double complex value)
 Update a property list with a double complex value.
 
cpl_error_code cpl_propertylist_update_float (cpl_propertylist *self, const char *name, float value)
 Update a property list with a float value.
 
cpl_error_code cpl_propertylist_update_float_complex (cpl_propertylist *self, const char *name, float complex value)
 Update a property list with a float complex value.
 
cpl_error_code cpl_propertylist_update_int (cpl_propertylist *self, const char *name, int value)
 Update a property list with a integer value.
 
cpl_error_code cpl_propertylist_update_long (cpl_propertylist *self, const char *name, long value)
 Update a property list with a long value.
 
cpl_error_code cpl_propertylist_update_long_long (cpl_propertylist *self, const char *name, long long value)
 Update a property list with a long long value.
 
cpl_error_code cpl_propertylist_update_string (cpl_propertylist *self, const char *name, const char *value)
 Update a property list with a string value.
 

Detailed Description

This module implements a container for properties (see Properties) which can be used to store auxiliary values related to another data object, an image or a table for instance. The property values can be set and retrieved by their associated name and properties can be added and removed from the list. The property list container is an ordered sequence of properties.

Synopsis:
#include <cpl_propertylist.h>

Typedef Documentation

typedef struct _cpl_propertylist_ cpl_propertylist

The opaque property list data type.

typedef int(* cpl_propertylist_compare_func)(const cpl_property *first, const cpl_property *second)

The property comparison function data type.

Function Documentation

cpl_error_code cpl_propertylist_append ( cpl_propertylist self,
const cpl_propertylist other 
)

Append a property list..

Parameters
selfA property list.
otherThe property to append.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function appends the property list other to the property list self.

cpl_error_code cpl_propertylist_append_bool ( cpl_propertylist self,
const char *  name,
int  value 
)

Append a boolean value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe boolean value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new boolean property with name name and value value. The property is appended to the property list self.

cpl_error_code cpl_propertylist_append_char ( cpl_propertylist self,
const char *  name,
char  value 
)

Append a character value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe character value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new character property with name name and value value. The property is appended to the property list self.

cpl_error_code cpl_propertylist_append_double ( cpl_propertylist self,
const char *  name,
double  value 
)

Append a double value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe double value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new double property with name name and value value. The property is appended to the property list self.

cpl_error_code cpl_propertylist_append_double_complex ( cpl_propertylist self,
const char *  name,
double complex  value 
)

Append a double complex value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe double complex value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new double complex property with name name and value value. The property is appended to the property list self.

cpl_error_code cpl_propertylist_append_float ( cpl_propertylist self,
const char *  name,
float  value 
)

Append a float value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe float value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new float property with name name and value value. The property is appended to the property list self.

cpl_error_code cpl_propertylist_append_float_complex ( cpl_propertylist self,
const char *  name,
float complex  value 
)

Append a float complex value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe float complex value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new float complex property with name name and value value. The property is appended to the property list self.

cpl_error_code cpl_propertylist_append_int ( cpl_propertylist self,
const char *  name,
int  value 
)

Append an integer value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe integer value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new integer property with name name and value value. The property is appended to the property list self.

cpl_error_code cpl_propertylist_append_long ( cpl_propertylist self,
const char *  name,
long  value 
)

Append a long value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe long value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new long property with name name and value value. The property is appended to the property list self.

cpl_error_code cpl_propertylist_append_long_long ( cpl_propertylist self,
const char *  name,
long long  value 
)

Append a long long value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe long long value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new long long property with name name and value value. The property is appended to the property list self.

cpl_error_code cpl_propertylist_append_property ( cpl_propertylist self,
const cpl_property property 
)

Append a property to a property list.

Parameters
selfProperty list to append to
propertyThe property to append
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or property is a NULL pointer.

This function creates a new property and appends it to the end of a property list. It will not check if the property already exists.

cpl_error_code cpl_propertylist_append_string ( cpl_propertylist self,
const char *  name,
const char *  value 
)

Append a string value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe string value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, name or value is a NULL pointer.

The function creates a new string property with name name and value value. The property is appended to the property list self.

cpl_error_code cpl_propertylist_copy_property ( cpl_propertylist self,
const cpl_propertylist other,
const char *  name 
)

Copy a property from another property list.

Parameters
selfA property list.
otherThe property list from which a property is copied.
nameThe name of the property to copy.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, other or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list other does not contain a property with the name name.
CPL_ERROR_TYPE_MISMATCH The property list self contains a property with the name name which is not of the same type as the property which should be copied from other.

The function copies the property name from the property list other to the property list self. If the property list self does not already contain a property name the property is appended to self. If a property name exists already in self the function overwrites the contents of this property if and only if this property is of the same type as the property to be copied from other.

cpl_error_code cpl_propertylist_copy_property_regexp ( cpl_propertylist self,
const cpl_propertylist other,
const char *  regexp,
int  invert 
)

Copy matching properties from another property list.

Parameters
selfA property list.
otherThe property list from which a property is copied.
regexpThe regular expression used to select properties.
invertFlag inverting the sense of matching.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, other or regexp is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter regexp is an invalid regular expression.
CPL_ERROR_TYPE_MISMATCH The property list self contains a property with the name name which is not of the same type as the property which should be copied from other.

The function copies all properties with matching names from the property list other to the property list self. If the flag invert is zero, all properties whose names match the regular expression regexp are copied. If invert is set to a non-zero value, all properties with names not matching regexp are copied rather. The function expects POSIX 1003.2 compliant extended regular expressions.

If the property list self does not already contain one of the properties to be copied this property is appended to self. If a property to be copied exists already in self the function overwrites the contents of this property.

Before properties are copied from the property list other to self the types of the properties are checked and if any type mismatch is detected the function stops processing immediately. The property list self is not at all modified in this case.

See Also
cpl_propertylist_copy_property()
void cpl_propertylist_delete ( cpl_propertylist self)

Destroy a property list.

Parameters
selfThe property list to .
Returns
Nothing.

The function destroys the property list self and its whole contents. If self is NULL, nothing is done and no error is set.

void cpl_propertylist_dump ( const cpl_propertylist self,
FILE *  stream 
)

Print a property list.

Parameters
selfPointer to property list
streamThe output stream
Returns
Nothing.

This function is mainly intended for debug purposes. If the specified stream is NULL, it is set to stdout. The function used for printing is the standard C fprintf().

cpl_propertylist* cpl_propertylist_duplicate ( const cpl_propertylist self)

Create a copy of the given property list.

Parameters
selfThe property list to be copied.
Returns
The created copy or NULL in case an error occurred.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function creates a deep copy of the given property list self, i.e the created copy and the original property list do not share any resources.

void cpl_propertylist_empty ( cpl_propertylist self)

Remove all properties from a property list.

Parameters
selfA property list.
Returns
Nothing.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function removes all properties from self. Each property is properly deallocated. After calling this function self is empty.

int cpl_propertylist_erase ( cpl_propertylist self,
const char *  name 
)

Erase the given property from a property list.

Parameters
selfA property list.
nameName of the property to erase.
Returns
On success the function returns the number of erased entries. If an error occurs the function returns 0 and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function searches the property with the name name in the property list self and removes it. The property is destroyed. If self contains multiple duplicates of a property named name, only the first one is erased.

int cpl_propertylist_erase_regexp ( cpl_propertylist self,
const char *  regexp,
int  invert 
)

Erase all properties with name matching a given regular expression.

Parameters
selfA property list.
regexpRegular expression.
invertFlag inverting the sense of matching.
Returns
On success the function returns the number of erased entries or 0 if no entries are erase. If an error occurs the function returns -1 and an appropriate error code is set. In CPL versions earlier than 5.0, the return value in case of error is 0.
Errors
CPL_ERROR_NULL_INPUT The parameter self or regexp is a NULL pointer.

The function searches for all the properties matching in the list self and removes them. Whether a property matches or not depends on the given regular expression regexp, and the flag invert. If invert is 0, all properties matching regexp are removed from the list. If invert is set to a non-zero value, all properties which do not match regexp are erased. The removed properties are destroyed.

The function expects POSIX 1003.2 compliant extended regular expressions.

cpl_property* cpl_propertylist_get ( cpl_propertylist self,
long  position 
)

Access property list elements by index.

Parameters
selfThe property list to query.
positionIndex of the element to retrieve.
Returns
The function returns the property with index position, or NULL if position is out of range.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns a handle for the property list element, the property, with the index position. Numbering of property list elements extends from 0 to cpl_propertylist_get_size() - 1. If position is less than 0 or greater equal than cpl_propertylist_get_size() the function returns NULL.

int cpl_propertylist_get_bool ( const cpl_propertylist self,
const char *  name 
)

Get the boolean value of the given property list entry.

Parameters
selfA property list.
nameThe property name to look up.
Returns
The integer representation of the boolean value stored in the list entry. TRUE is represented as non-zero value while 0 indicates FALSE. The function returns 0 if an error occurs and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.
CPL_ERROR_TYPE_MISMATCH The sought-after property name is not of type CPL_TYPE_BOOL.

The function searches the property list self for a property named name. If it is present in the list, its boolean value is returned. If there is more than one property with the same name, it takes the first one from the list.

char cpl_propertylist_get_char ( const cpl_propertylist self,
const char *  name 
)

Get the character value of the given property list entry.

Parameters
selfA property list.
nameThe property name to look up.
Returns
The character value stored in the list entry. The function returns '\0' if an error occurs and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.
CPL_ERROR_TYPE_MISMATCH The sought-after property name is not of type CPL_TYPE_CHAR.

The function searches the property list self for a property named name. If it is present in the list, its character value is returned. If there is more than one property with the same name, it takes the first one from the list.

const char* cpl_propertylist_get_comment ( const cpl_propertylist self,
const char *  name 
)

Get the comment of the given property list entry.

Parameters
selfA property list.
nameThe property name to look up.
Returns
The comment of the property list entry, or NULL.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function searches the property list self for a property named name. If it is present in the list, its comment string is returned. If an entry with the name name is not found, or if the entry has no comment the function returns NULL. If there is more than one property with the same name, it takes the first one from the list.

const cpl_property* cpl_propertylist_get_const ( const cpl_propertylist self,
long  position 
)

Access property list elements by index.

Parameters
selfThe property list to query.
positionIndex of the element to retrieve.
Returns
The function returns the property with index position, or NULL if position is out of range.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns a handle for the property list element, the property, with the index position. Numbering of property list elements extends from 0 to cpl_propertylist_get_size() - 1. If position is less than 0 or greater equal than cpl_propertylist_get_size() the function returns NULL.

double cpl_propertylist_get_double ( const cpl_propertylist self,
const char *  name 
)

Get the double value of the given property list entry.

Parameters
selfA property list.
nameThe property name to look up.
Returns
The double value stored in the list entry. The function returns 0 if an error occurs and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.
CPL_ERROR_TYPE_MISMATCH The sought-after property name is not of type CPL_TYPE_DOUBLE or CPL_TYPE_FLOAT.

The function searches the property list self for a property named name. If it is present in the list, its double value is returned. If there is more than one property with the same name, it takes the first one from the list. If the value is of type float, the function casts it to double before returning it.

The function may be used to access the value of all floating-point type properties whose floating-point value has a rank less or equal to the functions return type. If the value of a compatible property is retrieved, it is promoted to the return type of the function.

double complex cpl_propertylist_get_double_complex ( const cpl_propertylist self,
const char *  name 
)

Get the double complex value of the given property list entry.

Parameters
selfA property list.
nameThe property name to look up.
Returns
The double complex value stored in the list entry. The function returns 0 if an error occurs and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.
CPL_ERROR_TYPE_MISMATCH The sought-after property name is not of type CPL_TYPE_DOUBLE_COMPLEX or CPL_TYPE_FLOAT_COMPLEX.

The function searches the property list self for a property named name. If it is present in the list, its double complex value is returned. If there is more than one property with the same name, it takes the first one from the list. If the value is of type float, the function casts it to double complex before returning it.

The function may be used to access the value of all complex type properties whose complex value has a rank less or equal to the functions return type. If the value of a compatible property is retrieved, it is promoted to the return type of the function.

float cpl_propertylist_get_float ( const cpl_propertylist self,
const char *  name 
)

Get the float value of the given property list entry.

Parameters
selfA property list.
nameThe property name to look up.
Returns
The float value stored in the list entry. The function returns 0 if an error occurs and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.
CPL_ERROR_TYPE_MISMATCH The sought-after property name is not of type CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

The function searches the property list self for a property named name. If it is present in the list, its float value is returned. If there is more than one property with the same name, it takes the first one from the list. If the value is of type double, the function casts it to float before returning it.

float complex cpl_propertylist_get_float_complex ( const cpl_propertylist self,
const char *  name 
)

Get the float complex value of the given property list entry.

Parameters
selfA property list.
nameThe property name to look up.
Returns
The float complex value stored in the list entry. The function returns 0 if an error occurs and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.
CPL_ERROR_TYPE_MISMATCH The sought-after property name is not of type CPL_TYPE_FLOAT_COMPLEX or CPL_TYPE_DOUBLE_COMPLEX.

The function searches the property list self for a property named name. If it is present in the list, its float complex value is returned. If there is more than one property with the same name, it takes the first one from the list. If the value is of type double, the function casts it to float complex before returning it.

int cpl_propertylist_get_int ( const cpl_propertylist self,
const char *  name 
)

Get the integer value of the given property list entry.

Parameters
selfA property list.
nameThe property name to look up.
Returns
The integer value stored in the list entry. The function returns 0 if an error occurs and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.
CPL_ERROR_TYPE_MISMATCH The sought-after property name is not of type CPL_TYPE_INT.

The function searches the property list self for a property named name. If it is present in the list, its integer value is returned. If there is more than one property with the same name, it takes the first one from the list.

long cpl_propertylist_get_long ( const cpl_propertylist self,
const char *  name 
)

Get the long value of the given property list entry.

Parameters
selfA property list.
nameThe property name to look up.
Returns
The long value stored in the list entry. The function returns 0 if an error occurs and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.
CPL_ERROR_TYPE_MISMATCH The sought-after property name is not of type CPL_TYPE_LONG or CPL_TYPE_INT.

The function searches the property list self for a property named name. If it is present in the list, its long value is returned. If there is more than one property with the same name, it takes the first one from the list.

The function may be used to access the value of all integer type properties whose integer value has a rank less or equal to the functions return type. If the value of a compatible property is retrieved, it is promoted to the return type of the function.

long long cpl_propertylist_get_long_long ( const cpl_propertylist self,
const char *  name 
)

Get the long long value of the given property list entry.

Parameters
selfA property list.
nameThe property name to look up.
Returns
The long value stored in the list entry. The function returns 0 if an error occurs and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.
CPL_ERROR_TYPE_MISMATCH The sought-after property name is not of type CPL_TYPE_LONG_LONG, CPL_TYPE_LONG, or CPL_TYPE_INT

The function searches the property list self for a property named name. If it is present in the list, its long long value is returned. If there is more than one property with the same name, it takes the first one from the list.

The function may be used to access the value of all integer type properties whose integer value has a rank less or equal to the functions return type. If the value of a compatible property is retrieved, it is promoted to the return type of the function.

cpl_property* cpl_propertylist_get_property ( cpl_propertylist self,
const char *  name 
)

Access property list elements by property name.

Parameters
selfThe property list to query.
nameThe name of the property to retrieve.
Returns
The function returns the property with name name, or NULL if it does not exist.
Errors
CPL_ERROR_NULL_INPUT The parameter self or the name is a NULL pointer.

The function returns a handle to the property list element, the property, with the name name. If more than one property exist with the same name, then the first one found will be returned.

const cpl_property* cpl_propertylist_get_property_const ( const cpl_propertylist self,
const char *  name 
)

Access property list elements by property name.

Parameters
selfThe property list to query.
nameThe name of the property to retrieve.
Returns
The function returns the property with name name, or NULL if it does not exist.
Errors
CPL_ERROR_NULL_INPUT The parameter self or the name is a NULL pointer.

The function returns a handle to the property list element, the property, with the name name. If more than one property exist with the same name, then the first one found will be returned.

cpl_size cpl_propertylist_get_size ( const cpl_propertylist self)

Get the current size of a property list.

Parameters
selfA property list.
Returns
The property list's current size, or 0 if the list is empty. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function reports the current number of elements stored in the property list self.

const char* cpl_propertylist_get_string ( const cpl_propertylist self,
const char *  name 
)

Get the string value of the given property list entry.

Parameters
selfA property list.
nameThe property name to look up.
Returns
A handle to the string value stored in the list entry. The function returns NULL if an error occurs and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.
CPL_ERROR_TYPE_MISMATCH The sought-after property name is not of type CPL_TYPE_STRING.

The function searches the property list self for a property named name. If it is present in the list, a handle to its string value is returned. If there is more than one property with the same name, it takes the first one from the list.

cpl_type cpl_propertylist_get_type ( const cpl_propertylist self,
const char *  name 
)

Get the the type of a property list entry.

Parameters
selfA property list.
nameThe property name to look up.
Returns
The type of the stored value. If an error occurs the function returns CPL_TYPE_INVALID and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function returns the type of the value stored in self with the name name. If there is more than one property with the same name, it takes the first one from the list.

int cpl_propertylist_has ( const cpl_propertylist self,
const char *  name 
)

Check whether a property is present in a property list.

Parameters
selfA property list.
nameThe property name to look up.
Returns
The function returns 1 if the property is present, or 0 otherwise. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function searches the property list self for a property with the name name and reports whether it was found or not.

cpl_error_code cpl_propertylist_insert_after_bool ( cpl_propertylist self,
const char *  after,
const char *  name,
int  value 
)

Insert a boolean value into a property list after the given position.

Parameters
selfA property list.
afterName of the property after which the value is inserted.
nameThe property name to be assigned to the value.
valueThe boolean value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, after or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new boolean property with name name and value value. The property is inserted into the property list self after the property named after.

cpl_error_code cpl_propertylist_insert_after_char ( cpl_propertylist self,
const char *  after,
const char *  name,
char  value 
)

Insert a character value into a property list after the given position.

Parameters
selfA property list.
afterName of the property after which the value is inserted.
nameThe property name to be assigned to the value.
valueThe character value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, after or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new character property with name name and value value. The property is inserted into the property list self after the property named after.

cpl_error_code cpl_propertylist_insert_after_double ( cpl_propertylist self,
const char *  after,
const char *  name,
double  value 
)

Insert a double value into a property list after the given position.

Parameters
selfA property list.
afterName of the property after which the value is inserted.
nameThe property name to be assigned to the value.
valueThe double value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, after or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new double property with name name and value value. The property is inserted into the property list self after the property named after.

cpl_error_code cpl_propertylist_insert_after_double_complex ( cpl_propertylist self,
const char *  after,
const char *  name,
double complex  value 
)

Insert a double complex value into a property list after the given position.

Parameters
selfA property list.
afterName of the property after which the value is inserted.
nameThe property name to be assigned to the value.
valueThe double complex value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, after or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new double complex property with name name and value value. The property is inserted into the property list self after the property named after.

cpl_error_code cpl_propertylist_insert_after_float ( cpl_propertylist self,
const char *  after,
const char *  name,
float  value 
)

Insert a float value into a property list after the given position.

Parameters
selfA property list.
afterName of the property after which the value is inserted.
nameThe property name to be assigned to the value.
valueThe float value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, after or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new float property with name name and value value. The property is inserted into the property list self after the property named after.

cpl_error_code cpl_propertylist_insert_after_float_complex ( cpl_propertylist self,
const char *  after,
const char *  name,
float complex  value 
)

Insert a float complex value into a property list after the given position.

Parameters
selfA property list.
afterName of the property after which the value is inserted.
nameThe property name to be assigned to the value.
valueThe float complex value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, after or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new float complex property with name name and value value. The property is inserted into the property list self after the property named after.

cpl_error_code cpl_propertylist_insert_after_int ( cpl_propertylist self,
const char *  after,
const char *  name,
int  value 
)

Insert a integer value into a property list after the given position.

Parameters
selfA property list.
afterName of the property after which the value is inserted.
nameThe property name to be assigned to the value.
valueThe integer value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, after or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new integer property with name name and value value. The property is inserted into the property list self after the property named after.

cpl_error_code cpl_propertylist_insert_after_long ( cpl_propertylist self,
const char *  after,
const char *  name,
long  value 
)

Insert a long value into a property list after the given position.

Parameters
selfA property list.
afterName of the property after which the value is inserted.
nameThe property name to be assigned to the value.
valueThe long value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, after or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new long property with name name and value value. The property is inserted into the property list self after the property named after.

cpl_error_code cpl_propertylist_insert_after_long_long ( cpl_propertylist self,
const char *  after,
const char *  name,
long long  value 
)

Insert a long long value into a property list after the given position.

Parameters
selfA property list.
afterName of the property after which the value is inserted.
nameThe property name to be assigned to the value.
valueThe long long value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, after or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new long long property with name name and value value. The property is inserted into the property list self after the property named after.

cpl_error_code cpl_propertylist_insert_after_property ( cpl_propertylist self,
const char *  after,
const cpl_property property 
)

Insert a property into a property list after the given position.

Parameters
selfProperty list
afterName of the property after which to insert the property
propertyThe property to insert
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, property or after is a NULL pointer.

The function creates a new property and inserts it into the property list self after the position of the property named after.

cpl_error_code cpl_propertylist_insert_after_string ( cpl_propertylist self,
const char *  after,
const char *  name,
const char *  value 
)

Insert a string value into a property list after the given position.

Parameters
selfA property list.
afterName of the property after which the value is inserted.
nameThe property name to be assigned to the value.
valueThe string value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, after, name or value or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new string property with name name and value value. The property is inserted into the property list self after the property named after.

cpl_error_code cpl_propertylist_insert_bool ( cpl_propertylist self,
const char *  here,
const char *  name,
int  value 
)

Insert a boolean value into a property list at the given position.

Parameters
selfA property list.
hereName indicating the position at which the value is inserted.
nameThe property name to be assigned to the value.
valueThe boolean value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, here or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new boolean property with name name and value value. The property is inserted into the property list self at the position of the property named here.

cpl_error_code cpl_propertylist_insert_char ( cpl_propertylist self,
const char *  here,
const char *  name,
char  value 
)

Insert a character value into a property list at the given position.

Parameters
selfA property list.
hereName indicating the position at which the value is inserted.
nameThe property name to be assigned to the value.
valueThe character value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, here or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new character property with name name and value value. The property is inserted into the property list self at the position of the property named here.

cpl_error_code cpl_propertylist_insert_double ( cpl_propertylist self,
const char *  here,
const char *  name,
double  value 
)

Insert a double value into a property list at the given position.

Parameters
selfA property list.
hereName indicating the position at which the value is inserted.
nameThe property name to be assigned to the value.
valueThe double value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, here or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new double property with name name and value value. The property is inserted into the property list self at the position of the property named here.

cpl_error_code cpl_propertylist_insert_double_complex ( cpl_propertylist self,
const char *  here,
const char *  name,
double complex  value 
)

Insert a double complex value into a property list at the given position.

Parameters
selfA property list.
hereName indicating the position at which the value is inserted.
nameThe property name to be assigned to the value.
valueThe double complex value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, here or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new double complex property with name name and value value. The property is inserted into the property list self at the position of the property named here.

cpl_error_code cpl_propertylist_insert_float ( cpl_propertylist self,
const char *  here,
const char *  name,
float  value 
)

Insert a float value into a property list at the given position.

Parameters
selfA property list.
hereName indicating the position at which the value is inserted.
nameThe property name to be assigned to the value.
valueThe float value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, here or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new float property with name name and value value. The property is inserted into the property list self at the position of the property named here.

cpl_error_code cpl_propertylist_insert_float_complex ( cpl_propertylist self,
const char *  here,
const char *  name,
float complex  value 
)

Insert a float complex value into a property list at the given position.

Parameters
selfA property list.
hereName indicating the position at which the value is inserted.
nameThe property name to be assigned to the value.
valueThe float complex value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, here or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new float complex property with name name and value value. The property is inserted into the property list self at the position of the property named here.

cpl_error_code cpl_propertylist_insert_int ( cpl_propertylist self,
const char *  here,
const char *  name,
int  value 
)

Insert a integer value into a property list at the given position.

Parameters
selfA property list.
hereName indicating the position at which the value is inserted.
nameThe property name to be assigned to the value.
valueThe integer value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, here or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new integer property with name name and value value. The property is inserted into the property list self at the position of the property named here.

cpl_error_code cpl_propertylist_insert_long ( cpl_propertylist self,
const char *  here,
const char *  name,
long  value 
)

Insert a long value into a property list at the given position.

Parameters
selfA property list.
hereName indicating the position at which the value is inserted.
nameThe property name to be assigned to the value.
valueThe long value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, here or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new long property with name name and value value. The property is inserted into the property list self at the position of the property named here.

cpl_error_code cpl_propertylist_insert_long_long ( cpl_propertylist self,
const char *  here,
const char *  name,
long long  value 
)

Insert a long long value into a property list at the given position.

Parameters
selfA property list.
hereName indicating the position at which the value is inserted.
nameThe property name to be assigned to the value.
valueThe long long value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, here or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new long long property with name name and value value. The property is inserted into the property list self at the position of the property named here.

cpl_error_code cpl_propertylist_insert_property ( cpl_propertylist self,
const char *  here,
const cpl_property property 
)

Insert a property into a property list at the given position.

Parameters
selfProperty list
hereName indicating the position where to insert the property
propertyThe property to insert
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, property or here is a NULL pointer.

The function creates a new property and inserts it into the property list self at the position of the property named here.

cpl_error_code cpl_propertylist_insert_string ( cpl_propertylist self,
const char *  here,
const char *  name,
const char *  value 
)

Insert a string value into a property list at the given position.

Parameters
selfA property list.
hereName indicating the position at which the value is inserted.
nameThe property name to be assigned to the value.
valueThe string value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, here, name or value or name is a NULL pointer.
CPL_ERROR_UNSPECIFIED A property with the name name could not be inserted into self.

The function creates a new string property with name name and value value. The property is inserted into the property list self at the position of the property named here.

int cpl_propertylist_is_empty ( const cpl_propertylist self)

Check whether a property list is empty.

Parameters
selfA property list.
Returns
The function returns 1 if the list is empty, and 0 otherwise. In case an error occurs the function returns -1 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function checks if self contains any properties.

cpl_propertylist* cpl_propertylist_load ( const char *  name,
cpl_size  position 
)

Create a property list from a file.

Parameters
nameName of the input file.
positionIndex of the data set to read.
Returns
The function returns the newly created property list or NULL if an error occurred.
Errors
CPL_ERROR_NULL_INPUT The parameter name is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The position is less than 0 or the properties cannot be read from the file name.
CPL_ERROR_FILE_IO The file name does not exist.
CPL_ERROR_BAD_FILE_FORMAT The file name is not a valid FITS file.
CPL_ERROR_DATA_NOT_FOUND The requested data set at index position does not exist.

The function reads the properties of the data set with index position from the file name.

Currently only the FITS file format is supported. The property list is created by reading the FITS keywords from extension position. The numbering of the data sections starts from 0. When creating the property list from a FITS header, any keyword without a value such as undefined keywords, are not transformed into a property. In the case of float or double (complex) keywords, there is no way to identify the type returned by CFITSIO, therefore this function will always load them as double (complex).

See Also
cpl_propertylist_load_regexp()
cpl_propertylist* cpl_propertylist_load_regexp ( const char *  name,
cpl_size  position,
const char *  regexp,
int  invert 
)

Create a filtered property list from a file.

Parameters
nameName of the input file.
positionIndex of the data set to read.
regexpRegular expression used to filter properties.
invertFlag inverting the sense of matching property names.
Returns
The function returns the newly created property list or NULL if an error occurred.
Errors
CPL_ERROR_NULL_INPUT The parameter name or the parameter regexp is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The position is less than 0, the properties cannot be read from the file name, or regexp is not a valid extended regular expression.
CPL_ERROR_FILE_IO The file name does not exist.
CPL_ERROR_BAD_FILE_FORMAT The file name is not a valid FITS file.
CPL_ERROR_DATA_NOT_FOUND The requested data set at index position does not exist.

The function reads all properties of the data set with index position with matching names from the file name. If the flag invert is zero, all properties whose names match the regular expression regexp are read. If invert is set to a non-zero value, all properties with names not matching regexp are read rather. The function expects POSIX 1003.2 compliant extended regular expressions.

Currently only the FITS file format is supported. The property list is created by reading the FITS keywords from extension position. The numbering of the data sections starts from 0.

When creating the property list from a FITS header, any keyword without a value such as undefined keywords, are not transformed into a property. In the case of float or double (complex) keywords, there is no way to identify the type returned by CFITSIO, therefore this function will always load them as double (complex).

FITS format specific keyword prefixes (e.g. HIERARCH) must not be part of the given pattern string regexp, but only the actual FITS keyword name may be given.

See Also
cpl_propertylist_load()
cpl_propertylist* cpl_propertylist_new ( void  )

Create an empty property list.

Returns
The newly created property list.

The function creates a new property list and returns a handle for it. To destroy the returned property list object use the property list destructor cpl_propertylist_delete().

See Also
cpl_propertylist_delete()
cpl_error_code cpl_propertylist_prepend_bool ( cpl_propertylist self,
const char *  name,
int  value 
)

Prepend a boolean value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe boolean value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new boolean property with name name and value value. The property is prepended to the property list self.

cpl_error_code cpl_propertylist_prepend_char ( cpl_propertylist self,
const char *  name,
char  value 
)

Prepend a character value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe character value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new character property with name name and value value. The property is prepended to the property list self.

cpl_error_code cpl_propertylist_prepend_double ( cpl_propertylist self,
const char *  name,
double  value 
)

Prepend a double value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe double value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new double property with name name and value value. The property is prepended to the property list self.

cpl_error_code cpl_propertylist_prepend_double_complex ( cpl_propertylist self,
const char *  name,
double complex  value 
)

Prepend a double complex value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe double complex value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new double complex property with name name and value value. The property is prepended to the property list self.

cpl_error_code cpl_propertylist_prepend_float ( cpl_propertylist self,
const char *  name,
float  value 
)

Prepend a float value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe float value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new float property with name name and value value. The property is prepended to the property list self.

cpl_error_code cpl_propertylist_prepend_float_complex ( cpl_propertylist self,
const char *  name,
float complex  value 
)

Prepend a float complex value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe float complex value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new float complex property with name name and value value. The property is prepended to the property list self.

cpl_error_code cpl_propertylist_prepend_int ( cpl_propertylist self,
const char *  name,
int  value 
)

Prepend a integer value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe integer value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new integer property with name name and value value. The property is prepended to the property list self.

cpl_error_code cpl_propertylist_prepend_long ( cpl_propertylist self,
const char *  name,
long  value 
)

Prepend a long value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe long value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new long property with name name and value value. The property is prepended to the property list self.

cpl_error_code cpl_propertylist_prepend_long_long ( cpl_propertylist self,
const char *  name,
long long  value 
)

Prepend a long long value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe long long value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function creates a new long long property with name name and value value. The property is prepended to the property list self.

cpl_error_code cpl_propertylist_prepend_property ( cpl_propertylist self,
const cpl_property property 
)

Prepend a property to a property list.

Parameters
selfProperty list to prepend to
propertyThe property to prepend
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or property is a NULL pointer.

This function creates a new property and prepends it to the beginning of a property list. It will not check if the property already exists.

cpl_error_code cpl_propertylist_prepend_string ( cpl_propertylist self,
const char *  name,
const char *  value 
)

Prepend a string value to a property list.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe string value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, name or value is a NULL pointer.

The function creates a new string property with name name and value value. The property is prepended to the property list self.

cpl_error_code cpl_propertylist_save ( const cpl_propertylist self,
const char *  filename,
unsigned  mode 
)

Save a property list to a FITS file.

Parameters
selfThe property list to save or NULL if empty
filenameName of the file to write
modeThe desired output options (combined with bitwise or)
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
Errors
CPL_ERROR_NULL_INPUT The filename is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter mode is invalid.
CPL_ERROR_FILE_IO The file cannot be written or accessed.

This function saves a property list to a FITS file, using cfitsio. The data unit is empty.

Supported output modes are CPL_IO_CREATE (create a new file) and CPL_IO_EXTEND (append to an existing file)

cpl_error_code cpl_propertylist_set_bool ( cpl_propertylist self,
const char *  name,
int  value 
)

Set the value of the given boolean property list entry.

Parameters
selfA property list.
nameThe property name to look up.
valueNew boolean value.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function searches the property list self for a property named name. If it is present in the list, its boolean value is replaced with the boolean value. If there is more than one property with the same name, it takes the first one from the list.

cpl_error_code cpl_propertylist_set_char ( cpl_propertylist self,
const char *  name,
char  value 
)

Set the value of the given character property list entry.

Parameters
selfA property list.
nameThe property name to look up.
valueNew character value.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function searches the property list self for a property named name. If it is present in the list, its character value is replaced with the character value. If there is more than one property with the same name, it takes the first one from the list.

cpl_error_code cpl_propertylist_set_comment ( cpl_propertylist self,
const char *  name,
const char *  comment 
)

Modify the comment field of the given property list entry.

Parameters
selfA property list.
nameThe property name to look up.
commentNew comment string.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function searches the property list self for a property named name. If it is present in the list, its comment is replaced by the string comment. The provided comment string may be NULL. In this case an already existing comment is deleted. If there is more than one property with the same name, it takes the first one from the list.

cpl_error_code cpl_propertylist_set_double ( cpl_propertylist self,
const char *  name,
double  value 
)

Set the value of the given double property list entry.

Parameters
selfA property list.
nameThe property name to look up.
valueNew double value.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function searches the property list self for a property named name. If it is present in the list, its double value is replaced with the double value. If there is more than one property with the same name, it takes the first one from the list.

cpl_error_code cpl_propertylist_set_double_complex ( cpl_propertylist self,
const char *  name,
double complex  value 
)

Set the value of the given double complex property list entry.

Parameters
selfA property list.
nameThe property name to look up.
valueNew double complex value.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function searches the property list self for a property named name. If it is present in the list, its double complex value is replaced with the double complex value. If there is more than one property with the same name, it takes the first one from the list.

cpl_error_code cpl_propertylist_set_float ( cpl_propertylist self,
const char *  name,
float  value 
)

Set the value of the given float property list entry.

Parameters
selfA property list.
nameThe property name to look up.
valueNew float value.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function searches the property list self for a property named name. If it is present in the list, its float value is replaced with the float value. If there is more than one property with the same name, it takes the first one from the list.

cpl_error_code cpl_propertylist_set_float_complex ( cpl_propertylist self,
const char *  name,
float complex  value 
)

Set the value of the given float complex property list entry.

Parameters
selfA property list.
nameThe property name to look up.
valueNew float complex value.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function searches the property list self for a property named name. If it is present in the list, its float complex value is replaced with the float complex value. If there is more than one property with the same name, it takes the first one from the list.

cpl_error_code cpl_propertylist_set_int ( cpl_propertylist self,
const char *  name,
int  value 
)

Set the value of the given integer property list entry.

Parameters
selfA property list.
nameThe property name to look up.
valueNew integer value.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function searches the property list self for a property named name. If it is present in the list, its integer value is replaced with the integer value. If there is more than one property with the same name, it takes the first one from the list.

cpl_error_code cpl_propertylist_set_long ( cpl_propertylist self,
const char *  name,
long  value 
)

Set the value of the given long property list entry.

Parameters
selfA property list.
nameThe property name to look up.
valueNew long value.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function searches the property list self for a property named name. If it is present in the list, its long value is replaced with the long value. If there is more than one property with the same name, it takes the first one from the list.

cpl_error_code cpl_propertylist_set_long_long ( cpl_propertylist self,
const char *  name,
long long  value 
)

Set the value of the given long long property list entry.

Parameters
selfA property list.
nameThe property name to look up.
valueNew long long value.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function searches the property list self for a property named name. If it is present in the list, its long long value is replaced with value. If there is more than one property with the same name, it takes the first one from the list.

cpl_error_code cpl_propertylist_set_string ( cpl_propertylist self,
const char *  name,
const char *  value 
)

Set the value of the given string property list entry.

Parameters
selfA property list.
nameThe property name to look up.
valueNew string value.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, name or value is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The property list self does not contain a property with the name name.

The function searches the property list self for a property named name. If it is present in the list, its string value is replaced with the string value. If there is more than one property with the same name, it takes the first one from the list.

cpl_error_code cpl_propertylist_sort ( cpl_propertylist self,
cpl_propertylist_compare_func  compare 
)

Sort a property list.

Parameters
selfThe property list to sort.
compareThe function used to compare two properties.
Returns
The function returns CPL_ERROR_NONE on success, or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function sorts the property list self in place, using the function compare to determine whether a property is less, equal or greater than another one.

The function compare must be of the type cpl_propertylist_compare_func.

See Also
cpl_propertylist_compare_func
cpl_error_code cpl_propertylist_update_bool ( cpl_propertylist self,
const char *  name,
int  value 
)

Update a property list with a boolean value.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe boolean value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property list self contains a property with the name name which is not of type CPL_TYPE_BOOL.

The function updates the property list self with the boolean value value. This means, if a property with the name name exists already its value is updated, otherwise a property with the name name is created and added to self. The update will fail if a property with the name name exists already which is not of type CPL_TYPE_BOOL.

cpl_error_code cpl_propertylist_update_char ( cpl_propertylist self,
const char *  name,
char  value 
)

Update a property list with a character value.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe character value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property list self contains a property with the name name which is not of type CPL_TYPE_CHAR.

The function updates the property list self with the character value value. This means, if a property with the name name exists already its value is updated, otherwise a property with the name name is created and added to self. The update will fail if a property with the name name exists already which is not of type CPL_TYPE_CHAR.

cpl_error_code cpl_propertylist_update_double ( cpl_propertylist self,
const char *  name,
double  value 
)

Update a property list with a double value.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe double value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property list self contains a property with the name name which is not of type CPL_TYPE_DOUBLE.

The function updates the property list self with the double value value. This means, if a property with the name name exists already its value is updated, otherwise a property with the name name is created and added to self. The update will fail if a property with the name name exists already which is not of type CPL_TYPE_DOUBLE.

cpl_error_code cpl_propertylist_update_double_complex ( cpl_propertylist self,
const char *  name,
double complex  value 
)

Update a property list with a double complex value.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe double complex value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property list self contains a property with the name name which is not of type CPL_TYPE_DOUBLE_COMPLEX.

The function updates the property list self with the double complex value value. This means, if a property with the name name exists already its value is updated, otherwise a property with the name name is created and added to self. The update will fail if a property with the name name exists already which is not of type CPL_TYPE_DOUBLE_COMPLEX.

cpl_error_code cpl_propertylist_update_float ( cpl_propertylist self,
const char *  name,
float  value 
)

Update a property list with a float value.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe float value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property list self contains a property with the name name which is not of type CPL_TYPE_FLOAT.

The function updates the property list self with the float value value. This means, if a property with the name name exists already its value is updated, otherwise a property with the name name is created and added to self. The update will fail if a property with the name name exists already which is not of type CPL_TYPE_FLOAT.

cpl_error_code cpl_propertylist_update_float_complex ( cpl_propertylist self,
const char *  name,
float complex  value 
)

Update a property list with a float complex value.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe float complex value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property list self contains a property with the name name which is not of type CPL_TYPE_FLOAT_COMPLEX.

The function updates the property list self with the float complex value value. This means, if a property with the name name exists already its value is updated, otherwise a property with the name name is created and added to self. The update will fail if a property with the name name exists already which is not of type CPL_TYPE_FLOAT_COMPLEX.

cpl_error_code cpl_propertylist_update_int ( cpl_propertylist self,
const char *  name,
int  value 
)

Update a property list with a integer value.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe integer value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property list self contains a property with the name name which is not of type CPL_TYPE_INT.

The function updates the property list self with the integer value value. This means, if a property with the name name exists already its value is updated, otherwise a property with the name name is created and added to self. The update will fail if a property with the name name exists already which is not of type CPL_TYPE_INT.

cpl_error_code cpl_propertylist_update_long ( cpl_propertylist self,
const char *  name,
long  value 
)

Update a property list with a long value.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe long value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property list self contains a property with the name name which is not of type CPL_TYPE_LONG.

The function updates the property list self with the long value value. This means, if a property with the name name exists already its value is updated, otherwise a property with the name name is created and added to self. The update will fail if a property with the name name exists already which is not of type CPL_TYPE_LONG.

cpl_error_code cpl_propertylist_update_long_long ( cpl_propertylist self,
const char *  name,
long long  value 
)

Update a property list with a long long value.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe long long value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property list self contains a property with the name name which is not of type CPL_TYPE_LONG_LONG.

The function updates the property list self with the long long value value. This means, if a property with the name name exists already its value is updated, otherwise a property with the name name is created and added to self. The update will fail if a property with the name name exists already which is not of type CPL_TYPE_LONG_LONG.

cpl_error_code cpl_propertylist_update_string ( cpl_propertylist self,
const char *  name,
const char *  value 
)

Update a property list with a string value.

Parameters
selfA property list.
nameThe property name to be assigned to the value.
valueThe string value to store.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self, name or value is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property list self contains a property with the name name which is not of type CPL_TYPE_STRING.

The function updates the property list self with the string value value. This means, if a property with the name name exists already its value is updated, otherwise a property with the name name is created and added to self. The update will fail if a property with the name name exists already which is not of type CPL_TYPE_STRING.

cpl-6.4.1/html/group__cpl__image.html0000644000460300003120000160670512310333014014503 00000000000000 Common Pipeline Library Reference Manual: Images
Common Pipeline Library Reference Manual  6.4.1

Typedefs

typedef enum _cpl_value_ cpl_value
 The CPL special value. It is a bit field.
 

Enumerations

enum  _cpl_value_ {
  CPL_VALUE_NAN,
  CPL_VALUE_PLUSINF,
  CPL_VALUE_MINUSINF,
  CPL_VALUE_ZERO,
  CPL_VALUE_INF,
  CPL_VALUE_NOTFINITE
}
 The special values that can be rejected They are a bit-field and can be combined with bitwise or. More...
 

Functions

cpl_error_code cpl_image_abs (cpl_image *image)
 Take the absolute value of an image.
 
cpl_image * cpl_image_abs_create (const cpl_image *image_in)
 Take the absolute value of an image.
 
cpl_error_code cpl_image_accept (cpl_image *im, cpl_size x, cpl_size y)
 Set a pixel as good in an image.
 
cpl_error_code cpl_image_accept_all (cpl_image *self)
 Set all pixels in the image as good.
 
cpl_error_code cpl_image_add (cpl_image *im1, const cpl_image *im2)
 Add two images, store the result in the first image.
 
cpl_image * cpl_image_add_create (const cpl_image *image1, const cpl_image *image2)
 Add two images.
 
cpl_error_code cpl_image_add_scalar (cpl_image *self, double scalar)
 Elementwise addition of a scalar to an image.
 
cpl_image * cpl_image_add_scalar_create (const cpl_image *image, double addend)
 Create a new image by elementwise addition of a scalar to an image.
 
cpl_error_code cpl_image_and (cpl_image *self, const cpl_image *first, const cpl_image *second)
 The bit-wise and of two images with integer pixels.
 
cpl_error_code cpl_image_and_scalar (cpl_image *self, const cpl_image *first, cpl_bitmask second)
 The bit-wise and of a scalar and an image with integer pixels.
 
cpl_image * cpl_image_average_create (const cpl_image *image_1, const cpl_image *image_2)
 Build the average of two images.
 
cpl_image * cpl_image_cast (const cpl_image *self, cpl_type type)
 Convert a cpl_image to a given type.
 
cpl_image * cpl_image_collapse_create (const cpl_image *self, int direction)
 Collapse an image along its rows or columns.
 
cpl_image * cpl_image_collapse_median_create (const cpl_image *self, int direction, cpl_size drop_ll, cpl_size drop_ur)
 Collapse an image along its rows or columns, with filtering.
 
cpl_image * cpl_image_collapse_window_create (const cpl_image *self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, int direction)
 Collapse an image region along its rows or columns.
 
cpl_error_code cpl_image_conjugate (cpl_image *self, const cpl_image *other)
 Complex conjugate the pixels in a complex image.
 
cpl_error_code cpl_image_copy (cpl_image *im1, const cpl_image *im2, cpl_size xpos, cpl_size ypos)
 Copy one image into another.
 
cpl_size cpl_image_count_rejected (const cpl_image *im)
 Count the number of bad pixels declared in an image.
 
void cpl_image_delete (cpl_image *d)
 Free memory associated to an cpl_image object.
 
cpl_error_code cpl_image_divide (cpl_image *im1, const cpl_image *im2)
 Divide two images, store the result in the first image.
 
cpl_image * cpl_image_divide_create (const cpl_image *image1, const cpl_image *image2)
 Divide two images.
 
cpl_error_code cpl_image_divide_scalar (cpl_image *self, double scalar)
 Elementwise division of an image with a scalar.
 
cpl_image * cpl_image_divide_scalar_create (const cpl_image *image, double divisor)
 Create a new image by elementwise division of an image with a scalar.
 
cpl_error_code cpl_image_dump_structure (const cpl_image *self, FILE *stream)
 Dump structural information of a CPL image.
 
cpl_error_code cpl_image_dump_window (const cpl_image *self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, FILE *stream)
 Dump pixel values in a CPL image.
 
cpl_image * cpl_image_duplicate (const cpl_image *src)
 Copy an image.
 
cpl_error_code cpl_image_exponential (cpl_image *self, double base)
 Compute the elementwise exponential of the image.
 
cpl_image * cpl_image_exponential_create (const cpl_image *image, double base)
 Create a new image by elementwise exponentiation of an image.
 
cpl_image * cpl_image_extract (const cpl_image *in, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Extract a rectangular zone from an image into another image.
 
cpl_image * cpl_image_extract_subsample (const cpl_image *image, cpl_size xstep, cpl_size ystep)
 Sub-sample an image.
 
cpl_error_code cpl_image_fft (cpl_image *img_real, cpl_image *img_imag, unsigned mode)
 Fast Fourier Transform a square, power-of-two sized image.
 
cpl_error_code cpl_image_fill_abs_arg (cpl_image *im_abs, cpl_image *im_arg, const cpl_image *self)
 Split a complex image into its absolute and argument part(s)
 
cpl_error_code cpl_image_fill_gaussian (cpl_image *ima, double xcen, double ycen, double norm, double sig_x, double sig_y)
 Generate an image from a 2d gaussian function.
 
cpl_error_code cpl_image_fill_jacobian (cpl_image *out, const cpl_image *deltax, const cpl_image *deltay)
 Compute area change ratio for a transformation map.
 
cpl_error_code cpl_image_fill_jacobian_polynomial (cpl_image *out, const cpl_polynomial *poly_x, const cpl_polynomial *poly_y)
 Compute area change ratio for a 2D polynomial transformation.
 
cpl_error_code cpl_image_fill_noise_uniform (cpl_image *ima, double min_pix, double max_pix)
 Generate an image with uniform random noise distribution.
 
cpl_error_code cpl_image_fill_polynomial (cpl_image *ima, const cpl_polynomial *poly, double startx, double stepx, double starty, double stepy)
 Generate an image from a 2d polynomial function.
 
cpl_error_code cpl_image_fill_re_im (cpl_image *im_real, cpl_image *im_imag, const cpl_image *self)
 Split a complex image into its real and/or imaginary part(s)
 
cpl_error_code cpl_image_fill_rejected (cpl_image *im, double a)
 Set the bad pixels in an image to a fixed value.
 
cpl_image * cpl_image_fill_test_create (cpl_size nx, cpl_size ny)
 Generate a test image with pixel type CPL_TYPE_DOUBLE.
 
cpl_error_code cpl_image_fill_window (cpl_image *self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, double value)
 Fill an image window with a constant.
 
cpl_error_code cpl_image_filter (cpl_image *self, const cpl_image *other, const cpl_matrix *kernel, cpl_filter_mode filter, cpl_border_mode border)
 Filter an image using a floating-point kernel.
 
cpl_image * cpl_image_filter_linear (const cpl_image *in, const cpl_matrix *ker)
 Compute a linear filtering.
 
cpl_error_code cpl_image_filter_mask (cpl_image *self, const cpl_image *other, const cpl_mask *kernel, cpl_filter_mode filter, cpl_border_mode border)
 Filter an image using a binary kernel.
 
cpl_image * cpl_image_filter_median (const cpl_image *in, const cpl_matrix *ker)
 Apply a spatial median filter to an image.
 
cpl_image * cpl_image_filter_morpho (const cpl_image *in, const cpl_matrix *ker)
 Filter an image in spatial domain with a morpho kernel.
 
cpl_image * cpl_image_filter_stdev (const cpl_image *in, const cpl_matrix *ker)
 Standard deviation filter.
 
cpl_error_code cpl_image_fit_gaussian (const cpl_image *im, cpl_size xpos, cpl_size ypos, cpl_size size, double *norm, double *xcen, double *ycen, double *sig_x, double *sig_y, double *fwhm_x, double *fwhm_y)
 Apply a gaussian fit on an image sub window.
 
cpl_error_code cpl_image_flip (cpl_image *im, int angle)
 Flip an image on a given mirror line.
 
double cpl_image_get (const cpl_image *image, cpl_size xpos, cpl_size ypos, int *pis_rejected)
 Get the value of a pixel at a given position.
 
double cpl_image_get_absflux (const cpl_image *image)
 Computes the sum of absolute values over an image.
 
double cpl_image_get_absflux_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Computes the sum of absolute values over an image sub-window.
 
cpl_mask * cpl_image_get_bpm (cpl_image *img)
 Gets the bad pixels map.
 
const cpl_mask * cpl_image_get_bpm_const (const cpl_image *img)
 Gets the bad pixels map.
 
double cpl_image_get_centroid_x (const cpl_image *image)
 Computes the x centroid value over the whole image.
 
double cpl_image_get_centroid_x_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Computes the x centroid value over an image sub-window.
 
double cpl_image_get_centroid_y (const cpl_image *image)
 Computes the y centroid value over the whole image.
 
double cpl_image_get_centroid_y_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Computes the y centroid value over an image sub-window.
 
double complex cpl_image_get_complex (const cpl_image *image, cpl_size xpos, cpl_size ypos, int *pis_rejected)
 Get the value of a complex pixel at a given position.
 
void * cpl_image_get_data (cpl_image *img)
 Gets the pixel data.
 
const void * cpl_image_get_data_const (const cpl_image *img)
 Gets the pixel data.
 
double * cpl_image_get_data_double (cpl_image *img)
 Get the data as a double array.
 
double complex * cpl_image_get_data_double_complex (cpl_image *img)
 Get the data as a double complex array.
 
const double complex * cpl_image_get_data_double_complex_const (const cpl_image *img)
 Get the data as a double complex array.
 
const double * cpl_image_get_data_double_const (const cpl_image *img)
 Get the data as a double array.
 
float * cpl_image_get_data_float (cpl_image *img)
 Get the data as a float array.
 
float complex * cpl_image_get_data_float_complex (cpl_image *img)
 Get the data as a float complex array.
 
const float complex * cpl_image_get_data_float_complex_const (const cpl_image *img)
 Get the data as a float complex array.
 
const float * cpl_image_get_data_float_const (const cpl_image *img)
 Get the data as a float array.
 
int * cpl_image_get_data_int (cpl_image *img)
 Get the data as a integer array.
 
const int * cpl_image_get_data_int_const (const cpl_image *img)
 Get the data as a integer array.
 
double cpl_image_get_flux (const cpl_image *image)
 Computes the sum of pixel values over an image.
 
double cpl_image_get_flux_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Computes the sum of pixel values over an image sub-window.
 
cpl_error_code cpl_image_get_fwhm (const cpl_image *in, cpl_size xpos, cpl_size ypos, double *fwhm_x, double *fwhm_y)
 Compute FWHM values in x and y for an object.
 
double cpl_image_get_interpolated (const cpl_image *source, double xpos, double ypos, const cpl_vector *xprofile, double xradius, const cpl_vector *yprofile, double yradius, double *pconfid)
 Interpolate a pixel.
 
double cpl_image_get_mad (const cpl_image *image, double *sigma)
 Computes median and median absolute deviation (MAD) on an image.
 
double cpl_image_get_mad_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, double *sigma)
 Computes median and median absolute deviation (MAD) on an image window.
 
double cpl_image_get_max (const cpl_image *image)
 computes maximum pixel value over an image.
 
double cpl_image_get_max_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 computes maximum pixel value over an image sub-window.
 
cpl_error_code cpl_image_get_maxpos (const cpl_image *image, cpl_size *px, cpl_size *py)
 Computes maximum pixel value and position over an image.
 
cpl_error_code cpl_image_get_maxpos_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size *px, cpl_size *py)
 Computes maximum pixel value and position over an image sub window.
 
double cpl_image_get_mean (const cpl_image *image)
 computes mean pixel value over an image.
 
double cpl_image_get_mean_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 computes mean pixel value over an image sub-window.
 
double cpl_image_get_median (const cpl_image *image)
 computes median pixel value over an image.
 
double cpl_image_get_median_dev (const cpl_image *image, double *sigma)
 Computes median and mean absolute median deviation on an image window.
 
double cpl_image_get_median_dev_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, double *sigma)
 Computes median and mean absolute median deviation on an image window.
 
double cpl_image_get_median_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 computes median pixel value over an image sub-window.
 
double cpl_image_get_min (const cpl_image *image)
 computes minimum pixel value over an image.
 
double cpl_image_get_min_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 computes minimum pixel value over an image sub-window.
 
cpl_error_code cpl_image_get_minpos (const cpl_image *image, cpl_size *px, cpl_size *py)
 Computes minimum pixel value and position over an image.
 
cpl_error_code cpl_image_get_minpos_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size *px, cpl_size *py)
 Computes minimum pixel value and position over an image sub window.
 
cpl_size cpl_image_get_size_x (const cpl_image *img)
 Get the image x size.
 
cpl_size cpl_image_get_size_y (const cpl_image *img)
 Get the image y size.
 
double cpl_image_get_sqflux (const cpl_image *image)
 Computes the sum of squared values over an image.
 
double cpl_image_get_sqflux_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Computes the sum of squared values over an image sub-window.
 
double cpl_image_get_stdev (const cpl_image *image)
 computes pixel standard deviation over an image.
 
double cpl_image_get_stdev_window (const cpl_image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 computes pixel standard deviation over an image sub-window.
 
cpl_type cpl_image_get_type (const cpl_image *img)
 Get the image type.
 
cpl_error_code cpl_image_hypot (cpl_image *self, const cpl_image *first, const cpl_image *second)
 The pixel-wise Euclidean distance function of the images.
 
cpl_bivector * cpl_image_iqe (const cpl_image *in, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Compute an image quality estimation for an object.
 
int cpl_image_is_rejected (const cpl_image *im, cpl_size x, cpl_size y)
 Test if a pixel is good or bad.
 
cpl_image * cpl_image_labelise_mask_create (const cpl_mask *in, cpl_size *nbobjs)
 Labelise a mask to differentiate different objects.
 
cpl_image * cpl_image_load (const char *filename, cpl_type im_type, cpl_size pnum, cpl_size xtnum)
 Load an image from a FITS file.
 
cpl_image * cpl_image_load_window (const char *filename, cpl_type im_type, cpl_size pnum, cpl_size xtnum, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Load an image from a FITS file.
 
cpl_error_code cpl_image_logarithm (cpl_image *self, double base)
 Compute the elementwise logarithm of the image.
 
cpl_image * cpl_image_logarithm_create (const cpl_image *image, double base)
 Create a new image by taking the elementwise logarithm of an image.
 
cpl_error_code cpl_image_move (cpl_image *im, cpl_size nb_cut, const cpl_size *new_pos)
 Reorganize the pixels in an image.
 
cpl_error_code cpl_image_multiply (cpl_image *im1, const cpl_image *im2)
 Multiply two images, store the result in the first image.
 
cpl_image * cpl_image_multiply_create (const cpl_image *image1, const cpl_image *image2)
 Multiply two images.
 
cpl_error_code cpl_image_multiply_scalar (cpl_image *self, double scalar)
 Elementwise multiplication of an image with a scalar.
 
cpl_image * cpl_image_multiply_scalar_create (const cpl_image *image, double factor)
 Create a new image by multiplication of a scalar and an image.
 
cpl_image * cpl_image_new (cpl_size nx, cpl_size ny, cpl_type type)
 Allocate an image structure and pixel buffer for a image.
 
cpl_image * cpl_image_new_from_mask (const cpl_mask *mask)
 Create an int image from a mask.
 
cpl_error_code cpl_image_normalise (cpl_image *image, cpl_norm mode)
 Normalise pixels in an image.
 
cpl_image * cpl_image_normalise_create (const cpl_image *image_in, cpl_norm mode)
 Create a new normalised image from an existing image.
 
cpl_error_code cpl_image_not (cpl_image *self, const cpl_image *first)
 The bit-wise complement (not) of an image with integer pixels.
 
cpl_error_code cpl_image_or (cpl_image *self, const cpl_image *first, const cpl_image *second)
 The bit-wise or of two images with integer pixels.
 
void cpl_image_or_mask (cpl_image *self, const cpl_image *first, const cpl_image *second)
 The bit-wise or of the input masks onto the output mask.
 
void cpl_image_or_mask_unary (cpl_image *self, const cpl_image *first)
 The bit-wise or of the input mask(s) onto the output mask.
 
cpl_error_code cpl_image_or_scalar (cpl_image *self, const cpl_image *first, cpl_bitmask second)
 The bit-wise or of a scalar and an image with integer pixels.
 
cpl_error_code cpl_image_power (cpl_image *self, double exponent)
 Compute the elementwise power of the image.
 
cpl_image * cpl_image_power_create (const cpl_image *image, double exponent)
 Create a new image by elementwise raising of an image to a power.
 
cpl_image * cpl_image_rebin (const cpl_image *image, cpl_size xstart, cpl_size ystart, cpl_size xstep, cpl_size ystep)
 Rebin an image.
 
cpl_error_code cpl_image_reject (cpl_image *im, cpl_size x, cpl_size y)
 Set a pixel as bad in an image.
 
cpl_error_code cpl_image_reject_from_mask (cpl_image *im, const cpl_mask *map)
 Set the bad pixels in an image as defined in a mask.
 
cpl_error_code cpl_image_reject_value (cpl_image *self, cpl_value mode)
 Reject pixels with the specified special value(s)
 
cpl_error_code cpl_image_save (const cpl_image *self, const char *filename, cpl_type type, const cpl_propertylist *pl, unsigned mode)
 Save an image to a FITS file.
 
cpl_error_code cpl_image_set (cpl_image *image, cpl_size xpos, cpl_size ypos, double value)
 Set the pixel at the given position to the given value.
 
cpl_mask * cpl_image_set_bpm (cpl_image *self, cpl_mask *bpm)
 Replace the bad pixel map of the image.
 
cpl_error_code cpl_image_set_complex (cpl_image *image, cpl_size xpos, cpl_size ypos, double complex value)
 Set the pixel at the given position to the given complex value.
 
cpl_error_code cpl_image_shift (cpl_image *self, cpl_size dx, cpl_size dy)
 Shift an image by integer offsets.
 
cpl_error_code cpl_image_subtract (cpl_image *im1, const cpl_image *im2)
 Subtract two images, store the result in the first image.
 
cpl_image * cpl_image_subtract_create (const cpl_image *image1, const cpl_image *image2)
 Subtract two images.
 
cpl_error_code cpl_image_subtract_scalar (cpl_image *self, double scalar)
 Elementwise subtraction of a scalar from an image.
 
cpl_image * cpl_image_subtract_scalar_create (const cpl_image *image, double subtrahend)
 Create an image by elementwise subtraction of a scalar from an image.
 
cpl_error_code cpl_image_threshold (cpl_image *image_in, double lo_cut, double hi_cut, double assign_lo_cut, double assign_hi_cut)
 Threshold an image to a given interval.
 
cpl_error_code cpl_image_turn (cpl_image *self, int rot)
 Rotate an image by a multiple of 90 degrees clockwise.
 
cpl_mask * cpl_image_unset_bpm (cpl_image *self)
 Remove the bad pixel map from the image.
 
void * cpl_image_unwrap (cpl_image *d)
 Free memory associated to an cpl_image object, but the pixel buffer.
 
cpl_error_code cpl_image_warp (cpl_image *out, const cpl_image *in, const cpl_image *deltax, const cpl_image *deltay, const cpl_vector *xprofile, double xradius, const cpl_vector *yprofile, double yradius)
 Warp an image.
 
cpl_error_code cpl_image_warp_polynomial (cpl_image *out, const cpl_image *in, const cpl_polynomial *poly_x, const cpl_polynomial *poly_y, const cpl_vector *xprofile, double xradius, const cpl_vector *yprofile, double yradius)
 Warp an image according to a 2D polynomial transformation.
 
cpl_image * cpl_image_wrap_double (cpl_size nx, cpl_size ny, double *pixels)
 Create a double image using an existing pixel buffer.
 
cpl_image * cpl_image_wrap_double_complex (cpl_size nx, cpl_size ny, double complex *pixels)
 Create a double complex image using an existing pixel buffer.
 
cpl_image * cpl_image_wrap_float (cpl_size nx, cpl_size ny, float *pixels)
 Create a float image using an existing pixel buffer.
 
cpl_image * cpl_image_wrap_float_complex (cpl_size nx, cpl_size ny, float complex *pixels)
 Create a float complex image using an existing pixel buffer.
 
cpl_image * cpl_image_wrap_int (cpl_size nx, cpl_size ny, int *pixels)
 Create an integer image using an existing pixel buffer.
 
cpl_error_code cpl_image_xor (cpl_image *self, const cpl_image *first, const cpl_image *second)
 The bit-wise xor of two images with integer pixels.
 
cpl_error_code cpl_image_xor_scalar (cpl_image *self, const cpl_image *first, cpl_bitmask second)
 The bit-wise xor of a scalar and an image with integer pixels.
 
cpl_vector * cpl_vector_new_from_image_column (const cpl_image *image_in, cpl_size pos)
 Extract a column from an image.
 
cpl_vector * cpl_vector_new_from_image_row (const cpl_image *image_in, cpl_size pos)
 Extract a row from an image.
 

Detailed Description

This module provides functions to create, use, and destroy a cpl_image. A cpl_image is a 2-dimensional data structure with a pixel type (one of CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT_COMPLEX or CPL_TYPE_DOUBLE_COMPLEX) and an optional bad pixel map.

The pixel indexing follows the FITS convention in the sense that the lower left pixel in a CPL image has index (1, 1). The pixel buffer is stored row-wise so for optimum performance any pixel-wise access should be done likewise.

Functionality include: FITS I/O Image arithmetic, casting, extraction, thresholding, filtering, resampling Bad pixel handling Image statistics Generation of test images Special functions, such as the image quality estimator

Synopsis:
#include "cpl_image.h"

Usage: define the following preprocessor symbols as needed, then include this file

Typedef Documentation

typedef enum _cpl_value_ cpl_value

The CPL special value. It is a bit field.

Enumeration Type Documentation

The special values that can be rejected They are a bit-field and can be combined with bitwise or.

Enumerator:
CPL_VALUE_NAN 

Not-a-Number (NaN)

CPL_VALUE_PLUSINF 

Plus Infinity

CPL_VALUE_MINUSINF 

Minus Infinity

CPL_VALUE_ZERO 

Zero

CPL_VALUE_INF 

Infinity with any sign

CPL_VALUE_NOTFINITE 

NaN or infinity with any sign

Function Documentation

cpl_error_code cpl_image_abs ( cpl_image *  image)

Take the absolute value of an image.

Parameters
imageImage to be modified in place
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error

Set each pixel to its absolute value.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_image* cpl_image_abs_create ( const cpl_image *  image_in)

Take the absolute value of an image.

Parameters
image_inImage operand.
Returns
1 newly allocated image or NULL on error
See Also
cpl_image_abs

For each pixel, out = abs(in). The returned image must be deallocated using cpl_image_delete().

cpl_error_code cpl_image_accept ( cpl_image *  im,
cpl_size  x,
cpl_size  y 
)

Set a pixel as good in an image.

Parameters
imthe input image
xthe x pixel position in the image (first pixel is 1)
ythe y pixel position in the image (first pixel is 1)
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the image
cpl_error_code cpl_image_accept_all ( cpl_image *  self)

Set all pixels in the image as good.

Parameters
selfthe input image
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_image_add ( cpl_image *  im1,
const cpl_image *  im2 
)

Add two images, store the result in the first image.

Parameters
im1first operand.
im2second operand.
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

The first input image is modified to contain the result of the operation.

The bad pixel map of the first image becomes the union of the bad pixel maps of the input images.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the input images have different sizes
  • CPL_ERROR_TYPE_MISMATCH if the second input image has complex type while the first one does not
cpl_image* cpl_image_add_create ( const cpl_image *  image1,
const cpl_image *  image2 
)

Add two images.

Parameters
image1first operand
image2second operand
Returns
1 newly allocated image or NULL on error

Creates a new image, being the result of the operation, and returns it to the caller. The returned image must be deallocated using cpl_image_delete(). The function supports images with different types among CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. The returned image type is the one of the first passed image.

The bad pixels map of the result is the union of the bad pixels maps of the input images.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the input images have different sizes
  • CPL_ERROR_TYPE_MISMATCH if the second input image has complex type while the first one does not
cpl_error_code cpl_image_add_scalar ( cpl_image *  self,
double  scalar 
)

Elementwise addition of a scalar to an image.

Parameters
selfImage to be modified in place.
scalarNumber to add
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error

Modifies the image by adding a number to each of its pixels.

The operation is always performed in double precision, with a final cast of the result to the image pixel type.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_image* cpl_image_add_scalar_create ( const cpl_image *  image,
double  addend 
)

Create a new image by elementwise addition of a scalar to an image.

Parameters
imageImage to add
addendNumber to add
Returns
1 newly allocated image or NULL in case of an error
See Also
cpl_image_add_scalar

Creates a new image, being the result of the operation, and returns it to the caller. The returned image must be deallocated using cpl_image_delete(). The function supports images with different types among CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. The type of the created image is that of the passed image.

cpl_error_code cpl_image_and ( cpl_image *  self,
const cpl_image *  first,
const cpl_image *  second 
)

The bit-wise and of two images with integer pixels.

Parameters
selfPre-allocated image to hold the result
firstFirst operand, or NULL for an in-place operation
secondSecond operand
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
Note
CPL_TYPE_INT is required
See Also
cpl_mask_and() for the equivalent logical operation

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes
  • CPL_ERROR_INVALID_TYPE if the passed image type is as required
cpl_error_code cpl_image_and_scalar ( cpl_image *  self,
const cpl_image *  first,
cpl_bitmask  second 
)

The bit-wise and of a scalar and an image with integer pixels.

Parameters
selfPre-allocated image to hold the result
firstFirst operand, or NULL for an in-place operation
secondSecond operand (scalar)
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
Note
CPL_TYPE_INT is required

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes
  • CPL_ERROR_INVALID_TYPE if the passed image type is as required
cpl_image* cpl_image_average_create ( const cpl_image *  image_1,
const cpl_image *  image_2 
)

Build the average of two images.

Parameters
image_1First image operand.
image_2Second image operand.
Returns
1 newly allocated image or NULL on error

Builds the average of two images and returns a newly allocated image, to be deallocated using cpl_image_delete(). The average is arithmetic, i.e. outpix=(pix1+pix2)/2 Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_image* cpl_image_cast ( const cpl_image *  self,
cpl_type  type 
)

Convert a cpl_image to a given type.

Parameters
selfThe image to convert
typeThe destination type
Returns
the newly allocated cpl_image or NULL on error

Casting to non-complex types is only supported for non-complex types.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the passed type is invalid
  • CPL_ERROR_TYPE_MISMATCH if the passed image type is complex and requested casting type is non-complex.
  • CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported
cpl_image* cpl_image_collapse_create ( const cpl_image *  self,
int  direction 
)

Collapse an image along its rows or columns.

Parameters
selfInput image to collapse.
directionCollapsing direction.
Returns
1 newly allocated 1D image or NULL on error

On success the function returns a 1D image, created by adding up all pixels on the same row or column.

Collapse along y (sum of rows):

p7  p8  p9     Input image is a 3x3 image containing 9 pixels.
p4  p5  p6     The output is an image containing one row with
p1  p2  p3     3 pixels A, B, C, where:
----------

A   B   C      A = p1+p4+p7
               B = p2+p5+p8
               C = p3+p6+p9

If p7 is a bad pixel, A = (p1+p4)*3/2.
If p1, p4, p7 are bad, A is flagged as bad.

Provide the collapsing direction as an int. Give 0 to collapse along y (sum of rows) and get an image with a single row in output, or give 1 to collapse along x (sum of columns) to get an image with a single column in output. Only the good pixels are collapsed. Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The returned image must be deallocated using cpl_image_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_image* cpl_image_collapse_median_create ( const cpl_image *  self,
int  direction,
cpl_size  drop_ll,
cpl_size  drop_ur 
)

Collapse an image along its rows or columns, with filtering.

Parameters
selfInput image to collapse.
directionCollapsing direction.
drop_llIgnore this many lower rows/leftmost columns
drop_urIgnore this many upper rows/rightmost columns
Returns
1 newly allocated image having 1 row or 1 column or NULL on error
See Also
cpl_image_collapse_create()

The collapsing direction is defined as for cpl_image_collapse_create(). For each output pixel, the median of the corresponding non-ignored pixels is computed. A combination of bad pixels and drop parameters can cause a median value in the output image to be undefined. Such pixels will be flagged as bad and set to zero.

If the output would contain only bad pixels an error is set.

Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The returned image must be deallocated using cpl_image_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if a rejection parameter is negative, or if the sum of ignored pixels is bigger than the image size in the collapsing direction
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
  • CPL_ERROR_DATA_NOT_FOUND if the output image would have only bad pixels
cpl_image* cpl_image_collapse_window_create ( const cpl_image *  self,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
int  direction 
)

Collapse an image region along its rows or columns.

Parameters
selfImage to collapse.
llxlower left x coord.
llylower left y coord
urxupper right x coord
uryupper right y coord
directionCollapsing direction.
Returns
a newly allocated image or NULL on error
See Also
cpl_image_collapse_create()

llx, lly, urx, ury are the image region coordinates in FITS convention. Those specified bounds are included in the collapsed region.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the specified window is not valid
cpl_error_code cpl_image_conjugate ( cpl_image *  self,
const cpl_image *  other 
)

Complex conjugate the pixels in a complex image.

Parameters
selfPre-allocated complex image to hold the result
otherThe complex image to conjugate, may equal self
Returns
CPL_ERROR_NONE or _cpl_error_code_ on error
Note
The two images must match in size and precision

Any bad pixels are also conjugated.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT If an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT If the images have different sizes
  • CPL_ERROR_INVALID_TYPE If an input image is not of complex type
  • CPL_ERROR_TYPE_MISMATCH If the images have different precision
cpl_error_code cpl_image_copy ( cpl_image *  im1,
const cpl_image *  im2,
cpl_size  xpos,
cpl_size  ypos 
)

Copy one image into another.

Parameters
im1the image in which im2 is inserted
im2the inserted image
xposthe x pixel position in im1 where the lower left pixel of im2 should go (from 1 to the x size of im1)
yposthe y pixel position in im1 where the lower left pixel of im2 should go (from 1 to the y size of im1)
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error.
Note
The two pixel buffers may not overlap

(xpos, ypos) must be a valid position in im1. If im2 is bigger than the place left in im1, the part that falls outside of im1 is simply ignored, an no error is raised. The bad pixels are inherited from im2 in the concerned im1 zone.

The two input images must be of the same type, namely one of CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_TYPE_MISMATCH if the input images are of different types
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if xpos or ypos are outside the specified range
cpl_size cpl_image_count_rejected ( const cpl_image *  im)

Count the number of bad pixels declared in an image.

Parameters
imthe input image
Returns
the number of bad pixels or -1 if the input image is NULL

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
void cpl_image_delete ( cpl_image *  d)

Free memory associated to an cpl_image object.

Parameters
dImage to destroy.
Returns
void

Frees all memory associated with a cpl_image. If the passed image is NULL, the function returns without doing anything.

cpl_error_code cpl_image_divide ( cpl_image *  im1,
const cpl_image *  im2 
)

Divide two images, store the result in the first image.

Parameters
im1first operand.
im2second operand.
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_add()
Note
The result of division with a zero-valued pixel is marked as a bad pixel.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the input images have different sizes
  • CPL_ERROR_TYPE_MISMATCH if the second input image has complex type while the first one does not
  • CPL_ERROR_DIVISION_BY_ZERO is all pixels in the divisor are zero
cpl_image* cpl_image_divide_create ( const cpl_image *  image1,
const cpl_image *  image2 
)

Divide two images.

Parameters
image1first operand
image2second operand
Returns
1 newly allocated image or NULL on error
See Also
cpl_image_add_create()
cpl_image_divide() The result of division with a zero-valued pixel is marked as a bad pixel.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the input images have different sizes
  • CPL_ERROR_TYPE_MISMATCH if the second input image has complex type while the first one does not
  • CPL_ERROR_DIVISION_BY_ZERO is all pixels in the divisor are zero
cpl_error_code cpl_image_divide_scalar ( cpl_image *  self,
double  scalar 
)

Elementwise division of an image with a scalar.

Parameters
selfImage to be modified in place.
scalarNon-zero number to divide with
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
See Also
cpl_image_add_scalar()

Modifies the image by dividing each of its pixels with a number.

If the scalar is zero the image is not modified and an error is returned.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_DIVISION_BY_ZERO a division by 0 occurs
cpl_image* cpl_image_divide_scalar_create ( const cpl_image *  image,
double  divisor 
)

Create a new image by elementwise division of an image with a scalar.

Parameters
imageImage to divide
divisorNon-zero number to divide with
Returns
1 newly allocated image or NULL in case of an error
See Also
cpl_image_divide_scalar
cpl_image_add_scalar_create
cpl_error_code cpl_image_dump_structure ( const cpl_image *  self,
FILE *  stream 
)

Dump structural information of a CPL image.

Parameters
selfImage to dump
streamOutput stream, accepts stdout or stderr
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if a write operation fails
cpl_error_code cpl_image_dump_window ( const cpl_image *  self,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
FILE *  stream 
)

Dump pixel values in a CPL image.

Parameters
selfImage to dump
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxSpecifies the window position
urySpecifies the window position
streamOutput stream, accepts stdout or stderr
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if a write operation fails
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the defined window is not in the image
  • CPL_ERROR_ILLEGAL_INPUT if the window definition is wrong (e.g llx > urx)
cpl_image* cpl_image_duplicate ( const cpl_image *  src)

Copy an image.

Parameters
srcSource image.
Returns
1 newly allocated image, or NULL on error.

Copy an image into a new image object. The pixels and the bad pixel map are also copied. The returned image must be deallocated using cpl_image_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_image_exponential ( cpl_image *  self,
double  base 
)

Compute the elementwise exponential of the image.

Parameters
selfImage to be modified in place.
baseBase of the exponential.
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error

Modifies the image by computing the base-scalar exponential of each of its pixels.

Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

Pixels for which the power of the given base is not defined are rejected and set to zero.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_image* cpl_image_exponential_create ( const cpl_image *  image,
double  base 
)

Create a new image by elementwise exponentiation of an image.

Parameters
imageImage to exponentiate
baseBase of the exponential
Returns
1 newly allocated image or NULL in case of an error
See Also
cpl_image_logarithm
cpl_image_add_scalar_create
cpl_image* cpl_image_extract ( const cpl_image *  in,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Extract a rectangular zone from an image into another image.

Parameters
inInput image
llxLower left X coordinate
llyLower left Y coordinate
urxUpper right X coordinate
uryUpper right Y coordinate
Returns
1 newly allocated image or NULL on error
Note
The returned image must be deallocated using cpl_image_delete()

The input coordinates define the extracted region by giving the coordinates of the lower left and upper right corners (inclusive).

Coordinates must be provided in the FITS convention: lower left corner of the image is at (1,1), x increasing from left to right, y increasing from bottom to top. Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the window coordinates are not valid
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_image* cpl_image_extract_subsample ( const cpl_image *  image,
cpl_size  xstep,
cpl_size  ystep 
)

Sub-sample an image.

Parameters
imageThe image to subsample
xstepTake every xstep pixel in x
ystepTake every ystep pixel in y
Returns
The newly allocated sub-sampled image or NULL in error case
See Also
cpl_image_extract

step represents the sampling step in x and y: both steps = 2 will create an image with a quarter of the pixels of the input image.

image type can be CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. If the image has bad pixels, they will be resampled in the same way.

The returned image must be deallocated using cpl_image_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if the input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if xstep, ystep are not positive
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_error_code cpl_image_fft ( cpl_image *  img_real,
cpl_image *  img_imag,
unsigned  mode 
)

Fast Fourier Transform a square, power-of-two sized image.

Parameters
img_realThe image real part to be transformed in place
img_imagThe image imaginary part to be transformed in place
modeThe desired FFT options (combined with bitwise or)
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

The input images must be of double type.

If the second passed image is NULL, the resulting imaginary part cannot be returned. This can be useful if the input is real and the output is known to also be real. But if the output has a significant imaginary part, you might want to pass a 0-valued image as the second parameter.

Any rejected pixel is used as if it were a good pixel.

The image must be square with a size that is a power of two.

These are the supported FFT modes: CPL_FFT_DEFAULT: Default, forward FFT transform CPL_FFT_INVERSE: Inverse FFT transform CPL_FFT_UNNORMALIZED: Do not normalize (with N*N for N-by-N image) on inverse. Has no effect on forward transform. CPL_FFT_SWAP_HALVES: Swap the four quadrants of the result image.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the image is not square or if the image size is not a power of 2.
  • CPL_ERROR_INVALID_TYPE if mode is 1, e.g. due to a logical or (||) of the allowed FFT options.
  • CPL_ERROR_UNSUPPORTED_MODE if mode is otherwise different from the allowed FFT options.
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_error_code cpl_image_fill_abs_arg ( cpl_image *  im_abs,
cpl_image *  im_arg,
const cpl_image *  self 
)

Split a complex image into its absolute and argument part(s)

Parameters
im_absPre-allocated image to hold the absolute part, or NULL
im_argPre-allocated image to hold the argument part, or NULL
selfComplex image to process
Returns
CPL_ERROR_NONE or _cpl_error_code_ on error
Note
At least one output image must be non-NULL. The images must match in size and precision

Any bad pixels are also processed.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT If the input image or both output images are NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT If the images have different sizes
  • CPL_ERROR_INVALID_TYPE If the input image is not of complex type
  • CPL_ERROR_TYPE_MISMATCH If the images have different precision
cpl_error_code cpl_image_fill_gaussian ( cpl_image *  ima,
double  xcen,
double  ycen,
double  norm,
double  sig_x,
double  sig_y 
)

Generate an image from a 2d gaussian function.

Parameters
imathe gaussian image to generate
xcenx position of the center (1 for the first pixel)
yceny position of the center (1 for the first pixel)
normnorm of the gaussian.
sig_xSigma in x for the gaussian distribution.
sig_ySigma in y for the gaussian distribution.
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

This function expects an already allocated image. This function generates an image of a 2d gaussian. The gaussian is defined by the position of its centre, given in pixel coordinates inside the image with the FITS convention (x from 1 to nx, y from 1 to ny), its norm and the value of sigma in x and y.

f(x, y) = (norm/(2*pi*sig_x*sig_y)) * exp(-(x-xcen)^2/(2*sig_x^2)) * exp(-(y-ycen)^2/(2*sig_y^2))

The input image type can be CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_error_code cpl_image_fill_jacobian ( cpl_image *  out,
const cpl_image *  deltax,
const cpl_image *  deltay 
)

Compute area change ratio for a transformation map.

Parameters
outPre-allocated image to hold the result
deltaxThe x shifts for each pixel
deltayThe y shifts for each pixel
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_image_warp()

The shifts images deltax and deltay, describing the transformation, must be of type CPL_TYPE_DOUBLE and of the same size as out. For each pixel (u, v) of the out image, the deltax and deltay code the following transformation:

* u - deltax(u,v) = x
* v - deltay(u,v) = y
* 

This function writes the density of the (u, v) coordinate system relative to the (x, y) coordinates for each (u, v) pixel of image out.

This is trivially obtained by computing the absolute value of the determinant of the Jacobian of the transformation for each pixel of the (u, v) image out.

The partial derivatives are estimated at the position (u, v) in the following way:

* dx/du = 1 + 1/2 ( deltax(u-1, v) - deltax(u+1, v) )
* dx/dv =     1/2 ( deltax(u, v-1) - deltax(u, v+1) )
* dy/du =     1/2 ( deltay(u-1, v) - deltay(u+1, v) )
* dy/dv = 1 + 1/2 ( deltay(u, v-1) - deltay(u, v+1) )
* 

Typically this function would be used to determine a flux-conservation factor map for the target image specified in function cpl_image_warp(). For example,

* cpl_image_warp(out, in, deltax, deltay, xprof, xrad, yprof, yrad);
* correction_map = cpl_image_new(cpl_image_get_size_x(out),
*                                cpl_image_get_size_y(out),
*                                cpl_image_get_type(out));
* cpl_image_fill_jacobian(correction_map, deltax, deltay);
* out_flux_corrected = cpl_image_multiply_create(out, correction_map);
* 

where out_flux_corrected is the resampled image out after correction for flux conservation.

Note
The map produced by this function is not applicable for flux conservation in case the transformation implies severe undersampling of the original signal.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the polynomial dimensions are not 2
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_error_code cpl_image_fill_jacobian_polynomial ( cpl_image *  out,
const cpl_polynomial *  poly_x,
const cpl_polynomial *  poly_y 
)

Compute area change ratio for a 2D polynomial transformation.

Parameters
outPre-allocated image to hold the result
poly_xDefines source x-pos corresponding to destination (u,v).
poly_yDefines source y-pos corresponding to destination (u,v).
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_image_warp_polynomial()

Given an input image with pixel coordinates (x, y) which is mapped into an output image with pixel coordinates (u, v), and the polynomial inverse transformation (u, v) to (x, y) as in cpl_image_warp_polynomial(), this function writes the density of the (u, v) coordinate system relative to the (x, y) coordinates for each (u, v) pixel of image out.

This is trivially obtained by computing the absolute value of the determinant of the Jacobian of the transformation for each pixel of the (u, v) image out.

Typically this function would be used to determine a flux-conservation factor map for the target image specified in function cpl_image_warp_polynomial(). For example,

* cpl_image_warp_polynomial(out, in, poly_x, poly_y, xprof, xrad, yprof, yrad);
* correction_map = cpl_image_new(cpl_image_get_size_x(out),
*                                cpl_image_get_size_y(out),
*                                cpl_image_get_type(out));
* cpl_image_fill_jacobian_polynomial(correction_map, poly_x, poly_y);
* out_flux_corrected = cpl_image_multiply_create(out, correction_map);
* 

where out_flux_corrected is the resampled image out after correction for flux conservation.

Note
The map produced by this function is not applicable for flux conservation in case the transformation implies severe undersampling of the original signal.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the polynomial dimensions are not 2
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_error_code cpl_image_fill_noise_uniform ( cpl_image *  ima,
double  min_pix,
double  max_pix 
)

Generate an image with uniform random noise distribution.

Parameters
imathe image to generate
min_pixMinimum output pixel value.
max_pixMaximum output pixel value.
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

Generate an image with a uniform random noise distribution. Pixel values are within the provided bounds. This function expects an already allocated image. The input image type can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if min_pix is bigger than max_pix
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_error_code cpl_image_fill_polynomial ( cpl_image *  ima,
const cpl_polynomial *  poly,
double  startx,
double  stepx,
double  starty,
double  stepy 
)

Generate an image from a 2d polynomial function.

Parameters
imathe polynomial image to generate
polythe 2d polynomial
startxthe x value associated with the left pixels column
stepxthe x step
startythe y value associated with the bottom pixels row
stepythe y step
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

This function expects an already allocated image. The pixel value of the pixel (i, j) is set to poly(startx+(i-1)*stepx, starty+(j-1)*stepy).

The input image type can be CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

If you want to generate an image whose pixel values are the values of the polynomial applied to the pixel positions, just call cpl_image_fill_polynomial(ima, poly, 1.0, 1.0, 1.0, 1.0);

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the polynomial's dimension is not 2
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_error_code cpl_image_fill_re_im ( cpl_image *  im_real,
cpl_image *  im_imag,
const cpl_image *  self 
)

Split a complex image into its real and/or imaginary part(s)

Parameters
im_realPre-allocated image to hold the real part, or NULL
im_imagPre-allocated image to hold the imaginary part, or NULL
selfComplex image to process
Returns
CPL_ERROR_NONE or _cpl_error_code_ on error
Note
At least one output image must be non-NULL. The images must match in size and precision

Any bad pixels are also processed.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT If the input image or both output images are NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT If the images have different sizes
  • CPL_ERROR_INVALID_TYPE If the input image is not of complex type
  • CPL_ERROR_TYPE_MISMATCH If the images have different precision
cpl_error_code cpl_image_fill_rejected ( cpl_image *  im,
double  a 
)

Set the bad pixels in an image to a fixed value.

Parameters
imThe image to modify.
aThe fixed value
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT, CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT
  • CPL_ERROR_INVALID_TYPE if the image pixel type is not supported
cpl_image* cpl_image_fill_test_create ( cpl_size  nx,
cpl_size  ny 
)

Generate a test image with pixel type CPL_TYPE_DOUBLE.

Parameters
nxx size
nyy size
Returns
1 newly allocated image or NULL on error

Generates a reference pattern for testing purposes only. The created image has to be deallocated with cpl_image_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_ILLEGAL_INPUT if nx or ny is non-positive
cpl_error_code cpl_image_fill_window ( cpl_image *  self,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
double  value 
)

Fill an image window with a constant.

Parameters
selfThe image to fill
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxSpecifies the window position
urySpecifies the window position
valueThe value to fill with
Returns
The _cpl_error_code_ or CPL_ERROR_NONE
Note
Any bad pixels are accepted

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the specified window is not valid
cpl_error_code cpl_image_filter ( cpl_image *  self,
const cpl_image *  other,
const cpl_matrix *  kernel,
cpl_filter_mode  filter,
cpl_border_mode  border 
)

Filter an image using a floating-point kernel.

Parameters
selfPre-allocated image to hold the filtered result
otherImage to filter
kernelPixel weigths
filterCPL_FILTER_LINEAR, CPL_FILTER_MORPHO
borderCPL_BORDER_FILTER
Returns
CPL_ERROR_NONE or the relevant CPL error code
See Also
cpl_image_filter_mask

The two images must have equal dimensions.

The kernel must have an odd number of rows and an odd number of columns and at least one non-zero element.

For scaling filters (CPL_FILTER_LINEAR_SCALE and CPL_FILTER_MORPHO_SCALE) the flux of the filtered image will be scaled with the sum of the weights of the kernel. If for a given input pixel location the kernel covers only bad pixels, the filtered pixel value is flagged as bad and set to zero.

For flux-preserving filters (CPL_FILTER_LINEAR and CPL_FILTER_MORPHO) the filtered pixel must have at least one input pixel with a non-zero weight available. Output pixels where this is not the case are set to zero and flagged as bad.

In-place filtering is not supported, but if the two images have the same pixel type, then the input pixel buffer may overlap all but the 1+H first rows of the output pixel buffer, where 1+2*H is the number of rows in the kernel.

Supported filters: CPL_FILTER_LINEAR, CPL_FILTER_MORPHO, CPL_FILTER_LINEAR_SCALE, CPL_FILTER_MORPHO_SCALE.

Supported borders modes: CPL_BORDER_FILTER

Example:

Beware that the 1st pixel - at (1,1) - in an image is the lower left, while the 1st element in a matrix - at (0,0) - is the top left. Thus to shift an image 1 pixel up and 1 pixel right with the CPL_FILTER_LINEAR and a 3 by 3 kernel, one should set to 1.0 the bottom leftmost matrix element which is at row 3, column 1, i.e.

cpl_matrix_set(kernel, 2, 0);

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL.
  • CPL_ERROR_ILLEGAL_INPUT if the kernel has a side of even length.
  • CPL_ERROR_DIVISION_BY_ZERO If the kernel is a zero-matrix.
  • CPL_ERROR_ACCESS_OUT_OF_RANGE If the kernel has a side longer than the input image.
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported.
  • CPL_ERROR_TYPE_MISMATCH if in median filtering the input and output pixel types differ.
  • CPL_ERROR_INCOMPATIBLE_INPUT If the input and output images have incompatible sizes.
  • CPL_ERROR_UNSUPPORTED_MODE If the output pixel buffer overlaps the input one (or the kernel), or the border/filter mode is unsupported.
cpl_image* cpl_image_filter_linear ( const cpl_image *  in,
const cpl_matrix *  ker 
)

Compute a linear filtering.

Parameters
inThe image to filter
kerThe kernel
Returns
The filtered image or NULL on error
See Also
cpl_image_filter()
Deprecated:
Replace this call with cpl_image_filter() using CPL_FILTER_LINEAR and CPL_BORDER_FILTER.
cpl_error_code cpl_image_filter_mask ( cpl_image *  self,
const cpl_image *  other,
const cpl_mask *  kernel,
cpl_filter_mode  filter,
cpl_border_mode  border 
)

Filter an image using a binary kernel.

Parameters
selfPre-allocated image to hold the filtered result
otherImage to filter
kernelPixels to use, if set to CPL_BINARY_1
filterCPL_FILTER_MEDIAN, CPL_FILTER_AVERAGE and more, see below
borderCPL_BORDER_FILTER and more, see below
Returns
CPL_ERROR_NONE or the relevant CPL error code

The kernel must have an odd number of rows and an odd number of columns.

The two images must have equal dimensions, except for the border mode CPL_BORDER_CROP, where the input image must have 2 * hx columns more and 2 * hy rows more than the output image, where the kernel has size (1 + 2 * hx, 1 + 2 * hy).

In standard deviation filtering the kernel must have at least two elements set to CPL_BINARY_1, for others at least one element must be set to CPL_BINARY_1.

Supported pixel types are: CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE.

In median filtering the two images must have the same pixel type.

In standard deviation filtering a filtered pixel must be computed from at least two input pixels, for other filters at least one input pixel must be available. Output pixels where this is not the case are set to zero and flagged as rejected.

In-place filtering is not supported, but if the two images have the same pixel type, then the input pixel buffer may overlap all but the 1+h first rows of the output pixel buffer, where 1+2*h is the number of rows in the kernel.

Supported modes:

CPL_FILTER_MEDIAN: CPL_BORDER_FILTER, CPL_BORDER_COPY, CPL_BORDER_NOP, CPL_BORDER_CROP.

CPL_FILTER_AVERAGE: CPL_BORDER_FILTER

CPL_FILTER_AVERAGE_FAST: CPL_BORDER_FILTER

CPL_FILTER_STDEV: CPL_BORDER_FILTER

CPL_FILTER_STDEV_FAST: CPL_BORDER_FILTER

Example:

To shift an image 1 pixel up and 1 pixel right with the CPL_FILTER_MEDIAN filter and a 3 by 3 kernel, one should set to CPL_BINARY_1 the bottom leftmost kernel element - at row 3, column 1, i.e.

cpl_mask * kernel = cpl_mask_new(3, 3);
cpl_mask_set(kernel, 1, 1);

The kernel required to do a 5 x 5 median filtering is created like this:

cpl_mask * kernel = cpl_mask_new(5, 5);
cpl_mask_not(kernel);

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL.
  • CPL_ERROR_ILLEGAL_INPUT if the kernel has a side of even length.
  • CPL_ERROR_DATA_NOT_FOUND If the kernel is empty, or in case of CPL_FILTER_STDEV if the kernel has only one element set to CPL_BINARY_1.
  • CPL_ERROR_ACCESS_OUT_OF_RANGE If the kernel has a side longer than the input image.
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported.
  • CPL_ERROR_TYPE_MISMATCH if in median filtering the input and output pixel types differ.
  • CPL_ERROR_INCOMPATIBLE_INPUT If the input and output images have incompatible sizes.
  • CPL_ERROR_UNSUPPORTED_MODE If the output pixel buffer overlaps the input one (or the kernel), or the border/filter mode is unsupported.
cpl_image* cpl_image_filter_median ( const cpl_image *  in,
const cpl_matrix *  ker 
)

Apply a spatial median filter to an image.

Parameters
inImage to filter.
kerthe kernel
Returns
1 newly allocated image or NULL in error case
See Also
cpl_image_filter_mask
Deprecated:
Replace this call with cpl_image_filter_mask() using CPL_FILTER_MEDIAN and CPL_BORDER_FILTER.
cpl_image* cpl_image_filter_morpho ( const cpl_image *  in,
const cpl_matrix *  ker 
)

Filter an image in spatial domain with a morpho kernel.

Parameters
inImage to filter.
kerFilter definition.
Returns
1 newly allocated image or NULL in error case.
See Also
cpl_image_filter()
Deprecated:
Replace this call with cpl_image_filter() using CPL_FILTER_MORPHO and CPL_BORDER_FILTER.
cpl_image* cpl_image_filter_stdev ( const cpl_image *  in,
const cpl_matrix *  ker 
)

Standard deviation filter.

Parameters
ininput image
kerthe kernel
Returns
a newly allocated filtered image or NULL on error
See Also
cpl_image_filter_mask
Deprecated:
Replace this call with cpl_image_filter_mask() using CPL_FILTER_STDEV and CPL_BORDER_FILTER.
cpl_error_code cpl_image_fit_gaussian ( const cpl_image *  im,
cpl_size  xpos,
cpl_size  ypos,
cpl_size  size,
double *  norm,
double *  xcen,
double *  ycen,
double *  sig_x,
double *  sig_y,
double *  fwhm_x,
double *  fwhm_y 
)

Apply a gaussian fit on an image sub window.

Parameters
imthe input image
xposthe x position of the center (1 for the first pixel)
yposthe y position of the center (1 for the first pixel)
sizethe window size in pixels, at least 4
normthe norm of the gaussian or NULL
xcenthe x center of the gaussian or NULL
ycenthe y center of the gaussian or NULL
sig_xthe semi-major axis of the gaussian or NULL
sig_ythe semi-minor axis of the gaussian or NULL
fwhm_xthe FHHM in x or NULL
fwhm_ythe FHHM in y or NULL
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_fit_image_gaussian()
cpl_image_iqe()
Deprecated:
If you need a 2D gaussian fit please use the function cpl_fit_image_gaussian(). Please note that on CPL versions earlier than 5.1.0 this function was wrongly documented: the parameters sig_x and sig_y were defined as "the sigma in x (or y) of the gaussian", while actually they returned the semi-major and semi-minor axes of the gaussian distribution at 1-sigma. PLEASE NOTE THAT IF YOU USED THIS FUNCTION FOR DETERMINING THE SPREAD OF A DISTRIBUTION ALONG THE X DIRECTION, THIS WAS VERY LIKELY OVERESTIMATED (because sig_x was always assigned the semi-major axis of the distribution ignoring the rotation), WHILE THE SPREAD ALONG THE Y DIRECTION WOULD BE UNDERESTIMATED. In addition to that, even with circular distributions this function may lead to an underestimation of sig_x and sig_y (up to 25% underestimation in the case of noiseless data with a box 4 times the sigma, 1% underestimation in the case of noiseless data with a box 7 times the sigma). This latter problem is related to the function cpl_image_iqe().

This function is only acceptable for determining the position of a peak.

cpl_error_code cpl_image_flip ( cpl_image *  im,
int  angle 
)

Flip an image on a given mirror line.

Parameters
imthe image to flip.
anglemirror line in polar coord. is theta = (PI/4) * angle
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

This function operates locally on the pixel buffer.

angle can take one of the following values:

  • 0 (theta=0) to flip the image around the horizontal
  • 1 (theta=pi/4) to flip the image around y=x
  • 2 (theta=pi/2) to flip the image around the vertical
  • 3 (theta=3pi/4) to flip the image around y=-x

Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the angle is different from the allowed values
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
double cpl_image_get ( const cpl_image *  image,
cpl_size  xpos,
cpl_size  ypos,
int *  pis_rejected 
)

Get the value of a pixel at a given position.

Parameters
imageInput image.
xposPixel x position (FITS convention, 1 for leftmost)
yposPixel y position (FITS convention, 1 for lowest)
pis_rejected1 if the pixel is bad, 0 if good, negative on error
Returns
The pixel value (cast to a double) or undefined if *pis_rejected

The return value is defined if the pixel is not flagged as rejected, i. e. when *pis_rejected == 0.

In case of an error, the _cpl_error_code_ code is set.

Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the passed position is not in the image
  • CPL_ERROR_INVALID_TYPE if the image pixel type is not supported
double cpl_image_get_absflux ( const cpl_image *  image)

Computes the sum of absolute values over an image.

Parameters
imageinput image.
Returns
the absolute flux (sum of |pixels|) value
See Also
cpl_image_get_min()
double cpl_image_get_absflux_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Computes the sum of absolute values over an image sub-window.

Parameters
imageinput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
the absolute flux (sum of |pixels|) value
See Also
cpl_image_get_min_window()
cpl_mask* cpl_image_get_bpm ( cpl_image *  img)

Gets the bad pixels map.

Parameters
imgImage to query.
Returns
A pointer to the mask identifying the bad pixels or NULL.

The returned pointer refers to already allocated data. If the bad pixel map is NULL, an empty one is created.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
const cpl_mask* cpl_image_get_bpm_const ( const cpl_image *  img)

Gets the bad pixels map.

Parameters
imgImage to query.
Returns
A pointer to the mask identifying the bad pixels or NULL.
Note
NULL is returned if the image has no bad pixel map
See Also
cpl_image_get_bpm

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
double cpl_image_get_centroid_x ( const cpl_image *  image)

Computes the x centroid value over the whole image.

Parameters
imageinput image.
Returns
the x centroid value
See Also
cpl_image_get_min_window()
double cpl_image_get_centroid_x_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Computes the x centroid value over an image sub-window.

Parameters
imageinput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
the x centroid value
See Also
cpl_image_get_min_window()
double cpl_image_get_centroid_y ( const cpl_image *  image)

Computes the y centroid value over the whole image.

Parameters
imageinput image.
Returns
the y centroid value
See Also
cpl_image_get_min_window()
double cpl_image_get_centroid_y_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Computes the y centroid value over an image sub-window.

Parameters
imageinput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
the y centroid value
See Also
cpl_image_get_min_window()
double complex cpl_image_get_complex ( const cpl_image *  image,
cpl_size  xpos,
cpl_size  ypos,
int *  pis_rejected 
)

Get the value of a complex pixel at a given position.

Parameters
imageInput complex image.
xposPixel x position (FITS convention, 1 for leftmost)
yposPixel y position (FITS convention, 1 for lowest)
pis_rejected1 if the pixel is bad, 0 if good, negative on error
Returns
The pixel value (cast to a double complex) or undefined if *pis_rejected
See Also
cpl_image_get()
Note
This function is available iff the application includes complex.h

The return value is defined if the pixel is not flagged as rejected, i. e. when *pis_rejected == 0.

In case of an error, the _cpl_error_code_ code is set.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the passed position is not in the image
void* cpl_image_get_data ( cpl_image *  img)

Gets the pixel data.

Parameters
imgImage to query.
Returns
A pointer to the image pixel data or NULL on error.

The returned pointer refers to already allocated data.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
const void* cpl_image_get_data_const ( const cpl_image *  img)

Gets the pixel data.

Parameters
imgImage to query.
Returns
A pointer to the image pixel data or NULL on error.
See Also
cpl_image_get_data
double* cpl_image_get_data_double ( cpl_image *  img)

Get the data as a double array.

Parameters
imga cpl_image object
Returns
pointer to the double data array or NULL on error.

The returned pointer refers to already allocated data.

The pixels are stored in a one dimensional array. The pixel value PIXVAL at position (i, j) in the image - (0, 0) is the lower left pixel, i gives the column position from left to right, j gives the row position from bottom to top - is given by : PIXVAL = array[i + j*nx]; where nx is the x size of the image and array is the data array returned by this function. array can be used to access or modify the pixel value in the image.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_TYPE_MISMATCH if the passed image type is not double
double complex* cpl_image_get_data_double_complex ( cpl_image *  img)

Get the data as a double complex array.

Parameters
imga cpl_image object
Returns
pointer to the double complex data array or NULL on error.
See Also
cpl_image_get_data_double()
Note
This function is available iff the application includes complex.h
const double complex* cpl_image_get_data_double_complex_const ( const cpl_image *  img)

Get the data as a double complex array.

Parameters
imga cpl_image object
Returns
pointer to the double complex data array or NULL on error.
See Also
cpl_image_get_data_double_complex()
const double* cpl_image_get_data_double_const ( const cpl_image *  img)

Get the data as a double array.

Parameters
imga cpl_image object
Returns
pointer to the double data array or NULL on error.
See Also
cpl_image_get_data_double
float* cpl_image_get_data_float ( cpl_image *  img)

Get the data as a float array.

Parameters
imga cpl_image object
Returns
pointer to the float data array or NULL on error.
See Also
cpl_image_get_data_double()
float complex* cpl_image_get_data_float_complex ( cpl_image *  img)

Get the data as a float complex array.

Parameters
imga cpl_image object
Returns
pointer to the float complex data array or NULL on error.
See Also
cpl_image_get_data_double_complex()
const float complex* cpl_image_get_data_float_complex_const ( const cpl_image *  img)

Get the data as a float complex array.

Parameters
imga cpl_image object
Returns
pointer to the float complex data array or NULL on error.
See Also
cpl_image_get_data_double_complex()
const float* cpl_image_get_data_float_const ( const cpl_image *  img)

Get the data as a float array.

Parameters
imga cpl_image object
Returns
pointer to the float data array or NULL on error.
See Also
cpl_image_get_data_float()
int* cpl_image_get_data_int ( cpl_image *  img)

Get the data as a integer array.

Parameters
imga cpl_image object
Returns
pointer to the integer data array or NULL on error.
See Also
cpl_image_get_data_double()
const int* cpl_image_get_data_int_const ( const cpl_image *  img)

Get the data as a integer array.

Parameters
imga cpl_image object
Returns
pointer to the integer data array or NULL on error.
See Also
cpl_image_get_data_int()
double cpl_image_get_flux ( const cpl_image *  image)

Computes the sum of pixel values over an image.

Parameters
imageinput image.
Returns
the flux value
See Also
cpl_image_get_min()
double cpl_image_get_flux_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Computes the sum of pixel values over an image sub-window.

Parameters
imageinput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
the flux value
See Also
cpl_image_get_min_window()
cpl_error_code cpl_image_get_fwhm ( const cpl_image *  in,
cpl_size  xpos,
cpl_size  ypos,
double *  fwhm_x,
double *  fwhm_y 
)

Compute FWHM values in x and y for an object.

Parameters
inthe input image
xposthe x position of the object (1 for the first pixel)
yposthe y position of the object (1 for the first pixel)
fwhm_xthe computed FWHM in x or -1 on error
fwhm_ythe computed FWHM in y or -1 on error
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_

This function uses a basic method: start from the center of the object and go away until the half maximum value is reached in x and y.

For the FWHM in x (resp. y) to be computed, the image size in the x (resp. y) direction should be at least of 5 pixels.

If for any reason, one of the FHWMs cannot be computed, its returned value is -1.0, but an error is not necessarily raised. For example, if a 4 column image is passed, the fwhm_x would be -1.0, the fwhm_y would be correctly computed, and no error would be raised.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_DATA_NOT_FOUND if (xpos, ypos) specifies a rejected pixel or a pixel with a non-positive value
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if xpos or ypos is outside the image size range
double cpl_image_get_interpolated ( const cpl_image *  source,
double  xpos,
double  ypos,
const cpl_vector *  xprofile,
double  xradius,
const cpl_vector *  yprofile,
double  yradius,
double *  pconfid 
)

Interpolate a pixel.

Parameters
sourceInterpolation source
xposPixel x floating-point position (FITS convention)
yposPixel y floating-point position (FITS convention)
xprofileInterpolation weight as a function of the distance in X
xradiusPositive inclusion radius in the X-dimension
yprofileInterpolation weight as a function of the distance in Y
yradiusPositive inclusion radius in the Y-dimension
pconfidConfidence level of the interpolated value (range 0 to 1)
Returns
The interpolated pixel value, or undefined on error
See Also
cpl_image_get()

If the X- and Y-radii are identical the area of inclusion is a circle, otherwise it is an ellipse, with the larger of the two radii as the semimajor axis and the other as the semiminor axis.

The radii are only required to be positive. However, for small radii, especially radii less than 1/sqrt(2), (xpos, ypos) may be located such that no source pixels are included in the interpolation, causing the interpolated pixel value to be undefined.

The X- and Y-profiles can be generated with cpl_vector_fill_kernel_profile(profile, radius). For profiles generated with cpl_vector_fill_kernel_profile() it is important to use the same radius both there and in cpl_image_get_interpolated().

A good profile length is CPL_KERNEL_DEF_SAMPLES, using radius CPL_KERNEL_DEF_WIDTH.

On error *pconfid is negative (unless pconfid is NULL). Otherwise, if *pconfid is zero, the interpolated pixel-value is undefined. Otherwise, if *pconfid is less than 1, the area of inclusion is close to the image border or contains rejected pixels.

The input image type can be CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE.

Here is an example of a simple image unwarping (with error-checking omitted for brevity):

const double xyradius = CPL_KERNEL_DEF_WIDTH;

cpl_vector * xyprofile = cpl_vector_new(CPL_KERNEL_DEF_SAMPLES); cpl_image * unwarped = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE);

cpl_vector_fill_kernel_profile(xyprofile, CPL_KERNEL_DEFAULT, xyradius);

for (iv = 1; iv <= ny; iv++) { for (iu = 1; iu <= nx; iu++) { double confidence; const double x = my_unwarped_x(); const double y = my_unwarped_y();

const double value = cpl_image_get_interpolated(warped, x, y, xyprofile, xyradius, xyprofile, xyradius, &confidence);

if (confidence > 0) cpl_image_set(unwarped, iu, iv, value); else cpl_image_reject(unwarped, iu, iv); } }

cpl_vector_delete(xyprofile);

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if xradius, xprofile, yprofile and yradius are not as requested
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
double cpl_image_get_mad ( const cpl_image *  image,
double *  sigma 
)

Computes median and median absolute deviation (MAD) on an image.

Parameters
imageInput image.
sigmaThe median of the absolute median deviation of the good pixels
Returns
The median of the non-bad pixels
See Also
cpl_image_get_mad_window()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
  • CPL_ERROR_DATA_NOT_FOUND if all the pixels are bad in the image
double cpl_image_get_mad_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
double *  sigma 
)

Computes median and median absolute deviation (MAD) on an image window.

Parameters
imageInput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
sigmaThe median of the absolute median deviation of the good pixels
Returns
The median of the non-bad pixels
See Also
cpl_image_get_median_window(), CPL_MATH_STD_MAD

For each non-bad pixel in the window the absolute deviation from the median is computed. The median of these absolute deviations in returned via sigma, while the median itself is returned by the function.

If the pixels are gaussian, the computed sigma is a robust and consistent estimate of the standard deviation in the sense that the standard deviation is approximately k * MAD, where k is a constant equal to approximately 1.4826. CPL defines CPL_MATH_STD_MAD as this scaling constant.

Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE. On error the _cpl_error_code_ code is set and the return value is undefined.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
  • CPL_ERROR_ILLEGAL_INPUT if the specified window is illegal
  • CPL_ERROR_DATA_NOT_FOUND if all the pixels are bad in the image window
double cpl_image_get_max ( const cpl_image *  image)

computes maximum pixel value over an image.

Parameters
imageinput image.
Returns
the maximum value
See Also
cpl_image_get_min()
double cpl_image_get_max_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

computes maximum pixel value over an image sub-window.

Parameters
imageinput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
the maximum value
See Also
cpl_image_get_min_window()
cpl_error_code cpl_image_get_maxpos ( const cpl_image *  image,
cpl_size px,
cpl_size py 
)

Computes maximum pixel value and position over an image.

Parameters
imageInput image.
pxptr to the x coordinate of the maximum position
pyptr to the y coordinate of the maximum position
Returns
CPL_ERROR_NONE or the _cpl_error_code_ on error
See Also
cpl_image_get_minpos()
cpl_error_code cpl_image_get_maxpos_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
cpl_size px,
cpl_size py 
)

Computes maximum pixel value and position over an image sub window.

Parameters
imageInput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
pxptr to the x coordinate of the maximum position
pyptr to the y coordinate of the maximum position
Returns
CPL_ERROR_NONE or the _cpl_error_code_ on error
See Also
cpl_image_get_minpos_window()
double cpl_image_get_mean ( const cpl_image *  image)

computes mean pixel value over an image.

Parameters
imageinput image.
Returns
the mean value
See Also
cpl_image_get_min()
double cpl_image_get_mean_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

computes mean pixel value over an image sub-window.

Parameters
imageinput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
the mean value
See Also
cpl_image_get_min_window()
double cpl_image_get_median ( const cpl_image *  image)

computes median pixel value over an image.

Parameters
imageInput image.
Returns
the median value
See Also
cpl_image_get_median_window()

In case of error, the _cpl_error_code_ code is set, and the returned double is undefined. Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
double cpl_image_get_median_dev ( const cpl_image *  image,
double *  sigma 
)

Computes median and mean absolute median deviation on an image window.

Parameters
imageInput image.
sigmaThe mean of the absolute median deviation of the (good) pixels
Returns
The median of the non-bad pixels
See Also
cpl_image_get_median_dev_window()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
  • CPL_ERROR_DATA_NOT_FOUND if all the pixels are bad in the image
double cpl_image_get_median_dev_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
double *  sigma 
)

Computes median and mean absolute median deviation on an image window.

Parameters
imageInput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
sigmaThe mean of the absolute median deviation of the (good) pixels
Returns
The median of the non-bad pixels
See Also
cpl_image_get_mad_window()

For each non-bad pixel in the window the absolute deviation from the median is computed. The mean of these absolute deviations in returned via sigma, while the median itself is returned by the function. The computed median and sigma may be a robust estimate of the mean and standard deviation of the pixels. The sigma is however still sensitive to outliers. See cpl_image_get_mad_window() for a more robust estimator.

Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE. On error the _cpl_error_code_ code is set and the return value is undefined.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
  • CPL_ERROR_ILLEGAL_INPUT if the specified window is illegal
  • CPL_ERROR_DATA_NOT_FOUND if all the pixels are bad in the image window
double cpl_image_get_median_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

computes median pixel value over an image sub-window.

Parameters
imageInput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
The median value, or undefined on error

The specified bounds are included in the specified region.

In case of error, the _cpl_error_code_ code is set, and the returned value is undefined. Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE.

For a finite population or sample, the median is the middle value of an odd number of values (arranged in ascending order) or any value between the two middle values of an even number of values. For an even number of elements in the array, the mean of the two central values is returned. Note that in this case, the median might not belong to the input array.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the window is outside the image or if there are only bad pixels in the window
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
double cpl_image_get_min ( const cpl_image *  image)

computes minimum pixel value over an image.

Parameters
imageinput image.
Returns
the minimum value
See Also
cpl_image_get_min_window()

In case of error, the _cpl_error_code_ code is set, and the returned double is undefined. Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
double cpl_image_get_min_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

computes minimum pixel value over an image sub-window.

Parameters
imageinput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
the minimum value, or undefined on error
See Also
cpl_stats_new_from_window()
Note
In case of error, the _cpl_error_code_ code is set.

The specified bounds are included in the specified region.

Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_image_get_minpos ( const cpl_image *  image,
cpl_size px,
cpl_size py 
)

Computes minimum pixel value and position over an image.

Parameters
imageInput image.
pxptr to the x coordinate of the minimum position
pyptr to the y coordinate of the minimum position
Returns
CPL_ERROR_NONE or the _cpl_error_code_ on error
See Also
cpl_image_get_minpos_window()

Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_image_get_minpos_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
cpl_size px,
cpl_size py 
)

Computes minimum pixel value and position over an image sub window.

Parameters
imageInput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
pxptr to the x coordinate of the minimum position
pyptr to the y coordinate of the minimum position
Returns
CPL_ERROR_NONE or the _cpl_error_code_ on error
See Also
cpl_image_get_min_window()

The specified bounds are included in the specified region.

Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_size cpl_image_get_size_x ( const cpl_image *  img)

Get the image x size.

Parameters
imga cpl_image object
Returns
The image x size, or -1 on NULL input

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_size cpl_image_get_size_y ( const cpl_image *  img)

Get the image y size.

Parameters
imga cpl_image object
Returns
The image y size, or -1 on NULL input

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
double cpl_image_get_sqflux ( const cpl_image *  image)

Computes the sum of squared values over an image.

Parameters
imageinput image.
Returns
the sqaure flux
See Also
cpl_image_get_min()
double cpl_image_get_sqflux_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Computes the sum of squared values over an image sub-window.

Parameters
imageinput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
the square flux
See Also
cpl_image_get_min_window()
double cpl_image_get_stdev ( const cpl_image *  image)

computes pixel standard deviation over an image.

Parameters
imageinput image.
Returns
the standard deviation value
See Also
cpl_image_get_min()
double cpl_image_get_stdev_window ( const cpl_image *  image,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

computes pixel standard deviation over an image sub-window.

Parameters
imageinput image.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
the standard deviation value
See Also
cpl_image_get_min_window()
cpl_type cpl_image_get_type ( const cpl_image *  img)

Get the image type.

Parameters
imga cpl_image object
Returns
The image type or CPL_TYPE_INVALID on NULL input.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_image_hypot ( cpl_image *  self,
const cpl_image *  first,
const cpl_image *  second 
)

The pixel-wise Euclidean distance function of the images.

Parameters
selfPre-allocated image to hold the result
firstFirst operand, or NULL for an in-place operation
secondSecond operand
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error

The Euclidean distance function is useful for gaussian error propagation on addition/subtraction operations.

For pixel values a and b the Euclidean distance c is defined as: $$c = sqrt{a^2 + b^2}$$

first may be NULL, in this case the distance is computed in-place on self using second as the other operand.

Images can be of type CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

If both input operands are of type CPL_TYPE_FLOAT the distance is computed in single precision (using hypotf()), otherwise in double precision (using hypot()).

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_bivector* cpl_image_iqe ( const cpl_image *  in,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Compute an image quality estimation for an object.

Parameters
inthe input image
llx
llythe zone to analyse ((1, 1) for the first pixel)
urxThe zone must be at least 4 by 4 pixels
ury
Returns
a newly allocated cpl_bivector containing the results or NULL in error case.

This function makes internal use of the iqe() MIDAS function (called here cpl_iqe()) written by P. Grosbol. Refer to the MIDAS documentation for more details. This function has proven to give good results over the years when called from RTD. The goal is to provide the exact same functionality in CPL as the one provided in RTD. The code is simply copied from the MIDAS package, it is not maintained by the CPL team.

The returned object must be deallocated with cpl_bivector_delete(). It contains in the first vector the computed values, and in the second one, the associated errors. The computed values are:

  • x position of the object
  • y position of the object
  • FWHM along the major axis
  • FWHM along the minor axis
  • the angle of the major axis with the horizontal in degrees
  • the peak value of the object
  • the background computed

The bad pixels map of the image is not taken into account. The input image must be of type float.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the specified zone is not valid or if the computation fails on this zone
  • CPL_ERROR_INVALID_TYPE if the input image has the wrong type
Note
This function may lead to a strong underestimation of the sigmas and FWHMs (up to 25% underestimation in the case of noiseless data with a box 4 times the sigma, 1% underestimation in the case of noiseless data with a box 7 times the sigma).
int cpl_image_is_rejected ( const cpl_image *  im,
cpl_size  x,
cpl_size  y 
)

Test if a pixel is good or bad.

Parameters
imthe input image
xthe x pixel position in the image (first pixel is 1)
ythe y pixel position in the image (first pixel is 1)
Returns
1 if the pixel is bad, 0 if the pixel is good, negative on error.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the image
cpl_image* cpl_image_labelise_mask_create ( const cpl_mask *  in,
cpl_size nbobjs 
)

Labelise a mask to differentiate different objects.

Parameters
inmask to labelise
nbobjsIf non-NULL, number of objects found on success
Returns
A newly allocated label image or NULL on error

This function labelises all blobs in a mask. All 4-neighbour connected zones set to 1 in the input mask will end up in the returned integer image as zones where all pixels are set to the same (unique for this blob in this image) label. A non-recursive flood-fill is applied to label the zones. The flood-fill is dimensioned by the number of lines in the image, and the maximal number of lines possibly covered by a blob. The returned image must be deallocated with cpl_image_delete()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if the input mask is NULL
cpl_image* cpl_image_load ( const char *  filename,
cpl_type  im_type,
cpl_size  pnum,
cpl_size  xtnum 
)

Load an image from a FITS file.

Parameters
filenameName of the file to load from.
im_typeType of the created image
pnumPlane number in the Data Unit (0 for first)
xtnumExtension number in the file (0 for primary HDU)
Returns
1 newly allocated image or NULL on error

This function loads an image from a FITS file (NAXIS=2 or 3).

The returned image has to be deallocated with cpl_image_delete().

The passed type for the output image can be : CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE or CPL_TYPE_INT.

This type is there to specify the type of the cpl_image that will be created by the function. It is totally independant from the way the data are stored in the FITS file. A FITS image containg float pixels can be loaded as a cpl_image of type double. In this case, the user would specify CPL_TYPE_DOUBLE as im_type.

Additionally, CPL_TYPE_UNSPECIFIED can be passed to inherit the FITS file type. The type of the image is defined based on the BITPIX information of the FITS file. After a successful call, the type of the created image can be accessed via cpl_image_get_type().

'xtnum' specifies from which extension the image should be loaded. This could be 0 for the main data section (files without extension), or any number between 1 and N, where N is the number of extensions present in the file.

The requested plane number runs from 0 to nplanes-1, where nplanes is the number of planes present in the requested data section.

The created image has an empty bad pixel map.

Examples:

// Load as a float image the only image in FITS file (a.fits) without ext.
// and NAXIS=2.
cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_FLOAT, 0, 0);
// Load as a double image the first plane in a FITS cube (a.fits) without
// extension, NAXIS=3 and NAXIS3=128
cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_DOUBLE, 0, 0);
// Load as an integer image the third plane in a FITS cube (a.fits) without
// extension, NAXIS=3 and NAXIS3=128
cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_INT, 2, 0);
// Load as a double image the first plane from extension 5
cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_DOUBLE, 0, 5);
// Load as a double image the third plane in extension 5
cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_DOUBLE, 2, 5);

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_FILE_IO if the file cannot be opened or does not exist
  • CPL_ERROR_BAD_FILE_FORMAT if the data cannot be loaded from the file
  • CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported
  • CPL_ERROR_ILLEGAL_INPUT if the passed extension number is negative
  • CPL_ERROR_DATA_NOT_FOUND if the specified extension has no image data
cpl_image* cpl_image_load_window ( const char *  filename,
cpl_type  im_type,
cpl_size  pnum,
cpl_size  xtnum,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Load an image from a FITS file.

Parameters
filenameName of the file to load from.
im_typeType of the created image
pnumPlane number in the Data Unit (0 for first)
xtnumExtension number in the file.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
1 newly allocated image or NULL on error
See Also
cpl_image_load()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_FILE_IO if the file does not exist
  • CPL_ERROR_BAD_FILE_FORMAT if the data cannot be loaded from the file
  • CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported
  • CPL_ERROR_ILLEGAL_INPUT if the passed position is invalid
cpl_error_code cpl_image_logarithm ( cpl_image *  self,
double  base 
)

Compute the elementwise logarithm of the image.

Parameters
selfImage to be modified in place.
baseBase of the logarithm.
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error

Modifies the image by computing the base-scalar logarithm of each of its pixels.

Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

Pixels for which the logarithm is not defined are rejected and set to zero.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
  • CPL_ERROR_ILLEGAL_INPUT if base is non-positive
  • CPL_ERROR_DIVISION_BY_ZERO if the base equals 1
cpl_image* cpl_image_logarithm_create ( const cpl_image *  image,
double  base 
)

Create a new image by taking the elementwise logarithm of an image.

Parameters
imageImage to take logarithm of
baseBase of the logarithm.
Returns
1 newly allocated image or NULL in case of an error
See Also
cpl_image_logarithm
cpl_image_add_scalar_create
cpl_error_code cpl_image_move ( cpl_image *  im,
cpl_size  nb_cut,
const cpl_size new_pos 
)

Reorganize the pixels in an image.

Parameters
imthe image to reorganize
nb_cutthe number of cut in x and y
new_posarray with the nb_cut^2 new positions
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

nb_cut^2 defines in how many tiles the images will be moved. Each tile will then be moved to an other place defined in new_pos. 1 will leave the image unchanged, 2 is used to move the quadrants, etc.. new_pos contains nb_cut^2 values between 1 and nb_cut^2. The zones positions are counted from the lower left part of the image. It is not allowed to move two tiles to the same position (the relation between th new tiles positions and the initial position is bijective !).

The image x and y sizes have to be multiples of nb_cut.

Example:

16   17   18           6    5    4
13   14   15           3    2    1

10   11   12   ---->  12   11   10
 7    8    9           9    8    7

 4    5    6          18   17   16
 1    2    3          15   14   13

 image 3x6            cpl_image_move(image, 3, new_pos);
                      with new_pos = {9,8,7,6,5,4,3,2,1};

The bad pixels are moved accordingly.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if nb_cut is not strictly positive or cannot divide one of the image sizes or if the new_pos array specifies to move two tiles to the same position.
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_error_code cpl_image_multiply ( cpl_image *  im1,
const cpl_image *  im2 
)

Multiply two images, store the result in the first image.

Parameters
im1first operand.
im2second operand.
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_add()
cpl_image* cpl_image_multiply_create ( const cpl_image *  image1,
const cpl_image *  image2 
)

Multiply two images.

Parameters
image1first operand
image2second operand
Returns
1 newly allocated image or NULL on error
See Also
cpl_image_add_create()
cpl_error_code cpl_image_multiply_scalar ( cpl_image *  self,
double  scalar 
)

Elementwise multiplication of an image with a scalar.

Parameters
selfImage to be modified in place.
scalarNumber to multiply with
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
See Also
cpl_image_add_scalar()
cpl_image* cpl_image_multiply_scalar_create ( const cpl_image *  image,
double  factor 
)

Create a new image by multiplication of a scalar and an image.

Parameters
imageImage to be multiplied
factorNumber to multiply with
Returns
1 newly allocated image or NULL in case of an error
See Also
cpl_image_multiply_scalar
cpl_image_add_scalar_create
cpl_image* cpl_image_new ( cpl_size  nx,
cpl_size  ny,
cpl_type  type 
)

Allocate an image structure and pixel buffer for a image.

Parameters
nxSize in x (the number of columns)
nySize in y (the number of rows)
typeThe pixel type
Returns
1 newly allocated cpl_image or NULL in case of an error

Allocates space for the cpl_image structure and sets the dimensions and type of pixel data. The pixel buffer is allocated and initialised to zero. The pixel array will contain nx*ny values being the image pixels from the lower left to the upper right line by line.

Supported pixel types are CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT_COMPLEX and CPL_TYPE_DOUBLE_COMPLEX.

The returned cpl_image must be deallocated using cpl_image_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_ILLEGAL_INPUT if nx or ny is non-positive
  • CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported
cpl_image* cpl_image_new_from_mask ( const cpl_mask *  mask)

Create an int image from a mask.

Parameters
maskthe original mask
Returns
1 newly allocated cpl_image or NULL on error

The created image is of type CPL_TYPE_INT.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_image_normalise ( cpl_image *  image,
cpl_norm  mode 
)

Normalise pixels in an image.

Parameters
imageImage operand.
modeNormalisation mode.
Returns
CPL_ERROR_NONE, or the relevant _cpl_error_code_ on error.

Normalises an image according to a given criterion.

Possible normalisations are:

  • CPL_NORM_SCALE sets the pixel interval to [0,1].
  • CPL_NORM_MEAN sets the mean value to 1.
  • CPL_NORM_FLUX sets the flux to 1.
  • CPL_NORM_ABSFLUX sets the absolute flux to 1.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_image* cpl_image_normalise_create ( const cpl_image *  image_in,
cpl_norm  mode 
)

Create a new normalised image from an existing image.

Parameters
image_inImage operand.
modeNormalisation mode.
Returns
1 newly allocated image or NULL on error
See Also
cpl_image_normalise

Stores the result in a newly allocated image and returns it. The returned image must be deallocated using cpl_image_delete().

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_image_not ( cpl_image *  self,
const cpl_image *  first 
)

The bit-wise complement (not) of an image with integer pixels.

Parameters
selfPre-allocated image to hold the result
firstFirst operand, or NULL for an in-place operation
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
Note
CPL_TYPE_INT is required
See Also
cpl_mask_not() for the equivalent logical operation

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes
  • CPL_ERROR_INVALID_TYPE if the passed image type is as required
cpl_error_code cpl_image_or ( cpl_image *  self,
const cpl_image *  first,
const cpl_image *  second 
)

The bit-wise or of two images with integer pixels.

Parameters
selfPre-allocated image to hold the result
firstFirst operand, or NULL for an in-place operation
secondSecond operand
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
Note
CPL_TYPE_INT is required
See Also
cpl_mask_or() for the equivalent logical operation

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes
  • CPL_ERROR_INVALID_TYPE if the passed image type is as required
void cpl_image_or_mask ( cpl_image *  self,
const cpl_image *  first,
const cpl_image *  second 
)

The bit-wise or of the input masks onto the output mask.

Parameters
selfPre-allocated image to hold the result
firstFirst operand, or NULL for an in-place operation
secondSecond operand
Returns
void
Note
Error checking assumed to have been performed by the caller
void cpl_image_or_mask_unary ( cpl_image *  self,
const cpl_image *  first 
)

The bit-wise or of the input mask(s) onto the output mask.

Parameters
selfPre-allocated image to hold the result
firstFirst operand, or NULL for an in-place operation
Returns
void
Note
Error checking assumed to have been performed by the caller
See Also
cpl_image_or_mask
cpl_error_code cpl_image_or_scalar ( cpl_image *  self,
const cpl_image *  first,
cpl_bitmask  second 
)

The bit-wise or of a scalar and an image with integer pixels.

Parameters
selfPre-allocated image to hold the result
firstFirst operand, or NULL for an in-place operation
secondSecond operand (scalar)
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
Note
CPL_TYPE_INT is required

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes
  • CPL_ERROR_INVALID_TYPE if the passed image type is as required
cpl_error_code cpl_image_power ( cpl_image *  self,
double  exponent 
)

Compute the elementwise power of the image.

Parameters
selfImage to be modified in place.
exponentScalar exponent.
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error

Modifies the image by lifting each of its pixels to exponent.

Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

Pixels for which the power to the given exponent is not defined are rejected and set to zero.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_image* cpl_image_power_create ( const cpl_image *  image,
double  exponent 
)

Create a new image by elementwise raising of an image to a power.

Parameters
imageImage to raise to a power
exponentscalar exponent
Returns
1 newly allocated image or NULL in case of an error
See Also
cpl_image_power
cpl_image_add_scalar_create
cpl_image* cpl_image_rebin ( const cpl_image *  image,
cpl_size  xstart,
cpl_size  ystart,
cpl_size  xstep,
cpl_size  ystep 
)

Rebin an image.

Parameters
imageThe image to rebin
xstartstart x position of binning (starting from 1...)
ystartstart y position of binning (starting from 1...)
xstepBin size in x.
ystepBin size in y.
Returns
The newly allocated rebinned image or NULL in case of error

If both bin sizes in x and y are = 2, an image with (about) a quarter of the pixels of the input image will be created. Each new pixel will be the sum of the values of all contributing input pixels. If a bin is incomplete (i.e., the input image size is not a multiple of the bin sizes), it is not computed.

xstep and ystep must not be greater than the sizes of the rebinned region.

The input image type can be CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. If the image has bad pixels, they will be propagated to the rebinned image "pessimistically", i.e., if at least one of the contributing input pixels is bad, then the corresponding output pixel will also be flagged "bad". If you need an image of "weights" for each rebinned pixel, just cast the input image bpm into a CPL_TYPE_INT image, and apply cpl_image_rebin() to it too.

The returned image must be deallocated using cpl_image_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if the input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if xstep, ystep, xstart, ystart are not positive
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_error_code cpl_image_reject ( cpl_image *  im,
cpl_size  x,
cpl_size  y 
)

Set a pixel as bad in an image.

Parameters
imthe input image
xthe x pixel position in the image (first pixel is 1)
ythe y pixel position in the image (first pixel is 1)
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the image
cpl_error_code cpl_image_reject_from_mask ( cpl_image *  im,
const cpl_mask *  map 
)

Set the bad pixels in an image as defined in a mask.

Parameters
imthe input image
mapthe mask defining the bad pixels
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

If the input image has a bad pixel map prior to the call, it is overwritten.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if the input image or the input map is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the image and the map have different sizes
cpl_error_code cpl_image_reject_value ( cpl_image *  self,
cpl_value  mode 
)

Reject pixels with the specified special value(s)

Parameters
selfInput image to modify
modeBit field specifying which special value(s) to reject

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if mode is 1, e.g. due to a logical or (||) of the allowed options or if the pixel type is complex
  • CPL_ERROR_UNSUPPORTED_MODE if mode is otherwise different from the allowed options.
cpl_error_code cpl_image_save ( const cpl_image *  self,
const char *  filename,
cpl_type  type,
const cpl_propertylist pl,
unsigned  mode 
)

Save an image to a FITS file.

Parameters
selfImage to write to disk or NULL
filenameName of the file to write to
typeThe type used to represent the data in the file
plProperty list for the output header or NULL
modeThe desired output options
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_propertylist_save()

This function saves an image to a FITS file. If a property list is provided, it is written to the header where the image is written. The image may be NULL, in this case only the propertylist is saved.

Supported image types are CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT.

The type used in the file can be one of: CPL_TYPE_UCHAR (8 bit unsigned), CPL_TYPE_SHORT (16 bit signed), CPL_TYPE_USHORT (16 bit unsigned), CPL_TYPE_INT (32 bit signed), CPL_TYPE_FLOAT (32 bit floating point), or CPL_TYPE_DOUBLE (64 bit floating point). Additionally, the special value CPL_TYPE_UNSPECIFIED is allowed. This value means that the type used for saving is the pixel type of the input image. Using the image pixel type as saving type ensures that the saving incurs no loss of information.

Supported output modes are CPL_IO_CREATE (create a new file) and CPL_IO_EXTEND (append a new extension to an existing file).

Upon success the image will reside in a FITS data unit with NAXIS = 2. Is it possible to save a single image in a FITS data unit with NAXIS = 3, see cpl_imagelist_save().

When the data written to disk are of an integer type, the output mode CPL_IO_EXTEND can be combined (via bit-wise or) with an option for tile-compression. This compression of integer data is lossless. The options are: CPL_IO_COMPRESS_GZIP, CPL_IO_COMPRESS_RICE, CPL_IO_COMPRESS_HCOMPRESS, CPL_IO_COMPRESS_PLIO. With compression the type must be CPL_TYPE_UNSPECIFIED or CPL_TYPE_INT.

Note that in append mode the file must be writable (and do not take for granted that a file is writable just because it was created by the same application, as this depends from the system umask).

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the type or the mode is not supported
  • CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported
  • CPL_ERROR_FILE_NOT_CREATED if the output file cannot be created
  • CPL_ERROR_FILE_IO if the data cannot be written to the file
cpl_error_code cpl_image_set ( cpl_image *  image,
cpl_size  xpos,
cpl_size  ypos,
double  value 
)

Set the pixel at the given position to the given value.

Parameters
imageinput image.
xposPixel x position (FITS convention, 1 for leftmost)
yposPixel y position (FITS convention, 1 for lowest)
valueNew pixel value
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT, CPL_TYPE_DOUBLE.

If the pixel is flagged as rejected, this flag is removed.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the passed position is not in the image
  • CPL_ERROR_INVALID_TYPE if the image pixel type is not supported
cpl_mask* cpl_image_set_bpm ( cpl_image *  self,
cpl_mask *  bpm 
)

Replace the bad pixel map of the image.

Parameters
selfImage to modfify
bpmBad Pixel Map (BPM) to set, replacing the old one, or NULL
Returns
A pointer to the old mask of bad pixels, or NULL
Note
NULL is returned if the image had no bad pixel map, while a non-NULL returned mask must be deallocated by the caller using cpl_mask_delete().
See Also
cpl_image_get_bpm_const()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if self is NULL
cpl_error_code cpl_image_set_complex ( cpl_image *  image,
cpl_size  xpos,
cpl_size  ypos,
double complex  value 
)

Set the pixel at the given position to the given complex value.

Parameters
imageinput image.
xposPixel x position (FITS convention, 1 for leftmost)
yposPixel y position (FITS convention, 1 for lowest)
valueNew pixel value
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_image_set()
Note
This function is available iff the application includes complex.h

Images can be CPL_TYPE_FLOAT_COMPLEX or CPL_TYPE_DOUBLE_COMPLEX.

If the pixel is flagged as rejected, this flag is removed.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the passed position is not in the image
  • CPL_ERROR_INVALID_TYPE if the image pixel type is not supported
cpl_error_code cpl_image_shift ( cpl_image *  self,
cpl_size  dx,
cpl_size  dy 
)

Shift an image by integer offsets.

Parameters
selfThe image to shift in place
dxThe shift in X
dyThe shift in Y
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

The new zones (in the result image) where no new value is computed are set to 0 and flagged as bad pixels. The shift values have to be valid: -nx < dx < nx and -ny < dy < ny

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the requested shift is bigger than the image size
cpl_error_code cpl_image_subtract ( cpl_image *  im1,
const cpl_image *  im2 
)

Subtract two images, store the result in the first image.

Parameters
im1first operand.
im2second operand.
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_add()
cpl_image* cpl_image_subtract_create ( const cpl_image *  image1,
const cpl_image *  image2 
)

Subtract two images.

Parameters
image1first operand
image2second operand
Returns
1 newly allocated image or NULL on error
See Also
cpl_image_add_create()
cpl_error_code cpl_image_subtract_scalar ( cpl_image *  self,
double  scalar 
)

Elementwise subtraction of a scalar from an image.

Parameters
selfImage to be modified in place.
scalarNumber to subtract
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
See Also
cpl_image_add_scalar()
cpl_image* cpl_image_subtract_scalar_create ( const cpl_image *  image,
double  subtrahend 
)

Create an image by elementwise subtraction of a scalar from an image.

Parameters
imageImage to be subtracted from
subtrahendNumber to subtract
Returns
1 newly allocated image or NULL in case of an error
See Also
cpl_image_subtract_scalar
cpl_image_add_scalar_create
cpl_error_code cpl_image_threshold ( cpl_image *  image_in,
double  lo_cut,
double  hi_cut,
double  assign_lo_cut,
double  assign_hi_cut 
)

Threshold an image to a given interval.

Parameters
image_inImage to threshold.
lo_cutLower bound.
hi_cutHigher bound.
assign_lo_cutValue to assign to pixels below low bound.
assign_hi_cutValue to assign to pixels above high bound.
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

Pixels outside of the provided interval are assigned the given values.

Use FLT_MIN and FLT_MAX for floating point images and DBL_MIN and DBL_MAX for double images for the lo_cut and hi_cut to avoid any pixel replacement.

Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. lo_cut must be smaller than or equal to hi_cut.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
  • CPL_ERROR_ILLEGAL_INPUT if lo_cut is greater than hi_cut
cpl_error_code cpl_image_turn ( cpl_image *  self,
int  rot 
)

Rotate an image by a multiple of 90 degrees clockwise.

Parameters
selfThe image to rotate in place.
rotThe multiple: -1 is a rotation of 90 deg counterclockwise.
Returns
CPL_ERROR_NONE on success, otherwise the relevant _cpl_error_code_
Note
The dimension of a rectangular image is changed.

Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

The definition of the rotation relies on the FITS convention: The lower left corner of the image is at (1,1), x increasing from left to right, y increasing from bottom to top.

For rotations of +90 or -90 degrees on rectangular non-1D-images, the pixel buffer is temporarily duplicated.

rot may be any integer value, its modulo 4 determines the rotation:

  • -3 to turn 270 degrees counterclockwise.
  • -2 to turn 180 degrees counterclockwise.
  • -1 to turn 90 degrees counterclockwise.
  • 0 to not turn
  • +1 to turn 90 degrees clockwise (same as -3)
  • +2 to turn 180 degrees clockwise (same as -2).
  • +3 to turn 270 degrees clockwise (same as -1).

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_mask* cpl_image_unset_bpm ( cpl_image *  self)

Remove the bad pixel map from the image.

Parameters
selfimage to process
Returns
A pointer to the cpl_mask of bad pixels, or NULL
Note
NULL is returned if the image has no bad pixel map
The returned mask must be deallocated using cpl_mask_delete().
See Also
cpl_image_set_bpm()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
void* cpl_image_unwrap ( cpl_image *  d)

Free memory associated to an cpl_image object, but the pixel buffer.

Parameters
dImage to destroy.
Returns
A pointer to the data array or NULL if the input is NULL.

Frees all memory associated to an cpl_image, except the pixel buffer. cpl_image_unwrap() is provided for images that are constructed by passing a pixel buffer to one of cpl_image_wrap_{double,float,int}().

Note
The pixel buffer must subsequently be deallocated. Failure to do so will result in a memory leak.
cpl_error_code cpl_image_warp ( cpl_image *  out,
const cpl_image *  in,
const cpl_image *  deltax,
const cpl_image *  deltay,
const cpl_vector *  xprofile,
double  xradius,
const cpl_vector *  yprofile,
double  yradius 
)

Warp an image.

Parameters
outPre-allocated destination image to hold the result
inSource image to warp
deltaxThe x shift of each pixel, same image size as out
deltayThe y shift of each pixel, same image size as out
xprofileInterpolation weight as a function of the distance in X
xradiusPositive inclusion radius in the X-dimension
yprofileInterpolation weight as a function of the distance in Y
yradiusPositive inclusion radius in the Y-dimension
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_image_get_interpolated()

The pixel value at the (integer) position (u, v) in the destination image is interpolated from the (typically non-integer) pixel position (x, y) in the source image, where

x = u - deltax(u, v),
y = v - deltay(u, v).

The identity transform is thus given by deltax and deltay filled with zeros.

The first pixel is (1, 1), located in the lower left. 'out' and 'in' may have different sizes, while deltax and deltay must have the same size as 'out'. deltax and deltay must have pixel type CPL_TYPE_DOUBLE.

Beware that extreme transformations may lead to blank images.

'out' and 'in' may be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

Examples of profiles and radius are:

xprofile = cpl_vector_new(CPL_KERNEL_DEF_SAMPLES);
cpl_vector_fill_kernel_profile(profile, CPL_KERNEL_DEFAULT,
      CPL_KERNEL_DEF_WIDTH);
xradius = CPL_KERNEL_DEF_WIDTH;

In case a correction for flux conservation were required, please create a correction map using the function cpl_image_fill_jacobian().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input images sizes are incompatible or if the delta images are not of type CPL_TYPE_DOUBLE
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_error_code cpl_image_warp_polynomial ( cpl_image *  out,
const cpl_image *  in,
const cpl_polynomial *  poly_x,
const cpl_polynomial *  poly_y,
const cpl_vector *  xprofile,
double  xradius,
const cpl_vector *  yprofile,
double  yradius 
)

Warp an image according to a 2D polynomial transformation.

Parameters
outPre-allocated image to hold the result
inImage to warp.
poly_xDefines source x-pos corresponding to destination (u,v).
poly_yDefines source y-pos corresponding to destination (u,v).
xprofileInterpolation weight as a function of the distance in X
xradiusPositive inclusion radius in the X-dimension
yprofileInterpolation weight as a function of the distance in Y
yradiusPositive inclusion radius in the Y-dimension
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_image_get_interpolated()

'out' and 'in' may have different dimensions and types.

The pair of 2D polynomials are used internally like this

x = cpl_polynomial_eval(poly_x, (u, v));
y = cpl_polynomial_eval(poly_y, (u, v));

where (u,v) are (integer) pixel positions in the destination image and (x,y) are the corresponding pixel positions (typically non-integer) in the source image.

The identity transform (poly_x(u,v) = u, poly_y(u,v) = v) would thus overwrite the 'out' image with the 'in' image, starting from the lower left if the two images are of different sizes.

Beware that extreme transformations may lead to blank images.

The input image type may be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

In case a correction for flux conservation were required, please create a correction map using the function cpl_image_fill_jacobian_polynomial().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the polynomial dimensions are not 2
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_image* cpl_image_wrap_double ( cpl_size  nx,
cpl_size  ny,
double *  pixels 
)

Create a double image using an existing pixel buffer.

Parameters
nxSize in x (the number of columns)
nySize in y (the number of rows)
pixelsdouble * pixel data
Returns
1 newly allocated cpl_image or NULL in case of an error
See Also
cpl_image_new

The pixel array is set to point to that of the argument. The pixel array must contain nx*ny doubles.

The allocated image must be deallocated with cpl_image_unwrap().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if nx or ny is non-positive or zero.
cpl_image* cpl_image_wrap_double_complex ( cpl_size  nx,
cpl_size  ny,
double complex *  pixels 
)

Create a double complex image using an existing pixel buffer.

Parameters
nxSize in x (the number of columns)
nySize in y (the number of rows)
pixelsdouble complex * pixel data.
Returns
1 newly allocated cpl_image or NULL on error
See Also
cpl_image_wrap_double()
Note
This function is available iff the application includes complex.h
cpl_image* cpl_image_wrap_float ( cpl_size  nx,
cpl_size  ny,
float *  pixels 
)

Create a float image using an existing pixel buffer.

Parameters
nxSize in x (the number of columns)
nySize in y (the number of rows)
pixelsfloat * pixel data.
Returns
1 newly allocated cpl_image or NULL on error
See Also
cpl_image_wrap_double()
cpl_image* cpl_image_wrap_float_complex ( cpl_size  nx,
cpl_size  ny,
float complex *  pixels 
)

Create a float complex image using an existing pixel buffer.

Parameters
nxSize in x (the number of columns)
nySize in y (the number of rows)
pixelsfloat complex * pixel data.
Returns
1 newly allocated cpl_image or NULL on error
See Also
cpl_image_wrap_double_complex()
cpl_image* cpl_image_wrap_int ( cpl_size  nx,
cpl_size  ny,
int *  pixels 
)

Create an integer image using an existing pixel buffer.

Parameters
nxSize in x (the number of columns)
nySize in y (the number of rows)
pixelsint * pixel data.
Returns
1 newly allocated cpl_image or NULL on error
See Also
cpl_image_wrap_double()
cpl_error_code cpl_image_xor ( cpl_image *  self,
const cpl_image *  first,
const cpl_image *  second 
)

The bit-wise xor of two images with integer pixels.

Parameters
selfPre-allocated image to hold the result
firstFirst operand, or NULL for an in-place operation
secondSecond operand
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
Note
CPL_TYPE_INT is required
See Also
cpl_mask_xor() for the equivalent logical operation

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes
  • CPL_ERROR_INVALID_TYPE if the passed image type is as required
cpl_error_code cpl_image_xor_scalar ( cpl_image *  self,
const cpl_image *  first,
cpl_bitmask  second 
)

The bit-wise xor of a scalar and an image with integer pixels.

Parameters
selfPre-allocated image to hold the result
firstFirst operand, or NULL for an in-place operation
secondSecond operand (scalar)
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
Note
CPL_TYPE_INT is required

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes
  • CPL_ERROR_INVALID_TYPE if the passed image type is as required
cpl_vector* cpl_vector_new_from_image_column ( const cpl_image *  image_in,
cpl_size  pos 
)

Extract a column from an image.

Parameters
image_inInput image
posPosition of the column (1 for the left one)
Returns
1 newly allocated cpl_vector or NULL on error

Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The returned vector must be deallocated using cpl_vector_delete().

The bad pixels map is not taken into account in this function.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if pos is not valid
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl_vector* cpl_vector_new_from_image_row ( const cpl_image *  image_in,
cpl_size  pos 
)

Extract a row from an image.

Parameters
image_inInput image
posPosition of the row (1 for the bottom one)
Returns
1 newly allocated cpl_vector or NULL on error

Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The returned vector must be deallocated using cpl_vector_delete().

The bad pixels map is not taken into account in this function.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if pos is not valid
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
cpl-6.4.1/html/form_3.png0000644000460300003120000000600212310333015012036 00000000000000‰PNG  IHDRK+_5¡æ«ýg‹‚øꟶÂXì·½àJÚåå\uá«H+€îÛŽªÆÔ¿"åôë¹µé‚Æçdó\J÷‘ rI;ÓºÉÎC&V| à/ ú¦Ž éQ§º$»¶Äóšøp •¢œ®‘„¡¢»i@I.6¶i¦.2høö®Èb,iÀœ·W€[¨úý$njKK“ž lÛwe*€Pe>,ô¾@Jì’Le¹4+™ºÖÌÇ\õ·Œ©n¿È¥¾Àãš'q›Ø[˜§Ös]÷T˜ï.ÄíO9»dvéb…¹,+©v΢ ýRcÁâøÆ5‰ô~€¢¤qiŒ^´ZžsX °ƒïà&|Õ”`=a2942¯‹z!¾OOe:q8þÊÕ±}µrr"Ǫ}¹z¿Lœk_Ü €b4Tßã’ÛéàO¸”¬¸¦]{Øt&ÇYyÔnͼXŽK4«í[',ŽtÛvk¢Ÿ©aõ èŸ×ýZ¬ÄŽs¡N»Ù¯}ĸäê=Ͼ§Sþüý2o€[<áR»¸d©¬gUFÏSs·ú«JÒ™ÖýJW3äBLtÝŽ% ±:ƒó È5õxüܘ–\´îêצ{Rê°YÝcŠÓøâˆNзíë{Ûtœ75À=žp)î|-g•¼jçkV§÷­msSW¸ÅvI˜ÞbþS¶§kB¦NÏV²Í0s<© H ¶ËËæêßòkWÞ®zšDˆËàðEª/r©äMO¸4rö‘¦ÒÂ0ôdLÍÕXkƒÙ¿‹Z¨ãldz™3]5Ú·Vš„Õ÷&o%Ëqg‘Ÿ·Ø äâÝæÔãZY;ãߟ^6ž{—ˆ Õ$˜¯‘¶ÌJÛÀ5Æ@‹uP¯VÚ¬Â×!»·6N7Mhܾ»ç¨—„ª·¶šLJ×ÊûP%TzÛ• 1D¤b¯‚wfŽ;ñ¬~=~Æö5L7ù°¹}«»ÆQuN¯ÞfwÏ™(íþnemÊUg4p‡Ê¯ÕvÝÎ>A]À%övÒ:t# ªnl-ÂØÀŒµ5‹ÂœŽÝâ­ÌÎEWë3³unÆckmí96ý؇ãÇÔUÖJ–ãuC8tÆöhÃM•ëSó®äe“ÇdöA£I$ë 5:¥Ü²\¿¶«>@SäK7ˆÊr«ørhšå·ž 6…Ø×°õž¥‹YY7}l¯õ*¿¢[ßf\Æs×ã²M¨Æ­_îæry)†ÜF_âË ŒÚwž0FB>™Ì\Ê|Èüù¥pŽînà%p¡ÍI¯Íµ•­bï£Ë›[Ë´ô¶ùçoéª+SEÛ §d…-UéÜú^ËùW ±ßUás2¿øVÚ̺ŒTÙø†ÁK©OZwb:ΛגÐ_ã’qÉ-PM%÷ZË“­ ðQNÝ:€òkz¯Ô”Kò¯©ÙÊÎĸ2±ùÀ!DŒe²QÃñ.¡Z4™_üZÙìàוI¨¶oRœG4xìëåæ#f¹ÖÄ:1̦ÿú[\ª;¹U5Vjhµ­ê£þƒ\ÚKà®Mv ÝÔÛÔ""„¸³µHªhj›SÉüžçb†ïÍ;Ë%_òü¡Z® §”]êš‹1Æü),»ÜëÆ^ÐSÕ‹™f¸¤Œ1æœrÉcà—ÞÒT_É<ƒ0?mŒ1÷8å’1ÆÜã—žå²¼ã—dpGÌ^(glÛ¶¯^~t×uÝ‚7Q3:k}–­·£©ê%é5w%yø«–¼»®ëʱ˜u†K]×u÷XÍ~Ë¥%­výÓ병Gûé›0¿ºëºîg\zÖÿ5ÃåT2¿rY¥÷ˆKÞÒ)­KÒMÛe±…¿´ã´øÒ¼«_B–©êaîÌ¿µãj#®9yÓ8õö¯í8 Þ?Ýq›v=áR[™&ëLžÞjè¹”B½ßï÷üƒ/I±F½ÄÍTõZù—n›m’åÿ§¹$ÖÐtÊϲšê¿Á¥J>¯ž¸™MÛuÁÌ¥Ö(¥Ô –œ[­ÄYΌֶ n¸¤ÅÆNѨZJHžŠ\ ;à9V ØBr÷{Ê Ö-Õg\ !fw(€N‚&óû,—~×àüޏ…þ¤˜¤¹…°Cª f²- ¹uÛ®%zù›n6€=Œøë q"mlxù^rpÛÂ&Iç‡Æò‘u¦íKç÷Q.û Æð·ûL'Ÿ 9•ð2W«_[¨.&œØH¼+"sÓeK+×^’Âø²yrrš\ã^Þït~Ÿh1†øÈ:è`rÙ»pMn2÷hÚW¹ŒE Ú]È¡74'€ä^ÖÞ¼‹3òÞÙkg6œÌäz3[]Šù¤»àì-Ó‘½>1–¢ÊH àí ?ÊeߣHÈÜÆ¸…ÈPJ&oK6Îà€þƺζò8-¹Y'\j¬í<•Ä»FÍ'{÷š[íj‡óžM àˆ<‡ÈÓ]÷r\67@Éÿ|’Ë^9É8f5¢—Ô‹MmÎðŒKÚO²ÍØo•x5Õhærò\ªe"£‡·¸˜48ãÒY¡:yüªÐ³I‘%CAˆ\õZôòÈàìÕŸä²WŽÏŸØ\ð¦ý‡I;itƒü¹/¯™¿8áR§ëÊSén4qô»v¹Tµó5¿RâªQÉ5W˜gç·Éí›õ>·RU(¨õ Bä\°—¾6çƒt§&óA.ÃŽËMlY^ä÷Ðr¸¦ÂW·“†,ªzRÿÒŒ9·¥¦<—¤!flÇ÷p¹7£OR‘`¾/W¾äUèEK‹_fR3¾Yþ ¥UŽæMÑŠ“hÇÜJBèÌ*óGýŒµˆ%Ó½þTW¹È¡ 7ÌnÅñ¹™Ò-µÉqŠÕàÚJÃóhë,÷é³[¸¶ L-¦Q‡ɤW×8A‡ÐàÎ3EŸKÍr©*÷aƒêøˆ˜ÕUså«JÞmm“ó„ËÝpÀ‘¯E!^¡„8Ϲkº#o㔋«»¥™@¼ýœxG3J  ­öÜ5õ¤ðUò•|ù–Ož#Ê‹%Pv5ª¬/Iêt9 lŒ>4s”kªÒ×£Ú÷˜bhCk›87Sx¿53îÞ¸Ê?«rs*·%ù±Ê’ê8áÚ9_¯rùñŸÚÒe.SGrL®µyAbôIG ÐY#<¢Ó󆥡*û® ½LD¢*7(75ÂÇqëIJ\êå¿û] Áëb|ÕQµy ¦M¬âr"žÏY©q/Êy·”à í²õiù½ÉŒ¢@§¹ÈTçÑñžWQÚÆðvõùŠk½H01%?¤Us¦±DU²¸f¥UHV̼FÆŒM‹7¡%À-ÄÊò8íœ_¢‰ÀR¥NWŸ©«®Q °¹_sÞ ËK `‡!²æ5{íQfzi;@§¹ˆ? ‡8íapÉŠ»P­;ãÛBn‘ТóÑ[8@«np,2iΙjõF[Æ´É¡úÜÙ¶ðŠ(ƒz´ËÏCtg\ÌPûÒ•.rQÕ‘…îПy¸TžÁв’€º­.µý5më’öÚ À)6þ|AT€ >ìŸz®›lˆ“°®:üã>Á“\TFûÇÎD%¬ø>êàŠj¼´%lÑTrKàcT%TøÅ²w²ø“0.PùšJPC°nÑo6 À/.¡ã~è¾­n€¿ómQý·Ù ðÿ¯¸áZ€E+àê—K%Pqaýüà?ÄÿÊ¿W$ZÊc IEND®B`‚cpl-6.4.1/html/ftv2splitbar.png0000644000460300003120000000047212310333014013277 00000000000000‰PNG  IHDRM¸¿IDATxíÝ¡JCa‡ñç(˜ ëƒ%±Ø4 b±È˜Í¶3˜v^Á±˜…ãó–ŽELƒõ…¥•³ ,ÿb;íç{Ã/¼ðÞÀaYÕ¯åóøq:¼º¹›\òIIIIIIIIIIIIIIIIII-Òçl¹›«õ抢è_t/Ï»ã£ÑíYQVõðêäíã÷´×ùY¬Úÿµ§¦ivók¾_íåýÛ£I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$ýC[Vì=ü[„fÆIEND®B`‚cpl-6.4.1/html/ftv2mlastnode.png0000644000460300003120000000036612310333014013447 00000000000000‰PNG  IHDRɪ|½IDATxíÝ!NAÅñ¤‡à\ ÷à Um@`Ô5iÒ`ëh ‚ÅW7] b§ÝˆŠ&oföÍd¾YÔ4 üšcø ‡€´‹Åòù3v=¼]†§µ\B… I¿‹=B·™B¡®;¸k´µ W°ÍN@vyÍÑÖ4ãß÷]ÈâYìã§|M}]ÔÚx6a }ôdׇØYüú¨>¤||5?Ó>|žB"¡î'¡IEND®B`‚cpl-6.4.1/html/nav_h.png0000644000460300003120000000014212310333014011742 00000000000000‰PNG  IHDR ,é@)IDATxíÝA @BQ­³šÛ›Ð¢Žáà) )ëý éaÅèÜ¿Æo‡RlÐßIEND®B`‚cpl-6.4.1/html/group__cpl__wcs.html0000644000460300003120000010527512310333015014211 00000000000000 Common Pipeline Library Reference Manual: World Coordinate System
Common Pipeline Library Reference Manual  6.4.1
World Coordinate System

Macros

#define CPL_WCS_REGEXP
 A regular expression that matches the FITS keys used for WCS.
 

Functions

cpl_error_code cpl_wcs_convert (const cpl_wcs *wcs, const cpl_matrix *from, cpl_matrix **to, cpl_array **status, cpl_wcs_trans_mode transform)
 Convert between physical and world coordinates.
 
void cpl_wcs_delete (cpl_wcs *wcs)
 Destroy a WCS structure.
 
const cpl_matrix * cpl_wcs_get_cd (const cpl_wcs *wcs)
 Accessor to get the CD matrix for a WCS.
 
const cpl_array * cpl_wcs_get_crpix (const cpl_wcs *wcs)
 Accessor to get the CRPIX vector for a WCS.
 
const cpl_array * cpl_wcs_get_crval (const cpl_wcs *wcs)
 Accessor to get the CRVAL vector for a WCS.
 
const cpl_array * cpl_wcs_get_ctype (const cpl_wcs *wcs)
 Accessor to get the CTYPE vector for a WCS.
 
const cpl_array * cpl_wcs_get_cunit (const cpl_wcs *wcs)
 Accessor to get the CUNIT vector for a WCS.
 
const cpl_array * cpl_wcs_get_image_dims (const cpl_wcs *wcs)
 Accessor to get the axis lengths of the image associated with a WCS.
 
int cpl_wcs_get_image_naxis (const cpl_wcs *wcs)
 Accessor to get the dimensionality of the image associated with a WCS.
 
cpl_wcs * cpl_wcs_new_from_propertylist (const cpl_propertylist *plist)
 Create a wcs structure by parsing a propertylist.
 
cpl_error_code cpl_wcs_platesol (const cpl_propertylist *ilist, const cpl_matrix *cel, const cpl_matrix *xy, int niter, float thresh, cpl_wcs_platesol_fitmode fitmode, cpl_wcs_platesol_outmode outmode, cpl_propertylist **olist)
 Do a 2d plate solution given physical and celestial coordinates.
 

Detailed Description

This module provides functions to manipulate FITS World Coordinate Systems

A cpl_wcs is an object containing a pointer to the WCSLIB structure and the physical dimensions of the image from which the WCS was read. The functionality provided includes general transformations between physical and world coordinates as well as a few convenience routines for x,y <=> RA,Dec transformations.

Synopsis:
#include "cpl_wcs.h"

Macro Definition Documentation

#define CPL_WCS_REGEXP

A regular expression that matches the FITS keys used for WCS.

Function Documentation

cpl_error_code cpl_wcs_convert ( const cpl_wcs *  wcs,
const cpl_matrix *  from,
cpl_matrix **  to,
cpl_array **  status,
cpl_wcs_trans_mode  transform 
)

Convert between physical and world coordinates.

Parameters
wcsThe input cpl_wcs structure
fromThe input coordinate matrix
toThe output coordinate matrix
statusThe output status array
transformThe transformation mode
Returns
An appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter wcs, from, to or status is a NULL pointer or wcs is missing some of its information.
CPL_ERROR_UNSPECIFIED No rows or columns in the input matrix, or an unspecified error has occurred in the WCSLIB routine
CPL_ERROR_UNSUPPORTED_MODE The input conversion mode is not supported
CPL_ERROR_NO_WCS The WCS sub library is not available.

This function converts between several types of coordinates. These include: – physical coordinates: The physical location on a detector (i.e. pixel coordinates) – world coordinates: The real astronomical coordinate system for the observations. This may be spectral, celestial, time, etc. – standard coordinates: These are an intermediate relative coordinate representation, defined as a distance from a reference point in the natural units of the world coordinate system. Any defined projection geometry will have already been included in the definition of standard coordinates.

The supported conversion modes are: – CPL_WCS_PHYS2WORLD: Converts input physical to world coordinates – CPL_WCS_WORLD2PHYS: Converts input world to physical coordinates – CPL_WCS_WORLD2STD: Converts input world to standard coordinates – CPL_WCS_PHYS2STD: Converts input physical to standard coordinates

The input cpl_matrix from has to be filled with coordinates. The number of rows equals the number of objects and the number of columns has to be equal to the value of the NAXIS keyword in the wcs structure. The same convention is used for the output cpl_matrix to. For example, if an image contains NAXIS = 2 and 100 stars with positions X,Y, the new matrix will be created:

from = cpl_matrix_new(100, 2);

Each element in column 0 will take a X coordinate and each element in column 1 will take a Y coordinate.

The output matrix and status arrays will be allocated here, and thus will need to be freed by the calling routine. The status array is used to flag input coordinates where there has been some sort of failure in the transformation.

void cpl_wcs_delete ( cpl_wcs *  wcs)

Destroy a WCS structure.

Parameters
wcsThe WCS structure to destroy
Returns
Nothing.
Errors
CPL_ERROR_NO_WCS The WCS sub library is not available.

The function destroys the WCS structure wcs and its whole contents. If wcs is NULL, nothing is done and no error is set.

const cpl_matrix* cpl_wcs_get_cd ( const cpl_wcs *  wcs)

Accessor to get the CD matrix for a WCS.

Parameters
wcsThe WCS structure to examine
Returns
A handle to a matrix with the CDi_ja linear transformation matrix, or NULL on error.
Errors
CPL_ERROR_NULL_INPUT The parameter wcs is a NULL pointer.
CPL_ERROR_NO_WCS The WCS sub library is not available.

The function returns a handle to a matrix with the CD matrix defined for this WCS.

const cpl_array* cpl_wcs_get_crpix ( const cpl_wcs *  wcs)

Accessor to get the CRPIX vector for a WCS.

Parameters
wcsThe WCS structure to examine
Returns
A handle to an array with the CRPIXja keyvalues for each pixel axis, or NULL on error.
Errors
CPL_ERROR_NULL_INPUT The parameter wcs is a NULL pointer.
CPL_ERROR_NO_WCS The WCS sub library is not available.

The function returns a handle to an array with the CRPIX vector defined for this WCS.

const cpl_array* cpl_wcs_get_crval ( const cpl_wcs *  wcs)

Accessor to get the CRVAL vector for a WCS.

Parameters
wcsThe WCS structure to examine
Returns
A handle to an array with the CRVALia keyvalues for each coord axis, or NULL on error.
Errors
CPL_ERROR_NULL_INPUT The parameter wcs is a NULL pointer.
CPL_ERROR_NO_WCS The WCS sub library is not available.

The function returns a handle to an array with the CRVAL vector defined for this WCS.

const cpl_array* cpl_wcs_get_ctype ( const cpl_wcs *  wcs)

Accessor to get the CTYPE vector for a WCS.

Parameters
wcsThe WCS structure to examine
Returns
A handle to an array with the CTYPEja keyvalues for each pixel axis, or NULL on error.
Errors
CPL_ERROR_NULL_INPUT The parameter wcs is a NULL pointer.
CPL_ERROR_NO_WCS The WCS sub library is not available.

The function returns a handle to an array with the CTYPE vector defined for this WCS.

const cpl_array* cpl_wcs_get_cunit ( const cpl_wcs *  wcs)

Accessor to get the CUNIT vector for a WCS.

Parameters
wcsThe WCS structure to examine
Returns
A handle to an array with the CUNITja keyvalues for each pixel axis, or NULL on error.
Errors
CPL_ERROR_NULL_INPUT The parameter wcs is a NULL pointer.
CPL_ERROR_NO_WCS The WCS sub library is not available.

The function returns a handle to an array with the CUNIT vector defined for this WCS.

const cpl_array* cpl_wcs_get_image_dims ( const cpl_wcs *  wcs)

Accessor to get the axis lengths of the image associated with a WCS.

Parameters
wcsThe WCS structure to examine
Returns
An array with the image axis sizes, or NULL on error.
Errors
CPL_ERROR_NULL_INPUT The parameter wcs is a NULL pointer.
CPL_ERROR_NO_WCS The WCS sub library is not available.

The function returns a handle to an array with the axis lengths of the image associated with this WCS. If no image was used to define the WCS then a NULL value will be returned.

int cpl_wcs_get_image_naxis ( const cpl_wcs *  wcs)

Accessor to get the dimensionality of the image associated with a WCS.

Parameters
wcsThe WCS structure to examine
Returns
The image dimensionality, or zero on error
Errors
CPL_ERROR_NULL_INPUT The parameter wcs is a NULL pointer.
CPL_ERROR_NO_WCS The WCS sub library is not available.

The function returns the dimensionality of the image associated with a WCS. If no image was used to define the WCS then a value of zero is returned.

cpl_wcs* cpl_wcs_new_from_propertylist ( const cpl_propertylist plist)

Create a wcs structure by parsing a propertylist.

Parameters
plistThe input propertylist
Returns
The newly created and filled cpl_wcs object or NULL if it could not be created. In the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter plist is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH NAXIS information in image propertylist is not an integer
CPL_ERROR_DATA_NOT_FOUND Error in getting NAXIS information for image propertylists
CPL_ERROR_UNSPECIFIED An unspecified error occurred in the WCSLIB routine.
CPL_ERROR_NO_WCS The WCS sub library is not available.

The function allocates memory for a WCS structure. A pointer to the WCSLIB header information is created by parsing the FITS WCS keywords from the header of a file. A few ancillary items are also filled in.

It is allowed to pass a cpl_propertylist with a valid WCS structure and NAXIS = 0, such a propertylist can be created by cpl_wcs_platesol(). In this case a cpl_wcs object is returned for which the dimensional information (accessible via cpl_wcs_get_image_dims()) will be NULL.

The returned property must be destroyed using the wcs destructor cpl_wcs_delete().

See Also
cpl_wcs_delete()
cpl_error_code cpl_wcs_platesol ( const cpl_propertylist ilist,
const cpl_matrix *  cel,
const cpl_matrix *  xy,
int  niter,
float  thresh,
cpl_wcs_platesol_fitmode  fitmode,
cpl_wcs_platesol_outmode  outmode,
cpl_propertylist **  olist 
)

Do a 2d plate solution given physical and celestial coordinates.

Parameters
ilistThe input property list containing the first pass WCS
celThe celestial coordinate matrix
xyThe physical coordinate matrix
niterThe number of fitting iterations
threshThe threshold for the fitting rejection cycle
fitmodeThe fitting mode (see below)
outmodeThe output mode (see below)
olistThe output property list containing the new WCS
Returns
An appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter cel is a NULL pointer, the parameter xy is a NULL pointer or ilist is a NULL pointer. CPL_ERROR_ILLEGAL_INPUT The parameter niter is non-positive.
CPL_ERROR_UNSPECIFIED Unable to parse the input propertylist into a proper FITS WCS or there are too few points in the input matrices for a fit.
CPL_ERROR_INCOMPATIBLE_INPUT The matrices cel and xy have different sizes.
CPL_ERROR_UNSUPPORTED_MODE Either fitmode or outmode are specified incorrectly
CPL_ERROR_DATA_NOT_FOUND The threshold is so low that no valid points are found. If the threshold is not positive, this error is certain to occur.
CPL_ERROR_NO_WCS The WCS sub library is not available.

This function allows for the following type of fits: – CPL_WCS_PLATESOL_4: Fit for zero point, 1 scale and 1 rotation. – CPL_WCS_PLATESOL_6: Fit for zero point, 2 scales, 1 rotation, 1 shear.

This function allows the zeropoint to be defined by shifting either the physical or the celestial coordinates of the reference point: – CPL_WCS_MV_CRVAL: Keeps the physical point fixed and shifts the celestial – CPL_WCS_MV_CRPIX: Keeps the celestial point fixed and shifts the physical

The output property list contains WCS relevant information only.

The matrices cel, and xy have to be set up in the same way as it is required for cpl_wcs_convert(). See the documentation of cpl_wcs_convert() for details.

See Also
cpl_wcs_convert()
cpl-6.4.1/html/struct__cpl__framedata__-members.html0000644000460300003120000000601612310333015017450 00000000000000 Common Pipeline Library Reference Manual: Member List
Common Pipeline Library Reference Manual  6.4.1
_cpl_framedata_ Member List

This is the complete list of members for _cpl_framedata_, including all inherited members.

max_count_cpl_framedata_
min_count_cpl_framedata_
tag_cpl_framedata_
cpl-6.4.1/html/form_11.png0000644000460300003120000000044712310333017012126 00000000000000‰PNG  IHDR"D+]V0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ï–IDATxí]à ƒ?Â?âþ·]¨­&µo{´bZã€OðO&€wVð%9€†Œ òxÑ¨ÉØ®’bÖªÒ¦ÿH¤¦–ŽäµS‡¶Ñ[màãü¦&†¾v.-عBžuË¿.pÕGŸ1ÿ‰­Y× Ü+VJ;ç´ÑûžtKTsñól´ñO¹´·PÏÜ^(+Œ/ÈÎÒ/±eIEND®B`‚cpl-6.4.1/html/group__cpl__memory.html0000644000460300003120000005236412310333014014724 00000000000000 Common Pipeline Library Reference Manual: Memory Management Utilities
Common Pipeline Library Reference Manual  6.4.1
Memory Management Utilities

Functions

void * cpl_calloc (size_t natoms, size_t nbytes)
 Allocate memory for natoms elements of size size.
 
void cpl_free (void *memblk)
 Memory block deallocation.
 
void * cpl_malloc (size_t nbytes)
 Allocate nbytes bytes.
 
void cpl_memory_dump (void)
 Display the memory status.
 
int cpl_memory_is_empty (void)
 Tell if there is some memory allocated.
 
void * cpl_realloc (void *memblk, size_t nbytes)
 Change the size of a memory block.
 
char * cpl_sprintf (const char *format,...)
 Create a string and fill it in an sprintf()-like manner.
 
char * cpl_strdup (const char *string)
 Duplicate a string.
 
char * cpl_vsprintf (const char *format, va_list arglist)
 Create a string and fill it in an vsprintf()-like manner.
 

Detailed Description

This module provides the CPL memory management utilities.

Function Documentation

void* cpl_calloc ( size_t  natoms,
size_t  nbytes 
)

Allocate memory for natoms elements of size size.

Parameters
natomsNumber of atomic elements.
nbytesElement size in bytes.
Returns
Pointer to the allocated memory block.

The function allocates memory suitable for storage of natoms elements of size nbytes bytes. The allocated memory is cleared, i.e. the value 0 is written to each single byte.

Note
If the memory subsytem has not been initialised before calling this function, the program execution is stopped printing a message to the error channel showing the current code position.
void cpl_free ( void *  memblk)

Memory block deallocation.

Returns
Nothing.

Deallocates a memory block previously allocated by any of the CPL allocator functions.

See Also
cpl_malloc(), cpl_calloc()
void* cpl_malloc ( size_t  nbytes)

Allocate nbytes bytes.

Parameters
nbytesNumber of bytes.
Returns
Pointer to the allocated memory block.

The function allocates nbytes bytes of memory. The allocated memory is not cleared.

Note
If the memory subsytem has not been initialised before calling this function, the program execution is stopped printing a message to the error channel showing the current code position.
void cpl_memory_dump ( void  )

Display the memory status.

int cpl_memory_is_empty ( void  )

Tell if there is some memory allocated.

Returns
-1 if the model is off, 1 if it is empty, 0 otherwise
void* cpl_realloc ( void *  memblk,
size_t  nbytes 
)

Change the size of a memory block.

Parameters
memblkPointer to the memory to re-allocate.
nbytesNew memory block size in bytes.
Returns
Pointer to the allocated memory block.

The function changes the size of an already allocated memory block memblk to the new size nbytes bytes. The contents is unchanged to the minimum of old and new size; newly allocated memory is not initialized. If memblk is NULL the call to cpl_realloc() is equivalent to cpl_malloc(), and if nbytes is 0 the call is equivalent to cpl_free(). Unless memblk is NULL, it must have been returned by a previous call to cpl_malloc(), cpl_calloc(), or cpl_realloc().

Note
  • The returned memory block returned on successfull allocation may not be the same as the one pointed to by memblk. Existing references pointing to locations within the original memory block might be invalidated!
  • If the memory subsytem has not been initialised before calling this function, the program execution is stopped printing a message to the error channel showing the current code position.
See Also
cpl_malloc(), cpl_calloc()
char* cpl_sprintf ( const char *  format,
  ... 
)

Create a string and fill it in an sprintf()-like manner.

Parameters
formatThe format string
...Variable argument list for format
Returns
The created string or NULL on error
Note
The created string must be deallocated with cpl_free()
See Also
cpl_vsprintf()

The allocated memory is exactly what is needed to hold the string.

Errors
CPL_ERROR_NULL_INPUT The format string is NULL.
CPL_ERROR_ILLEGAL_INPUT The format string has an invalid format.

Example of usage:

int error;
char * cp_cmd = cpl_sprintf("cp %s %s/%s", long_file, new_dir,
new_file);
assert( cp_cmd != NULL);
error = system(cp_cmd);
assert(!error);
cpl_free(cp_cmd);
char* cpl_strdup ( const char *  string)

Duplicate a string.

Parameters
stringString to be duplicated.
Returns
Newly allocated copy of the original string.

Duplicates the input string string. The newly allocated copy returned to the caller can be deallocated using cpl_free().

See Also
cpl_free()
char* cpl_vsprintf ( const char *  format,
va_list  arglist 
)

Create a string and fill it in an vsprintf()-like manner.

Parameters
formatThe format string
arglistThe argument list for the format
Returns
The created string or NULL on error
Note
The created string must be deallocated with cpl_free()
See Also
vsprintf()

The allocated memory is exactly what is needed to hold the string.

Errors
CPL_ERROR_NULL_INPUT The format string is NULL.
CPL_ERROR_ILLEGAL_INPUT The format string has an invalid format.
cpl-6.4.1/html/form_22.png0000644000460300003120000000033012310333020012111 00000000000000‰PNG  IHDR ³Ÿõ0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïGIDATxíÛ €0 ÄœW‹D(ûoKT â‹ ¬Ë‡ï2Àÿ¹ q[È€AœKcÇ*“4¶•I}¥âºô¨FÞ‘ÖÜ{<ã— DòÓRÕ–IEND®B`‚cpl-6.4.1/html/group__cpl__frameset__iterator.html0000644000460300003120000006654212310333015017276 00000000000000 Common Pipeline Library Reference Manual: Frame Set Iterators
Common Pipeline Library Reference Manual  6.4.1
Frame Set Iterators

Iterator support for frame sets. More...

Typedefs

typedef struct
_cpl_frameset_iterator_ 
cpl_frameset_iterator
 The frame set iterator data type.
 

Functions

cpl_error_code cpl_frameset_iterator_advance (cpl_frameset_iterator *self, int distance)
 Advance an iterator by a number of elements.
 
cpl_error_code cpl_frameset_iterator_assign (cpl_frameset_iterator *self, const cpl_frameset_iterator *other)
 Assign a frame set iterator to another.
 
void cpl_frameset_iterator_delete (cpl_frameset_iterator *self)
 Destroy a frame set iterator.
 
int cpl_frameset_iterator_distance (const cpl_frameset_iterator *self, const cpl_frameset_iterator *other)
 Calculate the distance between two iterators.
 
cpl_frameset_iteratorcpl_frameset_iterator_duplicate (const cpl_frameset_iterator *other)
 Create a frame set iterator from an existing frame set iterator.
 
cpl_framecpl_frameset_iterator_get (cpl_frameset_iterator *self)
 Get the frame from the frame set at the current position of the iterator.
 
const cpl_framecpl_frameset_iterator_get_const (const cpl_frameset_iterator *self)
 Get the frame from the frame set at the current position of the iterator.
 
cpl_frameset_iteratorcpl_frameset_iterator_new (const cpl_frameset *parent)
 Create a new frame set iterator.
 
void cpl_frameset_iterator_reset (cpl_frameset_iterator *self)
 Reset a frame set iterator to the beginning of a frame set.
 

Detailed Description

Iterator support for frame sets.

Frame set iterators allow to access the contents of a frame set sequentially, in an ordered manner. An iterator is created for a particular frame set, and it stays bound to that frame set until it is destroyed. However multiple iterators can be defined for the same frame set.

By default, the order of frames in a frame set is the order in which the individual frames have been inserted. However, a particular sorting order can be defined by sorting the frame set using a custom comparison function for frames.

Frame set iterators are supposed to be short-lived objects, and it is not recommended to use them for keeping, or passing around references to the frame set contents. In particular, changing the contents of the underlying frame set by erasing, or inserting frames may invalidate all existing iterators.

Typedef Documentation

typedef struct _cpl_frameset_iterator_ cpl_frameset_iterator

The frame set iterator data type.

This data type is opaque.

Function Documentation

cpl_error_code cpl_frameset_iterator_advance ( cpl_frameset_iterator self,
int  distance 
)

Advance an iterator by a number of elements.

Parameters
selfThe frame set iterator to reposition.
distanceThe of number of elements by which the iterator is moved.
Returns
The function returns CPL_ERROR_NONE on success, or an appropriate CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The given iterator offset would move the iterator beyond the beginning or the end of the frame set.

The functions moves the iterator by distance number of elements, with respect to its current position. The number of elements distance may be negative or positive, and the iterator position will move backward and forward respectively.

It is an error if the given distance would move the iterator either past the one-before-the-beginning position or the one-past-the-end position of the underlying frame set. In this case the iterator is not repositioned and an out of range error is returned.

cpl_error_code cpl_frameset_iterator_assign ( cpl_frameset_iterator self,
const cpl_frameset_iterator other 
)

Assign a frame set iterator to another.

Parameters
selfThe frame set iterator to assign to.
otherThe frame set iterator to be assigned.
Returns
The function returns CPL_ERROR_NONE on success, or an appropriate CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameters self or other is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameters self and other are not bound to the same frame set.

The function assigns the iterator other to the iterator self. Only iterators which are bound to the same frame set can be assigned to each other!

void cpl_frameset_iterator_delete ( cpl_frameset_iterator self)

Destroy a frame set iterator.

Parameters
selfThe frame set to destroy.
Returns
Nothing.

The function destroys the frame set iterator object self. If self is NULL, no operation is performed.

int cpl_frameset_iterator_distance ( const cpl_frameset_iterator self,
const cpl_frameset_iterator other 
)

Calculate the distance between two iterators.

Parameters
selfFirst frame set iterator.
otherSecond frame set iterator.
Returns
The function returns the distance between the two input iterators. If an error occurs, the function returns a distance of 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or other is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The two iterators iterators are not bound to the same frame set.
CPL_ERROR_DATA_NOT_FOUND At least one input iterator is invalid.

The function calculates the distance between the iterators self and other.

To properly detect whether this function has failed or not it is recommended to reset the errors before it is called, since the returned value is not a distinctive feature.

cpl_frameset_iterator* cpl_frameset_iterator_duplicate ( const cpl_frameset_iterator other)

Create a frame set iterator from an existing frame set iterator.

Parameters
otherThe frame set iterator to clone.
Returns
A copy of the frame set iterator other on success, or NULL otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter other is a NULL pointer.

The function creates a copy of the iterator object other. An iterator copy constructed by this function is bound to the same frame set other has been constructed for, and it points to the same frame that other points to.

cpl_frame* cpl_frameset_iterator_get ( cpl_frameset_iterator self)

Get the frame from the frame set at the current position of the iterator.

Parameters
selfThe frame set iterator to dereference.
Returns
The frame stored in the frame set at the position of the iterator, or NULL if an error occurs. The function also returns if the iterator is positioned at the sentinel element (i.e. the one-before-the-beginning or one-past-the-end position).
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function dereferences the iterator self, i.e. it retrieves the frame at the position pointed to by self.

const cpl_frame* cpl_frameset_iterator_get_const ( const cpl_frameset_iterator self)

Get the frame from the frame set at the current position of the iterator.

Parameters
selfThe frame set iterator to dereference.
Returns
The frame stored in the frame set at the position of the iterator, or NULL if an error occurs.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function dereferences the iterator self, i.e. it retrieves the frame at the position pointed to by self.

cpl_frameset_iterator* cpl_frameset_iterator_new ( const cpl_frameset parent)

Create a new frame set iterator.

Parameters
parentThe frame set for which the iterator is created.
Returns
The newly allocated frame set iterator object, or NULL if an error occurred.
Errors
CPL_ERROR_NULL_INPUT The parameter parent is a NULL pointer.

The function creates a new iterator object bound to the frame set parent. The iterator is initialized such that it points to the beginning of parent.

The beginning is defined by the current ordering defined for the frame set parent.

See Also
cpl_frameset_sort()
void cpl_frameset_iterator_reset ( cpl_frameset_iterator self)

Reset a frame set iterator to the beginning of a frame set.

Parameters
selfThe iterator to reposition.
Returns
Nothing.

The function moves the frame set iterator self back to the beginning of its underlying frame set. The first frame in the frame set is defined by the established sorting order.

See Also
cpl_frameset_sort()
cpl-6.4.1/html/pages.html0000644000460300003120000000433212310333020012130 00000000000000 Common Pipeline Library Reference Manual: Related Pages
Common Pipeline Library Reference Manual  6.4.1
Related Pages
Here is a list of all related documentation pages:
cpl-6.4.1/html/group__cpl__test.html0000644000460300003120000026314512310333015014375 00000000000000 Common Pipeline Library Reference Manual: Unit testing functions
Common Pipeline Library Reference Manual  6.4.1
Unit testing functions

Macros

#define cpl_test(bool)
 Evaluate an expression and increment an internal counter if zero.
 
#define cpl_test_abs(first, second, tolerance)
 Test if two numerical expressions are within a given absolute tolerance.
 
#define cpl_test_array_abs(first, second, tolerance)
 Test if two numerical arrays are identical within a given (absolute) tolerance.
 
#define cpl_test_assert(bool)
 Evaluate an expression and return if it fails.
 
#define cpl_test_eq(first, second)
 Test if two integer expressions are equal.
 
#define cpl_test_eq_error(first, second)
 Test if two error expressions are equal and reset the CPL error code.
 
#define cpl_test_eq_mask(first, second)
 Test if two CPL masks are equal.
 
#define cpl_test_eq_ptr(first, second)
 Test if two pointer expressions are equal.
 
#define cpl_test_eq_string(first, second)
 Test if two strings are equal.
 
#define cpl_test_error(error)
 Test and reset the CPL error code.
 
#define cpl_test_errorstate(errorstate)
 Test and if necessary reset the CPL errorstate.
 
#define cpl_test_fits(fitsfile)
 Test if a file is valid FITS using an external verification utility.
 
#define cpl_test_image_abs(first, second, tolerance)
 Test if two images are identical within a given (absolute) tolerance.
 
#define cpl_test_image_rel(first, second, tolerance)
 Test if two images are identical within a given (relative) tolerance.
 
#define cpl_test_imagelist_abs(first, second, tolerance)
 Test if two imagelists are identical within a given (absolute) tolerance.
 
#define cpl_test_init(REPORT, LEVEL)
 Initialize CPL + CPL messaging + unit test.
 
#define cpl_test_leq(value, tolerance)
 Evaluate A <= B and increment an internal counter if it is not true.
 
#define cpl_test_lt(value, tolerance)
 Evaluate A < B and increment an internal counter if it is not true.
 
#define cpl_test_matrix_abs(first, second, tolerance)
 Test if two matrices are identical within a given (absolute) tolerance.
 
#define cpl_test_memory_is_empty()
 Test if the memory system is empty.
 
#define cpl_test_noneq(first, second)
 Test if two integer expressions are not equal.
 
#define cpl_test_noneq_ptr(first, second)
 Test if two pointer expressions are not equal.
 
#define cpl_test_noneq_string(first, second)
 Test if two strings are not equal.
 
#define cpl_test_nonnull(pointer)
 Test if a pointer is non-NULL.
 
#define cpl_test_null(pointer)
 Test if a pointer is NULL and update an internal counter on failure.
 
#define cpl_test_polynomial_abs(first, second, tolerance)
 Test if two polynomials are identical within a given (absolute) tolerance.
 
#define cpl_test_rel(first, second, tolerance)
 Test if two numerical expressions are within a given relative tolerance.
 
#define cpl_test_vector_abs(first, second, tolerance)
 Test if two vectors are identical within a given (absolute) tolerance.
 
#define cpl_test_zero(zero)
 Evaluate an expression and increment an internal counter if non-zero.
 

Functions

int cpl_test_end (cpl_size nfail)
 Finalize CPL and unit-testing environment and report any failures.
 
size_t cpl_test_get_bytes_image (const cpl_image *self)
 Get the amount of storage [bytes] for the CPL object.
 
size_t cpl_test_get_bytes_imagelist (const cpl_imagelist *self)
 Get the amount of storage [bytes] for the CPL object.
 
size_t cpl_test_get_bytes_matrix (const cpl_matrix *self)
 Get the amount of storage [bytes] for the CPL object.
 
size_t cpl_test_get_bytes_vector (const cpl_vector *self)
 Get the amount of storage [bytes] for the CPL object.
 
cpl_size cpl_test_get_failed (void)
 Get the number of failed CPL tests.
 
cpl_size cpl_test_get_tested (void)
 Get the number of CPL tests performed.
 
double cpl_test_get_walltime (void)
 Get the process wall-clock time, when available.
 

Detailed Description

This module provides various functions for unit testing.

Synopsis:
#include "cpl_test.h"

Macro Definition Documentation

#define cpl_test (   bool)

Evaluate an expression and increment an internal counter if zero.

Parameters
boolThe expression to evaluate, side-effects are allowed
Note
A zero value of the expression is a failure, other values are not
Returns
void
See Also
cpl_test_init()
Note
This macro should be used for unit tests

Example of usage:

cpl_test(myfunc()); // myfunc() is expected to return non-zero
#define cpl_test_abs (   first,
  second,
  tolerance 
)

Test if two numerical expressions are within a given absolute tolerance.

Parameters
firstThe first value in the comparison, side-effects are allowed
secondThe second value in the comparison, side-effects are allowed
toleranceA non-negative tolerance
Note
If the tolerance is negative, the test will always fail
See Also
cpl_test()

Example of usage:

cpl_test_abs(computed, expected, DBL_EPSILON);
#define cpl_test_array_abs (   first,
  second,
  tolerance 
)

Test if two numerical arrays are identical within a given (absolute) tolerance.

Parameters
firstThe first array in the comparison
secondThe second array of identical size in the comparison
toleranceA non-negative tolerance
Returns
void
See Also
cpl_test_abs()
Note
The test will fail if one or both the arrays are NULL or of a non-numerical type
#define cpl_test_assert (   bool)

Evaluate an expression and return if it fails.

Parameters
boolThe (boolean) expression to evaluate, side-effects are allowed
Note
A zero value of the expression is a failure, other values are not
Returns
void
See Also
cpl_test()
Note
This macro should be used for unit tests that cannot continue after a failure.

Example of usage:

int main (void)
{
cpl_test_init(CPL_MSG_WARNING);
cpl_test(myfunc(&p));
cpl_test_assert(p != NULL);
cpl_test(*p);
return cpl_test_end(0);
}
#define cpl_test_eq (   first,
  second 
)

Test if two integer expressions are equal.

Parameters
firstThe first value in the comparison, side-effects are allowed
secondThe second value in the comparison, side-effects are allowed
See Also
cpl_test()
Returns
void

Example of usage:

cpl_test_eq(computed, expected);

For comparison of floating point values, see cpl_test_abs() and cpl_test_rel().

#define cpl_test_eq_error (   first,
  second 
)

Test if two error expressions are equal and reset the CPL error code.

Parameters
firstThe first value in the comparison
secondThe second value in the comparison
See Also
cpl_test_error
Note
If the two CPL error expressions are equal they will also be tested against the current CPL error code. After the test(s), the CPL errorstate is reset.

Example of usage:

cpl_error_code error = my_func(NULL);
// my_func(NULL) is expected to return CPL_ERROR_NULL_INPUT
// and to set the same error code
// The errorstate has been reset.
error = my_func(p); // Successful call
#define cpl_test_eq_mask (   first,
  second 
)

Test if two CPL masks are equal.

Parameters
firstThe first mask or NULL of the comparison
secondThe second mask or NULL of the comparison
Note
One or two NULL pointer(s) is considered a failure.

Example of usage:

cpl_test_eq_mask(computed, expected);
#define cpl_test_eq_ptr (   first,
  second 
)

Test if two pointer expressions are equal.

Parameters
firstThe first value in the comparison, side-effects are allowed
secondThe second value in the comparison, side-effects are allowed
See Also
cpl_test_eq()
Returns
void

Example of usage:

cpl_test_eq_ptr(computed, expected);
#define cpl_test_eq_string (   first,
  second 
)

Test if two strings are equal.

Parameters
firstThe first string or NULL of the comparison
secondThe second string or NULL of the comparison
Note
One or two NULL pointer(s) is considered a failure.

Example of usage:

cpl_test_eq_string(computed, expected);
#define cpl_test_error (   error)

Test and reset the CPL error code.

Parameters
errorThe expected CPL error code (incl. CPL_ERROR_NONE)
See Also
cpl_test()
Note
After the test, the CPL errorstate is reset
Returns
void

Example of usage:

cpl_test( my_func(NULL) ); // my_func(NULL) is expected to return non-zero
cpl_test_error(CPL_ERROR_NULL_INPUT); // ... and to set this error code
// The errorstate has been reset.
cpl_test( !my_func(p) ); // my_func(p) is expected to return zero
#define cpl_test_errorstate (   errorstate)

Test and if necessary reset the CPL errorstate.

Parameters
errorstateThe expected CPL errorstate
See Also
cpl_test()
Note
After the test, the CPL errorstate is set to the provided state
Returns
void

This function is useful for verifying that a successful call to a function does not modify any pre-existing errors.

Example of usage:

const cpl_error_code error = cpl_error_set(cpl_func, CPL_ERROR_EOL);
cpl_errorstate prestate = cpl_errorstate_get();
const cpl_error_code ok = my_func(); // Expected to succeed
cpl_test_errorstate(prestate); // Verify that no additional errors occurred
cpl_test_error(CPL_ERROR_EOL); // Reset error
cpl_test_eq(ok, CPL_ERROR_NONE); // Verify that my_func() succeeded
#define cpl_test_fits (   fitsfile)

Test if a file is valid FITS using an external verification utility.

Parameters
fitsfileThe file to verify, NULL causes failure
Note
The external verification utility is specified with the environemt variable CPL_TEST_FITS, if is not set the test will pass on any non-NULL file.

Example of usage:

export CPL_TEST_FITS=/usr/local/bin/fitsverify
cpl_test_fits(fitsfile);
#define cpl_test_image_abs (   first,
  second,
  tolerance 
)

Test if two images are identical within a given (absolute) tolerance.

Parameters
firstThe first image in the comparison
secondThe second image of identical size in the comparison
toleranceA non-negative tolerance
Returns
void
See Also
cpl_test_abs()
Note
The test will fail if one or both the images are NULL
#define cpl_test_image_rel (   first,
  second,
  tolerance 
)

Test if two images are identical within a given (relative) tolerance.

Parameters
firstThe first image in the comparison
secondThe second image of identical size in the comparison
toleranceA non-negative tolerance
Returns
void
See Also
cpl_test_rel()
Note
The test will fail if one or both the images are NULL

For each pixel position the two values x, y must pass the test: |x - y| <= tol * min(|x|, |y|). This definition is chosen since it is commutative and meaningful also for zero-valued pixels.

#define cpl_test_imagelist_abs (   first,
  second,
  tolerance 
)

Test if two imagelists are identical within a given (absolute) tolerance.

Parameters
firstThe first imagelist in the comparison
secondThe second imagelist of identical size in the comparison
toleranceA non-negative tolerance
Returns
void
See Also
cpl_test_image_abs()
Note
The test will fail if one or both the imagelists are NULL
#define cpl_test_init (   REPORT,
  LEVEL 
)

Initialize CPL + CPL messaging + unit test.

Parameters
REPORTThe email address for the error message e.g. PACKAGE_BUGREPORT
LEVELThe default messaging level, e.g. CPL_MSG_WARNING
Returns
void
See Also
cpl_init()
Note
This macro should be used at the beginning of main() of a unit test instead of cpl_init() and before any other CPL function call.
#define cpl_test_leq (   value,
  tolerance 
)

Evaluate A <= B and increment an internal counter if it is not true.

Parameters
valueThe number to test
toleranceThe upper limit to compare against
Returns
void
See Also
cpl_test_init()
Note
This macro should be used for unit tests

Example of usage:

cpl_test_leq(fabs(myfunc(&p)), DBL_EPSILON);
#define cpl_test_lt (   value,
  tolerance 
)

Evaluate A < B and increment an internal counter if it is not true.

Parameters
valueThe number to test
toleranceThe upper limit to compare against
Returns
void
See Also
cpl_test_init()
Note
This macro should be used for unit tests

Example of usage:

cpl_test_lt(0.0, myfunc());
#define cpl_test_matrix_abs (   first,
  second,
  tolerance 
)

Test if two matrices are identical within a given (absolute) tolerance.

Parameters
firstThe first matrix in the comparison
secondThe second matrix of identical size in the comparison
toleranceA non-negative tolerance
Returns
void
See Also
cpl_test_abs()
Note
The test will fail if one or both the matrices are NULL
#define cpl_test_memory_is_empty ( )

Test if the memory system is empty.

See Also
cpl_memory_is_empty()
Deprecated:
Called by cpl_test_end()
#define cpl_test_noneq (   first,
  second 
)

Test if two integer expressions are not equal.

Parameters
firstThe first value in the comparison, side-effects are allowed
secondThe second value in the comparison, side-effects are allowed
See Also
cpl_test_eq()
Returns
void

Example of usage:

cpl_test_noneq(computed, wrong);
#define cpl_test_noneq_ptr (   first,
  second 
)

Test if two pointer expressions are not equal.

Parameters
firstThe first value in the comparison, side-effects are allowed
secondThe second value in the comparison, side-effects are allowed
See Also
cpl_test_eq_ptr()
Returns
void

Example of usage:

cpl_test_noneq_ptr(computed, wrong);
#define cpl_test_noneq_string (   first,
  second 
)

Test if two strings are not equal.

Parameters
firstThe first string or NULL of the comparison
secondThe second string or NULL of the comparison
Note
One or two NULL pointer(s) is considered a failure.

Example of usage:

cpl_test_noneq_string(computed, expected);
#define cpl_test_nonnull (   pointer)

Test if a pointer is non-NULL.

Parameters
pointerThe pointer to check, side-effects are allowed
See Also
cpl_test_nonnull()
Returns
void

Example of usage:

cpl_test_nonnull(pointer); // pointer is expected to be non-NULL
#define cpl_test_null (   pointer)

Test if a pointer is NULL and update an internal counter on failure.

Parameters
pointerThe NULL-pointer to check, side-effects are allowed
See Also
cpl_test()
Returns
void

Example of usage:

cpl_test_null(pointer); // pointer is expected to be NULL
#define cpl_test_polynomial_abs (   first,
  second,
  tolerance 
)

Test if two polynomials are identical within a given (absolute) tolerance.

Parameters
firstThe first polynomial in the comparison
secondThe second polynomial in the comparison
toleranceA non-negative tolerance
Returns
void
See Also
cpl_test_abs()
Note
The test will fail if one or both the polynomials are NULL
#define cpl_test_rel (   first,
  second,
  tolerance 
)

Test if two numerical expressions are within a given relative tolerance.

Parameters
firstThe first value in the comparison, side-effects are allowed
secondThe second value in the comparison, side-effects are allowed
toleranceA non-negative tolerance
Note
If the tolerance is negative or if one but not both of the two values is zero, the test will always fail. If both values are zero, the test will succeed for any non-negative tolerance. The test is commutative in the two values.
See Also
cpl_test()

The test is carried out by comparing the absolute value of the difference abs (first - second) to the product of the tolerance and the minimum of the absolute value of the two values, tolerance * min(abs(first), abs(second)) (The test is implemented like this to avoid division with a number that may be zero.

Example of usage:

cpl_test_rel(computed, expected, 0.001);
#define cpl_test_vector_abs (   first,
  second,
  tolerance 
)

Test if two vectors are identical within a given (absolute) tolerance.

Parameters
firstThe first vector in the comparison
secondThe second vector of identical size in the comparison
toleranceA non-negative tolerance
Returns
void
See Also
cpl_test_abs()
Note
The test will fail if one or both the vectors are NULL
#define cpl_test_zero (   zero)

Evaluate an expression and increment an internal counter if non-zero.

Parameters
zeroThe numerical expression to evaluate, side-effects are allowed
Note
A zero value of the expression is a success, other values are not
Returns
void
See Also
cpl_test()
Note
This macro should be used for unit tests

Example of usage:

cpl_test_zero(myfunc()); // myfunc() is expected to return zero

Function Documentation

int cpl_test_end ( cpl_size  nfail)

Finalize CPL and unit-testing environment and report any failures.

Parameters
nfailThe number of failures counted apart from cpl_test() et al.
Returns
EXIT_SUCCESS iff the CPL errorstate is clean
Note
This function should be used for the final return from a unit test
See Also
cpl_test_init()

nfail should normally be zero, but may be set to a positive number when it is necessary to ensure a failure. nfail should only be negative in the unit test of the unit-test functions themselves.

Example of usage:

int main (void)
{
cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
cpl_test(myfunc(&p));
cpl_test(p != NULL);
return cpl_test_end(0);
}
size_t cpl_test_get_bytes_image ( const cpl_image *  self)

Get the amount of storage [bytes] for the CPL object.

Parameters
selfThe CPL object
Returns
The size in bytes
Note
Passing NULL is allowed and will return zero
See Also
cpl_test_get_bytes_vector
size_t cpl_test_get_bytes_imagelist ( const cpl_imagelist *  self)

Get the amount of storage [bytes] for the CPL object.

Parameters
selfThe CPL object
Returns
The size in bytes
Note
Passing NULL is allowed and will return zero
See Also
cpl_test_get_bytes_vector
size_t cpl_test_get_bytes_matrix ( const cpl_matrix *  self)

Get the amount of storage [bytes] for the CPL object.

Parameters
selfThe CPL object
Returns
The size in bytes
Note
Passing NULL is allowed and will return zero
See Also
cpl_test_get_bytes_vector
size_t cpl_test_get_bytes_vector ( const cpl_vector *  self)

Get the amount of storage [bytes] for the CPL object.

Parameters
selfThe CPL object
Returns
The size in bytes
Note
Passing NULL is allowed and will return zero

Example of usage:

int my_benchmark (void)
{
const size_t storage = cpl_test_get_bytes_vector(mydata);
double walltime, tstop;
const double tstart = cpl_test_get_walltime();
myfunc(mydata);
walltime = tstop - tstart;
if (walltime > 0.0) {
cpl_msg_info(cpl_func, "Processing rate: %g",
(double)storage/walltime);
}
}
cpl_size cpl_test_get_failed ( void  )

Get the number of failed CPL tests.

Returns
The count of failed tests
See Also
cpl_test_get_tested()

Example of usage:

void my_tester (void)
{
const cpl_size prefailed = cpl_test_get_failed();
cpl_test(mytest());
if (cpl_test_get_failed() > prefailed) {
cpl_msg_info(cpl_func, "The function mytest() failed!");
}
}
cpl_size cpl_test_get_tested ( void  )

Get the number of CPL tests performed.

Returns
The test count
See Also
cpl_test_get_failed()
double cpl_test_get_walltime ( void  )

Get the process wall-clock time, when available.

Returns
The process wall-clock time in seconds.
Note
Will always return 0 if clock_gettime() and gettimeofday() are unavailable or failing
See Also
clock_gettime(), gettimeofday()

Example of usage:

int my_benchmark (void)
{
double walltime, tstop;
const double tstart = cpl_test_get_walltime();
myfunc();
walltime = tstop - tstart;
cpl_msg_info(cpl_func, "The call took %g seconds of wall-clock time",
walltime);
}
cpl-6.4.1/html/form_16.png0000644000460300003120000000045612310333017012133 00000000000000‰PNG  IHDR0•ð¼Í0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïIDATxíKà D_›€CzÿÛ–¦„*Í®êÊš‘Ï?ùÿ³—ö5€A’õ—Å–“Äzú'õè’nøê õ~[œ¶¹àëæ©¶•+Û—N©þŒ\#Ú—š[ïáœ_Žü­ÄŽ’¾PÚ—WÝ7œÇ½¦y?ëÁSlÃÞ¡R\8l^ è Üæã‚·¸sÖàç~ÊÌEI²eÏIEND®B`‚cpl-6.4.1/html/group__cpl__wlcalib.html0000644000460300003120000012041712310333015015025 00000000000000 Common Pipeline Library Reference Manual: Wavelength calibration
Common Pipeline Library Reference Manual  6.4.1
Wavelength calibration

Functions

cpl_error_code cpl_wlcalib_fill_line_spectrum (cpl_vector *self, void *model, const cpl_polynomial *disp)
 Generate a 1D spectrum from a model and a dispersion relation.
 
cpl_error_code cpl_wlcalib_fill_line_spectrum_fast (cpl_vector *self, void *model, const cpl_polynomial *disp)
 Generate a 1D spectrum from a model and a dispersion relation.
 
cpl_error_code cpl_wlcalib_fill_logline_spectrum (cpl_vector *self, void *model, const cpl_polynomial *disp)
 Generate a 1D spectrum from a model and a dispersion relation.
 
cpl_error_code cpl_wlcalib_fill_logline_spectrum_fast (cpl_vector *self, void *model, const cpl_polynomial *disp)
 Generate a 1D spectrum from a model and a dispersion relation.
 
cpl_error_code cpl_wlcalib_find_best_1d (cpl_polynomial *self, const cpl_polynomial *guess, const cpl_vector *spectrum, void *model, cpl_error_code(*filler)(cpl_vector *, void *, const cpl_polynomial *), const cpl_vector *wl_search, cpl_size nsamples, cpl_size hsize, double *xcmax, cpl_vector *xcorrs)
 Find the best 1D dispersion polynomial in a given search space.
 
void cpl_wlcalib_slitmodel_delete (cpl_wlcalib_slitmodel *self)
 Free memory associated with a cpl_wlcalib_slitmodel object.
 
cpl_wlcalib_slitmodel * cpl_wlcalib_slitmodel_new (void)
 Create a new line model to be initialized.
 
cpl_error_code cpl_wlcalib_slitmodel_set_catalog (cpl_wlcalib_slitmodel *self, cpl_bivector *catalog)
 Set the catalog of lines to be used by the spectrum filler.
 
cpl_error_code cpl_wlcalib_slitmodel_set_threshold (cpl_wlcalib_slitmodel *self, double value)
 The (positive) threshold for truncating the transfer function.
 
cpl_error_code cpl_wlcalib_slitmodel_set_wfwhm (cpl_wlcalib_slitmodel *self, double value)
 Set the FWHM of the transfer function to be used by the spectrum filler.
 
cpl_error_code cpl_wlcalib_slitmodel_set_wslit (cpl_wlcalib_slitmodel *self, double value)
 Set the slit width to be used by the spectrum filler.
 

Detailed Description

This module contains functions to perform 1D-wavelength calibration, typically of long-slit spectroscopy data.

Synopsis:
#include "cpl_wlcalib.h"

Function Documentation

cpl_error_code cpl_wlcalib_fill_line_spectrum ( cpl_vector *  self,
void *  model,
const cpl_polynomial *  disp 
)

Generate a 1D spectrum from a model and a dispersion relation.

Parameters
selfVector to fill with spectrum
modelPointer to cpl_wlcalib_slitmodel object
disp1D-Dispersion relation, at least of degree 1
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
Note
The model is passed as a void pointer so the function can be used with cpl_wlcalib_find_best_1d().
See Also
cpl_wlcalib_find_best_1d()

The fill a vector with a spectrum, one must first initialize the parameters of the model (error checks omitted for brevity):

cpl_vector * spectrum = cpl_vector_new(nresolution);
cpl_wlcalib_slitmodel * model = cpl_wlcalib_slitmodel_new();
cpl_bivector * lines = my_load_lines_catalog(filename);
cpl_polynomial * dispersion = my_1d_dispersion();

With that the spectrum can be filled:

cpl_wlcalib_fill_line_spectrum(spectrum, model, dispersion);

Clean-up when no more spectra are needed (lines are deleted with the model):

Each line profile is given by the convolution of the Dirac delta function with a Gaussian with $\sigma = w_{FWHM}/(2\sqrt(2\log(2))),$ and a top-hat with the slit width as width. This continuous line profile is then integrated over each pixel, wherever the intensity is above the threshold set by the given model. For a given line the value on a given pixel requires the evaluation of two calls to erf().

Possible _cpl_error_code_ set by this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE If the input polynomial is not 1D
  • CPL_ERROR_ILLEGAL_INPUT If the input polynomial is non-increasing over the given input (pixel) range, or if a model parameter is non-physical (e.g. non-positive slit width).
  • CPL_ERROR_DATA_NOT_FOUND If no catalog lines are available in the range of the dispersion relation
  • CPL_ERROR_INCOMPATIBLE_INPUT If the wavelengths of two catalog lines are found to be in non-increasing order.
cpl_error_code cpl_wlcalib_fill_line_spectrum_fast ( cpl_vector *  self,
void *  model,
const cpl_polynomial *  disp 
)

Generate a 1D spectrum from a model and a dispersion relation.

Parameters
selfVector to fill with spectrum
modelPointer to cpl_wlcalib_slitmodel object
disp1D-Dispersion relation, at least of degree 1
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
Note
The generated spectrum will use an approximate line profile for speed
See Also
cpl_wlcalib_fill_line_spectrum()

The approximation preserves the position of the maximum, the symmetry and the flux of the line profile.

The use of a given line in a spectrum requires the evaluation of four calls to erf().

The fast spectrum generation can be useful when the model spectrum includes many catalog lines.

cpl_error_code cpl_wlcalib_fill_logline_spectrum ( cpl_vector *  self,
void *  model,
const cpl_polynomial *  disp 
)

Generate a 1D spectrum from a model and a dispersion relation.

Parameters
selfVector to fill with spectrum
modelPointer to cpl_wlcalib_slitmodel object
disp1D-Dispersion relation, at least of degree 1
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
Note
The spectrum is generated from 1 + the logarithm of the line intensities
See Also
cpl_wlcalib_fill_line_spectrum()
cpl_error_code cpl_wlcalib_fill_logline_spectrum_fast ( cpl_vector *  self,
void *  model,
const cpl_polynomial *  disp 
)

Generate a 1D spectrum from a model and a dispersion relation.

Parameters
selfVector to fill with spectrum
modelPointer to cpl_wlcalib_slitmodel object
disp1D-Dispersion relation, at least of degree 1
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
Note
The spectrum is generated from 1 + the logarithm of the line intensities and an approximate line profile for speed
See Also
cpl_wlcalib_fill_line_spectrum_fast()
cpl_error_code cpl_wlcalib_find_best_1d ( cpl_polynomial *  self,
const cpl_polynomial *  guess,
const cpl_vector *  spectrum,
void *  model,
cpl_error_code(*)(cpl_vector *, void *, const cpl_polynomial *)  filler,
const cpl_vector *  wl_search,
cpl_size  nsamples,
cpl_size  hsize,
double *  xcmax,
cpl_vector *  xcorrs 
)

Find the best 1D dispersion polynomial in a given search space.

Parameters
selfPre-created 1D-polynomial for the result
guess1D-polynomial with the guess, may equal self
spectrumThe vector with the observed 1D-spectrum
modelThe spectrum model
fillerThe function used to make the spectrum
wl_searchSearch range around the anchor points, same unit as guess
nsamplesNumber of samples around the anchor points
hsizeMaximum (pixel) displacement of the polynomial guess
xcmaxOn success, the maximum cross-correlation
xcorrsThe vector to fill with the correlation values or NULL
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_wlcalib_fill_line_spectrum() for the model and filler.

Find the polynomial that maximizes the cross-correlation between an observed 1D-spectrum and a model spectrum based on the polynomial dispersion relation.

The wavelength search range is in the same units as the Y-values of the dispersion relation.

For each candidate polynomial P(x), the polynomial P(x+u), -hsize <= u <= hsize is also evaluated. The half-size hsize may be zero. When it is non-zero, an additional 2 * hsize cross-correlations are performed for each candidate polynomial, one for each possible shift. The maximizing polynomial among those shifted polynomials is kept. A well-chosen half-size can allow for the use of fewer number of samples around the anchor points, leading to a reduction of polynomials to be evaluated.

The complexity in terms of model spectra creation is O(N^D) and in terms of cross-correlations O(hsize * N^D), where N is nsamples and D is the length of wl_error.

xcorrs must be NULL or have a size of (at least) N^D*(1 + 2 * hsize).

Possible _cpl_error_code_ set by this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE If an input polynomial is not 1D
  • CPL_ERROR_ILLEGAL_INPUT If nfree is less than 2, or nsamples is less than 1, hsize negative or if wl_search contains a zero search bound, or if xcorrs is non-NULL and too short.
  • CPL_ERROR_DATA_NOT_FOUND If no model spectra can be created using the supplied model and filler
void cpl_wlcalib_slitmodel_delete ( cpl_wlcalib_slitmodel *  self)

Free memory associated with a cpl_wlcalib_slitmodel object.

Parameters
selfThe cpl_wlcalib_slitmodel object or NULL
Returns
Nothing
See Also
cpl_wlcalib_slitmodel_new()
Note
If self is NULL nothing is done and no error is set.
cpl_wlcalib_slitmodel* cpl_wlcalib_slitmodel_new ( void  )

Create a new line model to be initialized.

Returns
1 newly allocated cpl_wlcalib_slitmodel
Note
All elements are initialized to either zero or NULL.
See Also
cpl_wlcalib_slitmodel_delete() for object deallocation.

The model comprises these elements: Slit Width FWHM of transfer function Truncation threshold of the transfer function Catalog of lines (typically arc or sky)

The units of the X-values of the lines is a length, it is assumed to be the same as that of the Y-values of the dispersion relation (e.g. meter), the units of slit width and the FWHM are assumed to be the same as the X-values of the dispersion relation (e.g. pixel), while the units of the produced spectrum will be that of the Y-values of the lines.

cpl_error_code cpl_wlcalib_slitmodel_set_catalog ( cpl_wlcalib_slitmodel *  self,
cpl_bivector *  catalog 
)

Set the catalog of lines to be used by the spectrum filler.

Parameters
selfThe cpl_wlcalib_slitmodel object
catalogThe catalog of lines (e.g. arc lines)
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_wlcalib_slitmodel_new()
Note
The values in the X-vector must be increasing. Any previously set catalog is deallocated

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_wlcalib_slitmodel_set_threshold ( cpl_wlcalib_slitmodel *  self,
double  value 
)

The (positive) threshold for truncating the transfer function.

Parameters
selfThe cpl_wlcalib_slitmodel object
valueThe (non-negative) truncation threshold, 5 is a good value.
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_wlcalib_slitmodel_new()
Note
The threshold should be high enough to ensure a good line profile, but not too high to make the spectrum generation too costly.

The line profile is truncated at this distance [pixel] from its maximum: $x_{max} = w/2 + k * \sigma,$ where $w$ is the slit width and $\sigma = w_{FWHM}/(2\sqrt(2\log(2))),$ where $w_{FWHM}$ is the Full Width at Half Maximum (FWHM) of the transfer function and $k$ is the user supplied value.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT the value is negative
cpl_error_code cpl_wlcalib_slitmodel_set_wfwhm ( cpl_wlcalib_slitmodel *  self,
double  value 
)

Set the FWHM of the transfer function to be used by the spectrum filler.

Parameters
selfThe cpl_wlcalib_slitmodel object
valueThe (positive) FWHM
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_wlcalib_slitmodel_new()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT the value is non-positive
cpl_error_code cpl_wlcalib_slitmodel_set_wslit ( cpl_wlcalib_slitmodel *  self,
double  value 
)

Set the slit width to be used by the spectrum filler.

Parameters
selfThe cpl_wlcalib_slitmodel object
valueThe (positive) width of the slit
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_wlcalib_slitmodel_new()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT the value is non-positive
cpl-6.4.1/html/group__cpl__property.html0000644000460300003120000023310112310333014015266 00000000000000 Common Pipeline Library Reference Manual: Properties
Common Pipeline Library Reference Manual  6.4.1
Properties

Typedefs

typedef struct _cpl_property_ cpl_property
 The opaque property data type.
 

Functions

void cpl_property_delete (cpl_property *self)
 Destroy a property.
 
cpl_propertycpl_property_duplicate (const cpl_property *other)
 Create a copy of a property.
 
int cpl_property_get_bool (const cpl_property *self)
 Get the value of a boolean property.
 
char cpl_property_get_char (const cpl_property *self)
 Get the value of a character property.
 
const char * cpl_property_get_comment (const cpl_property *self)
 Get the property comment.
 
double cpl_property_get_double (const cpl_property *self)
 Get the value of a double property.
 
double complex cpl_property_get_double_complex (const cpl_property *self)
 Get the value of a double complex property.
 
float cpl_property_get_float (const cpl_property *self)
 Get the value of a float property.
 
float complex cpl_property_get_float_complex (const cpl_property *self)
 Get the value of a float complex property.
 
int cpl_property_get_int (const cpl_property *self)
 Get the value of an integer property.
 
long cpl_property_get_long (const cpl_property *self)
 Get the value of a long property.
 
long long cpl_property_get_long_long (const cpl_property *self)
 Get the value of a long long property.
 
const char * cpl_property_get_name (const cpl_property *self)
 Get the property name.
 
cpl_size cpl_property_get_size (const cpl_property *self)
 Get the current number of elements a property contains.
 
const char * cpl_property_get_string (const cpl_property *self)
 Get the value of a string property.
 
cpl_type cpl_property_get_type (const cpl_property *self)
 Get the type of a property.
 
cpl_propertycpl_property_new (const char *name, cpl_type type)
 Create an empty property of a given type.
 
cpl_propertycpl_property_new_array (const char *name, cpl_type type, cpl_size size)
 Create an empty property of a given type and size.
 
cpl_error_code cpl_property_set_bool (cpl_property *self, int value)
 Set the value of a boolean property.
 
cpl_error_code cpl_property_set_char (cpl_property *self, char value)
 Set the value of a character property.
 
cpl_error_code cpl_property_set_comment (cpl_property *self, const char *comment)
 Modify a property's comment.
 
cpl_error_code cpl_property_set_double (cpl_property *self, double value)
 Set the value of a double property.
 
cpl_error_code cpl_property_set_double_complex (cpl_property *self, double complex value)
 Set the value of a double complex property.
 
cpl_error_code cpl_property_set_float (cpl_property *self, float value)
 Set the value of a float property.
 
cpl_error_code cpl_property_set_float_complex (cpl_property *self, float complex value)
 Set the value of a complex float property.
 
cpl_error_code cpl_property_set_int (cpl_property *self, int value)
 Set the value of an integer property.
 
cpl_error_code cpl_property_set_long (cpl_property *self, long value)
 Set the value of a long property.
 
cpl_error_code cpl_property_set_long_long (cpl_property *self, long long value)
 Set the value of a long long property.
 
cpl_error_code cpl_property_set_name (cpl_property *self, const char *name)
 Modify the name of a property.
 
cpl_error_code cpl_property_set_string (cpl_property *self, const char *value)
 Set the value of a string property.
 

Detailed Description

This module implements the property type. The type cpl_property is basically a variable container which consists of a name, a type identifier and a specific value of that type. The type identifier always determines the type of the associated value. A property is similar to an ordinary variable and its current value can be set or retrieved through its name. In addition a property may have a descriptive comment associated. A property can be created for the basic types char, bool (int), int, long, float and double. Also C strings are supported. Support for arrays in general is currently not available.

Synopsis:
#include <cpl_property.h>

Typedef Documentation

typedef struct _cpl_property_ cpl_property

The opaque property data type.

Function Documentation

void cpl_property_delete ( cpl_property self)

Destroy a property.

Parameters
selfThe property.
Returns
Nothing.

The function destroys a property of any kind. All property members including their values are properly deallocated. If the property self is NULL, nothing is done and no error is set.

cpl_property* cpl_property_duplicate ( const cpl_property other)

Create a copy of a property.

Parameters
otherThe property to copy.
Returns
The copy of the given property, or NULL in case of an error. In the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns a copy of the property self. The copy is a deep copy, i.e. all property members are copied.

int cpl_property_get_bool ( const cpl_property self)

Get the value of a boolean property.

Parameters
selfThe property.
Returns
The current property value. If an error occurs the function returns 0 and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_BOOL.

The function retrieves the boolean value currently stored in the property self.

char cpl_property_get_char ( const cpl_property self)

Get the value of a character property.

Parameters
selfThe property.
Returns
The current property value. If an error occurs the function returns '\0' and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_CHAR.

The function retrieves the character value currently stored in the property self.

const char* cpl_property_get_comment ( const cpl_property self)

Get the property comment.

Parameters
selfThe property.
Returns
The comment of the property if it is present or NULL. If an error occurrs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns a handle for the read-only comment string of self.

double cpl_property_get_double ( const cpl_property self)

Get the value of a double property.

Parameters
selfThe property.
Returns
The current property value. If an error occurs the function returns 0. and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_DOUBLE or CPL_TYPE_FLOAT.

The function retrieves the value currently stored in the property self as a double. The function accepts properties of a floating-point type with a rank less or equal than the function's return type.

double complex cpl_property_get_double_complex ( const cpl_property self)

Get the value of a double complex property.

Parameters
selfThe property.
Returns
The current property value. If an error occurs the function returns 0. and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_DOUBLE_COMPLEX or CPL_TYPE_FLOAT_COMPLEX.

The function retrieves the value currently stored in the property self as a double complex. The function accepts properties of a complex type with a rank less or equal than the function's return type.

float cpl_property_get_float ( const cpl_property self)

Get the value of a float property.

Parameters
selfThe property.
Returns
The current property value. If an error occurs the function returns 0. and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

The function retrieves the value currently stored in the property self as a float. The function also accepts properties of type double and returns the property value as float.

Note
Calling the function for a property of type double may lead to truncation errors!
float complex cpl_property_get_float_complex ( const cpl_property self)

Get the value of a float complex property.

Parameters
selfThe property.
Returns
The current property value. If an error occurs the function returns 0. and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_FLOAT_COMPLEX or CPL_TYPE_DOUBLE_COMPLEX.

The function retrieves the value currently stored in the property self as a float complex. The function also accepts properties of type double complex and returns the property value as float complex.

Note
Calling the function for a property of type double complex may lead to truncation errors!
int cpl_property_get_int ( const cpl_property self)

Get the value of an integer property.

Parameters
selfThe property.
Returns
The current property value. If an error occurs the function returns 0 and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_INT.

The function retrieves the integer value currently stored in the property self.

long cpl_property_get_long ( const cpl_property self)

Get the value of a long property.

Parameters
selfThe property.
Returns
The current property value. If an error occurs the function returns 0 and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_LONG or CPL_TYPE_INT.

The function retrieves the value currently stored in the property self as a long integer. The function accepts properties of integer type with a rank less or equal than the function's return type.

long long cpl_property_get_long_long ( const cpl_property self)

Get the value of a long long property.

Parameters
selfThe property.
Returns
The current property value. If an error occurs the function returns 0 and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_LONG_LONG, CPL_TYPE_LONG, or CPL_TYPE_INT.

The function retrieves the value currently stored in the property self as a long long integer. The function accepts properties of integer type with a rank less or equal than the function's return type.

const char* cpl_property_get_name ( const cpl_property self)

Get the property name.

Parameters
selfThe property.
Returns
The name of the property or NULL if an error occurred. In the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns a handle for the read-only identifier string of self.

cpl_size cpl_property_get_size ( const cpl_property self)

Get the current number of elements a property contains.

Parameters
selfThe property.
Returns
The current number of elements or -1 in case of an error. If an error occurred an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the current number of elements the property self contains. This is the array size of the property's value and in particular, for a property of the type CPL_TYPE_STRING, it is the length of the string as given by the strlen() function plus 1.

const char* cpl_property_get_string ( const cpl_property self)

Get the value of a string property.

Parameters
selfThe property.
Returns
The current property value. If an error occurs the function returns NULL and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_STRING.

The function retrieves the string value currently stored in the property self.

cpl_type cpl_property_get_type ( const cpl_property self)

Get the type of a property.

Parameters
selfThe property.
Returns
The type code of this property. In case of an error the returned type code is CPL_TYPE_INVALID and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function returns the type of the data value stored in the property self.

cpl_property* cpl_property_new ( const char *  name,
cpl_type  type 
)

Create an empty property of a given type.

Parameters
nameProperty name.
typeProperty type flag.
Returns
The newly created property, or NULL if it could not be created. In the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter name is a NULL pointer.
CPL_ERROR_INVALID_TYPE The requested property type type is not supported.

The function allocates memory for a property of type type and assigns the identifier string name to the newly created property.

The returned property must be destroyed using the property destructor cpl_property_delete().

See Also
cpl_property_delete()
cpl_property* cpl_property_new_array ( const char *  name,
cpl_type  type,
cpl_size  size 
)

Create an empty property of a given type and size.

Parameters
nameProperty name.
typeProperty type flag.
sizeSize of the property value.
Returns
The newly created property, or NULL if it could not be created. in the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter name is a NULL pointer.

The function allocates memory for a property of type type and assigns the identifier string name to the newly created property. The property value is created such that size elements of type type can be stored.

The returned property must be destroyed using the property destructor cpl_property_delete().

See Also
cpl_property_delete()
cpl_error_code cpl_property_set_bool ( cpl_property self,
int  value 
)

Set the value of a boolean property.

Parameters
selfThe property.
valueNew value.
Returns
The function returns CPL_ERROR_NONE on success and an appropriate error code if an error occurred. In the latter case the error code is also set in the error handling system.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_BOOL.

The function replaces the current boolean value of self with a a 0, if value is equal to 0. If value is different from 0 any previous value of self is replaced by a 1.

cpl_error_code cpl_property_set_char ( cpl_property self,
char  value 
)

Set the value of a character property.

Parameters
selfThe property.
valueNew value.
Returns
The function returns CPL_ERROR_NONE on success and an appropriate error code if an error occurred. In the latter case the error code is also set in the error handling system.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_CHAR.

The function replaces the current character value of self with a copy of the value value.

cpl_error_code cpl_property_set_comment ( cpl_property self,
const char *  comment 
)

Modify a property's comment.

Parameters
selfThe property.
commentNew comment.
Returns
The function returns CPL_ERROR_NONE on success and an appropriate error code if an error occurred. In the latter case the error code is also set in the error handling system.
Errors
CPL_ERROR_NULL_INPUT The parameter self or comment is a NULL pointer.

The function replaces the current comment field of self with a copy of the string comment. The new comment may be NULL. In this case the function effectively deletes the current comment.

cpl_error_code cpl_property_set_double ( cpl_property self,
double  value 
)

Set the value of a double property.

Parameters
selfThe property.
valueNew value.
Returns
The function returns CPL_ERROR_NONE on success and an appropriate error code if an error occurred. In the latter case the error code is also set in the error handling system.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_DOUBLE.

The function replaces the current double value of self with a copy of the value value.

cpl_error_code cpl_property_set_double_complex ( cpl_property self,
double complex  value 
)

Set the value of a double complex property.

Parameters
selfThe property.
valueNew value.
Returns
The function returns CPL_ERROR_NONE on success and an appropriate error code if an error occurred. In the latter case the error code is also set in the error handling system.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_DOUBLE_COMPLEX.

The function replaces the current double value of self with a copy of the value value.

cpl_error_code cpl_property_set_float ( cpl_property self,
float  value 
)

Set the value of a float property.

Parameters
selfThe property.
valueNew value.
Returns
The function returns CPL_ERROR_NONE on success and an appropriate error code if an error occurred. In the latter case the error code is also set in the error handling system.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_FLOAT.

The function replaces the current float value of self with a copy of the value value.

cpl_error_code cpl_property_set_float_complex ( cpl_property self,
float complex  value 
)

Set the value of a complex float property.

Parameters
selfThe property.
valueNew value.
Returns
The function returns CPL_ERROR_NONE on success and an appropriate error code if an error occurred. In the latter case the error code is also set in the error handling system.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_COMPLEX_FLOAT.

The function replaces the current complex float value of self with a copy of the value value.

cpl_error_code cpl_property_set_int ( cpl_property self,
int  value 
)

Set the value of an integer property.

Parameters
selfThe property.
valueNew value.
Returns
The function returns CPL_ERROR_NONE on success and an appropriate error code if an error occurred. In the latter case the error code is also set in the error handling system.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_INT.

The function replaces the current integer value of self with a copy of the value value.

cpl_error_code cpl_property_set_long ( cpl_property self,
long  value 
)

Set the value of a long property.

Parameters
selfThe property.
valueNew value.
Returns
The function returns CPL_ERROR_NONE on success and an appropriate error code if an error occurred. In the latter case the error code is also set in the error handling system.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_LONG.

The function replaces the current long value of self with a copy of the value value.

cpl_error_code cpl_property_set_long_long ( cpl_property self,
long long  value 
)

Set the value of a long long property.

Parameters
selfThe property.
valueNew value.
Returns
The function returns CPL_ERROR_NONE on success and an appropriate error code if an error occurred. In the latter case the error code is also set in the error handling system.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_LONG.

The function replaces the current long long value of self with a copy of the value value.

cpl_error_code cpl_property_set_name ( cpl_property self,
const char *  name 
)

Modify the name of a property.

Parameters
selfThe property.
nameNew name.
Returns
The function returns CPL_ERROR_NONE on success and an appropriate error code if an error occurred. In the latter case the error code is also set in the error handling system.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function replaces the current name of self with a copy of the string name. The function returns an error if name is NULL.

cpl_error_code cpl_property_set_string ( cpl_property self,
const char *  value 
)

Set the value of a string property.

Parameters
selfThe property.
valueNew value.
Returns
The function returns CPL_ERROR_NONE on success and an appropriate error code if an error occurred. In the latter case the error code is also set in the error handling system.
Errors
CPL_ERROR_NULL_INPUT The parameter self or value is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The property self is not of type CPL_TYPE_STRING.

The function replaces the current string value of self with a copy of the value value.

cpl-6.4.1/html/ftv2link.png0000644000460300003120000000135212310333014012412 00000000000000‰PNG  IHDRÚ}\ˆ±IDATxíMOS[…Ÿžsúa?-XZ(PD4‚ AWbu`b 77wäHFÆCËÔÂÿà/`vo„ˆAPòq‹P @ ­ûÝè980 îà¤+»§Ýy×^ïZï9SW¹\83g‰3'°Nâçl¹¸_b¯p ïåûÆVÜÖ¡€Ÿ×"¬Ö†X€d]Ðà3“ÉÃÄÌ™xŸ ßMàœ[<çSPkvc—hÈ'…™˜^Åm™hØ7 `Û™¦ èÀåráq›‘œ¾!daeKŸþÆÕ˜:Ì*³_דâèi?I–eP*B7Ÿ¿åô!¹Ýgr6Ër6oKbëþãðôrI”ËTˆüªŒ¨xóö=›ù¢&‰(e+ßóÄkýÇ`ëÁÜb.“¸ÐW×w0¥°jÑzN™¬|©WEãµ¢a¯6[öX†AkÓù*/œ¨‰€ÉY­ ÿV’§–u²jÂ>1W *½·°PGŽzÿ¨/Eg{ ŸÇâaoŠÁVú:è¿™¤1$ôR§W,–ªà¨@ŠË56¾ÀÔÜ-¾,mê¸Î/æè¹– òr5¥T*S(Vf8ö9u’ Õ£w›ùóa=Í<{Ò¡UŒ÷r¯+ÉådDÏF$è°…£é¿`zþ»ÎúöN‘µÜ®0Q3£~_^Ëóâ¯N=ˆvpTà±LžT}ˆîkq†Òm<¼ÎÓ?Zh¿X£ï_þÝ¥[)ƒ `gêÃa_Ô*äÔ2`'=õ´Fÿ2EâÁPú ÷»›l=8‹Wv°%THqÉ¿<"¤ïG¾ÆxH{#ÆÖ«aÔJÕÞ‡—m‹„ çñKsÿàñVŠØ¡°·MâÒ^ TÁ– Ý›r¥ß½ømüÿ_™?ªWİ÷#uIEND®B`‚cpl-6.4.1/html/modules.html0000644000460300003120000003036112310333020012502 00000000000000 Common Pipeline Library Reference Manual: Modules
Common Pipeline Library Reference Manual  6.4.1
Modules
cpl-6.4.1/html/group__cpl__ppm.html0000644000460300003120000006566512310333015014221 00000000000000 Common Pipeline Library Reference Manual: Point pattern matching module
Common Pipeline Library Reference Manual  6.4.1
Point pattern matching module

Functions

cpl_array * cpl_ppm_match_points (const cpl_matrix *data, cpl_size use_data, double err_data, const cpl_matrix *pattern, cpl_size use_pattern, double err_pattern, double tolerance, double radius, cpl_matrix **mdata, cpl_matrix **mpattern, double *lin_scale, double *lin_angle)
 Match 2-D distributions of points.
 
cpl_bivector * cpl_ppm_match_positions (const cpl_vector *peaks, const cpl_vector *lines, double min_disp, double max_disp, double tolerance, cpl_array **seq_peaks, cpl_array **seq_lines)
 Match 1-D patterns.
 

Detailed Description

Synopsis:
#include "cpl_ppm.h"

Function Documentation

cpl_array* cpl_ppm_match_points ( const cpl_matrix *  data,
cpl_size  use_data,
double  err_data,
const cpl_matrix *  pattern,
cpl_size  use_pattern,
double  err_pattern,
double  tolerance,
double  radius,
cpl_matrix **  mdata,
cpl_matrix **  mpattern,
double *  lin_scale,
double *  lin_angle 
)

Match 2-D distributions of points.

Parameters
dataList of data points (e.g., detected stars positions).
use_dataNumber of data points used for preliminary match.
err_dataError on data points positions.
patternList of pattern points (e.g., expected stars positions).
use_patternNumber of pattern points used for preliminary match.
err_patternError on pattern points positions.
toleranceMax relative difference of angles and scales from their median value for match acceptance.
radiusSearch radius applied in final matching (data units).
mdataList of identified data points.
mpatternList of matching pattern points.
lin_scaleLinear transformation scale factor.
lin_angleLinear transformation rotation angle.
Returns
Indexes of identified data points (pattern-to-data).

A point is described here by its coordinates on a cartesian plane. The input matrices data and pattern must have 2 rows, as their column vectors are the points coordinates.

This function attemps to associate points in data to points in pattern, under the assumption that a transformation limited to scaling, rotation, and translation, would convert positions in pattern into positions in data. Association between points is also indicated in the following as "match", or "identification".

Point identification is performed in two steps. In the first step only a subset of the points is identified (preliminary match). In the second step the identified points are used to define a first-guess transformation from pattern points to data points, that is applied to identify all the remaining points as well. The second step would be avoided if a use_pattern equal to the number of points in pattern is given, and exactly use_pattern points would be identified already in the first step.

First step:

All possible triangles (sub-patterns) are built using the first use_data points from data and the first use_pattern points from pattern. The values of use_data and use_pattern must always be at least 3 (however, see the note at the end), and should not be greater than the length of the corresponding lists of points. The point-matching algorithm goes as follow:

For every triplet of points:
Select one point as the reference. The triangle coordinates
are defined by
((Rmin/Rmax)^2, theta_min - theta_max)
where Rmin (Rmax) is the shortest (longest) distance from the
reference point to one of the two other points, and theta_min
(theta_max) is the view angle in [0; 2pi[ to the nearest
(farthest) point.
Triangles are computed by using each point in the triplet
as reference, thereby computing 3 times as many triangles
as needed.
The accuracy of triangle patterns is robust against distortions
(i.e., systematic inaccuracies in the points positions) of the
second order. This is because, if the points positions had
constant statistical uncertainty, the relative uncertainty in
the triangle coordinates would be inversely proportional to
the triangle size, while if second order distortions are
present the systematic error on points position would be
directly proportional to the triangle size.
For every triangle derived from the @em pattern points:
Match with nearest triangle derived from @em data points
if their distance in the parameter space is less than their
uncertainties (propagated from the points positions uncertainties
@em err_data and @em err_pattern). For every matched pair of
triangles, record their scale ratio, and their orientation
difference. Note that if both @em err_data and @em err_pattern
are zero, the tolerance in triangle comparison will also be
zero, and therefore no match will be found.
Get median scale ratio and median angle of rotation, and reject
matches with a relative variation greater than @em tolerance from
the median of either quantities. The estimator of all the rotation
angles a_i is computed as
atan( med sin(a_i) / med cos(a_i) )

Second step:

From the safely matched triangles, a list of identified points is derived, and the best transformation from pattern points to data points (in terms of best rotation angle, best scaling factor, and best shift) is applied to attempt the identification of all the points that are still without match. This matching is made by selecting for each pattern point the data point which is closest to its transformed position, and at a distance less than radius.

The returned array of integers is as long as the number of points in pattern, and each element reports the position of the matching point in data (counted starting from zero), or is invalid if no match was found for the pattern point. For instance, if element N of the array has value M, it means that the Nth point in pattern matches the Mth point in data. A NULL pointer is returned in case no point was identified.

If mdata and mpattern are both valid pointers, two more matrices will be returned with the coordinates of the identified points. These two matrices will both have the same size: 2 rows, and as many columns as successfully identified points. Matching points will be in the same column of both matrices. Those matrix should in the end be destroyed using cpl_matrix_delete().

If lin_scale is a valid pointer, it is returned with a good estimate of the scale (distance_in_data = lin_scale * distance_in_pattern). This makes sense only in case the transformation between pattern and data is an affine transformation. In case of failure, lin_scale is set to zero.

If lin_angle is a valid pointer, it is returned with a good estimate of the rotation angle between pattern and data in degrees (counted counterclockwise, from -180 to +180, and with data_orientation = pattern_orientation + lin_angle). This makes sense only in case the transformation between pattern and data is an affine transformation. In case of failure, lin_angle is set to zero.

The returned values for lin_scale and lin_angle have the only purpose of providing a hint on the relation between pattern points and data points. This function doesn't attempt in any way to determine or even suggest a possible transformation between pattern points and data points: this function just matches points, and it is entriely a responsibility of the caller to fit the appropriate transformation between one coordinate system and the other. A polynomial transformation of degree 2 from pattern to data may be fit in the following way (assuming that mpattern and mdata are available):

int degree = 2;
int npoints = cpl_matrix_get_ncol(mdata);
double *dpoints = cpl_matrix_get_data(mdata);
cpl_vector *data_x = cpl_vector_wrap(npoints, dpoints);
cpl_vector *data_y = cpl_vector_wrap(npoints, dpoints + npoints);
cpl_polynomial *x_trans = cpl_polynomial_new(degree);
cpl_polynomial *y_trans = cpl_polynomial_new(degree);
cpl_polynomial_fit(x_trans, mpattern, NULL, data_x, NULL, CPL_FALSE,
NULL, degree);
cpl_polynomial_fit(y_trans, mpattern, NULL, data_y, NULL, CPL_FALSE,
NULL, degree);
Note
The basic requirement for using this function is that the searched point pattern (or at least most of it) is contained in the data. As an indirect consequence of this, it would generally be appropriate to have more points in data than in pattern (and analogously, to have use_data greater than use_pattern), even if this is not strictly necessary.

Also, pattern and data should not contain too few points (say, less than 5 or 4) or the identification may risk to be incorrect: more points enable the construction of many more triangles, reducing the risk of ambiguity (multiple valid solutions). Special situations, involving regularities in patterns (as, for instance, input data containing just three equidistant points, or the case of a regular grid of points) would certainly provide an answer, and this answer would very likely be wrong (the human brain would fail as well, and for exactly the same reasons).

The reason why a two steps approach is encouraged here is mainly to enable an efficient use of this function: in principle, constructing all possible triangles using all of the available points is never wrong, but it could become very slow: a list of N points implies the evaluation of N*(N-1)*(N-2)/2 triangles, and an even greater number of comparisons between triangles. The possibility of evaluating first a rough transformation based on a limited number of identified points, and then using this transformation for recovering all the remaining points, may significantly speed up the whole identification process. However it should again be ensured that the main requirement (i.e., that the searched point pattern must be contained in the data) would still be valid for the selected subsets of points: a random choice would likely lead to a matching failure (due to too few, or no, common points).

A secondary reason for the two steps approach is to limit the effect of another class of ambiguities, happening when either or both of the input matrices contains a very large number of uniformely distributed points. The likelihood to find several triangles that are similar by chance, and at all scales and orientations, may increase to unacceptable levels.

A real example may clarify a possible way of using this function: let data contain the positions (in pixel) of detected stars on a CCD. Typically hundreds of star positions would be available, but only the brightest ones may be used for preliminary identification. The input data positions will therefore be opportunely ordered from the brightest to the dimmest star positions. In order to identify stars, a star catalogue is needed. From a rough knowledge of the pointing position of the telescope and of the size of the field of view, a subset of stars can be selected from the catalogue: they will be stored in the pattern list, ordered as well by their brightness, and with their RA and Dec coordinates converted into standard coordinates (a gnomonic coordinate system centered on the telescope pointing, i.e., a cartesian coordinate system), no matter in what units of arc, and no matter what orientation of the field. For the first matching step, the 10 brightest catalogue stars may be selected (selecting less stars would perhaps be unsafe, selecting more would likely make the program slower without producing any better result). Therefore use_pattern would be set to 10. From the data side, it would generally be appropriate to select twice as many stars positions, just to ensure that the searched pattern is present. Therefore use_data would be set to 20. A reasonable value for tolerance and for radius would be respectively 0.1 (a 10% variation of scales and angles) and 20 (pixels).

cpl_bivector* cpl_ppm_match_positions ( const cpl_vector *  peaks,
const cpl_vector *  lines,
double  min_disp,
double  max_disp,
double  tolerance,
cpl_array **  seq_peaks,
cpl_array **  seq_lines 
)

Match 1-D patterns.

Parameters
peaksList of observed positions (e.g., of emission peaks)
linesList of positions in searched pattern (e.g., wavelengths)
min_dispMin expected scale (e.g., spectral dispersion in A/pixel)
max_dispMax expected scale (e.g., spectral dispersion in A/pixel)
toleranceTolerance for interval ratio comparison
seq_peaksReturned: index of identified peaks in input peaks
seq_linesReturned: index of identified lines in input lines
Returns
List of all matching points positions

This function attempts to find the reference pattern lines in a list of observed positions peaks. In the following documentation a terminology drawn from the context of arc lamp spectra calibration is used for simplicity: the reference pattern is then a list of wavelengths corresponding to a set of reference arc lamp emission lines - the so-called line catalog; while the observed positions are the positions (in pixel) on the CCD, measured along the dispersion direction, of any significant peak of the signal. To identify the observed peaks means to associate them with the right reference wavelength. This is attempted here with a point-pattern matching technique, where the pattern is contained in the vector lines, and is searched in the vector peak.

In order to work, this method just requires a rough expectation value of the spectral dispersion (in Angstrom/pixel), and a line catalog. The line catalog lines should just include lines that are expected somewhere in the CCD exposure of the calibration lamp (note, however, that a catalog including extra lines at its blue and/or red ends is still allowed).

Typically, the arc lamp lines candidates peak will include light contaminations, hot pixels, and other unwanted signal, but only in extreme cases does this prevent the pattern-recognition algorithm from identifying all the spectral lines. The pattern is detected even in the case peak contained more arc lamp lines than actually listed in the input line catalog.

This method is based on the assumption that the relation between wavelengths and CCD positions is with good approximation locally linear (this is always true, for any modern spectrograph).

The ratio between consecutive intervals pairs in wavelength and in pixel is invariant to linear transformations, and therefore this quantity can be used in the recognition of local portions of the searched pattern. All the examined sub-patterns will overlap, leading to the final identification of the whole pattern, notwithstanding the overall non-linearity of the relation between pixels and wavelengths.

Ambiguous cases, caused by exceptional regularities in the pattern, or by a number of undetected (but expected) peaks that disrupt the pattern on the data, are recovered by linear interpolation and extrapolation of the safely identified peaks.

More details about the applied algorithm can be found in the comments to the function code.

The seq_peaks and seq_lines are array reporting the positions of matching peaks and wavelengths in the input peaks and lines vectors. This functionality is not yet supported: this arguments should always be set to NULL or a CPL_ERROR_UNSUPPORTED_MODE would be set.

cpl-6.4.1/html/group__cpl__dfs.html0000644000460300003120000012721312310333015014165 00000000000000 Common Pipeline Library Reference Manual: DFS related functions
Common Pipeline Library Reference Manual  6.4.1
DFS related functions

Macros

#define CPL_DFS_PRO_CATG   "ESO PRO CATG"
 The name of the Product Category key.
 
#define CPL_DFS_PRO_SCIENCE   "ESO PRO SCIENCE"
 The name of the Product Science key.
 
#define CPL_DFS_PRO_TECH   "ESO PRO TECH"
 The name of the Product Tech key.
 
#define CPL_DFS_PRO_TYPE   "ESO PRO TYPE"
 The name of the Product Type key.
 

Functions

cpl_error_code cpl_dfs_save_imagelist (cpl_frameset *allframes, cpl_propertylist *header, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_frame *inherit, const cpl_imagelist *imagelist, cpl_type type, const char *recipe, const cpl_propertylist *applist, const char *remregexp, const char *pipe_id, const char *filename)
 Save an imagelist as a DFS-compliant pipeline product.
 
cpl_error_code cpl_dfs_save_paf (const char *instrume, const char *recipe, const cpl_propertylist *paflist, const char *filename)
 Create a new PAF file.
 
cpl_error_code cpl_dfs_save_propertylist (cpl_frameset *allframes, cpl_propertylist *header, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_frame *inherit, const char *recipe, const cpl_propertylist *applist, const char *remregexp, const char *pipe_id, const char *filename)
 Save a propertylist as a DFS-compliant pipeline product.
 
cpl_error_code cpl_dfs_save_table (cpl_frameset *allframes, cpl_propertylist *header, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_frame *inherit, const cpl_table *table, const cpl_propertylist *tablelist, const char *recipe, const cpl_propertylist *applist, const char *remregexp, const char *pipe_id, const char *filename)
 Save a table as a DFS-compliant pipeline product.
 
cpl_error_code cpl_dfs_setup_product_header (cpl_propertylist *header, const cpl_frame *product_frame, const cpl_frameset *framelist, const cpl_parameterlist *parlist, const char *recid, const char *pipeline_id, const char *dictionary_id, const cpl_frame *inherit_frame)
 Add product keywords to a pipeline product property list.
 
cpl_error_code cpl_dfs_update_product_header (cpl_frameset *self)
 Perform any DFS-compliancy required actions (DATAMD5/PIPEFILE update)
 

Detailed Description

Macro Definition Documentation

#define CPL_DFS_PRO_CATG   "ESO PRO CATG"

The name of the Product Category key.

See Also
cpl_dfs_save_image()
Note
A pipeline product must contain a string property with this name
#define CPL_DFS_PRO_SCIENCE   "ESO PRO SCIENCE"

The name of the Product Science key.

See Also
cpl_dfs_save_image()
Note
A pipeline product should contain a boolean property with this name
#define CPL_DFS_PRO_TECH   "ESO PRO TECH"

The name of the Product Tech key.

See Also
cpl_dfs_save_image()
Note
A pipeline product should contain a string property with this name
#define CPL_DFS_PRO_TYPE   "ESO PRO TYPE"

The name of the Product Type key.

See Also
cpl_dfs_save_image()
Note
A pipeline product should contain a string property with this name

Function Documentation

cpl_error_code cpl_dfs_save_imagelist ( cpl_frameset allframes,
cpl_propertylist header,
const cpl_parameterlist parlist,
const cpl_frameset usedframes,
const cpl_frame inherit,
const cpl_imagelist *  imagelist,
cpl_type  type,
const char *  recipe,
const cpl_propertylist applist,
const char *  remregexp,
const char *  pipe_id,
const char *  filename 
)

Save an imagelist as a DFS-compliant pipeline product.

Parameters
allframesThe list of input frames for the recipe
headerNULL, or filled with properties written to product header
parlistThe list of input parameters
usedframesThe list of raw/calibration frames used for this product
inheritNULL or product frames inherit their header from this frame
imagelistThe imagelist to be saved
typeThe type used to represent the data in the file
recipeThe recipe name
applistPropertylist to append to primary header, w. PRO.CATG
remregexpOptional regexp of properties not to put in main header
pipe_idPACKAGE "/" PACKAGE_VERSION
filenameFilename of created product
Note
remregexp may be NULL
Returns
CPL_ERROR_NONE or the relevant CPL error code on error
See Also
cpl_dfs_image_save(), cpl_imagelist_save().
cpl_error_code cpl_dfs_save_paf ( const char *  instrume,
const char *  recipe,
const cpl_propertylist paflist,
const char *  filename 
)

Create a new PAF file.

Parameters
instrumeName of instrument in capitals (NACO, VISIR, etc.)
recipeName of recipe
paflistPropertylist to save
filenameFilename of created PArameter File
Returns
CPL_ERROR_NONE or the relevant CPL error code on error
See Also
cpl_dfs_save_image().

The example below shows how to create a PAF from some FITS cards from the file ref_file and QC parameters in a propertylist qclist. Please note that qclist can be used also in calls to cpl_dfs_save_image() and cpl_dfs_save_table(). Error handling is omitted for brevity:

const char pafcopy[] = "^(DATE-OBS|ARCFILE|ESO TPL ID|ESO DET DIT|MJD-OBS)$";
pafcopy, 0);
cpl_propertylist_append(paflist, qclist);
cpl_dfs_save_paf("IIINSTRUMENT", "rrrecipe", paflist, "rrrecipe.paf");
cpl_error_code cpl_dfs_save_propertylist ( cpl_frameset allframes,
cpl_propertylist header,
const cpl_parameterlist parlist,
const cpl_frameset usedframes,
const cpl_frame inherit,
const char *  recipe,
const cpl_propertylist applist,
const char *  remregexp,
const char *  pipe_id,
const char *  filename 
)

Save a propertylist as a DFS-compliant pipeline product.

Parameters
allframesThe list of input frames for the recipe
headerNULL, or filled with properties written to product header
parlistThe list of input parameters
usedframesThe list of raw/calibration frames used for this product
inheritNULL or product frames inherit their header from this frame
recipeThe recipe name
applistPropertylist to append to primary header, w. PRO.CATG
remregexpOptional regexp of properties not to put in main header
pipe_idPACKAGE "/" PACKAGE_VERSION
filenameFilename of created product
Note
remregexp may be NULL
Returns
CPL_ERROR_NONE or the relevant CPL error code on error
See Also
cpl_dfs_image_save(), cpl_propertylistlist_save().

The FITS header of the created product is created from the provided applist and the cards copied by cpl_dfs_setup_product_header(), with exception of the cards whose keys match the provided remregexp.

The FITS data unit will be empty.

cpl_error_code cpl_dfs_save_table ( cpl_frameset allframes,
cpl_propertylist header,
const cpl_parameterlist parlist,
const cpl_frameset usedframes,
const cpl_frame inherit,
const cpl_table *  table,
const cpl_propertylist tablelist,
const char *  recipe,
const cpl_propertylist applist,
const char *  remregexp,
const char *  pipe_id,
const char *  filename 
)

Save a table as a DFS-compliant pipeline product.

Parameters
allframesThe list of input frames for the recipe
headerNULL, or filled with properties written to product header
parlistThe list of input parameters
usedframesThe list of raw/calibration frames used for this product
inheritNULL or product frames inherit their header from this frame
tableThe table to be saved
tablelistOptional propertylist to use in table extension or NULL
recipeThe recipe name
applistPropertylist to append to primary header, w. PRO.CATG
remregexpOptional regexp of properties not to put in main header
pipe_idPACKAGE "/" PACKAGE_VERSION
filenameFilename of created product
Returns
CPL_ERROR_NONE or the relevant CPL error code on error
See Also
cpl_dfs_save_image(), cpl_table_save().
cpl_error_code cpl_dfs_setup_product_header ( cpl_propertylist header,
const cpl_frame product_frame,
const cpl_frameset framelist,
const cpl_parameterlist parlist,
const char *  recid,
const char *  pipeline_id,
const char *  dictionary_id,
const cpl_frame inherit_frame 
)

Add product keywords to a pipeline product property list.

Parameters
headerProperty list where keywords must be written
product_frameFrame describing the product
framelistList of frames including all input frames
parlistRecipe parameter list
recidRecipe name
pipeline_idPipeline unique identifier
dictionary_idPRO dictionary identifier
inherit_frameFrame from which header information is inherited
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT An input pointer is NULL.
CPL_ERROR_DATA_NOT_FOUND The input framelist contains no input frames or a frame in the input framelist does not specify a file. In the former case the string "Empty set-of-frames" is appended to the error message returned by cpl_error_get_message().
CPL_ERROR_ILLEGAL_INPUT The product frame is not tagged or not grouped as CPL_FRAME_GROUP_PRODUCT. A specified inherit_frame doesn't belong to the input frame list, or it is not in FITS format.
CPL_ERROR_FILE_NOT_FOUND A frame in the input framelist specifies a non-existing file.
CPL_ERROR_BAD_FILE_FORMAT A frame in the input framelist specifies an invalid file.

This function checks the header associated to a pipeline product, to ensure that it is DICB compliant. In particular, this function does the following:

  1. Selects a reference frame from which the primary and secondary keyword information is inherited. The primary information is contained in the FITS keywords ORIGIN, TELESCOPE, INSTRUME, OBJECT, RA, DEC, EPOCH, EQUINOX, RADECSYS, DATE-OBS, MJD-OBS, UTC, LST, PI-COI, OBSERVER, while the secondary information is contained in all the other keywords. If the inherit_frame is just a NULL pointer, both primary and secondary information is inherited from the first frame in the input framelist with group CPL_FRAME_GROUP_RAW, or if no such frames are present the first frame with group CPL_FRAME_GROUP_CALIB. If inherit_frame is non-NULL, the secondary information is inherited from inherit_frame instead.
  1. Copy to header, if they are present, the following primary FITS keywords from the first input frame in the framelist: ORIGIN, TELESCOPE, INSTRUME, OBJECT, RA, DEC, EPOCH, EQUINOX, RADECSYS, DATE-OBS, MJD-OBS, UTC, LST, PI-COI, OBSERVER. If those keywords are already present in the header property list, they are overwritten only in case they have the same type. If any of these keywords are present with an unexpected type, a warning is issued, but the keywords are copied anyway (provided that the above conditions are fulfilled), and no error is set.
  1. Copy all the HIERARCH.ESO._ keywords from the primary FITS header of the inherit_frame in framelist, with the exception of the HIERARCH.ESO.DPR._, and of the .PRO._ and .DRS._ keywords if the inherit_frame is a calibration. If those keywords are already present in header, they are overwritten.
  1. If found, remove the HIERARCH.ESO.DPR._ keywords from header.
  1. If found, remove the ARCFILE and ORIGFILE keywords from header.
  1. Add to header the following mandatory keywords from the PRO dictionary: PIPEFILE, PRO.DID, PRO.REC1.ID, PRO.REC1.DRS.ID, PRO.REC1.PIPE.ID, and PRO.CATG. If those keywords are already present in header, they are overwritten. The keyword PRO.CATG is always set identical to the tag in product_frame.
  1. Only if missing, add to header the following mandatory keywords from the PRO dictionary: PRO.TYPE, PRO.TECH, and PRO.SCIENCE. The keyword PRO.TYPE will be set to "REDUCED". If the keyword DPR.TECH is found in the header of the first frame, PRO.TECH is given its value, alternatively if the keyword PRO.TECH is found it is copied instead, and if all fails the value "UNDEFINED" is set. Finally, if the keyword DPR.CATG is found in the header of the first frame and is set to "SCIENCE", the boolean keyword PRO.SCIENCE will be set to "true", otherwise it will be copied from an existing PRO.SCIENCE jeyword, while it will be set to "false" in all other cases.
  1. Check the existence of the keyword PRO.DATANCOM in header. If this keyword is missing, one is added, with the value of the total number of raw input frames.
  1. Add to header the keywords PRO.REC1.RAW1.NAME, PRO.REC1.RAW1.CATG, PRO.REC1.CAL1.NAME, PRO.REC1.CAL1.CATG, to describe the content of the input set-of-frames.

See the DICB PRO dictionary to have details on the mentioned PRO keywords.

Note
Non-FITS files are handled as files with an empty FITS header.
cpl_error_code cpl_dfs_update_product_header ( cpl_frameset self)

Perform any DFS-compliancy required actions (DATAMD5/PIPEFILE update)

Parameters
selfThe list of frames with FITS products created by the recipe
Returns
CPL_ERROR_NONE or the relevant CPL error code on error
Note
Each product frame must correspond to a FITS file created with a CPL FITS saving function.
Errors
CPL_ERROR_NULL_INPUT An input pointer is NULL.
CPL_ERROR_DATA_NOT_FOUND The input framelist contains a frame of type product with a missing filename.
CPL_ERROR_BAD_FILE_FORMAT The input framelist contains a frame of type product without a FITS card with key 'DATAMD5'.
CPL_ERROR_FILE_IO The input framelist contains a frame of type product for which the FITS card with key 'DATAMD5' could not be updated.
cpl-6.4.1/html/ftv2plastnode.png0000644000460300003120000000034512310333014013447 00000000000000‰PNG  IHDRɪ|¬IDATxí=QF‘Ø¥D«ÔkÄ:‰F©PK؃=V@§Õ³ Õ8SHxñÌ0bnrróŠ{ò½¿¾’$ ÀÏTŠP  ö¼X¬OÛd6êìòð"°²S´±O¥B€(¡àQé)š+YĈ ÒªËRÉÐ>VtÉsˆm9(ê„䜥k‚-@ȧ-Ü$ó b Ò[he ¿Kp-ôl|CùÿApRG'rÍ­aIEND®B`‚cpl-6.4.1/html/form_21.png0000644000460300003120000000106612310333020012117 00000000000000‰PNG  IHDRxêK×0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ï¥IDATxíË–¤ Do’‡Pm½ÿ¢é-ÓXÖ9ú%)Ï7ÈQãxöξoÛ>C"–†®r”ó(«UÆu­y–Öê»àE{0{'ã_Œàb§£uä,³}öñÖ\Î^†Û/÷gJ•têœ)ìZ0ÅçšÜRrxü ^!nÂÑÀ« Ëà{Ìëð—ÐßÜÀÇ?4Àü©3üŽÆIEND®B`‚cpl-6.4.1/html/group__cpl__matrix.html0000644000460300003120000054011412310333014014713 00000000000000 Common Pipeline Library Reference Manual: Matrices
Common Pipeline Library Reference Manual  6.4.1
Matrices

Functions

cpl_error_code cpl_matrix_add (cpl_matrix *matrix1, const cpl_matrix *matrix2)
 Add two matrices.
 
cpl_error_code cpl_matrix_add_scalar (cpl_matrix *matrix, double value)
 Add a scalar to a matrix.
 
cpl_error_code cpl_matrix_append (cpl_matrix *matrix1, const cpl_matrix *matrix2, int mode)
 Append a matrix to another.
 
cpl_error_code cpl_matrix_copy (cpl_matrix *matrix, const cpl_matrix *submatrix, cpl_size row, cpl_size col)
 Write the values of a matrix into another matrix.
 
cpl_error_code cpl_matrix_decomp_chol (cpl_matrix *self)
 Replace a matrix by its Cholesky-decomposition, L * transpose(L) = A.
 
void cpl_matrix_delete (cpl_matrix *matrix)
 Delete a matrix.
 
cpl_error_code cpl_matrix_divide (cpl_matrix *matrix1, const cpl_matrix *matrix2)
 Divide a matrix by another element by element.
 
cpl_error_code cpl_matrix_divide_scalar (cpl_matrix *matrix, double value)
 Divide a matrix by a scalar.
 
void cpl_matrix_dump (const cpl_matrix *matrix, FILE *stream)
 Print a matrix.
 
cpl_matrix * cpl_matrix_duplicate (const cpl_matrix *matrix)
 Make a copy of a matrix.
 
cpl_error_code cpl_matrix_erase_columns (cpl_matrix *matrix, cpl_size start, cpl_size count)
 Delete columns from a matrix.
 
cpl_error_code cpl_matrix_erase_rows (cpl_matrix *matrix, cpl_size start, cpl_size count)
 Delete rows from a matrix.
 
cpl_error_code cpl_matrix_exponential (cpl_matrix *matrix, double base)
 Compute the exponential of matrix elements.
 
cpl_matrix * cpl_matrix_extract (const cpl_matrix *matrix, cpl_size start_row, cpl_size start_column, cpl_size step_row, cpl_size step_column, cpl_size nrows, cpl_size ncolumns)
 Extract a submatrix from a matrix.
 
cpl_matrix * cpl_matrix_extract_column (const cpl_matrix *matrix, cpl_size column)
 Copy a matrix column.
 
cpl_matrix * cpl_matrix_extract_diagonal (const cpl_matrix *matrix, cpl_size diagonal)
 Extract a matrix diagonal.
 
cpl_matrix * cpl_matrix_extract_row (const cpl_matrix *matrix, cpl_size row)
 Extract a matrix row.
 
cpl_error_code cpl_matrix_fill (cpl_matrix *matrix, double value)
 Write the same value to all matrix elements.
 
cpl_error_code cpl_matrix_fill_column (cpl_matrix *matrix, double value, cpl_size column)
 Write the same value to a matrix column.
 
cpl_error_code cpl_matrix_fill_diagonal (cpl_matrix *matrix, double value, cpl_size diagonal)
 Write a given value to all elements of a given matrix diagonal.
 
cpl_error_code cpl_matrix_fill_row (cpl_matrix *matrix, double value, cpl_size row)
 Write the same value to a matrix row.
 
cpl_error_code cpl_matrix_fill_window (cpl_matrix *matrix, double value, cpl_size row, cpl_size col, cpl_size nrow, cpl_size ncol)
 Write the same value into a submatrix of a matrix.
 
cpl_error_code cpl_matrix_flip_columns (cpl_matrix *matrix)
 Reverse order of columns in matrix.
 
cpl_error_code cpl_matrix_flip_rows (cpl_matrix *matrix)
 Reverse order of rows in matrix.
 
double cpl_matrix_get (const cpl_matrix *matrix, cpl_size row, cpl_size column)
 Get the value of a matrix element.
 
double * cpl_matrix_get_data (cpl_matrix *matrix)
 Get the pointer to a matrix data buffer, or NULL in case of error.
 
const double * cpl_matrix_get_data_const (const cpl_matrix *matrix)
 Get the pointer to a matrix data buffer, or NULL in case of error.
 
double cpl_matrix_get_determinant (const cpl_matrix *matrix)
 Compute the determinant of a matrix.
 
double cpl_matrix_get_max (const cpl_matrix *matrix)
 Find the maximum value of matrix elements.
 
cpl_error_code cpl_matrix_get_maxpos (const cpl_matrix *matrix, cpl_size *row, cpl_size *column)
 Find position of the maximum value of matrix elements.
 
double cpl_matrix_get_mean (const cpl_matrix *matrix)
 Find the mean of all matrix elements.
 
double cpl_matrix_get_median (const cpl_matrix *matrix)
 Find the median of matrix elements.
 
double cpl_matrix_get_min (const cpl_matrix *matrix)
 Find the minimum value of matrix elements.
 
cpl_error_code cpl_matrix_get_minpos (const cpl_matrix *matrix, cpl_size *row, cpl_size *column)
 Find position of minimum value of matrix elements.
 
cpl_size cpl_matrix_get_ncol (const cpl_matrix *matrix)
 Get the number of columns of a matrix.
 
cpl_size cpl_matrix_get_nrow (const cpl_matrix *matrix)
 Get the number of rows of a matrix.
 
double cpl_matrix_get_stdev (const cpl_matrix *matrix)
 Find the standard deviation of matrix elements.
 
cpl_matrix * cpl_matrix_invert_create (const cpl_matrix *matrix)
 Find a matrix inverse.
 
int cpl_matrix_is_diagonal (const cpl_matrix *matrix, double tolerance)
 Check if a matrix is diagonal.
 
int cpl_matrix_is_identity (const cpl_matrix *matrix, double tolerance)
 Check for identity matrix.
 
int cpl_matrix_is_zero (const cpl_matrix *matrix, double tolerance)
 Check for zero matrix.
 
cpl_error_code cpl_matrix_logarithm (cpl_matrix *matrix, double base)
 Compute the logarithm of matrix elements.
 
cpl_error_code cpl_matrix_multiply (cpl_matrix *matrix1, const cpl_matrix *matrix2)
 Multiply two matrices element by element.
 
cpl_error_code cpl_matrix_multiply_scalar (cpl_matrix *matrix, double value)
 Multiply a matrix by a scalar.
 
cpl_matrix * cpl_matrix_new (cpl_size rows, cpl_size columns)
 Create a zero matrix of given size.
 
cpl_error_code cpl_matrix_power (cpl_matrix *matrix, double exponent)
 Compute a power of matrix elements.
 
cpl_matrix * cpl_matrix_product_create (const cpl_matrix *matrix1, const cpl_matrix *matrix2)
 Rows-by-columns product of two matrices.
 
cpl_error_code cpl_matrix_resize (cpl_matrix *matrix, cpl_size top, cpl_size bottom, cpl_size left, cpl_size right)
 Reframe a matrix.
 
cpl_error_code cpl_matrix_set (cpl_matrix *matrix, cpl_size row, cpl_size column, double value)
 Write a value to a matrix element.
 
cpl_error_code cpl_matrix_set_size (cpl_matrix *matrix, cpl_size rows, cpl_size columns)
 Resize a matrix.
 
cpl_error_code cpl_matrix_shift (cpl_matrix *matrix, cpl_size rshift, cpl_size cshift)
 Shift matrix elements.
 
cpl_matrix * cpl_matrix_solve (const cpl_matrix *coeff, const cpl_matrix *rhs)
 Solution of a linear system.
 
cpl_error_code cpl_matrix_solve_chol (const cpl_matrix *self, cpl_matrix *rhs)
 Solve a L*transpose(L)-system.
 
cpl_matrix * cpl_matrix_solve_normal (const cpl_matrix *coeff, const cpl_matrix *rhs)
 Solution of overdetermined linear equations in a least squares sense.
 
cpl_error_code cpl_matrix_sort_columns (cpl_matrix *matrix, int mode)
 Sort matrix by columns.
 
cpl_error_code cpl_matrix_sort_rows (cpl_matrix *matrix, int mode)
 Sort matrix by rows.
 
cpl_error_code cpl_matrix_subtract (cpl_matrix *matrix1, const cpl_matrix *matrix2)
 Subtract a matrix from another.
 
cpl_error_code cpl_matrix_subtract_scalar (cpl_matrix *matrix, double value)
 Subtract a scalar to a matrix.
 
cpl_error_code cpl_matrix_swap_columns (cpl_matrix *matrix, cpl_size column1, cpl_size column2)
 Swap two matrix columns.
 
cpl_error_code cpl_matrix_swap_rowcolumn (cpl_matrix *matrix, cpl_size row)
 Swap a matrix column with a matrix row.
 
cpl_error_code cpl_matrix_swap_rows (cpl_matrix *matrix, cpl_size row1, cpl_size row2)
 Swap two matrix rows.
 
cpl_error_code cpl_matrix_threshold_small (cpl_matrix *matrix, double tolerance)
 Rounding to zero very small numbers in matrix.
 
cpl_matrix * cpl_matrix_transpose_create (const cpl_matrix *matrix)
 Create transposed matrix.
 
void * cpl_matrix_unwrap (cpl_matrix *matrix)
 Delete a matrix, but not its data buffer.
 
cpl_matrix * cpl_matrix_wrap (cpl_size rows, cpl_size columns, double *data)
 Create a new matrix from existing data.
 

Detailed Description

This module provides functions to create, destroy and use a cpl_matrix. The elements of a cpl_matrix with M rows and N columns are counted from 0,0 to M-1,N-1. The matrix element 0,0 is the one at the upper left corner of a matrix. The CPL matrix functions work properly only in the case the matrices elements do not contain garbage (such as NaN or infinity).

Synopsis:
#include <cpl_matrix.h>

Function Documentation

cpl_error_code cpl_matrix_add ( cpl_matrix *  matrix1,
const cpl_matrix *  matrix2 
)

Add two matrices.

Parameters
matrix1Pointer to first matrix.
matrix2Pointer to second matrix.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT An input matrix is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT The specified matrices do not have the same size.

Add two matrices element by element. The two matrices must have identical sizes. The result is written to the first matrix.

cpl_error_code cpl_matrix_add_scalar ( cpl_matrix *  matrix,
double  value 
)

Add a scalar to a matrix.

Parameters
matrixPointer to matrix.
valueValue to add.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

Add the same value to each matrix element.

cpl_error_code cpl_matrix_append ( cpl_matrix *  matrix1,
const cpl_matrix *  matrix2,
int  mode 
)

Append a matrix to another.

Parameters
matrix1Pointer to first matrix.
matrix2Pointer to second matrix.
modeMatrices connected horizontally (0) or vertically (1).
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT An input matrix is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT mode is neither 0 nor 1.
CPL_ERROR_INCOMPATIBLE_INPUT Matrices cannot be joined as indicated by mode.

If mode is set to 0, the matrices must have the same number of rows, and are connected horizontally with the first matrix on the left. If mode is set to 1, the matrices must have the same number of columns, and are connected vertically with the first matrix on top. The first matrix is expanded to include the values from the second matrix, while the second matrix is left untouched.

Note
The pointer to the first matrix data buffer may change, therefore pointers previously retrieved by calling cpl_matrix_get_data() should be discarded.
cpl_error_code cpl_matrix_copy ( cpl_matrix *  matrix,
const cpl_matrix *  submatrix,
cpl_size  row,
cpl_size  col 
)

Write the values of a matrix into another matrix.

Parameters
matrixPointer to matrix to be modified.
submatrixPointer to matrix to get the values from.
rowPosition of row 0 of submatrix in matrix.
colPosition of column 0 of submatrix in matrix.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix or submatrix are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE No overlap exists between the two matrices.

The values of submatrix are written to matrix starting at the indicated row and column. There are no restrictions on the sizes of submatrix: just the parts of submatrix overlapping matrix are copied. There are no restrictions on row and col either, that can also be negative. If the two matrices do not overlap, nothing is done, but an error condition is set.

cpl_error_code cpl_matrix_decomp_chol ( cpl_matrix *  self)

Replace a matrix by its Cholesky-decomposition, L * transpose(L) = A.

Parameters
selfN by N symmetric positive-definite matrix to decompose
Returns
CPL_ERROR_NONE on success, or the relevant CPL error code
Note
Only the upper triangle of self is read, L is written in the lower triangle
If the matrix is singular the elements of self become undefined
See Also
Golub & Van Loan, Matrix Computations, Algorithm 4.2.1 (Cholesky: Gaxpy Version).
Errors
CPL_ERROR_NULL_INPUT An input pointer is NULL.
CPL_ERROR_ILLEGAL_INPUT self is not an n by n matrix.
CPL_ERROR_SINGULAR_MATRIX self is not symmetric, positive definite.
void cpl_matrix_delete ( cpl_matrix *  matrix)

Delete a matrix.

Parameters
matrixPointer to a matrix to be deleted.
Returns
Nothing.

This function frees all the memory associated to a matrix. If matrix is NULL, nothing is done.

cpl_error_code cpl_matrix_divide ( cpl_matrix *  matrix1,
const cpl_matrix *  matrix2 
)

Divide a matrix by another element by element.

Parameters
matrix1Pointer to first matrix.
matrix2Pointer to second matrix.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT An input matrix is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT The specified matrices do not have the same size.

Divide each element of the first matrix by the corresponding element of the second one. The two matrices must have the same number of rows and columns. The result is written to the first matrix. No check is made against a division by zero.

cpl_error_code cpl_matrix_divide_scalar ( cpl_matrix *  matrix,
double  value 
)

Divide a matrix by a scalar.

Parameters
matrixPointer to matrix.
valueDivisor.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_DIVISION_BY_ZERO The input value is 0.0.

Divide each matrix element by the same value.

void cpl_matrix_dump ( const cpl_matrix *  matrix,
FILE *  stream 
)

Print a matrix.

Parameters
matrixThe matrix to print
streamThe output stream
Returns
Nothing.

This function is intended just for debugging. It just prints the elements of a matrix, ordered in rows and columns, to the specified stream or FILE pointer. If the specified stream is NULL, it is set to stdout. The function used for printing is the standard C fprintf().

cpl_matrix* cpl_matrix_duplicate ( const cpl_matrix *  matrix)

Make a copy of a matrix.

Parameters
matrixMatrix to be duplicated.
Returns
Pointer to the new matrix, or NULL in case of error.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

A copy of the input matrix is created. To destroy the duplicated matrix the function cpl_matrix_delete() should be used.

cpl_error_code cpl_matrix_erase_columns ( cpl_matrix *  matrix,
cpl_size  start,
cpl_size  count 
)

Delete columns from a matrix.

Parameters
matrixPointer to matrix to be modified.
startFirst column to delete.
countNumber of columns to delete.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The specified start is outside the matrix boundaries.
CPL_ERROR_ILLEGAL_INPUT count is not positive.
CPL_ERROR_ILLEGAL_OUTPUT Attempt to delete all the columns of matrix.

A portion of the matrix data is physically removed. The pointer to matrix data may change, therefore pointers previously retrieved by calling cpl_matrix_get_data() should be discarded. The specified segment can extend beyond the end of the matrix, but the attempt to remove all matrix columns is flagged as an error because zero length matrices are illegal. Columns are counted starting from 0.

cpl_error_code cpl_matrix_erase_rows ( cpl_matrix *  matrix,
cpl_size  start,
cpl_size  count 
)

Delete rows from a matrix.

Parameters
matrixPointer to matrix to be modified.
startFirst row to delete.
countNumber of rows to delete.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The specified start is outside the matrix boundaries.
CPL_ERROR_ILLEGAL_INPUT count is not positive.
CPL_ERROR_ILLEGAL_OUTPUT Attempt to delete all the rows of matrix.

A portion of the matrix data is physically removed. The pointer to matrix data may change, therefore pointers previously retrieved by calling cpl_matrix_get_data() should be discarded. The specified segment can extend beyond the end of the matrix, but the attempt to remove all matrix rows is flagged as an error because zero length matrices are illegal. Rows are counted starting from 0.

cpl_error_code cpl_matrix_exponential ( cpl_matrix *  matrix,
double  base 
)

Compute the exponential of matrix elements.

Parameters
matrixTarget matrix.
baseExponential base.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The input base is not positive.

Each matrix element is replaced by its exponential in the specified base. The base must be positive.

cpl_matrix* cpl_matrix_extract ( const cpl_matrix *  matrix,
cpl_size  start_row,
cpl_size  start_column,
cpl_size  step_row,
cpl_size  step_column,
cpl_size  nrows,
cpl_size  ncolumns 
)

Extract a submatrix from a matrix.

Parameters
matrixPointer to the input matrix.
start_rowMatrix row where to begin extraction.
start_columnMatrix column where to begin extraction.
step_rowStep between extracted rows.
step_columnStep between extracted columns.
nrowsNumber of rows to extract.
ncolumnsNumber of columns to extract.
Returns
Pointer to the new matrix, or NULL in case of error.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The start position is outside the matrix boundaries.
CPL_ERROR_ILLEGAL_INPUT While nrows and ncolumns are greater than 1, the specified steps are not positive.

The new matrix will include the nrows x ncolumns values read from the input matrix elements starting from position (start_row, start_column), in a grid of steps step_row and step_column. If the extraction parameters exceed the input matrix boundaries, just the overlap is returned, and this matrix would have sizes smaller than nrows x ncolumns. To destroy the new matrix the function cpl_matrix_delete() should be used.

cpl_matrix* cpl_matrix_extract_column ( const cpl_matrix *  matrix,
cpl_size  column 
)

Copy a matrix column.

Parameters
matrixPointer to matrix containing the column.
columnSequence number of column to copy.
Returns
Pointer to new matrix, or NULL in case of error.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The column is outside the matrix boundaries.

If a MxN matrix is given in input, the extracted row is a new Mx1 matrix. The column number is counted from 0. To destroy the new matrix the function cpl_matrix_delete() should be used.

cpl_matrix* cpl_matrix_extract_diagonal ( const cpl_matrix *  matrix,
cpl_size  diagonal 
)

Extract a matrix diagonal.

Parameters
matrixPointer to the matrix containing the diagonal.
diagonalSequence number of the diagonal to copy.
Returns
Pointer to the new matrix, or NULL in case of error.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The diagonal is outside the matrix boundaries (see description below).

If a MxN matrix is given in input, the extracted diagonal is a Mx1 matrix if N >= M, or a 1xN matrix if N < M. The diagonal number is counted from 0, corresponding to the matrix diagonal starting at element (0,0). A square matrix has just one diagonal; if M != N, the number of diagonals in the matrix is |M - N| + 1. To specify a diagonal sequence number outside this range would set an error condition, and a NULL pointer would be returned. To destroy the new matrix the function cpl_matrix_delete() should be used.

cpl_matrix* cpl_matrix_extract_row ( const cpl_matrix *  matrix,
cpl_size  row 
)

Extract a matrix row.

Parameters
matrixPointer to the matrix containing the row.
rowSequence number of row to copy.
Returns
Pointer to new matrix, or NULL in case of error.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The row is outside the matrix boundaries.

If a MxN matrix is given in input, the extracted row is a new 1xN matrix. The row number is counted from 0. To destroy the new matrix the function cpl_matrix_delete() should be used.

cpl_error_code cpl_matrix_fill ( cpl_matrix *  matrix,
double  value 
)

Write the same value to all matrix elements.

Parameters
matrixPointer to the matrix to access
valueValue to write
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

Write the same value to all matrix elements.

cpl_error_code cpl_matrix_fill_column ( cpl_matrix *  matrix,
double  value,
cpl_size  column 
)

Write the same value to a matrix column.

Parameters
matrixPointer to the matrix to access
valueValue to write
columnSequence number of column to overwrite
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The specified column is outside the matrix boundaries.

Write the same value to a matrix column. Columns are counted starting from 0.

cpl_error_code cpl_matrix_fill_diagonal ( cpl_matrix *  matrix,
double  value,
cpl_size  diagonal 
)

Write a given value to all elements of a given matrix diagonal.

Parameters
matrixMatrix to modify
valueValue to write to diagonal
diagonalNumber of diagonal to overwrite, 0 for main, positive for above main, negative for below main
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The specified diagonal is outside the matrix boundaries (see description below).
cpl_error_code cpl_matrix_fill_row ( cpl_matrix *  matrix,
double  value,
cpl_size  row 
)

Write the same value to a matrix row.

Parameters
matrixMatrix to access
valueValue to write
rowSequence number of row to overwrite.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The specified row is outside the matrix boundaries.

Write the same value to a matrix row. Rows are counted starting from 0.

cpl_error_code cpl_matrix_fill_window ( cpl_matrix *  matrix,
double  value,
cpl_size  row,
cpl_size  col,
cpl_size  nrow,
cpl_size  ncol 
)

Write the same value into a submatrix of a matrix.

Parameters
matrixPointer to matrix to be modified.
valueValue to write.
rowStart row of matrix submatrix.
colStart column of matrix submatrix.
nrowNumber of rows of matrix submatrix.
ncolNumber of columns of matrix submatrix.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The specified start position is outside the matrix boundaries.
CPL_ERROR_ILLEGAL_INPUT nrow or ncol are not positive.

The specified value is written to matrix starting at the indicated row and column; nrow and ncol can exceed the input matrix boundaries, just the range overlapping the matrix is used in that case.

cpl_error_code cpl_matrix_flip_columns ( cpl_matrix *  matrix)

Reverse order of columns in matrix.

Parameters
matrixPointer to matrix to be reversed.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The order of the columns in the matrix is reversed in place.

cpl_error_code cpl_matrix_flip_rows ( cpl_matrix *  matrix)

Reverse order of rows in matrix.

Parameters
matrixPointer to matrix to be reversed.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The order of the rows in the matrix is reversed in place.

double cpl_matrix_get ( const cpl_matrix *  matrix,
cpl_size  row,
cpl_size  column 
)

Get the value of a matrix element.

Parameters
matrixPointer to a matrix.
rowMatrix element row.
columnMatrix element column.
Returns
Value of the specified matrix element, or 0.0 in case of error.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The accessed element is beyond the matrix boundaries.

Get the value of a matrix element. The matrix rows and columns are counted from 0,0.

double* cpl_matrix_get_data ( cpl_matrix *  matrix)

Get the pointer to a matrix data buffer, or NULL in case of error.

Parameters
matrixInput matrix.
Returns
Pointer to the matrix data buffer.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

A cpl_matrix object includes an array of values of type double. This function returns a pointer to this internal array, whose first element corresponds to the cpl_matrix element 0,0. The internal array contains in sequence all the cpl_matrix rows. For instance, in the case of a 3x4 matrix, the array elements

0 1 2 3 4 5 6 7 8 9 10 11

would correspond to the following matrix elements:

0 1 2 3
4 5 6 7
8 9 10 11
Note
Use at your own risk: direct manipulation of matrix data rules out any check performed by the matrix object interface, and may introduce inconsistencies between the information maintained internally, and the actual matrix data and structure.
const double* cpl_matrix_get_data_const ( const cpl_matrix *  matrix)

Get the pointer to a matrix data buffer, or NULL in case of error.

Parameters
matrixInput matrix.
Returns
Pointer to the matrix data buffer.
See Also
cpl_matrix_get_data
double cpl_matrix_get_determinant ( const cpl_matrix *  matrix)

Compute the determinant of a matrix.

Parameters
matrixPointer to n by n matrix.
Returns
Matrix determinant. In case of error, 0.0 is returned.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The input matrix is not square.
CPL_ERROR_UNSPECIFIED The input matrix is near-singular with a determinant so close to zero that it cannot be represented by a double.

The input matrix must be a square matrix. In case of a 1x1 matrix, the matrix single element value is returned.

double cpl_matrix_get_max ( const cpl_matrix *  matrix)

Find the maximum value of matrix elements.

Parameters
matrixPointer to matrix.
Returns
Maximum value. In case of error, 0.0 is returned.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The maximum value of all matrix elements is found.

cpl_error_code cpl_matrix_get_maxpos ( const cpl_matrix *  matrix,
cpl_size row,
cpl_size column 
)

Find position of the maximum value of matrix elements.

Parameters
matrixInput matrix.
rowReturned row position of maximum.
columnReturned column position of maximum.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The position of the maximum value of all matrix elements is found. If more than one matrix element have a value corresponding to the maximum, the lowest element row number is returned in row. If more than one maximum matrix elements have the same row number, the lowest element column number is returned in column.

double cpl_matrix_get_mean ( const cpl_matrix *  matrix)

Find the mean of all matrix elements.

Parameters
matrixPointer to matrix.
Returns
Mean. In case of error 0.0 is returned.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The mean value of all matrix elements is calculated.

Note
This function works properly only in the case all the elements of the input matrix do not contain garbage (such as NaN or infinity).
double cpl_matrix_get_median ( const cpl_matrix *  matrix)

Find the median of matrix elements.

Parameters
matrixPointer to matrix.
Returns
Median. In case of error 0.0 is returned.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The median value of all matrix elements is calculated.

double cpl_matrix_get_min ( const cpl_matrix *  matrix)

Find the minimum value of matrix elements.

Parameters
matrixPointer to matrix.
Returns
Minimum value. In case of error, 0.0 is returned.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The minimum value of all matrix elements is found.

cpl_error_code cpl_matrix_get_minpos ( const cpl_matrix *  matrix,
cpl_size row,
cpl_size column 
)

Find position of minimum value of matrix elements.

Parameters
matrixInput matrix.
rowReturned row position of minimum.
columnReturned column position of minimum.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The position of the minimum value of all matrix elements is found. If more than one matrix element have a value corresponding to the minimum, the lowest element row number is returned in row. If more than one minimum matrix elements have the same row number, the lowest element column number is returned in column.

cpl_size cpl_matrix_get_ncol ( const cpl_matrix *  matrix)

Get the number of columns of a matrix.

Parameters
matrixPointer to the matrix to examine.
Returns
Number of matrix columns, or zero in case of failure.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

Determine the number of columns in a matrix.

cpl_size cpl_matrix_get_nrow ( const cpl_matrix *  matrix)

Get the number of rows of a matrix.

Parameters
matrixPointer to the matrix to examine.
Returns
Number of matrix rows, or zero in case of failure.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

Determine the number of rows in a matrix.

double cpl_matrix_get_stdev ( const cpl_matrix *  matrix)

Find the standard deviation of matrix elements.

Parameters
matrixPointer to matrix.
Returns
Standard deviation. In case of error, or if a matrix is 1x1, 0.0 is returned.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The standard deviation of all matrix elements is calculated.

Note
This function works properly only in the case all the elements of the input matrix do not contain garbage (such as NaN or infinity).
cpl_matrix* cpl_matrix_invert_create ( const cpl_matrix *  matrix)

Find a matrix inverse.

Parameters
matrixPointer to matrix to invert.
Returns
Inverse matrix. In case of error a NULL is returned.
Errors
CPL_ERROR_NULL_INPUT Any input is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT self is not an n by n matrix.
CPL_ERROR_SINGULAR_MATRIX matrix cannot be inverted.

The input must be a square matrix. To destroy the new matrix the function cpl_matrix_delete() should be used.

Note
When calling cpl_matrix_invert_create() with a nearly singular matrix, it is possible to get a result containin NaN values without any error code being set.
int cpl_matrix_is_diagonal ( const cpl_matrix *  matrix,
double  tolerance 
)

Check if a matrix is diagonal.

Parameters
matrixPointer to matrix to be checked.
toleranceMax tolerated rounding to zero.
Returns
1 in case of diagonal matrix, 0 otherwise. If a NULL pointer is passed, or the input matrix is not square, -1 is returned.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

A threshold may be specified to consider zero any number that is close enough to zero. If the specified tolerance is negative, a default of DBL_EPSILON is used. A zero tolerance may also be specified. No error is set if the input matrix is not square.

int cpl_matrix_is_identity ( const cpl_matrix *  matrix,
double  tolerance 
)

Check for identity matrix.

Parameters
matrixPointer to matrix to be checked.
toleranceMax tolerated rounding to zero, or to one.
Returns
1 in case of identity matrix, 0 otherwise. If a NULL pointer is passed, or the input matrix is not square, -1 is returned.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

A threshold may be specified to consider zero any number that is close enough to zero, and 1 any number that is close enough to 1. If the specified tolerance is negative, a default of DBL_EPSILON is used. A zero tolerance may also be specified. No error is set if the input matrix is not square.

int cpl_matrix_is_zero ( const cpl_matrix *  matrix,
double  tolerance 
)

Check for zero matrix.

Parameters
matrixPointer to matrix to be checked.
toleranceMax tolerated rounding to zero.
Returns
1 in case of zero matrix, 0 otherwise. If a NULL pointer is passed, -1 is returned.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

After specific manipulations of a matrix some of its elements may theoretically be expected to be zero. However, because of numerical noise, such elements may turn out not to be exactly zero. In this specific case, if any of the matrix element is not exactly zero, the matrix would not be classified as a null matrix. A threshold may be specified to consider zero any number that is close enough to zero. If the specified tolerance is negative, a default of DBL_EPSILON is used. A zero tolerance may also be specified.

cpl_error_code cpl_matrix_logarithm ( cpl_matrix *  matrix,
double  base 
)

Compute the logarithm of matrix elements.

Parameters
matrixPointer to matrix.
baseLogarithm base.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The input base, or any matrix element, is not positive.

Each matrix element is replaced by its logarithm in the specified base. The base and all matrix elements must be positive. If this is not the case, the matrix would not be modified.

cpl_error_code cpl_matrix_multiply ( cpl_matrix *  matrix1,
const cpl_matrix *  matrix2 
)

Multiply two matrices element by element.

Parameters
matrix1Pointer to first matrix.
matrix2Pointer to second matrix.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT An input matrix is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT The specified matrices do not have the same size.

Multiply the two matrices element by element. The two matrices must have identical sizes. The result is written to the first matrix.

Note
To obtain the rows-by-columns product between two matrices, cpl_matrix_product_create() should be used instead.
cpl_error_code cpl_matrix_multiply_scalar ( cpl_matrix *  matrix,
double  value 
)

Multiply a matrix by a scalar.

Parameters
matrixPointer to matrix.
valueMultiplication factor.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

Multiply each matrix element by the same factor.

cpl_matrix* cpl_matrix_new ( cpl_size  rows,
cpl_size  columns 
)

Create a zero matrix of given size.

Parameters
rowsNumber of matrix rows.
columnsNumber of matrix columns.
Returns
Pointer to new matrix, or NULL in case of error.
Errors
CPL_ERROR_ILLEGAL_INPUT rows or columns are not positive numbers.

This function allocates and initialises to zero a matrix of given size. To destroy this matrix the function cpl_matrix_delete() should be used.

cpl_error_code cpl_matrix_power ( cpl_matrix *  matrix,
double  exponent 
)

Compute a power of matrix elements.

Parameters
matrixPointer to matrix.
exponentConstant exponent.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT Any matrix element is not compatible with the specified exponent (see description below).

Each matrix element is replaced by its power to the specified exponent. If the specified exponent is not negative, all matrix elements must be not negative; if the specified exponent is negative, all matrix elements must be positive; otherwise, an error condition is set and the matrix will be left unchanged. If the exponent is exactly 0.5 the (faster) sqrt() will be applied instead of pow(). If the exponent is zero, then any (non negative) matrix element would be assigned the value 1.0.

cpl_matrix* cpl_matrix_product_create ( const cpl_matrix *  matrix1,
const cpl_matrix *  matrix2 
)

Rows-by-columns product of two matrices.

Parameters
matrix1Pointer to left side matrix.
matrix2Pointer to right side matrix.
Returns
Pointer to product matrix, or NULL in case of error.
Errors
CPL_ERROR_NULL_INPUT An input matrix is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT The number of columns of the first matrix is not equal to the number of rows of the second matrix.

Rows-by-columns product of two matrices. The number of columns of the first matrix must be equal to the number of rows of the second matrix. To destroy the new matrix the function cpl_matrix_delete() should be used.

cpl_error_code cpl_matrix_resize ( cpl_matrix *  matrix,
cpl_size  top,
cpl_size  bottom,
cpl_size  left,
cpl_size  right 
)

Reframe a matrix.

Parameters
matrixPointer to matrix to be modified.
topExtra rows on top.
bottomExtra rows on bottom.
leftExtra columns on left.
rightExtra columns on right.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ILLEGAL_OUTPUT Attempt to shrink matrix to zero size (or less).

The input matrix is reframed according to specifications. Extra rows and column on the sides might also be negative, as long as they are compatible with the matrix sizes: the input matrix would be reduced in size accordingly, but an attempt to remove all matrix columns and/or rows is flagged as an error because zero length matrices are illegal. The old matrix elements contained in the new shape are left unchanged, and new matrix elements added by the reshaping are initialised to zero. No reshaping (i.e., all the extra rows set to zero) would not be flagged as an error.

Note
The pointer to the matrix data buffer may change, therefore pointers previously retrieved by calling cpl_matrix_get_data() should be discarded.
cpl_error_code cpl_matrix_set ( cpl_matrix *  matrix,
cpl_size  row,
cpl_size  column,
double  value 
)

Write a value to a matrix element.

Parameters
matrixInput matrix.
rowMatrix element row.
columnMatrix element column.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The accessed element is beyond the matrix boundaries.

Write a value to a matrix element. The matrix rows and columns are counted from 0,0.

cpl_error_code cpl_matrix_set_size ( cpl_matrix *  matrix,
cpl_size  rows,
cpl_size  columns 
)

Resize a matrix.

Parameters
matrixPointer to matrix to be resized.
rowsNew number of rows.
columnsNew number of columns.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ILLEGAL_OUTPUT Attempt to shrink matrix to zero size (or less).

The input matrix is resized according to specifications. The old matrix elements contained in the resized matrix are left unchanged, and new matrix elements added by an increase of the matrix number of rows and/or columns are initialised to zero.

Note
The pointer to the matrix data buffer may change, therefore pointers previously retrieved by calling cpl_matrix_get_data() should be discarded.
cpl_error_code cpl_matrix_shift ( cpl_matrix *  matrix,
cpl_size  rshift,
cpl_size  cshift 
)

Shift matrix elements.

Parameters
matrixPointer to matrix to be modified.
rshiftShift in the vertical direction.
cshiftShift in the horizontal direction.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The performed shift operation is cyclical (toroidal), i.e., matrix elements shifted out of one side of the matrix get shifted in from its opposite side. There are no restrictions on the values of the shift. Positive shifts are always in the direction of increasing row/column indexes.

cpl_matrix* cpl_matrix_solve ( const cpl_matrix *  coeff,
const cpl_matrix *  rhs 
)

Solution of a linear system.

Parameters
coeffA non-singular N by N matrix.
rhsA matrix containing one or more right-hand-sides.
Note
rhs must have N rows and may contain more than one column, which each represent an independent right-hand-side.
Returns
A newly allocated solution matrix with the size as rhs, or NULL on error.
Errors
CPL_ERROR_NULL_INPUT Any input is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT coeff is not a square matrix.
CPL_ERROR_INCOMPATIBLE_INPUT coeff and rhs do not have the same number of rows.
CPL_ERROR_SINGULAR_MATRIX coeff is singular (to working precision).

Compute the solution of a system of N equations with N unknowns:

coeff * X = rhs

coeff must be an NxN matrix, and rhs a NxM matrix. M greater than 1 means that multiple independent right-hand-sides are solved for. To destroy the solution matrix the function cpl_matrix_delete() should be used.

cpl_error_code cpl_matrix_solve_chol ( const cpl_matrix *  self,
cpl_matrix *  rhs 
)

Solve a L*transpose(L)-system.

Parameters
selfN by N L*transpose(L)-matrix from cpl_matrix_decomp_chol()
rhsM right-hand-sides to be replaced by their solution
Returns
CPL_ERROR_NONE on success, or the relevant CPL error code
See Also
cpl_matrix_decomp_chol()
Note
Only the lower triangle of self is accessed
Errors
CPL_ERROR_NULL_INPUT An input pointer is NULL.
CPL_ERROR_ILLEGAL_INPUT self is not an n by n matrix.
CPL_ERROR_INCOMPATIBLE_INPUT The specified matrices do not have the same number of rows.
CPL_ERROR_DIVISION_BY_ZERO The main diagonal of L contains a zero. This error can only occur if the L*transpose(L)-matrix does not come from a successful call to cpl_matrix_decomp_chol().
cpl_matrix* cpl_matrix_solve_normal ( const cpl_matrix *  coeff,
const cpl_matrix *  rhs 
)

Solution of overdetermined linear equations in a least squares sense.

Parameters
coeffThe N by M matrix of coefficients, where N >= M.
rhsAn N by K matrix containing K right-hand-sides.
Note
rhs may contain more than one column, which each represent an independent right-hand-side.
Returns
A newly allocated M by K solution matrix, or NULL on error.
Errors
CPL_ERROR_NULL_INPUT Any input is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT coeff and rhs do not have the same number of rows.
CPL_ERROR_SINGULAR_MATRIX The matrix is (near) singular and a solution cannot be computed.

The following linear system of N equations and M unknowns is given:

coeff * X = rhs

where coeff is the NxM matrix of the coefficients, X is the MxK matrix of the unknowns, and rhs the NxK matrix containing the K right hand side(s).

The solution to the normal equations is known to be a least-squares solution, i.e. the 2-norm of coeff * X - rhs is minimized by the solution to transpose(coeff) * coeff * X = transpose(coeff) * rhs.

In the case that coeff is square (N is equal to M) it gives a faster and more accurate result to use cpl_matrix_solve().

The solution matrix should be deallocated with the function cpl_matrix_delete().

cpl_error_code cpl_matrix_sort_columns ( cpl_matrix *  matrix,
int  mode 
)

Sort matrix by columns.

Parameters
matrixPointer to matrix to be sorted.
modeSorting mode: 0, by absolute value, otherwise by value.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The matrix elements of the top row are used as reference for the column sorting, if there are identical the values of the second row are considered, etc. Columns with the largest values go on the right. If mode is equal to zero, the columns are sorted according to their absolute values (zeroes at left).

cpl_error_code cpl_matrix_sort_rows ( cpl_matrix *  matrix,
int  mode 
)

Sort matrix by rows.

Parameters
matrixPointer to matrix to be sorted.
modeSorting mode: 0, by absolute value, otherwise by value.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The matrix elements of the leftmost column are used as reference for the row sorting, if there are identical the values of the second column are considered, etc. Rows with the greater values go on top. If mode is equal to zero, the rows are sorted according to their absolute values (zeroes at bottom).

cpl_error_code cpl_matrix_subtract ( cpl_matrix *  matrix1,
const cpl_matrix *  matrix2 
)

Subtract a matrix from another.

Parameters
matrix1Pointer to first matrix.
matrix2Pointer to second matrix.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT An input matrix is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT The specified matrices do not have the same size.

Subtract the second matrix from the first one element by element. The two matrices must have identical sizes. The result is written to the first matrix.

cpl_error_code cpl_matrix_subtract_scalar ( cpl_matrix *  matrix,
double  value 
)

Subtract a scalar to a matrix.

Parameters
matrixPointer to matrix.
valueValue to subtract.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

Subtract the same value to each matrix element.

cpl_error_code cpl_matrix_swap_columns ( cpl_matrix *  matrix,
cpl_size  column1,
cpl_size  column2 
)

Swap two matrix columns.

Parameters
matrixPointer to matrix to be modified.
column1One matrix column.
column2Another matrix column.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE Any of the specified columns is outside the matrix boundaries.

The values of two given matrix columns are exchanged. Columns are counted starting from 0. If the same column number is given twice, nothing is done and no error is set.

cpl_error_code cpl_matrix_swap_rowcolumn ( cpl_matrix *  matrix,
cpl_size  row 
)

Swap a matrix column with a matrix row.

Parameters
matrixPointer to matrix to be modified.
rowMatrix row.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The specified row is outside the matrix boundaries.
CPL_ERROR_ILLEGAL_INPUT The input matrix is not square.

The values of the indicated row are exchanged with the column having the same sequence number. Rows and columns are counted starting from 0.

cpl_error_code cpl_matrix_swap_rows ( cpl_matrix *  matrix,
cpl_size  row1,
cpl_size  row2 
)

Swap two matrix rows.

Parameters
matrixPointer to matrix to be modified.
row1One matrix row.
row2Another matrix row.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE Any of the specified rows is outside the matrix boundaries.

The values of two given matrix rows are exchanged. Rows are counted starting from 0. If the same row number is given twice, nothing is done and no error is set.

cpl_error_code cpl_matrix_threshold_small ( cpl_matrix *  matrix,
double  tolerance 
)

Rounding to zero very small numbers in matrix.

Parameters
matrixPointer to matrix to be chopped.
toleranceMax tolerated rounding to zero.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

After specific manipulations of a matrix some of its elements may theoretically be expected to be zero (for instance, as a result of multiplying a matrix by its inverse). However, because of numerical noise, such elements may turn out not to be exactly zero. With this function any very small number in the matrix is turned to exactly zero. If the tolerance is zero or negative, a default threshold of DBL_EPSILON is used.

cpl_matrix* cpl_matrix_transpose_create ( const cpl_matrix *  matrix)

Create transposed matrix.

Parameters
matrixPointer to matrix to be transposed.
Returns
Pointer to transposed matrix. If a NULL pointer is passed, a NULL pointer is returned.
Errors
CPL_ERROR_NULL_INPUT The input matrix is a NULL pointer.

The transposed of the input matrix is created. To destroy the new matrix the function cpl_matrix_delete() should be used.

void* cpl_matrix_unwrap ( cpl_matrix *  matrix)

Delete a matrix, but not its data buffer.

Parameters
matrixPointer to a matrix to be deleted.
Returns
Pointer to the internal data buffer.

This function deallocates all the memory associated to a matrix, with the exception of its data buffer. This type of destructor should be used on matrices created with the cpl_matrix_wrap() constructor, if the data buffer specified then was not allocated using the functions of the cpl_memory module. In such a case, the data buffer should be deallocated separately. See the documentation of the function cpl_matrix_wrap(). If matrix is NULL, nothing is done, and a NULL pointer is returned.

cpl_matrix* cpl_matrix_wrap ( cpl_size  rows,
cpl_size  columns,
double *  data 
)

Create a new matrix from existing data.

Parameters
dataExisting data buffer.
rowsNumber of matrix rows.
columnsNumber of matrix columns.
Returns
Pointer to new matrix, or NULL in case of error.
Errors
CPL_ERROR_NULL_INPUT The input data is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT rows or columns are not positive numbers.

This function creates a new matrix that will encapsulate the given data. At any error condition, a NULL pointer would be returned. Note that the size of the input data array is not checked in any way, and it is expected to match the specified matrix sizes. The input array is supposed to contain in sequence all the new cpl_matrix rows. For instance, in the case of a 3x4 matrix, the input array should contain 12 elements

0 1 2 3 4 5 6 7 8 9 10 11

that would correspond to the matrix elements

0 1 2 3
4 5 6 7
8 9 10 11

The data buffer is not copied, so it should not be deallocated while the matrix is still in use: the function cpl_matrix_delete() would take care of deallocating it. To avoid problems with the memory managment, the specified data buffer should be allocated using the functions of the cpl_memory module, and also statically allocated data should be strictly avoided. If this were not the case, this matrix should not be destroyed using cpl_matrix_delete(), but cpl_matrix_unwrap() should be used instead; moreover, functions implying memory handling (as cpl_matrix_set_size(), or cpl_matrix_delete_row() ) should not be used.

cpl-6.4.1/html/form_8.png0000644000460300003120000000032612310333016012047 00000000000000‰PNG  IHDR ƒw·¬0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïEIDATxíÀ@·×£hÄÿ[IÑôbl_€­5¨Ûz`hq{ñrÀ+÷P .%{j­Óý­zŸ´“i^íJWtNÜ%@IEND®B`‚cpl-6.4.1/html/ftv2node.png0000644000460300003120000000012612310333014012400 00000000000000‰PNG  IHDRɪ|IDATxíݱðøScOx@ –¨y}IEND®B`‚cpl-6.4.1/html/form_2.png0000644000460300003120000000036212310333015012040 00000000000000‰PNG  IHDR,Øßn0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïaIDATxí €0E_ꬶj÷¿m jä‚®ð>Ÿx€¿$›7žHC§†­!E€@o&Ïm»«ßÊeÅrÎú,Ø–êÊ縔øT7 lñ“fÖÃû}€˜Óúv¾ÇB¹IEND®B`‚cpl-6.4.1/html/ftv2mo.png0000644000460300003120000000062312310333014012070 00000000000000‰PNG  IHDRÚ}\ˆZIDATxí1Kû@ÆiƒØB…Ò¡(h¬"EÄI'ÁoàªèÚ©ßÀáâä 8ùçR-‚â B«TPˆï]z¥B’3 _Þã’»ç}ŸË]VÇ÷}€ÌÈdIæ®i쟯JØ–b¸šÍÃõ+º™|KÂ…°,[Pï\ʘMÆ¢#€ä…F`JݤìÛk³úA±àþè?ØY4ck6"¹Z)ê¸0SHM¨@ï㋺WÖmo¼4èHJ¨Àÿö+…QobŒút ¤ú’*Ð~êè8_+3Y-ñðÜå½÷ ˜PwA¶+^ý}ºì£+xìhÏ•MAE]€TD~EÞߴ^R)`ÖAùŸÏ9©pÔq-Û¾õÛ3tÝÊÆ›ˆÃTÐHÈ)€ ½Š’ICªxëd#1ôú§é€ m@Vüý?Zæßgo_½3-³\IEND®B`‚cpl-6.4.1/html/group__cpl__stats.html0000644000460300003120000015747612310333014014564 00000000000000 Common Pipeline Library Reference Manual: Statistics
Common Pipeline Library Reference Manual  6.4.1

Typedefs

typedef struct _cpl_stats_ cpl_stats
 The opaque CPL stats data type.
 
typedef enum _cpl_stats_mode_ cpl_stats_mode
 The CPL stats mode. It is a bit field.
 

Enumerations

enum  _cpl_stats_mode_ {
  CPL_STATS_MIN,
  CPL_STATS_MAX,
  CPL_STATS_MEAN,
  CPL_STATS_MEDIAN,
  CPL_STATS_STDEV,
  CPL_STATS_FLUX,
  CPL_STATS_ABSFLUX,
  CPL_STATS_SQFLUX,
  CPL_STATS_MINPOS,
  CPL_STATS_MAXPOS,
  CPL_STATS_CENTROID,
  CPL_STATS_MEDIAN_DEV,
  CPL_STATS_MAD,
  CPL_STATS_ALL
}
 The values of the CPL stats mode. The values can be combined with bitwise or. More...
 

Functions

void cpl_stats_delete (cpl_stats *stats)
 Free memory associated to an cpl_stats object.
 
cpl_error_code cpl_stats_dump (const cpl_stats *self, cpl_stats_mode mode, FILE *stream)
 Dump a cpl_stats object.
 
double cpl_stats_get_absflux (const cpl_stats *in)
 Get the absolute flux from a cpl_stats object.
 
double cpl_stats_get_centroid_x (const cpl_stats *in)
 Get the x centroid position from a cpl_stats object.
 
double cpl_stats_get_centroid_y (const cpl_stats *in)
 Get the y centroid position from a cpl_stats object.
 
double cpl_stats_get_flux (const cpl_stats *in)
 Get the flux from a cpl_stats object.
 
double cpl_stats_get_mad (const cpl_stats *in)
 Get the median of the absolute median deviation.
 
double cpl_stats_get_max (const cpl_stats *in)
 Get the maximum from a cpl_stats object.
 
cpl_size cpl_stats_get_max_x (const cpl_stats *in)
 Get the maximum x position from a cpl_stats object.
 
cpl_size cpl_stats_get_max_y (const cpl_stats *in)
 Get the maximum y position from a cpl_stats object.
 
double cpl_stats_get_mean (const cpl_stats *in)
 Get the mean from a cpl_stats object.
 
double cpl_stats_get_median (const cpl_stats *in)
 Get the median from a cpl_stats object.
 
double cpl_stats_get_median_dev (const cpl_stats *in)
 Get the mean of the absolute median deviation from a cpl_stats object.
 
double cpl_stats_get_min (const cpl_stats *in)
 Get the minimum from a cpl_stats object.
 
cpl_size cpl_stats_get_min_x (const cpl_stats *in)
 Get the minimum x position from a cpl_stats object.
 
cpl_size cpl_stats_get_min_y (const cpl_stats *in)
 Get the minimum y position from a cpl_stats object.
 
cpl_size cpl_stats_get_npix (const cpl_stats *in)
 Get the number of pixels from a cpl_stats object.
 
double cpl_stats_get_sqflux (const cpl_stats *in)
 Get the sum of the squared values from a cpl_stats object.
 
double cpl_stats_get_stdev (const cpl_stats *in)
 Get the std. dev. from a cpl_stats object.
 
cpl_statscpl_stats_new_from_image (const cpl_image *image, cpl_stats_mode mode)
 Compute various statistics of an image.
 
cpl_statscpl_stats_new_from_image_window (const cpl_image *image, cpl_stats_mode mode, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Compute various statistics of an image sub-window.
 

Detailed Description

This module provides functions to handle the cpl_stats object. This object can contain the statistics that have been computed from different CPL objects. Currently, only the function that computes statistics on images (or images windows) is provided.

Synopsis:
#include "cpl_stats.h"

Typedef Documentation

typedef struct _cpl_stats_ cpl_stats

The opaque CPL stats data type.

The CPL stats mode. It is a bit field.

Enumeration Type Documentation

The values of the CPL stats mode. The values can be combined with bitwise or.

Enumerator:
CPL_STATS_MIN 

The minimum

CPL_STATS_MAX 

The maximum

CPL_STATS_MEAN 

The mean

CPL_STATS_MEDIAN 

The median

CPL_STATS_STDEV 

The standard deviation

CPL_STATS_FLUX 

The flux

CPL_STATS_ABSFLUX 

The absolute flux

CPL_STATS_SQFLUX 

The square flux

CPL_STATS_MINPOS 

The position of the minimum

CPL_STATS_MAXPOS 

The position of the maximum

CPL_STATS_CENTROID 

The centroid position

CPL_STATS_MEDIAN_DEV 

The mean of the absolute median deviation

CPL_STATS_MAD 

The median of the absolute median deviation

CPL_STATS_ALL 

All of the above

Function Documentation

void cpl_stats_delete ( cpl_stats stats)

Free memory associated to an cpl_stats object.

Parameters
statsthe object to delete
Returns
void

Frees all memory associated to a cpl_stats object. If the object stats is NULL, nothing is done and no error is set.

cpl_error_code cpl_stats_dump ( const cpl_stats self,
cpl_stats_mode  mode,
FILE *  stream 
)

Dump a cpl_stats object.

Parameters
selfcpl_stats object to dump
modeBit field specifying which statistics to dump
streamThe output stream
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_
See Also
cpl_stats_new_from_image_window()

It is an error to request parameters that have not been set.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if mode specifies statistics that have not been computed
  • CPL_ERROR_FILE_IO if the write fails
double cpl_stats_get_absflux ( const cpl_stats in)

Get the absolute flux from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
The absolute flux, or a negative number on error
See Also
cpl_stats_get_min()
double cpl_stats_get_centroid_x ( const cpl_stats in)

Get the x centroid position from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the x centroid
See Also
cpl_stats_get_min()
double cpl_stats_get_centroid_y ( const cpl_stats in)

Get the y centroid position from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the y centroid
See Also
cpl_stats_get_min()
double cpl_stats_get_flux ( const cpl_stats in)

Get the flux from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the flux
See Also
cpl_stats_get_min()
double cpl_stats_get_mad ( const cpl_stats in)

Get the median of the absolute median deviation.

Parameters
inthe cpl_stats object
Returns
The median of the absolute median deviation, or undefined on error
See Also
cpl_stats_get_min()
double cpl_stats_get_max ( const cpl_stats in)

Get the maximum from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the maximum value
See Also
cpl_stats_get_min()
cpl_size cpl_stats_get_max_x ( const cpl_stats in)

Get the maximum x position from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the x position (1 for the first pixel), non-positive on error.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_size cpl_stats_get_max_y ( const cpl_stats in)

Get the maximum y position from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the y position (1 for the first pixel), non-positive on error.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
double cpl_stats_get_mean ( const cpl_stats in)

Get the mean from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the mean value
See Also
cpl_stats_get_min()
double cpl_stats_get_median ( const cpl_stats in)

Get the median from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the median value
See Also
cpl_stats_get_min()
double cpl_stats_get_median_dev ( const cpl_stats in)

Get the mean of the absolute median deviation from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
The mean of the absolute median deviation, or undefined on error
See Also
cpl_stats_get_min()
double cpl_stats_get_min ( const cpl_stats in)

Get the minimum from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the minimum value

The call that created the cpl_stats object must have determined the minimum value.

In case of error, the _cpl_error_code_ code is set, and the returned double is undefined.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the requested stat has not been computed in in
cpl_size cpl_stats_get_min_x ( const cpl_stats in)

Get the minimum x position from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the x position (1 for the first pixel), non-positive on error.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_size cpl_stats_get_min_y ( const cpl_stats in)

Get the minimum y position from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the y position (1 for the first pixel), non-positive on error.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_size cpl_stats_get_npix ( const cpl_stats in)

Get the number of pixels from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the number of pixels, -1 in error case.

The creation of a cpl_stats object always causes the number of pixels to be determined.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
double cpl_stats_get_sqflux ( const cpl_stats in)

Get the sum of the squared values from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the square flux, or a negative number on error
See Also
cpl_stats_get_min()
double cpl_stats_get_stdev ( const cpl_stats in)

Get the std. dev. from a cpl_stats object.

Parameters
inthe cpl_stats object
Returns
the standard deviation
See Also
cpl_stats_get_min()
cpl_stats* cpl_stats_new_from_image ( const cpl_image *  image,
cpl_stats_mode  mode 
)

Compute various statistics of an image.

Parameters
imageinput image.
modeBit field specifying which statistics to compute
Returns
1 newly allocated cpl_stats structure or NULL in error case
See Also
cpl_stats_new_from_image_window()
cpl_stats* cpl_stats_new_from_image_window ( const cpl_image *  image,
cpl_stats_mode  mode,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Compute various statistics of an image sub-window.

Parameters
imageInput image.
modeBit field specifying which statistics to compute
llxLower left x position (FITS convention)
llyLower left y position (FITS convention)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
1 newly allocated cpl_stats structure or NULL in error case

Compute various image statistics.

The specified bounds are included in the specified region.

The statistics to compute is specified with a bit field, that may be set to any of these values

  • CPL_STATS_MIN
  • CPL_STATS_MAX
  • CPL_STATS_MEAN
  • CPL_STATS_MEDIAN
  • CPL_STATS_MEDIAN_DEV
  • CPL_STATS_MAD
  • CPL_STATS_STDEV
  • CPL_STATS_FLUX
  • CPL_STATS_ABSFLUX
  • CPL_STATS_SQFLUX
  • CPL_STATS_CENTROID
  • CPL_STATS_MINPOS
  • CPL_STATS_MAXPOS or any bitwise or (|) of these. For convenience the special value CPL_STATS_ALL may also be used, it is the conbination of all of the above values.

E.g. the mode CPL_STATS_MIN | CPL_STATS_MEDIAN specifies the minimum and the median of the image.

In the case of CPL_STATS_MIN and CPL_STATS_MAX where more than one set of coordinates share the extremum it is undefined which of those coordinates will be returned.

On i386 platforms there can be significant differences in the round-off of the computation of single statistics and statistics computed via CPL_STATS_ALL. This is especially true for squared quantities such as the CPL_STATS_SQFLUX and CPL_STATS_STDEV.

Images can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT.

For the CPL_STATS_CENTROID computation, if there are negative pixels, the minimum value is added to all the pixels in order to have all pixels with positive values for computation.

The returned object must be deallocated using cpl_stats_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the defined window is not in the image
  • CPL_ERROR_ILLEGAL_INPUT if the window definition is wrong (e.g llx > urx)
  • CPL_ERROR_DATA_NOT_FOUND if all the pixels are bad
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
  • CPL_ERROR_INVALID_TYPE if mode is 1, e.g. due to a logical or (||) of the allowed options.
  • CPL_ERROR_UNSUPPORTED_MODE if mode is otherwise different from the allowed options.
cpl-6.4.1/html/group__cpl__fits.html0000644000460300003120000005412512310333014014356 00000000000000 Common Pipeline Library Reference Manual: FITS related basic routines
Common Pipeline Library Reference Manual  6.4.1
FITS related basic routines

Typedefs

typedef enum _cpl_fits_mode_ cpl_fits_mode
 The CPL fits mode. It is a bit field.
 

Enumerations

enum  _cpl_fits_mode_ {
  CPL_FITS_STOP_CACHING,
  CPL_FITS_START_CACHING,
  CPL_FITS_RESTART_CACHING,
  CPL_FITS_ONE
}
 The values of the CPL fits mode. The values can be combined with bitwise or. More...
 

Functions

cpl_size cpl_fits_count_extensions (const char *filename)
 Get the number of extensions contained in a FITS file.
 
cpl_size cpl_fits_find_extension (const char *filename, const char *extname)
 Get the place of a given extension in a FITS file.
 
int cpl_fits_get_extension_nb (const char *filename, const char *extname)
 Get the place of a given extension in a FITS file.
 
cpl_fits_mode cpl_fits_get_mode (void)
 Get the FITS I/O mode.
 
int cpl_fits_get_nb_extensions (const char *filename)
 Get the number of extensions contained in a FITS file.
 
cpl_error_code cpl_fits_set_mode (cpl_fits_mode mode)
 Set the FITS I/O mode.
 

Detailed Description

This module provides functions to get basic information on FITS files

Synopsis:
#include "cpl_fits.h"

Typedef Documentation

The CPL fits mode. It is a bit field.

Enumeration Type Documentation

The values of the CPL fits mode. The values can be combined with bitwise or.

Enumerator:
CPL_FITS_STOP_CACHING 

Stop the caching of open FITS files

CPL_FITS_START_CACHING 

Start the caching of open FITS files

CPL_FITS_RESTART_CACHING 

Restart the caching of open FITS files

CPL_FITS_ONE 

Apply the mode change only to the current thread

Function Documentation

cpl_size cpl_fits_count_extensions ( const char *  filename)

Get the number of extensions contained in a FITS file.

Parameters
filenameThe file name
Returns
The number of extensions or -1 in case of error
Note
For a valid fits file without extensions zero is returned

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if the input pointer is NULL
  • CPL_ERROR_FILE_IO If the FITS file could not be opened
  • CPL_ERROR_BAD_FILE_FORMAT if the input FITS file is otherwise invalid
cpl_size cpl_fits_find_extension ( const char *  filename,
const char *  extname 
)

Get the place of a given extension in a FITS file.

Parameters
filenameThe file name
extnameThe extension name
Returns
The extension number, 0 if not found or -1 on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if the file is not FITS
int cpl_fits_get_extension_nb ( const char *  filename,
const char *  extname 
)

Get the place of a given extension in a FITS file.

Parameters
filenameThe file name
extnameThe extension name
Returns
the extension place or -1 in case of error
See Also
cpl_fits_find_extension
Deprecated:
Replace this call with cpl_fits_find_extension().
cpl_fits_mode cpl_fits_get_mode ( void  )

Get the FITS I/O mode.

Returns
One of: CPL_FITS_STOP_CACHING, CPL_FITS_START_CACHING
See Also
cpl_fits_set_mode()
int cpl_fits_get_nb_extensions ( const char *  filename)

Get the number of extensions contained in a FITS file.

Parameters
filenameThe file name
Returns
the number of extensions or -1 in case of error
See Also
cpl_fits_count_extensions()
Deprecated:
Replace this call with cpl_fits_count_extensions().
cpl_error_code cpl_fits_set_mode ( cpl_fits_mode  mode)

Set the FITS I/O mode.

Parameters
modeThe FITS I/O mode: CPL_FITS_STOP_CACHING, CPL_FITS_START_CACHING, CPL_FITS_RESTART_CACHING
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_init() to control the FITS I/O mode when CPL is started

Normally when a FITS file is processed with a CPL call the file is openened and closed during that call. However repeated calls on FITS data with many extensions causes the FITS headers to be parsed many times which can lead to a significant performance penalty. If instead this function is called with CPL_FITS_START_CACHING, CPL will use internal storage to keep the FITS files open between calls and only close them when the FITS I/O mode is changed (or cpl_end() is called).

If a CPL function that creates a FITS file is called any previously opened handles to that file are closed. If a CPL function that appends to a FITS file is called any previously opened read-only handles to that file are closed. If a CPL function that reads from a FITS file is called any previously opened read/write-handle to that file is used for the read. Any additional concurrent reads causes the file to also be opened for reading. This means that there is also a performance gain when alternating between appending to and reading from the same file. This optimized I/O mode cannot be used if the CPL application accesses a FITS file without using CPL. An incomplete list of such access is: Calls to rename(), remove(), unlink(), fopen() and access via another process started with for example system() or popen().

The caching of opened FITS files may be used in a multi-threaded environment to the extent that the underlying FITS library (CFITSIO) supports it. One implication of this is that multiple threads may only call CPL FITS saving functions on the same file using proper synchronization such as the OpenMP 'ordered' construct. CPL makes no attempt to verify that a CPL based application performs thread parallel FITS I/O correctly.

The mode CPL_FITS_STOP_CACHING causes all cached filed to be closed. Beware that this can cause an I/O error for a file that has otherwise not been accessed for some time.

Since CPL_FITS_STOP_CACHING closes all cached FITS files, the caller must ensure that this does not interfere with the concurrent use of those same files in another thread.

The mode CPL_FITS_RESTART_CACHING has the same effect as a call with CPL_FITS_STOP_CACHING followed by a call with CPL_FITS_START_CACHING.

The modes CPL_FITS_RESTART_CACHING and CPL_FITS_ONE may be combined. This causes all files cached by the calling thread to be closed. The caching remains active (for all threads), so subsequently opened files will be cached.

CPL_FITS_RESTART_CACHING can be used after an external modification of a FITS file also cached by CPL, thus allowing the caching to work together with the above mentioned external access to the same FITS files.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_ILLEGAL_INPUT if the mode is zero
  • CPL_ERROR_UNSUPPORTED_MODE if the mode is not supported
  • CPL_ERROR_INVALID_TYPE if mode is 1, e.g. due to a logical or (||) of the allowed options.
  • CPL_ERROR_BAD_FILE_FORMAT if the I/O caused by CPL_FITS_STOP_CACHING failed
cpl-6.4.1/html/form_12.png0000644000460300003120000000046412310333017012126 00000000000000‰PNG  IHDR"D+]V0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ï£IDATxíYà ',fI÷¿mmRH«þõÓÒ³°˜™¼èeÒßÚ—-‚O¥ôЈ+RåëÇÑÇœ÷¾M\ðqÜ©‰E»« "—ʦ̤1ìqû—›Øž{éãÎYNšÓ‰…\gŸÚ[{wZˆ8œ¹øñm´îsÃwEýXÀ¦¹ €¯rÛÿxF"'€çIEND®B`‚cpl-6.4.1/html/nav_f.png0000644000460300003120000000023112310333014011737 00000000000000‰PNG  IHDR8³»`IDATxíÝK€ EÑ–·[†øBÑmkâÄÂH—prÓ¼.‚Žó‚ꎤR6Z VI±E‚5j³„lóš›iI˜¬ÞêçJ0ŒÑÑ/Žû›™uøñóÞ¿6sH ÝõyIEND®B`‚cpl-6.4.1/html/ftv2ns.png0000644000460300003120000000060412310333014012074 00000000000000‰PNG  IHDRÚ}\ˆKIDATxíÝ1K1Àñ­ž ØG•â‚n‚Šà ‚âælÁE¿€‹“ (nºêââêäࢋƒÐMAá@°‹ µât¾ÄK¡à%Ü•Û ý]BIïå%áuÍ…a™€,e × v¯ç¥«ˆi‹º¨Õö–î\tòòuénÄ0ã æÜÉoV\Ì$G.&@Y=ÆË%$um·¢ûÛ6–'Úß«9Qó\bÙ)²º0Ðë-Zœ¥TèHÍ`pÀcsm µö5:>Áë‡Þ¦I µØ ‚F‹Çà]» ›jg—ìoÏáõ©[ œõ š­onë €Ô¬¨vqõ„?\Ðç”  6»øüÒTe ÃÉéŸeç ÀÅlQ ¡c”€ª¬ü3*d€ÅWTMÏ\rÿÿh6™ø1±F ‹°fžIEND®B`‚cpl-6.4.1/html/group__cpl__imagelist.html0000644000460300003120000035502012310333014015365 00000000000000 Common Pipeline Library Reference Manual: Imagelists
Common Pipeline Library Reference Manual  6.4.1
Imagelists
cpl_error_code cpl_imagelist_add (cpl_imagelist *in1, const cpl_imagelist *in2)
 Add two image lists, the first one is replaced by the result.
 
cpl_error_code cpl_imagelist_subtract (cpl_imagelist *in1, const cpl_imagelist *in2)
 Subtract two image lists, the first one is replaced by the result.
 
cpl_error_code cpl_imagelist_multiply (cpl_imagelist *in1, const cpl_imagelist *in2)
 Multiply two image lists, the first one is replaced by the result.
 
cpl_error_code cpl_imagelist_divide (cpl_imagelist *in1, const cpl_imagelist *in2)
 Divide two image lists, the first one is replaced by the result.
 
cpl_error_code cpl_imagelist_add_image (cpl_imagelist *imlist, const cpl_image *img)
 Add an image to an image list.
 
cpl_error_code cpl_imagelist_subtract_image (cpl_imagelist *imlist, const cpl_image *img)
 Subtract an image from an image list.
 
cpl_error_code cpl_imagelist_multiply_image (cpl_imagelist *imlist, const cpl_image *img)
 Multiply an image list by an image.
 
cpl_error_code cpl_imagelist_divide_image (cpl_imagelist *imlist, const cpl_image *img)
 Divide an image list by an image.
 
cpl_error_code cpl_imagelist_add_scalar (cpl_imagelist *imlist, double addend)
 Elementwise addition of a scalar to each image in the imlist.
 
cpl_error_code cpl_imagelist_subtract_scalar (cpl_imagelist *imlist, double subtrahend)
 Elementwise subtraction of a scalar from each image in the imlist.
 
cpl_error_code cpl_imagelist_multiply_scalar (cpl_imagelist *imlist, double factor)
 Elementwise multiplication of the imlist with a scalar.
 
cpl_error_code cpl_imagelist_divide_scalar (cpl_imagelist *imlist, double divisor)
 Elementwise division of each image in the imlist with a scalar.
 
cpl_error_code cpl_imagelist_logarithm (cpl_imagelist *imlist, double base)
 Compute the elementwise logarithm of each image in the imlist.
 
cpl_error_code cpl_imagelist_exponential (cpl_imagelist *imlist, double base)
 Compute the elementwise exponential of each image in the imlist.
 
cpl_error_code cpl_imagelist_power (cpl_imagelist *imlist, double exponent)
 Compute the elementwise power of each image in the imlist.
 
cpl_error_code cpl_imagelist_normalise (cpl_imagelist *imlist, cpl_norm mode)
 Normalize each image in the list.
 
cpl_error_code cpl_imagelist_threshold (cpl_imagelist *imlist, double lo_cut, double hi_cut, double assign_lo_cut, double assign_hi_cut)
 Threshold all pixel values to an interval.
 
cpl_image * cpl_image_new_from_accepted (const cpl_imagelist *imlist)
 Create a contribution map from the bad pixel maps of the images.
 
cpl_image * cpl_imagelist_collapse_create (const cpl_imagelist *imlist)
 Average an imagelist to a single image.
 
cpl_image * cpl_imagelist_collapse_minmax_create (const cpl_imagelist *self, cpl_size nlow, cpl_size nhigh)
 Average with rejection an imagelist to a single image.
 
cpl_image * cpl_imagelist_collapse_sigclip_create (const cpl_imagelist *self, double kappalow, double kappahigh, double keepfrac, cpl_collapse_mode mode, cpl_image *contrib)
 Collapse an imagelist with kappa-sigma-clipping rejection.
 
cpl_image * cpl_imagelist_collapse_median_create (const cpl_imagelist *self)
 Create a median image from the input imagelist.
 
cpl_imagelist * cpl_imagelist_swap_axis_create (const cpl_imagelist *ilist, cpl_swap_axis mode)
 Swap the axis of an image list.
 
cpl_imagelist * cpl_imagelist_new (void)
 Create an empty imagelist.
 
cpl_imagelist * cpl_imagelist_load (const char *filename, cpl_type im_type, cpl_size xtnum)
 Load a FITS file extension into a list of images.
 
cpl_imagelist * cpl_imagelist_load_window (const char *filename, cpl_type im_type, cpl_size xtnum, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Load images windows from a FITS file extension into an image list.
 
cpl_size cpl_imagelist_get_size (const cpl_imagelist *imlist)
 Get the number of images in the imagelist.
 
cpl_image * cpl_imagelist_get (cpl_imagelist *imlist, cpl_size inum)
 Get an image from a list of images.
 
const cpl_image * cpl_imagelist_get_const (const cpl_imagelist *imlist, cpl_size inum)
 Get an image from a list of images.
 
cpl_error_code cpl_imagelist_set (cpl_imagelist *imlist, cpl_image *im, cpl_size pos)
 Insert an image into an imagelist.
 
cpl_image * cpl_imagelist_unset (cpl_imagelist *self, cpl_size pos)
 Remove an image from an imagelist.
 
void cpl_imagelist_empty (cpl_imagelist *self)
 Empty an imagelist and deallocate all its images.
 
void cpl_imagelist_unwrap (cpl_imagelist *self)
 Free memory used by a cpl_imagelist object, except the images.
 
void cpl_imagelist_delete (cpl_imagelist *self)
 Free all memory used by a cpl_imagelist object including the images.
 
cpl_error_code cpl_imagelist_cast (cpl_imagelist *self, const cpl_imagelist *other, cpl_type type)
 Cast an imagelist, optionally in-place.
 
cpl_imagelist * cpl_imagelist_duplicate (const cpl_imagelist *imlist)
 Copy an image list.
 
cpl_error_code cpl_imagelist_erase (cpl_imagelist *imlist, const cpl_vector *valid)
 Reject one or more images in a list according to an array of flags.
 
cpl_error_code cpl_imagelist_save (const cpl_imagelist *self, const char *filename, cpl_type type, const cpl_propertylist *pl, unsigned mode)
 Save an imagelist to disk in FITS format.
 
int cpl_imagelist_is_uniform (const cpl_imagelist *imlist)
 Determine if an imagelist contains images of equal size and type.
 
cpl_error_code cpl_imagelist_dump_structure (const cpl_imagelist *self, FILE *stream)
 Dump structural information of images in an imagelist.
 
cpl_error_code cpl_imagelist_dump_window (const cpl_imagelist *self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, FILE *stream)
 Dump pixel values of images in a CPL imagelist.
 

Detailed Description

This module provides functions to create, use, and destroy a cpl_imagelist. A cpl_imagelist is an ordered list of cpl_images. All images in a list must have the same pixel-type and the same dimensions.

Synopsis:
#include "cpl_imagelist.h"

Function Documentation

cpl_image* cpl_image_new_from_accepted ( const cpl_imagelist *  imlist)

Create a contribution map from the bad pixel maps of the images.

Parameters
imlistThe imagelist
Returns
The contributions map (a CPL_TYPE_INT cpl_image) or NULL on error
See Also
cpl_imagelist_is_uniform()

The returned map counts for each pixel the number of good pixels in the list. The returned map has to be deallocated with cpl_image_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input image list is not valid
cpl_error_code cpl_imagelist_add ( cpl_imagelist *  in1,
const cpl_imagelist *  in2 
)

Add two image lists, the first one is replaced by the result.

Parameters
in1first input image list (modified)
in2image list to add
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_add()

The two input lists must have the same size, the image number n in the list in2 is added to the image number n in the list in1.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input images have different sizes
cpl_error_code cpl_imagelist_add_image ( cpl_imagelist *  imlist,
const cpl_image *  img 
)

Add an image to an image list.

Parameters
imlistinput image list (modified)
imgimage to add
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_add()

The passed image is added to each image of the passed image list.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_imagelist_add_scalar ( cpl_imagelist *  imlist,
double  addend 
)

Elementwise addition of a scalar to each image in the imlist.

Parameters
imlistImagelist to be modified in place.
addendNumber to add
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
See Also
cpl_image_add_scalar()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_imagelist_cast ( cpl_imagelist *  self,
const cpl_imagelist *  other,
cpl_type  type 
)

Cast an imagelist, optionally in-place.

Parameters
selfDestination imagelist
otherSource imagelist, or NULL to cast in-place
typeIf called with empty self, cast to this pixel-type
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_image_cast()
Note
If called with a non-empty self in an out-of-place cast, the input images are cast to the type already present in self and appended to the output list. In this case the parameter type is ignored.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if the destination pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the same pointer is passed twice
  • CPL_ERROR_ILLEGAL_INPUT if the passed type is invalid
  • CPL_ERROR_TYPE_MISMATCH if the passed image type is complex and requested casting type is non-complex.
  • CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported
cpl_image* cpl_imagelist_collapse_create ( const cpl_imagelist *  imlist)

Average an imagelist to a single image.

Parameters
imlistthe input images list
Returns
the average image or NULL on error case.
See Also
cpl_imagelist_is_uniform()

The returned image has to be deallocated with cpl_image_delete().

The bad pixel maps of the images in the input list are taken into account, the result image pixels are flagged as rejected for those where there were no good pixel at the same position in the input image list.

For integer pixel types, the averaging is performed using integer division.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input image list is not valid
cpl_image* cpl_imagelist_collapse_median_create ( const cpl_imagelist *  self)

Create a median image from the input imagelist.

Parameters
selfThe input image list
Returns
The median image of the input pixel type or NULL on error
Note
The created image has to be deallocated with cpl_image_delete()

The input image list can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE.

On success each pixel in the created image is the median of the values on the same pixel position in the input image list. If for a given pixel all values in the input image list are rejected, the resulting pixel is set to zero and flagged as rejected.

The median is defined here as the middle value of an odd number of sorted samples and for an even number of samples as the mean of the two central values. Note that with an even number of samples the median may not be among the input samples.

Also, note that in the case of an even number of integer data, the mean value will be computed using integer arithmetic. Cast your integer data to a floating point pixel type if that is not the desired behavior.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input image list is not valid
  • CPL_ERROR_INVALID_TYPE if the passed image list pixel type is not supported
cpl_image* cpl_imagelist_collapse_minmax_create ( const cpl_imagelist *  self,
cpl_size  nlow,
cpl_size  nhigh 
)

Average with rejection an imagelist to a single image.

Parameters
selfThe image list to average
nlowNumber of low rejected values
nhighNumber of high rejected values
Returns
The average image or NULL on error
Note
The returned image has to be deallocated with cpl_image_delete().

The input images are averaged, for each pixel position the nlow lowest pixels and the nhigh highest pixels are discarded for the average computation.

The input image list can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. The created image will be of the same type.

On success each pixel in the created image is the average of the non-rejected values on the pixel position in the input image list.

For a given pixel position any bad pixels (i.e. values) are handled as follows: Given n bad values on a given pixel position, n/2 of those values are assumed to be low outliers and n/2 of those values are assumed to be high outliers. Any low or high rejection will first reject up to n/2 bad values and if more values need to be rejected that rejection will take place on the good values. This rationale behind this is to allow the rejection of outliers to include bad pixels without introducing a bias. If for a given pixel all values in the input image list are rejected, the resulting pixel is set to zero and flagged as rejected.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an the input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input image list is not valid or if the sum of the rejections is not lower than the number of images or if nlow or nhigh is negative
  • CPL_ERROR_INVALID_TYPE if the passed image list type is not supported
cpl_image* cpl_imagelist_collapse_sigclip_create ( const cpl_imagelist *  self,
double  kappalow,
double  kappahigh,
double  keepfrac,
cpl_collapse_mode  mode,
cpl_image *  contrib 
)

Collapse an imagelist with kappa-sigma-clipping rejection.

Parameters
selfThe input imagelist
kappalowkappa-factor for lower clipping threshold
kappahighkappa-factor for upper clipping threshold
keepfracThe fraction of values to keep (0.0 < keepfrac <= 1.0)
modeClipping mode, CPL_COLLAPSE_MEAN or CPL_COLLAPSE_MEDIAN
contribPre-allocated integer-image for contribution map or NULL
Returns
The collapsed image or NULL on error case.
Note
The returned image has to be deallocated with cpl_image_delete().

The collapsing is an iterative process which will stop when it converges (i.e. an iteration did not reject any values for a given pixel) or when the next iteration would reduce the fraction of values to keep to less than or equal to keepfrac.

A call with keepfrac == 1.0 will thus perform no clipping.

Supported modes: CPL_COLLAPSE_MEAN: The center value of the acceptance range will be the mean. CPL_COLLAPSE_MEDIAN: The center value of the acceptance range will be the median. CPL_COLLAPSE_MEDIAN_MEAN: The center value of the acceptance range will be the median in the first iteration and in subsequent iterations it will be the mean.

For each pixel position the pixels whose value is higher than center + kappahigh * stdev or lower than center - kappalow * stdev are discarded for the subsequent center and stdev computation, where center is defined according to the clipping mode, and stdev is the standard deviation of the values at that pixel position. Since the acceptance interval must be non-empty, the sum of kappalow and kappahigh must be positive. A typical call has both kappalow and kappahigh positive.

The minimum number of values that the clipping can select is 2. This is because the clipping criterion is based on the sample standard deviation, which needs at least two values to be defined. This means that all calls with (positive) values of keepfrac less than 2/n will behave the same. To ensure that the values in (at least) i planes out of n are kept, keepfrac can be set to (i - 0.5) / n, e.g. to keep at least 50 out of 100 values, keepfrac can be set to 0.495.

The output pixel is set to the mean of the non-clipped values, also in the median mode. Regardless of the input pixel type, the mean is computed in double precision. The result is then cast to the output-pixel type, which is identical to the input pixel type.

The input parameter contrib is optional. It must be either NULL or point to a pre-allocated image of type CPL_TYPE_INT and size equal to the images in the imagelist. On success, it will contain the contribution map, i.e. the number of kept (non-clipped) values after the iterative process on every pixel.

Bad pixels are ignored from the start. This means that with a sufficient number of bad pixels, the fraction of good values will be less than keepfrac. In this case no iteration is performed at all. If there is at least one good value available, then the mean will be based on the good value(s). If for a given pixel position there are no good values, then that pixel is set to zero, rejected as bad and if available the value in the contribution map is set to zero.

The input imagelist can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_DATA_NOT_FOUND if there are less than 2 images in the list
  • CPL_ERROR_ILLEGAL_INPUT if the sum of kappalow and kappahigh is non-positive,
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if keepfrac is outside the required interval which is 0.0 < keepfrac <= 1.0
  • CPL_ERROR_TYPE_MISMATCH if contrib is non-NULL but not of type CPL_TYPE_INT
  • CPL_ERROR_INCOMPATIBLE_INPUT if contrib is non-NULL but of a size incompatible with the input imagelist
  • CPL_ERROR_INVALID_TYPE if the type of the input imagelist is unsupported
  • CPL_ERROR_UNSUPPORTED_MODE if the passed mode is none of the above listed
void cpl_imagelist_delete ( cpl_imagelist *  self)

Free all memory used by a cpl_imagelist object including the images.

Parameters
selfThe image list or NULL
Returns
Nothing
See Also
cpl_imagelist_empty(), cpl_imagelist_unwrap()
cpl_error_code cpl_imagelist_divide ( cpl_imagelist *  in1,
const cpl_imagelist *  in2 
)

Divide two image lists, the first one is replaced by the result.

Parameters
in1first input image list (modified)
in2image list to divide
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_divide()
cpl_imagelist_add()
cpl_error_code cpl_imagelist_divide_image ( cpl_imagelist *  imlist,
const cpl_image *  img 
)

Divide an image list by an image.

Parameters
imlistinput image list (modified)
imgimage for division
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_divide()
cpl_imagelist_add_image()
cpl_error_code cpl_imagelist_divide_scalar ( cpl_imagelist *  imlist,
double  divisor 
)

Elementwise division of each image in the imlist with a scalar.

Parameters
imlistImagelist to be modified in place.
divisorNon-zero number to divide with
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
See Also
cpl_imagelist_add_scalar()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_imagelist_dump_structure ( const cpl_imagelist *  self,
FILE *  stream 
)

Dump structural information of images in an imagelist.

Parameters
selfImagelist to dump
streamOutput stream, accepts stdout or stderr
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if a write operation fails
cpl_error_code cpl_imagelist_dump_window ( const cpl_imagelist *  self,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
FILE *  stream 
)

Dump pixel values of images in a CPL imagelist.

Parameters
selfImagelist to dump
llxSpecifies the window position
llySpecifies the window position
urxSpecifies the window position
urySpecifies the window position
streamOutput stream, accepts stdout or stderr
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if a write operation fails
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the defined window is not in the image
  • CPL_ERROR_ILLEGAL_INPUT if the window definition is wrong (e.g llx > urx)
cpl_imagelist* cpl_imagelist_duplicate ( const cpl_imagelist *  imlist)

Copy an image list.

Parameters
imlistSource image list.
Returns
1 newly allocated image list, or NULL on error.

Copy an image list into a new image list object. The returned image list must be deallocated using cpl_imagelist_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
void cpl_imagelist_empty ( cpl_imagelist *  self)

Empty an imagelist and deallocate all its images.

Parameters
selfThe image list or NULL
Returns
Nothing
See Also
cpl_imagelist_empty(), cpl_imagelist_delete()
Note
If self is NULL nothing is done and no error is set.

After the call the image list can be populated again. It must eventually be deallocted with a call to cpl_imagelist_delete().

cpl_error_code cpl_imagelist_erase ( cpl_imagelist *  imlist,
const cpl_vector *  valid 
)

Reject one or more images in a list according to an array of flags.

Parameters
imlistNon-empty imagelist to examine for image rejection.
validVector of flags (>=-0.5: valid, <-0.5: invalid)
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

This function takes an imagelist and a vector of flags. The imagelist and vector must have equal lengths.

Images flagged as invalid are removed from the list.

The removal of image(s) will reduce the length of the list accordingly.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the vector size and the image list size are different
cpl_error_code cpl_imagelist_exponential ( cpl_imagelist *  imlist,
double  base 
)

Compute the elementwise exponential of each image in the imlist.

Parameters
imlistImagelist to be modified in place.
baseBase of the exponential.
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
See Also
cpl_image_exponential()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_image* cpl_imagelist_get ( cpl_imagelist *  imlist,
cpl_size  inum 
)

Get an image from a list of images.

Parameters
imlistthe image list
inumthe image id (from 0 to number of images-1)
Returns
A pointer to the image or NULL in error case.

The returned pointer refers to already allocated data.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if inum is bigger thant the list size
  • CPL_ERROR_ILLEGAL_INPUT if inum is negative
const cpl_image* cpl_imagelist_get_const ( const cpl_imagelist *  imlist,
cpl_size  inum 
)

Get an image from a list of images.

Parameters
imlistthe image list
inumthe image id (from 0 to number of images-1)
Returns
A pointer to the image or NULL in error case.
See Also
cpl_imagelist_get
cpl_size cpl_imagelist_get_size ( const cpl_imagelist *  imlist)

Get the number of images in the imagelist.

Parameters
imlistthe list of image
Returns
The number of images or -1 on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
int cpl_imagelist_is_uniform ( const cpl_imagelist *  imlist)

Determine if an imagelist contains images of equal size and type.

Parameters
imlistThe imagelist to check
Returns
Zero if uniform, positive if non-uniform and negative on error.

The function returns 1 if the list is empty.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_imagelist* cpl_imagelist_load ( const char *  filename,
cpl_type  im_type,
cpl_size  xtnum 
)

Load a FITS file extension into a list of images.

Parameters
filenameThe FITS file name
im_typeType of the images in the created image list
xtnumThe extension number (0 for primary HDU)
Returns
The loaded list of images or NULL on error.
See Also
cpl_image_load()

This function loads all the images of a specified extension (NAXIS=2 or 3) into an image list.

Type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT. The loaded images have an empty bad pixel map.

The returned cpl_imagelist must be deallocated using cpl_imagelist_delete()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if xtnum is negative
  • CPL_ERROR_INVALID_TYPE if the passed type is not supported
  • CPL_ERROR_FILE_IO If the file cannot be opened or read, or if xtnum is bigger than the number of extensions in the FITS file
  • CPL_ERROR_BAD_FILE_FORMAT if the file cannot be parsed
  • CPL_ERROR_DATA_NOT_FOUND if the data cannot be read from the file
cpl_imagelist* cpl_imagelist_load_window ( const char *  filename,
cpl_type  im_type,
cpl_size  xtnum,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Load images windows from a FITS file extension into an image list.

Parameters
filenameThe FITS file name
im_typeType of the images in the created image list
xtnumThe extension number (0 for primary HDU)
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
The loaded list of image windows or NULL on error.
See Also
cpl_imagelist_load(), cpl_image_load_window()
Note
The returned cpl_imagelist must be deallocated using cpl_imagelist_delete()

This function loads all the image windows of a specified extension in an image list.

Type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if xtnum is negative
  • CPL_ERROR_INVALID_TYPE if the passed type is not supported
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if xtnum is bigger than the number of extensions in the FITS file
  • CPL_ERROR_BAD_FILE_FORMAT if the file cannot be parsed
  • CPL_ERROR_DATA_NOT_FOUND if the data cannot be read from the file
cpl_error_code cpl_imagelist_logarithm ( cpl_imagelist *  imlist,
double  base 
)

Compute the elementwise logarithm of each image in the imlist.

Parameters
imlistImagelist to be modified in place.
baseBase of the logarithm.
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
See Also
cpl_image_logarithm()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_imagelist_multiply ( cpl_imagelist *  in1,
const cpl_imagelist *  in2 
)

Multiply two image lists, the first one is replaced by the result.

Parameters
in1first input image list (modified)
in2image list to multiply
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_multiply()
cpl_imagelist_add()
cpl_error_code cpl_imagelist_multiply_image ( cpl_imagelist *  imlist,
const cpl_image *  img 
)

Multiply an image list by an image.

Parameters
imlistinput image list (modified)
imgimage to multiply
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_multiply()
cpl_imagelist_add_image()
cpl_error_code cpl_imagelist_multiply_scalar ( cpl_imagelist *  imlist,
double  factor 
)

Elementwise multiplication of the imlist with a scalar.

Parameters
imlistImagelist to be modified in place.
factorNumber to multiply with
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
See Also
cpl_imagelist_add_scalar()
cpl_imagelist* cpl_imagelist_new ( void  )

Create an empty imagelist.

Returns
1 newly allocated cpl_imagelist
See Also
cpl_imagelist_set()

The returned cpl_imagelist must be deallocated using cpl_imagelist_delete()

cpl_error_code cpl_imagelist_normalise ( cpl_imagelist *  imlist,
cpl_norm  mode 
)

Normalize each image in the list.

Parameters
imlistImagelist to modify.
modeNormalization mode.
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_image_normalise()

The list may be partly modified if an error occurs.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_imagelist_power ( cpl_imagelist *  imlist,
double  exponent 
)

Compute the elementwise power of each image in the imlist.

Parameters
imlistImagelist to be modified in place.
exponentScalar exponent
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
See Also
cpl_image_power()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_imagelist_save ( const cpl_imagelist *  self,
const char *  filename,
cpl_type  type,
const cpl_propertylist pl,
unsigned  mode 
)

Save an imagelist to disk in FITS format.

Parameters
selfImagelist to save
filenameName of the FITS file to write
typeThe type used to represent the data in the file
plProperty list for the output header or NULL
modeThe desired output options (combined with bitwise or)
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_save()

This function saves an image list to a FITS file. If a property list is provided, it is written to the named file before the pixels are written.

Supported image lists types are CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT.

The type used in the file can be one of: CPL_TYPE_UCHAR (8 bit unsigned), CPL_TYPE_SHORT (16 bit signed), CPL_TYPE_USHORT (16 bit unsigned), CPL_TYPE_INT (32 bit signed), CPL_TYPE_FLOAT (32 bit floating point), or CPL_TYPE_DOUBLE (64 bit floating point). Additionally, the special value CPL_TYPE_UNSPECIFIED is allowed. This value means that the type used for saving is the pixel type of the input image. Using the image pixel type as saving type ensures that the saving incurs no loss of information.

Supported output modes are CPL_IO_CREATE (create a new file), CPL_IO_EXTEND (extend an existing file with a new extension) and CPL_IO_APPEND (append a list of images to the last data unit, which must already contain compatible image(s)).

When the data written to disk are of an integer type, the output mode CPL_IO_EXTEND can be combined (via bit-wise or) with an option for tile-compression. This compression of integer data is lossless. The options are: CPL_IO_COMPRESS_GZIP, CPL_IO_COMPRESS_RICE, CPL_IO_COMPRESS_HCOMPRESS, CPL_IO_COMPRESS_PLIO. With compression the type must be CPL_TYPE_UNSPECIFIED or CPL_TYPE_INT.

In extend and append mode, make sure that the file has write permissions. You may have problems if you create a file in your application and append something to it with the umask set to 222. In this case, the file created by your application would not be writable, and the append would fail.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the type or the mode is not supported
  • CPL_ERROR_FILE_IO if the file cannot be written
  • CPL_ERROR_INVALID_TYPE if the passed image list type is not supported
cpl_error_code cpl_imagelist_set ( cpl_imagelist *  imlist,
cpl_image *  im,
cpl_size  pos 
)

Insert an image into an imagelist.

Parameters
imlistThe imagelist
imThe image to insert
posThe list position (from 0 to number of images)
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

It is allowed to specify the position equal to the number of images in the list. This will increment the size of the imagelist.

No action occurs if an image is inserted more than once into the same position. It is allowed to insert the same image into two different positions in a list.

The image is inserted at the position pos in the image list. If the image already there is only present in that one location in the list, then the image is deallocated.

It is not allowed to insert images of different size into a list.

The added image is owned by the imagelist object, which deallocates it cpl_imagelist_delete is called. Other option is to use cpl_imagelist_unset to recover ownership of the image, in which case the cpl_imagelist object is not longer responsible for deallocating it.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if pos is negative
  • CPL_ERROR_TYPE_MISMATCH if im and imlist are of different types
  • CPL_ERROR_INCOMPATIBLE_INPUT if im and imlist have different sizes
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if pos is bigger than the number of images in imlist
cpl_error_code cpl_imagelist_subtract ( cpl_imagelist *  in1,
const cpl_imagelist *  in2 
)

Subtract two image lists, the first one is replaced by the result.

Parameters
in1first input image list (modified)
in2image list to subtract
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_subtract()
cpl_imagelist_add()
cpl_error_code cpl_imagelist_subtract_image ( cpl_imagelist *  imlist,
const cpl_image *  img 
)

Subtract an image from an image list.

Parameters
imlistinput image list (modified)
imgimage to subtract
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_subtract()
cpl_imagelist_add_image()
cpl_error_code cpl_imagelist_subtract_scalar ( cpl_imagelist *  imlist,
double  subtrahend 
)

Elementwise subtraction of a scalar from each image in the imlist.

Parameters
imlistImagelist to be modified in place.
subtrahendNumber to subtract
Returns
CPL_ERROR_NONE or the relevant the _cpl_error_code_ on error
See Also
cpl_imagelist_add_scalar()
cpl_imagelist* cpl_imagelist_swap_axis_create ( const cpl_imagelist *  ilist,
cpl_swap_axis  mode 
)

Swap the axis of an image list.

Parameters
ilistThe image list to swap
modeThe swapping mode
Returns
The swapped image list or NULL in error case

This function is intended for users that want to use the cpl_imagelist object as a cube. Swapping the axis would give them access to the usual functions in the 3 dimensions. This has the cost that it duplicates the memory consumption, which can be a problem for big amounts of data.

Image list can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The mode can be either CPL_SWAP_AXIS_XZ or CPL_SWAP_AXIS_YZ

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if mode is not equal to one of the possible values or if the image list is not valid
  • CPL_ERROR_INVALID_TYPE if the passed image list type is not supported
cpl_error_code cpl_imagelist_threshold ( cpl_imagelist *  imlist,
double  lo_cut,
double  hi_cut,
double  assign_lo_cut,
double  assign_hi_cut 
)

Threshold all pixel values to an interval.

Parameters
imlistImage list to threshold.
lo_cutLower bound.
hi_cutHigher bound.
assign_lo_cutValue to assign to pixels below low bound.
assign_hi_cutValue to assign to pixels above high bound.
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_image_threshold()

Threshold the images of the list using cpl_image_threshold() The input image list is modified.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if lo_cut is bigger than hi_cut
cpl_image* cpl_imagelist_unset ( cpl_imagelist *  self,
cpl_size  pos 
)

Remove an image from an imagelist.

Parameters
selfThe imagelist
posThe list position (from 0 to number of images-1)
Returns
The pointer to the removed image or NULL in error case

The specified image is not deallocated, it is simply removed from the list. The pointer to the image is returned to let the user decide to deallocate it or not. Eventually, the image will have to be deallocated with cpl_image_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if pos is negative
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if pos is bigger than the number of images in self
void cpl_imagelist_unwrap ( cpl_imagelist *  self)

Free memory used by a cpl_imagelist object, except the images.

Parameters
selfThe image list or NULL
Returns
Nothing
See Also
cpl_imagelist_empty()
Note
The caller must have pointers to all images in the list and is reponsible for their deallocation. If self is NULL nothing is done and no error is set.
cpl-6.4.1/html/form_17.png0000644000460300003120000000032612310333017012130 00000000000000‰PNG  IHDR a«¬Õ0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïEIDATxíÁ À0 /6v ÁÉþÛöÑ8é«:8íðSë ²7«‘ú‚Ê„UZt4 Rˆ(ÂÜhîçâãc™ÛÙ7J, Ç61ÔIEND®B`‚cpl-6.4.1/html/functions_vars.html0000644000460300003120000001053212310333020014073 00000000000000 Common Pipeline Library Reference Manual: Class Members - Variables
Common Pipeline Library Reference Manual  6.4.1
 
cpl-6.4.1/html/form_18.png0000644000460300003120000000106412310333017012131 00000000000000‰PNG  IHDR>;ÒÉÅ0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ï£IDATxíÝŽÜ F„Ÿ@xÿ·]'M· ;Ò0 UªTËç&Âlóùào²”Ã<Àn•U‚Œ`pÖ®ƒDÂLx~n»o>wO&ô`@,póÍQÀv‡2žŽ .CÔ·úÌÄËÞïj4ÔU€òÙ³å–*«¡©½º½L üq¹ì¶²"¸»¬—55h)ÛŸô"e}‰i¼JxÔñ&)šèÐ['€'F“ÛLô3Ñ¢Ç ›ŠSÑ^{dTh5mU­•€NžðoÓñ,^c6 @&׺«´ÞRy<UË­;æÊú£’ú©t?kh3£Ê¡ÓÀÝ%\ÖLcÝ®mgDëí¸âviÖý”Ä_¿ÒHm9çvÒu`Û:»Ø/K<å-; ‘­tU€†ÅoM­ºñl3Ú¾¬3Ñÿ˜Ä…¹2Ô9ퟘçá³™9}L¦·…jÝ©á9w>кóê©ol½Ð:¬nÙLüwZ§“á[\mÂ6×y£u²º²~Ç—:3÷[ëXîbóiד¬Œ×Úù°65ø˜/ð úEˆIEND®B`‚cpl-6.4.1/html/group__cpl__fit.html0000644000460300003120000012520412310333015014171 00000000000000 Common Pipeline Library Reference Manual: High-level functions for non-linear fitting
Common Pipeline Library Reference Manual  6.4.1
High-level functions for non-linear fitting

Functions

cpl_error_code cpl_fit_image_gaussian (const cpl_image *im, const cpl_image *im_err, cpl_size xpos, cpl_size ypos, cpl_size xsize, cpl_size ysize, cpl_array *parameters, cpl_array *err_params, const cpl_array *fit_params, double *rms, double *red_chisq, cpl_matrix **covariance, double *major, double *minor, double *angle, cpl_matrix **phys_cov)
 Fit a 2D gaussian to image values.
 
cpl_imagelist * cpl_fit_imagelist_polynomial (const cpl_vector *x_pos, const cpl_imagelist *values, cpl_size mindeg, cpl_size maxdeg, cpl_boolean is_symsamp, cpl_type pixeltype, cpl_image *fiterror)
 Least-squares fit a polynomial to each pixel in a list of images.
 
cpl_imagelist * cpl_fit_imagelist_polynomial_window (const cpl_vector *x_pos, const cpl_imagelist *values, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size mindeg, cpl_size maxdeg, cpl_boolean is_symsamp, cpl_type pixeltype, cpl_image *fiterror)
 Least-squares fit a polynomial to each pixel in a list of images.
 
cpl_error_code cpl_fit_lvmq (const cpl_matrix *x, const cpl_matrix *sigma_x, const cpl_vector *y, const cpl_vector *sigma_y, cpl_vector *a, const int ia[], int(*f)(const double x[], const double a[], double *result), int(*dfda)(const double x[], const double a[], double result[]), double relative_tolerance, int tolerance_count, int max_iterations, double *mse, double *red_chisq, cpl_matrix **covariance)
 Fit a function to a set of data.
 
double cpl_gaussian_eval_2d (const cpl_array *self, double x, double y)
 Evaluate the Gaussian in a 2D-point.
 

Detailed Description

This module provides a routine for non-linear fitting.

Synopsis:
#include "cpl_fit.h"

Function Documentation

cpl_error_code cpl_fit_image_gaussian ( const cpl_image *  im,
const cpl_image *  im_err,
cpl_size  xpos,
cpl_size  ypos,
cpl_size  xsize,
cpl_size  ysize,
cpl_array *  parameters,
cpl_array *  err_params,
const cpl_array *  fit_params,
double *  rms,
double *  red_chisq,
cpl_matrix **  covariance,
double *  major,
double *  minor,
double *  angle,
cpl_matrix **  phys_cov 
)

Fit a 2D gaussian to image values.

Parameters
imInput image with data values to fit.
im_errOptional input image with statistical errors associated to data.
xposX position of center of fitting domain.
yposY position of center of fitting domain.
xsizeX size of fitting domain. It must be at least 3 pixels.
ysizeY size of fitting domain. It must be at least 3 pixels.
parametersPreallocated array for returning the values of the best-fit gaussian parameters (the parametrisation of the fitted gaussian is described in the main documentation section, below). This array must be of type CPL_TYPE_DOUBLE, and it must have exactly 7 elements. Generally, when passed to this function, this array would not be initialised (all elements are "invalid"). A first-guess for the gaussian parameters is not mandatory: but it is possible to specify here a first-guess value for each parameter. First-guess values can also be specified just for a subset of parameters.
err_paramsOptional preallocated array for returning the statistical error associated to each fitted parameter. This array must be of type CPL_TYPE_DOUBLE, and it must have exactly 7 elements. This makes mandatory to specify im_err. Note that the returned values are the square root of the diagonal elements (variances) of the covariance matrix (see ahead).
fit_paramsOptional array, used for flagging the parameters to freeze. This array must be of type CPL_TYPE_INT, and it must have exactly 7 elements. If an array element is set to 0, the corresponding parameter will be frozen. Any other value (including an "invalid" array element) would indicate a free parameter. If a parameter is frozen, a first-guess value must be specified at the corresponding element of the parameters array. If no array is specified here (NULL pointer), all parameters are free.
rmsIf not NULL, returned standard deviation of fit residuals.
red_chisqIf not NULL, returned reduced chi-squared of fit. This makes mandatory to specify im_err.
covarianceIf not NULL, a newly allocated covariance matrix will be returned. This makes mandatory to specify im_err. On error it is not modified.
majorIf not NULL, returned semi-major axis of ellipse at 1-sigma.
minorIf not NULL, returned semi-minor axis of ellipse at 1-sigma.
angleIf not NULL, returned angle between X axis and major axis of ellipse, counted counterclockwise (radians).
phys_covIf not NULL, a newly allocated 3x3 covariance matrix for the derived physical parameters major, minor, and angle, will be returned. This makes mandatory to specify im_err. On error it is not modified.
Returns
CPL_ERROR_NONE on successful fit.

This function fits a 2d gaussian to pixel values within a specified region by minimizing $\chi^2$ using a Levenberg-Marquardt algorithm. The gaussian model adopted here is based on the well-known cartesian form

\[ z = B + \frac{A}{2 \pi \sigma_x \sigma_y \sqrt{1-\rho^2}} \exp\left({-\frac{1}{2\left(1-\rho^2\right)} \left(\left(\frac{x - \mu_x}{\sigma_x}\right)^2 -2\rho\left(\frac{x - \mu_x}{\sigma_x}\right) \left(\frac{y - \mu_y}{\sigma_y}\right) + \left(\frac{y - \mu_y}{\sigma_y}\right)^2\right)}\right) \]

where $B$ is a background level and $A$ the volume of the gaussian (they both can be negative!), making 7 parameters altogether. Conventionally the parameters are indexed from 0 to 6 in the elements of the arrays parameters, err_params, fit_params, and of the 7x7 covariance matrix:

\begin{eqnarray*} \mathrm{parameters[0]} &=& B \\ \mathrm{parameters[1]} &=& A \\ \mathrm{parameters[2]} &=& \rho \\ \mathrm{parameters[3]} &=& \mu_x \\ \mathrm{parameters[4]} &=& \mu_y \\ \mathrm{parameters[5]} &=& \sigma_x \\ \mathrm{parameters[6]} &=& \sigma_y \end{eqnarray*}

The semi-axes $a, b$ and the orientation $\theta$ of the ellipse at 1-sigma level are finally derived from the fitting parameters as:

\begin{eqnarray*} \theta &=& \frac{1}{2} \arctan \left(2 \rho \frac{\sigma_x \sigma_y} {\sigma_x^2 - \sigma_y^2}\right) \\ a &=& \sigma_x \sigma_y \sqrt{2(1-\rho^2) \frac{\cos 2\theta} {\left(\sigma_x^2 + \sigma_y^2\right) \cos 2\theta + \sigma_y^2 - \sigma_x^2}} \\ b &=& \sigma_x \sigma_y \sqrt{2(1-\rho^2) \frac{\cos 2\theta} {\left(\sigma_x^2 + \sigma_y^2\right) \cos 2\theta - \sigma_y^2 + \sigma_x^2}} \end{eqnarray*}

Note that $\theta$ is counted counterclockwise starting from the positive direction of the $x$ axis, ranging bewteen $-\pi/2$ and $+\pi/2$ radians.

If the correlation $\rho = 0$ and $\sigma_x \geq \sigma_y$ (within uncertainties) the ellipse is either a circle or its major axis is aligned with the $x$ axis, so it is conventionally set

\begin{eqnarray*} \theta &=& 0 \\ a &=& \sigma_x \\ b &=& \sigma_y \end{eqnarray*}

If the correlation $\rho = 0$ and $\sigma_x < \sigma_y$ (within uncertainties) the major axis of the ellipse is aligned with the $y$ axis, so it is conventionally set

\begin{eqnarray*} \theta &=& \frac{\pi}{2} \\ a &=& \sigma_y \\ b &=& \sigma_x \end{eqnarray*}

If requested, the 3x3 covariance matrix G associated to the derived physical quantities is also computed, applying the usual

\[ \mathrm{G} = \mathrm{J} \mathrm{C} \mathrm{J}^\mathrm{T} \]

where J is the Jacobian of the transformation $ (B, A, \rho, \mu_x, \mu_y, \sigma_x, \sigma_y) \rightarrow (\theta, a, b) $ and C is the 7x7 matrix of the gaussian parameters.

cpl_imagelist* cpl_fit_imagelist_polynomial ( const cpl_vector *  x_pos,
const cpl_imagelist *  values,
cpl_size  mindeg,
cpl_size  maxdeg,
cpl_boolean  is_symsamp,
cpl_type  pixeltype,
cpl_image *  fiterror 
)

Least-squares fit a polynomial to each pixel in a list of images.

Parameters
x_posThe vector of positions to fit
valuesThe list of images with values to fit
mindegThe smallest degree with a non-zero coefficient
maxdegThe polynomial degree of the fit, at least mindeg
is_symsampTrue iff the x_pos values are symmetric around their mean
pixeltypeThe pixel-type of the created image list
fiterrorWhen non-NULL, the error of the fit
Note
values and x_pos must have the same number of elements.
The created imagelist must be deallocated with cpl_imagelist_delete().
x_pos must have at least 1 + (maxdeg - mindeg) distinct values.
Returns
The image list of the fitted polynomial coefficients or NULL on error.
See Also
cpl_fit_imagelist_polynomial_window()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input const pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if mindeg is negative or maxdeg is less than mindeg.
  • CPL_ERROR_INCOMPATIBLE_INPUT if x_pos and values have different lengths, or if fiterror is non-NULL with a different size than that of values, or if the input images do not all have the same dimensions and pixel type.
  • CPL_ERROR_DATA_NOT_FOUND if x_pos contains less than nc values.
  • CPL_ERROR_SINGULAR_MATRIX if x_pos contains less than nc distinct values.
  • CPL_ERROR_UNSUPPORTED_MODE if the chosen pixel type is not one of CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT.
cpl_imagelist* cpl_fit_imagelist_polynomial_window ( const cpl_vector *  x_pos,
const cpl_imagelist *  values,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
cpl_size  mindeg,
cpl_size  maxdeg,
cpl_boolean  is_symsamp,
cpl_type  pixeltype,
cpl_image *  fiterror 
)

Least-squares fit a polynomial to each pixel in a list of images.

Parameters
x_posThe vector of positions to fit
valuesThe list of images with values to fit
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
mindegThe smallest degree with a non-zero coefficient
maxdegThe polynomial degree of the fit, at least mindeg
is_symsampTrue iff the x_pos values are symmetric around their mean
pixeltypeThe (non-complex) pixel-type of the created image list
fiterrorWhen non-NULL, the error of the fit. Must be non-complex
Note
values and x_pos must have the same number of elements.
The created imagelist must be deallocated with cpl_imagelist_delete().
x_pos must have at least 1 + (maxdeg - mindeg) distinct values.
Returns
The image list of the fitted polynomial coefficients or NULL on error.
See Also
cpl_polynomial_fit()

For each pixel, a polynomial representing the relation value = P(x) is computed where: P(x) = x^{mindeg} * (a_0 + a_1 * x + ... + a_{nc-1} * x^{nc-1}), where mindeg >= 0 and maxdeg >= mindeg, and nc is the number of polynomial coefficients to determine, nc = 1 + (maxdeg - mindeg).

The returned image list thus contains nc coefficient images, a_0, a_1, ..., a_{nc-1}.

np is the number of sample points, i.e. the number of elements in x_pos and number of images in the input image list.

If mindeg is nonzero then is_symsamp is ignored, otherwise is_symsamp may to be set to CPL_TRUE if and only if the values in x_pos are known a-priori to be symmetric around their mean, e.g. (1, 2, 4, 6, 10, 14, 16, 18, 19), but not (1, 2, 4, 6, 10, 14, 16). Setting is_symsamp to CPL_TRUE while mindeg is zero eliminates certain round-off errors. For higher order fitting the fitting problem known as "Runge's phenomenon" is minimized using the socalled "Chebyshev nodes" as sampling points. For Chebyshev nodes is_symsamp can be set to CPL_TRUE.

Even though it is not an error, it is hardly useful to use an image of pixel type integer for the fitting error. An image of pixel type float should on the other hand be sufficient for most fitting errors.

The call requires the following number of FLOPs, where nz is the number of pixels in any one image in the imagelist:

2 * nz * nc * (nc + np) + np * nc^2 + nc^3/3 + O(nc * (nc + np)).

If mindeg is zero an additional nz * nc^2 FLOPs are required.

If fiterror is non-NULL an additional 2 * nz * nc * np FLOPs are required.

Bad pixels in the input is suported as follows: First all pixels are fitted ignoring any bad pixel maps in the input. If this succeeds then each fit, where bad pixel(s) are involved is redone. During this second pass all input pixels flagged as bad are ignored. For each pixel to be redone, the remaining good samples are passed to cpl_polynomial_fit(). The input is_symsamp is ignored in this second pass. The reduced number of samples may reduce the number of sampling points to equal the number of coefficients to fit. In this case the fit has another meaning (any non-zero residual is due to rounding errors, not a fitting error). If for a given fit bad pixels reduces the number of sampling points to less than the number of coefficients to fit, then as many coefficients are fit as there are sampling points. The higher order coefficients are set to zero and flagged as bad. If a given pixel has no good samples, then the resulting fit will consist of zeroes, all flagged as bad.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input const pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if mindeg is negative or maxdeg is less than mindeg or if llx or lly are smaller than 1 or if urx or ury is smaller than llx and lly respectively.
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if urx or ury exceed the size of values.
  • CPL_ERROR_INCOMPATIBLE_INPUT if x_pos and values have different lengths, or if fiterror is non-NULL with a different size than that of values, or if the input images do not all have the same dimensions and pixel type.
  • CPL_ERROR_DATA_NOT_FOUND if x_pos contains less than nc values.
  • CPL_ERROR_SINGULAR_MATRIX if x_pos contains less than nc distinct values.
  • CPL_ERROR_UNSUPPORTED_MODE if the chosen pixel type is not one of CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT.
cpl_error_code cpl_fit_lvmq ( const cpl_matrix *  x,
const cpl_matrix *  sigma_x,
const cpl_vector *  y,
const cpl_vector *  sigma_y,
cpl_vector *  a,
const int  ia[],
int(*)(const double x[], const double a[], double *result)  f,
int(*)(const double x[], const double a[], double result[])  dfda,
double  relative_tolerance,
int  tolerance_count,
int  max_iterations,
double *  mse,
double *  red_chisq,
cpl_matrix **  covariance 
)

Fit a function to a set of data.

Parameters
xN x D matrix of the positions to fit. Each matrix row is a D-dimensional position.
sigma_xUncertainty (one sigma, gaussian errors assumed) assosiated with x. Taking into account the uncertainty of the independent variable is currently unsupported, and this parameter must therefore be set to NULL.
yThe N values to fit.
sigma_yVector of size N containing the uncertainties of the y-values. If this parameter is NULL, constant uncertainties are assumed.
aVector containing M fit parameters. Must contain a guess solution on input and contains the best fit parameters on output.
iaArray of size M defining which fit parameters participate in the fit (non-zero) and which fit parameters are held constant (zero). At least one element must be non-zero. Alternatively, pass NULL to fit all parameters.
fFunction that evaluates the fit function at the position specified by the first argument (an array of size D) using the fit parameters specified by the second argument (an array of size M). The result must be output using the third parameter, and the function must return zero iff the evaluation succeded.
dfdaFunction that evaluates the first order partial derivatives of the fit function with respect to the fit parameters at the position specified by the first argument (an array of size D) using the parameters specified by the second argument (an array of size M). The result must be output using the third parameter (array of size M), and the function must return zero iff the evaluation succeded.
relative_toleranceThe algorithm converges by definition if the relative decrease in chi squared is less than tolerance tolerance_count times in a row. Recommended default: CPL_FIT_LVMQ_TOLERANCE
tolerance_countThe algorithm converges by definition if the relative decrease in chi squared is less than tolerance tolerance_count times in a row. Recommended default: CPL_FIT_LVMQ_COUNT
max_iterationsIf this number of iterations is reached without convergence, the algorithm diverges, by definition. Recommended default: CPL_FIT_LVMQ_MAXITER
mseIf non-NULL, the mean squared error of the best fit is computed.
red_chisqIf non-NULL, the reduced chi square of the best fit is computed. This requires sigma_y to be specified.
covarianceIf non-NULL, the formal covariance matrix of the best fit parameters is computed (or NULL on error). On success the diagonal terms of the covariance matrix are guaranteed to be positive. However, terms that involve a constant parameter (as defined by the input array ia) are always set to zero. Computation of the covariacne matrix requires sigma_y to be specified.
Returns
CPL_ERROR_NONE iff OK.

This function makes a minimum chi squared fit of the specified function to the specified data set using a Levenberg-Marquardt algorithm.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer other than sigma_x, sigma_y, mse, red_chisq or covariance is NULL.
  • CPL_ERROR_ILLEGAL_INPUT if an input matrix/vector is empty, if ia contains only zero values, if any of relative_tolerance, tolerance_count or max_iterations is non-positive, if N <= M and red_chisq is non-NULL, if any element of sigma_x or sigma_y is non-positive, or if evaluation of the fit function or its derivative failed.
  • CPL_ERROR_INCOMPATIBLE_INPUT if the dimensions of the input vectors/matrices do not match, or if chi square or covariance computation is requested and sigma_y is NULL.
  • CPL_ERROR_ILLEGAL_OUTPUT if memory allocation failed.
  • CPL_ERROR_CONTINUE if the Levenberg-Marquardt algorithm failed to converge.
  • CPL_ERROR_SINGULAR_MATRIX if the covariance matrix could not be computed.
double cpl_gaussian_eval_2d ( const cpl_array *  self,
double  x,
double  y 
)

Evaluate the Gaussian in a 2D-point.

Parameters
selfThe seven Gaussian parameters
xThe X-coordinate to evaluate
yThe Y-coordinate to evaluate
Returns
The gaussian value or zero on error
See Also
cpl_fit_image_gaussian()
Note
The function should not be able to fail if the parameters come from a succesful call to cpl_fit_image_gaussian()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if a pointer is NULL.
  • CPL_ERROR_TYPE_MISMATCH if the array is not of type double
  • CPL_ERROR_ILLEGAL_INPUT if the array has a length different from 7
  • CPL_ERROR_ILLEGAL_OUTPUT if the (absolute value of the) radius exceeds 1
  • CPL_ERROR_DIVISION_BY_ZERO if a sigma is 0, or the radius is 1
cpl-6.4.1/html/cpl.css0000644000460300003120000000046212310333014011436 00000000000000TABLE.ec { width: 100%; text-align: left; background-color: #f5f5f5; margin-top: 0px; padding-top: 0px; border: none; } TD.ecl { font-family: monospace; vertical-align: top; padding-right: 20px; border: none; } TD.ecr { vertical-align: top; border: none; } cpl-6.4.1/html/form_1.png0000644000460300003120000000211012310333015012030 00000000000000‰PNG  IHDR¶t9Éî0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ï·IDATxíÛ®ì( D‹K.@þÿoÇ€“Ñiæ­[A»w‘Õel¯ðððð¿Ží0<]9ì“$:oˆG(Sža žÝûEÆÀ0®/ÂoæTRÐÞÚóÓcó#!•¡¯“>z¡L=´ó¯• eJï^ÙJ#Ô<ñåÖØBË4ÿ &ÊØ¥" ] £ î:–X¦ôy^aQaâGTˆñ—kb æœð¯µweJ˜à½§µ®Ì=hÕûX·®Ì=¢Â5dW(’8kè­óªbRž*ŸÚý‘fïòOue L Ez¼NQðq[{Pß»wXv/e[}Û/ˆ¤jNP™ëÊœHïÑ•…GúÂÿ°GSæÄEe©ù/s]ˆV¶³vkUÎüZήøaKa>åôa¢+ÑóFÙàÝØ<°ßЦõN=è¶õ’ðv㌲‡9ìV–8'|°[´xteáAoò Ò¢ªÊœPñ2G ‹‰®Ì‰Ôþy¦]ÎÏáNÅ÷ÍX¶š||.‚ ê!9¢lÖåï‚°WIîÂcç lØv—ÃßK³-‰´ãÓO6ÚÑêÉu›7©!å y4e½ò’™UUVÔYëDUÄA{Ë¥™F4e$Z[ß¾¶ë;•.Þ‡éájDUaèeŸîëú•ÝW¡Ê¡üMiG¿ËöŽ gÞÀÒãgÀ›¸Óá“ï¥êÑ••ÇV<&º2't ‰¼òJteááwòB›GSfe³Á|óÕ²åË$¦Vôñ4¸ÁÊk‚¨‰»3aSJ1±Ó+å6œz¨àÜéþ£UîJÀ;bNÑ<*Ks£ÇIëûð@¨‡OóhÊrå¥ù:Ñ”‘ÉÝÖˆ¦,=|ŠZx°"ˆ^$S3™ʵNWtiq¹ñóΈ¢¼‰vH¦KէЈT’x~xÔ°”¦_á@Ój—ÄA1xòéžz•ZsIl´¯\"š+Qq«‹¨²¢‘o‚K¬,=½ýäZV‚•ÑCå¯ìž²eX¹h ÇWïLq'Ч¨L°ò&ZÙ ]õ|Š2q8“N´¥G:¬8Eº{ °–„rv/Çnõ0§ñ´âµG8·»¼Z=ŠòU»ŠZTY9(—SÂÜ› ƒ+K­çïL°òòH;€x„b8C‚þ ¤"ˆV6êã^EÒ1¹öÈ¿ `xš4'þ½G:¼ˆ§+ †Ñ•¿ŒJ(SBí]üC‘üüüü÷ãnõ)á×R4IEND®B`‚cpl-6.4.1/html/form_19.png0000644000460300003120000000055712310333020012132 00000000000000‰PNG  IHDR>‹9Œ~0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïÞIDATxíK²Ä Eo?øIö¿Û5vÛy/ƒ zFÕ%eäˆ €ß+9Ê<‘€;àà‰¶†‹oæ§è|‹¸fÝ…Ù%8WÖ ÁÏJtmîR“¸¢!th¾î߸«ý<ô¢ ýÂ÷Ø>–à*ÅGHKÐpC|†¯·ŽÃæOÅ?CFöimÏ Ñ›:lÉ~‡ç¬Þܵ®hû¤KµO3}=pÖFÊÔðäzÁa«¼l¬dßvƒÃjm;a FG,°È3Û9DËÍÈ+-ŽF_*¬z«ðàL(ãIEND®B`‚cpl-6.4.1/html/group__cpl__array.html0000644000460300003120000116511212310333014014527 00000000000000 Common Pipeline Library Reference Manual: Arrays
Common Pipeline Library Reference Manual  6.4.1
Arrays

Functions

cpl_error_code cpl_array_abs (cpl_array *array)
 Compute the absolute value of array elements.
 
cpl_error_code cpl_array_add (cpl_array *to_array, const cpl_array *from_array)
 Add the values of two numeric or complex arrays.
 
cpl_error_code cpl_array_add_scalar (cpl_array *array, double value)
 Add a constant value to a numerical array.
 
cpl_error_code cpl_array_add_scalar_complex (cpl_array *array, double complex value)
 Add a constant complex value to a complex array.
 
cpl_error_code cpl_array_arg (cpl_array *array)
 Compute the phase angle value of array elements.
 
cpl_array * cpl_array_cast (cpl_array *array, cpl_type type)
 Cast a numeric array to a new numeric type array.
 
cpl_error_code cpl_array_copy_data (cpl_array *array, const double *data)
 Copy buffer of numerical data to a numerical array.
 
cpl_error_code cpl_array_copy_data_complex (cpl_array *array, const double complex *data)
 Copy buffer of complex data to a complex array.
 
cpl_error_code cpl_array_copy_data_cplsize (cpl_array *array, const cpl_size *data)
 Copy existing data to a cpl_size array.
 
cpl_error_code cpl_array_copy_data_double (cpl_array *array, const double *data)
 Copy existing data to a double array.
 
cpl_error_code cpl_array_copy_data_double_complex (cpl_array *array, const double complex *data)
 Copy existing data to a double complex array.
 
cpl_error_code cpl_array_copy_data_float (cpl_array *array, const float *data)
 Copy existing data to a float array.
 
cpl_error_code cpl_array_copy_data_float_complex (cpl_array *array, const float complex *data)
 Copy existing data to a float complex array.
 
cpl_error_code cpl_array_copy_data_int (cpl_array *array, const int *data)
 Copy existing data to an integer array.
 
cpl_error_code cpl_array_copy_data_long (cpl_array *array, const long *data)
 Copy existing data to a long integer array.
 
cpl_error_code cpl_array_copy_data_long_long (cpl_array *array, const long long *data)
 Copy existing data to a long long integer array.
 
cpl_error_code cpl_array_copy_data_string (cpl_array *array, const char **data)
 Copy existing data to a string array.
 
cpl_size cpl_array_count_invalid (const cpl_array *array)
 Count number of invalid elements in an array.
 
void cpl_array_delete (cpl_array *array)
 Delete an array.
 
cpl_error_code cpl_array_divide (cpl_array *to_array, const cpl_array *from_array)
 Divide the values of two numeric or complex arrays.
 
cpl_error_code cpl_array_divide_scalar (cpl_array *array, double value)
 Divide a numerical array by a constant value.
 
cpl_error_code cpl_array_divide_scalar_complex (cpl_array *array, double complex value)
 Divide a complex array by a constant complex value.
 
void cpl_array_dump (const cpl_array *array, cpl_size start, cpl_size count, FILE *stream)
 Print an array.
 
void cpl_array_dump_structure (const cpl_array *array, FILE *stream)
 Describe the structure and the contents of an array.
 
cpl_array * cpl_array_duplicate (const cpl_array *array)
 Make a copy of an array.
 
cpl_error_code cpl_array_erase_window (cpl_array *array, cpl_size start, cpl_size count)
 Delete a segment of an array.
 
cpl_error_code cpl_array_exponential (cpl_array *array, double base)
 Compute the exponential of array elements.
 
cpl_array * cpl_array_extract (const cpl_array *array, cpl_size start, cpl_size count)
 Create an array from a section of another array.
 
cpl_array * cpl_array_extract_imag (cpl_array *array)
 Extract the imaginary value of array elements.
 
cpl_array * cpl_array_extract_real (cpl_array *array)
 Extract the real value of array elements.
 
cpl_error_code cpl_array_fill_window (cpl_array *array, cpl_size start, cpl_size count, double value)
 Write the same value within a numerical array segment.
 
cpl_error_code cpl_array_fill_window_complex (cpl_array *array, cpl_size start, cpl_size count, double complex value)
 Write the same value within a complex array segment.
 
cpl_error_code cpl_array_fill_window_cplsize (cpl_array *array, cpl_size start, cpl_size count, cpl_size value)
 Write the same value within a cpl_size array segment.
 
cpl_error_code cpl_array_fill_window_double (cpl_array *array, cpl_size start, cpl_size count, double value)
 Write the same value within a double array segment.
 
cpl_error_code cpl_array_fill_window_double_complex (cpl_array *array, cpl_size start, cpl_size count, double complex value)
 Write the same value within a double complex array segment.
 
cpl_error_code cpl_array_fill_window_float (cpl_array *array, cpl_size start, cpl_size count, float value)
 Write the same value within a float array segment.
 
cpl_error_code cpl_array_fill_window_float_complex (cpl_array *array, cpl_size start, cpl_size count, float complex value)
 Write the same value within a float complex array segment.
 
cpl_error_code cpl_array_fill_window_int (cpl_array *array, cpl_size start, cpl_size count, int value)
 Write the same value within an integer array segment.
 
cpl_error_code cpl_array_fill_window_invalid (cpl_array *array, cpl_size start, cpl_size count)
 Set an array segment to NULL.
 
cpl_error_code cpl_array_fill_window_long (cpl_array *array, cpl_size start, cpl_size count, long value)
 Write the same value within a long integer array segment.
 
cpl_error_code cpl_array_fill_window_long_long (cpl_array *array, cpl_size start, cpl_size count, long long value)
 Write the same value within a long long integer array segment.
 
cpl_error_code cpl_array_fill_window_string (cpl_array *array, cpl_size start, cpl_size count, const char *value)
 Write a string to a string array segment.
 
double cpl_array_get (const cpl_array *array, cpl_size indx, int *null)
 Read a value from a numerical array.
 
double complex cpl_array_get_complex (const cpl_array *array, cpl_size indx, int *null)
 Read a value from a complex array.
 
cpl_size cpl_array_get_cplsize (const cpl_array *array, cpl_size indx, int *null)
 Read a value from a cpl_size array.
 
cpl_sizecpl_array_get_data_cplsize (cpl_array *array)
 Get a pointer to cpl_size array data.
 
const cpl_sizecpl_array_get_data_cplsize_const (const cpl_array *array)
 Get a pointer to constant cpl_size array data.
 
double * cpl_array_get_data_double (cpl_array *array)
 Get a pointer to double array data.
 
double complex * cpl_array_get_data_double_complex (cpl_array *array)
 Get a pointer to double complex array data.
 
const double complex * cpl_array_get_data_double_complex_const (const cpl_array *array)
 Get a pointer to constant double complex array data.
 
const double * cpl_array_get_data_double_const (const cpl_array *array)
 Get a pointer to constant double array data.
 
float * cpl_array_get_data_float (cpl_array *array)
 Get a pointer to float array data.
 
float complex * cpl_array_get_data_float_complex (cpl_array *array)
 Get a pointer to float complex array data.
 
const float complex * cpl_array_get_data_float_complex_const (const cpl_array *array)
 Get a pointer to constant float complex array data.
 
const float * cpl_array_get_data_float_const (const cpl_array *array)
 Get a pointer to constant float array data.
 
int * cpl_array_get_data_int (cpl_array *array)
 Get a pointer to integer array data.
 
const int * cpl_array_get_data_int_const (const cpl_array *array)
 Get a pointer to constant integer array data.
 
long * cpl_array_get_data_long (cpl_array *array)
 Get a pointer to long integer array data.
 
const long * cpl_array_get_data_long_const (const cpl_array *array)
 Get a pointer to constant long integer array data.
 
long long * cpl_array_get_data_long_long (cpl_array *array)
 Get a pointer to long long integer array data.
 
const long long * cpl_array_get_data_long_long_const (const cpl_array *array)
 Get a pointer to constant long long integer array data.
 
char ** cpl_array_get_data_string (cpl_array *array)
 Get a pointer to string array data.
 
const char ** cpl_array_get_data_string_const (const cpl_array *array)
 Get a pointer to constant string array data.
 
double cpl_array_get_double (const cpl_array *array, cpl_size indx, int *null)
 Read a value from a double array.
 
double complex cpl_array_get_double_complex (const cpl_array *array, cpl_size indx, int *null)
 Read a value from a double complex array.
 
float cpl_array_get_float (const cpl_array *array, cpl_size indx, int *null)
 Read a value from a float array.
 
float complex cpl_array_get_float_complex (const cpl_array *array, cpl_size indx, int *null)
 Read a value from a float complex array.
 
int cpl_array_get_int (const cpl_array *array, cpl_size indx, int *null)
 Read a value from an integer array.
 
long cpl_array_get_long (const cpl_array *array, cpl_size indx, int *null)
 Read a value from a long integer array.
 
long long cpl_array_get_long_long (const cpl_array *array, cpl_size indx, int *null)
 Read a value from a long long integer array.
 
double cpl_array_get_max (const cpl_array *array)
 Get maximum value in a numerical array.
 
cpl_error_code cpl_array_get_maxpos (const cpl_array *array, cpl_size *indx)
 Get position of maximum in a numerical array.
 
double cpl_array_get_mean (const cpl_array *array)
 Compute the mean value of a numeric array.
 
double complex cpl_array_get_mean_complex (const cpl_array *array)
 Compute the mean value of a complex array.
 
double cpl_array_get_median (const cpl_array *array)
 Compute the median of a numeric array.
 
double cpl_array_get_min (const cpl_array *array)
 Get minimum value in a numerical array.
 
cpl_error_code cpl_array_get_minpos (const cpl_array *array, cpl_size *indx)
 Get position of minimum in a numerical array.
 
cpl_size cpl_array_get_size (const cpl_array *array)
 Get the length of an array.
 
double cpl_array_get_stdev (const cpl_array *array)
 Compute the standard deviation of a numeric array.
 
const char * cpl_array_get_string (const cpl_array *array, cpl_size indx)
 Read a value from a string array.
 
cpl_type cpl_array_get_type (const cpl_array *array)
 Get the type of an array.
 
int cpl_array_has_invalid (const cpl_array *array)
 Check if an array contains at least one invalid element.
 
int cpl_array_has_valid (const cpl_array *array)
 Check if an array contains at least one valid value.
 
cpl_error_code cpl_array_insert (cpl_array *target_array, const cpl_array *insert_array, cpl_size start)
 Merge two arrays.
 
cpl_error_code cpl_array_insert_window (cpl_array *array, cpl_size start, cpl_size count)
 Insert a segment of new elements into array.
 
int cpl_array_is_valid (const cpl_array *array, cpl_size indx)
 Check if an array element is valid.
 
cpl_error_code cpl_array_logarithm (cpl_array *array, double base)
 Compute the logarithm of array elements.
 
cpl_error_code cpl_array_multiply (cpl_array *to_array, const cpl_array *from_array)
 Multiply the values of two numeric or complex arrays.
 
cpl_error_code cpl_array_multiply_scalar (cpl_array *array, double value)
 Multiply a numerical array by a constant value.
 
cpl_error_code cpl_array_multiply_scalar_complex (cpl_array *array, double complex value)
 Multiply a complex array by a constant complex value.
 
cpl_array * cpl_array_new (cpl_size length, cpl_type type)
 Create a new array of given type.
 
cpl_error_code cpl_array_power (cpl_array *array, double exponent)
 Compute the power of array elements.
 
cpl_error_code cpl_array_set (cpl_array *array, cpl_size indx, double value)
 Write a value to a numerical array element.
 
cpl_error_code cpl_array_set_complex (cpl_array *array, cpl_size indx, double complex value)
 Write a value to a complex array element.
 
cpl_error_code cpl_array_set_cplsize (cpl_array *array, cpl_size indx, cpl_size value)
 Write a value to a cpl_size array element.
 
cpl_error_code cpl_array_set_double (cpl_array *array, cpl_size indx, double value)
 Write a value to a double array element.
 
cpl_error_code cpl_array_set_double_complex (cpl_array *array, cpl_size indx, double complex value)
 Write a value to a double complex array element.
 
cpl_error_code cpl_array_set_float (cpl_array *array, cpl_size indx, float value)
 Write a value to a float array element.
 
cpl_error_code cpl_array_set_float_complex (cpl_array *array, cpl_size indx, float complex value)
 Write a value to a float complex array element.
 
cpl_error_code cpl_array_set_int (cpl_array *array, cpl_size indx, int value)
 Write a value to an integer array element.
 
cpl_error_code cpl_array_set_invalid (cpl_array *array, cpl_size indx)
 Invalidate an array element.
 
cpl_error_code cpl_array_set_long (cpl_array *array, cpl_size indx, long value)
 Write a value to a long integer array element.
 
cpl_error_code cpl_array_set_long_long (cpl_array *array, cpl_size indx, long long value)
 Write a value to a long long integer array element.
 
cpl_error_code cpl_array_set_size (cpl_array *array, cpl_size new_length)
 Resize an array.
 
cpl_error_code cpl_array_set_string (cpl_array *array, cpl_size indx, const char *string)
 Write a character string to a string array element.
 
cpl_error_code cpl_array_subtract (cpl_array *to_array, const cpl_array *from_array)
 Subtract the values of two numeric or complex arrays.
 
cpl_error_code cpl_array_subtract_scalar (cpl_array *array, double value)
 Subtract a constant value from a numerical array.
 
cpl_error_code cpl_array_subtract_scalar_complex (cpl_array *array, double complex value)
 Subtract a constant complex value from a complex array.
 
void * cpl_array_unwrap (cpl_array *array)
 Delete an array, without losing the data buffer.
 
cpl_array * cpl_array_wrap_cplsize (cpl_size *data, cpl_size length)
 Create a new cpl_size array from existing data.
 
cpl_array * cpl_array_wrap_double (double *data, cpl_size length)
 Create a new double array from existing data.
 
cpl_array * cpl_array_wrap_double_complex (double complex *data, cpl_size length)
 Create a new double complex array from existing data.
 
cpl_array * cpl_array_wrap_float (float *data, cpl_size length)
 Create a new float array from existing data.
 
cpl_array * cpl_array_wrap_float_complex (float complex *data, cpl_size length)
 Create a new float complex array from existing data.
 
cpl_array * cpl_array_wrap_int (int *data, cpl_size length)
 Create a new integer array from existing data.
 
cpl_array * cpl_array_wrap_long (long *data, cpl_size length)
 Create a new long integer array from existing data.
 
cpl_array * cpl_array_wrap_long_long (long long *data, cpl_size length)
 Create a new long long integer array from existing data.
 
cpl_array * cpl_array_wrap_string (char **data, cpl_size length)
 Create a new character string array from existing data.
 

Detailed Description

This module provides functions to create, destroy and use a cpl_array.

Synopsis:
#include <cpl_array.h>

Function Documentation

cpl_error_code cpl_array_abs ( cpl_array *  array)

Compute the absolute value of array elements.

Parameters
arrayPointer to array.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical.

Each array element is replaced by its absolute value. Invalid elements are not modified by this operation. If the array is complex, its type will be turned to real (CPL_TYPE_FLOAT_COMPLEX will be changed into CPL_TYPE_FLOAT, and CPL_TYPE_DOUBLE_COMPLEX will be changed into CPL_TYPE_DOUBLE), and any pointer retrieved by calling cpl_array_get_data_float(), cpl_array_get_data_double_complex(), etc., should be discarded.

cpl_error_code cpl_array_add ( cpl_array *  to_array,
const cpl_array *  from_array 
)

Add the values of two numeric or complex arrays.

Parameters
to_arrayTarget array.
from_arraySource array.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any input array is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT The input arrays have different sizes.
CPL_ERROR_INVALID_TYPE Any specified array is not numerical.

The arrays are summed element by element, and the result of the sum is stored in the target array. The arrays' types may differ, and in that case the operation would be performed using the standard C upcasting rules, with a final cast of the result to the target array type. Invalid elements are propagated consistently: if either or both members of the sum are invalid, the result will be invalid too. Underflows and overflows are ignored.

cpl_error_code cpl_array_add_scalar ( cpl_array *  array,
double  value 
)

Add a constant value to a numerical array.

Parameters
arrayTarget array
valueValue to add.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The input array is not numerical.

The operation is always performed in double precision, with a final cast of the result to the target array type. Invalid elements are are not modified by this operation.

cpl_error_code cpl_array_add_scalar_complex ( cpl_array *  array,
double complex  value 
)

Add a constant complex value to a complex array.

Parameters
arrayTarget array
valueValue to add.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The input array is not complex.

The operation is always performed in double precision, with a final cast of the result to the target array type. Invalid elements are are not modified by this operation.

cpl_error_code cpl_array_arg ( cpl_array *  array)

Compute the phase angle value of array elements.

Parameters
arrayPointer to array.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical.

Each array element is replaced by its phase angle value. The phase angle will be in the range of [-pi,pi]. Invalid elements are not modified by this operation. If the array is complex, its type will be turned to real (CPL_TYPE_FLOAT_COMPLEX will be changed into CPL_TYPE_FLOAT, and CPL_TYPE_DOUBLE_COMPLEX will be changed into CPL_TYPE_DOUBLE), and any pointer retrieved by calling cpl_array_get_data_float(), cpl_array_get_data_double_complex(), etc., should be discarded.

cpl_array* cpl_array_cast ( cpl_array *  array,
cpl_type  type 
)

Cast a numeric array to a new numeric type array.

Parameters
arrayPointer to array.
typeType of new array.
Returns
New array.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The specified column is not numerical.
CPL_ERROR_ILLEGAL_INPUT The specified type is not numerical.

A new array of the specified type is created, and the content of the input numeric array is cast to the new type. If the input array type is identical to the specified type the array is duplicated as is done by the function cpl_array_duplicate().

cpl_error_code cpl_array_copy_data ( cpl_array *  array,
const double *  data 
)

Copy buffer of numerical data to a numerical array.

Parameters
arrayExisting array.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success. If the array is not numerical, a CPL_ERROR_INVALID_TYPE is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.

The input data are copied into the specified array. If the type of the accessed array is not CPL_TYPE_DOUBLE, the data values will be truncated according to C casting rules. The size of the input data buffer is not checked in any way, and the values are all considered valid: invalid values should be marked using the functions cpl_array_set_invalid(). If N is the length of the array, the first N values of the input data buffer would be copied to the column buffer. If the array had length zero, no values would be copied.

cpl_error_code cpl_array_copy_data_complex ( cpl_array *  array,
const double complex *  data 
)

Copy buffer of complex data to a complex array.

Parameters
arrayExisting array.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success. If the array is not complex, a CPL_ERROR_INVALID_TYPE is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.

The input data are copied into the specified array. If the type of the accessed array is not CPL_TYPE_DOUBLE, the data values will be truncated according to C casting rules. The size of the input data buffer is not checked in any way, and the values are all considered valid: invalid values should be marked using the functions cpl_array_set_invalid(). If N is the length of the array, the first N values of the input data buffer would be copied to the column buffer. If the array had length zero, no values would be copied.

cpl_error_code cpl_array_copy_data_cplsize ( cpl_array *  array,
const cpl_size data 
)

Copy existing data to a cpl_size array.

Parameters
arrayExisting array.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_SIZE, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.

The input data are copied into the specified array. The size of the input data buffer is not checked in any way, and the data values are all considered valid: invalid values should be marked using the functions cpl_array_set_invalid(). If N is the length of the array, the first N values of the input data buffer would be copied to the array buffer. If the array had length zero, no values would be copied.

cpl_error_code cpl_array_copy_data_double ( cpl_array *  array,
const double *  data 
)

Copy existing data to a double array.

Parameters
arrayExisting array.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_DOUBLE, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.

See documentation of function cpl_array_copy_data_int().

cpl_error_code cpl_array_copy_data_double_complex ( cpl_array *  array,
const double complex *  data 
)

Copy existing data to a double complex array.

Parameters
arrayExisting array.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_DOUBLE_COMPLEX, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.

See documentation of function cpl_array_copy_data_int().

cpl_error_code cpl_array_copy_data_float ( cpl_array *  array,
const float *  data 
)

Copy existing data to a float array.

Parameters
arrayExisting array.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_FLOAT, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.

See documentation of function cpl_array_copy_data_int().

cpl_error_code cpl_array_copy_data_float_complex ( cpl_array *  array,
const float complex *  data 
)

Copy existing data to a float complex array.

Parameters
arrayExisting array.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_FLOAT_COMPLEX, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.

See documentation of function cpl_array_copy_data_int().

cpl_error_code cpl_array_copy_data_int ( cpl_array *  array,
const int *  data 
)

Copy existing data to an integer array.

Parameters
arrayExisting array.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_INT, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.

The input data are copied into the specified array. The size of the input data buffer is not checked in any way, and the data values are all considered valid: invalid values should be marked using the functions cpl_array_set_invalid(). If N is the length of the array, the first N values of the input data buffer would be copied to the array buffer. If the array had length zero, no values would be copied.

cpl_error_code cpl_array_copy_data_long ( cpl_array *  array,
const long *  data 
)

Copy existing data to a long integer array.

Parameters
arrayExisting array.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_LONG, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.

The input data are copied into the specified array. The size of the input data buffer is not checked in any way, and the data values are all considered valid: invalid values should be marked using the functions cpl_array_set_invalid(). If N is the length of the array, the first N values of the input data buffer would be copied to the array buffer. If the array had length zero, no values would be copied.

cpl_error_code cpl_array_copy_data_long_long ( cpl_array *  array,
const long long *  data 
)

Copy existing data to a long long integer array.

Parameters
arrayExisting array.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_LONG_LONG, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.

The input data are copied into the specified array. The size of the input data buffer is not checked in any way, and the data values are all considered valid: invalid values should be marked using the functions cpl_array_set_invalid(). If N is the length of the array, the first N values of the input data buffer would be copied to the array buffer. If the array had length zero, no values would be copied.

cpl_error_code cpl_array_copy_data_string ( cpl_array *  array,
const char **  data 
)

Copy existing data to a string array.

Parameters
arrayExisting array.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_STRING, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.

See documentation of function cpl_array_copy_data_int().

The input data are copied into the specified array. The size of the input buffer is not checked in any way. The strings pointed by the input buffer are all duplicated, while the strings contained in the array are released before being overwritten.

cpl_size cpl_array_count_invalid ( const cpl_array *  array)

Count number of invalid elements in an array.

Parameters
arrayArray to inquire.
Returns
Number of invalid elements in an array. -1 is always returned in case of error.

Count number of invalid elements in an array. If the array itself is a NULL pointer, an error CPL_ERROR_NULL_INPUT is set.

void cpl_array_delete ( cpl_array *  array)

Delete an array.

Parameters
arrayArray to be deleted.
Returns
Nothing.

This function deletes an array. If the input array is NULL, nothing is done, and no error is set.

cpl_error_code cpl_array_divide ( cpl_array *  to_array,
const cpl_array *  from_array 
)

Divide the values of two numeric or complex arrays.

Parameters
to_arrayTarget array.
from_arraySource array.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any input array is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT The input arrays have different sizes.
CPL_ERROR_INVALID_TYPE Any specified array is not numerical.

The arrays are divided element by element, and the result is stored in the target array. See the documentation of the function cpl_array_add() for further details.

cpl_error_code cpl_array_divide_scalar ( cpl_array *  array,
double  value 
)

Divide a numerical array by a constant value.

Parameters
arrayTarget array
valueDivisor.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The input array is not numerical.
CPL_ERROR_DIVISION_BY_ZERO The input value is zero.

The operation is always performed in double precision, with a final cast of the result to the target array type. Invalid elements are not modified by this operation.

cpl_error_code cpl_array_divide_scalar_complex ( cpl_array *  array,
double complex  value 
)

Divide a complex array by a constant complex value.

Parameters
arrayTarget array
valueDivisor.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The input array is not complex.
CPL_ERROR_DIVISION_BY_ZERO The input value is zero.

The operation is always performed in double precision, with a final cast of the result to the target array type. Invalid elements are not modified by this operation.

void cpl_array_dump ( const cpl_array *  array,
cpl_size  start,
cpl_size  count,
FILE *  stream 
)

Print an array.

Parameters
arrayPointer to array
startFirst element to print
countNumber of elements to print
streamThe output stream
Returns
Nothing.

This function is mainly intended for debug purposes. Array elements are counted from 0, and their sequence number is printed at the left of each element. Invalid elements are represented as a sequence of "-" as wide as the field occupied by the array. Specifying a start beyond the array boundaries, or a non-positive count, would generate a warning message, but no error would be set. The specified number of elements to print may exceed the array end, and in that case the array would be printed up to its last element. If the specified stream is NULL, it is set to stdout. The function used for printing is the standard C fprintf().

void cpl_array_dump_structure ( const cpl_array *  array,
FILE *  stream 
)

Describe the structure and the contents of an array.

Parameters
arrayPointer to array.
streamThe output stream
Returns
Nothing.

This function is mainly intended for debug purposes. Some information about the structure of an array and its contents is printed to terminal:

  • Data type of the array
  • Number of elements
  • Number of invalid elements

If the specified stream is NULL, it is set to stdout. The function used for printing is the standard C fprintf().

cpl_array* cpl_array_duplicate ( const cpl_array *  array)

Make a copy of an array.

Parameters
arrayArray to be duplicated.
Returns
Pointer to the new array, or NULL in case of error.

If the input array is a NULL pointer, a CPL_ERROR_NULL_INPUT is returned. Copy is "in depth": in the case of a string array, also the string elements are duplicated.

cpl_error_code cpl_array_erase_window ( cpl_array *  array,
cpl_size  start,
cpl_size  count 
)

Delete a segment of an array.

Parameters
arrayInput array
startFirst element to delete.
countNumber of elements to delete.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT array is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input array has length zero, or start is outside the table range.
CPL_ERROR_ILLEGAL_INPUT count is negative.

A portion of the array data is physically removed. The pointers to data may change, therefore pointers previously retrieved by calling cpl_array_get_data_int(), cpl_array_get_data_string(), etc., should be discarded. The specified segment can extend beyond the end of the array, and in that case elements will be removed up to the end of the array.

cpl_error_code cpl_array_exponential ( cpl_array *  array,
double  base 
)

Compute the exponential of array elements.

Parameters
arrayPointer to array.
baseExponential base.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical or complex.
CPL_ERROR_ILLEGAL_INPUT The input base is not positive.

Each column element is replaced by its exponential in the specified base. The operation is always performed in double precision, with a final cast of the result to the array type. Invalid elements are not modified by this operation.

cpl_array* cpl_array_extract ( const cpl_array *  array,
cpl_size  start,
cpl_size  count 
)

Create an array from a section of another array.

Parameters
arrayInput array
startFirst element to be copied to new array.
countNumber of elements to be copied.
Returns
Pointer to the new array, or NULL in case or error.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input array has zero length, or start is outside the array boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.

A number of consecutive elements are copied from an input array to a newly created array. If the sum of start and count goes beyond the end of the input array, elements are copied up to the end.

cpl_array* cpl_array_extract_imag ( cpl_array *  array)

Extract the imaginary value of array elements.

Parameters
arrayPointer to array.
Returns
New array with imaginary part of input array elements.
Errors
CPL_ERROR_NULL_INPUT Input array is NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical.

A new array is created with the imaginary part of all input array elements. If the input array is complex, the output type will be CPL_TYPE_FLOAT if input is CPL_TYPE_FLOAT_COMPLEX, and CPL_TYPE_DOUBLE if input is CPL_TYPE_DOUBLE_COMPLEX).

cpl_array* cpl_array_extract_real ( cpl_array *  array)

Extract the real value of array elements.

Parameters
arrayPointer to array.
Returns
New array with real part of input array elements.
Errors
CPL_ERROR_NULL_INPUT Input array is NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical.

A new array is created with the real part of all input array elements. If the input array is complex, the output type will be CPL_TYPE_FLOAT if input is CPL_TYPE_FLOAT_COMPLEX, and CPL_TYPE_DOUBLE if input is CPL_TYPE_DOUBLE_COMPLEX).

cpl_error_code cpl_array_fill_window ( cpl_array *  array,
cpl_size  start,
cpl_size  count,
double  value 
)

Write the same value within a numerical array segment.

Parameters
arrayArray to be accessed.
startPosition where to begin write value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of numerical type, a CPL_ERROR_INVALID_TYPE is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Write the same value to a numerical array segment. The value is cast to the accessed array type. The written values are automatically flagged as valid. To invalidate an array interval use cpl_array_fill_window_invalid().

cpl_error_code cpl_array_fill_window_complex ( cpl_array *  array,
cpl_size  start,
cpl_size  count,
double complex  value 
)

Write the same value within a complex array segment.

Parameters
arrayArray to be accessed.
startPosition where to begin write value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of numerical type, a CPL_ERROR_INVALID_TYPE is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Write the same value to a complex array segment. The value is cast to the accessed array type. The written values are automatically flagged as valid. To invalidate an array interval use cpl_array_fill_window_invalid().

cpl_error_code cpl_array_fill_window_cplsize ( cpl_array *  array,
cpl_size  start,
cpl_size  count,
cpl_size  value 
)

Write the same value within a cpl_size array segment.

Parameters
arrayArray to be accessed.
startPosition where to begin write value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.

Write the same value to a cpl_size array segment. The written values are automatically flagged as valid. To invalidate an array interval use cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be written just up to the end of the array. If count is zero, the array is not modified and no error is set.

cpl_error_code cpl_array_fill_window_double ( cpl_array *  array,
cpl_size  start,
cpl_size  count,
double  value 
)

Write the same value within a double array segment.

Parameters
arrayArray to be accessed.
startPosition where to begin write value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.

Write the same value to a double array segment. The written values are automatically flagged as valid. To invalidate an array interval use cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be written just up to the end of the array. If count is zero, the array is not modified and no error is set.

cpl_error_code cpl_array_fill_window_double_complex ( cpl_array *  array,
cpl_size  start,
cpl_size  count,
double complex  value 
)

Write the same value within a double complex array segment.

Parameters
arrayArray to be accessed.
startPosition where to begin write value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.

Write the same value to a double complex array segment. The written values are automatically flagged as valid. To invalidate an array interval use cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be written just up to the end of the array. If count is zero, the array is not modified and no error is set.

cpl_error_code cpl_array_fill_window_float ( cpl_array *  array,
cpl_size  start,
cpl_size  count,
float  value 
)

Write the same value within a float array segment.

Parameters
arrayArray to be accessed.
startPosition where to begin write value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.

Write the same value to a float array segment. The written values are automatically flagged as valid. To invalidate an array interval use cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be written just up to the end of the array. If count is zero, the array is not modified and no error is set.

cpl_error_code cpl_array_fill_window_float_complex ( cpl_array *  array,
cpl_size  start,
cpl_size  count,
float complex  value 
)

Write the same value within a float complex array segment.

Parameters
arrayArray to be accessed.
startPosition where to begin write value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.

Write the same value to a float complex array segment. The written values are automatically flagged as valid. To invalidate an array interval use cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be written just up to the end of the array. If count is zero, the array is not modified and no error is set.

cpl_error_code cpl_array_fill_window_int ( cpl_array *  array,
cpl_size  start,
cpl_size  count,
int  value 
)

Write the same value within an integer array segment.

Parameters
arrayArray to be accessed.
startPosition where to begin write value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.

Write the same value to an integer array segment. The written values are automatically flagged as valid. To invalidate an array interval use cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be written just up to the end of the array. If count is zero, the array is not modified and no error is set.

cpl_error_code cpl_array_fill_window_invalid ( cpl_array *  array,
cpl_size  start,
cpl_size  count 
)

Set an array segment to NULL.

Parameters
arrayArray to be accessed.
startPosition where to start writing NULLs.
countNumber of column elements to set to NULL.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.

Invalidate values contained in an array segment. The count argument can go beyond the array end, and in that case the values will be invalidated up to the end of the array. If count is zero, the array is not modified and no error is set. In the case of a string array, the invalidated strings are set free and their pointers are set to NULL; for other data types, the corresponding elements are flagged as invalid.

cpl_error_code cpl_array_fill_window_long ( cpl_array *  array,
cpl_size  start,
cpl_size  count,
long  value 
)

Write the same value within a long integer array segment.

Parameters
arrayArray to be accessed.
startPosition where to begin write value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.

Write the same value to a long integer array segment. The written values are automatically flagged as valid. To invalidate an array interval use cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be written just up to the end of the array. If count is zero, the array is not modified and no error is set.

cpl_error_code cpl_array_fill_window_long_long ( cpl_array *  array,
cpl_size  start,
cpl_size  count,
long long  value 
)

Write the same value within a long long integer array segment.

Parameters
arrayArray to be accessed.
startPosition where to begin write value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.

Write the same value to a long long integer array segment. The written values are automatically flagged as valid. To invalidate an array interval use cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be written just up to the end of the array. If count is zero, the array is not modified and no error is set.

cpl_error_code cpl_array_fill_window_string ( cpl_array *  array,
cpl_size  start,
cpl_size  count,
const char *  value 
)

Write a string to a string array segment.

Parameters
arrayArray to be accessed.
startPosition where to begin write value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.

Copy the same string to a string array segment. If the input string is not a NULL pointer, it is duplicated for each accessed array element. If the input string is NULL, this call is equivalent to cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be copied just up to the end of the array. If count is zero, the array is not modified and no error is set.

double cpl_array_get ( const cpl_array *  array,
cpl_size  indx,
int *  null 
)

Read a value from a numerical array.

Parameters
arrayArray to be accessed.
indxPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Value read. In case of an invalid array element, or in case of error, 0.0 is returned.

Read a value from a numerical array. A CPL_ERROR_NULL_INPUT is set in case array is a NULL pointer. A CPL_ERROR_INVALID_TYPE is set in case a non-numerical array is accessed. CPL_ERROR_ACCESS_OUT_OF_RANGE is set if the indx is outside the array range. Indexes are counted starting from 0. If the input array has length zero, CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. The null flag is used to indicate whether the accessed array element is valid (0) or invalid (1). The null flag also signals an error condition (-1). The null argument can be left to NULL.

double complex cpl_array_get_complex ( const cpl_array *  array,
cpl_size  indx,
int *  null 
)

Read a value from a complex array.

Parameters
arrayArray to be accessed.
indxPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Value read. In case of an invalid array element, or in case of error, 0.0 is returned.

Read a value from a complex array. A CPL_ERROR_NULL_INPUT is set in case array is a NULL pointer. A CPL_ERROR_INVALID_TYPE is set in case a non-complex array is accessed. CPL_ERROR_ACCESS_OUT_OF_RANGE is set if the indx is outside the array range. Indexes are counted starting from 0. If the input array has length zero, CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. The null flag is used to indicate whether the accessed array element is valid (0) or invalid (1). The null flag also signals an error condition (-1). The null argument can be left to NULL.

cpl_size cpl_array_get_cplsize ( const cpl_array *  array,
cpl_size  indx,
int *  null 
)

Read a value from a cpl_size array.

Parameters
arrayArray to be accessed.
indxPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
The cpl_size value read. In case of an invalid array element, or in case of error, 0 is returned.

Read a value from an array of type CPL_TYPE_SIZE. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is set. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is set. Indexes are counted starting from 0. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the null flag is a valid pointer, it is used to indicate whether the accessed array element is valid (0) or invalid (1). The null flag also signals an error condition (-1).

cpl_size* cpl_array_get_data_cplsize ( cpl_array *  array)

Get a pointer to cpl_size array data.

Parameters
arrayArray to get the data from.
Returns
Pointer to cpl_size array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_SIZE, a CPL_ERROR_TYPE_MISMATCH is set.

Note
Use at your own risk: direct manipulation of array data rules out any check performed by the array object interface, and may introduce inconsistencies between the array information maintained internally and the actual array data.
const cpl_size* cpl_array_get_data_cplsize_const ( const cpl_array *  array)

Get a pointer to constant cpl_size array data.

Parameters
arrayConstant array to get the data from.
Returns
Pointer to constant cpl_size array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_SIZE, a CPL_ERROR_TYPE_MISMATCH is set.

double* cpl_array_get_data_double ( cpl_array *  array)

Get a pointer to double array data.

Parameters
arrayArray to get the data from.
Returns
Pointer to double array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_DOUBLE, a CPL_ERROR_TYPE_MISMATCH is set.

See documentation of function cpl_array_get_data_int().

double complex* cpl_array_get_data_double_complex ( cpl_array *  array)

Get a pointer to double complex array data.

Parameters
arrayArray to get the data from.
Returns
Pointer to double complex array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_DOUBLE_COMPLEX, a CPL_ERROR_TYPE_MISMATCH is set.

See documentation of function cpl_array_get_data_int().

const double complex* cpl_array_get_data_double_complex_const ( const cpl_array *  array)

Get a pointer to constant double complex array data.

Parameters
arrayConstant array to get the data from.
Returns
Pointer to constant double complex array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_DOUBLE_COMPLEX, a CPL_ERROR_TYPE_MISMATCH is set.

See documentation of function cpl_array_get_data_int_const().

const double* cpl_array_get_data_double_const ( const cpl_array *  array)

Get a pointer to constant double array data.

Parameters
arrayConstant array to get the data from.
Returns
Pointer to constant double array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_DOUBLE, a CPL_ERROR_TYPE_MISMATCH is set.

See documentation of function cpl_array_get_data_int_const().

float* cpl_array_get_data_float ( cpl_array *  array)

Get a pointer to float array data.

Parameters
arrayArray to get the data from.
Returns
Pointer to float array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_FLOAT, a CPL_ERROR_TYPE_MISMATCH is set.

See documentation of function cpl_array_get_data_int().

float complex* cpl_array_get_data_float_complex ( cpl_array *  array)

Get a pointer to float complex array data.

Parameters
arrayArray to get the data from.
Returns
Pointer to float complex array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_FLOAT_COMPLEX, a CPL_ERROR_TYPE_MISMATCH is set.

See documentation of function cpl_array_get_data_int().

const float complex* cpl_array_get_data_float_complex_const ( const cpl_array *  array)

Get a pointer to constant float complex array data.

Parameters
arrayConstant array to get the data from.
Returns
Pointer to constant float complex array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_FLOAT_COMPLEX, a CPL_ERROR_TYPE_MISMATCH is set.

See documentation of function cpl_array_get_data_int_const().

const float* cpl_array_get_data_float_const ( const cpl_array *  array)

Get a pointer to constant float array data.

Parameters
arrayConstant array to get the data from.
Returns
Pointer to constant float array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_FLOAT, a CPL_ERROR_TYPE_MISMATCH is set.

See documentation of function cpl_array_get_data_int_const().

int* cpl_array_get_data_int ( cpl_array *  array)

Get a pointer to integer array data.

Parameters
arrayArray to get the data from.
Returns
Pointer to integer array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_INT, a CPL_ERROR_TYPE_MISMATCH is set.

Note
Use at your own risk: direct manipulation of array data rules out any check performed by the array object interface, and may introduce inconsistencies between the array information maintained internally and the actual array data.
const int* cpl_array_get_data_int_const ( const cpl_array *  array)

Get a pointer to constant integer array data.

Parameters
arrayConstant array to get the data from.
Returns
Pointer to constant integer array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_INT, a CPL_ERROR_TYPE_MISMATCH is set.

long* cpl_array_get_data_long ( cpl_array *  array)

Get a pointer to long integer array data.

Parameters
arrayArray to get the data from.
Returns
Pointer to long integer array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_LONG, a CPL_ERROR_TYPE_MISMATCH is set.

Note
Use at your own risk: direct manipulation of array data rules out any check performed by the array object interface, and may introduce inconsistencies between the array information maintained internally and the actual array data.
const long* cpl_array_get_data_long_const ( const cpl_array *  array)

Get a pointer to constant long integer array data.

Parameters
arrayConstant array to get the data from.
Returns
Pointer to constant long integer array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_LONG, a CPL_ERROR_TYPE_MISMATCH is set.

long long* cpl_array_get_data_long_long ( cpl_array *  array)

Get a pointer to long long integer array data.

Parameters
arrayArray to get the data from.
Returns
Pointer to long long integer array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_LONG_LONG, a CPL_ERROR_TYPE_MISMATCH is set.

Note
Use at your own risk: direct manipulation of array data rules out any check performed by the array object interface, and may introduce inconsistencies between the array information maintained internally and the actual array data.
const long long* cpl_array_get_data_long_long_const ( const cpl_array *  array)

Get a pointer to constant long long integer array data.

Parameters
arrayConstant array to get the data from.
Returns
Pointer to constant long long integer array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_LONG_LONG, a CPL_ERROR_TYPE_MISMATCH is set.

char** cpl_array_get_data_string ( cpl_array *  array)

Get a pointer to string array data.

Parameters
arrayArray to get the data from.
Returns
Pointer to string array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_STRING, a CPL_ERROR_TYPE_MISMATCH is set.

See documentation of function cpl_array_get_data_int().

const char** cpl_array_get_data_string_const ( const cpl_array *  array)

Get a pointer to constant string array data.

Parameters
arrayConstant array to get the data from.
Returns
Pointer to constant string array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.

If the array is not of type CPL_TYPE_STRING, a CPL_ERROR_TYPE_MISMATCH is set.

See documentation of function cpl_array_get_data_int().

double cpl_array_get_double ( const cpl_array *  array,
cpl_size  indx,
int *  null 
)

Read a value from a double array.

Parameters
arrayArray to be accessed.
indxPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Array value read. In case of an invalid array element, or in case of error, 0.0 is returned.

Read a value from an array of type CPL_TYPE_DOUBLE. See the documentation of the function cpl_array_get_int().

double complex cpl_array_get_double_complex ( const cpl_array *  array,
cpl_size  indx,
int *  null 
)

Read a value from a double complex array.

Parameters
arrayArray to be accessed.
indxPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Array value read. In case of an invalid array element, or in case of error, 0.0 is returned.

Read a value from an array of type CPL_TYPE_DOUBLE_COMPLEX. See the documentation of the function cpl_array_get_int().

float cpl_array_get_float ( const cpl_array *  array,
cpl_size  indx,
int *  null 
)

Read a value from a float array.

Parameters
arrayArray to be accessed.
indxPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Array value read. In case of an invalid array element, or in case of error, 0.0 is returned.

Read a value from an array of type CPL_TYPE_FLOAT. See the documentation of the function cpl_array_get_int().

float complex cpl_array_get_float_complex ( const cpl_array *  array,
cpl_size  indx,
int *  null 
)

Read a value from a float complex array.

Parameters
arrayArray to be accessed.
indxPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Array value read. In case of an invalid array element, or in case of error, 0.0 is returned.

Read a value from an array of type CPL_TYPE_FLOAT_COMPLEX. See the documentation of the function cpl_array_get_int().

int cpl_array_get_int ( const cpl_array *  array,
cpl_size  indx,
int *  null 
)

Read a value from an integer array.

Parameters
arrayArray to be accessed.
indxPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Integer value read. In case of an invalid array element, or in case of error, 0 is returned.

Read a value from an array of type CPL_TYPE_INT. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is set. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is set. Indexes are counted starting from 0. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the null flag is a valid pointer, it is used to indicate whether the accessed array element is valid (0) or invalid (1). The null flag also signals an error condition (-1).

long cpl_array_get_long ( const cpl_array *  array,
cpl_size  indx,
int *  null 
)

Read a value from a long integer array.

Parameters
arrayArray to be accessed.
indxPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Long integer value read. In case of an invalid array element, or in case of error, 0 is returned.

Read a value from an array of type CPL_TYPE_LONG. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is set. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is set. Indexes are counted starting from 0. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the null flag is a valid pointer, it is used to indicate whether the accessed array element is valid (0) or invalid (1). The null flag also signals an error condition (-1).

long long cpl_array_get_long_long ( const cpl_array *  array,
cpl_size  indx,
int *  null 
)

Read a value from a long long integer array.

Parameters
arrayArray to be accessed.
indxPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Long long integer value read. In case of an invalid array element, or in case of error, 0 is returned.

Read a value from an array of type CPL_TYPE_LONG_LONG. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is set. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is set. Indexes are counted starting from 0. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the null flag is a valid pointer, it is used to indicate whether the accessed array element is valid (0) or invalid (1). The null flag also signals an error condition (-1).

double cpl_array_get_max ( const cpl_array *  array)

Get maximum value in a numerical array.

Parameters
arrayInput array.
Returns
Maximum value. In case of error, this is set to 0.0.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical.
CPL_ERROR_DATA_NOT_FOUND The specified array has either size zero, or all its elements are invalid.

Array elements marked as invalid are excluded from the search. The array must contain at least one valid value. Arrays of strings or complex are not allowed.

cpl_error_code cpl_array_get_maxpos ( const cpl_array *  array,
cpl_size indx 
)

Get position of maximum in a numerical array.

Parameters
arrayPointer to array.
indxReturned position of maximum value.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array or indx is NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical.
CPL_ERROR_DATA_NOT_FOUND The specified array has either size zero, or all its elements are invalid.

Array values marked as invalid are excluded from the search. The indx argument will be assigned the position of the maximum value. Indexes are counted starting from 0. If more than one array element correspond to the max value, the position with the lowest indx is returned. In case of error, indx is set to zero. Arrays of strings or complex are not allowed.

double cpl_array_get_mean ( const cpl_array *  array)

Compute the mean value of a numeric array.

Parameters
arrayInput array.
Returns
Mean value. In case of error, this is set to 0.0.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical.
CPL_ERROR_DATA_NOT_FOUND The specified array has either size zero, or all its elements are invalid.

Array elements marked as invalid are excluded from the computation. The array must contain at least one valid value. Arrays of strings or complex are not allowed.

double complex cpl_array_get_mean_complex ( const cpl_array *  array)

Compute the mean value of a complex array.

Parameters
arrayInput array.
Returns
Mean value. In case of error, this is set to 0.0.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not complex.
CPL_ERROR_DATA_NOT_FOUND The specified array has either size zero, or all its elements are invalid.

Array elements marked as invalid are excluded from the computation. The array must contain at least one valid value. Arrays of strings or numerical are not allowed.

double cpl_array_get_median ( const cpl_array *  array)

Compute the median of a numeric array.

Parameters
arrayInput array.
Returns
Median. In case of error, this is set to 0.0.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical.
CPL_ERROR_DATA_NOT_FOUND The specified array has either size zero, or all its elements are invalid.

Array elements marked as invalid are excluded from the computation. The array must contain at least one valid value. Arrays of strings or complex are not allowed.

double cpl_array_get_min ( const cpl_array *  array)

Get minimum value in a numerical array.

Parameters
arrayInput array.
Returns
Minimum value. In case of error, this is set to 0.0.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical.
CPL_ERROR_DATA_NOT_FOUND The specified array has either size zero, or all its elements are invalid.

Array elements marked as invalid are excluded from the search. The array must contain at least one valid value. Arrays of strings or complex are not allowed.

cpl_error_code cpl_array_get_minpos ( const cpl_array *  array,
cpl_size indx 
)

Get position of minimum in a numerical array.

Parameters
arrayPointer to array.
indxReturned position of minimum value.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array or indx is NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical.
CPL_ERROR_DATA_NOT_FOUND The specified array has either size zero, or all its elements are invalid.

Array values marked as invalid are excluded from the search. The indx argument will be assigned the position of the minimum value. Indexes are counted starting from 0. If more than one array element correspond to the min value, the position with the lowest indx is returned. In case of error, indx is set to zero. Arrays of strings or complex are not allowed.

cpl_size cpl_array_get_size ( const cpl_array *  array)

Get the length of an array.

Parameters
arrayInput array.
Returns
Length of array, or zero. The latter case can occur either with an array having zero length, or if a NULL array is passed to the function, but in the latter case a CPL_ERROR_NULL_INPUT is set.

If the array is NULL, zero is returned.

double cpl_array_get_stdev ( const cpl_array *  array)

Compute the standard deviation of a numeric array.

Parameters
arrayInput array.
Returns
Standard deviation. In case of error, this is set to 0.0.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical.
CPL_ERROR_DATA_NOT_FOUND The specified array has either size zero, or all its elements are invalid.

Array elements marked as invalid are excluded from the computation. The array must contain at least one valid value. Arrays of strings or complex are not allowed.

const char* cpl_array_get_string ( const cpl_array *  array,
cpl_size  indx 
)

Read a value from a string array.

Parameters
arrayArray to be accessed.
indxPosition of element to be read.
Returns
Character string read. In case of an invalid array element, or in case of error, a NULL pointer is returned.

Read a value from an array of type CPL_TYPE_STRING. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is set. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is set. Indexes are counted starting from 0. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always set.

Note
The returned string is a pointer to an array element, not its copy. Its manipulation will directly affect that array element, while changing that array element using cpl_array_set_string() will turn it into garbage. Therefore, if a real copy of a string array element is required, this function should be called as an argument of the function strdup().
cpl_type cpl_array_get_type ( const cpl_array *  array)

Get the type of an array.

Parameters
arrayInput array
Returns
Type of array, or CPL_TYPE_INVALID if a NULL array is passed to the function.

If the array is NULL, CPL_ERROR_NULL_INPUT is set.

int cpl_array_has_invalid ( const cpl_array *  array)

Check if an array contains at least one invalid element.

Parameters
arrayArray to inquire.
Returns
1 if the array contains at least one invalid element, 0 if not, -1 in case of error.

Check if there are invalid elements in an array. If the input array is a NULL pointer, a CPL_ERROR_NULL_INPUT is set.

int cpl_array_has_valid ( const cpl_array *  array)

Check if an array contains at least one valid value.

Parameters
arrayArray to inquire.
Returns
1 if the array contains at least one valid value, 0 if not -1 in case of error.

Check if there are valid values in an array. If the input array is a NULL pointer, a CPL_ERROR_NULL_INPUT is set.

cpl_error_code cpl_array_insert ( cpl_array *  target_array,
const cpl_array *  insert_array,
cpl_size  start 
)

Merge two arrays.

Parameters
target_arrayTarget array.
insert_arrayArray to be inserted in the target array.
startElement where to insert the insert array.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any input array is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE start is negative.
CPL_ERROR_TYPE_MISMATCH The input arrays do not have the same type.

The input arrays must have the same type. Data from the insert_array are duplicated and inserted at the specified position of the target_array. If the specified start is not less than the target array length, the second array will be appended to the target array. The pointers to array data in the target array may change, therefore pointers previously retrieved by calling cpl_array_get_data_int(), cpl_array_get_data_string(), etc., should be discarded.

cpl_error_code cpl_array_insert_window ( cpl_array *  array,
cpl_size  start,
cpl_size  count 
)

Insert a segment of new elements into array.

Parameters
arrayInput array
startElement where to insert the segment.
countLength of the segment.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT array is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE start is negative.
CPL_ERROR_ILLEGAL_INPUT count is negative.

Insert a segment of empty (invalid) elements. Setting start to a number greater than the array length is legal, and has the effect of appending extra elements at the end of the array: this is equivalent to expanding the array using cpl_array_set_size(). The input array may also have zero length. The pointers to array data values may change, therefore pointers previously retrieved by calling cpl_array_get_data_int(), cpl_array_get_data_string(), etc., should be discarded.

int cpl_array_is_valid ( const cpl_array *  array,
cpl_size  indx 
)

Check if an array element is valid.

Parameters
arrayPointer to array.
indxArray element to examine.
Returns
1 if the array element is valid, 0 if invalid, -1 in case of error.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input array has zero length, or indx is outside the array boundaries.

Check if an array element is valid.

cpl_error_code cpl_array_logarithm ( cpl_array *  array,
double  base 
)

Compute the logarithm of array elements.

Parameters
arrayPointer to array.
baseLogarithm base.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is NULL pointer.
CPL_ERROR_INVALID_TYPE The specified array is not numerical or complex.
CPL_ERROR_ILLEGAL_INPUT The input base is not positive.

Each array element is replaced by its logarithm in the specified base. The operation is always performed in double precision, with a final cast of the result to the array type. Invalid elements are not modified by this operation, but zero or negative elements are invalidated by this operation. In case of complex numbers, values very close to the origin may cause an overflow.

cpl_error_code cpl_array_multiply ( cpl_array *  to_array,
const cpl_array *  from_array 
)

Multiply the values of two numeric or complex arrays.

Parameters
to_arrayTarget array.
from_arraySource array.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any input array is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT The input arrays have different sizes.
CPL_ERROR_INVALID_TYPE Any specified array is not numerical.

The arrays are multiplied element by element, and the result is stored in the target array. See the documentation of the function cpl_array_add() for further details.

cpl_error_code cpl_array_multiply_scalar ( cpl_array *  array,
double  value 
)

Multiply a numerical array by a constant value.

Parameters
arrayTarget array
valueFactor.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The input array is not numerical.

The operation is always performed in double precision, with a final cast of the result to the target array type. Invalid elements are are not modified by this operation.

cpl_error_code cpl_array_multiply_scalar_complex ( cpl_array *  array,
double complex  value 
)

Multiply a complex array by a constant complex value.

Parameters
arrayTarget array
valueFactor.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The input array is not complex.

The operation is always performed in double precision, with a final cast of the result to the target array type. Invalid elements are are not modified by this operation.

cpl_array* cpl_array_new ( cpl_size  length,
cpl_type  type 
)

Create a new array of given type.

Parameters
lengthNumber of elements in array.
typeType of array
Returns
Pointer to the new array, or NULL in case of error.

This function allocates memory for an array, its type is assigned, and its number of elements is allocated. Only arrays of types CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT_COMPLEX, CPL_TYPE_DOUBLE_COMPLEX and CPL_TYPE_STRING, are supported. An error CPL_ERROR_INVALID_TYPE is set in case other types are specified. All array elements are initially flagged as invalid. If a negative length is specified, an error CPL_ERROR_ILLEGAL_INPUT is set. Zero length arrays are allowed.

cpl_error_code cpl_array_power ( cpl_array *  array,
double  exponent 
)

Compute the power of array elements.

Parameters
arrayPointer to array.
exponentConstant exponent.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is NULL.
CPL_ERROR_INVALID_TYPE The array is not numerical or complex.

Each array element is replaced by its power to the specified exponent. The operation is always performed in double precision, with a final cast of the result to the array type. Invalid elements are not modified by this operation, but elements are invalidated at any illegal operation: if the specified exponent is not negative, all array elements must be not negative, and if the specified exponent is negative, all array elements must be positive; array elements not fulfilling this condition will be invalidated. Only in case of complex arrays this operation becomes legal. If the exponent is 0.0, then any (valid) array element would be assigned the value 1.0.

cpl_error_code cpl_array_set ( cpl_array *  array,
cpl_size  indx,
double  value 
)

Write a value to a numerical array element.

Parameters
arrayArray to be accessed.
indxPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of numerical type, a CPL_ERROR_INVALID_TYPE is returned. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Write a value to a numerical array element. The value is cast to the accessed array type. The written value is automatically flagged as valid. To invalidate an array value use cpl_array_set_invalid(). Array elements are counted starting from 0.

cpl_error_code cpl_array_set_complex ( cpl_array *  array,
cpl_size  indx,
double complex  value 
)

Write a value to a complex array element.

Parameters
arrayArray to be accessed.
indxPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of numerical type, a CPL_ERROR_INVALID_TYPE is returned. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Write a value to a numerical array element. The value is cast to the accessed array type. The written value is automatically flagged as valid. To invalidate an array value use cpl_array_set_invalid(). Array elements are counted starting from 0.

cpl_error_code cpl_array_set_cplsize ( cpl_array *  array,
cpl_size  indx,
cpl_size  value 
)

Write a value to a cpl_size array element.

Parameters
arrayArray to be accessed.
indxPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Write a value to a cpl_size array element. The written value is automatically flagged as valid. To invalidate an array value use cpl_array_set_invalid(). Array elements are counted starting from 0.

cpl_error_code cpl_array_set_double ( cpl_array *  array,
cpl_size  indx,
double  value 
)

Write a value to a double array element.

Parameters
arrayArray to be accessed.
indxPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Write a value to a double array element. The written value is automatically flagged as valid. To invalidate an array value use cpl_array_set_invalid(). Array elements are counted starting from 0.

cpl_error_code cpl_array_set_double_complex ( cpl_array *  array,
cpl_size  indx,
double complex  value 
)

Write a value to a double complex array element.

Parameters
arrayArray to be accessed.
indxPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Write a value to a double array element. The written value is automatically flagged as valid. To invalidate an array value use cpl_array_set_invalid(). Array elements are counted starting from 0.

cpl_error_code cpl_array_set_float ( cpl_array *  array,
cpl_size  indx,
float  value 
)

Write a value to a float array element.

Parameters
arrayArray to be accessed.
indxPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Write a value to a float array element. The written value is automatically flagged as valid. To invalidate an array value use cpl_array_set_invalid(). Array elements are counted starting from 0.

cpl_error_code cpl_array_set_float_complex ( cpl_array *  array,
cpl_size  indx,
float complex  value 
)

Write a value to a float complex array element.

Parameters
arrayArray to be accessed.
indxPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Write a value to a float complex array element. The written value is automatically flagged as valid. To invalidate an array value use cpl_array_set_invalid(). Array elements are counted starting from 0.

cpl_error_code cpl_array_set_int ( cpl_array *  array,
cpl_size  indx,
int  value 
)

Write a value to an integer array element.

Parameters
arrayArray to be accessed.
indxPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Write a value to an integer array element. The written value is automatically flagged as valid. To invalidate an array value use cpl_array_set_invalid(). Array elements are counted starting from 0.

cpl_error_code cpl_array_set_invalid ( cpl_array *  array,
cpl_size  indx 
)

Invalidate an array element.

Parameters
arrayArray to be accessed
indxPosition of element to invalidate
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is set. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always set.

In the case of a string array, the string is set free and its pointer is set to NULL; for other data types, the corresponding element of the null flags buffer is flagged. Array elements are counted starting from zero.

cpl_error_code cpl_array_set_long ( cpl_array *  array,
cpl_size  indx,
long  value 
)

Write a value to a long integer array element.

Parameters
arrayArray to be accessed.
indxPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Write a value to a long integer array element. The written value is automatically flagged as valid. To invalidate an array value use cpl_array_set_invalid(). Array elements are counted starting from 0.

cpl_error_code cpl_array_set_long_long ( cpl_array *  array,
cpl_size  indx,
long long  value 
)

Write a value to a long long integer array element.

Parameters
arrayArray to be accessed.
indxPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Write a value to a long long integer array element. The written value is automatically flagged as valid. To invalidate an array value use cpl_array_set_invalid(). Array elements are counted starting from 0.

cpl_error_code cpl_array_set_size ( cpl_array *  array,
cpl_size  new_length 
)

Resize an array.

Parameters
arrayInput array.
new_lengthNew number of elements in array.
Returns
CPL_ERROR_NONE on success. The new array size must not be negative, or a CPL_ERROR_ILLEGAL_INPUT is returned. The input array pointer should not be NULL, or a CPL_ERROR_NULL_INPUT is returned.

Reallocate an array to a new number of elements. The contents of the array data buffer will be unchanged up to the lesser of the new and old sizes. If the array size is increased, the new array elements are flagged as invalid. The pointer to data may change, therefore pointers previously retrieved by calling cpl_array_get_data_int(), cpl_array_get_data_string(), etc. should be discarded). Resizing to zero is allowed, and would produce a zero-length array. In case of failure, the old data buffer is left intact.

If the array is NULL, zero is returned.

cpl_error_code cpl_array_set_string ( cpl_array *  array,
cpl_size  indx,
const char *  string 
)

Write a character string to a string array element.

Parameters
arrayArray to be accessed.
indxPosition where to write character string.
stringCharacter string to write.
Returns
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.

Copy a character string to a string array element. The written value can also be a NULL pointer. Note that the input character string is copied, therefore the original can be modified without affecting the column content. To "plug" a character string directly into an array element, use the function cpl_array_get_data_string(). Array elements are counted starting from zero.

cpl_error_code cpl_array_subtract ( cpl_array *  to_array,
const cpl_array *  from_array 
)

Subtract the values of two numeric or complex arrays.

Parameters
to_arrayTarget array.
from_arraySource array.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any input array is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT The input arrays have different sizes.
CPL_ERROR_INVALID_TYPE Any specified array is not numerical.

The arrays are subtracted element by element, and the result is stored in the target array. See the documentation of the function cpl_array_add() for further details.

cpl_error_code cpl_array_subtract_scalar ( cpl_array *  array,
double  value 
)

Subtract a constant value from a numerical array.

Parameters
arrayTarget array
valueValue to subtract.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The input array is not numerical.

The operation is always performed in double precision, with a final cast of the result to the target array type. Invalid elements are are not modified by this operation.

cpl_error_code cpl_array_subtract_scalar_complex ( cpl_array *  array,
double complex  value 
)

Subtract a constant complex value from a complex array.

Parameters
arrayTarget array
valueValue to subtract.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input array is a NULL pointer.
CPL_ERROR_INVALID_TYPE The input array is not complex.

The operation is always performed in double precision, with a final cast of the result to the target array type. Invalid elements are are not modified by this operation.

void* cpl_array_unwrap ( cpl_array *  array)

Delete an array, without losing the data buffer.

Parameters
arrayArray to be deleted.
Returns
Pointer to the internal data buffer.

This function deletes an array, but its data buffer is not destroyed. Supposedly, the developer knows that the data are static, or the developer holds the pointer to the data obtained with the functions cpl_array_get_data_int(), cpl_array_get_data_float(), etc. If the input array is NULL, nothing is done, and no error is set.

cpl_array* cpl_array_wrap_cplsize ( cpl_size data,
cpl_size  length 
)

Create a new cpl_size array from existing data.

Parameters
dataExisting data buffer.
lengthNumber of elements in array.
Returns
Pointer to the new array, or NULL in case of error.

This function creates a new cpl_size array that will encapsulate the given data. Note that the size of the data buffer is not checked in any way, and that the data values are all considered valid: invalid values should be marked using the functions cpl_array_set_invalid(). The data array is not copied, so it should never be deallocated: to deallocate it, the function cpl_array_delete() should be called instead. Alternatively, the function cpl_array_unwrap() might be used, and the data array deallocated afterwards. A zero or negative length is illegal, and would cause an error CPL_ERROR_ILLEGAL_INPUT to be set. An input NULL pointer would set an error CPL_ERROR_NULL_INPUT.

Note
Functions that handle arrays assume that an array data buffer is dynamically allocated: with a statically allocated data buffer any function implying memory handling (cpl_array_set_size(), cpl_array_delete(), etc.) would crash the program. This means that a static data buffer should never be passed to this function if memory handling is planned. In case of a static data buffer, only the cpl_array_unwrap() destructor can be used.
cpl_array* cpl_array_wrap_double ( double *  data,
cpl_size  length 
)

Create a new double array from existing data.

Parameters
dataExisting data buffer.
lengthNumber of elements in array.
Returns
Pointer to the new array, or NULL in case of error.

See documentation of function cpl_array_wrap_int().

cpl_array* cpl_array_wrap_double_complex ( double complex *  data,
cpl_size  length 
)

Create a new double complex array from existing data.

Parameters
dataExisting data buffer.
lengthNumber of elements in array.
Returns
Pointer to the new array, or NULL in case of error.

See documentation of function cpl_array_wrap_int().

cpl_array* cpl_array_wrap_float ( float *  data,
cpl_size  length 
)

Create a new float array from existing data.

Parameters
dataExisting data buffer.
lengthNumber of elements in array.
Returns
Pointer to the new array, or NULL in case of error.

See documentation of function cpl_array_wrap_int().

cpl_array* cpl_array_wrap_float_complex ( float complex *  data,
cpl_size  length 
)

Create a new float complex array from existing data.

Parameters
dataExisting data buffer.
lengthNumber of elements in array.
Returns
Pointer to the new array, or NULL in case of error.

See documentation of function cpl_array_wrap_int().

cpl_array* cpl_array_wrap_int ( int *  data,
cpl_size  length 
)

Create a new integer array from existing data.

Parameters
dataExisting data buffer.
lengthNumber of elements in array.
Returns
Pointer to the new array, or NULL in case of error.

This function creates a new integer array that will encapsulate the given data. Note that the size of the data buffer is not checked in any way, and that the data values are all considered valid: invalid values should be marked using the functions cpl_array_set_invalid() The data array is not copied, so it should never be deallocated: to deallocate it, the function cpl_array_delete() should be called instead. Alternatively, the function cpl_array_unwrap() might be used, and the data array deallocated afterwards. A zero or negative length is illegal, and would cause an error CPL_ERROR_ILLEGAL_INPUT to be set. An input NULL pointer would set an error CPL_ERROR_NULL_INPUT.

Note
Functions that handle arrays assume that an array data buffer is dynamically allocated: with a statically allocated data buffer any function implying memory handling (cpl_array_set_size(), cpl_array_delete(), etc.) would crash the program. This means that a static data buffer should never be passed to this function if memory handling is planned. In case of a static data buffer, only the cpl_array_unwrap() destructor can be used.
cpl_array* cpl_array_wrap_long ( long *  data,
cpl_size  length 
)

Create a new long integer array from existing data.

Parameters
dataExisting data buffer.
lengthNumber of elements in array.
Returns
Pointer to the new array, or NULL in case of error.

This function creates a new long integer array that will encapsulate the given data. Note that the size of the data buffer is not checked in any way, and that the data values are all considered valid: invalid values should be marked using the functions cpl_array_set_invalid() The data array is not copied, so it should never be deallocated: to deallocate it, the function cpl_array_delete() should be called instead. Alternatively, the function cpl_array_unwrap() might be used, and the data array deallocated afterwards. A zero or negative length is illegal, and would cause an error CPL_ERROR_ILLEGAL_INPUT to be set. An input NULL pointer would set an error CPL_ERROR_NULL_INPUT.

Note
Functions that handle arrays assume that an array data buffer is dynamically allocated: with a statically allocated data buffer any function implying memory handling (cpl_array_set_size(), cpl_array_delete(), etc.) would crash the program. This means that a static data buffer should never be passed to this function if memory handling is planned. In case of a static data buffer, only the cpl_array_unwrap() destructor can be used.
cpl_array* cpl_array_wrap_long_long ( long long *  data,
cpl_size  length 
)

Create a new long long integer array from existing data.

Parameters
dataExisting data buffer.
lengthNumber of elements in array.
Returns
Pointer to the new array, or NULL in case of error.

This function creates a new long long integer array that will encapsulate the given data. Note that the size of the data buffer is not checked in any way, and that the data values are all considered valid: invalid values should be marked using the functions cpl_array_set_invalid() The data array is not copied, so it should never be deallocated: to deallocate it, the function cpl_array_delete() should be called instead. Alternatively, the function cpl_array_unwrap() might be used, and the data array deallocated afterwards. A zero or negative length is illegal, and would cause an error CPL_ERROR_ILLEGAL_INPUT to be set. An input NULL pointer would set an error CPL_ERROR_NULL_INPUT.

Note
Functions that handle arrays assume that an array data buffer is dynamically allocated: with a statically allocated data buffer any function implying memory handling (cpl_array_set_size(), cpl_array_delete(), etc.) would crash the program. This means that a static data buffer should never be passed to this function if memory handling is planned. In case of a static data buffer, only the cpl_array_unwrap() destructor can be used.
cpl_array* cpl_array_wrap_string ( char **  data,
cpl_size  length 
)

Create a new character string array from existing data.

Parameters
dataExisting data buffer.
lengthNumber of elements in array.
Returns
Pointer to the new array, or NULL in case of error.

See documentation of function cpl_array_wrap_int().

cpl-6.4.1/html/dir_0893a83ae506d6342ff4de074eaf5145.html0000644000460300003120000000612212310333015016174 00000000000000 Common Pipeline Library Reference Manual: cpldfs Directory Reference
Common Pipeline Library Reference Manual  6.4.1
cpldfs Directory Reference

Files

file  cpl_dfs.c
 
file  cpl_dfs.h
 
file  md5.c
 
file  md5.h
 
cpl-6.4.1/html/group__cpl__recipe.html0000644000460300003120000001141212310333015014651 00000000000000 Common Pipeline Library Reference Manual: Recipes
Common Pipeline Library Reference Manual  6.4.1
Recipes

Recipe plugin interface definition. More...

Classes

struct  _cpl_recipe_
 The type representation of the recipe plugin interface. More...
 

Typedefs

typedef struct _cpl_recipe_ cpl_recipe
 The recipe plugin data type.
 

Detailed Description

Recipe plugin interface definition.

This defines the interface in order to implement recipes as Pluggable Data Reduction Modules (PDRMs). It extends the generic plugin interface with a parameter list and a frame set containing the recipe's setup information (parameters to run with) and the data frames to process.

This interface is constructed in such a way, that a pointer to an object of type cpl_recipe can be cast into a pointer to cpl_plugin (see Plugin Interface).

Synopsis:
#include <cpl_recipe.h>

Typedef Documentation

typedef struct _cpl_recipe_ cpl_recipe

The recipe plugin data type.

cpl-6.4.1/html/form_4.png0000644000460300003120000000033712310333016012045 00000000000000‰PNG  IHDR ŠœÖ0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïNIDATxíí À DÑÊÇþÛ¶š‚iÿt.ywy;ü~W#:¥d¡c'{½Ã0ðð)IÎh­¯Î{_:ÙK¯ÞÃVG$ „²î ™ÄÄÕObIEND®B`‚cpl-6.4.1/html/tabs.css0000644000460300003120000000221312310333014011605 00000000000000.tabs, .tabs2, .tabs3 { background-image: url('tab_b.png'); width: 100%; z-index: 101; font-size: 13px; font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; } .tabs2 { font-size: 10px; } .tabs3 { font-size: 9px; } .tablist { margin: 0; padding: 0; display: table; } .tablist li { float: left; display: table-cell; background-image: url('tab_b.png'); line-height: 36px; list-style: none; } .tablist a { display: block; padding: 0 20px; font-weight: bold; background-image:url('tab_s.png'); background-repeat:no-repeat; background-position:right; color: #283A5D; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); text-decoration: none; outline: none; } .tabs3 .tablist a { padding: 0 10px; } .tablist a:hover { background-image: url('tab_h.png'); background-repeat:repeat-x; color: #fff; text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); text-decoration: none; } .tablist li.current a { background-image: url('tab_a.png'); background-repeat:repeat-x; color: #fff; text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); } cpl-6.4.1/html/ftv2doc.png0000644000460300003120000000135212310333014012222 00000000000000‰PNG  IHDRÚ}\ˆ±IDATxíMOS[…Ÿžsúa?-XZ(PD4‚ AWbu`b 77wäHFÆCËÔÂÿà/`vo„ˆAPòq‹P @ ­ûÝè980 îà¤+»§Ýy×^ïZï9SW¹\83g‰3'°Nâçl¹¸_b¯p ïåûÆVÜÖ¡€Ÿ×"¬Ö†X€d]Ðà3“ÉÃÄÌ™xŸ ßMàœ[<çSPkvc—hÈ'…™˜^Åm™hØ7 `Û™¦ èÀåráq›‘œ¾!daeKŸþÆÕ˜:Ì*³_דâèi?I–eP*B7Ÿ¿åô!¹Ýgr6Ër6oKbëþãðôrI”ËTˆüªŒ¨xóö=›ù¢&‰(e+ßóÄkýÇ`ëÁÜb.“¸ÐW×w0¥°jÑzN™¬|©WEãµ¢a¯6[öX†AkÓù*/œ¨‰€ÉY­ ÿV’§–u²jÂ>1W *½·°PGŽzÿ¨/Eg{ ŸÇâaoŠÁVú:è¿™¤1$ôR§W,–ªà¨@ŠË56¾ÀÔÜ-¾,mê¸Î/æè¹– òr5¥T*S(Vf8ö9u’ Õ£w›ùóa=Í<{Ò¡UŒ÷r¯+ÉådDÏF$è°…£é¿`zþ»ÎúöN‘µÜ®0Q3£~_^Ëóâ¯N=ˆvpTà±LžT}ˆîkq†Òm<¼ÎÓ?Zh¿X£ï_þÝ¥[)ƒ `gêÃa_Ô*äÔ2`'=õ´Fÿ2EâÁPú ÷»›l=8‹Wv°%THqÉ¿<"¤ïG¾ÆxH{#ÆÖ«aÔJÕÞ‡—m‹„ çñKsÿàñVŠØ¡°·MâÒ^ TÁ– Ý›r¥ß½ømüÿ_™?ªWİ÷#uIEND®B`‚cpl-6.4.1/html/group__cpl__version.html0000644000460300003120000002743012310333015015076 00000000000000 Common Pipeline Library Reference Manual: Library Version Information
Common Pipeline Library Reference Manual  6.4.1
Library Version Information

Functions

unsigned int cpl_version_get_binary_age (void)
 Get the library's binary age.
 
unsigned int cpl_version_get_binary_version (void)
 Get the library's binary version number.
 
unsigned int cpl_version_get_interface_age (void)
 Get the library's interface age.
 
unsigned int cpl_version_get_major (void)
 Get the library's major version number.
 
unsigned int cpl_version_get_micro (void)
 Get the library's micro version number.
 
unsigned int cpl_version_get_minor (void)
 Get the library's minor version number.
 
const char * cpl_version_get_version (void)
 Get the library's version string.
 

Detailed Description

This module provides functions to access the library's version information.

The library version applies to all component libraries of the Common pipeline library, and changes if any of the component libraries changes.

The library version is a version code made up of three components, the major, minor and micro version number, and is usually represented by a string of the form "major.minor.micro".

Synopsis:
#include <cpl_version.h>

Function Documentation

unsigned int cpl_version_get_binary_age ( void  )

Get the library's binary age.

Returns
The function returns the library's binary age.

The function returns the binary age of the library.

unsigned int cpl_version_get_binary_version ( void  )

Get the library's binary version number.

Returns
The function returns the library's version number.

The function returns the version number of the library encoded as a single integer number.

unsigned int cpl_version_get_interface_age ( void  )

Get the library's interface age.

Returns
The function returns the library's interface age.

The function returns the interface age of the library.

unsigned int cpl_version_get_major ( void  )

Get the library's major version number.

Returns
The function returns the library's major version number.

The function returns the major version number of the library.

unsigned int cpl_version_get_micro ( void  )

Get the library's micro version number.

Returns
The function returns the library's micro version number.

The function returns the micro version number of the library.

unsigned int cpl_version_get_minor ( void  )

Get the library's minor version number.

Returns
The function returns the library's minor version number.

The function returns the minor version number of the library.

const char* cpl_version_get_version ( void  )

Get the library's version string.

Returns
The function returns the library's version string.

The function returns the package version of the library as a string. The returned version string is composed of the major, minor and, possibly, the micro version of the library separated by dots. The micro version may not be there if it is 0.

cpl-6.4.1/html/struct__cpl__plugin__-members.html0000644000460300003120000001217612310333015017026 00000000000000 Common Pipeline Library Reference Manual: Member List
Common Pipeline Library Reference Manual  6.4.1
_cpl_plugin_ Member List
cpl-6.4.1/html/group__cpl__math.html0000644000460300003120000010644112310333014014341 00000000000000 Common Pipeline Library Reference Manual: Fundamental math functionality
Common Pipeline Library Reference Manual  6.4.1
Fundamental math functionality

Macros

#define CPL_MATH_1_PI   0.3183098861837906715377675267450287240689192914809129
 1/pi
 
#define CPL_MATH_2_PI   0.6366197723675813430755350534900574481378385829618258
 2/pi
 
#define CPL_MATH_2_SQRTPI   1.1283791670955125738961589031215451716881012586579977
 2/sqrt(pi)
 
#define CPL_MATH_2PI   6.2831853071795864769252867665590057683943387987502116
 2 pi
 
#define CPL_MATH_4_PI   1.2732395447351626861510701069801148962756771659236516
 4/pi
 
#define CPL_MATH_DEG_RAD   57.295779513082320876798154814105170332405472466564322
 180/pi
 
#define CPL_MATH_E   2.7182818284590452353602874713526624977572470936999595
 The base of the exponential function.
 
#define CPL_MATH_FWHM_SIG   2.3548200450309493820231386529193992754947713787716411
 FWHM per Sigma, 2.0*sqrt(2.0*log(2.0))
 
#define CPL_MATH_LN10   2.3025850929940456840179914546843642076011014886287730
 The natural logarithm of 10.
 
#define CPL_MATH_LN2   0.6931471805599453094172321214581765680755001343602553
 The natural logarithm of 2.
 
#define CPL_MATH_LOG10E   0.4342944819032518276511289189166050822943970058036666
 log10(e)
 
#define CPL_MATH_LOG2E   1.4426950408889634073599246810018921374266459541529859
 log2(e)
 
#define CPL_MATH_PI   3.1415926535897932384626433832795028841971693993751058
 The ratio of a circles circumference to its diameter.
 
#define CPL_MATH_PI_2   1.5707963267948966192313216916397514420985846996875529
 pi/2
 
#define CPL_MATH_PI_4   0.7853981633974483096156608458198757210492923498437765
 pi/4
 
#define CPL_MATH_RAD_DEG   0.0174532925199432957692369076848861271344287188854173
 pi/180
 
#define CPL_MATH_SIG_FWHM   0.4246609001440095213607514170514448098575705468921770
 Sigma per FWHM, 0.5/sqrt(2.0*log(2.0))
 
#define CPL_MATH_SQRT1_2   0.7071067811865475244008443621048490392848359376884740
 sqrt(1/2)
 
#define CPL_MATH_SQRT2   1.4142135623730950488016887242096980785696718753769481
 The square root of 2.
 
#define CPL_MATH_SQRT2PI   2.5066282746310005024157652848110452530069867406099383
 sqrt(2pi)
 
#define CPL_MATH_SQRT3   1.7320508075688772935274463415058723669428052538103806
 The square root of 3.
 
#define CPL_MATH_STD_MAD   1.4826
 Standard deviation per Median Absolute Deviation for Gaussian data.
 
#define CPL_MAX(first, second)
 Return the maximum of two values.
 
#define CPL_MIN(first, second)
 Return the minimum of two values.
 

Detailed Description

This module provides fundamental math constants.

Source: On-Line Encyclopedia of Integer Sequences (OEIS)

pi: http://www.research.att.com/~njas/sequences/A000796

e: http://www.research.att.com/~njas/sequences/A001113

ln(2): http://www.research.att.com/~njas/sequences/A002162

ln(10): http://www.research.att.com/~njas/sequences/A002392

sqrt(2): http://www.research.att.com/~njas/sequences/A002193

sqrt(3): http://www.research.att.com/~njas/sequences/A002194

The derived constants have been computed with the GNU Multiple-Precision Library v. 4.2.2.

The constants are listed with a precision that allows a one-line definition.

Synopsis:
#include <cpl_math_const.h>

Macro Definition Documentation

#define CPL_MATH_1_PI   0.3183098861837906715377675267450287240689192914809129

1/pi

See Also
CPL_MATH_PI
Note
Derived from a fundamental constant
#define CPL_MATH_2_PI   0.6366197723675813430755350534900574481378385829618258

2/pi

See Also
CPL_MATH_PI
Note
Derived from a fundamental constant
#define CPL_MATH_2_SQRTPI   1.1283791670955125738961589031215451716881012586579977

2/sqrt(pi)

See Also
CPL_MATH_PI
Note
Derived from a fundamental constant
#define CPL_MATH_2PI   6.2831853071795864769252867665590057683943387987502116

2 pi

See Also
CPL_MATH_PI
Note
Derived from a fundamental constant
#define CPL_MATH_4_PI   1.2732395447351626861510701069801148962756771659236516

4/pi

See Also
CPL_MATH_PI
Note
Derived from a fundamental constant
#define CPL_MATH_DEG_RAD   57.295779513082320876798154814105170332405472466564322

180/pi

See Also
CPL_MATH_PI
Note
Derived from a fundamental constant
#define CPL_MATH_E   2.7182818284590452353602874713526624977572470936999595

The base of the exponential function.

See Also
On-Line Encyclopedia of Integer Sequences (OEIS), http://www.research.att.com/~njas/sequences/A001113
#define CPL_MATH_FWHM_SIG   2.3548200450309493820231386529193992754947713787716411

FWHM per Sigma, 2.0*sqrt(2.0*log(2.0))

See Also
CPL_MATH_LN2
Note
Derived from a fundamental constant
#define CPL_MATH_LN10   2.3025850929940456840179914546843642076011014886287730

The natural logarithm of 10.

See Also
On-Line Encyclopedia of Integer Sequences (OEIS), http://www.research.att.com/~njas/sequences/A002392
#define CPL_MATH_LN2   0.6931471805599453094172321214581765680755001343602553

The natural logarithm of 2.

See Also
On-Line Encyclopedia of Integer Sequences (OEIS), http://www.research.att.com/~njas/sequences/A002162
#define CPL_MATH_LOG10E   0.4342944819032518276511289189166050822943970058036666

log10(e)

See Also
CPL_MATH_LN10
Note
Derived from a fundamental constant
#define CPL_MATH_LOG2E   1.4426950408889634073599246810018921374266459541529859

log2(e)

See Also
CPL_MATH_LN2
Note
Derived from a fundamental constant
#define CPL_MATH_PI   3.1415926535897932384626433832795028841971693993751058

The ratio of a circles circumference to its diameter.

See Also
On-Line Encyclopedia of Integer Sequences (OEIS), http://www.research.att.com/~njas/sequences/A000796
#define CPL_MATH_PI_2   1.5707963267948966192313216916397514420985846996875529

pi/2

See Also
CPL_MATH_PI
Note
Derived from a fundamental constant
#define CPL_MATH_PI_4   0.7853981633974483096156608458198757210492923498437765

pi/4

See Also
CPL_MATH_PI
Note
Derived from a fundamental constant
#define CPL_MATH_RAD_DEG   0.0174532925199432957692369076848861271344287188854173

pi/180

See Also
CPL_MATH_PI
Note
Derived from a fundamental constant
#define CPL_MATH_SIG_FWHM   0.4246609001440095213607514170514448098575705468921770

Sigma per FWHM, 0.5/sqrt(2.0*log(2.0))

See Also
CPL_MATH_LN2
Note
Derived from a fundamental constant
#define CPL_MATH_SQRT1_2   0.7071067811865475244008443621048490392848359376884740

sqrt(1/2)

See Also
CPL_MATH_SQRT2
Note
Derived from a fundamental constant
#define CPL_MATH_SQRT2   1.4142135623730950488016887242096980785696718753769481

The square root of 2.

See Also
On-Line Encyclopedia of Integer Sequences (OEIS), http://www.research.att.com/~njas/sequences/A002193
#define CPL_MATH_SQRT2PI   2.5066282746310005024157652848110452530069867406099383

sqrt(2pi)

See Also
CPL_MATH_PI
Note
Derived from a fundamental constant
#define CPL_MATH_SQRT3   1.7320508075688772935274463415058723669428052538103806

The square root of 3.

See Also
On-Line Encyclopedia of Integer Sequences (OEIS), http://www.research.att.com/~njas/sequences/A002194
#define CPL_MATH_STD_MAD   1.4826

Standard deviation per Median Absolute Deviation for Gaussian data.

See Also
cpl_image_get_mad_window()

For a Gaussian distribution the Median Absolute Deviation (MAD) is a robust and consistent estimate of the Standard Deviation (STD) in the sense that the STD is approximately K * MAD, where K is a constant equal to approximately 1.4826.

#define CPL_MAX (   first,
  second 
)

Return the maximum of two values.

Parameters
firstThe first expression in the comparison
secondThe second expression in the comparison
Returns
The maximum of the two values
See Also
CPL_MIN()
#define CPL_MIN (   first,
  second 
)

Return the minimum of two values.

Parameters
firstThe first expression in the comparison
secondThe second expression in the comparison
Returns
The minimum of the two values
Note
If the first argument is the smallest then it is evaluated twice otherwise the second argument is evaluated twice
cpl-6.4.1/html/dir_283883d147ab9a845d7032d17e09a122.html0000644000460300003120000002047612310333015015757 00000000000000 Common Pipeline Library Reference Manual: cpldrs Directory Reference
Common Pipeline Library Reference Manual  6.4.1
cpldrs Directory Reference

Files

file  cpl_apertures.c
 
file  cpl_apertures.h
 
file  cpl_apertures_img.h
 
file  cpl_detector.c
 
file  cpl_detector.h
 
file  cpl_detector_body.h
 
file  cpl_fft.c
 
file  cpl_fft.h
 
file  cpl_fft_body.h
 
file  cpl_fit.c
 
file  cpl_fit.h
 
file  cpl_fit_body.h
 
file  cpl_geom_img.c
 
file  cpl_geom_img.h
 
file  cpl_geom_img_body.h
 
file  cpl_photom.c
 
file  cpl_photom.h
 
file  cpl_phys_const.h
 
file  cpl_ppm.c
 
file  cpl_ppm.h
 
file  cpl_wcs.c
 
file  cpl_wcs.h
 
file  cpl_wlcalib.c
 
file  cpl_wlcalib.h
 
file  cpl_wlcalib_impl.h
 
cpl-6.4.1/html/group__cpl__table.html0000644000460300003120000231323412310333014014501 00000000000000 Common Pipeline Library Reference Manual: Tables
Common Pipeline Library Reference Manual  6.4.1
Tables

Functions

cpl_error_code cpl_table_abs_column (cpl_table *table, const char *name)
 Compute the absolute value of column values.
 
cpl_error_code cpl_table_add_columns (cpl_table *table, const char *to_name, const char *from_name)
 Add the values of two numeric or complex table columns.
 
cpl_error_code cpl_table_add_scalar (cpl_table *table, const char *name, double value)
 Add a constant value to a numerical or complex column.
 
cpl_error_code cpl_table_add_scalar_complex (cpl_table *table, const char *name, double complex value)
 Add a constant complex value to a numerical or complex column.
 
cpl_size cpl_table_and_selected (cpl_table *table, const char *name1, cpl_table_select_operator operator, const char *name2)
 Select from selected table rows, by comparing the values of two numerical columns.
 
cpl_size cpl_table_and_selected_double (cpl_table *table, const char *name, cpl_table_select_operator operator, double value)
 Select from selected table rows, by comparing double column values with a constant.
 
cpl_size cpl_table_and_selected_double_complex (cpl_table *table, const char *name, cpl_table_select_operator operator, double complex value)
 Select from selected table rows, by comparing double complex column values with a complex constant.
 
cpl_size cpl_table_and_selected_float (cpl_table *table, const char *name, cpl_table_select_operator operator, float value)
 Select from selected table rows, by comparing float column values with a constant.
 
cpl_size cpl_table_and_selected_float_complex (cpl_table *table, const char *name, cpl_table_select_operator operator, float complex value)
 Select from selected table rows, by comparing float complex column values with a complex constant.
 
cpl_size cpl_table_and_selected_int (cpl_table *table, const char *name, cpl_table_select_operator operator, int value)
 Select from selected table rows, by comparing integer column values with a constant.
 
cpl_size cpl_table_and_selected_invalid (cpl_table *table, const char *name)
 Select from selected table rows all rows with an invalid value in a specified column.
 
cpl_size cpl_table_and_selected_long (cpl_table *table, const char *name, cpl_table_select_operator operator, long value)
 Select from selected table rows, by comparing long column values with a constant.
 
cpl_size cpl_table_and_selected_long_long (cpl_table *table, const char *name, cpl_table_select_operator operator, long long value)
 Select from selected table rows, by comparing long long column values with a constant.
 
cpl_size cpl_table_and_selected_string (cpl_table *table, const char *name, cpl_table_select_operator operator, const char *string)
 Select from selected table rows, by comparing string column values with a character string.
 
cpl_size cpl_table_and_selected_window (cpl_table *table, cpl_size start, cpl_size count)
 Select from selected rows only those within a table segment.
 
cpl_error_code cpl_table_arg_column (cpl_table *table, const char *name)
 Compute the phase angle value of table column elements.
 
cpl_error_code cpl_table_cast_column (cpl_table *table, const char *from_name, const char *to_name, cpl_type type)
 Cast a numeric or complex column to a new numeric or complex type column.
 
int cpl_table_compare_structure (const cpl_table *table1, const cpl_table *table2)
 Compare the structure of two tables.
 
cpl_error_code cpl_table_conjugate_column (cpl_table *table, const char *name)
 Compute the complex conjugate of column values.
 
cpl_error_code cpl_table_copy_data_double (cpl_table *table, const char *name, const double *data)
 Copy existing data to a table double column.
 
cpl_error_code cpl_table_copy_data_double_complex (cpl_table *table, const char *name, const double complex *data)
 Copy existing data to a table double complex column.
 
cpl_error_code cpl_table_copy_data_float (cpl_table *table, const char *name, const float *data)
 Copy existing data to a table float column.
 
cpl_error_code cpl_table_copy_data_float_complex (cpl_table *table, const char *name, const float complex *data)
 Copy existing data to a table float complex column.
 
cpl_error_code cpl_table_copy_data_int (cpl_table *table, const char *name, const int *data)
 Copy existing data to a table integer column.
 
cpl_error_code cpl_table_copy_data_long (cpl_table *table, const char *name, const long *data)
 Copy existing data to a table long column.
 
cpl_error_code cpl_table_copy_data_long_long (cpl_table *table, const char *name, const long long *data)
 Copy existing data to a table long long column.
 
cpl_error_code cpl_table_copy_data_string (cpl_table *table, const char *name, const char **data)
 Copy existing data to a table string column.
 
cpl_error_code cpl_table_copy_structure (cpl_table *table, const cpl_table *mtable)
 Give to a table the same structure of another table.
 
cpl_size cpl_table_count_invalid (const cpl_table *table, const char *name)
 Count number of invalid values in a table column.
 
cpl_size cpl_table_count_selected (const cpl_table *table)
 Get number of selected rows in given table.
 
void cpl_table_delete (cpl_table *table)
 Delete a table.
 
cpl_error_code cpl_table_divide_columns (cpl_table *table, const char *to_name, const char *from_name)
 Divide two numeric or complex table columns.
 
cpl_error_code cpl_table_divide_scalar (cpl_table *table, const char *name, double value)
 Divide a numerical or complex column by a constant.
 
cpl_error_code cpl_table_divide_scalar_complex (cpl_table *table, const char *name, double complex value)
 Divide a numerical or complex column by a complex constant.
 
void cpl_table_dump (const cpl_table *table, cpl_size start, cpl_size count, FILE *stream)
 Print a table.
 
void cpl_table_dump_structure (const cpl_table *table, FILE *stream)
 Describe the structure and the contents of a table.
 
cpl_table * cpl_table_duplicate (const cpl_table *table)
 Make a copy of a table.
 
cpl_error_code cpl_table_duplicate_column (cpl_table *to_table, const char *to_name, const cpl_table *from_table, const char *from_name)
 Copy a column from a table to another.
 
cpl_error_code cpl_table_erase_column (cpl_table *table, const char *name)
 Delete a column from a table.
 
cpl_error_code cpl_table_erase_invalid (cpl_table *table)
 Remove from a table all columns just containing invalid elements, and then all rows containing at least one invalid element.
 
cpl_error_code cpl_table_erase_invalid_rows (cpl_table *table)
 Remove from a table columns and rows just containing invalid elements.
 
cpl_error_code cpl_table_erase_selected (cpl_table *table)
 Delete the selected rows of a table.
 
cpl_error_code cpl_table_erase_window (cpl_table *table, cpl_size start, cpl_size count)
 Delete a table segment.
 
cpl_error_code cpl_table_exponential_column (cpl_table *table, const char *name, double base)
 Compute the exponential of column values.
 
cpl_table * cpl_table_extract (const cpl_table *table, cpl_size start, cpl_size count)
 Create a table from a section of another table.
 
cpl_table * cpl_table_extract_selected (const cpl_table *table)
 Create a new table from the selected rows of another table.
 
cpl_error_code cpl_table_fill_column_window (cpl_table *table, const char *name, cpl_size start, cpl_size count, double value)
 Write a value to a numerical column segment.
 
cpl_error_code cpl_table_fill_column_window_array (cpl_table *table, const char *name, cpl_size start, cpl_size count, const cpl_array *array)
 Write an array to an array column segment.
 
cpl_error_code cpl_table_fill_column_window_complex (cpl_table *table, const char *name, cpl_size start, cpl_size count, double complex value)
 Write a value to a complex column segment.
 
cpl_error_code cpl_table_fill_column_window_double (cpl_table *table, const char *name, cpl_size start, cpl_size count, double value)
 Write a value to a double column segment.
 
cpl_error_code cpl_table_fill_column_window_double_complex (cpl_table *table, const char *name, cpl_size start, cpl_size count, double complex value)
 Write a value to a double complex column segment.
 
cpl_error_code cpl_table_fill_column_window_float (cpl_table *table, const char *name, cpl_size start, cpl_size count, float value)
 Write a value to a float column segment.
 
cpl_error_code cpl_table_fill_column_window_float_complex (cpl_table *table, const char *name, cpl_size start, cpl_size count, float complex value)
 Write a value to a float complex column segment.
 
cpl_error_code cpl_table_fill_column_window_int (cpl_table *table, const char *name, cpl_size start, cpl_size count, int value)
 Write a value to an integer column segment.
 
cpl_error_code cpl_table_fill_column_window_long (cpl_table *table, const char *name, cpl_size start, cpl_size count, long value)
 Write a value to an long column segment.
 
cpl_error_code cpl_table_fill_column_window_long_long (cpl_table *table, const char *name, cpl_size start, cpl_size count, long long value)
 Write a value to an long long column segment.
 
cpl_error_code cpl_table_fill_column_window_string (cpl_table *table, const char *name, cpl_size start, cpl_size count, const char *value)
 Write a character string to a string column segment.
 
cpl_error_code cpl_table_fill_invalid_double (cpl_table *table, const char *name, double code)
 Write to invalid double column elements a numeric code.
 
cpl_error_code cpl_table_fill_invalid_double_complex (cpl_table *table, const char *name, double complex code)
 Write to invalid double complex column elements a numeric code.
 
cpl_error_code cpl_table_fill_invalid_float (cpl_table *table, const char *name, float code)
 Write to invalid float column elements a numeric code.
 
cpl_error_code cpl_table_fill_invalid_float_complex (cpl_table *table, const char *name, float complex code)
 Write to invalid float complex column elements a numeric code.
 
cpl_error_code cpl_table_fill_invalid_int (cpl_table *table, const char *name, int code)
 Write to invalid integer column elements a numeric code.
 
cpl_error_code cpl_table_fill_invalid_long (cpl_table *table, const char *name, long code)
 Write to invalid long column elements a numeric code.
 
cpl_error_code cpl_table_fill_invalid_long_long (cpl_table *table, const char *name, long long code)
 Write to invalid long long column elements a numeric code.
 
double cpl_table_get (const cpl_table *table, const char *name, cpl_size row, int *null)
 Read a value from a numerical column.
 
const cpl_array * cpl_table_get_array (const cpl_table *table, const char *name, cpl_size row)
 Read an array from an array column.
 
cpl_size cpl_table_get_column_depth (const cpl_table *table, const char *name)
 Get the depth of a table column.
 
cpl_size cpl_table_get_column_dimension (const cpl_table *table, const char *name, cpl_size indx)
 Get size of one dimension of a table column of arrays.
 
cpl_size cpl_table_get_column_dimensions (const cpl_table *table, const char *name)
 Get the number of dimensions of a table column of arrays.
 
const char * cpl_table_get_column_format (const cpl_table *table, const char *name)
 Get the format of a table column.
 
double cpl_table_get_column_max (const cpl_table *table, const char *name)
 Get maximum value in a numerical column.
 
cpl_error_code cpl_table_get_column_maxpos (const cpl_table *table, const char *name, cpl_size *row)
 Get position of maximum in a numerical column.
 
double cpl_table_get_column_mean (const cpl_table *table, const char *name)
 Compute the mean value of a numerical column.
 
double complex cpl_table_get_column_mean_complex (const cpl_table *table, const char *name)
 Compute the mean value of a numerical or complex column.
 
double cpl_table_get_column_median (const cpl_table *table, const char *name)
 Compute the median value of a numerical column.
 
double cpl_table_get_column_min (const cpl_table *table, const char *name)
 Get minimum value in a numerical column.
 
cpl_error_code cpl_table_get_column_minpos (const cpl_table *table, const char *name, cpl_size *row)
 Get position of minimum in a numerical column.
 
const char * cpl_table_get_column_name (const cpl_table *table)
 Get table columns names.
 
cpl_array * cpl_table_get_column_names (const cpl_table *table)
 Get table columns names.
 
double cpl_table_get_column_stdev (const cpl_table *table, const char *name)
 Find the standard deviation of a table column.
 
cpl_type cpl_table_get_column_type (const cpl_table *table, const char *name)
 Get the type of a table column.
 
const char * cpl_table_get_column_unit (const cpl_table *table, const char *name)
 Get the unit of a table column.
 
double complex cpl_table_get_complex (const cpl_table *table, const char *name, cpl_size row, int *null)
 Read a value from a complex column.
 
cpl_array ** cpl_table_get_data_array (cpl_table *table, const char *name)
 Get a pointer to array column data.
 
const cpl_array ** cpl_table_get_data_array_const (const cpl_table *table, const char *name)
 Get a pointer to array column data.
 
double * cpl_table_get_data_double (cpl_table *table, const char *name)
 Get a pointer to double column data.
 
double complex * cpl_table_get_data_double_complex (cpl_table *table, const char *name)
 Get a pointer to double complex column data.
 
const double complex * cpl_table_get_data_double_complex_const (const cpl_table *table, const char *name)
 Get a pointer to constant double complex column data.
 
const double * cpl_table_get_data_double_const (const cpl_table *table, const char *name)
 Get a pointer to constant double column data.
 
float * cpl_table_get_data_float (cpl_table *table, const char *name)
 Get a pointer to float column data.
 
float complex * cpl_table_get_data_float_complex (cpl_table *table, const char *name)
 Get a pointer to float complex column data.
 
const float complex * cpl_table_get_data_float_complex_const (const cpl_table *table, const char *name)
 Get a pointer to constant float complex column data.
 
const float * cpl_table_get_data_float_const (const cpl_table *table, const char *name)
 Get a pointer to constant float column data.
 
int * cpl_table_get_data_int (cpl_table *table, const char *name)
 Get a pointer to integer column data.
 
const int * cpl_table_get_data_int_const (const cpl_table *table, const char *name)
 Get a pointer to constant integer column data.
 
long * cpl_table_get_data_long (cpl_table *table, const char *name)
 Get a pointer to long column data.
 
const long * cpl_table_get_data_long_const (const cpl_table *table, const char *name)
 Get a pointer to constant long column data.
 
long long * cpl_table_get_data_long_long (cpl_table *table, const char *name)
 Get a pointer to long long column data.
 
const long long * cpl_table_get_data_long_long_const (const cpl_table *table, const char *name)
 Get a pointer to constant long long column data.
 
char ** cpl_table_get_data_string (cpl_table *table, const char *name)
 Get a pointer to string column data.
 
const char ** cpl_table_get_data_string_const (const cpl_table *table, const char *name)
 Get a pointer to constant string column data.
 
double cpl_table_get_double (const cpl_table *table, const char *name, cpl_size row, int *null)
 Read a value from a double column.
 
double complex cpl_table_get_double_complex (const cpl_table *table, const char *name, cpl_size row, int *null)
 Read a value from a double complex column.
 
float cpl_table_get_float (const cpl_table *table, const char *name, cpl_size row, int *null)
 Read a value from a float column.
 
float complex cpl_table_get_float_complex (const cpl_table *table, const char *name, cpl_size row, int *null)
 Read a value from a float complex column.
 
int cpl_table_get_int (const cpl_table *table, const char *name, cpl_size row, int *null)
 Read a value from an integer column.
 
long cpl_table_get_long (const cpl_table *table, const char *name, cpl_size row, int *null)
 Read a value from a long column.
 
long long cpl_table_get_long_long (const cpl_table *table, const char *name, cpl_size row, int *null)
 Read a value from a long long column.
 
cpl_size cpl_table_get_ncol (const cpl_table *table)
 Get the number of columns in a table.
 
cpl_size cpl_table_get_nrow (const cpl_table *table)
 Get the number of rows in a table.
 
const char * cpl_table_get_string (const cpl_table *table, const char *name, cpl_size row)
 Read a value from a string column.
 
int cpl_table_has_column (const cpl_table *table, const char *name)
 Check if a column with a given name exists.
 
int cpl_table_has_invalid (const cpl_table *table, const char *name)
 Check if a column contains at least one invalid value.
 
int cpl_table_has_valid (const cpl_table *table, const char *name)
 Check if a column contains at least one valid value.
 
cpl_error_code cpl_table_imag_column (cpl_table *table, const char *name)
 Compute the imaginary part value of table column elements.
 
cpl_error_code cpl_table_insert (cpl_table *target_table, const cpl_table *insert_table, cpl_size row)
 Merge two tables.
 
cpl_error_code cpl_table_insert_window (cpl_table *table, cpl_size start, cpl_size count)
 Insert a segment of rows into table data.
 
int cpl_table_is_selected (const cpl_table *table, cpl_size row)
 Determine whether a table row is selected or not.
 
int cpl_table_is_valid (const cpl_table *table, const char *name, cpl_size row)
 Check if a column element is valid.
 
cpl_table * cpl_table_load (const char *filename, int xtnum, int check_nulls)
 Load a FITS table extension into a new cpl_table.
 
cpl_table * cpl_table_load_window (const char *filename, int xtnum, int check_nulls, const cpl_array *selcol, cpl_size firstrow, cpl_size nrow)
 Load part of a FITS table extension into a new cpl_table.
 
cpl_error_code cpl_table_logarithm_column (cpl_table *table, const char *name, double base)
 Compute the logarithm of column values.
 
cpl_error_code cpl_table_move_column (cpl_table *to_table, const char *name, cpl_table *from_table)
 Move a column from a table to another.
 
cpl_error_code cpl_table_multiply_columns (cpl_table *table, const char *to_name, const char *from_name)
 Multiply two numeric or complex table columns.
 
cpl_error_code cpl_table_multiply_scalar (cpl_table *table, const char *name, double value)
 Multiply a numerical or complex column by a constant.
 
cpl_error_code cpl_table_multiply_scalar_complex (cpl_table *table, const char *name, double complex value)
 Multiply a numerical or complex column by a complex constant.
 
cpl_error_code cpl_table_name_column (cpl_table *table, const char *from_name, const char *to_name)
 Rename a table column.
 
cpl_table * cpl_table_new (cpl_size length)
 Create an empty table structure.
 
cpl_error_code cpl_table_new_column (cpl_table *table, const char *name, cpl_type type)
 Create an empty column in a table.
 
cpl_error_code cpl_table_new_column_array (cpl_table *table, const char *name, cpl_type type, cpl_size depth)
 Create an empty column of arrays in a table.
 
cpl_size cpl_table_not_selected (cpl_table *table)
 Select unselected table rows, and unselect selected ones.
 
cpl_size cpl_table_or_selected (cpl_table *table, const char *name1, cpl_table_select_operator operator, const char *name2)
 Select from unselected table rows, by comparing the values of two numerical columns.
 
cpl_size cpl_table_or_selected_double (cpl_table *table, const char *name, cpl_table_select_operator operator, double value)
 Select from unselected table rows, by comparing double column values with a constant.
 
cpl_size cpl_table_or_selected_double_complex (cpl_table *table, const char *name, cpl_table_select_operator operator, double complex value)
 Select from unselected table rows, by comparing double complex column values with a complex constant.
 
cpl_size cpl_table_or_selected_float (cpl_table *table, const char *name, cpl_table_select_operator operator, float value)
 Select from unselected table rows, by comparing float column values with a constant.
 
cpl_size cpl_table_or_selected_float_complex (cpl_table *table, const char *name, cpl_table_select_operator operator, float complex value)
 Select from unselected table rows, by comparing float complex column values with a complex constant.
 
cpl_size cpl_table_or_selected_int (cpl_table *table, const char *name, cpl_table_select_operator operator, int value)
 Select from unselected table rows, by comparing integer column values with a constant.
 
cpl_size cpl_table_or_selected_invalid (cpl_table *table, const char *name)
 Select from unselected table rows all rows with an invalid value in a specified column.
 
cpl_size cpl_table_or_selected_long (cpl_table *table, const char *name, cpl_table_select_operator operator, long value)
 Select from unselected table rows, by comparing long column values with a constant.
 
cpl_size cpl_table_or_selected_long_long (cpl_table *table, const char *name, cpl_table_select_operator operator, long long value)
 Select from unselected table rows, by comparing long long column values with a constant.
 
cpl_size cpl_table_or_selected_string (cpl_table *table, const char *name, cpl_table_select_operator operator, const char *string)
 Select from unselected table rows, by comparing column values with a constant.
 
cpl_size cpl_table_or_selected_window (cpl_table *table, cpl_size start, cpl_size count)
 Select from unselected rows only those within a table segment.
 
cpl_error_code cpl_table_power_column (cpl_table *table, const char *name, double exponent)
 Compute the power of column values.
 
cpl_error_code cpl_table_real_column (cpl_table *table, const char *name)
 Compute the real part value of table column elements.
 
cpl_error_code cpl_table_save (const cpl_table *table, const cpl_propertylist *pheader, const cpl_propertylist *header, const char *filename, unsigned mode)
 Save a cpl_table to a FITS file.
 
cpl_error_code cpl_table_select_all (cpl_table *table)
 Select all table rows.
 
cpl_error_code cpl_table_select_row (cpl_table *table, cpl_size row)
 Flag a table row as selected.
 
cpl_error_code cpl_table_set (cpl_table *table, const char *name, cpl_size row, double value)
 Write a value to a numerical table column element.
 
cpl_error_code cpl_table_set_array (cpl_table *table, const char *name, cpl_size row, const cpl_array *array)
 Write an array to an array table column element.
 
cpl_error_code cpl_table_set_column_depth (cpl_table *table, const char *name, cpl_size depth)
 Modify depth of a column of arrays.
 
cpl_error_code cpl_table_set_column_dimensions (cpl_table *table, const char *name, const cpl_array *dimensions)
 Set the dimensions of a table column of arrays.
 
cpl_error_code cpl_table_set_column_format (cpl_table *table, const char *name, const char *format)
 Give a new format to a table column.
 
cpl_error_code cpl_table_set_column_invalid (cpl_table *table, const char *name, cpl_size start, cpl_size count)
 Invalidate a column segment.
 
cpl_error_code cpl_table_set_column_unit (cpl_table *table, const char *name, const char *unit)
 Give a new unit to a table column.
 
cpl_error_code cpl_table_set_complex (cpl_table *table, const char *name, cpl_size row, double complex value)
 Write a complex value to a complex numerical table column element.
 
cpl_error_code cpl_table_set_double (cpl_table *table, const char *name, cpl_size row, double value)
 Write a value to a double table column element.
 
cpl_error_code cpl_table_set_double_complex (cpl_table *table, const char *name, cpl_size row, double complex value)
 Write a value to a double complex table column element.
 
cpl_error_code cpl_table_set_float (cpl_table *table, const char *name, cpl_size row, float value)
 Write a value to a float table column element.
 
cpl_error_code cpl_table_set_float_complex (cpl_table *table, const char *name, cpl_size row, float complex value)
 Write a value to a float complex table column element.
 
cpl_error_code cpl_table_set_int (cpl_table *table, const char *name, cpl_size row, int value)
 Write a value to an integer table column element.
 
cpl_error_code cpl_table_set_invalid (cpl_table *table, const char *name, cpl_size row)
 Flag a column element as invalid.
 
cpl_error_code cpl_table_set_long (cpl_table *table, const char *name, cpl_size row, long value)
 Write a value to an long table column element.
 
cpl_error_code cpl_table_set_long_long (cpl_table *table, const char *name, cpl_size row, long long value)
 Write a value to an long long table column element.
 
cpl_error_code cpl_table_set_size (cpl_table *table, cpl_size new_length)
 Resize a table to a new number of rows.
 
cpl_error_code cpl_table_set_string (cpl_table *table, const char *name, cpl_size row, const char *value)
 Write a character string to a string table column element.
 
cpl_error_code cpl_table_shift_column (cpl_table *table, const char *name, cpl_size shift)
 Shift the position of numeric or complex column values.
 
cpl_error_code cpl_table_sort (cpl_table *table, const cpl_propertylist *reflist)
 Sort table rows according to columns values.
 
cpl_error_code cpl_table_subtract_columns (cpl_table *table, const char *to_name, const char *from_name)
 Subtract two numeric or complex table columns.
 
cpl_error_code cpl_table_subtract_scalar (cpl_table *table, const char *name, double value)
 Subtract a constant value from a numerical or complex column.
 
cpl_error_code cpl_table_subtract_scalar_complex (cpl_table *table, const char *name, double complex value)
 Subtract a constant complex value from a numerical or complex column.
 
cpl_error_code cpl_table_unselect_all (cpl_table *table)
 Unselect all table rows.
 
cpl_error_code cpl_table_unselect_row (cpl_table *table, cpl_size row)
 Flag a table row as unselected.
 
void * cpl_table_unwrap (cpl_table *table, const char *name)
 Unwrap a table column.
 
cpl_array * cpl_table_where_selected (const cpl_table *table)
 Get array of indexes to selected table rows.
 
cpl_error_code cpl_table_wrap_double (cpl_table *table, double *data, const char *name)
 Create in table a new double column obtained from existing data.
 
cpl_error_code cpl_table_wrap_double_complex (cpl_table *table, double complex *data, const char *name)
 Create in table a new double complex column from existing data.
 
cpl_error_code cpl_table_wrap_float (cpl_table *table, float *data, const char *name)
 Create in table a new float column obtained from existing data.
 
cpl_error_code cpl_table_wrap_float_complex (cpl_table *table, float complex *data, const char *name)
 Create in table a new float complex column obtained from existing data.
 
cpl_error_code cpl_table_wrap_int (cpl_table *table, int *data, const char *name)
 Create in table a new integer column obtained from existing data.
 
cpl_error_code cpl_table_wrap_long (cpl_table *table, long *data, const char *name)
 Create in table a new long column obtained from existing data.
 
cpl_error_code cpl_table_wrap_long_long (cpl_table *table, long long *data, const char *name)
 Create in table a new long long column obtained from existing data.
 
cpl_error_code cpl_table_wrap_string (cpl_table *table, char **data, const char *name)
 Create in table a new string column obtained from existing data.
 

Detailed Description

This module provides functions to create, use, and destroy a cpl_table. A cpl_table is made of columns, and a column consists of an array of elements of a given type. Currently three numerical types are supported, CPL_TYPE_INT, CPL_TYPE_FLOAT, and CPL_TYPE_DOUBLE, plus a type indicating columns containing character strings, CPL_TYPE_STRING. Moreover, it is possible to define columns of arrays, i.e. columns whose elements are arrays of all the basic types listed above. Within the same column all arrays must have the same type and the same length.

A table column is accessed by specifying its name. The ordering of the columns within a table is undefined: a cpl_table is not an n-tuple of columns, but just a set of columns. The N elements of a column are counted from 0 to N-1, with element 0 on top. The set of all the table columns elements with the same index constitutes a table row, and table rows are counted according to the same convention. It is possible to flag each cpl_table row as "selected" or "unselected", and each column element as "valid" or "invalid". Selecting table rows is mainly a way to extract just those table parts fulfilling any given condition, while invalidating column elements is a way to exclude such elements from any computation. A cpl_table is created with all rows selected, and a column is created with all elements invalidated.

Note
The cpl_table pointers specified in the argument list of all the cpl_table functions must point to valid objects: these functions do not perform any check in this sense. Only in the particular case of a NULL pointer the functions will set a CPL_ERROR_NULL_INPUT error code, unless differently specified.
Synopsis:
#include <cpl_table.h>

Function Documentation

cpl_error_code cpl_table_abs_column ( cpl_table *  table,
const char *  name 
)

Compute the absolute value of column values.

Parameters
tablePointer to table.
nameTable column name.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is not numerical, or has type array.

Each column element is replaced by its absolute value. Invalid elements are not modified by this operation. If the column is complex, its type will be turned to real (CPL_TYPE_FLOAT_COMPLEX will be changed into CPL_TYPE_FLOAT, and CPL_TYPE_DOUBLE_COMPLEX will be changed into CPL_TYPE_DOUBLE), and any pointer retrieved by calling cpl_table_get_data_float_complex() and cpl_array_get_data_double_complex() should be discarded.

cpl_error_code cpl_table_add_columns ( cpl_table *  table,
const char *  to_name,
const char *  from_name 
)

Add the values of two numeric or complex table columns.

Parameters
tablePointer to table.
to_nameName of target column.
from_nameName of source column.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or any column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with any specified name is not found in table.
CPL_ERROR_INVALID_TYPE Any specified column is neither numerical nor complex, or it is an array column.

The columns are summed element by element, and the result of the sum is stored in the target column. The columns' types may differ, and in that case the operation would be performed using the standard C upcasting rules, with a final cast of the result to the target column type. Invalid elements are propagated consistently: if either or both members of the sum are invalid, the result will be invalid too. Underflows and overflows are ignored.

cpl_error_code cpl_table_add_scalar ( cpl_table *  table,
const char *  name,
double  value 
)

Add a constant value to a numerical or complex column.

Parameters
tablePointer to table.
nameColumn name.
valueValue to add.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex, or it is an array column.

The operation is always performed in double precision, with a final cast of the result to the target column type. Invalid elements are are not modified by this operation.

cpl_error_code cpl_table_add_scalar_complex ( cpl_table *  table,
const char *  name,
double complex  value 
)

Add a constant complex value to a numerical or complex column.

Parameters
tablePointer to table.
nameColumn name.
valueValue to add.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex, or it is an array column.

The operation is always performed in double precision, with a final cast of the result to the target column type. Invalid elements are are not modified by this operation.

cpl_size cpl_table_and_selected ( cpl_table *  table,
const char *  name1,
cpl_table_select_operator  operator,
const char *  name2 
)

Select from selected table rows, by comparing the values of two numerical columns.

Parameters
tablePointer to table.
name1Name of first table column.
operatorRelational operator.
name2Name of second table column.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column names are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with any of the specified names is not found in table.
CPL_ERROR_INVALID_TYPE Invalid types for comparison.

Either both columns must be numerical, or they both must be strings. The comparison between strings is lexicographical. Comparison between complex types and array types are not supported.

For all the already selected table rows, the values of the specified columns are compared. The table rows not fulfilling the comparison are unselected. Invalid elements from either columns never fulfill any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, CPL_NOT_LESS_THAN. See also the function cpl_table_or_selected().

cpl_size cpl_table_and_selected_double ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
double  value 
)

Select from selected table rows, by comparing double column values with a constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE.

For all the already selected table rows, the values of the specified column are compared with the reference value. All table rows not fulfilling the comparison are unselected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, and CPL_NOT_LESS_THAN. If the table has no rows, no error is set, and 0 is returned. See also the function cpl_table_or_selected_double().

cpl_size cpl_table_and_selected_double_complex ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
double complex  value 
)

Select from selected table rows, by comparing double complex column values with a complex constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX.
CPL_ERROR_ILLEGAL_INPUT Operator other than CPL_EQUAL_TO or CPL_NOT_EQUAL_TO was specified.

For all the already selected table rows, the values of the specified column are compared with the reference value. All table rows not fulfilling the comparison are unselected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO and CPL_NOT_EQUAL_TO. If the table has no rows, no error is set, and 0 is returned. See also the function cpl_table_or_selected_double_complex().

cpl_size cpl_table_and_selected_float ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
float  value 
)

Select from selected table rows, by comparing float column values with a constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT.

For all the already selected table rows, the values of the specified column are compared with the reference value. All table rows not fulfilling the comparison are unselected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, and CPL_NOT_LESS_THAN. If the table has no rows, no error is set, and 0 is returned. See also the function cpl_table_or_selected_float().

cpl_size cpl_table_and_selected_float_complex ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
float complex  value 
)

Select from selected table rows, by comparing float complex column values with a complex constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT_COMPLEX.
CPL_ERROR_ILLEGAL_INPUT Operator other than CPL_EQUAL_TO or CPL_NOT_EQUAL_TO was specified.

For all the already selected table rows, the values of the specified column are compared with the reference value. All table rows not fulfilling the comparison are unselected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO and CPL_NOT_EQUAL_TO. If the table has no rows, no error is set, and 0 is returned. See also the function cpl_table_or_selected_float_complex().

cpl_size cpl_table_and_selected_int ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
int  value 
)

Select from selected table rows, by comparing integer column values with a constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_INT.

For all the already selected table rows, the values of the specified column are compared with the reference value. All table rows not fulfilling the comparison are unselected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, and CPL_NOT_LESS_THAN. If the table has no rows, no error is set, and 0 is returned. See also the function cpl_table_or_selected_int().

cpl_size cpl_table_and_selected_invalid ( cpl_table *  table,
const char *  name 
)

Select from selected table rows all rows with an invalid value in a specified column.

Parameters
tablePointer to table.
nameColumn name.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.

For all the already selected table rows, all the rows containing valid values at the specified column are unselected. See also the function cpl_table_or_selected_invalid().

cpl_size cpl_table_and_selected_long ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
long  value 
)

Select from selected table rows, by comparing long column values with a constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG.

For all the already selected table rows, the values of the specified column are compared with the reference value. All table rows not fulfilling the comparison are unselected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, and CPL_NOT_LESS_THAN. If the table has no rows, no error is set, and 0 is returned. See also the function cpl_table_or_selected_long().

cpl_size cpl_table_and_selected_long_long ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
long long  value 
)

Select from selected table rows, by comparing long long column values with a constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG_LONG.

For all the already selected table rows, the values of the specified column are compared with the reference value. All table rows not fulfilling the comparison are unselected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, and CPL_NOT_LESS_THAN. If the table has no rows, no error is set, and 0 is returned. See also the function cpl_table_or_selected_long_long().

cpl_size cpl_table_and_selected_string ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
const char *  string 
)

Select from selected table rows, by comparing string column values with a character string.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
stringReference character string.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_STRING.
CPL_ERROR_ILLEGAL_INPUT Invalid regular expression.

For all the already selected table rows, the values of the specified column are compared with the reference string. The comparison function used is the C standard strcmp(), but in case the relational operators CPL_EQUAL_TO or CPL_NOT_EQUAL_TO are specified, the comparison string is treated as a regular expression. All table rows not fulfilling the comparison are unselected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, and CPL_NOT_LESS_THAN. If the table has no rows, no error is set, and 0 is returned. See also the function cpl_table_or_selected_string().

cpl_size cpl_table_and_selected_window ( cpl_table *  table,
cpl_size  start,
cpl_size  count 
)

Select from selected rows only those within a table segment.

Parameters
tablePointer to table.
startFirst row of table segment.
countLength of segment.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.

All the selected table rows that are outside the specified interval are unselected. If the sum of start and count goes beyond the end of the input table, rows are checked up to the end of the table. See also the function cpl_table_or_selected_window().

cpl_error_code cpl_table_arg_column ( cpl_table *  table,
const char *  name 
)

Compute the phase angle value of table column elements.

Parameters
tablePointer to table.
nameColumn name.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex.

Each column element is replaced by its phase angle value. The phase angle will be in the range of [-pi,pi]. Invalid elements are not modified by this operation. If the column is complex, its type will be turned to real (CPL_TYPE_FLOAT_COMPLEX will be changed into CPL_TYPE_FLOAT, and CPL_TYPE_DOUBLE_COMPLEX will be changed into CPL_TYPE_DOUBLE), and any pointer retrieved by calling cpl_table_get_data_float_complex(), cpl_table_get_data_double_complex(), etc., should be discarded.

cpl_error_code cpl_table_cast_column ( cpl_table *  table,
const char *  from_name,
const char *  to_name,
cpl_type  type 
)

Cast a numeric or complex column to a new numeric or complex type column.

Parameters
tablePointer to table.
from_nameName of table column to cast.
to_nameName of new table column.
typeType of new table column.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any of table or from_name is a NULL pointer.
CPL_ERROR_ILLEGAL_OUTPUT A column with the specified to_name already exists in table. Note however that to_name equal to from_name is legal (in-place cast).
CPL_ERROR_DATA_NOT_FOUND A column with the specified from_name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex.
CPL_ERROR_ILLEGAL_INPUT The specified type is neither numerical nor complex.

A new column of the specified type is created, and the content of the given numeric column is cast to the new type. If the input column type is identical to the specified type the column is duplicated as is done by the function cpl_table_duplicate_column(). Note that a column of arrays is always cast to another column of arrays of the specified type, unless it has depth 1. Consistently, a column of numbers can be cast to a column of arrays of depth 1. Here is a complete summary of how any (legal) type specification would be interpreted, depending on the type of the input column:

from_name type = CPL_TYPE_XXX
specified type = CPL_TYPE_XXX
to_name type = CPL_TYPE_XXX
from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER
specified type = CPL_TYPE_XXX | CPL_TYPE_POINTER
to_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER
from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth > 1)
specified type = CPL_TYPE_XXX
to_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER
from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth = 1)
specified type = CPL_TYPE_XXX
to_name type = CPL_TYPE_XXX
from_name type = CPL_TYPE_XXX
specified type = CPL_TYPE_XXX | CPL_TYPE_POINTER
to_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth = 1)
from_name type = CPL_TYPE_XXX
specified type = CPL_TYPE_POINTER
to_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth = 1)
from_name type = CPL_TYPE_XXX
specified type = CPL_TYPE_YYY
to_name type = CPL_TYPE_YYY
from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER
specified type = CPL_TYPE_YYY | CPL_TYPE_POINTER
to_name type = CPL_TYPE_YYY | CPL_TYPE_POINTER
from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth > 1)
specified type = CPL_TYPE_YYY
to_name type = CPL_TYPE_YYY | CPL_TYPE_POINTER
from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth = 1)
specified type = CPL_TYPE_YYY
to_name type = CPL_TYPE_YYY
from_name type = CPL_TYPE_XXX
specified type = CPL_TYPE_YYY | CPL_TYPE_POINTER
to_name type = CPL_TYPE_YYY | CPL_TYPE_POINTER (depth = 1)
Note
If to_name is a NULL pointer, or it is equal to from_name, the cast is done in-place. The pointers to data will change, therefore pointers previously retrieved by cpl_table_get_data_xxx(), should be discarded.
int cpl_table_compare_structure ( const cpl_table *  table1,
const cpl_table *  table2 
)

Compare the structure of two tables.

Parameters
table1Pointer to a table.
table2Pointer to another table.
Returns
0 if the tables have the same structure, 1 otherwise. In case of error, -1 is returned.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.

Two tables have the same structure if they have the same number of columns, with the same names, the same types, and the same units. The order of the columns is not relevant.

cpl_error_code cpl_table_conjugate_column ( cpl_table *  table,
const char *  name 
)

Compute the complex conjugate of column values.

Parameters
tablePointer to table.
nameColumn name.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex, or it is integer, or it is an array column.
CPL_ERROR_ILLEGAL_INPUT The input base is not positive.

Each column element is replaced by its complex conjugate. The operation is always performed in double precision, with a final cast of the result to the target column type. Invalid elements are not modified by this operation.

cpl_error_code cpl_table_copy_data_double ( cpl_table *  table,
const char *  name,
const double *  data 
)

Copy existing data to a table double column.

Parameters
tablePointer to table.
nameName of the column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE.

See the description of cpl_table_copy_data_int() for details.

cpl_error_code cpl_table_copy_data_double_complex ( cpl_table *  table,
const char *  name,
const double complex *  data 
)

Copy existing data to a table double complex column.

Parameters
tablePointer to table.
nameName of the column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX.

See the description of cpl_table_copy_data_int() for details.

cpl_error_code cpl_table_copy_data_float ( cpl_table *  table,
const char *  name,
const float *  data 
)

Copy existing data to a table float column.

Parameters
tablePointer to table.
nameName of the column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT.

See the description of cpl_table_copy_data_int() for details.

cpl_error_code cpl_table_copy_data_float_complex ( cpl_table *  table,
const char *  name,
const float complex *  data 
)

Copy existing data to a table float complex column.

Parameters
tablePointer to table.
nameName of the column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT_COMPLEX.

See the description of cpl_table_copy_data_int() for details.

cpl_error_code cpl_table_copy_data_int ( cpl_table *  table,
const char *  name,
const int *  data 
)

Copy existing data to a table integer column.

Parameters
tablePointer to table.
nameName of the column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_INT.

The input data values are copied to the specified column. The size of the input array is not checked in any way, and it is expected to be compatible with the number of rows in the given table. The copied data values are all taken as valid: invalid values should be marked using the functions cpl_table_set_invalid() and cpl_table_set_column_invalid().

cpl_error_code cpl_table_copy_data_long ( cpl_table *  table,
const char *  name,
const long *  data 
)

Copy existing data to a table long column.

Parameters
tablePointer to table.
nameName of the column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG.

See the description of cpl_table_copy_data_int() for details.

cpl_error_code cpl_table_copy_data_long_long ( cpl_table *  table,
const char *  name,
const long long *  data 
)

Copy existing data to a table long long column.

Parameters
tablePointer to table.
nameName of the column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG_LONG.

See the description of cpl_table_copy_data_int() for details.

cpl_error_code cpl_table_copy_data_string ( cpl_table *  table,
const char *  name,
const char **  data 
)

Copy existing data to a table string column.

Parameters
tablePointer to table.
nameName of the column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_STRING.

See the description of cpl_table_copy_data_int() for details. In the particular case of a string column, it should be noted that the data are copied in-depth, i.e., also the pointed strings are duplicated. Strings contained in the existing table column are deallocated before being replaced by the new ones.

cpl_error_code cpl_table_copy_structure ( cpl_table *  table,
const cpl_table *  mtable 
)

Give to a table the same structure of another table.

Parameters
tablePointer to empty table.
mtablePointer to model table.
Returns
CPL_ERROR_NONE in case of success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT table contains columns.

This function assignes to a columnless table the same column structure (names, types, units) of a given model table. All columns are physically created in the new table, and they are initialised to contain just invalid elements.

cpl_size cpl_table_count_invalid ( const cpl_table *  table,
const char *  name 
)

Count number of invalid values in a table column.

Parameters
tablePointer to table.
nameName of table column to examine.
Returns
Number of invalid elements in a table column, or -1 in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

Count number of invalid elements in a table column.

cpl_size cpl_table_count_selected ( const cpl_table *  table)

Get number of selected rows in given table.

Parameters
tablePointer to table.
Returns
Number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.

Get number of selected rows in given table.

void cpl_table_delete ( cpl_table *  table)

Delete a table.

Parameters
tablePointer to table to be deleted.
Returns
Nothing.

This function deletes a table, releasing all the memory associated to it, including any existing column. If table is NULL, nothing is done, and no error is set.

cpl_error_code cpl_table_divide_columns ( cpl_table *  table,
const char *  to_name,
const char *  from_name 
)

Divide two numeric or complex table columns.

Parameters
tablePointer to table.
to_nameName of target column.
from_nameName of column dividing the target column.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or any column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with any specified name is not found in table.
CPL_ERROR_INVALID_TYPE Any specified column is neither numerical nor complex, or it is an array column.

The columns are divided element by element, and the result of the division is stored in the target column. The columns' types may differ, and in that case the operation would be performed using the standard C upcasting rules, with a final cast of the result to the target column type. Invalid elements are propagated consistently: if either or both members of the division are invalid, the result will be invalid too. Underflows and overflows are ignored, but a division by exactly zero will set an invalid column element.

cpl_error_code cpl_table_divide_scalar ( cpl_table *  table,
const char *  name,
double  value 
)

Divide a numerical or complex column by a constant.

Parameters
tablePointer to table.
nameColumn name.
valueDivisor value.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex, or it is an array column.
CPL_ERROR_DIVISION_BY_ZERO The input value is 0.0.

The operation is always performed in double precision, with a final cast of the result to the target column type. Invalid elements are not modified by this operation.

cpl_error_code cpl_table_divide_scalar_complex ( cpl_table *  table,
const char *  name,
double complex  value 
)

Divide a numerical or complex column by a complex constant.

Parameters
tablePointer to table.
nameColumn name.
valueDivisor value.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex, or it is an array column.
CPL_ERROR_DIVISION_BY_ZERO The input value is 0.0.

The operation is always performed in double precision, with a final cast of the result to the target column type. Invalid elements are not modified by this operation.

void cpl_table_dump ( const cpl_table *  table,
cpl_size  start,
cpl_size  count,
FILE *  stream 
)

Print a table.

Parameters
tablePointer to table
startFirst row to print
countNumber of rows to print
streamThe output stream
Returns
Nothing.

This function is mainly intended for debug purposes. All column elements are printed according to the column formats, that may be specified for each table column with the function cpl_table_set_column_format(). The default column formats have been chosen to provide a reasonable printout in most cases. Table rows are counted from 0, and their sequence number is printed at the left of each row. Invalid table elements are represented as a sequence of "-" as wide as the field occupied by the column to which they belong. Array elements are not resolved, and are represented by a sequence of "+" as wide as the field occupied by the column to which they belong. It is not shown whether a table row is selected or not. Specifying a start beyond the table boundaries, or a non-positive count, would generate a warning message, but no error would be set. The specified number of rows to print may exceed the table end, and in that case the table would be printed up to its last row. If the specified stream is NULL, it is set to stdout. The function used for printing is the standard C fprintf().

void cpl_table_dump_structure ( const cpl_table *  table,
FILE *  stream 
)

Describe the structure and the contents of a table.

Parameters
tablePointer to table.
streamThe output stream
Returns
Nothing.

This function is mainly intended for debug purposes. Some information about the structure of a table and its contents is printed to terminal:

  • Number of columns, with their names and types
  • Number of invalid elements for each column
  • Number of rows and of selected rows

If the specified stream is NULL, it is set to stdout. The function used for printing is the standard C fprintf().

cpl_table* cpl_table_duplicate ( const cpl_table *  table)

Make a copy of a table.

Parameters
tablePointer to table.
Returns
Pointer to the new table, or NULL in case of NULL input, or in case of error.

The copy operation is done "in depth": columns data are duplicated too, not just their pointers. Also the selection flags of the original table are transferred to the new table.

cpl_error_code cpl_table_duplicate_column ( cpl_table *  to_table,
const char *  to_name,
const cpl_table *  from_table,
const char *  from_name 
)

Copy a column from a table to another.

Parameters
to_tableTarget table.
to_nameNew name of copied column.
from_tableSource table.
from_nameName of column to copy.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT The input tables do not have the same number of rows.
CPL_ERROR_DATA_NOT_FOUND A column with the specified from_name is not found in the source table.
CPL_ERROR_ILLEGAL_OUTPUT A column with the specified to_name already exists in the target table.

Copy a column from a table to another. The column is duplicated. A column may be duplicated also within the same table.

cpl_error_code cpl_table_erase_column ( cpl_table *  table,
const char *  name 
)

Delete a column from a table.

Parameters
tablePointer to table.
nameName of table column to delete.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

Delete a column from a table. If the table is left without columns, also the selection flags are lost.

cpl_error_code cpl_table_erase_invalid ( cpl_table *  table)

Remove from a table all columns just containing invalid elements, and then all rows containing at least one invalid element.

Parameters
tablePointer to table.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.

Firstly, all columns consisting just of invalid elements are deleted from the table. Next, the remaining table rows containing at least one invalid element are also deleted from the table. The selection flags are set back to "all selected" even if no rows or columns are erased. The pointers to data may change, therefore pointers previously retrieved by calling cpl_table_get_data_int(), etc., should be discarded.

The function is similar to the function cpl_table_erase_invalid_rows(), except for the criteria to remove rows containing invalid elements after all invalid columns have been removed. While cpl_table_erase_invalid_rows() requires all elements to be invalid in order to remove a row from the table, this function requires only one (or more) elements to be invalid.

Note
If the input table just contains invalid elements, all columns are deleted.
See Also
cpl_table_erase_invalid_rows()
cpl_error_code cpl_table_erase_invalid_rows ( cpl_table *  table)

Remove from a table columns and rows just containing invalid elements.

Parameters
tablePointer to table.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.

Table columns and table rows just containing invalid elements are deleted from the table, i.e. a column or a row is deleted only if all of its elements are invalid. The selection flags are set back to "all selected" even if no rows or columns are removed. The pointers to data may change, therefore pointers previously retrieved by cpl_table_get_data_int(), cpl_table_get_data_string(), etc., should be discarded.

Note
If the input table just contains invalid elements, all columns are deleted.
cpl_error_code cpl_table_erase_selected ( cpl_table *  table)

Delete the selected rows of a table.

Parameters
tablePointer to table
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT table is a NULL pointer.

A portion of the table data is physically removed. The pointer to column data may change, therefore pointers previously retrieved by calling cpl_table_get_data_int(), cpl_table_get_data_string(), etc., should be discarded. The table selection flags are set back to "all selected".

cpl_error_code cpl_table_erase_window ( cpl_table *  table,
cpl_size  start,
cpl_size  count 
)

Delete a table segment.

Parameters
tablePointer to table.
startFirst row to delete.
countNumber of rows to delete.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT table is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has length zero, or start is outside the table range.
CPL_ERROR_ILLEGAL_INPUT count is negative.

A portion of the table data is physically removed. The pointers to column data may change, therefore pointers previously retrieved by calling cpl_table_get_data_int(), cpl_table_get_data_string(), etc., should be discarded. The table selection flags are set back to "all selected". The specified segment can extend beyond the end of the table, and in that case rows will be removed up to the end of the table.

cpl_error_code cpl_table_exponential_column ( cpl_table *  table,
const char *  name,
double  base 
)

Compute the exponential of column values.

Parameters
tablePointer to table.
nameColumn name.
baseExponential base.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex, or it is an array column.
CPL_ERROR_ILLEGAL_INPUT The input base is not positive.

Each column element is replaced by its exponential in the specified base. The operation is always performed in double precision, with a final cast of the result to the target column type. Invalid elements are not modified by this operation.

cpl_table* cpl_table_extract ( const cpl_table *  table,
cpl_size  start,
cpl_size  count 
)

Create a table from a section of another table.

Parameters
tablePointer to table.
startFirst row to be copied to new table.
countNumber of rows to be copied.
Returns
Pointer to the new table, or NULL in case or error.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.

A number of consecutive rows are copied from an input table to a newly created table. The new table will have the same structure of the original table (see function cpl_table_compare_structure() ). If the sum of start and count goes beyond the end of the input table, rows are copied up to the end. All the rows of the new table are selected, i.e., existing selection flags are not transferred from the old table to the new one.

cpl_table* cpl_table_extract_selected ( const cpl_table *  table)

Create a new table from the selected rows of another table.

Parameters
tablePointer to table.
Returns
Pointer to new table, or NULL in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.

A new table is created, containing a copy of all the selected rows of the input table. In the output table all rows are selected.

cpl_error_code cpl_table_fill_column_window ( cpl_table *  table,
const char *  name,
cpl_size  start,
cpl_size  count,
double  value 
)

Write a value to a numerical column segment.

Parameters
tablePointer to table.
nameName of table column to access.
startPosition where to begin to write the value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is not numerical, or is of type array.

Write the same value to a numerical column segment. The value is cast to the type of the accessed column according to the C casting rules. The written values are automatically marked as valid. To invalidate a column interval use cpl_table_set_column_invalid() instead. If the sum of start and count exceeds the number of table rows, the column is filled up to its end.

cpl_error_code cpl_table_fill_column_window_array ( cpl_table *  table,
const char *  name,
cpl_size  start,
cpl_size  count,
const cpl_array *  array 
)

Write an array to an array column segment.

Parameters
tablePointer to table.
nameName of table column to access.
startPosition where to begin to write the array.
countNumber of arrays to write.
arrayArray to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column does not match the type of the input array, or it is not made of arrays.
CPL_ERROR_INCOMPATIBLE_INPUT The size of the input array is different from the depth of the specified column.

Write the same array to a segment of an array column. If the input array is not a NULL pointer, it is duplicated for each accessed column element. If the input array is a NULL pointer, this call is equivalent to a call to cpl_table_set_column_invalid(). If the sum of start and count exceeds the number of rows in the table, the column is filled up to its end.

cpl_error_code cpl_table_fill_column_window_complex ( cpl_table *  table,
const char *  name,
cpl_size  start,
cpl_size  count,
double complex  value 
)

Write a value to a complex column segment.

Parameters
tablePointer to table.
nameName of table column to access.
startPosition where to begin to write the value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is not complex, or is of type array.

Write the same value to a complex column segment. The value is cast to the type of the accessed column according to the C casting rules. The written values are automatically marked as valid. To invalidate a column interval use cpl_table_set_column_invalid() instead. If the sum of start and count exceeds the number of table rows, the column is filled up to its end.

cpl_error_code cpl_table_fill_column_window_double ( cpl_table *  table,
const char *  name,
cpl_size  start,
cpl_size  count,
double  value 
)

Write a value to a double column segment.

Parameters
tablePointer to table.
nameName of table column to access.
startPosition where to begin to write the value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE.

Write the same value to a double column segment. The written values are automatically marked as valid. To invalidate a column interval use cpl_table_set_column_invalid() instead. If the sum of start and count exceeds the number of table rows, the column is filled up to its end.

cpl_error_code cpl_table_fill_column_window_double_complex ( cpl_table *  table,
const char *  name,
cpl_size  start,
cpl_size  count,
double complex  value 
)

Write a value to a double complex column segment.

Parameters
tablePointer to table.
nameName of table column to access.
startPosition where to begin to write the value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX.

Write the same value to a double complex column segment. The written values are automatically marked as valid. To invalidate a column interval use cpl_table_set_column_invalid() instead. If the sum of start and count exceeds the number of table rows, the column is filled up to its end.

cpl_error_code cpl_table_fill_column_window_float ( cpl_table *  table,
const char *  name,
cpl_size  start,
cpl_size  count,
float  value 
)

Write a value to a float column segment.

Parameters
tablePointer to table.
nameName of table column to access.
startPosition where to begin to write the value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT.

Write the same value to a float column segment. The written values are automatically marked as valid. To invalidate a column interval use cpl_table_set_column_invalid() instead. If the sum of start and count exceeds the number of table rows, the column is filled up to its end.

cpl_error_code cpl_table_fill_column_window_float_complex ( cpl_table *  table,
const char *  name,
cpl_size  start,
cpl_size  count,
float complex  value 
)

Write a value to a float complex column segment.

Parameters
tablePointer to table.
nameName of table column to access.
startPosition where to begin to write the value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT_COMPLEX.

Write the same value to a float complex column segment. The written values are automatically marked as valid. To invalidate a column interval use cpl_table_set_column_invalid() instead. If the sum of start and count exceeds the number of table rows, the column is filled up to its end.

cpl_error_code cpl_table_fill_column_window_int ( cpl_table *  table,
const char *  name,
cpl_size  start,
cpl_size  count,
int  value 
)

Write a value to an integer column segment.

Parameters
tablePointer to table.
nameName of table column to access.
startPosition where to begin to write the value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_INT.

Write the same value to an integer column segment. The written values are automatically marked as valid. To invalidate a column interval use cpl_table_set_column_invalid() instead. If the sum of start and count exceeds the number of table rows, the column is filled up to its end.

Note
For automatic conversion to the accessed column type use the function cpl_table_fill_column_window().
cpl_error_code cpl_table_fill_column_window_long ( cpl_table *  table,
const char *  name,
cpl_size  start,
cpl_size  count,
long  value 
)

Write a value to an long column segment.

Parameters
tablePointer to table.
nameName of table column to access.
startPosition where to begin to write the value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG.

Write the same value to an long column segment. The written values are automatically marked as valid. To invalidate a column interval use cpl_table_set_column_invalid() instead. If the sum of start and count exceeds the number of table rows, the column is filled up to its end.

Note
For automatic conversion to the accessed column type use the function cpl_table_fill_column_window().
cpl_error_code cpl_table_fill_column_window_long_long ( cpl_table *  table,
const char *  name,
cpl_size  start,
cpl_size  count,
long long  value 
)

Write a value to an long long column segment.

Parameters
tablePointer to table.
nameName of table column to access.
startPosition where to begin to write the value.
countNumber of values to write.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG_LONG.

Write the same value to an long long column segment. The written values are automatically marked as valid. To invalidate a column interval use cpl_table_set_column_invalid() instead. If the sum of start and count exceeds the number of table rows, the column is filled up to its end.

Note
For automatic conversion to the accessed column type use the function cpl_table_fill_column_window().
cpl_error_code cpl_table_fill_column_window_string ( cpl_table *  table,
const char *  name,
cpl_size  start,
cpl_size  count,
const char *  value 
)

Write a character string to a string column segment.

Parameters
tablePointer to table.
nameName of table column to access.
startPosition where to begin to write the character string.
countNumber of strings to write.
valueCharacter string to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_STRING.

Write the same value to a string column segment. If the input string is not a NULL pointer, it is duplicated for each accessed column element. If the input string is a NULL pointer, this call is equivalent to a call to cpl_table_set_column_invalid(). If the sum of start and count exceeds the number of rows in the table, the column is filled up to its end.

cpl_error_code cpl_table_fill_invalid_double ( cpl_table *  table,
const char *  name,
double  code 
)

Write to invalid double column elements a numeric code.

Parameters
tablePointer to table containing the column.
nameColumn name.
codeCode to write to invalid column elements.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE, or of type CPL_TYPE_DOUBLE | CPL_TYPE_POINTER.

This function can be applied also to columns of arrays of doubles. In general, numeric column elements that are flagged as invalid may contain any value, that should not be given any meaning whatsoever. In order to export the column data (using a call to cpl_table_get_data_double() ) to procedures that are external to the CPL column system, it may turn out to be appropriate assigning to all the invalid elements a conventional code value. This code value will supposedly be recognized and handled properly by a given foreign method applied directly to the column data buffer. Note that only existing invalid elements will be coded as indicated: new invalid column elements would still have their actual values left undefined. Also, any further processing of the column would not take care of maintaining the assigned code to a given invalid column element: therefore the code should be applied just before it is actually needed.

Note
Assigning a code to an invalid element doesn't make it valid.
cpl_error_code cpl_table_fill_invalid_double_complex ( cpl_table *  table,
const char *  name,
double complex  code 
)

Write to invalid double complex column elements a numeric code.

Parameters
tablePointer to table containing the column.
nameColumn name.
codeCode to write to invalid column elements.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX, or of type CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER.

This function can be applied also to columns of arrays of complex doubles. In general, complex column elements that are flagged as invalid may contain any value, that should not be given any meaning whatsoever. In order to export the column data (calling to cpl_table_get_data_double_complex() ) to procedures which are external to the CPL column system, it may turn out to be appropriate assigning a conventional code value to all the invalid elements. This code value will supposedly be recognized and handled properly by a given foreign method applied directly to the column data buffer. Note that only existing invalid elements will be coded as indicated: new invalid column elements would still have their actual values left undefined. Also, any further processing of the column would not take care of maintaining the assigned code to a given invalid column element: therefore the code should be applied just before it is actually needed.

Note
Assigning a code to an invalid element doesn't make it valid.
cpl_error_code cpl_table_fill_invalid_float ( cpl_table *  table,
const char *  name,
float  code 
)

Write to invalid float column elements a numeric code.

Parameters
tablePointer to table containing the column.
nameColumn name.
codeCode to write to invalid column elements.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT, or of type CPL_TYPE_FLOAT | CPL_TYPE_POINTER.

This function can be applied also to columns of arrays of floats. In general, numeric column elements that are flagged as invalid may contain any value, that should not be given any meaning whatsoever. In order to export the column data (using a call to cpl_table_get_data_float() ) to procedures that are external to the CPL column system, it may turn out to be appropriate assigning to all the invalid elements a conventional code value. This code value will supposedly be recognized and handled properly by a given foreign method applied directly to the column data buffer. Note that only existing invalid elements will be coded as indicated: new invalid column elements would still have their actual values left undefined. Also, any further processing of the column would not take care of maintaining the assigned code to a given invalid column element: therefore the code should be applied just before it is actually needed.

Note
Assigning a code to an invalid element doesn't make it valid.
cpl_error_code cpl_table_fill_invalid_float_complex ( cpl_table *  table,
const char *  name,
float complex  code 
)

Write to invalid float complex column elements a numeric code.

Parameters
tablePointer to table containing the column.
nameColumn name.
codeCode to write to invalid column elements.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT_COMPLEX, or of type CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER.

This function can be applied also to columns of arrays of complex floats. In general, complex column elements that are flagged as invalid may contain any value, that should not be given any meaning whatsoever. In order to export the column data (calling to cpl_table_get_data_float_complex() ) to procedures which are external to the CPL column system, it may turn out to be appropriate assigning a conventional code value to all the invalid elements. This code value will supposedly be recognized and handled properly by a given foreign method applied directly to the column data buffer. Note that only existing invalid elements will be coded as indicated: new invalid column elements would still have their actual values left undefined. Also, any further processing of the column would not take care of maintaining the assigned code to a given invalid column element: therefore the code should be applied just before it is actually needed.

Note
Assigning a code to an invalid element doesn't make it valid.
cpl_error_code cpl_table_fill_invalid_int ( cpl_table *  table,
const char *  name,
int  code 
)

Write to invalid integer column elements a numeric code.

Parameters
tablePointer to table containing the column.
nameColumn name.
codeCode to write to invalid column elements.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_INT, or of type CPL_TYPE_INT | CPL_TYPE_POINTER.

This function can be applied also to columns of arrays of integers. In general, numeric column elements that are flagged as invalid may contain any value, that should not be given any meaning whatsoever. In order to export the column data (using a call to cpl_table_get_data_int() ) to procedures that are external to the CPL column system, it may turn out to be appropriate assigning to all the invalid elements a conventional code value. This code value will supposedly be recognized and handled properly by a given foreign method applied directly to the column data buffer. Note that only existing invalid elements will be coded as indicated: new invalid column elements would still have their actual values left undefined. Also, any further processing of the column would not take care of maintaining the assigned code to a given invalid column element: therefore the code should be applied just before it is actually needed.

Note
Assigning a code to an invalid element doesn't make it valid.
cpl_error_code cpl_table_fill_invalid_long ( cpl_table *  table,
const char *  name,
long  code 
)

Write to invalid long column elements a numeric code.

Parameters
tablePointer to table containing the column.
nameColumn name.
codeCode to write to invalid column elements.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG, or of type CPL_TYPE_LONG | CPL_TYPE_POINTER.

This function can be applied also to columns of arrays of integers. In general, numeric column elements that are flagged as invalid may contain any value, that should not be given any meaning whatsoever. In order to export the column data (using a call to cpl_table_get_data_long() ) to procedures that are external to the CPL column system, it may turn out to be appropriate assigning to all the invalid elements a conventional code value. This code value will supposedly be recognized and handled properly by a given foreign method applied directly to the column data buffer. Note that only existing invalid elements will be coded as indicated: new invalid column elements would still have their actual values left undefined. Also, any further processing of the column would not take care of maintaining the assigned code to a given invalid column element: therefore the code should be applied just before it is actually needed.

Note
Assigning a code to an invalid element doesn't make it valid.
cpl_error_code cpl_table_fill_invalid_long_long ( cpl_table *  table,
const char *  name,
long long  code 
)

Write to invalid long long column elements a numeric code.

Parameters
tablePointer to table containing the column.
nameColumn name.
codeCode to write to invalid column elements.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG_LONG, or of type CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER.

This function can be applied also to columns of arrays of integers. In general, numeric column elements that are flagged as invalid may contain any value, that should not be given any meaning whatsoever. In order to export the column data (using a call to cpl_table_get_data_long_long() ) to procedures that are external to the CPL column system, it may turn out to be appropriate assigning to all the invalid elements a conventional code value. This code value will supposedly be recognized and handled properly by a given foreign method applied directly to the column data buffer. Note that only existing invalid elements will be coded as indicated: new invalid column elements would still have their actual values left undefined. Also, any further processing of the column would not take care of maintaining the assigned code to a given invalid column element: therefore the code should be applied just before it is actually needed.

Note
Assigning a code to an invalid element doesn't make it valid.
double cpl_table_get ( const cpl_table *  table,
const char *  name,
cpl_size  row,
int *  null 
)

Read a value from a numerical column.

Parameters
tablePointer to table.
nameName of table column to be accessed.
rowPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Value read. In case of invalid table element, or in case of error, 0.0 is returned.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is not numerical, or is a column of arrays.

Rows are counted starting from 0. The null flag is used to indicate whether the accessed table element is valid (0) or invalid (1). The null flag also signals an error condition (-1). The null argument can be left to NULL.

const cpl_array* cpl_table_get_array ( const cpl_table *  table,
const char *  name,
cpl_size  row 
)

Read an array from an array column.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition of element to be read.
Returns
Pointer to array. In case of an invalid column element, or in case of error, a NULL pointer is always returned.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type array.

Read a value from a column of any array type. Rows are counted starting from 0.

Note
The returned array is a pointer to a table element, not its copy. Its manipulation will directly affect that element, while changing that element using cpl_table_set_array() will turn it into garbage. Therefore, if a real copy of an array column element is required, this function should be called as an argument of the function cpl_array_duplicate().
cpl_size cpl_table_get_column_depth ( const cpl_table *  table,
const char *  name 
)

Get the depth of a table column.

Parameters
tablePointer to table.
nameColumn name.
Returns
Column depth, or -1 in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

Get the depth of a column. Columns of type array always have positive depth, while columns listing numbers or character strings have depth 0.

cpl_size cpl_table_get_column_dimension ( const cpl_table *  table,
const char *  name,
cpl_size  indx 
)

Get size of one dimension of a table column of arrays.

Parameters
tablePointer to table.
nameColumn name.
indxIndicate dimension to query (0 = x, 1 = y, 2 = z, etc.).
Returns
Size of queried dimension of the column, or zero in case of error.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_UNSUPPORTED_MODE The specified column is not of type array.
CPL_ERROR_ACCESS_OUT_OF_RANGE The specified indx array is not compatible with the column dimensions.
CPL_ERROR_INCOMPATIBLE_INPUT The specified dimensions are incompatible with the total number of elements in the column arrays.

Get the size of one dimension of a column. If a column is not an array column, or if it has no dimensions, 1 is returned.

cpl_size cpl_table_get_column_dimensions ( const cpl_table *  table,
const char *  name 
)

Get the number of dimensions of a table column of arrays.

Parameters
tablePointer to table.
nameColumn name.
Returns
Column number of dimensions, or 0 in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

Get the number of dimensions of a column. If a column is not an array column, or if it has no dimensions, 1 is returned.

const char* cpl_table_get_column_format ( const cpl_table *  table,
const char *  name 
)

Get the format of a table column.

Parameters
tablePointer to table.
nameColumn name.
Returns
Format of column, or NULL in case of error.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

Return the format of a column. Note that the returned string is a pointer to the column format, not its copy. Its manipulation will directly affect the column format, while changing the column format using cpl_column_set_format() will turn it into garbage. Therefore it should be considered read-only, and if a real copy of a column format is required, this function should be called as an argument of the function strdup().

double cpl_table_get_column_max ( const cpl_table *  table,
const char *  name 
)

Get maximum value in a numerical column.

Parameters
tablePointer to table.
nameColumn name.
Returns
Maximum value. See documentation of cpl_table_get_column_mean().

See the description of the function cpl_table_get_column_mean().

cpl_error_code cpl_table_get_column_maxpos ( const cpl_table *  table,
const char *  name,
cpl_size row 
)

Get position of maximum in a numerical column.

Parameters
tablePointer to table.
nameColumn name.
rowReturned position of maximum value.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table, or it just contains invalid elements, or the table has length zero.
CPL_ERROR_INVALID_TYPE The specified column is not numerical.

Invalid column values are excluded from the search. The row argument will be assigned the position of the maximum value, where rows are counted starting from 0. If more than one column element correspond to the max value, the position with the lowest row number is returned. In case of error, row is left untouched. The table selection flags have no influence on the result.

double cpl_table_get_column_mean ( const cpl_table *  table,
const char *  name 
)

Compute the mean value of a numerical column.

Parameters
tablePointer to table.
nameColumn name.
Returns
Mean value. In case of error 0.0 is returned.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table, or it just contains invalid elements, or the table has length zero.
CPL_ERROR_INVALID_TYPE The specified column is not numerical.

Invalid column values are excluded from the computation. The table selection flags have no influence on the result.

double complex cpl_table_get_column_mean_complex ( const cpl_table *  table,
const char *  name 
)

Compute the mean value of a numerical or complex column.

Parameters
tablePointer to table.
nameColumn name.
Returns
Mean value. In case of error 0.0 is returned.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table, or it just contains invalid elements, or the table has length zero.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex.

Invalid column values are excluded from the computation. The table selection flags have no influence on the result.

double cpl_table_get_column_median ( const cpl_table *  table,
const char *  name 
)

Compute the median value of a numerical column.

Parameters
tablePointer to table.
nameColumn name.
Returns
Median value. See documentation of cpl_table_get_column_mean().

See the description of the function cpl_table_get_column_mean().

double cpl_table_get_column_min ( const cpl_table *  table,
const char *  name 
)

Get minimum value in a numerical column.

Parameters
tablePointer to table.
nameColumn name.
Returns
Minimum value. See documentation of cpl_table_get_column_mean().

See the description of the function cpl_table_get_column_mean().

cpl_error_code cpl_table_get_column_minpos ( const cpl_table *  table,
const char *  name,
cpl_size row 
)

Get position of minimum in a numerical column.

Parameters
tablePointer to table.
nameColumn name.
rowReturned position of minimum value.
Returns
See function cpl_table_get_column_maxpos().

See the description of the function cpl_table_get_column_maxpos().

const char* cpl_table_get_column_name ( const cpl_table *  table)

Get table columns names.

Parameters
tablePointer to table.
Returns
Name of a table column.

If this function is not called with a NULL pointer the name of the first table column will be returned. Further calls made with a NULL pointer would return the next columns names, till the end of the list of columns when a NULL would be returned. This function only guarantees that all the table column names would be returned by subsequent calls to this function, but the order in which the column names are returned is undefined. The table structure must not be modified (e.g. by deleting, creating, moving, or renaming columns) between a sequence of calls to cpl_table_get_column_name() related to the same table, or this function behaviour will be undetermined. This function returns a pointer to the table column name, and not to its copy, therefore the pointed string shouldn't be deallocated or manipulated in any way. Its manipulation would directly affect the column name, while changing the column name using cpl_table_name_column() would turn it into garbage. Therefore, if a real copy of a column name is required, this function should be called as an argument of the function strdup().

Deprecated:
This function is deprecated, because its usage could create serious problems in case it is attempted to get names from different tables simultaneously. For instance, a programmer may call cpl_table_get_column_name() in a loop, and in the same loop call a CPL function that calls as well the same function. The behaviour in this case would be unpredictable. The function cpl_table_get_column_names() should be used instead.
cpl_array* cpl_table_get_column_names ( const cpl_table *  table)

Get table columns names.

Parameters
tablePointer to table.
Returns
Array of table columns names.

The returned CPL array of strings should be finally destroyed using cpl_array_delete().

double cpl_table_get_column_stdev ( const cpl_table *  table,
const char *  name 
)

Find the standard deviation of a table column.

Parameters
tablePointer to table.
nameColumn name.
Returns
Standard deviation. See documentation of cpl_table_get_column_mean().
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table, or it just contains invalid elements, or the table has length zero.
CPL_ERROR_INVALID_TYPE The specified column is not numerical.

Invalid column values are excluded from the computation of the standard deviation. If just one valid element is found, 0.0 is returned but no error is set. The table selection flags have no influence on the result.

cpl_type cpl_table_get_column_type ( const cpl_table *  table,
const char *  name 
)

Get the type of a table column.

Parameters
tablePointer to table.
nameColumn name.
Returns
Column type, or CPL_TYPE_INVALID in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

Get the type of a column.

const char* cpl_table_get_column_unit ( const cpl_table *  table,
const char *  name 
)

Get the unit of a table column.

Parameters
tablePointer to table.
nameColumn name.
Returns
Unit of column, or NULL if no unit can be returned.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

Return the unit of a column if present, otherwise a NULL pointer is returned. Note that the returned string is a pointer to the column unit, not its copy. Its manipulation will directly affect the column unit, while changing the column unit using cpl_column_set_unit() will turn it into garbage. Therefore it should be considered read-only, and if a real copy of a column unit is required, this function should be called as an argument of the function strdup().

double complex cpl_table_get_complex ( const cpl_table *  table,
const char *  name,
cpl_size  row,
int *  null 
)

Read a value from a complex column.

Parameters
tablePointer to table.
nameName of table column to be accessed.
rowPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Value read. In case of invalid table element, or in case of error, 0.0 is returned.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is not complex, or is a column of arrays.

Rows are counted starting from 0. The null flag is used to indicate whether the accessed table element is valid (0) or invalid (1). The null flag also signals an error condition (-1). The null argument can be left to NULL.

cpl_array** cpl_table_get_data_array ( cpl_table *  table,
const char *  name 
)

Get a pointer to array column data.

Parameters
tablePointer to table.
nameColumn name.
Returns
Pointer to column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type array.

A table column of type array includes an array of values of type cpl_array*. This function returns a pointer to this array.

Note
Use at your own risk: direct manipulation of column data rules out any check performed by the table object interface, and may introduce inconsistencies between the information maintained internally, and the actual column data and structure.
const cpl_array** cpl_table_get_data_array_const ( const cpl_table *  table,
const char *  name 
)

Get a pointer to array column data.

Parameters
tablePointer to table.
nameColumn name.
Returns
Pointer to column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type array.

A table column of type array includes an array of values of type cpl_array*. This function returns a pointer to this array.

double* cpl_table_get_data_double ( cpl_table *  table,
const char *  name 
)

Get a pointer to double column data.

Parameters
tablePointer to table.
nameColumn name.
Returns
Pointer to column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE.

A cpl_table column of type CPL_TYPE_DOUBLE includes an array of values of type double. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_double() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_double() for further details.

Note
Use at your own risk: direct manipulation of column data rules out any check performed by the table object interface, and may introduce inconsistencies between the information maintained internally, and the actual column data and structure.
double complex* cpl_table_get_data_double_complex ( cpl_table *  table,
const char *  name 
)

Get a pointer to double complex column data.

Parameters
tablePointer to table.
nameColumn name.
Returns
Pointer to column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX.

A cpl_table column of type CPL_TYPE_DOUBLE_COMPLEX includes an array of values of type double complex. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_double_complex() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_double_complex() for further details.

Note
Use at your own risk: direct manipulation of column data rules out any check performed by the table object interface, and may introduce inconsistencies between the information maintained internally, and the actual column data and structure.
const double complex* cpl_table_get_data_double_complex_const ( const cpl_table *  table,
const char *  name 
)

Get a pointer to constant double complex column data.

Parameters
tablePointer to constant table.
nameColumn name.
Returns
Pointer to constant column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX.

A cpl_table column of type CPL_TYPE_DOUBLE_COMPLEX includes an array of values of type double complex. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_double_complex() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_double_complex() for further details.

const double* cpl_table_get_data_double_const ( const cpl_table *  table,
const char *  name 
)

Get a pointer to constant double column data.

Parameters
tablePointer to constant table.
nameColumn name.
Returns
Pointer to constant column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE.

A cpl_table column of type CPL_TYPE_DOUBLE includes an array of values of type double. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_double() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_double() for further details.

float* cpl_table_get_data_float ( cpl_table *  table,
const char *  name 
)

Get a pointer to float column data.

Parameters
tablePointer to table.
nameColumn name.
Returns
Pointer to column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT.

A cpl_table column of type CPL_TYPE_FLOAT includes an array of values of type float. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_float() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_float() for further details.

Note
Use at your own risk: direct manipulation of column data rules out any check performed by the table object interface, and may introduce inconsistencies between the information maintained internally, and the actual column data and structure.
float complex* cpl_table_get_data_float_complex ( cpl_table *  table,
const char *  name 
)

Get a pointer to float complex column data.

Parameters
tablePointer to table.
nameColumn name.
Returns
Pointer to column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT_COMPLEX.

A cpl_table column of type CPL_TYPE_FLOAT_COMPLEX includes an array of values of type float complex. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_float_complex() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_float_complex() for further details.

Note
Use at your own risk: direct manipulation of column data rules out any check performed by the table object interface, and may introduce inconsistencies between the information maintained internally, and the actual column data and structure.
const float complex* cpl_table_get_data_float_complex_const ( const cpl_table *  table,
const char *  name 
)

Get a pointer to constant float complex column data.

Parameters
tablePointer to constant table.
nameColumn name.
Returns
Pointer to constant column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT_COMPLEX.

A cpl_table column of type CPL_TYPE_FLOAT_COMPLEX includes an array of values of type float complex. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_float_complex() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_float_complex() for further details.

const float* cpl_table_get_data_float_const ( const cpl_table *  table,
const char *  name 
)

Get a pointer to constant float column data.

Parameters
tablePointer to constant table.
nameColumn name.
Returns
Pointer to constant column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT.

A cpl_table column of type CPL_TYPE_FLOAT includes an array of values of type float. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_float() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_float() for further details.

int* cpl_table_get_data_int ( cpl_table *  table,
const char *  name 
)

Get a pointer to integer column data.

Parameters
tablePointer to table.
nameColumn name.
Returns
Pointer to column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_INT.

A cpl_table column of type CPL_TYPE_INT includes an array of values of type int. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_int() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_int() for further details.

Note
Use at your own risk: direct manipulation of column data rules out any check performed by the table object interface, and may introduce inconsistencies between the information maintained internally, and the actual column data and structure.
const int* cpl_table_get_data_int_const ( const cpl_table *  table,
const char *  name 
)

Get a pointer to constant integer column data.

Parameters
tablePointer to constant table.
nameColumn name.
Returns
Pointer to constant column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_INT.

A cpl_table column of type CPL_TYPE_INT includes an array of values of type int. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_int() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_int() for further details.

long* cpl_table_get_data_long ( cpl_table *  table,
const char *  name 
)

Get a pointer to long column data.

Parameters
tablePointer to table.
nameColumn name.
Returns
Pointer to column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG.

A cpl_table column of type CPL_TYPE_LONG includes an array of values of type long. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_long() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_long() for further details.

Note
Use at your own risk: direct manipulation of column data rules out any check performed by the table object interface, and may introduce inconsistencies between the information maintained internally, and the actual column data and structure.
const long* cpl_table_get_data_long_const ( const cpl_table *  table,
const char *  name 
)

Get a pointer to constant long column data.

Parameters
tablePointer to constant table.
nameColumn name.
Returns
Pointer to constant column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG.

A cpl_table column of type CPL_TYPE_LONG includes an array of values of type long. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_long() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_long() for further details.

long long* cpl_table_get_data_long_long ( cpl_table *  table,
const char *  name 
)

Get a pointer to long long column data.

Parameters
tablePointer to table.
nameColumn name.
Returns
Pointer to column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG_LONG.

A cpl_table column of type CPL_TYPE_LONG_LONG includes an array of values of type long long. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_long_long() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_long_long() for further details.

Note
Use at your own risk: direct manipulation of column data rules out any check performed by the table object interface, and may introduce inconsistencies between the information maintained internally, and the actual column data and structure.
const long long* cpl_table_get_data_long_long_const ( const cpl_table *  table,
const char *  name 
)

Get a pointer to constant long long column data.

Parameters
tablePointer to constant table.
nameColumn name.
Returns
Pointer to constant column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG_LONG.

A cpl_table column of type CPL_TYPE_LONG_LONG includes an array of values of type long long. This function returns a pointer to this array. The data buffer elements corresponding to invalid column elements would in general contain garbage. To avoid this, cpl_table_fill_invalid_long_long() should be called just before this function, assigning to all the invalid column elements an ad hoc numerical value. See the description of function cpl_table_fill_invalid_long_long() for further details.

char** cpl_table_get_data_string ( cpl_table *  table,
const char *  name 
)

Get a pointer to string column data.

Parameters
tablePointer to table.
nameColumn name.
Returns
Pointer to column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_STRING.

A table column of type CPL_TYPE_STRING includes an array of values of type char*. This function returns a pointer to this array.

Note
Use at your own risk: direct manipulation of column data rules out any check performed by the table object interface, and may introduce inconsistencies between the information maintained internally, and the actual column data and structure.
const char** cpl_table_get_data_string_const ( const cpl_table *  table,
const char *  name 
)

Get a pointer to constant string column data.

Parameters
tablePointer to constant table.
nameColumn name.
Returns
Pointer to constant column data, or NULL if the column has zero length, or in case of failure.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_STRING.

A table column of type CPL_TYPE_STRING includes an array of values of type char*. This function returns a pointer to this array.

double cpl_table_get_double ( const cpl_table *  table,
const char *  name,
cpl_size  row,
int *  null 
)

Read a value from a double column.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Double value read. In case of an invalid table element, or in case of error, 0.0 is always returned.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE.

Read a value from a column of type CPL_TYPE_DOUBLE. See the documentation of function cpl_table_get_int().

double complex cpl_table_get_double_complex ( const cpl_table *  table,
const char *  name,
cpl_size  row,
int *  null 
)

Read a value from a double complex column.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Double complex value read. In case of an invalid table element, or in case of error, 0.0 is always returned.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX.

Read a value from a column of type CPL_TYPE_DOUBLE_COMPLEX. See the documentation of function cpl_table_get_int().

float cpl_table_get_float ( const cpl_table *  table,
const char *  name,
cpl_size  row,
int *  null 
)

Read a value from a float column.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Float value read. In case of an invalid table element, or in case of error, 0.0 is always returned.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT.

Read a value from a column of type CPL_TYPE_FLOAT. See the documentation of function cpl_table_get_int().

float complex cpl_table_get_float_complex ( const cpl_table *  table,
const char *  name,
cpl_size  row,
int *  null 
)

Read a value from a float complex column.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Float complex value read. In case of an invalid table element, or in case of error, 0.0 is always returned.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT_COMPLEX.

Read a value from a column of type CPL_TYPE_FLOAT_COMPLEX. See the documentation of function cpl_table_get_int().

int cpl_table_get_int ( const cpl_table *  table,
const char *  name,
cpl_size  row,
int *  null 
)

Read a value from an integer column.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Integer value read. In case of an invalid table element, or in case of error, 0 is always returned.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_INT.

Read a value from a column of type CPL_TYPE_INT. If the null flag is a valid pointer, it is used to indicate whether the accessed column element is valid (0) or invalid (1). The null flag also signals an error condition (-1). The null flag pointer can also be NULL, and in that case this option will be disabled. Rows are counted starting from 0.

Note
For automatic conversion (always to type double), use the function cpl_table_get().
long cpl_table_get_long ( const cpl_table *  table,
const char *  name,
cpl_size  row,
int *  null 
)

Read a value from a long column.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Long integer value read. In case of an invalid table element, or in case of error, 0 is always returned.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG.

Read a value from a column of type CPL_TYPE_LONG. See the documentation of function cpl_table_get_int().

long long cpl_table_get_long_long ( const cpl_table *  table,
const char *  name,
cpl_size  row,
int *  null 
)

Read a value from a long long column.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition of element to be read.
nullFlag indicating null values, or error condition.
Returns
Long long integer value read. In case of an invalid table element, or in case of error, 0 is always returned.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG_LONG.

Read a value from a column of type CPL_TYPE_LONG_LONG. See the documentation of function cpl_table_get_int().

cpl_size cpl_table_get_ncol ( const cpl_table *  table)

Get the number of columns in a table.

Parameters
tablePointer to table to examine.
Returns
Number of columns in the table. If a NULL table pointer is passed, -1 is returned.
Errors
CPL_ERROR_NULL_INPUT table is a NULL pointer.

Get the number of columns in a table.

cpl_size cpl_table_get_nrow ( const cpl_table *  table)

Get the number of rows in a table.

Parameters
tablePointer to table to examine.
Returns
Number of rows in the table. If a NULL table pointer is passed, -1 is returned.
Errors
CPL_ERROR_NULL_INPUT table is a NULL pointer.

Get the number of rows in a table.

const char* cpl_table_get_string ( const cpl_table *  table,
const char *  name,
cpl_size  row 
)

Read a value from a string column.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition of element to be read.
Returns
Pointer to string. In case of an invalid column element, or in case of error, a NULL pointer is always returned.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_STRING.

Read a value from a column of type CPL_TYPE_STRING. Rows are counted starting from 0.

Note
The returned string is a pointer to a table element, not its copy. Its manipulation will directly affect that element, while changing that element using cpl_table_set_string() will turn it into garbage. Therefore, if a real copy of a string column element is required, this function should be called as an argument of the function strdup().
int cpl_table_has_column ( const cpl_table *  table,
const char *  name 
)

Check if a column with a given name exists.

Parameters
tablePointer to table.
nameName of table column.
Returns
1 if column exists, 0 if column doesn't exist, -1 in case of error.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.

Check if a column with a given name exists in the specified table.

int cpl_table_has_invalid ( const cpl_table *  table,
const char *  name 
)

Check if a column contains at least one invalid value.

Parameters
tablePointer to table.
nameName of table column to access.
Returns
1 if the column contains at least one invalid element, 0 if not, -1 in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

Check if there are invalid elements in a column. In case of columns of arrays, invalid values within an array are not considered: an invalid element here means that an array element is not allocated, i.e., it is a NULL pointer. In order to detect invalid elements within an array element, this element must be extracted using the function cpl_table_get_array(), and then use the function cpl_array_has_invalid().

int cpl_table_has_valid ( const cpl_table *  table,
const char *  name 
)

Check if a column contains at least one valid value.

Parameters
tablePointer to table.
nameName of table column to access.
Returns
1 if the column contains at least one valid value, 0 if not, -1 in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

Check if there are valid elements in a column. In case of columns of arrays, invalid values within an array are not considered: an invalid element here means that an array element is not allocated, i.e., it is a NULL pointer. In order to detect valid elements within an array element, this element must be extracted using the function cpl_table_get_array(), and then use the function cpl_array_has_valid().

cpl_error_code cpl_table_imag_column ( cpl_table *  table,
const char *  name 
)

Compute the imaginary part value of table column elements.

Parameters
tablePointer to table.
nameColumn name.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex.

Each column element is replaced by its imaginary party value only. Invalid elements are not modified by this operation. If the column is complex, its type will be turned to real (CPL_TYPE_FLOAT_COMPLEX will be changed into CPL_TYPE_FLOAT, and CPL_TYPE_DOUBLE_COMPLEX will be changed into CPL_TYPE_DOUBLE), and any pointer retrieved by calling cpl_table_get_data_float_complex(), cpl_table_get_data_double_complex(), etc., should be discarded.

cpl_error_code cpl_table_insert ( cpl_table *  target_table,
const cpl_table *  insert_table,
cpl_size  row 
)

Merge two tables.

Parameters
target_tableTarget table.
insert_tableTable to be inserted in the target table.
rowRow where to insert the insert table.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any input table is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE row is negative.
CPL_ERROR_INCOMPATIBLE_INPUT The input tables do not have the same structure.

The input tables must have the same structure, as defined by the function cpl_table_compare_structure() . Data from the insert_table are duplicated and inserted at the specified position of the target_table. If the specified row is not less than the target table length, the second table will be appended to the target table. The selection flags of the target table are always set back to "all selected". The pointers to column data in the target table may change, therefore pointers previously retrieved by calling cpl_table_get_data_int(), cpl_table_get_data_string(), etc., should be discarded.

cpl_error_code cpl_table_insert_window ( cpl_table *  table,
cpl_size  start,
cpl_size  count 
)

Insert a segment of rows into table data.

Parameters
tablePointer to table
startRow where to insert the segment.
countLength of the segment.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT table is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE start is negative.
CPL_ERROR_ILLEGAL_INPUT count is negative.

Insert a segment of empty rows, just containing invalid elements. Setting start to a number greater than the column length is legal, and has the effect of appending extra rows at the end of the table: this is equivalent to expanding the table using cpl_table_set_size(). The input column may also have zero length. The pointers to column data values may change, therefore pointers previously retrieved by calling cpl_table_get_data_int(), cpl_table_get_data_string(), etc., should be discarded. The table selection flags are set back to "all selected".

int cpl_table_is_selected ( const cpl_table *  table,
cpl_size  row 
)

Determine whether a table row is selected or not.

Parameters
tablePointer to table.
rowTable row to check.
Returns
1 if row is selected, 0 if it is not selected, -1 in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.

Check if a table row is selected.

int cpl_table_is_valid ( const cpl_table *  table,
const char *  name,
cpl_size  row 
)

Check if a column element is valid.

Parameters
tablePointer to table.
nameName of table column to access.
rowColumn element to examine.
Returns
1 if the column element is valid, 0 if invalid, -1 in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.

Check if a column element is valid.

cpl_table* cpl_table_load ( const char *  filename,
int  xtnum,
int  check_nulls 
)

Load a FITS table extension into a new cpl_table.

Parameters
filenameName of FITS file with at least one table extension.
xtnumNumber of extension to read, starting from 1.
check_nullsIf set to 0, identified invalid values are not marked.
Returns
New table, or NULL in case of failure.
Errors
CPL_ERROR_NULL_INPUT Input filename is a NULL pointer.
CPL_ERROR_FILE_NOT_FOUND A file named as specified in filename is not found.
CPL_ERROR_BAD_FILE_FORMAT The input file is not in FITS format.
CPL_ERROR_ILLEGAL_INPUT The specified FITS file extension is not a table, or, if it is a table, it has more than 9999 columns.
CPL_ERROR_ACCESS_OUT_OF_RANGE xtnum is greater than the number of FITS extensions in the FITS file, or is less than 1.
CPL_ERROR_DATA_NOT_FOUND The FITS table has no rows or no columns.
CPL_ERROR_UNSPECIFIED Generic error condition, that should be reported to the CPL Team.

The selected FITS file table extension is just read and converted into the cpl_table conventions.

cpl_table* cpl_table_load_window ( const char *  filename,
int  xtnum,
int  check_nulls,
const cpl_array *  selcol,
cpl_size  firstrow,
cpl_size  nrow 
)

Load part of a FITS table extension into a new cpl_table.

Parameters
filenameName of FITS file with at least one table extension.
xtnumNumber of extension to read, starting from 1.
check_nullsIf set to 0, identified invalid values are not marked.
selcolArray with the names of the columns to extract.
firstrowFirst table row to extract.
nrowNumber of rows to extract.
Returns
New table, or NULL in case of failure.
Errors
CPL_ERROR_NULL_INPUT Input filename is a NULL pointer.
CPL_ERROR_FILE_NOT_FOUND A file named as specified in filename is not found.
CPL_ERROR_BAD_FILE_FORMAT The input file is not in FITS format.
CPL_ERROR_ILLEGAL_INPUT The specified FITS file extension is not a table. Or the specified number of rows to extract is less than zero. Or the array of column names to extract contains empty fields.
CPL_ERROR_ACCESS_OUT_OF_RANGE xtnum is greater than the number of FITS extensions in the FITS file, or is less than 1. Or firstrow is either less than zero, or greater than the number of rows in the table.
CPL_ERROR_DATA_NOT_FOUND The FITS table has no columns. Or selcol includes columns that are not found in table.
CPL_ERROR_UNSPECIFIED Generic error condition, that should be reported to the CPL Team.

The selected FITS file table extension is just read in the specified columns and rows intervals, and converted into the cpl_table conventions. If selcol is NULL, all columns are selected.

cpl_error_code cpl_table_logarithm_column ( cpl_table *  table,
const char *  name,
double  base 
)

Compute the logarithm of column values.

Parameters
tablePointer to table.
nameTable column name.
baseLogarithm base.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex, or it is an array column.
CPL_ERROR_ILLEGAL_INPUT The input base is not positive.

Each column element is replaced by its logarithm in the specified base. The operation is always performed in double precision, with a final cast of the result to the target column type. Invalid elements are not modified by this operation, but zero or negative elements are invalidated by this operation. In case of complex numbers, values very close to the origin may cause an overflow. The imaginary part of the result is chosen in the interval [-pi/ln(base),pi/ln(base)], so it should be kept in mind that doing the logarithm of exponential of a complex number will not always express the phase angle with the same number. For instance, the exponential in base 2 of (5.00, 5.00) is (-30.33, -10.19), and the logarithm in base 2 of the latter will be expressed as (5.00, -4.06).

cpl_error_code cpl_table_move_column ( cpl_table *  to_table,
const char *  name,
cpl_table *  from_table 
)

Move a column from a table to another.

Parameters
to_tableTarget table.
nameName of column to move.
from_tableSource table.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT The input tables do not have the same number of rows.
CPL_ERROR_ILLEGAL_INPUT Source and target tables are the same table.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in the source table.
CPL_ERROR_ILLEGAL_OUTPUT A column with the same name already exists in the target table.

Move a column from a table to another.

cpl_error_code cpl_table_multiply_columns ( cpl_table *  table,
const char *  to_name,
const char *  from_name 
)

Multiply two numeric or complex table columns.

Parameters
tablePointer to table.
to_nameName of target column.
from_nameName of column to be multiplied with target column.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or any column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with any specified name is not found in table.
CPL_ERROR_INVALID_TYPE Any specified column is neither numerical nor complex, or it is an array column.

The columns are multiplied element by element, and the result of the multiplication is stored in the target column. See the documentation of the function cpl_table_add_columns() for further details.

cpl_error_code cpl_table_multiply_scalar ( cpl_table *  table,
const char *  name,
double  value 
)

Multiply a numerical or complex column by a constant.

Parameters
tablePointer to table.
nameColumn name.
valueMultiplication factor.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex, or it is an array column.

See the description of the function cpl_table_add_scalar().

cpl_error_code cpl_table_multiply_scalar_complex ( cpl_table *  table,
const char *  name,
double complex  value 
)

Multiply a numerical or complex column by a complex constant.

Parameters
tablePointer to table.
nameColumn name.
valueMultiplication factor.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex, or it is an array column.

See the description of the function cpl_table_add_scalar_complex().

cpl_error_code cpl_table_name_column ( cpl_table *  table,
const char *  from_name,
const char *  to_name 
)

Rename a table column.

Parameters
tablePointer to table.
from_nameName of table column to rename.
to_nameNew name of column.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the specified from_name is not found in table.
CPL_ERROR_ILLEGAL_OUTPUT A column with the specified to_name already exists in table.

This function is used to change the name of a column.

cpl_table* cpl_table_new ( cpl_size  length)

Create an empty table structure.

Parameters
lengthNumber of rows in table.
Returns
Pointer to new table, or NULL in case of error.
Errors
CPL_ERROR_ILLEGAL_INPUT The specified length is negative.

This function allocates and initialises memory for a table data container. A new table is created with no columns, but the size of the columns that will be created is defined in advance, to ensure that all columns will be created with the same length. All table rows are marked a priori as selected. This should be considered the normal status of a table, as long as no row selection has been applied to it.

cpl_error_code cpl_table_new_column ( cpl_table *  table,
const char *  name,
cpl_type  type 
)

Create an empty column in a table.

Parameters
tablePointer to table.
nameName of the new column.
typeType of the new column.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_INVALID_TYPE The specified type is not supported.
CPL_ERROR_ILLEGAL_OUTPUT A column with the same name already exists in table.

This function allocates memory for a new column of specified type, excluding array types (for creating a column of arrays use the function cpl_table_new_column_array(), where the column depth must also be specified). The new column name must be different from any other column name in the table. All the elements of the new column are marked as invalid.

cpl_error_code cpl_table_new_column_array ( cpl_table *  table,
const char *  name,
cpl_type  type,
cpl_size  depth 
)

Create an empty column of arrays in a table.

Parameters
tablePointer to table.
nameName of the new column.
typeType of the new column.
depthDepth of the new column.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_INVALID_TYPE The specified type is not supported.
CPL_ERROR_ILLEGAL_INPUT The specified depth is negative.
CPL_ERROR_ILLEGAL_OUTPUT A column with the same name already exists in table.

This function allocates memory for a new column of specified array type, (for creating a column of simple scalars or character strings use the function cpl_table_new_column() instead). It doesn't make any difference if a simple or an array type is specified, the corresponding array type will always be created (e.g., specifying a type CPL_TYPE_INT or a type CPL_TYPE_INT | CPL_TYPE_POINTER would always create a column of type CPL_TYPE_INT | CPL_TYPE_POINTER). The new column name must be different from any other column name in the table. All the elements of the new column are marked as invalid.

cpl_size cpl_table_not_selected ( cpl_table *  table)

Select unselected table rows, and unselect selected ones.

Parameters
tablePointer to table.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.

Select unselected table rows, and unselect selected ones.

cpl_size cpl_table_or_selected ( cpl_table *  table,
const char *  name1,
cpl_table_select_operator  operator,
const char *  name2 
)

Select from unselected table rows, by comparing the values of two numerical columns.

Parameters
tablePointer to table.
name1Name of first table column.
operatorRelational operator.
name2Name of second table column.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column names are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with any of the specified names is not found in table.
CPL_ERROR_INVALID_TYPE Invalid types for comparison.

Either both columns must be numerical, or they both must be strings. The comparison between strings is lexicographical. Comparison between complex types and array types are not supported.

Both columns must be numerical. For all the unselected table rows, the values of the specified columns are compared. The table rows fulfilling the comparison are selected. Invalid elements from either columns never fulfill any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, CPL_NOT_LESS_THAN. See also the function cpl_table_and_selected().

cpl_size cpl_table_or_selected_double ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
double  value 
)

Select from unselected table rows, by comparing double column values with a constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE.

For all the unselected table rows, the values of the specified column are compared with the reference value. The table rows fulfilling the comparison are selected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, and CPL_NOT_LESS_THAN. If the table has no rows, no error is set, and 0 is returned. See also the description of the function cpl_table_and_selected_double().

cpl_size cpl_table_or_selected_double_complex ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
double complex  value 
)

Select from unselected table rows, by comparing double complex column values with a complex constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX.
CPL_ERROR_ILLEGAL_INPUT Operator other than CPL_EQUAL_TO or CPL_NOT_EQUAL_TO was specified.

For all the unselected table rows, the values of the specified column are compared with the reference value. The table rows fulfilling the comparison are selected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO and CPL_NOT_EQUAL_TO. If the table has no rows, no error is set, and 0 is returned. See also the description of the function cpl_table_and_selected_double_complex().

cpl_size cpl_table_or_selected_float ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
float  value 
)

Select from unselected table rows, by comparing float column values with a constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT.

For all the unselected table rows, the values of the specified column are compared with the reference value. The table rows fulfilling the comparison are selected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, and CPL_NOT_LESS_THAN. If the table has no rows, no error is set, and 0 is returned. See also the description of the function cpl_table_and_selected_float().

cpl_size cpl_table_or_selected_float_complex ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
float complex  value 
)

Select from unselected table rows, by comparing float complex column values with a complex constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT_COMPLEX.
CPL_ERROR_ILLEGAL_INPUT Operator other than CPL_EQUAL_TO or CPL_NOT_EQUAL_TO was specified.

For all the unselected table rows, the values of the specified column are compared with the reference value. The table rows fulfilling the comparison are selected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO and CPL_NOT_EQUAL_TO. If the table has no rows, no error is set, and 0 is returned. See also the description of the function cpl_table_and_selected_float_complex().

cpl_size cpl_table_or_selected_int ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
int  value 
)

Select from unselected table rows, by comparing integer column values with a constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_INT.

For all the unselected table rows, the values of the specified column are compared with the reference value. The table rows fulfilling the comparison are selected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, and CPL_NOT_LESS_THAN. If the table has no rows, no error is set, and 0 is returned. See also the description of the function cpl_table_and_selected_int().

cpl_size cpl_table_or_selected_invalid ( cpl_table *  table,
const char *  name 
)

Select from unselected table rows all rows with an invalid value in a specified column.

Parameters
tablePointer to table.
nameColumn name.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.

For all the unselected table rows, all the rows containing invalid values at the specified column are selected. See also the function cpl_table_and_selected_invalid().

cpl_size cpl_table_or_selected_long ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
long  value 
)

Select from unselected table rows, by comparing long column values with a constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG.

For all the unselected table rows, the values of the specified column are compared with the reference value. The table rows fulfilling the comparison are selected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, and CPL_NOT_LESS_THAN. If the table has no rows, no error is set, and 0 is returned. See also the description of the function cpl_table_and_selected_long().

cpl_size cpl_table_or_selected_long_long ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
long long  value 
)

Select from unselected table rows, by comparing long long column values with a constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
valueReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG_LONG.

For all the unselected table rows, the values of the specified column are compared with the reference value. The table rows fulfilling the comparison are selected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, and CPL_NOT_LESS_THAN. If the table has no rows, no error is set, and 0 is returned. See also the description of the function cpl_table_and_selected_long_long().

cpl_size cpl_table_or_selected_string ( cpl_table *  table,
const char *  name,
cpl_table_select_operator  operator,
const char *  string 
)

Select from unselected table rows, by comparing column values with a constant.

Parameters
tablePointer to table.
nameColumn name.
operatorRelational operator.
stringReference value.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_STRING.
CPL_ERROR_ILLEGAL_INPUT Invalid regular expression.

For all the unselected table rows, the values of the specified column are compared with the reference value. The comparison function used is the C standard strcmp(), but in case the relational operators CPL_EQUAL_TO or CPL_NOT_EQUAL_TO are specified, the comparison string is treated as a regular expression. The table rows fulfilling the comparison are selected. An invalid element never fulfills any comparison by definition. Allowed relational operators are CPL_EQUAL_TO, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, and CPL_NOT_LESS_THAN. If the table has no rows, no error is set, and 0 is returned. See also the description of the function cpl_table_and_selected_string().

cpl_size cpl_table_or_selected_window ( cpl_table *  table,
cpl_size  start,
cpl_size  count 
)

Select from unselected rows only those within a table segment.

Parameters
tableTable to handle.
startFirst row of table segment.
countLength of segment.
Returns
Current number of selected rows, or a negative number in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.

All the unselected table rows that are within the specified interval are selected. If the sum of start and count goes beyond the end of the input table, rows are checked up to the end of the table. See also the function cpl_table_and_selected_window().

cpl_error_code cpl_table_power_column ( cpl_table *  table,
const char *  name,
double  exponent 
)

Compute the power of column values.

Parameters
tablePointer to table.
nameColumn name.
exponentConstant exponent.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex.

Each column element is replaced by its power to the specified exponent. The operation is always performed in double precision, with a final cast of the result to the target column type. Invalid elements are not modified by this operation, but elements are invalidated at any illegal operation: if the specified exponent is not negative, all column elements must be not negative, and if the specified exponent is negative, all column elements must be positive; column values not fulfilling this condition will be invalidated. Only in case of complex arrays this operation becomes legal. If the exponent is 0.0, then any (valid) column element would be assigned the value 1.0.

cpl_error_code cpl_table_real_column ( cpl_table *  table,
const char *  name 
)

Compute the real part value of table column elements.

Parameters
tablePointer to table.
nameColumn name.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex.

Each column element is replaced by its real party value only. Invalid elements are not modified by this operation. If the column is complex, its type will be turned to real (CPL_TYPE_FLOAT_COMPLEX will be changed into CPL_TYPE_FLOAT, and CPL_TYPE_DOUBLE_COMPLEX will be changed into CPL_TYPE_DOUBLE), and any pointer retrieved by calling cpl_table_get_data_float_complex(), cpl_table_get_data_double_complex(), etc., should be discarded.

cpl_error_code cpl_table_save ( const cpl_table *  table,
const cpl_propertylist pheader,
const cpl_propertylist header,
const char *  filename,
unsigned  mode 
)

Save a cpl_table to a FITS file.

Parameters
tableInput table.
pheaderPrimary header entries.
headerTable header entries.
filenameName of output FITS file.
modeOutput mode.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or filename are NULL pointers.
CPL_ERROR_UNSUPPORTED_MODE A saving mode other than CPL_IO_CREATE and CPL_IO_EXTEND was specified.
CPL_ERROR_FILE_NOT_FOUND While mode is set to CPL_IO_EXTEND, a file named as specified in filename is not found.
CPL_ERROR_BAD_FILE_FORMAT While mode is set to CPL_IO_EXTEND, the specified file is not in FITS format.
CPL_ERROR_FILE_NOT_CREATED The FITS file could not be created.
CPL_ERROR_FILE_IO The FITS file could only partially be created.
CPL_ERROR_UNSPECIFIED Generic error condition, that should be reported to the CPL Team.

This function can be used to convert a CPL table into a binary FITS table extension. If the mode is set to CPL_IO_CREATE, a new FITS file will be created containing an empty primary array, with just one FITS table extension. An existing (and writable) FITS file with the same name would be overwritten. If the mode flag is set to CPL_IO_EXTEND, a new table extension would be appended to an existing FITS file. Note that also in this case the file must be writable (and do not take for granted that a file is writable just because it was created by the same application, as this depends from the system umask). Two property lists may be passed to this function, both optionally. The first property list, pheader, is just used if the mode is set to CPL_IO_CREATE, and it is assumed to contain entries for the FITS file primary header. In pheader any property name related to the FITS convention, as SIMPLE, BITPIX, NAXIS, EXTEND, BLOCKED, and END, are ignored: such entries would be written anyway to the primary header and set to some standard values. If a NULL pheader is passed, the primary array would be created with just such entries, that are mandatory in any regular FITS file. The second property list, header, is assumed to contain entries for the FITS table extension header. In this property list any property name related to the FITS convention, as XTENSION, BITPIX, NAXIS, PCOUNT, GCOUNT, and END, and to the table structure, as TFIELDS, TTYPEi, TUNITi, TDISPi, TNULLi, TFORMi, would be ignored: such entries are always computed internally, to guarantee their consistency with the actual table structure. A DATE keyword containing the date of table creation in ISO8601 format is also added automatically.

Note
Invalid strings in columns of type CPL_TYPE_STRING are written to FITS as blanks. Invalid values in columns of type CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE will be written to the FITS file as a NaN. Invalid values in columns of type CPL_TYPE_INT and CPL_TYPE_LONG_LONG are the only ones that need a specific code to be explicitly assigned to them. This can be realised by calling the functions cpl_table_fill_invalid_int() and cpl_table_fill_invalid_long_long(), respectively, for each table column of type CPL_TYPE_INT and CPL_TYPE_LONG_LONG containing invalid values, just before saving the table to FITS. The numerical values identifying invalid integer column elements are written to the FITS keywords TNULLn (where n is the column sequence number). Beware that if valid column elements have the value identical to the chosen null-code, they will also be considered invalid in the FITS convention.
cpl_error_code cpl_table_select_all ( cpl_table *  table)

Select all table rows.

Parameters
tablePointer to table.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.

The table selection flags are reset, meaning that they are all marked as selected. This is the initial state of any table.

cpl_error_code cpl_table_select_row ( cpl_table *  table,
cpl_size  row 
)

Flag a table row as selected.

Parameters
tablePointer to table.
rowRow to select.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.

Flag a table row as selected. Any previous selection is kept.

cpl_error_code cpl_table_set ( cpl_table *  table,
const char *  name,
cpl_size  row,
double  value 
)

Write a value to a numerical table column element.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is not numerical, or it is of type array.

Write a value to a numerical column element. The value is cast to the accessed column type according to the C casting rules. The written value is automatically marked as valid. To invalidate a column value use cpl_table_set_invalid(). Table rows are counted starting from 0.

cpl_error_code cpl_table_set_array ( cpl_table *  table,
const char *  name,
cpl_size  row,
const cpl_array *  array 
)

Write an array to an array table column element.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition where to write the array.
arrayArray to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type array.
CPL_ERROR_INCOMPATIBLE_INPUT The size of the input array is different from the depth of the specified column.

Write an array to a table column of type array. The written value can also be a NULL pointer, that is equivalent to a call to cpl_table_set_invalid(). Note that the array is copied, therefore the original can be modified without affecting the table element. To "plug" an array directly into a table element, use the function cpl_table_get_data_array(). Beware that the "plugged" array must have the same type and depth declared for the column.

cpl_error_code cpl_table_set_column_depth ( cpl_table *  table,
const char *  name,
cpl_size  depth 
)

Modify depth of a column of arrays.

Parameters
tablePointer to table.
nameColumn name.
depthNew column depth.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any input argument is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The specified new depth is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_TYPE_MISMATCH The column with the specified name is not an array type.

This function is applicable just to columns of arrays. The contents of the arrays in the specified column will be unchanged up to the lesser of the new and old depths. If the depth is increased, the extra array elements would be flagged as invalid. The pointers to array data may change, therefore pointers previously retrieved by calling cpl_array_get_data_int(), cpl_array_get_data_string(), etc. should be discarded.

cpl_error_code cpl_table_set_column_dimensions ( cpl_table *  table,
const char *  name,
const cpl_array *  dimensions 
)

Set the dimensions of a table column of arrays.

Parameters
tablePointer to table.
nameColumn name.
dimensionsInteger array containing the sizes of the column dimensions
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_ILLEGAL_INPUT Either the specified column is not of type array, or the dimensions array contains invalid elements.
CPL_ERROR_TYPE_MISMATCH The dimensions array is not of type CPL_TYPE_INT.
CPL_ERROR_INCOMPATIBLE_INPUT The specified dimensions are incompatible with the total number of elements in the column arrays.

Set the number of dimensions of a column. If the dimensions array has size less than 2, nothing is done and no error is returned.

cpl_error_code cpl_table_set_column_format ( cpl_table *  table,
const char *  name,
const char *  format 
)

Give a new format to a table column.

Parameters
tablePointer to table.
nameColumn name.
formatNew format.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

The input format string is duplicated before being used as the column format. If format is a NULL pointer, "%%s" will be used if the column is of type CPL_TYPE_STRING, "% 1.5e" if the column is of type CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE, and "% 7d" if it is of type CPL_TYPE_INT. The format associated to a column has no effect on any operation performed on columns, and it is used just in the printf() calls made while printing a table using the function cpl_table_dump(). This information is lost after saving the table in FITS format using cpl_table_save().

cpl_error_code cpl_table_set_column_invalid ( cpl_table *  table,
const char *  name,
cpl_size  start,
cpl_size  count 
)

Invalidate a column segment.

Parameters
tablePointer to table.
nameName of table column to access.
startPosition where to begin invalidation.
countNumber of column elements to invalidate.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or start is outside the table boundaries.
CPL_ERROR_ILLEGAL_INPUT count is negative.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

All the column elements in the specified interval are invalidated. In the case of either a string or an array column, the corresponding strings or arrays are set free. If the sum of start and count exceeds the number of rows in the table, the column is invalidated up to its end.

cpl_error_code cpl_table_set_column_unit ( cpl_table *  table,
const char *  name,
const char *  unit 
)

Give a new unit to a table column.

Parameters
tablePointer to table.
nameColumn name.
unitNew unit.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

The input unit string is duplicated before being used as the column unit. If unit is a NULL pointer, the column will be unitless. The unit associated to a column has no effect on any operation performed on columns, and it must be considered just an optional description of the content of a column. It is however saved to a FITS file when using cpl_table_save().

cpl_error_code cpl_table_set_complex ( cpl_table *  table,
const char *  name,
cpl_size  row,
double complex  value 
)

Write a complex value to a complex numerical table column element.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is not complex, or it is of type array.

Write a value to a complex column element. The value is cast to the accessed column type according to the C casting rules. The written value is automatically marked as valid. To invalidate a column value use cpl_table_set_invalid(). Table rows are counted starting from 0.

cpl_error_code cpl_table_set_double ( cpl_table *  table,
const char *  name,
cpl_size  row,
double  value 
)

Write a value to a double table column element.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE.

Write a value to a table column of type CPL_TYPE_DOUBLE. The written value is automatically marked as valid. To invalidate a column value use cpl_table_set_invalid(). Table rows are counted starting from 0.

Note
For automatic conversion to the column type, use the function cpl_table_set().
cpl_error_code cpl_table_set_double_complex ( cpl_table *  table,
const char *  name,
cpl_size  row,
double complex  value 
)

Write a value to a double complex table column element.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX.

Write a value to a table column of type CPL_TYPE_DOUBLE_COMPLEX. The written value is automatically marked as valid. To invalidate a column value use cpl_table_set_invalid(). Table rows are counted starting from 0.

Note
For automatic conversion to the column type, use the function cpl_table_set_complex().
cpl_error_code cpl_table_set_float ( cpl_table *  table,
const char *  name,
cpl_size  row,
float  value 
)

Write a value to a float table column element.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT.

Write a value to a table column of type CPL_TYPE_FLOAT. The written value is automatically marked as valid. To invalidate a column value use cpl_table_set_invalid(). Table rows are counted starting from 0.

Note
For automatic conversion to the column type, use the function cpl_table_set().
cpl_error_code cpl_table_set_float_complex ( cpl_table *  table,
const char *  name,
cpl_size  row,
float complex  value 
)

Write a value to a float complex table column element.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_FLOAT_COMPLEX.

Write a value to a table column of type CPL_TYPE_FLOAT_COMPLEX. The written value is automatically marked as valid. To invalidate a column value use cpl_table_set_invalid(). Table rows are counted starting from 0.

Note
For automatic conversion to the column type, use the function cpl_table_set_complex().
cpl_error_code cpl_table_set_int ( cpl_table *  table,
const char *  name,
cpl_size  row,
int  value 
)

Write a value to an integer table column element.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_INT.

Write a value to a table column of type CPL_TYPE_INT. The written value is automatically marked as valid. To invalidate a column value use cpl_table_set_invalid(). Table rows are counted starting from 0.

Note
For automatic conversion to the column type, use the function cpl_table_set().
cpl_error_code cpl_table_set_invalid ( cpl_table *  table,
const char *  name,
cpl_size  row 
)

Flag a column element as invalid.

Parameters
tablePointer to table.
nameName of table column to access.
rowRow where to write a null.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.

In the case of either a string or an array column, the corresponding string or array is set free and its pointer is set to NULL. For other data types, the corresponding table element is flagged internally as invalid.

cpl_error_code cpl_table_set_long ( cpl_table *  table,
const char *  name,
cpl_size  row,
long  value 
)

Write a value to an long table column element.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG.

Write a value to a table column of type CPL_TYPE_LONG. The written value is automatically marked as valid. To invalidate a column value use cpl_table_set_invalid(). Table rows are counted starting from 0.

Note
For automatic conversion to the column type, use the function cpl_table_set().
cpl_error_code cpl_table_set_long_long ( cpl_table *  table,
const char *  name,
cpl_size  row,
long long  value 
)

Write a value to an long long table column element.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition where to write value.
valueValue to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_LONG_LONG.

Write a value to a table column of type CPL_TYPE_LONG_LONG. The written value is automatically marked as valid. To invalidate a column value use cpl_table_set_invalid(). Table rows are counted starting from 0.

Note
For automatic conversion to the column type, use the function cpl_table_set().
cpl_error_code cpl_table_set_size ( cpl_table *  table,
cpl_size  new_length 
)

Resize a table to a new number of rows.

Parameters
tablePointer to table.
new_lengthNew number of rows in table.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The specified new length is negative.

The contents of the columns will be unchanged up to the lesser of the new and old sizes. If the table is expanded, the extra table rows would just contain invalid elements. The table selection flags are set back to "all selected". The pointer to column data may change, therefore pointers previously retrieved by calling cpl_table_get_data_int(), cpl_table_get_data_string(), etc. should be discarded.

cpl_error_code cpl_table_set_string ( cpl_table *  table,
const char *  name,
cpl_size  row,
const char *  value 
)

Write a character string to a string table column element.

Parameters
tablePointer to table.
nameName of table column to access.
rowPosition where to write the character string.
valueCharacter string to write.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or name are NULL pointers.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_TYPE_MISMATCH The specified column is not of type CPL_TYPE_STRING.

Write a string to a table column of type CPL_TYPE_STRING. The written value can also be a NULL pointer, that is equivalent to a call to cpl_table_set_invalid(). Note that the character string is copied, therefore the original can be modified without affecting the table element. To "plug" a character string directly into a table element, use the function cpl_table_get_data_string().

cpl_error_code cpl_table_shift_column ( cpl_table *  table,
const char *  name,
cpl_size  shift 
)

Shift the position of numeric or complex column values.

Parameters
tablePointer to table.
nameName of table column to shift.
shiftShift column values by so many rows.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex.
CPL_ERROR_ILLEGAL_INPUT The absolute value of shift is greater than the column length.

The position of all column values is shifted by the specified amount. If shift is positive, all values will be moved toward the bottom of the column, otherwise toward its top. In either case as many column elements as the amount of the shift will be left undefined, either at the top or at the bottom of the column according to the direction of the shift. These column elements will be marked as invalid. This function is applicable just to numeric and complex columns, and not to strings and or array types. The selection flags are always set back to "all selected" after this operation.

cpl_error_code cpl_table_sort ( cpl_table *  table,
const cpl_propertylist reflist 
)

Sort table rows according to columns values.

Parameters
tablePointer to table.
reflistNames of reference columns with corresponding sorting mode.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or reflist are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND Any reference column specified in reflist is not found in table.
CPL_ERROR_ILLEGAL_INPUT The size of reflist exceeds the total number of columns in table, or reflist is empty.
CPL_ERROR_TYPE_MISMATCH The input reflist includes properties of type different from CPL_TYPE_BOOL.
CPL_ERROR_UNSUPPORTED_MODE Any reference column specified in reflist is of type array.

The table rows are sorted according to the values of the specified reference columns. The reference column names are listed in the input reflist, that associates to each reference column a boolean value. If the associated value is FALSE, the table is sorted according to the ascending values of the specified column, otherwise if the associated value is TRUE, the table is sorted according to the descending values of that column. The sorting will be performed by comparing the values of the first reference column; if the compared values are equal, the values from the next column in the list are compared, and so on till the end of the reference columns list. An invalid table element is always treated as if it doesn't fulfill any comparison, i.e., sorting either by increasing or decreasing column values would accumulate invalid elements toward the top of the table. The sorting is made in-place, therefore pointers to data retrieved with calls to cpl_table_get_data_<TYPE>() remain valid.

cpl_error_code cpl_table_subtract_columns ( cpl_table *  table,
const char *  to_name,
const char *  from_name 
)

Subtract two numeric or complex table columns.

Parameters
tablePointer to table.
to_nameName of target column.
from_nameName of column to be subtracted from target column.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or any column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with any specified name is not found in table.
CPL_ERROR_INVALID_TYPE Any specified column is neither numerical non complex, or it is an array column.

The columns are subtracted element by element, and the result of the subtraction is stored in the target column. See the documentation of the function cpl_table_add_columns() for further details.

cpl_error_code cpl_table_subtract_scalar ( cpl_table *  table,
const char *  name,
double  value 
)

Subtract a constant value from a numerical or complex column.

Parameters
tablePointer to table.
nameColumn name.
valueValue to subtract.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex, or it is an array column.

See the description of the function cpl_table_add_scalar().

cpl_error_code cpl_table_subtract_scalar_complex ( cpl_table *  table,
const char *  name,
double complex  value 
)

Subtract a constant complex value from a numerical or complex column.

Parameters
tablePointer to table.
nameColumn name.
valueValue to subtract.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table or column name are NULL pointers.
CPL_ERROR_DATA_NOT_FOUND A column with the specified name is not found in table.
CPL_ERROR_INVALID_TYPE The specified column is neither numerical nor complex, or it is an array column.

See the description of the function cpl_table_add_scalar_complex().

cpl_error_code cpl_table_unselect_all ( cpl_table *  table)

Unselect all table rows.

Parameters
tablePointer to table.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.

The table selection flags are all unset, meaning that no table rows are selected.

cpl_error_code cpl_table_unselect_row ( cpl_table *  table,
cpl_size  row 
)

Flag a table row as unselected.

Parameters
tablePointer to table.
rowRow to unselect.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.
CPL_ERROR_ACCESS_OUT_OF_RANGE The input table has zero length, or row is outside the table boundaries.

Flag a table row as unselected. Any previous selection is kept.

void* cpl_table_unwrap ( cpl_table *  table,
const char *  name 
)

Unwrap a table column.

Parameters
tablePointer to table.
nameName of the column.
Returns
Pointer to internal data buffer, NULL in case of error.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND A column with the given name is not found in table.
CPL_ERROR_UNSUPPORTED_MODE The column with the given name is a column of arrays.

This function deallocates all the memory associated to a table column, with the exception of its data buffer. This type of destructor should be used on columns created with the cpl_table_wrap_<type>() constructors, if the data buffer specified then was not allocated using the functions of the cpl_memory module. In such a case, the data buffer should be deallocated separately. See the documentation of the functions cpl_table_wrap_<type>().

Note
Columns of arrays cannot be unwrapped. Use the function cpl_table_get_data_array() to directly access the column data buffer.
cpl_array* cpl_table_where_selected ( const cpl_table *  table)

Get array of indexes to selected table rows.

Parameters
tablePointer to table.
Returns
Indexes to selected table rows, or NULL in case of error.
Errors
CPL_ERROR_NULL_INPUT Input table is a NULL pointer.

Get array of indexes to selected table rows. If no rows are selected, an array of size zero is returned. The returned array must be deleted using cpl_array_delete().

cpl_error_code cpl_table_wrap_double ( cpl_table *  table,
double *  data,
const char *  name 
)

Create in table a new double column obtained from existing data.

Parameters
tablePointer to table.
nameName of the new column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_ILLEGAL_OUTPUT A column with the same name already exists in table.

This function creates a new column of type CPL_TYPE_DOUBLE that will encapsulate the given data. See the description of cpl_table_wrap_int() for further details.

cpl_error_code cpl_table_wrap_double_complex ( cpl_table *  table,
double complex *  data,
const char *  name 
)

Create in table a new double complex column from existing data.

Parameters
tablePointer to table.
nameName of the new column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_ILLEGAL_OUTPUT A column with the same name already exists in table.

This function creates a new column of type CPL_TYPE_FLOAT_COMPLEX that will encapsulate the given data. See the description of cpl_table_wrap_int() for further details.

cpl_error_code cpl_table_wrap_float ( cpl_table *  table,
float *  data,
const char *  name 
)

Create in table a new float column obtained from existing data.

Parameters
tablePointer to table.
nameName of the new column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_ILLEGAL_OUTPUT A column with the same name already exists in table.

This function creates a new column of type CPL_TYPE_FLOAT that will encapsulate the given data. See the description of cpl_table_wrap_int() for further details.

cpl_error_code cpl_table_wrap_float_complex ( cpl_table *  table,
float complex *  data,
const char *  name 
)

Create in table a new float complex column obtained from existing data.

Parameters
tablePointer to table.
nameName of the new column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_ILLEGAL_OUTPUT A column with the same name already exists in table.

This function creates a new column of type CPL_TYPE_FLOAT_COMPLEX that will encapsulate the given data. See the description of cpl_table_wrap_int() for further details.

cpl_error_code cpl_table_wrap_int ( cpl_table *  table,
int *  data,
const char *  name 
)

Create in table a new integer column obtained from existing data.

Parameters
tablePointer to table where to create the new column.
nameName of the new column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_ILLEGAL_OUTPUT A column with the same name already exists in table.

This function creates a new column of type CPL_TYPE_INT that will encapsulate the given data. The size of the input data array is not checked in any way, and it is expected to match the number of rows assigned to the given table. The pointed data values are all taken as valid: invalid values should be marked using the functions cpl_table_set_invalid() and cpl_table_set_column_invalid(). The data buffer is not copied, so it should not be deallocated while the table column is still in use: the functions cpl_table_erase_column() or cpl_table_delete() would take care of deallocating it. To avoid problems with the memory managment, the specified data buffer should have been allocated using the functions of the cpl_memory module, and statically allocated data should be avoided too. If this is not possible, then the function cpl_table_unwrap() should be used on that column before destroying the table that contains it.

cpl_error_code cpl_table_wrap_long ( cpl_table *  table,
long *  data,
const char *  name 
)

Create in table a new long column obtained from existing data.

Parameters
tablePointer to table.
nameName of the new column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_ILLEGAL_OUTPUT A column with the same name already exists in table.

This function creates a new column of type CPL_TYPE_LONG that will encapsulate the given data. See the description of cpl_table_wrap_int() for further details.

cpl_error_code cpl_table_wrap_long_long ( cpl_table *  table,
long long *  data,
const char *  name 
)

Create in table a new long long column obtained from existing data.

Parameters
tablePointer to table.
nameName of the new column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_ILLEGAL_OUTPUT A column with the same name already exists in table.

This function creates a new column of type CPL_TYPE_LONG_LONG that will encapsulate the given data. See the description of cpl_table_wrap_int() for further details.

cpl_error_code cpl_table_wrap_string ( cpl_table *  table,
char **  data,
const char *  name 
)

Create in table a new string column obtained from existing data.

Parameters
tablePointer to table.
nameName of the new column.
dataExisting data buffer.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT Any argument is a NULL pointer.
CPL_ERROR_ILLEGAL_OUTPUT A column with the same name already exists in table.

This function creates a new column of type CPL_TYPE_STRING that will encapsulate the given data. See the description of cpl_table_wrap_int() for further details, especially with regard to memory managment. In the specific case of string columns the described restrictions applies also to the single column elements (strings). To deallocate specific column elements the functions cpl_table_set_invalid() and cpl_table_set_column_invalid() should be used.

cpl-6.4.1/html/group__cpl__photom.html0000644000460300003120000001670412310333015014721 00000000000000 Common Pipeline Library Reference Manual: High-level functions that are photometry related
Common Pipeline Library Reference Manual  6.4.1
High-level functions that are photometry related

Functions

cpl_error_code cpl_photom_fill_blackbody (cpl_vector *spectrum, cpl_unit out_unit, const cpl_vector *evalpoints, cpl_unit in_unit, double temp)
 The Planck radiance from a black-body.
 

Detailed Description

Synopsis:
#include "cpl_photom.h"

Function Documentation

cpl_error_code cpl_photom_fill_blackbody ( cpl_vector *  spectrum,
cpl_unit  out_unit,
const cpl_vector *  evalpoints,
cpl_unit  in_unit,
double  temp 
)

The Planck radiance from a black-body.

Parameters
spectrumPreallocated, the computed radiance
out_unitCPL_UNIT_PHOTONRADIANCE, CPL_UNIT_ENERGYRADIANCE or CPL_UNIT_LESS
evalpointsThe evaluation points (wavelengths or frequencies)
in_unitCPL_UNIT_LENGTH or CPL_UNIT_FREQUENCY
tempThe black body temperature [K]
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_

The Planck black-body radiance can be computed in 5 different ways: As a radiance of either energy [J*radian/s/m^3] or photons [radian/s/m^3], and in terms of either wavelength [m] or frequency [1/s]. The fifth way is as a unit-less radiance in terms of wavelength, in which case the area under the planck curve is 1.

The dimension of the spectrum (energy or photons or unit-less, CPL_UNIT_LESS) is controlled by out_unit, and the dimension of the input (length or frequency) is controlled by in_unit.

evalpoints and spectrum must be of equal, positive length.

The input wavelengths/frequencies and the temperature must be positive.

The four different radiance formulas are: Rph1(l,T) = 2pi c/l^4/(exp(hc/klT)-1) Rph2(f,T) = 2pi f^2/c^2/(exp(hf/kT)-1) Re1(l,T) = 2pi hc^2/l^5/(exp(hc/klT)-1) = Rph1(l,T) * hc/l Re2(f,T) = 2pi hf^3/c^2/(exp(hf/kT)-1) = Rph2(f,T) * hf R1(l,T) = 15h^5c^5/(pi^4k^5l^5T^5/(exp(hc/klT)-1) = Rph1(l,T) * h^4c^3/(2pi^5k^5T^5)

where l is the wavelength, f is the frequency, T is the temperature, h is the Planck constant, k is the Boltzmann constant and c is the speed of light in vacuum.

When the radiance is computed in terms of wavelength, the radiance peaks at l_max = CPL_PHYS_Wien/temp. When the radiance is unit-less this maximum, R1(l_max,T), is approximately 3.2648. R1(l,T) integrated over l from 0 to infinity is 1.

A unit-less black-body radiance in terms of frequency may be added later, until then it is an error to combine CPL_UNIT_LESS and CPL_UNIT_FREQUENCY.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the size of evalpoints is different from the size of spectrum
  • CPL_ERROR_UNSUPPORTED_MODE if in_unit and out_unit are not as requested
  • CPL_ERROR_ILLEGAL_INPUT if temp or a wavelength is non-positive
cpl-6.4.1/html/form_7.png0000644000460300003120000000040512310333016012044 00000000000000‰PNG  IHDR8q¤d0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïtIDATxí ! '$\]Žÿÿ¶Tì²­¨Ô>a$Ç1VøÀ_¤°€o-zë¦kðIŽÕÚÍSY…z…¬Œ•Ì—£±¯ú€œ~W´]~uø34Ö9{d4@ŠŸ~ŒRĵ׬!¾º]ûñS€/8€_<goh°ºIEND®B`‚cpl-6.4.1/html/functions.html0000644000460300003120000001071212310333020013040 00000000000000 Common Pipeline Library Reference Manual: Class Members
Common Pipeline Library Reference Manual  6.4.1
Here is a list of all documented class members with links to the class documentation for each member:
cpl-6.4.1/html/ftv2blank.png0000644000460300003120000000012612310333014012542 00000000000000‰PNG  IHDRɪ|IDATxíݱðøScOx@ –¨y}IEND®B`‚cpl-6.4.1/html/bc_s.png0000644000460300003120000000124412310333014011561 00000000000000‰PNG  IHDR€_ kIDATxíËkQÆÏ¹É̤I&“¦mš&156*nÄ…”ܸR,4 +Hµ(U­b”ª1‚ŠˆJ.º(E·mßúhëJmKS'C›(‚èäÑ…¤ï &äÖþ ‡ïrÎåü3gö(z÷ýÒ&_9ó}’ÕŸ@‰mÚu ` Øh`ñ÷Ô¯  „ú&·ññ×Ù~“½—Üò‡ÎÝÑM4¸%‰3²§?Êêh)€ÿù™\ÄYi>Jb @gûßiÞˆú²Ñkg§ãê\è½­šEUæv+?E€î"pæÖÛB\ƒY&ðØó$vM+ê’Dn¼)}òþ:§Xoâ ƒ3ŠÚ¯'¯¿.‚fÁ0ìuŠ9òLýj€f6¸%«3Gf”Ô#Ôsm(,ùÃk*Ê’³Jª…¯¼JË¢o䆔¼u_~ °r]%%mnu]z°r5[ÍÆ°«Úò•Xeµ’†Iù<ÈèÐÅg@IÔÚÞàµë3‚:/<JÇ’ÐQ) ñ¹…tÚß÷(Mû\63éCgl!ýí;ÿ¸4Ùhâñ=÷Zë29­w’ÝÒ´·ˆV;ÊL3ƒj&7©·º½÷a!I†)ëë$-öÇÓú³›‹7tIV¾VàñÔübf¨8¡ÈƒB<﫵imnÿœÈ‡„ lߣù‡ÛD —#É5“­'Æ4?쬲øM’™›°»g¬‚|5Åçµ½GNdÓÐr|ô”Ã&„ì"7+'³@ 5‡G➑Džâɬ^;õã–.3Òr"ý_R³¿Â@²oI¾å$IEND®B`‚cpl-6.4.1/html/tab_s.png0000644000460300003120000000027012310333014011741 00000000000000‰PNG  IHDR$ÇÇ[IDATxíÝ ‚@@Ñ£?Q…¤"š¢%¦I‘—Šf–6[´HÃäQƒ<Þâõþ]ždr Í’s?ˆO=Ñññw'ÌF‡Ž íðö-~rÃ[œèŠ­ì¬mƒÖ¬ƒݯнŠÕF)Yº% §`nÌ,9B ™’©!ÑŒ\ý<Å#üîî•IEND®B`‚cpl-6.4.1/html/group__cpl__vector.html0000644000460300003120000036670012310333015014721 00000000000000 Common Pipeline Library Reference Manual: Vector
Common Pipeline Library Reference Manual  6.4.1
Vector

Functions

cpl_error_code cpl_vector_add (cpl_vector *v1, const cpl_vector *v2)
 Add a cpl_vector to another.
 
cpl_error_code cpl_vector_add_scalar (cpl_vector *v, double addend)
 Elementwise addition of a scalar to a vector.
 
cpl_error_code cpl_vector_convolve_symmetric (cpl_vector *smoothed, const cpl_vector *conv_kernel)
 Convolve a 1d-signal with a symmetric 1D-signal.
 
cpl_error_code cpl_vector_copy (cpl_vector *destination, const cpl_vector *source)
 This function copies contents of a vector into another vector.
 
cpl_size cpl_vector_correlate (cpl_vector *vxc, const cpl_vector *v1, const cpl_vector *v2)
 Cross-correlation of two vectors.
 
void cpl_vector_delete (cpl_vector *v)
 Delete a cpl_vector.
 
cpl_error_code cpl_vector_divide (cpl_vector *v1, const cpl_vector *v2)
 Divide two vectors element-wise.
 
cpl_error_code cpl_vector_divide_scalar (cpl_vector *v, double divisor)
 Elementwise division of a vector with a scalar.
 
void cpl_vector_dump (const cpl_vector *v, FILE *stream)
 Dump a cpl_vector as ASCII to a stream.
 
cpl_vector * cpl_vector_duplicate (const cpl_vector *v)
 This function duplicates an existing vector and allocates memory.
 
cpl_error_code cpl_vector_exponential (cpl_vector *v, double base)
 Compute the exponential of all vector elements.
 
cpl_vector * cpl_vector_extract (const cpl_vector *v, cpl_size istart, cpl_size istop, cpl_size istep)
 Extract a sub_vector from a vector.
 
cpl_error_code cpl_vector_fill (cpl_vector *v, double val)
 Fill a cpl_vector.
 
cpl_error_code cpl_vector_fill_kernel_profile (cpl_vector *profile, cpl_kernel type, double radius)
 Fill a vector with a kernel profile.
 
cpl_vector * cpl_vector_filter_lowpass_create (const cpl_vector *v, cpl_lowpass filter_type, cpl_size hw)
 Apply a low-pass filter to a cpl_vector.
 
cpl_vector * cpl_vector_filter_median_create (const cpl_vector *v, cpl_size hw)
 Apply a 1d median filter of given half-width to a cpl_vector.
 
cpl_size cpl_vector_find (const cpl_vector *sorted, double key)
 In a sorted vector find the element closest to the given value.
 
cpl_error_code cpl_vector_fit_gaussian (const cpl_vector *x, const cpl_vector *sigma_x, const cpl_vector *y, const cpl_vector *sigma_y, cpl_fit_mode fit_pars, double *x0, double *sigma, double *area, double *offset, double *mse, double *red_chisq, cpl_matrix **covariance)
 Apply a 1d gaussian fit.
 
double cpl_vector_get (const cpl_vector *in, cpl_size idx)
 Get an element of the vector.
 
double * cpl_vector_get_data (cpl_vector *in)
 Get a pointer to the data part of the vector.
 
const double * cpl_vector_get_data_const (const cpl_vector *in)
 Get a pointer to the data part of the vector.
 
double cpl_vector_get_max (const cpl_vector *v)
 Get the maximum of the cpl_vector.
 
double cpl_vector_get_mean (const cpl_vector *v)
 Compute the mean value of vector elements.
 
double cpl_vector_get_median (cpl_vector *v)
 Compute the median of the elements of a vector.
 
double cpl_vector_get_median_const (const cpl_vector *v)
 Compute the median of the elements of a vector.
 
double cpl_vector_get_min (const cpl_vector *v)
 Get the minimum of the cpl_vector.
 
cpl_size cpl_vector_get_size (const cpl_vector *in)
 Get the size of the vector.
 
double cpl_vector_get_stdev (const cpl_vector *v)
 Compute the bias-corrected standard deviation of a vectors elements.
 
double cpl_vector_get_sum (const cpl_vector *v)
 Get the sum of the elements of the cpl_vector.
 
cpl_vector * cpl_vector_load (const char *filename, cpl_size xtnum)
 Load a list of values from a FITS file.
 
cpl_error_code cpl_vector_logarithm (cpl_vector *v, double base)
 Compute the element-wise logarithm.
 
cpl_error_code cpl_vector_multiply (cpl_vector *v1, const cpl_vector *v2)
 Multiply two vectors component-wise.
 
cpl_error_code cpl_vector_multiply_scalar (cpl_vector *v, double factor)
 Elementwise multiplication of a vector with a scalar.
 
cpl_vector * cpl_vector_new (cpl_size n)
 Create a new cpl_vector.
 
cpl_vector * cpl_vector_new_lss_kernel (double slitw, double fwhm)
 Create Right Half of a symmetric smoothing kernel for LSS.
 
cpl_error_code cpl_vector_power (cpl_vector *v, double exponent)
 Compute the power of all vector elements.
 
double cpl_vector_product (const cpl_vector *v1, const cpl_vector *v2)
 Compute the vector dot product.
 
cpl_vector * cpl_vector_read (const char *filename)
 Read a list of values from an ASCII file and create a cpl_vector.
 
cpl_error_code cpl_vector_save (const cpl_vector *self, const char *filename, cpl_type type, const cpl_propertylist *pl, unsigned mode)
 Save a vector to a FITS file.
 
cpl_error_code cpl_vector_set (cpl_vector *in, cpl_size idx, double value)
 Set an element of the vector.
 
cpl_error_code cpl_vector_set_size (cpl_vector *in, cpl_size newsize)
 Resize the vector.
 
cpl_error_code cpl_vector_sort (cpl_vector *self, cpl_sort_direction dir)
 Sort a cpl_vector.
 
cpl_error_code cpl_vector_sqrt (cpl_vector *v)
 Compute the sqrt of a cpl_vector.
 
cpl_error_code cpl_vector_subtract (cpl_vector *v1, const cpl_vector *v2)
 Subtract a cpl_vector from another.
 
cpl_error_code cpl_vector_subtract_scalar (cpl_vector *v, double subtrahend)
 Elementwise subtraction of a scalar from a vector.
 
void * cpl_vector_unwrap (cpl_vector *v)
 Delete a cpl_vector except the data array.
 
cpl_vector * cpl_vector_wrap (cpl_size n, double *data)
 Create a cpl_vector from existing data.
 

Detailed Description

This module provides functions to handle cpl_vector.

A cpl_vector is an object containing a list of values (as doubles) and the (always positive) number of values. The functionalities provided here are simple ones like sorting, statistics, or simple operations. The cpl_bivector object is composed of two of these vectors.

Synopsis:
#include "cpl_vector.h"

Function Documentation

cpl_error_code cpl_vector_add ( cpl_vector *  v1,
const cpl_vector *  v2 
)

Add a cpl_vector to another.

Parameters
v1First cpl_vector (modified)
v2Second cpl_vector
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

The second vector is added to the first one. The input first vector is modified.

The input vectors must have the same size.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if v1 and v2 have different sizes
cpl_error_code cpl_vector_add_scalar ( cpl_vector *  v,
double  addend 
)

Elementwise addition of a scalar to a vector.

Parameters
vcpl_vector to modify
addendNumber to add
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Add a number to each element of the cpl_vector.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_vector_convolve_symmetric ( cpl_vector *  smoothed,
const cpl_vector *  conv_kernel 
)

Convolve a 1d-signal with a symmetric 1D-signal.

Parameters
smoothedPreallocated vector to be smoothed in place
conv_kernelVector with symmetric convolution function
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
Deprecated:
Unstable API, may change or disappear. Do not use in new code!
cpl_error_code cpl_vector_copy ( cpl_vector *  destination,
const cpl_vector *  source 
)

This function copies contents of a vector into another vector.

Parameters
destinationdestination cpl_vector
sourcesource cpl_vector
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_vector_set_size() if source and destination have different sizes.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_size cpl_vector_correlate ( cpl_vector *  vxc,
const cpl_vector *  v1,
const cpl_vector *  v2 
)

Cross-correlation of two vectors.

Parameters
vxcOdd-sized vector with the computed cross-correlations
v11st vector to correlate
v22nd vector to correlate
Returns
Index of maximum cross-correlation, or negative on error

vxc must have an odd number of elements, 2*half_search+1, where half_search is the half-size of the search domain.

The length of v2 may not exceed that of v1. If the difference in length between v1 and v2 is less than half_search then this difference must be even (if the difference is odd resampling of v2 may be useful).

The cross-correlation is computed with shifts ranging from -half_search to half_search.

On succesful return element i (starting with 0) of vxc contains the cross- correlation at offset i-half_search. On error vxc is unmodified.

The cross-correlation is in fact the dot-product of two unit-vectors and ranges therefore from -1 to 1.

The cross-correlation is, in absence of rounding errors, commutative only for equal-sized vectors, i.e. changing the order of v1 and v2 will move element j in vxc to 2*half_search - j and thus change the return value from i to 2*half_search - i.

If, in absence of rounding errors, more than one shift would give the maximum cross-correlation, rounding errors may cause any one of those shifts to be returned. If rounding errors have no effect the index corresponding to the shift with the smallest absolute value is returned (with preference given to the smaller of two indices that correspond to the same absolute shift).

If v1 is longer than v2, the first element in v1 used for the resulting cross-correlation is max(0,shift + (cpl_vector_get_size(v1)-cpl_vector_get_size(v2))/2).

Cross-correlation with half_search == 0 requires about 8n FLOPs, where n = cpl_vector_get_size(v2). Each increase of half_search by 1 requires about 4n FLOPs more, when all of v2's elements can be cross-correlated, otherwise the extra cost is about 4m, where m is the number of elements in v2 that can be cross-correlated, n - half_search <= m < n.

In case of error, the _cpl_error_code_ code is set, and the returned delta and cross-correlation is undefined.

Example of 1D-wavelength calibration (error handling omitted for brevity):

cpl_vector * model = my_model(dispersion);
cpl_vector * vxc = cpl_vector_new(1+2*maxshift);
const cpl_size shift = cpl_vector_correlate(vxc, model, observed) - maxshift;
cpl_error_code error = cpl_polynomial_shift_1d(dispersion, 0, (double)shift);
cpl_msg_info(cpl_func, "Shifted dispersion relation by %" CPL_SIZE_FORMAT
" pixels, shift);

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if v1 and v2 have different sizes or if vxc is not as requested
void cpl_vector_delete ( cpl_vector *  v)

Delete a cpl_vector.

Parameters
vcpl_vector to delete
Returns
void

If the vector v is NULL, nothing is done and no error is set.

cpl_error_code cpl_vector_divide ( cpl_vector *  v1,
const cpl_vector *  v2 
)

Divide two vectors element-wise.

Parameters
v1First cpl_vector
v2Second cpl_vector
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_vector_add()

If an element in v2 is zero v1 is not modified and CPL_ERROR_DIVISION_BY_ZERO is returned.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if v1 and v2 have different sizes
  • CPL_ERROR_DIVISION_BY_ZERO if a division by 0 would occur
cpl_error_code cpl_vector_divide_scalar ( cpl_vector *  v,
double  divisor 
)

Elementwise division of a vector with a scalar.

Parameters
vcpl_vector to modify
divisorNon-zero number to divide with
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Divide each element of the cpl_vector with a number.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_DIVISION_BY_ZERO if divisor is 0.0
void cpl_vector_dump ( const cpl_vector *  v,
FILE *  stream 
)

Dump a cpl_vector as ASCII to a stream.

Parameters
vInput cpl_vector to dump
streamOutput stream, accepts stdout or stderr
Returns
void

Each element is preceded by its index number (starting with 1!) and written on a single line.

Comment lines start with the hash character.

stream may be NULL in which case stdout is used.

Note
In principle a cpl_vector can be saved using cpl_vector_dump() and re-read using cpl_vector_read(). This will however introduce significant precision loss due to the limited accuracy of the ASCII representation.
cpl_vector* cpl_vector_duplicate ( const cpl_vector *  v)

This function duplicates an existing vector and allocates memory.

Parameters
vthe input cpl_vector
Returns
a newly allocated cpl_vector or NULL in case of an error

The returned object must be deallocated using cpl_vector_delete()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_vector_exponential ( cpl_vector *  v,
double  base 
)

Compute the exponential of all vector elements.

Parameters
vTarget cpl_vector.
baseExponential base.
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

If the base is zero all vector elements must be positive and if the base is negative all vector elements must be integer, otherwise a cpl_error_code is returned and the vector is unmodified.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT base and v are not as requested
  • CPL_ERROR_DIVISION_BY_ZERO if one of the v values is negative or 0
cpl_vector* cpl_vector_extract ( const cpl_vector *  v,
cpl_size  istart,
cpl_size  istop,
cpl_size  istep 
)

Extract a sub_vector from a vector.

Parameters
vInput cpl_vector
istartStart index (from 0 to number of elements - 1)
istopStop index (from 0 to number of elements - 1)
istepExtract every step element
Returns
A newly allocated cpl_vector or NULL in case of an error

The returned object must be deallocated using cpl_vector_delete()

FIXME: Currently istop must be greater than istart. FIXME: Currently istep must equal 1.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if istart, istop, istep are not as requested
cpl_error_code cpl_vector_fill ( cpl_vector *  v,
double  val 
)

Fill a cpl_vector.

Parameters
vcpl_vector to be filled with the value val
valValue used to fill the cpl_vector
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Input vector is modified

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_vector_fill_kernel_profile ( cpl_vector *  profile,
cpl_kernel  type,
double  radius 
)

Fill a vector with a kernel profile.

Parameters
profilecpl_vector to be filled
typeType of kernel profile
radiusRadius of the profile in pixels
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_image_get_interpolated

A number of predefined kernel profiles are available:

  • CPL_KERNEL_DEFAULT: default kernel, currently CPL_KERNEL_TANH
  • CPL_KERNEL_TANH: Hyperbolic tangent
  • CPL_KERNEL_SINC: Sinus cardinal
  • CPL_KERNEL_SINC2: Square sinus cardinal
  • CPL_KERNEL_LANCZOS: Lanczos2 kernel
  • CPL_KERNEL_HAMMING: Hamming kernel
  • CPL_KERNEL_HANN: Hann kernel
  • CPL_KERNEL_NEAREST: Nearest neighbor kernel (1 when dist < 0.5, else 0)

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if radius is non-positive, or in case of the CPL_KERNEL_TANH profile if the length of the profile exceeds 32768
cpl_vector* cpl_vector_filter_lowpass_create ( const cpl_vector *  v,
cpl_lowpass  filter_type,
cpl_size  hw 
)

Apply a low-pass filter to a cpl_vector.

Parameters
vcpl_vector
filter_typeType of filter to use
hwFilter half-width
Returns
Pointer to newly allocated cpl_vector or NULL in case of an error

This type of low-pass filtering consists in a convolution with a given kernel. The chosen filter type determines the kind of kernel to apply for convolution. Supported kernels are CPL_LOWPASS_LINEAR and CPL_LOWPASS_GAUSSIAN.

In the case of CPL_LOWPASS_GAUSSIAN, the gaussian sigma used is 1/sqrt(2). As this function is not meant to be general and cover all possible cases, this sigma is hardcoded and cannot be changed.

The returned smooth cpl_vector must be deallocated using cpl_vector_delete(). The returned signal has exactly as many samples as the input signal.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if filter_type is not supported or if hw is negative or bigger than half the vector v size
cpl_vector* cpl_vector_filter_median_create ( const cpl_vector *  v,
cpl_size  hw 
)

Apply a 1d median filter of given half-width to a cpl_vector.

Parameters
vcpl_vector
hwFilter half-width
Returns
Pointer to newly allocated cpl_vector or NULL in case of an error

This function applies a median smoothing to a cpl_vector and returns a newly allocated cpl_vector containing a median-smoothed version of the input. The returned cpl_vector has exactly as many samples as the input one. It must be deallocated using cpl_vector_delete(). For half-widths of 1,2,3,4, the filtering is optimised for speed.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT if hw is negative or bigger than half the vector v size
cpl_size cpl_vector_find ( const cpl_vector *  sorted,
double  key 
)

In a sorted vector find the element closest to the given value.

Parameters
sortedCPL vector sorted using CPL_SORT_ASCENDING
keyValue to find
Returns
The index that minimizes fabs(sorted[index] - key) or negative on error
See Also
cpl_vector_sort()

Bisection is used to find the element.

If two (neighboring) elements with different values both minimize fabs(sorted[index] - key) the index of the larger element is returned.

If the vector contains identical elements that minimize fabs(sorted[index] - key) then it is undefined which element has its index returned.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if two elements are found to not be sorted
cpl_error_code cpl_vector_fit_gaussian ( const cpl_vector *  x,
const cpl_vector *  sigma_x,
const cpl_vector *  y,
const cpl_vector *  sigma_y,
cpl_fit_mode  fit_pars,
double *  x0,
double *  sigma,
double *  area,
double *  offset,
double *  mse,
double *  red_chisq,
cpl_matrix **  covariance 
)

Apply a 1d gaussian fit.

Parameters
xPositions to fit
sigma_xUncertainty (one sigma, gaussian errors assumed) assosiated with x. Taking into account the uncertainty of the independent variable is currently unsupported, and this parameter must therefore be set to NULL.
yValues to fit
sigma_yUncertainty (one sigma, gaussian errors assumed) associated with y. If NULL, constant uncertainties are assumed.
fit_parsSpecifies which parameters participate in the fit (any other parameters will be held constant). Possible values are CPL_FIT_CENTROID, CPL_FIT_STDEV, CPL_FIT_AREA, CPL_FIT_OFFSET and any bitwise combination of these. As a shorthand for including all four parameters in the fit, use CPL_FIT_ALL.
x0(output) Center of best fit gaussian. If CPL_FIT_CENTROID is not set, this is also an input parameter.
sigma(output) Width of best fit gaussian. A positive number on success. If CPL_FIT_STDEV is not set, this is also an input parameter.
area(output) Area of gaussian. A positive number on succes. If CPL_FIT_AREA is not set, this is also an input parameter.
offset(output) Fitted background level. If CPL_FIT_OFFSET is not set, this is also an input parameter.
mse(output) If non-NULL, the mean squared error of the best fit is returned.
red_chisq(output) If non-NULL, the reduced chi square of the best fit is returned. This requires the noise vector to be specified.
covariance(output) If non-NULL, the formal covariance matrix of the best fit is returned. This requires sigma_y to be specified. The order of fit parameters in the covariance matrix is defined as (x0, sigma, area, offset), for example the (3,3) element of the matrix (counting from zero) is the variance of the fitted offset. The matrix must be deallocated by calling cpl_matrix_delete() . On error, NULL is returned.
Returns
CPL_ERROR_NONE iff okay

This function fits to the input vectors a 1d gaussian function of the form

f(x) = area / sqrt(2 pi sigma^2) * exp( -(x - x0)^2/(2 sigma^2)) + offset

(area > 0) by minimizing chi^2 using a Levenberg-Marquardt algorithm.

The values to fit are read from the input vector x. Optionally, a vector sigma_x (of same size as x) may be specified.

Optionally, the mean squared error, the reduced chi square and the covariance matrix of the best fit are computed . Set corresponding parameter to NULL to ignore.

If the covariance matrix is requested and successfully computed, the diagonal elements (the variances) are guaranteed to be positive.

Occasionally, the Levenberg-Marquardt algorithm fails to converge to a set of sensible parameters. In this case (and only in this case), a CPL_ERROR_CONTINUE is set. To allow the caller to recover from this particular error, the parameters x0, sigma, area and offset will on output contain estimates of the best fit parameters, specifically estimated as the median position, the median of the absolute residuals multiplied by 1.4828, the minimum flux value and the maximum flux difference multiplied by sqrt(2 pi sigma^2), respectively. In this case, mse, red_chisq and covariance are not computed. Note that the variance of x0 (the (0,0) element of the covariance matrix) in this case can be estimated by sigma^2 / area .

A CPL_ERROR_SINGULAR_MATRIX occurs if the covariance matrix cannot be computed. In that case all other output parameters are valid.

Current limitations

  • Taking into account the uncertainties of the independent variable is not supported.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if x, y, x0, sigma, area or offset is NULL.
  • CPL_ERROR_INVALID_TYPE if the specified fit_pars is not a bitwise combination of the allowed values (e.g. 0 or 1).
  • CPL_ERROR_UNSUPPORTED_MODE sigma_x is non-NULL.
  • CPL_ERROR_INCOMPATIBLE_INPUT if the sizes of any input vectors are different, or if the computation of reduced chi square or covariance is requested, but sigma_y is not provided.
  • CPL_ERROR_ILLEGAL_INPUT if any input noise values, sigma or area is non-positive, or if chi square computation is requested and there are less than 5 data points to fit.
  • CPL_ERROR_ILLEGAL_OUTPUT if memory allocation failed.
  • CPL_ERROR_CONTINUE if the fitting algorithm failed.
  • CPL_ERROR_SINGULAR_MATRIX if the covariance matrix could not be calculated.
double cpl_vector_get ( const cpl_vector *  in,
cpl_size  idx 
)

Get an element of the vector.

Parameters
inthe input vector
idxthe index of the element (0 to nelem-1)
Returns
The element value

In case of error, the _cpl_error_code_ code is set, and the returned double is undefined.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if idx is negative
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if idx is out of the vector bounds
double* cpl_vector_get_data ( cpl_vector *  in)

Get a pointer to the data part of the vector.

Parameters
inthe input vector
Returns
Pointer to the data or NULL in case of an error

The returned pointer refers to already allocated data.

Note
Use at your own risk: direct manipulation of vector data rules out any check performed by the vector object interface, and may introduce inconsistencies between the information maintained internally, and the actual vector data and structure.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
const double* cpl_vector_get_data_const ( const cpl_vector *  in)

Get a pointer to the data part of the vector.

Parameters
inthe input vector
Returns
Pointer to the data or NULL in case of an error
See Also
cpl_vector_get_data
double cpl_vector_get_max ( const cpl_vector *  v)

Get the maximum of the cpl_vector.

Parameters
vconst cpl_vector
Returns
the maximum value of the vector or undefined on error
See Also
cpl_vector_get_min()
double cpl_vector_get_mean ( const cpl_vector *  v)

Compute the mean value of vector elements.

Parameters
vInput const cpl_vector
Returns
Mean value of vector elements or undefined on error.
See Also
cpl_vector_get_min()
double cpl_vector_get_median ( cpl_vector *  v)

Compute the median of the elements of a vector.

Parameters
vInput cpl_vector
Returns
Median value of the vector elements or undefined on error.
See Also
cpl_vector_get_median_const()
Note
For efficiency reasons, this function modifies the order of the elements of the input vector.
double cpl_vector_get_median_const ( const cpl_vector *  v)

Compute the median of the elements of a vector.

Parameters
vInput const cpl_vector
Returns
Median value of the vector elements or undefined on error.
See Also
cpl_vector_get_min()

For a finite population or sample, the median is the middle value of an odd number of values (arranged in ascending order) or any value between the two middle values of an even number of values. The criteria used for an even number of values in the input array is to choose the mean between the two middle values. Note that in this case, the median might not be a value of the input array. Also, note that in the case of integer data types, the result will be converted to an integer. Consider to transform your int array to float if that is not the desired behavior.

double cpl_vector_get_min ( const cpl_vector *  v)

Get the minimum of the cpl_vector.

Parameters
vconst cpl_vector
Returns
The minimum value of the vector or undefined on error

In case of error, the _cpl_error_code_ code is set, and the returned double is undefined.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_size cpl_vector_get_size ( const cpl_vector *  in)

Get the size of the vector.

Parameters
inthe input vector
Returns
The size or -1 in case of an error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
double cpl_vector_get_stdev ( const cpl_vector *  v)

Compute the bias-corrected standard deviation of a vectors elements.

Parameters
vInput const cpl_vector
Returns
standard deviation of the elements or a negative number on error.
See Also
cpl_vector_get_min()

S(n-1) = sqrt((1/n-1) sum((xi-mean)^2) (i=1 -> n)

The length of v must be at least 2.

double cpl_vector_get_sum ( const cpl_vector *  v)

Get the sum of the elements of the cpl_vector.

Parameters
vconst cpl_vector
Returns
the sum of the elements of the vector or undefined on error
See Also
cpl_vector_get_min()
cpl_vector* cpl_vector_load ( const char *  filename,
cpl_size  xtnum 
)

Load a list of values from a FITS file.

Parameters
filenameName of the input file
xtnumExtension number in the file (0 for primary HDU)
Returns
1 newly allocated cpl_vector or NULL in case of an error
See Also
cpl_vector_save

This function loads a vector from a FITS file (NAXIS=1), using cfitsio. The returned image has to be deallocated with cpl_vector_delete().

'xtnum' specifies from which extension the vector should be loaded. This could be 0 for the main data section or any number between 1 and N, where N is the number of extensions present in the file.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the extension is not valid
  • CPL_ERROR_FILE_IO if the file cannot be read
  • CPL_ERROR_UNSUPPORTOED_MODE if the file is too large to be read
cpl_error_code cpl_vector_logarithm ( cpl_vector *  v,
double  base 
)

Compute the element-wise logarithm.

Parameters
vcpl_vector to modify.
baseLogarithm base.
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

The base and all the vector elements must be positive and the base must be different from 1, or a cpl_error_code will be returned and the vector will be left unmodified.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if base is negative or zero or if one of the vector values is negative or zero
  • CPL_ERROR_DIVISION_BY_ZERO if a division by zero occurs
cpl_error_code cpl_vector_multiply ( cpl_vector *  v1,
const cpl_vector *  v2 
)

Multiply two vectors component-wise.

Parameters
v1First cpl_vector
v2Second cpl_vector
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_vector_add()
cpl_error_code cpl_vector_multiply_scalar ( cpl_vector *  v,
double  factor 
)

Elementwise multiplication of a vector with a scalar.

Parameters
vcpl_vector to modify
factorNumber to multiply with
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Multiply each element of the cpl_vector with a number.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_vector* cpl_vector_new ( cpl_size  n)

Create a new cpl_vector.

Parameters
nNumber of element of the cpl_vector
Returns
1 newly allocated cpl_vector or NULL in case of an error

The returned object must be deallocated using cpl_vector_delete(). There is no default values assigned to the created object, they are undefined until they are set.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_ILLEGAL_INPUT if n is negative or zero
cpl_vector* cpl_vector_new_lss_kernel ( double  slitw,
double  fwhm 
)

Create Right Half of a symmetric smoothing kernel for LSS.

Parameters
slitwThe slit width [pixel]
fwhmThe spectral FWHM [pixel]
Returns
Right Half of (symmetric) smoothing vector
Deprecated:
Unstable API, may change or disappear. Do not use in new code!
cpl_error_code cpl_vector_power ( cpl_vector *  v,
double  exponent 
)

Compute the power of all vector elements.

Parameters
vTarget cpl_vector.
exponentConstant exponent.
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

If the exponent is negative all vector elements must be non-zero and if the exponent is non-integer all vector elements must be non-negative, otherwise a cpl_error_code is returned and the vector is unmodified.

Following the behaviour of C99 pow() function, this function sets 0^0 = 1.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if v and exponent are not as requested
  • CPL_ERROR_DIVISION_BY_ZERO if one of the v values is 0
double cpl_vector_product ( const cpl_vector *  v1,
const cpl_vector *  v2 
)

Compute the vector dot product.

Parameters
v1One vector
v2Another vector of the same size
Returns
The (non-negative) product or negative on error.

The same vector may be passed twice, in which case the square of its 2-norm is computed.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if v1 and v2 have different sizes
cpl_vector* cpl_vector_read ( const char *  filename)

Read a list of values from an ASCII file and create a cpl_vector.

Parameters
filenameName of the input ASCII file
Returns
1 newly allocated cpl_vector or NULL in case of an error
See Also
cpl_vector_dump

Parse an input ASCII file values and create a cpl_vector from it Lines beginning with a hash are ignored, blank lines also. In valid lines the value is preceeded by an integer, which is ignored.

The returned object must be deallocated using cpl_vector_delete()

In addition to normal files, FIFO (see man mknod) are also supported.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if the file cannot be read
  • CPL_ERROR_BAD_FILE_FORMAT if the file contains no valid lines
cpl_error_code cpl_vector_save ( const cpl_vector *  self,
const char *  filename,
cpl_type  type,
const cpl_propertylist pl,
unsigned  mode 
)

Save a vector to a FITS file.

Parameters
selfVector to write to disk or NULL
filenameName of the file to write
typeThe type used to represent the data in the file
plProperty list for the output header or NULL
modeThe desired output options (combined with bitwise or)
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

This function saves a vector to a FITS file (NAXIS=1), using cfitsio. If a property list is provided, it is written to the named file before the pixels are written. If the image is not provided, the created file will only contain the primary header. This can be useful to create multiple extension files.

The type used in the file can be one of: CPL_TYPE_UCHAR (8 bit unsigned), CPL_TYPE_SHORT (16 bit signed), CPL_TYPE_USHORT (16 bit unsigned), CPL_TYPE_INT (32 bit signed), CPL_TYPE_FLOAT (32 bit floating point), or CPL_TYPE_DOUBLE (64 bit floating point). Use CPL_TYPE_DOUBLE when no loss of information is required.

Supported output modes are CPL_IO_CREATE (create a new file) and CPL_IO_EXTEND (append to an existing file)

If you are in append mode, make sure that the file has writing permissions. You may have problems if you create a file in your application and append something to it with the umask set to 222. In this case, the file created by your application would not be writable, and the append would fail.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the type or the mode is not supported
  • CPL_ERROR_FILE_NOT_CREATED if the output file cannot be created
  • CPL_ERROR_FILE_IO if the data cannot be written to the file
  • CPL_ERROR_UNSUPPORTOED_MODE if the file is too large to be saved
cpl_error_code cpl_vector_set ( cpl_vector *  in,
cpl_size  idx,
double  value 
)

Set an element of the vector.

Parameters
inthe input vector
idxthe index of the element (0 to nelem-1)
valuethe value to set in the vector
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if idx is negative
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if idx is out of the vector bounds
cpl_error_code cpl_vector_set_size ( cpl_vector *  in,
cpl_size  newsize 
)

Resize the vector.

Parameters
inThe vector to be resized
newsizeThe new (positive) number of elements in the vector
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
Note
On succesful return the value of the elements of the vector is unchanged to the minimum of the old and new sizes; any newly allocated elements are undefined. The pointer to the vector data buffer may change, therefore pointers previously retrieved by calling cpl_vector_get_data() should be discarded. If the vector was created with cpl_vector_wrap() the argument pointer to that call should be discarded as well.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if newsize is negative or zero
cpl_error_code cpl_vector_sort ( cpl_vector *  self,
cpl_sort_direction  dir 
)

Sort a cpl_vector.

Parameters
selfcpl_vector to sort in place
dirCPL_SORT_ASCENDING or CPL_SORT_DESCENDING
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

The input cpl_vector is modified to sort its values in either ascending (CPL_SORT_ASCENDING) or descending (CPL_SORT_DESCENDING) order.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if dir is neither CPL_SORT_DESCENDING nor CPL_SORT_ASCENDING
cpl_error_code cpl_vector_sqrt ( cpl_vector *  v)

Compute the sqrt of a cpl_vector.

Parameters
vcpl_vector
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

The sqrt of the data is computed. The input cpl_vector is modified

If an element in v is negative v is not modified and CPL_ERROR_ILLEGAL_INPUT is returned.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if one of the vector values is negative
cpl_error_code cpl_vector_subtract ( cpl_vector *  v1,
const cpl_vector *  v2 
)

Subtract a cpl_vector from another.

Parameters
v1First cpl_vector (modified)
v2Second cpl_vector
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_vector_add()
cpl_error_code cpl_vector_subtract_scalar ( cpl_vector *  v,
double  subtrahend 
)

Elementwise subtraction of a scalar from a vector.

Parameters
vcpl_vector to modify
subtrahendNumber to subtract
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Subtract a number from each element of the cpl_vector.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
void* cpl_vector_unwrap ( cpl_vector *  v)

Delete a cpl_vector except the data array.

Parameters
vcpl_vector to delete
Returns
A pointer to the data array or NULL if the input is NULL.
Note
The data array must subsequently be deallocated. Failure to do so will result in a memory leak.
cpl_vector* cpl_vector_wrap ( cpl_size  n,
double *  data 
)

Create a cpl_vector from existing data.

Parameters
nNumber of elements in the vector
dataPointer to array of n doubles
Returns
1 newly allocated cpl_vector or NULL in case of an error

The returned object must be deallocated using cpl_vector_unwrap().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if n is negative or zero
cpl-6.4.1/html/form_6.png0000644000460300003120000000560412310333016012051 00000000000000‰PNG  IHDR†ˆ­cÓ0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ï óIDATxí]Û’ë,¯l@mÌû¿ínÉ8q2™½’Ì:|U(ätŒ,5’@·ðøm²Ô êோ:‘‰à—âj¯µ.^qp/tÞ"J~üà#ê^”ö 5ê(ÏÓÈp¢Qz(‰‰»Ä6±¬YrvR¹rŽH£– w=1½Š¬ö†¼@c¥¡kQé‘´-aa\{óÛ )sE6ÛîÜðnBÓ $l©(F#}¡‘Êp#£ˆôxó†‘^:’øF³Û;p¡p•±k‹ýSÕ UÏøæ{ps¸™VAÍÝР¸„zИøJ£wÆ?˜ê„»^$u$%>Ÿ+ %~K£-Za¥íæ|ІUÿ7¡ê…@UGçZkJ4ñTÚp3Wæ’¥v“aŒ¼†)÷ì·ê-dÄ®­^«& V«’4$ÑBÓÓÚXÍùB-þ< F ¡ÐЙFäõ°½¤dçB±'Ž)¹”.ëyñ—”AÓóû—ê<‰Ú|’ sÜÝ]7…¯ÊÕù.ó:Zx[~ ø™\*P/7ø|>ÿ-é—Ë›žÞÈð»DY8»_º¾¬-ÀËÞûtž’µ„Wh¸þ6õ;³3½B#Ë öÛÒÙþÄæGNcbÙšä%HKü(çÆ06:2¸ëe‰¼¿ß¢$ÜöÔàFÒBS'½ºzàÒm5 2b(¢ùšPõÂÂtü4Rn…ôïhð_Ûà%.¬³N».®’ƺ†Ðš©N¨znôÌ7ïD#·RÆÍQQeèöխјøJ£/ÎQmð1¡é¹Ò›ïiø0€›é 0w4ÖêY0¥‰™?ð•†.áŸà&T½Àípý{’æp3Y‹s'W ±3ÀÞ¥u×åÀ¡oRFõk Åc+L©AÓ ™ê­ƒ´ŸMJX‡× lç¬ '´hO ø kìU0ꑟïP_2PjÈ®/Sz¶6Lyÿä&)ð¶\¿t‹8ͪGÞ–å¨À`7:ü ‰G©Åßܬà#ðøü\úqñÔþ•E¨M»ÕO/BxBâÃ{¿²Ç±ãQþõ…}IŽ–¯K±tFÔIlq°×O,[“¼i¼¬sÎ yhÿ1¸ëe‰ìü.‚4^‰FŽõèDG‡ p#i¡©“^]=pé¶1Ñšñ„ª§¹ ÅÝùÊŸ{©ÎàfÖ„@;÷¾mðvÈ®}jâBá*i¬k­™ê„ªçFÏ|cN²>Ÿ†cä4z÷4ÊÐí«[£1ñ•F_œ£ÚàcBÓs¥sOê\˜œ¯4|˜ÀyF-ç»Óm[¬žäJ3à+¬Ô…‚›Põû^˜BtIÏuHšÀyêéÞîk#!vÆÉ»´±îº8ôMʨ¾Qc­¡xl…›6hz!ÓÊëx>)4XYÕ®s81bÑžðÖØ«`;Šþ€ú’bÔ9ÕTéI, QC®S“oËÕù“4âƒK¿êÑ€·e9²˜!ø•¤û’€K<*0jŠà#ðøü§¤Ï}·€¿'dáK«GË€?+ñá½Oçl— Cñ—h¬ßѨeû2bé™mObsˆƒ½~bÙšä%HãesnÈCûÁ]/KdçßoìÜOÓh_•G`çMZhê¤WW\º­öenuÖŒ'T½°°MíöBÑç=Tçp3iȧ©¶Û/qa‡ìÚ§&.®’ƺ†Ðš©N¨znô|)ÌLNÏFÑ‚êßÓ(C·¯nÆÄW}qŽjƒ MÏ•ná™Ô@Í{>Ìà<#ËyU õ™ÆZ5F¥‰™?ð•FÖ ÿ7¡ê6vs®ï"垆¤9œg#íá¢KÒÓÁƒu;ãä]ÚXw]ú&eTߨ±ÖP<¶ÂŠ4hz!Ó ·Dé/”è`wx"hï 1FÑžðÖØ«`;Šþ€ú’b<̹$Uz’†üÎ ¼oÁ©Å#)ð¶\?I#Îê”\c¸ªGÞ–åHo`†àWr©øm Œš"ø|>ÿ)éÇÅSÙ±àßÈÎb½´|ø£ÞûæÿE¹´Œ/½þšh“º½–àÊãû–×ß²”…—ÆO/BxBòCtÞZÕ‹è4|Щ[Õ';¹§Á‰=‚›«öÜÛ©G s>ýÿ€F)®ìs"¾Óí¨2&ö}â‹F=†NUí?MÏ5§mD£%¿B£ö1¶£«ÍËе¢Ðf/²ãjHî³EcBÕ#*«óÈ„±>ïi¤:€ól‘{pžj» ¸”¥¡e?±Rá*iô.R‹©NhzÛX™ Ý µž†QØœ§ÑØÐã 5?ñ•ƺ·ðáüUKÕœ{>5¿D£Ìà4 (Œ4¼Ø))I7Sš˜ù_iD¾Aâqš…# ú/†œ§›Àif~×è5ù5]>!-Â5‰¬)õ•yÞ±¬=ÖÑ|Û2òª[ª+÷aÐôB•¨o­XÓÏ&ÅUÉôÂhž dL²gÊî{õUó8öî铲[ˆnÕŸ¥u xG®Î_¼7jÎéØRLGK€w„gw–ž–ü¹Tàã–€Àÿ°¶·[]Öãâ‰ìõð§åñÅ wg^*ɼx‹À;’ò óÚ·ÑðA§nUŸ.8ÏV9±GpsÕžìúN=j¨s·/ü„F)®l"ž½:Œ*cbßW‘!¾ÐúC§j; é¹æBSçyˆ42yšFíclG+šž;kE¡Mö)9°¶*®†Ôé>[4&T=ÒÑFMe.D*ßÓHuçÙ"÷à<Õvp)-JCË~b¥ÂUÒè]¤SÐô¶±2AJƒùáâ“Ñ0 ,%×i46ô¸GCÍO|¥±™ª? êq©’@Eü†F*s8Í’E܃×5)‰¾èVÌü¯4Ôÿˆ›Ðô(ÜkRvà4ÝN3ó»F¯©E§lv)h®IdM©¯ñÀ²öXGómËÈ«n©®Ü‡AÓ U¢¾%¡^Ú}2)®J¦¸Íé÷GRv²gÊî{õUó8¦öî铲[`´K#,vx[®Î_½7/‡£¤£%À;³;Kï’høµH¸æ~&— |Ürà±xÑ áø?þ[zmÙj”IEND®B`‚cpl-6.4.1/html/ftv2mnode.png0000644000460300003120000000036612310333014012563 00000000000000‰PNG  IHDRɪ|½IDATxíÝ!NAÅñ¤‡à\ ÷à Um@`Ô5iÒ`ëh ‚ÅW7] b§ÝˆŠ&oföÍd¾YÔ4 üšcø ‡€´‹Åòù3v=¼]†§µ\B… I¿‹=B·™B¡®;¸k´µ W°ÍN@vyÍÑÖ4ãß÷]ÈâYìã§|M}]ÔÚx6a }ôdׇØYüú¨>¤||5?Ó>|žB"¡î'¡IEND®B`‚cpl-6.4.1/html/group__cpl__plugin.html0000644000460300003120000026577212310333015014724 00000000000000 Common Pipeline Library Reference Manual: Plugin Interface
Common Pipeline Library Reference Manual  6.4.1
Plugin Interface

The basic plugin interface definition. More...

Classes

struct  _cpl_plugin_
 The type representation of the generic plugin interface. More...
 

Macros

#define CPL_PLUGIN_API
 Plugin API version.
 

Typedefs

typedef struct _cpl_plugin_ cpl_plugin
 The plugin data type.
 
typedef enum _cpl_plugin_type_ cpl_plugin_type
 Data type used to store the plugin type code.
 

Enumerations

enum  _cpl_plugin_type_ {
  CPL_PLUGIN_TYPE_NONE = 0,
  CPL_PLUGIN_TYPE_RECIPE = 1 << 0,
  CPL_PLUGIN_TYPE_RECIPE_V2 = (1 << 1) | CPL_PLUGIN_TYPE_RECIPE
}
 Definition of plugin types. More...
 

Functions

cpl_error_code cpl_plugin_copy (cpl_plugin *self, const cpl_plugin *other)
 Copy a plugin.
 
void cpl_plugin_delete (cpl_plugin *self)
 Destroy a plugin.
 
void cpl_plugin_dump (const cpl_plugin *self, FILE *stream)
 Dump the plugin debugging information to the given stream.
 
unsigned int cpl_plugin_get_api (const cpl_plugin *self)
 Get the version number of the plugin interface implementation.
 
const char * cpl_plugin_get_author (const cpl_plugin *self)
 Get the name of the plugin author.
 
const char * cpl_plugin_get_copyright (const cpl_plugin *self)
 Get the license and copyright information of a plugin.
 
cpl_plugin_func cpl_plugin_get_deinit (const cpl_plugin *self)
 Get the cleanup handler of a plugin.
 
const char * cpl_plugin_get_description (const cpl_plugin *self)
 Get the detailed description of a plugin.
 
const char * cpl_plugin_get_email (const cpl_plugin *self)
 Get the contact information of a plugin.
 
cpl_plugin_func cpl_plugin_get_exec (const cpl_plugin *self)
 Get the execution handler of a plugin.
 
int cpl_plugin_get_info (cpl_pluginlist *cpl_plugin_list)
 Append the plugin information to the given list.
 
cpl_plugin_func cpl_plugin_get_init (const cpl_plugin *self)
 Get the initialisation handler of a plugin.
 
const char * cpl_plugin_get_name (const cpl_plugin *self)
 Get the name of a plugin.
 
const char * cpl_plugin_get_synopsis (const cpl_plugin *self)
 Get the short description of a plugin.
 
unsigned long cpl_plugin_get_type (const cpl_plugin *self)
 Get the type of a plugin.
 
char * cpl_plugin_get_type_string (const cpl_plugin *self)
 Get the type of a plugin as string.
 
unsigned long cpl_plugin_get_version (const cpl_plugin *self)
 Get the version number of a plugin.
 
char * cpl_plugin_get_version_string (const cpl_plugin *self)
 Get the version number of a plugin as a string.
 
cpl_error_code cpl_plugin_init (cpl_plugin *self, unsigned int api, unsigned long version, unsigned long type, const char *name, const char *synopsis, const char *description, const char *author, const char *email, const char *copyright, cpl_plugin_func create, cpl_plugin_func execute, cpl_plugin_func destroy)
 Initialise a plugin.
 
cpl_plugincpl_plugin_new (void)
 Create a new, empty plugin interface.
 
cpl_error_code cpl_plugin_set_api (cpl_plugin *self, unsigned int api)
 Set the plugin interface version number.
 
cpl_error_code cpl_plugin_set_author (cpl_plugin *self, const char *author)
 Set the name of the plugin author.
 
cpl_error_code cpl_plugin_set_copyright (cpl_plugin *self, const char *copyright)
 Set the license and copyright information of a plugin.
 
cpl_error_code cpl_plugin_set_deinit (cpl_plugin *self, cpl_plugin_func func)
 Set the cleanup handler of a plugin.
 
cpl_error_code cpl_plugin_set_description (cpl_plugin *self, const char *description)
 Set the detailed description of a plugin.
 
cpl_error_code cpl_plugin_set_email (cpl_plugin *self, const char *email)
 Set the contact information of a plugin.
 
cpl_error_code cpl_plugin_set_exec (cpl_plugin *self, cpl_plugin_func func)
 Set the execution handler of a plugin.
 
cpl_error_code cpl_plugin_set_init (cpl_plugin *self, cpl_plugin_func func)
 Set the initialisation handler of a plugin.
 
cpl_error_code cpl_plugin_set_name (cpl_plugin *self, const char *name)
 Set the name of a plugin.
 
cpl_error_code cpl_plugin_set_synopsis (cpl_plugin *self, const char *synopsis)
 Set the short description of a plugin.
 
cpl_error_code cpl_plugin_set_type (cpl_plugin *self, unsigned long type)
 Set the type of a plugin.
 
int cpl_plugin_set_version (cpl_plugin *self, unsigned long version)
 Set the version number of a plugin.
 

Detailed Description

The basic plugin interface definition.

This module defines the basic plugin interface. The plugin interface provides the possibility to dynamically load and execute software modules. The basic plugin interface defined here serves as `superclass' for context specific plugins. All context specific plugins inherit this basic plugin interface. A plugin context is represented by a type code, i.e. the different plugin contexts are represented as different plugin types.

Most of the time an application using the plugin interface is dealing only with this basic, plugin type independent part of the interface. It provides the application with the necessary information about a particular plugin implementation and the services to initialise, execute and cleanup a dynamically loaded module.

In this way plugin type specific details may remain hidden from the application until the plugin type and its implementation details are known through querying the basic plugin interface part.

To obtain a filled plugin interface structure the application will call the function cpl_plugin_get_info(), which has the following prototype:

#include <cpl_pluginlist.h>

For each plugin library (a shared object library containing one or more plugins) this function must be implemented by the plugin developer. Its purpose is to fill a plugin interface structure for each plugin the plugin library contains and add it to a list provided by the application. This list of plugin interfaces provides the application with all the details on how to communicate with a particular plugin.

As an example on how to create a context specific plugin, i.e. how to create a new plugin type, you may have a look at Recipes.

Synopsis:
#include <cpl_plugin.h>

Macro Definition Documentation

#define CPL_PLUGIN_API

Plugin API version.

Typedef Documentation

typedef struct _cpl_plugin_ cpl_plugin

The plugin data type.

This defines the (public) plugin data type.

Data type used to store the plugin type code.

Enumeration Type Documentation

Definition of plugin types.

Predefined plugin types supported by the Common Pipeline Library itself.

Enumerator:
CPL_PLUGIN_TYPE_NONE 

Plugin is of unknown or undefined type

CPL_PLUGIN_TYPE_RECIPE 

Plugin is a complete data reduction task, i.e. a sequence of individual data reduction steps, turning a raw frame into a `final' product.

CPL_PLUGIN_TYPE_RECIPE_V2 

Plugin is a recipe, i.e. a complete data reduction task. In addition, this recipe version provides extra data about the required input data. This plugin is a subclass of CPL_PLUGIN_TYPE_RECIPE.

Function Documentation

cpl_error_code cpl_plugin_copy ( cpl_plugin self,
const cpl_plugin other 
)

Copy a plugin.

Parameters
selfA plugin.
otherThe plugin structure to copy.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or other is a NULL pointer.

The function copies all members of the plugin other to the plugin self. The plugin other and its copy self do not share any resources after the copy operation. If either self, or other are invalid pointers, the function returns immediately.

Note that the plugins self and other do not need to be of the same kind (see below).

Attention
If a derived plugin (a cpl_recipe for instance) is passed to this function, after casting it to its base, a cpl_plugin this function most likely will not work as expected, since data slicing will happen. The function is only aware of the cpl_plugin part of the derived plugin and only these data members are copied. Any additional data members defined by the derived plugin are therefore lost, unless they are copied explicitly.

The should be used function as follows. If necessary, create the target plugin using the appropriate constructor, or allocate a memory block of the appropriate size to hold the derived plugin type. Use this function to copy the cpl_plugin part of your derived plugin. Copy additional data members of the target plugin explicitely.

void cpl_plugin_delete ( cpl_plugin self)

Destroy a plugin.

Parameters
selfThe plugin to destroy.
Returns
Nothing.

The function destroys a plugin. First, the memory used by the members of the cpl_plugin type is released and then the plugin itself is destroyed.

Attention
The function may also be used to destroy plugins which have been derived from the cpl_plugin type. But if the derived plugin type defines members which are dynamically allocated, they have to be destroyed explicitly before (in the plugin's cleanup handler for instance) the derived plugin is passed to this function, or the references to these memory blocks have to be kept and cleaned up later. Otherwise memory leaks may result. If the plugin self is NULL, nothing is done and no error is set.
void cpl_plugin_dump ( const cpl_plugin self,
FILE *  stream 
)

Dump the plugin debugging information to the given stream.

Parameters
selfThe plugin.
streamThe output stream to use.
Returns
Nothing.

The function dumps the contents of of the plugin self to the output stream stream. If stream is NULL the function writes to the standard output. If self is NULL the function does nothing.

unsigned int cpl_plugin_get_api ( const cpl_plugin self)

Get the version number of the plugin interface implementation.

Parameters
selfA plugin.
Returns
The version number of the plugin interface implementation the plugin self complies with. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function returns the plugin interface version number, i.e. the version number describing the layout of the plugin data type itself. Valid version numbers are always greater or equal to 1.

const char* cpl_plugin_get_author ( const cpl_plugin self)

Get the name of the plugin author.

Parameters
selfA plugin.
Returns
The function returns a pointer to the plugin author's name string. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function returns a reference to the name of the author of the plugin self. The plugin author's name must not be modified using the returned pointer. The appropriate method should be used instead!

const char* cpl_plugin_get_copyright ( const cpl_plugin self)

Get the license and copyright information of a plugin.

Parameters
selfA plugin.
Returns
The function returns a pointer to the plugin's copyright information string. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function returns a reference to the license and copyright information of the plugin self. The copyright information must not be modified using the returned pointer. The appropriate method should be used instead!

cpl_plugin_func cpl_plugin_get_deinit ( const cpl_plugin self)

Get the cleanup handler of a plugin.

Parameters
selfA plugin.
Returns
The plugin's cleanup handler. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the cleanup handler of the plugin self.

const char* cpl_plugin_get_description ( const cpl_plugin self)

Get the detailed description of a plugin.

Parameters
selfA plugin.
Returns
The function returns a pointer to the plugin's detailed description. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function returns a reference to the detailed description (a description of the algorithm for instance) of the plugin self. The plugin's description must not be modified using this pointer. Use the appropriate method instead!

const char* cpl_plugin_get_email ( const cpl_plugin self)

Get the contact information of a plugin.

Parameters
selfA plugin.
Returns
The function returns a pointer to the plugin author's contact information string. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function returns a reference to the e-mail address of the author of the plugin self. The plugin author's e-mail address must not be modified using the returned pointer. The appropriate method should be used instead!

cpl_plugin_func cpl_plugin_get_exec ( const cpl_plugin self)

Get the execution handler of a plugin.

Parameters
selfA plugin.
Returns
The plugin's execution function. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the execution function of the plugin self.

int cpl_plugin_get_info ( cpl_pluginlist cpl_plugin_list)

Append the plugin information to the given list.

Parameters
cpl_plugin_listA plugin list.
Returns
The function must return 0 on success and 1 in case of an error.

This function must be implemented by plugin developers. There must be one such implementation per plugin library, regardless of how many plugins the library actually offers, provided that there is at least one plugin implemented in this library.

This prototype is only provided in order to allow the compiler to do some basic checks when compiling a plugin library. To have the prototype available when you are compiling your plugin library, you must add the line

#include <cpl_plugininfo.h>

to your plugin source file.

The purpose of this function is to create a plugin object for each plugin implementation provided by the plugin library, fill the basic plugin interface (the cpl_plugin part of the created plugin object) and append the created object to the plugin list list.

The list will be provided by the application which is going to use the plugin and it may be expected that list points to a valid plugin list when this function is called.

cpl_plugin_func cpl_plugin_get_init ( const cpl_plugin self)

Get the initialisation handler of a plugin.

Parameters
selfA plugin.
Returns
The plugin's initalization function. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the initalisation function of the plugin self.

const char* cpl_plugin_get_name ( const cpl_plugin self)

Get the name of a plugin.

Parameters
selfA plugin.
Returns
The function returns a pointer to the plugin's unique name string. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function returns a reference to the unique name of the plugin self. The plugin's name must not be modified using the returned pointer. The appropriate method should be used instead.

const char* cpl_plugin_get_synopsis ( const cpl_plugin self)

Get the short description of a plugin.

Parameters
selfA plugin.
Returns
The function returns a pointer to the plugin's short description. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function returns a reference to the short description (its purpose for instance) of the plugin self. The plugin's short description must not be modified using this pointer. Use the appropriate method instead!

unsigned long cpl_plugin_get_type ( const cpl_plugin self)

Get the type of a plugin.

Parameters
selfA plugin.
Returns
The function returns the plugin type code. If an error occurs the function returns CPL_PLUGIN_TYPE_NONE and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function returns the type (cf. cpl_plugin_type) of the plugin self.

char* cpl_plugin_get_type_string ( const cpl_plugin self)

Get the type of a plugin as string.

Parameters
selfA plugin.
Returns
The function returns the string representation of the plugin type. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function returns the plugin type of self as a string. The type string is placed into a newly allocated buffer. This buffer must be deallocated using cpl_free() by the caller if it is no longer needed.

unsigned long cpl_plugin_get_version ( const cpl_plugin self)

Get the version number of a plugin.

Parameters
selfA plugin.
Returns
The plugin's version number. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function returns the version number of the plugin self.

char* cpl_plugin_get_version_string ( const cpl_plugin self)

Get the version number of a plugin as a string.

Parameters
selfA plugin.
Returns
The string representation of the plugin's version number. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function returns the version number of the plugin self as a string. The function assumes that the integer representation of the plugin version can be decoded into a version string of the usual form: "major.minor.micro"

The resulting string is placed in a newly allocated buffer. This buffer must be deallocated using cpl_free() by the caller if it is no longer needed.

cpl_error_code cpl_plugin_init ( cpl_plugin self,
unsigned int  api,
unsigned long  version,
unsigned long  type,
const char *  name,
const char *  synopsis,
const char *  description,
const char *  author,
const char *  email,
const char *  copyright,
cpl_plugin_func  create,
cpl_plugin_func  execute,
cpl_plugin_func  destroy 
)

Initialise a plugin.

Parameters
selfThe plugin to initialise.
apiThe plugin interface version number.
versionThe plugin's version number.
typeThe plugin's type.
nameThe plugin's unique name.
synopsisThe plugin's short description (purpose, synopsis ...).
descriptionThe plugin's detailed description.
authorThe plugin's author name.
emailThe plugin author's e-mail address.
copyrightThe plugin's copyright and licensing information.
createThe function used to create the plugin.
executeThe function used to execute the plugin.
destroyThe function used to destroy the plugin.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function fills the cpl_plugin part of a plugin structure. For information on which information is required and which is optional please refer to the documentation of the plugin structure cpl_plugin.

If self is not a valid pointer, the function returns immediately.

cpl_plugin* cpl_plugin_new ( void  )

Create a new, empty plugin interface.

Returns
The pointer to a newly allocated plugin or NULL if it could not be created.

The function allocates memory for a cpl_plugin and initialises it. The function returns a handle for the newly created plugin interface object. The created plugin interface must be destroyed using the plugin interface destructor cpl_plugin_delete().

cpl_error_code cpl_plugin_set_api ( cpl_plugin self,
unsigned int  api 
)

Set the plugin interface version number.

Parameters
selfA plugin
apiThe plugin interface version to set.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function sets the version number of the plugin interface of the plugin self to the version api.

Attention
The plugin interface version describes the internal layout of the plugin interface. It should be used by an application to decide whether a particular plugin can be used or not, i.e. if the plugin interface supported by the application is compatible with the interface presented by the plugin itself.
cpl_error_code cpl_plugin_set_author ( cpl_plugin self,
const char *  author 
)

Set the name of the plugin author.

Parameters
selfA plugin
authorThe name of the plugin author.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or author is a NULL pointer.

This function copies the plugin author's name from the string author to the plugin self.

cpl_error_code cpl_plugin_set_copyright ( cpl_plugin self,
const char *  copyright 
)

Set the license and copyright information of a plugin.

Parameters
selfA plugin.
copyrightThe plugin's license information.
Note
The license information must be compatible with that of CPL.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or copyright is a NULL pointer.

This function copies the plugin's license information from the string copyright to the plugin self.

cpl_error_code cpl_plugin_set_deinit ( cpl_plugin self,
cpl_plugin_func  func 
)

Set the cleanup handler of a plugin.

Parameters
selfA plugin
funcThe plugin's cleanup handler.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function installs the function func as the cleanup handler of the plugin self. The registered function is called after the plugin has been executed to release any acquired resources.

cpl_error_code cpl_plugin_set_description ( cpl_plugin self,
const char *  description 
)

Set the detailed description of a plugin.

Parameters
selfA plugin.
descriptionThe plugin's detailed description, or NULL.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function copies the detailed description text from the string description to the plugin self. The C formatting characters '\n' and '\t' may be embedded in the string description.

cpl_error_code cpl_plugin_set_email ( cpl_plugin self,
const char *  email 
)

Set the contact information of a plugin.

Parameters
selfA plugin.
emailThe plugin author's contact information.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
Returns
The function returns 0 on success, or a non-zero value otherwise. If self is not a valid pointer the function returns 1.

This function copies the plugin author contact information from the string email to the plugin self.

cpl_error_code cpl_plugin_set_exec ( cpl_plugin self,
cpl_plugin_func  func 
)

Set the execution handler of a plugin.

Parameters
selfA plugin.
funcThe plugin's execution function.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function installs the function func as the execution function of the plugin self. The registered function must be called by an application after the plugin's initialisation function was called. Calling the registered function executes the plugin.

cpl_error_code cpl_plugin_set_init ( cpl_plugin self,
cpl_plugin_func  func 
)

Set the initialisation handler of a plugin.

Parameters
selfA plugin
funcThe plugin's initialisation function
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function installs the function func as the initialisation function of the plugin self. The registered function must be called by an application before the plugin is executed.

cpl_error_code cpl_plugin_set_name ( cpl_plugin self,
const char *  name 
)

Set the name of a plugin.

Parameters
selfA plugin.
nameThe plugin's unique name.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

This function assigns the name name to the plugin self.

Attention
Since plugins are selected through their name this name should be choosen carefully in order to avoid name clashes with other plugins.
cpl_error_code cpl_plugin_set_synopsis ( cpl_plugin self,
const char *  synopsis 
)

Set the short description of a plugin.

Parameters
selfA plugin.
synopsisThe plugin's synopsis, or NULL.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function copies the short description text from the string synopsis to the plugin self.

cpl_error_code cpl_plugin_set_type ( cpl_plugin self,
unsigned long  type 
)

Set the type of a plugin.

Parameters
selfA plugin.
typeThe plugin type to set.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function sets the type (cf. cpl_plugin_type) of the plugin self to type.

int cpl_plugin_set_version ( cpl_plugin self,
unsigned long  version 
)

Set the version number of a plugin.

Parameters
selfA plugin
versionThe plugin's version number to set.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

This function sets the version number of the plugin interface of the plugin self to the version api.

This function sets the version number of the plugin self to version.

cpl-6.4.1/html/group__cpl__parameter.html0000644000460300003120000044076512310333015015403 00000000000000 Common Pipeline Library Reference Manual: Parameters
Common Pipeline Library Reference Manual  6.4.1

Typedefs

typedef struct _cpl_parameter_ cpl_parameter
 The opaque parameter data type.
 
typedef enum _cpl_parameter_class_ cpl_parameter_class
 The parameter class data type.
 
typedef enum _cpl_parameter_mode_ cpl_parameter_mode
 The parameter mode data type.
 

Enumerations

enum  _cpl_parameter_class_ {
  CPL_PARAMETER_CLASS_INVALID,
  CPL_PARAMETER_CLASS_VALUE,
  CPL_PARAMETER_CLASS_RANGE,
  CPL_PARAMETER_CLASS_ENUM
}
 Supported parameter classes. More...
 
enum  _cpl_parameter_mode_ {
  CPL_PARAMETER_MODE_CLI,
  CPL_PARAMETER_MODE_ENV,
  CPL_PARAMETER_MODE_CFG
}
 Supported parameter modes. More...
 

Functions

void cpl_parameter_delete (cpl_parameter *self)
 Delete a parameter.
 
cpl_error_code cpl_parameter_disable (cpl_parameter *self, cpl_parameter_mode mode)
 Deactivate a parameter for the given mode.
 
void cpl_parameter_dump (const cpl_parameter *self, FILE *stream)
 Dump the parameter debugging information to the given stream.
 
cpl_parametercpl_parameter_duplicate (const cpl_parameter *self)
 Create a copy of a parameter.
 
cpl_error_code cpl_parameter_enable (cpl_parameter *self, cpl_parameter_mode mode)
 Activates a parameter for the given mode.
 
const char * cpl_parameter_get_alias (const cpl_parameter *self, cpl_parameter_mode mode)
 Get the parameter's alias name for the given mode.
 
int cpl_parameter_get_bool (const cpl_parameter *self)
 Get the value of the given boolean parameter.
 
cpl_parameter_class cpl_parameter_get_class (const cpl_parameter *self)
 Get the parameter's class.
 
const char * cpl_parameter_get_context (const cpl_parameter *self)
 Get the context of a parameter.
 
int cpl_parameter_get_default_bool (const cpl_parameter *self)
 Get the default value of the given boolean parameter.
 
double cpl_parameter_get_default_double (const cpl_parameter *self)
 Get the default value of the given double parameter.
 
int cpl_parameter_get_default_flag (const cpl_parameter *self)
 Get the presence status flag of the given parameter.
 
int cpl_parameter_get_default_int (const cpl_parameter *self)
 Get the default value of the given integer parameter.
 
const char * cpl_parameter_get_default_string (const cpl_parameter *self)
 Get the default value of the given string parameter.
 
double cpl_parameter_get_double (const cpl_parameter *self)
 Get the value of the given double parameter.
 
double cpl_parameter_get_enum_double (const cpl_parameter *self, int position)
 Get the possible values for a double enumeration.
 
int cpl_parameter_get_enum_int (const cpl_parameter *self, int position)
 Get the possible values for an integer enumeration.
 
int cpl_parameter_get_enum_size (const cpl_parameter *self)
 Get the number of alternatives of an enumeration parameter.
 
const char * cpl_parameter_get_enum_string (const cpl_parameter *self, int position)
 Get the possible values for a string enumeration.
 
const char * cpl_parameter_get_help (const cpl_parameter *self)
 Get the description of a parameter.
 
int cpl_parameter_get_id (const cpl_parameter *self)
 Get the numerical identifier of the given parameter.
 
int cpl_parameter_get_int (const cpl_parameter *self)
 Get the value of the given integer parameter.
 
const char * cpl_parameter_get_name (const cpl_parameter *self)
 Get the name of a parameter.
 
double cpl_parameter_get_range_max_double (const cpl_parameter *self)
 Get the maximum value of a double range parameter.
 
int cpl_parameter_get_range_max_int (const cpl_parameter *self)
 Get the maximum value of an integer range parameter.
 
double cpl_parameter_get_range_min_double (const cpl_parameter *self)
 Get the minimum value of a double range parameter.
 
int cpl_parameter_get_range_min_int (const cpl_parameter *self)
 Get the minimum value of an integer range parameter.
 
const char * cpl_parameter_get_string (const cpl_parameter *self)
 Get the value of the given string parameter.
 
const char * cpl_parameter_get_tag (const cpl_parameter *self)
 Get the parameter's user tag.
 
cpl_type cpl_parameter_get_type (const cpl_parameter *self)
 Get the parameter's value type.
 
int cpl_parameter_is_enabled (const cpl_parameter *self, cpl_parameter_mode mode)
 Get the parameter's activity status for the environment context.
 
cpl_parametercpl_parameter_new_enum (const char *name, cpl_type type, const char *description, const char *context,...)
 Create a new enumeration parameter.
 
cpl_parametercpl_parameter_new_range (const char *name, cpl_type type, const char *description, const char *context,...)
 Create a new range parameter.
 
cpl_parametercpl_parameter_new_value (const char *name, cpl_type type, const char *description, const char *context,...)
 Create a new value parameter.
 
cpl_error_code cpl_parameter_set_alias (cpl_parameter *self, cpl_parameter_mode mode, const char *alias)
 Set alias names for the given parameter.
 
cpl_error_code cpl_parameter_set_bool (cpl_parameter *self, int value)
 Assign a boolean value to a parameter.
 
cpl_error_code cpl_parameter_set_default_bool (cpl_parameter *self, int value)
 Modify the default value of a boolean parameter.
 
cpl_error_code cpl_parameter_set_default_double (cpl_parameter *self, double value)
 Modify the default value of a double parameter.
 
cpl_error_code cpl_parameter_set_default_flag (cpl_parameter *self, int status)
 Change the presence status flag of the given parameter.
 
cpl_error_code cpl_parameter_set_default_int (cpl_parameter *self, int value)
 Modify the default value of an integer parameter.
 
cpl_error_code cpl_parameter_set_default_string (cpl_parameter *self, const char *value)
 Modify the default value of a string parameter.
 
cpl_error_code cpl_parameter_set_double (cpl_parameter *self, double value)
 Assign a double value to a parameter.
 
cpl_error_code cpl_parameter_set_id (cpl_parameter *self, int id)
 Set the numerical identifier of the given parameter.
 
cpl_error_code cpl_parameter_set_int (cpl_parameter *self, int value)
 Assign an integer value to a parameter.
 
cpl_error_code cpl_parameter_set_string (cpl_parameter *self, const char *value)
 Assign a string value to a parameter.
 
cpl_error_code cpl_parameter_set_tag (cpl_parameter *self, const char *tag)
 Set the tag of the given parameter.
 

Detailed Description

This module implements a class of data types which can be used to manage context specific, named parameters. They provide a standard way to pass, for instance, command line information to different components of an application.

The fundamental parts of a parameter are its name, a context to which it belongs (a specific component of an application for instance), its current value and a default value.

The implementation supports three classes of parameters:

  • A plain value
  • A range of values
  • An enumeration value

When a parameter is created it is created for a particular value type. The type of a parameter's current and default value may be (cf. Type codes):

  • CPL_TYPE_BOOL
  • CPL_TYPE_INT
  • CPL_TYPE_DOUBLE
  • CPL_TYPE_STRING

When a value is assigned to a parameter, the different parameter classes behave differently. For a plain value, no checks are applied to the data value to be assigned. For a range or an enumeration, on the other hand, the value to be stored is validated with respect to the minimum and maximum value of the range and the list of enumeration alternatives respectively. If the value is invalid, an error is reported.

Note
The validation of parameter values is not yet implemented.

The functions to create a new parameter of a particular class are polymorphic and accept any value type mentioned above to initialise the parameter to create. This is accomplished by using a variable argument list. The number and type of the parameters expected by these functions is determined from the parameter class and the indicated value type.

The constructor of a plain value expects a single value, the parameter's default value, which must be of the appropriate type, as argument while the constructor for a range expects the default value, the minimum and the maximum value. The constructor for an enumeration expects as arguments the default value, the number of alternatives following and the list of alternatives. Note that the default value must be a member of the list of alternative enumeration values.

An example of how parameters of the different classes are created and destroyed is shown below:

cpl_parameter *enumeration;
...
"This is a plain value of type integer",
"Example",
-1);
"This is a value range of type double",
"Example",
0.5, 0.0, 1.0);
"This is an enumeration of type "
"string",
"Example",
"first", 3, "first", "second",
"third");
...
cpl_parameter_delete(value);
cpl_parameter_delete(enumeration);

After the parameter has been created and initialised the parameters current value equals its default value. The initialisation values are copied into the parameter, i.e. if an initialiser value resides in dynamically allocated memory, it can be deallocated after the parameter has been initialised without affecting the created parameter.

Note
A variable argument list allows only limited type checking. Therefore, code explicitly what you mean and double check the constructor calls that the number of arguments and the types of the elements of the variable argument list are what the constructor expects.
Synopsis:
#include <cpl_parameter.h>

Typedef Documentation

typedef struct _cpl_parameter_ cpl_parameter

The opaque parameter data type.

The parameter class data type.

The parameter mode data type.

Enumeration Type Documentation

Supported parameter classes.

Enumerator:
CPL_PARAMETER_CLASS_INVALID 

Parameter of undefined or invalid class.

CPL_PARAMETER_CLASS_VALUE 

Parameter representing a plain value.

CPL_PARAMETER_CLASS_RANGE 

Parameter representing a range of values.

CPL_PARAMETER_CLASS_ENUM 

Parameter representing an enumeration value.

Supported parameter modes.

The parameter mode is used to set or get context specific parameter attributes.

Enumerator:
CPL_PARAMETER_MODE_CLI 

Command line mode of the parameter.

CPL_PARAMETER_MODE_ENV 

Environment variable mode of the parameter.

CPL_PARAMETER_MODE_CFG 

Configuration file mode of the parameter.

Function Documentation

void cpl_parameter_delete ( cpl_parameter self)

Delete a parameter.

Parameters
selfThe parameter to delete.
Returns
Nothing.

The function deletes a parameter of any class and type. All memory resources acquired by the parameter during its usage are released. If the parameter self is NULL, nothing is done and no error is set.

cpl_error_code cpl_parameter_disable ( cpl_parameter self,
cpl_parameter_mode  mode 
)

Deactivate a parameter for the given mode.

Parameters
selfA parameter.
modeThe parameter mode.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter mode mode is not supported.

The function disables the parameter self for the given mode mode.

void cpl_parameter_dump ( const cpl_parameter self,
FILE *  stream 
)

Dump the parameter debugging information to the given stream.

Parameters
selfThe parameter.
streamThe output stream to use.
Returns
Nothing.

The function dumps the contents of of the parameter self to the output stream stream. If stream is NULL the function writes to the standard output. If self is NULL the function does nothing.

cpl_parameter* cpl_parameter_duplicate ( const cpl_parameter self)

Create a copy of a parameter.

Parameters
selfThe parameter to copy.
Returns
The copy of the given parameter, or NULL in case of an error. In the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns a copy of the parameter self. The copy is a deep copy, i.e. all parameter properties are copied.

cpl_error_code cpl_parameter_enable ( cpl_parameter self,
cpl_parameter_mode  mode 
)

Activates a parameter for the given mode.

Parameters
selfA parameter.
modeThe parameter mode.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter mode mode is not supported.

The function enables the parameter self for the given mode mode.

const char* cpl_parameter_get_alias ( const cpl_parameter self,
cpl_parameter_mode  mode 
)

Get the parameter's alias name for the given mode.

Parameters
selfA parameter.
modeThe parameter mode.
Returns
The function returns the parameter's context specific alias name. If no alias name was previously assigned the function returns NULL. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter mode mode is not supported.

The function retrieves the read-only alias name of the parameter self. The context for which an alias is retrieved is selected by the mode. The functions accepts the parameter modes CPL_PARAMETER_MODE_CFG, CPL_PARAMETER_MODE_CLI and CPL_PARAMETER_MODE_ENV.

See Also
cpl_parameter_mode
int cpl_parameter_get_bool ( const cpl_parameter self)

Get the value of the given boolean parameter.

Parameters
selfA boolean parameter.
Returns
The function returns the integer representation of the parameter's boolean value. TRUE is represented as non-zero value; whereas 0 indicates FALSE. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_BOOL.

The current boolean value of the parameter self is retrieved.

cpl_parameter_class cpl_parameter_get_class ( const cpl_parameter self)

Get the parameter's class.

Parameters
selfA parameter.
Returns
The function returns the parameter's class identifier. The function returns CPL_PARAMETER_CLASS_INVALID if self is not a valid parameter, but NULL. In this case an appropriate error code is also set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The class identifier of the parameter self is retrieved.

const char* cpl_parameter_get_context ( const cpl_parameter self)

Get the context of a parameter.

Parameters
selfA parameter.
Returns
The function returns the context of the parameter, or NULL if self is not a valid parameter but NULL. In the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the read-only context to which the parameter self belongs. The parameter's context must not be modified using the returned pointer.

int cpl_parameter_get_default_bool ( const cpl_parameter self)

Get the default value of the given boolean parameter.

Parameters
selfA boolean parameter.
Returns
The function returns the integer representation of the parameter's default boolean value. TRUE is represented as non-zero value; whereas 0 indicates FALSE. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_BOOL.

The current boolean default value of the parameter self is retrieved.

double cpl_parameter_get_default_double ( const cpl_parameter self)

Get the default value of the given double parameter.

Parameters
selfAn double parameter.
Returns
The function returns the parameter's default double value. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_DOUBLE.

The current double default value of the parameter self is retrieved.

int cpl_parameter_get_default_flag ( const cpl_parameter self)

Get the presence status flag of the given parameter.

Parameters
selfA parameter.
Returns
The function returns the current setting of the parameters presence flag. If the parameter is present the function returns 1 and 0 otherwise. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function indicates whether the given parameter self was seen by an application while processing the input from the command line, the environment and/or a configuration file. If the parameter was seen the application may set this status flag and query it later using this function.

See Also
cpl_parameter_set_default_flag()
int cpl_parameter_get_default_int ( const cpl_parameter self)

Get the default value of the given integer parameter.

Parameters
selfAn integer parameter.
Returns
The function returns the parameter's default integer value. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_INT.

The current integer default value of the parameter self is retrieved.

const char* cpl_parameter_get_default_string ( const cpl_parameter self)

Get the default value of the given string parameter.

Parameters
selfAn string parameter.
Returns
The function returns the parameter's default string value. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_STRING.

The current read-only string default value of the parameter self is retrieved. If self is not a valid pointer the error code CPL_ERROR_NULL_INPUT is set on return. Also, if the parameter self is not an string parameter, i.e. the parameter's type is different from CPL_TYPE_INT, the error code CPL_ERROR_TYPE_MISMATCH is set.

double cpl_parameter_get_double ( const cpl_parameter self)

Get the value of the given double parameter.

Parameters
selfAn double parameter.
Returns
The function returns the parameter's double value. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_INT.

The current double value of the parameter self is retrieved.

double cpl_parameter_get_enum_double ( const cpl_parameter self,
int  position 
)

Get the possible values for a double enumeration.

Parameters
selfAn enumeration parameter
positionPosition to look up in the list of possible values.
Returns
The double value at position position in the list of possible values of the enumeration self. In case of an error the function returns 0. and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The class of the parameter self is not of the kind CPL_PARAMETER_CLASS_ENUM, or self is not of type CPL_TYPE_DOUBLE.
CPL_ERROR_ACCESS_OUT_OF_RANGE The requested index position position is out of range.

The function retrieves the double value at position position from the list of enumeration values the parameter self can possibly take. For any valid enumeration parameter this list contains at leas one value. The possible values are counted starting from 0.

int cpl_parameter_get_enum_int ( const cpl_parameter self,
int  position 
)

Get the possible values for an integer enumeration.

Parameters
selfAn enumeration parameter
positionPosition to look up in the list of possible values.
Returns
The integer value at position position in the list of possible values of the enumeration self. In case of an error the function returns 0 and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The class of the parameter self is not of the kind CPL_PARAMETER_CLASS_ENUM, or self is not of type CPL_TYPE_INT.
CPL_ERROR_ACCESS_OUT_OF_RANGE The requested index position position is out of range.

The function retrieves the integer value at position position from the list of enumeration values the parameter self can possibly take. For any valid enumeration parameter this list contains at least one value. The possible values are counted starting from 0.

int cpl_parameter_get_enum_size ( const cpl_parameter self)

Get the number of alternatives of an enumeration parameter.

Parameters
selfAn enumeration parameter.
Returns
The number of possible values the parameter self can take, or 0 if self does not point to a valid parameter, or the parameter is not an enumeration parameter. In case of an error the function also sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The class of the parameter self is not of the kind CPL_PARAMETER_CLASS_ENUM.

The function retrieves the number of possible alternatives for an enumeration parameter, which is always greater or equal than 1.

const char* cpl_parameter_get_enum_string ( const cpl_parameter self,
int  position 
)

Get the possible values for a string enumeration.

Parameters
selfAn enumeration parameter
positionPosition to look up in the list of possible values.
Returns
The string value at position position in the list of possible values of the enumeration self. In case of an error the function returns NULL and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The class of the parameter self is not of the kind CPL_PARAMETER_CLASS_ENUM, or self is not of type CPL_TYPE_STRING.
CPL_ERROR_ACCESS_OUT_OF_RANGE The requested index position position is out of range.

The function retrieves the read-only string value at position position from the list of enumeration values the parameter self can possibly take. For any valid enumeration parameter this list contains at least one value. The possible values are counted starting from 0.

const char* cpl_parameter_get_help ( const cpl_parameter self)

Get the description of a parameter.

Parameters
selfA parameter.
Returns
The function returns the parameter description, or NULL if no description has been set. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the read-only short help of the parameter self. The parameter description must not be modified using the returned pointer.

int cpl_parameter_get_id ( const cpl_parameter self)

Get the numerical identifier of the given parameter.

Parameters
selfA parameter.
Returns
The function returns the parameter's numerical identifier. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function looks up the numerical identifier of the given parameter self. A numerical identifier may be assigned to a parameter using cpl_parameter_set_id().

See Also
cpl_parameter_set_id()
int cpl_parameter_get_int ( const cpl_parameter self)

Get the value of the given integer parameter.

Parameters
selfAn integer parameter.
Returns
The function returns the parameter's integer value. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_INT.

The current integer value of the parameter self is retrieved.

const char* cpl_parameter_get_name ( const cpl_parameter self)

Get the name of a parameter.

Parameters
selfA parameter.
Returns
The function returns the parameter's unique name, or NULL if self is not a valid parameter but NULL. In the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the read-only unique name of the parameter self. The parameter name must not be modified using the returned pointer.

double cpl_parameter_get_range_max_double ( const cpl_parameter self)

Get the maximum value of a double range parameter.

Parameters
selfA double range parameter.
Returns
The function returns the maximum double value the range parameter self can take. In case of an error, the function returns 0. and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The class of the parameter self is not of the kind CPL_PARAMETER_CLASS_RANGE, or self is not of type CPL_TYPE_DOUBLE.

The function retrieves the double value defined to be the upper limit of the double range parameter self.

int cpl_parameter_get_range_max_int ( const cpl_parameter self)

Get the maximum value of an integer range parameter.

Parameters
selfAn integer range parameter.
Returns
The function returns the maximum integer value the range parameter self can take. In case of an error, the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The class of the parameter self is not of the kind CPL_PARAMETER_CLASS_RANGE, or self is not of type CPL_TYPE_INT.

The function retrieves the integer value defined to be the upper limit of the integer range parameter self.

double cpl_parameter_get_range_min_double ( const cpl_parameter self)

Get the minimum value of a double range parameter.

Parameters
selfA double range parameter.
Returns
The function returns the minimum double value the range parameter self can take. In case of an error, the function returns 0. and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The class of the parameter self is not of the kind CPL_PARAMETER_CLASS_RANGE, or self is not of type CPL_TYPE_DOUBLE.

The function retrieves the double value defined to be the lower limit of the double range parameter self.

int cpl_parameter_get_range_min_int ( const cpl_parameter self)

Get the minimum value of an integer range parameter.

Parameters
selfAn integer range parameter.
Returns
The function returns the minimum integer value the range parameter self can take. In case of an error, the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The class of the parameter self is not of the kind CPL_PARAMETER_CLASS_RANGE, or self is not of type CPL_TYPE_INT.

The function retrieves the integer value defined to be the lower limit of the integer range parameter self.

const char* cpl_parameter_get_string ( const cpl_parameter self)

Get the value of the given string parameter.

Parameters
selfA string parameter.
Returns
The function returns the parameter's string value. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_STRING.

The current string value of the parameter self is retrieved.

const char* cpl_parameter_get_tag ( const cpl_parameter self)

Get the parameter's user tag.

Parameters
selfA parameter.
Returns
The function returns the parameter's user tag, or NULL if no user tag was previously set. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The current read-only setting of the user definable tag of the given parameter self is retrieved.

cpl_type cpl_parameter_get_type ( const cpl_parameter self)

Get the parameter's value type.

Parameters
selfA parameter.
Returns
The function returns the parameter's value type. The function returns CPL_TYPE_INVALID if self is not a valid parameter, but NULL. In this case an appropriate error is also set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The type identifier of the parameter's value is retrieved from the given parameter self.

int cpl_parameter_is_enabled ( const cpl_parameter self,
cpl_parameter_mode  mode 
)

Get the parameter's activity status for the environment context.

Parameters
selfA parameter.
modeThe parameter mode.
Returns
The function returns a non-zero value if the parameter is enabled for the environment context, or 0 if the parameter is not active. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter mode mode is not supported.

The function returns whether the parameter is enabled for the environment context or not. If the parameter is enabled for the context the application may modify the parameter's value if the parameter is referenced in the context specific input of the application. If the parameter is disabled, the application must not modify the parameter's value.

cpl_parameter* cpl_parameter_new_enum ( const char *  name,
cpl_type  type,
const char *  description,
const char *  context,
  ... 
)

Create a new enumeration parameter.

Parameters
nameThe parameter's unique name
typeThe type of the parameter's current and default value.
descriptionAn optional comment or description of the parameter.
contextThe context to which the parameter belongs.
...Arguments used for parameter initialisation.
Returns
The function returns the newly created parameter, or NULL if the parameter could not be created. In the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_INVALID_TYPE An unsupported type was passed as type.

The function allocates memory for an enumeration parameter with the name name and a value type type. Optionally a comment describing the parameter may be passed by description and the context to which the parameter belongs may be given by context.

To properly initialise the newly created enumeration, the parameter's default value (together with the number of alternatives following) and the list of enumeration alternatives must be passed as the variable argument list arguments. The list of enumeration alternatives must contain the default value! Apart from the number of possible alternatives, which must be an argument of type int, the type of all initialisation arguments must match the parameter's value type as it is indicated by type.

The following example creates a string enumeration parameter with the unique name application.setup.enum which belongs to the context application.setup with the default def and 3 enumeration alternatives.

Example:
const char *first = "first";
const char *second = "second";
const char *third = "third";
cpl_parameter *p = cpl_parameter_new_enum("application.setup.enum",
"An enum of type string",
"application.setup",
first, 3, first, second,
third);
See Also
cpl_parameter_new_value(), cpl_parameter_new_range()
cpl_parameter* cpl_parameter_new_range ( const char *  name,
cpl_type  type,
const char *  description,
const char *  context,
  ... 
)

Create a new range parameter.

Parameters
nameThe parameter's unique name
typeThe type of the parameter's current and default value.
descriptionAn optional comment or description of the parameter.
contextThe context to which the parameter belongs.
...Arguments used for parameter initialisation.
Returns
The function returns the newly created parameter, or NULL if the parameter could not be created. In the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_INVALID_TYPE An unsupported type was passed as type.

The function allocates memory for a range parameter with the name name and a value type type. Optionally a comment describing the parameter may be passed by description and the context to which the parameter belongs may be given by context.

To properly initialise the newly created range the parameters default value together with the minimum and maximum value of the range has to be passed as the variable argument list arguments. The type of all initialisation arguments must match the parameter's value type as it is indicated by type.

The following example creates a double range parameter with the unique name application.setup.range which belongs to the context application.setup with the default def and the range boundary values minimum and maximum.

Example:
double def = 0.5;
double min = 0.0;
double max = 1.0;
cpl_parameter *p = cpl_parameter_new_range("application.setup.range",
"A range of type double",
"application.setup",
def, min, max);
See Also
cpl_parameter_new_value(), cpl_parameter_new_enum()
cpl_parameter* cpl_parameter_new_value ( const char *  name,
cpl_type  type,
const char *  description,
const char *  context,
  ... 
)

Create a new value parameter.

Parameters
nameThe parameter's unique name
typeThe type of the parameter's current and default value.
descriptionAn optional comment or description of the parameter.
contextThe context to which the parameter belongs.
...Arguments used for parameter initialisation.
Returns
The function returns the newly created parameter, or NULL if the parameter could not be created. In the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter name is a NULL pointer.
CPL_ERROR_INVALID_TYPE An unsupported type was passed as type.

The function allocates memory for a value parameter with the name name and a value type type. Optionally a comment describing the parameter may be passed by description and the context to which the parameter belongs may be given by context.

The newly created parameter is initialised with the default value passed to the function as the only variable argument list argument. The type of the value must match the parameter's value type as it is indicated by type.

The following example creates an integer value parameter with the unique name application.setup.value which belongs to the context application.setup with the default value def

Example:
int def = 1;
cpl_parameter *p = cpl_parameter_new_value("application.setup.value",
"An integer value",
"application.setup",
def);
See Also
cpl_parameter_new_range(), cpl_parameter_new_enum()
cpl_error_code cpl_parameter_set_alias ( cpl_parameter self,
cpl_parameter_mode  mode,
const char *  alias 
)

Set alias names for the given parameter.

Parameters
selfA parameter
modeThe parameter mode for which the alias should be set.
aliasThe parameter's alias.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter mode mode is not supported.

The function assigns an alternative name to the parameter self for the given mode mode. This alias name may be used instead of the fully qualified parameter name in the context for which they have been set. If the alias name is NULL a previously set alias is deleted.

The context for which an alias is set is selected by the mode. The functions accepts the parameter modes CPL_PARAMETER_MODE_CFG, CPL_PARAMETER_MODE_CLI and CPL_PARAMETER_MODE_ENV.

See Also
cpl_parameter_mode
cpl_error_code cpl_parameter_set_bool ( cpl_parameter self,
int  value 
)

Assign a boolean value to a parameter.

Parameters
selfThe parameter the value is assigned to.
valueThe boolean value to be assigned.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_BOOL.

The function assigns a boolean value value to a parameter of type CPL_TYPE_BOOL. Any non-zero value passed as value is interpreted as true.

cpl_error_code cpl_parameter_set_default_bool ( cpl_parameter self,
int  value 
)

Modify the default value of a boolean parameter.

Parameters
selfThe parameter whose default value is modified.
valueThe boolean value to be assigned.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_BOOL.

The function changes the default value of the parameter self to the boolean value value. The parameter self must be of type CPL_TYPE_BOOL. Any non-zero value passed as value is interpreted as true.

cpl_error_code cpl_parameter_set_default_double ( cpl_parameter self,
double  value 
)

Modify the default value of a double parameter.

Parameters
selfThe parameter whose default value is modified.
valueThe double value to be assigned.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_DOUBLE.

The function changes the default value of the parameter self to the double value value. The parameter self must be of type CPL_TYPE_DOUBLE.

cpl_error_code cpl_parameter_set_default_flag ( cpl_parameter self,
int  status 
)

Change the presence status flag of the given parameter.

Parameters
selfA parameter.
statusThe presence status value to assign.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function sets the presence status flag of the given parameter self to the value status. Any non-zero value means that the parameter is present. If the presence status should be changed to `not present' the argument status must be 0.

See Also
cpl_parameter_get_default_flag()
cpl_error_code cpl_parameter_set_default_int ( cpl_parameter self,
int  value 
)

Modify the default value of an integer parameter.

Parameters
selfThe parameter whose default value is modified.
valueThe integer value to be assigned.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_INT.

The function changes the default value of the parameter self to the integer value value. The parameter self must be of type CPL_TYPE_INT.

cpl_error_code cpl_parameter_set_default_string ( cpl_parameter self,
const char *  value 
)

Modify the default value of a string parameter.

Parameters
selfThe parameter whose default value is modified.
valueThe string value to be assigned.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_STRING.

The function changes the default value of the parameter self to the string value value. The parameter self must be of type CPL_TYPE_STRING.

cpl_error_code cpl_parameter_set_double ( cpl_parameter self,
double  value 
)

Assign a double value to a parameter.

Parameters
selfThe parameter the value is assigned to.
valueThe double value to be assigned.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_DOUBLE.

The function assigns a double value value to a parameter of type CPL_TYPE_DOUBLE.

cpl_error_code cpl_parameter_set_id ( cpl_parameter self,
int  id 
)

Set the numerical identifier of the given parameter.

Parameters
selfA parameter.
idNumerical identifier to assign.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function assigns a numerical identifier to the parameter self. The numerical value to be assigned to the parameter's numerical identifier member is passed as the argument id. The function does not do any checks on the numerical value of id. The numerical identifier may be used by an application to, for instance, assign a sequence number to the parameter.

See Also
cpl_parameter_get_id()
cpl_error_code cpl_parameter_set_int ( cpl_parameter self,
int  value 
)

Assign an integer value to a parameter.

Parameters
selfThe parameter the value is assigned to.
valueThe integer value to be assigned.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_INT.

The function assigns an integer value value to a parameter of type CPL_TYPE_INT.

cpl_error_code cpl_parameter_set_string ( cpl_parameter self,
const char *  value 
)

Assign a string value to a parameter.

Parameters
selfThe parameter the value is assigned to.
valueThe string value to be assigned.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_TYPE_MISMATCH The type of the parameter self is not of type CPL_TYPE_STRING.

The function assigns a string value value to a parameter of type CPL_TYPE_STRING.

cpl_error_code cpl_parameter_set_tag ( cpl_parameter self,
const char *  tag 
)

Set the tag of the given parameter.

Parameters
selfA parameter.
tagTag string to assign.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function assigns a user definable tag tag to the parameter self. The function does not check the passed string tag in any way. The tag may be used by an application but it cannot rely on the contents of the parameter's tag.

See Also
cpl_parameter_get_tag()
cpl-6.4.1/html/closed.png0000644000460300003120000000020412310333014012117 00000000000000‰PNG  IHDR à‘KIDATxíÝm @!†ÑGk™É7À-`&séts¦Àñþòð@åk}ª2€… P%Á_Ëþ¿N² .:0Dk¥‹Â›x" Ö›)¡xÒ5õIEND®B`‚cpl-6.4.1/html/dir_5cd28bf58103222faf21a5533c3a1fe9.html0000644000460300003120000001764612310333015016250 00000000000000 Common Pipeline Library Reference Manual: cplui Directory Reference
Common Pipeline Library Reference Manual  6.4.1
cplui Directory Reference

Files

file  cpl_frame.c
 
file  cpl_frame.h
 
file  cpl_frame_impl.h
 
file  cpl_framedata.c
 
file  cpl_framedata.h
 
file  cpl_frameset.c
 
file  cpl_frameset.h
 
file  cpl_frameset_io.c
 
file  cpl_frameset_io.h
 
file  cpl_parameter.c
 
file  cpl_parameter.h
 
file  cpl_parameterlist.c
 
file  cpl_parameterlist.h
 
file  cpl_plugin.c
 
file  cpl_plugin.h
 
file  cpl_plugininfo.h
 
file  cpl_pluginlist.c
 
file  cpl_pluginlist.h
 
file  cpl_recipe.h
 
file  cpl_recipeconfig.c
 
file  cpl_recipeconfig.h
 
file  cpl_recipedefine.c
 
file  cpl_recipedefine.h
 
cpl-6.4.1/html/group__cpl__apertures.html0000644000460300003120000027151612310333015015431 00000000000000 Common Pipeline Library Reference Manual: High level functions to handle apertures
Common Pipeline Library Reference Manual  6.4.1
High level functions to handle apertures

Functions

void cpl_apertures_delete (cpl_apertures *self)
 Destructor for cpl_apertures.
 
void cpl_apertures_dump (const cpl_apertures *self, FILE *fp)
 Dump a cpl_apertures to an opened file pointer.
 
cpl_apertures * cpl_apertures_extract (const cpl_image *self, const cpl_vector *sigmas, cpl_size *pisigma)
 Simple detection of apertures in an image.
 
cpl_apertures * cpl_apertures_extract_mask (const cpl_image *self, const cpl_mask *selection)
 Simple apertures creation from a user supplied selection mask.
 
cpl_apertures * cpl_apertures_extract_sigma (const cpl_image *self, double sigma)
 Simple apertures detection in an image using a provided sigma.
 
cpl_apertures * cpl_apertures_extract_window (const cpl_image *self, const cpl_vector *sigmas, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size *pisigma)
 Simple detection of apertures in an image window.
 
cpl_size cpl_apertures_get_bottom (const cpl_apertures *self, cpl_size ind)
 Get the bottommost y position in an aperture.
 
cpl_size cpl_apertures_get_bottom_x (const cpl_apertures *self, cpl_size ind)
 Get the x position of the bottommost y position in an aperture.
 
double cpl_apertures_get_centroid_x (const cpl_apertures *self, cpl_size ind)
 Get the X-centroid of an aperture.
 
double cpl_apertures_get_centroid_y (const cpl_apertures *self, cpl_size ind)
 Get the Y-centroid of an aperture.
 
double cpl_apertures_get_flux (const cpl_apertures *self, cpl_size ind)
 Get the flux of an aperture.
 
cpl_bivector * cpl_apertures_get_fwhm (const cpl_image *self, const cpl_apertures *aperts)
 Compute FWHM values in x and y for a list of apertures.
 
cpl_size cpl_apertures_get_left (const cpl_apertures *self, cpl_size ind)
 Get the leftmost x position in an aperture.
 
cpl_size cpl_apertures_get_left_y (const cpl_apertures *self, cpl_size ind)
 Get the y position of the leftmost x position in an aperture.
 
double cpl_apertures_get_max (const cpl_apertures *self, cpl_size ind)
 Get the maximum value of an aperture.
 
double cpl_apertures_get_max_x (const cpl_apertures *self, cpl_size ind)
 Get the average X-position of an aperture.
 
double cpl_apertures_get_max_y (const cpl_apertures *self, cpl_size ind)
 Get the average Y-position of an aperture.
 
cpl_size cpl_apertures_get_maxpos_x (const cpl_apertures *self, cpl_size ind)
 Get the X-position of the aperture maximum value.
 
cpl_size cpl_apertures_get_maxpos_y (const cpl_apertures *self, cpl_size ind)
 Get the Y-position of the aperture maximum value.
 
double cpl_apertures_get_mean (const cpl_apertures *self, cpl_size ind)
 Get the mean value of an aperture.
 
double cpl_apertures_get_median (const cpl_apertures *self, cpl_size ind)
 Get the median value of an aperture.
 
double cpl_apertures_get_min (const cpl_apertures *self, cpl_size ind)
 Get the minimum value of an aperture.
 
cpl_size cpl_apertures_get_minpos_x (const cpl_apertures *self, cpl_size ind)
 Get the X-position of the aperture minimum value.
 
cpl_size cpl_apertures_get_minpos_y (const cpl_apertures *self, cpl_size ind)
 Get the Y-position of the aperture minimum value.
 
cpl_size cpl_apertures_get_npix (const cpl_apertures *self, cpl_size ind)
 Get the number of pixels of an aperture.
 
double cpl_apertures_get_pos_x (const cpl_apertures *self, cpl_size ind)
 Get the average X-position of an aperture.
 
double cpl_apertures_get_pos_y (const cpl_apertures *self, cpl_size ind)
 Get the average Y-position of an aperture.
 
cpl_size cpl_apertures_get_right (const cpl_apertures *self, cpl_size ind)
 Get the rightmost x position in an aperture.
 
cpl_size cpl_apertures_get_right_y (const cpl_apertures *self, cpl_size ind)
 Get the y position of the rightmost x position in an aperture.
 
cpl_size cpl_apertures_get_size (const cpl_apertures *self)
 Get the number of apertures.
 
double cpl_apertures_get_stdev (const cpl_apertures *self, cpl_size ind)
 Get the standard deviation of an aperture.
 
cpl_size cpl_apertures_get_top (const cpl_apertures *self, cpl_size ind)
 Get the topmost y position in an aperture.
 
cpl_size cpl_apertures_get_top_x (const cpl_apertures *self, cpl_size ind)
 Get the x position of the topmost y position in an aperture.
 
cpl_apertures * cpl_apertures_new_from_image (const cpl_image *self, const cpl_image *lab)
 Compute statistics on selected apertures.
 
cpl_error_code cpl_apertures_sort_by_flux (cpl_apertures *self)
 Sort by decreasing aperture flux.
 
cpl_error_code cpl_apertures_sort_by_max (cpl_apertures *self)
 Sort by decreasing aperture peak value.
 
cpl_error_code cpl_apertures_sort_by_npix (cpl_apertures *self)
 Sort by decreasing aperture size.
 

Detailed Description

The aperture object contains a list of zones in an image. It is typically used to contain the results of an objects detection, or if one wants to work on a very specific zone in an image.

This module provides functions to handle cpl_apertures.

Function Documentation

void cpl_apertures_delete ( cpl_apertures *  self)

Destructor for cpl_apertures.

Parameters
selfThe object to delete.
Returns
void
Note
If self is NULL, nothing is done and no error is set.

This function deallocates all memory allocated for the object.

void cpl_apertures_dump ( const cpl_apertures *  self,
FILE *  fp 
)

Dump a cpl_apertures to an opened file pointer.

Parameters
selfThe cpl_apertures to dump
fpFile pointer, may use stdout or stderr
Returns
void

This function dumps all information in a cpl_apertures to the passed file pointer. If the object is unallocated or contains nothing, this function does nothing.

cpl_apertures* cpl_apertures_extract ( const cpl_image *  self,
const cpl_vector *  sigmas,
cpl_size pisigma 
)

Simple detection of apertures in an image.

Parameters
selfThe image to process
sigmasPositive, decreasing sigmas to apply
pisigmaIndex of the sigma that was used or unchanged on error
Returns
The detected apertures or NULL on error
See Also
cpl_apertures_extract_sigma()

pisigma may be NULL.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if self or sigmas is NULL
  • CPL_ERROR_DATA_NOT_FOUND if the apertures cannot be detected
cpl_apertures* cpl_apertures_extract_mask ( const cpl_image *  self,
const cpl_mask *  selection 
)

Simple apertures creation from a user supplied selection mask.

Parameters
selfThe image to process
selectionThe mask of selected pixels
Returns
The list of detected apertures or NULL if nothing detected or on error.
See Also
cpl_image_labelise_mask_create(), cpl_apertures_new_from_image()

The values selected for inclusion in the apertures must have the non-zero value in the selection mask, and must not be flagged as bad in the bad pixel map of the image.

The input image type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if self and selection have different sizes.
  • CPL_ERROR_TYPE_MISMATCH if self is of a complex type
  • CPL_ERROR_DATA_NOT_FOUND if the selection mask is empty
cpl_apertures* cpl_apertures_extract_sigma ( const cpl_image *  self,
double  sigma 
)

Simple apertures detection in an image using a provided sigma.

Parameters
selfThe image to process
sigmaDetection level
Returns
The list of detected apertures or NULL on error
Note
In order to avoid (the potentially many) detections of small objects the mask of detected pixels is subjected to a 3x3 morphological opening filter.
See Also
cpl_apertures_extract_mask(), cpl_mask_filter()

The threshold used for the detection is the median plus the average distance to the median times sigma.

The input image type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if sigma is non-positive
  • CPL_ERROR_TYPE_MISMATCH if self is of a complex type
  • CPL_ERROR_DATA_NOT_FOUND if the no apertures are found
cpl_apertures* cpl_apertures_extract_window ( const cpl_image *  self,
const cpl_vector *  sigmas,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
cpl_size pisigma 
)

Simple detection of apertures in an image window.

Parameters
selfThe image to process
sigmasPositive, decreasing sigmas to apply
llxLower left x position (FITS convention)
llyLower left y position (FITS convention)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
pisigmaIndex of the sigma that was used or undefined on error
Returns
The list of detected apertures or NULL on error
See Also
cpl_apertures_extract()
cpl_image_extract()
cpl_size cpl_apertures_get_bottom ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the bottommost y position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the bottommost y position in the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See Also
cpl_apertures_get_maxpos_x()
cpl_size cpl_apertures_get_bottom_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the x position of the bottommost y position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the bottommost x position of the aperture or negative on error
Note
An aperture may have multiple bottom x positions, in which case one of these is returned.
See Also
cpl_apertures_get_maxpos_x()
double cpl_apertures_get_centroid_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the X-centroid of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The X-centroid position of the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set

For a concave aperture the centroid may not belong to the aperture.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if ind is non-positive
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if ind exceeds the number of apertures in self
double cpl_apertures_get_centroid_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the Y-centroid of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The X-centroid position of the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See Also
cpl_apertures_get_centroid_x()
double cpl_apertures_get_flux ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the flux of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The flux of the aperture or undefined on error
See Also
cpl_apertures_get_max()
cpl_bivector* cpl_apertures_get_fwhm ( const cpl_image *  self,
const cpl_apertures *  aperts 
)

Compute FWHM values in x and y for a list of apertures.

Parameters
selfThe image to process
apertsThe list of apertures
Returns
A newly allocated object containing the fwhms in x and y or NULL
See Also
cpl_image_get_fwhm()
Deprecated:
Replace this call with a loop over cpl_image_get_fwhm()
cpl_size cpl_apertures_get_left ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the leftmost x position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the leftmost x position of the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See Also
cpl_apertures_get_maxpos_x()
cpl_size cpl_apertures_get_left_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the y position of the leftmost x position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the y position of the leftmost x position or negative on error
Note
An aperture may have multiple leftmost x positions, in which case one of these is returned.
See Also
cpl_apertures_get_maxpos_x()
double cpl_apertures_get_max ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the maximum value of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The maximum value of the aperture or undefined on error
Note
In case of an error the _cpl_error_code_ code is set

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if ind is non-positive
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if ind exceeds the number of apertures in self
double cpl_apertures_get_max_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the average X-position of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The average X-position of the aperture or negative on error
Deprecated:
Replace this function with cpl_apertures_get_pos_x()
double cpl_apertures_get_max_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the average Y-position of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The average Y-position of the aperture or negative on error
Deprecated:
Replace this function with cpl_apertures_get_pos_y()
cpl_size cpl_apertures_get_maxpos_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the X-position of the aperture maximum value.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The X-position of the aperture maximum value or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See Also
cpl_apertures_get_centroid_x()
cpl_size cpl_apertures_get_maxpos_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the Y-position of the aperture maximum value.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The Y-position of the aperture maximum value or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See Also
cpl_apertures_get_maxpos_x()
double cpl_apertures_get_mean ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the mean value of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The mean value of the aperture or undefined on error
See Also
cpl_apertures_get_max()
double cpl_apertures_get_median ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the median value of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The median value of the aperture or undefined on error
See Also
cpl_apertures_get_max()
double cpl_apertures_get_min ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the minimum value of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The minimum value of the aperture or undefined on error
See Also
cpl_apertures_get_max()
cpl_size cpl_apertures_get_minpos_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the X-position of the aperture minimum value.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The X-position of the aperture minimum value or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See Also
cpl_apertures_get_maxpos_x()
cpl_size cpl_apertures_get_minpos_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the Y-position of the aperture minimum value.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The Y-position of the aperture minimum value or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See Also
cpl_apertures_get_minpos_x()
cpl_size cpl_apertures_get_npix ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the number of pixels of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The number of pixels of the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if ind is non-positive
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if ind exceeds the number of apertures in self
double cpl_apertures_get_pos_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the average X-position of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The average X-position of the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See Also
cpl_apertures_get_centroid_x()
double cpl_apertures_get_pos_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the average Y-position of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The average Y-position of the aperture or negative on error
See Also
cpl_apertures_get_pos_x()
cpl_size cpl_apertures_get_right ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the rightmost x position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the rightmost x position in an aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See Also
cpl_apertures_get_maxpos_x()
cpl_size cpl_apertures_get_right_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the y position of the rightmost x position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the y position of the rightmost x position or negative on error
Note
An aperture may have multiple rightmost x positions, in which case one of these is returned.
See Also
cpl_apertures_get_maxpos_x()
cpl_size cpl_apertures_get_size ( const cpl_apertures *  self)

Get the number of apertures.

Parameters
selfThe cpl_apertures object
Returns
The number of apertures or -1 on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
double cpl_apertures_get_stdev ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the standard deviation of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The standard deviation of the aperture or negative on error
See Also
cpl_apertures_get_max()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if ind is non-positive
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if ind exceeds the number of apertures in self
  • CPL_ERROR_DATA_NOT_FOUND if the aperture comprises less than two pixels
cpl_size cpl_apertures_get_top ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the topmost y position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the topmost y position in the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See Also
cpl_apertures_get_maxpos_x()
cpl_size cpl_apertures_get_top_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the x position of the topmost y position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the x position of the topmost y position or negative on error
Note
An aperture may have multiple topmost x positions, in which case one of these is returned.
See Also
cpl_apertures_get_maxpos_x()
cpl_apertures* cpl_apertures_new_from_image ( const cpl_image *  self,
const cpl_image *  lab 
)

Compute statistics on selected apertures.

Parameters
selfReference image
labLabelized image (of type CPL_TYPE_INT)
Returns
An CPL apertures object or NULL on error
Note
The returned object must be deleted using cpl_apertures_delete().
See Also
cpl_image_labelise_mask_create()

The labelized image must contain at least one pixel for each value from 1 to the maximum value in the image.

For the centroiding computation of an aperture, if some pixels have values lower or equal to 0, all the values of the aperture are locally shifted such as the minimum value of the aperture has a value of epsilon. The centroid is then computed on these positive values. In principle, centroid should always be computed on positive values, this is done to avoid raising an error in case the caller of the function wants to use it on negative values images without caring about the centroid results. In such cases, the centroid result would be meaningful, but slightly depend on the hardcoded value chosen for epsilon (1e-10).

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_TYPE_MISMATCH if lab is not of type CPL_TYPE_INT or if self is of a complex type
  • CPL_ERROR_ILLEGAL_INPUT if lab has a negative value or zero maximum
  • CPL_ERROR_INCOMPATIBLE_INPUT if lab and self have different sizes.
  • CPL_ERROR_DATA_NOT_FOUND if one of the lab values is missing.
cpl_error_code cpl_apertures_sort_by_flux ( cpl_apertures *  self)

Sort by decreasing aperture flux.

Parameters
selfApertures to sort (MODIFIED)
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_apertures_sort_by_npix()
cpl_error_code cpl_apertures_sort_by_max ( cpl_apertures *  self)

Sort by decreasing aperture peak value.

Parameters
selfApertures to sort (MODIFIED)
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_apertures_sort_by_npix()
cpl_error_code cpl_apertures_sort_by_npix ( cpl_apertures *  self)

Sort by decreasing aperture size.

Parameters
selfApertures to sort (MODIFIED)
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl-6.4.1/html/form_24.png0000644000460300003120000000053212310333020012117 00000000000000‰PNG  IHDR4 Š^¡0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïÉIDATxíIrÅ D 1z¸ÿmÓÂþ•,“Mvm—-õ ¸À¿Á|B§ž¿EÍIû†ÒݼRk¢UU<Ê5oàm[¨¦•FÃÈ/ˆ4º¾Ž EyêÀNµ§3„´®Äp’IlaHx’×À$·ZT5a×›Oo‰„Ø&?ÊR )~ä¸Íj y—·t¤tZ[)Fg¹MÄÍ ó 9••sÌñž_‰ýŽ´#ãÏÏ‘2ÒšïHß«¯§1΄G²N‰áó4ÝK9€?â §S¥¨*’{IEND®B`‚cpl-6.4.1/html/index.html0000644000460300003120000000361012310333020012136 00000000000000 Common Pipeline Library Reference Manual: Main Page
Common Pipeline Library Reference Manual  6.4.1
Common Pipeline Library Reference Manual Documentation
cpl-6.4.1/html/tab_a.png0000644000460300003120000000021612310333014011717 00000000000000‰PNG  IHDR$ÇÇ[UIDATxíK €0C'o¤(Šˆ[Žà%Üxÿ#Ù©­ç ùÁöó¦W¦e# 3t I 3+¼øEã~\D½9¯Ûàè’wM·¿öÿ}Yõ_êA4Yžã}IEND®B`‚cpl-6.4.1/html/struct__cpl__recipe__.html0000644000460300003120000001660712310333015015352 00000000000000 Common Pipeline Library Reference Manual: _cpl_recipe_ Struct Reference
Common Pipeline Library Reference Manual  6.4.1
_cpl_recipe_ Struct Reference

The type representation of the recipe plugin interface. More...

Public Attributes

cpl_framesetframes
 Pointer to a frame set, or NULL if no frame set is available.
 
cpl_plugin interface
 Generic plugin interface.
 
cpl_parameterlistparameters
 Pointer to the recipes parameter list, or NULL if the recipe does not provide/accept any parameters.
 

Detailed Description

The type representation of the recipe plugin interface.

Member Data Documentation

cpl_frameset* _cpl_recipe_::frames

Pointer to a frame set, or NULL if no frame set is available.

This member points to the frame set (see Frame Sets) the recipe should process. The frame set to process has to be provided by the application which is going to execute this recipe, i.e. this member has to be set by the application.

The recipe can rely on the availability of the frame set at the time the application executes the recipe by calling cpl_plugin::execute. The recipe is free to ignore a provided frame set if it does not need any input frames.

cpl_plugin _cpl_recipe_::interface

Generic plugin interface.

See the Plugin Interface documentation for a detailed description.

cpl_parameterlist* _cpl_recipe_::parameters

Pointer to the recipes parameter list, or NULL if the recipe does not provide/accept any parameters.

This member points to a cpl_parameterlist, containing all parameters the recipe accepts, or NULL if the recipe does not need any parameters for execution.

An application which wants to execute the recipe may update this list with new parameter values, obtained from the command line for instance.

cpl-6.4.1/html/ftv2folderopen.png0000644000460300003120000000112512310333014013610 00000000000000‰PNG  IHDRÚ}\ˆIDATxí]?oÓPÿ9iš4i°;ii“¶‰ZЉ‘‰ÀÀ7`bèÔÙ¬Øù,HìU'ô$*Tµ]‚T¡DPÚÄ6wÏ}‰;¡C; a¿ÓߟûÝïîž¼jAÀ­InSþ}€9H“ÓŽ|?íÁ÷ =_ÊÆŠ­†¥Àue*;¯YEäsYäæB¢Ÿ¿þÄ—£sÙ½½ÙŒ† É«›©ÀYÇq !GÇ¿v̇¹ÑØ®š °Œ‚ÔF¹}q¥b]÷7í·0)Úd›¾ÿð-èº}Pfä£ÖY{4™ÑÂ@}úæôñ2ÛüÔ—ñúåNŒI‚ÁǃcçÁº%£¬UаI³mc±ô˜å¼ÔÆüÈ>é¸xþt9Æ$µý OæVE*õU´Ì‚ç#ž×ˆ•ïûr@l$øPÿrHaaÇ¥ ²›dZ®rè‘ãqI„o¼øT\Ž,tªj2FAxv-LŸp׌p TÄI/ \¥sfí½; jViTƒèú¤o^cpÅü¼ûû»Ïb]”€¢¤<†aþÕœ²“ßÓ˜y“£§9:Œîù+À³€ñà,E žf³6éNˆÄE£KU}Ü^;¶ØnZ¢uß­US4— ѬëbížN¶.Úk¦ØjTÄöº%µªâ i¯VÄÊÝò§™ Èù¸)ùÿG€™òºJ@T x”IEND®B`‚cpl-6.4.1/html/group__cpl__filter.html0000644000460300003120000005573012310333014014701 00000000000000 Common Pipeline Library Reference Manual: Filters
Common Pipeline Library Reference Manual  6.4.1

Typedefs

typedef enum _cpl_border_mode_ cpl_border_mode
 The border mode type.
 
typedef enum _cpl_filter_mode_ cpl_filter_mode
 The filter mode type.
 

Enumerations

enum  _cpl_border_mode_ {
  CPL_BORDER_FILTER,
  CPL_BORDER_ZERO,
  CPL_BORDER_CROP,
  CPL_BORDER_NOP,
  CPL_BORDER_COPY
}
 These are the supported border modes. For a kernel of width 2n+1, the n left- and rightmost image/mask columns do not have elements for the whole kernel. The same holds for the top and bottom image/mask rows. The border mode defines the filtering of such border pixels. More...
 
enum  _cpl_filter_mode_ {
  CPL_FILTER_EROSION,
  CPL_FILTER_DILATION,
  CPL_FILTER_OPENING,
  CPL_FILTER_CLOSING,
  CPL_FILTER_LINEAR,
  CPL_FILTER_LINEAR_SCALE,
  CPL_FILTER_AVERAGE,
  CPL_FILTER_AVERAGE_FAST,
  CPL_FILTER_MEDIAN,
  CPL_FILTER_STDEV,
  CPL_FILTER_STDEV_FAST,
  CPL_FILTER_MORPHO,
  CPL_FILTER_MORPHO_SCALE
}
 These are the supported filter modes. More...
 

Detailed Description

This module provides definitions for filtering of a cpl_image and a cpl_mask. The actual filtering functions are defined in the cpl_image and cpl_mask modules.

Synopsis:
#include "cpl_filter.h"

Typedef Documentation

The border mode type.

The filter mode type.

Enumeration Type Documentation

These are the supported border modes. For a kernel of width 2n+1, the n left- and rightmost image/mask columns do not have elements for the whole kernel. The same holds for the top and bottom image/mask rows. The border mode defines the filtering of such border pixels.

Enumerator:
CPL_BORDER_FILTER 

Filter the border using the reduced number of pixels. If in median filtering the number of pixels is even choose the mean of the two central values, after the borders have been filled with a chess-like pattern of +- inf

CPL_BORDER_ZERO 

Set the border of the filtered image/mask to zero.

CPL_BORDER_CROP 

Crop the filtered image/mask.

CPL_BORDER_NOP 

Do not modify the border of the filtered image/mask.

CPL_BORDER_COPY 

Copy the border of the input image/mask.

These are the supported filter modes.

Enumerator:
CPL_FILTER_EROSION 

The erosion filter (for a cpl_mask).

See Also
cpl_mask_filter()
CPL_FILTER_DILATION 

The dilation filter (for a cpl_mask).

See Also
cpl_mask_filter()
CPL_FILTER_OPENING 

The opening filter (for a cpl_mask).

See Also
cpl_mask_filter()
CPL_FILTER_CLOSING 

The closing filter (for a cpl_mask).

See Also
cpl_mask_filter()
CPL_FILTER_LINEAR 
A linear filter (for a @c cpl_image). The kernel elements are normalized
with the sum of their absolute values. This implies that there must be
at least one non-zero element in the kernel. The normalisation makes the
kernel useful for filtering where flux conservation is desired.

The kernel elements are thus used as weights like this:
Kernel          Image        ...
       1 2 3         ... 1.0 2.0 3.0 ...
       4 5 6         ... 4.0 5.0 6.0 ...
       7 8 9         ... 7.0 8.0 9.0 ...
                             ...
 The filtered value corresponding to the pixel whose value is 5.0 is:

$\frac{(1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0)} {1+2+3+4+5+6+7+8+9}$

Filtering with CPL_FILTER_LINEAR and a flat kernel can be done faster with CPL_FILTER_AVERAGE.

See Also
CPL_FILTER_LINEAR_SCALE, CPL_FILTER_AVERAGE, cpl_image_filter()
CPL_FILTER_LINEAR_SCALE 
A linear filter (for a @c cpl_image). Unlike @c CPL_FILTER_LINEAR the
kernel elements are not normalized, so the filtered image will have
its flux scaled with the sum of the weights of the kernel. Examples
of linear, scaling kernels are gradient operators and edge detectors.

The kernel elements are thus applied like this:
Kernel          Image        ...
       1 2 3         ... 1.0 2.0 3.0 ...
       4 5 6         ... 4.0 5.0 6.0 ...
       7 8 9         ... 7.0 8.0 9.0 ...
                             ...
 The filtered value corresponding to the pixel whose value is 5.0 is:

$1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0$

See Also
CPL_FILTER_LINEAR, cpl_image_filter()
CPL_FILTER_AVERAGE 

An average filter, i.e. the output pixel is the arithmetic average of the surrounding (1 + 2 * hsizex) (1 + 2 * hsizey) pixels. The cost per pixel is O(hsizex*hsizey). The two images may have different pixel types. When the input and output pixel types are identical, the arithmetic is done with that type, e.g. int for two integer images. When the input and output pixel types differ, the arithmetic is done in double precision when one of the two images have pixel type CPL_TYPE_DOUBLE, otherwise float is used.

See Also
CPL_FILTER_AVERAGE_FAST, cpl_image_filter_mask()
CPL_FILTER_AVERAGE_FAST 

The same as CPL_FILTER_AVERAGE, except that it uses a running average, which will lead to a significant loss of precision if there are large differences in the magnitudes of the input pixels. The cost per pixel is O(1) if all elements in the kernel are used, otherwise the filtering is done as for CPL_FILTER_AVERAGE.

See Also
cpl_image_filter_mask()
CPL_FILTER_MEDIAN 

A median filter (for a cpl_image). The pixel types of the input and output images must be identical.

See Also
cpl_image_filter_mask()
CPL_FILTER_STDEV 

The filtered value is the standard deviation of the included input pixels.

Kernel                Image        ...
       1   0   1           ... 1.0 2.0 3.0 ...
       0   1   0           ... 4.0 5.0 6.0 ...
       1   0   1           ... 7.0 8.0 9.0 ...
                                   ...

The pixel with value 5.0 will have a filtered value of: std_dev(1.0, 3.0, 5.0, 7.0, 9.0)

See Also
CPL_FILTER_STDEV_FAST, cpl_image_filter_mask()
CPL_FILTER_STDEV_FAST 

The same as CPL_FILTER_STDEV, except that it uses the same running method employed in CPL_FILTER_AVERAGE_FAST, which will lead to a significant loss of precision if there are large differences in the magnitudes of the input pixels. As for CPL_FILTER_AVERAGE_FAST, the cost per pixel is O(1) if all elements are used, otherwise the filtering is done as for CPL_FILTER_STDEV.

See Also
cpl_image_filter_mask()
CPL_FILTER_MORPHO 
A morphological filter (for a @c cpl_image). The kernel elements are
normalized with the sum of their absolute values. This implies that
there must be at least one non-zero element in the kernel. The
normalisation makes the kernel useful for filtering where flux
conservation is desired.

The kernel elements are used as weights on the sorted values covered by
the kernel:
 Kernel          Image        ...
        1 2 3         ... 4.0 6.0 5.0 ...
        4 5 6         ... 3.0 1.0 2.0 ...
        7 8 9         ... 7.0 8.0 9.0 ...
                              ...
 The filtered value corresponding to the pixel whose value is 5.0 is:

$\frac{(1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0)} {1+2+3+4+5+6+7+8+9}$

See Also
CPL_FILTER_MORPHO_SCALE, cpl_image_filter()
CPL_FILTER_MORPHO_SCALE 
A morphological filter (for a @c cpl_image). Unlike @c CPL_FILTER_MORPHO
the kernel elements are not normalized, so the filtered image will have
its flux scaled with the sum of the weights of the kernel.

The kernel elements are thus applied to the sorted values covered by
the kernel:
 Kernel          Image        ...
        1 2 3         ... 4.0 6.0 5.0 ...
        4 5 6         ... 3.0 1.0 2.0 ...
        7 8 9         ... 7.0 8.0 9.0 ...
                              ...
 The filtered value corresponding to the pixel whose value is 5.0 is:

$1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0$

See Also
CPL_FILTER_MORPHO, cpl_image_filter()
cpl-6.4.1/html/tab_b.png0000644000460300003120000000025212310333014011720 00000000000000‰PNG  IHDR$ÇÇ[qIDATxíÝM‚@Dáî.ÑÄx56.\ÀŠÊß Ì„“²ãžÁš˜è5¾z©[ȶ¿írÎìtü²bò+Ü+ÂMý1<š! u ûuïgb»uÒz\ËÎT•äWÎÿ ¿©R“ìÀ˜¢¨Fä·Çës{‹ú;IEND®B`‚cpl-6.4.1/html/group__cpl__bivector.html0000644000460300003120000012451612310333014015230 00000000000000 Common Pipeline Library Reference Manual: Bi-vector object
Common Pipeline Library Reference Manual  6.4.1
Bi-vector object

Functions

cpl_error_code cpl_bivector_copy (cpl_bivector *self, const cpl_bivector *other)
 Copy contents of a bivector into another bivector.
 
void cpl_bivector_delete (cpl_bivector *f)
 Delete a cpl_bivector.
 
void cpl_bivector_dump (const cpl_bivector *f, FILE *stream)
 Dump a cpl_bivector as ASCII to a stream.
 
cpl_bivector * cpl_bivector_duplicate (const cpl_bivector *in)
 Duplicate a cpl_bivector.
 
cpl_size cpl_bivector_get_size (const cpl_bivector *in)
 Get the size of the cpl_bivector.
 
cpl_vector * cpl_bivector_get_x (cpl_bivector *in)
 Get a pointer to the x vector of the cpl_bivector.
 
const cpl_vector * cpl_bivector_get_x_const (const cpl_bivector *in)
 Get a pointer to the x vector of the cpl_bivector.
 
double * cpl_bivector_get_x_data (cpl_bivector *in)
 Get a pointer to the x data part of the cpl_bivector.
 
const double * cpl_bivector_get_x_data_const (const cpl_bivector *in)
 Get a pointer to the x data part of the cpl_bivector.
 
cpl_vector * cpl_bivector_get_y (cpl_bivector *in)
 Get a pointer to the y vector of the cpl_bivector.
 
const cpl_vector * cpl_bivector_get_y_const (const cpl_bivector *in)
 Get a pointer to the y vector of the cpl_bivector.
 
double * cpl_bivector_get_y_data (cpl_bivector *in)
 Get a pointer to the y data part of the cpl_bivector.
 
const double * cpl_bivector_get_y_data_const (const cpl_bivector *in)
 Get a pointer to the y data part of the cpl_bivector.
 
cpl_error_code cpl_bivector_interpolate_linear (cpl_bivector *fout, const cpl_bivector *fref)
 Linear interpolation of a 1d-function.
 
cpl_bivector * cpl_bivector_new (cpl_size n)
 Create a new cpl_bivector.
 
cpl_bivector * cpl_bivector_read (const char *filename)
 Read a list of values from an ASCII file and create a cpl_bivector.
 
cpl_error_code cpl_bivector_sort (cpl_bivector *self, const cpl_bivector *other, cpl_sort_direction dir, cpl_sort_mode mode)
 Sort a cpl_bivector.
 
void cpl_bivector_unwrap_vectors (cpl_bivector *f)
 Free memory associated to a cpl_bivector, excluding the two vectors.
 
cpl_bivector * cpl_bivector_wrap_vectors (cpl_vector *x, cpl_vector *y)
 Create a new cpl_bivector from two cpl_vectors.
 

Detailed Description

This module provides functions to handle cpl_bivector.

A cpl_bivector is composed of two vectors of the same size. It can be used to store 1d functions, with the x and y positions of the samples, offsets in x and y or simply positions in an image.

This module provides among other things functions for interpolation and for sorting one vector according to another.

Synopsis:
#include "cpl_bivector.h"

Function Documentation

cpl_error_code cpl_bivector_copy ( cpl_bivector *  self,
const cpl_bivector *  other 
)

Copy contents of a bivector into another bivector.

Parameters
selfdestination cpl_vector
othersource cpl_vector
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_vector_set_size() if source and destination have different sizes.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
void cpl_bivector_delete ( cpl_bivector *  f)

Delete a cpl_bivector.

Parameters
fcpl_bivector to delete
Returns
void

This function deletes a bivector. If the input bivector f is NULL, nothing is done, and no error is set.

void cpl_bivector_dump ( const cpl_bivector *  f,
FILE *  stream 
)

Dump a cpl_bivector as ASCII to a stream.

Parameters
fInput cpl_bivector to dump or NULL
streamOutput stream, accepts stdout or stderr or NULL
Returns
void

Comment lines start with the hash character.

stream may be NULL in which case stdout is used.

Note
In principle a cpl_bivector can be saved using cpl_bivector_dump() and re-read using cpl_bivector_read(). This will however introduce significant precision loss due to the limited accuracy of the ASCII representation.
cpl_bivector* cpl_bivector_duplicate ( const cpl_bivector *  in)

Duplicate a cpl_bivector.

Parameters
incpl_bivector to duplicate
Returns
1 newly allocated cpl_bivector or NULL on error

The returned object must be deallocated using cpl_bivector_delete()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input bivector contains vectors of different sizes
cpl_size cpl_bivector_get_size ( const cpl_bivector *  in)

Get the size of the cpl_bivector.

Parameters
inthe input bivector
Returns
The size or a negative number on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input bivector contains vectors of different sizes
cpl_vector* cpl_bivector_get_x ( cpl_bivector *  in)

Get a pointer to the x vector of the cpl_bivector.

Parameters
ina cpl_bivector
Returns
Pointer to the x vector or NULL on error

The returned pointer refers to an already created cpl_vector.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
const cpl_vector* cpl_bivector_get_x_const ( const cpl_bivector *  in)

Get a pointer to the x vector of the cpl_bivector.

Parameters
ina cpl_bivector
Returns
Pointer to the x vector or NULL on error
See Also
cpl_bivector_get_x
double* cpl_bivector_get_x_data ( cpl_bivector *  in)

Get a pointer to the x data part of the cpl_bivector.

Parameters
ina cpl_bivector
Returns
Pointer to the double x array or NULL on error
See Also
cpl_vector_get_data The returned pointer refers to already allocated data.
Note
Use at your own risk: direct manipulation of vector data rules out any check performed by the vector object interface, and may introduce inconsistencies between the information maintained internally, and the actual vector data and structure.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
const double* cpl_bivector_get_x_data_const ( const cpl_bivector *  in)

Get a pointer to the x data part of the cpl_bivector.

Parameters
ina cpl_bivector
Returns
Pointer to the double x array or NULL on error
See Also
cpl_bivector_get_x_data
cpl_vector* cpl_bivector_get_y ( cpl_bivector *  in)

Get a pointer to the y vector of the cpl_bivector.

Parameters
ina cpl_bivector
Returns
Pointer to the y vector or NULL on error

The returned pointer refers to an already created cpl_vector.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
const cpl_vector* cpl_bivector_get_y_const ( const cpl_bivector *  in)

Get a pointer to the y vector of the cpl_bivector.

Parameters
ina cpl_bivector
Returns
Pointer to the y vector or NULL on error
double* cpl_bivector_get_y_data ( cpl_bivector *  in)

Get a pointer to the y data part of the cpl_bivector.

Parameters
ina cpl_bivector
Returns
Pointer to the double y array or NULL on error
See Also
cpl_vector_get_x_data

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
const double* cpl_bivector_get_y_data_const ( const cpl_bivector *  in)

Get a pointer to the y data part of the cpl_bivector.

Parameters
ina cpl_bivector
Returns
Pointer to the double y array or NULL on error
See Also
cpl_bivector_get_y_data
cpl_error_code cpl_bivector_interpolate_linear ( cpl_bivector *  fout,
const cpl_bivector *  fref 
)

Linear interpolation of a 1d-function.

Parameters
foutPreallocated with X-vector set, to hold interpolation in Y
frefReference 1d-function
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_

fref must have both its abscissa and ordinate defined. fout must have its abscissa defined and its ordinate allocated.

The linear interpolation will be done from the values in fref to the abscissa points in fout.

For each abscissa point in fout, fref must either have two neigboring abscissa points such that xref_i < xout_j < xref{i+1}, or a single identical abscissa point, such that xref_i == xout_j.

This is ensured by monotonely growing abscissa points in both fout and fref (and by min(xref) <= min(xout) and max(xout) < max(xref)).

However, for efficiency reasons (since fref can be very long) the monotonicity is only verified to the extent necessary to actually perform the interpolation.

This input requirement implies that extrapolation is not allowed.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_DATA_NOT_FOUND if fout has an endpoint which is out of range
  • CPL_ERROR_ILLEGAL_INPUT if the monotonicity requirement on the 2 input abscissa vectors is not met.
cpl_bivector* cpl_bivector_new ( cpl_size  n)

Create a new cpl_bivector.

Parameters
nPositive number of points
Returns
1 newly allocated cpl_bivector or NULL on error

The returned object must be deallocated using cpl_bivector_delete() or cpl_bivector_unwrap_vectors(), provided the two cpl_vectors are deallocated separately.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_ILLEGAL_INPUT if n is < 1.
cpl_bivector* cpl_bivector_read ( const char *  filename)

Read a list of values from an ASCII file and create a cpl_bivector.

Parameters
filenameName of the input ASCII file
Returns
1 newly allocated cpl_bivector or NULL on error
See Also
cpl_vector_load

The input ASCII file must contain two values per line.

The returned object must be deallocated using cpl_bivector_delete() Two columns of numbers are expected in the input file.

In addition to normal files, FIFO (see man mknod) are also supported.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if the file cannot be read
  • CPL_ERROR_BAD_FILE_FORMAT if the file contains no valid lines
cpl_error_code cpl_bivector_sort ( cpl_bivector *  self,
const cpl_bivector *  other,
cpl_sort_direction  dir,
cpl_sort_mode  mode 
)

Sort a cpl_bivector.

Parameters
selfcpl_bivector to hold sorted result
otherInput cpl_bivector to sort, may equal self
dirCPL_SORT_ASCENDING or CPL_SORT_DESCENDING
modeCPL_SORT_BY_X or CPL_SORT_BY_Y
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

The values in the input are sorted according to direction and mode, and the result is placed self which must be of the same size as other.

As for qsort(): If two members compare as equal, their order in the sorted array is undefined.

In place sorting is supported.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if self and other have different sizes
  • CPL_ERROR_ILLEGAL_INPUT if dir is neither CPL_SORT_DESCENDING nor CPL_SORT_ASCENDING.
  • CPL_ERROR_UNSUPPORTED_MODE if self and other are the same or point to the same underlying arrays, or if mode is neither CPL_SORT_BY_X nor CPL_SORT_BY_Y
void cpl_bivector_unwrap_vectors ( cpl_bivector *  f)

Free memory associated to a cpl_bivector, excluding the two vectors.

Parameters
fcpl_bivector to delete
Returns
void
See Also
cpl_bivector_wrap_vectors
cpl_bivector* cpl_bivector_wrap_vectors ( cpl_vector *  x,
cpl_vector *  y 
)

Create a new cpl_bivector from two cpl_vectors.

Parameters
xthe x cpl_vector
ythe y cpl_vector
Returns
1 cpl_bivector or NULL on error
Note
The input cpl_vectors must have identical sizes. Afterwards one of those two vectors may be resized, which will corrupt the bivector. Such a corrupted bivector should not be used any more, but rather deallocated, using cpl_bivector_unwrap_vectors() or cpl_bivector_delete().

The returned object must be deallocated using cpl_bivector_delete() or with cpl_bivector_unwrap_vectors(), provided the two cpl_vectors are deallocated separately.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input vectors have different sizes
cpl-6.4.1/html/group__cpl__frameset__io.html0000644000460300003120000001403112310333015016036 00000000000000 Common Pipeline Library Reference Manual: Frame Sets IO functions
Common Pipeline Library Reference Manual  6.4.1
Frame Sets IO functions

Functions

cpl_imagelist * cpl_imagelist_load_frameset (const cpl_frameset *fset, cpl_type im_type, cpl_size pnum, cpl_size xtnum)
 Load an imagelist from a frameset.
 

Detailed Description

Synopsis:
#include <cpl_frameset_io.h>

Function Documentation

cpl_imagelist* cpl_imagelist_load_frameset ( const cpl_frameset fset,
cpl_type  im_type,
cpl_size  pnum,
cpl_size  xtnum 
)

Load an imagelist from a frameset.

Parameters
fsetThe frames set
im_typeThe required image type
pnumThe plane number, 1 for first, 0 for all planes
xtnumThe extension number, 0 for primary, n for nth, -1 for all
Returns
the loaded list of images or NULL on error.
Note
The returned cpl_imagelist must be deallocated using cpl_imagelist_delete()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if fset is NULL
  • CPL_ERROR_ILLEGAL_INPUT if pnum is negative, xtnum is lower than -1 or one image cannot be loaded as specified
cpl-6.4.1/html/ftv2folderclosed.png0000644000460300003120000000115012310333014014116 00000000000000‰PNG  IHDRÚ}\ˆ/IDATxí]MOÔ@~ÚúuØlp]ö¿#›Å]PYECˆ\9ù¼yÑß`ÖÄÿàÿÀÉxóâ¢C &=qÐÄ£—vZçv¶3m؃‡vžLûNç}Þ÷}Þ½ZA@n° OäNp ’xóþK°ññ€xÜj”°8sÑ€“ “€œ_¼[Âíæ§ïD'‚•yye+ø¼û 7#rNŸlïük* ¾0Ь_d«_(àñÖ±àôz=ñxõv§÷h©‰z¹€šØP-äóä’̪uý¼$»\DãJc—B4¯ãÝÖ.:£Ï-ÑÏß}µŠLEíºþ #—ûáºÀÏgN;BŠ€6ïýñ䬜…ö@’Ðåñp&™h>p9¤™EEά¨ÎÊ‘" u¥n€$R"?{¹<˜…ë…%PNtâ$‰ß¶±úá+^<é"§2 ªDq”q´\¬«Ò™a–Œ‘©Aÿ€"Ôµ ™êŸèP£}#Eàz{û.8i îp³ê(ADwD¦E<ê¬cE¦$ HdÊÄ ”.:Ù GŽ-`ŒL‚ý¾'¢‰Ä<¤CIª½;ÙÇTZd±i};>èôß‚z×;K×§8t ¤Ž q”:uvÿv•Ý›¬²ÙvEân{„M·FXg¼ÌfZÖ¨°¹‰*›ßÌß©±ù©:›j–YqèÜë#3çÏSøWøÿÿÑr'ø Ôùù‚ ©¡IEND®B`‚cpl-6.4.1/html/group__cpl__parameterlist.html0000644000460300003120000015302512310333015016265 00000000000000 Common Pipeline Library Reference Manual: Parameter Lists
Common Pipeline Library Reference Manual  6.4.1
Parameter Lists

Typedefs

typedef struct _cpl_parameterlist_ cpl_parameterlist
 The opaque parameter list data type.
 

Functions

cpl_error_code cpl_parameterlist_append (cpl_parameterlist *self, cpl_parameter *parameter)
 Append a parameter to a parameter list.
 
void cpl_parameterlist_delete (cpl_parameterlist *self)
 Destroy a parameter list.
 
void cpl_parameterlist_dump (const cpl_parameterlist *self, FILE *stream)
 Dump the contents of a parameter list to the given stream.
 
cpl_parametercpl_parameterlist_find (cpl_parameterlist *self, const char *name)
 Find a parameter with the given name in a parameter list.
 
const cpl_parametercpl_parameterlist_find_const (const cpl_parameterlist *self, const char *name)
 Find a parameter with the given name in a parameter list.
 
cpl_parametercpl_parameterlist_find_context (cpl_parameterlist *self, const char *context)
 Find a parameter which belongs to the given context in a parameter list.
 
const cpl_parametercpl_parameterlist_find_context_const (const cpl_parameterlist *self, const char *context)
 Find a parameter which belongs to the given context in a parameter list.
 
cpl_parametercpl_parameterlist_find_tag (cpl_parameterlist *self, const char *tag)
 Find a parameter with the given tag in a parameter list.
 
const cpl_parametercpl_parameterlist_find_tag_const (const cpl_parameterlist *self, const char *tag)
 Find a parameter with the given tag in a parameter list.
 
cpl_parametercpl_parameterlist_find_type (cpl_parameterlist *self, cpl_type type)
 Find a parameter of the given type in a parameter list.
 
const cpl_parametercpl_parameterlist_find_type_const (const cpl_parameterlist *self, cpl_type type)
 Find a parameter of the given type in a parameter list.
 
cpl_parametercpl_parameterlist_get_first (cpl_parameterlist *self)
 Get the first parameter in the given parameter list.
 
const cpl_parametercpl_parameterlist_get_first_const (const cpl_parameterlist *self)
 Get the first parameter in the given parameter list.
 
cpl_parametercpl_parameterlist_get_last (cpl_parameterlist *self)
 Get the last parameter in the given list.
 
const cpl_parametercpl_parameterlist_get_last_const (const cpl_parameterlist *self)
 Get the last parameter in the given list.
 
cpl_parametercpl_parameterlist_get_next (cpl_parameterlist *self)
 Get the next parameter in the given list.
 
const cpl_parametercpl_parameterlist_get_next_const (const cpl_parameterlist *self)
 Get the next parameter in the given list.
 
cpl_size cpl_parameterlist_get_size (const cpl_parameterlist *self)
 Get the current size of a parameter list.
 
cpl_parameterlistcpl_parameterlist_new (void)
 Create a new parameter list.
 

Detailed Description

The module implements a parameter list data type, a container for the cpl_parameter type. It provides a convenient way to pass a set of parameters, as a whole, to a function.

It is used in the plugin interface (cf. Plugin Interface), for instance, to pass the parameters a recipe accepts from the plugin to the calling application and vice versa.

All functions expect a valid pointer to a parameter list as input, unless otherwise specified.

Synopsis:
#include <cpl_parameterlist.h>

Typedef Documentation

typedef struct _cpl_parameterlist_ cpl_parameterlist

The opaque parameter list data type.

Function Documentation

cpl_error_code cpl_parameterlist_append ( cpl_parameterlist self,
cpl_parameter parameter 
)

Append a parameter to a parameter list.

Parameters
selfA parameter list.
parameterThe parameter to append.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The parameter parameter is appended to the parameter list self.

void cpl_parameterlist_delete ( cpl_parameterlist self)

Destroy a parameter list.

Parameters
selfThe parameter list to destroy.
Returns
Nothing.

The function destroys the parameter list object self and all parameters it possibly contains. The individual parameters are destroyed using the parameter destructor (cf. Parameters). If self is NULL, nothing is done and no error is set.

void cpl_parameterlist_dump ( const cpl_parameterlist self,
FILE *  stream 
)

Dump the contents of a parameter list to the given stream.

Parameters
selfThe parameter list.
streamThe output stream to use.
Returns
Nothing.

The function dumps the debugging information for each parameter found in the parameter list self to the output stream stream. The debugging information for each individual parameter is dumped using cpl_parameter_dump(). If self is NULL the function does nothing.

See Also
cpl_parameter_dump()
cpl_parameter* cpl_parameterlist_find ( cpl_parameterlist self,
const char *  name 
)

Find a parameter with the given name in a parameter list.

Parameters
selfA parameter list.
nameThe parameter name to search for.
Returns
The function returns a handle for the first parameter with the name name, or NULL if no such parameter was found. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function searches the parameter list self for the first occurrence of a parameter with the fully qualified name name. If no parameter with this name exists, the function returns NULL.

const cpl_parameter* cpl_parameterlist_find_const ( const cpl_parameterlist self,
const char *  name 
)

Find a parameter with the given name in a parameter list.

Parameters
selfA parameter list.
nameThe parameter name to search for.
Returns
The function returns a handle for the first parameter with the name name, or NULL if no such parameter was found. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

The function searches the parameter list self for the first occurrence of a parameter with the fully qualified name name. If no parameter with this name exists, the function returns NULL.

cpl_parameter* cpl_parameterlist_find_context ( cpl_parameterlist self,
const char *  context 
)

Find a parameter which belongs to the given context in a parameter list.

Parameters
selfA parameter list.
contextThe parameter context to search for.
Returns
The function returns a handle for the first parameter with the context context, or NULL if no such parameter was found. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or context is a NULL pointer.

The function searches the parameter list self for the first occurrence of a parameter which belongs to the context context. If no parameter with this type exists, the function returns NULL.

const cpl_parameter* cpl_parameterlist_find_context_const ( const cpl_parameterlist self,
const char *  context 
)

Find a parameter which belongs to the given context in a parameter list.

Parameters
selfA parameter list.
contextThe parameter context to search for.
Returns
The function returns a handle for the first parameter with the context context, or NULL if no such parameter was found. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or context is a NULL pointer.

The function searches the parameter list self for the first occurrence of a parameter which belongs to the context context. If no parameter with this type exists, the function returns NULL.

cpl_parameter* cpl_parameterlist_find_tag ( cpl_parameterlist self,
const char *  tag 
)

Find a parameter with the given tag in a parameter list.

Parameters
selfA parameter list.
tagThe parameter tag to search for.
Returns
The function returns a handle for the first parameter with the tag tag, or NULL if no such parameter was found. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or tag is a NULL pointer.

The function searches the parameter list self for the first occurrence of a parameter with the user tag tag. If no parameter with this tag exists, the function returns NULL.

const cpl_parameter* cpl_parameterlist_find_tag_const ( const cpl_parameterlist self,
const char *  tag 
)

Find a parameter with the given tag in a parameter list.

Parameters
selfA parameter list.
tagThe parameter tag to search for.
Returns
The function returns a handle for the first parameter with the tag tag, or NULL if no such parameter was found. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or tag is a NULL pointer.

The function searches the parameter list self for the first occurrence of a parameter with the user tag tag. If no parameter with this tag exists, the function returns NULL.

cpl_parameter* cpl_parameterlist_find_type ( cpl_parameterlist self,
cpl_type  type 
)

Find a parameter of the given type in a parameter list.

Parameters
selfA parameter list.
typeThe parameter type to search for.
Returns
The function returns a handle for the first parameter with the type type, or NULL if no such parameter was found. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function searches the parameter list self for the first occurrence of a parameter whose value is of the type type. If no parameter with this type exists, the function returns NULL.

const cpl_parameter* cpl_parameterlist_find_type_const ( const cpl_parameterlist self,
cpl_type  type 
)

Find a parameter of the given type in a parameter list.

Parameters
selfA parameter list.
typeThe parameter type to search for.
Returns
The function returns a handle for the first parameter with the type type, or NULL if no such parameter was found. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function searches the parameter list self for the first occurrence of a parameter whose value is of the type type. If no parameter with this type exists, the function returns NULL.

cpl_parameter* cpl_parameterlist_get_first ( cpl_parameterlist self)

Get the first parameter in the given parameter list.

Parameters
selfA parameter list.
Returns
The function returns a handle for the first parameter in the list, or NULL if the list is empty. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the first parameter in the parameter list self, if it exists. If there is no first parameter, i.e. if the list is empty, NULL is returned. The function updates the internal search position cache.

const cpl_parameter* cpl_parameterlist_get_first_const ( const cpl_parameterlist self)

Get the first parameter in the given parameter list.

Parameters
selfA parameter list.
Returns
The function returns a handle for the first parameter in the list, or NULL if the list is empty. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the first parameter in the parameter list self, if it exists. If there is no first parameter, i.e. if the list is empty, NULL is returned. The function updates the internal search position cache.

cpl_parameter* cpl_parameterlist_get_last ( cpl_parameterlist self)

Get the last parameter in the given list.

Parameters
selfA parameter list.
Returns
The function returns a handle for the last parameter in the list. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter self is an empty list.

The function returns the last parameter stored in the parameter list self. The list self must not be empty.

const cpl_parameter* cpl_parameterlist_get_last_const ( const cpl_parameterlist self)

Get the last parameter in the given list.

Parameters
selfA parameter list.
Returns
The function returns a handle for the last parameter in the list. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter self is an empty list.

The function returns the last parameter stored in the parameter list self. The list self must not be empty.

cpl_parameter* cpl_parameterlist_get_next ( cpl_parameterlist self)

Get the next parameter in the given list.

Parameters
selfA parameter list.
Returns
The function returns a handle for the next parameter in the list, or NULL if there are no more parameters in the list. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the next parameter in the parameter list self if it exists and NULL otherwise. The function uses the last cached search position to determine the most recently accessed parameter. This means that the function only works as expected if the self has been initialised by a call to cpl_parameterlist_get_first(), and if no function updating the internal cache was called between two subsequent calls to this function.

const cpl_parameter* cpl_parameterlist_get_next_const ( const cpl_parameterlist self)

Get the next parameter in the given list.

Parameters
selfA parameter list.
Returns
The function returns a handle for the next parameter in the list, or NULL if there are no more parameters in the list. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the next parameter in the parameter list self if it exists and NULL otherwise. The function uses the last cached search position to determine the most recently accessed parameter. This means that the function only works as expected if the self has been initialised by a call to cpl_parameterlist_get_first_const(), and if no function updating the internal cache was called between two subsequent calls to this function.

cpl_size cpl_parameterlist_get_size ( const cpl_parameterlist self)

Get the current size of a parameter list.

Parameters
selfA parameter list
Returns
The parameter list's current size, or 0 if the list is empty. If an error occurs the function returns 0 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function reports the current number of elements stored in the parameter list self.

cpl_parameterlist* cpl_parameterlist_new ( void  )

Create a new parameter list.

Returns
A pointer to the newly created parameter list.

The function creates a new parameter list object. The created object must be destroyed using the parameter list destructor cpl_parameterlist_delete().

cpl-6.4.1/html/group__cpl__msg.html0000644000460300003120000021534312310333014014200 00000000000000 Common Pipeline Library Reference Manual: Messages
Common Pipeline Library Reference Manual  6.4.1
Messages

Functions

void cpl_msg_debug (const char *component, const char *format,...)
 Display a debug message.
 
void cpl_msg_error (const char *component, const char *format,...)
 Display an error message.
 
const char * cpl_msg_get_domain (void)
 Get the domain name.
 
cpl_msg_severity cpl_msg_get_level (void)
 Get current terminal verbosity level.
 
cpl_msg_severity cpl_msg_get_log_level (void)
 Get current log verbosity level.
 
const char * cpl_msg_get_log_name (void)
 Get the log file name.
 
void cpl_msg_indent (int level)
 Set the indentation level.
 
void cpl_msg_indent_less (void)
 Decrease the message indentation by one indentation step.
 
void cpl_msg_indent_more (void)
 Increase the message indentation by one indentation step.
 
void cpl_msg_info (const char *component, const char *format,...)
 Display an information message.
 
void cpl_msg_info_overwritable (const char *component, const char *format,...)
 Display an overwritable information message.
 
cpl_error_code cpl_msg_init (void)
 Initialise the messaging system.
 
void cpl_msg_progress (const char *component, int i, int iter, const char *format,...)
 Display a progress message predicting the time required in a loop.
 
void cpl_msg_set_component_off (void)
 Disable the component tag in output messages.
 
void cpl_msg_set_component_on (void)
 Attach the component tag to output messages.
 
void cpl_msg_set_domain (const char *name)
 Set the domain name.
 
void cpl_msg_set_domain_off (void)
 Disable the domain tag in output messages.
 
void cpl_msg_set_domain_on (void)
 Attach the domain tag to output messages.
 
void cpl_msg_set_indentation (int step)
 Set the indentation step.
 
void cpl_msg_set_level (cpl_msg_severity verbosity)
 Set verbosity level of output to terminal.
 
void cpl_msg_set_level_from_env (void)
 Set verbosity level of terminal output using an environment variable.
 
cpl_error_code cpl_msg_set_log_level (cpl_msg_severity verbosity)
 Open and initialise a log file.
 
cpl_error_code cpl_msg_set_log_name (const char *name)
 Set the log file name.
 
void cpl_msg_set_threadid_off (void)
 Disable the thread id tag to output messages.
 
void cpl_msg_set_threadid_on (void)
 Attach a thread id tag to output messages.
 
void cpl_msg_set_time_off (void)
 Disable the time tag in output messages.
 
void cpl_msg_set_time_on (void)
 Attach a time tag to output messages.
 
void cpl_msg_set_width (int width)
 Set the maximum width of the displayed text.
 
void cpl_msg_stop (void)
 Turn the messaging system off.
 
cpl_error_code cpl_msg_stop_log (void)
 Close the current log file.
 
void cpl_msg_warning (const char *component, const char *format,...)
 Display a warning message.
 

Detailed Description

This module provides functions to display and log messages. The following operations are supported:

- Enable messages output to terminal or to log file.
- Optionally adding informative tags to messages.
- Setting width for message line wrapping.
- Control the message indentation level.
- Filtering messages according to their severity level.

To activate and deactivate the messaging system, the functions cpl_msg_init() and cpl_msg_stop() need to be used. However, since they are called anyway by the functions cpl_init() and cpl_end(), there is generally no need to call them explicitly, and starting from CPL 2.1 they are deprecated. These functions would typically be called at the beginning and at the end of a program. An attempt to use an uninitialised messaging system would generate a warning message. More functions may also be used to configure the messaging system, and here is an example of a possible initialisation:

...
cpl_msg_set_time_on();
cpl_msg_set_domain("Source detection");
cpl_msg_set_level(CPL_MSG_ERROR);
cpl_msg_set_log_level(CPL_MSG_DEBUG);
...

The functions of these kind, are meant to configure the messaging system, defining its "style", once and for all. For this reason such functions are not supposed to be called from threads. Three different tags may be attached to any message: time, domain, and component. The time tag is the time of printing of the message, and can optionally be turned on or off with the functions cpl_msg_set_time_on() and cpl_msg_set_time_off(). The domain tag is an identifier of the main program running (typically, a pipeline recipe), and can be optionally turned on or off with the functions cpl_msg_set_domain_on() and cpl_msg_set_domain_off(). Finally, the component tag is used to identify a component of the program running (typically, a function), and can be optionally turned on or off with the functions cpl_msg_set_component_on() and cpl_msg_set_component_off(). As a default, none of the above tags are attached to messages sent to terminal. However, all tags are always used in messages sent to the log file. A further tag, the severity tag, can never be turned off. This tag depends on the function used to print a message, that can be either cpl_msg_debug(), cpl_msg_info(), cpl_msg_warning(), or cpl_msg_error(). The time and severity tags are all prepended to any message, and are not affected by the message indentation controlled by the functions cpl_msg_indent(), cpl_msg_indent_more(), cpl_msg_indent_less(), and cpl_msg_set_indentation().

Synopsis:
#include <cpl_msg.h>

Function Documentation

void cpl_msg_debug ( const char *  component,
const char *  format,
  ... 
)

Display a debug message.

Returns
Nothing.
Parameters
componentName of the function generating the message.
formatFormat string.
...Variable argument list associated to the format string.

See the description of the function cpl_msg_error().

void cpl_msg_error ( const char *  component,
const char *  format,
  ... 
)

Display an error message.

Returns
Nothing.
Parameters
componentName of the component generating the message.
formatFormat string.
...Variable argument list associated to the format string.

The format string should follow the usual printf() convention. Newline characters shouldn't generally be used, as the message would be split automatically according to the width specified with cpl_msg_set_width(). Inserting a newline character would enforce breaking a line of text even before the current row is filled. Newline characters at the end of the format string are not required. If component is a NULL pointer, it would be set to the string "<empty field>". If format is a NULL pointer, the message "<empty message>" would be printed.

const char* cpl_msg_get_domain ( void  )

Get the domain name.

Returns
Pointer to "domain" string.

This routine returns always the same pointer to the statically allocated buffer containing the "domain" string.

cpl_msg_severity cpl_msg_get_level ( void  )

Get current terminal verbosity level.

Returns
Current verbosity level.

Get current verbosity level set for the output to terminal.

cpl_msg_severity cpl_msg_get_log_level ( void  )

Get current log verbosity level.

Returns
Current verbosity level.

Get current verbosity level set for the output to the log file.

const char* cpl_msg_get_log_name ( void  )

Get the log file name.

Returns
Logfile name

The name of the log file is returned.

void cpl_msg_indent ( int  level)

Set the indentation level.

Returns
Nothing.
Parameters
levelIndentation level.

Any message printed after a call to this function would be indented by a number of characters equal to the level multiplied by the indentation step specified with the function cpl_msg_set_indentation(). Specifying a negative indentation level would set the indentation level to zero.

void cpl_msg_indent_less ( void  )

Decrease the message indentation by one indentation step.

Returns
Nothing.

Calling this function is equivalent to decrease the indentation level by 1. If the indentation level is already 0, it is not decreased.

void cpl_msg_indent_more ( void  )

Increase the message indentation by one indentation step.

Returns
Nothing.

Calling this function is equivalent to increase the indentation level by 1. See function cpl_msg_indent().

void cpl_msg_info ( const char *  component,
const char *  format,
  ... 
)

Display an information message.

Returns
Nothing.
Parameters
componentName of the function generating the message.
formatFormat string.
...Variable argument list associated to the format string.

See the description of the function cpl_msg_error().

void cpl_msg_info_overwritable ( const char *  component,
const char *  format,
  ... 
)

Display an overwritable information message.

Returns
Nothing.
Parameters
componentName of the function generating the message.
formatFormat string.
...Variable argument list associated to the format string.

See the description of the function cpl_msg_error(). The severity of the message issued by cpl_msg_info_overwritable() is the same as the severity of a message issued using cpl_msg_info(). The only difference with the cpl_msg_info() function is that the printed message would be overwritten by a new message issued using again cpl_msg_info_overwritable(), if no other meassages were issued with other messaging functions in between. This function would be used typically in loops, as in the following example:

iter = 1000;
for (i = 0; i < iter; i++) {
"Median computation... %d out of %d", i, iter);
<median computation would take place here>
}
Note
In the current implementation, an overwritable message is obtained by not adding the new-line character ('\n') at the end of the message (contrary to what cpl_msg_info() does).
cpl_error_code cpl_msg_init ( void  )

Initialise the messaging system.

Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_FILE_ALREADY_OPEN The messaging system was already initialised.
CPL_ERROR_DUPLICATING_STREAM stdout and stderr streams cannot be duplicated.
CPL_ERROR_ASSIGNING_STREAM A stream cannot be associated with a file descriptor.

This function needs to be called to activate the messaging system, typically at the beginning of a program. An attempt to use any messaging function before turning the system on would generate a warning message. The messaging system needs to be deactivated by calling the function cpl_msg_stop(). However, since these functions are called anyway by the functions cpl_init() and cpl_end(), there is generally no need to call them explicitly, and starting from CPL 2.1 they are deprecated.

When cpl_msg_init() is called, the stdout and stderr streams are duplicated for greater flexibility of the system. The terminal width is determined (if possible), and the resized window signal handler is deployed to monitor possible changes of the terminal window width. If the width of the output device cannot be determined, lines of text are not splitted when written to output. If line splitting is not wanted, the function cpl_msg_set_width() should be called specifying a non positive width.

void cpl_msg_progress ( const char *  component,
int  i,
int  iter,
const char *  format,
  ... 
)

Display a progress message predicting the time required in a loop.

Returns
Nothing.
Parameters
componentName of the function generating the message.
iIteration, starting with 0 and less than iter.
iterTotal number of iterations.
formatFormat string.
...Variable argument list associated to the format string.
See Also
cpl_msg_info()
Deprecated:
Use standard calls such as cpl_msg_info() instead.
void cpl_msg_set_component_off ( void  )

Disable the component tag in output messages.

Returns
Nothing.

The component tag is turned off in messages written to terminal, unless the verbosity level is set to CPL_MSG_DEBUG. The component tag cannot be turned off in messages written to the log file.

Note
This function is meant to configure once and for all the behaviour and the "style" of the messaging system, and it is not supposed to be called in threads.
void cpl_msg_set_component_on ( void  )

Attach the component tag to output messages.

Returns
Nothing.

As a default, the component tag is attached just to messages written to the log file. This function must be called to display the component tag also in messages written to terminal. To turn the component tag off the function cpl_msg_set_component_off() should be called. However, the component tag is always shown when the verbosity level is set to CPL_MSG_DEBUG.

Note
This function is meant to configure once and for all the behaviour and the "style" of the messaging system, and it is not supposed to be called in threads.
void cpl_msg_set_domain ( const char *  name)

Set the domain name.

Parameters
nameAny task identifier, typically a pipeline recipe name.
Returns
Nothing.

This routine should be called at a pipeline recipe start, and before a possible call to the function cpl_msg_set_log_level() or the proper task identifier would not appear in the log file header. The domain tag is attached to messages sent to terminal only if the function cpl_msg_set_domain_on() is called. If the domain tag is on and no domain tag was specified, the string "Undefined domain" (or something analogous) would be attached to all messages. To turn the domain tag off the function cpl_msg_set_domain_off() should be called. If name is a NULL pointer, nothing is done, and no error is set.

Note
This function is meant to configure once and for all the behaviour and the "style" of the messaging system, and it is not supposed to be called in threads.
void cpl_msg_set_domain_off ( void  )

Disable the domain tag in output messages.

Returns
Nothing.

The domain tag is turned off in messages written to terminal.

Note
This function is meant to configure once and for all the behaviour and the "style" of the messaging system, and it is not supposed to be called in threads.
void cpl_msg_set_domain_on ( void  )

Attach the domain tag to output messages.

Returns
Nothing.

As a default, the domain tag is just written to the header of the log file. This function must be called to attach the domain tag to all messages written to terminal. If the domain tag is on and no domain tag was specified, the string "Undefined domain" (or something analogous) would be attached to all messages. To turn the domain tag off the function cpl_msg_set_domain_off() must be called.

Note
This function is meant to configure once and for all the behaviour and the "style" of the messaging system, and it is not supposed to be called in threads.
void cpl_msg_set_indentation ( int  step)

Set the indentation step.

Parameters
stepIndentation step.
Returns
Nothing.

To maintain a consistent message display style, this routine should be called at most once, and just at program start. A message line might be moved leftward or rightward by a number of characters that is a multiple of the specified indentation step. Setting the indentation step to zero or to a negative number would eliminate messages indentation. If this function is not called, the indentation step defaults to 2.

Note
This function is meant to configure once and for all the behaviour and the "style" of the messaging system, and it is not supposed to be called in threads.
void cpl_msg_set_level ( cpl_msg_severity  verbosity)

Set verbosity level of output to terminal.

Parameters
verbosityVerbosity level.
Returns
Nothing.

The verbosity specifies the lowest severity level that a message should have for being displayed to terminal. If this function is not called, the verbosity level defaults to CPL_MSG_INFO.

Note
This function is not supposed to be called in threads.
void cpl_msg_set_level_from_env ( void  )

Set verbosity level of terminal output using an environment variable.

Returns
void
See Also
cpl_msg_set_level
Note
This function can be used for run-time control of the verbosity level of unit test modules.

The CPL verbosity level of output to terminal is set according to the environment variable CPL_MSG_LEVEL: debug: CPL_MSG_DEBUG info: CPL_MSG_INFO warning: CPL_MSG_WARNING error: CPL_MSG_ERROR off: CPL_MSG_OFF

Any other value (including NULL) will cause the function to do nothing.

cpl_error_code cpl_msg_set_log_level ( cpl_msg_severity  verbosity)

Open and initialise a log file.

Parameters
verbosityVerbosity level.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_FILE_ALREADY_OPEN A log file was already started.
CPL_ERROR_FILE_NOT_CREATED Log file cannot be created.

If the specified verbosity level is different from CPL_MSG_OFF, a log file is created and initialised with a header containing the start logging time, the domain identifier set by the function cpl_msg_set_domain(), and the chosen verbosity level. The verbosity specifies the lowest severity level that a message should have to be written to the log file. The name of the created log file may be previously set with the function cpl_msg_set_log_name(), otherwise it is left to a default ".logfile". The log file name can be obtained by calling the function cpl_msg_get_log_name(). Typically this function is called at the beginning of a program. Calling it while a log file is already open has no effect, but it will return an error code.

Note
This function is meant to configure once and for all the behaviour and the "style" of the messaging system, and it is not supposed to be called in threads.
cpl_error_code cpl_msg_set_log_name ( const char *  name)

Set the log file name.

Parameters
nameName of log file.
Returns
CPL_ERROR_NONE on success.
Errors
CPL_ERROR_NULL_INPUT The specified name is a NULL pointer.
CPL_ERROR_FILE_ALREADY_OPEN A log file was already started.
CPL_ERROR_ILLEGAL_INPUT The specified name is longer than CPL_MAX_LOGFILE_NAME characters (including the terminating '\0').

This function is used to set the log file name, and can only be called before the log is opened by cpl_msg_set_log_level(). If this function is not called, or the specified name is longer than CPL_MAX_LOGFILE_NAME characters, the log file name is left to its default, ".logfile".

Note
This function is meant to configure once and for all the behaviour and the "style" of the messaging system, and it is not supposed to be called in threads.
void cpl_msg_set_threadid_off ( void  )

Disable the thread id tag to output messages.

Returns
Nothing.

The thread id tag is turned off in messages written to terminal. The thread id tag cannot be turned off in messages written to the log file.

Note
This function is meant to configure once and for all the behaviour and the "style" of the messaging system, and it is not supposed to be called in threads.
void cpl_msg_set_threadid_on ( void  )

Attach a thread id tag to output messages.

Returns
Nothing.

As a default, thread ids tags are attached just to messages written to the log file. This function must be called to display the thread id tag also in messages written to terminal. To turn the thread id tag off the function cpl_msg_set_threadid_off() should be called.

Note
This function is meant to configure once and for all the behaviour and the "style" of the messaging system, and it is not supposed to be called in threads.
void cpl_msg_set_time_off ( void  )

Disable the time tag in output messages.

Returns
Nothing.

The time tag is turned off in messages written to terminal. The time tag cannot be turned off in messages written to the log file.

Note
This function is meant to configure once and for all the behaviour and the "style" of the messaging system, and it is not supposed to be called in threads.
void cpl_msg_set_time_on ( void  )

Attach a time tag to output messages.

Returns
Nothing.

As a default, time tags are attached just to messages written to the log file. This function must be called to display the time tag also in messages written to terminal. To turn the time tag off the function cpl_msg_set_time_off() should be called.

Note
This function is meant to configure once and for all the behaviour and the "style" of the messaging system, and it is not supposed to be called in threads.
void cpl_msg_set_width ( int  width)

Set the maximum width of the displayed text.

Parameters
widthMax width of the displayed text.
Returns
Nothing.

If a message is longer than width characters, it would be broken into shorter lines before being displayed to terminal. However, words longer than width would not be broken, and in this case longer lines would be printed. This function is automatically called by the messaging system every time the terminal window is resized, and the width is set equal to the new width of the terminal window. If width is zero or negative, long message lines would not be broken. Lines are never broken in log files.

void cpl_msg_stop ( void  )

Turn the messaging system off.

Returns
Nothing

This function needs to be called to turn the messaging system off, typically at the end of a program. To turn the messaging system on the function cpl_msg_init() needs to be called. However, since these functions are called anyway by the functions cpl_init() and cpl_end(), there is generally no need to call them explicitly, and starting from CPL 2.1 they are deprecated.

When cpl_msg_stop() is called, the default resized window signal handler is restored, and the duplicated output streams are closed. If a log file is still open, it is closed, and the log verbosity level is set to CPL_MSG_OFF. If the messaging system is not on, nothing is done, and no error is set.

cpl_error_code cpl_msg_stop_log ( void  )

Close the current log file.

Returns
CPL_ERROR_NONE on success.

The log file is closed. The name of the created log file is always the same, and can be obtained by calling the function cpl_msg_get_log_name(). An attempt to close a non existing log file would not generate an error condition. This routine may be called in case the logging should be terminated before the end of a program. Otherwise, the function cpl_msg_stop() would automatically close the log file when called at the end of the program.

void cpl_msg_warning ( const char *  component,
const char *  format,
  ... 
)

Display a warning message.

Returns
Nothing.
Parameters
componentName of the function generating the message.
formatFormat string.
...Variable argument list associated to the format string.

See the description of the function cpl_msg_error().

cpl-6.4.1/html/group__cpl__frame.html0000644000460300003120000015551512310333015014511 00000000000000 Common Pipeline Library Reference Manual: Frames
Common Pipeline Library Reference Manual  6.4.1

Macros

#define CPL_FRAME_GROUP_CALIB_ID   "CALIB"
 Frame group tag for calibration data.
 
#define CPL_FRAME_GROUP_PRODUCT_ID   "PRODUCT"
 Frame group tag for processed data.
 
#define CPL_FRAME_GROUP_RAW_ID   "RAW"
 Frame group tag for unprocessed data.
 

Typedefs

typedef struct _cpl_frame_ cpl_frame
 The frame data type.
 
typedef int(* cpl_frame_compare_func )(const cpl_frame *self, const cpl_frame *other)
 Frame comparison function.
 
typedef enum _cpl_frame_group_ cpl_frame_group
 The frame group data type.
 
typedef enum _cpl_frame_level_ cpl_frame_level
 The frame level data type.
 
typedef enum _cpl_frame_type_ cpl_frame_type
 The frame type data type.
 

Enumerations

enum  _cpl_frame_group_ {
  CPL_FRAME_GROUP_NONE,
  CPL_FRAME_GROUP_RAW,
  CPL_FRAME_GROUP_CALIB,
  CPL_FRAME_GROUP_PRODUCT
}
 Supported frame groups. More...
 
enum  _cpl_frame_level_ {
  CPL_FRAME_LEVEL_NONE,
  CPL_FRAME_LEVEL_TEMPORARY,
  CPL_FRAME_LEVEL_INTERMEDIATE,
  CPL_FRAME_LEVEL_FINAL
}
 Supported frame processing levels. More...
 
enum  _cpl_frame_type_ {
  CPL_FRAME_TYPE_NONE,
  CPL_FRAME_TYPE_IMAGE,
  CPL_FRAME_TYPE_MATRIX,
  CPL_FRAME_TYPE_TABLE,
  CPL_FRAME_TYPE_PAF,
  CPL_FRAME_TYPE_ANY
}
 Supported frame types. More...
 

Functions

void cpl_frame_delete (cpl_frame *self)
 Destroy a frame.
 
void cpl_frame_dump (const cpl_frame *frame, FILE *stream)
 Dump the frame debugging information to the given stream.
 
cpl_framecpl_frame_duplicate (const cpl_frame *other)
 Create a copy of a frame.
 
const char * cpl_frame_get_filename (const cpl_frame *self)
 Get the file name to which a frame refers.
 
cpl_frame_group cpl_frame_get_group (const cpl_frame *self)
 Get the current group of a frame.
 
cpl_frame_level cpl_frame_get_level (const cpl_frame *self)
 Get the current level of a frame.
 
cpl_size cpl_frame_get_nextensions (const cpl_frame *self)
 Get the number of extensions of this frame.
 
const char * cpl_frame_get_tag (const cpl_frame *self)
 Get the category tag of a frame.
 
cpl_frame_type cpl_frame_get_type (const cpl_frame *self)
 Get the type of a frame.
 
cpl_framecpl_frame_new (void)
 Create a new, empty frame.
 
cpl_error_code cpl_frame_set_filename (cpl_frame *self, const char *filename)
 Set the file name to which a frame refers.
 
cpl_error_code cpl_frame_set_group (cpl_frame *self, cpl_frame_group group)
 Set the group attribute of a frame.
 
cpl_error_code cpl_frame_set_level (cpl_frame *self, cpl_frame_level level)
 Set the level attribute of a frame.
 
cpl_error_code cpl_frame_set_tag (cpl_frame *self, const char *tag)
 Set a frame's category tag.
 
cpl_error_code cpl_frame_set_type (cpl_frame *self, cpl_frame_type type)
 Set the type of a frame.
 

Detailed Description

This module implements the cpl_frame type. A frame is a container for descriptive attributes related to a data file. The attributes are related to a data file through the file name member of the frame type. Among the attributes which may be assigned to a data file is an attribute identifying the type of the data stored in the file (image or table data), a classification tag indicating the kind of data the file contains and an attribute denoting to which group the data file belongs (raw, processed or calibration file). For processed data a processing level indicates whether the product is an temporary, intermediate or final product.

Synopsis:
#include <cpl_frame.h>

Macro Definition Documentation

#define CPL_FRAME_GROUP_CALIB_ID   "CALIB"

Frame group tag for calibration data.

#define CPL_FRAME_GROUP_PRODUCT_ID   "PRODUCT"

Frame group tag for processed data.

#define CPL_FRAME_GROUP_RAW_ID   "RAW"

Frame group tag for unprocessed data.

Typedef Documentation

typedef struct _cpl_frame_ cpl_frame

The frame data type.

typedef int(* cpl_frame_compare_func)(const cpl_frame *self, const cpl_frame *other)

Frame comparison function.

Type definition for functions which compares the frame other with the frame self.

All function of this type must return -1, 0, or 1 if self is considered to be less than, equal or greater than other respectively.

The frame group data type.

The frame level data type.

The frame type data type.

Enumeration Type Documentation

Supported frame groups.

Defines the possible values for the frame's group attribute.

Enumerator:
CPL_FRAME_GROUP_NONE 

The frame does not belong to any supported group.

CPL_FRAME_GROUP_RAW 

The frame is associated to unprocessed data.

CPL_FRAME_GROUP_CALIB 

The frame is associated to calibration data.

CPL_FRAME_GROUP_PRODUCT 

The frame is associated to processed data.

Supported frame processing levels.

Note
The processing levels are just flags and it is left to the application to trigger the appropriate action for the different levels.
Enumerator:
CPL_FRAME_LEVEL_NONE 

Undefined processing level

CPL_FRAME_LEVEL_TEMPORARY 

Temporary product. The corresponding file will be deleted when the processing chain is completed.

CPL_FRAME_LEVEL_INTERMEDIATE 

Intermediate product. The corresponding file is only kept on request. The default is to delete these products at the end of the processing chain.

CPL_FRAME_LEVEL_FINAL 

Final data product, which is always written to a file at the end of the processing chain.

Supported frame types.

Defines the possible values for the frame's type attribute.

Enumerator:
CPL_FRAME_TYPE_NONE 

Undefined frame type

CPL_FRAME_TYPE_IMAGE 

Image frame type identifier

CPL_FRAME_TYPE_MATRIX 

Matrix frame type identifier

CPL_FRAME_TYPE_TABLE 

Table frame type identifier

CPL_FRAME_TYPE_PAF 

paf frame type identifier

CPL_FRAME_TYPE_ANY 

identifier for any other type

Function Documentation

void cpl_frame_delete ( cpl_frame self)

Destroy a frame.

Parameters
selfA frame.
Returns
Nothing.

The function deallocates the memory used by the frame self. If self is NULL, nothing is done, and no error is set.

void cpl_frame_dump ( const cpl_frame frame,
FILE *  stream 
)

Dump the frame debugging information to the given stream.

Parameters
frameThe frame.
streamThe output stream to use.
Returns
Nothing.

The function dumps the contents of the frame frame to the output stream stream. If stream is NULL the function writes to the standard output. If frame is NULL the function does nothing.

cpl_frame* cpl_frame_duplicate ( const cpl_frame other)

Create a copy of a frame.

Parameters
otherThe frame to copy.
Returns
The function returns a handle for the created clone. If an error occurs the function returns NULL and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter other is a NULL pointer.

The function creates a clone of the input frame other. All members of the input frame are copied.

const char* cpl_frame_get_filename ( const cpl_frame self)

Get the file name to which a frame refers.

Parameters
selfA frame.
Returns
The file name to which the frame refers, or NULL if a file name has not been set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The frame self is not associated to a file.

The function returns the read-only name of a file associated to self. A file is associated to self by calling cpl_frame_set_filename() for self. If self is not associated to a file this function returns NULL.

cpl_frame_group cpl_frame_get_group ( const cpl_frame self)

Get the current group of a frame.

Parameters
selfA frame.
Returns
The frame's current group. The function returns CPL_FRAME_GROUP_NONE if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the group attribute of the frame self.

cpl_frame_level cpl_frame_get_level ( const cpl_frame self)

Get the current level of a frame.

Parameters
selfA frame.
Returns
The frame's current level. The function returns CPL_FRAME_LEVEL_NONE if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the level attribute of the frame self.

cpl_size cpl_frame_get_nextensions ( const cpl_frame self)

Get the number of extensions of this frame.

Parameters
selfA frame.
Returns
The number of extensions in the file
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The frame self is not associated to a file.

The function returns the number of extensions in the frame or -1 in case of error.

const char* cpl_frame_get_tag ( const cpl_frame self)

Get the category tag of a frame.

Parameters
selfA frame.
Returns
The frame's category tag or NULL if the tag is not set. The function returns NULL if an error occurs and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the read-only frame's category tag. If a tag has not yet been set a NULL pointer is returned.

cpl_frame_type cpl_frame_get_type ( const cpl_frame self)

Get the type of a frame.

Parameters
selfA frame.
Returns
The frame's type. The returns CPL_FRAME_TYPE_NONE if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the type of the data object to which it currently refers.

cpl_frame* cpl_frame_new ( void  )

Create a new, empty frame.

Returns
A handle for the newly created frame.

The function allocates the memory for the new frame and initialises it to an empty frame, i.e. it is created without tag and file information, and the type, group and level set to CPL_FRAME_TYPE_NONE, CPL_FRAME_GROUP_NONE, and CPL_FRAME_LEVEL_NONE, resepctively.

cpl_error_code cpl_frame_set_filename ( cpl_frame self,
const char *  filename 
)

Set the file name to which a frame refers.

Parameters
selfA frame.
filenameThe new file name.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or filename is a NULL pointer.

The function sets the name of the file, to which the frame self refers. Any file name which was previously set by a call to this function is replaced. If no file name is present yet it is created and initialised to filename.

cpl_error_code cpl_frame_set_group ( cpl_frame self,
cpl_frame_group  group 
)

Set the group attribute of a frame.

Parameters
selfA frame.
groupNew group attribute.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function sets the group attribute of the frame self to group.

cpl_error_code cpl_frame_set_level ( cpl_frame self,
cpl_frame_level  level 
)

Set the level attribute of a frame.

Parameters
selfA frame.
levelNew level attribute.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function sets the level attribute of the frame self to level.

cpl_error_code cpl_frame_set_tag ( cpl_frame self,
const char *  tag 
)

Set a frame's category tag.

Parameters
selfA frame.
tagThe new category tag.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or tag is a NULL pointer.

The function sets the category tag of self, replacing any previously set tag. If the frame does not yet have a tag is is created and initialised to tag.

cpl_error_code cpl_frame_set_type ( cpl_frame self,
cpl_frame_type  type 
)

Set the type of a frame.

Parameters
selfA frame.
typeNew frame type.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function sets the type of the frame self to type.

cpl-6.4.1/html/group__cpl__recipeconfig.html0000644000460300003120000015510112310333015016043 00000000000000 Common Pipeline Library Reference Manual: Recipe Configurations
Common Pipeline Library Reference Manual  6.4.1
Recipe Configurations

Functions

void cpl_recipeconfig_clear (cpl_recipeconfig *self)
 Clear a recipe configuration object.
 
void cpl_recipeconfig_delete (cpl_recipeconfig *self)
 Delete a recipe configuration object.
 
char ** cpl_recipeconfig_get_inputs (const cpl_recipeconfig *self, const char *tag)
 Get the input configuration for a given tag.
 
cpl_size cpl_recipeconfig_get_max_count (const cpl_recipeconfig *self, const char *tag, const char *input)
 Get the maximum number of frames for the given configuration and tag.
 
cpl_size cpl_recipeconfig_get_min_count (const cpl_recipeconfig *self, const char *tag, const char *input)
 Get the minimum number of frames for the given configuration and tag.
 
char ** cpl_recipeconfig_get_outputs (const cpl_recipeconfig *self, const char *tag)
 Get the output configuration for a given tag.
 
char ** cpl_recipeconfig_get_tags (const cpl_recipeconfig *self)
 Get the list of supported configuration tags.
 
int cpl_recipeconfig_is_required (const cpl_recipeconfig *self, const char *tag, const char *input)
 Check whether a frame with the given tag is required.
 
cpl_recipeconfig * cpl_recipeconfig_new (void)
 Create a new recipe configuration object.
 
int cpl_recipeconfig_set_input (cpl_recipeconfig *self, const char *tag, const char *input, cpl_size min_count, cpl_size max_count)
 Add the configuration for the given input and configuration tag.
 
int cpl_recipeconfig_set_inputs (cpl_recipeconfig *self, const char *tag, const cpl_framedata *data)
 Set the input configuration for a given tag.
 
int cpl_recipeconfig_set_output (cpl_recipeconfig *self, const char *tag, const char *output)
 Add an output frame tag for the given configuration tag.
 
int cpl_recipeconfig_set_outputs (cpl_recipeconfig *self, const char *tag, const char **data)
 Set the output configuration for a given tag.
 
int cpl_recipeconfig_set_tag (cpl_recipeconfig *self, const char *tag, cpl_size min_count, cpl_size max_count)
 Set a configuration tag.
 
int cpl_recipeconfig_set_tags (cpl_recipeconfig *self, const cpl_framedata *data)
 Set the list of configuration tags.
 

Detailed Description

This module implements the support for recipe configurations. A recipe configuration stores information about the input data frames a recipe can process, which other input frame are needed in addition, and which output frames may be created by the recipe.

For each input frame extra information, for instance, whether a particular frame type is a required or optional recipe input, or how many frames of a certain type are at least needed, can also be stored.

The information for the individual recipe configurations and also for the individual frames can be accessed by means of a unique string identifier for the configuration and the frame respectively. This string identifier is called configuration tag in the former, and frame tag in the latter case. In particular, the configuration tag is a frame tag too, namely the frame tag of the recipe's "primary" input, or trigger frame.

The recipe configuration object stores a separate configuration for each of the different frame types, indicated by its tag, it is able to process. Each of these configurations can be retrieved, using the appropriate configuration tag as a key.

In the same way the information about individual frames can be retrieved from the selected configuration.

Synopsis:
#include <cpl_recipeconfig.h>

Function Documentation

void cpl_recipeconfig_clear ( cpl_recipeconfig *  self)

Clear a recipe configuration object.

Parameters
selfThe recipe configuration object.
Returns
Nothing.

The function clears the contents of the recipe configuration self. After the return from this call, self is empty.

See Also
cpl_recipeconfig_new()
void cpl_recipeconfig_delete ( cpl_recipeconfig *  self)

Delete a recipe configuration object.

Parameters
selfThe recipe configuration object.
Returns
Nothing.

The function destroys the recipe configuration object self. Any resources used by self are released. If self is NULL, nothing is done and no error is set.

char** cpl_recipeconfig_get_inputs ( const cpl_recipeconfig *  self,
const char *  tag 
)

Get the input configuration for a given tag.

Parameters
selfThe recipe configuration object.
tagThe tag for which the input configuration is requested.
Returns
On success, the function returns a NULL terminated array of strings, and NULL if an error occurred. In the latter case an appropriate error code is also set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or tag is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The configuration tag tag was not found.

The function retrieves the list of input frame tags stored in the recipe configuration for the configuration tag tag from the configuration object self.

In case the input configuration for the tag tag is empty, i.e. no input frame tag has been added the function still returns a C string array. In this case the first element is set to NULL.

The returned array and each of its elements must be deallocated using cpl_free() if they are no longer used. The array is NULL terminated, i.e. the last element of the array is set to NULL.

cpl_size cpl_recipeconfig_get_max_count ( const cpl_recipeconfig *  self,
const char *  tag,
const char *  input 
)

Get the maximum number of frames for the given configuration and tag.

Parameters
selfThe recipe configuration object.
tagThe configuration tag to look up.
inputThe frame tag to search for.
Returns
The function returns the maximum number of frames with the tag input, or -1, if an error occurred. In the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self, tag or input is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The configuration tag tag is NULL, or an invalid string, the empty string for instance.
CPL_ERROR_DATA_NOT_FOUND No frame tag tag or input was found, or self was not properly initialized.

The function queries the recipe configuration self for the configuration tag tag, searches this configuration for the frame tag input and returns the maximum number of frames required for this frame type.

If the same string is passed as tag and input, the settings for the frame with tag tag are returned.

cpl_size cpl_recipeconfig_get_min_count ( const cpl_recipeconfig *  self,
const char *  tag,
const char *  input 
)

Get the minimum number of frames for the given configuration and tag.

Parameters
selfThe recipe configuration object.
tagThe configuration tag to look up.
inputThe frame tag to search for.
Returns
The function returns the minimum number of frames with the tag input, or -1, if an error occurred. In the latter case an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self, tag or input is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The configuration tag tag is NULL, or an invalid string, the empty string for instance.
CPL_ERROR_DATA_NOT_FOUND No frame tag tag or input was found, or self was not properly initialized.

The function queries the recipe configuration self for the configuration tag tag, searches this configuration for the frame tag input and returns the minimum number of frames required for this frame type.

If the same string is passed as tag and input, the settings for the frame with tag tag are returned.

char** cpl_recipeconfig_get_outputs ( const cpl_recipeconfig *  self,
const char *  tag 
)

Get the output configuration for a given tag.

Parameters
selfThe recipe configuration object.
tagThe tag for which the ouput configuration is requested.
Returns
On success, the function returns a NULL terminated array of strings, and NULL if an error occurred. In the latter case an appropriate error code is also set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or tag is a NULL pointer.
CPL_ERROR_DATA_NOT_FOUND The configuration tag tag was not found.

The function retrieves the list of all possible output frame tags stored in the recipe configuration object self for the configuration tag tag.

In case the output configuration for the tag tag is empty, i.e. no output frame tag has been added the function still returns a C string array. In this case the first element is set to NULL.

The returned array and each of its elements must be deallocated using cpl_free() if they are no longer used. The array is NULL terminated, i.e. the last element of the array is set to NULL.

char** cpl_recipeconfig_get_tags ( const cpl_recipeconfig *  self)

Get the list of supported configuration tags.

Parameters
selfThe recipe configuration object.
Returns
On success, the function returns a NULL terminated array of strings, and NULL if an error occurred. In the latter case an appropriate error code is also set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function retrieves the list of configuration tags stored in the recipe configuration object self. The frame tags are returned as the elements of an array of C strings. The last element of the array is a NULL pointer indicating the end of the list.

In case the recipe configuration object is empty, i.e. no configuration tag has been added, or cpl_recipeconfig_clear() has been called for this object, the function still returns the C string array. In this case the first element is set to NULL.

If the returned list is not used any more each element, and the array itself must be deallocated using cpl_free().

int cpl_recipeconfig_is_required ( const cpl_recipeconfig *  self,
const char *  tag,
const char *  input 
)

Check whether a frame with the given tag is required.

Parameters
selfA recipe configuration object.
tagThe configuration tag to look up.
inputThe frame tag to search for.
Returns
The function returns 1 if the frame with the tag input is required, and 0 if the frame is not a required input. If an error occurred -1 is returned and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self, tag or input is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The frame tag tag is NULL, an invalid string, the empty string for instance.
CPL_ERROR_DATA_NOT_FOUND No frame tag tag or input was found, or self was not properly initialized.

The function queries the recipe configuration self for the configuration tag tag and searches this configuration for the frame tag input. It returns the maximum number of frames required for this frame type.

If the same string is passed as tag and input, the settings for the frame with tag tag are returned.

cpl_recipeconfig* cpl_recipeconfig_new ( void  )

Create a new recipe configuration object.

Returns
The function returns a pointer to the newly created recipe configuration.

The function creates a new, empty recipe configuration object.

int cpl_recipeconfig_set_input ( cpl_recipeconfig *  self,
const char *  tag,
const char *  input,
cpl_size  min_count,
cpl_size  max_count 
)

Add the configuration for the given input and configuration tag.

Parameters
selfThe recipe configuration object.
tagThe configuration tag.
inputThe input frame tag.
min_countThe value to set as the minimum number of frames.
max_countThe value to set as the maximum number of frames.
Returns
The function returns 0 on success and a non-zero value if an error occurred. The return value is -1 if self, tag or input is NULL, or, if tag or input is an invalid string. The function returns 1 if self was not properly initialized using cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags(). If no tag tag is found in self the function returns 2. If an error occurs an appropriate error code is also set.
Errors
CPL_ERROR_NULL_INPUT The parameter self, tag or input is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The frame tag tag or input is an empty string, or tag and input are equal.
CPL_ERROR_DATA_NOT_FOUND No configuration for the tag tag was found, or self was not properly initialized.

The function sets the configuration for the input frame tag input of the configuration associated with the tag tag in the recipe configuration object self. The minimum and maximum number of frames of this input frame tag are given using the min_count and max_count arguments. Using a value of -1 for the minimum and maximum number of frames, means that these two numbers are unspecified. Using a minimum number min_count greater then 0 makes the frame a required input.

Before an input configuration can be set using this function, the configuration tag tag must have been added to self previously using cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags().

See Also
cpl_recipeconfig_set_tag(), cpl_recipeconfig_set_tags()
int cpl_recipeconfig_set_inputs ( cpl_recipeconfig *  self,
const char *  tag,
const cpl_framedata data 
)

Set the input configuration for a given tag.

Parameters
selfThe recipe configuration object.
tagThe tag for which the input configuration is set.
dataAn array containing the configuration informations.
Returns
The function returns 0 on success, or a non-zero value otherwise. If self or tag is NULL, or if tag is invalid, i.e. the empty string the function returns -1 and sets an appropriate error code. If no configuration tags were previously configured using cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags() the function returns 1. If no configuration was found for the given tag tag the return value is 2. Finally, if the frame tag to add to the configuration is invalid, the function returns 3.
Errors
CPL_ERROR_NULL_INPUT The parameter self or tag is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The frame tag tag is an invalid tag, i.e. the empty string or the input frame tag read from data is invalid, or the same as tag.
CPL_ERROR_DATA_NOT_FOUND No configuration for the tag tag was found, or self was not properly initialized.

The function sets the input configuration for the tag tag in the recipe configuration object self. The minimum and maximum number of frames of this tag can be given using the arguments min_count and max_count. Using a value of -1 for the minimum and maximum number of frames, means that these two numbers are unspecified. Using a value greater than 0 for the minimum number of frames makes the input frame a required frame.

The function sets the configuration data for each input tag specified in the array data, until a tag set to NULL is reached. The array data must contain such an entry as last element, in order to indicate the end of the array.

Before an input configuration can be set using this function, the configuration tag tag must have been added to self previously using cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags().

See Also
cpl_recipeconfig_set_tag(), cpl_recipeconfig_set_tags()
int cpl_recipeconfig_set_output ( cpl_recipeconfig *  self,
const char *  tag,
const char *  output 
)

Add an output frame tag for the given configuration tag.

Parameters
selfThe recipe configuration object.
tagThe configuration tag.
outputThe output frame tag to add.
Returns
The function returns 0 on success and a non-zero value if an error occurred. The return value is -1 if self, tag or output is NULL, or if tag or input is an invalid string. The function returns 1 if self was not properly initialized using cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags(). If no tag tag is found in self the function returns 2. If an error occurs an appropriate error code is also set.
Errors
CPL_ERROR_NULL_INPUT The parameter self, tag or output is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The frame tag tag or input is an invalid string, i.e. the empty string.
CPL_ERROR_DATA_NOT_FOUND No configuration for the tag tag was found, or self was not properly initialized.

The function adds the output frame tag ouput to the configuration associated with the tag tag in the recipe configuration object self.

Before an output frame tag can be set using this function, the configuration tag tag must have been added to self previously, using cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags().

See Also
cpl_recipeconfig_set_tag(), cpl_recipeconfig_set_tags()
int cpl_recipeconfig_set_outputs ( cpl_recipeconfig *  self,
const char *  tag,
const char **  data 
)

Set the output configuration for a given tag.

Parameters
selfThe recipe configuration object.
tagThe tag for which the output configuration is set.
dataAn array of strings containing the output frame tags to set.
Returns
The function returns 0 on success, or a non-zero value otherwise. If self or tag is NULL, or if tag is invalid, i.e. the empty string the function returns -1 and sets an appropriate error code. If no configuration tags were previously configured using cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags() the function returns 1. If no configuration was found for the given tag tag the return value is 2.
Errors
CPL_ERROR_NULL_INPUT The parameter self or tag is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The frame tag tag is an invalid tag, i.e. the empty string.
CPL_ERROR_DATA_NOT_FOUND No configuration for the tag tag was found, or self was not properly initialized.

The function sets the output configuration for the tag tag in the recipe configuration object self. The output configuration is a list of all possible frame tags which could result from the execution of the corresponding recipe.

The function stores each output frame tag found in the array data, until an array element set to NULL is reached. The array data must contain such an entry as last element, in order to indicate the end of the array.

Before an output configuration can be set using this function, the configuration tag tag must have been added to self previously using cpl_recipeconfig_set_tag() or cpl_recipeconfig_set_tags().

See Also
cpl_recipeconfig_set_tag(), cpl_recipeconfig_set_tags()
int cpl_recipeconfig_set_tag ( cpl_recipeconfig *  self,
const char *  tag,
cpl_size  min_count,
cpl_size  max_count 
)

Set a configuration tag.

Parameters
selfThe recipe configuration object.
tagThe configuration tag.
min_countThe value to set as the minimum number of frames.
max_countThe value to set as the maximum number of frames.
Returns
The function returns 0 on success and a non-zero value if an error occurred. The return value is -1 if self or tag is NULL, or if tag is an invalid string. If an error occurs an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or tag is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The frame tag tag is an invalid tag, i.e. the empty string.

The function creates a configuration for the configuration tag tag and adds it to the recipe configuration object self. The minimum and maximum number of frames of this tag can be given using the arguments min_count and max_count. Using a value of -1 for the minimum and maximum number of frames, means that these two numbers are unspecified. If the minimum number of frames is greater than 0, the frame is considered to be required, otherwise it is optional.

int cpl_recipeconfig_set_tags ( cpl_recipeconfig *  self,
const cpl_framedata data 
)

Set the list of configuration tags.

Parameters
selfThe recipe configuration object.
dataA frame data array from which the tags are set.
Returns
The function returns 0 on success, or a non-zero value otherwise. Inparticular, if the self is NULL the function returns -1 and sets the appropriate error code. If any configuration tag in the input array data is invalid, an empty string for instance, the function returns 1 and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The frame data array data contains an invalid tag.

The function is a convenience function to allow an initialization of a recipe configuration from static data. The configuration tags to be stored are taken from the frame data array data and are added to the recipe configuration self. The configuration tag is copied to self.

In addition the tags can be configured using the remaining members of the frame data structures of data.

The function adds each configuration tag found in the array data to the configuration self, until a configuration tag set to NULL is reached. The array data must be terminated by such an entry, which indicates the end of the array.

cpl-6.4.1/html/dynsections.js0000644000460300003120000000413412310333014013046 00000000000000function toggleVisibility(linkObj) { var base = $(linkObj).attr('id'); var summary = $('#'+base+'-summary'); var content = $('#'+base+'-content'); var trigger = $('#'+base+'-trigger'); var src=$(trigger).attr('src'); if (content.is(':visible')===true) { content.hide(); summary.show(); $(linkObj).addClass('closed').removeClass('opened'); $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); } else { content.show(); summary.hide(); $(linkObj).removeClass('closed').addClass('opened'); $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); } return false; } function updateStripes() { $('table.directory tr'). removeClass('even').filter(':visible:even').addClass('even'); } function toggleLevel(level) { $('table.directory tr').each(function(){ var l = this.id.split('_').length-1; var i = $('#img'+this.id.substring(3)); var a = $('#arr'+this.id.substring(3)); if (lìK-+KÁ²Ñ.Y”¾dEPaA‰ø°¥¶›ZSÓïÜ;3wºŠ–¯—߯gfîïœsçœWKÇñ.€ÉøD­¨a‘'¬âq_ôˆk¢ÀŒ ÀDŽøQ´ÄïC¨¶åñÏÿgÅ ñ 0„Y‚:qZ¦Á)~õâ€èLý0HVñ× žz-¿‰C“%¨g¦˜6€é8%Úõ¬ëwêÙUÏ¿˜ª³Ä }? ?€·3ÀÀž©Š À”K• @hà a±ðaÇæUe‹ sù~ë2²ì“&Ú&B*AÄljæºììi*˨,Ëçí»÷oÆ£T”,d[˜¼3-*ÁÀ…>å‡Ë çLÉŸçfk˜Ò éw#*AEjKUy>ûšËÉõ&{µ¢8—m5Ki¬ jjƒD*¿NŽÖigwÃ7Dª’mz骹úKÛ¾±ˆ¶M!æ¤ÍkÐ?šoý¬_åÓlXí#Ò~–¸¬ê×ÒÑXŠÓ‘ùRÙ*Eû‚ՂדðEÜ;6«e"Q(²Ù=–¿Ezæ5Kؼָ_ 1òzBªJë ±XŒì96åªjL^7{ùãJÑ÷1½i@%8'7M©_\Qœ#ÓUŒËñýÿyõ Wo Éx8¼s¥v¯ªì|×SnÜ q_m Ýé î>bèÕí[JX,½4[Tú{R£ë¼ôˆ¾þa€tÝjjzzÅ'ÅìȶiIžŽòwÏs ¡€—ÕKøõâC^ŽŒ˜Y­¨µÉ%6¨´êˆº]vÛðhâ½iWv–hôëê°Ò¨¾'æÌ‚·ñ|[ßìúÅ^€YrD=<ýDû]äÇ÷s€Ïõ‹8™ºCì? À ¨—t4õᩎ¡Jã‡W‹É± îr¼cjMɘìx| šE©øNÔ‰œøA¢þ«–€Z¼ñ‡jó î#™§¢¢4gIEND®B`‚cpl-6.4.1/html/group__cpl__framedata.html0000644000460300003120000010421312310333015015330 00000000000000 Common Pipeline Library Reference Manual: Auxiliary Frame Data
Common Pipeline Library Reference Manual  6.4.1
Auxiliary Frame Data

Auxiliary frame data for recipe configurations. More...

Classes

struct  _cpl_framedata_
 The public frame data object. More...
 

Typedefs

typedef struct _cpl_framedata_ cpl_framedata
 The frame data object type.
 

Functions

void cpl_framedata_clear (cpl_framedata *self)
 Clear a frame data object.
 
cpl_framedatacpl_framedata_create (const char *tag, cpl_size min_count, cpl_size max_count)
 Create a new frame data object and initialize it with the given values.
 
void cpl_framedata_delete (cpl_framedata *self)
 Delete a frame data object.
 
cpl_framedatacpl_framedata_duplicate (const cpl_framedata *other)
 Create a duplicate of another frame data object.
 
cpl_size cpl_framedata_get_max_count (const cpl_framedata *self)
 Get the maximum number of frames.
 
cpl_size cpl_framedata_get_min_count (const cpl_framedata *self)
 Get the minimum number of frames.
 
const char * cpl_framedata_get_tag (const cpl_framedata *self)
 Get the frame tag.
 
cpl_framedatacpl_framedata_new (void)
 Create an new frame data object.
 
cpl_error_code cpl_framedata_set (cpl_framedata *self, const char *tag, cpl_size min_count, cpl_size max_count)
 Assign new values to a frame data object.
 
cpl_error_code cpl_framedata_set_max_count (cpl_framedata *self, cpl_size max_count)
 Set the maximum number of frames.
 
cpl_error_code cpl_framedata_set_min_count (cpl_framedata *self, cpl_size min_count)
 Set the minimum number of frames.
 
cpl_error_code cpl_framedata_set_tag (cpl_framedata *self, const char *tag)
 Set the frame tag to the given value.
 

Detailed Description

Auxiliary frame data for recipe configurations.

This module implements a frame data object, which stores auxiliary information of input and output frames of recipes. This information is used to store the frame configurations of recipes which can be queried by an application which is going to invoke the recipe.

The objects stores a frame tag, a unique identifier for a certain kind of frame, the minimum and maximum number of frames needed.

A frame is required if the data member min_count is set to a value greater than 0. The minimum and maximum number of frames is unspecified if the respective member, min_count or max_count, is set to -1.

The data members of this structure are public to allow for a static initialization. Any other access of the data members should still be done using the member functions.

Synopsis:
#include <cpl_framedata.h>

Typedef Documentation

The frame data object type.

Function Documentation

void cpl_framedata_clear ( cpl_framedata self)

Clear a frame data object.

Parameters
selfThe frame data object to clear.
Returns
Nothing.

The function clears the contents of the frame data object self, i.e. resets the data members to their default values. If self is NULL, nothing is done and no error is set.

cpl_framedata* cpl_framedata_create ( const char *  tag,
cpl_size  min_count,
cpl_size  max_count 
)

Create a new frame data object and initialize it with the given values.

Parameters
tagThe frame tag initializer.
min_countThe initial value for the minimum number of frames.
max_countThe initial value for the maximum number of frames.
Returns
On success the function returns a pointer to the newly created object, or NULL otherwise.

The function allocates the memory for a frame data object, and initializes its data members with the given values of the arguments tag, min_count, and max_count.

void cpl_framedata_delete ( cpl_framedata self)

Delete a frame data object.

Parameters
selfThe frame data object to delete.
Returns
Nothing.

The function destroys the frame data object self. All resources used by self are released. If self is NULL, nothing is done and no error is set.

cpl_framedata* cpl_framedata_duplicate ( const cpl_framedata other)

Create a duplicate of another frame data object.

Parameters
otherThe frame data object to clone.
Returns
On success the function returns a pointer to the newly created copy of the frame data object, or NULL otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter other is a NULL pointer.

The function creates a clone of the given frame data object other. The created copy does not share any resources with the original object.

cpl_size cpl_framedata_get_max_count ( const cpl_framedata self)

Get the maximum number of frames.

Parameters
selfThe frame data object.
Returns
The function returns the maximum number of frames on success. In case an error occurred, the return value is -2 and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the maximum number of frames value stored in self. If the returned value is -1, the maximum number of frames is undefined, i.e. any number may be used.

cpl_size cpl_framedata_get_min_count ( const cpl_framedata self)

Get the minimum number of frames.

Parameters
selfThe frame data object.
Returns
The function returns the minimum number of frames on success. In case an error occurred, the return value is -2 and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the minimum number of frames value stored in self. If the returned value is -1, the minimum number of frames is undefined, i.e. any number may be used.

const char* cpl_framedata_get_tag ( const cpl_framedata self)

Get the frame tag.

Parameters
selfThe frame data object.
Returns
The function returns a pointer to the frame tag on success, or NULL if an error occurred.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns a handle to the frame tag stored in the frame data object self.

cpl_framedata* cpl_framedata_new ( void  )

Create an new frame data object.

Returns
On success the function returns a pointer to the newly created object, or NULL otherwise.

The function allocates the memory for a frame data object, and initializes the data members to their default values, i.e. tag is set to NULL, and both, min_count and max_count are set to -1.

cpl_error_code cpl_framedata_set ( cpl_framedata self,
const char *  tag,
cpl_size  min_count,
cpl_size  max_count 
)

Assign new values to a frame data object.

Parameters
selfThe frame data object.
tagThe tag to assign.
min_countThe value to set as minimum number of frames.
max_countThe value to set as maximum number of frames.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter tag is a NULL pointer or the empty string.

The function updates the frame data object self with the given values for tag, min_count, and max_count. All previous values stored in self are replaced. The string tag is assigned by copying its contents.

See Also
cpl_framedata_set_tag()
cpl_error_code cpl_framedata_set_max_count ( cpl_framedata self,
cpl_size  max_count 
)

Set the maximum number of frames.

Parameters
selfThe frame data object.
max_countThe value to set as maximum number of frames.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function sets the maximum number of frames value of self to max_count. If max_count is -1 the maximum number of frames is unspecified.

cpl_error_code cpl_framedata_set_min_count ( cpl_framedata self,
cpl_size  min_count 
)

Set the minimum number of frames.

Parameters
selfThe frame data object.
min_countThe value to set as minimum number of frames.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function sets the minimum number of frames value of self to min_count. If min_count is -1 the minimum number of frames is unspecified.

cpl_error_code cpl_framedata_set_tag ( cpl_framedata self,
const char *  tag 
)

Set the frame tag to the given value.

Parameters
selfThe frame data object.
tagThe tag to assign.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter tag is a NULL pointer or the empty string.

The function assigns the string tag to the corresponding data member of the frame data object self by copying its contents. Any previous tag stored in self is replaced.

cpl-6.4.1/html/group__cpl__detector.html0000644000460300003120000004642712310333015015231 00000000000000 Common Pipeline Library Reference Manual: High-level functions to compute detector features
Common Pipeline Library Reference Manual  6.4.1
High-level functions to compute detector features

Functions

cpl_error_code cpl_detector_interpolate_rejected (cpl_image *self)
 Interpolate any bad pixels in an image and delete the bad pixel map.
 
cpl_error_code cpl_flux_get_bias_window (const cpl_image *diff, const cpl_size *zone_def, cpl_size ron_hsize, cpl_size ron_nsamp, double *bias, double *error)
 Compute the bias in a rectangle.
 
cpl_error_code cpl_flux_get_noise_ring (const cpl_image *diff, const double *zone_def, cpl_size ron_hsize, cpl_size ron_nsamp, double *noise, double *error)
 Compute the readout noise in a ring.
 
cpl_error_code cpl_flux_get_noise_window (const cpl_image *diff, const cpl_size *zone_def, cpl_size ron_hsize, cpl_size ron_nsamp, double *noise, double *error)
 Compute the readout noise in a rectangle.
 

Detailed Description

Synopsis:
#include "cpl_detector.h"

Function Documentation

cpl_error_code cpl_detector_interpolate_rejected ( cpl_image *  self)

Interpolate any bad pixels in an image and delete the bad pixel map.

Parameters
selfThe image to clean
Returns
The _cpl_error_code_ or CPL_ERROR_NONE

The value of a bad pixel is interpolated from the good pixels among the 8 nearest. (If all but one of the eight neighboring pixels are bad, the interpolation becomes a nearest neighbor interpolation). For integer images the interpolation in done with floating-point and rounded to the nearest integer.

If there are pixels for which all of the eight neighboring pixels are bad, a subsequent interpolation pass is done, where the already interpolated pixels are included as source for the interpolation.

The interpolation passes are repeated until all bad pixels have been interpolated. In the worst case, all pixels will be interpolated from a single good pixel.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_DATA_NOT_FOUND if all pixels are bad
cpl_error_code cpl_flux_get_bias_window ( const cpl_image *  diff,
const cpl_size zone_def,
cpl_size  ron_hsize,
cpl_size  ron_nsamp,
double *  bias,
double *  error 
)

Compute the bias in a rectangle.

Parameters
diffInput image, usually a difference frame.
zone_defZone where the bias is to be computed.
ron_hsizeto specify half size of squares (<0 to use default)
ron_nsampto specify the nb of samples (<0 to use default)
biasOutput parameter: bias in the frame.
errorOutput parameter: error on the bias.
Returns
CPL_ERROR_NONE on success or the relevant _cpl_error_code_ on error
See Also
cpl_flux_get_noise_window(), rand()
Note
No calls to srand() are made from CPL
cpl_error_code cpl_flux_get_noise_ring ( const cpl_image *  diff,
const double *  zone_def,
cpl_size  ron_hsize,
cpl_size  ron_nsamp,
double *  noise,
double *  error 
)

Compute the readout noise in a ring.

Parameters
diffInput image, usually a difference frame.
zone_defZone where the readout noise is to be computed.
ron_hsizeto specify half size of squares (<0 to use default)
ron_nsampto specify the nb of samples (<0 to use default)
noiseOn success, *noise is the noise in the frame.
errorNULL, or on success, *error is the error in the noise
Returns
CPL_ERROR_NONE on success or the relevant _cpl_error_code_ on error
See Also
cpl_flux_get_noise_window(), rand()
Note
No calls to srand() are made from CPL

The provided zone is an array of four integers specifying the zone to take into account for the computation. The integers specify a ring as x, y, r1, r2 where these coordinates are given in the FITS notation (x from 1 to nx, y from 1 to ny and bottom to top).

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if diff noise or zone_def is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the internal radius is bigger than the external one in zone_def
  • CPL_ERROR_DATA_NOT_FOUND if an insufficient number of samples were found inside the ring
cpl_error_code cpl_flux_get_noise_window ( const cpl_image *  diff,
const cpl_size zone_def,
cpl_size  ron_hsize,
cpl_size  ron_nsamp,
double *  noise,
double *  error 
)

Compute the readout noise in a rectangle.

Parameters
diffInput image, usually a difference frame.
zone_defZone where the readout noise is to be computed.
ron_hsizeto specify half size of squares (<0 to use default)
ron_nsampto specify the nb of samples (<0 to use default)
noiseOutput parameter: noise in the frame.
errorOutput parameter: error on the noise.
Returns
CPL_ERROR_NONE on success or the relevant _cpl_error_code_ on error
See Also
rand()
Note
No calls to srand() are made from CPL

This function is meant to compute the readout noise in a frame by means of a MonteCarlo approach. The input is a frame, usually a difference between two frames taken with the same settings for the acquisition system, although no check is done on that, it is up to the caller to feed in the right kind of frame.

The provided zone is an array of four integers specifying the zone to take into account for the computation. The integers specify ranges as xmin, xmax, ymin, ymax, where these coordinates are given in the FITS notation (x from 1 to lx, y from 1 to ly and bottom to top). Specify NULL instead of an array of four values to use the whole frame in the computation.

The algorithm will create typically 100 9x9 windows on the frame, scattered optimally using a Poisson law. In each window, the standard deviation of all pixels in the window is computed and this value is stored. The readout noise is the median of all computed standard deviations, and the error is the standard deviation of the standard deviations.

Both noise and error are returned by modifying a passed double. If you do not care about the error, pass NULL.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if diff or noise is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the specified window (zone_def) is invalid
cpl-6.4.1/html/dir_d94ae846f16019cf15b4979bbb4258a2.html0000644000460300003120000006773312310333015016222 00000000000000 Common Pipeline Library Reference Manual: cplcore Directory Reference
Common Pipeline Library Reference Manual  6.4.1
cplcore Directory Reference

Files

file  cpl_array.c
 
file  cpl_array.h
 
file  cpl_array_impl.h
 
file  cpl_bivector.c
 
file  cpl_bivector.h
 
file  cpl_cfitsio.c
 
file  cpl_cfitsio.h
 
file  cpl_column.c
 
file  cpl_column.h
 
file  cpl_error.c
 
file  cpl_error.h
 
file  cpl_error_impl.h
 
file  cpl_errorstate.c
 
file  cpl_errorstate.h
 
file  cpl_filter.h
 
file  cpl_filter_median.c
 
file  cpl_fits.c
 
file  cpl_fits.h
 
file  cpl_image.h
 
file  cpl_image_basic.c
 
file  cpl_image_basic.h
 
file  cpl_image_basic_body.h
 
file  cpl_image_basic_impl.h
 
file  cpl_image_bpm.c
 
file  cpl_image_bpm.h
 
file  cpl_image_bpm_body.h
 
file  cpl_image_defs.h
 
file  cpl_image_filter.c
 
file  cpl_image_filter.h
 
file  cpl_image_filter_body.h
 
file  cpl_image_filter_impl.h
 
file  cpl_image_gen.c
 
file  cpl_image_gen.h
 
file  cpl_image_gen_body.h
 
file  cpl_image_io.c
 
file  cpl_image_io.h
 
file  cpl_image_io_body.h
 
file  cpl_image_io_impl.h
 
file  cpl_image_iqe.c
 
file  cpl_image_iqe.h
 
file  cpl_image_resample.c
 
file  cpl_image_resample.h
 
file  cpl_image_resample_body.h
 
file  cpl_image_stats.c
 
file  cpl_image_stats.h
 
file  cpl_image_stats_body.h
 
file  cpl_imagelist.h
 
file  cpl_imagelist_basic.c
 
file  cpl_imagelist_basic.h
 
file  cpl_imagelist_basic_body.h
 
file  cpl_imagelist_defs.h
 
file  cpl_imagelist_io.c
 
file  cpl_imagelist_io.h
 
file  cpl_init.c
 
file  cpl_init.h
 
file  cpl_io.h
 
file  cpl_io_fits.c
 
file  cpl_io_fits.h
 
file  cpl_macros.h
 
file  cpl_mask.c
 
file  cpl_mask.h
 
file  cpl_mask_binary.h
 
file  cpl_mask_body.h
 
file  cpl_mask_defs.h
 
file  cpl_mask_impl.h
 
file  cpl_math_const.h
 
file  cpl_matrix.c
 
file  cpl_matrix.h
 
file  cpl_matrix_impl.h
 
file  cpl_memory.c
 
file  cpl_memory.h
 
file  cpl_memory_impl.h
 
file  cpl_msg.c
 
file  cpl_msg.h
 
file  cpl_plot.c
 
file  cpl_plot.h
 
file  cpl_polynomial.c
 
file  cpl_polynomial.h
 
file  cpl_polynomial_impl.h
 
file  cpl_property.c
 
file  cpl_property.h
 
file  cpl_propertylist.c
 
file  cpl_propertylist.h
 
file  cpl_propertylist_impl.h
 
file  cpl_stats.c
 
file  cpl_stats.h
 
file  cpl_stats_body.h
 
file  cpl_table.c
 
file  cpl_table.h
 
file  cpl_test.c
 
file  cpl_test.h
 
file  cpl_tools.h
 
file  cpl_tools_body.h
 
file  cpl_type.c
 
file  cpl_type.h
 
file  cpl_type_impl.h
 
file  cpl_vector.c
 
file  cpl_vector.h
 
file  cpl_vector_fit_impl.h
 
file  cpl_vector_impl.h
 
file  cpl_version.c
 
file  cpl_xmemory.c
 
file  cpl_xmemory.h
 
cpl-6.4.1/html/tab_h.png0000644000460300003120000000026112310333014011726 00000000000000‰PNG  IHDR$ÇÇ[xIDATxíÝMÁ@†áž~¥ÜÆÎ’Evˆ¿"!•²‘d*×rGq=Š{¼ßSݧçë­ÓÉHÇ uO^õø[À_‡¢ãXvyËþÒ±=·VCffææ{°öŠó´Rçœ%_õçÿŽ¢ö·°Çrug¶(?gh\i>|sIEND®B`‚cpl-6.4.1/html/group__cpl__mask.html0000644000460300003120000033561412310333014014351 00000000000000 Common Pipeline Library Reference Manual: Masks of pixels
Common Pipeline Library Reference Manual  6.4.1
Masks of pixels

Functions

cpl_error_code cpl_mask_and (cpl_mask *in1, const cpl_mask *in2)
 Performs a logical AND of one mask onto another.
 
cpl_error_code cpl_mask_closing (cpl_mask *in, const cpl_matrix *ker)
 Compute a morphological closing.
 
cpl_mask * cpl_mask_collapse_create (const cpl_mask *in, int dir)
 Collapse a mask.
 
cpl_error_code cpl_mask_copy (cpl_mask *in1, const cpl_mask *in2, cpl_size x_pos, cpl_size y_pos)
 Insert a mask in an other one.
 
cpl_size cpl_mask_count (const cpl_mask *in)
 Get the number of occurences of CPL_BINARY_1.
 
cpl_size cpl_mask_count_window (const cpl_mask *self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Get the number of occurences of CPL_BINARY_1 in a window.
 
void cpl_mask_delete (cpl_mask *m)
 Delete a cpl_mask.
 
cpl_error_code cpl_mask_dilation (cpl_mask *in, const cpl_matrix *ker)
 Compute a morphological dilation.
 
cpl_error_code cpl_mask_dump_window (const cpl_mask *self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, FILE *stream)
 Dump a mask.
 
cpl_mask * cpl_mask_duplicate (const cpl_mask *in)
 Duplicates a cpl_mask.
 
cpl_error_code cpl_mask_erosion (cpl_mask *in, const cpl_matrix *ker)
 Compute a morphological erosion.
 
cpl_mask * cpl_mask_extract (const cpl_mask *in, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Extract a mask from an other one.
 
cpl_mask * cpl_mask_extract_subsample (const cpl_mask *in, cpl_size xstep, cpl_size ystep)
 Subsample a mask.
 
cpl_error_code cpl_mask_filter (cpl_mask *self, const cpl_mask *other, const cpl_mask *kernel, cpl_filter_mode filter, cpl_border_mode border)
 Filter a mask using a binary kernel.
 
cpl_error_code cpl_mask_flip (cpl_mask *in, int angle)
 Flip a mask on a given mirror line.
 
cpl_binary cpl_mask_get (const cpl_mask *self, cpl_size xpos, cpl_size ypos)
 Get the value of a mask at a given position.
 
cpl_binary * cpl_mask_get_data (cpl_mask *in)
 Get a pointer to the data part of the mask.
 
const cpl_binary * cpl_mask_get_data_const (const cpl_mask *in)
 Get a pointer to the data part of the mask.
 
cpl_size cpl_mask_get_size_x (const cpl_mask *in)
 Get the x size of the mask.
 
cpl_size cpl_mask_get_size_y (const cpl_mask *in)
 Get the y size of the mask.
 
cpl_boolean cpl_mask_is_empty (const cpl_mask *self)
 Return CPL_TRUE iff a mask has no elements set (to CPL_BINARY_1)
 
cpl_boolean cpl_mask_is_empty_window (const cpl_mask *self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Return CPL_TRUE iff a mask has no elements set in the window.
 
cpl_mask * cpl_mask_load (const char *filename, cpl_size pnum, cpl_size xtnum)
 Load a mask from a FITS file.
 
cpl_mask * cpl_mask_load_window (const char *filename, cpl_size pnum, cpl_size xtnum, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Load a mask from a FITS file.
 
cpl_error_code cpl_mask_move (cpl_mask *in, cpl_size nb_cut, const cpl_size *new_pos)
 Reorganize the pixels in a mask.
 
cpl_mask * cpl_mask_new (cpl_size nx, cpl_size ny)
 Create a new cpl_mask.
 
cpl_error_code cpl_mask_not (cpl_mask *in)
 Performs a logical NOT on a mask.
 
cpl_error_code cpl_mask_opening (cpl_mask *in, const cpl_matrix *ker)
 Compute a morphological opening.
 
cpl_error_code cpl_mask_or (cpl_mask *in1, const cpl_mask *in2)
 Performs a logical OR of one mask onto another.
 
cpl_error_code cpl_mask_save (const cpl_mask *self, const char *filename, const cpl_propertylist *pl, unsigned mode)
 Save a mask to a FITS file.
 
cpl_error_code cpl_mask_set (cpl_mask *self, cpl_size xpos, cpl_size ypos, cpl_binary value)
 Set a value in a mask at a given position.
 
cpl_error_code cpl_mask_shift (cpl_mask *self, cpl_size dx, cpl_size dy)
 Shift a mask.
 
cpl_error_code cpl_mask_threshold_image (cpl_mask *self, const cpl_image *image, double lo_cut, double hi_cut, cpl_binary inval)
 Select parts of an image with provided thresholds.
 
cpl_mask * cpl_mask_threshold_image_create (const cpl_image *in, double lo_cut, double hi_cut)
 Select parts of an image with provided thresholds.
 
cpl_error_code cpl_mask_turn (cpl_mask *self, int rot)
 Rotate a mask by a multiple of 90 degrees clockwise.
 
void * cpl_mask_unwrap (cpl_mask *m)
 Delete a cpl_mask except the data array.
 
cpl_mask * cpl_mask_wrap (cpl_size nx, cpl_size ny, cpl_binary *data)
 Create a cpl_mask from existing data.
 
cpl_error_code cpl_mask_xor (cpl_mask *in1, const cpl_mask *in2)
 Performs a logical XOR of one mask onto another.
 

Detailed Description

This module provides functions to handle masks of pixels

These masks are useful for object detection routines or bad pixel map handling. Morphological routines (erosion, dilation, closing and opening) and logical operations are provided. A cpl_mask is a kind of binary array whose elements are of type cpl_binary and can take only two values: either CPL_BINARY_0 or CPL_BINARY_1.

The element indexing follows the FITS convention in the sense that the lower left element in a CPL mask has index (1, 1).

Synopsis:
#include "cpl_mask.h"

Function Documentation

cpl_error_code cpl_mask_and ( cpl_mask *  in1,
const cpl_mask *  in2 
)

Performs a logical AND of one mask onto another.

Parameters
in1first mask, to be modified
in2second mask
Returns
CPL_ERROR_NONE on success, otherwise the relevant _cpl_error_code_
See Also
cpl_image_and()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the two masks have different sizes
cpl_error_code cpl_mask_closing ( cpl_mask *  in,
const cpl_matrix *  ker 
)

Compute a morphological closing.

Parameters
ininput mask to filter
kerbinary kernel (0 for 0, any other value is considered as 1)
Returns
CPL_ERROR_NONE on success or the _cpl_error_code_ on failure
See Also
cpl_mask_filter()
Deprecated:
Replace this call with cpl_mask_filter() using CPL_FILTER_CLOSING and CPL_BORDER_ZERO.
cpl_mask* cpl_mask_collapse_create ( const cpl_mask *  in,
int  dir 
)

Collapse a mask.

Parameters
ininput mask to collapse
dircollapsing direction
Returns
the newly allocated mask or NULL on error
Note
The returned mask must be deallocated using cpl_mask_delete().

direction 0 collapses along y, producing a nx by 1 mask direction 1 collapses along x, producing a 1 by ny mask

The resulting mask element is set to CPL_BINARY_1 iff all elements of the associated column (resp. row) in the input mask are set to CPL_BINARY_1.

Direction 0 collapse:

1 0 1    Input mask.
0 1 1
0 0 1
-----
0 0 1    Only the third element is set to CPL_BINARY_1 since all input
         elements of that column are set to CPL_BINARY_1.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT
cpl_error_code cpl_mask_copy ( cpl_mask *  in1,
const cpl_mask *  in2,
cpl_size  x_pos,
cpl_size  y_pos 
)

Insert a mask in an other one.

Parameters
in1mask in which in2 is inserted
in2mask to insert
x_posthe x pixel position in in1 where the lower left pixel of in2 should go (from 1 to the x size of in1)
y_posthe y pixel position in in1 where the lower left pixel of in2 should go (from 1 to the y size of in1)
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if in1 or in2 is NULL
  • CPL_ERROR_ILLEGAL_INPUT if x_pos, y_pos is outside in1
cpl_size cpl_mask_count ( const cpl_mask *  in)

Get the number of occurences of CPL_BINARY_1.

Parameters
inthe input mask
Returns
the number of occurences of CPL_BINARY_1 or -1 on error
See Also
cpl_mask_count_window()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_size cpl_mask_count_window ( const cpl_mask *  self,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Get the number of occurences of CPL_BINARY_1 in a window.

Parameters
selfThe mask to count
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
the number of occurences of CPL_BINARY_1 or -1 on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the window coordinates are invalid
void cpl_mask_delete ( cpl_mask *  m)

Delete a cpl_mask.

Parameters
mcpl_mask to delete
Returns
void

The function deallocates the memory used by the mask m. If m is NULL, nothing is done, and no error is set.

cpl_error_code cpl_mask_dilation ( cpl_mask *  in,
const cpl_matrix *  ker 
)

Compute a morphological dilation.

Parameters
ininput mask to filter
kerbinary kernel (0 for 0, any other value is considered as 1)
Returns
CPL_ERROR_NONE on success or the _cpl_error_code_ on failure
See Also
cpl_mask_filter()
Deprecated:
Replace this call with cpl_mask_filter() using CPL_FILTER_DILATION and CPL_BORDER_ZERO.
cpl_error_code cpl_mask_dump_window ( const cpl_mask *  self,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
FILE *  stream 
)

Dump a mask.

Parameters
selfmask to dump
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
streamOutput stream, accepts stdout or stderr
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if a write operation fails
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the defined window is not in the mask
  • CPL_ERROR_ILLEGAL_INPUT if the window definition is wrong (e.g llx > urx)
cpl_mask* cpl_mask_duplicate ( const cpl_mask *  in)

Duplicates a cpl_mask.

Parameters
inthe mask to duplicate
Returns
1 newly allocated cpl_mask or NULL on error

The returned object must be deallocated using cpl_mask_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if in is NULL
cpl_error_code cpl_mask_erosion ( cpl_mask *  in,
const cpl_matrix *  ker 
)

Compute a morphological erosion.

Parameters
ininput mask to filter
kerbinary kernel (0 for 0, any other value is considered as 1)
Returns
CPL_ERROR_NONE on success or the _cpl_error_code_ on failure
See Also
cpl_mask_filter()
Deprecated:
Replace this call with cpl_mask_filter() using CPL_FILTER_EROSION and CPL_BORDER_ZERO.
cpl_mask* cpl_mask_extract ( const cpl_mask *  in,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Extract a mask from an other one.

Parameters
ininput mask
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
1 newly allocated mask or NULL on error.

The returned mask must be deallocated using cpl_mask_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_ILLEGAL_INPUT if the zone falls outside the mask
  • CPL_ERROR_NULL_INPUT if the input mask is NULL
cpl_mask* cpl_mask_extract_subsample ( const cpl_mask *  in,
cpl_size  xstep,
cpl_size  ystep 
)

Subsample a mask.

Parameters
ininput mask
xstepTake every xstep pixel in x
ystepTake every ystep pixel in y
Returns
the newly allocated mask or NULL on error case
See Also
cpl_image_extract_subsample()

The returned mask must be deallocated using cpl_mask_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if in is NULL
  • CPL_ERROR_ILLEGAL_INPUT if xstep and ystep are not greater than zero
cpl_error_code cpl_mask_filter ( cpl_mask *  self,
const cpl_mask *  other,
const cpl_mask *  kernel,
cpl_filter_mode  filter,
cpl_border_mode  border 
)

Filter a mask using a binary kernel.

Parameters
selfPre-allocated mask to hold the filtered result
otherMask to filter
kernelElements to use, if set to CPL_BINARY_1
filterCPL_FILTER_EROSION, CPL_FILTER_DILATION, CPL_FILTER_OPENING, CPL_FILTER_CLOSING
borderCPL_BORDER_NOP, CPL_BORDER_ZERO or CPL_BORDER_COPY
Returns
CPL_ERROR_NONE or the relevant CPL error code

The two masks must have equal dimensions.

The kernel must have an odd number of rows and an odd number of columns.

At least one kernel element must be set to CPL_BINARY_1.

For erosion and dilation: In-place filtering is not supported, but the input buffer may overlap all but the 1+h first rows of the output buffer, where 1+2*h is the number of rows in the kernel.

For opening and closing: Opening is implemented as an erosion followed by a dilation, and closing is implemented as a dilation followed by an erosion. As such a temporary, internal buffer the size of self is used. Consequently, in-place opening and closing is supported with no additional overhead, it is achieved by passing the same mask as both self and other.

Supported modes: CPL_FILTER_EROSION, CPL_FILTER_DILATION: CPL_BORDER_NOP, CPL_BORDER_ZERO or CPL_BORDER_COPY.

CPL_FILTER_OPENING, CPL_FILTER_CLOSING: CPL_BORDER_ZERO or CPL_BORDER_COPY.

Duality and idempotency: Erosion and Dilation have the duality relations: not(dil(A,B)) = er(not(A), B) and not(er(A,B)) = dil(not(A), B).

Opening and closing have similar duality relations: not(open(A,B)) = close(not(A), B) and not(close(A,B)) = open(not(A), B).

Opening and closing are both idempotent, i.e. open(A,B) = open(open(A,B),B) and close(A,B) = close(close(A,B),B).

The above duality and idempotency relations do not hold on the mask border (with the currently supported border modes).

Unnecessary large kernels: Adding an empty border to a given kernel should not change the outcome of the filtering. However doing so widens the border of the mask to be filtered and therefore has an effect on the filtering of the mask border. Since an unnecessary large kernel is also more costly to apply, such kernels should be avoided.

A 1 x 3 erosion filtering example (error checking omitted for brevity)
cpl_mask * kernel = cpl_mask_new(1, 3);
cpl_mask_not(kernel);
cpl_mask_filter(filtered, raw, kernel, CPL_FILTER_EROSION,

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL.
  • CPL_ERROR_ILLEGAL_INPUT if the kernel has a side of even length.
  • CPL_ERROR_DATA_NOT_FOUND If the kernel is empty.
  • CPL_ERROR_ACCESS_OUT_OF_RANGE If the kernel has a side longer than the input mask.
  • CPL_ERROR_INCOMPATIBLE_INPUT If the input and output masks have incompatible sizes.
  • CPL_ERROR_UNSUPPORTED_MODE If the output pixel buffer overlaps the input one (or the kernel), or the border/filter mode is unsupported.
cpl_error_code cpl_mask_flip ( cpl_mask *  in,
int  angle 
)

Flip a mask on a given mirror line.

Parameters
inmask to flip
anglemirror line in polar coord. is theta = (PI/4) * angle
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

angle can take one of the following values:

  • 0 (theta=0) to flip the image around the horizontal
  • 1 (theta=pi/4) to flip the image around y=x
  • 2 (theta=pi/2) to flip the image around the vertical
  • 3 (theta=3pi/4) to flip the image around y=-x

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if in is NULL
  • CPL_ERROR_ILLEGAL_INPUT if angle is not as specified
cpl_binary cpl_mask_get ( const cpl_mask *  self,
cpl_size  xpos,
cpl_size  ypos 
)

Get the value of a mask at a given position.

Parameters
selfThe input mask
xposPixel x position (FITS convention, 1 for leftmost)
yposPixel y position (FITS convention, 1 for lowest)
Returns
The mask value or undefined if an error code is set

The mask value can be either CPL_BINARY_0 or CPL_BINARY_1

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if xpos or ypos is out of bounds
cpl_binary* cpl_mask_get_data ( cpl_mask *  in)

Get a pointer to the data part of the mask.

Parameters
inthe input mask
Returns
Pointer to the data or NULL on error

The returned pointer refers to already allocated data.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
const cpl_binary* cpl_mask_get_data_const ( const cpl_mask *  in)

Get a pointer to the data part of the mask.

Parameters
inthe input mask
Returns
Pointer to the data or NULL on error
See Also
cpl_mask_get_data
cpl_size cpl_mask_get_size_x ( const cpl_mask *  in)

Get the x size of the mask.

Parameters
inthe input mask
Returns
The mask x size, or -1 on NULL input

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_size cpl_mask_get_size_y ( const cpl_mask *  in)

Get the y size of the mask.

Parameters
inthe input mask
Returns
The mask y size, or -1 on NULL input

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_boolean cpl_mask_is_empty ( const cpl_mask *  self)

Return CPL_TRUE iff a mask has no elements set (to CPL_BINARY_1)

Parameters
selfThe mask to search
Returns
CPL_TRUE iff the mask has no elements set (to CPL_BINARY_1)
See Also
cpl_mask_is_empty_window()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_boolean cpl_mask_is_empty_window ( const cpl_mask *  self,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Return CPL_TRUE iff a mask has no elements set in the window.

Parameters
selfThe mask to search
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
CPL_TRUE iff the mask has no elements set (to CPL_BINARY_1)

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the window coordinates are not valid
cpl_mask* cpl_mask_load ( const char *  filename,
cpl_size  pnum,
cpl_size  xtnum 
)

Load a mask from a FITS file.

Parameters
filenameName of the file to load from.
pnumPlane number in the Data Unit (0 for first)
xtnumExtension number in the file (0 for primary HDU)
Returns
1 newly allocated mask or NULL on error
See Also
cpl_mask_load()

This function loads a mask from a FITS file (NAXIS=2 or 3).

The returned mask has to be deallocated with cpl_mask_delete().

'xtnum' specifies from which extension the mask should be loaded. This could be 0 for the main data section (files without extension), or any number between 1 and N, where N is the number of extensions present in the file.

The requested plane number runs from 0 to nplanes-1, where nplanes is the number of planes present in the requested data section.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_FILE_IO if the file cannot be opened or does not exist
  • CPL_ERROR_BAD_FILE_FORMAT if the data cannot be loaded from the file
  • CPL_ERROR_ILLEGAL_INPUT if the passed extension number is negative
  • CPL_ERROR_DATA_NOT_FOUND if the specified extension has no mask data
cpl_mask* cpl_mask_load_window ( const char *  filename,
cpl_size  pnum,
cpl_size  xtnum,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Load a mask from a FITS file.

Parameters
filenameName of the file to load from.
pnumPlane number in the Data Unit (0 for first)
xtnumExtension number in the file.
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
Returns
1 newly allocated mask or NULL on error
See Also
cpl_mask_load()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_FILE_IO if the file does not exist
  • CPL_ERROR_BAD_FILE_FORMAT if the data cannot be loaded from the file
  • CPL_ERROR_ILLEGAL_INPUT if the passed position is invalid
cpl_error_code cpl_mask_move ( cpl_mask *  in,
cpl_size  nb_cut,
const cpl_size new_pos 
)

Reorganize the pixels in a mask.

Parameters
inmask to collapse
nb_cutthe number of cut in x and y
new_posarray with the nb_cut^2 new positions
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_move()

nb_cut must be positive and divide the size of the input mask in x and y.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if in or new_pos is NULL
  • CPL_ERROR_ILLEGAL_INPUT if nb_cut is not as requested.
cpl_mask* cpl_mask_new ( cpl_size  nx,
cpl_size  ny 
)

Create a new cpl_mask.

Parameters
nxThe number of elements in the X-direction
nyThe number of elements in the Y-direction
Returns
1 newly allocated cpl_mask or NULL on error
Note
The returned object must be deallocated using cpl_mask_delete().

The created cpl_mask elements are all set to CPL_BINARY_0.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_ILLEGAL_INPUT if nx or ny is negative
cpl_error_code cpl_mask_not ( cpl_mask *  in)

Performs a logical NOT on a mask.

Parameters
inmask to be modified
Returns
CPL_ERROR_NONE on success, otherwise the relevant _cpl_error_code_
See Also
cpl_image_not()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_mask_opening ( cpl_mask *  in,
const cpl_matrix *  ker 
)

Compute a morphological opening.

Parameters
ininput mask to filter
kerbinary kernel (0 for 0, any other value is considered as 1)
Returns
CPL_ERROR_NONE on success or the _cpl_error_code_ on failure
See Also
cpl_mask_filter()
Deprecated:
Replace this call with cpl_mask_filter() using CPL_FILTER_OPENING and CPL_BORDER_ZERO.
cpl_error_code cpl_mask_or ( cpl_mask *  in1,
const cpl_mask *  in2 
)

Performs a logical OR of one mask onto another.

Parameters
in1first mask, to be modified
in2second mask
Returns
CPL_ERROR_NONE on success, otherwise the relevant _cpl_error_code_
See Also
cpl_image_or()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the two masks have different sizes
cpl_error_code cpl_mask_save ( const cpl_mask *  self,
const char *  filename,
const cpl_propertylist pl,
unsigned  mode 
)

Save a mask to a FITS file.

Parameters
selfmask to write to disk
filenameName of the file to write
plProperty list for the output header or NULL
modeThe desired output options
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error
See Also
cpl_propertylist_save()

This function saves a mask to a FITS file. If a property list is provided, it is written to the header where the mask is written.

The type used in the file is CPL_TYPE_UCHAR (8 bit unsigned).

Supported output modes are CPL_IO_CREATE (create a new file) and CPL_IO_EXTEND (append a new extension to an existing file)

The output mode CPL_IO_EXTEND can be combined (via bit-wise or) with an option for tile-compression. This compression is lossless. The options are: CPL_IO_COMPRESS_GZIP, CPL_IO_COMPRESS_RICE, CPL_IO_COMPRESS_HCOMPRESS, CPL_IO_COMPRESS_PLIO.

Note that in append mode the file must be writable (and do not take for granted that a file is writable just because it was created by the same application, as this depends from the system umask).

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the mode is not supported
  • CPL_ERROR_FILE_NOT_CREATED if the output file cannot be created
  • CPL_ERROR_FILE_IO if the data cannot be written to the file
cpl_error_code cpl_mask_set ( cpl_mask *  self,
cpl_size  xpos,
cpl_size  ypos,
cpl_binary  value 
)

Set a value in a mask at a given position.

Parameters
selfthe input mask
xposPixel x position (FITS convention, 1 for leftmost)
yposPixel y position (FITS convention, 1 for lowest)
valuethe value to set in the mask
Returns
the _cpl_error_code_ or CPL_ERROR_NONE

The value can be either CPL_BINARY_0 or CPL_BINARY_1

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if xpos or ypos is out of bounds or if value is different from CPL_BINARY_0 and CPL_BINARY_1
cpl_error_code cpl_mask_shift ( cpl_mask *  self,
cpl_size  dx,
cpl_size  dy 
)

Shift a mask.

Parameters
selfMask to shift in place
dxShift in X
dyShift in Y
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See Also
cpl_image_turn()

The 'empty zone' in the shifted mask is set to CPL_BINARY_1. The shift values have to be valid: -nx < dx < nx and -ny < dy < ny

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if in is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the offsets are too big
cpl_error_code cpl_mask_threshold_image ( cpl_mask *  self,
const cpl_image *  image,
double  lo_cut,
double  hi_cut,
cpl_binary  inval 
)

Select parts of an image with provided thresholds.

Parameters
selfMask to flag according to threshold
imageImage to threshold.
lo_cutLower bound for threshold.
hi_cutHigher bound for threshold.
invalThis value (CPL_BINARY_1 or CPL_BINARY_0) is assigned where the pixel value is not marked as rejected and is strictly inside the provided interval. The other positions are assigned the other value.
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_ on error

The input image type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT. If lo_cut is greater than or equal to hi_cut, then the mask is filled with outval.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_UNSUPPORTED_MODE if the pixel type is unsupported
  • CPL_ERROR_INCOMPATIBLE_INPUT if the mask and image have different sizes
  • CPL_ERROR_ILLEGAL_INPUT if inval is not one of CPL_BINARY_1 or CPL_BINARY_0
cpl_mask* cpl_mask_threshold_image_create ( const cpl_image *  in,
double  lo_cut,
double  hi_cut 
)

Select parts of an image with provided thresholds.

Parameters
inImage to threshold.
lo_cutLower bound for threshold.
hi_cutHigher bound for threshold.
Returns
1 newly allocated mask or NULL on error
Note
The returned mask must be deallocated with cpl_mask_delete()
See Also
cpl_mask_threshold_image()
cpl_error_code cpl_mask_turn ( cpl_mask *  self,
int  rot 
)

Rotate a mask by a multiple of 90 degrees clockwise.

Parameters
selfMask to rotate in place
rotThe multiple: -1 is a rotation of 90 deg counterclockwise.
Returns
CPL_ERROR_NONE on success, otherwise the relevant _cpl_error_code_
See Also
cpl_image_turn()

rot may be any integer value, its modulo 4 determines the rotation:

  • -3 to turn 270 degrees counterclockwise.
  • -2 to turn 180 degrees counterclockwise.
  • -1 to turn 90 degrees counterclockwise.
  • 0 to not turn
  • +1 to turn 90 degrees clockwise (same as -3)
  • +2 to turn 180 degrees clockwise (same as -2).
  • +3 to turn 270 degrees clockwise (same as -1).

The definition of the rotation relies on the FITS convention: The lower left corner of the image is at (1,1), x increasing from left to right, y increasing from bottom to top.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if self is NULL
void* cpl_mask_unwrap ( cpl_mask *  m)

Delete a cpl_mask except the data array.

Parameters
mcpl_mask to delete
Returns
A pointer to the data array or NULL if the input is NULL.
Note
The data array must be deallocated, otherwise a memory leak occurs.
cpl_mask* cpl_mask_wrap ( cpl_size  nx,
cpl_size  ny,
cpl_binary *  data 
)

Create a cpl_mask from existing data.

Parameters
nxnumber of element in x direction
nynumber of element in y direction
dataPointer to array of nx*ny cpl_binary
Returns
1 newly allocated cpl_mask or NULL in case of an error
Note
The returned object must be deallocated using cpl_mask_unwrap().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if nx or ny is negative or zero
cpl_error_code cpl_mask_xor ( cpl_mask *  in1,
const cpl_mask *  in2 
)

Performs a logical XOR of one mask onto another.

Parameters
in1first mask, to be modified
in2second mask
Returns
CPL_ERROR_NONE on success, otherwise the relevant _cpl_error_code_
See Also
cpl_image_xor()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the two masks have different sizes
cpl-6.4.1/html/group__cpl__init.html0000644000460300003120000002137112310333014014351 00000000000000 Common Pipeline Library Reference Manual: Library Initialization
Common Pipeline Library Reference Manual  6.4.1
Library Initialization

Functions

void cpl_end (void)
 Stop the internal subsystems of CPL.
 
const char * cpl_get_description (unsigned self)
 Create a string of version numbers of CPL and its libraries.
 
void cpl_init (unsigned self)
 Initialise the CPL core library.
 

Detailed Description

The module provides the CPL library startup routine. The startup routine initialises CPL internal data structures. For this reason, any application using functions from the CPL libraries must call the startup routine prior to calling any other CPL function.

Synopsis:
#include <cpl_init.h>

Function Documentation

void cpl_end ( void  )

Stop the internal subsystems of CPL.

Returns
Nothing.
Note
Currently, the behaviour of any CPL function becomes undefined after this function is called.

This function must be called after any other CPL function is called.

const char* cpl_get_description ( unsigned  self)

Create a string of version numbers of CPL and its libraries.

Parameters
selfCPL_DESCRIPTION_DEFAULT
Returns
A pointer to a constant character array
void cpl_init ( unsigned  self)

Initialise the CPL core library.

Parameters
selfCPL_INIT_DEFAULT is the only supported value
Returns
Nothing.
Note
The function must be called once before any other CPL function.
See Also
cpl_fits_set_mode()

This function sets up the library internal subsystems, which other CPL functions expect to be in a defined state. In particular, the CPL memory management and the CPL messaging systems are initialised by this function call.

One of the internal subsystems of CPL handles memory allocation. The default CPL memory mode is defined during the build procedure, this default can be changed during the call to cpl_init() via the environment variable CPL_MEMORY_MODE. The valid values are 0: Use the default system functions for memory handling 1: Exit if a memory-allocation fails, provide checking for memory leaks, limited reporting of memory allocation and limited protection on deallocation of invalid pointers. 2: Exit if a memory-allocation fails, provide checking for memory leaks, extended reporting of memory allocation and protection on deallocation of invalid pointers. Any other value (including NULL) will leave the default memory mode unchanged.

This function also reads the environment variable CPL_IO_MODE. Iff set to 1, cpl_fits_set_mode() is called with CPL_FITS_START_CACHING.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_INCOMPATIBLE_INPUT if there is an inconsistency between the run- time and compile-time versions of a library that CPL depends on internally, e.g. CFITSIO. This error may occur with dynamic linking. If it does occur, the use of CPL may lead to unexpected behaviour.
cpl-6.4.1/html/ftv2pnode.png0000644000460300003120000000034512310333014012563 00000000000000‰PNG  IHDRɪ|¬IDATxí=QF‘Ø¥D«ÔkÄ:‰F©PK؃=V@§Õ³ Õ8SHxñÌ0bnrróŠ{ò½¿¾’$ ÀÏTŠP  ö¼X¬OÛd6êìòð"°²S´±O¥B€(¡àQé)š+YĈ ÒªËRÉÐ>VtÉsˆm9(ê„䜥k‚-@ȧ-Ü$ó b Ò[he ¿Kp-ôl|CùÿApRG'rÍ­aIEND®B`‚cpl-6.4.1/html/group__cpl__recipedefine.html0000644000460300003120000003612712310333015016036 00000000000000 Common Pipeline Library Reference Manual: Recipe Definition
Common Pipeline Library Reference Manual  6.4.1
Recipe Definition

Macros

#define cpl_get_license(PACKAGE_NAME, YEAR)
 Generate the recipe copyright and license text (GPL v.2)
 
#define cpl_recipe_define(RECIPE_NAME, RECIPE_VERSION, RECIPE_AUTHOR,RECIPE_EMAIL, RECIPE_YEAR,RECIPE_SYNOPSIS, RECIPE_DESCRIPTION)
 Define a standard CPL recipe.
 
#define CPL_RECIPE_DEFINE(RECIPE_NAME, RECIPE_VERSION, RECIPE_FILL_PARAMS,RECIPE_AUTHOR, RECIPE_AUTHOR_EMAIL, RECIPE_YEAR,RECIPE_SYNOPSIS, RECIPE_DESCRIPTION)
 Define a standard CPL recipe.
 

Detailed Description

This module implements the support for recipe defition.

Synopsis:
#include <cpl_recipedefine.h>

Macro Definition Documentation

#define cpl_get_license (   PACKAGE_NAME,
  YEAR 
)

Generate the recipe copyright and license text (GPL v.2)

Parameters
PACKAGE_NAMEThe name as a string literal, e.g. from config.h
YEARThe year(s) as a string literal
Returns
The recipe copyright and license text as a string literal

Example:

const char * eso_gpl_license = cpl_get_license(PACKAGE_NAME, "2005, 2008");
#define cpl_recipe_define (   RECIPE_NAME,
  RECIPE_VERSION,
  RECIPE_AUTHOR,
  RECIPE_EMAIL,
  RECIPE_YEAR,
  RECIPE_SYNOPSIS,
  RECIPE_DESCRIPTION 
)

Define a standard CPL recipe.

Parameters
RECIPE_NAMEThe name as an identifier
RECIPE_VERSIONThe binary version number
RECIPE_AUTHORThe author as a string literal
RECIPE_EMAILThe contact email as a string literal
RECIPE_YEARThe copyright year as a string literal
RECIPE_SYNOPSISThe synopsis as a string literal
RECIPE_DESCRIPTIONThe man-page as a string literal

A CPL-based recipe may use this macro to define its four mandatory functions: cpl_plugin_get_info(), <recipe>_create(), <recipe>_exec() and <recipe>_destroy(), as well as declaring the actual data reduction function, <recipe>() as

static int <recipe>(cpl_frameset *, const cpl_parameterlist *);

The macro also declares the recipe-specific function that fills the recipe parameterlist with the supported parameters as

static cpl_error_code <recipe>_fill_parameterlist(cpl_parameterlist *self);

A recipe that invokes cpl_recipe_define() must define this function.

The macro cpl_recipe_define() may be used by defining a macro, e.g. in my_recipe.h:

#define MY_RECIPE_DEFINE(NAME, SYNOPSIS, DESCRIPTION) \
cpl_recipe_define(NAME, MY_BINARY_VERSION, \
"Firstname Lastname", "2006, 2008", SYNOPSIS, DESCRIPTION)
  • and then by invoking this macro in each recipe:
#include "my_recipe.h"
MY_RECIPE_DEFINE(instrume_img_dark,
"Dark recipe",
"instrume_img_dark -- imaging dark recipe.\n"
" ... recipe man-page\n");
static
cpl_error_code instrume_img_dark_fill_parameterlist(cpl_parameterlist *self);
{
// Fill the parameterlist with the parameters supported by the recipe.
}
#define CPL_RECIPE_DEFINE (   RECIPE_NAME,
  RECIPE_VERSION,
  RECIPE_FILL_PARAMS,
  RECIPE_AUTHOR,
  RECIPE_AUTHOR_EMAIL,
  RECIPE_YEAR,
  RECIPE_SYNOPSIS,
  RECIPE_DESCRIPTION 
)

Define a standard CPL recipe.

Parameters
RECIPE_NAMEThe name as an identifier
RECIPE_VERSIONThe binary version number
RECIPE_FILL_PARAMSA function call to fill the recipe parameterlist. Must evaluate to zero if and only if successful
RECIPE_AUTHORThe author as a string literal
RECIPE_AUTHOR_EMAILThe author email as a string literal
RECIPE_YEARThe copyright year as a string literal
RECIPE_SYNOPSISThe synopsis as a string literal
RECIPE_DESCRIPTIONThe man-page as a string literal
Deprecated:
Use cpl_recipe_define()
cpl-6.4.1/html/group__cpl__polynomial.html0000644000460300003120000025321712310333014015577 00000000000000 Common Pipeline Library Reference Manual: Polynomials
Common Pipeline Library Reference Manual  6.4.1
Polynomials

Functions

cpl_error_code cpl_polynomial_add (cpl_polynomial *self, const cpl_polynomial *first, const cpl_polynomial *second)
 Add two polynomials of the same dimension.
 
int cpl_polynomial_compare (const cpl_polynomial *p1, const cpl_polynomial *p2, double tol)
 Compare the coefficients of two polynomials.
 
cpl_error_code cpl_polynomial_copy (cpl_polynomial *out, const cpl_polynomial *in)
 This function copies contents of a polynomial into another one.
 
void cpl_polynomial_delete (cpl_polynomial *p)
 Delete a cpl_polynomial.
 
cpl_error_code cpl_polynomial_derivative (cpl_polynomial *self, cpl_size dim)
 Compute a first order partial derivative.
 
cpl_error_code cpl_polynomial_dump (const cpl_polynomial *p, FILE *stream)
 Dump a cpl_polynomial as ASCII to a stream.
 
cpl_polynomial * cpl_polynomial_duplicate (const cpl_polynomial *p)
 This function duplicates an existing polynomial.
 
double cpl_polynomial_eval (const cpl_polynomial *p, const cpl_vector *x)
 Evaluate the polynomial at the given point.
 
double cpl_polynomial_eval_1d (const cpl_polynomial *self, double x, double *pd)
 Evaluate a univariate (1D) polynomial using Horners rule.
 
double cpl_polynomial_eval_1d_diff (const cpl_polynomial *self, double a, double b, double *ppa)
 Evaluate p(a) - p(b) using Horners rule.
 
cpl_polynomial * cpl_polynomial_extract (const cpl_polynomial *self, cpl_size dim, const cpl_polynomial *other)
 Collapse one dimension of a multi-variate polynomial by composition.
 
cpl_error_code cpl_polynomial_fit (cpl_polynomial *self, const cpl_matrix *samppos, const cpl_boolean *sampsym, const cpl_vector *fitvals, const cpl_vector *fitsigm, cpl_boolean dimdeg, const cpl_size *mindeg, const cpl_size *maxdeg)
 Fit a polynomial to a set of samples in a least squares sense.
 
cpl_polynomial * cpl_polynomial_fit_1d_create (const cpl_vector *x_pos, const cpl_vector *values, cpl_size degree, double *mse)
 Fit a 1D-polynomial to a 1D-signal in a least squares sense.
 
cpl_polynomial * cpl_polynomial_fit_2d_create (cpl_bivector *xy_pos, cpl_vector *values, cpl_size degree, double *mse)
 Fit a 2D-polynomial to a 2D-surface in a least squares sense.
 
double cpl_polynomial_get_coeff (const cpl_polynomial *in, const cpl_size *pows)
 Get a coefficient of the polynomial.
 
cpl_size cpl_polynomial_get_degree (const cpl_polynomial *p)
 The degree of the polynomial.
 
cpl_size cpl_polynomial_get_dimension (const cpl_polynomial *p)
 The dimension of the polynomial.
 
cpl_error_code cpl_polynomial_multiply_scalar (cpl_polynomial *self, const cpl_polynomial *other, double factor)
 Multiply a polynomial with a scalar.
 
cpl_polynomial * cpl_polynomial_new (cpl_size dim)
 Create a new cpl_polynomial.
 
cpl_error_code cpl_polynomial_set_coeff (cpl_polynomial *in, const cpl_size *pows, double c)
 Set a coefficient of the polynomial.
 
cpl_error_code cpl_polynomial_shift_1d (cpl_polynomial *p, cpl_size i, double u)
 Modify p, p(x0, x1, ..., xi, ...) := (x0, x1, ..., xi+u, ...)
 
cpl_error_code cpl_polynomial_solve_1d (const cpl_polynomial *p, double x0, double *px, cpl_size mul)
 A real solution to p(x) = 0 using Newton-Raphsons method.
 
cpl_error_code cpl_polynomial_subtract (cpl_polynomial *self, const cpl_polynomial *first, const cpl_polynomial *second)
 Subtract two polynomials of the same dimension.
 
cpl_error_code cpl_vector_fill_polynomial (cpl_vector *v, const cpl_polynomial *p, double x0, double d)
 Evaluate a 1D-polynomial on equidistant points using Horners rule.
 
cpl_error_code cpl_vector_fill_polynomial_fit_residual (cpl_vector *self, const cpl_vector *fitvals, const cpl_vector *fitsigm, const cpl_polynomial *fit, const cpl_matrix *samppos, double *rechisq)
 Compute the residual of a polynomial fit.
 

Detailed Description

This module provides functions to handle uni- and multivariate polynomials.

Univariate (1D) polynomials use the Horner rule for evaluation, while multivariate polynomials are evaluated simply as the sum of each term.

This means that of the two polynomials

* P1(x) = p0 + p1.x + p4.x^2
* 

and

* P2(x,y) = p0 + p1.x + p2.y + p3.x.y + p4.x^2 + p5.y^2
* 

P1(x) may evaluate to more accurate results than P2(x,0), especially around the roots.

Note that a polynomial like P3(z) = p0 + p1.z + p2.z^2 + p3.z^3, z=x^4 is preferable to p4(x) = p0 + p1.x^4 + p2.x^8 + p3.x^12.

Function Documentation

cpl_error_code cpl_polynomial_add ( cpl_polynomial *  self,
const cpl_polynomial *  first,
const cpl_polynomial *  second 
)

Add two polynomials of the same dimension.

Parameters
selfThe polynomial to hold the result
firstThe 1st polynomial to add
secondThe 2nd polynomial to add
Returns
CPL_ERROR_NONE or the relevant CPL error code
Note
self may be passed also as first and/or second

Possible CPL error code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the polynomials do not have identical dimensions
  • CPL_ERROR_UNSUPPORTED_MODE if the dimension is not 1 (FIXME)
int cpl_polynomial_compare ( const cpl_polynomial *  p1,
const cpl_polynomial *  p2,
double  tol 
)

Compare the coefficients of two polynomials.

Parameters
p1the 1st polynomial
p2the 2nd polynomial
tolThe absolute (non-negative) tolerance
Returns
0 when equal, positive when different, negative on error.

The two polynomials are considered equal iff they have identical dimensions and the absolute difference between their coefficients does not exceed the tolerance.

This means that the following pair of polynomials per definition are considered different: P1(x1,x2) = 3*x1 different from P2(x1) = 3*x1.

If all parameters are valid and p1 and p2 point to the same polynomial the functions returns 0.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if tol is negative
cpl_error_code cpl_polynomial_copy ( cpl_polynomial *  out,
const cpl_polynomial *  in 
)

This function copies contents of a polynomial into another one.

Parameters
outPre-allocated output cpl_polynomial
inInput cpl_polynomial
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_

in and out must point to different polynomials.

If out already contains coefficients, they are overwritten.

This is the only function that can modify the dimension of a polynomial.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if in and out point to the same polynomial
void cpl_polynomial_delete ( cpl_polynomial *  p)

Delete a cpl_polynomial.

Parameters
pcpl_polynomial to delete
Returns
void

The function deallocates the memory used by the polynomial p. If p is NULL, nothing is done, and no error is set.

cpl_error_code cpl_polynomial_derivative ( cpl_polynomial *  self,
cpl_size  dim 
)

Compute a first order partial derivative.

Parameters
selfThe polynomial to be modified in place
dimThe dimension to differentiate (zero for first dimension)
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_

The dimension of the polynomial is preserved, even if the operation may cause the polynomial to become independent of the dimension dim of the variable.

The call requires n FLOPs, where n is the number of (non-zero) polynomial coefficients whose power in dimension dim is at least 1.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if dim is negative.
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if dim exceeds the dimension of self.
cpl_error_code cpl_polynomial_dump ( const cpl_polynomial *  p,
FILE *  stream 
)

Dump a cpl_polynomial as ASCII to a stream.

Parameters
pInput cpl_polynomial to dump
streamOutput stream, accepts stdout or stderr
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_

Each coefficient is preceded by its integer power(s) and written on a single line. If the polynomial has non-zero coefficients, only those are printed, otherwise the (zero-valued) constant term is printed.

Comment lines start with the hash character.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if the write operation fails
cpl_polynomial* cpl_polynomial_duplicate ( const cpl_polynomial *  p)

This function duplicates an existing polynomial.

Parameters
pThe input cpl_polynomial
Returns
A newly allocated cpl_polynomial or NULL on error

Notice that the returned object is a newly allocated cpl_polynomial that must be deallocated by the caller using cpl_polynomial_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
double cpl_polynomial_eval ( const cpl_polynomial *  p,
const cpl_vector *  x 
)

Evaluate the polynomial at the given point.

Parameters
pThe polynomial
xPoint of evaluation
Returns
The computed value or undefined on error.

The length of x must be the polynomial dimension.

A polynomial with no non-zero coefficients evaluates as 0.

If the classical evaluation method is used, the computational cost is:

For 1-dimensional polynomials the call requires 2n FLOPs where n+1 is the number of coefficients in p, see also cpl_polynomial_eval_1d().

For multivariate polynomials the call requires n*(1+dim) + d_1 + d_2 + ... + d_dim FLOPs, where dim is the dimension, n is the number of coefficients in p and d_i is the highest power used in dimension i, i = 1, 2, ..., dim.

If the Horner evaluation method is used the complexity has not been studied yet.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the length of x differs from the dimension of the polynomial
double cpl_polynomial_eval_1d ( const cpl_polynomial *  self,
double  x,
double *  pd 
)

Evaluate a univariate (1D) polynomial using Horners rule.

Parameters
selfThe 1D-polynomial
xThe point of evaluation
pdIff pd is non-NULL, the derivative evaluated at x
Returns
The result or undefined on error.

A polynomial with no non-zero coefficents evaluates to 0 with a derivative that does likewise.

The result is computed as p_0 + x * ( p_1 + x * ( p_2 + ... x * p_n )) and requires 2n FLOPs where n+1 is the number of coefficients.

If the derivative is requested it is computed using a nested Horner rule. This requires 4n FLOPs in total.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the polynomial is not (1D) univariate
double cpl_polynomial_eval_1d_diff ( const cpl_polynomial *  self,
double  a,
double  b,
double *  ppa 
)

Evaluate p(a) - p(b) using Horners rule.

Parameters
selfThe 1D-polynomial
aThe evaluation point of the minuend
bThe evaluation point of the subtrahend
ppaIff ppa is not NULL, p(a)
Returns
The difference or undefined on error

The call requires about 4n FLOPs where n is the number of coefficients in self, which is the same as that required for two separate polynomial evaluations. cpl_polynomial_eval_1d_diff() is however more accurate.

ppa may be NULL. If it is not, *ppa is set to self(a), which is calculated at no extra cost.

The underlying algorithm is the same as that used in cpl_polynomial_eval_1d() when the derivative is also requested.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the polynomial has the wrong dimension
cpl_polynomial* cpl_polynomial_extract ( const cpl_polynomial *  self,
cpl_size  dim,
const cpl_polynomial *  other 
)

Collapse one dimension of a multi-variate polynomial by composition.

Parameters
selfThe multi-variate polynomial
dimThe dimension to collapse (zero for first dimension)
otherThe polynomial to replace dimension dim of self
Returns
The collapsed polynomial or NULL on error

The dimension of the polynomial self must be one greater than that of the other polynomial. Given these two polynomials the dimension dim of self is collapsed by creating a new polynomial from self(x0, x1, ..., x{dim-1}, other(x0, x1, ..., x{dim-1}, x{dim+1}, x{dim+2}, ..., x{n-1}), x{dim+1}, x{dim+2}, ..., x{n-1}).

The created polynomial thus has a dimension which is one less than the polynomial self and which is equal to that of the other polynomial. Collapsing one dimension of a 1D-polynomial is equivalent to evaluating it, which can be done with cpl_polynomial_eval_1d().

FIXME: The other polynomial must currently have a degree of zero, i.e. it must be a constant.

Currently, the call requires dn + p FLOPs, where d the dimension of the polynomial self, p is the largest power of dimension dim and n the number of (non-zero) coefficients of the polynomial self.

The returned object is a newly allocated cpl_polynomial that must be deallocated by the caller using cpl_polynomial_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the polynomial is uni-variate.
  • CPL_ERROR_ILLEGAL_INPUT if dim is negative.
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if dim exceeds the dimension of self.
  • CPL_ERROR_INCOMPATIBLE_INPUT if other has the wrong dimension.
  • CPL_ERROR_UNSUPPORTED_MODE if other is not of degree 0.
cpl_error_code cpl_polynomial_fit ( cpl_polynomial *  self,
const cpl_matrix *  samppos,
const cpl_boolean *  sampsym,
const cpl_vector *  fitvals,
const cpl_vector *  fitsigm,
cpl_boolean  dimdeg,
const cpl_size mindeg,
const cpl_size maxdeg 
)

Fit a polynomial to a set of samples in a least squares sense.

Parameters
selfPolynomial of dimension d to hold the coefficients
sampposMatrix of p sample positions, with d rows and p columns
sampsymNULL, or d booleans, true iff the sampling is symmetric
fitvalsVector of the p values to fit
fitsigmUncertainties of the sampled values, or NULL for all ones
dimdegTrue iff there is a fitting degree per dimension
mindegPointer to 1 or d minimum fitting degree(s), or NULL
maxdegPointer to 1 or d maximum fitting degree(s), at least mindeg
Returns
CPL_ERROR_NONE on success, else the relevant _cpl_error_code_
Note
Currently only uni- and bi-variate polynomials are supported, fitsigm must be NULL. For all but uni-variate polynomials mindeg must be zero.
See Also
cpl_vector_fill_polynomial_fit_residual()

Any pre-set non-zero coefficients in self are overwritten or reset by the fit.

For 1D-polynomials N = 1 + maxdeg - mindeg coefficients are fitted.

For multi-variate polynomials the fit depends on dimdeg:

If dimdeg is false, an n-degree coefficient is fitted iff mindeg <= n <= maxdeg. For a 2D-polynomial this means that N * (N + 1) / 2 coefficients are fitted.

If dimdeg is true, nci = 1 + maxdeg[i] + mindeg[i] coefficients are fitted for dimension i, i.e. for a 2D-polynomial N = nc1 * nc2 coefficients are fitted.

The number of distinct samples should exceed the number of coefficients to fit. The number of distinct samples may also equal the number of coefficients to fit, but in this case the fit has another meaning (any non-zero residual is due to rounding errors, not a fitting error). It is an error to try to fit more coefficients than there are distinct samples.

If the relative uncertainties of the sampled values are known, they may be passed via fitsigm. NULL means that all uncertainties equals one.

symsamp is ignored if mindeg is nonzero, otherwise the caller may use sampsym to indicate an a priori knowledge that the sampling positions are symmetric. NULL indicates no knowledge of such symmetry. sampsym[i] may be set to true iff the sampling is symmetric around u_i, where u_i is the mean of the sampling positions in dimension i.

In 1D this implies that the sampling points as pairs average u_0 (with an odd number of samples one sample must equal u_0). E.g. both x = (1, 2, 4, 6, 7) and x = (1, 6, 4, 2, 7) have sampling symmetry, while x = (1, 2, 4, 6) does not.

In 2D this implies that the sampling points are symmetric in the 2D-plane. For the first dimension sampling symmetry means that the sampling is line- symmetric around y = u_1, while for the second dimension, sampling symmetry implies line-symmetry around x = u_2. Point symmetry around (x,y) = (u_1, u_2) means that both sampsym[0] and sampsym[1] may be set to true.

Knowledge of symmetric sampling allows the fit to be both faster and eliminates certain round-off errors.

For higher order fitting the fitting problem known as "Runge's phenomenon" is minimized using the socalled "Chebyshev nodes" as sampling points. For Chebyshev nodes symsamp can be set to CPL_TRUE.

Warning: An increase in the polynomial degree will normally reduce the fitting error. However, due to rounding errors and the limited accuracy of the solver of the normal equations, an increase in the polynomial degree may at some point cause the fitting error to increase. In some cases this happens with an increase of the polynomial degree from 8 to 9.

The fit is done in the following steps: 1) If mindeg is zero, the sampling positions are first transformed into Xhat_i = X_i - mean(X_i), i=1, .., dimension. 2) The Vandermonde matrix is formed from Xhat. 3) The normal equations of the Vandermonde matrix is solved. 4) If mindeg is zero, the resulting polynomial in Xhat is transformed back to X.

For a univariate (1D) fit the call requires 6MN + N^3/3 + 7/2N^2 + O(M) FLOPs where M is the number of data points and where N is the number of polynomial coefficients to fit, N = 1 + maxdeg - mindeg.

For a bivariate fit the call requires MN^2 + N^3/3 + O(MN) FLOPs where M is the number of data points and where N is the number of polynomial coefficients to fit.

Examples of usage:

cpl_polynomial * fit1d = cpl_polynomial_new(1);
cpl_matrix * samppos1d = my_sampling_points_1d(); // 1-row matrix
cpl_vector * fitvals = my_sampling_values();
const cpl_boolean sampsym = CPL_TRUE;
const int maxdeg1d = 4; // Fit 5 coefficients
= cpl_polynomial_fit(fit1d, samppos1d, &sampsym, fitvals, NULL,
CPL_FALSE, NULL, &maxdeg1d);
cpl_polynomial * fit2d = cpl_polynomial_new(2);
cpl_matrix * samppos2d = my_sampling_points_2d(); // 2-row matrix
cpl_vector * fitvals = my_sampling_values();
const int maxdeg2d[] = {2, 1}; // Fit 6 coefficients
= cpl_polynomial_fit(fit2d, samppos2d, NULL, fitvals, NULL, CPL_FALSE,
NULL, maxdeg2d);

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if a mindeg value is negative, or if a maxdeg value is less than the corresponding mindeg value.
  • CPL_ERROR_DATA_NOT_FOUND if the number of columns in samppos is less than the number of coefficients to be determined.
  • CPL_ERROR_INCOMPATIBLE_INPUT if samppos, fitvals or fitsigm have incompatible sizes, or if samppos, self or sampsym have incompatible sizes.
  • CPL_ERROR_SINGULAR_MATRIX if samppos contains too few distinct values
  • CPL_ERROR_DIVISION_BY_ZERO if an element in fitsigm is zero
  • CPL_ERROR_UNSUPPORTED_MODE if the polynomial dimension exceeds two, or if there is a non-zero value in the mindeg array.
cpl_polynomial* cpl_polynomial_fit_1d_create ( const cpl_vector *  x_pos,
const cpl_vector *  values,
cpl_size  degree,
double *  mse 
)

Fit a 1D-polynomial to a 1D-signal in a least squares sense.

Parameters
x_posVector of positions of the signal to fit.
valuesVector of values of the signal to fit.
degreeNon-negative polynomial degree.
mseIff mse is not null, the mean squared error on success
Returns
The fitted polynomial or NULL on error
See Also
cpl_polynomial_fit()
Deprecated:
Replace this call with cpl_polynomial_fit() and optionally cpl_vector_fill_polynomial_fit_residual().
cpl_polynomial* cpl_polynomial_fit_2d_create ( cpl_bivector *  xy_pos,
cpl_vector *  values,
cpl_size  degree,
double *  mse 
)

Fit a 2D-polynomial to a 2D-surface in a least squares sense.

Parameters
xy_posBivector positions of the surface to fit.
valuesVector of values of the surface to fit.
degreeNon-negative polynomial degree.
mseIff mse is not null, the mean squared error on success
Returns
The fitted polynomial or NULL on error
See Also
cpl_polynomial_fit()
Deprecated:
Replace this call with cpl_polynomial_fit() and optionally cpl_vector_fill_polynomial_fit_residual().
double cpl_polynomial_get_coeff ( const cpl_polynomial *  in,
const cpl_size pows 
)

Get a coefficient of the polynomial.

Parameters
inthe input polynomial
powsthe powers of the different variables
Returns
The coefficient or undefined on error

The array pows must have the size of the polynomial dimension and have non-negative elements.

It is allowed to specify a (set of) power(s) for which no coefficient has previously been set. In this case the function returns zero.

Example of usage:

const cpl_size power = 3;
double coefficient = cpl_polynomial_get_coeff(poly1d, &power);

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if pows contains negative values
cpl_size cpl_polynomial_get_degree ( const cpl_polynomial *  p)

The degree of the polynomial.

Parameters
pthe polynomial
Returns
The degree or negative on error

The degree is the highest sum of exponents (with a non-zero coefficient).

If there are no non-zero coefficients the degree is zero.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_size cpl_polynomial_get_dimension ( const cpl_polynomial *  p)

The dimension of the polynomial.

Parameters
pthe polynomial
Returns
The dimension or negative on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
cpl_error_code cpl_polynomial_multiply_scalar ( cpl_polynomial *  self,
const cpl_polynomial *  other,
double  factor 
)

Multiply a polynomial with a scalar.

Parameters
selfThe polynomial to hold the result
otherThe polynomial to scale, may equal self
factorThe factor to multiply with
Returns
CPL_ERROR_NONE or the relevant CPL error code

Possible CPL error code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_UNSUPPORTED_MODE if the dimension is not 1 (FIXME)
cpl_polynomial* cpl_polynomial_new ( cpl_size  dim)

Create a new cpl_polynomial.

Parameters
dimThe positive polynomial dimension (number of variables)
Returns
1 newly allocated cpl_polynomial, or NULL on error

The returned object must be deallocated using cpl_polynomial_delete().

A newly created polynomial has degree 0 and evaluates as 0.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_ILLEGAL_INPUT if dim is negative or zero
cpl_error_code cpl_polynomial_set_coeff ( cpl_polynomial *  in,
const cpl_size pows,
double  c 
)

Set a coefficient of the polynomial.

Parameters
inthe input polynomial
powsthe powers of the different variables
cthe coefficient
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_

The array pows must have the size of the polynomial dimension and have non-negative elements.

If the coefficient is already there, it is overwritten, if not, a new coefficient is added to the polynomial. This may cause the degree of the polynomial to be increased.

Setting the coefficient of x1^4 * x3^2 in the 4-dimensional polynomial poly4d to 12.3 would be performed by:

const cpl_size pows[] = {4, 0, 2, 0};
cpl_error_code error = cpl_polynomial_set_coeff(poly4d, pows, 12.3);

Setting the coefficient of x^3 in the 1-dimensional polynomial poly1d to 12.3 would be performed by:

const cpl_size power = 3;
cpl_error_code error = cpl_polynomial_set_coeff(poly1d, &power, 12.3);

For efficiency reasons the coefficients of a 1D-polynomial are best inserted with that of the highest power first.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if pows contains negative values
cpl_error_code cpl_polynomial_shift_1d ( cpl_polynomial *  p,
cpl_size  i,
double  u 
)

Modify p, p(x0, x1, ..., xi, ...) := (x0, x1, ..., xi+u, ...)

Parameters
pThe polynomial to be modified in place
iThe dimension to shift (0 for first)
uThe shift
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_
Note
Currently, only dimensions 1 and 2 are supported

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if i is negative
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if i exceeds the dimension of p
  • CPL_ERROR_UNSUPPORTED_MODE if the polynomial has a dimension larger than 2
cpl_error_code cpl_polynomial_solve_1d ( const cpl_polynomial *  p,
double  x0,
double *  px,
cpl_size  mul 
)

A real solution to p(x) = 0 using Newton-Raphsons method.

Parameters
pThe 1D-polynomial
x0First guess of the solution
pxThe solution, on error see below
mulThe root multiplicity (or 1 if unknown)
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_

Even if a real solution exists, it may not be found if the first guess is too far from the solution. But a solution is guaranteed to be found if all roots of p are real. If the constant term is zero, the solution 0 will be returned regardless of the first guess.

No solution is found when the iterative process stops because: 1) It can not proceed because p`(x) = 0 (CPL_ERROR_DIVISION_BY_ZERO). 2) Only a finite number of iterations are allowed (CPL_ERROR_CONTINUE). Both cases may be due to lack of a real solution or a bad first guess. In these two cases *px is set to the value where the error occurred. In case of other errors *px is unmodified.

The accuracy and robustness deteriorates with increasing multiplicity of the solution. This is also the case with numerical multiplicity, i.e. when multiple solutions are located close together.

mul is assumed to be the multiplicity of the solution. Knowledge of the root multiplicity often improves the robustness and accuracy. If there is no knowledge of the root multiplicity mul should be 1. Setting mul to a too high value should be avoided.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the polynomial has the wrong dimension
  • CPL_ERROR_ILLEGAL_INPUT if the multiplicity is non-positive
  • CPL_ERROR_DIVISION_BY_ZERO if a division by zero occurs
  • CPL_ERROR_CONTINUE if the algorithm does not converge
cpl_error_code cpl_polynomial_subtract ( cpl_polynomial *  self,
const cpl_polynomial *  first,
const cpl_polynomial *  second 
)

Subtract two polynomials of the same dimension.

Parameters
selfThe polynomial to hold the result
firstThe polynomial to subtract from
secondThe polynomial to subtract
Returns
CPL_ERROR_NONE or the relevant CPL error code
Note
self may be passed also as first and/or second

Possible CPL error code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the polynomials do not have identical dimensions
  • CPL_ERROR_UNSUPPORTED_MODE if the dimension is not 1 (FIXME)
cpl_error_code cpl_vector_fill_polynomial ( cpl_vector *  v,
const cpl_polynomial *  p,
double  x0,
double  d 
)

Evaluate a 1D-polynomial on equidistant points using Horners rule.

Parameters
vPreallocated vector to contain the result
pThe 1D-polynomial
x0The first point of evaluation
dThe increment between points of evaluation
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_
See Also
cpl_vector_fill

The evaluation points are x_i = x0 + i * d, i=0, 1, ..., n-1, where n is the length of the vector.

If d is zero it is preferable to simply use cpl_vector_fill(v, cpl_polynomial_eval_1d(p, x0, NULL)).

The call requires about 2nm FLOPs, where m+1 is the number of coefficients in p.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INVALID_TYPE if the polynomial has the wrong dimension
cpl_error_code cpl_vector_fill_polynomial_fit_residual ( cpl_vector *  self,
const cpl_vector *  fitvals,
const cpl_vector *  fitsigm,
const cpl_polynomial *  fit,
const cpl_matrix *  samppos,
double *  rechisq 
)

Compute the residual of a polynomial fit.

Parameters
selfVector to hold the fitting residuals, fitvals may be used
fitvalsVector of the p fitted values
fitsigmUncertainties of the sampled values or NULL for a uniform uncertainty
fitThe fitted polynomial
sampposMatrix of p sample positions, with d rows and p columns
rechisqIf non-NULL, the reduced chi square of the fit
Returns
CPL_ERROR_NONE on success, else the relevant _cpl_error_code_
Note
If necessary, self is resized to the length of fitvals.
See Also
cpl_polynomial_fit()

It is allowed to pass the same vector as both fitvals and as self, in which case fitvals is overwritten with the residuals.

If the relative uncertainties of the sampled values are known, they may be passed via fitsigm. NULL means that all uncertainties equal one. The uncertainties are taken into account when computing the reduced chi square value.

If rechisq is non-NULL, the reduced chi square of the fit is computed as well.

The mean square error, which was computed directly by the former CPL functions cpl_polynomial_fit_1d_create() and cpl_polynomial_fit_2d_create() can be computed from the fitting residual like this:

const double mse = cpl_vector_product(fitresidual, fitresidual)
/ cpl_vector_get_size(fitresidual);

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer (other than fitsigm) is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if samppos, fitvals, fitsigm or fit have incompatible sizes
  • CPL_ERROR_DIVISION_BY_ZERO if an element in fitsigm is zero
  • CPL_ERROR_DATA_NOT_FOUND if the number of columns in samppos is less than the number of coefficients in the fitted polynomial.
cpl-6.4.1/html/group__cpl__fft.html0000644000460300003120000003577312310333015014201 00000000000000 Common Pipeline Library Reference Manual: FFTW wrappers
Common Pipeline Library Reference Manual  6.4.1
FFTW wrappers

Typedefs

typedef enum _cpl_fft_mode_ cpl_fft_mode
 The CPL fft mode.
 

Enumerations

enum  _cpl_fft_mode_ {
  CPL_FFT_FORWARD,
  CPL_FFT_BACKWARD,
  CPL_FFT_NOSCALE,
  CPL_FFT_FIND_MEASURE,
  CPL_FFT_FIND_PATIENT,
  CPL_FFT_FIND_EXHAUSTIVE
}
 The supported values of the CPL fft mode. More...
 

Functions

cpl_error_code cpl_fft_image (cpl_image *self, const cpl_image *other, cpl_fft_mode mode)
 Perform a FFT operation on an image.
 
cpl_error_code cpl_fft_imagelist (cpl_imagelist *self, const cpl_imagelist *other, cpl_fft_mode mode)
 Perform a FFT operation on the images in an imagelist.
 

Detailed Description

This module provides FFTW wrappers

Synopsis:
#include "cpl_fft.h"

Typedef Documentation

The CPL fft mode.

Enumeration Type Documentation

The supported values of the CPL fft mode.

Enumerator:
CPL_FFT_FORWARD 

The forward transform

CPL_FFT_BACKWARD 

The backward transform

CPL_FFT_NOSCALE 

Transform without scaling (has no effect on forward transform)

CPL_FFT_FIND_MEASURE 

Spend time finding the best transform

CPL_FFT_FIND_PATIENT 

Spend more time finding the best transform

CPL_FFT_FIND_EXHAUSTIVE 

Spend even more time finding the best transform

Function Documentation

cpl_error_code cpl_fft_image ( cpl_image *  self,
const cpl_image *  other,
cpl_fft_mode  mode 
)

Perform a FFT operation on an image.

Parameters
selfPre-allocated output image to transform to
otherInput image to transform from, use self for in-place transform
modeCPL_FFT_FORWARD or CPL_FFT_BACKWARD, optionally CPL_FFT_NOSCALE
Returns
CPL_ERROR_NONE or the corresponding _cpl_error_code_ on error

This function performs an FFT on an image, using FFTW. CPL may be configured without this library, in this case an otherwise valid call will set and return the error CPL_ERROR_UNSUPPORTED_MODE.

The input and output images must match in precision level. Integer images are not supported.

In a forward transform the input image may be non-complex. In this case a real-to-complex transform is performed. This will only compute the first ny/2 + 1 columns of the transform. In this transform it is allowed to pass an output image with ny/2 + 1 columns.

Similarly, in a backward transform the output image may be non-complex. In this case a complex-to-real transform is performed. This will only transform the first ny/2 + 1 columns of the input. In this transform it is allowed to pass an input image with ny/2 + 1 columns.

Per default the backward transform scales (divides) the result with the number of elements transformed (i.e. the number of pixels in the result image). This scaling can be turned off with CPL_FFT_NOSCALE.

If many transformations in the same direction are to be done on data of the same size and type, a reduction in the time required to perform the transformations can be achieved by adding the flag CPL_FFT_FIND_MEASURE to the first transformation. For a larger number of transformations a further reduction may be achived with the flag CPL_FFT_FIND_PATIENT and for an even larger number of transformations a further reduction may be achived with the flag CPL_FFT_FIND_EXHAUSTIVE.

If many transformations are to be done then a reduction in the time required to perform the transformations can be achieved by using cpl_fft_imagelist().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an image is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the mode is illegal
  • CPL_ERROR_INCOMPATIBLE_INPUT if the image sizes do not match
  • CPL_ERROR_TYPE_MISMATCH if the image types are incompatible with each other or with the transform
  • CPL_ERROR_UNSUPPORTED_MODE if FFTW has not been installed
cpl_error_code cpl_fft_imagelist ( cpl_imagelist *  self,
const cpl_imagelist *  other,
cpl_fft_mode  mode 
)

Perform a FFT operation on the images in an imagelist.

Parameters
selfPre-allocated output imagelist to transform to
otherInput imagelist to transform from
modeCPL_FFT_FORWARD or CPL_FFT_BACKWARD, optionally CPL_FFT_NOSCALE
Returns
CPL_ERROR_NONE or the corresponding _cpl_error_code_ on error
See Also
cpl_fft_image()
cpl-6.4.1/html/bdwn.png0000644000460300003120000000022312310333014011601 00000000000000‰PNG  IHDR5åZIDATxíË € DŸP–1ñlžmÀ r±j².e è†D[ØÉ¾ÙÏÔ¼µ¦ã´Þ|陣6€Všë3´Å?Ls'(}¬>+ žKó÷¥¿ch`‚ ^׃ÞnIEND®B`‚cpl-6.4.1/html/form_10.png0000644000460300003120000000032212310333016012114 00000000000000‰PNG  IHDR U.T±0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïAIDATxíÁ À /!¡-E°ÿ¶-„ŠWG8É’ewø‹ºŠKT£Ù]fÏÐQý¤¶ÇÅÒ;5ñEª¥Óbß<'ÌÂ˜ŽºIEND®B`‚cpl-6.4.1/html/form_13.png0000644000460300003120000000042512310333017012124 00000000000000‰PNG  IHDR#Yi†&0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ï„IDATxíÛ ! Dîz[ÝúÿÛ¨±Ø"}(ô180‘Ã$úÿWô!|Q¸ ¸W{€=¼Deml2Ù¼«6¦ÎF¼äBÒ[¬L›{uXÎÊñµïµäb2EyÃqwg´Æ}’ì{යs3©AÎG]'³{yÏfù&€­ÆD€ßõ oê4ùDIEND®B`‚cpl-6.4.1/html/group__cpl__frameset.html0000644000460300003120000022363712310333015015226 00000000000000 Common Pipeline Library Reference Manual: Frame Sets
Common Pipeline Library Reference Manual  6.4.1
Frame Sets

Modules

 Frame Set Iterators
 Iterator support for frame sets.
 

Typedefs

typedef struct _cpl_frameset_ cpl_frameset
 The frame set data type.
 

Functions

int cpl_frameset_count_tags (const cpl_frameset *self, const char *tag)
 Counts the frames stored in a frame set having the given tag.
 
void cpl_frameset_delete (cpl_frameset *self)
 Destroy a frame set.
 
void cpl_frameset_dump (const cpl_frameset *self, FILE *stream)
 Dump the frameset debugging information to the given stream.
 
cpl_framesetcpl_frameset_duplicate (const cpl_frameset *other)
 Create a copy of the given frame set.
 
cpl_size cpl_frameset_erase (cpl_frameset *self, const char *tag)
 Erase all frames with the given tag from a frame set.
 
cpl_error_code cpl_frameset_erase_frame (cpl_frameset *self, cpl_frame *frame)
 Erase the given frame from a frame set.
 
cpl_framesetcpl_frameset_extract (const cpl_frameset *self, const cpl_size *labels, cpl_size desired_label)
 Extract a subset of frames from a set of frames.
 
cpl_framecpl_frameset_find (cpl_frameset *self, const char *tag)
 Find a frame with the given tag in a frame set.
 
const cpl_framecpl_frameset_find_const (const cpl_frameset *self, const char *tag)
 Find a frame with the given tag in a frame set.
 
cpl_framecpl_frameset_get_first (cpl_frameset *self)
 Get the first frame in the given set.
 
const cpl_framecpl_frameset_get_first_const (const cpl_frameset *self)
 Get the first frame in the given set.
 
cpl_framecpl_frameset_get_frame (cpl_frameset *set, cpl_size position)
 Get a frame from a frame set.
 
const cpl_framecpl_frameset_get_frame_const (const cpl_frameset *set, cpl_size position)
 Get a frame from a frame set.
 
cpl_framecpl_frameset_get_next (cpl_frameset *self)
 Get the next frame in the given set.
 
const cpl_framecpl_frameset_get_next_const (const cpl_frameset *self)
 Get the next frame in the given set.
 
cpl_framecpl_frameset_get_position (cpl_frameset *self, cpl_size position)
 Get the frame at a given position in the frame set.
 
const cpl_framecpl_frameset_get_position_const (const cpl_frameset *self, cpl_size position)
 Get the frame at a given iterator position.
 
cpl_size cpl_frameset_get_size (const cpl_frameset *self)
 Get the current size of a frame set.
 
cpl_error_code cpl_frameset_insert (cpl_frameset *self, cpl_frame *frame)
 Insert a frame into the given frame set.
 
int cpl_frameset_is_empty (const cpl_frameset *self)
 Check whether a frame set is empty.
 
cpl_error_code cpl_frameset_join (cpl_frameset *self, const cpl_frameset *other)
 Join two frame sets.
 
cpl_sizecpl_frameset_labelise (const cpl_frameset *self, int(*compare)(const cpl_frame *, const cpl_frame *), cpl_size *nb_labels)
 Separate a list of frames into groups, using a comparison function.
 
cpl_framesetcpl_frameset_new (void)
 Create a new, empty frame set.
 
cpl_error_code cpl_frameset_sort (cpl_frameset *self, cpl_frame_compare_func compare)
 Sort a frame set.
 

Detailed Description

The module implements a container type for frames. Frames can be stored in a frame set and retrieved, either by searching for a particular frame tag or by sequential access. Frame sets can be created, filled and saved to a so called `set of frames' file or loaded from such a file.

Synopsis:
#include <cpl_frameset.h>

Typedef Documentation

typedef struct _cpl_frameset_ cpl_frameset

The frame set data type.

This data type is opaque.

Function Documentation

int cpl_frameset_count_tags ( const cpl_frameset self,
const char *  tag 
)

Counts the frames stored in a frame set having the given tag.

Parameters
selfA frame set.
tagThe frame tag.
Returns
The number of frames with tag tag. The function returns 0 if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or tag is a NULL pointer.

The function scans the frame set self for frames with the tag tag and returns the number of frames found.

void cpl_frameset_delete ( cpl_frameset self)

Destroy a frame set.

Parameters
selfThe frame set to destroy.
Returns
Nothing.

The function destroys the frame set self and its whole contents. If self is NULL, nothing is done and no error is set.

void cpl_frameset_dump ( const cpl_frameset self,
FILE *  stream 
)

Dump the frameset debugging information to the given stream.

Parameters
selfThe frameset.
streamThe output stream to use.
Returns
Nothing.

The function dumps the contents of the frameset self to the output stream stream. If stream is NULL the function writes to the standard output. If self is NULL or the frameset is empty, the function does nothing.

cpl_frameset* cpl_frameset_duplicate ( const cpl_frameset other)

Create a copy of the given frame set.

Parameters
otherThe frame set to be copied.
Returns
A handle for the created clone. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter other is a NULL pointer.

The function creates a deep copy, i.e. the frame set object and its contents, of the frame set other. The created copy and the original set do not share any resources.

cpl_size cpl_frameset_erase ( cpl_frameset self,
const char *  tag 
)

Erase all frames with the given tag from a frame set.

Parameters
selfA frame set.
tagThe tag used to locate the frames to remove.
Returns
The function returns the number of frames removed. If an error occurs 0 is returned and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self or tag is a NULL pointer.

The function searches the frame set self for frames having the tag tag and removes them from the set. The removed frames are destroyed. If no frame with the tag tag is found the function has no effect.

cpl_error_code cpl_frameset_erase_frame ( cpl_frameset self,
cpl_frame frame 
)

Erase the given frame from a frame set.

Parameters
selfA frame set.
frameThe frame to remove.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or frame is a NULL pointer.

The function searches the frame set self for the first occurrance of frame. If it is present, the frame is removed from the set and destroyed. If frame is not present in self the function has no effect.

cpl_frameset* cpl_frameset_extract ( const cpl_frameset self,
const cpl_size labels,
cpl_size  desired_label 
)

Extract a subset of frames from a set of frames.

Parameters
selfInput frame set
labelsThe array of labels associated to each input frame
desired_labelThe label identifying the requested frames
Note
The array of labels must have (at least) the length of the frame set
Returns
A pointer to a newly allocated frame set or NULL on error
Errors
CPL_ERROR_NULL_INPUT The parameter self or labels is a NULL pointer.

The returned object must be deallocated with cpl_frameset_delete()

cpl_frame* cpl_frameset_find ( cpl_frameset self,
const char *  tag 
)

Find a frame with the given tag in a frame set.

Parameters
selfA frame set.
tagThe frame tag to search for.
Returns
The handle for a frame with tag tag, or NULL if no such frame was found. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or tag is a NULL pointer.

The function searches the frame set self for the frames with the tag tag. If such a frame is present, a handle for it is returned. If the set contains several frames with the tag tag the first one is returned. The remaining frames with this tag can be accessed sequentially by using NULL as tag when calling this function repeatedly, since the most recent frame accessed is cached. This cache is reset whenever the provided tag is not NULL. If no frame with the tag tag is present in self or no more frames with this tag are found the function returns NULL.

const cpl_frame* cpl_frameset_find_const ( const cpl_frameset self,
const char *  tag 
)

Find a frame with the given tag in a frame set.

Parameters
selfA frame set.
tagThe frame tag to search for.
Returns
The handle for a frame with tag tag, or NULL if no such frame was found. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or tag is a NULL pointer.

The function searches the frame set self for the frames with the tag tag. If such a frame is present, a handle for it is returned. If the set contains several frames with the tag tag the first one is returned. The remaining frames with this tag can be accessed sequentially by using NULL as tag when calling this function repeatedly, since the most recent frame accessed is cached. This cache is reset whenever the provided tag is not NULL. If no frame with the tag tag is present in self or no more frames with this tag are found the function returns NULL.

cpl_frame* cpl_frameset_get_first ( cpl_frameset self)

Get the first frame in the given set.

Parameters
selfA frame set.
Returns
A handle for the first frame in the set, or NULL if the set is empty. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the first frame in the frame set self if it exists. If a first frame does not exist, i.e. the frame set is empty, NULL is returned. The function also updates the internal cache.

See Also
cpl_frameset_get_next()
Deprecated:
This function will be removed from CPL version 7. Code using these functions should be ported to make use of frame set iterators instead!
const cpl_frame* cpl_frameset_get_first_const ( const cpl_frameset self)

Get the first frame in the given set.

Parameters
selfA frame set.
Returns
A handle for the first frame in the set, or NULL if the set is empty. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the first frame in the frame set self if it exists. If a first frame does not exist, i.e. the frame set is empty, NULL is returned. The function also updates the internal cache.

See Also
cpl_frameset_get_next_const()
Deprecated:
This function will be removed from CPL version 7. Code using these functions should be ported to make use of frame set iterators instead!
cpl_frame* cpl_frameset_get_frame ( cpl_frameset set,
cpl_size  position 
)

Get a frame from a frame set.

Parameters
setInput frame set.
positionThe requested frame.
Returns
The function returns a handle to the frame at position position in the set, or NULL in case an error occurs.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter position is out of range.

The function returns a handle to the frame at the index position in the set. The frame position ranges from 0 to one less than the size of the frame set.

The returned frame is still owned by the frame set set, i.e. the obtained frame must not be deleted through the returned handle and also its tag must not be modified.

As an alternative to using this function, the functions cpl_frameset_get_first() and cpl_frameset_get_next() should be considered, if performance is an issue.

See Also
cpl_frameset_get_size(), cpl_frameset_get_first(), cpl_frameset_get_next()
Deprecated:
This function will be removed from CPL version 7. Code using these functions should use cpl_frameset_get_position() instead!
const cpl_frame* cpl_frameset_get_frame_const ( const cpl_frameset set,
cpl_size  position 
)

Get a frame from a frame set.

Parameters
setInput frame set.
positionThe requested frame.
Returns
The function returns a handle to the frame at position position in the set, or NULL in case an error occurs.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter position is out of range.

The function returns a handle to the frame at the index position in the set. The frame position ranges from 0 to one less than the size of the frame set.

The returned frame is still owned by the frame set set, i.e. the obtained frame must not be deleted through the returned handle and also its tag must not be modified.

As an alternative to using this function, the functions cpl_frameset_get_first_const() and cpl_frameset_get_next_const() should be considered, if performance is an issue.

See Also
cpl_frameset_get_size(), cpl_frameset_get_first_const(), cpl_frameset_get_next_const()
Deprecated:
This function will be removed from CPL version 7. Code using these functions should use cpl_frameset_get_position_const() instead!
cpl_frame* cpl_frameset_get_next ( cpl_frameset self)

Get the next frame in the given set.

Parameters
selfA frame set.
Returns
A handle for the next frame in a set. If there are no more frames in the set the function returns NULL. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the next frame in the frame set self if it exists and otherwise NULL. The function uses the internal cache to determine the most recently accessed frame. This means that the function only works as expected if self has been initialised by a call to cpl_frameset_get_first(), and if no function updating the internal cache was called between two subsequent calls to this function.

See Also
cpl_frameset_get_first()
Deprecated:
This function will be removed from CPL version 7. Code using these functions should be ported to make use of frame set iterators instead!
const cpl_frame* cpl_frameset_get_next_const ( const cpl_frameset self)

Get the next frame in the given set.

Parameters
selfA frame set.
Returns
A handle for the next frame in a set. If there are no more frames in the set the function returns NULL. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns the next frame in the frame set self if it exists and otherwise NULL. The function uses the internal cache to determine the most recently accessed frame. This means that the function only works as expected if self has been initialised by a call to cpl_frameset_get_first_const(), and if no function updating the internal cache was called between two subsequent calls to this function.

See Also
cpl_frameset_get_first_const()
Deprecated:
This function will be removed from CPL version 7. Code using these functions should be ported to make use of frame set iterators instead!
cpl_frame* cpl_frameset_get_position ( cpl_frameset self,
cpl_size  position 
)

Get the frame at a given position in the frame set.

Parameters
selfThe frame set
positionFrame position.
Returns
The function returns the frame at the given position, or NULL if an error occurs.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter position is invalid, i.e. the given value is outside of its domain.

The function retrieves the frame stored in the frame set self at the index position position. The index positions are counted from zero, and reach up to one less than the number of frames in the frame set.

const cpl_frame* cpl_frameset_get_position_const ( const cpl_frameset self,
cpl_size  position 
)

Get the frame at a given iterator position.

Parameters
selfThe iterator to dereference
positionIterator offset from the beginning of the frame set.
Returns
The function returns the frame at the iterator position, or NULL if an error occurs.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter position is invalid, i.e. the given value is outside of its domain.

The function retrieves the frame stored in the frame set self at the index position position. The index positions are counted from zero, and reach up to one less than the number of frames in the frame set.

cpl_size cpl_frameset_get_size ( const cpl_frameset self)

Get the current size of a frame set.

Parameters
selfA frame set.
Returns
The frame set's current size, or 0 if it is empty. The function returns 0 if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The reports the current number of frames stored in the frame set self.

cpl_error_code cpl_frameset_insert ( cpl_frameset self,
cpl_frame frame 
)

Insert a frame into the given frame set.

Parameters
selfA frame set.
frameThe frame to insert.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or frame is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The parameter frame has an invalid tag.

The function adds the frame frame to the frame set self using the frame's tag as key.

The insertion of a frame into a frameset transfers the ownership of the frame frame to the frameset self. This means that the frame must not be deallocated through the pointer frame.

In addition, the frame pointer returned by any member function call returning a handle to a frameset's member frame, must not be used to insert the returned frame into another framset without prior duplication of this frame, and, it must not be used to modify the frames tag without removing it from the frameset first and re-inserting it with the new tag afterwards.

int cpl_frameset_is_empty ( const cpl_frameset self)

Check whether a frame set is empty.

Parameters
selfA frame set.
Returns
The function returns 1 if the set is empty, and 0 otherwise. If an error occurs 0 is returned and an appropriate error code is set.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function checks if self contains any frames.

cpl_error_code cpl_frameset_join ( cpl_frameset self,
const cpl_frameset other 
)

Join two frame sets.

Parameters
selfThe target frame set
otherThe source frame set
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or frame is a NULL pointer.

The function adds the contents of the frame set other to self by inserting copies of the elements of the frame set other. If the source frame set other is NULL, or if it is empty, the function has no effect.

cpl_size* cpl_frameset_labelise ( const cpl_frameset self,
int(*)(const cpl_frame *, const cpl_frame *)  compare,
cpl_size nb_labels 
)

Separate a list of frames into groups, using a comparison function.

Parameters
selfInput frame set
comparePointer to comparison function to use.
nb_labelsNumber of different sets or undefined on error
Returns
array of labels defining the selection or NULL on error
Errors
CPL_ERROR_NULL_INPUT The parameter self, compare or nb_labels is a NULL pointer.

This function takes a set of frames and groups the frames that are 'identical' together. The user provided comparison function defines what being identical means for two frames. A label (non-negative int) is associated to each group of identical frames, these labels are returned in an array of length equal to the size of the frameset.

The comparison function should be commutative, must take two frames and return 1 if they are identical, 0 if they are different, and -1 on error.

The number of calls to the comparison functions is O(n*m), where n is the number of frames in the set, and m is the number of different labels found in the set. In the worst case m equals n, and the call requires n(n-1)/2 calls to the comparison function. If all identical frames appear together in the list, the number of required calls is only n + O(m^2).

The returned array must be deallocated with cpl_free().

cpl_frameset* cpl_frameset_new ( void  )

Create a new, empty frame set.

Returns
The handle for the newly created frame set.

The function allocates the memory for the new frame set, initialises the set to be empty and returns a handle for it.

cpl_error_code cpl_frameset_sort ( cpl_frameset self,
cpl_frame_compare_func  compare 
)

Sort a frame set.

Parameters
selfThe frame set to sort.
compareComparison function for frames.
Returns
The function returns CPL_ERROR_NONE on success, or an appropriate CPL error code otherwise.
Errors
  • CPL_ERROR_NULL_INPUT The parameter self or compare is a NULL pointer.

The function replaces the existing order of the frame set self by sorting its contents according to the comparison function compare.

By default, the order of a frame set, i.e. the order of any newly created frame set object, is defined by the order in which frames are inserted into the frame set. By calling this function, this order will be lost. If this order has to be preserved, sorting has to be done on a copy of self.

The function compare compares two frames and must return -1, 0, or 1 if the first frame is considered to be less than, equal or larger than the second frame, respectively.

See Also
cpl_frame_compare_func
cpl-6.4.1/html/form_20.png0000644000460300003120000000154512310333020012120 00000000000000‰PNG  IHDRÃÑÚ0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïÔIDATxí]ëÒÛ* \ÄÍ&¶yÿ·­.€ I¾Nç´§N=Q¬Ëj‘ÿÀ?€?Aü!ø äà+ñw RCÚä¹7õ9à—Jþœ'eùOiÉ©=e—Ìû™ xç|M³ÝV¿‹ü'±à°JÑ㈠/’í¸ÛZ?kàõ¤—ÿÞà Diƒg&¼O¢(Új4ã´Ü:{Ü­®A¹[ñ\ö‹gqú²éùY7‰÷Æ=ŸqÈkGæÄÆûLú±®!ɺ%ÿ°²«÷±Ì%0Ù&jÑq4éd»µÅÙÞ`/¥žON%¯R«¡¨áóo›î¢«Áçˆyuõ®’ {Û[f…¯óu`óI¿~xãEXïûÆÁ¯çt%Ê]xÏà®IŸ×–a-û¡¦tô@™óå,ÓØ­4èTãVƒÒf›ÀÍeßëH@PÎ=œçÅÞñ¹±ƒ¥7Ò–°Ô¹×Ü>žËF½ìoõè8 )Fn$‰2×`×á0^Ù…Öæ ”™¶GO[”‹)c΃ØÚ‡°‘M” pi!äÜ3Ùx! »µŸ©y”ý­´Ä4i€á:ß\2 ¢l6CRÝhºóÚtfñÖCo +ì:ùƒ_ ½tB´²EÄÃ{FB ’:6Ô½Ä5RÍ®Óàõ»%ér±2·,ÿISÎxÕ:*žöÂÌá;#>ø®~©”l: Ik¨» Û@e( ÏÄ›Ê'ÙUC—£Á¯Ù¶—s´Þ™«ðF²PjKòo|Äí4Åå,ÅR›ja&FÇg]nÀ­´ö§xRFHN2ªt6Ð'/´ï™DŸ=w»µ 7™o^[„w ²-ž8-À¨.C§ÍÛ[ᜤ`Óm A'Ê<¡<Ö½f?µnó'”'…îÁ²4™qxVV§Ô¾ûð…4»Ï%°ÉÛôúY€Ÿ-ß üƒvð×Ë7ñ«;ß8N•IEND®B`‚cpl-6.4.1/html/group__cpl__geom__img.html0000644000460300003120000005711312310333015015334 00000000000000 Common Pipeline Library Reference Manual: High level functions for geometric transformations
Common Pipeline Library Reference Manual  6.4.1
High level functions for geometric transformations

Functions

cpl_image ** cpl_geom_img_offset_combine (const cpl_imagelist *self, const cpl_bivector *offs, int refine, const cpl_bivector *aperts, const cpl_vector *sigmas, cpl_size *pisigma, cpl_size s_hx, cpl_size s_hy, cpl_size m_hx, cpl_size m_hy, cpl_size min_rej, cpl_size max_rej, cpl_geom_combine union_flag)
 Images list recombination.
 
cpl_bivector * cpl_geom_img_offset_fine (const cpl_imagelist *ilist, const cpl_bivector *estimates, const cpl_bivector *anchors, cpl_size s_hx, cpl_size s_hy, cpl_size m_hx, cpl_size m_hy, cpl_vector *correl)
 Get the offsets by correlating the images.
 
cpl_image ** cpl_geom_img_offset_saa (const cpl_imagelist *ilist, const cpl_bivector *offs, cpl_kernel kernel, cpl_size rejmin, cpl_size rejmax, cpl_geom_combine union_flag, double *ppos_x, double *ppos_y)
 Shift and add an images list to a single image.
 

Detailed Description

This module contains functions to compute the shift-and-add operation on an image list.

Synopsis:
#include "cpl_geom_img.h"

Function Documentation

cpl_image** cpl_geom_img_offset_combine ( const cpl_imagelist *  self,
const cpl_bivector *  offs,
int  refine,
const cpl_bivector *  aperts,
const cpl_vector *  sigmas,
cpl_size pisigma,
cpl_size  s_hx,
cpl_size  s_hy,
cpl_size  m_hx,
cpl_size  m_hy,
cpl_size  min_rej,
cpl_size  max_rej,
cpl_geom_combine  union_flag 
)

Images list recombination.

Parameters
selfInput imagelist - with refining images may be erased
offsList of offsets in x and y
refineIff non-zero, the offsets will be refined
apertsList of correlation apertures or NULL if unknown
sigmasPositive, decreasing sigmas to apply
pisigmaIndex of the sigma that was used or undefined on error
s_hxSearch area half-width.
s_hySearch area half-height.
m_hxMeasurement area half-width.
m_hyMeasurement area half-height.
min_rejnumber of low values to reject in stacking
max_rejnumber of high values to reject in stacking
union_flagCombination mode (CPL_GEOM_UNION or CPL_GEOM_INTERSECT)
Returns
Pointer to newly allocated images array, or NULL on error.
See Also
cpl_geom_img_offset_saa()
cpl_apertures_extract()
cpl_geom_img_offset_fine()

With offset refinement enabled: This function detects cross correlation points in the first image (if not provided by the user), use them to refine the provided offsets with a cross correlation method, and then apply the shift and add to recombine the images together. Non-correlating images are removed from self.

Without offset refinement self is not modified.

The supported types are CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT.

The number of provided offsets shall be equal to the number of input images. The ith offset (offs_x, offs_y) is the offset that has to be used to shift the ith image to align it on the first one.

sigmas may be NULL if offset refinement is disabled or if aperts is non-NULL.

On success the returned image array contains 2 images:

  • the combined image
  • the contribution map

The returned cpl_image array must be deallocated like this:

if (array != NULL) {
cpl_image_delete(array[0]);
cpl_image_delete(array[1]);
cpl_free(array);
}

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if self or offs is NULL, or if sigmas is NULL with refinement enabled and aperts NULL.
  • CPL_ERROR_ILLEGAL_INPUT if self is not uniform
  • CPL_ERROR_INCOMPATIBLE_INPUT if self and offs have different sizes
  • CPL_ERROR_DATA_NOT_FOUND if the shift and add of the images fails
cpl_bivector* cpl_geom_img_offset_fine ( const cpl_imagelist *  ilist,
const cpl_bivector *  estimates,
const cpl_bivector *  anchors,
cpl_size  s_hx,
cpl_size  s_hy,
cpl_size  m_hx,
cpl_size  m_hy,
cpl_vector *  correl 
)

Get the offsets by correlating the images.

Parameters
ilistInput image list
estimatesFirst-guess estimation of the offsets
anchorsList of anchor points
s_hxHalf-width of search area
s_hyHalf-height of search area
m_hxHalf-width of measurement area
m_hyHalf-height of measurement area
correlList of cross-correlation quality factors
Returns
List of offsets or NULL on error

The matching is performed using a 2d cross-correlation, using a minimal squared differences criterion. One measurement is performed per input anchor point, and the median offset is returned together with a measure of similarity for each plane.

The images in the input list must only differ from a shift. In order from the correlation to work, they must have the same level (check the average values of your input images if the correlation does not work).

The supported types are CPL_TYPE_DOUBLE and CPL_TYPE_FLOAT. The bad pixel maps are ignored by this function.

The ith offset (offsx, offsy) in the returned offsets is the one that have to be used to shift the ith image to align it on the reference image (the first one).

If not NULL, the returned cpl_bivector must be deallocated with cpl_bivector_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if ilist is not valid
cpl_image** cpl_geom_img_offset_saa ( const cpl_imagelist *  ilist,
const cpl_bivector *  offs,
cpl_kernel  kernel,
cpl_size  rejmin,
cpl_size  rejmax,
cpl_geom_combine  union_flag,
double *  ppos_x,
double *  ppos_y 
)

Shift and add an images list to a single image.

Parameters
ilistInput image list
offsList of offsets in x and y
kernelInterpolation kernel to use for resampling
rejminNumber of minimum value pixels to reject in stacking
rejmaxNumber of maximum value pixels to reject in stacking
union_flagCombination mode (CPL_GEOM_UNION or CPL_GEOM_INTERSECT)
ppos_xIf non-NULL, *ppos_x is the X-position of the first image in the combined image
ppos_yIf non-NULL, *ppos_y is the Y- position of the first image in the combined image
Returns
Pointer to newly allocated images array, or NULL on error.

The supported types are CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT.

The number of provided offsets shall be equal to the number of inputs images. The ith offset (offs_x, offs_y) is the offset that has to be used to shift the ith image to align it on the first one.

Provide the name of the kernel you want to generate. Supported kernel types are:

  • CPL_KERNEL_DEFAULT: default kernel, currently CPL_KERNEL_TANH
  • CPL_KERNEL_TANH: Hyperbolic tangent
  • CPL_KERNEL_SINC: Sinus cardinal
  • CPL_KERNEL_SINC2: Square sinus cardinal
  • CPL_KERNEL_LANCZOS: Lanczos2 kernel
  • CPL_KERNEL_HAMMING: Hamming kernel
  • CPL_KERNEL_HANN: Hann kernel
  • CPL_KERNEL_NEAREST: Nearest neighbor kernel (1 when dist < 0.5, else 0)

If the number of input images is lower or equal to 3, the rejection parameters are ignored. If the number of input images is lower or equal to 2*(rejmin+rejmax), the rejection parameters are ignored.

On success the returned image array contains 2 images:

  • the combined image
  • the contribution map

Pixels with a zero in the contribution map are flagged as bad in the combined image.

If not NULL, the returned cpl_image array arr must be deallocated like:

if (arr[0] != NULL) cpl_image_delete(arr[0]);
if (arr[1] != NULL) cpl_image_delete(arr[1]);
cpl_free(arr);

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if ilist is invalid or if rejmin or rejmax is negative
  • CPL_ERROR_INCOMPATIBLE_INPUT if ilist and offs have different sizes
  • CPL_ERROR_ILLEGAL_OUTPUT if the CPL_GEOM_INTERSECT method is used with non-overlapping images.
  • CPL_ERROR_INVALID_TYPE if the passed image list type is not supported
  • CPL_ERROR_UNSUPPORTED_MODE if the union_flag is not one of the supported combination modes, which are CPL_GEOM_INTERSECT, CPL_GEOM_UNION, CPL_GEOM_FIRST.
cpl-6.4.1/html/form_14.png0000644000460300003120000000047012310333017012125 00000000000000‰PNG  IHDR0gp ƒ0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ï§IDATxí]ƒ0 ƒ¿–¤¿ÀîÛ(‚´‰§=™ºRqœšp€?Ð ÀjO¨õ›%O ['˧^ÅÏâzŽù^/Ö)]¤Ú>ý¢¿–fƒmƒ=—òC÷·Þ3-¡ 2…æˆù4ئ‹Ì”UÏÞo4íÿÁާ‘4]Ëâ[ k;ïËÐWîØt‹åÆîuLAÛ yCŽ¥±î~3RoÜRóú†7õ¦Ÿ0…Û!IEND®B`‚cpl-6.4.1/html/annotated.html0000644000460300003120000000630212310333020013005 00000000000000 Common Pipeline Library Reference Manual: Class List
Common Pipeline Library Reference Manual  6.4.1
Class List
Here are the classes, structs, unions and interfaces with brief descriptions:
oC_cpl_framedata_The public frame data object
oC_cpl_plugin_The type representation of the generic plugin interface
\C_cpl_recipe_The type representation of the recipe plugin interface
cpl-6.4.1/html/form_5.png0000644000460300003120000000033412310333016012043 00000000000000‰PNG  IHDR ŠœÖ0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïKIDATxíÝÛ€0DÑKb”˜AúïÖçè~ØÃs~–~§šlÀ—%geiáj'VáTqu¸Ç&eÅÌSÊÎÿ¯{Õudlvïëìa?F’½IEND®B`‚cpl-6.4.1/html/form_25.png0000644000460300003120000000032612310333020012121 00000000000000‰PNG  IHDR a«¬Õ0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïEIDATxí €0¿`1‘ý·5¤Ôâþ Ç ðKã¶½—“—ÎOó‚(%Ü]` |ìodìkЉ| ”Ž„˜³¿FéS[kIEND®B`‚cpl-6.4.1/html/struct__cpl__framedata__.html0000644000460300003120000001355612310333015016027 00000000000000 Common Pipeline Library Reference Manual: _cpl_framedata_ Struct Reference
Common Pipeline Library Reference Manual  6.4.1
_cpl_framedata_ Struct Reference

The public frame data object. More...

Public Attributes

cpl_size max_count
 
cpl_size min_count
 
const char * tag
 

Detailed Description

The public frame data object.

The frame data object stores a frame identifier, the frame tag, and the minimum and maximum number of frames needed.

The data members of this structure are public to allow for a static initialization. Any other access of the public data members should still be done using the member functions.

Member Data Documentation

cpl_size _cpl_framedata_::max_count

The maximum number of frames of the kind given by the tag, the recipe requires in input. A value of -1 means that the maximum number of frames is unspecified.

cpl_size _cpl_framedata_::min_count

The minimum number of frames of the kind given by the tag, the recipe requires in input. A value of -1 means that the minimum number of frames is unspecified.

const char* _cpl_framedata_::tag

The frame tag. A unique string identifier for a particular kind of frame.

cpl-6.4.1/html/nav_g.png0000644000460300003120000000013712310333014011745 00000000000000‰PNG  IHDRô1&IDATxíÝ1 ÁOHf„á_ ->~¸åM iËMèÀƒS½ü‚<IEND®B`‚cpl-6.4.1/html/group__cpl__pluginlist.html0000644000460300003120000006711012310333015015602 00000000000000 Common Pipeline Library Reference Manual: Plugin List
Common Pipeline Library Reference Manual  6.4.1
Plugin List

Typedefs

typedef struct _cpl_pluginlist_ cpl_pluginlist
 The opaque plugin list data type.
 

Functions

cpl_error_code cpl_pluginlist_append (cpl_pluginlist *self, const cpl_plugin *plugin)
 Append a plugin to a plugin list.
 
void cpl_pluginlist_delete (cpl_pluginlist *self)
 Delete a plugin list.
 
void cpl_pluginlist_dump (const cpl_pluginlist *self, FILE *stream)
 Dump the contents of a plugin list to the given stream.
 
cpl_plugincpl_pluginlist_find (cpl_pluginlist *self, const char *name)
 Find a plugin with a given name in a plugin list.
 
cpl_plugincpl_pluginlist_get_first (cpl_pluginlist *self)
 Get the first plugin of a plugin list.
 
cpl_plugincpl_pluginlist_get_last (cpl_pluginlist *self)
 Get the last plugin of a plugin list.
 
cpl_plugincpl_pluginlist_get_next (cpl_pluginlist *self)
 Get the next plugin from a plugin list.
 
int cpl_pluginlist_get_size (cpl_pluginlist *self)
 Get the current size of a plugin list.
 
cpl_pluginlistcpl_pluginlist_new (void)
 Creates an empty plugin list.
 
cpl_error_code cpl_pluginlist_prepend (cpl_pluginlist *self, const cpl_plugin *plugin)
 Prepend a plugin to a plugin list.
 

Detailed Description

This module implements a list container for plugin objects and provides the facilities to query, to traverse and to update the container. The purpose of this container is to be able to store references to available plugins and to handle sets of plugins as a whole.

Since the plugin list just stores pointers to cpl_plugin, a plugin list may contain plugins of different kind at the same time, because all context specific plugins inherit the cpl_plugin type (see Plugin Interface).

Synopsis:
#include <cpl_pluginlist.h>

Typedef Documentation

typedef struct _cpl_pluginlist_ cpl_pluginlist

The opaque plugin list data type.

Function Documentation

cpl_error_code cpl_pluginlist_append ( cpl_pluginlist self,
const cpl_plugin plugin 
)

Append a plugin to a plugin list.

Parameters
selfA plugin list.
pluginThe plugin to append.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or plugin is a NULL pointer.

The plugin plugin is inserted into the plugin list self after the last element.

If self does not point to a valid plugin list, or if plugin is not a valid pointer the function returns immediately.

void cpl_pluginlist_delete ( cpl_pluginlist self)

Delete a plugin list.

Parameters
selfThe plugin list to delete.
Returns
Nothing.

The function deletes the plugin list self and destroys all plugins the list potentially contains. If self is NULL, nothing is done and no error is set.

void cpl_pluginlist_dump ( const cpl_pluginlist self,
FILE *  stream 
)

Dump the contents of a plugin list to the given stream.

Parameters
selfThe plugin list.
streamThe output stream to use.
Returns
Nothing.

The function dumps the debugging information for each plugin found in the plugin list self to the output stream stream. The debugging information for each individual plugin is dumped using cpl_plugin_dump(). If self is NULL the function does nothing.

See Also
cpl_plugin_dump()
cpl_plugin* cpl_pluginlist_find ( cpl_pluginlist self,
const char *  name 
)

Find a plugin with a given name in a plugin list.

Parameters
selfThe plugin list to query.
nameThe plugin's unique name to look for.
Returns
The first plugin with the given name name, or NULL if it no plugin with this name could be found. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self or name is a NULL pointer.

This function searches the plugin list self for a plugin with the unique name name and returns a pointer to the first one found. If no plugin with the given name is found the function returns NULL.

cpl_plugin* cpl_pluginlist_get_first ( cpl_pluginlist self)

Get the first plugin of a plugin list.

Parameters
selfA plugin list.
Returns
The first plugin stored in the plugin list self, or NULL if the list is empty. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns a handle to the first plugin stored in the self.

cpl_plugin* cpl_pluginlist_get_last ( cpl_pluginlist self)

Get the last plugin of a plugin list.

Parameters
selfA plugin list.
Returns
The last plugin stored in the plugin list self, or NULL if the list is empty. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function returns a pointer to the last plugin stored in the plugin list self.

cpl_plugin* cpl_pluginlist_get_next ( cpl_pluginlist self)

Get the next plugin from a plugin list.

Parameters
selfA plugin list.
Returns
The function returns the next plugin in the list, or NULL if the end of the list has been reached. The function returns NULL if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.
CPL_ERROR_ILLEGAL_INPUT The function was called without initialising the plugin list self by calling cpl_pluginlist_first().

The function returns the next plugin in self. To find the next plugin, the plugin list caches the position of the most recently obtained plugin. This requires a call to cpl_pluginlist_get_first() prior to calling this function in order to properly initialise the internal cache.

If the end of self has been reached the internal cache is reset to the first plugin in the list.

int cpl_pluginlist_get_size ( cpl_pluginlist self)

Get the current size of a plugin list.

Parameters
selfA plugin list.
Returns
The plugin list's current size, or 0 if the list is empty. The function returns 0 if an error occurs and sets an appropriate error code.
Errors
CPL_ERROR_NULL_INPUT The parameter self is a NULL pointer.

The function reports the current number of plugins stored in the plugin list self. If self does not point to a valid plugin list the function returns 0.

cpl_pluginlist* cpl_pluginlist_new ( void  )

Creates an empty plugin list.

Returns
The newly created plugin list, or NULL if it could not be created.

The function allocates memory for a plugin list object and initialises it to be empty.

cpl_error_code cpl_pluginlist_prepend ( cpl_pluginlist self,
const cpl_plugin plugin 
)

Prepend a plugin to a plugin list.

Parameters
selfA plugin list.
pluginThe plugin to prepend.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.
Errors
CPL_ERROR_NULL_INPUT The parameter self or plugin is a NULL pointer.

The plugin plugin is inserted into the plugin list self before the first element.

If self does not point to a valid plugin list, or if plugin is not a valid pointer the function returns immediately.

cpl-6.4.1/html/group__cpl__error.html0000644000460300003120000015735212310333014014550 00000000000000 Common Pipeline Library Reference Manual: Error handling
Common Pipeline Library Reference Manual  6.4.1
Error handling

Macros

#define cpl_ensure(BOOL, ERRCODE, RETURN)
 Set an error code and return iff a boolean expression is false.
 
#define cpl_ensure_code(BOOL, ERRCODE)
 Set an error code and return it iff a boolean expression is false.
 
#define cpl_error_ensure(CONDITION, CODE, ACTION,...)
 Generic error handling macro.
 
#define CPL_ERROR_MAX_MESSAGE_LENGTH   256
 The maximum length of a CPL error message.
 
#define cpl_error_set(function, code)
 Set CPL error code, function name, source file and line number where an error occurred.
 
#define cpl_error_set_message(function, code,...)
 Set CPL error code, function name, source file and line number where an error occurred along with a text message.
 
#define cpl_error_set_where(function)
 Propagate a CPL-error to the current location.
 
#define CPL_HAVE_VA_ARGS
 Flag to indicate support for variadic macros.
 

Typedefs

typedef enum _cpl_error_code_ cpl_error_code
 The cpl_error_code type definition.
 

Enumerations

enum  _cpl_error_code_ {
  CPL_ERROR_NONE = 0,
  CPL_ERROR_UNSPECIFIED = 1,
  CPL_ERROR_HISTORY_LOST,
  CPL_ERROR_DUPLICATING_STREAM,
  CPL_ERROR_ASSIGNING_STREAM,
  CPL_ERROR_FILE_IO,
  CPL_ERROR_BAD_FILE_FORMAT,
  CPL_ERROR_FILE_ALREADY_OPEN,
  CPL_ERROR_FILE_NOT_CREATED,
  CPL_ERROR_FILE_NOT_FOUND,
  CPL_ERROR_DATA_NOT_FOUND,
  CPL_ERROR_ACCESS_OUT_OF_RANGE,
  CPL_ERROR_NULL_INPUT,
  CPL_ERROR_INCOMPATIBLE_INPUT,
  CPL_ERROR_ILLEGAL_INPUT,
  CPL_ERROR_ILLEGAL_OUTPUT,
  CPL_ERROR_UNSUPPORTED_MODE,
  CPL_ERROR_SINGULAR_MATRIX,
  CPL_ERROR_DIVISION_BY_ZERO,
  CPL_ERROR_TYPE_MISMATCH,
  CPL_ERROR_INVALID_TYPE,
  CPL_ERROR_CONTINUE,
  CPL_ERROR_NO_WCS,
  CPL_ERROR_EOL
}
 Available error codes. More...
 

Functions

cpl_error_code cpl_error_get_code (void)
 Get the last cpl_error_code set.
 
const char * cpl_error_get_file (void)
 Get the source code file name where the last CPL error occurred.
 
const char * cpl_error_get_function (void)
 Get the function name where the last CPL error occurred.
 
unsigned cpl_error_get_line (void)
 Get the line number where the last CPL error occurred.
 
const char * cpl_error_get_message (void)
 Get the text message of the current CPL error.
 
const char * cpl_error_get_message_default (cpl_error_code code)
 Return the standard CPL error message of the current CPL error.
 
const char * cpl_error_get_where (void)
 Get function name, source file and line number where the last CPL error occurred.
 

Detailed Description

This module provides functions to maintain the cpl_error_code set by any CPL function, similarly to what is done with the errno variable of the standard C library. The following guidelines are respected:

  • If no error occurs in a CPL function the cpl_error_code will remain unchanged.
  • If an error occurs in a CPL function, a new CPL error is set, causing the cpl_error_code to be modified to the new error.

A cpl_error_code equal to the enumeration constant CPL_ERROR_NONE would indicate no error condition. Note, however, that the cpl_error_code is only set when an error occurs, and it is not reset by successful function calls. For this reason it may be appropriate in some cases to reset the cpl_error_code using the function cpl_error_reset(). The cpl_error_code set by a CPL function can be obtained by calling the function cpl_error_get_code(), but functions of type cpl_error_code would not only return this code directly, but would also return CPL_ERROR_NONE in case of success. Other CPL functions return zero on success, or a non-zero value to indicate a change of the cpl_error_code, while CPL functions returning a pointer would flag an error by returning a NULL.

To each cpl_error_code is associated a standard error message, that can be obtained by calling the function cpl_error_get_message(). Conventionally, no CPL function will ever display any error message, leaving to the caller the decision of how to handle a given error condition. A call to the function cpl_error_get_function() would return the name of the function where the error occurred, and the functions cpl_error_get_file() and cpl_error_get_line() would also return the name of the source file containing the function code, and the line number where the error occurred. The function cpl_error_get_where() would gather all this items together, in a colon-separated string.

Synopsis:
#include <cpl_error.h>

Macro Definition Documentation

#define cpl_ensure (   BOOL,
  ERRCODE,
  RETURN 
)

Set an error code and return iff a boolean expression is false.

Parameters
BOOLThe boolean to evaluate
ERRCODEThe error code to set
RETURNThe value to return
Note
This macro will cause a return from its calling function. If ERRCODE equals CPL_ERROR_NONE, the error-code is set to CPL_ERROR_UNSPECIFIED. The boolean is always evaluated (unlike assert()). This macro may not be used in inline'd functions.
See Also
cpl_error_set()
#define cpl_ensure_code (   BOOL,
  ERRCODE 
)

Set an error code and return it iff a boolean expression is false.

Parameters
BOOLThe boolean to evaluate
ERRCODEThe error code to set and return
See Also
cpl_ensure()
#define cpl_error_ensure (   CONDITION,
  CODE,
  ACTION,
  ... 
)

Generic error handling macro.

Parameters
CONDITIONThe condition to check
CODEThe CPL error code to set if CONDTION is non-zero
ACTIONA statement that is executed iff the CONDITION evaluates to non-zero.
...A printf-style message for cpl_error_set_message().
See Also
cpl_error_set_message()
Note
This macro should not be used directly. It is defined only to support user-defined error handling macros. If CODE equals CPL_ERROR_NONE, a CPL error with code CPL_ERROR_UNSPECIFIED is created. The message may be a printf-like format string supplied with arguments unless variadic macros are not supported in which case only a (non-format) string is accepted. The provided CODE, ACTION and VA_ARGS are evaluated/executed only if the CONDITION evaluates to false (zero). The ACTION break is unsupported (it currently causes the execution to continue after cpl_error_ensure()). Some of the below examples use a goto statement to jump to a single cleanup label, assumed to be located immediately before the function's unified cleanup-code and return point. This error-handling scheme is reminiscent of using exceptions in languages that support exceptions (C++, Java, ...). The use of goto and a single clean-up label per function "if the error-handling code is non- trivial, and if errors can occur in several places" is sanctioned by Kernigan & Richie: "The C Programming Language". For any other purpose goto should be avoided.

Useful definitions might include

#define assure(BOOL, CODE) \
cpl_error_ensure(BOOL, CODE, goto cleanup, " ")
#define check(CMD) \
cpl_error_ensure((CMD, cpl_error_get_code() == CPL_ERROR_NONE), \
cpl_error_get_code(), goto cleanup, " ")
#define assert(BOOL) \
cpl_error_ensure(BOOL, CPL_ERROR_UNSPECIFIED, goto cleanup, \
"Internal error, please report to " PACKAGE_BUGREPORT)

or (same as above, but including printf-style error messages)

#define assure(BOOL, CODE, ...) \
cpl_error_ensure(BOOL, CODE, goto cleanup, __VA_ARGS__)
#define check(CMD, ...) \
cpl_error_ensure((CMD, cpl_error_get_code() == CPL_ERROR_NONE), \
cpl_error_get_code(), goto cleanup, __VA_ARGS__)
#define assert(BOOL, ...) \
cpl_error_ensure(BOOL, CPL_ERROR_UNSPECIFIED, goto cleanup, \
"Internal error, please report to " PACKAGE_BUGREPORT \
" " __VA_ARGS__)
/ * Assumes that PACKAGE_BUGREPORT
contains no formatting special characters * /

or

#define skip_if(BOOL) \
cpl_error_ensure(BOOL, cpl_error_get_code() != CPL_ERROR_NONE ? \
cpl_error_get_code() : CPL_ERROR_UNSPECIFIED, \
goto cleanup, " ")

The check macros in the examples above can be used to check a command which sets the cpl_error_code in case of failure (or, by use of a comma expression, a longer sequence of such commands):

check(
(x = cpl_table_get_int(table, "x", 0, NULL),
y = cpl_table_get_int(table, "y", 0, NULL),
z = cpl_table_get_int(table, "z", 0, NULL)),
"Error reading wavelength catalogue");
#define CPL_ERROR_MAX_MESSAGE_LENGTH   256

The maximum length of a CPL error message.

See Also
cpl_error_get_message()
#define cpl_error_set (   function,
  code 
)

Set CPL error code, function name, source file and line number where an error occurred.

Parameters
functionCharacter string with function name, cpl_func
codeError code
Returns
The specified error code.
Note
If code is CPL_ERROR_NONE, nothing is done (and code is returned), if code is CPL_ERROR_HISTORY_LOST (but avoid that) then CPL_ERROR_UNSPECIFIED is set and returned.
#define cpl_error_set_message (   function,
  code,
  ... 
)

Set CPL error code, function name, source file and line number where an error occurred along with a text message.

Parameters
functionCharacter string with function name, cpl_func
codeError code
...Variable argument list with message
Returns
The CPL error code
See Also
cpl_error_set()
Note
The message is ignored if it is NULL, empty, or consists of a single ' ' (space). Otherwise, the user supplied message is appended to the default message using ': ' (colon+space) as delimiter. If the CPL-based application may use variadic macros, the message may be a printf-style format string supplied with matching arguments. If variadic macros are not allowed (e.g. when compiling with gcc -ansi) only a non-format string is accepted. Please be aware that the format string should always be a string literal, otherwise the code may be vulnerable to the socalled 'format string exploit'. Sufficiently recent versions of gcc supports the option -Wformat-security, which tries to warn of this issue. If variadic macros are not supported, a printf-style message can be created prior to the call to cpl_error_set_message(), as in the below example.

Examples of usage:

if (image == NULL) {
"Image number %d is NULL", number);
}
if (error_string != NULL) {
"%s", error_string);
}

Example of usage if and only if variadic macros are unavaiable (e.g. when compiling with gcc -ansi):

if (image == NULL) {
char * my_txt = cpl_sprintf("Image number %d is NULL", number);
const cpl_error_code my_code =
cpl_free(my_txt);
return my_code;
}
#define cpl_error_set_where (   function)

Propagate a CPL-error to the current location.

Parameters
functionCharacter string with function name, cpl_func
Returns
The preexisting CPL error code (possibly CPL_ERROR_NONE).
See Also
cpl_error_set()
Note
If no error exists, nothing is done and CPL_ERROR_NONE is returned

If a CPL error already exists, this function creates a new CPL error with the preexisting CPL error code and the current location.

In a function of type cpl_error_code an error can be propagated with:

return cpl_error_set_where(cpl_func);
#define CPL_HAVE_VA_ARGS

Flag to indicate support for variadic macros.

See Also
cpl_error_set_message()
Note
Unless already defined, tries to detect whether variadic macros are supported, typically at compile-time of a CPL-based application. This check, which is hardly robust, should support
  • disabling of variadic macros when compiling with gcc -ansi
  • enabling them when compiling with a C99 compliant compiler, such as gcc -std=c99

Typedef Documentation

The cpl_error_code type definition.

Enumeration Type Documentation

Available error codes.

CPL_ERROR_NONE is equal to zero and compares to less than all other error codes.

All error codes are guaranteed to be less than CPL_ERROR_EOL (End Of List). CPL_ERROR_EOL allows user defined error codes to be added in this fashion:

const int my_first_error_code = 0 + CPL_ERROR_EOL;
const int my_second_error_code = 1 + CPL_ERROR_EOL;
const int my_third_error_code = 2 + CPL_ERROR_EOL;
if (is_connected() == CPL_FALSE) {
return cpl_error_set_message(cpl_func, my_first_error_code, "No "
"connection to host %s (after %u tries)",
hostname, max_attempts);
}

Extensive use of user defined error codes should be avoided. Instead a request of new CPL error codes should be emailed to cpl-h.nosp@m.elp@.nosp@m.eso.o.nosp@m.rg.

Enumerator:
CPL_ERROR_NONE 

No error condition

CPL_ERROR_UNSPECIFIED 

An unspecified error. FIXME: Do not set to 1 and verify correctness

CPL_ERROR_HISTORY_LOST 

The actual CPL error has been lost. Do not use to create a CPL error

CPL_ERROR_DUPLICATING_STREAM 

Could not duplicate output stream

CPL_ERROR_ASSIGNING_STREAM 

Could not associate a stream with a file descriptor

CPL_ERROR_FILE_IO 

Permission denied

CPL_ERROR_BAD_FILE_FORMAT 

Input file had not the expected format

CPL_ERROR_FILE_ALREADY_OPEN 

Attempted to open a file twice

CPL_ERROR_FILE_NOT_CREATED 

Could not create a file

CPL_ERROR_FILE_NOT_FOUND 

A specified file or directory was not found

CPL_ERROR_DATA_NOT_FOUND 

Data searched within a valid object were not found

CPL_ERROR_ACCESS_OUT_OF_RANGE 

Data were accessed beyond boundaries

CPL_ERROR_NULL_INPUT 

A NULL pointer was found where a valid pointer was expected

CPL_ERROR_INCOMPATIBLE_INPUT 

Data that had to be processed together did not match

CPL_ERROR_ILLEGAL_INPUT 

Illegal values were detected

CPL_ERROR_ILLEGAL_OUTPUT 

A given operation would have generated an illegal object

CPL_ERROR_UNSUPPORTED_MODE 

The requested functionality is not supported

CPL_ERROR_SINGULAR_MATRIX 

Could not invert a matrix

CPL_ERROR_DIVISION_BY_ZERO 

Attempted to divide a number by zero

CPL_ERROR_TYPE_MISMATCH 

Data were not of the expected type

CPL_ERROR_INVALID_TYPE 

Data type was unsupported or invalid

CPL_ERROR_CONTINUE 

An iterative process did not converge

CPL_ERROR_NO_WCS 

The WCS functionalities are missing

CPL_ERROR_EOL 

To permit extensibility of error handling. It is a coding error to use this within CPL itself!

Function Documentation

cpl_error_code cpl_error_get_code ( void  )

Get the last cpl_error_code set.

Returns
cpl_error_code of last occurred CPL error.

Get cpl_error_code of last occurred error.

const char* cpl_error_get_file ( void  )

Get the source code file name where the last CPL error occurred.

Returns
Name of source file name where the last CPL error occurred.

Get the source code file name where the last CPL error occurred.

const char* cpl_error_get_function ( void  )

Get the function name where the last CPL error occurred.

Returns
Identifier string of the function name where the last CPL error occurred.

Get the function name where the last CPL error occurred.

unsigned cpl_error_get_line ( void  )

Get the line number where the last CPL error occurred.

Returns
Line number of the source file where the last CPL error occurred.

Get the line number of the source file where the last CPL error occurred.

const char* cpl_error_get_message ( void  )

Get the text message of the current CPL error.

Returns
The text message of the current CPL error.
See Also
cpl_error_get_message_default(), cpl_error_set_message()

If the cpl_error_code is equal to CPL_ERROR_NONE, an empty string is returned. Otherwise, the message is the default message for the current CPL error code, possibly extended with a custom message supplied when the error was set.

const char* cpl_error_get_message_default ( cpl_error_code  code)

Return the standard CPL error message of the current CPL error.

Parameters
codeThe error code of the current CPL error
Returns
The standard CPL error message of the current CPL error
const char* cpl_error_get_where ( void  )

Get function name, source file and line number where the last CPL error occurred.

Returns
String containing function name, source file and line number separated by colons (:).

Get where the last CPL error occurred in the form function_name:source_file:line_number

cpl-6.4.1/html/form_15.png0000644000460300003120000000101212310333017012117 00000000000000‰PNG  IHDR>7c ¾0PLTEZ? tRNS.H]o€ž¬¹ÅÒÝéôÿªg°ïyIDATxíÍ’³ [þD@yÿ·ÝÁømMIÌíÛLMB1&¡¹|Ì`5ÀMT`èÀ»qªœ³¸d š©V–^À%ešÀ.ÙNî;|.åØeŽSl††i‹f£'åZ>–ý\ñ¢<`—ƒß¢_ËðL•ÑM7¤~ `Ÿ“t~nºìá§8e²ÎU¶k¼â¹_¾üGh{¸™çh à™Ö3Õ xL*¡€}Ús”K_Ûfjnüà¶h j¤2Ôþ ¢š¥]à„2oªm3OS׿2íR>)#ýz E'¢U}ž!³Iõl¶oßi;íÜc?Ç— c’êÜ/@‹rÚ5/À€?ƒM÷ÿA%òGÏî ¸‰¦¹×/8¸Žà[½áºÕ¾zÃuëÑÓpɉëÐâÊ\/så:kø=— 8ù€+6×Yµ~Ûâ\¯¹þ¹nôëFî´nß%€^”‹Ÿ¨6¨ÎfQ›gçË Є-­IEND®B`‚cpl-6.4.1/html/formula.repository0000644000460300003120000000355012310333020013752 00000000000000\form#0:$\frac{(1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0)} {1+2+3+4+5+6+7+8+9}$ \form#1:$1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0$ \form#2:$\chi^2$ \form#3:\[ z = B + \frac{A}{2 \pi \sigma_x \sigma_y \sqrt{1-\rho^2}} \exp\left({-\frac{1}{2\left(1-\rho^2\right)} \left(\left(\frac{x - \mu_x}{\sigma_x}\right)^2 -2\rho\left(\frac{x - \mu_x}{\sigma_x}\right) \left(\frac{y - \mu_y}{\sigma_y}\right) + \left(\frac{y - \mu_y}{\sigma_y}\right)^2\right)}\right) \] \form#4:$B$ \form#5:$A$ \form#6:\begin{eqnarray*} \mathrm{parameters[0]} &=& B \\ \mathrm{parameters[1]} &=& A \\ \mathrm{parameters[2]} &=& \rho \\ \mathrm{parameters[3]} &=& \mu_x \\ \mathrm{parameters[4]} &=& \mu_y \\ \mathrm{parameters[5]} &=& \sigma_x \\ \mathrm{parameters[6]} &=& \sigma_y \end{eqnarray*} \form#7:$a, b$ \form#8:$\theta$ \form#9:\begin{eqnarray*} \theta &=& \frac{1}{2} \arctan \left(2 \rho \frac{\sigma_x \sigma_y} {\sigma_x^2 - \sigma_y^2}\right) \\ a &=& \sigma_x \sigma_y \sqrt{2(1-\rho^2) \frac{\cos 2\theta} {\left(\sigma_x^2 + \sigma_y^2\right) \cos 2\theta + \sigma_y^2 - \sigma_x^2}} \\ b &=& \sigma_x \sigma_y \sqrt{2(1-\rho^2) \frac{\cos 2\theta} {\left(\sigma_x^2 + \sigma_y^2\right) \cos 2\theta - \sigma_y^2 + \sigma_x^2}} \end{eqnarray*} \form#10:$x$ \form#11:$-\pi/2$ \form#12:$+\pi/2$ \form#13:$\rho = 0$ \form#14:$\sigma_x \geq \sigma_y$ \form#15:\begin{eqnarray*} \theta &=& 0 \\ a &=& \sigma_x \\ b &=& \sigma_y \end{eqnarray*} \form#16:$\sigma_x < \sigma_y$ \form#17:$y$ \form#18:\begin{eqnarray*} \theta &=& \frac{\pi}{2} \\ a &=& \sigma_y \\ b &=& \sigma_x \end{eqnarray*} \form#19:\[ \mathrm{G} = \mathrm{J} \mathrm{C} \mathrm{J}^\mathrm{T} \] \form#20:$ (B, A, \rho, \mu_x, \mu_y, \sigma_x, \sigma_y) \rightarrow (\theta, a, b) $ \form#21:$x_{max} = w/2 + k * \sigma,$ \form#22:$w$ \form#23:$\sigma = w_{FWHM}/(2\sqrt(2\log(2))),$ \form#24:$w_{FWHM}$ \form#25:$k$ cpl-6.4.1/html/ftv2lastnode.png0000644000460300003120000000012612310333014013264 00000000000000‰PNG  IHDRɪ|IDATxíݱðøScOx@ –¨y}IEND®B`‚cpl-6.4.1/html/classes.html0000644000460300003120000000571412310333020012473 00000000000000 Common Pipeline Library Reference Manual: Class Index
Common Pipeline Library Reference Manual  6.4.1
Class Index
  _  
_cpl_plugin_   _cpl_recipe_   
_cpl_framedata_   
cpl-6.4.1/html/ftv2vertline.png0000644000460300003120000000012612310333014013303 00000000000000‰PNG  IHDRɪ|IDATxíݱðøScOx@ –¨y}IEND®B`‚cpl-6.4.1/Makefile.am0000644000460300003120000000351512144177220011252 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO Common Pipeline Library ## Copyright (C) 2001-2008 European Southern Observatory ## 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 2 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 02111-1307 USA AUTOMAKE_OPTIONS = 1.8 foreign ACLOCAL_AMFLAGS = -I m4 DISTCLEANFILES = *~ if GASGANO_SUPPORT libltdl = libltdl cpljava = cpljava endif SUBDIRS = $(libltdl) $(libcext) cplcore cplui cpldrs cpldfs $(cpljava) DOXYGEN_SUBDIRS = include_HEADERS = cpl.h EXTRA_DIST = BUGS Doxyfile.in m4/cpl.m4 m4/purify.m4 admin/doxygen.am \ doxygen/cpl.css if MAINTAINER_MODE MAINTAINERCLEANFILES = $(top_srcdir)/Makefile.in $(top_srcdir)/aclocal.m4 \ $(top_srcdir)/config.h.in $(top_srcdir)/configure config.log \ config.status clean-local: clean-doxygen dist-hook: doxygen @if test -d $(top_builddir)/html; then \ echo "cp -pr $(top_builddir)/html $(distdir)"; \ cp -pr $(top_builddir)/html $(distdir); \ fi find $(distdir) -type d ! -perm -222 -exec chmod u+w {} \; -o \ -type f ! -perm -222 -exec chmod u+w {} \; || chmod -R u+w $(distdir) else clean-local: endif uninstall-local: uninstall-doxygen include $(top_srcdir)/admin/doxygen.am cpl-6.4.1/config.h.in0000644000460300003120000001631212310332722011233 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* CPL binary age */ #undef CPL_BINARY_AGE /* CPL binary version number */ #undef CPL_BINARY_VERSION /* Directory prefix for system configuration files */ #undef CPL_CONFIG_DIR /* Defined to number of bytes in (L2) Cache */ #undef CPL_CPU_CACHE /* Defined to number of cores (possibly sharing the (L2) Cache) */ #undef CPL_CPU_CORES /* Defined if FFTW (single-precision) is available */ #undef CPL_FFTWF_INSTALLED /* Defined if FFTW (normal-precision) is available */ #undef CPL_FFTW_INSTALLED /* Define to 1 if you have complex primitive types. */ #undef CPL_HAVE_COMPLEX /* Define to 1 if you have variadic macros. */ #undef CPL_HAVE_VA_ARGS /* CPL interface age */ #undef CPL_INTERFACE_AGE /* CPL major version number */ #undef CPL_MAJOR_VERSION /* CPL micro version number */ #undef CPL_MICRO_VERSION /* CPL minor version number */ #undef CPL_MINOR_VERSION /* Define if thread support is enabled. */ #undef CPL_THREADS_ENABLED /* Defined if WCS is available */ #undef CPL_WCS_INSTALLED /* Define to 1 if `TIOCGWINSZ' requires . */ #undef GWINSZ_IN_SYS_IOCTL /* Define to 1 if you have the `cbrt' function. */ #undef HAVE_CBRT /* Define to 1 if you have the `clock_gettime' function. */ #undef HAVE_CLOCK_GETTIME /* Define to 1 if you have the declaration of `dup', and to 0 if you don't. */ #undef HAVE_DECL_DUP /* Define to 1 if you have the declaration of `fdopen', and to 0 if you don't. */ #undef HAVE_DECL_FDOPEN /* Define to 1 if you have the declaration of `fileno', and to 0 if you don't. */ #undef HAVE_DECL_FILENO /* Define to 1 if you have the declaration of `llabs', and to 0 if you don't. */ #undef HAVE_DECL_LLABS /* Define to 1 if you have the declaration of `stat', and to 0 if you don't. */ #undef HAVE_DECL_STAT /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the `dup' function. */ #undef HAVE_DUP /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `fdopen' function. */ #undef HAVE_FDOPEN /* Define to 1 if you have the `fileno' function. */ #undef HAVE_FILENO /* Define if you have the `fits_get_hduaddrll' function */ #undef HAVE_FITS_GET_HDUADDRLL /* Define if you have the `fits_get_hduoff' function */ #undef HAVE_FITS_GET_HDUOFF /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* Define to 1 if you have the `getpid' function. */ #undef HAVE_GETPID /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `llabs' function. */ #undef HAVE_LLABS /* Define to 1 if the type `long double' works and has more range or precision than `double'. */ #undef HAVE_LONG_DOUBLE /* Define to 1 if the type `long double' works and has more range or precision than `double'. */ #undef HAVE_LONG_DOUBLE_WIDER /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have . */ #undef HAVE_PTHREAD_H /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV /* Define to 1 if you have the `sigaction' function. */ #undef HAVE_SIGACTION /* Define to 1 if you have the `sigemptyset' function. */ #undef HAVE_SIGEMPTYSET /* Define to 1 if you have the `stat' function. */ #undef HAVE_STAT /* Define to 1 if `stat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_STAT_EMPTY_STRING_BUG /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_STROPTS_H /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define if you have the `sysconf' function */ #undef HAVE_SYSCONF /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIMES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIO_H /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* The size of `size_t', as computed by sizeof. */ #undef SIZEOF_SIZE_T /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc cpl-6.4.1/cplcore/0000755000460300003120000000000012310333011010704 500000000000000cpl-6.4.1/cplcore/cpl_mask_impl.h0000644000460300003120000000532012272176370013633 00000000000000/* $Id: cpl_mask_impl.h,v 1.4 2011-07-19 11:05:43 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-19 11:05:43 $ * $Revision: 1.4 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_MASK_IMPL_H #define CPL_MASK_IMPL_H #include "cpl_mask.h" CPL_BEGIN_DECLS cpl_size cpl_mask_get_first_window(const cpl_mask *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_binary); void cpl_mask_and_(cpl_binary *, const cpl_binary *, const cpl_binary *, size_t) CPL_INTERNAL #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1,3))) #endif ; void cpl_mask_or_(cpl_binary *, const cpl_binary *, const cpl_binary *, size_t) CPL_INTERNAL #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1,3))) #endif ; void cpl_mask_xor_(cpl_binary *, const cpl_binary *, const cpl_binary *, size_t) CPL_INTERNAL #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1,3))) #endif ; void cpl_mask_and_scalar(cpl_binary *, const cpl_binary *, cpl_bitmask, size_t) CPL_INTERNAL #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1))) #endif ; void cpl_mask_or_scalar(cpl_binary *, const cpl_binary *, cpl_bitmask, size_t) CPL_INTERNAL #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1))) #endif ; void cpl_mask_xor_scalar(cpl_binary *, const cpl_binary *, cpl_bitmask, size_t) CPL_INTERNAL #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1))) #endif ; #endif /* end of cpl_mask_impl.h */ cpl-6.4.1/cplcore/cpl_error_impl.h0000644000460300003120000001712611737327742014046 00000000000000/* $Id: cpl_error_impl.h,v 1.22 2012-04-05 14:44:50 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-04-05 14:44:50 $ * $Revision: 1.22 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_ERROR_IMPL_H #define CPL_ERROR_IMPL_H #include "cpl_error.h" #include "cpl_type.h" #include "cpl_tools.h" #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ /* * As the error handler itself should never fail, it cannot rely on * allocating memory dynamically. Therefore, define max limits for * string lengths, size of error queue. */ #ifdef PATH_MAX #define MAX_FILE_LENGTH PATH_MAX #else #define MAX_FILE_LENGTH 4096 #endif #define MAX_NAME_LENGTH 50 /** * @internal * @ingroup cpl_error * @brief Set CPL error code with the current location * @param code Error code * @return The specified error code. * @see cpl_error_set() * */ #define cpl_error_set_(code) cpl_error_set(cpl_func, code) /** * @internal * @ingroup cpl_error * @brief Propagate a CPL-error to the current location. * @return The preexisting CPL error code (possibly CPL_ERROR_NONE). * @see cpl_error_set_where() */ #define cpl_error_set_where_() cpl_error_set_where(cpl_func) /** * @internal * @ingroup cpl_error * @brief Set CPL error code with the current location along with a text message * @param code Error code * @param ... Variable argument list with message * @return The CPL error code * @see cpl_error_set_message() */ #define cpl_error_set_message_(code, ...) \ cpl_error_set_message(cpl_func, code, __VA_ARGS__) /** * @ingroup cpl_error * @internal * @brief * Set CPL error code, function name, source file, line number where * a FITS error occurred along with a FITS specific text message * * @param code CPL Error code * @param fitscode The error code of the failed FITS (CFITSIO) call * @param fitsfunction The FITS (CFITSIO) function (_not_ as a string) or * the empty string * @param ... Variable argument list with message * @return The CPL error code * @see cpl_error_set_message() * * Example of usage: * @code * * int ioerror = 0; * (void)fits_open_diskfile(&file, name, READONLY, &ioerror); * * if (ioerror) { * return cpl_error_set_fits(CPL_ERROR_FILE_IO, ioerror, * fits_open_diskfile, * "filename='%s', xtnum=%d", name, position); * } * * @endcode * * @hideinitializer */ #define cpl_error_set_fits(code, fitscode, fitsfunction, ...) \ cpl_error_set_fits_macro(cpl_func, code, fitscode, \ CPL_STRINGIFY(fitsfunction), \ __FILE__, __LINE__, __VA_ARGS__) /** * @ingroup cpl_error * @internal * @brief * Set CPL error code, function name, source file, line number where * a regex error occurred along with a regex specific text message * * @param code CPL Error code * @param regcode The error code of the failed regcomp() call * @param preg The regex of the failed call * @param ... Variable argument list with message * @return The CPL error code * @see regcomp(), cpl_error_set_message() * * Example of usage: * @code * * regex_t regex; * const int regerror = regcomp(®ex, pattern, REG_EXTENDED | REG_NOSUB); * * if (regerror) { * return cpl_error_set_regex(CPL_ERROR_ILLEGAL_INPUT, regerror, ®ex, * "pattern='%s', pattern); * } * * @endcode * * @hideinitializer */ #define cpl_error_set_regex(code, regcode, preg, ...) \ cpl_error_set_regex_macro(cpl_func, code, regcode, preg, \ __FILE__, __LINE__, __VA_ARGS__) #ifndef CPL_WCS_INSTALLED /* Make sure the WCS error macro can be invoked also when wcs_errmsg is not defined. This is useful for unit testing. */ #define wcs_errmsg NULL #endif /** * @ingroup cpl_error * @internal * @brief * Set CPL error code, function name, source file, line number where * a WCSLIB error occurred along with a WCSLIB specific text message * @param code CPL Error code * @param wcscode The error code of the failed WCSLIB call * @param wcsfunction Character string with WCSLIB function name or * the empty string * @param ... Variable argument list with message * @return The CPL error code * @see cpl_error_set_message(), WCSLIB * @note This macro accesses * extern const char *wcs_errmsg[]; * If an internal inconsistency in WCSLIB causes a too large error number * to be returned, the behaviour is undefined (e.g. a segfault). * * Example of usage: * @code * * #ifdef CPL_WCS_INSTALLED * * #include * * const int wcserror = wcspih(shdr,np,0,0,&nrej,&nwcs,&wwcs); * * if (wcserror) { * return cpl_error_set_wcs(CPL_ERROR_ILLEGAL_INPUT, wcserror, * "wcspih", "np=%d", np); * } * * #endif * * @endcode * * @hideinitializer */ #define cpl_error_set_wcs(code, wcscode, wcsfunction, ...) \ cpl_error_set_wcs_macro(cpl_func, code, wcscode, wcsfunction, \ wcs_errmsg, __FILE__, __LINE__, __VA_ARGS__) struct _cpl_error_ { cpl_error_code code; unsigned line; char function[MAX_NAME_LENGTH+1]; char file[MAX_FILE_LENGTH+1]; char msg[CPL_ERROR_MAX_MESSAGE_LENGTH]; }; /*----------------------------------------------------------------------------- Prototypes of private functions -----------------------------------------------------------------------------*/ cpl_error * cpl_errorstate_append(void); const cpl_error * cpl_errorstate_find(void) CPL_ATTR_PURE; cpl_boolean cpl_error_is_set(void) CPL_ATTR_PURE; cpl_boolean cpl_error_is_readonly(void) CPL_ATTR_PURE; void cpl_error_set_readonly(void); void cpl_error_reset_readonly(void); cpl_error_code cpl_error_set_fits_macro(const char *, cpl_error_code, int, const char *, const char *, unsigned, const char *, ...) CPL_ATTR_PRINTF(7,8); cpl_error_code cpl_error_set_regex_macro(const char *, cpl_error_code, int, const regex_t *, const char *, unsigned, const char *, ...) CPL_ATTR_PRINTF(7,8); cpl_error_code cpl_error_set_wcs_macro(const char *, cpl_error_code, int, const char *, const char *[], const char *, unsigned, const char *, ...) CPL_ATTR_PRINTF(8,9); #ifdef HAVE_LIBPTHREAD void cpl_error_init_locks(void); #endif CPL_END_DECLS #endif /* end of cpl_error_impl.h */ cpl-6.4.1/cplcore/cpl_image_filter_body.h0000644000460300003120000017131112062354026015320 00000000000000/* $Id: cpl_image_filter_body.h,v 1.80 2012-12-13 13:28:54 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ static void ADDTYPE_TWO(cpl_filter_average)(void *, const void *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode); static void ADDTYPE_TWO(cpl_filter_average_bpm)(void *, cpl_binary **, const void *, const cpl_binary *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode); static cpl_error_code ADDTYPE_TWO(cpl_filter_average_slow)(void *, cpl_binary **, const void *, const cpl_binary *, const cpl_binary *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode); static void ADDTYPE_TWO(cpl_filter_stdev)(void *, const void *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode); static cpl_error_code ADDTYPE_TWO(cpl_filter_stdev_slow)(void *, cpl_binary **, const void *, const cpl_binary *, const cpl_binary *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode); static cpl_error_code ADDTYPE_TWO(cpl_filter_linear_slow)(void *, cpl_binary **, const void *, const cpl_binary *, const double *, cpl_size, cpl_size, cpl_boolean, cpl_size, cpl_size, cpl_border_mode); static cpl_error_code ADDTYPE_TWO(cpl_filter_morpho_slow)(void *, cpl_binary **, const void *, const cpl_binary *, const double *, cpl_size, cpl_size, cpl_boolean, cpl_size, cpl_size, cpl_border_mode); #ifndef CPL_FILTER_NO_RECIPROCAL #ifndef ACCU_TYPE_IS_INT #define ALLOW_RECIPROCAL #endif #endif #ifdef ALLOW_RECIPROCAL /* If possible, and in order to speed-up the code, the central part of averaged image is done with multiplication instead of division, incurring one extra round-off */ #define RUNSUM_MEAN (runsum * rnpix) #else #define RUNSUM_MEAN (runsum / npix) #endif /* The functionss below are documented with Doxygen as usual, but the preprocessor generated function names mean that doxygen cannot actually parse it. So it is all ignored. @cond */ #ifdef IN_EQ_OUT /* Start of no-cast code */ static cpl_error_code ADDTYPE(cpl_filter_median_slow)(void *, cpl_binary **, const void *, const cpl_binary *, const cpl_binary *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode); /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Median filter with bad pixels @param vout The pixel buffer to hold the filtered result @param ppbpm *ppbpm is the bpm, or NULL if still to be created @param vin The input pixel buffer to be filtered @param bpm The input bad pixel map, or NULL if none @param pmask The window @param nx image width @param ny image height @param rx filtering half-size in x @param ry filtering half-size in y @return void */ /*----------------------------------------------------------------------------*/ static cpl_error_code ADDTYPE(cpl_filter_median_slow)(void * vout, cpl_binary ** ppbpm, const void * vin, const cpl_binary * bpm, const cpl_binary * pmask, cpl_size nx, cpl_size ny, cpl_size rx, cpl_size ry, cpl_border_mode mode) { if (mode == CPL_BORDER_FILTER) { OUT_TYPE * out = (OUT_TYPE*)vout; const IN_TYPE * in = (const IN_TYPE*)vin; IN_TYPE window[(2 * rx + 1) * (2 * ry + 1)]; cpl_size x, y; for (y = 0; y < ny; y++) { const size_t y_1 = CX_MAX(0, y - ry); const size_t y2 = CX_MIN(ny-1, y + ry); for (x = 0; x < nx; x++) { const size_t x1 = CX_MAX(0, x - rx); const size_t x2 = CX_MIN(nx-1, x + rx); const IN_TYPE * inj = in + y_1 * nx; const cpl_binary * pmaskj = pmask + (rx - x) + ((ry - y) + y_1) * (2 * rx + 1); size_t k = 0; size_t i, j; if (bpm == NULL) { for (j = y_1; j < 1 + y2; j++, inj += nx, pmaskj += 2 * rx + 1) { for (i = x1; i < 1 + x2; i++) { if (pmaskj[i]) window[k++] = inj[i]; } } } else { const cpl_binary * bpmj = bpm + y_1 * nx; for (j = y_1; j < 1 + y2; j++, inj += nx, bpmj += nx, pmaskj += 2 * rx + 1) { for (i = x1; i < 1 + x2; i++) { if (!bpmj[i] && pmaskj[i]) window[k++] = inj[i]; } } } if (k > 0) { out[x + y * nx] = ADDTYPE(cpl_tools_get_median)(window, k); } else { /* Flag as bad - and set to zero */ if (*ppbpm == NULL) { *ppbpm = cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); } (*ppbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } } } else if (mode == CPL_BORDER_NOP || mode == CPL_BORDER_COPY || mode == CPL_BORDER_CROP) { OUT_TYPE * out = (OUT_TYPE*)vout; const IN_TYPE * in = (const IN_TYPE*)vin; IN_TYPE window[(2 * rx + 1) * (2 * ry + 1)]; cpl_size x, y; cpl_size nxo = mode == CPL_BORDER_CROP ? nx - 2 * rx : nx; cpl_size nyo = mode == CPL_BORDER_CROP ? ny - 2 * ry : ny; if (mode == CPL_BORDER_COPY) { /* Copy the first ry row(s) and then the first rx pixel(s) of the next row */ (void)memcpy(vout, vin, (size_t)(nx * ry + rx) * sizeof(*out)); } for (y = ry; y < ny - ry; y++) { const size_t y_1 = y - ry; const size_t y2 = y + ry; const size_t yo = mode == CPL_BORDER_CROP ? y_1 : (size_t)y; for (x = rx; x < nx - rx; x++) { const size_t x1 = x - rx; const size_t x2 = x + rx; const size_t xo = mode == CPL_BORDER_CROP ? x1 : (size_t)x; const IN_TYPE * inj = in + y_1 * nx; const cpl_binary * pmaskj = pmask + (rx - x) + ((ry - y) + y_1) * (2 * rx + 1); size_t k = 0; size_t i, j; if (bpm == NULL) { for (j = y_1; j < 1 + y2; j++, inj += nx, pmaskj += 2 * rx + 1) { for (i = x1; i < 1 + x2; i++) { if (pmaskj[i]) window[k++] = inj[i]; } } } else { const cpl_binary * bpmj = bpm + y_1 * nx; for (j = y_1; j < 1 + y2; j++, inj += nx, bpmj += nx, pmaskj += 2 * rx + 1) { for (i = x1; i < 1 + x2; i++) { if (!bpmj[i] && pmaskj[i]) window[k++] = inj[i]; } } } if (k > 0) { out[xo + yo * nxo] = ADDTYPE(cpl_tools_get_median)(window, k); } else { /* Flag as bad - and set to zero */ if (*ppbpm == NULL) { *ppbpm = cpl_calloc((size_t)nxo * (size_t)nyo, sizeof(cpl_binary)); } (*ppbpm)[xo + yo * nxo] = CPL_BINARY_1; out[xo + yo * nxo] = (OUT_TYPE)0; } } if (mode == CPL_BORDER_COPY && rx > 0 && y < ny - ry - 1) { /* Copy the last rx pixel(s) of this row and the first rx of the next */ (void)memcpy(out + (size_t)(nx * y + x), in + (size_t)(nx * y + x), 2 * (size_t)rx * sizeof(*out)); } } if (mode == CPL_BORDER_COPY) { /* Copy the last rx pixel(s) of the previous row and the last ry row(s)*/ (void)memcpy(out + (size_t)(nx * y - rx), in + (size_t)(nx * y - rx), (size_t)(nx * ry + rx) * sizeof(*out)); } } else { /* FIXME: Support more modes ? */ return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } return CPL_ERROR_NONE; } /* End of no-cast code */ #endif /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Average filter with bad pixels @param vout The pixel buffer to hold the filtered result @param ppbpm *ppbpm is the bpm, or NULL if still to be created @param vin The input pixel buffer to be filtered @param bpm The input bad pixel map, or NULL if none @param pmask The window @param nx image width @param ny image height @param rx filtering half-size in x @param ry filtering half-size in y @return void @see cpl_filter_median_slow @note FIXME: Modified from cpl_filter_median_slow */ /*----------------------------------------------------------------------------*/ static cpl_error_code ADDTYPE_TWO(cpl_filter_average_slow)(void * vout, cpl_binary ** ppbpm, const void * vin, const cpl_binary * bpm, const cpl_binary * pmask, cpl_size nx, cpl_size ny, cpl_size rx, cpl_size ry, cpl_border_mode mode) { if (mode == CPL_BORDER_FILTER) { OUT_TYPE * out = (OUT_TYPE*)vout; const IN_TYPE * in = (const IN_TYPE*)vin; cpl_size x, y; for (y = 0; y < ny; y++) { const size_t y_1 = (size_t)CX_MAX(0, y - ry); const size_t y2 = (size_t)CX_MIN(ny-1, y + ry); for (x = 0; x < nx; x++) { const size_t x1 = (size_t)CX_MAX(0, x - rx); const size_t x2 = (size_t)CX_MIN(nx-1, x + rx); const IN_TYPE * inj = in + y_1 * nx; const cpl_binary * pmaskj = pmask + (rx - x) + ((ry - y) + y_1) * (2 * rx + 1); ACCU_TYPE meansum = (ACCU_TYPE)0; /* Sum for int else mean */ size_t k = 0; size_t i, j; if (bpm == NULL) { for (j = y_1; j < 1 + y2; j++, inj += nx, pmaskj += 2 * rx + 1) { for (i = x1; i < 1 + x2; i++) { if (pmaskj[i]) { #if defined ACCU_TYPE_IS_INT || !defined CPL_FILTER_AVERAGE_SLOW meansum += (ACCU_TYPE)inj[i]; k++; #else /* This recurrence is taken from cpl_vector_get_mean() */ /* It is turned off by default, since the number of samples is limited */ meansum += (inj[i] - meansum) / ++k; #endif } } } } else { const cpl_binary * bpmj = bpm + y_1 * nx; for (j = y_1; j < 1 + y2; j++, inj += nx, bpmj += nx, pmaskj += 2 * rx + 1) { for (i = x1; i < 1 + x2; i++) { if (!bpmj[i] && pmaskj[i]) { #if defined ACCU_TYPE_IS_INT || !defined CPL_FILTER_AVERAGE_SLOW meansum += (ACCU_TYPE)inj[i]; k++; #else /* This recurrence is taken from cpl_vector_get_mean() */ /* It is turned off by default, since the number of samples is limited */ meansum += (inj[i] - meansum) / ++k; #endif } } } } if (k > 0) { #if defined ACCU_TYPE_IS_INT || !defined CPL_FILTER_AVERAGE_SLOW meansum /= (ACCU_TYPE)k; #endif } else { /* Flag as bad - and set to zero */ if (*ppbpm == NULL) { *ppbpm = cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); } (*ppbpm)[x + y * nx] = CPL_BINARY_1; } out[x + y * nx] = (OUT_TYPE)meansum; } } } else { /* FIXME: Support more modes ? */ return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Stdev filter with bad pixels @param vout The pixel buffer to hold the filtered result @param ppbpm *ppbpm is the bpm, or NULL if still to be created @param vin The input pixel buffer to be filtered @param bpm The input bad pixel map, or NULL if none @param pmask The window @param nx image width @param ny image height @param rx filtering half-size in x @param ry filtering half-size in y @return void @see cpl_filter_average_slow, cpl_tools_get_variancesum @note FIXME: Modified from cpl_filter_average_slow */ /*----------------------------------------------------------------------------*/ static cpl_error_code ADDTYPE_TWO(cpl_filter_stdev_slow)(void * vout, cpl_binary ** ppbpm, const void * vin, const cpl_binary * bpm, const cpl_binary * pmask, cpl_size nx, cpl_size ny, cpl_size rx, cpl_size ry, cpl_border_mode mode) { if (mode == CPL_BORDER_FILTER) { OUT_TYPE * out = (OUT_TYPE*)vout; const IN_TYPE * in = (const IN_TYPE*)vin; cpl_size x, y; for (y = 0; y < ny; y++) { const size_t y_1 = CX_MAX(0, y - ry); const size_t y2 = CX_MIN(ny-1, y + ry); for (x = 0; x < nx; x++) { const size_t x1 = CX_MAX(0, x - rx); const size_t x2 = CX_MIN(nx-1, x + rx); const IN_TYPE * inj = in + y_1 * nx; const cpl_binary * pmaskj = pmask + (rx - x) + ((ry - y) + y_1) * (2 * rx + 1); ACCU_FLOATTYPE varsum = 0.0; ACCU_FLOATTYPE mean = 0.0; double k = 0; size_t i, j; if (bpm == NULL) { for (j = y_1; j < 1 + y2; j++, inj += nx, pmaskj += 2 * rx + 1) { for (i = x1; i < 1 + x2; i++) { if (pmaskj[i]) { const ACCU_FLOATTYPE delta = (ACCU_FLOATTYPE)inj[i] - mean; varsum += k * delta * delta / (k + 1.0); mean += delta / (k + 1.0); k += 1.0; } } } } else { const cpl_binary * bpmj = bpm + y_1 * nx; for (j = y_1; j < 1 + y2; j++, inj += nx, bpmj += nx, pmaskj += 2 * rx + 1) { for (i = x1; i < 1 + x2; i++) { if (!bpmj[i] && pmaskj[i]) { const ACCU_FLOATTYPE delta = (ACCU_FLOATTYPE)inj[i] - mean; varsum += k * delta * delta / (k + 1.0); mean += delta / (k + 1.0); k += 1.0; } } } } if (k > 1) { out[x + y * nx] = (OUT_TYPE)sqrt(varsum / (k - 1.0)); } else { /* Flag as bad - and set to zero */ if (*ppbpm == NULL) { *ppbpm = cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); } (*ppbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } } } else { /* FIXME: Support more modes ? */ return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Stdev filter without bad pixels @param vout The pixel buffer to hold the filtered result @param vin The input pixel buffer to be filtered @param nx image width @param ny image height @param rx filtering half-size in x @param ry filtering half-size in y @return void @see cpl_filter_stdev_slow */ /*----------------------------------------------------------------------------*/ static void ADDTYPE_TWO(cpl_filter_stdev)(void * vout, const void * vin, cpl_size nx, cpl_size ny, cpl_size hsizex, cpl_size hsizey, cpl_border_mode border_mode) { OUT_TYPE * out = (OUT_TYPE*)vout; const IN_TYPE * in = (const IN_TYPE*)vin; double * colvarsum; double * colmean; cpl_size npix, npixy; cpl_size x, y, i; double npixcol, ncol; assert(out != NULL); assert(in != NULL); assert( hsizex >= 0 ); assert( hsizey >= 0 ); assert( 2*hsizex < nx ); /* Caller does not (need to) support this */ assert( 2*hsizey < ny ); /* Caller does not (need to) support this */ assert( hsizex > 0 || hsizey > 0); /* FIXME: Support more modes ? */ assert( border_mode == CPL_BORDER_FILTER ); /* The number of pixels prior to the first stdev */ npixy = hsizey; npix = (1+hsizex) * npixy; /* Initialize the column sums */ colvarsum = cpl_calloc((size_t)nx, sizeof(double)); colmean = cpl_calloc((size_t)nx, sizeof(double)); npixcol = 0.0; for (y=0; y < hsizey; y++) { for (i=0; i < nx; i++) { const double delta = (double)in[i + y * nx] - colmean[i]; colvarsum[i] += npixcol / (npixcol + 1.0) * delta * delta; colmean[i] += delta / (npixcol + 1.0); } npixcol += 1.0; } /* Loop over all the first rows, that cannot be covered by the kernel */ for (y = 0; y < 1 + hsizey; y++) { double runvarsum = (double)0; double runmean = (double)0; npixy ++; npix = (hsizex)*npixy; ncol = 0.0; for (x = 0; x < 1; x ++) { /* Update the first 1 + hsizex column sums */ for (i = 0; i < 1 + hsizex; i ++) { const double delta = (double)in[i + (y + hsizey) * nx] - colmean[i]; double rundelta; colvarsum[i] += npixcol / (npixcol + 1.0) * delta * delta; colmean[i] += delta / (npixcol + 1.0); rundelta = colmean[i] - runmean; runvarsum += colvarsum[i] + ncol / (ncol + 1.0) * (npixcol + 1.0) * rundelta * rundelta; runmean += rundelta / (ncol + 1.0); ncol += 1.0; } npix += npixy; out[x + y * nx] = (OUT_TYPE)sqrt(runvarsum/(double)(npix - 1)); } for (; x < 1 + hsizex; x ++) { const double delta = (double)in[x + hsizex + (y + hsizey) * nx] - colmean[x + hsizex]; double rundelta; colvarsum[x + hsizex] += npixcol / (npixcol + 1.0) * delta * delta; colmean[x + hsizex] += delta / (npixcol + 1.0); rundelta = colmean[x + hsizex] - runmean; runvarsum += colvarsum[x + hsizex] + ncol / (ncol + 1.0) * (npixcol + 1.0) * rundelta * rundelta; runmean += rundelta / (ncol + 1.0); ncol += 1.0; npix += npixy; out[x + y * nx] = (OUT_TYPE)sqrt(runvarsum/(double)(npix - 1)); } for (; x < nx-hsizex; x ++) { const double delta = (double)in[x + hsizex + (y + hsizey) * nx] - colmean[x + hsizex]; double rundelta; colvarsum[x + hsizex] += npixcol / (npixcol + 1.0) * delta * delta; colmean[x + hsizex] += delta / (npixcol + 1.0); if (ncol > 1.0) { rundelta = colmean[x - hsizex - 1] - runmean; runvarsum -= colvarsum[x - hsizex - 1] + ncol / (ncol - 1.0) * (npixcol + 1.0) * rundelta * rundelta; runmean -= rundelta / (ncol - 1.0); rundelta = colmean[x + hsizex] - runmean; runvarsum += colvarsum[x + hsizex] + (ncol - 1.0) / ncol * (npixcol + 1.0) * rundelta * rundelta; runmean += rundelta / ncol; } else { runvarsum = colvarsum[x + hsizex]; } out[x + y * nx] = (OUT_TYPE)sqrt(runvarsum/(double)(npix - 1)); } for (; x < nx; x++) { const double rundelta = colmean[x - hsizex - 1] - runmean; runvarsum -= colvarsum[x - hsizex - 1] + ncol / (ncol - 1.0) * (npixcol + 1.0) * rundelta * rundelta; runmean -= rundelta / (ncol - 1.0); ncol -= 1.0; npix -= npixy; out[x + y * nx] = (OUT_TYPE)sqrt(runvarsum/(double)(npix - 1)); } npixcol += 1.0; } /* Loop over the central rows */ for (;y < ny-hsizey; y++) { double runvarsum = (double)0; double runmean = (double)0; npix = (hsizex)*npixy; ncol = 0.0; for (x = 0; x < 1; x++) { /* Update the first 1 + hsizex column sums */ for (i = 0; i < 1 + hsizex; i ++) { double delta; double rundelta; if (npixcol > 1.0) { delta = (double)in[i + (y - hsizey - 1) * nx] - colmean[i]; colvarsum[i] -= npixcol / (npixcol - 1.0) * delta * delta; colmean[i] -= delta / (npixcol - 1.0); delta = (double)in[i + (y + hsizey) * nx] - colmean[i]; colvarsum[i] += (npixcol - 1.0) / npixcol * delta * delta; colmean[i] += delta / npixcol; } else { colvarsum[i] = 0.0; colmean[i] = (double)in[i + (y + hsizey) * nx]; } rundelta = colmean[i] - runmean; runvarsum += colvarsum[i] + ncol / (ncol + 1.0) * npixcol * rundelta * rundelta; runmean += rundelta / (ncol + 1.0); ncol += 1.0; } npix += npixy; out[x + y * nx] = (OUT_TYPE)sqrt(runvarsum/(double)(npix - 1)); } for (; x < 1 + hsizex; x++) { double delta; double rundelta; if (npixcol > 1.0) { delta = (double)in[x + hsizex + (y - hsizey - 1) * nx] - colmean[x + hsizex]; colvarsum[x + hsizex] -= npixcol / (npixcol - 1.0) * delta * delta; colmean[x + hsizex] -= delta / (npixcol - 1.0); delta = (double)in[x + hsizex + (y + hsizey) * nx] - colmean[x + hsizex]; colvarsum[x + hsizex] += (npixcol - 1.0) / npixcol * delta * delta; colmean[x + hsizex] += delta / npixcol; } else { colvarsum[x + hsizex] = 0.0; colmean[x + hsizex] = (double)in[x + hsizex + (y + hsizey) * nx]; } rundelta = colmean[x + hsizex] - runmean; runvarsum += colvarsum[x + hsizex] + ncol / (ncol + 1.0) * npixcol * rundelta * rundelta; runmean += rundelta / (ncol + 1.0); ncol += 1.0; npix += npixy; out[x + y * nx] = (OUT_TYPE)sqrt(runvarsum/(double)(npix - 1)); } for (; x < nx-hsizex; x++) { double delta; double rundelta; if (npixcol > 1.0) { delta = (double)in[x + hsizex + (y - hsizey - 1) * nx] - colmean[x + hsizex]; colvarsum[x + hsizex] -= npixcol / (npixcol - 1.0) * delta * delta; colmean[x + hsizex] -= delta / (npixcol - 1.0); delta = (double)in[x + hsizex + (y + hsizey) * nx] - colmean[x + hsizex]; colvarsum[x + hsizex] += (npixcol - 1.0) / npixcol * delta * delta; colmean[x + hsizex] += delta / npixcol; } else { colvarsum[x + hsizex] = 0.0; colmean[x + hsizex] = (double)in[x + hsizex + (y + hsizey) * nx]; } if (ncol > 1.0) { rundelta = colmean[x - hsizex - 1] - runmean; runvarsum -= colvarsum[x - hsizex - 1] + ncol / (ncol - 1.0) * npixcol * rundelta * rundelta; runmean -= rundelta / (ncol - 1.0); rundelta = colmean[x + hsizex] - runmean; runvarsum += colvarsum[x + hsizex] + (ncol - 1.0) / ncol * npixcol * rundelta * rundelta; runmean += rundelta / ncol; } else { runvarsum = colvarsum[x + hsizex]; } out[x + y * nx] = (OUT_TYPE)sqrt(runvarsum/(double)(npix - 1)); } for (; x < nx; x++) { const double rundelta = colmean[x - hsizex - 1] - runmean; runvarsum -= colvarsum[x - hsizex - 1] + ncol / (ncol - 1.0) * npixcol * rundelta * rundelta; runmean -= rundelta / (ncol - 1.0); ncol -= 1.0; npix -= npixy; out[x + y * nx] = (OUT_TYPE)sqrt(runvarsum/(double)(npix - 1)); } } /* Loop over all the last rows, that cannot be covered by the kernel */ for (;y < ny; y++) { double runvarsum = (double)0; double runmean = (double)0; npixy --; npix = (hsizex)*npixy; ncol = 0.0; for (x = 0; x < 1; x++) { /* Update the first 1 + hsizex column sums */ for (i = 0; i < 1 + hsizex; i ++) { const double delta = (double)in[i + (y - hsizey - 1) * nx] - colmean[i]; double rundelta; colvarsum[i] -= npixcol / (npixcol - 1.0) * delta * delta; colmean[i] -= delta / (npixcol - 1.0); rundelta = colmean[i] - runmean; runvarsum += colvarsum[i] + ncol / (ncol + 1.0) * (npixcol - 1.0) * rundelta * rundelta; runmean += rundelta / (ncol + 1.0); ncol += 1.0; } npix += npixy; out[x + y * nx] = (OUT_TYPE)sqrt(runvarsum/(double)(npix - 1)); } for (; x < 1 + hsizex; x++) { const double delta = (double)in[x + hsizex + (y - hsizey - 1) * nx] - colmean[x + hsizex]; double rundelta; colvarsum[x + hsizex] -= npixcol / (npixcol - 1.0) * delta * delta; colmean[x + hsizex] -= delta / (npixcol - 1.0); rundelta = colmean[x + hsizex] - runmean; runvarsum += colvarsum[x + hsizex] + ncol / (ncol + 1.0) * (npixcol - 1.0) * rundelta * rundelta; runmean += rundelta / (ncol + 1.0); npix += npixy; ncol += 1.0; out[x + y * nx] = (OUT_TYPE)sqrt(runvarsum/(double)(npix - 1)); } for (; x < nx-hsizex; x++) { const double delta = (double)in[x + hsizex + (y - hsizey - 1) * nx] - colmean[x + hsizex]; double rundelta; colvarsum[x + hsizex] -= npixcol / (npixcol - 1.0) * delta * delta; colmean[x + hsizex] -= delta / (npixcol - 1.0); if (ncol > 1.0) { rundelta = colmean[x - hsizex - 1] - runmean; runvarsum -= colvarsum[x - hsizex - 1] + ncol / (ncol - 1.0) * (npixcol - 1.0) * rundelta * rundelta; runmean -= rundelta / (ncol - 1.0); rundelta = colmean[x + hsizex] - runmean; runvarsum += colvarsum[x + hsizex] + (ncol - 1.0) / ncol * (npixcol - 1.0) * rundelta * rundelta; runmean += rundelta / ncol; } else { runvarsum = colvarsum[x + hsizex]; } out[x + y * nx] = (OUT_TYPE)sqrt(runvarsum/(double)(npix - 1)); } for (; x < nx; x++) { const double rundelta = colmean[x - hsizex - 1] - runmean; runvarsum -= colvarsum[x - hsizex - 1] + ncol / (ncol - 1.0) * (npixcol - 1.0) * rundelta * rundelta; runmean -= rundelta / (ncol - 1.0); ncol -= 1.0; npix -= npixy; out[x + y * nx] = (OUT_TYPE)sqrt(runvarsum/(double)(npix - 1)); } npixcol -= 1.0; } cpl_free(colvarsum); cpl_free(colmean); return; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Average filter without bad pixels @param vout The pixel buffer to hold the filtered result @param vin The input pixel buffer to be filtered @param nx image width @param ny image height @param rx filtering half-size in x @param ry filtering half-size in y @return void @note FIXME: Lots of code duplication inside */ /*----------------------------------------------------------------------------*/ static void ADDTYPE_TWO(cpl_filter_average)(void * vout, const void * vin, cpl_size nx, cpl_size ny, cpl_size hsizex, cpl_size hsizey, cpl_border_mode border_mode) { OUT_TYPE * out = (OUT_TYPE*)vout; const IN_TYPE * in = (const IN_TYPE*)vin; ACCU_TYPE * colsum; cpl_size npix, npixy; cpl_size x, y, i; assert(out != NULL); assert(in != NULL); assert( hsizex >= 0 ); assert( hsizey >= 0 ); assert( 2*hsizex < nx ); /* Caller does not (need to) support this */ assert( 2*hsizey < ny ); /* Caller does not (need to) support this */ /* FIXME: Support more modes ? */ assert( border_mode == CPL_BORDER_FILTER ); /* The number of pixels prior to the first average */ npixy = hsizey; npix = (1+hsizex) * npixy; /* Initialize the column sums */ colsum = cpl_calloc((size_t)nx, sizeof(*colsum)); for (y=0; y < hsizey; y++) { for (i=0; i < nx; i++) { colsum[i] += in[i + y * nx]; } } /* Loop over all the first rows, that cannot be covered by the kernel */ for (y = 0; y < 1 + hsizey; y++) { ACCU_TYPE runsum = (ACCU_TYPE)0; #ifdef ALLOW_RECIPROCAL ACCU_TYPE rnpix; #endif npixy ++; npix = (hsizex)*npixy; for (x = 0; x < 1; x ++) { /* Update the first 1 + hsizex column sums */ for (i = 0; i < 1 + hsizex; i ++) { colsum[i] += in[i + (y + hsizey) * nx]; runsum += colsum[i]; } npix += npixy; out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } for (; x < 1 + hsizex; x ++) { /* Update the new colsum */ colsum[x + hsizex] += in[x + hsizex + (y + hsizey) * nx]; /* Update the running sum */ runsum += colsum[x + hsizex]; npix += npixy; out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } #ifdef ALLOW_RECIPROCAL rnpix = (ACCU_TYPE)1.0/(ACCU_TYPE)npix; #endif for (; x < nx-hsizex; x ++) { /* Update the new colsum */ colsum[x + hsizex] += in[x + hsizex + (y + hsizey) * nx]; /* Update the running sum */ runsum -= colsum[x - hsizex - 1]; runsum += colsum[x + hsizex]; out[x + y * nx] = (OUT_TYPE)(RUNSUM_MEAN); } for (; x < nx; x++) { /* Update the running sum */ runsum -= colsum[x - hsizex - 1]; npix -= npixy; out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } } /* Loop over the central rows */ for (;y < ny-hsizey; y++) { ACCU_TYPE runsum = (ACCU_TYPE)0; #ifdef ALLOW_RECIPROCAL ACCU_TYPE rnpix; #endif npix = (hsizex)*npixy; for (x = 0; x < 1; x++) { /* Update the first 1 + hsizex column sums */ for (i = 0; i < 1 + hsizex; i ++) { colsum[i] -= in[i + (y - hsizey - 1) * nx]; colsum[i] += in[i + (y + hsizey) * nx]; runsum += colsum[i]; } npix += npixy; out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } for (; x < 1 + hsizex; x++) { /* Update the new colsum */ colsum[x + hsizex] -= in[x + hsizex + (y - hsizey - 1) * nx]; colsum[x + hsizex] += in[x + hsizex + (y + hsizey) * nx]; /* Update the running sum */ runsum += colsum[x + hsizex]; npix += npixy; out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } #ifdef ALLOW_RECIPROCAL rnpix = (ACCU_TYPE)1.0/(ACCU_TYPE)npix; #endif for (; x < nx-hsizex; x++) { /* Update the new colsum */ colsum[x + hsizex] -= in[x + hsizex + (y - hsizey - 1) * nx]; colsum[x + hsizex] += in[x + hsizex + (y + hsizey) * nx]; /* Update the running sum */ runsum -= colsum[x - hsizex - 1]; runsum += colsum[x + hsizex]; out[x + y * nx] = (OUT_TYPE)(RUNSUM_MEAN); } for (; x < nx; x++) { /* Update the running sum */ runsum -= colsum[x - hsizex - 1]; npix -= npixy; out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } } /* Loop over all the last rows, that cannot be covered by the kernel */ for (;y < ny; y++) { ACCU_TYPE runsum = (ACCU_TYPE)0; #ifdef ALLOW_RECIPROCAL ACCU_TYPE rnpix; #endif npixy --; npix = (hsizex)*npixy; for (x = 0; x < 1; x++) { /* Update the first 1 + hsizex column sums */ for (i = 0; i < 1 + hsizex; i ++) { colsum[i] -= in[i + (y - hsizey - 1) * nx]; runsum += colsum[i]; } npix += npixy; out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } for (; x < 1 + hsizex; x++) { /* Update the new colsum */ colsum[x + hsizex] -= in[x + hsizex + (y - hsizey - 1) * nx]; /* Update the running sum */ runsum += colsum[x + hsizex]; npix += npixy; out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } #ifdef ALLOW_RECIPROCAL rnpix = (ACCU_TYPE)1.0/(ACCU_TYPE)npix; #endif for (; x < nx-hsizex; x++) { /* Update the new colsum */ colsum[x + hsizex] -= in[x + hsizex + (y - hsizey - 1) * nx]; /* Update the running sum */ runsum -= colsum[x - hsizex - 1]; runsum += colsum[x + hsizex]; out[x + y * nx] = (OUT_TYPE)(RUNSUM_MEAN); } for (; x < nx; x++) { /* Update the running sum */ runsum -= colsum[x - hsizex - 1]; npix -= npixy; out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } } cpl_free(colsum); return; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Average filter with bad pixels @param vout The pixel buffer to hold the filtered result @param pbpm *pbpm is the output bpm, or NULL if still to be created @param vin The input pixel buffer to be filtered @param bpm The input bad pixel map, or NULL if none @param pmask The window @param nx image width @param ny image height @param rx filtering half-size in x @param ry filtering half-size in y @return void @note FIXME: Modified from cpl_filter_average */ /*----------------------------------------------------------------------------*/ static void ADDTYPE_TWO(cpl_filter_average_bpm)(void * vout, cpl_binary ** pbpm, const void * vin, const cpl_binary * bpm, cpl_size nx, cpl_size ny, cpl_size hsizex, cpl_size hsizey, cpl_border_mode border_mode) { OUT_TYPE * out = (OUT_TYPE*)vout; const IN_TYPE * in = (const IN_TYPE*)vin; ACCU_TYPE * colsum; int * colpix; cpl_size npix; cpl_size x, y, i; assert(out != NULL); assert(pbpm != NULL); assert(in != NULL); assert(bpm != NULL); assert( hsizex >= 0 ); assert( hsizey >= 0 ); assert( 2*hsizex < nx ); /* Caller does not (need to) support this */ assert( 2*hsizey < ny ); /* Caller does not (need to) support this */ /* FIXME: Support more modes ? */ assert( border_mode == CPL_BORDER_FILTER ); /* Initialize the column sums */ colsum = cpl_calloc((size_t)nx, sizeof(*colsum)); /* Initialize the counter of column elements (variable with bad pixels) */ colpix = cpl_calloc((size_t)nx, sizeof(*colsum)); for (y=0; y < hsizey; y++) { for (i=0; i < nx; i++) { if (!bpm[i + y * nx]) { colsum[i] += in[i + y * nx]; colpix[i]++; } } } /* Loop over all the first rows, that cannot be covered by the kernel */ for (y = 0; y < 1 + hsizey; y++) { ACCU_TYPE runsum = (ACCU_TYPE)0; #ifdef ALLOW_RECIPROCAL ACCU_TYPE rnpix = 0.0; /* Prevent (false) uninit warning */ #endif npix = 0; for (x = 0; x < 1; x ++) { /* Update the first 1 + hsizex column sums */ for (i = 0; i < 1 + hsizex; i ++) { if (!bpm[i + (y + hsizey) * nx]) { colsum[i] += in[i + (y + hsizey) * nx]; runsum += colsum[i]; colpix[i]++; npix += colpix[i]; } } if (npix) { out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } else { /* Flag as bad - and set to zero */ if (*pbpm == NULL) *pbpm = (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); (*pbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } for (; x < 1 + hsizex; x ++) { if (!bpm[x + hsizex + (y + hsizey) * nx]) { /* Update the new colsum */ colsum[x + hsizex] += in[x + hsizex + (y + hsizey) * nx]; /* Update the running sum */ runsum += colsum[x + hsizex]; colpix[x + hsizex]++; npix += colpix[x + hsizex]; } if (npix) { out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } else { /* Flag as bad - and set to zero */ if (*pbpm == NULL) *pbpm = (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); (*pbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } #ifdef ALLOW_RECIPROCAL rnpix = (ACCU_TYPE)1.0/(ACCU_TYPE)npix; #endif for (; x < nx-hsizex; x ++) { if (!bpm[x + hsizex + (y + hsizey) * nx]) { /* Update the new colsum */ colsum[x + hsizex] += in[x + hsizex + (y + hsizey) * nx]; colpix[x + hsizex]++; } if (colsum[x + hsizex] != colpix[x - hsizex - 1]) { npix += colpix[x + hsizex] - colpix[x - hsizex - 1]; #ifdef ALLOW_RECIPROCAL if (npix) rnpix = (ACCU_TYPE)1.0/(ACCU_TYPE)npix; #endif } /* Update the running sum */ runsum -= colsum[x - hsizex - 1]; runsum += colsum[x + hsizex]; if (npix) { out[x + y * nx] = (OUT_TYPE)(RUNSUM_MEAN); } else { /* Flag as bad - and set to zero */ if (*pbpm == NULL) *pbpm = (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); (*pbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } for (; x < nx; x++) { /* Update the running sum */ runsum -= colsum[x - hsizex - 1]; npix -= colpix[x - hsizex - 1]; if (npix) { out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } else { /* Flag as bad - and set to zero */ if (*pbpm == NULL) *pbpm = (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); (*pbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } } /* Loop over the central rows */ for (;y < ny-hsizey; y++) { ACCU_TYPE runsum = (ACCU_TYPE)0; #ifdef ALLOW_RECIPROCAL ACCU_TYPE rnpix = (ACCU_TYPE)0; /* Prevent (false) uninit warning */ #endif npix = 0; for (x = 0; x < 1; x++) { /* Update the first 1 + hsizex column sums */ for (i = 0; i < 1 + hsizex; i ++) { if (!bpm[i + (y - hsizey - 1) * nx]) { colsum[i] -= in[i + (y - hsizey - 1) * nx]; colpix[i]--; } if (!bpm[i + (y + hsizey) * nx]) { colsum[i] += in[i + (y + hsizey) * nx]; colpix[i]++; } runsum += colsum[i]; npix += colpix[i]; } if (npix) { out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } else { /* Flag as bad - and set to zero */ if (*pbpm == NULL) *pbpm = (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); (*pbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } for (; x < 1 + hsizex; x++) { /* Update the new colsum */ if (!bpm[x + hsizex + (y - hsizey - 1) * nx]) { colsum[x + hsizex] -= in[x + hsizex + (y - hsizey - 1) * nx]; colpix[x + hsizex]--; } if (!bpm[x + hsizex + (y + hsizey) * nx]) { colsum[x + hsizex] += in[x + hsizex + (y + hsizey) * nx]; colpix[x + hsizex]++; } /* Update the running sum */ runsum += colsum[x + hsizex]; npix += colpix[x + hsizex]; if (npix) { out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } else { /* Flag as bad - and set to zero */ if (*pbpm == NULL) *pbpm = (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); (*pbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } #ifdef ALLOW_RECIPROCAL if (npix > (ACCU_TYPE)0.0) rnpix = (ACCU_TYPE)1.0/(ACCU_TYPE)npix; #endif for (; x < nx-hsizex; x++) { /* Update the new colsum */ if (!bpm[x + hsizex + (y - hsizey - 1) * nx]) { colsum[x + hsizex] -= in[x + hsizex + (y - hsizey - 1) * nx]; colpix[x + hsizex]--; } if (!bpm[x + hsizex + (y + hsizey) * nx]) { colsum[x + hsizex] += in[x + hsizex + (y + hsizey) * nx]; colpix[x + hsizex]++; } /* Update the running sum */ runsum -= colsum[x - hsizex - 1]; runsum += colsum[x + hsizex]; if (colsum[x + hsizex] != colpix[x - hsizex - 1]) { npix += colpix[x + hsizex] - colpix[x - hsizex - 1]; #ifdef ALLOW_RECIPROCAL if (npix) rnpix = (ACCU_TYPE)1.0/(ACCU_TYPE)npix; #endif } if (npix) { out[x + y * nx] = (OUT_TYPE)(RUNSUM_MEAN); } else { /* Flag as bad - and set to zero */ if (*pbpm == NULL) *pbpm = (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); (*pbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } for (; x < nx; x++) { /* Update the running sum */ runsum -= colsum[x - hsizex - 1]; npix -= colpix[x - hsizex - 1]; if (npix) { out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } else { /* Flag as bad - and set to zero */ if (*pbpm == NULL) *pbpm = (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); (*pbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } } /* Loop over all the last rows, that cannot be covered by the kernel */ for (;y < ny; y++) { ACCU_TYPE runsum = (ACCU_TYPE)0; #ifdef ALLOW_RECIPROCAL ACCU_TYPE rnpix = (ACCU_TYPE)0; /* Prevent (false) uninit warning */ #endif npix = (ACCU_TYPE)0; for (x = 0; x < 1; x++) { /* Update the first 1 + hsizex column sums */ for (i = 0; i < 1 + hsizex; i ++) { if (!bpm[i + (y - hsizey - 1) * nx]) { colsum[i] -= in[i + (y - hsizey - 1) * nx]; colpix[i]--; } runsum += colsum[i]; npix += colpix[i]; } if (npix) { out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } else { /* Flag as bad - and set to zero */ if (*pbpm == NULL) *pbpm = (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); (*pbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } for (; x < 1 + hsizex; x++) { /* Update the new colsum */ if (!bpm[x + hsizex + (y - hsizey - 1) * nx]) { colsum[x + hsizex] -= in[x + hsizex + (y - hsizey - 1) * nx]; colpix[x + hsizex]--; } /* Update the running sum */ runsum += colsum[x + hsizex]; npix += colpix[x + hsizex]; if (npix) { out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } else { /* Flag as bad - and set to zero */ if (*pbpm == NULL) *pbpm = (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); (*pbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } #ifdef ALLOW_RECIPROCAL if (npix) rnpix = (ACCU_TYPE)1.0/(ACCU_TYPE)npix; #endif for (; x < nx-hsizex; x++) { /* Update the new colsum */ if (!bpm[x + hsizex + (y - hsizey - 1) * nx]) { colsum[x + hsizex] -= in[x + hsizex + (y - hsizey - 1) * nx]; colpix[x + hsizex]--; } /* Update the running sum */ runsum -= colsum[x - hsizex - 1]; runsum += colsum[x + hsizex]; if (colsum[x + hsizex] != colpix[x - hsizex - 1]) { npix += colpix[x + hsizex] - colpix[x - hsizex - 1]; #ifdef ALLOW_RECIPROCAL if (npix) rnpix = (ACCU_TYPE)1.0/(ACCU_TYPE)npix; #endif } if (npix) { out[x + y * nx] = (OUT_TYPE)(RUNSUM_MEAN); } else { /* Flag as bad - and set to zero */ if (*pbpm == NULL) *pbpm = (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); (*pbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } for (; x < nx; x++) { /* Update the running sum */ runsum -= colsum[x - hsizex - 1]; npix -= colpix[x - hsizex - 1]; if (npix) { out[x + y * nx] = (OUT_TYPE)(runsum/(ACCU_TYPE)npix); } else { /* Flag as bad - and set to zero */ if (*pbpm == NULL) *pbpm = (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); (*pbpm)[x + y * nx] = CPL_BINARY_1; out[x + y * nx] = (OUT_TYPE)0; } } } cpl_free(colsum); cpl_free(colpix); return; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Linear filter with bad pixels @param vout The pixel buffer to hold the filtered result @param ppbpm *ppbpm is the bpm, or NULL if still to be created @param vin The input pixel buffer to be filtered @param bpm The input bad pixel map, or NULL if none @param pkernel The kernel @param nx image width @param ny image height @param dodiv CPL_TRUE for division by the kernel absolute weights sum @param rx filtering half-size in x @param ry filtering half-size in y @return void @see cpl_filter_average_slow @note FIXME: Modified from cpl_filter_average_slow */ /*----------------------------------------------------------------------------*/ static cpl_error_code ADDTYPE_TWO(cpl_filter_linear_slow)(void * vout, cpl_binary ** ppbpm, const void * vin, const cpl_binary * bpm, const double * pkernel, cpl_size nx, cpl_size ny, cpl_boolean dodiv, cpl_size rx, cpl_size ry, cpl_border_mode mode) { if (mode == CPL_BORDER_FILTER) { OUT_TYPE * out = (OUT_TYPE*)vout; const IN_TYPE * in = (const IN_TYPE*)vin; cpl_size x, y; for (y = 0; y < ny; y++) { const size_t y_1 = CX_MAX(0, y - ry); const size_t y2 = CX_MIN(ny-1, y + ry); for (x = 0; x < nx; x++) { const size_t x1 = CX_MAX(0, x - rx); const size_t x2 = CX_MIN(nx-1, x + rx); const IN_TYPE * inj = in + y_1 * nx; /* Point to last (bottom) kernel row for first (bottom) image row */ /* As a difference from cpl_filter_average_slow, element (i,j) in a mask buffer corresponds to element (i, n-1-j) in a matrix buffer. Thus a matrix buffer has to be accessed in reverse row order */ const double * pkernelj = pkernel + (rx - x) + (ry + y - y_1) * (2 * rx + 1); double sum = 0.0; double weight = 0.0; /* True iff the filtered pixel has contributing input pixels (ignoring zero-valued weigths) */ cpl_boolean isok = bpm == NULL; size_t i, j; if (bpm == NULL) { for (j = y_1; j < 1 + y2; j++, inj += nx, pkernelj -= 2 * rx + 1) { for (i = x1; i < 1 + x2; i++) { sum += pkernelj[i] * (double)inj[i]; if (dodiv) weight += fabs(pkernelj[i]); } } } else { const cpl_binary * bpmj = bpm + y_1 * nx; for (j = y_1; j < 1 + y2; j++, inj += nx, bpmj += nx, pkernelj -= 2 * rx + 1) { for (i = x1; i < 1 + x2; i++) { if (!bpmj[i]) { sum += pkernelj[i] * (double)inj[i]; if (dodiv) weight += fabs(pkernelj[i]); else isok = CPL_TRUE; } } } } if (dodiv ? weight > 0.0 : isok) { if (dodiv) sum /= weight; } else { /* Flag as bad - and set to zero */ if (*ppbpm == NULL) { *ppbpm = cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); } (*ppbpm)[x + y * nx] = CPL_BINARY_1; } out[x + y * nx] = (OUT_TYPE)sum; } } } else { /* FIXME: Support more modes ? */ return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Morpho filter with bad pixels @param vout The pixel buffer to hold the filtered result @param ppbpm *ppbpm is the bpm, or NULL if still to be created @param vin The input pixel buffer to be filtered @param bpm The input bad pixel map, or NULL if none @param pkernel The kernel @param nx image width @param ny image height @param dodiv CPL_TRUE for division by the kernel absolute weights sum @param rx filtering half-size in x @param ry filtering half-size in y @return void @see cpl_filter_average_slow @note FIXME: Modified from cpl_filter_linear_slow + cpl_filter_median_slow */ /*----------------------------------------------------------------------------*/ static cpl_error_code ADDTYPE_TWO(cpl_filter_morpho_slow)(void * vout, cpl_binary ** ppbpm, const void * vin, const cpl_binary * bpm, const double * pkernel, cpl_size nx, cpl_size ny, cpl_boolean dodiv, cpl_size rx, cpl_size ry, cpl_border_mode mode) { if (mode == CPL_BORDER_FILTER) { OUT_TYPE * out = (OUT_TYPE*)vout; const IN_TYPE * in = (const IN_TYPE*)vin; IN_TYPE window[(2 * rx + 1) * (2 * ry + 1)]; cpl_size x, y; for (y = 0; y < ny; y++) { const size_t y_1 = CX_MAX(0, y - ry); const size_t y2 = CX_MIN(ny-1, y + ry); for (x = 0; x < nx; x++) { const size_t x1 = CX_MAX(0, x - rx); const size_t x2 = CX_MIN(nx-1, x + rx); const IN_TYPE * inj = in + y_1 * nx; double sum = 0.0; double weight = 0.0; size_t i, j; size_t k = 0; /* FIXME: In the sorted array, only one row has to be updated for each new pixel, see the fast median algorithm */ if (bpm == NULL) { for (j = y_1; j < 1 + y2; j++, inj += nx) { for (i = x1; i < 1 + x2; i++) { window[k] = inj[i]; if (dodiv) weight += fabs(pkernel[k]); k++; } } } else { const cpl_binary * bpmj = bpm + y_1 * nx; for (j = y_1; j < 1 + y2; j++, inj += nx, bpmj += nx) { for (i = x1; i < 1 + x2; i++) { if (!bpmj[i]) { window[k] = inj[i]; if (dodiv) weight += fabs(pkernel[k]); k++; } } } } if (dodiv ? weight > 0.0 : k > 0) { /* Sort array with standard sorting routine */ /* assert(k > 0); */ ADDTYPE(cpl_tools_sort)(window, k); for (; k--;) { sum += pkernel[k] * (double)window[k]; } if (dodiv) sum /= weight; } else { /* Flag as bad - and set to zero */ if (*ppbpm == NULL) { *ppbpm = cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary)); } (*ppbpm)[x + y * nx] = CPL_BINARY_1; } out[x + y * nx] = (OUT_TYPE)sum; } } } else { /* FIXME: Support more modes ? */ return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } return CPL_ERROR_NONE; } /* @endcond */ #undef ACCU_TYPE #undef ACCU_FLOATTYPE #undef IN_TYPE #undef OUT_TYPE #undef ACCU_TYPE_IS_INT #undef ALLOW_RECIPROCAL #undef RUNSUM_MEAN cpl-6.4.1/cplcore/cpl_imagelist_io.h0000644000460300003120000000631512076020377014326 00000000000000/* $Id: cpl_imagelist_io.h,v 1.30 2013-01-17 16:04:13 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-01-17 16:04:13 $ * $Revision: 1.30 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGELIST_IO_H #define CPL_IMAGELIST_IO_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image.h" #include "cpl_imagelist.h" #include "cpl_vector.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* Imagelist constructors */ cpl_imagelist * cpl_imagelist_new(void) CPL_ATTR_ALLOC; cpl_imagelist * cpl_imagelist_load(const char *, cpl_type, cpl_size) CPL_ATTR_ALLOC; cpl_imagelist * cpl_imagelist_load_window(const char *, cpl_type, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; /* Imagelist accessors */ cpl_size cpl_imagelist_get_size(const cpl_imagelist *); cpl_image * cpl_imagelist_get(cpl_imagelist *, cpl_size); const cpl_image * cpl_imagelist_get_const(const cpl_imagelist *, cpl_size); cpl_error_code cpl_imagelist_set(cpl_imagelist *, cpl_image *, cpl_size); cpl_image * cpl_imagelist_unset(cpl_imagelist *, cpl_size); /* Imagelist destructor */ void cpl_imagelist_delete(cpl_imagelist *); void cpl_imagelist_unwrap(cpl_imagelist *); void cpl_imagelist_empty(cpl_imagelist *); /* Others */ cpl_imagelist * cpl_imagelist_duplicate(const cpl_imagelist *) CPL_ATTR_ALLOC; cpl_error_code cpl_imagelist_erase(cpl_imagelist *, const cpl_vector *); int cpl_imagelist_is_uniform(const cpl_imagelist *); cpl_error_code cpl_imagelist_cast(cpl_imagelist *, const cpl_imagelist *, cpl_type); cpl_error_code cpl_imagelist_dump_structure(const cpl_imagelist *, FILE *); cpl_error_code cpl_imagelist_dump_window(const cpl_imagelist *, cpl_size, cpl_size, cpl_size, cpl_size, FILE *); /* Saving function */ cpl_error_code cpl_imagelist_save(const cpl_imagelist *, const char *, cpl_type, const cpl_propertylist *, unsigned); CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_polynomial_impl.h0000644000460300003120000000374311667164715015101 00000000000000/* $Id: cpl_polynomial_impl.h,v 1.6 2011-12-05 15:57:01 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-12-05 15:57:01 $ * $Revision: 1.6 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_POLYNOMIAL_IMPL_H #define CPL_POLYNOMIAL_IMPL_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_polynomial.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_fit_1d(cpl_polynomial *, const cpl_vector *, const cpl_vector *, cpl_size, cpl_size, cpl_boolean, double *); void cpl_polynomial_shift_double(double *, cpl_size, double) CPL_ATTR_NONNULL; cpl_error_code cpl_polynomial_solve_1d_(const cpl_polynomial *, double, double *, cpl_size, cpl_boolean); CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_init.h0000644000460300003120000000241111466733006012617 00000000000000/* $Id: cpl_init.h,v 1.9 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.9 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_INIT_H #define CPL_INIT_H #include CPL_BEGIN_DECLS #define CPL_INIT_DEFAULT 0 #define CPL_DESCRIPTION_DEFAULT 0 void cpl_init(unsigned); const char * cpl_get_description(unsigned); void cpl_end(void); CPL_END_DECLS #endif /* CPL_INIT_H */ cpl-6.4.1/cplcore/cpl_propertylist_impl.h0000644000460300003120000000264311466733006015464 00000000000000/* $Id: cpl_propertylist_impl.h,v 1.9 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.9 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_PROPERTYLIST_IMPL_H #define CPL_PROPERTYLIST_IMPL_H #include #include "cpl_error.h" #include "cpl_property.h" #include "cpl_propertylist.h" CPL_BEGIN_DECLS cpl_error_code cpl_propertylist_to_fitsfile(fitsfile *file, const cpl_propertylist *self, const char *to_rm); cpl_propertylist *cpl_propertylist_from_fitsfile(fitsfile *file); CPL_END_DECLS #endif /* CPL_PROPERTYLIST_IMPL_H */ cpl-6.4.1/cplcore/cpl_error.h0000644000460300003120000004544712226751634013027 00000000000000/* $Id: cpl_error.h,v 1.83 2013-10-14 11:21:00 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-10-14 11:21:00 $ * $Revision: 1.83 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_ERROR_H #define CPL_ERROR_H #include #include #include #include CPL_BEGIN_DECLS /* * * This module provides functions to maintain the @em cpl_error status. */ /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @ingroup cpl_error @brief The maximum length of a CPL error message @see cpl_error_get_message() */ /*----------------------------------------------------------------------------*/ #ifndef CPL_ERROR_MAX_MESSAGE_LENGTH #define CPL_ERROR_MAX_MESSAGE_LENGTH 256 #endif /*----------------------------------------------------------------------------*/ /** @ingroup cpl_error @hideinitializer @brief Flag to indicate support for variadic macros @see cpl_error_set_message() @note Unless already defined, tries to detect whether variadic macros are supported, typically at compile-time of a CPL-based application. This check, which is hardly robust, should support - disabling of variadic macros when compiling with @em gcc @em -ansi - enabling them when compiling with a C99 compliant compiler, such as @em gcc @em -std=c99 */ /*----------------------------------------------------------------------------*/ #ifndef CPL_HAVE_VA_ARGS # if !defined __STDC_VERSION__ && defined __STRICT_ANSI__ /* (llvm-)gcc -ansi and (llvm-)gcc -std=c89 do not define __STDC_VERSION__ but they do define __STRICT_ANSI__ */ # define CPL_HAVE_VA_ARGS 0 # else /* (llvm-)gcc with other language standards (incl. gnu89 (equivalent to no language specification), iso9899:199409, c99) reaches this point */ /* Sunstudio 12.1 c99 reaches this point since it defines __STDC_VERSION__ to 199901L as expected (it also defines __STRICT_ANSI__) */ # define CPL_HAVE_VA_ARGS 1 # endif #endif /*----------------------------------------------------------------------------*/ /** * @ingroup cpl_error @hideinitializer @brief Generic error handling macro @param CONDITION The condition to check @param CODE The CPL error code to set if @em CONDTION is non-zero @param ACTION A statement that is executed iff the @em CONDITION evaluates to non-zero. @param ... A printf-style message for cpl_error_set_message(). @see cpl_error_set_message() @note This macro should not be used directly. It is defined only to support user-defined error handling macros. If CODE equals CPL_ERROR_NONE, a CPL error with code CPL_ERROR_UNSPECIFIED is created. The message may be a printf-like format string supplied with arguments unless variadic macros are not supported in which case only a (non-format) string is accepted. The provided @em CODE, @em ACTION and @em __VA_ARGS__ are evaluated/executed only if the @em CONDITION evaluates to false (zero). The @em ACTION @em break is unsupported (it currently causes the execution to continue after @em cpl_error_ensure()). Some of the below examples use a @em goto statement to jump to a single cleanup label, assumed to be located immediately before the function's unified cleanup-code and return point. This error-handling scheme is reminiscent of using exceptions in languages that support exceptions (C++, Java, ...). The use of @em goto and a single clean-up label per function "if the error-handling code is non- trivial, and if errors can occur in several places" is sanctioned by Kernigan & Richie: "The C Programming Language". For any other purpose @em goto should be avoided. Useful definitions might include @code #define assure(BOOL, CODE) \ cpl_error_ensure(BOOL, CODE, goto cleanup, " ") #define check(CMD) \ cpl_error_ensure((CMD, cpl_error_get_code() == CPL_ERROR_NONE), \ cpl_error_get_code(), goto cleanup, " ") #define assert(BOOL) \ cpl_error_ensure(BOOL, CPL_ERROR_UNSPECIFIED, goto cleanup, \ "Internal error, please report to " PACKAGE_BUGREPORT) @endcode or (same as above, but including printf-style error messages) @code #define assure(BOOL, CODE, ...) \ cpl_error_ensure(BOOL, CODE, goto cleanup, __VA_ARGS__) #define check(CMD, ...) \ cpl_error_ensure((CMD, cpl_error_get_code() == CPL_ERROR_NONE), \ cpl_error_get_code(), goto cleanup, __VA_ARGS__) #define assert(BOOL, ...) \ cpl_error_ensure(BOOL, CPL_ERROR_UNSPECIFIED, goto cleanup, \ "Internal error, please report to " PACKAGE_BUGREPORT \ " " __VA_ARGS__) / * Assumes that PACKAGE_BUGREPORT contains no formatting special characters * / @endcode or @code #define skip_if(BOOL) \ cpl_error_ensure(BOOL, cpl_error_get_code() != CPL_ERROR_NONE ? \ cpl_error_get_code() : CPL_ERROR_UNSPECIFIED, \ goto cleanup, " ") @endcode The check macros in the examples above can be used to check a command which sets the cpl_error_code in case of failure (or, by use of a comma expression, a longer sequence of such commands): @code check( (x = cpl_table_get_int(table, "x", 0, NULL), y = cpl_table_get_int(table, "y", 0, NULL), z = cpl_table_get_int(table, "z", 0, NULL)), "Error reading wavelength catalogue"); @endcode */ /*----------------------------------------------------------------------------*/ #if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS == 1 || defined DOXYGEN_SKIP #define cpl_error_ensure(CONDITION, CODE, ACTION, ...) \ do if (CPL_UNLIKELY(!(CONDITION))) { \ /* Evaluate exactly once using a name-space protected variable name */ \ const cpl_error_code cpl_ensure_error = (CODE); \ (void)cpl_error_set_message_macro(cpl_func, cpl_ensure_error \ ? cpl_ensure_error : \ CPL_ERROR_UNSPECIFIED, \ __FILE__, __LINE__, __VA_ARGS__); \ ACTION; \ } while (0) #else #define cpl_error_ensure(CONDITION, CODE, ACTION, MSG) \ do if (CPL_UNLIKELY(!(CONDITION))) { \ /* Evaluate exactly once using a name-space protected variable name */ \ const cpl_error_code cpl_ensure_error = (CODE); \ (void)cpl_error_set_message_one_macro(cpl_func, cpl_ensure_error \ ? cpl_ensure_error : \ CPL_ERROR_UNSPECIFIED, \ __FILE__, __LINE__, MSG); \ ACTION; \ } while (0) #endif /*----------------------------------------------------------------------------*/ /** @ingroup cpl_error @hideinitializer @brief Set an error code and return iff a boolean expression is false @param BOOL The boolean to evaluate @param ERRCODE The error code to set @param RETURN The value to return @note This macro will cause a return from its calling function. If ERRCODE equals CPL_ERROR_NONE, the error-code is set to CPL_ERROR_UNSPECIFIED. The boolean is always evaluated (unlike assert()). This macro may not be used in inline'd functions. @see cpl_error_set() */ /*----------------------------------------------------------------------------*/ #define cpl_ensure(BOOL, ERRCODE, RETURN) \ cpl_error_ensure(BOOL, ERRCODE, return(RETURN), " ") /*----------------------------------------------------------------------------*/ /** @ingroup cpl_error @hideinitializer @brief Set an error code and return it iff a boolean expression is false @param BOOL The boolean to evaluate @param ERRCODE The error code to set and return @see cpl_ensure() */ /*----------------------------------------------------------------------------*/ #define cpl_ensure_code(BOOL, ERRCODE) \ cpl_error_ensure(BOOL, ERRCODE, return(cpl_error_get_code()), " ") /** * @ingroup cpl_error * @hideinitializer * @brief * Set CPL error code, function name, source file and line number where * an error occurred. * * @param function Character string with function name, cpl_func * @param code Error code * * @return The specified error code. * @note If code is CPL_ERROR_NONE, nothing is done (and code is returned), * if code is CPL_ERROR_HISTORY_LOST (but avoid that) then * CPL_ERROR_UNSPECIFIED is set and returned. * * @hideinitializer */ #define cpl_error_set(function, code) \ cpl_error_set_message_macro(function, code, __FILE__, __LINE__, " ") /** * @ingroup cpl_error * @hideinitializer * @brief Propagate a CPL-error to the current location. * * @param function Character string with function name, cpl_func * * @return The preexisting CPL error code (possibly CPL_ERROR_NONE). * @see cpl_error_set() * @note If no error exists, nothing is done and CPL_ERROR_NONE is returned * * If a CPL error already exists, this function creates a new CPL error * with the preexisting CPL error code and the current location. * * In a function of type cpl_error_code an error can be propagated with: * @code * * return cpl_error_set_where(cpl_func); * * @endcode * * @hideinitializer */ #define cpl_error_set_where(function) \ cpl_error_set_message_macro(function, cpl_error_get_code(), \ __FILE__, __LINE__, " ") /** * @ingroup cpl_error * @hideinitializer * @brief * Set CPL error code, function name, source file and line number where * an error occurred along with a text message * * @param function Character string with function name, cpl_func * @param code Error code * @param ... Variable argument list with message * @return The CPL error code * @see cpl_error_set() * @note The message is ignored if it is NULL, empty, or consists of a single * ' ' (space). Otherwise, the user supplied message is appended to * the default message using ': ' (colon+space) as delimiter. * If the CPL-based application may use variadic macros, the message * may be a printf-style format string supplied with matching arguments. * If variadic macros are not allowed (e.g. when compiling with gcc -ansi) * only a non-format string is accepted. Please be aware that the format * string should always be a string literal, otherwise the code may be * vulnerable to the socalled 'format string exploit'. Sufficiently recent * versions of gcc supports the option -Wformat-security, which tries to * warn of this issue. If variadic macros are not supported, a * printf-style message can be created prior to the call to * cpl_error_set_message(), as in the below example. * * Examples of usage: * @code * * if (image == NULL) { * return cpl_error_set_message(cpl_func, CPL_ERROR_NULL_INPUT, * "Image number %d is NULL", number); * } * * @endcode * * @code * * if (error_string != NULL) { * return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, * "%s", error_string); * } * * @endcode * * Example of usage if and only if variadic macros are unavaiable (e.g. when * compiling with gcc -ansi): * @code * * if (image == NULL) { * char * my_txt = cpl_sprintf("Image number %d is NULL", number); * const cpl_error_code my_code = * cpl_error_set_message(cpl_func, CPL_ERROR_NULL_INPUT, my_txt); * cpl_free(my_txt); * return my_code; * } * * @endcode * * @hideinitializer */ #if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS == 1 || defined DOXYGEN_SKIP #define cpl_error_set_message(function, code, ...) \ cpl_error_set_message_macro(function, code, __FILE__, __LINE__, __VA_ARGS__) #else #define cpl_error_set_message(function, code, text) \ cpl_error_set_message_one_macro(function, code, __FILE__, __LINE__, text) #endif /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ /** * @ingroup cpl_error * @brief * Available error codes. @c CPL_ERROR_NONE is equal to zero and compares to less than all other error codes. All error codes are guaranteed to be less than @c CPL_ERROR_EOL (End Of List). @c CPL_ERROR_EOL allows user defined error codes to be added in this fashion: @code const int my_first_error_code = 0 + CPL_ERROR_EOL; const int my_second_error_code = 1 + CPL_ERROR_EOL; const int my_third_error_code = 2 + CPL_ERROR_EOL; if (is_connected() == CPL_FALSE) { return cpl_error_set_message(cpl_func, my_first_error_code, "No " "connection to host %s (after %u tries)", hostname, max_attempts); } @endcode Extensive use of user defined error codes should be avoided. Instead a request of new CPL error codes should be emailed to cpl-help@eso.org. */ enum _cpl_error_code_ { CPL_ERROR_NONE = 0, /**< No error condition */ CPL_ERROR_UNSPECIFIED = 1, /**< An unspecified error. FIXME: Do not set to 1 and verify correctness */ CPL_ERROR_HISTORY_LOST, /**< The actual CPL error has been lost. Do not use to create a CPL error */ CPL_ERROR_DUPLICATING_STREAM, /**< Could not duplicate output stream */ CPL_ERROR_ASSIGNING_STREAM, /**< Could not associate a stream with a file descriptor */ CPL_ERROR_FILE_IO, /**< Permission denied */ CPL_ERROR_BAD_FILE_FORMAT, /**< Input file had not the expected format */ CPL_ERROR_FILE_ALREADY_OPEN, /**< Attempted to open a file twice */ CPL_ERROR_FILE_NOT_CREATED, /**< Could not create a file */ CPL_ERROR_FILE_NOT_FOUND, /**< A specified file or directory was not found */ CPL_ERROR_DATA_NOT_FOUND, /**< Data searched within a valid object were not found */ CPL_ERROR_ACCESS_OUT_OF_RANGE, /**< Data were accessed beyond boundaries */ CPL_ERROR_NULL_INPUT, /**< A @c NULL pointer was found where a valid pointer was expected */ CPL_ERROR_INCOMPATIBLE_INPUT, /**< Data that had to be processed together did not match */ CPL_ERROR_ILLEGAL_INPUT, /**< Illegal values were detected */ CPL_ERROR_ILLEGAL_OUTPUT, /**< A given operation would have generated an illegal object */ CPL_ERROR_UNSUPPORTED_MODE, /**< The requested functionality is not supported */ CPL_ERROR_SINGULAR_MATRIX, /**< Could not invert a matrix */ CPL_ERROR_DIVISION_BY_ZERO, /**< Attempted to divide a number by zero */ CPL_ERROR_TYPE_MISMATCH, /**< Data were not of the expected type */ CPL_ERROR_INVALID_TYPE, /**< Data type was unsupported or invalid */ CPL_ERROR_CONTINUE, /**< An iterative process did not converge */ CPL_ERROR_NO_WCS, /**< The WCS functionalities are missing */ CPL_ERROR_EOL /**< To permit extensibility of error handling. It is a coding error to use this within CPL itself! */ }; /** * @ingroup cpl_error * @brief * The cpl_error_code type definition */ typedef enum _cpl_error_code_ cpl_error_code; typedef struct _cpl_error_ cpl_error; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ void cpl_error_reset(void); cpl_error_code cpl_error_set_message_macro(const char *, cpl_error_code, const char *, unsigned, const char *, ...) CPL_ATTR_PRINTF(5,6) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(3))) #endif ; cpl_error_code cpl_error_set_message_one_macro(const char *, cpl_error_code, const char *, unsigned, const char *) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(3))) #endif ; cpl_error_code cpl_error_get_code(void) CPL_ATTR_PURE; const char *cpl_error_get_message(void) CPL_ATTR_PURE; const char *cpl_error_get_message_default(cpl_error_code) CPL_ATTR_CONST; const char *cpl_error_get_function(void) CPL_ATTR_PURE; const char *cpl_error_get_file(void) CPL_ATTR_PURE; unsigned cpl_error_get_line(void) CPL_ATTR_PURE; const char *cpl_error_get_where(void) CPL_ATTR_PURE; CPL_END_DECLS #endif /* end of cpl_error.h */ cpl-6.4.1/cplcore/cpl_type.h0000644000460300003120000001435412272176370012647 00000000000000/* $Id: cpl_type.h,v 1.29 2012-05-09 09:59:26 llundin Exp $ * * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-05-09 09:59:26 $ * $Revision: 1.29 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_TYPE_H #define CPL_TYPE_H #include #include CPL_BEGIN_DECLS /**@{*/ /** * @ingroup cpl_type * * @brief * The CPL type codes and flags. */ enum _cpl_type_ { /* flags */ /** * Flag indicating whether a type is an array or a basic type. * @hideinitializer */ CPL_TYPE_FLAG_ARRAY = 1 << 0, /* Padded for future extensions */ /* types */ /** * Invalid or undetermined type. * @hideinitializer */ CPL_TYPE_INVALID = 1 << 4, /** * Type code corresponding to type @c char. * @hideinitializer */ CPL_TYPE_CHAR = 1 << 5, /** * Type code corresponding to type @c unsigned char. * @hideinitializer */ CPL_TYPE_UCHAR = 1 << 6, /** * Type code corresponding to the boolean type. * @hideinitializer */ CPL_TYPE_BOOL = 1 << 7, /** * Type code corresponding to type @c short. * @hideinitializer */ CPL_TYPE_SHORT = 1 << 8, /** * Type code corresponding to type @c unsigned short. * @hideinitializer */ CPL_TYPE_USHORT = 1 << 9, /** * Type code corresponding to type @c int. * @hideinitializer */ CPL_TYPE_INT = 1 << 10, /** * Type code corresponding to type @c unsigned int. * @hideinitializer */ CPL_TYPE_UINT = 1 << 11, /** * Type code corresponding to type @c long. * @hideinitializer */ CPL_TYPE_LONG = 1 << 12, /** * Type code corresponding to type @c unsigned long. * @hideinitializer */ CPL_TYPE_ULONG = 1 << 13, /** * Type code corresponding to type @c long @c long. * @hideinitializer */ CPL_TYPE_LONG_LONG = 1 << 14, /** * Type code corresponding to type @c cpl_size * @hideinitializer */ CPL_TYPE_SIZE = 1 << 15, /** * Type code corresponding to type @c float. * @hideinitializer */ CPL_TYPE_FLOAT = 1 << 16, /** * Type code corresponding to type @c double. * @hideinitializer */ CPL_TYPE_DOUBLE = 1 << 17, /** * Type code corresponding to a pointer type. * @hideinitializer */ CPL_TYPE_POINTER = 1 << 18, /** * Type code corresponding to a complex type. * @hideinitializer */ CPL_TYPE_COMPLEX = 1 << 19, /** * Type code to be used for inheritance of original FITS type. * @hideinitializer */ CPL_TYPE_UNSPECIFIED = 1 << 20, /** * Type code corresponding to type @c cpl_bitmask * @hideinitializer */ CPL_TYPE_BITMASK = 1 << 21, /** * Type code corresponding to a character array. * @hideinitializer */ CPL_TYPE_STRING = (CPL_TYPE_CHAR | CPL_TYPE_FLAG_ARRAY), /** * Type code corresponding to type @c float complex. * @hideinitializer */ CPL_TYPE_FLOAT_COMPLEX = (CPL_TYPE_FLOAT | CPL_TYPE_COMPLEX), /** * Type code corresponding to type @c double complex. * @hideinitializer */ CPL_TYPE_DOUBLE_COMPLEX = (CPL_TYPE_DOUBLE | CPL_TYPE_COMPLEX) }; /** * @ingroup cpl_type * * @brief * The type code type. */ typedef enum _cpl_type_ cpl_type; enum _cpl_boolean_ { CPL_FALSE = 0, CPL_TRUE = !CPL_FALSE }; typedef enum _cpl_boolean_ cpl_boolean; /** * @ingroup cpl_type * * @brief The type used for sizes and indices in CPL */ #if defined CPL_SIZE_BITS && CPL_SIZE_BITS == 32 typedef int cpl_size; /* The type as is was up to CPL 5.3 */ #else typedef long long cpl_size; #endif #include /*----------------------------------------------------------------------------*/ /** * * @brief The CPL bitmask type for bitmask operations * @note The CPL bitmask is currently used only for bit-wise operations on CPL * images of integer pixel type, which are 32-bits wide. * For forward compatibility the CPL bitmask is 64 bits wide, which is cast to * 32 bits when used with a CPL_TYPE_INT. */ /*----------------------------------------------------------------------------*/ typedef uint64_t cpl_bitmask; /** * @def CPL_SIZE_MIN * * @hideinitializer * @ingroup cpl_type * * @brief * Minimum value a variable of type @em cpl_size can hold. */ /** * @def CPL_SIZE_MAX * * @hideinitializer * @ingroup cpl_type * * @brief * Maximum value a variable of type @em cpl_size can hold. */ #if defined CPL_SIZE_BITS && CPL_SIZE_BITS == 32 #define CPL_SIZE_MIN (CX_MININT) #define CPL_SIZE_MAX (CX_MAXINT) #else #define CPL_SIZE_MIN (LLONG_MIN) #define CPL_SIZE_MAX (LLONG_MAX) #endif /** * @hideinitializer * @ingroup cpl_type * * @brief The format specifier for the type cpl_size * @note It is "ld" when cpl_size is a @c long int and "d" when it is an @c int * @see cpl_size * * It can be used like this: * @code * cpl_size i = my_index(); * * return cpl_sprintf("The index is %" CPL_SIZE_FORMAT "\n", i); * * @endcode */ #if defined CPL_SIZE_BITS && CPL_SIZE_BITS == 32 #define CPL_SIZE_FORMAT "d" #else #define CPL_SIZE_FORMAT "lld" #endif /**@}*/ size_t cpl_type_get_sizeof(cpl_type type) CPL_ATTR_CONST; const char * cpl_type_get_name(cpl_type type); CPL_END_DECLS #endif /* CPL_TYPE_H */ cpl-6.4.1/cplcore/cpl_bivector.h0000644000460300003120000000645311532741420013474 00000000000000/* $Id: cpl_bivector.h,v 1.15 2011-02-28 15:45:20 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-02-28 15:45:20 $ * $Revision: 1.15 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_BIVECTOR_H #define CPL_BIVECTOR_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include "cpl_vector.h" #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ typedef struct _cpl_bivector_ cpl_bivector; typedef enum { CPL_SORT_BY_X, CPL_SORT_BY_Y } cpl_sort_mode; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* Constructors and destructors */ cpl_bivector * cpl_bivector_new(cpl_size) CPL_ATTR_ALLOC; cpl_bivector * cpl_bivector_wrap_vectors(cpl_vector *, cpl_vector *) CPL_ATTR_ALLOC; cpl_bivector * cpl_bivector_duplicate(const cpl_bivector *) CPL_ATTR_ALLOC; void cpl_bivector_delete(cpl_bivector *); void cpl_bivector_unwrap_vectors(cpl_bivector *); void cpl_bivector_dump(const cpl_bivector *, FILE *); cpl_bivector * cpl_bivector_read(const char *) CPL_ATTR_ALLOC; cpl_error_code cpl_bivector_copy(cpl_bivector *, const cpl_bivector *); /* Accessors functions */ cpl_size cpl_bivector_get_size(const cpl_bivector *); cpl_vector * cpl_bivector_get_x(cpl_bivector *); cpl_vector * cpl_bivector_get_y(cpl_bivector *); const cpl_vector * cpl_bivector_get_x_const(const cpl_bivector *); const cpl_vector * cpl_bivector_get_y_const(const cpl_bivector *); double * cpl_bivector_get_x_data(cpl_bivector *); double * cpl_bivector_get_y_data(cpl_bivector *); const double * cpl_bivector_get_x_data_const(const cpl_bivector *); const double * cpl_bivector_get_y_data_const(const cpl_bivector *); /* Basic functionalities */ cpl_error_code cpl_bivector_interpolate_linear(cpl_bivector *, const cpl_bivector *); cpl_error_code cpl_bivector_sort(cpl_bivector *, const cpl_bivector *, cpl_sort_direction, cpl_sort_mode); CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_fits.h0000644000460300003120000000573011753202340012617 00000000000000/* $Id: cpl_fits.h,v 1.9 2012-05-11 12:24:00 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-05-11 12:24:00 $ * $Revision: 1.9 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_FITS_H #define CPL_FITS_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ /** * @ingroup cpl_fits * * @brief The values of the CPL fits mode. * The values can be combined with bitwise or. */ enum _cpl_fits_mode_ { /* No mode has the value 1, which makes the (mis)use of logical or detectable */ /** * Stop the caching of open FITS files * @hideinitializer */ CPL_FITS_STOP_CACHING = 1 << 1, /** * Start the caching of open FITS files * @hideinitializer */ CPL_FITS_START_CACHING = 1 << 2, /** * Restart the caching of open FITS files * @hideinitializer */ CPL_FITS_RESTART_CACHING = CPL_FITS_STOP_CACHING | CPL_FITS_START_CACHING, /** * Apply the mode change only to the current thread * @hideinitializer */ CPL_FITS_ONE = 1 << 3 }; /** * @ingroup cpl_fits * * @brief * The CPL fits mode. It is a bit field. */ typedef enum _cpl_fits_mode_ cpl_fits_mode; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_size cpl_fits_count_extensions(const char *); cpl_size cpl_fits_find_extension(const char *, const char *); cpl_error_code cpl_fits_set_mode(cpl_fits_mode); cpl_fits_mode cpl_fits_get_mode(void); int cpl_fits_get_nb_extensions(const char *) CPL_ATTR_DEPRECATED; int cpl_fits_get_extension_nb(const char *, const char *) CPL_ATTR_DEPRECATED; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_image_iqe.h0000644000460300003120000000325611611513204013570 00000000000000/* $Id: cpl_image_iqe.h,v 1.6 2011-07-20 08:49:08 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-20 08:49:08 $ * $Revision: 1.6 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGE_IQE_H #define CPL_IMAGE_IQE_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image.h" #include "cpl_bivector.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_bivector * cpl_image_iqe(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_image_filter.h0000644000460300003120000000452611466733006014314 00000000000000/* $Id: cpl_image_filter.h,v 1.25 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.25 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGE_FILTER_H #define CPL_IMAGE_FILTER_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image.h" #include "cpl_matrix.h" #include "cpl_filter.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_error_code cpl_image_filter_mask(cpl_image *, const cpl_image *, const cpl_mask *, cpl_filter_mode, cpl_border_mode); cpl_error_code cpl_image_filter(cpl_image *, const cpl_image *, const cpl_matrix *, cpl_filter_mode, cpl_border_mode); cpl_image * cpl_image_filter_linear(const cpl_image *, const cpl_matrix *) CPL_ATTR_DEPRECATED; cpl_image * cpl_image_filter_morpho(const cpl_image *, const cpl_matrix *) CPL_ATTR_DEPRECATED; cpl_image * cpl_image_filter_median(const cpl_image *, const cpl_matrix *) CPL_ATTR_DEPRECATED; cpl_image * cpl_image_filter_stdev(const cpl_image *, const cpl_matrix *) CPL_ATTR_DEPRECATED; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_tools.h0000644000460300003120000003315012242411611013004 00000000000000/* $Id: cpl_tools.h,v 1.111 2012-02-27 16:12:47 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-02-27 16:12:47 $ * $Revision: 1.111 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_TOOLS_H #define CPL_TOOLS_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_cfitsio.h" #include #include #include #include #include #include #include "cpl_propertylist.h" #include "cpl_error.h" #include "cpl_errorstate.h" #include "cpl_vector.h" #include "cpl_msg.h" #include "cpl_test.h" #include "cpl_type.h" #include "cpl_type_impl.h" /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ /** @ingroup cpl_tools @internal @brief Generate and return a pseudo-random double in the range 0 to 1. @return A pseudo-random number in the range 0 to 1 @see rand() */ #define cpl_drand() ((double)rand()/(double)RAND_MAX) #define CPL_FITS_BADKEYS "SIMPLE|BSCALE|BZERO|EXTEND" \ "|XTENSION|BITPIX|NAXIS[0-9]*|PCOUNT|GCOUNT|DATE" "" \ "|TFIELDS|TFORM[0-9]*|TTYPE[0-9]*|TUNIT[0-9]*|TZERO[0-9]*" \ "|TSCAL[0-9]*|TDIM[0-9]*|TNULL[0-9]*" #define CPL_FITS_BADKEYS_PRIM "^(" CPL_FITS_BADKEYS \ "|BLOCKED" ")$" #define CPL_FITS_BADKEYS_EXT "^(" CPL_FITS_BADKEYS \ "|ORIGIN[0-9]*)$" #define CPL_FITS_COMPRKEYS "^(" "ZIMAGE|ZCMPTYPE|ZNAXIS" \ "|ZTENSION|ZPCOUNT|ZGCOUNT|ZNAME[0-9]|ZVAL[0-9]|" \ "ZTILE[0-9]|ZBITPIX|ZNAXIS[0-9]|ZSCALE|ZZERO|ZBLANK" ")$" /* CFITSIO support for I/O of largest possible buffers. */ /* FIXME: Add CPL_FITSIO_FORMAT w. "ld" for long int, but need a format string for LONGLONG */ #if defined fits_get_img_sizell && defined fits_read_pixll && defined fits_create_imgll #define CPL_FITSIO_GET_SIZE fits_get_img_sizell #define CPL_FITSIO_READ_PIX cpl_fits_read_pixll #define CPL_FITSIO_READ_PIX_E fits_read_pixll #define CPL_FITSIO_RESIZE_IMG fits_resize_imgll #define CPL_FITSIO_CREATE_IMG cpl_fits_create_imgll #define CPL_FITSIO_CREATE_IMG_E fits_create_imgll #define CPL_FITSIO_WRITE_PIX cpl_fits_write_pixll #define CPL_FITSIO_WRITE_PIX_E fits_write_pixll #define CPL_FITSIO_TYPE LONGLONG #else #define CPL_FITSIO_GET_SIZE fits_get_img_size #define CPL_FITSIO_READ_PIX cpl_fits_read_pix #define CPL_FITSIO_READ_PIX_E fits_read_pix #define CPL_FITSIO_RESIZE_IMG fits_resize_img #define CPL_FITSIO_CREATE_IMG cpl_fits_create_img #define CPL_FITSIO_CREATE_IMG_E fits_create_img #define CPL_FITSIO_WRITE_PIX cpl_fits_write_pix #define CPL_FITSIO_WRITE_PIX_E fits_write_pix #define CPL_FITSIO_TYPE long int #endif /*----------------------------------------------------------------------------*/ /** @internal @brief Create a tracing message @param LEVEL The CPL messaging level to use, CPL_MSG_ERROR, CPL_MSG_WARNING, CPL_MSG_INFO, CPL_MSG_DEBUG. Nothing happens for other values. @return void @note This macro will also fflush() both stdout and stderr which can be useful in tracing a process that terminates unexpectedly. */ /*----------------------------------------------------------------------------*/ #define cpl_tools_trace(LEVEL) \ do { \ const cpl_msg_severity cpl_tools_trace_level = LEVEL; \ if (cpl_tools_trace_level == CPL_MSG_ERROR || \ cpl_tools_trace_level == CPL_MSG_WARNING || \ cpl_tools_trace_level == CPL_MSG_INFO || \ cpl_tools_trace_level == CPL_MSG_DEBUG) { \ (cpl_tools_trace_level == CPL_MSG_ERROR ? cpl_msg_error : \ (cpl_tools_trace_level == CPL_MSG_WARNING ? cpl_msg_warning : \ (cpl_tools_trace_level == CPL_MSG_INFO ? cpl_msg_info : \ cpl_msg_debug))) (cpl_func, "TRACE: " __FILE__ \ " at line " CPL_STRINGIFY(__LINE__)); \ (void)fflush(stdout); \ (void)fflush(stderr); \ } \ } while (0) #if defined HAVE_LONG_DOUBLE && HAVE_LONG_DOUBLE == 1 typedef long double cpl_long_double; #define CPL_LDBL_EPSILON LDBL_EPSILON #define CPL_LDBL_EPSILON_STR "LDBL_EPSILON" #else typedef double cpl_long_double; #define CPL_LDBL_EPSILON DBL_EPSILON #define CPL_LDBL_EPSILON_STR "DBL_EPSILON" #endif /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* Operations on arrays */ double cpl_tools_get_kth_double(double *, cpl_size, cpl_size) CPL_ATTR_NONNULL; float cpl_tools_get_kth_float(float *, cpl_size, cpl_size) CPL_ATTR_NONNULL; int cpl_tools_get_kth_int(int *, cpl_size, cpl_size) CPL_ATTR_NONNULL; long cpl_tools_get_kth_long(long *, cpl_size, cpl_size) CPL_ATTR_NONNULL; long long cpl_tools_get_kth_long_long(long long *, cpl_size, cpl_size) CPL_ATTR_NONNULL; cpl_size cpl_tools_get_kth_cplsize(cpl_size *, cpl_size, cpl_size) CPL_ATTR_NONNULL; double cpl_tools_quickselection_double(double *, cpl_size, cpl_size) CPL_ATTR_NONNULL; float cpl_tools_quickselection_float(float *, cpl_size, cpl_size) CPL_ATTR_NONNULL; int cpl_tools_quickselection_int(int *, cpl_size, cpl_size) CPL_ATTR_NONNULL; long cpl_tools_quickselection_long(long *, cpl_size, cpl_size) CPL_ATTR_NONNULL; long long cpl_tools_quickselection_long_long(long long *, cpl_size, cpl_size) CPL_ATTR_NONNULL; cpl_size cpl_tools_quickselection_cplsize(cpl_size *, cpl_size, cpl_size) CPL_ATTR_NONNULL; double cpl_tools_get_mean_double(const double *, cpl_size); double cpl_tools_get_mean_float(const float *, cpl_size); double cpl_tools_get_mean_int(const int *, cpl_size); double cpl_tools_get_mean_long(const long *, cpl_size); double cpl_tools_get_mean_long_long(const long long *, cpl_size); double cpl_tools_get_mean_cplsize(const cpl_size *, cpl_size); double cpl_tools_get_variancesum_double(const double *, cpl_size, double *); double cpl_tools_get_variancesum_float(const float *, cpl_size, double *); double cpl_tools_get_variancesum_int(const int *, cpl_size, double *); double cpl_tools_get_variancesum_long(const long *, cpl_size, double *); double cpl_tools_get_variancesum_long_long(const long long *, cpl_size, double *); double cpl_tools_get_variancesum_cplsize(const cpl_size *, cpl_size, double *); double cpl_tools_get_variance_double(const double *, cpl_size, double *) CPL_ATTR_NONNULL; double cpl_tools_get_variance_float(const float *, cpl_size, double *) CPL_ATTR_NONNULL; double cpl_tools_get_variance_int(const int *, cpl_size, double *) CPL_ATTR_NONNULL; double cpl_tools_get_variance_long(const long *, cpl_size, double *) CPL_ATTR_NONNULL; double cpl_tools_get_variance_long_long(const long long *, cpl_size, double *) CPL_ATTR_NONNULL; double cpl_tools_get_variance_cplsize(const cpl_size *, cpl_size, double *) CPL_ATTR_NONNULL; double cpl_tools_get_median_double(double *, cpl_size) CPL_ATTR_NONNULL; float cpl_tools_get_median_float(float *, cpl_size) CPL_ATTR_NONNULL; int cpl_tools_get_median_int(int *, cpl_size) CPL_ATTR_NONNULL; long cpl_tools_get_median_long(long *, cpl_size) CPL_ATTR_NONNULL; long long cpl_tools_get_median_long_long(long long *, cpl_size) CPL_ATTR_NONNULL; cpl_size cpl_tools_get_median_cplsize(cpl_size *, cpl_size) CPL_ATTR_NONNULL; cpl_error_code cpl_tools_copy_window(void *, const void *, size_t, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_NONNULL; cpl_error_code cpl_tools_shift_window(void *, size_t, cpl_size, cpl_size, int, cpl_size, cpl_size) CPL_ATTR_NONNULL; /* Sorting */ cpl_error_code cpl_tools_sort_stable_pattern_cplsize(cpl_size const *, cpl_size, int, int, cpl_size *); cpl_error_code cpl_tools_sort_stable_pattern_int(int const *, cpl_size, int, int, cpl_size *); cpl_error_code cpl_tools_sort_stable_pattern_long(long const *, cpl_size, int, int, cpl_size *); cpl_error_code cpl_tools_sort_stable_pattern_long_long(long long const *, cpl_size, int, int, cpl_size *); cpl_error_code cpl_tools_sort_stable_pattern_float(float const *, cpl_size, int, int, cpl_size *); cpl_error_code cpl_tools_sort_stable_pattern_double(double const *, cpl_size, int, int, cpl_size *); cpl_error_code cpl_tools_sort_stable_pattern_string(char * const *, cpl_size, int, int, cpl_size *); cpl_error_code cpl_tools_permute_cplsize(cpl_size *, cpl_size, cpl_size *, cpl_size const *, cpl_size *, cpl_size const *); cpl_error_code cpl_tools_permute_int(cpl_size *, cpl_size, int *, int const *, int *, int const *); cpl_error_code cpl_tools_permute_long(cpl_size *, cpl_size, long *, long const *, long *, long const *); cpl_error_code cpl_tools_permute_long_long(cpl_size *, cpl_size, long long *, long long const *, long long *, long long const *); cpl_error_code cpl_tools_permute_float(cpl_size *, cpl_size, float *, float const *, float *, float const *); cpl_error_code cpl_tools_permute_double(cpl_size *, cpl_size, double *, double const *, double *, double const *); cpl_error_code cpl_tools_permute_string(cpl_size *, cpl_size, char **, char * const *, char **, char * const *); cpl_error_code cpl_tools_sort_double(double *, cpl_size) CPL_ATTR_NONNULL; cpl_error_code cpl_tools_sort_float(float *, cpl_size) CPL_ATTR_NONNULL; cpl_error_code cpl_tools_sort_int(int *, cpl_size) CPL_ATTR_NONNULL; cpl_error_code cpl_tools_sort_long(long *, cpl_size) CPL_ATTR_NONNULL; cpl_error_code cpl_tools_sort_long_long(long long *, cpl_size) CPL_ATTR_NONNULL; cpl_error_code cpl_tools_sort_cplsize(cpl_size *, cpl_size) CPL_ATTR_NONNULL; void cpl_tools_sort_ascn_double(double *, int) CPL_ATTR_NONNULL; void cpl_tools_sort_ascn_float(float *, int) CPL_ATTR_NONNULL; void cpl_tools_sort_ascn_int(int *, int) CPL_ATTR_NONNULL; void cpl_tools_sort_ascn_long(long *, int) CPL_ATTR_NONNULL; void cpl_tools_sort_ascn_long_long(long long *, int) CPL_ATTR_NONNULL; void cpl_tools_sort_ascn_cplsize(cpl_size *, int) CPL_ATTR_NONNULL; void cpl_tools_sort_desc_double(double *, int) CPL_ATTR_NONNULL; void cpl_tools_sort_desc_float(float *, int) CPL_ATTR_NONNULL; void cpl_tools_sort_desc_int(int *, int) CPL_ATTR_NONNULL; void cpl_tools_sort_desc_long(long *, int) CPL_ATTR_NONNULL; void cpl_tools_sort_desc_long_long(long long *, int) CPL_ATTR_NONNULL; void cpl_tools_sort_desc_cplsize(cpl_size *, int) CPL_ATTR_NONNULL; cpl_vector * cpl_vector_transform_mean(const cpl_vector *, double *) CPL_ATTR_NONNULL; void cpl_tools_add_flops(cpl_flops); cpl_flops cpl_tools_get_flops(void) CPL_ATTR_PURE; /* Others */ cpl_size cpl_tools_is_power_of_2(cpl_size) CPL_ATTR_CONST; double cpl_tools_ipow(double, int) CPL_ATTR_CONST; double * cpl_tools_fill_kernel_profile(cpl_kernel, int *); cpl_error_code cpl_fits_add_properties(fitsfile *, const cpl_propertylist *, const char *); int cpl_tools_get_bpp(cpl_type); cpl_error_code cpl_vector_count_distinct(cpl_vector *, cpl_size *); cpl_error_code cpl_vector_ensure_distinct(const cpl_vector *, cpl_size); #endif cpl-6.4.1/cplcore/cpl_tools_body.h0000644000460300003120000011757212151065765014052 00000000000000/* $Id: cpl_tools_body.h,v 1.33 2013-05-28 08:33:57 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-05-28 08:33:57 $ * $Revision: 1.33 $ * $Name: not supported by cvs2svn $ */ #undef ADDTYPE #define ADDTYPE(a) CONCAT2X(a, CPL_TYPE_NAME) #ifdef CPL_TYPE_IS_NUM static int ADDTYPE(compar_ascn)(const void *, const void *) CPL_ATTR_NONNULL; static int ADDTYPE(compar_desc)(const void *, const void *) CPL_ATTR_NONNULL; static void ADDTYPE(cpl_tools_get_median_3)(CPL_TYPE *) CPL_ATTR_NONNULL; static void ADDTYPE(cpl_tools_get_median_5)(CPL_TYPE *) CPL_ATTR_NONNULL; static void ADDTYPE(cpl_tools_get_median_6)(CPL_TYPE *) CPL_ATTR_NONNULL; static void ADDTYPE(cpl_tools_get_median_7)(CPL_TYPE *) CPL_ATTR_NONNULL; static void ADDTYPE(cpl_tools_get_median_9)(CPL_TYPE *) CPL_ATTR_NONNULL; static void ADDTYPE(cpl_tools_get_median_25)(CPL_TYPE *) CPL_ATTR_NONNULL; static void ADDTYPE(cpl_tools_get_0th)(CPL_TYPE *, size_t) CPL_ATTR_NONNULL; /* Swap macro */ #define CPL_TYPE_SWAP(a, b) { register const CPL_TYPE t=(a); (a)=(b); (b)=t; } /* Guarded swap macro */ #define CPL_TYPE_SORT(a, b) { if ((a) > (b)) CPL_TYPE_SWAP((a), (b)); } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the smallest value in a numerical array @param self The array to permute and request from @param n The number of elements in the array, must be at least 1 @return void @see cpl_tools_get_kth @note Since the function is static its error checking is disabled @note cpl_tools_get_0th(self, n) is the same as (void)cpl_tools_get_kth(self, n, 0) */ /*----------------------------------------------------------------------------*/ static void ADDTYPE(cpl_tools_get_0th)(CPL_TYPE * self, size_t n) { CPL_TYPE min = self[0]; size_t amin = 0; size_t i; for (i = 1; i < n; i++) { if (self[i] < min) { amin = i; min = self[i]; } } CPL_TYPE_SWAP(self[0], self[amin]); } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the median of a numerical array @param self The array to permute and request from @param n the number of elements @return The median @note Since the function is not exported its error checking is disabled For a finite population or sample, the median is the middle value of an odd number of values (arranged in ascending order) or any value between the two middle values of an even number of values. For an even number of elements in the array, the mean of the two central values is returned. Note that in this case, the median might not be a value of the input array. Also, note that in the case of integer data types, the division by 2 is performed with integer arithmetic. Consider casting your integer array to float if that is not the desired behavior. The function is optimized for 3, 5, 6, 7, 9 and 25 elements. After a successful call, self is permuted so elements less than the median have lower indices, while elements greater than the median have higher indices. Example: the median of (1 2 3) is 2 and the median of (1. 2. 3. 4.) is 2.5. The median of the integers (1 2 3 4) is 2 (due to the integer arithmetic). */ /*----------------------------------------------------------------------------*/ CPL_TYPE ADDTYPE(cpl_tools_get_median)(CPL_TYPE * self, cpl_size n) { switch (n) { case 3: ADDTYPE(cpl_tools_get_median_3)(self); break; case 5: ADDTYPE(cpl_tools_get_median_5)(self); break; case 6: ADDTYPE(cpl_tools_get_median_6)(self); break; case 7: ADDTYPE(cpl_tools_get_median_7)(self); break; case 9: ADDTYPE(cpl_tools_get_median_9)(self); break; case 25: ADDTYPE(cpl_tools_get_median_25)(self); break; default: if (n & 1) { /* Odd number */ (void)ADDTYPE(cpl_tools_quickselection)(self, n, (n-1)/2); } else { /* Even number */ (void)ADDTYPE(cpl_tools_quickselection)(self, n, n/2-1); ADDTYPE(cpl_tools_get_0th)(self + n / 2, n / 2); } } return (n & 1) ? self[(n-1)/2] /* Odd number */ : (self[n/2-1]+self[n/2])/((CPL_TYPE)2); /* Even number */ } /*----------------------------------------------------------------------------*/ /** @internal @brief Optimized median computation for 3 elements (via 3 guarded swaps) @param self Array to sort for median @return void @note Since the function is not exported its error checking is disabled @see cpl_tools_get_median_double() http://ndevilla.free.fr/median/median/ */ /*----------------------------------------------------------------------------*/ static void ADDTYPE(cpl_tools_get_median_3)(CPL_TYPE * self) { #ifdef CPL_TOOLS_STRICT_ERROR_CHECKING cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, (CPL_TYPE)0); #endif CPL_TYPE_SORT(self[0], self[1]); CPL_TYPE_SORT(self[1], self[2]); CPL_TYPE_SORT(self[0], self[1]); } /*----------------------------------------------------------------------------*/ /** @internal @brief Optimized median computation for 5 elements (via 7 guarded swaps) @param self Array to (partially) sort for median @return void @note Since the function is not exported its error checking is disabled @see cpl_tools_get_median_double() http://ndevilla.free.fr/median/median/ found on sci.image.processing cannot go faster unless assumptions are made */ /*----------------------------------------------------------------------------*/ static void ADDTYPE(cpl_tools_get_median_5)(CPL_TYPE * self) { #ifdef CPL_TOOLS_STRICT_ERROR_CHECKING cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, (CPL_TYPE)0); #endif CPL_TYPE_SORT(self[0],self[1]); CPL_TYPE_SORT(self[3],self[4]); CPL_TYPE_SORT(self[0],self[3]); CPL_TYPE_SORT(self[1],self[4]); CPL_TYPE_SORT(self[1],self[2]); CPL_TYPE_SORT(self[2],self[3]); CPL_TYPE_SORT(self[1],self[2]); } /*----------------------------------------------------------------------------*/ /** @internal @brief Optimized median computation for 6 elements (via 13 guarded swaps) @param self Array to (partially) sort for median @return void @note Since the function is not exported its error checking is disabled @see cpl_tools_get_median_double() http://ndevilla.free.fr/median/median/ from Christoph_John@gmx.de based on a selection network which was proposed in "FAST, EFFICIENT MEDIAN FILTERS WITH EVEN LENGTH WINDOWS" J.P. HAVLICEK, K.A. SAKADY, G.R.KATZ If you need larger even length kernels check the paper */ /*----------------------------------------------------------------------------*/ static void ADDTYPE(cpl_tools_get_median_6)(CPL_TYPE * self) { #ifdef CPL_TOOLS_STRICT_ERROR_CHECKING cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, (CPL_TYPE)0); #endif CPL_TYPE_SORT(self[1], self[2]); CPL_TYPE_SORT(self[3],self[4]); CPL_TYPE_SORT(self[0], self[1]); CPL_TYPE_SORT(self[2],self[3]); CPL_TYPE_SORT(self[4],self[5]); CPL_TYPE_SORT(self[1], self[2]); CPL_TYPE_SORT(self[3],self[4]); CPL_TYPE_SORT(self[0], self[1]); CPL_TYPE_SORT(self[2],self[3]); CPL_TYPE_SORT(self[4],self[5]); CPL_TYPE_SORT(self[1], self[2]); CPL_TYPE_SORT(self[3],self[4]); CPL_TYPE_SORT(self[2], self[3]); } /*----------------------------------------------------------------------------*/ /** @internal @brief Optimized median computation for 7 elements (via 13 guarded swaps) @param self Array to (partially) sort for median @return void @note Since the function is not exported its error checking is disabled @see cpl_tools_get_median_double() http://ndevilla.free.fr/median/median/ found on sci.image.processing cannot go faster unless assumptions are made */ /*----------------------------------------------------------------------------*/ static void ADDTYPE(cpl_tools_get_median_7)(CPL_TYPE * self) { #ifdef CPL_TOOLS_STRICT_ERROR_CHECKING cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, (CPL_TYPE)0); #endif CPL_TYPE_SORT(self[0], self[5]); CPL_TYPE_SORT(self[0], self[3]); CPL_TYPE_SORT(self[1], self[6]); CPL_TYPE_SORT(self[2], self[4]); CPL_TYPE_SORT(self[0], self[1]); CPL_TYPE_SORT(self[3], self[5]); CPL_TYPE_SORT(self[2], self[6]); CPL_TYPE_SORT(self[2], self[3]); CPL_TYPE_SORT(self[3], self[6]); CPL_TYPE_SORT(self[4], self[5]); CPL_TYPE_SORT(self[1], self[4]); CPL_TYPE_SORT(self[1], self[3]); CPL_TYPE_SORT(self[3], self[4]); } /*----------------------------------------------------------------------------*/ /** @internal @brief Optimized median computation for 9 elements (via 19 guarded swaps) @param self Array to partially sort for median @return void @note Since the function is not exported its error checking is disabled @see cpl_tools_get_median_double() Formula from: XILINX XCELL magazine, vol. 23 by John L. Smith */ /*----------------------------------------------------------------------------*/ static void ADDTYPE(cpl_tools_get_median_9)(CPL_TYPE * self) { #ifdef CPL_TOOLS_STRICT_ERROR_CHECKING cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, (CPL_TYPE)0); #endif CPL_TYPE_SORT(self[1], self[2]); CPL_TYPE_SORT(self[4], self[5]); CPL_TYPE_SORT(self[7], self[8]); CPL_TYPE_SORT(self[0], self[1]); CPL_TYPE_SORT(self[3], self[4]); CPL_TYPE_SORT(self[6], self[7]); CPL_TYPE_SORT(self[1], self[2]); CPL_TYPE_SORT(self[4], self[5]); CPL_TYPE_SORT(self[7], self[8]); CPL_TYPE_SORT(self[0], self[3]); CPL_TYPE_SORT(self[5], self[8]); CPL_TYPE_SORT(self[4], self[7]); CPL_TYPE_SORT(self[3], self[6]); CPL_TYPE_SORT(self[1], self[4]); CPL_TYPE_SORT(self[2], self[5]); CPL_TYPE_SORT(self[4], self[7]); CPL_TYPE_SORT(self[4], self[2]); CPL_TYPE_SORT(self[6], self[4]); CPL_TYPE_SORT(self[4], self[2]); } /*----------------------------------------------------------------------------*/ /** @internal @brief Optimized median computation for 25 elements (via 99 guarded swaps) @param self Array to (partially) sort for median @return void @note Since the function is not exported its error checking is disabled @see cpl_tools_get_median_double() http://ndevilla.free.fr/median/median/ In theory, cannot go faster without assumptions on the signal. Code taken from Graphic Gems. */ /*----------------------------------------------------------------------------*/ static void ADDTYPE(cpl_tools_get_median_25)(CPL_TYPE * self) { #ifdef CPL_TOOLS_STRICT_ERROR_CHECKING cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, (CPL_TYPE)0); #endif CPL_TYPE_SORT(self[0], self[1]); CPL_TYPE_SORT(self[3], self[4]); CPL_TYPE_SORT(self[2], self[4]); CPL_TYPE_SORT(self[2], self[3]); CPL_TYPE_SORT(self[6], self[7]); CPL_TYPE_SORT(self[5], self[7]); CPL_TYPE_SORT(self[5], self[6]); CPL_TYPE_SORT(self[9], self[10]); CPL_TYPE_SORT(self[8], self[10]); CPL_TYPE_SORT(self[8], self[9]); CPL_TYPE_SORT(self[12], self[13]); CPL_TYPE_SORT(self[11], self[13]); CPL_TYPE_SORT(self[11], self[12]); CPL_TYPE_SORT(self[15], self[16]); CPL_TYPE_SORT(self[14], self[16]); CPL_TYPE_SORT(self[14], self[15]); CPL_TYPE_SORT(self[18], self[19]); CPL_TYPE_SORT(self[17], self[19]); CPL_TYPE_SORT(self[17], self[18]); CPL_TYPE_SORT(self[21], self[22]); CPL_TYPE_SORT(self[20], self[22]); CPL_TYPE_SORT(self[20], self[21]); CPL_TYPE_SORT(self[23], self[24]); CPL_TYPE_SORT(self[2], self[5]); CPL_TYPE_SORT(self[3], self[6]); CPL_TYPE_SORT(self[0], self[6]); CPL_TYPE_SORT(self[0], self[3]); CPL_TYPE_SORT(self[4], self[7]); CPL_TYPE_SORT(self[1], self[7]); CPL_TYPE_SORT(self[1], self[4]); CPL_TYPE_SORT(self[11], self[14]); CPL_TYPE_SORT(self[8], self[14]); CPL_TYPE_SORT(self[8], self[11]); CPL_TYPE_SORT(self[12], self[15]); CPL_TYPE_SORT(self[9], self[15]); CPL_TYPE_SORT(self[9], self[12]); CPL_TYPE_SORT(self[13], self[16]); CPL_TYPE_SORT(self[10], self[16]); CPL_TYPE_SORT(self[10], self[13]); CPL_TYPE_SORT(self[20], self[23]); CPL_TYPE_SORT(self[17], self[23]); CPL_TYPE_SORT(self[17], self[20]); CPL_TYPE_SORT(self[21], self[24]); CPL_TYPE_SORT(self[18], self[24]); CPL_TYPE_SORT(self[18], self[21]); CPL_TYPE_SORT(self[19], self[22]); CPL_TYPE_SORT(self[8], self[17]); CPL_TYPE_SORT(self[9], self[18]); CPL_TYPE_SORT(self[0], self[18]); CPL_TYPE_SORT(self[0], self[9]); CPL_TYPE_SORT(self[10], self[19]); CPL_TYPE_SORT(self[1], self[19]); CPL_TYPE_SORT(self[1], self[10]); CPL_TYPE_SORT(self[11], self[20]); CPL_TYPE_SORT(self[2], self[20]); CPL_TYPE_SORT(self[2], self[11]); CPL_TYPE_SORT(self[12], self[21]); CPL_TYPE_SORT(self[3], self[21]); CPL_TYPE_SORT(self[3], self[12]); CPL_TYPE_SORT(self[13], self[22]); CPL_TYPE_SORT(self[4], self[22]); CPL_TYPE_SORT(self[4], self[13]); CPL_TYPE_SORT(self[14], self[23]); CPL_TYPE_SORT(self[5], self[23]); CPL_TYPE_SORT(self[5], self[14]); CPL_TYPE_SORT(self[15], self[24]); CPL_TYPE_SORT(self[6], self[24]); CPL_TYPE_SORT(self[6], self[15]); CPL_TYPE_SORT(self[7], self[16]); CPL_TYPE_SORT(self[7], self[19]); CPL_TYPE_SORT(self[13], self[21]); CPL_TYPE_SORT(self[15], self[23]); CPL_TYPE_SORT(self[7], self[13]); CPL_TYPE_SORT(self[7], self[15]); CPL_TYPE_SORT(self[1], self[9]); CPL_TYPE_SORT(self[3], self[11]); CPL_TYPE_SORT(self[5], self[17]); CPL_TYPE_SORT(self[11], self[17]); CPL_TYPE_SORT(self[9], self[17]); CPL_TYPE_SORT(self[4], self[10]); CPL_TYPE_SORT(self[6], self[12]); CPL_TYPE_SORT(self[7], self[14]); CPL_TYPE_SORT(self[4], self[6]); CPL_TYPE_SORT(self[4], self[7]); CPL_TYPE_SORT(self[12], self[14]); CPL_TYPE_SORT(self[10], self[14]); CPL_TYPE_SORT(self[6], self[7]); CPL_TYPE_SORT(self[10], self[12]); CPL_TYPE_SORT(self[6], self[10]); CPL_TYPE_SORT(self[6], self[17]); CPL_TYPE_SORT(self[12], self[17]); CPL_TYPE_SORT(self[7], self[17]); CPL_TYPE_SORT(self[7], self[10]); CPL_TYPE_SORT(self[12], self[18]); CPL_TYPE_SORT(self[7], self[12]); CPL_TYPE_SORT(self[10], self[18]); CPL_TYPE_SORT(self[12], self[20]); CPL_TYPE_SORT(self[10], self[20]); CPL_TYPE_SORT(self[10], self[12]); } /*----------------------------------------------------------------------------*/ /** @internal @brief Compute the arithmetic mean of an array @param a The array @param n The (positive) array size @return The mean, S(n) = (1/n) sum(a_i) (i=1 -> n), or 0 on NULL input Compute the arithmetic mean of a dataset using the recurrence relation mean_(n) = mean(n-1) + (v[n] - mean(n-1))/(n+1) - this has a measurable impact on the output of cpl_polynomial_fit_{1,2}d_create() */ /*----------------------------------------------------------------------------*/ double ADDTYPE(cpl_tools_get_mean)(const CPL_TYPE * a, cpl_size nn) { double mean = 0.0; const size_t n = (size_t)nn; size_t i; cpl_ensure(a != NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(nn > 0, CPL_ERROR_ILLEGAL_INPUT, 0.0); /* Ensure that the cast was OK */ cpl_ensure((cpl_size)n == nn, CPL_ERROR_UNSUPPORTED_MODE, 0.0); for (i = 0; i < n; i++) mean += ((double)a[i] - mean) / (double)(i + 1); cpl_tools_add_flops(3 * n); return mean; } /*----------------------------------------------------------------------------*/ /** @internal @brief Compute the summed sample variance of an array @param a The array @param n The (non-negative) array size @param pmean Iff non-NULL, *pmean is the mean (at no extra cost) @return The summed sample variance, S(n) = sum((a_i-mean)^2) (i=1 -> n) @note Even with rounding errors the returned result is always non-negative Math explanation for ticket DFS05126, written by Lander de Bilbao. $$\sigma2 = \frac{\sum_{i=1}^N (x_i - \overline{x})2}{N-1}$$ We concentrate on how to compute $$\sum_{i=1}^N (x_i - \overline{x})2$$ developed as follows $$\sum_{i=1}^N (x_i - \overline{x})2 = \sum_{i=1}^N x_i2 - 2 \, \overline{x} \, \sum_{i=1}^N x_i + N \, \overline{x}2$$ as $$ \overline{x} = \frac{\sum_{i=1}^N x_i}{N}$$ then we have $$\sum_{i=1}^N (x_i - \overline{x})2 = \sum_{i=1}^N x_i2 - N \, \overline{x}2$$ Now we look and see if it possible to, after doing this computation for N samples, add the contribution of a new sample We call the new sample $x_{n+1}$, and the mean taken into account this new sample, $\overline{x}_{n+1}$. For clarity, we rewrite the previous equation with $\overline{x}$ renamed as $\overline{x}_n$ $$\sum_{i=1}^N (x_i - \overline{x}_n)2 = \sum_{i=1}^N x_i2 - N \, \overline{x}_n2$$ We want to compute now $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2$$ Developed $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 = \sum_{i=1}^{N+1} x_i2 - (N+1) \, \overline{x}_{n+1}2$$ $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 = \sum_{i=1}^N x_i2 + x_{n+1}2 - (N+1) \, \overline{x}_{n+1}2$$ as $$\overline{x}_{n+1} = \frac{\sum_{i=1}^N x_i + x_{n+1}}{N+1} $$ $$\overline{x}_{n+1} = \frac{\overline{x}_n \, N + x_{n+1}}{N+1} $$ then we have $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 = \sum_{i=1}^N x_i2 + x_{n+1}2 - (N+1) \, ( \, \frac{\overline{x}_n \, N + x_{n+1}}{N+1} ) \, ^2$$ $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 = \sum_{i=1}^N x_i2 + x_{n+1}2 - \frac{( \, \overline{x}_n \, N + x_{n+1} ) \, ^2}{N+1}$$ $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 = \sum_{i=1}^N x_i2 + x_{n+1}2 - \frac{( \, N2 \, \overline{x}_n2 + 2 \, N \, \overline{x}_n \, x_{n+1} + x_{n+1}2 \, )}{N+1}$$ $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 = \sum_{i=1}^N x_i2 + x_{n+1}2 - \frac{N2}{N+1} \, \overline{x}_n2 - \frac{N}{N+1} \, 2 \, \overline{x}_n \, x_{n+1} - \frac1{N+1} \, x_{n+1}2$$ we add in both parts of the equation $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 + \frac1{N+1} \, \overline{x}_n2 = \sum_{i=1}^N x_i2 + x_{n+1}2 - \frac{N2}{N+1} \, \overline{x}_n2 - \frac{N}{N+1} \, 2 \, \overline{x}_n \, x_{n+1} - \frac1{N+1} \, x_{n+1}2 + \frac1{N+1} \, \overline{x}_n2$$ we can now group some terms $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 + \frac1{N+1} \, \overline{x}_n2 = \sum_{i=1}^N x_i2 - \frac{N2 - 1}{N+1} \, \overline{x}_n2 - \frac{N}{N+1} \, 2 \, \overline{x}_n \, x_{n+1} + \frac{N}{N+1} \, x_{n+1}2$$ $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 + \frac1{N+1} \, \overline{x}_n2 = \sum_{i=1}^N x_i2 - (N-1) \, \overline{x}_n2 - \frac{N}{N+1} \, 2 \, \overline{x}_n \, x_{n+1} + \frac{N}{N+1} \, x_{n+1}2$$ $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 + \frac1{N+1} \, \overline{x}_n2 = \sum_{i=1}^N x_i2 - N \, \overline{x}_n2 + \overline{x}_n2 - \frac{N}{N+1} \, 2 \, \overline{x}_n \, x_{n+1} + \frac{N}{N+1} \, x_{n+1}2$$ $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 = \sum_{i=1}^N x_i2 - N \, \overline{x}_n2 + \frac{N}{N+1} \, \overline{x}_n2 - \frac{N}{N+1} \, 2 \, \overline{x}_n \, x_{n+1} + \frac{N}{N+1} \, x_{n+1}2$$ $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 = \sum_{i=1}^N (x_i - \overline{x}_n)2 + \frac{N}{N+1} \,( \, \overline{x}_n2 - 2 \, \overline{x}_n \, x_{n+1} + x_{n+1}2 )$$ $$\sum_{i=1}^{N+1} (x_i - \overline{x}_{n+1})2 = \sum_{i=1}^N (x_i - \overline{x}_n)2 + \frac{N}{N+1} \,( \, \overline{x}_n - x_{n+1} )2 $$ */ /*----------------------------------------------------------------------------*/ double ADDTYPE(cpl_tools_get_variancesum)(const CPL_TYPE * a, cpl_size nn, double * pmean) { double varsum = 0.0; double mean = 0.0; const size_t n = (size_t)nn; size_t i; cpl_ensure(a != NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(nn >= 0, CPL_ERROR_ILLEGAL_INPUT, 0.0); /* Ensure that the cast was OK */ cpl_ensure((cpl_size)n == nn, CPL_ERROR_UNSUPPORTED_MODE, 0.0); for (i=0; i < n; i++) { const double delta = (double)a[i] - mean; varsum += (double)i * delta * delta / (double)(i + 1); mean += delta / (double)(i + 1); } cpl_tools_add_flops( 1 + 6 * n ); /* Assume expression reuse */ if (pmean != NULL) *pmean = mean; return varsum; } /*----------------------------------------------------------------------------*/ /** @internal @brief Compute the sample variance of an array @param a The array @param n The (positive) array size @param pmean Iff non-NULL, *pmean is the mean (at no extra cost) @return The sample variance, S(n) = (1/n) sum((a_i-mean)^2) (i=1 -> n) @see cpl_tools_get_variancesum_double() */ /*----------------------------------------------------------------------------*/ double ADDTYPE(cpl_tools_get_variance)(const CPL_TYPE * a, cpl_size n, double * pmean) { const double varsum = ADDTYPE(cpl_tools_get_variancesum)(a, n, pmean); cpl_ensure(n > 0, CPL_ERROR_ILLEGAL_INPUT, 0.0); return varsum / (double)n; } /*----------------------------------------------------------------------------*/ /** @internal @brief Compare two numerical values for qsort() @param p1 Pointer to the 1st value @param p2 Pointer to the 2nd value @return 1, 0, -1 depending on whether *p1 is smaller than, equal to or greater than *p2. @see qsort() @note Since the function is not exported its error checking is disabled */ /*----------------------------------------------------------------------------*/ static int ADDTYPE(compar_ascn)(const void * p1, const void * p2) { const CPL_TYPE a1 = *(const CPL_TYPE *)p1; const CPL_TYPE a2 = *(const CPL_TYPE *)p2; return a1 < a2 ? -1 : (a1 > a2 ? 1 : 0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Compare two numerical values for qsort() @param p1 Pointer to the 1st value @param p2 Pointer to the 2nd value @return -1, 0, 1 depending on whether *p1 is smaller than, equal to or greater than *p2. @see qsort() @note Since the function is not exported its error checking is disabled */ /*----------------------------------------------------------------------------*/ static int ADDTYPE(compar_desc)(const void * p1, const void * p2) { const CPL_TYPE a1 = *(const CPL_TYPE *)p1; const CPL_TYPE a2 = *(const CPL_TYPE *)p2; return a1 < a2 ? 1 : (a1 > a2 ? -1 : 0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the median of a numerical array @param self The array to permute and request from @param nn The number of elements in the array @param kk The requested value position in the sorted array, zero for 1st @return The median of the partially sorted array. @see cpl_tools_get_median_int @note Since the function is not exported its error checking is disabled @note Benchmarking up to 10M randomized elements on a Xeon E5345 show no significant advantage over cpl_tools_get_kth. However, for an almost sorted array, quick select can be a lot faster. This Quickselect routine is based on the algorithm described in "Numerical recipes in C", Second Edition, Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5 See also: http://ndevilla.free.fr/median/median/ */ /*----------------------------------------------------------------------------*/ CPL_TYPE ADDTYPE(cpl_tools_quickselection)(CPL_TYPE * self, cpl_size nn, cpl_size kk) { const size_t n = (size_t)nn; const size_t k = (size_t)kk; size_t low = 0; size_t high = n-1; #ifdef CPL_TOOLS_STRICT_ERROR_CHECKING cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, (CPL_TYPE)0); cpl_ensure(nn > 0, CPL_ERROR_ILLEGAL_INPUT, (CPL_TYPE)0); cpl_ensure(nn > kk -1, CPL_ERROR_ILLEGAL_INPUT, (CPL_TYPE)0); #endif /* Ensure that the cast was OK */ cpl_ensure((cpl_size)n == nn, CPL_ERROR_UNSUPPORTED_MODE, 0.0); cpl_ensure((cpl_size)k == kk, CPL_ERROR_UNSUPPORTED_MODE, 0.0); /* Control flow has been changed to a single return at the end */ for (;low + 1 < high;) { /* Find median of low, middle and high items; swap into position low */ const size_t middle = low + (high - low) / 2; size_t ll = low + 1; size_t hh = high; CPL_TYPE_SORT(self[middle], self[high]); CPL_TYPE_SORT(self[low], self[high]); CPL_TYPE_SORT(self[middle], self[low]); /* Swap low item (now in position middle) into position (low+1) */ CPL_TYPE_SWAP(self[middle], self[low+1]); /* Nibble from each end towards middle, swapping items when stuck */ for (;;) { do ll++; while (self[low] > self[ll]); do hh--; while (self[hh] > self[low]); if (hh < ll) break; CPL_TYPE_SWAP(self[ll], self[hh]); } /* Swap middle item (in position low) back into correct position */ CPL_TYPE_SWAP(self[low], self[hh]); /* Re-set active partition */ if (hh <= k) low = ll; if (hh >= k) high = hh - 1; } if (high == low + 1) { /* Two elements only */ CPL_TYPE_SORT(self[low], self[high]); } return self[k]; } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the kth smallest value in a numerical array @param self The array to permute and request from @param n The number of elements in the array @param k The requested value position in the sorted array, zero for 1st @return The kth smallest value in the partially sorted array. @note Since the function is not exported its error checking is disabled @see cpl_tools_get_median_int After a successful call, self is permuted so elements less than the kth have lower indices, while elements greater than the kth have higher indices. Reference: Author: Wirth, Niklaus Title: Algorithms + data structures = programs Publisher: Englewood Cliffs: Prentice-Hall, 1976 Physical description: 366 p. Series: Prentice-Hall Series in Automatic Computation See also: http://ndevilla.free.fr/median/median/ */ /*----------------------------------------------------------------------------*/ CPL_TYPE ADDTYPE(cpl_tools_get_kth)(CPL_TYPE * self, cpl_size n, cpl_size k) { register cpl_size l = 0; register cpl_size m = n - 1; register cpl_size i = l; register cpl_size j = m; #ifdef CPL_TOOLS_STRICT_ERROR_CHECKING cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, (CPL_TYPE)0); cpl_ensure(k >= 0, CPL_ERROR_ILLEGAL_INPUT, (CPL_TYPE)0); cpl_ensure(k < n, CPL_ERROR_ACCESS_OUT_OF_RANGE, (CPL_TYPE)0); #endif while (l < m) { register const CPL_TYPE x = self[k]; do { while (self[i] < x) i++; while (x < self[j]) j--; if (i <= j) { CPL_TYPE_SWAP(self[i], self[j]); i++; j--; } } while (i <= j); /* assert( j < i ); */ /* The original implementation has two index comparisons and two, three or four index assignments. This has been reduced to one or two index comparisons and two index assignments. */ if (k <= j) { /* assert( k < i ); */ m = j; i = l; } else { if (k < i) { m = j; } else { j = m; } l = i; } } return self[k]; } /*----------------------------------------------------------------------------*/ /** @internal @brief Sort a numerical array into ascending order using qsort @param self The array to sort @param n The number of array elements @return the #_cpl_error_code_ or CPL_ERROR_NONE @note Since the function is not exported its NULL-pointer checking is disabled Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT */ /*----------------------------------------------------------------------------*/ void ADDTYPE(cpl_tools_sort_ascn)(CPL_TYPE * self, int n) { qsort(self, n, sizeof(*self), ADDTYPE(compar_ascn)); } /*----------------------------------------------------------------------------*/ /** @internal @brief Sort a numerical array into ascending order using qsort @param self The array to sort @param n The number of array elements @return the #_cpl_error_code_ or CPL_ERROR_NONE @note Since the function is not exported its NULL-pointer checking is disabled Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT */ /*----------------------------------------------------------------------------*/ void ADDTYPE(cpl_tools_sort_desc)(CPL_TYPE * self, int n) { qsort(self, (size_t)n, sizeof(*self), ADDTYPE(compar_desc)); } /*----------------------------------------------------------------------------*/ /** @internal @brief Sort a numerical array @param self The array to sort @param n The number of array elements @return the #_cpl_error_code_ or CPL_ERROR_NONE @note Since the function is not exported its NULL-pointer checking is disabled On a nearly sorted array, this function is a LOT slower than qsort() - but on "normal" rancom data, it can be several times faster. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT */ /*----------------------------------------------------------------------------*/ cpl_error_code ADDTYPE(cpl_tools_sort)(CPL_TYPE * self, cpl_size nn) { const size_t n = (size_t)nn; size_t i, ir, j, k, l; size_t i_stack[CPL_PIX_STACK_SIZE]; size_t j_stack; CPL_TYPE a; /* Ensure that the cast was OK */ cpl_ensure_code((cpl_size)n == nn, CPL_ERROR_UNSUPPORTED_MODE); ir = n; l = 1; j_stack = 0; for (;;) { if (ir-l < 7) { for (j=l+1; j<=ir; j++) { a = self[j-1]; for (i=j-1; i>=1; i--) { if (self[i-1] <= a) break; self[i] = self[i-1]; } self[i] = a; } if (j_stack == 0) break; ir = i_stack[j_stack-- -1]; l = i_stack[j_stack-- -1]; } else { k = (l+ir) >> 1; CPL_TYPE_SWAP(self[k-1], self[l]); CPL_TYPE_SORT(self[l], self[ir-1]); CPL_TYPE_SORT(self[l-1], self[ir-1]); CPL_TYPE_SORT(self[l], self[l-1]); i = l+1; j = ir; a = self[l-1]; for (;;) { do i++; while (self[i-1] < a); do j--; while (self[j-1] > a); if (j < i) break; CPL_TYPE_SWAP(self[i-1], self[j-1]); } self[l-1] = self[j-1]; self[j-1] = a; j_stack += 2; cpl_ensure_code(j_stack <= CPL_PIX_STACK_SIZE, CPL_ERROR_ILLEGAL_INPUT); if (ir-i+1 >= j-l) { i_stack[j_stack-1] = ir; i_stack[j_stack-2] = i; ir = j-1; } else { i_stack[j_stack-1] = j-1; i_stack[j_stack-2] = l; l = i; } } } return CPL_ERROR_NONE; } #undef CPL_TYPE_SWAP #undef CPL_TYPE_SORT /* End of CPL_TYPE_IS_NUM */ #endif /*----------------------------------------------------------------------------*/ /** @internal @brief Sort a numerical array @param self The numerical array to sort @param n The number of array elemenst @param reverse flag indicating whether to sort ascending (zero) or descending (non-zero) @param stable flag to indicate whether to guarantee stability at the cost of execution time (if cpl_tools_sort_int is O(n log n), this function would still be O(n log n)) @param sort_pattern resulting sort pattern @return the #_cpl_error_code_ or CPL_ERROR_NONE The heap sort algorithm used here - has bad cache performance, but - is worst case O(n log n) - is stable (meaning that the order of equal elements is conserved indepent on the value of the reverse flag) - is in place Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT - CPL_ERROR_ILLEGAL_INPUT */ /*----------------------------------------------------------------------------*/ cpl_error_code ADDTYPE(cpl_tools_sort_stable_pattern)(CPL_TYPE const * self, cpl_size n, int reverse, int stable, cpl_size *sort_pattern) { cpl_size i; /* Check entries */ cpl_ensure_code(self, CPL_ERROR_NULL_INPUT); cpl_ensure_code(sort_pattern, CPL_ERROR_NULL_INPUT); if (n == 0) return CPL_ERROR_NONE; for (i = 0; i < n; i++) { sort_pattern[i] = i; } /* * Heap sort */ for (i = n / 2 - 1; i >= 0; i--) { int done = 0; cpl_size root = i; cpl_size bottom = n - 1; while ((root*2 + 1 <= bottom) && (!done)) { cpl_size child = root*2 + 1; if (child+1 <= bottom) { if ((!reverse && CPL_TOOLS_SORT_LT( self[sort_pattern[child]], self[sort_pattern[child + 1]])) || (reverse && CPL_TOOLS_SORT_LT( self[sort_pattern[child + 1]], self[sort_pattern[child]])) ) { child += 1; } } if ((!reverse && CPL_TOOLS_SORT_LT( self[sort_pattern[root]], self[sort_pattern[child]])) || (reverse && CPL_TOOLS_SORT_LT( self[sort_pattern[child]], self[sort_pattern[root]])) ) { CPL_INT_SWAP(sort_pattern[root], sort_pattern[child]); root = child; } else { done = 1; } } } for (i = n - 1; i >= 1; i--) { int done = 0; cpl_size root = 0; cpl_size bottom = i - 1; CPL_INT_SWAP(sort_pattern[0], sort_pattern[i]); while ((root*2 + 1 <= bottom) && (!done)) { cpl_size child = root*2 + 1; if (child+1 <= bottom) { if ((!reverse && CPL_TOOLS_SORT_LT( self[sort_pattern[child]], self[sort_pattern[child + 1]])) || (reverse && CPL_TOOLS_SORT_LT( self[sort_pattern[child + 1]], self[sort_pattern[child]])) ) { child += 1; } } if ((!reverse && CPL_TOOLS_SORT_LT( self[sort_pattern[root]], self[sort_pattern[child]])) || (reverse && CPL_TOOLS_SORT_LT( self[sort_pattern[child]], self[sort_pattern[root]])) ) { CPL_INT_SWAP(sort_pattern[root], sort_pattern[child]); root = child; } else { done = 1; } } } /* * Enforce stability */ if (stable) { for (i = 0; i < n; i++) { cpl_size j; j = i + 1; while(j < n && !CPL_TOOLS_SORT_LT(self[sort_pattern[i]], self[sort_pattern[j]]) && !CPL_TOOLS_SORT_LT(self[sort_pattern[j]], self[sort_pattern[i]])) { j++; } if (j - i > 1) { cpl_tools_sort_cplsize(sort_pattern + i, j - i); } i = j - 1; } } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Apply a permutation to one or two arrays @param self The permutation array, this is destroyed by the call @param n The (positive) number of elements to permute @param awrite The array to hold the permuted A-array @param aread The array to hold the input A-array, may equal awrite @param bwrite The array to hold the permuted B-array, or NULL @param bread The array to hold the input B-array, may equal awrite or NULL @return CPL_ERROR_NONE on success or the relevant #_cpl_error_code_ on error @note self is destroyed by the call. bread and bwrite must both be either NULL or non-NULL In-place permutation is done in O(n) time with O(1) extra storage using the fact that any permutation can be decomposed into a sequence of cyclic permutations. Uni-cycles are processed as well, to support in-place permuting of only one of the two arrays. This means that the below code also works for out-of-place permuting. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT self, aread or awrite is NULL - CPL_ERROR_ILLEGAL_INPUT size is not positive - CPL_ERROR_INCOMPATIBLE_INPUT only one of bread/bwrite is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code ADDTYPE(cpl_tools_permute)(cpl_size * self, cpl_size n, CPL_TYPE * awrite, CPL_TYPE const * aread, CPL_TYPE * bwrite, CPL_TYPE const * bread) { cpl_size ido = 0; /* First element in cycle to process */ const cpl_boolean dob = bwrite != NULL; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(n > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(awrite != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(aread != NULL, CPL_ERROR_NULL_INPUT); if (dob) { cpl_ensure_code(bread != NULL, CPL_ERROR_INCOMPATIBLE_INPUT); } else { cpl_ensure_code(bread == NULL, CPL_ERROR_INCOMPATIBLE_INPUT); } do { /* Save last pair in cycle */ CPL_TYPE const aread0 = aread[ido]; CPL_TYPE const bread0 = dob ? bread[ido] : 0; cpl_size ifrom = ido; while (self[ifrom] != ido) { /* Test here to avoid uni-cycles */ /* Copy the pair first to support cross-wrapped bivectors */ CPL_TYPE const areadj = aread[self[ifrom]]; CPL_TYPE const breadj = dob ? bread[self[ifrom]] : 0; const cpl_size j = ifrom; ifrom = self[ifrom]; /* Point to next in cycle */ assert( ifrom != -1 ); /* Can fail only on non-perm array */ awrite[j] = areadj; if (dob) bwrite[j] = breadj; self [j] = -1; /* This position now has the right value */ } /* Cycle is finished, copy and flag last pair */ awrite[ifrom] = aread0; if (dob) bwrite[ifrom] = bread0; self[ifrom] = -1; /* Find start of next cycle */ while (++ido < n && self[ido] < 0); } while (ido < n); return CPL_ERROR_NONE; } cpl-6.4.1/cplcore/cpl_stats.h0000644000460300003120000001174712005615436013022 00000000000000/* $Id: cpl_stats.h,v 1.17 2012-07-30 23:39:10 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-07-30 23:39:10 $ * $Revision: 1.17 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_STATS_H #define CPL_STATS_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_image.h" #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ /** * @ingroup cpl_stats * * @brief The values of the CPL stats mode. * The values can be combined with bitwise or. */ enum _cpl_stats_mode_ { /* No mode has the value 1, which makes the (mis)use of logical or detectable */ /** * The minimum * @hideinitializer */ CPL_STATS_MIN = 1 << 1, /** * The maximum * @hideinitializer */ CPL_STATS_MAX = 1 << 2, /** * The mean * @hideinitializer */ CPL_STATS_MEAN = 1 << 3, /** * The median * @hideinitializer */ CPL_STATS_MEDIAN = 1 << 4, /** * The standard deviation * @hideinitializer */ CPL_STATS_STDEV = 1 << 5, /** * The flux * @hideinitializer */ CPL_STATS_FLUX = 1 << 6, /** * The absolute flux * @hideinitializer */ CPL_STATS_ABSFLUX = 1 << 7, /** * The square flux * @hideinitializer */ CPL_STATS_SQFLUX = 1 << 8, /** * The position of the minimum * @hideinitializer */ CPL_STATS_MINPOS = 1 << 9, /** * The position of the maximum * @hideinitializer */ CPL_STATS_MAXPOS = 1 << 10, /** * The centroid position * @hideinitializer */ CPL_STATS_CENTROID = 1 << 11, /** * The mean of the absolute median deviation * @hideinitializer */ CPL_STATS_MEDIAN_DEV = 1 << 12, /** * The median of the absolute median deviation * @hideinitializer */ CPL_STATS_MAD = 1 << 13, /** * All of the above * @hideinitializer */ CPL_STATS_ALL = (1 << 14)-2 }; /** * @ingroup cpl_stats * * @brief * The CPL stats mode. It is a bit field. */ typedef enum _cpl_stats_mode_ cpl_stats_mode; /** * @ingroup cpl_stats * @brief The opaque CPL stats data type. */ typedef struct _cpl_stats_ cpl_stats; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* Accessor functions */ double cpl_stats_get_min(const cpl_stats *); double cpl_stats_get_max(const cpl_stats *); double cpl_stats_get_mean(const cpl_stats *); double cpl_stats_get_median(const cpl_stats *); double cpl_stats_get_median_dev(const cpl_stats *); double cpl_stats_get_mad(const cpl_stats *); double cpl_stats_get_stdev(const cpl_stats *); double cpl_stats_get_flux(const cpl_stats *); double cpl_stats_get_absflux(const cpl_stats *); double cpl_stats_get_sqflux(const cpl_stats *); double cpl_stats_get_centroid_x(const cpl_stats *); double cpl_stats_get_centroid_y(const cpl_stats *); cpl_size cpl_stats_get_min_x(const cpl_stats *); cpl_size cpl_stats_get_min_y(const cpl_stats *); cpl_size cpl_stats_get_max_x(const cpl_stats *); cpl_size cpl_stats_get_max_y(const cpl_stats *); cpl_size cpl_stats_get_npix(const cpl_stats *); void cpl_stats_delete(cpl_stats *); /* Statistics computations */ cpl_stats * cpl_stats_new_from_image(const cpl_image *, cpl_stats_mode) CPL_ATTR_ALLOC; cpl_stats * cpl_stats_new_from_image_window(const cpl_image *, cpl_stats_mode, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_error_code cpl_stats_dump(const cpl_stats *, cpl_stats_mode, FILE *); CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_image_bpm.h0000644000460300003120000000643512247045646013612 00000000000000/* $Id: cpl_image_bpm.h,v 1.20 2012-12-07 13:51:34 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-12-07 13:51:34 $ * $Revision: 1.20 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGE_BPM_H #define CPL_IMAGE_BPM_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image.h" #include "cpl_bivector.h" #include "cpl_mask.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ /** * @ingroup cpl_image * * @brief The special values that can be rejected * They are a bit-field and can be combined with bitwise or. */ enum _cpl_value_ { /* No entry has the value 1 which makes the (mis)use of logical or detectable */ /** * Not-a-Number (NaN) * @hideinitializer */ CPL_VALUE_NAN = 1 << 1, /** * Plus Infinity * @hideinitializer */ CPL_VALUE_PLUSINF = 1 << 2, /** * Minus Infinity * @hideinitializer */ CPL_VALUE_MINUSINF = 1 << 3, /** * Zero * @hideinitializer */ CPL_VALUE_ZERO = 1 << 4, /** * Infinity with any sign * @hideinitializer */ CPL_VALUE_INF = CPL_VALUE_PLUSINF | CPL_VALUE_MINUSINF, /** * NaN or infinity with any sign * @hideinitializer */ CPL_VALUE_NOTFINITE = CPL_VALUE_INF | CPL_VALUE_NAN }; /** * @ingroup cpl_image * * @brief * The CPL special value. It is a bit field. */ typedef enum _cpl_value_ cpl_value; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* Info on the bad pixels */ cpl_size cpl_image_count_rejected(const cpl_image *); int cpl_image_is_rejected(const cpl_image *, cpl_size, cpl_size); /* To modify an image's bad pixel map */ cpl_error_code cpl_image_reject(cpl_image *, cpl_size, cpl_size); cpl_error_code cpl_image_accept(cpl_image *, cpl_size, cpl_size); cpl_error_code cpl_image_accept_all(cpl_image *); cpl_error_code cpl_image_reject_from_mask(cpl_image *, const cpl_mask *); cpl_error_code cpl_image_reject_value(cpl_image *, cpl_value); CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_type_impl.h0000644000460300003120000000303411532727562013664 00000000000000/* $Id: cpl_type_impl.h,v 1.3 2011-02-28 14:21:38 cizzo Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: cizzo $ * $Date: 2011-02-28 14:21:38 $ * $Revision: 1.3 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_TYPE_IMPL_H #define CPL_TYPE_IMPL_H #include "cpl_type.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ /** * @ingroup cpl_type * @internal * @brief The type used for size and index of a CPL object * @note In a future release 64-bit architectures will define this type as * a 64-bit signed integer type */ #endif /* end of cpl_type_impl.h */ cpl-6.4.1/cplcore/cpl_msg.h0000644000460300003120000000765612101467627012462 00000000000000/* $Id: cpl_msg.h,v 1.18 2013-01-28 12:31:19 cgarcia Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: cgarcia $ * $Date: 2013-01-28 12:31:19 $ * $Revision: 1.18 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_MSG_H #define CPL_MSG_H #include #include #include CPL_BEGIN_DECLS /** * @ingroup cpl_messaging * @brief * Messaging verbosity * * Messages may be printed with any of the functions @c cpl_msg_debug(), * @c cpl_msg_info(), @c cpl_msg_warning() and @c cpl_msg_error(). Choosing * one of these functions means to assign a level of severity to a given * message. The messaging system can then be set to display just messages * having a high enough severity. The highest verbosity level of the * messaging system is @c CPL_MSG_DEBUG, that would ensure that @em all * the messages would be printed. The verbosity would progressively * decrease through the levels @c CPL_MSG_INFO, @c CPL_MSG_WARNING, and * @c CPL_MSG_ERROR, where only messages served by the @c cpl_msg_error() * function would be printed. The lowest verbosity level, @c CPL_MSG_OFF, * would inhibit the printing of any message to the terminal. */ #ifndef CPL_MAX_MSG_LENGTH #define CPL_MAX_MSG_LENGTH 1024 #endif #ifndef CPL_MAX_FUNCTION_NAME #define CPL_MAX_FUNCTION_NAME 50 #endif #ifndef CPL_MAX_DOMAIN_NAME #define CPL_MAX_DOMAIN_NAME 40 #endif #ifndef CPL_MAX_LOGFILE_NAME #define CPL_MAX_LOGFILE_NAME 72 #endif enum _cpl_msg_severity_ { CPL_MSG_DEBUG = 0, CPL_MSG_INFO, CPL_MSG_WARNING, CPL_MSG_ERROR, CPL_MSG_OFF }; typedef enum _cpl_msg_severity_ cpl_msg_severity; cpl_error_code cpl_msg_init(void); void cpl_msg_stop(void); cpl_error_code cpl_msg_set_log_level(cpl_msg_severity); cpl_error_code cpl_msg_stop_log(void); const char *cpl_msg_get_log_name(void); cpl_error_code cpl_msg_set_log_name(const char *); void cpl_msg_set_level(cpl_msg_severity); void cpl_msg_set_level_from_env(void); cpl_msg_severity cpl_msg_get_log_level(void); cpl_msg_severity cpl_msg_get_level(void); void cpl_msg_set_time_on(void); void cpl_msg_set_time_off(void); void cpl_msg_set_component_on(void); void cpl_msg_set_component_off(void); void cpl_msg_set_domain_on(void); void cpl_msg_set_domain_off(void); void cpl_msg_set_threadid_on(void); void cpl_msg_set_threadid_off(void); void cpl_msg_set_domain(const char *); const char *cpl_msg_get_domain(void); void cpl_msg_set_width(int); void cpl_msg_set_indentation(int); void cpl_msg_indent_more(void); void cpl_msg_indent_less(void); void cpl_msg_indent(int); void cpl_msg_error(const char *, const char *, ...) CPL_ATTR_PRINTF(2,3); void cpl_msg_warning(const char *, const char *, ...) CPL_ATTR_PRINTF(2,3); void cpl_msg_info(const char *, const char *, ...) CPL_ATTR_PRINTF(2,3); void cpl_msg_debug(const char *, const char *, ...) CPL_ATTR_PRINTF(2,3); void cpl_msg_info_overwritable(const char *, const char *, ...) CPL_ATTR_PRINTF(2,3); void cpl_msg_progress(const char *, int, int, const char *, ...) CPL_ATTR_DEPRECATED CPL_ATTR_PRINTF(4,5); CPL_END_DECLS #endif /* end of cpl_messages.h */ cpl-6.4.1/cplcore/cpl_imagelist_basic_body.h0000644000460300003120000004536212225254511016015 00000000000000/* $Id: cpl_imagelist_basic_body.h,v 1.43 2013-10-09 13:25:29 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Type dependent macros */ #if defined CPL_CLASS && CPL_CLASS == CPL_CLASS_DOUBLE #define CPL_TYPE double #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_IMAGE_GET_DATA cpl_image_get_data_double #define CPL_IMAGE_GET_DATA_CONST cpl_image_get_data_double_const #define CPL_IMAGE_WRAP cpl_image_wrap_double #define CPL_IMAGE_GET_MEDIAN cpl_tools_get_median_double #define CPL_TOOLS_GET_KTH cpl_tools_get_kth_double #elif defined CPL_CLASS && CPL_CLASS == CPL_CLASS_FLOAT #define CPL_TYPE float #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_IMAGE_GET_DATA cpl_image_get_data_float #define CPL_IMAGE_GET_DATA_CONST cpl_image_get_data_float_const #define CPL_IMAGE_WRAP cpl_image_wrap_float #define CPL_IMAGE_GET_MEDIAN cpl_tools_get_median_float #define CPL_TOOLS_GET_KTH cpl_tools_get_kth_float #elif defined CPL_CLASS && CPL_CLASS == CPL_CLASS_INT #define CPL_TYPE int #define CPL_TYPE_T CPL_TYPE_INT #define CPL_IMAGE_GET_DATA cpl_image_get_data_int #define CPL_IMAGE_GET_DATA_CONST cpl_image_get_data_int_const #define CPL_IMAGE_WRAP cpl_image_wrap_int #define CPL_IMAGE_GET_MEDIAN cpl_tools_get_median_int #define CPL_TOOLS_GET_KTH cpl_tools_get_kth_int #else #undef CPL_TYPE #undef CPL_TYPE_T #undef CPL_IMAGE_GET_DATA #undef CPL_IMAGE_GET_DATA_CONST #undef CPL_IMAGE_WRAP #undef CPL_IMAGE_GET_MEDIAN #undef CPL_TOOLS_GET_KTH #endif #if CPL_OPERATION == CPL_IMLIST_BASIC_OPER cpl_size i; /* Check input image sets */ cpl_ensure_code(in1, CPL_ERROR_NULL_INPUT); cpl_ensure_code(in2, CPL_ERROR_NULL_INPUT); /* Check image sets compatibility */ cpl_ensure_code( in1->ni == in2->ni, CPL_ERROR_ILLEGAL_INPUT); /* Loop on the planes and apply the operation */ for (i=0; ini; i++) { const cpl_error_code error = CPL_OPERATOR(in1->images[i], in2->images[i]); cpl_ensure_code(!error, error); } return CPL_ERROR_NONE; #elif CPL_OPERATION == CPL_IMLIST_BASIC_IMAGE_LOCAL cpl_size i; /* Check input image sets */ cpl_ensure_code(imlist, CPL_ERROR_NULL_INPUT); cpl_ensure_code(img, CPL_ERROR_NULL_INPUT); /* Loop on the planes and apply the operation */ for (i=0; ini; i++) { const cpl_error_code error = CPL_OPERATOR(imlist->images[i], img); cpl_ensure_code(!error, error); } return CPL_ERROR_NONE; #elif CPL_OPERATION == CPL_IMLIST_BASIC_TIME_MEDIAN #ifndef L2_CACHE_BYTES #ifdef CPL_CPU_CACHE #define L2_CACHE_BYTES CPL_CPU_CACHE #else /* The size in bytes of the cache level, with most importance (probably related to size times penalty for a miss) */ /* FIXME: Assume 256kB (L2) Cache. Many CPUs have more (e.g. 512kB), but the performance on those does not seem to suffer much */ #define L2_CACHE_BYTES 262144 #endif #endif case CPL_TYPE_T: { const size_t nz = self->ni; CPL_TYPE ** pi = cpl_malloc((size_t)nz * sizeof(CPL_TYPE*)); CPL_TYPE * po = (CPL_TYPE*)cpl_malloc(nx * ny * sizeof(*po)); CPL_TYPE * timeline = NULL; const cpl_binary ** pbpm = NULL; size_t i, j, k; /* Create the output image */ median = cpl_image_wrap(nx, ny, type, po); /* Find planes with a non-empty bad pixel map - if any */ for (k = 0; k < nz; k++) { const cpl_mask * bpm = cpl_image_get_bpm_const(self->images[k]); pi[k] = CPL_IMAGE_GET_DATA(self->images[k]); if (bpm != NULL && !cpl_mask_is_empty(bpm)) { /* Found one */ if (pbpm == NULL) { pbpm = cpl_calloc((size_t)nz, sizeof(*pbpm)); /* Assume that cpl_calloc() fills with NULL */ } pbpm[k] = cpl_mask_get_data_const(bpm); } } #if L2_CACHE_BYTES > 0 if (L2_CACHE_BYTES > 0 && sizeof(CPL_TYPE) * nz * (1 + nx * ny) > L2_CACHE_BYTES) { /* There is a cache available, and the entire imagelist does not fit inside it */ /* Heuristics: When there are just a few planes, remapping does not pay off. It seems that break-even is at nz = nx / 15. */ const size_t max_aspect = 15; /* The largest number of pixels that can be handled by the cache */ const size_t mxl2 = (L2_CACHE_BYTES - sizeof(CPL_TYPE *) * nz) / (sizeof(CPL_TYPE) * (1 + 2 * nz)); const size_t mxmax = mxl2 < nz * max_aspect ? mxl2 : nz * max_aspect; size_t mx = nx; size_t my = ny; while ((mx & 1) == 0 && mx > mxmax) { /* Make mx smaller, until it fits */ mx >>= 1; my <<= 1; } if (mx == nx ) { /* Did not yet change mx, try to make it larger while it fits */ while ((mx<<1) < mxmax && (my & 1) == 0) { mx <<=1; my >>=1; } } if (sizeof(CPL_TYPE *) * (size_t)nz + sizeof(CPL_TYPE) * (size_t)mx * (size_t)(1 + 2 * nz) > L2_CACHE_BYTES/2) { /* Heuristics: Too few planes may cause only a fraction of the cache to be usable, in this case fall back on the simple method. It seems that the break-even is about 50% cache usage */ size_t * ngood = cpl_calloc((size_t)mx, sizeof(*ngood)); timeline = cpl_malloc((size_t)mx * (size_t)nz * sizeof(CPL_TYPE)); /* For each time line */ for (j=0; j < my; j++) { /* Get the pixels on the current time line */ if (pbpm == NULL) { for (k=0; k < nz; k++) { for (i=0; i < mx; i++) { timeline[k + i * nz] = pi[k][i + j * mx]; } } for (i=0; i < mx; i++) { /* Compute the median */ po[i + j * mx] = CPL_IMAGE_GET_MEDIAN (timeline + i * nz, nz); } } else { for (k=0; k < nz; k++) { for (i=0; i < mx; i++) { if (pbpm[k] == NULL || !pbpm[k][i + j * mx]) { timeline[ngood[i]++ + i * nz] = pi[k][i + j * mx]; } } } for (i=0; i < mx; i++) { if (ngood[i] > 0) { /* Compute the median */ po[i + j * mx] = CPL_IMAGE_GET_MEDIAN (timeline + i * nz, ngood[i]); ngood[i] = 0; } else { po[i + j * mx] = (CPL_TYPE)0; cpl_image_reject(median, (i + j * mx) % nx + 1, (i + j * mx) / nx + 1); } } } } cpl_free(ngood); } } #endif if (timeline == NULL) { /* Remap one pixel at a time */ timeline = cpl_malloc((size_t)nz * sizeof(CPL_TYPE)); if (pbpm == NULL) { /* For each time line */ for (i=0; i < nx * ny; i++) { /* Get the pixels on the current time line */ for (k=0; k < nz; k++) timeline[k] = pi[k][i]; /* Compute the median */ po[i] = CPL_IMAGE_GET_MEDIAN(timeline, nz); } } else { /* For each time line */ for (i=0; i < nx * ny; i++) { /* Get the pixels on the current time line */ size_t igood = 0; for (k=0; k < nz; k++) { if (pbpm[k] == NULL || !pbpm[k][i]) { timeline[igood++] = pi[k][i]; } } if (igood > 0) { /* Compute the median */ po[i] = CPL_IMAGE_GET_MEDIAN(timeline, igood); } else { po[i] = (CPL_TYPE)0; cpl_image_reject(median, i%nx + 1, i/nx + 1); } } } } cpl_free(pi); cpl_free(timeline); cpl_free(pbpm); break; } #elif CPL_OPERATION == CPL_IMLIST_BASIC_TIME_MINMAX case CPL_TYPE_T: { /* Pointers to the ni pixel buffers */ const CPL_TYPE ** pin = cpl_malloc(ni * sizeof(CPL_TYPE *)); const cpl_binary ** pbpm = NULL; /* Output pixel buffer */ CPL_TYPE * pavg = cpl_malloc(nx * ny * sizeof(*pavg)); /* A single timeline */ CPL_TYPE * ptime = cpl_malloc(ni * sizeof(*ptime)); size_t i, k; avg = CPL_IMAGE_WRAP(nx, ny, pavg); /* Find planes with a non-empty bad pixel map - if any */ for (k = 0; k < ni; k++) { const cpl_mask * bpm = cpl_image_get_bpm_const(self->images[k]); pin[k] = CPL_IMAGE_GET_DATA_CONST(cpl_imagelist_get_const(self, k)); if (bpm != NULL && !cpl_mask_is_empty(bpm)) { /* Found one */ if (pbpm == NULL) { pbpm = cpl_calloc(ni, sizeof(*pbpm)); /* Assume that cpl_calloc() fills with NULL */ } pbpm[k] = cpl_mask_get_data_const(bpm); } } /* Loop on the pixels */ for (i = 0; i < nx * ny; i++) { size_t igood = 0; size_t ilow, ihigh; size_t ihbad; /* Fill the timeline */ for (k = 0; k < ni; k++) { if (pbpm == NULL || pbpm[k] == NULL || !pbpm[k][i]) { ptime[igood++] = pin[k][i]; } } ihbad = (ni - igood) / 2; ilow = (size_t)nlow > ihbad ? (size_t)nlow - ihbad : 0; ihigh = (size_t)nhigh > ihbad ? (size_t)nhigh - ihbad : 0; if (igood > ilow + ihigh) { double mean = 0.0; const size_t iuse = igood - ilow - ihigh; /* Place ilow and ihigh samples at the ends */ if (ilow > 0) (void)CPL_TOOLS_GET_KTH(ptime, igood, ilow-1); if (ihigh > 0) (void)CPL_TOOLS_GET_KTH(ptime + ilow, iuse + ihigh, iuse); /* Compute the average - using the recurrence relation from cpl_tools_get_mean_double() */ for (k = 0; k < iuse; k++) mean += ((double)ptime[ilow + k] - mean) / (double)(k + 1); pavg[i] = (CPL_TYPE)mean; cpl_tools_add_flops(3 * iuse); } else { pavg[i] = (CPL_TYPE)0; cpl_image_reject(avg, i%nx + 1, i/nx + 1); } } cpl_free(pin); cpl_free(ptime); cpl_free(pbpm); break; } #elif CPL_OPERATION == CPL_IMLIST_BASIC_TIME_SIGCLIP case CPL_TYPE_T: { /* Need at least two values for the standard deviation */ const cpl_size notok = CX_MAX(1, (cpl_size)(keepfrac * (double)ni)); /* The pixel buffer of the output image */ CPL_TYPE * pclipped = (CPL_TYPE*)cpl_malloc((size_t)nx * (size_t)ny * sizeof(*pclipped)); /* Temporary array for the non-clipped values */ double * pvals = (double*)cpl_malloc((size_t)ni * sizeof(double)); cpl_size i; clipped = cpl_image_wrap(nx, ny, CPL_TYPE_T, (void*)pclipped); /* Loop on the pixels */ for (i = 0; i < nx * ny; i++) { double mean = 0.0; /* Value to use when all pixels are bad */ cpl_size nok = 0; /* Number of values used in this timeline */ /* Need a 2nd counter, for convergence check and for contribution */ cpl_size prevok = ni + 1; /* No convergence before 1st iteration */ cpl_size k; /* Extract and count the non-bad values for this pixel */ for (k = 0; k < ni; k++) { const cpl_image * imgk = cpl_imagelist_get_const(self, k); const cpl_mask * bpm = cpl_image_get_bpm_const(imgk); const cpl_binary * bbpm = bpm ? cpl_mask_get_data_const(bpm) : NULL; if (bbpm == NULL || !bbpm[i]) { const CPL_TYPE * pimg = CPL_IMAGE_GET_DATA_CONST(imgk); pvals[nok++] = (double)pimg[i]; } } /* Will not actually enter when there are too many bad pixels */ while (notok < nok && nok < prevok) { /* cpl_tools_get_variancesum_double() is trusted to return a non-negative result even with rounding errors, so we assume it is safe to take the sqrt() below. Compute also the mean. Since it is computed prior to the clipping, it is the mean-value sought once the iteration has stopped. */ const double varsum = cpl_tools_get_variancesum_double (pvals, nok, &mean); /* When computed, the median permutes the (non-clipped) values, but this has no effect on the result. */ const double center = mode == CPL_COLLAPSE_MEAN || (mode == CPL_COLLAPSE_MEDIAN_MEAN && prevok < ni + 1) ? mean : cpl_tools_get_median_double(pvals, nok); /* Compute the clipping thresholds */ const double stdev = sqrt(varsum / (double) (nok-1)); const double low_thresh = center - kappalow * stdev; const double high_thresh = center + kappahigh * stdev; prevok = nok; /* Count the initial all-ok values */ for (nok = 0; nok < prevok; nok++) { /* Use exact same clipping criterion as next loop */ if (!(low_thresh < pvals[nok] && pvals[nok] < high_thresh)) { break; } } /* All values may have been checked above, but if not skip the one that cause the above loop to stop and check the rest and repack+count as necessary */ for (k = nok+1; k < prevok; k++) { if (low_thresh < pvals[k] && pvals[k] < high_thresh) { pvals[nok++] = pvals[k]; } } } if (prevok == ni+1) { /* The clipping loop was not entered at all */ prevok = nok; /* Needed for the contribution map */ /* The mean must be computed (without clipping) */ if (nok == 0) { /* All pixels are bad, so result pixel is bad */ /* The call for the 1st bad pixel will create the bpm */ cpl_mask * bpm = cpl_image_get_bpm(clipped); cpl_binary * bbpm = cpl_mask_get_data(bpm); bbpm[i] = CPL_BINARY_1; } else { mean = cpl_tools_get_mean_double(pvals, nok); } } /* Set the output image pixel value */ pclipped[i] = (CPL_TYPE)mean; if (pcontrib) { /* The contributing number of values */ pcontrib[i] = (int)prevok; if((cpl_size)pcontrib[i] != prevok) break; } cpl_tools_add_flops(6 + prevok); } cpl_free(pvals); if (i < nx * ny) { cpl_image_delete(clipped); clipped = NULL; (void)cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } break; } #elif CPL_OPERATION == CPL_IMLIST_BASIC_SWAP_AXIS case CPL_TYPE_T: { CPL_TYPE * pcur_ima; const CPL_TYPE * pold_ima; /* SWAP X <-> Z */ if (mode == CPL_SWAP_AXIS_XZ) { for (i=0; i Z */ for (i=0; i #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ /* Verify self-sufficiency of cpl_mask.h by including it first */ #include "cpl_mask_defs.h" #include "cpl_memory.h" #include "cpl_tools.h" #include "cpl_error_impl.h" #include "cpl_io_fits.h" #include "cpl_cfitsio.h" /* Verify self-sufficiency of CPL header files by including system files last */ #include #include #include #include #include #include #include #ifdef __SSE2__ #include #endif /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #if defined SIZEOF_SIZE_T && SIZEOF_SIZE_T == 4 /* Maximum half-size that fits in one word */ #define CPL_MASK_HXW 1 /* Maximum half-size that fits in two words */ #define CPL_MASK_HX2W 3 /* Word-size */ #define CPL_MASK_WORD 4 /* Maximum zero-padding */ #define CPL_MASK_PAD 3 /* Used for computing number of words to span 2hx + 1 */ #define CPL_MASK_DIV 2 /* Used to not a word and via multiplication for population count in one word */ #define CPL_MASK_NOT (((((((size_t)CPL_BINARY_1<<8) | (size_t)CPL_BINARY_1) <<8) | (size_t)CPL_BINARY_1)<<8) | (size_t)CPL_BINARY_1) #elif defined SIZEOF_SIZE_T && SIZEOF_SIZE_T == 8 #define CPL_MASK_HXW 3 #define CPL_MASK_HX2W 7 #define CPL_MASK_WORD 8 #define CPL_MASK_PAD 7 #define CPL_MASK_DIV 4 #define CPL_MASK_NOT (((((((((((((((size_t)CPL_BINARY_1<<8) | (size_t)CPL_BINARY_1) <<8) | (size_t)CPL_BINARY_1)<<8) | (size_t)CPL_BINARY_1 )<<8)|(size_t)CPL_BINARY_1)<<8) | (size_t)CPL_BINARY_1) <<8) | (size_t)CPL_BINARY_1)<<8) | (size_t)CPL_BINARY_1) #endif #define CPL_MASK_PAD2 ((CPL_MASK_PAD<<1)|1) #define CPL_MASK_WORD2 (CPL_MASK_WORD<<1) #define CPL_MASK_NOT8 (((((((((((((((cpl_bitmask)CPL_BINARY_1<<8) | (cpl_bitmask)CPL_BINARY_1) <<8) | (cpl_bitmask)CPL_BINARY_1)<<8) | (cpl_bitmask)CPL_BINARY_1 )<<8)|(cpl_bitmask)CPL_BINARY_1)<<8) | (cpl_bitmask)CPL_BINARY_1) <<8) | (cpl_bitmask)CPL_BINARY_1)<<8) | (cpl_bitmask)CPL_BINARY_1) #ifdef __SSE2__ #define CPL_MASK_REGISTER_SIZE 16 #define CPL_MASK_REGISTER_TYPE __m128i #else #define CPL_MASK_REGISTER_SIZE CPL_MASK_WORD #define CPL_MASK_REGISTER_TYPE size_t #endif #define CPL_MASK_PAD2WORD(I) \ ((CPL_MASK_WORD - ((I)&CPL_MASK_PAD)) & CPL_MASK_PAD) #define CPL_MASK_PAD2WORD2(I) \ ((CPL_MASK_WORD2 - ((I)&CPL_MASK_PAD2)) & CPL_MASK_PAD2) /* These macros are needed for support of the different pixel types */ #define CONCAT(a,b) a ## _ ## b #define CONCAT2X(a,b) CONCAT(a,b) /* Multiple concatenation should append the terms starting from the left, */ /* to avoid forming intermediate identifiers that are reserved (e.g. _0_1) */ #define APPENDSIZE(a, b, c) CONCAT2X(CONCAT2X(CONCAT2X(cpl_mask, a), b), c) #define APPENDOPER(a) CONCAT2X(CONCAT2X(cpl_mask, a), ) #define APPENDOPERS(a) CONCAT2X(CONCAT2X(cpl_mask, a), scalar) #define OPER2MM(a) CONCAT2X(CONCAT2X(_mm, a), si128) /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_mask Masks of pixels * * This module provides functions to handle masks of pixels * * These masks are useful for object detection routines or bad pixel map * handling. Morphological routines (erosion, dilation, closing and * opening) and logical operations are provided. A cpl_mask is a kind of * binary array whose elements are of type cpl_binary and can take only * two values: either CPL_BINARY_0 or CPL_BINARY_1. * * The element indexing follows the FITS convention in the sense that the * lower left element in a CPL mask has index (1, 1). * * @par Synopsis: * @code * #include "cpl_mask.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Private functions -----------------------------------------------------------------------------*/ static cpl_mask * cpl_mask_load_one(const char *, cpl_size, cpl_size, cpl_boolean, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; static cpl_mask * cpl_mask_load_(fitsfile*, int*, CPL_FITSIO_TYPE[], const char*, cpl_size, cpl_size, cpl_boolean, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; static void cpl_mask_erosion_(cpl_binary *, const cpl_binary *, const cpl_binary *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode) CPL_ATTR_NONNULL; static void cpl_mask_dilation_(cpl_binary *, const cpl_binary *, const cpl_binary *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode) CPL_ATTR_NONNULL; static void cpl_mask_opening_(cpl_binary *, const cpl_binary *, const cpl_binary *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode) CPL_ATTR_NONNULL; static void cpl_mask_closing_(cpl_binary *, const cpl_binary *, const cpl_binary *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode) CPL_ATTR_NONNULL; static cpl_mask * cpl_mask_new_from_matrix(const cpl_matrix *, double) CPL_ATTR_ALLOC; #define CPL_MASK_BINARY_WOPER and #define CPL_MASK_BINARY_OPER & #include "cpl_mask_binary.h" #undef CPL_MASK_BINARY_WOPER #undef CPL_MASK_BINARY_OPER #define CPL_MASK_BINARY_WOPER or #define CPL_MASK_BINARY_OPER | #include "cpl_mask_binary.h" #undef CPL_MASK_BINARY_WOPER #undef CPL_MASK_BINARY_OPER #define CPL_MASK_BINARY_WOPER xor #define CPL_MASK_BINARY_OPER ^ #include "cpl_mask_binary.h" #undef CPL_MASK_BINARY_WOPER #undef CPL_MASK_BINARY_OPER #ifdef CPL_MASK_NOT /* Support Erosion/Dilation: general case */ #define GENERAL_CASE #define OPERATION erosion #define OPERATE_WORD(A) ((A) ^ CPL_MASK_NOT) #define OPERATE_PIXEL(A) (!(A)) #define VALUE_TRUE CPL_BINARY_0 #define VALUE_FALSE CPL_BINARY_1 #define HX n #define HY n #define CPL_MASK_FILTER_WORD \ const cpl_binary * otheri = other + i; \ const size_t * kernelkw = (const size_t *)kernel; \ size_t k, l; \ \ for (k = 0; k < 1 + 2 * hy; k++, otheri += nx, \ kernelkw += mxew) { \ /* Points to first element to read */ \ const size_t * otheriw = (const size_t *)otheri; \ \ for (l = 0; l < (hx+CPL_MASK_DIV)/CPL_MASK_DIV; l++) { \ if (OPERATE_WORD(otheriw[l]) & kernelkw[l]) \ break; \ } \ if (l < (hx+CPL_MASK_DIV)/CPL_MASK_DIV) break; \ \ } \ self[i] = k < 1+ 2 * hy ? VALUE_TRUE : VALUE_FALSE #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE #define OPERATION dilation #define OPERATE_WORD(A) (A) #define OPERATE_PIXEL(A) (A) #define VALUE_TRUE CPL_BINARY_1 #define VALUE_FALSE CPL_BINARY_0 #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE #undef GENERAL_CASE /* Support Erosion/Dilation: hx within 1 word and hy == 0 */ #undef CPL_MASK_FILTER_WORD #undef HX #undef HY #define OPERATION erosion #define OPERATE_WORD(A) ((A) ^ CPL_MASK_NOT) #define OPERATE_PIXEL(A) (!(A)) #define VALUE_TRUE CPL_BINARY_0 #define VALUE_FALSE CPL_BINARY_1 #define HX 1 #define HY 0 #define CPL_MASK_FILTER_WORD \ self[i] = \ (OPERATE_WORD(*(const size_t*)(other + i )) & kernelw[0]) \ ? VALUE_TRUE : VALUE_FALSE #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE #define OPERATION dilation #define OPERATE_WORD(A) (A) #define OPERATE_PIXEL(A) (A) #define VALUE_TRUE CPL_BINARY_1 #define VALUE_FALSE CPL_BINARY_0 #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE /* Support Erosion/Dilation: hx within 1 word and hy == 1 */ #undef CPL_MASK_FILTER_WORD #undef HX #undef HY #define OPERATION erosion #define OPERATE_WORD(A) ((A) ^ CPL_MASK_NOT) #define OPERATE_PIXEL(A) (!(A)) #define VALUE_TRUE CPL_BINARY_0 #define VALUE_FALSE CPL_BINARY_1 #define HX 1 #define HY 1 #define CPL_MASK_FILTER_WORD \ self[i] = \ (OPERATE_WORD(*(const size_t*)(other + i )) & kernelw[0]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx )) & kernelw[1]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*2)) & kernelw[2]) \ ? VALUE_TRUE : VALUE_FALSE #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE #define OPERATION dilation #define OPERATE_WORD(A) (A) #define OPERATE_PIXEL(A) (A) #define VALUE_TRUE CPL_BINARY_1 #define VALUE_FALSE CPL_BINARY_0 #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE /* Support Erosion/Dilation: hx within 1 word and hy == 2 */ #undef CPL_MASK_FILTER_WORD #undef HX #undef HY #define OPERATION erosion #define OPERATE_WORD(A) ((A) ^ CPL_MASK_NOT) #define OPERATE_PIXEL(A) (!(A)) #define VALUE_TRUE CPL_BINARY_0 #define VALUE_FALSE CPL_BINARY_1 #define HX 1 #define HY 2 #define CPL_MASK_FILTER_WORD \ self[i] = \ (OPERATE_WORD(*(const size_t*)(other + i )) & kernelw[0]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx )) & kernelw[1]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*2)) & kernelw[2]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*3)) & kernelw[3]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*4)) & kernelw[4]) \ ? VALUE_TRUE : VALUE_FALSE #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE #define OPERATION dilation #define OPERATE_WORD(A) (A) #define OPERATE_PIXEL(A) (A) #define VALUE_TRUE CPL_BINARY_1 #define VALUE_FALSE CPL_BINARY_0 #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE /* Support Erosion/Dilation: hx within 1 word and hy == 3 */ #undef CPL_MASK_FILTER_WORD #undef HX #undef HY #define OPERATION erosion #define OPERATE_WORD(A) ((A) ^ CPL_MASK_NOT) #define OPERATE_PIXEL(A) (!(A)) #define VALUE_TRUE CPL_BINARY_0 #define VALUE_FALSE CPL_BINARY_1 #define HX 1 #define HY 3 #define CPL_MASK_FILTER_WORD \ self[i] = \ (OPERATE_WORD(*(const size_t*)(other + i )) & kernelw[0]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx )) & kernelw[1]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*2)) & kernelw[2]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*3)) & kernelw[3]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*4)) & kernelw[4]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*5)) & kernelw[5]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*6)) & kernelw[6]) \ ? VALUE_TRUE : VALUE_FALSE #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE #define OPERATION dilation #define OPERATE_WORD(A) (A) #define OPERATE_PIXEL(A) (A) #define VALUE_TRUE CPL_BINARY_1 #define VALUE_FALSE CPL_BINARY_0 #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE /* Support Erosion/Dilation: hx within 2 words and hy == 0 */ #undef CPL_MASK_FILTER_WORD #undef HX #undef HY #define OPERATION erosion #define OPERATE_WORD(A) ((A) ^ CPL_MASK_NOT) #define OPERATE_PIXEL(A) (!(A)) #define VALUE_TRUE CPL_BINARY_0 #define VALUE_FALSE CPL_BINARY_1 #define HX 2 #define HY 0 #define CPL_MASK_FILTER_WORD \ self[i] = \ (OPERATE_WORD(*(const size_t*)(other + i )) & kernelw[0]) || \ (OPERATE_WORD(*(const size_t*)(other + i + CPL_MASK_WORD)) \ & kernelw[1]) \ ? VALUE_TRUE : VALUE_FALSE #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE #define OPERATION dilation #define OPERATE_WORD(A) (A) #define OPERATE_PIXEL(A) (A) #define VALUE_TRUE CPL_BINARY_1 #define VALUE_FALSE CPL_BINARY_0 #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE /* Support Erosion/Dilation: hx within 2 words and hy == 1 */ #undef CPL_MASK_FILTER_WORD #undef HX #undef HY #define OPERATION erosion #define OPERATE_WORD(A) ((A) ^ CPL_MASK_NOT) #define OPERATE_PIXEL(A) (!(A)) #define VALUE_TRUE CPL_BINARY_0 #define VALUE_FALSE CPL_BINARY_1 #define HX 2 #define HY 1 #define CPL_MASK_FILTER_WORD \ self[i] = \ (OPERATE_WORD(*(const size_t*)(other + i )) & kernelw[0]) || \ (OPERATE_WORD(*(const size_t*)(other + i + CPL_MASK_WORD)) \ & kernelw[1]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx )) & kernelw[2]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx + CPL_MASK_WORD)) \ & kernelw[3]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*2)) & kernelw[4]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*2 + CPL_MASK_WORD)) \ & kernelw[5]) \ ? VALUE_TRUE : VALUE_FALSE #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE #define OPERATION dilation #define OPERATE_WORD(A) (A) #define OPERATE_PIXEL(A) (A) #define VALUE_TRUE CPL_BINARY_1 #define VALUE_FALSE CPL_BINARY_0 #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE /* Support Erosion/Dilation: hx within 2 words and hy == 2 */ #undef CPL_MASK_FILTER_WORD #undef HX #undef HY #define OPERATION erosion #define OPERATE_WORD(A) ((A) ^ CPL_MASK_NOT) #define OPERATE_PIXEL(A) (!(A)) #define VALUE_TRUE CPL_BINARY_0 #define VALUE_FALSE CPL_BINARY_1 #define HX 2 #define HY 2 #define CPL_MASK_FILTER_WORD \ self[i] = \ (OPERATE_WORD(*(const size_t*)(other + i )) & kernelw[0]) || \ (OPERATE_WORD(*(const size_t*)(other + i + CPL_MASK_WORD)) \ & kernelw[1]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx )) & kernelw[2]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx + CPL_MASK_WORD)) \ & kernelw[3]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*2)) & kernelw[4]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*2 + CPL_MASK_WORD)) \ & kernelw[5]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*3)) & kernelw[6]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*3 + CPL_MASK_WORD)) \ & kernelw[7]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*4)) & kernelw[8]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*4 + CPL_MASK_WORD)) \ & kernelw[9]) \ ? VALUE_TRUE : VALUE_FALSE #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE #define OPERATION dilation #define OPERATE_WORD(A) (A) #define OPERATE_PIXEL(A) (A) #define VALUE_TRUE CPL_BINARY_1 #define VALUE_FALSE CPL_BINARY_0 #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE /* Support Erosion/Dilation: hx within 2 words and hy == 3 */ /* On 32-bit this covers kernels up to 7x7, on 64-bit up to 15x7 */ #undef CPL_MASK_FILTER_WORD #undef HX #undef HY #define OPERATION erosion #define OPERATE_WORD(A) ((A) ^ CPL_MASK_NOT) #define OPERATE_PIXEL(A) (!(A)) #define VALUE_TRUE CPL_BINARY_0 #define VALUE_FALSE CPL_BINARY_1 #define HX 2 #define HY 3 #define CPL_MASK_FILTER_WORD \ self[i] = \ (OPERATE_WORD(*(const size_t*)(other + i )) & kernelw[0]) || \ (OPERATE_WORD(*(const size_t*)(other + i + CPL_MASK_WORD)) \ & kernelw[1]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx )) & kernelw[2]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx + CPL_MASK_WORD)) \ & kernelw[3]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*2)) & kernelw[4]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*2 + CPL_MASK_WORD)) \ & kernelw[5]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*3)) & kernelw[6]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*3 + CPL_MASK_WORD)) \ & kernelw[7]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*4)) & kernelw[8]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*4 + CPL_MASK_WORD)) \ & kernelw[9]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*5)) & kernelw[10]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*5 + CPL_MASK_WORD)) \ & kernelw[11]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*6)) & kernelw[12]) || \ (OPERATE_WORD(*(const size_t*)(other + i + nx*6 + CPL_MASK_WORD)) \ & kernelw[13]) \ ? VALUE_TRUE : VALUE_FALSE #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef VALUE_TRUE #undef VALUE_FALSE #define OPERATION dilation #define OPERATE_WORD(A) (A) #define OPERATE_PIXEL(A) (A) #define OPERATE_AND(A,B) ((A) & (B)) #define VALUE_TRUE CPL_BINARY_1 #define VALUE_FALSE CPL_BINARY_0 #include "cpl_mask_body.h" #undef OPERATION #undef OPERATE_WORD #undef OPERATE_PIXEL #undef OPERATE_AND #undef VALUE_TRUE #undef VALUE_FALSE #endif /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Create a new cpl_mask @param nx The number of elements in the X-direction @param ny The number of elements in the Y-direction @return 1 newly allocated cpl_mask or NULL on error @note The returned object must be deallocated using cpl_mask_delete(). The created cpl_mask elements are all set to CPL_BINARY_0. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if nx or ny is negative */ /*----------------------------------------------------------------------------*/ cpl_mask * cpl_mask_new(cpl_size nx, cpl_size ny) { /* Need to validate input for cpl_calloc() */ cpl_ensure(nx > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(ny > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Cannot fail now */ return cpl_mask_wrap(nx, ny, (cpl_binary*)cpl_calloc((size_t)nx * (size_t)ny, sizeof(cpl_binary))); } /*----------------------------------------------------------------------------*/ /** @brief Create a cpl_mask from existing data @param nx number of element in x direction @param ny number of element in y direction @param data Pointer to array of nx*ny cpl_binary @return 1 newly allocated cpl_mask or NULL in case of an error @note The returned object must be deallocated using cpl_mask_unwrap(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if nx or ny is negative or zero */ /*----------------------------------------------------------------------------*/ cpl_mask * cpl_mask_wrap(cpl_size nx, cpl_size ny, cpl_binary * data) { cpl_mask * m; /* Test input */ cpl_ensure(data != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(nx > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(ny > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Allocate memory */ m = cpl_malloc(sizeof(cpl_mask)); m->nx = nx; m->ny = ny; m->data = data; return m; } /*----------------------------------------------------------------------------*/ /** @brief Duplicates a cpl_mask @param in the mask to duplicate @return 1 newly allocated cpl_mask or NULL on error The returned object must be deallocated using cpl_mask_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if in is NULL */ /*----------------------------------------------------------------------------*/ cpl_mask * cpl_mask_duplicate(const cpl_mask * in) { cpl_binary * pbpm; size_t sz; cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, NULL); sz = (size_t)in->nx * (size_t)in->ny * sizeof(cpl_binary); pbpm = (cpl_binary*)cpl_malloc(sz); /* Create the output mask, cannot fail now */ return cpl_mask_wrap(in->nx, in->ny, memcpy(pbpm, in->data, sz)); } /*----------------------------------------------------------------------------*/ /** @brief Delete a cpl_mask @param m cpl_mask to delete @return void The function deallocates the memory used by the mask @em m. If @em m is @c NULL, nothing is done, and no error is set. */ /*----------------------------------------------------------------------------*/ void cpl_mask_delete(cpl_mask * m) { if (m != NULL) { cpl_free(m->data); cpl_free(m); } return; } /*----------------------------------------------------------------------------*/ /** @brief Delete a cpl_mask except the data array @param m cpl_mask to delete @return A pointer to the data array or NULL if the input is NULL. @note The data array must be deallocated, otherwise a memory leak occurs. */ /*----------------------------------------------------------------------------*/ void * cpl_mask_unwrap(cpl_mask * m) { void * data = NULL; if (m != NULL) { data = (void *) m->data; cpl_free(m); } return data; } /*----------------------------------------------------------------------------*/ /** @brief Get a pointer to the data part of the mask @param in the input mask @return Pointer to the data or NULL on error The returned pointer refers to already allocated data. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_binary * cpl_mask_get_data(cpl_mask * in) { cpl_ensure(in, CPL_ERROR_NULL_INPUT, NULL); return in->data; } /*----------------------------------------------------------------------------*/ /** @brief Get a pointer to the data part of the mask @param in the input mask @return Pointer to the data or NULL on error @see cpl_mask_get_data */ /*----------------------------------------------------------------------------*/ const cpl_binary * cpl_mask_get_data_const(const cpl_mask * in) { cpl_ensure(in, CPL_ERROR_NULL_INPUT, NULL); return in->data; } /*----------------------------------------------------------------------------*/ /** @brief Get the value of a mask at a given position @param self The input mask @param xpos Pixel x position (FITS convention, 1 for leftmost) @param ypos Pixel y position (FITS convention, 1 for lowest) @return The mask value or undefined if an error code is set The mask value can be either CPL_BINARY_0 or CPL_BINARY_1 Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if xpos or ypos is out of bounds */ /*----------------------------------------------------------------------------*/ cpl_binary cpl_mask_get(const cpl_mask * self, cpl_size xpos, cpl_size ypos) { /* Test entries */ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, CPL_BINARY_0); cpl_ensure(xpos > 0, CPL_ERROR_ILLEGAL_INPUT, CPL_BINARY_0); cpl_ensure(ypos > 0, CPL_ERROR_ILLEGAL_INPUT, CPL_BINARY_0); cpl_ensure(xpos <= self->nx, CPL_ERROR_ILLEGAL_INPUT, CPL_BINARY_0); cpl_ensure(ypos <= self->ny, CPL_ERROR_ILLEGAL_INPUT, CPL_BINARY_0); return self->data[(xpos-1) + (ypos-1) * self->nx]; } /*----------------------------------------------------------------------------*/ /** @brief Set a value in a mask at a given position @param self the input mask @param xpos Pixel x position (FITS convention, 1 for leftmost) @param ypos Pixel y position (FITS convention, 1 for lowest) @param value the value to set in the mask @return the #_cpl_error_code_ or CPL_ERROR_NONE The value can be either CPL_BINARY_0 or CPL_BINARY_1 Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if xpos or ypos is out of bounds or if value is different from CPL_BINARY_0 and CPL_BINARY_1 */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_set(cpl_mask * self, cpl_size xpos, cpl_size ypos, cpl_binary value) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(xpos > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(ypos > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(xpos <= self->nx, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(ypos <= self->ny, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(value == CPL_BINARY_0 || value == CPL_BINARY_1, CPL_ERROR_ILLEGAL_INPUT); self->data[(xpos-1) + (ypos-1) * self->nx] = value; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Get the x size of the mask @param in the input mask @return The mask x size, or -1 on NULL input Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_mask_get_size_x(const cpl_mask * in) { /* Test entries */ cpl_ensure(in, CPL_ERROR_NULL_INPUT, -1); return in->nx; } /*----------------------------------------------------------------------------*/ /** @brief Get the y size of the mask @param in the input mask @return The mask y size, or -1 on NULL input Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_mask_get_size_y(const cpl_mask * in) { /* Test entries */ cpl_ensure(in, CPL_ERROR_NULL_INPUT, -1); return in->ny; } /*----------------------------------------------------------------------------*/ /** @brief Dump a mask @param self mask to dump @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @param stream Output stream, accepts @c stdout or @c stderr @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_FILE_IO if a write operation fails - CPL_ERROR_ACCESS_OUT_OF_RANGE if the defined window is not in the mask - CPL_ERROR_ILLEGAL_INPUT if the window definition is wrong (e.g llx > urx) */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_dump_window(const cpl_mask * self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, FILE * stream) { const cpl_error_code err = CPL_ERROR_FILE_IO; cpl_size i, j; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(stream != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(llx > 0, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(llx <= urx, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(urx <= self->nx, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(lly > 0, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(lly <= ury, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(ury <= self->ny, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code( fprintf(stream, "#----- mask: %" CPL_SIZE_FORMAT " <= x <= %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " <= y <= %" CPL_SIZE_FORMAT " -----\n", llx, urx, lly, ury) > 0, err); cpl_ensure_code( fprintf(stream, "\tX\tY\tvalue\n") > 0, err); for (i = llx; i <= urx; i++) { for (j = lly; j <= ury; j++) { const cpl_binary value = self->data[(i-1) + (j-1) * self->nx]; cpl_ensure_code( fprintf(stream, "\t%" CPL_SIZE_FORMAT "\t%" CPL_SIZE_FORMAT "\t%d\n", i, j, (int)value) > 0, err); } } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Return CPL_TRUE iff a mask has no elements set (to CPL_BINARY_1) @param self The mask to search @return CPL_TRUE iff the mask has no elements set (to CPL_BINARY_1) @see cpl_mask_is_empty_window() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_boolean cpl_mask_is_empty(const cpl_mask * self) { if (self == NULL) { (void)cpl_error_set_(CPL_ERROR_NULL_INPUT); return CPL_FALSE; } else { const cpl_size idx = cpl_mask_get_first_window(self, 1, 1, self->nx, self->ny, CPL_BINARY_1); /* Propagate the error, if any */ if (idx < -1) (void)cpl_error_set_where_(); return idx == -1 ? CPL_TRUE : CPL_FALSE; } } /*----------------------------------------------------------------------------*/ /** @brief Return CPL_TRUE iff a mask has no elements set in the window @param self The mask to search @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return CPL_TRUE iff the mask has no elements set (to CPL_BINARY_1) Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the window coordinates are not valid */ /*----------------------------------------------------------------------------*/ cpl_boolean cpl_mask_is_empty_window(const cpl_mask * self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { const cpl_size idx = cpl_mask_get_first_window(self, llx, lly, urx, ury, CPL_BINARY_1); /* Propagate the error, if any */ if (idx < -1) (void)cpl_error_set_where_(); return idx == -1 ? CPL_TRUE : CPL_FALSE; } /*----------------------------------------------------------------------------*/ /** @brief Get the number of occurences of CPL_BINARY_1 @param in the input mask @return the number of occurences of CPL_BINARY_1 or -1 on error @see cpl_mask_count_window() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_mask_count(const cpl_mask * in) { /* Test inputs */ cpl_ensure(in, CPL_ERROR_NULL_INPUT, -1); return cpl_mask_count_window(in, 1, 1, in->nx, in->ny); } /*----------------------------------------------------------------------------*/ /** @brief Get the number of occurences of CPL_BINARY_1 in a window @param self The mask to count @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return the number of occurences of CPL_BINARY_1 or -1 on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the window coordinates are invalid */ /*----------------------------------------------------------------------------*/ cpl_size cpl_mask_count_window(const cpl_mask * self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { const cpl_binary * pi; cpl_size count = 0; cpl_size i, j; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(llx > 0, CPL_ERROR_ILLEGAL_INPUT, -1); cpl_ensure(llx <= urx, CPL_ERROR_ILLEGAL_INPUT, -1); cpl_ensure(urx <= self->nx, CPL_ERROR_ILLEGAL_INPUT, -1); cpl_ensure(lly > 0, CPL_ERROR_ILLEGAL_INPUT, -1); cpl_ensure(lly <= ury, CPL_ERROR_ILLEGAL_INPUT, -1); cpl_ensure(ury <= self->ny, CPL_ERROR_ILLEGAL_INPUT, -1); /* Point to first row with element(s) to check */ pi = self->data + (size_t)self->nx * (size_t)(lly-1); for (j = lly - 1; j < ury; j++, pi += self->nx) { i = llx - 1; #ifdef CPL_MASK_WORD /* FIXME: Should really ensure byte-wise iteration to word-boundary */ for (; i < llx - 1 + CPL_MASK_PAD2WORD2(llx - 1); i++) { if (pi[i] != CPL_BINARY_0) count++; } /* Use multiplication to sum up all one-bytes in one word into the single (most significant byte) using an idea of Julian Taylor. */ for (; i < (urx & ~CPL_MASK_PAD2); i+= CPL_MASK_WORD2) { const size_t countz = *(const size_t*)(pi + i) + *(const size_t*)(pi + i + CPL_MASK_WORD); /* Instead of shifting one could also accumulate from an unsigned character pointing to the MSB of the product, but on one tested 64-bit platform this is not faster. */ count += (countz * CPL_MASK_NOT) >> (CPL_MASK_PAD * 8); } /* Count remainder */ #endif for (; i < urx; i++) { if (pi[i] != CPL_BINARY_0) count++; } } return count; } /*----------------------------------------------------------------------------*/ /** @brief Performs a logical AND of one mask onto another @param in1 first mask, to be modified @param in2 second mask @return CPL_ERROR_NONE on success, otherwise the relevant #_cpl_error_code_ @see cpl_image_and() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the two masks have different sizes */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_and(cpl_mask * in1, const cpl_mask * in2) { cpl_ensure_code(in1 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(in2 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(in1->nx == in2->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(in1->ny == in2->ny, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_mask_and_(in1->data, NULL, in2->data, (size_t)(in1->nx * in1->ny)); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Performs a logical OR of one mask onto another @param in1 first mask, to be modified @param in2 second mask @return CPL_ERROR_NONE on success, otherwise the relevant #_cpl_error_code_ @see cpl_image_or() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the two masks have different sizes */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_or(cpl_mask * in1, const cpl_mask * in2) { cpl_ensure_code(in1 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(in2 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(in1->nx == in2->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(in1->ny == in2->ny, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_mask_or_(in1->data, NULL, in2->data, (size_t)(in1->nx * in1->ny)); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Performs a logical XOR of one mask onto another @param in1 first mask, to be modified @param in2 second mask @return CPL_ERROR_NONE on success, otherwise the relevant #_cpl_error_code_ @see cpl_image_xor() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the two masks have different sizes */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_xor(cpl_mask * in1, const cpl_mask * in2) { cpl_ensure_code(in1 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(in2 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(in1->nx == in2->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(in1->ny == in2->ny, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_mask_xor_(in1->data, NULL, in2->data, (size_t)(in1->nx * in1->ny)); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Performs a logical NOT on a mask @param in mask to be modified @return CPL_ERROR_NONE on success, otherwise the relevant #_cpl_error_code_ @see cpl_image_not() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_not(cpl_mask * in) { cpl_ensure_code(in != NULL, CPL_ERROR_NULL_INPUT); cpl_mask_xor_scalar(in->data, NULL, CPL_MASK_NOT8, (size_t)(in->nx * in->ny)); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Collapse a mask @param in input mask to collapse @param dir collapsing direction @return the newly allocated mask or NULL on error @note The returned mask must be deallocated using cpl_mask_delete(). direction 0 collapses along y, producing a nx by 1 mask direction 1 collapses along x, producing a 1 by ny mask The resulting mask element is set to CPL_BINARY_1 iff all elements of the associated column (resp. row) in the input mask are set to CPL_BINARY_1. @verbatim Direction 0 collapse: 1 0 1 Input mask. 0 1 1 0 0 1 ----- 0 0 1 Only the third element is set to CPL_BINARY_1 since all input elements of that column are set to CPL_BINARY_1. @endverbatim Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT - CPL_ERROR_ILLEGAL_INPUT */ /*----------------------------------------------------------------------------*/ cpl_mask * cpl_mask_collapse_create(const cpl_mask * in, int dir) { cpl_mask * out; const cpl_binary * pin; cpl_size j; /* Check entries */ cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, NULL); /* Get access to bpm_in */ pin = in->data; /* Check the collapsing direction */ if (dir == 0) { cpl_binary * pout = (cpl_binary*)cpl_malloc((size_t)in->nx * sizeof(cpl_binary)); /* Process whole words */ const cpl_size nword = in->nx / (cpl_size)sizeof(size_t); /* Skip first + last CPL_BINARY_0 - valued columns in out */ /* This overhead is accepted because in the typical case out will have many CPL_BINARY_0;s, leading to a significant reduction in iterations */ cpl_size ifirst = 0; cpl_size ilast = nword-1; /* Can't use unsigned: nword may be zero */ /* Unlike in perl, in C ?: cannot be used to choose the assignee */ cpl_size * pfirst = &ifirst; cpl_size * plast = &ilast; /* Initialize out with 1st row of in */ size_t * word1 = (size_t*)memcpy(pout, pin, (size_t)in->nx); pin += in->nx; /* To achieve stride-1 access remaining rows of pin are and'ed onto pout. No more iterations are needed if pout is all CPL_BINARY_0. */ for (j = 1; j < in->ny; j++, pin += in->nx) { const size_t * word2 = (const size_t*)pin; unsigned donext = 0; /* Done iff out is all _0 */ const cpl_size klast = ilast; /* ilast is updated via plast */ cpl_size i; for (i = ifirst; i < 1 + klast; i++) { /* donext is also used to ensure an update of ifirst the first time a CPL_BINARY_1 is set, and to update ilast for other occurences (including the last one) of CPL_BINARY_1 */ if ((word1[i] &= word2[i])) *(donext++ ? plast : pfirst) = i; } /* Typical masks will fall through here */ for (i = nword * (cpl_size)sizeof(size_t); i < in->nx; i++) { if ((pout[i] &= pin[i])) donext = 1; } if (!donext) break; } out = cpl_mask_wrap(in->nx, 1, pout); } else if (dir == 1) { /* Using memchr() this direction is about three times faster for some 4k by 4k masks on a 32 bit Intel Xeon */ cpl_binary * pout = (cpl_binary*)cpl_malloc((size_t)in->ny * sizeof(cpl_binary)); /* Each iteration may do multiple rows. Therefore, if the last computed value is CPL_BINARY_1, j will be 1 + in->ny after the loop */ for (j = 0; j < in->ny; j++) { /* pfind points to 1st element in the j'th row */ const cpl_binary * pfind = pin + (size_t)in->nx * (size_t)j; /* szfind is the remaining number of elements to search */ const size_t szfind = (size_t)in->nx * (size_t)(in->ny - j); /* Look for next CPL_BINARY_0 */ /* In the worst case the last column is all CPL_BINARY_0, the rest is CPL_BINARY_1, then ny memchr() calls have to be made, each scanning nx elements */ const cpl_binary * pnext = memchr(pfind, CPL_BINARY_0, szfind); /* Row numbers less than this one are set to CPL_BINARY_1 */ const cpl_size row0 = pnext != NULL ? (cpl_size)((size_t)pnext-(size_t)pin) / in->nx : in->ny; for (; j < row0; j++) { pout[j] = CPL_BINARY_1; } /* Unless we are done, collapse the j'th row to CPL_BINARY_0 */ if (pnext != NULL) pout[j] = CPL_BINARY_0; } out = cpl_mask_wrap(1, in->ny, pout); } else { out = NULL; (void)cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } /* out is NULL if dir is illegal */ return out; } /*----------------------------------------------------------------------------*/ /** @brief Extract a mask from an other one @param in input mask @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return 1 newly allocated mask or NULL on error. The returned mask must be deallocated using cpl_mask_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if the zone falls outside the mask - CPL_ERROR_NULL_INPUT if the input mask is NULL */ /*----------------------------------------------------------------------------*/ cpl_mask * cpl_mask_extract(const cpl_mask * in, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { const cpl_size nx = urx - llx + 1; const cpl_size ny = ury - lly + 1; cpl_binary * pout; /* Test entries */ cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(llx > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(llx <= urx, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(urx <= in->nx, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(lly > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(lly <= ury, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(ury <= in->ny, CPL_ERROR_ILLEGAL_INPUT, NULL); /* assert(nx > 0); */ /* assert(ny > 0); */ /* assert(nx <= in->nx); */ /* assert(ny <= in->ny); */ /* Create the buffer of the extracted mask */ pout = (cpl_binary*)cpl_malloc((size_t)nx * (size_t)ny * sizeof(cpl_binary)); if (nx == in->nx) { /* Whole rows are extracted from in */ (void)memcpy(pout, in->data + (size_t)in->nx * (size_t)(lly - 1), (size_t)nx * (size_t)ny * sizeof(cpl_binary)); } else { const cpl_binary * pin = in->data + (llx - 1) + (size_t)in->nx * (size_t)(lly - 1); cpl_binary * pj = pout; cpl_size j; /* Loop over the rows to extract */ for (j = 0; j < ny; j++, pin += in->nx, pj += nx) { (void)memcpy(pj, pin, (size_t)nx); } } return cpl_mask_wrap(nx, ny, pout); } /*----------------------------------------------------------------------------*/ /** @brief Rotate a mask by a multiple of 90 degrees clockwise. @param self Mask to rotate in place @param rot The multiple: -1 is a rotation of 90 deg counterclockwise. @return CPL_ERROR_NONE on success, otherwise the relevant #_cpl_error_code_ @see cpl_image_turn() rot may be any integer value, its modulo 4 determines the rotation: - -3 to turn 270 degrees counterclockwise. - -2 to turn 180 degrees counterclockwise. - -1 to turn 90 degrees counterclockwise. - 0 to not turn - +1 to turn 90 degrees clockwise (same as -3) - +2 to turn 180 degrees clockwise (same as -2). - +3 to turn 270 degrees clockwise (same as -1). The definition of the rotation relies on the FITS convention: The lower left corner of the image is at (1,1), x increasing from left to right, y increasing from bottom to top. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if self is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_turn(cpl_mask * self, int rot) { cpl_mask * loc; const cpl_binary * ploc; cpl_binary * pself; cpl_size i, j; /* Check entries */ cpl_ensure_code(self, CPL_ERROR_NULL_INPUT); rot %= 4; if (rot < 0) rot += 4; /* Create the local mask */ loc = cpl_mask_duplicate(self); ploc = cpl_mask_get_data_const(loc); pself = cpl_mask_get_data(self); /* Compute the new positions */ /* Switch on the kind of rotation */ /* rot is 0, 1, 2 or 3. */ switch (rot) { case 1: self->nx = loc->ny; self->ny = loc->nx; pself += ((self->ny)-1)* (self->nx); for (j=0; j<(self->nx); j++) { for (i=0; i<(self->ny); i++) { *pself = *ploc++; pself -= (self->nx); } pself += (self->nx)*(self->ny)+1; } break; case 2: for (i=0; i<(self->nx)*(self->ny); i++) pself[i] = ploc[(self->ny)*(self->nx)-1-i]; break; case 3: self->nx = loc->ny; self->ny = loc->nx; pself += (self->nx)-1; for (j=0; j<(self->nx); j++) { for (i=0; i<(self->ny); i++) { *pself = *ploc++; pself += (self->nx); } pself -= (self->nx)*(self->ny)+1; } break; default: break; } cpl_mask_delete(loc); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Shift a mask @param self Mask to shift in place @param dx Shift in X @param dy Shift in Y @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_turn() The 'empty zone' in the shifted mask is set to CPL_BINARY_1. The shift values have to be valid: -nx < dx < nx and -ny < dy < ny Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if in is NULL - CPL_ERROR_ILLEGAL_INPUT if the offsets are too big */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_shift(cpl_mask * self, cpl_size dx, cpl_size dy) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); return cpl_tools_shift_window(self->data, sizeof(*(self->data)), self->nx, self->ny, CPL_BINARY_1, dx, dy) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Insert a mask in an other one @param in1 mask in which in2 is inserted @param in2 mask to insert @param x_pos the x pixel position in in1 where the lower left pixel of in2 should go (from 1 to the x size of in1) @param y_pos the y pixel position in in1 where the lower left pixel of in2 should go (from 1 to the y size of in1) @return the #_cpl_error_code_ or CPL_ERROR_NONE Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if in1 or in2 is NULL - CPL_ERROR_ILLEGAL_INPUT if x_pos, y_pos is outside in1 */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_copy(cpl_mask * in1, const cpl_mask * in2, cpl_size x_pos, cpl_size y_pos) { cpl_binary * pin1; const cpl_binary * pin2; cpl_size urx, ury; size_t linesz; /* Test entries */ cpl_ensure_code(in1 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(in2 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(x_pos >= 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(x_pos <= in1->nx, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(y_pos >= 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(y_pos <= in1->ny, CPL_ERROR_ILLEGAL_INPUT); /* Define the zone to modify in in1: x_pos, y_pos, urx, ury */ urx = CX_MIN(in1->nx, in2->nx + x_pos - 1); ury = CX_MIN(in1->ny, in2->ny + y_pos - 1); /* Get access to the data */ pin1 = cpl_mask_get_data(in1) + (y_pos - 1) * in1->nx; pin2 = cpl_mask_get_data_const(in2); linesz = (size_t)(urx - (x_pos-1)) * sizeof(cpl_binary); if (x_pos == 1 && urx == in1->nx && in1->nx == in2->nx) { /* The zone consists of whole lines in both in1 and in2 */ (void)memcpy(pin1, pin2, (size_t)(ury - (y_pos - 1)) * linesz); } else { cpl_size j; pin1 += (x_pos - 1); /* Loop on the zone */ for (j = y_pos - 1; j < ury; j++, pin1 += in1->nx, pin2 += in2->nx) { (void)memcpy(pin1, pin2, linesz); } } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Flip a mask on a given mirror line. @param in mask to flip @param angle mirror line in polar coord. is theta = (PI/4) * angle @return the #_cpl_error_code_ or CPL_ERROR_NONE angle can take one of the following values: - 0 (theta=0) to flip the image around the horizontal - 1 (theta=pi/4) to flip the image around y=x - 2 (theta=pi/2) to flip the image around the vertical - 3 (theta=3pi/4) to flip the image around y=-x Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if in is NULL - CPL_ERROR_ILLEGAL_INPUT if angle is not as specified */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_flip(cpl_mask * in, int angle) { cpl_binary * pin; cpl_size nx, ny; cpl_size i, j; /* Check entries */ cpl_ensure_code(in != NULL, CPL_ERROR_NULL_INPUT); /* Initialise */ pin = cpl_mask_get_data(in); nx = in->nx; ny = in->ny; /* Compute the new positions */ /* Switch on the kind of flipping */ switch (angle) { case 0: { const size_t rowsize = (size_t)nx * sizeof(cpl_binary); cpl_binary row[nx]; cpl_binary * pfirst = pin; cpl_binary * plast = pin + (ny-1) * nx; for (j = 0; j < ny/2; j++, pfirst += nx, plast -= nx) { (void)memcpy(row, pfirst, rowsize); (void)memcpy(pfirst, plast, rowsize); (void)memcpy(plast, row, rowsize); } break; } case 2: { for (j = 0; j < ny; j++, pin += nx) { for (i = 0; i < nx/2; i++) { const cpl_binary tmp = pin[i]; pin[i] = pin[nx-1-i]; pin[nx-1-i] = tmp; } } break; } case 1: { if (nx == ny) { cpl_binary * pt = pin; for (j = 0; j < nx; j++, pt += nx) { for (i = 0; i < j; i++) { const cpl_binary tmp = pt[i]; pt[i] = pin[j + i * nx]; pin[j + i * nx] = tmp; } } } else { /* Duplicate the input mask */ cpl_mask * loc = cpl_mask_duplicate(in); const cpl_binary * ploc = cpl_mask_get_data_const(loc); in->nx = ny; in->ny = nx; for (j=0; jnx = ny; in->ny = nx; ploc += (nx*ny-1); for (j=0; j 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(in->nx % nb_cut == 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(in->ny % nb_cut == 0, CPL_ERROR_ILLEGAL_INPUT); /* Initialize */ tile_sz_x = in->nx / nb_cut; tile_sz_y = in->ny / nb_cut; /* Create local mask */ loc = cpl_mask_duplicate(in); ploc = cpl_mask_get_data_const(loc); pin = cpl_mask_get_data(in); /* Loop to move the pixels */ for (j=0; jnx * (l+j*tile_sz_y); npos=(k+tile_x*tile_sz_x) + in->nx * (l+tile_y*tile_sz_y); pin[npos] = ploc[opos]; } } } } cpl_mask_delete(loc); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Subsample a mask @param in input mask @param xstep Take every xstep pixel in x @param ystep Take every ystep pixel in y @return the newly allocated mask or NULL on error case @see cpl_image_extract_subsample() The returned mask must be deallocated using cpl_mask_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if in is NULL - CPL_ERROR_ILLEGAL_INPUT if xstep and ystep are not greater than zero */ /*----------------------------------------------------------------------------*/ cpl_mask *cpl_mask_extract_subsample(const cpl_mask *in, cpl_size xstep, cpl_size ystep) { cpl_size new_nx, new_ny; cpl_mask *out; cpl_binary *pout; const cpl_binary *pin; cpl_size i, j; cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(xstep > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(ystep > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); new_nx = (in->nx - 1)/xstep + 1; new_ny = (in->ny - 1)/ystep + 1; out = cpl_mask_new(new_nx, new_ny); pin = cpl_mask_get_data_const(in); pout = cpl_mask_get_data(out); for (j = 0; j < in->ny; j += ystep, pin += ystep*in->nx) for (i = 0; i < in->nx; i += xstep) *pout++ = pin[i]; return out; } /*----------------------------------------------------------------------------*/ /** @brief Filter a mask using a binary kernel @param self Pre-allocated mask to hold the filtered result @param other Mask to filter @param kernel Elements to use, if set to CPL_BINARY_1 @param filter CPL_FILTER_EROSION, CPL_FILTER_DILATION, CPL_FILTER_OPENING, CPL_FILTER_CLOSING @param border CPL_BORDER_NOP, CPL_BORDER_ZERO or CPL_BORDER_COPY @return CPL_ERROR_NONE or the relevant CPL error code The two masks must have equal dimensions. The kernel must have an odd number of rows and an odd number of columns. At least one kernel element must be set to CPL_BINARY_1. For erosion and dilation: In-place filtering is not supported, but the input buffer may overlap all but the 1+h first rows of the output buffer, where 1+2*h is the number of rows in the kernel. For opening and closing: Opening is implemented as an erosion followed by a dilation, and closing is implemented as a dilation followed by an erosion. As such a temporary, internal buffer the size of self is used. Consequently, in-place opening and closing is supported with no additional overhead, it is achieved by passing the same mask as both self and other. Supported modes: CPL_FILTER_EROSION, CPL_FILTER_DILATION: CPL_BORDER_NOP, CPL_BORDER_ZERO or CPL_BORDER_COPY. CPL_FILTER_OPENING, CPL_FILTER_CLOSING: CPL_BORDER_ZERO or CPL_BORDER_COPY. Duality and idempotency: Erosion and Dilation have the duality relations: not(dil(A,B)) = er(not(A), B) and not(er(A,B)) = dil(not(A), B). Opening and closing have similar duality relations: not(open(A,B)) = close(not(A), B) and not(close(A,B)) = open(not(A), B). Opening and closing are both idempotent, i.e. open(A,B) = open(open(A,B),B) and close(A,B) = close(close(A,B),B). The above duality and idempotency relations do _not_ hold on the mask border (with the currently supported border modes). Unnecessary large kernels: Adding an empty border to a given kernel should not change the outcome of the filtering. However doing so widens the border of the mask to be filtered and therefore has an effect on the filtering of the mask border. Since an unnecessary large kernel is also more costly to apply, such kernels should be avoided. @par A 1 x 3 erosion filtering example (error checking omitted for brevity) @code cpl_mask * kernel = cpl_mask_new(1, 3); cpl_mask_not(kernel); cpl_mask_filter(filtered, raw, kernel, CPL_FILTER_EROSION, CPL_BORDER_NOP); cpl_mask_delete(kernel); @endcode Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL. - CPL_ERROR_ILLEGAL_INPUT if the kernel has a side of even length. - CPL_ERROR_DATA_NOT_FOUND If the kernel is empty. - CPL_ERROR_ACCESS_OUT_OF_RANGE If the kernel has a side longer than the input mask. - CPL_ERROR_INCOMPATIBLE_INPUT If the input and output masks have incompatible sizes. - CPL_ERROR_UNSUPPORTED_MODE If the output pixel buffer overlaps the input one (or the kernel), or the border/filter mode is unsupported. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_filter(cpl_mask * self, const cpl_mask * other, const cpl_mask * kernel, cpl_filter_mode filter, cpl_border_mode border) { /* Modified from cpl_image_filter_mask() :-((((( */ const cpl_size nsx = cpl_mask_get_size_x(self); const cpl_size nsy = cpl_mask_get_size_y(self); const cpl_size nx = cpl_mask_get_size_x(other); const cpl_size ny = cpl_mask_get_size_y(other); const cpl_size mx = cpl_mask_get_size_x(kernel); const cpl_size my = cpl_mask_get_size_y(kernel); const cpl_size hsizex = mx >> 1; const cpl_size hsizey = my >> 1; const cpl_binary * pmask = cpl_mask_get_data_const(kernel); const cpl_binary * pother = cpl_mask_get_data_const(other); cpl_binary * pself = cpl_mask_get_data(self); /* assert( sizeof(cpl_binary) == 1 ) */ const cpl_binary * polast = pother + nx * ny; const cpl_binary * psrows = pself + nsx * (1 + hsizey); /* pmask may not overlap pself at all */ const cpl_binary * pmlast = pmask + mx * my; const cpl_binary * pslast = pself + nsx * nsy; /* In filtering it is generally faster with a special case for the full kernel. Some tests indicate that this is not the case for mask filtering. This may be due to the typically small kernels - and the simple operations involved. */ void (*filter_func)(cpl_binary *, const cpl_binary *, const cpl_binary *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode) CPL_ATTR_NONNULL; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(other != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(kernel != NULL, CPL_ERROR_NULL_INPUT); if (filter == CPL_FILTER_OPENING || filter == CPL_FILTER_CLOSING) { cpl_ensure_code(border == CPL_BORDER_ZERO || border == CPL_BORDER_COPY, CPL_ERROR_UNSUPPORTED_MODE); } else { /* pself has to be above all of the other buffer, or */ /* ...pother has to be above the first hsize+1 rows of pself */ cpl_ensure_code(pself >= polast || pother >= psrows, CPL_ERROR_UNSUPPORTED_MODE); cpl_ensure_code(border == CPL_BORDER_NOP || border == CPL_BORDER_ZERO || border == CPL_BORDER_COPY, CPL_ERROR_UNSUPPORTED_MODE); } /* If this check fails, the caller is doing something really weird... */ cpl_ensure_code(pmask >= pslast || pself >= pmlast, CPL_ERROR_UNSUPPORTED_MODE); /* Only odd-sized masks allowed */ cpl_ensure_code((mx&1) == 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code((my&1) == 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(mx <= nx, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(my <= ny, CPL_ERROR_ACCESS_OUT_OF_RANGE); #ifdef CPL_MASK_FILTER_CROP if (border == CPL_BORDER_CROP) { cpl_ensure_code(nsx == nx - 2 * hsizex, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(nsy == ny - 2 * hsizey, CPL_ERROR_INCOMPATIBLE_INPUT); } else #endif { cpl_ensure_code(nsx == nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(nsy == ny, CPL_ERROR_INCOMPATIBLE_INPUT); } cpl_ensure_code(!cpl_mask_is_empty(kernel), CPL_ERROR_DATA_NOT_FOUND); filter_func = NULL; #ifdef CPL_MASK_NOT if (filter == CPL_FILTER_EROSION) { filter_func = cpl_mask_erosion_; } else if (filter == CPL_FILTER_DILATION) { filter_func = cpl_mask_dilation_; } else if (filter == CPL_FILTER_OPENING) { filter_func = cpl_mask_opening_; } else if (filter == CPL_FILTER_CLOSING) { filter_func = cpl_mask_closing_; } #endif if (filter_func != NULL) { /* Pad kernel rows to a multiple of four/eight bytes so each instruction can process four/eight bytes. */ const cpl_size mxe = 1 + (mx | CPL_MASK_PAD); cpl_mask * meven = cpl_mask_new(mxe, my); cpl_binary * even = cpl_mask_get_data(meven); cpl_mask_copy(meven, kernel, 1, 1); filter_func(pself, pother, even, nx, ny, hsizex, hsizey, border); cpl_mask_delete(meven); } else { return cpl_error_set_message_(CPL_ERROR_UNSUPPORTED_MODE, "filter=%u. border=%u", (unsigned)filter, (unsigned)border); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Compute a morphological opening @param in input mask to filter @param ker binary kernel (0 for 0, any other value is considered as 1) @return CPL_ERROR_NONE on success or the #_cpl_error_code_ on failure @see cpl_mask_filter() @deprecated Replace this call with cpl_mask_filter() using CPL_FILTER_OPENING and CPL_BORDER_ZERO. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_opening( cpl_mask * in, const cpl_matrix * ker) { cpl_mask * mask = cpl_mask_new_from_matrix(ker, FLT_MIN); const cpl_error_code error = cpl_mask_filter(in, in, mask, CPL_FILTER_OPENING, CPL_BORDER_ZERO); cpl_mask_delete(mask); return cpl_error_set_(error); } /*----------------------------------------------------------------------------*/ /** @brief Compute a morphological closing @param in input mask to filter @param ker binary kernel (0 for 0, any other value is considered as 1) @return CPL_ERROR_NONE on success or the #_cpl_error_code_ on failure @see cpl_mask_filter() @deprecated Replace this call with cpl_mask_filter() using CPL_FILTER_CLOSING and CPL_BORDER_ZERO. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_closing( cpl_mask * in, const cpl_matrix * ker) { cpl_mask * mask = cpl_mask_new_from_matrix(ker, FLT_MIN); const cpl_error_code error = cpl_mask_filter(in, in, mask, CPL_FILTER_CLOSING, CPL_BORDER_ZERO); cpl_mask_delete(mask); return cpl_error_set_(error); } /*----------------------------------------------------------------------------*/ /** @brief Compute a morphological erosion @param in input mask to filter @param ker binary kernel (0 for 0, any other value is considered as 1) @return CPL_ERROR_NONE on success or the #_cpl_error_code_ on failure @see cpl_mask_filter() @deprecated Replace this call with cpl_mask_filter() using CPL_FILTER_EROSION and CPL_BORDER_ZERO. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_erosion( cpl_mask * in, const cpl_matrix * ker) { cpl_mask * mask = cpl_mask_new_from_matrix(ker, FLT_MIN); cpl_mask * self = cpl_mask_duplicate(in); const cpl_error_code error = cpl_mask_filter(in, self, mask, CPL_FILTER_EROSION, CPL_BORDER_ZERO); cpl_mask_delete(self); cpl_mask_delete(mask); return cpl_error_set_(error); } /*----------------------------------------------------------------------------*/ /** @brief Compute a morphological dilation @param in input mask to filter @param ker binary kernel (0 for 0, any other value is considered as 1) @return CPL_ERROR_NONE on success or the #_cpl_error_code_ on failure @see cpl_mask_filter() @deprecated Replace this call with cpl_mask_filter() using CPL_FILTER_DILATION and CPL_BORDER_ZERO. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_dilation( cpl_mask * in, const cpl_matrix * ker) { cpl_mask * mask = cpl_mask_new_from_matrix(ker, FLT_MIN); cpl_mask * self = cpl_mask_duplicate(in); const cpl_error_code error = cpl_mask_filter(in, self, mask, CPL_FILTER_DILATION, CPL_BORDER_ZERO); cpl_mask_delete(self); cpl_mask_delete(mask); return cpl_error_set_(error); } /*----------------------------------------------------------------------------*/ /** @brief Select parts of an image with provided thresholds @param self Mask to flag according to threshold @param image Image to threshold. @param lo_cut Lower bound for threshold. @param hi_cut Higher bound for threshold. @param inval This value (CPL_BINARY_1 or CPL_BINARY_0) is assigned where the pixel value is not marked as rejected and is strictly inside the provided interval. The other positions are assigned the other value. @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error The input image type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT. If lo_cut is greater than or equal to hi_cut, then the mask is filled with outval. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_UNSUPPORTED_MODE if the pixel type is unsupported - CPL_ERROR_INCOMPATIBLE_INPUT if the mask and image have different sizes - CPL_ERROR_ILLEGAL_INPUT if inval is not one of CPL_BINARY_1 or CPL_BINARY_0 */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_threshold_image(cpl_mask * self, const cpl_image * image, double lo_cut, double hi_cut, cpl_binary inval) { const cpl_size nx = cpl_mask_get_size_x(self); const cpl_size ny = cpl_mask_get_size_y(self); const cpl_size npix = nx * ny; const void * pixels = cpl_image_get_data_const(image); cpl_binary * bpm = cpl_mask_get_data(self); const cpl_mask * bmask = cpl_image_get_bpm_const(image); const cpl_binary * pmask = bmask ? cpl_mask_get_data_const(bmask) : NULL; const cpl_binary outval = inval == CPL_BINARY_1 ? CPL_BINARY_0 : CPL_BINARY_1; int i; cpl_ensure_code(bpm != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pixels != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(nx == cpl_image_get_size_x(image), CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(ny == cpl_image_get_size_y(image), CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(inval == CPL_BINARY_1 || inval == CPL_BINARY_0, CPL_ERROR_ILLEGAL_INPUT); /* Switch on the input data type */ switch (cpl_image_get_type(image)) { case CPL_TYPE_DOUBLE: { const double * pi = (const double*)pixels; for (i=0; i < npix; i++) { bpm[i] = (pmask == NULL || !pmask[i]) && lo_cut < pi[i] && pi[i] < hi_cut ? inval : outval; } break; } case CPL_TYPE_FLOAT: { const float * pi = (const float*)pixels; for (i=0; i < npix; i++) { bpm[i] = (pmask == NULL || !pmask[i]) && lo_cut < pi[i] && pi[i] < hi_cut ? inval : outval; } break; } case CPL_TYPE_INT: { const int * pi = (const int*)pixels; for (i=0; i < npix; i++) { bpm[i] = (pmask == NULL || !pmask[i]) && lo_cut < pi[i] && pi[i] < hi_cut ? inval : outval; } break; } default: return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Select parts of an image with provided thresholds @param in Image to threshold. @param lo_cut Lower bound for threshold. @param hi_cut Higher bound for threshold. @return 1 newly allocated mask or NULL on error @note The returned mask must be deallocated with cpl_mask_delete() @see cpl_mask_threshold_image() */ /*----------------------------------------------------------------------------*/ cpl_mask * cpl_mask_threshold_image_create(const cpl_image * in, double lo_cut, double hi_cut) { cpl_mask * self = cpl_mask_new(cpl_image_get_size_x(in), cpl_image_get_size_y(in)); if (cpl_mask_threshold_image(self, in, lo_cut, hi_cut, CPL_BINARY_1)) { cpl_error_set_where_(); cpl_mask_delete(self); self = NULL; } return self; } /*----------------------------------------------------------------------------*/ /** @brief Save a mask to a FITS file @param self mask to write to disk @param filename Name of the file to write @param pl Property list for the output header or NULL @param mode The desired output options @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_propertylist_save() This function saves a mask to a FITS file. If a property list is provided, it is written to the header where the mask is written. The type used in the file is CPL_TYPE_UCHAR (8 bit unsigned). Supported output modes are CPL_IO_CREATE (create a new file) and CPL_IO_EXTEND (append a new extension to an existing file) The output mode CPL_IO_EXTEND can be combined (via bit-wise or) with an option for tile-compression. This compression is lossless. The options are: CPL_IO_COMPRESS_GZIP, CPL_IO_COMPRESS_RICE, CPL_IO_COMPRESS_HCOMPRESS, CPL_IO_COMPRESS_PLIO. Note that in append mode the file must be writable (and do not take for granted that a file is writable just because it was created by the same application, as this depends from the system @em umask). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the mode is not supported - CPL_ERROR_FILE_NOT_CREATED if the output file cannot be created - CPL_ERROR_FILE_IO if the data cannot be written to the file */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_mask_save(const cpl_mask * self, const char * filename, const cpl_propertylist * pl, unsigned mode) { /* FIXME: This code is a simplification of cpl_image_save() */ cpl_error_code error = CPL_ERROR_NONE; fitsfile * fptr; int fio_status=0; const char * badkeys = mode & CPL_IO_EXTEND ? CPL_FITS_BADKEYS_EXT "|" CPL_FITS_COMPRKEYS : CPL_FITS_BADKEYS_PRIM "|" CPL_FITS_COMPRKEYS; CPL_FITSIO_TYPE naxes[2]; /* Count number of compression flags */ const unsigned ncompress = ((mode & CPL_IO_COMPRESS_GZIP) != 0) + ((mode & CPL_IO_COMPRESS_HCOMPRESS) != 0) + ((mode & CPL_IO_COMPRESS_PLIO) != 0) + ((mode & CPL_IO_COMPRESS_RICE) != 0); cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(filename != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(((mode & CPL_IO_CREATE) != 0) ^ ((mode & CPL_IO_EXTEND) != 0), CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(mode < CPL_IO_MAX, CPL_ERROR_ILLEGAL_INPUT); naxes[0] = self->nx; naxes[1] = self->ny; if (mode & CPL_IO_EXTEND) { /* Only one type of compression is allowed */ cpl_ensure_code(ncompress <= 1, CPL_ERROR_ILLEGAL_INPUT); /* Open the file */ cpl_io_fits_open_diskfile(&fptr, filename, READWRITE, &fio_status); if (fio_status != 0) { return cpl_error_set_fits(CPL_ERROR_FILE_IO, fio_status, fits_open_diskfile, "filename='%s', mode=%d", filename, mode); } if (mode & CPL_IO_COMPRESS_GZIP) fits_set_compression_type(fptr, GZIP_1, &fio_status); else if (mode & CPL_IO_COMPRESS_HCOMPRESS) fits_set_compression_type(fptr, HCOMPRESS_1, &fio_status); else if (mode & CPL_IO_COMPRESS_PLIO) fits_set_compression_type(fptr, PLIO_1, &fio_status); else if (mode & CPL_IO_COMPRESS_RICE) fits_set_compression_type(fptr, RICE_1, &fio_status); if (fio_status != 0) { int fio_status2 = 0; cpl_io_fits_close_file(fptr, &fio_status2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, fio_status, fits_set_compression_type, "filename='%s', mode=%d", filename, mode); } } else if (ncompress > 0) { /* Compression is only allowed in extensions */ return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } else { /* Create the file */ char * sval = cpl_sprintf("!%s", filename); cpl_io_fits_create_file(&fptr, sval, &fio_status); cpl_free(sval); if (fio_status != 0) { int fio_status2 = 0; cpl_io_fits_close_file(fptr, &fio_status2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, fio_status, fits_create_file, "filename='%s', " "mode=%d", filename, mode); } } /* Save the data in a new HDU appended to the file */ CPL_FITSIO_CREATE_IMG(fptr, BYTE_IMG, 2, naxes, &fio_status); if (fio_status != 0) { int fio_status2 = 0; cpl_io_fits_close_file(fptr, &fio_status2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, fio_status, CPL_FITSIO_CREATE_IMG_E, "filename='%s', " "mode=%d", filename, mode); } if (mode & CPL_IO_CREATE) { /* Add DATE */ fits_write_date(fptr, &fio_status); if (fio_status != 0) { int fio_status2 = 0; cpl_io_fits_close_file(fptr, &fio_status2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, fio_status, fits_write_date, "filename='%s', " "mode=%d", filename, mode); } } /* Add the property list */ if (cpl_fits_add_properties(fptr, pl, badkeys) != CPL_ERROR_NONE) { cpl_io_fits_close_file(fptr, &fio_status); return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } /* Write the pixels */ fits_write_img(fptr, TBYTE, 1, (LONGLONG)self->nx * (LONGLONG)self->ny, (void*)self->data, &fio_status); if (fio_status != 0) { error = cpl_error_set_fits(CPL_ERROR_FILE_IO, fio_status, fits_write_img, "filename='%s', " "mode=%d", filename, mode); fio_status = 0; } /* Close and write on disk */ cpl_io_fits_close_file(fptr, &fio_status); /* Check */ if (fio_status != 0) { error = cpl_error_set_fits(CPL_ERROR_FILE_IO, fio_status, fits_close_file, "filename='%s', " "mode=%d", filename, mode); } return error; } /*----------------------------------------------------------------------------*/ /** @brief Load a mask from a FITS file. @param filename Name of the file to load from. @param pnum Plane number in the Data Unit (0 for first) @param xtnum Extension number in the file (0 for primary HDU) @return 1 newly allocated mask or NULL on error @see cpl_mask_load() This function loads a mask from a FITS file (NAXIS=2 or 3). The returned mask has to be deallocated with cpl_mask_delete(). 'xtnum' specifies from which extension the mask should be loaded. This could be 0 for the main data section (files without extension), or any number between 1 and N, where N is the number of extensions present in the file. The requested plane number runs from 0 to nplanes-1, where nplanes is the number of planes present in the requested data section. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO if the file cannot be opened or does not exist - CPL_ERROR_BAD_FILE_FORMAT if the data cannot be loaded from the file - CPL_ERROR_ILLEGAL_INPUT if the passed extension number is negative - CPL_ERROR_DATA_NOT_FOUND if the specified extension has no mask data */ /*----------------------------------------------------------------------------*/ cpl_mask * cpl_mask_load(const char * filename, cpl_size pnum, cpl_size xtnum) { cpl_mask * self = cpl_mask_load_one(filename, pnum, xtnum, CPL_FALSE, 0, 0, 0, 0); if (self == NULL) (void)cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @brief Load a mask from a FITS file. @param filename Name of the file to load from. @param pnum Plane number in the Data Unit (0 for first) @param xtnum Extension number in the file. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return 1 newly allocated mask or NULL on error @see cpl_mask_load() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO if the file does not exist - CPL_ERROR_BAD_FILE_FORMAT if the data cannot be loaded from the file - CPL_ERROR_ILLEGAL_INPUT if the passed position is invalid */ /*----------------------------------------------------------------------------*/ cpl_mask * cpl_mask_load_window(const char * filename, cpl_size pnum, cpl_size xtnum, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { cpl_mask * self = cpl_mask_load_one(filename, pnum, xtnum, CPL_TRUE, llx, lly, urx, ury); if (self == NULL) (void)cpl_error_set_where_(); return self; } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Load an mask from a FITS file. @param filename Name of the file to load from. @param pnum Plane number in the Data Unit (0 for first) @param xtnum Extension number in the file (0 for primary HDU) @param do_window True for (and only for) a windowed load @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return 1 newly allocated mask or NULL on error @see cpl_mask_load() */ /*----------------------------------------------------------------------------*/ static cpl_mask * cpl_mask_load_one(const char * filename, cpl_size pnum, cpl_size xtnum, cpl_boolean do_window, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { /* FIXME: This code is a simplification of cpl_image_load_one() */ int error = 0; int naxis = 0; /* May read from Data Unit w. NAXIS=[23] */ CPL_FITSIO_TYPE naxes[3] ={0, 0, 0}; fitsfile * fptr; cpl_mask * self; /* FIXME: Version 3.24 of fits_open_diskfile() seg-faults on NULL. If ever fixed in CFITSIO, this check should be removed */ cpl_ensure(filename != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(xtnum >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); if (cpl_io_fits_open_diskfile(&fptr, filename, READONLY, &error)) { /* If the file did not exist: error = 104 (FILE_NOT_OPENED) */ /* If the file had permission 0: error = 104 (FILE_NOT_OPENED) */ /* If the file was empty: error = 107 (END_OF_FILE) */ /* If the file was a directory: error = 108 (READ_ERROR) */ (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_open_diskfile, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", xtnum=%" CPL_SIZE_FORMAT, filename, pnum, xtnum); return NULL; } self = cpl_mask_load_(fptr, &naxis, naxes, filename, pnum, xtnum, do_window, llx, lly, urx, ury); if (cpl_io_fits_close_file(fptr, &error)) { cpl_mask_delete(self); self = NULL; (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_close_file, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", xtnum=%" CPL_SIZE_FORMAT, filename, pnum, xtnum); } else if (self == NULL) { cpl_error_set_where_(); } return self; } /*----------------------------------------------------------------------------*/ /* @internal @brief Internal mask loading function @param fptr CFITSIO structure of the already opened FITS file @param pnaxis If it points to 0, set *pnaxis to NAXIS else use as such @param naxes If 1st is 0, fill w. NAXIS[12[3]] else use as such @param filename The named of the opened file (only for error messages) @param pnum Plane number in the Data Unit (0 for first) @param lhdumov Absolute extension number to move to first (0 for primary) @param do_window True for (and only for) a windowed load @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Specifies the window position @param ury Specifies the window position @return 1 newly allocated mask or NULL if mask cannot be loaded. @see cpl_mask_load_one() This function reads from an already opened FITS-file, which is useful when multiple masks are to be loaded from the same file. To avoid repeated calls to determine NAXIS, NAXISi and optionally the CPL pixel-type most suitable for the the actual FITS data, the parameters pnaxis and naxes can be used both for input and for output. The extension number lhdumov is numbered with 1 for the first extension, i.e. 0 moves to the primary HDU. Any negative value causes no move. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_BAD_FILE_FORMAT if a CFITSIO call fails. - CPL_ERROR_DATA_NOT_FOUND if the specified extension has no mask data. This code is relied on as being part of the API! - CPL_ERROR_INCOMPATIBLE_INPUT if NAXIS is OK but the data unit is empty - CPL_ERROR_ILLEGAL_INPUT If the plane number is out of range, or in a windowed read the window is invalid */ /*----------------------------------------------------------------------------*/ cpl_mask * cpl_mask_load_(fitsfile * fptr, int * pnaxis, CPL_FITSIO_TYPE naxes[], const char * filename, cpl_size pnum, cpl_size lhdumov, cpl_boolean do_window, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { /* FIXME: This code is a simplification of cpl_image_load_() */ const int hdumov = (int)lhdumov; int error = 0; cpl_mask * self; cpl_binary * pixels; const long int inc[3] = {1, 1, 1}; long int fpixel[3]; long int lpixel[3]; cpl_size nx, ny; cpl_ensure(fptr != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(pnaxis != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(naxes != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(filename != NULL, CPL_ERROR_NULL_INPUT, NULL); /* CFITSIO only supports int */ cpl_ensure((cpl_size)(1+hdumov) == 1+lhdumov, CPL_ERROR_ILLEGAL_INPUT, NULL); if (hdumov >= 0 && fits_movabs_hdu(fptr, 1+hdumov, NULL, &error)) { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_movabs_hdu, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", " "hdumov=%d", filename, pnum, hdumov); return NULL; } /* Get NAXIS, if needed */ if (*pnaxis == 0 && fits_get_img_dim(fptr, pnaxis, &error)) { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_get_img_dim, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d", filename, pnum, hdumov); return NULL; } /* Verify NAXIS before trying anything else */ if (*pnaxis != 2 && *pnaxis != 3) { (void)cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, NAXIS=%d", filename, pnum, hdumov, *pnaxis); return NULL; } /* Get NAXIS[12[3]], if needed */ if (naxes[0] == 0 && CPL_FITSIO_GET_SIZE(fptr, *pnaxis, naxes, &error)) { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, CPL_FITSIO_GET_SIZE, "filename='%s', " "pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, " "NAXIS=%d", filename, pnum, hdumov, *pnaxis); return NULL; } /* Verify NAXIS[123] */ if (naxes[0] == 0 || naxes[1] == 0) { /* FIXME: Is this actually possible with a non-zero NAXIS ? */ (void)cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, NAXIS=%d, NAXIS1=%ld, " "NAXIS2=%ld", filename, pnum, hdumov, *pnaxis, (long)naxes[0], (long)naxes[1]); return NULL; } if (*pnaxis == 3 && naxes[2] == 0) { /* FIXME: Is this actually possible with a non-zero NAXIS ? */ (void)cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, NAXIS=%d, NAXIS1=%ld, " "NAXIS2=%ld NAXIS3=0", filename, pnum, hdumov, *pnaxis, (long)naxes[0], (long)naxes[1]); return NULL; } if (do_window) { /* Verify the window size */ /* If the naxes[] passed is from a previous succesful call here, then this check is redundant. Don't rely on that. */ if (llx < 1 || lly < 1 || urx > naxes[0] || ury > naxes[1] || urx < llx || ury < lly) { (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, " "llx=%" CPL_SIZE_FORMAT ", " "lly=%" CPL_SIZE_FORMAT ", " "urx=%" CPL_SIZE_FORMAT ", " "ury=%" CPL_SIZE_FORMAT ", " "NAXIS=%d, NAXIS1=%ld, NAXIS2=%ld", filename, pnum, hdumov, llx, lly, urx, ury, *pnaxis, (long)naxes[0], (long)naxes[1]); return NULL; } } else { llx = lly = 1; urx = naxes[0]; ury = naxes[1]; } /* Create the zone definition. The 3rd element not defined for NAXIS = 2 */ fpixel[0] = llx; fpixel[1] = lly; lpixel[0] = urx; lpixel[1] = ury; if (*pnaxis == 3) { /* Verify plane number */ if (pnum + 1 > naxes[2]) { (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, NAXIS=3, NAXIS1=%ld, " "NAXIS2=%ld, NAXIS3=%ld", filename, pnum, hdumov, (long)naxes[0], (long)naxes[1], (long)naxes[2]); return NULL; } fpixel[2] = lpixel[2] = pnum + 1; } else if (pnum != 0) { /* May not ask for any plane but the first when NAXIS == 2 */ (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, NAXIS=%d, NAXIS1=%ld, " "NAXIS2=%ld", filename, pnum, hdumov, *pnaxis, (long)naxes[0], (long)naxes[1]); return NULL; } nx = urx - llx + 1; ny = ury - lly + 1; pixels = (cpl_binary*)cpl_malloc((size_t)nx * (size_t)ny * sizeof(*pixels)); if (cpl_fits_read_subset(fptr, TBYTE, fpixel, lpixel, inc, NULL, pixels, NULL, &error)) { cpl_free(pixels); (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_read_subset, "filename='%s', " "pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, " "NAXIS=%d, NAXIS1=%ld, NAXIS2=%ld", filename, pnum, hdumov, *pnaxis, (long)naxes[0], (long)naxes[1]); return NULL; } self = cpl_mask_wrap(nx, ny, pixels); if (self == NULL) { cpl_free(pixels); (void)cpl_error_set_where_(); } return self; } /*----------------------------------------------------------------------------*/ /** @internal @brief Find 1st element with the given value (zero for first) @param self The mask to search @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return The index (zero for first), or -1 when not found, or < -1 on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the window coordinates are not valid */ /*----------------------------------------------------------------------------*/ cpl_size cpl_mask_get_first_window(const cpl_mask * self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_binary value) { const cpl_binary * pi; const cpl_binary * found; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -2); cpl_ensure(llx <= urx, CPL_ERROR_ILLEGAL_INPUT, -3); cpl_ensure(llx > 0, CPL_ERROR_ILLEGAL_INPUT, -4); cpl_ensure(urx <= self->nx, CPL_ERROR_ILLEGAL_INPUT, -5); cpl_ensure(lly <= ury, CPL_ERROR_ILLEGAL_INPUT, -6); cpl_ensure(lly > 0, CPL_ERROR_ILLEGAL_INPUT, -7); cpl_ensure(ury <= self->ny, CPL_ERROR_ILLEGAL_INPUT, -8); /* Point to 1st element in first row to read */ pi = self->data + (lly-1)*self->nx; if (llx == 1 && urx == self->nx) { /* Special case: Window extends to left and right mask border */ found = memchr(pi, value, (size_t)self->nx * (size_t)(ury-lly+1) * sizeof(*pi)); } else { const cpl_binary * pii = pi; const size_t rowsize = (size_t)(urx-llx+1) * sizeof(*pii); cpl_size j; /* Point to first element to read */ pii += llx - 1; found = NULL; for (j = lly - 1; found == NULL && j < ury; j++, pii += self->nx) { found = memchr(pii, value, rowsize); } } return found == NULL ? -1 : found - pi; } /*----------------------------------------------------------------------------*/ /** @internal @brief Apply the erosion filter @param self The output binary 2D array to hold the filtered result @param other The input binary 2D array to filter @param kernel The input binary 2D kernel - rows padded with 0 to fit word @param nx The X-size of the input array @param ny The Y-size of the input array @param hx The X-half-size of the kernel @param hy The Y-half-size of the kernel @return void @note No error checking in this internal function! FIXME: Changes to this function must also be made to cpl_mask_dilation_() */ /*----------------------------------------------------------------------------*/ static void cpl_mask_erosion_(cpl_binary * self, const cpl_binary * other, const cpl_binary * kernel, cpl_size nx, cpl_size ny, cpl_size hx, cpl_size hy, cpl_border_mode border) { #ifdef CPL_MASK_NOT if (hx <= CPL_MASK_HXW && hy == 0) { cpl_mask_erosion_1_0(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HXW && hy == 1) { cpl_mask_erosion_1_1(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HXW && hy == 2) { cpl_mask_erosion_1_2(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HXW && hy == 3) { cpl_mask_erosion_1_3(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HX2W && hy == 0) { cpl_mask_erosion_2_0(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HX2W && hy == 1) { cpl_mask_erosion_2_1(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HX2W && hy == 2) { cpl_mask_erosion_2_2(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HX2W && hy == 3) { cpl_mask_erosion_2_3(self, other, kernel, nx, ny, hx, hy, border); } else { cpl_mask_erosion_n_n(self, other, kernel, nx, ny, hx, hy, border); } #endif } /*----------------------------------------------------------------------------*/ /** @internal @brief Apply the dilation filter @param self The output binary 2D array to hold the filtered result @param other The input binary 2D array to filter @param kernel The input binary 2D kernel - rows padded with 0 to fit word @param nx The X-size of the input array @param ny The Y-size of the input array @param hx The X-half-size of the kernel @param hy The Y-half-size of the kernel @return void @note No error checking in this internal function! @see cpl_mask_erosion_() Modified from cpl_mask_erosion_(). FIXME: Changes to this function must also be made to cpl_mask_erosion_() */ /*----------------------------------------------------------------------------*/ static void cpl_mask_dilation_(cpl_binary * self, const cpl_binary * other, const cpl_binary * kernel, cpl_size nx, cpl_size ny, cpl_size hx, cpl_size hy, cpl_border_mode border) { #ifdef CPL_MASK_NOT if (hx <= CPL_MASK_HXW && hy == 0) { cpl_mask_dilation_1_0(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HXW && hy == 1) { cpl_mask_dilation_1_1(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HXW && hy == 2) { cpl_mask_dilation_1_2(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HXW && hy == 3) { cpl_mask_dilation_1_3(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HX2W && hy == 0) { cpl_mask_dilation_2_0(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HX2W && hy == 1) { cpl_mask_dilation_2_1(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HX2W && hy == 2) { cpl_mask_dilation_2_2(self, other, kernel, nx, ny, hx, hy, border); } else if (hx <= CPL_MASK_HX2W && hy == 3) { cpl_mask_dilation_2_3(self, other, kernel, nx, ny, hx, hy, border); } else { cpl_mask_dilation_n_n(self, other, kernel, nx, ny, hx, hy, border); } #endif } /*----------------------------------------------------------------------------*/ /** @internal @brief Apply the opening filter @param self The output binary 2D array to hold the filtered result @param other The input binary 2D array to filter @param kernel The input binary 2D kernel - rows padded with 0 to fit word @param nx The X-size of the input array @param ny The Y-size of the input array @param hx The X-half-size of the kernel @param hy The Y-half-size of the kernel @return void @note No error checking in this internal function! @note Fast handling of 3 x 3 (and 1 x 3) kernels @see cpl_mask_erosion_(), cpl_mask_dilation() */ /*----------------------------------------------------------------------------*/ static void cpl_mask_opening_(cpl_binary * self, const cpl_binary * other, const cpl_binary * kernel, cpl_size nx, cpl_size ny, cpl_size hx, cpl_size hy, cpl_border_mode border) { cpl_binary * middle = cpl_malloc((size_t)nx * (size_t)ny * sizeof(cpl_binary)); cpl_mask_erosion_(middle, other, kernel, nx, ny, hx, hy, border); cpl_mask_dilation_(self, middle, kernel, nx, ny, hx, hy, border); cpl_free(middle); } /*----------------------------------------------------------------------------*/ /** @internal @brief Apply the closing filter @param self The output binary 2D array to hold the filtered result @param other The input binary 2D array to filter @param kernel The input binary 2D kernel - rows padded with 0 to fit word @param nx The X-size of the input array @param ny The Y-size of the input array @param hx The X-half-size of the kernel @param hy The Y-half-size of the kernel @return void @note No error checking in this internal function! @note Fast handling of 3 x 3 (and 1 x 3) kernels @see cpl_mask_dilation_(), cpl_mask_erosion() */ /*----------------------------------------------------------------------------*/ static void cpl_mask_closing_(cpl_binary * self, const cpl_binary * other, const cpl_binary * kernel, cpl_size nx, cpl_size ny, cpl_size hx, cpl_size hy, cpl_border_mode border) { cpl_binary * middle = cpl_malloc((size_t)nx * (size_t)ny * sizeof(cpl_binary)); cpl_mask_dilation_(middle, other, kernel, nx, ny, hx, hy, border); cpl_mask_erosion_(self, middle, kernel, nx, ny, hx, hy, border); cpl_free(middle); } /*----------------------------------------------------------------------------*/ /** @internal @brief Fill a mask from a matrix @param kernel The matrix @param tol The non-zero tolerance @return the mask on success, or NULL on error @note This function is different from the similar one in cpl_image_filter.c. Example: matrix -> mask 1.0 0.0 1.0 1 0 1 0.0 0.0 0.0 0 0 0 0.0 0.0 0.0 0 0 0 Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ static cpl_mask * cpl_mask_new_from_matrix(const cpl_matrix * kernel, double tol) { const cpl_size mx = cpl_matrix_get_ncol(kernel); const cpl_size my = cpl_matrix_get_nrow(kernel); cpl_mask * self = cpl_mask_new(mx, my); cpl_size i, j; cpl_ensure(kernel != NULL, CPL_ERROR_NULL_INPUT, NULL); for (j = 0; j < my; j++) { for (i = 0; i < mx; i++) { const double value = cpl_matrix_get(kernel, my - j - 1, i); if (fabs(value) > tol) cpl_mask_set(self, i + 1, j + 1, CPL_BINARY_1); } } return self; } cpl-6.4.1/cplcore/cpl_image_resample.h0000644000460300003120000000620111611535010014612 00000000000000/* $Id: cpl_image_resample.h,v 1.19 2011-07-20 11:20:40 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-20 11:20:40 $ * $Revision: 1.19 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGE_RESAMPLE_H #define CPL_IMAGE_RESAMPLE_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ CPL_BEGIN_DECLS cpl_error_code cpl_image_warp_polynomial(cpl_image *, const cpl_image *, const cpl_polynomial *, const cpl_polynomial *, const cpl_vector *, double, const cpl_vector *, double); cpl_error_code cpl_image_warp(cpl_image *, const cpl_image *, const cpl_image *, const cpl_image *, const cpl_vector *, double, const cpl_vector *, double); cpl_error_code cpl_image_fill_jacobian_polynomial(cpl_image *, const cpl_polynomial *poly_x, const cpl_polynomial *poly_y); cpl_error_code cpl_image_fill_jacobian(cpl_image *, const cpl_image *deltax, const cpl_image *deltay); cpl_image *cpl_image_extract_subsample(const cpl_image *, cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_image *cpl_image_rebin(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; double cpl_image_get_interpolated(const cpl_image *, double, double, const cpl_vector *, double, const cpl_vector *, double, double *); CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_image_defs.h0000644000460300003120000000442211611313247013734 00000000000000/* $Id: cpl_image_defs.h,v 1.20 2011-07-19 14:37:27 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-19 14:37:27 $ * $Revision: 1.20 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGE_DEFS_H #define CPL_IMAGE_DEFS_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image.h" #include "cpl_type.h" #include "cpl_mask.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ #define CPL_CLASS_NONE 0 #define CPL_CLASS_DOUBLE 1 #define CPL_CLASS_FLOAT 2 #define CPL_CLASS_INT 3 #define CPL_CLASS_DOUBLE_COMPLEX 4 #define CPL_CLASS_FLOAT_COMPLEX 5 /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ struct _cpl_image_ { /* Size of the image in x and y */ cpl_size nx, ny; /* Type of the pixels used for the cpl_image */ cpl_type type; /* Pointer to pixel buffer as a 1d buffer */ void * pixels; /* Bad Pixels mask */ cpl_mask * bpm; }; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_matrix_impl.h0000644000460300003120000000403012212064637014175 00000000000000/* $Id: cpl_matrix_impl.h,v 1.8 2013-09-05 11:23:11 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-09-05 11:23:11 $ * $Revision: 1.8 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_MATRIX_IMPL_H #define CPL_MATRIX_IMPL_H #include "cpl_matrix.h" CPL_BEGIN_DECLS cpl_error_code cpl_matrix_product_normal(cpl_matrix *, const cpl_matrix *); cpl_matrix * cpl_matrix_product_normal_create(const cpl_matrix *) CPL_ATTR_ALLOC; cpl_error_code cpl_matrix_solve_spd(cpl_matrix *, cpl_matrix *); cpl_error_code cpl_matrix_product(cpl_matrix *, const cpl_matrix *, const cpl_matrix *); cpl_error_code cpl_matrix_product_transpose(cpl_matrix *, const cpl_matrix *, const cpl_matrix *); cpl_error_code cpl_matrix_product_bilinear(cpl_matrix *, const cpl_matrix *, const cpl_matrix *); cpl_error_code cpl_matrix_solve_chol_transpose(const cpl_matrix *, cpl_matrix *); CPL_END_DECLS #endif /* end of cpl_matrix_impl.h */ cpl-6.4.1/cplcore/cpl_image_io.c0000644000460300003120000034550512253611520013425 00000000000000/* $Id: cpl_image_io.c,v 1.245 2013-10-14 13:33:01 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-10-14 13:33:01 $ * $Revision: 1.245 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image_io_impl.h" #include "cpl_error_impl.h" #include "cpl_memory.h" #include "cpl_propertylist_impl.h" #include "cpl_mask_defs.h" #include "cpl_io_fits.h" #include "cpl_cfitsio.h" #include "cpl_image_bpm.h" #include "cpl_image_defs.h" #include #include #include #include #include #include #include #include #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define CPL_IMAGE_IO_GET_PIXELS 1 #define CPL_IMAGE_IO_SET_BADPIXEL 2 #define CPL_IMAGE_IO_GET 3 #define CPL_IMAGE_IO_SET 4 #define CPL_IMAGE_IO_RE_IM 5 #define CPL_IMAGE_IO_RE 6 #define CPL_IMAGE_IO_IM 7 #define CPL_IMAGE_IO_ABS_ARG 8 #define CPL_IMAGE_IO_ABS 9 #define CPL_IMAGE_IO_ARG 10 /* Needed for cpl_image_floodfill() */ #define FFSTACK_MAXLINES 10 #define FFSTACK_STACKSZ(IMAGE) (FFSTACK_MAXLINES * IMAGE->ny) #define FFSTACK_BYTES(IMAGE) \ ((size_t)FFSTACK_STACKSZ(IMAGE) * 4 * sizeof(cpl_size)) /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_image_floodfill(cpl_image *, void *, cpl_size, cpl_size, cpl_size); static cpl_image * cpl_image_load_one(const char *, cpl_type, cpl_size, cpl_size, cpl_boolean, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_io_body.h" #undef CPL_CLASS /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Allocate an image structure and pixel buffer for a image. @param nx Size in x (the number of columns) @param ny Size in y (the number of rows) @param type The pixel type @return 1 newly allocated cpl_image or NULL in case of an error Allocates space for the cpl_image structure and sets the dimensions and type of pixel data. The pixel buffer is allocated and initialised to zero. The pixel array will contain nx*ny values being the image pixels from the lower left to the upper right line by line. Supported pixel types are CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT_COMPLEX and CPL_TYPE_DOUBLE_COMPLEX. The returned cpl_image must be deallocated using cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if nx or ny is non-positive - CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_new(cpl_size nx, cpl_size ny, cpl_type type) { cpl_image * self = cpl_image_wrap_(nx, ny, type, NULL); if (self == NULL) (void)cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @brief Create an image using an existing pixel buffer of the specified type @param nx Size in x (the number of columns) @param ny Size in y (the number of rows) @param type Pixel type @param pixels Pixel data of the specified type @return 1 newly allocated cpl_image or NULL on error @see cpl_image_new() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if nx or ny is non-positive or their product is too big - CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_wrap(cpl_size nx, cpl_size ny, cpl_type type, void * pixels) { cpl_image * self; cpl_ensure(pixels != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_image_wrap_(nx, ny, type, pixels); if (self == NULL) (void)cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create a double image using an existing pixel buffer. @param nx Size in x (the number of columns) @param ny Size in y (the number of rows) @param pixels double * pixel data @return 1 newly allocated cpl_image or NULL in case of an error @see cpl_image_new The pixel array is set to point to that of the argument. The pixel array must contain nx*ny doubles. The allocated image must be deallocated with cpl_image_unwrap(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if nx or ny is non-positive or zero. */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_wrap_double(cpl_size nx, cpl_size ny, double * pixels) { cpl_image * self; cpl_ensure(pixels != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_image_wrap_(nx, ny, CPL_TYPE_DOUBLE, pixels); if (self == NULL) (void)cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create a float image using an existing pixel buffer. @param nx Size in x (the number of columns) @param ny Size in y (the number of rows) @param pixels float * pixel data. @return 1 newly allocated cpl_image or NULL on error @see cpl_image_wrap_double() */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_wrap_float(cpl_size nx, cpl_size ny, float * pixels) { cpl_image * self; cpl_ensure(pixels != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_image_wrap_(nx, ny, CPL_TYPE_FLOAT, pixels); if (self == NULL) (void)cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create a double complex image using an existing pixel buffer. @param nx Size in x (the number of columns) @param ny Size in y (the number of rows) @param pixels double complex * pixel data. @return 1 newly allocated cpl_image or NULL on error @see cpl_image_wrap_double() @note This function is available iff the application includes complex.h */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_wrap_double_complex(cpl_size nx, cpl_size ny, double complex * pixels) { cpl_image * self; cpl_ensure(pixels != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_image_wrap_(nx, ny, CPL_TYPE_DOUBLE_COMPLEX, pixels); if (self == NULL) (void)cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create a float complex image using an existing pixel buffer. @param nx Size in x (the number of columns) @param ny Size in y (the number of rows) @param pixels float complex * pixel data. @return 1 newly allocated cpl_image or NULL on error @see cpl_image_wrap_double_complex() */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_wrap_float_complex(cpl_size nx, cpl_size ny, float complex * pixels) { cpl_image * self; cpl_ensure(pixels != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_image_wrap_(nx, ny, CPL_TYPE_FLOAT_COMPLEX, pixels); if (self == NULL) (void)cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create an integer image using an existing pixel buffer. @param nx Size in x (the number of columns) @param ny Size in y (the number of rows) @param pixels int * pixel data. @return 1 newly allocated cpl_image or NULL on error @see cpl_image_wrap_double() */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_wrap_int( cpl_size nx, cpl_size ny, int * pixels) { cpl_image * self; cpl_ensure(pixels != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_image_wrap_(nx, ny, CPL_TYPE_INT, pixels); if (self == NULL) (void)cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Load an image from a FITS file. @param filename Name of the file to load from. @param im_type Type of the created image @param pnum Plane number in the Data Unit (0 for first) @param xtnum Extension number in the file (0 for primary HDU) @return 1 newly allocated image or NULL on error This function loads an image from a FITS file (NAXIS=2 or 3). The returned image has to be deallocated with cpl_image_delete(). The passed type for the output image can be : CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE or CPL_TYPE_INT. This type is there to specify the type of the cpl_image that will be created by the function. It is totally independant from the way the data are stored in the FITS file. A FITS image containg float pixels can be loaded as a cpl_image of type double. In this case, the user would specify CPL_TYPE_DOUBLE as im_type. Additionally, CPL_TYPE_UNSPECIFIED can be passed to inherit the FITS file type. The type of the image is defined based on the BITPIX information of the FITS file. After a successful call, the type of the created image can be accessed via cpl_image_get_type(). 'xtnum' specifies from which extension the image should be loaded. This could be 0 for the main data section (files without extension), or any number between 1 and N, where N is the number of extensions present in the file. The requested plane number runs from 0 to nplanes-1, where nplanes is the number of planes present in the requested data section. The created image has an empty bad pixel map. Examples: @code // Load as a float image the only image in FITS file (a.fits) without ext. // and NAXIS=2. cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_FLOAT, 0, 0); // Load as a double image the first plane in a FITS cube (a.fits) without // extension, NAXIS=3 and NAXIS3=128 cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_DOUBLE, 0, 0); // Load as an integer image the third plane in a FITS cube (a.fits) without // extension, NAXIS=3 and NAXIS3=128 cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_INT, 2, 0); // Load as a double image the first plane from extension 5 cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_DOUBLE, 0, 5); // Load as a double image the third plane in extension 5 cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_DOUBLE, 2, 5); @endcode Possible #_cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO if the file cannot be opened or does not exist - CPL_ERROR_BAD_FILE_FORMAT if the data cannot be loaded from the file - CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported - CPL_ERROR_ILLEGAL_INPUT if the passed extension number is negative - CPL_ERROR_DATA_NOT_FOUND if the specified extension has no image data */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_load(const char * filename, cpl_type im_type, cpl_size pnum, cpl_size xtnum) { cpl_image * self = cpl_image_load_one(filename, im_type, pnum, xtnum, CPL_FALSE, 0, 0, 0, 0); if (self == NULL) cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @internal @brief Load an image from a FITS file. @param filename Name of the file to load from. @param im_type Type of the created image @param pnum Plane number in the Data Unit (0 for first) @param xtnum Extension number in the file (0 for primary HDU) @param do_window True for (and only for) a windowed load @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return 1 newly allocated image or NULL on error @see cpl_image_load() */ /*----------------------------------------------------------------------------*/ static cpl_image * cpl_image_load_one(const char * filename, cpl_type im_type, cpl_size pnum, cpl_size xtnum, cpl_boolean do_window, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { int error = 0; int naxis = 0; /* May read from Data Unit w. NAXIS=[23] */ CPL_FITSIO_TYPE naxes[3] ={0, 0, 0}; cpl_type pix_type = im_type; fitsfile * fptr; cpl_image * self; /* FIXME: Version 3.24 of fits_open_diskfile() seg-faults on NULL. If ever fixed in CFITSIO, this check should be removed */ cpl_ensure(filename != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(xtnum >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); if (cpl_io_fits_open_diskfile(&fptr, filename, READONLY, &error)) { /* If the file did not exist: error = 104 (FILE_NOT_OPENED) */ /* If the file had permission 0: error = 104 (FILE_NOT_OPENED) */ /* If the file was empty: error = 107 (END_OF_FILE) */ /* If the file was a directory: error = 108 (READ_ERROR) */ (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_open_diskfile, "filename='%s', im_type=%u, pnum=%" CPL_SIZE_FORMAT ", xtnum=%" CPL_SIZE_FORMAT, filename, im_type, pnum, xtnum); return NULL; } self = cpl_image_load_(fptr, &naxis, naxes, &pix_type, filename, pnum, xtnum, do_window, llx, lly, urx, ury); if (cpl_io_fits_close_file(fptr, &error)) { cpl_image_delete(self); self = NULL; (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_close_file, "filename='%s', " "im_type=%u, pnum=%" CPL_SIZE_FORMAT ", xtnum=%" CPL_SIZE_FORMAT, filename, im_type, pnum, xtnum); } else if (self == NULL) { cpl_error_set_where_(); } return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Load an image from a FITS file. @param filename Name of the file to load from. @param im_type Type of the created image @param pnum Plane number in the Data Unit (0 for first) @param xtnum Extension number in the file. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return 1 newly allocated image or NULL on error @see cpl_image_load() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO if the file does not exist - CPL_ERROR_BAD_FILE_FORMAT if the data cannot be loaded from the file - CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported - CPL_ERROR_ILLEGAL_INPUT if the passed position is invalid */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_load_window(const char * filename, cpl_type im_type, cpl_size pnum, cpl_size xtnum, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { cpl_image * self = cpl_image_load_one(filename, im_type, pnum, xtnum, CPL_TRUE, llx, lly, urx, ury); if (self == NULL) cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create an int image from a mask @param mask the original mask @return 1 newly allocated cpl_image or NULL on error The created image is of type CPL_TYPE_INT. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_new_from_mask(const cpl_mask * mask) { const size_t nx = cpl_mask_get_size_x(mask); const size_t ny = cpl_mask_get_size_y(mask); const cpl_binary * data = cpl_mask_get_data_const(mask); cpl_image * out; int * pout; size_t i; cpl_ensure(mask, CPL_ERROR_NULL_INPUT, NULL); /* Create the INT image */ pout = (int*)cpl_malloc(nx * ny * sizeof(*pout)); out = cpl_image_wrap_int(nx, ny, pout); /* Fill the image */ for (i= 0; i < nx * ny; i++) { pout[i] = (data[i] == CPL_BINARY_0) ? 0 : 1; } return out; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Labelise a mask to differentiate different objects @param in mask to labelise @param nbobjs If non-NULL, number of objects found on success @return A newly allocated label image or NULL on error This function labelises all blobs in a mask. All 4-neighbour connected zones set to 1 in the input mask will end up in the returned integer image as zones where all pixels are set to the same (unique for this blob in this image) label. A non-recursive flood-fill is applied to label the zones. The flood-fill is dimensioned by the number of lines in the image, and the maximal number of lines possibly covered by a blob. The returned image must be deallocated with cpl_image_delete() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if the input mask is NULL */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_labelise_mask_create(const cpl_mask * in, cpl_size * nbobjs) { cpl_image * intimage; int * pio; cpl_size label = 1; /* The first label value */ const size_t nx = cpl_mask_get_size_x(in); const size_t ny = cpl_mask_get_size_y(in); const cpl_binary * pin = cpl_mask_get_data_const(in); size_t i, j; cpl_boolean has_data = CPL_TRUE; /* Duplicated body from cpl_image_new_from_mask() :-((((((((((((((((*/ /* Test entries */ cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, NULL); /* Create output integer image and initialise it with the input map */ intimage = cpl_image_new(nx, ny, CPL_TYPE_INT); pio = cpl_image_get_data_int(intimage); for (i = 0; i < nx * ny; i++) { if (pin[i] != CPL_BINARY_0) { pio[i] = -1; has_data = CPL_TRUE; } } if (has_data) { /* Now work on intimage */ /* Allocate temporary work-space for cpl_image_floodfill() */ void * fftemp = cpl_malloc(FFSTACK_BYTES(intimage)); for (j = 0; j < ny; j++, pio += nx) { for (i = 0; i < nx; i++) { /* Look up if unprocessed pixel */ if (pio[i] == -1) { /* Flood fill from this pixel with the assigned label */ cpl_image_floodfill(intimage, fftemp, i, j, label); label++; } } } cpl_free(fftemp); } if (nbobjs!=NULL) *nbobjs = label-1; return intimage; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the image type @param img a cpl_image object @return The image type or CPL_TYPE_INVALID on NULL input. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_type cpl_image_get_type(const cpl_image * img) { cpl_ensure(img, CPL_ERROR_NULL_INPUT, CPL_TYPE_INVALID); return img->type; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the image x size @param img a cpl_image object @return The image x size, or -1 on NULL input Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_image_get_size_x(const cpl_image * img) { cpl_ensure(img, CPL_ERROR_NULL_INPUT, -1); return img->nx; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the image y size @param img a cpl_image object @return The image y size, or -1 on NULL input Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_image_get_size_y(const cpl_image * img) { cpl_ensure(img, CPL_ERROR_NULL_INPUT, -1); return img->ny; } #define CPL_OPERATION CPL_IMAGE_IO_GET #define CPL_TYPE_RETURN double /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the value of a pixel at a given position @param image Input image. @param xpos Pixel x position (FITS convention, 1 for leftmost) @param ypos Pixel y position (FITS convention, 1 for lowest) @param pis_rejected 1 if the pixel is bad, 0 if good, negative on error @return The pixel value (cast to a double) or undefined if *pis_rejected The return value is defined if the pixel is not flagged as rejected, i. e. when *pis_rejected == 0. In case of an error, the #_cpl_error_code_ code is set. Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ACCESS_OUT_OF_RANGE if the passed position is not in the image - CPL_ERROR_INVALID_TYPE if the image pixel type is not supported */ /*----------------------------------------------------------------------------*/ double cpl_image_get(const cpl_image * image, cpl_size xpos, cpl_size ypos, int * pis_rejected) { double value; cpl_size pos; /* Check entries */ cpl_ensure(pis_rejected != NULL, CPL_ERROR_NULL_INPUT, -1.0); *pis_rejected = -1; cpl_ensure(image != NULL, CPL_ERROR_NULL_INPUT, -2.0); cpl_ensure(xpos >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE, -2.0); cpl_ensure(ypos >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE, -2.0); cpl_ensure(xpos <= image->nx, CPL_ERROR_ACCESS_OUT_OF_RANGE, -2.0); cpl_ensure(ypos <= image->ny, CPL_ERROR_ACCESS_OUT_OF_RANGE, -2.0); pos = (xpos - 1) + image->nx * (ypos - 1); /* Check the validity of image, xpos and ypos */ *pis_rejected = image->bpm != NULL && image->bpm->data[pos] != CPL_BINARY_0 ? 1 : 0; /* The pixel is flagged as rejected */ if (*pis_rejected) return 0.0; assert( image->pixels ); /* Get the value */ switch (image->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_io_body.h" #undef CPL_CLASS default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); value = -3.0; } return value; } #undef CPL_TYPE_RETURN #define CPL_TYPE_RETURN double complex /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the value of a complex pixel at a given position @param image Input complex image. @param xpos Pixel x position (FITS convention, 1 for leftmost) @param ypos Pixel y position (FITS convention, 1 for lowest) @param pis_rejected 1 if the pixel is bad, 0 if good, negative on error @return The pixel value (cast to a double complex) or undefined if *pis_rejected @see cpl_image_get() @note This function is available iff the application includes complex.h The return value is defined if the pixel is not flagged as rejected, i. e. when *pis_rejected == 0. In case of an error, the #_cpl_error_code_ code is set. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ACCESS_OUT_OF_RANGE if the passed position is not in the image */ /*----------------------------------------------------------------------------*/ double complex cpl_image_get_complex(const cpl_image * image, cpl_size xpos, cpl_size ypos, int * pis_rejected) { double complex value; cpl_size pos; /* Check entries */ cpl_ensure(pis_rejected != NULL, CPL_ERROR_NULL_INPUT, -1.0); *pis_rejected = -1; cpl_ensure(image != NULL, CPL_ERROR_NULL_INPUT, -1.0); cpl_ensure(xpos >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE, -2.0); cpl_ensure(ypos >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE, -2.0); cpl_ensure(xpos <= image->nx, CPL_ERROR_ACCESS_OUT_OF_RANGE, -2.0); cpl_ensure(ypos <= image->ny, CPL_ERROR_ACCESS_OUT_OF_RANGE, -2.0); pos = (xpos - 1) + image->nx * (ypos - 1); /* Check the validity of image, xpos and ypos */ *pis_rejected = image->bpm != NULL && image->bpm->data[pos] != CPL_BINARY_0 ? 1 : 0; /* The pixel is flagged as rejected */ if (*pis_rejected) return 0.0; assert( image->pixels ); /* Get the value */ switch (image->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_DOUBLE_COMPLEX #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT_COMPLEX #include "cpl_image_io_body.h" #undef CPL_CLASS default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); value = -3.0; } return value; } #undef CPL_OPERATION #undef CPL_TYPE_RETURN /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Split a complex image into its real and/or imaginary part(s) @param im_real Pre-allocated image to hold the real part, or @c NULL @param im_imag Pre-allocated image to hold the imaginary part, or @c NULL @param self Complex image to process @return CPL_ERROR_NONE or #_cpl_error_code_ on error @note At least one output image must be non-NULL. The images must match in size and precision Any bad pixels are also processed. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT If the input image or both output images are @c NULL - CPL_ERROR_INCOMPATIBLE_INPUT If the images have different sizes - CPL_ERROR_INVALID_TYPE If the input image is not of complex type - CPL_ERROR_TYPE_MISMATCH If the images have different precision */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_re_im(cpl_image * im_real, cpl_image * im_imag, const cpl_image * self) { cpl_error_code error; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(self->type & CPL_TYPE_COMPLEX, CPL_ERROR_INVALID_TYPE); if (im_real != NULL && im_imag != NULL) { cpl_ensure_code(self->nx == im_real->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == im_real->ny, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->nx == im_imag->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == im_imag->ny, CPL_ERROR_INCOMPATIBLE_INPUT); switch (self->type) { case CPL_TYPE_DOUBLE_COMPLEX: error = cpl_image_fill_re_im_double(im_real, im_imag, self); break; case CPL_TYPE_FLOAT_COMPLEX: error = cpl_image_fill_re_im_float(im_real, im_imag, self); break; default: error = CPL_ERROR_INVALID_TYPE; } } else if (im_real != NULL) { cpl_ensure_code(self->nx == im_real->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == im_real->ny, CPL_ERROR_INCOMPATIBLE_INPUT); switch (self->type) { case CPL_TYPE_DOUBLE_COMPLEX: error = cpl_image_fill_re_double(im_real, self); break; case CPL_TYPE_FLOAT_COMPLEX: error = cpl_image_fill_re_float(im_real, self); break; default: error = CPL_ERROR_INVALID_TYPE; } } else if (im_imag != NULL) { cpl_ensure_code(self->nx == im_imag->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == im_imag->ny, CPL_ERROR_INCOMPATIBLE_INPUT); switch (self->type) { case CPL_TYPE_DOUBLE_COMPLEX: error = cpl_image_fill_im_double(im_imag, self); break; case CPL_TYPE_FLOAT_COMPLEX: error = cpl_image_fill_im_float(im_imag, self); break; default: error = CPL_ERROR_INVALID_TYPE; } } else { error = CPL_ERROR_NULL_INPUT; } return error ? cpl_error_set_(error) : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Split a complex image into its absolute and argument part(s) @param im_abs Pre-allocated image to hold the absolute part, or @c NULL @param im_arg Pre-allocated image to hold the argument part, or @c NULL @param self Complex image to process @return CPL_ERROR_NONE or #_cpl_error_code_ on error @note At least one output image must be non-NULL. The images must match in size and precision Any bad pixels are also processed. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT If the input image or both output images are @c NULL - CPL_ERROR_INCOMPATIBLE_INPUT If the images have different sizes - CPL_ERROR_INVALID_TYPE If the input image is not of complex type - CPL_ERROR_TYPE_MISMATCH If the images have different precision */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_abs_arg(cpl_image * im_abs, cpl_image * im_arg, const cpl_image * self) { cpl_error_code error; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(self->type & CPL_TYPE_COMPLEX, CPL_ERROR_INVALID_TYPE); if (im_abs != NULL && im_arg != NULL) { cpl_ensure_code(self->nx == im_abs->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == im_abs->ny, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->nx == im_arg->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == im_arg->ny, CPL_ERROR_INCOMPATIBLE_INPUT); switch (self->type) { case CPL_TYPE_DOUBLE_COMPLEX: error = cpl_image_fill_abs_arg_double(im_abs, im_arg, self); break; case CPL_TYPE_FLOAT_COMPLEX: error = cpl_image_fill_abs_arg_float(im_abs, im_arg, self); break; default: error = CPL_ERROR_INVALID_TYPE; } } else if (im_abs != NULL) { cpl_ensure_code(self->nx == im_abs->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == im_abs->ny, CPL_ERROR_INCOMPATIBLE_INPUT); switch (self->type) { case CPL_TYPE_DOUBLE_COMPLEX: error = cpl_image_fill_abs_double(im_abs, self); break; case CPL_TYPE_FLOAT_COMPLEX: error = cpl_image_fill_abs_float(im_abs, self); break; default: error = CPL_ERROR_INVALID_TYPE; } } else if (im_arg != NULL) { cpl_ensure_code(self->nx == im_arg->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == im_arg->ny, CPL_ERROR_INCOMPATIBLE_INPUT); switch (self->type) { case CPL_TYPE_DOUBLE_COMPLEX: error = cpl_image_fill_arg_double(im_arg, self); break; case CPL_TYPE_FLOAT_COMPLEX: error = cpl_image_fill_arg_float(im_arg, self); break; default: error = CPL_ERROR_INVALID_TYPE; } } else { error = CPL_ERROR_NULL_INPUT; } return error ? cpl_error_set_(error) : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Get the real part of the pixels from a complex image @param self Pre-allocated non-complex image to hold the result @param other The complex image to process @return CPL_ERROR_NONE or #_cpl_error_code_ on error @deprecated Replace this call with cpl_image_fill_re_im() @see cpl_image_fill_re_im() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_real(cpl_image * self, const cpl_image * other) { const cpl_error_code error = cpl_image_fill_re_im(self, NULL, other); return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Get the imaginary part of the pixels from a complex image @param self Pre-allocated non-complex image to hold the result @param other The complex image to process @return CPL_ERROR_NONE or #_cpl_error_code_ on error @deprecated Replace this call with cpl_image_fill_re_im() @see cpl_image_fill_re_im() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_imag(cpl_image * self, const cpl_image * other) { const cpl_error_code error = cpl_image_fill_re_im(NULL, self, other); return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Get the absolute values of the pixels in a complex image @param self Pre-allocated non-complex image to hold the result @param other The complex image to process @return CPL_ERROR_NONE or #_cpl_error_code_ on error @deprecated Replace this call with cpl_image_fill_abs_arg() @see cpl_image_fill_abs_arg() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_mod(cpl_image * self, const cpl_image * other) { const cpl_error_code error = cpl_image_fill_abs_arg(self, NULL, other); return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Get the phase of the pixels in a complex image @param self Pre-allocated non-complex image to hold the result @param other The complex image to process @return CPL_ERROR_NONE or #_cpl_error_code_ on error @deprecated Replace this call with cpl_image_fill_abs_arg() @see cpl_image_fill_abs_arg() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_phase(cpl_image * self, const cpl_image * other) { const cpl_error_code error = cpl_image_fill_abs_arg(NULL, self, other); return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Complex conjugate the pixels in a complex image @param self Pre-allocated complex image to hold the result @param other The complex image to conjugate, may equal self @return CPL_ERROR_NONE or #_cpl_error_code_ on error @note The two images must match in size and precision Any bad pixels are also conjugated. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT If an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT If the images have different sizes - CPL_ERROR_INVALID_TYPE If an input image is not of complex type - CPL_ERROR_TYPE_MISMATCH If the images have different precision */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_conjugate(cpl_image * self, const cpl_image * other) { cpl_error_code error; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(other != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(self->nx == other->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == other->ny, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->type == other->type, CPL_ERROR_TYPE_MISMATCH); switch (self->type) { case CPL_TYPE_DOUBLE_COMPLEX: error = cpl_image_conjugate_double(self, other); break; case CPL_TYPE_FLOAT_COMPLEX: error = cpl_image_conjugate_float(self, other); break; default: error = CPL_ERROR_INVALID_TYPE; } return error ? cpl_error_set_(error) : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Fill an image window with a constant @param self The image to fill @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Specifies the window position @param ury Specifies the window position @param value The value to fill with @return The #_cpl_error_code_ or CPL_ERROR_NONE @note Any bad pixels are accepted Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the specified window is not valid */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_window(cpl_image * self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, double value) { size_t i, j; cpl_error_code code = CPL_ERROR_NONE; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(llx >= 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(lly >= 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(llx <= urx, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(lly <= ury, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(urx <= self->nx, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(ury <= self->ny, CPL_ERROR_ILLEGAL_INPUT); for (j = (size_t)lly; j <= (size_t)ury; j++) { for (i = (size_t)llx; i <= (size_t)urx; i++) { /* FIXME: Access pixel buffer directly and clear bad pixels */ code = cpl_image_set(self, (cpl_size)i, (cpl_size)j, value); if (code) break; } if (code) break; } return code ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Fill an image of type integer with a constant @param self The image to fill @param value The value to fill with @return The #_cpl_error_code_ or CPL_ERROR_NONE @note Any bad pixels are accepted Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_TYPE_MISMATCH if the image type is not int */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_int(cpl_image * self, int value) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(self->type == CPL_TYPE_INT, CPL_ERROR_TYPE_MISMATCH); if (value == 0) { (void)memset(self->pixels, 0, (size_t)self->nx * (size_t)self->ny * sizeof(int)); } else { size_t i = (size_t)(self->nx * self->ny); do { ((int*)self->pixels)[--i] = value; } while (i); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Extract the real part image of a complex image @param image input image @return a newly allocated real image or NULL on error @see cpl_image_fill_real() Image can be CPL_TYPE_FLOAT_COMPLEX or CPL_TYPE_DOUBLE_COMPLEX. The returned image must be deallocated using cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if the input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is non-complex */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_extract_real(const cpl_image * image) { cpl_image * self; cpl_ensure(image != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_image_new(image->nx, image->ny, image->type & ~CPL_TYPE_COMPLEX); if (cpl_image_fill_real(self, image)) { (void)cpl_error_set_where_(); cpl_image_delete(self); self = NULL; } return self; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Extract the imaginary part image of a complex image @param image input image @return a newly allocated imaginary image or NULL on error @see cpl_image_fill_imag() Image can be CPL_TYPE_FLOAT_COMPLEX or CPL_TYPE_DOUBLE_COMPLEX. The returned image must be deallocated using cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if the input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is non-complex */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_extract_imag(const cpl_image * image) { cpl_image * self; cpl_ensure(image != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_image_new(image->nx, image->ny, image->type & ~CPL_TYPE_COMPLEX); if (cpl_image_fill_imag(self, image)) { (void)cpl_error_set_where_(); cpl_image_delete(self); self = NULL; } return self; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Extract the absolute part (modulus) of a complex image @param image input image @return a newly allocated imaginary image or NULL on error @see cpl_image_fill_mod() Image can be CPL_TYPE_FLOAT_COMPLEX or CPL_TYPE_DOUBLE_COMPLEX. The returned image must be deallocated using cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if the input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is non-complex */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_extract_mod(const cpl_image * image) { cpl_image * self; cpl_ensure(image != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_image_new(image->nx, image->ny, image->type & ~CPL_TYPE_COMPLEX); if (cpl_image_fill_mod(self, image)) { (void)cpl_error_set_where_(); cpl_image_delete(self); self = NULL; } return self; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Extract the argument (phase) of a complex image @param image input image @return a newly allocated imaginary image or NULL on error @see cpl_image_fill_phase() Image can be CPL_TYPE_FLOAT_COMPLEX or CPL_TYPE_DOUBLE_COMPLEX. The returned image must be deallocated using cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if the input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is non-complex */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_extract_phase(const cpl_image * image) { cpl_image * self; cpl_ensure(image != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_image_new(image->nx, image->ny, image->type & ~CPL_TYPE_COMPLEX); if (cpl_image_fill_phase(self, image)) { (void)cpl_error_set_where_(); cpl_image_delete(self); self = NULL; } return self; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_IO_SET /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Set the pixel at the given position to the given value @param image input image. @param xpos Pixel x position (FITS convention, 1 for leftmost) @param ypos Pixel y position (FITS convention, 1 for lowest) @param value New pixel value @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT, CPL_TYPE_DOUBLE. If the pixel is flagged as rejected, this flag is removed. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ACCESS_OUT_OF_RANGE if the passed position is not in the image - CPL_ERROR_INVALID_TYPE if the image pixel type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_set(cpl_image * image, cpl_size xpos, cpl_size ypos, double value) { cpl_size pos; /* Check entries */ cpl_ensure_code(image != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(xpos >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(ypos >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(xpos <= image->nx, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(ypos <= image->ny, CPL_ERROR_ACCESS_OUT_OF_RANGE); assert( image->pixels ); pos = (xpos - 1) + image->nx * (ypos - 1); /* Get the value */ switch (image->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_io_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return cpl_image_accept(image, xpos, ypos) ? cpl_error_set_where_() : CPL_ERROR_NONE; } #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Set the pixel at the given position to the given complex value @param image input image. @param xpos Pixel x position (FITS convention, 1 for leftmost) @param ypos Pixel y position (FITS convention, 1 for lowest) @param value New pixel value @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_image_set() @note This function is available iff the application includes complex.h Images can be CPL_TYPE_FLOAT_COMPLEX or CPL_TYPE_DOUBLE_COMPLEX. If the pixel is flagged as rejected, this flag is removed. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ACCESS_OUT_OF_RANGE if the passed position is not in the image - CPL_ERROR_INVALID_TYPE if the image pixel type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_set_complex(cpl_image * image, cpl_size xpos, cpl_size ypos, double complex value) { cpl_size pos; /* Check entries */ cpl_ensure_code(image != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(xpos >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(ypos >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(xpos <= image->nx, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(ypos <= image->ny, CPL_ERROR_ACCESS_OUT_OF_RANGE); /* cpl_ensure_code(image -> type & CPL_TYPE_COMPLEX, CPL_ERROR_INVALID_TYPE);*/ assert( image->pixels ); pos = (xpos - 1) + image->nx * (ypos - 1); if (image-> type == CPL_TYPE_FLOAT_COMPLEX) { float complex * pi = (float complex *)image->pixels; pi[pos] = (float complex)value; } else { double complex * pi = (double complex *)image->pixels; pi[pos] = value; } return cpl_image_accept(image, xpos, ypos) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Gets the pixel data. @param img Image to query. @return A pointer to the image pixel data or NULL on error. The returned pointer refers to already allocated data. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ void * cpl_image_get_data(cpl_image * img) { cpl_ensure(img, CPL_ERROR_NULL_INPUT, NULL); return img->pixels; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Gets the pixel data. @param img Image to query. @return A pointer to the image pixel data or NULL on error. @see cpl_image_get_data */ /*----------------------------------------------------------------------------*/ const void * cpl_image_get_data_const(const cpl_image * img) { cpl_ensure(img, CPL_ERROR_NULL_INPUT, NULL); return img->pixels; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Replace the bad pixel map of the image @param self Image to modfify @param bpm Bad Pixel Map (BPM) to set, replacing the old one, or NULL @return A pointer to the old mask of bad pixels, or NULL @note NULL is returned if the image had no bad pixel map, while a non-NULL returned mask must be deallocated by the caller using cpl_mask_delete(). @see cpl_image_get_bpm_const() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if self is NULL */ /*----------------------------------------------------------------------------*/ cpl_mask * cpl_image_set_bpm(cpl_image * self, cpl_mask * bpm) { cpl_mask * oldbpm; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); oldbpm = self->bpm; self->bpm = bpm; return oldbpm; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Remove the bad pixel map from the image @param self image to process @return A pointer to the cpl_mask of bad pixels, or NULL @note NULL is returned if the image has no bad pixel map @note The returned mask must be deallocated using cpl_mask_delete(). @see cpl_image_set_bpm() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_mask * cpl_image_unset_bpm(cpl_image * self) { cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); /* Cannot fail now */ return cpl_image_set_bpm(self, NULL); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Gets the bad pixels map @param img Image to query. @return A pointer to the mask identifying the bad pixels or NULL. The returned pointer refers to already allocated data. If the bad pixel map is NULL, an empty one is created. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_mask * cpl_image_get_bpm(cpl_image * img) { cpl_ensure(img != NULL, CPL_ERROR_NULL_INPUT, NULL); if (img->bpm == NULL) img->bpm = cpl_mask_new(img->nx, img->ny); return img->bpm; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Gets the bad pixels map @param img Image to query. @return A pointer to the mask identifying the bad pixels or NULL. @note NULL is returned if the image has no bad pixel map @see cpl_image_get_bpm Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ const cpl_mask * cpl_image_get_bpm_const(const cpl_image * img) { cpl_ensure(img != NULL, CPL_ERROR_NULL_INPUT, NULL); return img->bpm; } #define CPL_OPERATION CPL_IMAGE_IO_GET_PIXELS #define CPL_CONST /* const */ /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the data as a double array @param img a cpl_image object @return pointer to the double data array or NULL on error. The returned pointer refers to already allocated data. The pixels are stored in a one dimensional array. The pixel value PIXVAL at position (i, j) in the image - (0, 0) is the lower left pixel, i gives the column position from left to right, j gives the row position from bottom to top - is given by : PIXVAL = array[i + j*nx]; where nx is the x size of the image and array is the data array returned by this function. array can be used to access or modify the pixel value in the image. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_TYPE_MISMATCH if the passed image type is not double */ /*----------------------------------------------------------------------------*/ double * cpl_image_get_data_double(cpl_image * img) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_io_body.h" #undef CPL_CLASS } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the data as a float array @param img a cpl_image object @return pointer to the float data array or NULL on error. @see cpl_image_get_data_double() */ /*----------------------------------------------------------------------------*/ float * cpl_image_get_data_float(cpl_image * img) { #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_io_body.h" #undef CPL_CLASS } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the data as a double complex array @param img a cpl_image object @return pointer to the double complex data array or NULL on error. @see cpl_image_get_data_double() @note This function is available iff the application includes complex.h */ /*----------------------------------------------------------------------------*/ double complex * cpl_image_get_data_double_complex(cpl_image * img) { #define CPL_CLASS CPL_CLASS_DOUBLE_COMPLEX #include "cpl_image_io_body.h" #undef CPL_CLASS } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the data as a float complex array @param img a cpl_image object @return pointer to the float complex data array or NULL on error. @see cpl_image_get_data_double_complex() */ /*----------------------------------------------------------------------------*/ float complex * cpl_image_get_data_float_complex(cpl_image * img) { #define CPL_CLASS CPL_CLASS_FLOAT_COMPLEX #include "cpl_image_io_body.h" #undef CPL_CLASS } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the data as a integer array @param img a cpl_image object @return pointer to the integer data array or NULL on error. @see cpl_image_get_data_double() */ /*----------------------------------------------------------------------------*/ int * cpl_image_get_data_int(cpl_image * img) { #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_io_body.h" #undef CPL_CLASS } #undef CPL_CONST #define CPL_CONST const /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the data as a double array @param img a cpl_image object @return pointer to the double data array or NULL on error. @see cpl_image_get_data_double */ /*----------------------------------------------------------------------------*/ const double * cpl_image_get_data_double_const(const cpl_image * img) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_io_body.h" #undef CPL_CLASS } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the data as a float array @param img a cpl_image object @return pointer to the float data array or NULL on error. @see cpl_image_get_data_float() */ /*----------------------------------------------------------------------------*/ const float * cpl_image_get_data_float_const(const cpl_image * img) { #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_io_body.h" #undef CPL_CLASS } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the data as a double complex array @param img a cpl_image object @return pointer to the double complex data array or NULL on error. @see cpl_image_get_data_double_complex() */ /*----------------------------------------------------------------------------*/ const double complex * cpl_image_get_data_double_complex_const(const cpl_image * img) { #define CPL_CLASS CPL_CLASS_DOUBLE_COMPLEX #include "cpl_image_io_body.h" #undef CPL_CLASS } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the data as a float complex array @param img a cpl_image object @return pointer to the float complex data array or NULL on error. @see cpl_image_get_data_double_complex() */ /*----------------------------------------------------------------------------*/ const float complex * cpl_image_get_data_float_complex_const(const cpl_image * img) { #define CPL_CLASS CPL_CLASS_FLOAT_COMPLEX #include "cpl_image_io_body.h" #undef CPL_CLASS } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Get the data as a integer array @param img a cpl_image object @return pointer to the integer data array or NULL on error. @see cpl_image_get_data_int() */ /*----------------------------------------------------------------------------*/ const int * cpl_image_get_data_int_const(const cpl_image * img) { #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_io_body.h" #undef CPL_CLASS } #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Free memory associated to an cpl_image object. @param d Image to destroy. @return void Frees all memory associated with a cpl_image. If the passed image is NULL, the function returns without doing anything. */ /*----------------------------------------------------------------------------*/ void cpl_image_delete(cpl_image * d) { if (d == NULL) return; /* Delete pixels and bad pixel map */ cpl_free(d->pixels); cpl_mask_delete(d->bpm); cpl_free(d); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Free memory associated to an cpl_image object, but the pixel buffer. @param d Image to destroy. @return A pointer to the data array or NULL if the input is NULL. Frees all memory associated to an cpl_image, except the pixel buffer. cpl_image_unwrap() is provided for images that are constructed by passing a pixel buffer to one of cpl_image_wrap_{double,float,int}(). @note The pixel buffer must subsequently be deallocated. Failure to do so will result in a memory leak. */ /*----------------------------------------------------------------------------*/ void * cpl_image_unwrap(cpl_image * d) { void * data; if (d == NULL) return NULL; /* Delete bad pixel map */ cpl_mask_delete(d->bpm); data = (void *) d->pixels; cpl_free(d); return data; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Copy an image. @param src Source image. @return 1 newly allocated image, or NULL on error. Copy an image into a new image object. The pixels and the bad pixel map are also copied. The returned image must be deallocated using cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_duplicate(const cpl_image * src) { cpl_image * self; cpl_ensure(src != NULL, CPL_ERROR_NULL_INPUT, NULL); /* Allocate and copy the image properties into a new image - must update all (one or two) non-NULL pointer members */ self = memcpy(cpl_malloc(sizeof(cpl_image)), src, sizeof(cpl_image)); /* 1: Allocate and copy the pixel buffer */ self->pixels = cpl_malloc((size_t)src->nx * (size_t)src->ny * cpl_type_get_sizeof(src->type)); (void)memcpy(self->pixels, src->pixels, (size_t)src->nx * (size_t)src->ny * cpl_type_get_sizeof(src->type)); /* 2: Duplicate the bad pixel map, if any */ if (src->bpm != NULL) self->bpm = cpl_mask_duplicate(src->bpm); return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Convert a cpl_image to a given type @param self The image to convert @param type The destination type @return the newly allocated cpl_image or NULL on error Casting to non-complex types is only supported for non-complex types. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the passed type is invalid - CPL_ERROR_TYPE_MISMATCH if the passed image type is complex and requested casting type is non-complex. - CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_cast(const cpl_image * self, cpl_type type) { cpl_image * new_im; const float * pfi; float * pfo; const double * pdi; double * pdo; const int * pii; int * pio; const float complex * pfci; float complex * pfco; const double complex * pdci; double complex * pdco; const size_t nxy = (size_t)(cpl_image_get_size_x(self) * cpl_image_get_size_y(self)); size_t i; /* Check entries */ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(type != CPL_TYPE_INVALID, CPL_ERROR_ILLEGAL_INPUT, NULL); /* The image has already the destination type */ if (self->type == type) return cpl_image_duplicate(self); /* Switch on the requested type */ switch (type) { case CPL_TYPE_FLOAT: pfo = (float*)cpl_malloc(nxy * sizeof(*pfo)); new_im = cpl_image_wrap_(self->nx, self->ny, type, pfo); /* Switch on the original type */ switch(self->type) { case CPL_TYPE_DOUBLE: pdi = (const double*)self->pixels; for (i = 0; i < nxy; i++) pfo[i] = (float)pdi[i]; break; case CPL_TYPE_INT: pii = (const int*)self->pixels; for (i = 0; i < nxy; i++) pfo[i] = (float)pii[i]; break; case CPL_TYPE_FLOAT_COMPLEX: case CPL_TYPE_DOUBLE_COMPLEX: cpl_image_delete(new_im); (void)cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; default: cpl_image_delete(new_im); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } break; case CPL_TYPE_DOUBLE: pdo = (double*)cpl_malloc(nxy * sizeof(*pdo)); new_im = cpl_image_wrap_(self->nx, self->ny, type, pdo); /* Switch on the original type */ switch(self->type) { case CPL_TYPE_FLOAT: pfi = (const float*)self->pixels; for (i = 0; i < nxy; i++) pdo[i] = (double)pfi[i]; break; case CPL_TYPE_INT: pii = (const int*)self->pixels; for (i = 0; i < nxy; i++) pdo[i] = (double)pii[i]; break; case CPL_TYPE_FLOAT_COMPLEX: case CPL_TYPE_DOUBLE_COMPLEX: cpl_image_delete(new_im); (void)cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; default: cpl_image_delete(new_im); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } break; case CPL_TYPE_INT: pio = (int*)cpl_malloc(nxy * sizeof(*pio)); new_im = cpl_image_wrap_(self->nx, self->ny, type, pio); /* Switch on the original type */ switch(self->type) { case CPL_TYPE_FLOAT: pfi = (const float*)self->pixels; for (i = 0; i < nxy; i++) pio[i] = (int)pfi[i]; break; case CPL_TYPE_DOUBLE: pdi = (const double*)self->pixels; for (i = 0; i < nxy; i++) pio[i] = (int)pdi[i]; break; case CPL_TYPE_FLOAT_COMPLEX: case CPL_TYPE_DOUBLE_COMPLEX: cpl_image_delete(new_im); (void)cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; default: cpl_image_delete(new_im); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } break; case CPL_TYPE_FLOAT_COMPLEX: pfco = (float complex*)cpl_malloc(nxy * sizeof(*pfco)); new_im = cpl_image_wrap_(self->nx, self->ny, type, pfco); /* Switch on the original type */ switch(self->type) { case CPL_TYPE_DOUBLE_COMPLEX: pdci = (const double complex *)self->pixels; for (i = 0; i < nxy; i++) pfco[i] = (float complex)pdci[i]; break; case CPL_TYPE_INT: pii = (const int *)self->pixels; for (i = 0; i < nxy; i++) pfco[i] = (float complex)pii[i]; break; case CPL_TYPE_FLOAT: pfi = (const float*)self->pixels; for (i = 0; i < nxy; i++) pfco[i] = (float complex)pfi[i]; break; case CPL_TYPE_DOUBLE: pdi = (const double*)self->pixels; for (i = 0; i < nxy; i++) pfco[i] = (float complex)pdi[i]; break; default: cpl_image_delete(new_im); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } break; case CPL_TYPE_DOUBLE_COMPLEX: pdco = (double complex*)cpl_malloc(nxy * sizeof(*pdco)); new_im = cpl_image_wrap_(self->nx, self->ny, type, pdco); /* Switch on the original type */ switch(self->type) { case CPL_TYPE_FLOAT_COMPLEX: pfci = (const float complex*)self->pixels; for (i = 0; i < nxy; i++) pdco[i] = (double complex)pfci[i]; break; case CPL_TYPE_INT: pii = (const int *)self->pixels; for (i = 0; i < nxy; i++) pdco[i] = (double complex)pii[i]; break; case CPL_TYPE_FLOAT: pfi = (const float*)self->pixels; for (i = 0; i < nxy; i++) pdco[i] = (double complex)pfi[i]; break; case CPL_TYPE_DOUBLE: pdi = (const double*)self->pixels; for (i = 0; i < nxy; i++) pdco[i] = (double complex)pdi[i]; break; default: cpl_image_delete(new_im); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } break; default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } /* Bad pixel map */ if (self->bpm != NULL) new_im->bpm = cpl_mask_duplicate(self->bpm); return new_im; } #define CPL_OPERATION CPL_IMAGE_IO_SET_BADPIXEL /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Set the bad pixels in an image to a fixed value @param im The image to modify. @param a The fixed value @return the #_cpl_error_code_ or CPL_ERROR_NONE Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT, CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT - CPL_ERROR_INVALID_TYPE if the image pixel type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_rejected( cpl_image * im, double a) { cpl_binary * pbpm; /* Check entries and Initialise */ cpl_ensure_code(im, CPL_ERROR_NULL_INPUT); /* If no bad pixel */ if (im->bpm == NULL) return CPL_ERROR_NONE; /* Return if no bad pixel map to update */ if (cpl_mask_is_empty(im->bpm)) return CPL_ERROR_NONE; pbpm = cpl_mask_get_data(im->bpm); switch (im->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_DOUBLE_COMPLEX #include "cpl_image_io_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT_COMPLEX #include "cpl_image_io_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Save one or more images to a FITS file @param self Image(s) of identical size and type to write to disk @param nz Number of images @param is_cube CPL_TRUE: use NAXIS3, otherwise NAXIS2 (ignored: nz > 1) @param filename Name of the file to write to @param type The type used to represent the data in the file @param pl Property list for the output header or NULL @param mode The desired output options @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_image_save() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_save_(const cpl_image * const* self, cpl_size nz, cpl_boolean is_cube, const char * filename, cpl_type type, const cpl_propertylist * pl, unsigned mode) { int status = 0; /* CFITSIO status, must be set to zero */ /* Count number of compression flags */ const unsigned ncompress = ((mode & CPL_IO_COMPRESS_GZIP) != 0) + ((mode & CPL_IO_COMPRESS_HCOMPRESS) != 0) + ((mode & CPL_IO_COMPRESS_PLIO) != 0) + ((mode & CPL_IO_COMPRESS_RICE) != 0); fitsfile * fptr; cpl_size i; const char * badkeys = mode & CPL_IO_EXTEND ? CPL_FITS_BADKEYS_EXT "|" CPL_FITS_COMPRKEYS : CPL_FITS_BADKEYS_PRIM "|" CPL_FITS_COMPRKEYS; const cpl_image * first = self ? self[0] : NULL; const cpl_size nx = cpl_image_get_size_x(first); const cpl_size ny = cpl_image_get_size_y(first); const cpl_type ftype = cpl_image_get_type(first); const int cfitsiotype = ftype == CPL_TYPE_DOUBLE ? TDOUBLE : (ftype == CPL_TYPE_FLOAT ? TFLOAT : TINT); const CPL_FITSIO_TYPE naxes[3] = {nx, ny, nz}; long plane1 = 0; /* First plane to write */ const int ibpp = cpl_tools_get_bpp(type == CPL_TYPE_UNSPECIFIED ? ftype : type); const int naxis23 = (nz > 1 || is_cube) ? 3 : 2; /* Test entries */ cpl_ensure_code(filename != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(ibpp != 0, CPL_ERROR_ILLEGAL_INPUT); if (is_cube) { cpl_ensure_code(((mode & CPL_IO_CREATE) != 0) + ((mode & CPL_IO_EXTEND) != 0) + ((mode & CPL_IO_APPEND) != 0) == 1, CPL_ERROR_ILLEGAL_INPUT); } else { cpl_ensure_code(((mode & CPL_IO_CREATE) != 0) + ((mode & CPL_IO_EXTEND) != 0) == 1, CPL_ERROR_ILLEGAL_INPUT); } cpl_ensure_code(mode < CPL_IO_MAX, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(ftype == CPL_TYPE_DOUBLE || ftype == CPL_TYPE_FLOAT || ftype == CPL_TYPE_INT, CPL_ERROR_INVALID_TYPE); if (mode & (CPL_IO_EXTEND | CPL_IO_APPEND)) { if (ncompress > 0) { if (ncompress > 1) { /* Only one type of compression is allowed */ return cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Specify one compression method, " "not %d (mode=0x%x)", ncompress, mode); } if (mode & CPL_IO_APPEND) { /* A compression flag is not allowed in append mode - it would at best be redundant or else in conflict with the existing compression method (which includes no compression) */ return cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Compression in append mode not " "allowed"); } if (abs(ibpp) < 32) { return cpl_error_set_message_(CPL_ERROR_UNSUPPORTED_MODE, "Compression not supported " "with implicit conversion to " "BITPIX=%d (type='%s'), use e.g. " "type='CPL_TYPE_INT'", ibpp, cpl_type_get_name(type)); } #ifndef CPL_IO_COMPRESSION_LOSSY if (ibpp < 0) { /* No compression of floating-point data - yet */ return cpl_error_set_message_(CPL_ERROR_UNSUPPORTED_MODE, "Lossy compression not supported " "(BITPIX=%d < 0)", ibpp); } #endif } /* Open the file */ if (cpl_io_fits_open_diskfile(&fptr, filename, READWRITE, &status)) { return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_open_diskfile, "filename='%s', " "type=%d, mode=%d", filename, type, mode); } if (mode & CPL_IO_COMPRESS_GZIP) fits_set_compression_type(fptr, GZIP_1, &status); else if (mode & CPL_IO_COMPRESS_HCOMPRESS) fits_set_compression_type(fptr, HCOMPRESS_1, &status); else if (mode & CPL_IO_COMPRESS_PLIO) fits_set_compression_type(fptr, PLIO_1, &status); else if (mode & CPL_IO_COMPRESS_RICE) fits_set_compression_type(fptr, RICE_1, &status); if (status != 0) { int fio_status2 = 0; cpl_io_fits_close_file(fptr, &fio_status2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_set_compression_type, "filename='%s', type=%d, mode=%d", filename, type, mode); } } else if (ncompress > 0) { /* Compression is only allowed in extensions */ return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } else { /* Create the file */ char * sval = cpl_sprintf("!%s", filename); cpl_io_fits_create_file(&fptr, sval, &status); cpl_free(sval); if (status != 0) { return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_create_file, "filename='%s', " "type=%d, mode=%d", filename, type, mode); } } if (mode & CPL_IO_APPEND) { int next; int exttype; int naxis; int bitpix; /* Last element read on naxis=2 */ CPL_FITSIO_TYPE fnaxes[3]; if (fits_get_num_hdus(fptr, &next, &status)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_get_num_hdus, "filename='%s', " "type=%d, mode=%d", filename, type, mode); } else if (fits_movabs_hdu(fptr, next, &exttype, &status)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_movabs_hdu, "filename='%s', type=%d, mode=%d", filename, type, mode); } else if (exttype != IMAGE_HDU) { int error2 = 0; return cpl_io_fits_close_file(fptr, &error2) ? cpl_error_set_fits(CPL_ERROR_FILE_IO, error2, fits_close_file, "filename='%s', " "type=%d, mode=%d", filename, type, mode) : cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Data-unit " "%d in file %s is not image-type (%d " "!= %d. type=%d, mode=%d)", next, filename, exttype, IMAGE_HDU, type, mode); } else if (fits_get_img_dim(fptr, &naxis, &status)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_get_img_dim, "filename='%s', " "type=%d, mode=%d", filename, type, mode); } else if (naxis < 2 || naxis > 3) { int error2 = 0; return cpl_io_fits_close_file(fptr, &error2) ? cpl_error_set_fits(CPL_ERROR_FILE_IO, error2, fits_close_file, "filename='%s', " "type=%d, mode=%d", filename, type, mode) : cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Data-unit " "%d in file %s has wrong NAXIS (%d !=" " 2/3). type=%d, mode=%d)", next, filename, naxis, type, mode); } else if (fits_get_img_type(fptr, &bitpix, &status)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_get_img_type, "filename='%s', type=" "%d, mode=%d", filename, type, mode); } else if (bitpix != ibpp) { int error2 = 0; return cpl_io_fits_close_file(fptr, &error2) ? cpl_error_set_fits(CPL_ERROR_FILE_IO, error2, fits_close_file, "filename='%s', " "type=%d, mode=%d", filename, type, mode) : cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Data-unit " "%d in file %s has wrong BITPIX (%d " "!= %d). type=%d, mode=%d)", next, filename, bitpix, ibpp, type, mode); } else if (CPL_FITSIO_GET_SIZE(fptr, naxis, fnaxes, &status)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, CPL_FITSIO_GET_SIZE, "filename='%s', type=%d, mode=%d", filename, type, mode); } else if (naxes[0] != fnaxes[0] || naxes[1] != fnaxes[1]) { int error2 = 0; return cpl_io_fits_close_file(fptr, &error2) ? cpl_error_set_fits(CPL_ERROR_FILE_IO, error2, fits_close_file, "filename='%s', " "type=%d, mode=%d", filename, type, mode) : cpl_error_set_message_ (CPL_ERROR_ILLEGAL_INPUT, "Data-unit %d in file %s has " "wrong NAXIS1/2 (%ldX%ld != %ldX%ld). type=%d, mode=%d)", next, filename, (long)fnaxes[0], (long)fnaxes[1], (long)naxes[0], (long)naxes[1], type, mode); } else if (fits_is_compressed_image(fptr, &status) && !status) { return cpl_io_fits_close_file(fptr, &status) ? cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_close_file, "filename='%s', " "type=%d, mode=%d", filename, type, mode) : cpl_error_set_message_(CPL_ERROR_UNSUPPORTED_MODE, "Data-" "unit %d in file %s is compressed. " "type=%d, mode=%d)", next, filename, type, mode); } else if (status) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_is_compressed_image, "filename='%s', type=%d, mode=%d", filename, type, mode); } else { plane1 = fnaxes[2]; fnaxes[2] += naxes[2]; if (CPL_FITSIO_RESIZE_IMG(fptr, bitpix, naxis, fnaxes, &status)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, CPL_FITSIO_RESIZE_IMG, "filename='%s', type=%d, mode=%d", filename, type, mode); } } } else if /* Create the imagelist in a new HDU appended to the file */ (CPL_FITSIO_CREATE_IMG(fptr, ibpp, naxis23, naxes, &status)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, CPL_FITSIO_CREATE_IMG_E, "filename='%s', type=%d, mode=%d", filename, type, mode); } else if /* Add Date, if creating */ ((mode & CPL_IO_CREATE) && fits_write_date(fptr, &status)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_write_date, "filename='%s', type=%d, mode=%d", filename, type, mode); } /* Add the property list */ if (cpl_fits_add_properties(fptr, pl, badkeys)) { return cpl_io_fits_close_file(fptr, &status) ? cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_close_file, "filename='%s', " "type=%d, mode=%d", filename, type, mode) : cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } /* Loop on the images */ for (i = 0; i < nz; i++) { const CPL_FITSIO_TYPE fpixel[3] = {1, 1, plane1 + i + 1}; const cpl_image * image = self[i]; const void * data = cpl_image_get_data_const(image); /* Write the pixels */ if (CPL_FITSIO_WRITE_PIX(fptr, cfitsiotype, fpixel, (LONGLONG)(nx*ny), data, &status)) break; } /* Check */ if (status) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, CPL_FITSIO_WRITE_PIX_E, "filename='%s', " "type=%d, mode=%d, plane=%u", filename, type, mode, (unsigned)i); } /* Close (and write to disk) */ return cpl_io_fits_close_file(fptr, &status) ? cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_close_file, "filename='%s', " "type=%d, mode=%d", filename, type, mode) : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Save an image to a FITS file @param self Image to write to disk or NULL @param filename Name of the file to write to @param type The type used to represent the data in the file @param pl Property list for the output header or NULL @param mode The desired output options @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_propertylist_save() This function saves an image to a FITS file. If a property list is provided, it is written to the header where the image is written. The image may be NULL, in this case only the propertylist is saved. Supported image types are CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT. The type used in the file can be one of: CPL_TYPE_UCHAR (8 bit unsigned), CPL_TYPE_SHORT (16 bit signed), CPL_TYPE_USHORT (16 bit unsigned), CPL_TYPE_INT (32 bit signed), CPL_TYPE_FLOAT (32 bit floating point), or CPL_TYPE_DOUBLE (64 bit floating point). Additionally, the special value CPL_TYPE_UNSPECIFIED is allowed. This value means that the type used for saving is the pixel type of the input image. Using the image pixel type as saving type ensures that the saving incurs no loss of information. Supported output modes are CPL_IO_CREATE (create a new file) and CPL_IO_EXTEND (append a new extension to an existing file). Upon success the image will reside in a FITS data unit with NAXIS = 2. Is it possible to save a single image in a FITS data unit with NAXIS = 3, see cpl_imagelist_save(). When the data written to disk are of an integer type, the output mode CPL_IO_EXTEND can be combined (via bit-wise or) with an option for tile-compression. This compression of integer data is lossless. The options are: CPL_IO_COMPRESS_GZIP, CPL_IO_COMPRESS_RICE, CPL_IO_COMPRESS_HCOMPRESS, CPL_IO_COMPRESS_PLIO. With compression the type must be CPL_TYPE_UNSPECIFIED or CPL_TYPE_INT. Note that in append mode the file must be writable (and do not take for granted that a file is writable just because it was created by the same application, as this depends from the system @em umask). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the type or the mode is not supported - CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported - CPL_ERROR_FILE_NOT_CREATED if the output file cannot be created - CPL_ERROR_FILE_IO if the data cannot be written to the file */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_save(const cpl_image * self, const char * filename, cpl_type type, const cpl_propertylist * pl, unsigned mode) { const cpl_error_code error = self == NULL ? cpl_propertylist_save(pl, filename, mode) : cpl_image_save_(&self, 1, CPL_FALSE, filename, type, pl, mode); return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Dump structural information of a CPL image @param self Image to dump @param stream Output stream, accepts @c stdout or @c stderr @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_FILE_IO if a write operation fails */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_dump_structure(const cpl_image * self, FILE * stream) { const char * msg = "Image with %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " pixel(s) of type '%s' and %" CPL_SIZE_FORMAT " bad pixel(s)\n"; const int msgmin = (int)(strlen(msg) - 2 - 3 * strlen(CPL_SIZE_FORMAT)); cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(stream != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code( fprintf(stream, msg, self->nx, self->ny, cpl_type_get_name(self->type), self->bpm ? cpl_mask_count(self->bpm) : 0) >= msgmin, CPL_ERROR_FILE_IO); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Dump pixel values in a CPL image @param self Image to dump @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Specifies the window position @param ury Specifies the window position @param stream Output stream, accepts @c stdout or @c stderr @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_FILE_IO if a write operation fails - CPL_ERROR_ACCESS_OUT_OF_RANGE if the defined window is not in the image - CPL_ERROR_ILLEGAL_INPUT if the window definition is wrong (e.g llx > urx) */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_dump_window(const cpl_image * self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, FILE * stream) { const cpl_error_code err = CPL_ERROR_FILE_IO; cpl_size i, j; cpl_boolean has_bad; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(stream != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(llx > 0 && llx <= self->nx && urx > 0 && urx <= self->nx, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(lly > 0 && lly <= self->ny && ury > 0 && ury <= self->ny, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(urx >= llx && ury >= lly, CPL_ERROR_ILLEGAL_INPUT); has_bad = self->bpm != NULL && !cpl_mask_is_empty(self->bpm); cpl_ensure_code( fprintf(stream, "#----- image: %" CPL_SIZE_FORMAT " <= x <= %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " <= y <= %" CPL_SIZE_FORMAT " -----\n", llx, urx, lly, ury) > 0, err); cpl_ensure_code( fprintf(stream, "\tX\tY\tvalue\n") > 0, err); for (j = lly; j <= ury; j++) { for (i = llx; i <= urx; i++) { const char * badtxt = has_bad && cpl_mask_get(self->bpm, i, j) ? " (rejected)" : ""; if (self->type == CPL_TYPE_INT) { const int * pint = (const int*)self->pixels; const int value = pint[(i-1) + (j-1) * self->nx]; cpl_ensure_code( fprintf(stream, "\t%" CPL_SIZE_FORMAT "\t%" CPL_SIZE_FORMAT "\t%d%s\n", i, j, value, badtxt) > 0, err); } else if (self->type == CPL_TYPE_FLOAT_COMPLEX || self->type == CPL_TYPE_DOUBLE_COMPLEX ) { int dummy; const double complex value = cpl_image_get_complex(self, i, j, &dummy); cpl_ensure_code( fprintf(stream, "\t%" CPL_SIZE_FORMAT "\t%" CPL_SIZE_FORMAT "\t%g + %g I %s\n", i, j, creal(value), cimag(value), badtxt) > 0, err); } else { int dummy; const double value = cpl_image_get(self, i, j, &dummy); cpl_ensure_code( fprintf(stream, "\t%" CPL_SIZE_FORMAT "\t%" CPL_SIZE_FORMAT "\t%g%s\n", i, j, value, badtxt) > 0, err); } } } return CPL_ERROR_NONE; } #define FFSTACK_PUSH(Y, XL, XR, DY) \ if (sp=wy1 && Y+(DY)<=wy2) \ {sp->y = Y; sp->xl = XL; sp->xr = XR; sp->dy = DY; sp++;} #define FFSTACK_POP(Y, XL, XR, DY) \ {sp--; Y = sp->y+(DY = sp->dy); XL = sp->xl; XR = sp->xr;} /*----------------------------------------------------------------------------*/ /* @internal @ingroup cpl_image @brief Fill a zone with label. @param intimage input label image @param fftemp Pre-allocated work-space @param x x position @param y y position @param label current label This code was pulled out the Usenet and freely adapted to cpl. Credits - Paul Heckbert (posted on comp.graphics 28 Apr 1988) It is highly unreadable and makes use of goto and other fairly bad programming practices, but works fine and fast. */ /*----------------------------------------------------------------------------*/ static void cpl_image_floodfill(cpl_image * lab, void * fftemp, cpl_size x, cpl_size y, cpl_size label) { struct { cpl_size y, xl, xr, dy; } * stack, * sp; cpl_size wx1, wx2, wy1, wy2; cpl_size l, x1, x2, dy; cpl_size ov; const cpl_size stacksz = FFSTACK_STACKSZ(lab); int * pii; stack = fftemp; sp = stack; wx1 = 0; wx2 = lab->nx-1; wy1 = 0; wy2 = lab->ny-1; pii = cpl_image_get_data_int(lab); ov = pii[x+y*lab->nx]; if (ov==label || xwx2 || ywy2) return; FFSTACK_PUSH(y, x, x, 1); /* needed in some cases */ FFSTACK_PUSH(y+1, x, x, -1); /* seed segment (popped 1st) */ while (sp>stack) { /* pop segment off stack and fill a neighboring scan line */ FFSTACK_POP(y, x1, x2, dy); /* * segment of scan line y-dy for x1<=x<=x2 was previously filled, * now explore adjacent pixels in scan line y */ for (x=x1; x>=wx1 && pii[x+y*lab->nx]==ov; x--) pii[x+y*lab->nx] = (int)label; /* FIXME: Need cpl_size pixel */ if (x>=x1) goto skip; l = x+1; if (lnx]==ov; x++) pii[x+y*lab->nx] = (int)label; /* FIXME: Need cpl_size pixel */ FFSTACK_PUSH(y, l, x-1, dy); if (x>x2+1) FFSTACK_PUSH(y, x2+1, x-1, -dy); /* leak on right? */ skip: for (x++; x<=x2 && pii[x+y*lab->nx]!=ov; x++); l = x; } while (x<=x2); } } /*----------------------------------------------------------------------------*/ /* @internal @brief Internal image loading function @param fptr CFITSIO structure of the already opened FITS file @param pnaxis If it points to 0, set *pnaxis to NAXIS else use as such @param naxes If 1st is 0, fill w. NAXIS[12[3]] else use as such @param ppix_type If points to _UNSPECIFIED, set else use as such @param filename The named of the opened file (only for error messages) @param pnum Plane number in the Data Unit (0 for first) @param lhdumov Absolute extension number to move to first (0 for primary) @param do_window True for (and only for) a windowed load @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Specifies the window position @param ury Specifies the window position @return 1 newly allocated image or NULL if image cannot be loaded. @see cpl_image_load_one() This function reads from an already opened FITS-file, which is useful when multiple images are to be loaded from the same file. To avoid repeated calls to determine NAXIS, NAXISi and optionally the CPL pixel-type most suitable for the the actual FITS data, the parameters pnaxis, naxes and ppix_type can be used both for input and for output. The extension number lhdumov is numbered with 1 for the first extension, i.e. 0 moves to the primary HDU. Any negative value causes no move. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_BAD_FILE_FORMAT if a CFITSIO call fails or if in auto-pixel mode the CFITSIO data type is unsupported. - CPL_ERROR_DATA_NOT_FOUND if the specified extension has no image data. This code is relied on as being part of the API! - CPL_ERROR_INCOMPATIBLE_INPUT if NAXIS is OK but the data unit is empty - CPL_ERROR_ILLEGAL_INPUT If the plane number is out of range, or in a windowed read the window is invalid - CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_load_(fitsfile * fptr, int * pnaxis, CPL_FITSIO_TYPE naxes[], cpl_type * ppix_type, const char * filename, cpl_size pnum, cpl_size lhdumov, cpl_boolean do_window, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { const int hdumov = (int)lhdumov; int error = 0; cpl_image * self; void * pixels; const long int inc[3] = {1, 1, 1}; long int fpixel[3]; long int lpixel[3]; int loadtype; cpl_size nx, ny; cpl_ensure(fptr != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(pnaxis != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(naxes != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(ppix_type != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(filename != NULL, CPL_ERROR_NULL_INPUT, NULL); /* CFITSIO only supports int */ cpl_ensure((cpl_size)(1+hdumov) == 1+lhdumov, CPL_ERROR_ILLEGAL_INPUT, NULL); /* The open call may be reusing file handle opened for previous I/O, so the file pointer needs to be moved also for hdumov = 0 */ if (hdumov >= 0 && fits_movabs_hdu(fptr, 1+hdumov, NULL, &error)) { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_movabs_hdu, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d", filename, pnum, hdumov); return NULL; } /* Get NAXIS, if needed */ if (*pnaxis == 0 && fits_get_img_dim(fptr, pnaxis, &error)) { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_get_img_dim, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d", filename, pnum, hdumov); return NULL; } /* Verify NAXIS before trying anything else */ if (*pnaxis != 2 && *pnaxis != 3) { (void)cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, NAXIS=%d", filename, pnum, hdumov, *pnaxis); return NULL; } /* Get NAXIS[12[3]], if needed */ if (naxes[0] == 0 && CPL_FITSIO_GET_SIZE(fptr, *pnaxis, naxes, &error)) { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, CPL_FITSIO_GET_SIZE, "filename='%s', " "pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, " "NAXIS=%d", filename, pnum, hdumov, *pnaxis); return NULL; } /* Verify NAXIS[123] */ if (naxes[0] == 0 || naxes[1] == 0) { /* FIXME: Is this actually possible with a non-zero NAXIS ? */ (void)cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, NAXIS=%d, NAXIS1=%ld, " "NAXIS2=%ld", filename, pnum, hdumov, *pnaxis, (long)naxes[0], (long)naxes[1]); return NULL; } if (*pnaxis == 3 && naxes[2] == 0) { /* FIXME: Is this actually possible with a non-zero NAXIS ? */ (void)cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, NAXIS=%d, NAXIS1=%ld, " "NAXIS2=%ld NAXIS3=0", filename, pnum, hdumov, *pnaxis, (long)naxes[0], (long)naxes[1]); return NULL; } if (do_window) { /* Verify the window size */ /* If the naxes[] passed is from a previous succesful call here, then this check is redundant. Don't rely on that. */ if (llx < 1 || lly < 1 || urx > naxes[0] || ury > naxes[1] || urx < llx || ury < lly) { (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, " "llx=%" CPL_SIZE_FORMAT ", lly=%" CPL_SIZE_FORMAT ", urx=%" CPL_SIZE_FORMAT ", ury=%" CPL_SIZE_FORMAT ", NAXIS=%d, " "NAXIS1=%ld, NAXIS2=%ld", filename, pnum, hdumov, llx, lly, urx, ury, *pnaxis, (long)naxes[0], (long)naxes[1]); return NULL; } } else { llx = lly = 1; urx = naxes[0]; ury = naxes[1]; } /* Create the zone definition. The 3rd element not defined for NAXIS = 2 */ fpixel[0] = llx; fpixel[1] = lly; lpixel[0] = urx; lpixel[1] = ury; if (*pnaxis == 3) { /* Verify plane number */ if (pnum + 1 > naxes[2]) { (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, NAXIS=3, NAXIS1=%ld, " "NAXIS2=%ld, NAXIS3=%ld", filename, pnum, hdumov, (long)naxes[0], (long)naxes[1], (long)naxes[2]); return NULL; } fpixel[2] = lpixel[2] = pnum + 1; } else if (pnum != 0) { /* May not ask for any plane but the first when NAXIS == 2 */ (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, NAXIS=%d, NAXIS1=%ld, " "NAXIS2=%ld", filename, pnum, hdumov, *pnaxis, (long)naxes[0], (long)naxes[1]); return NULL; } if (*ppix_type == CPL_TYPE_UNSPECIFIED) { /* The pixel type of the created image is determined by the pixel type of the loaded FITS image */ int imgtype; if (fits_get_img_type(fptr, &imgtype, &error)) { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_get_img_type, "filename='%s', " "pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, " "NAXIS=%d, NAXIS1=%ld, NAXIS2=%ld", filename, pnum, hdumov, *pnaxis, (long)naxes[0], (long)naxes[1]); return NULL; } switch (imgtype) { case BYTE_IMG : case SHORT_IMG : case LONG_IMG : case LONGLONG_IMG: *ppix_type = CPL_TYPE_INT; break; case FLOAT_IMG : *ppix_type = CPL_TYPE_FLOAT; break; case DOUBLE_IMG : *ppix_type = CPL_TYPE_DOUBLE; break; default: break; } if (*ppix_type == CPL_TYPE_UNSPECIFIED) { (void)cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, NAXIS=%d, NAXIS1=%ld, " "NAXIS2=%ld, imgtype=%d", filename, pnum, hdumov, *pnaxis, (long)naxes[0], (long)naxes[1], imgtype); return NULL; } } if (*ppix_type == CPL_TYPE_DOUBLE) { loadtype = TDOUBLE; } else if (*ppix_type == CPL_TYPE_FLOAT) { loadtype = TFLOAT; } else if (*ppix_type == CPL_TYPE_INT) { loadtype = TINT; } else { (void)cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "filename='%s', pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, NAXIS=%d, NAXIS1=%ld, " "NAXIS2=%ld, im_type=%d", filename, pnum, hdumov,*pnaxis, (long)naxes[0], (long)naxes[1], *ppix_type); return NULL; } nx = urx - llx + 1; ny = ury - lly + 1; pixels = cpl_malloc((size_t)nx * (size_t)ny * cpl_type_get_sizeof(*ppix_type)); if (nx == (cpl_size)naxes[0]) { const LONGLONG nelem = naxes[0] * (LONGLONG)ny; const LONGLONG firstelem = 1 + naxes[0] * (LONGLONG)(lly - 1) + naxes[0] * naxes[1] * (LONGLONG)pnum; if (fits_read_img(fptr, loadtype, firstelem, nelem, NULL, pixels, NULL, &error)) { cpl_free(pixels); (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_read_img, "filename='%s', " "pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, " "NAXIS=%d, NAXIS1=%ld, NAXIS2=%ld", filename, pnum, hdumov, *pnaxis, (long)naxes[0], (long)naxes[1]); return NULL; } } else if (cpl_fits_read_subset(fptr, loadtype, fpixel, lpixel, inc, NULL, pixels, NULL, &error)) { cpl_free(pixels); (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_read_subset, "filename='%s', " "pnum=%" CPL_SIZE_FORMAT ", hdumov=%d, " "NAXIS=%d, NAXIS1=%ld, NAXIS2=%ld", filename, pnum, hdumov, *pnaxis, (long)naxes[0], (long)naxes[1]); return NULL; } self = cpl_image_wrap_(nx, ny, *ppix_type, pixels); if (self == NULL) { cpl_free(pixels); cpl_error_set_where_(); } return self; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Create an image, optionally using an existing pixel buffer. @param nx Size in x (the number of columns) @param ny Size in y (the number of rows) @param type Pixel type @param pixels Pixel data, or NULL @return 1 newly allocated cpl_image or NULL on error @see cpl_image_new(), cpl_image_wrap_double() @note if pixels is NULL, a new buffer will be cpl_calloc'ed. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if nx or ny is non-positive or their product is too big - CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_wrap_(cpl_size nx, cpl_size ny, cpl_type type, void * pixels) { cpl_image * self; const cpl_size npix = nx * ny; const size_t upix = (size_t)nx * (size_t)ny; cpl_ensure( nx > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure( ny > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Check for overflow */ cpl_ensure( npix > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure( (size_t)npix == upix, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure( type == CPL_TYPE_INT || type == CPL_TYPE_FLOAT || type == CPL_TYPE_DOUBLE || type == CPL_TYPE_FLOAT_COMPLEX || type == CPL_TYPE_DOUBLE_COMPLEX, CPL_ERROR_INVALID_TYPE, NULL); self = cpl_malloc(sizeof(cpl_image)); self->nx = nx; self->ny = ny; self->type = type; self->bpm = NULL; self->pixels = pixels != NULL ? pixels : cpl_calloc(upix, cpl_type_get_sizeof(type)); return self; } cpl-6.4.1/cplcore/cpl_image_bpm.c0000644000460300003120000002647012160523477013603 00000000000000/* $Id: cpl_image_bpm.c,v 1.51 2013-06-20 06:54:55 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-06-20 06:54:55 $ * $Revision: 1.51 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image_bpm.h" #include "cpl_tools.h" #include "cpl_error_impl.h" #include "cpl_image_defs.h" #include /* Needed for fpclassify() */ #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /* These macros are needed for support of the different pixel types */ #define CONCAT(a,b) a ## _ ## b #define CONCAT2X(a,b) CONCAT(a,b) #define ADDTYPE(a) CONCAT2X(a, CPL_TYPE_NAME) /*----------------------------------------------------------------------------- Static Function Prototypes -----------------------------------------------------------------------------*/ #define CPL_TYPE double #define CPL_TYPE_NAME double #include "cpl_image_bpm_body.h" #undef CPL_TYPE #undef CPL_TYPE_NAME #define CPL_TYPE float #define CPL_TYPE_NAME float #include "cpl_image_bpm_body.h" #undef CPL_TYPE #undef CPL_TYPE_NAME #ifdef CPL_FPCLASSIFY_COMPLEX #define CPL_TYPE double complex #define CPL_TYPE_NAME double_complex #include "cpl_image_bpm_body.h" #undef CPL_TYPE #undef CPL_TYPE_NAME #define CPL_TYPE float complex #define CPL_TYPE_NAME float_complex #include "cpl_image_bpm_body.h" #undef CPL_TYPE #undef CPL_TYPE_NAME #endif #define CPL_TYPE int #define CPL_TYPE_NAME int #define CPL_TYPE_IS_INT #include "cpl_image_bpm_body.h" #undef CPL_TYPE #undef CPL_TYPE_NAME #undef CPL_TYPE_IS_INT /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Reject pixels with the specified special value(s) @param self Input image to modify @param mode Bit field specifying which special value(s) to reject Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if mode is 1, e.g. due to a logical or (||) of the allowed options or if the pixel type is complex - CPL_ERROR_UNSUPPORTED_MODE if mode is otherwise different from the allowed options. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_reject_value(cpl_image * self, cpl_value mode) { cpl_error_code error = CPL_ERROR_NONE; switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: error = cpl_image_reject_value_double(self, mode); break; case CPL_TYPE_FLOAT: error = cpl_image_reject_value_float(self, mode); break; #ifdef CPL_FPCLASSIFY_COMPLEX case CPL_TYPE_DOUBLE_COMPLEX: error = cpl_image_reject_value_double_complex(self, mode); break; case CPL_TYPE_FLOAT_COMPLEX: error = cpl_image_reject_value_float_complex(self, mode); break; #endif case CPL_TYPE_INT: error = cpl_image_reject_value_int(self, mode); break; default: /* NULL input and unsupported pixel types */ error = self != NULL ? CPL_ERROR_INVALID_TYPE : CPL_ERROR_NULL_INPUT; break; } return error ? cpl_error_set_(error) : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Test if a pixel is good or bad @param im the input image @param x the x pixel position in the image (first pixel is 1) @param y the y pixel position in the image (first pixel is 1) @return 1 if the pixel is bad, 0 if the pixel is good, negative on error. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the image */ /*----------------------------------------------------------------------------*/ int cpl_image_is_rejected(const cpl_image * im, cpl_size x, cpl_size y) { /* Test entries */ cpl_ensure(im != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(x >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE, -2); cpl_ensure(y >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3); cpl_ensure(x <= im->nx, CPL_ERROR_ACCESS_OUT_OF_RANGE, -4); cpl_ensure(y <= im->ny, CPL_ERROR_ACCESS_OUT_OF_RANGE, -5); /* Get the pixel info */ if (im->bpm != NULL) { const cpl_binary val = cpl_mask_get(im->bpm, x, y); return val == CPL_BINARY_0 ? 0 : 1; } return 0; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Count the number of bad pixels declared in an image @param im the input image @return the number of bad pixels or -1 if the input image is NULL Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_image_count_rejected(const cpl_image * im) { cpl_ensure(im != NULL, CPL_ERROR_NULL_INPUT, -1); return im->bpm == NULL ? 0 : cpl_mask_count(im->bpm); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Set a pixel as bad in an image @param im the input image @param x the x pixel position in the image (first pixel is 1) @param y the y pixel position in the image (first pixel is 1) @return the #_cpl_error_code_ or CPL_ERROR_NONE Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the image */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_reject(cpl_image * im, cpl_size x, cpl_size y) { cpl_binary * pbpm; /* Test entries */ cpl_ensure_code(im != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(x >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(y >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(x <= im->nx, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(y <= im->ny, CPL_ERROR_ACCESS_OUT_OF_RANGE); /* Create the bad pixels mask if empty */ if (im->bpm == NULL) im->bpm = cpl_mask_new(im->nx, im->ny); /* Get the access to the data */ pbpm = cpl_mask_get_data(im->bpm); /* Set the bad pixel */ pbpm[(x-1) + (y-1) * im->nx] = CPL_BINARY_1; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Set a pixel as good in an image @param im the input image @param x the x pixel position in the image (first pixel is 1) @param y the y pixel position in the image (first pixel is 1) @return the #_cpl_error_code_ or CPL_ERROR_NONE Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the image */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_accept(cpl_image * im, cpl_size x, cpl_size y) { cpl_binary * pbpm; /* Test entries */ cpl_ensure_code(im != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(x >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(y >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(x <= im->nx, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(y <= im->ny, CPL_ERROR_ACCESS_OUT_OF_RANGE); /* If no badpixel map in the image, return with ok */ if (im->bpm==NULL) return CPL_ERROR_NONE; /* Get the access to the data */ pbpm = cpl_mask_get_data(im->bpm); /* Set the good pixel */ pbpm[(x-1) + (y-1) * im->nx] = CPL_BINARY_0; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Set all pixels in the image as good @param self the input image @return the #_cpl_error_code_ or CPL_ERROR_NONE Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_accept_all(cpl_image * self) { cpl_mask_delete(cpl_image_unset_bpm(self)); return self != NULL ? CPL_ERROR_NONE : cpl_error_set_where_(); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Set the bad pixels in an image as defined in a mask @param im the input image @param map the mask defining the bad pixels @return the #_cpl_error_code_ or CPL_ERROR_NONE If the input image has a bad pixel map prior to the call, it is overwritten. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if the input image or the input map is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the image and the map have different sizes */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_reject_from_mask(cpl_image * im, const cpl_mask * map) { /* Test entries */ cpl_ensure_code(im != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(map != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(im->nx==cpl_mask_get_size_x(map), CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(im->ny==cpl_mask_get_size_y(map), CPL_ERROR_INCOMPATIBLE_INPUT); /* Copy the provided mask - cpl_image_get_bpm(im) will create a new pixel-map if one does not exist */ (void)memcpy(cpl_mask_get_data(cpl_image_get_bpm(im)), cpl_mask_get_data_const(map), (size_t)im->nx * (size_t)im->ny * sizeof(cpl_binary)); return CPL_ERROR_NONE; } cpl-6.4.1/cplcore/cpl_image_stats.h0000644000460300003120000001035212005615436014153 00000000000000/* $Id: cpl_image_stats.h,v 1.29 2012-07-30 23:39:10 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-07-30 23:39:10 $ * $Revision: 1.29 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGE_STATS_H #define CPL_IMAGE_STATS_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ double cpl_image_get_min(const cpl_image *); double cpl_image_get_min_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size); double cpl_image_get_max(const cpl_image *); double cpl_image_get_max_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size); double cpl_image_get_mean(const cpl_image *); double cpl_image_get_mean_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size); double cpl_image_get_median(const cpl_image *); double cpl_image_get_median_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size); double cpl_image_get_stdev(const cpl_image *); double cpl_image_get_stdev_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size); double cpl_image_get_flux(const cpl_image *); double cpl_image_get_flux_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size); double cpl_image_get_absflux(const cpl_image *); double cpl_image_get_absflux_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size); double cpl_image_get_sqflux(const cpl_image *); double cpl_image_get_sqflux_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size); double cpl_image_get_centroid_x(const cpl_image *); double cpl_image_get_centroid_x_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size); double cpl_image_get_centroid_y(const cpl_image *); double cpl_image_get_centroid_y_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size); cpl_error_code cpl_image_get_minpos(const cpl_image *, cpl_size *, cpl_size *); cpl_error_code cpl_image_get_minpos_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size *, cpl_size *); cpl_error_code cpl_image_get_maxpos(const cpl_image *, cpl_size *, cpl_size *); cpl_error_code cpl_image_get_maxpos_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size *, cpl_size *); double cpl_image_get_median_dev(const cpl_image *, double *); double cpl_image_get_median_dev_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size, double *); double cpl_image_get_mad(const cpl_image *, double *); double cpl_image_get_mad_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size, double *); CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_propertylist.h0000644000460300003120000003554412270505777014457 00000000000000/* $Id: cpl_propertylist.h,v 1.25 2011-03-18 14:29:59 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-03-18 14:29:59 $ * $Revision: 1.25 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_PROPERTYLIST_H #define CPL_PROPERTYLIST_H #include #include #include #include CPL_BEGIN_DECLS /** * @ingroup cpl_propertylist * * @brief * The opaque property list data type. */ typedef struct _cpl_propertylist_ cpl_propertylist; /** * @ingroup cpl_propertylist * * @brief * The property comparison function data type. */ typedef int (*cpl_propertylist_compare_func)(const cpl_property *first, const cpl_property *second); /* * Create, copy and destroy operations. */ cpl_propertylist * cpl_propertylist_new(void) CPL_ATTR_ALLOC; cpl_propertylist * cpl_propertylist_duplicate(const cpl_propertylist *other) CPL_ATTR_ALLOC; void cpl_propertylist_delete(cpl_propertylist *self); /* * Non modifying operations */ cpl_size cpl_propertylist_get_size(const cpl_propertylist *self); int cpl_propertylist_is_empty(const cpl_propertylist *self); cpl_type cpl_propertylist_get_type(const cpl_propertylist *self, const char *name); int cpl_propertylist_has(const cpl_propertylist *self, const char *name); /* * Assignment operations */ cpl_error_code cpl_propertylist_set_comment(cpl_propertylist *self, const char *name, const char *comment); cpl_error_code cpl_propertylist_set_char(cpl_propertylist *self, const char *name, char value); cpl_error_code cpl_propertylist_set_bool(cpl_propertylist *self, const char *name , int value); cpl_error_code cpl_propertylist_set_int(cpl_propertylist *self, const char *name, int value); cpl_error_code cpl_propertylist_set_long(cpl_propertylist *self, const char *name, long value); cpl_error_code cpl_propertylist_set_long_long(cpl_propertylist *self, const char *name, long long value); cpl_error_code cpl_propertylist_set_float(cpl_propertylist *self, const char *name, float value); cpl_error_code cpl_propertylist_set_double(cpl_propertylist *self, const char *name, double value); cpl_error_code cpl_propertylist_set_string(cpl_propertylist *self, const char *name, const char *value); #ifdef _Complex_I cpl_error_code cpl_propertylist_set_float_complex(cpl_propertylist *self, const char *name, _Complex float value); cpl_error_code cpl_propertylist_set_double_complex(cpl_propertylist *self, const char *name, _Complex double value); #endif /* * Element access */ const cpl_property * cpl_propertylist_get_const(const cpl_propertylist *self, long position); cpl_property * cpl_propertylist_get(cpl_propertylist *self, long position); const cpl_property * cpl_propertylist_get_property_const(const cpl_propertylist *self, const char *name); cpl_property * cpl_propertylist_get_property(cpl_propertylist *self, const char *name); const char * cpl_propertylist_get_comment(const cpl_propertylist *self, const char *name); char cpl_propertylist_get_char(const cpl_propertylist *self, const char *name); int cpl_propertylist_get_bool(const cpl_propertylist *self, const char *name); int cpl_propertylist_get_int(const cpl_propertylist *self, const char *name); long cpl_propertylist_get_long(const cpl_propertylist *self, const char *name); long long cpl_propertylist_get_long_long(const cpl_propertylist *self, const char *name); float cpl_propertylist_get_float(const cpl_propertylist *self, const char *name); double cpl_propertylist_get_double(const cpl_propertylist *self, const char *name); const char * cpl_propertylist_get_string(const cpl_propertylist *self, const char *name); #ifdef _Complex_I _Complex float cpl_propertylist_get_float_complex(const cpl_propertylist *self, const char *name); _Complex double cpl_propertylist_get_double_complex(const cpl_propertylist *self, const char *name); #endif /* * Inserting and removing elements */ cpl_error_code cpl_propertylist_insert_char(cpl_propertylist *self, const char *here, const char *name, char value); cpl_error_code cpl_propertylist_insert_bool(cpl_propertylist *self, const char *here, const char *name, int value); cpl_error_code cpl_propertylist_insert_int(cpl_propertylist *self, const char *here, const char *name, int value); cpl_error_code cpl_propertylist_insert_long(cpl_propertylist *self, const char *here, const char *name, long value); cpl_error_code cpl_propertylist_insert_long_long(cpl_propertylist *self, const char *here, const char *name, long long value); cpl_error_code cpl_propertylist_insert_float(cpl_propertylist *self, const char *here, const char *name, float value); cpl_error_code cpl_propertylist_insert_double(cpl_propertylist *self, const char *here, const char *name, double value); cpl_error_code cpl_propertylist_insert_string(cpl_propertylist *self, const char *here, const char *name, const char *value); #ifdef _Complex_I cpl_error_code cpl_propertylist_insert_float_complex(cpl_propertylist *self, const char *here, const char *name, _Complex float value); cpl_error_code cpl_propertylist_insert_double_complex(cpl_propertylist *self, const char *here, const char *name, _Complex double value); #endif cpl_error_code cpl_propertylist_insert_after_char(cpl_propertylist *self, const char *after, const char *name, char value); cpl_error_code cpl_propertylist_insert_after_bool(cpl_propertylist *self, const char *after, const char *name, int value); cpl_error_code cpl_propertylist_insert_after_int(cpl_propertylist *self, const char *after, const char *name, int value); cpl_error_code cpl_propertylist_insert_after_long(cpl_propertylist *self, const char *after, const char *name, long value); cpl_error_code cpl_propertylist_insert_after_long_long(cpl_propertylist *self, const char *after, const char *name, long long value); cpl_error_code cpl_propertylist_insert_after_float(cpl_propertylist *self, const char *after, const char *name, float value); cpl_error_code cpl_propertylist_insert_after_double(cpl_propertylist *self, const char *after, const char *name, double value); cpl_error_code cpl_propertylist_insert_after_string(cpl_propertylist *self, const char *after, const char *name, const char *value); #ifdef _Complex_I cpl_error_code cpl_propertylist_insert_after_float_complex(cpl_propertylist *self, const char *after, const char *name, _Complex float value); cpl_error_code cpl_propertylist_insert_after_double_complex(cpl_propertylist *self, const char *after, const char *name, _Complex double value); #endif cpl_error_code cpl_propertylist_prepend_char(cpl_propertylist *self, const char *name, char value); cpl_error_code cpl_propertylist_prepend_bool(cpl_propertylist *self, const char *name, int value); cpl_error_code cpl_propertylist_prepend_int(cpl_propertylist *self, const char *name, int value); cpl_error_code cpl_propertylist_prepend_long(cpl_propertylist *self, const char *name, long value); cpl_error_code cpl_propertylist_prepend_long_long(cpl_propertylist *self, const char *name, long long value); cpl_error_code cpl_propertylist_prepend_float(cpl_propertylist *self, const char *name, float value); cpl_error_code cpl_propertylist_prepend_double(cpl_propertylist *self, const char *name, double value); cpl_error_code cpl_propertylist_prepend_string(cpl_propertylist *self, const char *name, const char *value); #ifdef _Complex_I cpl_error_code cpl_propertylist_prepend_float_complex(cpl_propertylist *self, const char *name, _Complex float value); cpl_error_code cpl_propertylist_prepend_double_complex(cpl_propertylist *self, const char *name, _Complex double value); #endif cpl_error_code cpl_propertylist_append_char(cpl_propertylist *self, const char *name, char value); cpl_error_code cpl_propertylist_append_bool(cpl_propertylist *self, const char *name, int value); cpl_error_code cpl_propertylist_append_int(cpl_propertylist *self, const char *name, int value); cpl_error_code cpl_propertylist_append_long(cpl_propertylist *self, const char *name, long value); cpl_error_code cpl_propertylist_append_long_long(cpl_propertylist *self, const char *name, long long value); cpl_error_code cpl_propertylist_append_float(cpl_propertylist *self, const char *name, float value); cpl_error_code cpl_propertylist_append_double(cpl_propertylist *self, const char *name, double value); cpl_error_code cpl_propertylist_append_string(cpl_propertylist *self, const char *name, const char *value); #ifdef _Complex_I cpl_error_code cpl_propertylist_append_float_complex(cpl_propertylist *self, const char *name, _Complex float value); cpl_error_code cpl_propertylist_append_double_complex(cpl_propertylist *self, const char *name, _Complex double value); #endif cpl_error_code cpl_propertylist_append(cpl_propertylist *self, const cpl_propertylist *other); int cpl_propertylist_erase(cpl_propertylist *self, const char *name); int cpl_propertylist_erase_regexp(cpl_propertylist *self, const char *regexp, int invert); void cpl_propertylist_empty(cpl_propertylist *self); /* * Convenience functions */ cpl_error_code cpl_propertylist_update_char(cpl_propertylist *self, const char *name, char value); cpl_error_code cpl_propertylist_update_bool(cpl_propertylist *self, const char *name, int value); cpl_error_code cpl_propertylist_update_int(cpl_propertylist *self, const char *name, int value); cpl_error_code cpl_propertylist_update_long(cpl_propertylist *self, const char *name, long value); cpl_error_code cpl_propertylist_update_long_long(cpl_propertylist *self, const char *name, long long value); cpl_error_code cpl_propertylist_update_float(cpl_propertylist *self, const char *name, float value); cpl_error_code cpl_propertylist_update_double(cpl_propertylist *self, const char *name, double value); cpl_error_code cpl_propertylist_update_string(cpl_propertylist *self, const char *name, const char *value); #ifdef _Complex_I cpl_error_code cpl_propertylist_update_float_complex(cpl_propertylist *self, const char *name, _Complex float value); cpl_error_code cpl_propertylist_update_double_complex(cpl_propertylist *self, const char *name, _Complex double value); #endif /* * Working on properties */ cpl_error_code cpl_propertylist_copy_property(cpl_propertylist *self, const cpl_propertylist *other, const char *name); cpl_error_code cpl_propertylist_copy_property_regexp(cpl_propertylist *self, const cpl_propertylist *other, const char *regexp, int invert); cpl_error_code cpl_propertylist_append_property(cpl_propertylist *self, const cpl_property *property); cpl_error_code cpl_propertylist_prepend_property(cpl_propertylist *self, const cpl_property *property); cpl_error_code cpl_propertylist_insert_property(cpl_propertylist *self, const char *here, const cpl_property *property); cpl_error_code cpl_propertylist_insert_after_property(cpl_propertylist *self, const char *after, const cpl_property *property); /* * Sorting */ cpl_error_code cpl_propertylist_sort(cpl_propertylist *self, cpl_propertylist_compare_func compare); /* * Loading, saving and conversion operations. */ cpl_propertylist * cpl_propertylist_load(const char *name, cpl_size position) CPL_ATTR_ALLOC; cpl_propertylist * cpl_propertylist_load_regexp(const char *name, cpl_size position, const char *regexp, int invert) CPL_ATTR_ALLOC; cpl_error_code cpl_propertylist_save(const cpl_propertylist *self, const char *filename, unsigned int mode); void cpl_propertylist_dump(const cpl_propertylist *self, FILE *stream); CPL_END_DECLS #endif /* CPL_PROPERTYLIST_H */ cpl-6.4.1/cplcore/cpl_image_stats.c0000644000460300003120000010520012032326632014140 00000000000000/* $Id: cpl_image_stats.c,v 1.94 2012-10-01 14:50:02 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-10-01 14:50:02 $ * $Revision: 1.94 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include "cpl_memory.h" #include "cpl_stats.h" #include "cpl_image_bpm.h" #include "cpl_image_stats.h" #include "cpl_mask.h" #include "cpl_tools.h" #include "cpl_image_defs.h" /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Define the body of a stats window function @param op Operation in lower case @param OP Operation in upper case */ /*----------------------------------------------------------------------------*/ #define CPL_IMAGE_GET_STATS_WINDOW_DOUBLE_BODY(op, OP) \ \ cpl_stats * stats = \ cpl_stats_new_from_image_window(image, \ CPL_CONCAT2X(CPL_STATS, OP), \ llx, lly, urx, ury); \ double res; \ \ cpl_ensure(stats != NULL, cpl_error_get_code(), 0.0); \ \ /* Should not be able to fail now */ \ res = CPL_CONCAT2X(cpl_stats_get, op)((const cpl_stats *)stats); \ \ cpl_stats_delete(stats); \ \ return res /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Define the body of a stats function @param op Operation in lower case @param OP Operation in upper case */ /*----------------------------------------------------------------------------*/ #define CPL_IMAGE_GET_STATS_DOUBLE_BODY(op, OP) \ \ cpl_stats * stats = \ cpl_stats_new_from_image(image, CPL_CONCAT2X(CPL_STATS, OP)); \ double res; \ \ cpl_ensure(stats != NULL, cpl_error_get_code(), 0.0); \ \ /* Should not be able to fail now */ \ res = CPL_CONCAT2X(cpl_stats_get, op)((const cpl_stats *)stats); \ \ cpl_stats_delete(stats); \ \ return res /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief computes minimum pixel value over an image sub-window. @param image input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return the minimum value, or undefined on error @see cpl_stats_new_from_window() @note In case of error, the #_cpl_error_code_ code is set. The specified bounds are included in the specified region. Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ double cpl_image_get_min_window(const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { CPL_IMAGE_GET_STATS_WINDOW_DOUBLE_BODY(min, MIN); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief computes minimum pixel value over an image. @param image input image. @return the minimum value @see cpl_image_get_min_window() In case of error, the #_cpl_error_code_ code is set, and the returned double is undefined. Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ double cpl_image_get_min(const cpl_image * image) { CPL_IMAGE_GET_STATS_DOUBLE_BODY(min, MIN); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief computes maximum pixel value over an image sub-window. @param image input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return the maximum value @see cpl_image_get_min_window() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_max_window(const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { CPL_IMAGE_GET_STATS_WINDOW_DOUBLE_BODY(max, MAX); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief computes maximum pixel value over an image. @param image input image. @return the maximum value @see cpl_image_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_max(const cpl_image * image) { CPL_IMAGE_GET_STATS_DOUBLE_BODY(max, MAX); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief computes mean pixel value over an image sub-window. @param image input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return the mean value @see cpl_image_get_min_window() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_mean_window( const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { CPL_IMAGE_GET_STATS_WINDOW_DOUBLE_BODY(mean, MEAN); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief computes mean pixel value over an image. @param image input image. @return the mean value @see cpl_image_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_mean(const cpl_image * image) { CPL_IMAGE_GET_STATS_DOUBLE_BODY(mean, MEAN); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief computes median pixel value over an image sub-window. @param image Input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return The median value, or undefined on error The specified bounds are included in the specified region. In case of error, the #_cpl_error_code_ code is set, and the returned value is undefined. Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE. For a finite population or sample, the median is the middle value of an odd number of values (arranged in ascending order) or any value between the two middle values of an even number of values. For an even number of elements in the array, the mean of the two central values is returned. Note that in this case, the median might not belong to the input array. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the window is outside the image or if there are only bad pixels in the window - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ double cpl_image_get_median_window(const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { CPL_IMAGE_GET_STATS_WINDOW_DOUBLE_BODY(median, MEDIAN); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief computes median pixel value over an image. @param image Input image. @return the median value @see cpl_image_get_median_window() In case of error, the #_cpl_error_code_ code is set, and the returned double is undefined. Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ double cpl_image_get_median(const cpl_image * image) { CPL_IMAGE_GET_STATS_DOUBLE_BODY(median, MEDIAN); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief computes pixel standard deviation over an image sub-window. @param image input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return the standard deviation value @see cpl_image_get_min_window() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_stdev_window(const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { CPL_IMAGE_GET_STATS_WINDOW_DOUBLE_BODY(stdev, STDEV); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief computes pixel standard deviation over an image. @param image input image. @return the standard deviation value @see cpl_image_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_stdev(const cpl_image * image) { CPL_IMAGE_GET_STATS_DOUBLE_BODY(stdev, STDEV); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes the sum of pixel values over an image sub-window @param image input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return the flux value @see cpl_image_get_min_window() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_flux_window(const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { CPL_IMAGE_GET_STATS_WINDOW_DOUBLE_BODY(flux, FLUX); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes the sum of pixel values over an image. @param image input image. @return the flux value @see cpl_image_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_flux(const cpl_image * image) { cpl_ensure(image, CPL_ERROR_NULL_INPUT, 0.0); return cpl_image_get_flux_window(image, 1, 1, image->nx, image->ny); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes the sum of absolute values over an image sub-window @param image input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return the absolute flux (sum of |pixels|) value @see cpl_image_get_min_window() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_absflux_window(const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { CPL_IMAGE_GET_STATS_WINDOW_DOUBLE_BODY(absflux, ABSFLUX); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes the sum of squared values over an image sub-window @param image input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return the square flux @see cpl_image_get_min_window() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_sqflux_window( const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { CPL_IMAGE_GET_STATS_WINDOW_DOUBLE_BODY(sqflux, SQFLUX); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes the sum of absolute values over an image @param image input image. @return the absolute flux (sum of |pixels|) value @see cpl_image_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_absflux(const cpl_image * image) { CPL_IMAGE_GET_STATS_DOUBLE_BODY(absflux, ABSFLUX); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes the sum of squared values over an image @param image input image. @return the sqaure flux @see cpl_image_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_sqflux(const cpl_image * image) { CPL_IMAGE_GET_STATS_DOUBLE_BODY(sqflux, SQFLUX); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes the x centroid value over the whole image @param image input image. @return the x centroid value @see cpl_image_get_min_window() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_centroid_x(const cpl_image * image) { CPL_IMAGE_GET_STATS_DOUBLE_BODY(centroid_x, CENTROID); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes the x centroid value over an image sub-window @param image input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return the x centroid value @see cpl_image_get_min_window() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_centroid_x_window(const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { CPL_IMAGE_GET_STATS_WINDOW_DOUBLE_BODY(centroid_x, CENTROID); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes the y centroid value over the whole image @param image input image. @return the y centroid value @see cpl_image_get_min_window() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_centroid_y(const cpl_image * image) { CPL_IMAGE_GET_STATS_DOUBLE_BODY(centroid_y, CENTROID); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes the y centroid value over an image sub-window @param image input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return the y centroid value @see cpl_image_get_min_window() */ /*----------------------------------------------------------------------------*/ double cpl_image_get_centroid_y_window(const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { CPL_IMAGE_GET_STATS_WINDOW_DOUBLE_BODY(centroid_y, CENTROID); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes minimum pixel value and position over an image sub window. @param image Input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @param px ptr to the x coordinate of the minimum position @param py ptr to the y coordinate of the minimum position @return CPL_ERROR_NONE or the #_cpl_error_code_ on error @see cpl_image_get_min_window() The specified bounds are included in the specified region. Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_get_minpos_window(const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size * px, cpl_size * py) { cpl_stats * stats; cpl_ensure_code(px != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(py != NULL, CPL_ERROR_NULL_INPUT); stats = cpl_stats_new_from_image_window(image, CPL_STATS_MINPOS, llx, lly, urx, ury); cpl_ensure_code(stats != NULL, cpl_error_get_code()); /* Should not be able to fail now */ *px = cpl_stats_get_min_x(stats); *py = cpl_stats_get_min_y(stats); cpl_stats_delete(stats); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes minimum pixel value and position over an image. @param image Input image. @param px ptr to the x coordinate of the minimum position @param py ptr to the y coordinate of the minimum position @return CPL_ERROR_NONE or the #_cpl_error_code_ on error @see cpl_image_get_minpos_window() Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_get_minpos(const cpl_image * image, cpl_size * px, cpl_size * py) { cpl_stats * stats; cpl_ensure_code(px != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(py != NULL, CPL_ERROR_NULL_INPUT); stats = cpl_stats_new_from_image(image, CPL_STATS_MINPOS); cpl_ensure_code(stats != NULL, cpl_error_get_code()); /* Should not be able to fail now */ *px = cpl_stats_get_min_x(stats); *py = cpl_stats_get_min_y(stats); cpl_stats_delete(stats); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes maximum pixel value and position over an image sub window. @param image Input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @param px ptr to the x coordinate of the maximum position @param py ptr to the y coordinate of the maximum position @return CPL_ERROR_NONE or the #_cpl_error_code_ on error @see cpl_image_get_minpos_window() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_get_maxpos_window(const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size * px, cpl_size * py) { cpl_stats * stats; cpl_ensure_code(px != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(py != NULL, CPL_ERROR_NULL_INPUT); stats = cpl_stats_new_from_image_window(image, CPL_STATS_MAXPOS, llx, lly, urx, ury); cpl_ensure_code(stats != NULL, cpl_error_get_code()); /* Should not be able to fail now */ *px = cpl_stats_get_max_x(stats); *py = cpl_stats_get_max_y(stats); cpl_stats_delete(stats); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes maximum pixel value and position over an image. @param image Input image. @param px ptr to the x coordinate of the maximum position @param py ptr to the y coordinate of the maximum position @return CPL_ERROR_NONE or the #_cpl_error_code_ on error @see cpl_image_get_minpos() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_get_maxpos(const cpl_image * image, cpl_size * px, cpl_size * py) { cpl_stats * stats; cpl_ensure_code(px != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(py != NULL, CPL_ERROR_NULL_INPUT); stats = cpl_stats_new_from_image(image, CPL_STATS_MAXPOS); cpl_ensure_code(stats != NULL, cpl_error_get_code()); /* Should not be able to fail now */ *px = cpl_stats_get_max_x(stats); *py = cpl_stats_get_max_y(stats); cpl_stats_delete(stats); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes median and mean absolute median deviation on an image window @param image Input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @param sigma The mean of the absolute median deviation of the (good) pixels @return The median of the non-bad pixels @see cpl_image_get_mad_window() For each non-bad pixel in the window the absolute deviation from the median is computed. The mean of these absolute deviations in returned via sigma, while the median itself is returned by the function. The computed median and sigma may be a robust estimate of the mean and standard deviation of the pixels. The sigma is however still sensitive to outliers. See cpl_image_get_mad_window() for a more robust estimator. Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE. On error the #_cpl_error_code_ code is set and the return value is undefined. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is not supported - CPL_ERROR_ILLEGAL_INPUT if the specified window is illegal - CPL_ERROR_DATA_NOT_FOUND if all the pixels are bad in the image window */ /*----------------------------------------------------------------------------*/ double cpl_image_get_median_dev_window(const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, double * sigma) { cpl_stats * stats; double median; cpl_ensure_code(sigma != NULL, CPL_ERROR_NULL_INPUT); stats = cpl_stats_new_from_image_window(image, CPL_STATS_MEDIAN_DEV, llx, lly, urx, ury); cpl_ensure(stats != NULL, cpl_error_get_code(), 0.0); /* Should not be able to fail now */ median = cpl_stats_get_median(stats); *sigma = cpl_stats_get_median_dev(stats); cpl_stats_delete(stats); return median; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes median and mean absolute median deviation on an image window @param image Input image. @param sigma The mean of the absolute median deviation of the (good) pixels @return The median of the non-bad pixels @see cpl_image_get_median_dev_window() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is not supported - CPL_ERROR_DATA_NOT_FOUND if all the pixels are bad in the image */ /*----------------------------------------------------------------------------*/ double cpl_image_get_median_dev(const cpl_image * image, double * sigma) { cpl_stats * stats; double median; cpl_ensure_code(sigma != NULL, CPL_ERROR_NULL_INPUT); stats = cpl_stats_new_from_image(image, CPL_STATS_MEDIAN_DEV); cpl_ensure(stats != NULL, cpl_error_get_code(), 0.0); /* Should not be able to fail now */ median = cpl_stats_get_median(stats); *sigma = cpl_stats_get_median_dev(stats); cpl_stats_delete(stats); return median; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes median and median absolute deviation (MAD) on an image window @param image Input image. @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @param sigma The median of the absolute median deviation of the good pixels @return The median of the non-bad pixels @see cpl_image_get_median_window(), CPL_MATH_STD_MAD For each non-bad pixel in the window the absolute deviation from the median is computed. The median of these absolute deviations in returned via sigma, while the median itself is returned by the function. If the pixels are gaussian, the computed sigma is a robust and consistent estimate of the standard deviation in the sense that the standard deviation is approximately k * MAD, where k is a constant equal to approximately 1.4826. CPL defines CPL_MATH_STD_MAD as this scaling constant. Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE. On error the #_cpl_error_code_ code is set and the return value is undefined. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is not supported - CPL_ERROR_ILLEGAL_INPUT if the specified window is illegal - CPL_ERROR_DATA_NOT_FOUND if all the pixels are bad in the image window */ /*----------------------------------------------------------------------------*/ double cpl_image_get_mad_window(const cpl_image * image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, double * sigma) { cpl_stats * stats; double median; cpl_ensure_code(sigma != NULL, CPL_ERROR_NULL_INPUT); stats = cpl_stats_new_from_image_window(image, CPL_STATS_MAD, llx, lly, urx, ury); cpl_ensure(stats != NULL, cpl_error_get_code(), 0.0); /* Should not be able to fail now */ median = cpl_stats_get_median(stats); *sigma = cpl_stats_get_mad(stats); cpl_stats_delete(stats); return median; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Computes median and median absolute deviation (MAD) on an image @param image Input image. @param sigma The median of the absolute median deviation of the good pixels @return The median of the non-bad pixels @see cpl_image_get_mad_window() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is not supported - CPL_ERROR_DATA_NOT_FOUND if all the pixels are bad in the image */ /*----------------------------------------------------------------------------*/ double cpl_image_get_mad(const cpl_image * image, double * sigma) { cpl_stats * stats; double median; cpl_ensure_code(sigma != NULL, CPL_ERROR_NULL_INPUT); stats = cpl_stats_new_from_image(image, CPL_STATS_MAD); cpl_ensure(stats != NULL, cpl_error_get_code(), 0.0); /* Should not be able to fail now */ median = cpl_stats_get_median(stats); *sigma = cpl_stats_get_mad(stats); cpl_stats_delete(stats); return median; } cpl-6.4.1/cplcore/cpl_matrix.h0000644000460300003120000001561411614525050013162 00000000000000/* $Id: cpl_matrix.h,v 1.40 2011-07-29 12:40:08 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-29 12:40:08 $ * $Revision: 1.40 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_MATRIX_H #define CPL_MATRIX_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Typedefs -----------------------------------------------------------------------------*/ typedef struct _cpl_matrix_ cpl_matrix; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* * IO methods */ cpl_matrix *cpl_matrix_new(cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_matrix *cpl_matrix_wrap(cpl_size, cpl_size, double *) CPL_ATTR_ALLOC; void cpl_matrix_delete(cpl_matrix *); void *cpl_matrix_unwrap(cpl_matrix *); void cpl_matrix_dump(const cpl_matrix *, FILE *); /* * Accessors */ cpl_size cpl_matrix_get_nrow(const cpl_matrix *); cpl_size cpl_matrix_get_ncol(const cpl_matrix *); double *cpl_matrix_get_data(cpl_matrix *); const double *cpl_matrix_get_data_const(const cpl_matrix *); double cpl_matrix_get(const cpl_matrix *, cpl_size, cpl_size); cpl_error_code cpl_matrix_set(cpl_matrix *, cpl_size, cpl_size, double); /* * Copying methods */ cpl_matrix *cpl_matrix_duplicate(const cpl_matrix *) CPL_ATTR_ALLOC; cpl_matrix *cpl_matrix_extract(const cpl_matrix *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_matrix *cpl_matrix_extract_row(const cpl_matrix *, cpl_size) CPL_ATTR_ALLOC; cpl_matrix *cpl_matrix_extract_column(const cpl_matrix *, cpl_size) CPL_ATTR_ALLOC; cpl_matrix *cpl_matrix_extract_diagonal(const cpl_matrix *, cpl_size) CPL_ATTR_ALLOC; /* * Writing methods */ cpl_error_code cpl_matrix_copy(cpl_matrix *, const cpl_matrix *, cpl_size, cpl_size); cpl_error_code cpl_matrix_fill(cpl_matrix *, double); cpl_error_code cpl_matrix_fill_row(cpl_matrix *, double, cpl_size); cpl_error_code cpl_matrix_fill_column(cpl_matrix *, double, cpl_size); cpl_error_code cpl_matrix_fill_diagonal(cpl_matrix *, double, cpl_size); cpl_error_code cpl_matrix_fill_window(cpl_matrix *, double, cpl_size, cpl_size, cpl_size, cpl_size); /* * Test methods */ int cpl_matrix_is_zero(const cpl_matrix *, double); int cpl_matrix_is_diagonal(const cpl_matrix *, double); int cpl_matrix_is_identity(const cpl_matrix *, double); /* * Sorting methods */ cpl_error_code cpl_matrix_sort_rows(cpl_matrix *, int); cpl_error_code cpl_matrix_sort_columns(cpl_matrix *, int); /* * Handling methods */ cpl_error_code cpl_matrix_threshold_small(cpl_matrix *, double); cpl_error_code cpl_matrix_swap_rows(cpl_matrix *, cpl_size, cpl_size); cpl_error_code cpl_matrix_swap_columns(cpl_matrix *, cpl_size, cpl_size); cpl_error_code cpl_matrix_swap_rowcolumn(cpl_matrix *, cpl_size); cpl_error_code cpl_matrix_flip_rows(cpl_matrix *); cpl_error_code cpl_matrix_flip_columns(cpl_matrix *); cpl_error_code cpl_matrix_erase_rows(cpl_matrix *, cpl_size, cpl_size); cpl_error_code cpl_matrix_erase_columns(cpl_matrix *, cpl_size, cpl_size); cpl_error_code cpl_matrix_set_size(cpl_matrix *, cpl_size, cpl_size); cpl_error_code cpl_matrix_resize(cpl_matrix *, cpl_size, cpl_size, cpl_size, cpl_size); cpl_error_code cpl_matrix_append(cpl_matrix *, const cpl_matrix *, int); /* * Basic operations */ cpl_error_code cpl_matrix_shift(cpl_matrix *, cpl_size, cpl_size); cpl_error_code cpl_matrix_add(cpl_matrix *, const cpl_matrix *); cpl_error_code cpl_matrix_subtract(cpl_matrix *, const cpl_matrix *); cpl_error_code cpl_matrix_multiply(cpl_matrix *, const cpl_matrix *); cpl_error_code cpl_matrix_divide(cpl_matrix *, const cpl_matrix *); cpl_error_code cpl_matrix_add_scalar(cpl_matrix *, double); cpl_error_code cpl_matrix_subtract_scalar(cpl_matrix *, double); cpl_error_code cpl_matrix_multiply_scalar(cpl_matrix *, double); cpl_error_code cpl_matrix_divide_scalar(cpl_matrix *, double); cpl_error_code cpl_matrix_logarithm(cpl_matrix *, double); cpl_error_code cpl_matrix_exponential(cpl_matrix *, double); cpl_error_code cpl_matrix_power(cpl_matrix *, double); cpl_matrix *cpl_matrix_product_create(const cpl_matrix *, const cpl_matrix *) CPL_ATTR_ALLOC; cpl_matrix *cpl_matrix_transpose_create(const cpl_matrix *) CPL_ATTR_ALLOC; /* * More complex operations */ double cpl_matrix_get_determinant(const cpl_matrix *); cpl_matrix *cpl_matrix_solve(const cpl_matrix *, const cpl_matrix *) CPL_ATTR_ALLOC; cpl_matrix *cpl_matrix_solve_normal(const cpl_matrix *, const cpl_matrix *) CPL_ATTR_ALLOC; cpl_matrix *cpl_matrix_invert_create(const cpl_matrix *) CPL_ATTR_ALLOC; cpl_error_code cpl_matrix_decomp_lu(cpl_matrix *, cpl_array *, int *); cpl_error_code cpl_matrix_solve_lu(const cpl_matrix *, cpl_matrix *, const cpl_array *); cpl_error_code cpl_matrix_decomp_chol(cpl_matrix *); cpl_error_code cpl_matrix_solve_chol(const cpl_matrix *, cpl_matrix *); /* * Stats methods */ double cpl_matrix_get_mean(const cpl_matrix *); double cpl_matrix_get_median(const cpl_matrix *); double cpl_matrix_get_stdev(const cpl_matrix *); double cpl_matrix_get_min(const cpl_matrix *); double cpl_matrix_get_max(const cpl_matrix *); cpl_error_code cpl_matrix_get_minpos(const cpl_matrix *, cpl_size *, cpl_size *); cpl_error_code cpl_matrix_get_maxpos(const cpl_matrix *, cpl_size *, cpl_size *); CPL_END_DECLS #endif /* end of cpl_matrix.h */ cpl-6.4.1/cplcore/cpl_bivector.c0000644000460300003120000006227512016651643013500 00000000000000/* $Id: cpl_bivector.c,v 1.43 2012-08-27 11:01:55 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-08-27 11:01:55 $ * $Revision: 1.43 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include "cpl_memory.h" #include "cpl_bivector.h" #include "cpl_tools.h" #include "cpl_error_impl.h" #include "cpl_type.h" /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ #define HALF_CENTROID_DOMAIN 5 /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_bivector Bi-vector object * * This module provides functions to handle @em cpl_bivector. * * A @em cpl_bivector is composed of two vectors of the same size. It can * be used to store 1d functions, with the x and y positions of the * samples, offsets in x and y or simply positions in an image. * * This module provides among other things functions for interpolation and * for sorting one vector according to another. * * @par Synopsis: * @code * #include "cpl_bivector.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Type definition -----------------------------------------------------------------------------*/ struct _cpl_bivector_ { cpl_vector * x; cpl_vector * y; }; /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Create a new cpl_bivector @param n Positive number of points @return 1 newly allocated cpl_bivector or NULL on error The returned object must be deallocated using cpl_bivector_delete() or cpl_bivector_unwrap_vectors(), provided the two cpl_vectors are deallocated separately. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if n is < 1. */ /*----------------------------------------------------------------------------*/ cpl_bivector * cpl_bivector_new(cpl_size n) { cpl_bivector * f; /* Test input */ cpl_ensure(n > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Allocate memory */ f = cpl_malloc(sizeof(cpl_bivector)); f->x = cpl_vector_new(n); f->y = cpl_vector_new(n); return f; } /*----------------------------------------------------------------------------*/ /** @brief Create a new cpl_bivector from two cpl_vectors @param x the x cpl_vector @param y the y cpl_vector @return 1 cpl_bivector or NULL on error @note The input cpl_vectors must have identical sizes. Afterwards one of those two vectors may be resized, which will corrupt the bivector. Such a corrupted bivector should not be used any more, but rather deallocated, using cpl_bivector_unwrap_vectors() or cpl_bivector_delete(). The returned object must be deallocated using cpl_bivector_delete() or with cpl_bivector_unwrap_vectors(), provided the two cpl_vectors are deallocated separately. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the input vectors have different sizes */ /*----------------------------------------------------------------------------*/ cpl_bivector * cpl_bivector_wrap_vectors( cpl_vector * x, cpl_vector * y) { cpl_bivector * f; /* Test input */ cpl_ensure(x, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(y, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(cpl_vector_get_size(x)==cpl_vector_get_size(y), CPL_ERROR_ILLEGAL_INPUT, NULL); /* Allocate memory */ f = cpl_malloc(sizeof(cpl_bivector)); f->x = x; f->y = y; return f; } /*----------------------------------------------------------------------------*/ /** @brief Duplicate a cpl_bivector @param in cpl_bivector to duplicate @return 1 newly allocated cpl_bivector or NULL on error The returned object must be deallocated using cpl_bivector_delete() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the input bivector contains vectors of different sizes */ /*----------------------------------------------------------------------------*/ cpl_bivector * cpl_bivector_duplicate(const cpl_bivector * in) { cpl_bivector * out; cpl_ensure(in, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(cpl_vector_get_size(in->x)==cpl_vector_get_size(in->y), CPL_ERROR_ILLEGAL_INPUT, NULL); out = cpl_malloc(sizeof(cpl_bivector)); out->x = cpl_vector_duplicate(in->x); out->y = cpl_vector_duplicate(in->y); return out; } /*----------------------------------------------------------------------------*/ /** @brief Copy contents of a bivector into another bivector @param self destination cpl_vector @param other source cpl_vector @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_vector_set_size() if source and destination have different sizes. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_bivector_copy(cpl_bivector * self, const cpl_bivector * other) { return cpl_vector_copy(cpl_bivector_get_x(self), cpl_bivector_get_x_const(other)) || cpl_vector_copy(cpl_bivector_get_y(self), cpl_bivector_get_y_const(other)) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Delete a cpl_bivector @param f cpl_bivector to delete @return void This function deletes a bivector. If the input bivector @em f is @c NULL, nothing is done, and no error is set. */ /*----------------------------------------------------------------------------*/ void cpl_bivector_delete(cpl_bivector * f) { if (f == NULL) return; cpl_vector_delete(f->x); cpl_vector_delete(f->y); cpl_free(f); return; } /*----------------------------------------------------------------------------*/ /** @brief Free memory associated to a cpl_bivector, excluding the two vectors. @param f cpl_bivector to delete @return void @see cpl_bivector_wrap_vectors */ /*----------------------------------------------------------------------------*/ void cpl_bivector_unwrap_vectors(cpl_bivector * f) { cpl_free(f); return; } /*----------------------------------------------------------------------------*/ /** @brief Dump a cpl_bivector as ASCII to a stream @param f Input cpl_bivector to dump or NULL @param stream Output stream, accepts @c stdout or @c stderr or NULL @return void Comment lines start with the hash character. stream may be NULL in which case @c stdout is used. @note In principle a cpl_bivector can be saved using cpl_bivector_dump() and re-read using cpl_bivector_read(). This will however introduce significant precision loss due to the limited accuracy of the ASCII representation. */ /*----------------------------------------------------------------------------*/ void cpl_bivector_dump(const cpl_bivector * f, FILE * stream) { const double * data_x; const double * data_y; cpl_size i; if (stream == NULL) stream = stdout; if (f == NULL) { fprintf(stream, "#NULL bivector\n"); return; } if (cpl_vector_get_size(f->x) != cpl_vector_get_size(f->y)) return; data_x = cpl_vector_get_data_const(f->x); data_y = cpl_vector_get_data_const(f->y); fprintf(stream, "#--- Bi-vector ---\n"); fprintf(stream, "# X Y \n"); for (i = 0; i < cpl_bivector_get_size(f); i++) fprintf(stream, "%g\t%g\n", data_x[i], data_y[i]); fprintf(stream, "#-----------------------\n"); return; } /*----------------------------------------------------------------------------*/ /** @brief Read a list of values from an ASCII file and create a cpl_bivector @param filename Name of the input ASCII file @return 1 newly allocated cpl_bivector or NULL on error @see cpl_vector_load The input ASCII file must contain two values per line. The returned object must be deallocated using cpl_bivector_delete() Two columns of numbers are expected in the input file. In addition to normal files, FIFO (see man mknod) are also supported. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_FILE_IO if the file cannot be read - CPL_ERROR_BAD_FILE_FORMAT if the file contains no valid lines */ /*----------------------------------------------------------------------------*/ cpl_bivector * cpl_bivector_read(const char * filename) { FILE * in; cpl_vector * v1; cpl_vector * v2; cpl_size np = 0; cpl_size size = 1000; /* Default size */ char line[1024]; double x, y; cpl_ensure(filename, CPL_ERROR_NULL_INPUT, NULL); /* Open the file */ in = fopen(filename, "r"); cpl_ensure(in, CPL_ERROR_FILE_IO, NULL); /* Create and fill the vectors */ v1 = cpl_vector_new(size); v2 = cpl_vector_new(size); while (fgets(line, 1024, in) != NULL) { if (line[0] != '#' && sscanf(line, "%lg %lg", &x, &y) == 2) { /* Found new element-pair - increase vector sizes if necessary, - insert element at end and - increment size counter */ if (np == size) { size *= 2; cpl_vector_set_size(v1, size); cpl_vector_set_size(v2, size); } cpl_vector_set(v1, np, x); cpl_vector_set(v2, np, y); np++; } } /* Check that the loop ended due to eof and not an error */ if (ferror(in)) { fclose(in); cpl_vector_delete(v1); cpl_vector_delete(v2); (void)cpl_error_set_(CPL_ERROR_FILE_IO); return NULL; } fclose(in); /* Check that the file was not empty and set the size to its true value */ if (np == 0 || cpl_vector_set_size(v1, np) || cpl_vector_set_size(v2, np)) { cpl_vector_delete(v1); cpl_vector_delete(v2); (void)cpl_error_set_(CPL_ERROR_BAD_FILE_FORMAT); return NULL; } /* Cannot fail at this point */ return cpl_bivector_wrap_vectors(v1, v2); } /*----------------------------------------------------------------------------*/ /** @brief Get the size of the cpl_bivector @param in the input bivector @return The size or a negative number on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the input bivector contains vectors of different sizes */ /*----------------------------------------------------------------------------*/ cpl_size cpl_bivector_get_size(const cpl_bivector * in) { cpl_size size; cpl_ensure(in, CPL_ERROR_NULL_INPUT, -1); assert( in->x ); assert( in->y ); /* Get sizes of x and y vectors */ size = cpl_vector_get_size(in->x); cpl_ensure(size == cpl_vector_get_size(in->y), CPL_ERROR_ILLEGAL_INPUT, -2); return size; } /*----------------------------------------------------------------------------*/ /** @brief Get a pointer to the x vector of the cpl_bivector @param in a cpl_bivector @return Pointer to the x vector or NULL on error The returned pointer refers to an already created cpl_vector. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_bivector_get_x(cpl_bivector * in) { cpl_ensure(in, CPL_ERROR_NULL_INPUT, NULL); assert( in->x ); return in->x; } /*----------------------------------------------------------------------------*/ /** @brief Get a pointer to the x vector of the cpl_bivector @param in a cpl_bivector @return Pointer to the x vector or NULL on error @see cpl_bivector_get_x */ /*----------------------------------------------------------------------------*/ const cpl_vector * cpl_bivector_get_x_const (const cpl_bivector * in) { cpl_ensure(in, CPL_ERROR_NULL_INPUT, NULL); assert( in->x ); return in->x; } /*----------------------------------------------------------------------------*/ /** @brief Get a pointer to the y vector of the cpl_bivector @param in a cpl_bivector @return Pointer to the y vector or NULL on error The returned pointer refers to an already created cpl_vector. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_bivector_get_y(cpl_bivector * in) { cpl_ensure(in, CPL_ERROR_NULL_INPUT, NULL); assert( in->y ); return in->y; } /*----------------------------------------------------------------------------*/ /** @brief Get a pointer to the y vector of the cpl_bivector @param in a cpl_bivector @return Pointer to the y vector or NULL on error */ /*----------------------------------------------------------------------------*/ const cpl_vector * cpl_bivector_get_y_const(const cpl_bivector * in) { cpl_ensure(in, CPL_ERROR_NULL_INPUT, NULL); assert( in->y ); return in->y; } /*----------------------------------------------------------------------------*/ /** @brief Get a pointer to the x data part of the cpl_bivector @param in a cpl_bivector @return Pointer to the double x array or NULL on error @see cpl_vector_get_data The returned pointer refers to already allocated data. @note Use at your own risk: direct manipulation of vector data rules out any check performed by the vector object interface, and may introduce inconsistencies between the information maintained internally, and the actual vector data and structure. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ double * cpl_bivector_get_x_data(cpl_bivector * in) { cpl_ensure(in, CPL_ERROR_NULL_INPUT, NULL); assert( in->x ); return cpl_vector_get_data(in->x); } /*----------------------------------------------------------------------------*/ /** @brief Get a pointer to the x data part of the cpl_bivector @param in a cpl_bivector @return Pointer to the double x array or NULL on error @see cpl_bivector_get_x_data */ /*----------------------------------------------------------------------------*/ const double * cpl_bivector_get_x_data_const(const cpl_bivector * in) { cpl_ensure(in, CPL_ERROR_NULL_INPUT, NULL); assert( in->x ); return cpl_vector_get_data_const(in->x); } /*----------------------------------------------------------------------------*/ /** @brief Get a pointer to the y data part of the cpl_bivector @param in a cpl_bivector @return Pointer to the double y array or NULL on error @see cpl_vector_get_x_data Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ double * cpl_bivector_get_y_data(cpl_bivector * in) { cpl_ensure(in, CPL_ERROR_NULL_INPUT, NULL); assert( in->y ); return cpl_vector_get_data(in->y); } /*----------------------------------------------------------------------------*/ /** @brief Get a pointer to the y data part of the cpl_bivector @param in a cpl_bivector @return Pointer to the double y array or NULL on error @see cpl_bivector_get_y_data */ /*----------------------------------------------------------------------------*/ const double * cpl_bivector_get_y_data_const(const cpl_bivector * in) { cpl_ensure(in, CPL_ERROR_NULL_INPUT, NULL); assert( in->y ); return cpl_vector_get_data_const(in->y); } /*----------------------------------------------------------------------------*/ /** @brief Linear interpolation of a 1d-function @param fout Preallocated with X-vector set, to hold interpolation in Y @param fref Reference 1d-function @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ fref must have both its abscissa and ordinate defined. fout must have its abscissa defined and its ordinate allocated. The linear interpolation will be done from the values in fref to the abscissa points in fout. For each abscissa point in fout, fref must either have two neigboring abscissa points such that xref_i < xout_j < xref{i+1}, or a single identical abscissa point, such that xref_i == xout_j. This is ensured by monotonely growing abscissa points in both fout and fref (and by min(xref) <= min(xout) and max(xout) < max(xref)). However, for efficiency reasons (since fref can be very long) the monotonicity is only verified to the extent necessary to actually perform the interpolation. This input requirement implies that extrapolation is not allowed. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_DATA_NOT_FOUND if fout has an endpoint which is out of range - CPL_ERROR_ILLEGAL_INPUT if the monotonicity requirement on the 2 input abscissa vectors is not met. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_bivector_interpolate_linear(cpl_bivector * fout, const cpl_bivector * fref) { const cpl_size m = cpl_bivector_get_size(fref); const cpl_size n = cpl_bivector_get_size(fout); const double * xref = cpl_bivector_get_x_data_const(fref); const double * yref = cpl_bivector_get_y_data_const(fref); double * xout = cpl_bivector_get_x_data(fout); double * yout = cpl_bivector_get_y_data(fout); double grad = DBL_MAX; /* Avoid (false) uninit warning */ double y_0 = DBL_MAX; /* Avoid (false) uninit warning */ cpl_size ibelow, iabove; cpl_size i; cpl_ensure_code( xref != NULL, cpl_error_get_code()); cpl_ensure_code( yref != NULL, cpl_error_get_code()); cpl_ensure_code( xout != NULL, cpl_error_get_code()); cpl_ensure_code( yout != NULL, cpl_error_get_code()); /* Upper extrapolation not allowed */ cpl_ensure_code(xout[n-1] <= xref[m-1], CPL_ERROR_DATA_NOT_FOUND); /* Start interpolation from below */ ibelow = cpl_vector_find(cpl_bivector_get_x_const(fref), xout[0]); if (xout[0] < xref[ibelow]) { /* Lower extrapolation also not allowed */ cpl_ensure_code(ibelow > 0, CPL_ERROR_DATA_NOT_FOUND); ibelow--; } iabove = ibelow; /* Ensure grad initialization, for 1st interpolation */ /* assert( xref[iabove] <= xout[0] ); */ for (i = 0; i < n; i++) { /* When possible reuse reference function abscissa points */ if (xref[iabove] < xout[i]) { /* No, need new points */ while (xref[++iabove] < xout[i]); ibelow = iabove - 1; /* Verify that the pair of reference abscissa points are valid */ if (xref[iabove] <= xref[ibelow]) break; grad = (yref[iabove] - yref[ibelow]) / (xref[iabove] - xref[ibelow]); y_0 = yref[ibelow] - grad * xref[ibelow]; } if (xref[ibelow] < xout[i]) { yout[i] = y_0 + grad * xout[i]; } else { /* assert( xout[i] == xref[ibelow] ); */ yout[i] = yref[ibelow]; } } return i == n ? CPL_ERROR_NONE : cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } /*----------------------------------------------------------------------------*/ /** @brief Sort a cpl_bivector @param self cpl_bivector to hold sorted result @param other Input cpl_bivector to sort, may equal self @param dir CPL_SORT_ASCENDING or CPL_SORT_DESCENDING @param mode CPL_SORT_BY_X or CPL_SORT_BY_Y @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error The values in the input are sorted according to direction and mode, and the result is placed self which must be of the same size as other. As for qsort(): If two members compare as equal, their order in the sorted array is undefined. In place sorting is supported. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if self and other have different sizes - CPL_ERROR_ILLEGAL_INPUT if dir is neither CPL_SORT_DESCENDING nor CPL_SORT_ASCENDING. - CPL_ERROR_UNSUPPORTED_MODE if self and other are the same or point to the same underlying arrays, or if mode is neither CPL_SORT_BY_X nor CPL_SORT_BY_Y */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_bivector_sort(cpl_bivector * self, const cpl_bivector * other, cpl_sort_direction dir, cpl_sort_mode mode) { const cpl_size n = cpl_bivector_get_size(self); cpl_size * perm; const double * data; int reverse; cpl_size i; cpl_error_code error = CPL_ERROR_NONE; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(other != NULL, CPL_ERROR_NULL_INPUT); /* At least one of the two bivectors must have two distinct buffers (otherwise the call is utterly pointless) */ cpl_ensure_code(cpl_bivector_get_x_data_const(self) != cpl_bivector_get_y_data_const(self) || cpl_bivector_get_x_data_const(other) != cpl_bivector_get_y_data_const(other), CPL_ERROR_UNSUPPORTED_MODE); cpl_ensure_code(cpl_bivector_get_size(other) == n, CPL_ERROR_INCOMPATIBLE_INPUT); if (dir == CPL_SORT_ASCENDING) { reverse = 0; } else if (dir == CPL_SORT_DESCENDING) { reverse = 1; } else { return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } /* The sorting mode. Could later be extended with f.ex. CPL_SORT_BY_XY and CPL_SORT_BY_YX */ /* To allow for all possible sorting combinations, extensions to dir would be needed as well. This will probably not be requested */ if (mode == CPL_SORT_BY_X) { data = cpl_bivector_get_x_data_const(other); } else if (mode == CPL_SORT_BY_Y) { data = cpl_bivector_get_y_data_const(other); } else { return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } perm = (cpl_size*)cpl_malloc((size_t)n * sizeof(*perm)); for (i = 0; i < n; i++) { perm[i] = i; } if (cpl_tools_sort_stable_pattern_double(data, n, reverse, 1, perm)) { error = cpl_error_set_where_(); } else { double * dselfx = cpl_bivector_get_x_data(self); double * dselfy = cpl_bivector_get_y_data(self); const double * dotherx = cpl_bivector_get_x_data_const(other); const double * dothery = cpl_bivector_get_y_data_const(other); if (dselfx != dotherx && dselfy != dothery && dselfx != dothery && dselfy != dotherx) { /* Out-of place copy of the permuted values to self */ for (i = 0; i < n; i++) { dselfx[i] = dotherx[perm[i]]; dselfy[i] = dothery[perm[i]]; } } else if (cpl_tools_permute_double(perm, n, dselfx, dotherx, dselfy, dothery)) { error = cpl_error_set_where_(); } } cpl_free(perm); return error; } /**@}*/ cpl-6.4.1/cplcore/cpl_table.h0000644000460300003120000004605712270505777012767 00000000000000/* $Id: cpl_table.h,v 1.68 2013-01-23 16:06:32 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-01-23 16:06:32 $ * $Revision: 1.68 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_TABLE_H #define CPL_TABLE_H #include #include "cpl_io.h" #include "cpl_type.h" #include "cpl_propertylist.h" #include "cpl_array.h" CPL_BEGIN_DECLS typedef struct _cpl_table_ cpl_table; /* * Legal logical operators for selections: */ typedef enum _cpl_table_select_operator_ { CPL_EQUAL_TO = 0, CPL_NOT_EQUAL_TO, CPL_GREATER_THAN, CPL_NOT_GREATER_THAN, CPL_LESS_THAN, CPL_NOT_LESS_THAN } cpl_table_select_operator; /* * Constructors and destructors: */ cpl_table *cpl_table_new(cpl_size); cpl_error_code cpl_table_new_column(cpl_table *, const char *, cpl_type); cpl_error_code cpl_table_new_column_array(cpl_table *, const char *, cpl_type, cpl_size); cpl_error_code cpl_table_set_column_savetype(cpl_table *, const char *name, cpl_type); cpl_error_code cpl_table_wrap_int(cpl_table *, int *, const char *); cpl_error_code cpl_table_wrap_long_long(cpl_table *, long long *, const char *); cpl_error_code cpl_table_wrap_float(cpl_table *, float *, const char *); cpl_error_code cpl_table_wrap_double(cpl_table *, double *, const char *); #ifdef _Complex_I cpl_error_code cpl_table_wrap_float_complex(cpl_table *, _Complex float *, const char *); cpl_error_code cpl_table_wrap_double_complex(cpl_table *, _Complex double *, const char *); #endif cpl_error_code cpl_table_wrap_string(cpl_table *, char **, const char *); void *cpl_table_unwrap(cpl_table *, const char *); cpl_error_code cpl_table_copy_structure(cpl_table *, const cpl_table *); void cpl_table_delete(cpl_table *); /* * Methods: */ cpl_size cpl_table_get_nrow(const cpl_table *); cpl_size cpl_table_get_ncol(const cpl_table *); cpl_type cpl_table_get_column_type(const cpl_table *, const char *name); cpl_error_code cpl_table_set_column_unit(cpl_table *, const char *name, const char *unit); const char *cpl_table_get_column_unit(const cpl_table *, const char *name); cpl_error_code cpl_table_set_column_format(cpl_table *, const char *name, const char *format); const char *cpl_table_get_column_format(const cpl_table *, const char *name); cpl_error_code cpl_table_set_column_depth(cpl_table *, const char *, cpl_size); cpl_size cpl_table_get_column_depth(const cpl_table *, const char *); cpl_size cpl_table_get_column_dimensions(const cpl_table *, const char *); cpl_error_code cpl_table_set_column_dimensions(cpl_table *, const char *, const cpl_array *); cpl_size cpl_table_get_column_dimension(const cpl_table *, const char *, cpl_size); int *cpl_table_get_data_int(cpl_table *, const char *name); const int *cpl_table_get_data_int_const(const cpl_table *, const char *name); long long *cpl_table_get_data_long_long(cpl_table *, const char *name); const long long *cpl_table_get_data_long_long_const(const cpl_table *, const char *name); float *cpl_table_get_data_float(cpl_table *, const char *name); const float *cpl_table_get_data_float_const(const cpl_table *, const char *name); double *cpl_table_get_data_double(cpl_table *, const char *name); const double *cpl_table_get_data_double_const(const cpl_table *, const char *name); #ifdef _Complex_I _Complex float *cpl_table_get_data_float_complex(cpl_table *, const char *name); const _Complex float *cpl_table_get_data_float_complex_const(const cpl_table *, const char *name); _Complex double *cpl_table_get_data_double_complex(cpl_table *, const char *); const _Complex double *cpl_table_get_data_double_complex_const(const cpl_table *, const char *); #endif char **cpl_table_get_data_string(cpl_table *, const char *name); const char **cpl_table_get_data_string_const(const cpl_table *, const char *name); cpl_array **cpl_table_get_data_array(cpl_table *, const char *); const cpl_array **cpl_table_get_data_array_const(const cpl_table *, const char *); double cpl_table_get(const cpl_table *, const char *, cpl_size, int *null); int cpl_table_get_int(const cpl_table *, const char *, cpl_size, int *null); long long cpl_table_get_long_long(const cpl_table *, const char *, cpl_size, int *null); float cpl_table_get_float(const cpl_table *, const char *, cpl_size, int *null); double cpl_table_get_double(const cpl_table *, const char *, cpl_size, int *null); #ifdef _Complex_I _Complex double cpl_table_get_complex(const cpl_table *, const char *, cpl_size, int *); _Complex float cpl_table_get_float_complex(const cpl_table *, const char *, cpl_size, int *null); _Complex double cpl_table_get_double_complex(const cpl_table *, const char *, cpl_size, int *null); #endif const char *cpl_table_get_string(const cpl_table *, const char *, cpl_size); const cpl_array *cpl_table_get_array(const cpl_table *, const char *, cpl_size); cpl_error_code cpl_table_set(cpl_table *, const char *, cpl_size, double); cpl_error_code cpl_table_set_int(cpl_table *, const char *, cpl_size, int); cpl_error_code cpl_table_set_long_long(cpl_table *, const char *, cpl_size, long long); cpl_error_code cpl_table_set_float(cpl_table *, const char *, cpl_size, float); cpl_error_code cpl_table_set_double(cpl_table *, const char *, cpl_size, double); #ifdef _Complex_I cpl_error_code cpl_table_set_complex(cpl_table *, const char *, cpl_size, _Complex double); cpl_error_code cpl_table_set_float_complex(cpl_table *, const char *, cpl_size, _Complex float); cpl_error_code cpl_table_set_double_complex(cpl_table *, const char *, cpl_size, _Complex double); #endif cpl_error_code cpl_table_set_string(cpl_table *, const char *, cpl_size, const char *); cpl_error_code cpl_table_set_array(cpl_table *, const char *, cpl_size, const cpl_array *); cpl_error_code cpl_table_fill_column_window(cpl_table *, const char *, cpl_size, cpl_size, double); cpl_error_code cpl_table_fill_column_window_int(cpl_table *, const char *, cpl_size, cpl_size, int); cpl_error_code cpl_table_fill_column_window_long_long(cpl_table *, const char *, cpl_size, cpl_size, long long); cpl_error_code cpl_table_fill_column_window_float(cpl_table *, const char *, cpl_size, cpl_size, float); cpl_error_code cpl_table_fill_column_window_double(cpl_table *, const char *, cpl_size, cpl_size, double); #ifdef _Complex_I cpl_error_code cpl_table_fill_column_window_complex(cpl_table *, const char *, cpl_size, cpl_size, _Complex double); cpl_error_code cpl_table_fill_column_window_float_complex(cpl_table *, const char *, cpl_size, cpl_size, _Complex float); cpl_error_code cpl_table_fill_column_window_double_complex(cpl_table *, const char *, cpl_size, cpl_size, _Complex double); #endif cpl_error_code cpl_table_fill_column_window_string(cpl_table *, const char *, cpl_size, cpl_size, const char *); cpl_error_code cpl_table_fill_column_window_array(cpl_table *, const char *, cpl_size, cpl_size, const cpl_array *); cpl_error_code cpl_table_copy_data_int(cpl_table *, const char *, const int *); cpl_error_code cpl_table_copy_data_long_long(cpl_table *, const char *, const long long *); cpl_error_code cpl_table_copy_data_float(cpl_table *, const char *, const float *); cpl_error_code cpl_table_copy_data_double(cpl_table *, const char *, const double *); #ifdef _Complex_I cpl_error_code cpl_table_copy_data_float_complex(cpl_table *, const char *, const _Complex float *); cpl_error_code cpl_table_copy_data_double_complex(cpl_table *, const char *, const _Complex double *); #endif cpl_error_code cpl_table_copy_data_string(cpl_table *, const char *, const char **); cpl_error_code cpl_table_shift_column(cpl_table *, const char *, cpl_size); cpl_error_code cpl_table_set_invalid(cpl_table *, const char *, cpl_size); cpl_error_code cpl_table_set_column_invalid(cpl_table *, const char *, cpl_size, cpl_size); int cpl_table_is_valid(const cpl_table *, const char *, cpl_size); cpl_size cpl_table_count_invalid(const cpl_table *, const char *); int cpl_table_has_invalid(const cpl_table *table, const char *name); int cpl_table_has_valid(const cpl_table *table, const char *name); cpl_error_code cpl_table_fill_invalid_int(cpl_table *, const char *, int); cpl_error_code cpl_table_fill_invalid_long_long(cpl_table *, const char *, long long); cpl_error_code cpl_table_fill_invalid_float(cpl_table *, const char *, float); cpl_error_code cpl_table_fill_invalid_double(cpl_table *, const char *, double); #ifdef _Complex_I cpl_error_code cpl_table_fill_invalid_float_complex(cpl_table *, const char *, _Complex float); cpl_error_code cpl_table_fill_invalid_double_complex(cpl_table *, const char *, _Complex double); #endif cpl_error_code cpl_table_erase_column(cpl_table *, const char *); cpl_error_code cpl_table_move_column(cpl_table *, const char *, cpl_table *); cpl_error_code cpl_table_duplicate_column(cpl_table *, const char *, const cpl_table *, const char *); cpl_error_code cpl_table_name_column(cpl_table *, const char *, const char *); int cpl_table_has_column(const cpl_table *, const char *); const char *cpl_table_get_column_name(const cpl_table *) CPL_ATTR_DEPRECATED; cpl_array *cpl_table_get_column_names(const cpl_table *table); cpl_error_code cpl_table_set_size(cpl_table *, cpl_size); cpl_table *cpl_table_duplicate(const cpl_table *); cpl_table *cpl_table_extract(const cpl_table *, cpl_size, cpl_size); cpl_table *cpl_table_extract_selected(const cpl_table *); cpl_array *cpl_table_where_selected(const cpl_table *); cpl_error_code cpl_table_erase_selected(cpl_table *); cpl_error_code cpl_table_erase_window(cpl_table *, cpl_size, cpl_size); cpl_error_code cpl_table_insert_window(cpl_table *, cpl_size, cpl_size); int cpl_table_compare_structure(const cpl_table *, const cpl_table *); cpl_error_code cpl_table_insert(cpl_table *, const cpl_table *, cpl_size); cpl_error_code cpl_table_cast_column(cpl_table *, const char *, const char *, cpl_type); cpl_error_code cpl_table_add_columns(cpl_table *, const char *, const char *); cpl_error_code cpl_table_subtract_columns(cpl_table *, const char *, const char *); cpl_error_code cpl_table_multiply_columns(cpl_table *, const char *, const char *); cpl_error_code cpl_table_divide_columns(cpl_table *, const char *, const char *); cpl_error_code cpl_table_add_scalar(cpl_table *, const char *, double); cpl_error_code cpl_table_subtract_scalar(cpl_table *, const char *, double); cpl_error_code cpl_table_multiply_scalar(cpl_table *, const char *, double); cpl_error_code cpl_table_divide_scalar(cpl_table *, const char *, double); #ifdef _Complex_I cpl_error_code cpl_table_add_scalar_complex(cpl_table *, const char *, _Complex double); cpl_error_code cpl_table_subtract_scalar_complex(cpl_table *, const char *, _Complex double); cpl_error_code cpl_table_multiply_scalar_complex(cpl_table *, const char *, _Complex double); cpl_error_code cpl_table_divide_scalar_complex(cpl_table *, const char *, _Complex double); #endif cpl_error_code cpl_table_abs_column(cpl_table *, const char *); cpl_error_code cpl_table_logarithm_column(cpl_table *, const char *, double); cpl_error_code cpl_table_power_column(cpl_table *, const char *, double); cpl_error_code cpl_table_exponential_column(cpl_table *, const char *, double); cpl_error_code cpl_table_conjugate_column(cpl_table *, const char *); cpl_error_code cpl_table_real_column(cpl_table *, const char *); cpl_error_code cpl_table_imag_column(cpl_table *, const char *); cpl_error_code cpl_table_arg_column(cpl_table *, const char *); cpl_error_code cpl_table_erase_invalid_rows(cpl_table *); cpl_error_code cpl_table_erase_invalid(cpl_table *); double cpl_table_get_column_max(const cpl_table *, const char *); double cpl_table_get_column_min(const cpl_table *, const char *); cpl_error_code cpl_table_get_column_maxpos(const cpl_table *, const char *, cpl_size *); cpl_error_code cpl_table_get_column_minpos(const cpl_table *, const char *, cpl_size *); #ifdef _Complex_I _Complex double cpl_table_get_column_mean_complex(const cpl_table *, const char *); #endif double cpl_table_get_column_mean(const cpl_table *, const char *); double cpl_table_get_column_median(const cpl_table *, const char *); double cpl_table_get_column_stdev(const cpl_table *, const char *); cpl_error_code cpl_table_sort(cpl_table *, const cpl_propertylist *); cpl_size cpl_table_and_selected_window(cpl_table *, cpl_size, cpl_size); cpl_size cpl_table_or_selected_window(cpl_table *, cpl_size, cpl_size); cpl_size cpl_table_not_selected(cpl_table *); cpl_error_code cpl_table_select_row(cpl_table *, cpl_size); cpl_error_code cpl_table_unselect_row(cpl_table *, cpl_size); cpl_error_code cpl_table_select_all(cpl_table *); cpl_error_code cpl_table_unselect_all(cpl_table *); cpl_size cpl_table_and_selected_invalid(cpl_table *, const char *); cpl_size cpl_table_or_selected_invalid(cpl_table *, const char *); cpl_size cpl_table_and_selected_int(cpl_table *, const char *, cpl_table_select_operator, int); cpl_size cpl_table_or_selected_int(cpl_table *, const char *, cpl_table_select_operator, int); cpl_size cpl_table_and_selected_long_long(cpl_table *, const char *, cpl_table_select_operator, long long); cpl_size cpl_table_or_selected_long_long(cpl_table *, const char *, cpl_table_select_operator, long long); cpl_size cpl_table_and_selected_float(cpl_table *, const char *, cpl_table_select_operator, float); cpl_size cpl_table_or_selected_float(cpl_table *, const char *, cpl_table_select_operator, float); cpl_size cpl_table_and_selected_double(cpl_table *, const char *, cpl_table_select_operator, double); cpl_size cpl_table_or_selected_double(cpl_table *, const char *, cpl_table_select_operator, double); #ifdef _Complex_I cpl_size cpl_table_and_selected_float_complex(cpl_table *, const char *, cpl_table_select_operator, _Complex float); cpl_size cpl_table_or_selected_float_complex(cpl_table *, const char *, cpl_table_select_operator, _Complex float); cpl_size cpl_table_and_selected_double_complex(cpl_table *, const char *, cpl_table_select_operator, _Complex double); cpl_size cpl_table_or_selected_double_complex(cpl_table *, const char *, cpl_table_select_operator, _Complex double); #endif cpl_size cpl_table_and_selected_string(cpl_table *, const char *, cpl_table_select_operator, const char *); cpl_size cpl_table_or_selected_string(cpl_table *, const char *, cpl_table_select_operator, const char *); cpl_size cpl_table_and_selected(cpl_table *, const char *, cpl_table_select_operator, const char *); cpl_size cpl_table_or_selected(cpl_table *, const char *, cpl_table_select_operator, const char *); int cpl_table_is_selected(const cpl_table *, cpl_size); cpl_size cpl_table_count_selected(const cpl_table *); void cpl_table_dump_structure(const cpl_table *, FILE *); void cpl_table_dump(const cpl_table *, cpl_size, cpl_size, FILE *); cpl_table *cpl_table_load(const char *, int, int); cpl_table *cpl_table_load_window(const char *, int, int, const cpl_array *, cpl_size, cpl_size); cpl_error_code cpl_table_save(const cpl_table *, const cpl_propertylist *, const cpl_propertylist *, const char *filename, unsigned mode); CPL_END_DECLS #endif /* end of cpl_table.h */ cpl-6.4.1/cplcore/cpl_image_basic_impl.h0000644000460300003120000000372712272150710015122 00000000000000/* $Id: cpl_image_basic_impl.h,v 1.1 2013-04-04 13:10:32 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-04 13:10:32 $ * $Revision: 1.1 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGE_BASIC_IMPL_H #define CPL_IMAGE_BASIC_IMPL_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image_basic.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_image * cpl_image_min_create(const cpl_image *, const cpl_image *) CPL_INTERNAL CPL_ATTR_ALLOC; void cpl_image_or_mask(cpl_image *, const cpl_image *, const cpl_image *) CPL_INTERNAL #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1,3))) #endif ; void cpl_image_or_mask_unary(cpl_image *, const cpl_image *) CPL_INTERNAL #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1))) #endif ; CPL_END_DECLS #endif cpl-6.4.1/cplcore/tests/0000755000460300003120000000000012310333011012046 500000000000000cpl-6.4.1/cplcore/tests/cpl_matrix-test.c0000644000460300003120000020536312243373747015313 00000000000000/* $Id: cpl_matrix-test.c,v 1.59 2013-09-05 11:21:15 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-09-05 11:21:15 $ * $Revision: 1.59 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /* * Test for functions returning a generic pointer to data. * * r = variable to store returned pointer to data - expected non-NULL * f = function call * m = message */ #define test_data(r,f,m) \ do { \ cpl_msg_info("", "%s", m); \ cpl_test_nonnull(r = (f)); \ } while (0) /* * Test for functions returning 0 on success. * * f = function call * m = message */ #define test(f,m) \ do { \ cpl_msg_info("", "%s", m); \ cpl_test_eq(f, 0); \ } while (0) /* * Test for expected failure in functions returning 0 on success. * * f = function call * m = message */ #define test_failure(f,m) \ do { \ cpl_msg_info("", "%s", m); \ cpl_test_noneq(f, 0); \ } while (0) /* * Test for functions returning an expected integer value. * * e = expected value * f = function call * m = message */ #define test_ivalue(e,f,m) \ do { \ cpl_msg_info("", "%s", m); \ cpl_test_eq(e, f); \ } while (0) /* * Test for functions returning an expected floating point value. * * e = expected value * t = tolerance on expected value * f = function call * m = message */ #define test_fvalue(e,t,f,m) \ do { \ cpl_msg_info("", "%s", m); \ cpl_test_abs(e, f, t); \ } while (0) /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_matrix_test_banded(int, int); static cpl_error_code cpl_matrix_fill_illcond(cpl_matrix *, int); static cpl_error_code cpl_matrix_fill_test(cpl_matrix *, cpl_size, cpl_size); static double cpl_matrix_get_2norm_1(const cpl_matrix *); static void cpl_matrix_product_transpose_bench(int, int); static void cpl_matrix_solve_normal_bench(int, int); static void cpl_matrix_product_bilinear_test(cpl_size, cpl_size, cpl_boolean); static cpl_matrix * cpl_matrix_product_bilinear_brute(const cpl_matrix *, const cpl_matrix *); static cpl_error_code cpl_matrix_shift_brute(cpl_matrix *, cpl_size, cpl_size); /*----------------------------------------------------------------------------- main -----------------------------------------------------------------------------*/ int main(void) { const int nreps = 1; /* This is currently enough to expose the trouble */ int nelem = 70; int subnelem = 10; char message[80]; int size; double a2390[] = {2.125581475848425e-314, 3.952525166729972e-323, -0.000000000000000e+00, -2.393462054246040e-162, 3.952525166729972e-323, 1.677069691870074e-311, -0.000000000000000e+00, -6.726400100717507e-161, -0.000000000000000e+00, -0.000000000000000e+00, 0.000000000000000e+00, 1.172701769974922e-171, -2.393462054246040e-162, -6.726400100717507e-161, 1.172701769974922e-171, 6.189171527656329e+10}; double b2390[] = {-1.709710615916477e-161, -4.805142076113790e-160, 8.376377601213216e-171, 4.962260007044318e+01}; double a3097[] = {22.3366126198544243663945962908, -16.2991659056583451103961124318, 0.0747823788545301237906670621669, 0.0237870531554605392499102123338, -16.2991659056583451103961124318, 17.2102745748494783128990093246, -0.124262796786316020991591813072, 0.00881594777810015828301004603418, 0.0747823788545301237906670621669, -0.124262796786316020991591813072, 0.00370155728670603376487258096006, 0.00719839528504809342962511564679, 0.0237870531554605392499102123338, 0.00881594777810015828301004603418, 0.00719839528504809342962511564679, 0.0220958028150731733418865587737}; double b3097[] = {1, 2, 3, 4}; double *dArray; double *subdArray; double value; cpl_size i, j, k, l = 0; /* FIXME: What is l used for ? */ cpl_size r, c; cpl_matrix *matrix; cpl_matrix *copia; cpl_matrix *copy; cpl_matrix *product; cpl_matrix * xtrue; /* The true solution */ cpl_matrix * xsolv; /* The solution computed by the cpl_matrix solver */ FILE * stream; const double * data; cpl_boolean do_bench; cpl_error_code code; const cpl_matrix * null; /* This one is expected to be NULL */ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); do_bench = cpl_msg_get_level() <= CPL_MSG_INFO ? CPL_TRUE : CPL_FALSE; /* * Testing begins here */ stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; cpl_test_nonnull( stream ); cpl_matrix_test_banded(10, 1); cpl_matrix_test_banded(10, 2); for (i = 1; i <= 11; i++) { for (j = 1; j <= 11; j++) { cpl_matrix_product_bilinear_test(i, j, CPL_FALSE); } } if (do_bench) { cpl_matrix_product_bilinear_test(100, 500, CPL_TRUE); cpl_matrix_product_bilinear_test(500, 100, CPL_TRUE); cpl_matrix_product_bilinear_test(500, 500, CPL_TRUE); } cpl_matrix_product_transpose_bench(128, do_bench ? 100 : 1); /* Test cpl_matrix_get_stdev() (for DFS05126) */ (void)cpl_matrix_get_stdev(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); matrix = cpl_matrix_wrap(4, 4, a3097); value = cpl_matrix_get_stdev(matrix); cpl_test_leq(0.0, value); /* FIXME: use better test...*/ (void)cpl_matrix_unwrap(matrix); /* cpl_matrix_decomp_lu(): Verify detection of a matrix being singular due to its last pivot being zero. (Related to DFS 3097) */ matrix = cpl_matrix_wrap(4, 4, a3097); cpl_test_nonnull(matrix); copia = cpl_matrix_wrap(4, 1, b3097); cpl_test_nonnull(copia); xsolv = cpl_matrix_solve(matrix, copia); if (cpl_error_get_code() == CPL_ERROR_SINGULAR_MATRIX) { cpl_test_error(CPL_ERROR_SINGULAR_MATRIX); cpl_test_null(xsolv); cpl_msg_info(cpl_func, "cpl_matrix_solve() classified a near-" "singular matrix as singular. This is not a bug, " "but it indicates that cpl_matrix_solve() is less " "accurate on this computer. This loss of accuracy may " "be caused by compiling CPL with optimization"); cpl_test_abs(cpl_matrix_get_determinant(matrix), 0.0, 0.0); } else { cpl_test_nonnull(xsolv); test_fvalue(0.0, DBL_EPSILON, cpl_matrix_get_determinant(matrix), "Compute determinant of an ill-conditioned matrix"); } cpl_matrix_delete(xsolv); cpl_matrix_unwrap(copia); cpl_matrix_unwrap(matrix); /* Test for DFS 2390 */ matrix = cpl_matrix_wrap(4, 4, a2390); cpl_test_nonnull(matrix); copia = cpl_matrix_wrap(4, 1, b2390); cpl_test_nonnull(copia); xsolv = cpl_matrix_solve(matrix, copia); if (cpl_error_get_code() == CPL_ERROR_SINGULAR_MATRIX) { cpl_test_null(xsolv); cpl_test_error(CPL_ERROR_SINGULAR_MATRIX); cpl_msg_warning(cpl_func, "cpl_matrix_solve() classified a near-" "singular matrix as singular. This is not a bug, " "but it indicates that cpl_matrix_solve() is less " "accurate on this computer"); xsolv = cpl_matrix_duplicate(copia); } else { cpl_matrix_dump(xsolv, stream); value = cpl_matrix_get_mean(xsolv); cpl_test_error(CPL_ERROR_NONE); cpl_test( value == value); /* Check for NaNs */ } cpl_matrix_unwrap(copia); /* Test illegal call of cpl_matrix_solve_lu() */ cpl_test_eq(cpl_matrix_solve_lu(matrix, xsolv, NULL), CPL_ERROR_DIVISION_BY_ZERO); cpl_test_error(CPL_ERROR_DIVISION_BY_ZERO); cpl_matrix_delete(xsolv); cpl_matrix_unwrap(matrix); test_data(matrix, cpl_matrix_new(7, 10), "Creating the test matrix... "); cpl_matrix_delete(matrix); r = 7; c = 10; test_data(matrix, cpl_matrix_new(r, c), "Creating another test matrix... "); cpl_matrix_fill(matrix, 13.565656565); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of constant matrix... ", i, j); test_fvalue(13.565656565, .000001, cpl_matrix_get(matrix, i, j), message); } } cpl_matrix_delete(matrix); /* test_data(matrix, cpl_matrix_new_identity(3), "Creating identity matrix... "); */ matrix = cpl_matrix_new(3, 3); for (i = 0; i < 3; i++) cpl_matrix_set(matrix, i, i, 1); test_ivalue(1, cpl_matrix_is_identity(matrix, -1.), "Checking if matrix is identity... "); cpl_matrix_delete(matrix); dArray = cpl_malloc((size_t)nelem * sizeof(double)); value = 9.00; for (i = 0; i < nelem; i++) { dArray[i] = value; value += .01; } subdArray = cpl_malloc((size_t)subnelem * sizeof(double)); value = 1.00; for (i = 0; i < subnelem; i++) { subdArray[i] = value; value += .01; } /* test_data(matrix, cpl_matrix_new_diagonal(dArray, 5), "Creating diagonal matrix... "); */ matrix = cpl_matrix_new(5, 5); for (i = 0; i < 5; i++) cpl_matrix_set(matrix, i, i, dArray[i]); test_ivalue(1, cpl_matrix_is_diagonal(matrix, -1.), "Checking if matrix is diagonal... "); cpl_matrix_delete(matrix); test_data(matrix, cpl_matrix_wrap(7, 10, dArray), "Creating the final test matrix... "); test_fvalue(9.57, .001, cpl_matrix_get(matrix, 5, 7), "Reading a matrix element... "); /* test_failure(cpl_matrix_set(matrix, 10, 10, 1.00), "Writing a matrix element out of range... "); */ test(cpl_matrix_set(matrix, 6, 5, 1.00), "Writing a matrix element... "); test_fvalue(1.00, .001, cpl_matrix_get(matrix, 6, 5), "Reading just written matrix element... "); test_data(copia, cpl_matrix_duplicate(matrix), "Copy a matrix... "); test(cpl_matrix_subtract(copia, matrix), "Subtract original from copy... "); test_ivalue(1, cpl_matrix_is_zero(copia, -1), "Check if result is zero... "); cpl_matrix_delete(copia); test_data(copia, cpl_matrix_extract(matrix, 2, 3, 1, 1, 4, 3), "Extracting submatrix... "); test_fvalue(9.44, .001, cpl_matrix_get(copia, 2, 1), "Reading a submatrix element... "); cpl_matrix_delete(copia); test_data(copia, cpl_matrix_extract(matrix, 4, 4, 1, 1, 1000, 1000), "Extracting submatrix (beyond upper boundaries)... "); test_fvalue(9.55, .001, cpl_matrix_get(copia, 1, 1), "Reading new submatrix element... "); cpl_matrix_delete(copia); test_data(copia, cpl_matrix_extract(matrix, 0, 0, 3, 3, 1000, 1000), "Extracting submatrix (step 3, beyond boundaries)... "); test_fvalue(9.33, .001, cpl_matrix_get(copia, 1, 1), "Reading new submatrix element... "); cpl_matrix_delete(copia); /* Test error handling for invalid input: */ null = cpl_matrix_extract_row(NULL, 1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(null); null = cpl_matrix_extract_row(matrix, 9999999); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_null(null); null = cpl_matrix_extract_row(matrix, -1); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_null(null); null = cpl_matrix_extract_column(NULL, 1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(null); null = cpl_matrix_extract_column(matrix, 9999999); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_null(null); null = cpl_matrix_extract_column(matrix, -1); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_null(null); test_data(copia, cpl_matrix_extract_row(matrix, 2), "Copy one row... "); c = cpl_matrix_get_ncol(matrix); for (i = 0; i < c; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of copied row... ", i); test_fvalue(cpl_matrix_get(matrix, 2, i), 0.00001, cpl_matrix_get(copia, 0, i), message); } cpl_matrix_delete(copia); #ifdef CPL_MATRIX_TEST_EXTRA test(cpl_matrix_copy_row_remove(matrix, subdArray, 1), "Write one row... "); for (i = 0; i < c; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of written row... ", i); test_fvalue(subdArray[i], 0.00001, cpl_matrix_get(matrix, 1, i), message); } test_data(copia, cpl_matrix_extract_column(matrix, 3), "Copy one column... "); r = cpl_matrix_get_nrow(matrix); for (i = 0; i < r; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of copied column... ", i); test_fvalue(cpl_matrix_get(matrix, i, 3), 0.00001, cpl_matrix_get(copia, i, 0), message); } cpl_matrix_delete(copia); test(cpl_matrix_copy_column_remove(matrix, subdArray, 1), "Write one column... "); for (i = 0; i < r; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of written column... ", i); test_fvalue(subdArray[i], 0.00001, cpl_matrix_get(matrix, i, 1), message); } #endif value = 9.00; for (i = 0; i < nelem; i++) { dArray[i] = value; value += .01; } test_data(copia, cpl_matrix_extract_diagonal(matrix, 0), "Copy main diagonal... "); r = cpl_matrix_get_nrow(matrix); for (i = 0; i < r; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of copied diagonal... ", i); test_fvalue(cpl_matrix_get(matrix, i, i), 0.00001, cpl_matrix_get(copia, i, 0), message); } cpl_matrix_delete(copia); test_data(copia, cpl_matrix_extract_diagonal(matrix, 2), "Copy third diagonal... "); for (i = 0; i < r; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of copied third diagonal... ", i); test_fvalue(cpl_matrix_get(matrix, i , i + 2), 0.00001, cpl_matrix_get(copia, i, 0), message); } cpl_matrix_delete(copia); #ifdef CPL_MATRIX_TEST_EXTRA test(cpl_matrix_copy_diagonal_remove(matrix, subdArray, 0), "Write main diagonal... "); for (i = 0; i < r; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of written " "diagonal... ", i);; test_fvalue(subdArray[i], 0.00001, cpl_matrix_get(matrix, i, i), message); } test(cpl_matrix_copy_diagonal_remove(matrix, subdArray, 2), "Write third diagonal... "); for (i = 0; i < r; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of written " "diagonal... ", i); test_fvalue(subdArray[i], 0.00001, cpl_matrix_get(matrix, i, i + 2), message); } #endif value = 9.00; for (i = 0; i < nelem; i++) { dArray[i] = value; value += .01; } cpl_matrix_unwrap(matrix); test_data(matrix, cpl_matrix_wrap(10, 7, dArray), "A new test matrix... "); test_data(copia, cpl_matrix_extract_diagonal(matrix, 0), "Copy main diagonal (vertical)... "); c = cpl_matrix_get_ncol(matrix); for (i = 0; i < c; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of copied diagonal " "(vertical)... ", i); test_fvalue(cpl_matrix_get(matrix, i, i), 0.00001, cpl_matrix_get(copia, 0, i), message); } cpl_matrix_delete(copia); test_data(copia, cpl_matrix_extract_diagonal(matrix, 1), "Copy second diagonal (vertical)... "); for (i = 0; i < c; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of copied second diagonal " "(vertical)... ", i); test_fvalue(cpl_matrix_get(matrix, i + 1, i), 0.00001, cpl_matrix_get(copia, 0, i), message); } cpl_matrix_delete(copia); #ifdef CPL_MATRIX_TEST_EXTRA test(cpl_matrix_copy_diagonal_remove(matrix, subdArray, 0), "Write main diagonal (vertical)... "); for (i = 0; i < c; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of written diagonal " "(vertical)... ", i); test_fvalue(subdArray[i], 0.00001, cpl_matrix_get(matrix, i, i), message); } test(cpl_matrix_copy_diagonal_remove(matrix, subdArray, 1), "Write second diagonal (vertical)... "); for (i = 0; i < c; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of written second diagonal " "(vertical)... ", i); test_fvalue(subdArray[i], 0.00001, cpl_matrix_get(matrix, i + 1, i), message); } #endif cpl_free(subdArray); test(cpl_matrix_fill(matrix, 3.33), "Write same value to entire matrix... "); c = cpl_matrix_get_ncol(matrix); r = c * cpl_matrix_get_nrow(matrix); for (i = 0; i < r; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of matrix... ", i / c, i % c); test_fvalue(3.33, 0.00001, cpl_matrix_get(matrix, i / c, i % c), message); } test(cpl_matrix_fill_row(matrix, 2.0, 4), "Write 2 to row 4..."); for (i = 0; i < c; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of constant row... ", i); test_fvalue(2.0, 0.00001, cpl_matrix_get(matrix, 4, i), message); } test(cpl_matrix_fill_column(matrix, 9.99, 2), "Write 9.99 to column 2..."); r = cpl_matrix_get_nrow(matrix); for (i = 0; i < r; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of constant column... ", i); test_fvalue(9.99, 0.00001, cpl_matrix_get(matrix, i, 2), message); } test(cpl_matrix_fill_diagonal(matrix, 1.11, 0), "Write 1.11 to main diagonal..."); for (i = 0; i < c; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of constant main diagonal... ", i); test_fvalue(1.11, 0.00001, cpl_matrix_get(matrix, i, i), message); } test(cpl_matrix_fill_diagonal(matrix, 1.10, -1), "Write 1.11 to second diagonal..."); for (i = 0; i < c; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of constant second diagonal... ", i); test_fvalue(1.1, 0.00001, cpl_matrix_get(matrix, i + 1, i), message); } value = 9.00; for (i = 0; i < nelem; i++) { dArray[i] = value; value += .01; } cpl_matrix_unwrap(matrix); test_data(matrix, cpl_matrix_wrap(7, 10, dArray), "One more test matrix... "); test_data(copia, cpl_matrix_extract(matrix, 0, 0, 1, 1, 4, 4), "Copying square submatrix... "); r = cpl_matrix_get_nrow(copia); c = cpl_matrix_get_ncol(copia); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of submatrix... ", i, j); test_fvalue(cpl_matrix_get(matrix, i, j), 0.00001, cpl_matrix_get(copia, i, j), message); } } test(cpl_matrix_add_scalar(copia, -8.), "Subtracting constant from submatrix... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of modified submatrix... ", i, j); test_fvalue(cpl_matrix_get(matrix, i, j) - 8., 0.00001, cpl_matrix_get(copia, i, j), message); } } test(cpl_matrix_copy(matrix, copia, 2, 2), "Writing submatrix into matrix..."); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of modified matrix... ", i + 2, j + 2); test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i + 2, j + 2), message); } } cpl_matrix_delete(copia); test(cpl_matrix_fill_window(matrix, 0., 1, 1, 4, 3), "Writing same value into submatrix... "); for (i = 1; i < 4; i++) { for (j = 1; j < 3; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of constant submatrix... ", i, j); test_fvalue(0.0, 0.00001, cpl_matrix_get(matrix, i, j), message); } } value = 9.00; for (i = 0; i < nelem; i++) { dArray[i] = value; value += .01; } copia = cpl_matrix_duplicate(matrix); r = cpl_matrix_get_nrow(copia); c = cpl_matrix_get_ncol(copia); test(cpl_matrix_fill_window(matrix, 0., 2, 2, 10, 10), "Writing same value into submatrix (beyond borders)... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of overwritten matrix... ", i, j); if (i > 1 && j > 1) { test_fvalue(0.0, 0.00001, cpl_matrix_get(matrix, i, j), message); } else { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i, j), message); } } } cpl_matrix_delete(copia); value = 9.00; for (i = 0; i < nelem; i++) { dArray[i] = value; value += .01; } copia = cpl_matrix_duplicate(matrix); copy = cpl_matrix_duplicate(matrix); r = cpl_matrix_get_nrow(copia); c = cpl_matrix_get_ncol(copia); data = cpl_matrix_get_data_const(matrix); test(cpl_matrix_shift(matrix, 1, 0), "Shift matrix elements by +1,0... "); code = cpl_matrix_shift_brute(copy, 1, 0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_matrix_abs(matrix, copy, 0.0); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of first shifted matrix... ", i, j); if (i > r - 2) { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i + 1 - r, j), message); } else { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i + 1, j), message); } } } test(cpl_matrix_shift(matrix, -1, 1), "Shift matrix elements by -1,+1... "); code = cpl_matrix_shift_brute(copy, -1, 1); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_matrix_abs(matrix, copy, 0.0); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of second shifted matrix... ", i, j); if (j > c - 2) { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i, j + 1 - c), message); } else { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i, j + 1), message); } } } test(cpl_matrix_shift(matrix, 4, 3), "Shift matrix elements by +4,+3... "); code = cpl_matrix_shift_brute(copy, 4, 3); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_matrix_abs(matrix, copy, 0.0); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of third shifted matrix... ", i, j); if (j > c - 5 && i > r - 5) { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i + 4 - r, j + 4 - c), message); } else if (j > c - 5) { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i + 4, j + 4 - c), message); } else if (i > r - 5) { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i + 4 - r, j + 4), message); } else { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i + 4, j + 4), message); } } } test(cpl_matrix_shift(matrix, -8, -8), "Shift matrix elements by -8,-8... "); code = cpl_matrix_shift_brute(copy, -8, -8); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_matrix_abs(matrix, copy, 0.0); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of fourth shifted matrix... ", i, j); if (j < 4 && i < 4) { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i - 4 + r, j - 4 + c), message); } else if (j < 4) { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i - 4, j - 4 + c), message); } else if (i < 4) { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i - 4 + r, j - 4), message); } else { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i - 4, j - 4), message); } } } /* Shift matrix back to original */ code = cpl_matrix_shift(matrix, 4, 4); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_matrix_shift_brute(copy, 4, 4); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_matrix_abs(matrix, copy, 0.0); /* No information was lost since the shifts are cyclic */ cpl_test_matrix_abs(matrix, copia, 0.0); /* The pointer to the elements is also unchanged */ cpl_test_eq_ptr(data, cpl_matrix_get_data_const(matrix)); for (i = - 2 * cpl_matrix_get_nrow(matrix); i < 2 + 2 * cpl_matrix_get_nrow(matrix); i++) { for (j = - 2 * cpl_matrix_get_ncol(matrix); j < 2 + 2 * cpl_matrix_get_ncol(matrix); j++) { code = cpl_matrix_shift(matrix, i, 0); code = cpl_matrix_shift_brute(copy, i, 0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_matrix_abs(matrix, copy, 0.0); code = cpl_matrix_shift(matrix, 0, j); code = cpl_matrix_shift_brute(copy, 0, j); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_matrix_abs(matrix, copy, 0.0); code = cpl_matrix_shift(matrix, -i, -j); code = cpl_matrix_shift_brute(copy, -i, -j); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_matrix_abs(matrix, copy, 0.0); } } cpl_matrix_delete(copia); cpl_matrix_delete(copy); code = cpl_matrix_shift(NULL, 1, 1); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); copia = cpl_matrix_duplicate(matrix); test(cpl_matrix_threshold_small(matrix, 9.505), "Chop matrix... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of chopped matrix... ", i, j); if (cpl_matrix_get(copia, i, j) < 9.505) { test_fvalue(0.0, 0.00001, cpl_matrix_get(matrix, i, j), message); } else { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i, j), message); } } } cpl_matrix_delete(copia); cpl_matrix_delete(matrix); dArray = cpl_malloc((size_t)nelem * sizeof(double)); value = 9.00; for (i = 0; i < nelem; i++) { dArray[i] = value; value += .01; } test_data(matrix, cpl_matrix_wrap(7, 10, dArray), "Creating one more test matrix... "); copia = cpl_matrix_duplicate(matrix); test(cpl_matrix_swap_rows(matrix, 1, 3), "Swap rows 1 and 3... "); for (j = 0; j < c; j++) { sprintf(message, "Check column %" CPL_SIZE_FORMAT " of row swapped matrix... ", j); test_fvalue(cpl_matrix_get(copia, 1, j), 0.00001, cpl_matrix_get(matrix, 3, j), message); test_fvalue(cpl_matrix_get(copia, 3, j), 0.00001, cpl_matrix_get(matrix, 1, j), message); } value = 9.00; for (i = 0; i < nelem; i++) { dArray[i] = value; value += .01; } test(cpl_matrix_swap_columns(matrix, 1, 3), "Swap columns 1 and 3... "); for (i = 0; i < r; i++) { sprintf(message, "Check row %" CPL_SIZE_FORMAT " of column swapped matrix... ", i); test_fvalue(cpl_matrix_get(copia, i, 1), 0.00001, cpl_matrix_get(matrix, i, 3), message); test_fvalue(cpl_matrix_get(copia, i, 1), 0.00001, cpl_matrix_get(matrix, i, 3), message); } cpl_matrix_delete(copia); value = 9.00; for (i = 0; i < nelem; i++) { dArray[i] = value; value += .01; } test_data(copia, cpl_matrix_new(5, 5), "Creating 5x5 square matrix... "); test(cpl_matrix_copy(copia, matrix, 0, 0), "Writing upper left 5x5 of matrix into copy..."); test(cpl_matrix_swap_rowcolumn(copia, 1), "Swapping row 1 with column 1... "); for (i = 0; i < 5; i++) { sprintf(message, "Check row/column element %" CPL_SIZE_FORMAT " of swapped matrix... ", i); test_fvalue(cpl_matrix_get(matrix, i, 1), 0.00001, cpl_matrix_get(copia, 1, i), message); test_fvalue(cpl_matrix_get(matrix, i, 1), 0.00001, cpl_matrix_get(copia, 1, i), message); } cpl_matrix_delete(copia); copia = cpl_matrix_duplicate(matrix); test(cpl_matrix_flip_rows(matrix), "Flip matrix upside down... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of row-flipped matrix... ", i, j); test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, r - i - 1, j), message); } } test(cpl_matrix_flip_columns(matrix), "Flip matrix left right... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of row-flipped matrix... ", i, j); test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, r - i - 1, c - j - 1), message); } } cpl_matrix_delete(copia); value = 9.00; for (i = 0; i < nelem; i++) { dArray[i] = value; value += .01; } test_data(copia, cpl_matrix_transpose_create(matrix), "Compute transpose... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of transposed matrix... ", i, j); test_fvalue(cpl_matrix_get(matrix, i, j), 0.00001, cpl_matrix_get(copia, j, i), message); } } test(cpl_matrix_sort_rows(copia, 1), "Sort matrix rows... "); test(cpl_matrix_flip_columns(copia), "Flip matrix left right (again)... "); test(cpl_matrix_sort_columns(copia, 1), "Sort matrix columns... "); cpl_matrix_delete(copia); copia = cpl_matrix_duplicate(matrix); test(cpl_matrix_erase_rows(matrix, 2, 3), "Delete rows 2 to 4... "); k = 0; for (i = 0; i < r; i++) { if (i > 1 && i < 5) break; for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of row-deleted matrix... ", k, j); test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, k, j), message); } k++; } test(cpl_matrix_erase_columns(matrix, 2, 3), "Delete columns 2 to 4... "); k = 0; for (i = 0; i < r; i++) { if (i > 1 && i < 5) break; for (j = 0; j < c; j++) { if (j > 1 && j < 5) break; sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of row-deleted matrix... ", k, j); test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, k, j), message); l++; } k++; } cpl_matrix_delete(copia); cpl_matrix_delete(matrix); dArray = cpl_malloc((size_t)nelem * sizeof(double)); value = 9.00; for (i = 0; i < nelem; i++) { dArray[i] = value; value += .01; } test_data(matrix, cpl_matrix_wrap(7, 10, dArray), "Creating the steenth test matrix... "); copia = cpl_matrix_duplicate(matrix); test(cpl_matrix_resize(matrix, -2, -2, -2, -2), "Cut a frame around matrix... "); for (i = 2; i < r - 2; i++) { for (j = 2; j < c - 2; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of cropped matrix... ", i - 2, j - 2); test_fvalue(cpl_matrix_get(matrix, i - 2, j - 2), 0.00001, cpl_matrix_get(copia, i, j), message); } } test(cpl_matrix_resize(matrix, 2, 2, 2, 2), "Add a frame around matrix... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of expanded matrix... ", i, j); if (i > 1 && i < r - 2 && j > 1 && j < c - 2) { test_fvalue(cpl_matrix_get(copia, i, j), 0.00001, cpl_matrix_get(matrix, i, j), message); } else { test_fvalue(0.0, 0.00001, cpl_matrix_get(matrix, i, j), message); } } } test(cpl_matrix_resize(matrix, -2, 2, 2, -2), "Reframe a matrix... "); cpl_matrix_delete(copia); cpl_matrix_delete(matrix); dArray = cpl_malloc((size_t)nelem * sizeof(double)); value = 9.00; for (i = 0; i < nelem; i++) { dArray[i] = value; value += .01; } test_data(matrix, cpl_matrix_wrap(7, 10, dArray), "Creating matrix for merging test... "); test_data(copia, cpl_matrix_extract(matrix, 0, 0, 1, 1, 7, 1), "Creating second matrix for merging test... "); product = cpl_matrix_duplicate(copia); test(cpl_matrix_append(copia, matrix, 0), "Horizontal merging... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of horizontally merged matrix... ", i, j + 1); test_fvalue(cpl_matrix_get(matrix, i, j), 0.00001, cpl_matrix_get(copia, i, j + 1), message); } } for (i = 0; i < r; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %d" " of horizontally merged matrix... ", i, 0); test_fvalue(cpl_matrix_get(product, i, 0), 0.00001, cpl_matrix_get(copia, i, 0), message); } cpl_matrix_delete(product); cpl_matrix_delete(copia); test_data(copia, cpl_matrix_extract(matrix, 0, 0, 1, 1, 4, 10), "Creating third matrix for merging test... "); product = cpl_matrix_duplicate(copia); test(cpl_matrix_append(copia, matrix, 1), "Vertical merging... "); for (i = 0; i < 4; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of vertically merged matrix... ", i, j); test_fvalue(cpl_matrix_get(product, i, j), 0.00001, cpl_matrix_get(copia, i, j), message); } } for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of vertically merged matrix... ", i + 4, j); test_fvalue(cpl_matrix_get(matrix, i, j), 0.00001, cpl_matrix_get(copia, i + 4, j), message); } } cpl_matrix_delete(product); cpl_matrix_delete(copia); test_data(copia, cpl_matrix_duplicate(matrix), "Create matrix for add test... "); test(cpl_matrix_add(copia, matrix), "Adding two matrices... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of sum matrix... ", i, j); test_fvalue(cpl_matrix_get(matrix, i, j) * 2, 0.00001, cpl_matrix_get(copia, i, j), message); } } test(cpl_matrix_subtract(copia, matrix), "Subtracting two matrices... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of diff matrix... ", i, j); test_fvalue(cpl_matrix_get(matrix, i, j), 0.00001, cpl_matrix_get(copia, i, j), message); } } test(cpl_matrix_multiply(copia, matrix), "Multiply two matrices... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of mult matrix... ", i, j); test_fvalue(cpl_matrix_get(matrix, i, j) * cpl_matrix_get(matrix, i, j), 0.00001, cpl_matrix_get(copia, i, j), message); } } test(cpl_matrix_divide(copia, matrix), "Divide two matrices... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of ratio matrix... ", i, j); test_fvalue(cpl_matrix_get(matrix, i, j), 0.00001, cpl_matrix_get(copia, i, j), message); } } test(cpl_matrix_multiply_scalar(copia, 1./2.), "Divide a matrix by 2... "); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT ", %" CPL_SIZE_FORMAT " of half matrix... ", i, j); test_fvalue(cpl_matrix_get(matrix, i, j) / 2, 0.00001, cpl_matrix_get(copia, i, j), message); } } cpl_matrix_delete(matrix); cpl_matrix_delete(copia); test_data(matrix, cpl_matrix_new(3, 4), "Creating first matrix for product... "); test_data(copia, cpl_matrix_new(4, 5), "Creating second matrix for product... "); value = 0.0; for (i = 0, k = 0; i < 3; i++) { for (j = 0; j < 4; j++) { k++; sprintf(message, "Writing to element %" CPL_SIZE_FORMAT " of the first matrix... ", k); test(cpl_matrix_set(matrix, i, j, value), message); value++; } } value = -10.0; for (i = 0, k = 0; i < 4; i++) { for (j = 0; j < 5; j++) { k++; sprintf(message, "Writing to element %" CPL_SIZE_FORMAT " of the second matrix... ", k); test(cpl_matrix_set(copia, i, j, value), message); value++; } } test_data(product, cpl_matrix_product_create(matrix, copia), "Matrix product... "); test_fvalue(10., 0.00001, cpl_matrix_get(product, 0, 0), "Check element 0, 0 of product... "); test_fvalue(16., 0.00001, cpl_matrix_get(product, 0, 1), "Check element 0, 1 of product... "); test_fvalue(22., 0.00001, cpl_matrix_get(product, 0, 2), "Check element 0, 2 of product... "); test_fvalue(28., 0.00001, cpl_matrix_get(product, 0, 3), "Check element 0, 3 of product... "); test_fvalue(34., 0.00001, cpl_matrix_get(product, 0, 4), "Check element 0, 4 of product... "); test_fvalue(-30., 0.00001, cpl_matrix_get(product, 1, 0), "Check element 1, 0 of product... "); test_fvalue(-8., 0.00001, cpl_matrix_get(product, 1, 1), "Check element 1, 1 of product... "); test_fvalue(14., 0.00001, cpl_matrix_get(product, 1, 2), "Check element 1, 2 of product... "); test_fvalue(36., 0.00001, cpl_matrix_get(product, 1, 3), "Check element 1, 3 of product... "); test_fvalue(58., 0.00001, cpl_matrix_get(product, 1, 4), "Check element 1, 4 of product... "); test_fvalue(-70., 0.00001, cpl_matrix_get(product, 2, 0), "Check element 2, 0 of product... "); test_fvalue(-32., 0.00001, cpl_matrix_get(product, 2, 1), "Check element 2, 1 of product... "); test_fvalue(6., 0.00001, cpl_matrix_get(product, 2, 2), "Check element 2, 2 of product... "); test_fvalue(44., 0.00001, cpl_matrix_get(product, 2, 3), "Check element 2, 3 of product... "); test_fvalue(82., 0.00001, cpl_matrix_get(product, 2, 4), "Check element 2, 4 of product... "); cpl_matrix_delete(copia); cpl_matrix_delete(product); cpl_matrix_delete(matrix); test_data(matrix, cpl_matrix_new(3, 3), "Creating coefficient matrix... "); cpl_matrix_set(matrix, 0, 0, 1); cpl_matrix_set(matrix, 0, 1, 1); cpl_matrix_set(matrix, 0, 2, 1); cpl_matrix_set(matrix, 1, 0, 1); cpl_matrix_set(matrix, 1, 1, -2); cpl_matrix_set(matrix, 1, 2, 2); cpl_matrix_set(matrix, 2, 0, 0); cpl_matrix_set(matrix, 2, 1, 1); cpl_matrix_set(matrix, 2, 2, -2); test(cpl_matrix_get_minpos(matrix, &r, &c), "Find min pos 2... "); test_ivalue(1, r, "Check min row pos 2..."); test_ivalue(1, c, "Check min col pos 2..."); test_fvalue(-2.0, 0.0001, cpl_matrix_get_min(matrix), "Check min value 2... "); test(cpl_matrix_get_maxpos(matrix, &r, &c), "Find max pos 2... "); test_ivalue(1, r, "Check max row pos 2..."); test_ivalue(2, c, "Check max col pos 2..."); test_fvalue(2.0, 0.0001, cpl_matrix_get_max(matrix), "Check max value 2... "); test_data(copia, cpl_matrix_new(3, 1), "Creating nonhomo matrix... "); cpl_matrix_set(copia, 0, 0, 0); cpl_matrix_set(copia, 1, 0, 4); cpl_matrix_set(copia, 2, 0, 2); cpl_matrix_dump(matrix, stream); test_fvalue(5.0, DBL_EPSILON, cpl_matrix_get_determinant(matrix), "Compute determinant of a regular matrix"); cpl_test_error(CPL_ERROR_NONE); test_data(product, cpl_matrix_solve(matrix, copia), "Solving a linear system... "); test_fvalue(4., 0.0001, cpl_matrix_get(product, 0, 0), "Check linear system solution, x = 4... "); test_fvalue(-2., 0.0001, cpl_matrix_get(product, 1, 0), "Check linear system solution, y = -2... "); test_fvalue(-2., 0.0001, cpl_matrix_get(product, 2, 0), "Check linear system solution, z = -2... "); /* */ cpl_matrix_delete(product); /* cpl_matrix_dump(matrix); */ /* cpl_matrix_dump(copia); */ test_data(product, cpl_matrix_solve_normal(matrix, copia), "Least squares... "); /* cpl_matrix_dump(product); */ /* */ cpl_matrix_delete(copia); cpl_matrix_delete(product); cpl_matrix_delete(matrix); test_data(matrix, cpl_matrix_new(1, 1), "Creating 1x1 matrix to invert... "); cpl_matrix_set(matrix, 0, 0, 2); test_fvalue(2.0, 0.0, cpl_matrix_get_determinant(matrix), "Compute determinant of a 1x1-matrix"); cpl_test_error(CPL_ERROR_NONE); test_data(copia, cpl_matrix_invert_create(matrix), "Invert 1x1 matrix... "); test_data(product, cpl_matrix_product_create(matrix, copia), "Product by 1x1 inverse... "); test_ivalue(1, cpl_matrix_is_identity(product, -1.), "Checking if 1x1 product is identity... "); cpl_matrix_delete(matrix); cpl_matrix_delete(product); cpl_matrix_delete(copia); test_data(matrix, cpl_matrix_new(2, 2), "Creating matrix to invert... "); cpl_matrix_set(matrix, 0, 0, 1); cpl_matrix_set(matrix, 0, 1, 1); cpl_matrix_set(matrix, 1, 0, -1); cpl_matrix_set(matrix, 1, 1, 2); cpl_matrix_dump(matrix, stream); test_data(copia, cpl_matrix_invert_create(matrix), "Invert matrix... "); cpl_matrix_dump(copia, stream); test_data(product, cpl_matrix_product_create(matrix, copia), "Product by inverse... "); cpl_matrix_dump(product, stream); test_ivalue(1, cpl_matrix_is_identity(product, -1.), "Checking if product is identity... "); /* Try to solve a 2 X 2 singular system */ cpl_test_zero( cpl_matrix_set_size(matrix, 2, 2) ); cpl_test_zero( cpl_matrix_set_size(copia, 2, 1) ); cpl_test_zero( cpl_matrix_fill(matrix, 0.0) ); for (i = 0; i < 2; i++) { cpl_test_zero( cpl_matrix_set(matrix, i, 1, 1.0) ); } cpl_test_zero( cpl_matrix_fill(copia, 1.0) ); cpl_matrix_dump(matrix, stream); cpl_matrix_dump(copia, stream); cpl_msg_info("", "Try to solve a 2 X 2 singular system"); null = cpl_matrix_solve(matrix, copia); cpl_test_error(CPL_ERROR_SINGULAR_MATRIX); cpl_test_null(null); cpl_matrix_delete(product); xtrue = cpl_matrix_new(1,1); /* Compute the determinant */ test_fvalue(0.0, 0.0, cpl_matrix_get_determinant(matrix), "Compute determinant of a singular matrix"); cpl_test_error(CPL_ERROR_NONE); /* Compute the determinant */ /* This time with an existing error code */ do { const cpl_error_code edummy = cpl_error_set(cpl_func, CPL_ERROR_EOL); cpl_errorstate prev_state = cpl_errorstate_get(); const double dvalzero = cpl_matrix_get_determinant(matrix); const cpl_boolean is_equal = cpl_errorstate_is_equal(prev_state); cpl_test_eq_error(CPL_ERROR_EOL, edummy); cpl_test(is_equal); test_fvalue(0.0, 0.0, dvalzero, "Compute determinant of a singular matrix"); } while (0); /* Try to solve increasingly ill-conditioned systems */ cpl_msg_info("", "Try to solve increasingly large systems Ax=b, " "with A(i,j) = 1/(2*n-(1+i+j)) and x(j) = 1"); for (size = subnelem; 1 < nreps * nelem; size++) { cpl_matrix * p2; double error, residual; double x_min, x_max; cpl_boolean is_done; /* The true solution consists of all ones */ cpl_test_zero(cpl_matrix_set_size(xtrue, size, 1)); cpl_test_zero(cpl_matrix_fill(xtrue, 1.0)); cpl_test_zero(cpl_matrix_fill_illcond(matrix, size)); product = cpl_matrix_product_create(matrix, xtrue); cpl_test_nonnull(product); xsolv = cpl_matrix_solve(matrix, product); cpl_test_nonnull(xsolv); x_min = cpl_matrix_get_min(xsolv); x_max = cpl_matrix_get_max(xsolv); is_done = (x_min < 0.5 || x_max >= 2.0) ? CPL_TRUE : CPL_FALSE; /* Find the residual */ p2 = cpl_matrix_product_create(matrix, xsolv); cpl_test_zero(cpl_matrix_subtract(p2, product)); residual = cpl_matrix_get_2norm_1(p2); cpl_matrix_delete(p2); /* Find the error on the solution */ cpl_test_zero(cpl_matrix_subtract(xsolv, xtrue)); error = cpl_matrix_get_2norm_1(xsolv); cpl_msg_info("","2-norm of residual with ill-conditioned %d x %d " "[DBL_EPSILON]: %g", size, size, residual/DBL_EPSILON); cpl_msg_info("","2-norm of error on solution with ill-conditioned " "%d x %d : %g", size, size, error); cpl_matrix_dump(xsolv, stream); cpl_matrix_delete(xsolv); cpl_matrix_delete(product); if (is_done) { cpl_msg_info("", "Stopping at n=%d, because the most significant bit " "of at least one element in the solution is wrong, " "x_min=%g, x_max=%g", size, x_min, x_max); break; } } /* Badness squared: Try to solve the normal equations... */ cpl_msg_info("", "Try to solve increasingly large systems A^TAx=A^Tb, " "with A(i,j) = 1/(2*n-(1+i+j)) and x(j) = 1"); for (size = 1; size < nreps * nelem; size++) { cpl_matrix * p2; double error, residual; double x_min, x_max; cpl_boolean is_done; /* The true solution consists of all ones */ cpl_test_zero(cpl_matrix_set_size(xtrue, size, 1)); cpl_test_zero(cpl_matrix_fill(xtrue, 1.0)); cpl_test_zero(cpl_matrix_fill_illcond(matrix, size)); product = cpl_matrix_product_create(matrix, xtrue); cpl_test_nonnull(product); xsolv = cpl_matrix_solve_normal(matrix, product); cpl_test_nonnull(xsolv); x_min = cpl_matrix_get_min(xsolv); x_max = cpl_matrix_get_max(xsolv); is_done = (x_min < 0.5 || x_max >= 2.0) ? CPL_TRUE : CPL_FALSE; /* Find the residual */ p2 = cpl_matrix_product_create(matrix, xsolv); cpl_test_zero(cpl_matrix_subtract(p2, product)); residual = cpl_matrix_get_2norm_1(p2); cpl_matrix_delete(p2); /* Find the error on the solution */ cpl_test_zero(cpl_matrix_subtract(xsolv, xtrue)); error = cpl_matrix_get_2norm_1(xsolv); cpl_msg_info("","2-norm of residual with ill-conditioned %d x %d (normal)" " [DBL_EPSILON]: %g", size, size, residual/DBL_EPSILON); cpl_msg_info("","2-norm of error on solution with ill-conditioned %d x %d" " (normal): %g", size, size, error); cpl_matrix_dump(xsolv, stream); cpl_matrix_delete(xsolv); cpl_matrix_delete(product); if (is_done) { cpl_msg_info("", "Stopping at n=%d, because the most significant bit " "of at least one element in the solution is wrong, " "x_min=%g, x_max=%g", size, x_min, x_max); break; } } cpl_msg_info("", "Compute the determinant of increasingly large " "matrices, with A(i,j) = 1/(1+abs(i-j))"); for (size = 1; size < nelem*nreps; size++) { cpl_test_zero(cpl_matrix_fill_test(matrix, size, size)); value = cpl_matrix_get_determinant(matrix); cpl_msg_debug("", "Determinant of %d by %d test-matrix: %g", size, size, value); } if (cpl_error_get_code()) { cpl_msg_info("", "Stopping at n=%d, because the determinant was " "truncated to zero", size); cpl_test_error(CPL_ERROR_UNSPECIFIED); } else { cpl_msg_info("", "Stopping at n=%d, with a determinant of %g", size, value); } cpl_msg_info("", "Compute the determinant of increasingly large ill-" "conditioned matrices, with A(i,j) = 1/(2*n-(1+i+j))"); for (size = 1; !cpl_error_get_code(); size++) { cpl_test_zero(cpl_matrix_fill_illcond(matrix, size)); value = cpl_matrix_get_determinant(matrix); cpl_msg_debug("", "Determinant of %d by %d ill-conditioned-matrix: %g", size, size, value); } cpl_test_error(CPL_ERROR_UNSPECIFIED); cpl_msg_info("", "Stopping at n=%d, because the determinant was truncated to " "zero", size); cpl_matrix_solve_normal_bench(do_bench ? 400 : 40, do_bench ? 10 : 1); cpl_matrix_delete(xtrue); cpl_matrix_delete(matrix); cpl_matrix_delete(copia); if (stream != stdout) cpl_test_zero( fclose(stream) ); return cpl_test_end(0); } /**@}*/ /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Generate an ill-conditioned N X N matrix @param self The matrix to be modified (including resizing). @param size The positive size @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see http://csep1.phy.ornl.gov/bf/node17.html The condition number of this matrix increases with n, starting with cond=1, for size = 1. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if the input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if size is negative or zero */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_matrix_fill_illcond(cpl_matrix * self, int size) { int i,j; cpl_ensure_code(self, CPL_ERROR_NULL_INPUT); cpl_ensure_code(size > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(!cpl_matrix_set_size(self, size, size), cpl_error_get_code()); for (i = 0; i 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(nc > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(!cpl_matrix_set_size(self, nr, nc), cpl_error_get_code()); for (i = 0; i < nr; i++) { for (j = 0; j < nc; j++) { const double value = 1.0/(double)(1+labs(i-j)); cpl_ensure_code(!cpl_matrix_set(self, i, j, value), cpl_error_get_code()); } } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Compute the 2-norm of matrix of size N x 1 @param self The matrix @return The 2-norm, or a negative number on error FIXME: To be general this function should compute the 2-norm for each column of A - and be called cpl_matrix_get_2norm_column(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if the input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if size is negative or zero */ /*----------------------------------------------------------------------------*/ static double cpl_matrix_get_2norm_1(const cpl_matrix * self) { double norm = 0; int i; cpl_ensure(self, CPL_ERROR_NULL_INPUT, -1.0); cpl_ensure(cpl_matrix_get_ncol(self) == 1, CPL_ERROR_ILLEGAL_INPUT, -2.0); for (i = 0; i < cpl_matrix_get_nrow(self); i++) { const double value = cpl_matrix_get(self, i, 0); norm += value * value; } return sqrt(norm); } /*----------------------------------------------------------------------------*/ /** @internal @brief Benchmark the CPL function @param nsize The size of the CPL object @param n The number of repeats @return void */ /*----------------------------------------------------------------------------*/ static void cpl_matrix_solve_normal_bench(int nsize, int n) { cpl_matrix * xtrue = cpl_matrix_new(1,1); /* The true solution */ cpl_matrix * matrix = cpl_matrix_new(1,1); /* The system to solve */ cpl_matrix * product; /* The Right Hand Side */ size_t bytes; cpl_flops flops0; double secs; int i; /* The true solution consists of all ones */ cpl_test_zero(cpl_matrix_set_size(xtrue, nsize, 1)); cpl_test_zero(cpl_matrix_fill(xtrue, 1.0)); cpl_test_zero(cpl_matrix_fill_test(matrix, nsize, nsize)); product = cpl_matrix_product_create(matrix, xtrue); cpl_test_nonnull(product); bytes = (size_t)n * cpl_test_get_bytes_matrix(matrix); flops0 = cpl_tools_get_flops(); secs = cpl_test_get_cputime(); for (i = 0; i < n; i++) { cpl_matrix * xsolv = cpl_matrix_solve_normal(matrix, product); cpl_test_nonnull(xsolv); cpl_matrix_delete(xsolv); } secs = cpl_test_get_cputime() - secs; flops0 = cpl_tools_get_flops() - flops0; cpl_msg_info("","Speed while solving with size %d X %d in %g secs " "[Mflop/s]: %g (%g)", nsize, nsize, secs/(double)i, (double)flops0/secs/1e6, (double)flops0); if (secs > 0.0) { cpl_msg_info(cpl_func,"Processing rate [MB/s]: %g", 1e-6 * (double)bytes / secs); } cpl_matrix_delete(xtrue); cpl_matrix_delete(product); cpl_matrix_delete(matrix); } /*----------------------------------------------------------------------------*/ /** @internal @brief Benchmark the CPL function @param nsize The size of the CPL object @param n The number of repeats @return void */ /*----------------------------------------------------------------------------*/ static void cpl_matrix_product_transpose_bench(int nsize, int n) { double secs; cpl_matrix * in = cpl_matrix_new(nsize, nsize); cpl_matrix * out = cpl_matrix_new(nsize, nsize); const size_t bytes = (size_t)n * cpl_test_get_bytes_matrix(in); int i; cpl_matrix_fill(in, 1.0); secs = cpl_test_get_cputime(); for (i = 0; i < n; i++) { const cpl_error_code error = cpl_matrix_product_transpose(out, in, in); cpl_test_eq_error(error, CPL_ERROR_NONE); } secs = cpl_test_get_cputime() - secs; cpl_msg_info(cpl_func,"Time spent transposing %d %dx%d matrices " "[s]: %g", n, nsize, nsize, secs); if (secs > 0.0) { cpl_msg_info(cpl_func,"Processing rate [MB/s]: %g", 1e-6 * (double)bytes / secs); } cpl_matrix_delete(out); cpl_matrix_delete(in); } /*----------------------------------------------------------------------------*/ /** @internal @brief Create a matrix with the product of B * A * B' @param ma The matrix A, of size M x M @param mb The matrix B, of size N x M @return The product matrix, or NULL on error @see cpl_matrix_product_bilinear(), cpl_matrix_product_create() @note Computed using two product */ /*----------------------------------------------------------------------------*/ static cpl_matrix * cpl_matrix_product_bilinear_brute(const cpl_matrix * A, const cpl_matrix * B) { #if 1 cpl_matrix * C = cpl_matrix_new(cpl_matrix_get_nrow(B), cpl_matrix_get_ncol(B)); const cpl_error_code error = cpl_matrix_product_transpose(C, A, B); cpl_matrix * self = cpl_matrix_product_create(B, C); cpl_ensure(!error, cpl_error_get_code(), NULL); #else /* An even less efficient method */ cpl_matrix * Bt = cpl_matrix_transpose_create(B); cpl_matrix * C = cpl_matrix_product_create(A, Bt); cpl_matrix * self = cpl_matrix_product_create(B, C); cpl_matrix_delete(Bt); #endif cpl_matrix_delete(C); return self; } /*----------------------------------------------------------------------------*/ /** @internal @brief Shift a matrix in the manner of cpl_matrix_shift() @param matrix Pointer to matrix to be modified. @param rshift Shift in the vertical direction. @param cshift Shift in the horizontal direction. @return @c CPL_ERROR_NONE on success. @see cpl_matrix_shift() */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_matrix_shift_brute(cpl_matrix *matrix, cpl_size rshift, cpl_size cshift) { cpl_error_code error = CPL_ERROR_NONE; const cpl_size nr = cpl_matrix_get_nrow(matrix); const cpl_size nc = cpl_matrix_get_ncol(matrix); if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); rshift = rshift % nr; cshift = cshift % nc; if (rshift != 0 || cshift != 0) { cpl_matrix *copy = cpl_matrix_duplicate(matrix); /* Should not be able to fail now */ if (rshift < 0) rshift += nr; if (cshift < 0) cshift += nc; /* * This is not very efficient, but for the moment it may suffice... */ error = cpl_matrix_copy(matrix, copy, rshift, cshift); if (!error && rshift) error = cpl_matrix_copy(matrix, copy, rshift - nr, cshift); if (!error && cshift) error = cpl_matrix_copy(matrix, copy, rshift, cshift - nc); if (!error && rshift && cshift) error = cpl_matrix_copy(matrix, copy, rshift - nr, cshift - nc); cpl_matrix_delete(copy); } return cpl_error_set_(error); /* Propagate error, if any */ } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @param nr The number of matrix rows @param nc The number of matrix columns @param do_bench Whether or not benching is enabled @return void */ /*----------------------------------------------------------------------------*/ static void cpl_matrix_product_bilinear_test(cpl_size nr, cpl_size nc, cpl_boolean do_bench) { cpl_matrix * self = cpl_matrix_new(nr, nr); cpl_matrix * jacobi = cpl_matrix_new(nr, nc); cpl_matrix * matrix = cpl_matrix_new(nc, nc); cpl_matrix * brute; cpl_error_code error; double tfunc, tbrute, t0; cpl_flops ffunc, fbrute, f0; error = cpl_matrix_fill_test(jacobi, nr, nc); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_matrix_fill_test(matrix, nc, nc); cpl_test_eq_error(error, CPL_ERROR_NONE); f0 = cpl_tools_get_flops(); t0 = cpl_test_get_cputime(); error = cpl_matrix_product_bilinear(self, matrix, jacobi); tfunc = cpl_test_get_cputime() - t0; ffunc = cpl_tools_get_flops() - f0; cpl_test_eq_error(error, CPL_ERROR_NONE); f0 = cpl_tools_get_flops(); t0 = cpl_test_get_cputime(); brute = cpl_matrix_product_bilinear_brute(matrix, jacobi); tbrute = cpl_test_get_cputime() - t0; fbrute = cpl_tools_get_flops() - f0; /* Same number of FP operations */ cpl_test_eq(ffunc, fbrute); cpl_test_matrix_abs(self, brute, 250.0 * DBL_EPSILON); cpl_matrix_delete(self); cpl_matrix_delete(jacobi); cpl_matrix_delete(matrix); cpl_matrix_delete(brute); if (do_bench) { cpl_msg_info(cpl_func,"Time spent on B * A * B', B: %" CPL_SIZE_FORMAT "x%" CPL_SIZE_FORMAT " [s]: %g <=> %g (brute force)", nr, nc, tfunc, tbrute); if (tfunc > 0.0 && tbrute > 0.0) { cpl_msg_info(cpl_func,"Speed while computing B * A * B', B: %" CPL_SIZE_FORMAT "x%" CPL_SIZE_FORMAT " [Mflop/s]: " "%g <=> %g (brute force)", nr, nc, (double)ffunc/tfunc/1e6, (double)fbrute/tbrute/1e6); } } } /*----------------------------------------------------------------------------*/ /** @internal @brief LU factor a banded matrix @param nc The number of matrix columns/rows @param np The bandedness @return void */ /*----------------------------------------------------------------------------*/ static void cpl_matrix_test_banded(int nc, int np) { cpl_matrix * A = cpl_matrix_new(nc, nc); cpl_array * p = cpl_array_new(nc, CPL_TYPE_INT); int i; cpl_error_code error; for (i = -np; i <= np; i++) { error = cpl_matrix_fill_diagonal(A, 1.0, i); cpl_test_eq_error(error, CPL_ERROR_NONE); } if(cpl_msg_get_level() <= CPL_MSG_INFO) cpl_matrix_dump(A, stderr); error = cpl_matrix_decomp_lu(A, p, &i); cpl_test_eq_error(error, CPL_ERROR_NONE); if(cpl_msg_get_level() <= CPL_MSG_INFO) cpl_array_dump(p, 0, nc, stderr); cpl_matrix_delete(A); cpl_array_delete(p); } cpl-6.4.1/cplcore/tests/cpl_msg-test.c0000644000460300003120000001042612243346473014563 00000000000000/* $Id: cpl_msg-test.c,v 1.14 2012-11-15 09:36:07 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-11-15 09:36:07 $ * $Revision: 1.14 $ * $Name: not supported by cvs2svn $ */ #include #include "cpl_msg.h" #include "cpl_test.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef STR_LENGTH #define STR_LENGTH 80 #endif /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { char message[STR_LENGTH+1]; char toolong[CPL_MAX_MSG_LENGTH]; char* verylongname = NULL; int verylongnamesize = 1024*1024; int nindent = 0; cpl_msg_severity loglevel = CPL_MSG_OFF; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ /* Construct the null-terminated string of STR_LENGTH dots */ (void)memset((void*)message, '.', STR_LENGTH); message[STR_LENGTH] = '\0'; /* - and display it */ cpl_msg_info(cpl_func, "Display a string of %d dots: %s", STR_LENGTH, message); cpl_msg_info(cpl_func, "Domain is: %s", cpl_msg_get_domain()); cpl_msg_indent_more(); nindent++; cpl_msg_info(cpl_func,"hhu: %hhu\n", (unsigned char)-1); cpl_msg_indent_more(); nindent++; cpl_msg_info(cpl_func,"hhd: %hhd\n", (char)-1); cpl_msg_indent_more(); nindent++; cpl_msg_info(cpl_func,"zu: %zu\n", sizeof(size_t)); cpl_msg_indent_more(); nindent++; cpl_msg_info(cpl_func,"td: %td\n", (__func__ ) - (__func__ + 2) ); cpl_msg_indent_more(); nindent++; cpl_msg_info(cpl_func,"llu: %llu\n", (unsigned long long)-1); cpl_msg_indent_more(); nindent++; cpl_msg_info(cpl_func,"lld: %lld\n", (long long)-1); cpl_msg_indent_more(); nindent++; /* Test a too long message */ /* Construct the null-terminated string of STR_LENGTH dots */ (void)memset((void*)toolong, '.', CPL_MAX_MSG_LENGTH-1); toolong[CPL_MAX_MSG_LENGTH-1] = '\0'; cpl_msg_info(cpl_func, "Display a string of %d dots: %s", CPL_MAX_MSG_LENGTH-1, toolong); cpl_msg_set_time_on(); for (;nindent; nindent--) cpl_msg_indent_less(); /* Undo the indenting */ /* Construct a very long null-terminated string of 'A' characters */ verylongname = (char*) malloc(verylongnamesize); cpl_test_nonnull(verylongname); (void)memset((void*)verylongname, 'A', verylongnamesize-1); verylongname[verylongnamesize-1] = '\0'; loglevel = cpl_msg_get_level(); cpl_msg_set_level(CPL_MSG_OFF); cpl_msg_debug(verylongname, "test for long component name"); cpl_msg_set_level(loglevel); cpl_test_error(CPL_ERROR_NONE); cpl_msg_set_level(CPL_MSG_OFF); cpl_msg_info(verylongname, "test for long component name"); cpl_msg_set_level(loglevel); cpl_msg_set_level(loglevel); cpl_test_error(CPL_ERROR_NONE); cpl_msg_set_level(CPL_MSG_OFF); cpl_msg_warning(verylongname, "test for long component name"); cpl_msg_set_level(loglevel); cpl_test_error(CPL_ERROR_NONE); cpl_msg_set_level(CPL_MSG_OFF); cpl_msg_error(verylongname, "test for long component name"); cpl_msg_set_level(loglevel); cpl_test_error(CPL_ERROR_NONE); free(verylongname); /* End of tests */ return cpl_test_end(0); } cpl-6.4.1/cplcore/tests/cpl_math-test.c0000644000460300003120000001020012253634037014711 00000000000000/* $Id: cpl_math-test.c,v 1.12 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.12 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "cpl_math_const.h" #include "cpl_test.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /* Required precision in multiples of the machine precision */ #ifndef CPL_MATH_PRECISION #define CPL_MATH_PRECISION 1.0 #endif /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { const double prec = CPL_MATH_PRECISION * DBL_EPSILON; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ /* The constants are of type double */ cpl_test_eq(sizeof(CPL_MATH_PI), sizeof(double)); /* Expressions with just a subtraction must be accurate to 1 unit of machine precision, expressions also involving division must be accurate to 2 units of machine precision */ /* pi */ cpl_test_rel(atan2(0.0, -1.0), CPL_MATH_PI, prec); /* 2 pi */ cpl_test_rel(2.0 * atan2(0.0, -1.0), CPL_MATH_2PI, prec); /* pi/2 */ cpl_test_rel(atan2(1.0, 0.0), CPL_MATH_PI_2, prec); /* pi/4 */ cpl_test_rel(atan2(1.0, 1.0), CPL_MATH_PI_4, prec); /* 1/pi */ cpl_test_rel(1.0/atan2(0.0, -1.0), CPL_MATH_1_PI, 2.0 * prec); /* 2/pi */ cpl_test_rel(1.0/atan2(1.0, 0.0), CPL_MATH_2_PI, 2.0 * prec); /* 4/pi */ cpl_test_rel(1.0/atan2(1.0, 1.0), CPL_MATH_4_PI, 2.0 * prec); /* sqrt(2pi) */ cpl_test_rel(sqrt(2.0 * atan2(0.0, -1.0)), CPL_MATH_SQRT2PI, 2.0 * prec); /* 2 / sqrt(pi) */ cpl_test_rel(1.0 / sqrt(atan2(1.0, 1.0)), CPL_MATH_2_SQRTPI, 2.0 * prec); /* sqrt(2) */ cpl_test_rel(sqrt(2.0), CPL_MATH_SQRT2, prec); /* sqrt(3) */ cpl_test_rel(sqrt(3.0), CPL_MATH_SQRT3, prec); /* sqrt(1/2) */ cpl_test_rel(sqrt(0.5), CPL_MATH_SQRT1_2, prec); /* exp(1) */ cpl_test_rel(exp(1.0), CPL_MATH_E, prec); /* log(2) */ cpl_test_rel(log(2.0), CPL_MATH_LN2, prec); /* log(10) */ cpl_test_rel(log(10.0), CPL_MATH_LN10, prec); /* log2(e) */ cpl_test_rel(1.0/log(2.0), CPL_MATH_LOG2E, 2.0 * prec); /* log10(e) */ cpl_test_rel(log10(exp(1.0)), CPL_MATH_LOG10E, prec); /* 180/pi */ cpl_test_rel(45.0 / atan2(1.0, 1.0), CPL_MATH_DEG_RAD, 2.0 * prec); /* pi/180 */ cpl_test_rel(CPL_MATH_RAD_DEG * CPL_MATH_DEG_RAD, 1.0, prec); /* 2.0*sqrt(2.0*log(2.0)) */ cpl_test_rel(2.0*sqrt(2.0*log(2.0)), CPL_MATH_FWHM_SIG, prec); /* 0.5/sqrt(2.0*log(2.0)) */ cpl_test_rel(0.5/sqrt(2.0*log(2.0)), CPL_MATH_SIG_FWHM, 2.0 * prec); cpl_test_zero(CPL_MIN(0, 1)); cpl_test_zero(CPL_MAX(0, -1)); cpl_test_zero(CPL_MIN(0.0, 1.0)); cpl_test_zero(CPL_MAX(0.0, -1.0)); return cpl_test_end(0); } cpl-6.4.1/cplcore/tests/cpl_imagelist_basic-test.c0000644000460300003120000013302512225254511017104 00000000000000/* $Id: cpl_imagelist_basic-test.c,v 1.63 2013-10-09 13:25:29 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-10-09 13:25:29 $ * $Revision: 1.63 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include "cpl_imagelist_basic.h" #include "cpl_imagelist_io.h" #include "cpl_image_gen.h" #include "cpl_image_bpm.h" #include "cpl_image_io.h" #include "cpl_stats.h" #include "cpl_msg.h" #include "cpl_test.h" #include "cpl_memory.h" #include "cpl_math_const.h" #include "cpl_polynomial.h" /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ #define IMAGESZ 10 #define NFRAMES 10 #define MAGIC_NUMBER 42 #define IMAGESZBIG 512 #define TEST 10.0 #define BASE 10.0 #define POW 2.0 /*----------------------------------------------------------------------------- Private Function prototypes -----------------------------------------------------------------------------*/ static void cpl_imagelist_collapse_median_create_tests(cpl_size, cpl_boolean); static void cpl_imagelist_collapse_median_create_bench(cpl_size); static void cpl_imagelist_collapse_minmax_create_bench(cpl_size); static void cpl_imagelist_collapse_sigclip_create_bench(cpl_size, cpl_collapse_mode); static void cpl_imagelist_collapse_sigclip_create_test_one(const cpl_imagelist *); void cpl_imagelist_collapse_create_test(cpl_type); void cpl_imagelist_collapse_sigclip_create_test(void); static void cpl_imagelist_collapse_median_create_test_one(void); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { const cpl_type pixel_type[] = {CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT_COMPLEX, CPL_TYPE_DOUBLE_COMPLEX}; const cpl_size size[] = {1, 2, 3, 5, 8}; cpl_image * img; cpl_size nbad; cpl_size bpm_ind, bpm_x, bpm_y; cpl_size i, j; cpl_boolean do_bench; cpl_imagelist * imlist1; cpl_imagelist * imlist2; unsigned itype1; cpl_error_code error; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ do_bench = cpl_msg_get_level() <= CPL_MSG_INFO ? CPL_TRUE : CPL_FALSE; cpl_imagelist_collapse_median_create_test_one(); cpl_imagelist_collapse_create_test(CPL_TYPE_INT); cpl_imagelist_collapse_create_test(CPL_TYPE_FLOAT); cpl_imagelist_collapse_create_test(CPL_TYPE_DOUBLE); cpl_imagelist_collapse_sigclip_create_test(); for (itype1 = 0; itype1 < sizeof(pixel_type)/sizeof(pixel_type[0]); itype1++) { unsigned itype2; for (itype2 = 0; itype2 < sizeof(pixel_type)/sizeof(pixel_type[0]); itype2++) { unsigned isize; for (isize = 0; isize < sizeof(size)/sizeof(size[0]); isize++) { const cpl_error_code exp_err = !(pixel_type[itype1] & CPL_TYPE_COMPLEX) && (pixel_type[itype2] & CPL_TYPE_COMPLEX) ? CPL_ERROR_TYPE_MISMATCH : CPL_ERROR_NONE; const double xmin = -100.0; const double xmax = 200.0; cpl_image * img2; imlist1 = cpl_imagelist_new(); imlist2 = cpl_imagelist_new(); for (i = 0; i < size[isize]; i++) { cpl_image * iimg = cpl_image_new(IMAGESZ, IMAGESZ, pixel_type[itype1]); cpl_test_zero(cpl_image_fill_noise_uniform(iimg, xmin, xmax)); cpl_test_zero(cpl_imagelist_set(imlist1, iimg, i)); } for (i = 0; i < size[isize]; i++) { cpl_image * iimg = cpl_image_new(IMAGESZ, IMAGESZ, pixel_type[itype2]); cpl_test_zero(cpl_image_fill_noise_uniform(iimg, xmin, xmax) ); cpl_test_zero( cpl_imagelist_set(imlist2, iimg, i) ); } cpl_msg_info(cpl_func, "Basic ops., types %s and %s, with " "imagelist size %" CPL_SIZE_FORMAT, cpl_type_get_name(pixel_type[itype1]), cpl_type_get_name(pixel_type[itype2]), size[isize]); error = cpl_imagelist_add(imlist1, imlist2); cpl_test_eq_error(error, exp_err); error = cpl_imagelist_multiply(imlist1, imlist2); cpl_test_eq_error(error, exp_err); error = cpl_imagelist_subtract(imlist1, imlist2); cpl_test_eq_error(error, exp_err); error = cpl_imagelist_divide(imlist1, imlist2); cpl_test_eq_error(error, exp_err); cpl_imagelist_delete(imlist2); if (itype1 == itype2) { /* Avoid redundant tests */ if (pixel_type[itype1] == CPL_TYPE_INT || pixel_type[itype1] == CPL_TYPE_FLOAT || pixel_type[itype1] == CPL_TYPE_DOUBLE) { cpl_imagelist_collapse_sigclip_create_test_one(imlist1); cpl_msg_info(cpl_func, "Collapse type %s, with " "imagelist size %" CPL_SIZE_FORMAT, cpl_type_get_name(pixel_type[itype1]), size[isize]); img = cpl_imagelist_collapse_minmax_create(imlist1, 0, 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img); img2 = cpl_imagelist_collapse_create(imlist1); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img2); if (pixel_type[itype1] != CPL_TYPE_INT) { /* FIXME: Cannot test int (due to DFS08578) */ const double eps = pixel_type[itype1] == CPL_TYPE_FLOAT ? FLT_EPSILON : DBL_EPSILON; cpl_test_image_abs(img, img2, 300.0 * eps); } cpl_image_delete(img); cpl_image_delete(img2); } else { /* Cannot sort complex numbers */ img = cpl_imagelist_collapse_minmax_create(imlist1, 0, 0); cpl_test_error(CPL_ERROR_INVALID_TYPE); cpl_test_null(img); img = cpl_imagelist_collapse_median_create(imlist1); cpl_test_error(CPL_ERROR_INVALID_TYPE); cpl_test_null(img); } } cpl_imagelist_delete(imlist1); } } } /* Test cpl_imagelist_swap_axis_create() */ img = cpl_image_fill_test_create(IMAGESZ, 2*IMAGESZ); imlist1 = cpl_imagelist_new(); for (i=0; i<3*IMAGESZ; i++) { cpl_test_zero(cpl_imagelist_set(imlist1,cpl_image_duplicate(img),i)); } cpl_image_delete(img); imlist2 = cpl_imagelist_swap_axis_create(imlist1, CPL_SWAP_AXIS_XZ); cpl_test_nonnull(imlist2); cpl_imagelist_delete(imlist2); imlist2 = cpl_imagelist_swap_axis_create(imlist1, CPL_SWAP_AXIS_YZ); cpl_test_nonnull(imlist2); cpl_imagelist_delete(imlist2); /* Test cpl_imagelist_swap_axis_create() with bad pixels */ cpl_image_reject(cpl_imagelist_get(imlist1, 0), 1, 1); cpl_image_reject(cpl_imagelist_get(imlist1, 1), 2, 2); cpl_image_reject(cpl_imagelist_get(imlist1, 2), 2, 5); imlist2 = cpl_imagelist_swap_axis_create(imlist1, CPL_SWAP_AXIS_XZ); cpl_test_nonnull(imlist2); cpl_test_eq(cpl_image_count_rejected(cpl_imagelist_get(imlist2, 0)), 1); cpl_test_eq(cpl_image_count_rejected(cpl_imagelist_get(imlist2, 1)), 2); cpl_test_zero(cpl_image_count_rejected(cpl_imagelist_get(imlist2, 2)) ); cpl_imagelist_delete(imlist2); imlist2 = cpl_imagelist_swap_axis_create(imlist1, CPL_SWAP_AXIS_YZ); cpl_test_nonnull(imlist2); cpl_imagelist_delete(imlist1); cpl_test_eq(cpl_image_count_rejected(cpl_imagelist_get(imlist2,0)), 1); cpl_test_eq(cpl_image_count_rejected(cpl_imagelist_get(imlist2,1)), 1); cpl_test_zero(cpl_image_count_rejected(cpl_imagelist_get(imlist2,2)) ); cpl_test_eq(cpl_image_count_rejected(cpl_imagelist_get(imlist2,4)), 1); cpl_imagelist_delete(imlist2); /* Create two images set */ img = cpl_image_fill_test_create(IMAGESZ, IMAGESZ); imlist1 = cpl_imagelist_new(); imlist2 = cpl_imagelist_new(); for (i=0; i nz/2) { code = cpl_image_fill_noise_uniform(image, 1.0, (double)nz); cpl_test_eq_error(code, CPL_ERROR_NONE); } else if (i > 0) { code = cpl_image_fill_noise_uniform(image, (double)-nz, -1.0); cpl_test_eq_error(code, CPL_ERROR_NONE); } code = cpl_imagelist_set(imglist, image, i); cpl_test_eq_error(code, CPL_ERROR_NONE); } cpl_test_eq(cpl_imagelist_get_size(imglist), nz); if (test_bad) { /* Reject all pixels in the last, extra image */ image = cpl_image_duplicate(image); code = cpl_mask_not(cpl_image_get_bpm(image)); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_imagelist_set(imglist, image, nz); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_eq(cpl_imagelist_get_size(imglist), nz + 1); } image = cpl_imagelist_collapse_median_create(imglist); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(image); cpl_test_eq(cpl_image_get_type(image), type); cpl_test_leq(cpl_image_get_min(image), 0.0); cpl_test_leq(cpl_image_get_max(image), 0.0); cpl_image_delete(image); cpl_imagelist_delete(imglist); } return; } /*----------------------------------------------------------------------------*/ /** @brief Benchmark the CPL function @param mz Number of planes to test @return void */ /*----------------------------------------------------------------------------*/ static void cpl_imagelist_collapse_median_create_bench(cpl_size mz) { cpl_imagelist * imglist = cpl_imagelist_new(); cpl_image * image; const cpl_size nz = mz; const cpl_size nx = 2*IMAGESZBIG; const cpl_size ny = 2*IMAGESZBIG; double secs; size_t bytes; cpl_size i; cpl_msg_info(cpl_func, "Benchmarking with %" CPL_SIZE_FORMAT " %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " images", nz, nx, ny); /* Fill imagelist */ for (i = 0; i < nz; i++) { image = cpl_image_new(nx, ny, CPL_TYPE_FLOAT); cpl_test_zero(cpl_image_fill_noise_uniform(image, 0.0, 1.0)); cpl_test_zero(cpl_imagelist_set(imglist, image, i)); } cpl_test_eq(cpl_imagelist_get_size(imglist), nz); cpl_msg_info(cpl_func, "Testing with %" CPL_SIZE_FORMAT " %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " images", nz, nx, ny); bytes = cpl_test_get_bytes_imagelist(imglist); secs = cpl_test_get_cputime(); image = cpl_imagelist_collapse_median_create(imglist); secs = cpl_test_get_cputime() - secs; cpl_test_nonnull( image); cpl_test_error( CPL_ERROR_NONE); cpl_image_delete(image); cpl_msg_info(cpl_func, "Time spent median collapsing with %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT ": [s]: %g", nz, nx, ny, secs); if (secs > 0.0) { cpl_msg_info(cpl_func,"Processing rate [MB/s]: %g", 1e-6 * (double)bytes / secs); } cpl_imagelist_delete(imglist); return; } /*----------------------------------------------------------------------------*/ /** @brief Benchmark the CPL function @param mz Number of planes to test @return void */ /*----------------------------------------------------------------------------*/ static void cpl_imagelist_collapse_minmax_create_bench(cpl_size mz) { cpl_imagelist * imglist = cpl_imagelist_new(); cpl_image * image; const cpl_size nz = mz; const cpl_size nx = 2*IMAGESZBIG; const cpl_size ny = 2*IMAGESZBIG; double secs; size_t bytes; cpl_size i; cpl_msg_info(cpl_func, "Benchmarking with %" CPL_SIZE_FORMAT " %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " images", nz, nx, ny); /* Fill imagelist */ for (i = 0; i < nz; i++) { image = cpl_image_new(nx, ny, CPL_TYPE_FLOAT); cpl_test_zero(cpl_image_fill_noise_uniform(image, 0.0, 1.0)); cpl_test_zero(cpl_imagelist_set(imglist, image, i)); } cpl_test_eq(cpl_imagelist_get_size(imglist), nz); cpl_msg_info(cpl_func, "Testing with %" CPL_SIZE_FORMAT " %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " images", nz, nx, ny); bytes = cpl_test_get_bytes_imagelist(imglist); secs = cpl_test_get_cputime(); image = cpl_imagelist_collapse_minmax_create(imglist, 1, 1); secs = cpl_test_get_cputime() - secs; cpl_test_nonnull( image); cpl_test_error( CPL_ERROR_NONE); cpl_image_delete(image); cpl_msg_info(cpl_func, "Time spent min-max collapsing with %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT ": [s]: %g", nz, nx, ny, secs); if (secs > 0.0) { cpl_msg_info(cpl_func,"Processing rate [MB/s]: %g", 1e-6 * (double)bytes / secs); } cpl_imagelist_delete(imglist); return; } /*----------------------------------------------------------------------------*/ /** @brief Test the CPL function @param self Imagelist to test @return void */ /*----------------------------------------------------------------------------*/ static void cpl_imagelist_collapse_sigclip_create_test_one(const cpl_imagelist * self) { const unsigned clip_mode[] = {CPL_COLLAPSE_MEAN, CPL_COLLAPSE_MEDIAN, CPL_COLLAPSE_MEDIAN_MEAN}; const int nmode = sizeof(clip_mode)/sizeof(clip_mode[0]); const cpl_size nsize = cpl_imagelist_get_size(self); const cpl_image * image = cpl_imagelist_get_const(self, 0); const cpl_type type = cpl_image_get_type(image); const cpl_size nx = cpl_image_get_size_x(image); const cpl_size ny = cpl_image_get_size_y(image); cpl_image * map = cpl_image_new(nx, ny, CPL_TYPE_INT); int imode; cpl_msg_info(cpl_func, "Testing %s with %" CPL_SIZE_FORMAT " images of " "type %s", "cpl_imagelist_collapse_sigclip_create", nsize, cpl_type_get_name(type)); for (imode = 0; imode < nmode; imode++) { const unsigned mode = clip_mode[imode]; cpl_size ikeep; cpl_size jkeep = nsize; for (ikeep = nsize; ikeep > 0; ikeep--) { const double keepfrac = (ikeep == nsize ? ikeep : ikeep + 0.5) / (double)nsize; cpl_image * clipped = cpl_imagelist_collapse_sigclip_create(self, 0.5, 1.5, keepfrac, mode, map); if (nsize == 1) { cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(clipped); } else if (type & CPL_TYPE_COMPLEX) { cpl_test_error(CPL_ERROR_INVALID_TYPE); cpl_test_null(clipped); } else { cpl_image * contrib; cpl_mask * bpm; /* In no-clip collapsed image */ cpl_size minpix, maxpix, maxbad; cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(clipped); cpl_test_eq(cpl_image_get_type(clipped), type); cpl_test_eq(cpl_image_get_size_x(clipped), nx); cpl_test_eq(cpl_image_get_size_x(clipped), ny); contrib = cpl_image_new_from_accepted(self); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(contrib); minpix = (cpl_size)cpl_image_get_min(contrib); maxpix = (cpl_size)cpl_image_get_max(contrib); maxbad = nsize - minpix; bpm = cpl_mask_threshold_image_create(map, -0.5, 0.5); if (cpl_image_get_min(map) == 0) { cpl_test_eq_mask(bpm, cpl_image_get_bpm_const(clipped)); } else { cpl_test_null(cpl_image_get_bpm_const(clipped)); cpl_test_zero(cpl_mask_count(bpm)); cpl_test_leq(CX_MAX(1, ikeep - maxbad), cpl_image_get_min(map)); } cpl_test_leq(cpl_image_get_max(map), CX_MIN(jkeep, maxpix)); /* Contribution cannot increase with decreasing keepfrac */ jkeep = (cpl_size)cpl_image_get_max(map); if (ikeep == nsize) { /* Nothing was rejected */ cpl_image * average = cpl_imagelist_collapse_create(self); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(average); cpl_test_image_abs(contrib, map, 0.0); /* The clipped image is not (much) different from the averaged one - except for integer pixels, where the average is computed using integer arithmetics, while the clipped uses floating point */ cpl_test_image_abs(clipped, average, nsize * (type == CPL_TYPE_INT ? 1 : 150.0 * (type == CPL_TYPE_DOUBLE ? DBL_EPSILON : FLT_EPSILON))); cpl_image_delete(average); } cpl_mask_delete(bpm); cpl_image_delete(contrib); cpl_image_delete(clipped); } } } cpl_image_delete(map); } /*----------------------------------------------------------------------------*/ /** @brief Benchmark the CPL function @param mz Number of planes to test @param mode Clipping mode, CPL_COLLAPSE_MEAN, CPL_COLLAPSE_MEDIAN or CPL_COLLAPSE_MEDIAN_MEAN @return void @note Modified from cpl_imagelist_collapse_minmax_create_bench() */ /*----------------------------------------------------------------------------*/ static void cpl_imagelist_collapse_sigclip_create_bench(cpl_size mz, cpl_collapse_mode mode) { cpl_imagelist * imglist = cpl_imagelist_new(); const cpl_size nz = mz; const cpl_size nx = 2*IMAGESZBIG; const cpl_size ny = 2*IMAGESZBIG; cpl_image * image = NULL; cpl_image * map = cpl_image_new(nx, ny, CPL_TYPE_INT); cpl_error_code error; double secs; cpl_type type; size_t bytes; cpl_size i; cpl_msg_info(cpl_func, "Benchmarking with %" CPL_SIZE_FORMAT " %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " images", nz, nx, ny); /* Fill imagelist */ for (i = 0; i < nz; i++) { image = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(image); error = cpl_image_fill_noise_uniform(image, 0.0, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(imglist, image, i); cpl_test_eq_error(error, CPL_ERROR_NONE); } type = cpl_image_get_type(image); cpl_test_eq(cpl_imagelist_get_size(imglist), nz); cpl_msg_info(cpl_func, "Testing with %" CPL_SIZE_FORMAT " %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " images", nz, nx, ny); bytes = cpl_test_get_bytes_imagelist(imglist); secs = cpl_test_get_cputime(); image = cpl_imagelist_collapse_sigclip_create(imglist, 0.5, 1.5, 0.25, mode, map); secs = cpl_test_get_cputime() - secs; cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_image_get_size_x(image), nx); cpl_test_eq(cpl_image_get_size_y(image), ny); cpl_test_eq(cpl_image_get_type(image), type); cpl_image_delete(image); cpl_test_leq(1, cpl_image_get_min(map)); cpl_msg_info(cpl_func, "Time spent kappa-sigma-clipping around the %s " "with %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT ": [s]: %g", mode == CPL_COLLAPSE_MEAN ? "mean" : (mode == CPL_COLLAPSE_MEDIAN ? "median" : "median+mean"), nz, nx, ny, secs); if (secs > 0.0) { cpl_msg_info(cpl_func,"Processing rate [MB/s]: %g", 1e-6 * (double)bytes / secs); } cpl_imagelist_delete(imglist); cpl_image_delete(map); return; } /*----------------------------------------------------------------------------*/ /** @brief Test the CPL function @param type The pixel type to test @return void */ /*----------------------------------------------------------------------------*/ void cpl_imagelist_collapse_create_test(cpl_type type) { cpl_imagelist * imlist1 = cpl_imagelist_new(); cpl_image * img = cpl_image_new(IMAGESZ, IMAGESZ, type); cpl_error_code error; cpl_size i; /* Fill the list with integers 1 .. 2n+1 */ /* Their mean: 0.5 * (2n+1) * (2n+2) / 2n+1 = n + 1 */ for (i=0; i < 2 * IMAGESZ + 1; i++) { error = cpl_image_add_scalar(img, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(imlist1, cpl_image_duplicate(img), i); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_image_delete(img); cpl_test_eq(cpl_imagelist_get_size(imlist1), 2 * IMAGESZ + 1); img = cpl_imagelist_collapse_create(imlist1); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img); cpl_test_eq(cpl_image_get_type(img), type); cpl_test_abs(cpl_image_get_min(img), IMAGESZ + 1.0, DBL_EPSILON); cpl_test_abs(cpl_image_get_max(img), IMAGESZ + 1.0, DBL_EPSILON); cpl_image_delete(img); cpl_imagelist_delete(imlist1); return; } /*----------------------------------------------------------------------------*/ /** @brief Test the CPL function @return void */ /*----------------------------------------------------------------------------*/ void cpl_imagelist_collapse_sigclip_create_test(void) { const unsigned clip_mode[] = {CPL_COLLAPSE_MEAN, CPL_COLLAPSE_MEDIAN, CPL_COLLAPSE_MEDIAN_MEAN}; const int nmode = sizeof(clip_mode)/sizeof(clip_mode[0]); cpl_imagelist * imlist1 = cpl_imagelist_new(); cpl_image * nullimg; /* Expected to be NULL */ cpl_image * map = cpl_image_new(1, 1, CPL_TYPE_INT); cpl_error_code error; int imode; cpl_size nz, i; for (imode = 0; imode < nmode; imode++) { const unsigned mode = clip_mode[imode]; cpl_image * img = cpl_image_new(1, 1, CPL_TYPE_DOUBLE); cpl_imagelist_empty(imlist1); /* Fill the list with equal number of zero- and one-valued images */ /* Their mean: 0.5 */ /* Their St.dev: 0.5 * n / (n-1) */ for (i=0; i < IMAGESZ; i++) { error = cpl_imagelist_set(imlist1, cpl_image_duplicate(img), i); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_image_add_scalar(img, 1.0); for (; i < 2 * IMAGESZ; i++) { error = cpl_imagelist_set(imlist1, cpl_image_duplicate(img), i); cpl_test_eq_error(error, CPL_ERROR_NONE); } nz = 2 * IMAGESZ; cpl_image_delete(img); cpl_test_eq(cpl_imagelist_get_size(imlist1), nz); /* kappa greater than (n-1)/n means no iterations at all */ img = cpl_imagelist_collapse_sigclip_create(imlist1, 2.0, 2.0, 0.5, mode, map); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img); cpl_test_abs(cpl_image_get_min(img), 0.5, DBL_EPSILON); cpl_test_abs(cpl_image_get_max(img), 0.5, DBL_EPSILON); cpl_test_eq(cpl_image_get_min(map), 2 * IMAGESZ); cpl_test_eq(cpl_image_get_max(map), 2 * IMAGESZ); cpl_image_delete(img); /* kappa less than (n-1)/n means 1 iteration, still with no clipping */ img = cpl_imagelist_collapse_sigclip_create(imlist1, 0.5, 0.5, 0.5, mode, map); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img); cpl_test_abs(cpl_image_get_min(img), 0.5, DBL_EPSILON); cpl_test_abs(cpl_image_get_max(img), 0.5, DBL_EPSILON); cpl_test_eq(cpl_image_get_min(map), 2 * IMAGESZ); cpl_test_eq(cpl_image_get_max(map), 2 * IMAGESZ); /* Append an image once, with the average value */ cpl_test_zero(cpl_imagelist_set(imlist1, img, nz++)); cpl_test_eq(cpl_imagelist_get_size(imlist1), nz); /* It is not possible to clip all but one value, so all are kept */ img = cpl_imagelist_collapse_sigclip_create(imlist1, 0.5, 0.5, 1.0 / nz, mode, map); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img); cpl_test_abs(cpl_image_get_min(img), 0.5, DBL_EPSILON); cpl_test_abs(cpl_image_get_max(img), 0.5, DBL_EPSILON); cpl_test_eq(cpl_image_get_min(map), 2 * IMAGESZ + 1); cpl_test_eq(cpl_image_get_max(map), 2 * IMAGESZ + 1); /* Append the average image once more */ cpl_test_zero(cpl_imagelist_set(imlist1, img, nz++)); cpl_test_eq(cpl_imagelist_get_size(imlist1), nz); /* It is possible to clip all but two values */ img = cpl_imagelist_collapse_sigclip_create(imlist1, 0.5, 0.5, 1.0 / nz, mode, map); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img); cpl_test_abs(cpl_image_get_min(img), 0.5, DBL_EPSILON); cpl_test_abs(cpl_image_get_max(img), 0.5, DBL_EPSILON); cpl_test_eq(cpl_image_get_min(map), 2); cpl_test_eq(cpl_image_get_max(map), 2); /* Append two more values, one a bit below and one a bit above the mean */ error = cpl_image_subtract_scalar(img, 1.0 / IMAGESZ); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_imagelist_set(imlist1, img, nz++)); cpl_test_eq(cpl_imagelist_get_size(imlist1), nz); img = cpl_image_duplicate(cpl_imagelist_get_const(imlist1, nz-1)); error = cpl_image_add_scalar(img, 2.0 / IMAGESZ); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_imagelist_set(imlist1, img, nz++)); cpl_test_eq(cpl_imagelist_get_size(imlist1), nz); /* Clip no values */ img = cpl_imagelist_collapse_sigclip_create(imlist1, 1.0 / nz, 1.0 / nz, 1.0 / nz, mode, map); cpl_test_abs(cpl_image_get_min(img), 0.5, DBL_EPSILON); cpl_test_abs(cpl_image_get_max(img), 0.5, DBL_EPSILON); cpl_image_delete(img); /* Clip all but the two central values */ img = cpl_imagelist_collapse_sigclip_create(imlist1, 0.75, 0.75, 1.0 / nz, mode, map); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img); cpl_test_abs(cpl_image_get_min(img), 0.5, DBL_EPSILON); cpl_test_abs(cpl_image_get_max(img), 0.5, DBL_EPSILON); cpl_test_eq(cpl_image_get_min(map), 2); cpl_test_eq(cpl_image_get_max(map), 2); cpl_image_delete(img); /* Clip all but the four most central values */ img = cpl_imagelist_collapse_sigclip_create(imlist1, 1.0, 1.0, 3.5 / nz, mode, map); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img); cpl_test_abs(cpl_image_get_min(img), 0.5, DBL_EPSILON); cpl_test_abs(cpl_image_get_max(img), 0.5, DBL_EPSILON); cpl_test_eq(cpl_image_get_min(map), 4); cpl_test_eq(cpl_image_get_max(map), 4); cpl_image_delete(img); /* Test error handling */ img = cpl_imagelist_collapse_sigclip_create(imlist1, 2.0, 2.0, 0.5, mode, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img); cpl_image_delete(img); nullimg = cpl_imagelist_collapse_sigclip_create(NULL, 1.0, 1.0, 0.75, mode, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullimg); nullimg = cpl_imagelist_collapse_sigclip_create(imlist1, 0.0, 0.0, 0.75, mode, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_imagelist_collapse_sigclip_create(imlist1, -1.0, 1.0, 0.75, mode, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_imagelist_collapse_sigclip_create(imlist1, 1.0, 1.0, 0.0, mode, NULL); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_null(nullimg); nullimg = cpl_imagelist_collapse_sigclip_create(imlist1, 1.0, 1.0, 1.0 + DBL_EPSILON, mode, NULL); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_null(nullimg); img = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_FLOAT); nullimg = cpl_imagelist_collapse_sigclip_create(imlist1, 1.0, 1.0, 0.75, mode, img); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); cpl_image_delete(img); img = cpl_image_new(IMAGESZ, IMAGESZ + 1, CPL_TYPE_INT); nullimg = cpl_imagelist_collapse_sigclip_create(imlist1, 1.0, 1.0, 0.75, mode, img); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); cpl_image_delete(img); img = cpl_image_new(IMAGESZ + 1, IMAGESZ, CPL_TYPE_INT); nullimg = cpl_imagelist_collapse_sigclip_create(imlist1, 1.0, 1.0, 0.75, mode, img); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); cpl_imagelist_empty(imlist1); nullimg = cpl_imagelist_collapse_sigclip_create(imlist1, 1.0, 1.0, 0.75, mode, NULL); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(nullimg); error = cpl_imagelist_set(imlist1, img, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); nullimg = cpl_imagelist_collapse_sigclip_create(imlist1, 1.0, 1.0, 0.75, mode, NULL); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(nullimg); cpl_imagelist_empty(imlist1); img = cpl_image_new(1, 1, CPL_TYPE_FLOAT_COMPLEX); error = cpl_imagelist_set(imlist1, img, 0); img = cpl_image_new(1, 1, CPL_TYPE_FLOAT_COMPLEX); error = cpl_imagelist_set(imlist1, img, 1); nullimg = cpl_imagelist_collapse_sigclip_create(imlist1, 1.0, 1.0, 0.75, mode, NULL); cpl_test_error(CPL_ERROR_INVALID_TYPE); cpl_test_null(nullimg); cpl_imagelist_empty(imlist1); img = cpl_image_new(1, 1, CPL_TYPE_DOUBLE_COMPLEX); error = cpl_imagelist_set(imlist1, img, 0); img = cpl_image_new(1, 1, CPL_TYPE_DOUBLE_COMPLEX); error = cpl_imagelist_set(imlist1, img, 1); nullimg = cpl_imagelist_collapse_sigclip_create(imlist1, 1.0, 1.0, 0.75, mode, NULL); cpl_test_error(CPL_ERROR_INVALID_TYPE); cpl_test_null(nullimg); } nullimg = cpl_imagelist_collapse_sigclip_create(imlist1, 1.0, 1.0, 0.75, CPL_COLLAPSE_MEAN + CPL_COLLAPSE_MEDIAN + CPL_COLLAPSE_MEDIAN_MEAN, NULL); cpl_test_error(CPL_ERROR_UNSUPPORTED_MODE); cpl_test_null(nullimg); cpl_imagelist_delete(imlist1); cpl_image_delete(map); } /*----------------------------------------------------------------------------*/ /** @brief Test the CPL function @return void @note This test activates the cache optimization given a 18MB L2 cache */ /*----------------------------------------------------------------------------*/ static void cpl_imagelist_collapse_median_create_test_one(void) { cpl_imagelist * imlist = cpl_imagelist_new(); cpl_image * img; cpl_size i; for (i = 0 ; i < 300; i++) { img = cpl_image_new(IMAGESZBIG, IMAGESZBIG/2, CPL_TYPE_FLOAT); cpl_image_reject(img, IMAGESZBIG, IMAGESZBIG/2); cpl_imagelist_set(imlist, img, i); } img = cpl_imagelist_collapse_median_create(imlist); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img); cpl_test(cpl_image_is_rejected(img, IMAGESZBIG, IMAGESZBIG/2)); cpl_image_delete(img); cpl_imagelist_delete(imlist); } cpl-6.4.1/cplcore/tests/cpl_polynomial-test.c0000644000460300003120000020264411714174235016162 00000000000000/* $Id: cpl_polynomial-test.c,v 1.112 2012-02-07 10:10:37 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-02-07 10:10:37 $ * $Revision: 1.112 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "cpl_polynomial.h" #include "cpl_error_impl.h" #include "cpl_test.h" #include "cpl_tools.h" #include "cpl_memory.h" #include "cpl_math_const.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define POLY_COEF_NB 5 #define VECTOR_SIZE 1024 #define POLY_SIZE 24 #define POLY_DIM 11 /*----------------------------------------------------------------------------- Pricate functions -----------------------------------------------------------------------------*/ static void cpl_polynomial_fit_bench_2d(cpl_size, cpl_size, cpl_size); static void cpl_polynomial_fit_test_1d(FILE *); static cpl_polynomial * cpl_polynomial_fit_test_2d(FILE *, cpl_boolean); static void cpl_vector_fill_polynomial_fit_residual_test(void); static double cpl_vector_get_mse(const cpl_vector *, const cpl_polynomial *, const cpl_matrix *, double *); static cpl_error_code cpl_polynomial_fit_cmp(cpl_polynomial *, const cpl_matrix *, const cpl_boolean *, const cpl_vector *, const cpl_vector *, cpl_boolean , const cpl_size *, const cpl_size *); static cpl_flops mse_flops = 0; static double mse_secs = 0.0; /**@{*/ /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_polynomial * poly1; cpl_polynomial * poly2; cpl_polynomial * poly3; double x, y, z1, z2; double z, y_1, y2, x1, x2; cpl_vector * vec; cpl_vector * taylor; double * vec_data; /* Some binomial coefficients */ double p15[8] = {1,15,105,455,1365,3003,5005,6435}; double xmax = 0; /* Maximum rounding error on x */ double ymax = 0; /* Maximum rounding error on y */ double eps; cpl_size expo[POLY_DIM]; cpl_size i, j; cpl_size k; cpl_error_code error; FILE * stream; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; cpl_test_nonnull( stream ); cpl_vector_fill_polynomial_fit_residual_test(); cpl_polynomial_fit_test_1d(stream); x = 3.14; y = 2.72; cpl_test_null( cpl_polynomial_extract(NULL, 0, NULL) ); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test( cpl_polynomial_derivative(NULL, 0) ); cpl_test_error(CPL_ERROR_NULL_INPUT); /* Create a polynomial */ poly1 = cpl_polynomial_new(1); cpl_polynomial_dump(poly1, stream); cpl_test_zero( cpl_polynomial_get_degree(poly1)); error = cpl_polynomial_multiply_scalar(poly1, poly1, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_polynomial_get_degree(poly1)); /* Various tests regarding 0-degree polynomials */ cpl_test_null( cpl_polynomial_extract(poly1, 0, poly1) ); cpl_test_error(CPL_ERROR_INVALID_TYPE); error = cpl_polynomial_derivative(poly1, 1); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_zero( cpl_polynomial_derivative(poly1, 0) ); cpl_test_abs( cpl_polynomial_eval_1d(poly1, 5, &x), 0.0, 0.0); cpl_test_abs(x, 0.0, 0.0 ); cpl_test_abs( cpl_polynomial_solve_1d(poly1, 5, &x, 1), 0.0, 0.0 ); cpl_test_abs(x, 0.0, 0.0 ); cpl_test_abs( cpl_polynomial_eval_1d(poly1, 5, &x), 0.0, 0.0); cpl_test_abs(x, 0.0, 0.0 ); /* Properly react to a 0-degree polynomial with no roots */ i = 0; cpl_test_zero( cpl_polynomial_set_coeff(poly1, &i, 1) ); cpl_test_abs( cpl_polynomial_get_coeff(poly1, &i), 1.0, 0.0 ); error = cpl_polynomial_solve_1d(poly1, 1, &x, 1); cpl_test_eq_error(error, CPL_ERROR_DIVISION_BY_ZERO); /* Equivalent to setting all coefficients to zero */ error = cpl_polynomial_derivative(poly1, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_abs( cpl_polynomial_eval_1d(poly1, 5, &x), 0.0, 0.0); cpl_test_abs( x, 0.0, 0.0); i = VECTOR_SIZE; cpl_test_zero( cpl_polynomial_set_coeff(poly1, &i, 1) ); cpl_test_abs( cpl_polynomial_get_coeff(poly1, &i), 1.0, 0.0 ); cpl_test_zero( cpl_polynomial_set_coeff(poly1, &i, 0) ); cpl_test_eq( cpl_polynomial_get_dimension(poly1), 1); cpl_test_zero( cpl_polynomial_get_degree(poly1)); cpl_test( poly2 = cpl_polynomial_duplicate(poly1) ); cpl_test_zero( cpl_polynomial_get_degree(poly2)); cpl_polynomial_delete(poly2); cpl_test( poly2 = cpl_polynomial_new(VECTOR_SIZE) ); cpl_test_eq( cpl_polynomial_get_dimension(poly2), VECTOR_SIZE ); cpl_test_zero( cpl_polynomial_get_degree(poly2)); cpl_test_zero( cpl_polynomial_copy(poly2, poly1)); cpl_test_eq( cpl_polynomial_get_dimension(poly2), 1 ); cpl_test_zero( cpl_polynomial_get_degree(poly2)); cpl_polynomial_delete(poly2); /* Set the coefficients : 1 + 2.x + 3.x^2 + 4.x^3 + 5.x^4 */ for (i=0; i < POLY_COEF_NB ; i++) { if (i % (POLY_COEF_NB-2) != 0) continue; cpl_test_zero( cpl_polynomial_set_coeff(poly1, &i, (double)(i+1)) ); cpl_polynomial_dump(poly1, stream); } for (i=0; i < POLY_COEF_NB ; i++) { if (i % (POLY_COEF_NB-2) == 0) continue; cpl_polynomial_dump(poly1, stream); cpl_test_zero( cpl_polynomial_set_coeff(poly1, &i, (double)(i+1))); } cpl_polynomial_dump(poly1, stream); /* Test cpl_polynomial_get_degree() */ cpl_test_eq( cpl_polynomial_get_degree(poly1), POLY_COEF_NB-1); /* Test cpl_polynomial_get_coeff() */ for (i=0; i < POLY_COEF_NB ; i++) cpl_test_abs( cpl_polynomial_get_coeff(poly1, &i), (double)(i+1), 0.0); /* Test cpl_polynomial_eval() */ vec = cpl_vector_new(1); vec_data = cpl_vector_get_data(vec); vec_data[0] = x; z1 = cpl_polynomial_eval(poly1, vec); cpl_vector_delete(vec); /* Dump polynomials */ cpl_polynomial_dump(poly1, stream); /* Test cpl_polynomial_duplicate() and cpl_polynomial_copy() */ poly2 = cpl_polynomial_duplicate(poly1); cpl_test_zero( cpl_polynomial_compare(poly1, poly2, 0) ); cpl_polynomial_copy(poly1, poly2); cpl_test_zero( cpl_polynomial_compare(poly1, poly2, 0) ); i = 10 + cpl_polynomial_get_degree(poly1); error = cpl_polynomial_set_coeff(poly1, &i, 42.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_multiply_scalar(poly1, poly2, 0.5); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_polynomial_get_degree(poly1), cpl_polynomial_get_degree(poly2)); error = cpl_polynomial_multiply_scalar(poly1, poly1, 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_polynomial_compare(poly1, poly2, 0) ); error = cpl_polynomial_multiply_scalar(poly1, poly2, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_polynomial_get_degree(poly1)); error = cpl_polynomial_multiply_scalar(poly2, poly2, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_polynomial_get_degree(poly2)); /* Free */ cpl_polynomial_delete(poly1); cpl_polynomial_delete(poly2); /* Properly react to a polynomial with one real root at x = 1 and a proper (positive) 1st guess */ poly1 = cpl_polynomial_new(1); i = 0; cpl_test_zero( cpl_polynomial_set_coeff(poly1, &i, -1.0) ); i++; cpl_test_zero( cpl_polynomial_set_coeff(poly1, &i, 1.0) ); i = 2 * POLY_SIZE; cpl_test_zero( cpl_polynomial_set_coeff(poly1, &i, -1.0) ); i++; cpl_test_zero( cpl_polynomial_set_coeff(poly1, &i, 1.0) ); cpl_test_zero( cpl_polynomial_solve_1d(poly1, 5, &x, 1) ); cpl_test_abs( x, 1.0, 0.0 ); cpl_polynomial_delete(poly1); poly1 = cpl_polynomial_new(1); /* Create a tmporary vector - with a small length */ cpl_test_nonnull( vec = cpl_vector_new(POLY_SIZE) ); /* Fill the vector with a exp() Taylor series */ vec_data = cpl_vector_get_data(vec); cpl_test_nonnull( vec_data ); i = 0; vec_data[i] = 1; for (i=1 ; i < POLY_SIZE ; i++) { vec_data[i] = vec_data[i-1] / (double)i; } for (i=POLY_SIZE-1 ; i >= 0; i--) { cpl_test_zero( cpl_polynomial_set_coeff(poly1, &i, vec_data[i]) ); } cpl_test_eq( cpl_polynomial_get_degree(poly1), POLY_SIZE-1); cpl_test_abs(cpl_polynomial_eval_1d(poly1, 0, &y), 1.0, DBL_EPSILON); cpl_test_abs( y, 1.0, DBL_EPSILON); /* See how far away from zero the approximation holds */ x = DBL_EPSILON; while ( fabs(cpl_polynomial_eval_1d(poly1, x, NULL)-exp( x)) < DBL_EPSILON * exp( x) && fabs(cpl_polynomial_eval_1d(poly1,-x, &y)-exp(-x)) < DBL_EPSILON * exp(-x) ) { /* Differentation of exp() does not change anything - but in the case of a Taylor approximation one term is lost and with it a bit of precision */ cpl_test_rel( exp(-x), y, 7.5 * DBL_EPSILON); x *= 2; } x /= 2; /* FIXME: Verify the correctness of this test */ cpl_test_leq( -x, -FLT_EPSILON); /* OK for POLY_SIZE >= 4 */ z2 = 2 * x / VECTOR_SIZE; /* Evaluate a sequence of exp()-approximations */ taylor = cpl_vector_new(VECTOR_SIZE); cpl_test_zero( cpl_vector_fill_polynomial(taylor, poly1, -x, z2)); vec_data = cpl_vector_get_data(taylor); cpl_test_nonnull( vec_data ); for (i=0 ; i < VECTOR_SIZE ; i++) { const double xapp = -x + (double)i * z2; const double yapp = exp( xapp ); /* cpl_vector_fill_polynomial() is just a wrapper */ cpl_test_abs( vec_data[i], cpl_polynomial_eval_1d(poly1, xapp, &y), 2*DBL_EPSILON); if ( fabs(y - yapp ) > ymax * yapp ) ymax = fabs(y - yapp ) / yapp; if ( fabs(vec_data[i] - yapp ) > xmax * yapp ) xmax = fabs(vec_data[i] - yapp ) / yapp; } cpl_msg_info("","Rounding on %d-term Taylor-exp() in range [%g; %g] " "[DBL_EPSILON]: %7.5f %7.5f", POLY_SIZE, -x, x, xmax/DBL_EPSILON, ymax/DBL_EPSILON); cpl_test_leq( xmax, 2.0*DBL_EPSILON); cpl_test_leq( xmax, ymax); cpl_test_leq( ymax, 7.39*DBL_EPSILON); vec_data = cpl_vector_get_data(vec); eps = vec_data[0]; /* Solve p(y) = exp(x/2) - i.e. compute a logarithm */ i = 0; vec_data[i] -= exp(x/2); cpl_polynomial_set_coeff(poly1, &i, vec_data[i]); cpl_test_zero( cpl_polynomial_solve_1d(poly1, -x * x, &y, 1) ); vec_data[0] = eps; cpl_polynomial_set_coeff(poly1, &i, vec_data[i]); /* Check solution - allow up to 2 * meps rounding */ cpl_test_rel( y, x/2, 2.0*DBL_EPSILON); /* Check Residual - allow up to 2 * meps rounding */ cpl_test_rel( cpl_polynomial_eval_1d(poly1, y, NULL), exp(x/2), 2.0 * DBL_EPSILON ); /* Free */ cpl_vector_delete(vec); cpl_vector_delete(taylor); cpl_polynomial_delete(poly1); poly1 = cpl_polynomial_new(1); i = 0; cpl_polynomial_set_coeff(poly1, &i, 2); i++; cpl_polynomial_set_coeff(poly1, &i, 2); i++; cpl_polynomial_set_coeff(poly1, &i, 1); cpl_test_eq( cpl_polynomial_get_degree(poly1), 2); /* Properly react on a polynomial with no real roots */ cpl_test_eq( cpl_polynomial_solve_1d(poly1, 0, &x, 1), CPL_ERROR_DIVISION_BY_ZERO ); i = 0; cpl_polynomial_set_coeff(poly1, &i, 4); /* Properly react on a polynomial with no real roots */ error = cpl_polynomial_solve_1d(poly1, 0, &x, 1); cpl_test_eq_error(error, CPL_ERROR_CONTINUE); cpl_polynomial_delete(poly1); poly1 = cpl_polynomial_new(1); /* The simplest 15-degree polynomial */ i =15; cpl_polynomial_set_coeff(poly1, &i, 1); cpl_test_eq( cpl_polynomial_get_degree(poly1), i); cpl_test_zero( cpl_polynomial_solve_1d(poly1, 10, &x, i) ); cpl_test_abs( x, 0.0, DBL_EPSILON); cpl_test_abs( cpl_polynomial_eval_1d(poly1, x, &y), 0.0, DBL_EPSILON); cpl_test_abs( y, 0.0, DBL_EPSILON); /* -1 is a root with multiplicity 15 */ x1 = -1; poly2 = cpl_polynomial_duplicate(poly1); cpl_test_zero( cpl_polynomial_shift_1d(poly2, 0, -x1) ); /* poly2 now holds the binomial coefficients for n = 15 */ i = 0; for (i = 0; i < 8; i++) { cpl_polynomial_set_coeff(poly1, &i, p15[i]); j = 15 - i; cpl_polynomial_set_coeff(poly1, &j, p15[i]); } i = 15; cpl_test_eq( cpl_polynomial_get_degree(poly1), i); for (i = 0; i < 8; i++) { j = 15 - i; z1 = cpl_polynomial_get_coeff(poly1, &i); z2 = cpl_polynomial_get_coeff(poly2, &i); z = cpl_polynomial_get_coeff(poly2, &j); cpl_test_rel( z1, z2, 1.0 * DBL_EPSILON); cpl_test_rel( z, z2, 1.0 * DBL_EPSILON); } cpl_test_zero( cpl_polynomial_compare(poly1,poly2,0) ); i = 15; cpl_polynomial_solve_1d(poly1, 10*x1, &x, i); z = cpl_polynomial_eval_1d(poly1, x, &y); cpl_msg_info("", "(X+1)^15 (%" CPL_SIZE_FORMAT "): %g %g %g", i, (x-x1)/DBL_EPSILON, z/DBL_EPSILON, y/DBL_EPSILON); cpl_test_rel( x, x1, DBL_EPSILON ); cpl_test_abs( z, 0.0, DBL_EPSILON ); cpl_test_abs( y, 0.0, DBL_EPSILON); /* Lots of round-off here, which depends on the long double precision */ i = 5; cpl_test_zero( cpl_polynomial_solve_1d(poly1, -10*x1, &x, i) ); z = cpl_polynomial_eval_1d(poly1, x, &y); cpl_msg_info("", "(X+1)^15 (%" CPL_SIZE_FORMAT ") " CPL_LDBL_EPSILON_STR ": %g %g %g", i, x-x1, (double)(z/CPL_LDBL_EPSILON), (double)(y/CPL_LDBL_EPSILON)); cpl_test_rel( x, x1, 0.35 ); /* alphaev56 */ cpl_test_abs( z, 0.0, 18202.0 * DBL_EPSILON); cpl_test_abs( y, 0.0, 1554616.0 * DBL_EPSILON); /* alphaev56 */ i = 15; eps = 2 * DBL_EPSILON; cpl_polynomial_set_coeff(poly1, &i, 1 + eps); cpl_test( cpl_polynomial_compare(poly1,poly2,-eps/2) < 0); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_zero( cpl_polynomial_compare(poly1,poly2,eps) ); cpl_test( cpl_polynomial_compare(poly1,poly2,eps/2) > 0); cpl_polynomial_delete(poly2); poly2 = cpl_polynomial_new(POLY_DIM); cpl_polynomial_dump(poly2, stream); cpl_test_eq( cpl_polynomial_get_dimension(poly2), POLY_DIM); cpl_test_zero( cpl_polynomial_get_degree(poly2)); /* Set and reset some (outragous) coefficient */ for (j = 0; j =0; i--) cpl_test_abs( cpl_polynomial_get_coeff(poly1, &i), 0.0, 0.0); cpl_test_zero( cpl_polynomial_copy(poly1, poly2) ); cpl_test_eq( cpl_polynomial_get_dimension(poly2), POLY_DIM); cpl_test_zero( cpl_polynomial_compare(poly1, poly2, 0) ); i = 12; for (j = 0; j 0 ); cpl_test_zero( cpl_polynomial_set_coeff(poly2, expo, cpl_polynomial_get_coeff(poly1, expo)) ); cpl_test_zero( cpl_polynomial_compare(poly1, poly2, 0) ); x = cpl_polynomial_get_coeff(poly1, expo); for (j = 0; j 0 ); cpl_polynomial_delete(poly2); poly3 = cpl_polynomial_new(POLY_DIM-1); for (j = 0; j 0; i--) { x1 *= (double)i; cpl_test_zero( cpl_polynomial_derivative(poly1, 0) ); } cpl_test_zero( cpl_polynomial_get_degree(poly1) ); /* Verify the value of the constant term */ cpl_test_abs( x1, cpl_polynomial_get_coeff(poly1, &i), 0.0); cpl_polynomial_delete(poly1); /* Create and collapse and differentiate a 2d-polynomial with uniform coefficients */ poly1 = cpl_polynomial_new(2); x = CPL_MATH_PI_4; y = CPL_MATH_E; x1 = 1.0; for (i=0; i < POLY_SIZE; i++) { for (j=0; j < POLY_SIZE; j++) { expo[0] = i; expo[1] = j; cpl_test_zero( cpl_polynomial_set_coeff(poly1, expo, x)); } if (i > 0) x1 *= (double)i; } i = 0; cpl_test_zero( cpl_polynomial_set_coeff(poly3, &i, y)); for (j = 0; j < 2; j++) { poly2 = cpl_polynomial_extract(poly1, j, poly3); z1 = 0.0; for (i=0; i < POLY_SIZE; i++) { z1 += pow(y, (double)i); } z1 *= x; for (i=0; i < POLY_SIZE; i++) { z = cpl_polynomial_get_coeff(poly2, &i); cpl_test_abs( z, z1, 2.0*POLY_SIZE*FLT_EPSILON); } cpl_test_zero( cpl_polynomial_derivative(poly2, 0) ); i = 0; z = cpl_polynomial_get_coeff(poly2, &i); for (i=1; i < POLY_SIZE-1; i++) { z1 = cpl_polynomial_get_coeff(poly2, &i); cpl_test_abs( z * (double)(i+1), z1, 11.0*POLY_SIZE*FLT_EPSILON); } cpl_polynomial_delete(poly2); } cpl_polynomial_delete(poly3); for (i=POLY_SIZE-1; i > 0; i--) { cpl_test_zero( cpl_polynomial_derivative(poly1, 0) ); cpl_test_zero( cpl_polynomial_derivative(poly1, 1) ); } cpl_test_zero( cpl_polynomial_get_degree(poly1) ); expo[0] = expo[1] = 0; x2 = cpl_polynomial_get_coeff(poly1, expo); /* The constant term is huge at this point - reduce by a factor eps which is inaccurate */ eps = x2 * DBL_EPSILON > 1 ? x2 * DBL_EPSILON : 1; xmax = x2/eps - x * x1 * x1/eps; cpl_test_abs( xmax, 0.0, 1.0); cpl_polynomial_delete(poly1); /* Test for DFS06121 */ poly2 = cpl_polynomial_new(2); expo[0] = 0; expo[1] = 0; cpl_test_zero( cpl_polynomial_set_coeff(poly2, expo, -256.0) ); expo[1] = 1; cpl_test_zero( cpl_polynomial_set_coeff(poly2, expo, 1.0) ); expo[1] = 2; cpl_test_zero( cpl_polynomial_set_coeff(poly2, expo, 0.001) ); cpl_test_zero( cpl_polynomial_derivative(poly2, 0) ); cpl_test_zero( cpl_polynomial_get_degree(poly2) ); cpl_test_zero( cpl_polynomial_derivative(poly2, 0) ); cpl_test_zero( cpl_polynomial_get_degree(poly2) ); cpl_test_zero( cpl_polynomial_derivative(poly2, 1) ); cpl_test_zero( cpl_polynomial_get_degree(poly2) ); cpl_polynomial_delete(poly2); if (cpl_msg_get_level() <= CPL_MSG_INFO) cpl_polynomial_fit_bench_2d(1, 5 * POLY_SIZE, POLY_SIZE); if (mse_secs > 0.0) cpl_msg_info("","Speed of cpl_vector_fill_polynomial_fit_residual() " "over %g secs [Mflop/s]: %g", mse_secs, (double)mse_flops/mse_secs/1e6); if (stream != stdout) cpl_test_zero( fclose(stream) ); return cpl_test_end(0); } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @return void */ /*----------------------------------------------------------------------------*/ static void cpl_vector_fill_polynomial_fit_residual_test(void) { cpl_error_code error; /* Test 1: NULL input */ error = cpl_vector_fill_polynomial_fit_residual(NULL, NULL, NULL, NULL, NULL, NULL); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test cpl_polynomial_fit() in 2D @param stream A stream to dump to @param dimdeg Passed to cpl_polynomial_fit() @return void */ /*----------------------------------------------------------------------------*/ static cpl_polynomial * cpl_polynomial_fit_test_2d(FILE * stream, cpl_boolean dimdeg) { cpl_matrix * xy_pos; cpl_vector * xpoint; const double xy_offset = 100; cpl_size degree; cpl_polynomial * poly1 = cpl_polynomial_new(2); cpl_polynomial * poly2 = cpl_polynomial_new(2); cpl_vector * vec; double xmax = 0.0; /* Maximum rounding error on x */ double ymax = 0.0; /* Maximum rounding error on y */ double eps; double x, y; const cpl_size zerodeg2[] = {0, 0}; cpl_size i, j, k; cpl_error_code error; /* Try to fit increasing degrees to f(x,y) = sqrt(x)*log(1+y) - with exactly as many points as there are coefficient to determine thus the residual should be exactly zero. */ xpoint = cpl_vector_new(2); /* f(1/4,sqrt(e)-1) = 1/4 */ cpl_vector_set(xpoint, 0, 0.25+xy_offset); cpl_vector_set(xpoint, 1, sqrt(CPL_MATH_E)-1+xy_offset); for (degree = 0; degree < POLY_SIZE; degree++) { const cpl_size maxdeg[2] = {degree, degree}; const cpl_size nc = dimdeg ? (degree+1)*(degree+1) : (degree+1)*(degree+2)/2; k = 0; vec = cpl_vector_new(nc); xy_pos = cpl_matrix_new(2, nc); for (i=0; i < 1 + degree; i++) { for (j=0; j < 1 + (dimdeg ? degree : i); j++, k++) { cpl_test_zero( cpl_matrix_set(xy_pos, 0, k, (double)i+xy_offset) ); cpl_test_zero( cpl_matrix_set(xy_pos, 1, k, (double)j+xy_offset) ); cpl_test_zero( cpl_vector_set(vec, k, sqrt((double)i)* log((double)(j+1)))); } } cpl_test_eq( k, nc ); error = cpl_polynomial_fit_cmp(poly2, xy_pos, NULL, vec, NULL, dimdeg, zerodeg2, maxdeg); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_polynomial_get_dimension(poly2), 2 ); cpl_test_eq( cpl_polynomial_get_degree(poly2), dimdeg ? 2 * degree : degree ); cpl_polynomial_dump(poly2, stream); eps = cpl_vector_get_mse(vec, poly2, xy_pos, NULL); /* The increase in mse must be bound */ if (xmax > 0) cpl_test_leq( eps/xmax, 5.39953e+09); cpl_vector_delete(vec); cpl_matrix_delete(xy_pos); cpl_msg_info(cpl_func,"2D-Polynomial with degree %" CPL_SIZE_FORMAT " (dimdeg=%d) fit of a %" CPL_SIZE_FORMAT "-point " "dataset has a mean square error ratio to a %" CPL_SIZE_FORMAT "-degree fit: %g (%g > %g)", degree, dimdeg, nc, degree-1, xmax > 0.0 ? eps/xmax : 0.0, eps, xmax); xmax = eps; eps = cpl_polynomial_eval(poly2, xpoint); if (nc < (dimdeg ? 25 : 40)) cpl_test_abs( eps, 0.25, fabs(0.25 - ymax)); if (fabs(0.25-eps) >= fabs(0.25 - ymax) && degree > 0) { /* Should be able to fit at least a 5-degree polynomial with increased accuracy - and without error-margin */ cpl_msg_info(cpl_func,"2D-Polynomial with degree %" CPL_SIZE_FORMAT " fit of a %" CPL_SIZE_FORMAT "-point dataset has a " "greater residual than a %" CPL_SIZE_FORMAT "-degree " "fit to a %" CPL_SIZE_FORMAT "-point dataset: " "fabs(%g) > fabs(%g)", degree, nc, degree-1, degree*(degree+1)/2, eps-0.25, ymax-0.25); break; } ymax = eps; } /* Try to fit increasing degrees to f(x,y) = sqrt(x)*log(1+y) - with a constant, overdetermined number of points - The residual should decrease with increasing degree until the system becomes near singular */ /* f(1/4,sqrt(e)-1) = 1/4 */ cpl_vector_set(xpoint, 0, 0.25+xy_offset); cpl_vector_set(xpoint, 1, sqrt(CPL_MATH_E)-1-xy_offset); k = 0; vec = cpl_vector_new( 2 * POLY_SIZE * 2 * POLY_SIZE); xy_pos = cpl_matrix_new(2, 2 * POLY_SIZE * 2 * POLY_SIZE); for (i=0, k = 0; i < 2 * POLY_SIZE; i++) { for (j=0; j < 2 * POLY_SIZE; j++, k++) { x = (double) i * 0.5; y = (double) j * 2.0; cpl_test_zero( cpl_matrix_set(xy_pos, 0, k, (double)i+xy_offset) ); cpl_test_zero( cpl_matrix_set(xy_pos, 1, k, (double)j-xy_offset) ); cpl_test_zero( cpl_vector_set(vec, k, sqrt(x)*log(y+1.0))); } } cpl_test_eq( 2 * POLY_SIZE * 2 * POLY_SIZE, k ); ymax = 0; for (degree = 0; degree < POLY_SIZE; degree++) { const cpl_size maxdeg[2] = {degree, degree}; const cpl_size nc = 2 * POLY_SIZE * 2 * POLY_SIZE; double mse; error = cpl_polynomial_fit_cmp(poly2, xy_pos, NULL, vec, NULL, dimdeg, zerodeg2, maxdeg); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_polynomial_get_dimension(poly2), 2 ); cpl_test_eq( cpl_polynomial_get_degree(poly2), dimdeg ? 2 * degree : degree ); cpl_polynomial_dump(poly2, stream); mse = cpl_vector_get_mse(vec, poly2, xy_pos, NULL); eps = cpl_polynomial_eval(poly2, xpoint); cpl_msg_info(cpl_func, "2D-Polynomial with degree %" CPL_SIZE_FORMAT " fit of a %" CPL_SIZE_FORMAT "-point dataset " "has a mean square error: %g (P0-error=%g)", degree, nc, mse, 0.25-eps); /* mse must decrease */ if (degree > 0) { if (fabs(eps-0.25) > fabs(ymax - 0.25)) cpl_msg_info(cpl_func, "2D-Polynomial with degree %" CPL_SIZE_FORMAT " fit of a %" CPL_SIZE_FORMAT "-point dataset has a larger error than a %" CPL_SIZE_FORMAT "-degree fit: fabs(%g-0.25) > " "fabs(%g-0.25)", degree, nc, degree - 1, eps, ymax); if (mse > xmax) { cpl_msg_info(cpl_func, "2D-Polynomial with degree %" CPL_SIZE_FORMAT " fit of a %" CPL_SIZE_FORMAT "-point dataset has a larger mean square error " "than a %" CPL_SIZE_FORMAT "-degree fit: %g > %g", degree, nc, degree - 1, mse, xmax); break; } } xmax = mse; ymax = eps; cpl_test_zero(cpl_polynomial_copy(poly1, poly2)); } cpl_vector_delete(vec); cpl_matrix_delete(xy_pos); cpl_vector_delete(xpoint); cpl_polynomial_delete(poly2); return poly1; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test cpl_polynomial_fit() in 1D @param stream A stream to dump to @return void */ /*----------------------------------------------------------------------------*/ static void cpl_polynomial_fit_test_1d(FILE * stream) { const double dvec6[] = {1, 3, 5, 2, 4, 6}; const double dtay6[] = {0, 2*4, 2*20, 2*1, 2*10, 2*35}; const double dvec4[] = {1, 3, 4, 6}; const double dtay4[] = {0, 2*4, 2*10, 2*35}; const double dsq6[] = {1, 9, 25, 4, 16, 36}; cpl_matrix * samppos1 = cpl_matrix_wrap(1, 6, (double*)dvec6); cpl_vector * taylor = cpl_vector_wrap(6, (double*)dtay6); cpl_matrix * samppos14 = cpl_matrix_wrap(1, 4, (double*)dvec4); cpl_vector * taylor4 = cpl_vector_wrap(4, (double*)dtay4); cpl_matrix * samppos; cpl_vector * fitvals; cpl_polynomial * poly1a = cpl_polynomial_new(1); cpl_polynomial * poly1b = cpl_polynomial_new(1); cpl_polynomial * poly2 = cpl_polynomial_new(2); const cpl_boolean symsamp = CPL_TRUE; const cpl_size zerodeg = 0; const cpl_size sqdeg = 2; const cpl_size maxdeg = 3; cpl_size mindeg, errdeg; double eps, rechisq; double xmax; /* Maximum rounding error on x */ double ymax; /* Maximum rounding error on y */ double zmax; cpl_error_code error; cpl_size i, j; /* Test 1: NULL input */ error = cpl_polynomial_fit_cmp(NULL, NULL, NULL, NULL, NULL, CPL_FALSE, NULL, NULL); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_polynomial_fit_cmp(NULL, samppos1, NULL, taylor, NULL, CPL_FALSE, NULL, &maxdeg); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_polynomial_fit_cmp(poly1a, NULL, NULL, taylor, NULL, CPL_FALSE, NULL, &maxdeg); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_polynomial_fit_cmp(poly1a, samppos1, NULL, NULL, NULL, CPL_FALSE, NULL, &maxdeg); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_polynomial_fit_cmp(poly1a, samppos1, NULL, taylor, NULL, CPL_FALSE, NULL, NULL); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); /* Test 1a: negative maxdeg */ errdeg = -1; error = cpl_polynomial_fit_cmp(poly1a, samppos1, NULL, taylor, NULL, CPL_FALSE, NULL, &errdeg); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Test 1b: maxdeg less than mindeg*/ errdeg = 0; error = cpl_polynomial_fit_cmp(poly1a, samppos1, NULL, taylor, NULL, CPL_FALSE, &maxdeg, &errdeg); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Test 1c: Wrong dimension of poly */ error = cpl_polynomial_fit_cmp(poly2, samppos1, NULL, taylor, NULL, CPL_FALSE, NULL, &maxdeg); cpl_test_eq_error(error, CPL_ERROR_INCOMPATIBLE_INPUT); /* Test 2: Unordered insertion */ error = cpl_polynomial_fit_cmp(poly1a, samppos1, NULL, taylor, NULL, CPL_FALSE, &zerodeg, &maxdeg); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_fit_cmp(poly1a, samppos1, NULL, taylor, NULL, CPL_FALSE, &zerodeg, &maxdeg); cpl_test_eq_error(error, CPL_ERROR_NONE); eps = cpl_vector_get_mse(taylor, poly1a, samppos1, &rechisq); cpl_test_leq(0.0, rechisq); cpl_test_abs( eps, 0.0, 4359*DBL_EPSILON*DBL_EPSILON); /* alphaev56 */ /* Test 3: Symmetric 1D sampling (also test dimdeg and reset of preset 1D-coeffs) */ errdeg = maxdeg + 1; cpl_test_zero( cpl_polynomial_set_coeff(poly1b, &errdeg, 1.0) ); error = cpl_polynomial_fit_cmp(poly1b, samppos1, &symsamp, taylor, NULL, CPL_TRUE, &zerodeg, &maxdeg); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_polynomial_abs(poly1a, poly1b, DBL_EPSILON); cpl_test_abs( cpl_vector_get_mse(taylor, poly1b, samppos1, NULL), 0.0, fabs(eps)); /* Test 3A: Same, except mindeg set to 1 */ mindeg = 1; cpl_test_zero( cpl_polynomial_set_coeff(poly1b, &errdeg, 1.0) ); error = cpl_polynomial_fit_cmp(poly1b, samppos1, &symsamp, taylor, NULL, CPL_TRUE, &mindeg, &maxdeg); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_polynomial_get_degree(poly1b), maxdeg); cpl_test_abs(cpl_polynomial_get_coeff(poly1b, &zerodeg), 0.0, 0.0); cpl_test_zero( cpl_polynomial_set_coeff(poly1a, &zerodeg, 0.0) ); cpl_test_polynomial_abs(poly1a, poly1b, 700.0 * DBL_EPSILON); cpl_test_abs( cpl_vector_get_mse(taylor, poly1b, samppos1, NULL), 0.0, 70.0 * fabs(eps)); /* Test 3B: Symmetric, non-equidistant 1D sampling (also test dimdeg and reset of preset 1D-coeffs) */ error = cpl_polynomial_fit_cmp(poly1a, samppos14, NULL, taylor4, NULL, CPL_TRUE, &zerodeg, &maxdeg); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_polynomial_fit_cmp(poly1b, samppos14, &symsamp, taylor4, NULL, CPL_TRUE, &zerodeg, &maxdeg); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_polynomial_abs(poly1a, poly1b, DBL_EPSILON); /* Test 3C: Same except mindeg set to 1 */ error = cpl_polynomial_fit_cmp(poly1b, samppos14, &symsamp, taylor4, NULL, CPL_TRUE, &mindeg, &maxdeg); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_polynomial_get_degree(poly1b), maxdeg); cpl_test_abs(cpl_polynomial_get_coeff(poly1b, &zerodeg), 0.0, 0.0); cpl_test_zero( cpl_polynomial_set_coeff(poly1a, &zerodeg, 0.0) ); cpl_test_polynomial_abs(poly1a, poly1b, 600.0 * DBL_EPSILON); /* Not overdetermined, so must pass NULL for rechisq */ eps = cpl_vector_get_mse(taylor4, poly1a, samppos14, NULL); cpl_test_error(CPL_ERROR_NONE); cpl_test_abs( cpl_vector_get_mse(taylor4, poly1b, samppos14, NULL), 0.0, 283.0 * fabs(eps)); /* Test 4: Only one distinct sampling point */ samppos = cpl_matrix_new(1, 6); cpl_test_zero(cpl_matrix_fill(samppos, 1.0)); /* - should not be able to fit with only one distinct x-value */ error = cpl_polynomial_fit_cmp(poly1a, samppos, &symsamp, taylor, NULL, CPL_TRUE, &zerodeg, &maxdeg); cpl_test_eq_error(error, CPL_ERROR_SINGULAR_MATRIX); /* Test 4B: - unless the degree is 0 */ error = cpl_polynomial_fit_cmp(poly1a, samppos, &symsamp, taylor, NULL, CPL_TRUE, &zerodeg, &zerodeg); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_polynomial_get_degree(poly1a)); cpl_test_abs( cpl_polynomial_get_coeff(poly1a, &zerodeg), cpl_vector_get_mean(taylor), DBL_EPSILON); /* Test 4B: - or unless mindeg equals the degree */ for (i = 1; i < POLY_SIZE; i++) { error = cpl_polynomial_fit_cmp(poly1a, samppos, &symsamp, taylor, NULL, CPL_TRUE, &i, &i); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_polynomial_get_degree(poly1a), i); /* FIXME: Weak test, sampling positions are all at 1.0 */ /* Another test should be added */ cpl_test_abs( cpl_polynomial_get_coeff(poly1a, &i), cpl_vector_get_mean(taylor), 16.0 * DBL_EPSILON); error = cpl_polynomial_set_coeff(poly1a, &i, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_polynomial_get_degree(poly1a)); } /* Test 5: Try to fit j-coefficients to a sqrt() sampled j times at 0,1,...,j-1 - since sqrt(0) == 0, the constant coefficient of the fit should be zero */ fitvals = cpl_vector_new(1); xmax = 0.0; ymax = -DBL_EPSILON; zmax = 0.0; for (j=1; j <= POLY_SIZE; j++) { const cpl_size degree = j - 1; cpl_test_zero( cpl_matrix_set_size(samppos, 1, j) ); cpl_test_zero( cpl_vector_set_size(fitvals, j) ); for (i=0; i < j; i++) { cpl_test_zero( cpl_matrix_set(samppos, 0, i, (double)i) ); cpl_test_zero( cpl_vector_set(fitvals, i, sqrt((double)i)) ); } error = cpl_polynomial_fit_cmp(poly1a, samppos, &symsamp, fitvals, NULL, CPL_TRUE, &zerodeg, °ree); if (error == CPL_ERROR_SINGULAR_MATRIX) { cpl_msg_info("FIXME","1D-Polynomial fit of a %" CPL_SIZE_FORMAT "-point dataset with degree %" CPL_SIZE_FORMAT " leads to a (near) singular system of equations", j, degree); cpl_test_eq_error(error, CPL_ERROR_SINGULAR_MATRIX); break; } cpl_test_eq_error( error, CPL_ERROR_NONE ); cpl_test_eq( cpl_polynomial_get_dimension(poly1a), 1 ); cpl_test_eq( cpl_polynomial_get_degree(poly1a), degree ); cpl_polynomial_dump(poly1a, stream); eps = cpl_vector_get_mse(fitvals, poly1a, samppos, NULL); /* The increase in mse must be bound (i686 can manage with a bound of 957 instead of 9016) */ if (xmax > 0) cpl_test_leq( eps/xmax, 9016); xmax = eps; eps = cpl_polynomial_get_coeff(poly1a, &zerodeg); if (fabs(eps) > fabs(zmax)) { cpl_msg_info(cpl_func,"1D-Polynomial with degree %" CPL_SIZE_FORMAT " fit of a %" CPL_SIZE_FORMAT "-point dataset has a " "greater error on P0 than a %" CPL_SIZE_FORMAT "-degree fit to a %" CPL_SIZE_FORMAT "-point dataset: " "fabs(%g) > fabs(%g)", degree, j, degree-1, j-1, eps, zmax); } /* Should loose at most one decimal digit per degree fabs(eps) < DBL_EPSILON * 10 ** (degree-2) */ cpl_test_abs( eps, 0.0, DBL_EPSILON * pow(10, (double)(j-3)) ); zmax = eps; /* Compute approximation to sqrt(0.25) - this will systematically be too low, but less and less so with increasing degree - until the approximation goes bad */ eps = cpl_polynomial_eval_1d(poly1a, 0.25, NULL); if (j < 18) cpl_test_abs( eps, 0.5, fabs(0.5 - ymax)); if (eps <= ymax) { /* Should be able to fit at least an 18-degree polynomial with increased accuracy - and without error-margin */ cpl_msg_info(cpl_func, "1D-Polynomial with degree %" CPL_SIZE_FORMAT " fit of a %" CPL_SIZE_FORMAT "-point " "dataset has a greater residual than a %" CPL_SIZE_FORMAT "-degree fit to a %" CPL_SIZE_FORMAT "-point dataset: %g > %g", degree, j, degree-1, j-1, 0.5-eps, 0.5-ymax); break; } ymax = eps; } /* And the mse itself must be bound */ cpl_test_leq( eps, 0.411456 * cpl_error_margin); /* Test 6: Try to fit increasing degrees to a sqrt() */ cpl_test_zero( cpl_matrix_set_size(samppos, 1, VECTOR_SIZE) ); cpl_test_zero( cpl_vector_set_size(fitvals, VECTOR_SIZE) ); for (i=0; i < VECTOR_SIZE; i++) { cpl_test_zero( cpl_matrix_set(samppos, 0, i, (double)i + 1e4) ); cpl_test_zero( cpl_vector_set(fitvals, i, sqrt((double)i)) ); } eps = FLT_MAX; for (i = 0; i < VECTOR_SIZE-1; i++) { xmax = eps; error = cpl_polynomial_fit_cmp(poly1a, samppos, &symsamp, fitvals, NULL, CPL_TRUE, &zerodeg, &i); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_polynomial_get_dimension(poly1a), 1 ); cpl_test_eq( cpl_polynomial_get_degree(poly1a), i ); eps = cpl_vector_get_mse(fitvals, poly1a, samppos, NULL); if (eps > xmax) { /* Should be able to fit at least a 8-degree polynomial with no degradation - and without error-margin (i686 can manage one degree more) */ if (i < 9) cpl_test_leq( eps, xmax); cpl_msg_info(cpl_func, "1D-Polynomial with degree %" CPL_SIZE_FORMAT " fit of a %d-point " "dataset has a higher mean square error than a %" CPL_SIZE_FORMAT "-degree fit: %g > %g", i, VECTOR_SIZE, i-1, eps, xmax); break; } } /* Test 7A: Fit a 2nd degree polynomial to a parabola, using mindeg */ cpl_vector_delete(fitvals); fitvals = cpl_vector_wrap(6, (double*)dsq6); /* Not modified */ mindeg = 1; error = cpl_polynomial_fit_cmp(poly1a, samppos1, NULL, fitvals, NULL, CPL_TRUE, &mindeg, &sqdeg); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_polynomial_get_dimension(poly1a), 1 ); cpl_test_eq( cpl_polynomial_get_degree(poly1a), sqdeg ); cpl_test_abs( cpl_polynomial_get_coeff(poly1a, &zerodeg), 0.0, DBL_EPSILON); cpl_test_abs( cpl_polynomial_get_coeff(poly1a, &mindeg), 0.0, 6.0 * DBL_EPSILON); cpl_test_abs( cpl_polynomial_get_coeff(poly1a, &sqdeg), 1.0, DBL_EPSILON); /* Test 7A: Fit a 2nd degree polynomial to a parabola, using mindeg */ error = cpl_polynomial_fit_cmp(poly1a, samppos1, NULL, fitvals, NULL, CPL_TRUE, &sqdeg, &sqdeg); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( cpl_polynomial_get_dimension(poly1a), 1 ); cpl_test_eq( cpl_polynomial_get_degree(poly1a), sqdeg ); cpl_test_abs( cpl_polynomial_get_coeff(poly1a, &zerodeg), 0.0, DBL_EPSILON); cpl_test_abs( cpl_polynomial_get_coeff(poly1a, &mindeg), 0.0, DBL_EPSILON); cpl_test_abs( cpl_polynomial_get_coeff(poly1a, &sqdeg), 1.0, DBL_EPSILON); cpl_polynomial_delete(poly1a); cpl_polynomial_delete(poly1b); cpl_polynomial_delete(poly2); (void)cpl_matrix_unwrap(samppos1); (void)cpl_vector_unwrap(taylor); (void)cpl_matrix_unwrap(samppos14); (void)cpl_vector_unwrap(taylor4); cpl_matrix_delete(samppos); cpl_vector_unwrap(fitvals); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Benchmark the CPL function @param nr The number of repeats @param nc The number of coefficients @param nd The max degree @return void */ /*----------------------------------------------------------------------------*/ static void cpl_polynomial_fit_bench_2d(cpl_size nr, cpl_size nc, cpl_size nd) { cpl_polynomial * poly2 = cpl_polynomial_new(2); cpl_vector * vec = cpl_vector_new(nc * nc); cpl_matrix * xy_pos = cpl_matrix_new(2, nc * nc); cpl_flops flops = 0; double secs = 0.0; double xmax = DBL_MAX; /* This valuie should not be read */ cpl_size i, j, k, degree = 0; cpl_error_code error = CPL_ERROR_NONE; for (i=0, k = 0; i < nc; i++) { for (j=0; j < nc; j++, k++) { const double x = (double) i * 0.5; const double y = (double) j * 2.0; error = cpl_matrix_set(xy_pos, 0, k, (double)i); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_matrix_set(xy_pos, 1, k, (double)j); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_set(vec, k, sqrt(x)*log(y+1.0)); cpl_test_eq_error(error, CPL_ERROR_NONE); } } cpl_test_eq( k, nc * nc ); for (i = 0; i < nr; i++) { for (degree = 0; degree < nd; degree++) { double mse; const cpl_flops flops0 = cpl_tools_get_flops(); const double secs0 = cpl_test_get_cputime(); error = cpl_polynomial_fit_cmp(poly2, xy_pos, NULL, vec, NULL, CPL_FALSE, NULL, °ree); secs += cpl_test_get_cputime() - secs0; flops += cpl_tools_get_flops() - flops0; cpl_test_eq_error(error, CPL_ERROR_NONE); if (error) break; mse = cpl_vector_get_mse(vec, poly2, xy_pos, NULL); if (degree > 0 && mse > xmax) break; xmax = mse; } if (error) break; } cpl_vector_delete(vec); cpl_matrix_delete(xy_pos); cpl_polynomial_delete(poly2); cpl_msg_info("","Speed while fitting %" CPL_SIZE_FORMAT " 2D-points with " "up to degree %" CPL_SIZE_FORMAT " in %g secs [Mflop/s]: %g", nc*nc, degree, secs, (double)flops/secs/1e6); } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the mean squared error from a vector of residuals @param fitvals The fitted values @param fit The fitted polynomial @param samppos The sampling points @param prechisq If non-NULL, the reduced chi square @return the mse, or negative on NULL input */ /*----------------------------------------------------------------------------*/ static double cpl_vector_get_mse(const cpl_vector * fitvals, const cpl_polynomial * fit, const cpl_matrix * samppos, double * prechisq) { const cpl_size np = cpl_vector_get_size(fitvals); cpl_vector * residual; double mse; cpl_flops flops = 0; double secs = 0.0; cpl_ensure(fitvals != NULL, CPL_ERROR_NULL_INPUT, -1.0); cpl_ensure(fit != NULL, CPL_ERROR_NULL_INPUT, -2.0); cpl_ensure(samppos != NULL, CPL_ERROR_NULL_INPUT, -3.0); residual = cpl_vector_new(1+np/2); /* Just to test the resizing... */ flops = cpl_tools_get_flops(); secs = cpl_test_get_cputime(); cpl_vector_fill_polynomial_fit_residual(residual, fitvals, NULL, fit, samppos, prechisq); mse_secs += cpl_test_get_cputime() - secs; mse_flops += cpl_tools_get_flops() - flops; mse = cpl_vector_product(residual, residual) / (double)np; cpl_vector_delete(residual); return mse; } /*----------------------------------------------------------------------------*/ /** @internal @brief Fit and compare to a higher dimension fit with a zero-degree @param self Polynomial of dimension d to hold the coefficients @param samppos Matrix of p sample positions, with d rows and p columns @param sampsym NULL, or d booleans, true iff the sampling is symmetric @param fitvals Vector of the p values to fit @param fitsigm Uncertainties of the sampled values, or NULL for all ones @param dimdeg True iff there is a fitting degree per dimension @param mindeg Pointer to 1 or d minimum fitting degree(s), or NULL @param maxdeg Pointer to 1 or d maximum fitting degree(s), at least mindeg @return CPL_ERROR_NONE on success, else the relevant #_cpl_error_code_ @see cpl_polynomial_fit() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_fit_cmp(cpl_polynomial * self, const cpl_matrix * samppos, const cpl_boolean * sampsym, const cpl_vector * fitvals, const cpl_vector * fitsigm, cpl_boolean dimdeg, const cpl_size * mindeg, const cpl_size * maxdeg) { const cpl_error_code error = cpl_polynomial_fit(self, samppos, sampsym, fitvals, fitsigm, dimdeg, mindeg, maxdeg); cpl_test_error(error); if (self != NULL) { const cpl_size mdim = cpl_polynomial_get_dimension(self); const cpl_size ndim = 1 + mdim; cpl_polynomial * self1p = cpl_polynomial_new(ndim); cpl_size idim; /* This is quaranteed to fail */ const cpl_error_code error1e = cpl_polynomial_fit(self1p, samppos, sampsym, fitvals, fitsigm, dimdeg, mindeg, maxdeg); cpl_test_error(error1e); cpl_test(error1e == error || error1e == CPL_ERROR_INCOMPATIBLE_INPUT); if (samppos != NULL && (mdim == 1 || dimdeg == CPL_TRUE)) { cpl_polynomial * zeropol = cpl_polynomial_new(mdim); const cpl_size np = cpl_matrix_get_ncol(samppos); const cpl_size nc = cpl_matrix_get_nrow(samppos); cpl_matrix * samppos1p = cpl_matrix_new(1 + nc, np); cpl_boolean * sampsym1p = sampsym ? (cpl_boolean *)cpl_malloc((size_t)ndim * sizeof(*sampsym1p)) : NULL; cpl_size * mindeg1p = mindeg ? (cpl_size*)cpl_malloc((size_t)ndim * sizeof(*mindeg1p)) : NULL; cpl_size * maxdeg1p = maxdeg ? (cpl_size*)cpl_malloc((size_t)ndim * sizeof(*maxdeg1p)) : NULL; cpl_error_code error1p; for (idim = 0; idim < ndim; idim++) { cpl_size i, j; /* First copy all rows to new matrix, leaving one with zeros */ for (j = 0; j < idim; j++) { if (j <= nc) { for (i = 0; i < np; i++) { cpl_matrix_set(samppos1p, j, i, cpl_matrix_get(samppos, j, i)); } } if (sampsym1p != NULL) sampsym1p[j] = sampsym[j]; if (mindeg1p != NULL) mindeg1p [j] = mindeg [j]; if (maxdeg1p != NULL) maxdeg1p [j] = maxdeg [j]; } if (j <= nc) { for (i = 0; i < np; i++) { cpl_matrix_set(samppos1p, j, i, 0.0); } } if (sampsym1p != NULL) sampsym1p[j] = CPL_TRUE; if (mindeg1p != NULL) mindeg1p [j] = 0; if (maxdeg1p != NULL) maxdeg1p [j] = 0; for (j++; j < ndim; j++) { if (j <= nc) { for (i = 0; i < np; i++) { cpl_matrix_set(samppos1p, j, i, cpl_matrix_get(samppos, j-1, i)); } } if (sampsym1p != NULL) sampsym1p[j] = sampsym[j-1]; if (mindeg1p != NULL) mindeg1p [j] = mindeg [j-1]; if (maxdeg1p != NULL) maxdeg1p [j] = maxdeg [j-1]; } error1p = cpl_polynomial_fit(self1p, samppos1p, sampsym1p, fitvals, fitsigm, CPL_TRUE, mindeg1p, maxdeg1p); if (ndim != 2) { cpl_test_eq_error(error1p, CPL_ERROR_UNSUPPORTED_MODE); } else if (mindeg != NULL && mindeg[0] > 0) { cpl_test_eq_error(error1p, CPL_ERROR_UNSUPPORTED_MODE); } else { const cpl_size degree = cpl_polynomial_get_degree(self); if (!error && error1p == CPL_ERROR_SINGULAR_MATRIX && 1 + degree == np && np >= 20) { cpl_test_eq_error(error1p, CPL_ERROR_SINGULAR_MATRIX); /* In the non-overdetermined case, the multi-variate fit is not as accurate as the uni-variate, for degree 20 the difference is a failure */ cpl_msg_debug(cpl_func, "2D-fail(%d:%" CPL_SIZE_FORMAT ":%" CPL_SIZE_FORMAT ":%" CPL_SIZE_FORMAT "): S: %" CPL_SIZE_FORMAT "x %" CPL_SIZE_FORMAT, error, idim, maxdeg1p[0], maxdeg1p[1], 1 + nc, np); if (cpl_msg_get_level() <= CPL_MSG_DEBUG) cpl_matrix_dump(samppos1p, stdout); } else if (!error1p && !error) { const cpl_size i0 = 0; const double k0 = cpl_polynomial_get_coeff(self, &i0); cpl_polynomial * self0p = cpl_polynomial_extract(self1p, idim, zeropol); /* FIXME: Need relative polynomial comparison */ cpl_test_polynomial_abs(self, self0p, CX_MAX(fabs(k0),1) * pow(10.0, (double)degree) * DBL_EPSILON); cpl_polynomial_delete(self0p); } else { cpl_test_eq_error(error1p, error); } } } cpl_matrix_delete(samppos1p); cpl_polynomial_delete(zeropol); cpl_free(sampsym1p); cpl_free(mindeg1p); cpl_free(maxdeg1p); } cpl_polynomial_delete(self1p); } return cpl_error_set_(error); /* Tested and reset by caller */ } cpl-6.4.1/cplcore/tests/cpl_image_gen-test.c0000644000460300003120000000770711466733006015716 00000000000000/* $Id: cpl_image_gen-test.c,v 1.17 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.17 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_memory.h" #include "cpl_image_gen.h" #include "cpl_image_io.h" #include "cpl_test.h" /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ #define IMAGESZ 512 /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_image * img; double cputime; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ /* Test cpl_image_fill_noise_uniform() for double image */ img = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE) ; cputime = cpl_test_get_cputime(); cpl_test_zero(cpl_image_fill_noise_uniform(img, -100, 100)); cpl_msg_info("","Time to generate DOUBLE noise %dx%d image: %g", IMAGESZ, IMAGESZ, cputime - cpl_test_get_cputime()); cpl_image_delete(img); /* Test cpl_image_fill_noise_uniform() for float image */ img = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_FLOAT) ; cputime = cpl_test_get_cputime(); cpl_test_zero(cpl_image_fill_noise_uniform(img, -100, 100)); cpl_msg_info("","Time to generate FLOAT noise %dx%d image: %g", IMAGESZ, IMAGESZ, cputime - cpl_test_get_cputime()); cpl_image_delete(img) ; /* Test cpl_image_fill_gaussian() for double image */ img = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE) ; cputime = cpl_test_get_cputime(); cpl_test_zero(cpl_image_fill_gaussian(img, IMAGESZ/4, IMAGESZ/4, 1.0, 100, 100)); cpl_msg_info("","Time to generate DOUBLE gaussian %dx%d image: %g", IMAGESZ/4, IMAGESZ/4, cputime - cpl_test_get_cputime()) ; cpl_image_delete(img) ; /* Test cpl_image_fill_gaussian() for float image */ img = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_FLOAT) ; cputime = cpl_test_get_cputime(); cpl_test_zero(cpl_image_fill_gaussian(img, 3*IMAGESZ/4, 3*IMAGESZ/4, 1.0, 100, 100)); cpl_msg_info("","Time to generate FLOAT gaussian %dx%d image: %g", 3*IMAGESZ/4, 3*IMAGESZ/4, cputime - cpl_test_get_cputime()) ; cpl_image_delete(img) ; /* Test cpl_image_fill_test_create() */ cputime = cpl_test_get_cputime(); img = cpl_image_fill_test_create(IMAGESZ, IMAGESZ); cpl_test_nonnull(img); cpl_msg_info("","Time to generate the standard %dx%d test image: %g", IMAGESZ, IMAGESZ, cputime - cpl_test_get_cputime()) ; cpl_image_delete(img) ; return cpl_test_end(0); } cpl-6.4.1/cplcore/tests/cpl_test-test.c0000644000460300003120000004531112130474010014735 00000000000000/* $Id: cpl_test-test.c,v 1.35 2013-04-08 07:55:52 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-08 07:55:52 $ * $Revision: 1.35 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include #ifdef HAVE_UNISTD_H /* Used for sleep() */ #include #endif /* Needed for cpl_test_abs_complex() */ #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef IMAGESZ #define IMAGESZ 100 #endif #define CPL_TEST_FITS_NAME "cpl_test-test.fits" #define B2880 \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" \ /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { int nxfail = 0; /* The number of expected failures */ cpl_msg_severity level; cpl_vector * vec1; cpl_vector * vec2; cpl_matrix * mat1; cpl_matrix * mat2; cpl_array * arr1i; cpl_array * arr2i; cpl_array * arr1f; cpl_array * arr2f; cpl_array * arr1d; cpl_array * arr2d; cpl_array * arr1s; cpl_array * arr2s; cpl_image * img1; cpl_image * img2; cpl_image * img3; cpl_imagelist * imglist1; cpl_imagelist * imglist2; cpl_polynomial * poly1; cpl_polynomial * poly2; cpl_mask * mask1; cpl_mask * mask2; cpl_errorstate cleanstate; cpl_errorstate errstate; cpl_error_code error; double wallstart, cpustart; double wallstop, cpustop; cpl_size tested, failed; FILE * fp; const unsigned int tsleep = 1; unsigned int tleft; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); wallstart = cpl_test_get_walltime(); cpustart = cpl_test_get_cputime(); tested = cpl_test_get_tested(); failed = cpl_test_get_failed(); cpl_test_zero(tested); cpl_test_zero(failed); tested = cpl_test_get_tested(); failed = cpl_test_get_failed(); cpl_test_eq(tested, 2); cpl_test_zero(failed); cpl_test(41); cpl_test_zero(0); cpl_test_null(NULL); cpl_test_nonnull(cpl_func); cpl_test_eq_ptr(NULL, NULL); cpl_test_eq_ptr(cpl_func, cpl_func); cpl_test_noneq_ptr(NULL, cpl_func); cpl_test_noneq_ptr(cpl_func, NULL); cpl_test_eq(1, 1); cleanstate = cpl_errorstate_get(); cpl_test_errorstate(cleanstate); (void)cpl_error_set(cpl_func, CPL_ERROR_EOL); errstate = cpl_errorstate_get(); cpl_test_errorstate(errstate); cpl_test_error(CPL_ERROR_EOL); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq_error(CPL_ERROR_NONE, CPL_ERROR_NONE); /* Set a CPL error */ (void)cpl_msg_set_log_name(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); /* Set a CPL error */ (void)cpl_msg_set_log_name(NULL); cpl_test_eq_error(CPL_ERROR_NULL_INPUT, cpl_error_get_code()); cpl_test_noneq(0, 1); cpl_test_eq_string("", ""); cpl_test_eq_string(cpl_func, cpl_func); cpl_test_noneq_string("", cpl_func); cpl_test_noneq_string("", cpl_func); cpl_test_abs(0.0, 0.0, 0.0); cpl_test_abs(0.0, 1.0, 1.0); cpl_test_abs(1.0, 0.0, 1.0); cpl_test_abs_complex(0.0, 0.0, 0.0); cpl_test_abs_complex(0.0, _Complex_I, 1.0); cpl_test_abs_complex(_Complex_I, 0.0, 1.0); cpl_test_rel(0.0, 0.0, 0.0); cpl_test_rel(1.0, 1.0, 0.0); cpl_test_rel(-1.0, -2.0, 1.0); cpl_test_rel(-2.0, -1.0, 1.0); cpl_test_leq(0.0, 0.0); cpl_test_lt(0.0, 1.0); vec1 = cpl_vector_new(IMAGESZ); error = cpl_vector_fill(vec1, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); vec2 = cpl_vector_duplicate(vec1); cpl_test_vector_abs(vec1, vec2, 0.0); error = cpl_vector_add_scalar(vec1, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_vector_abs(vec1, vec2, 1.0 + FLT_EPSILON); /* Round-off */ cpl_test_eq(cpl_test_get_bytes_vector(vec1), cpl_test_get_bytes_vector(vec2)); mat1 = cpl_matrix_new(IMAGESZ, IMAGESZ); error = cpl_matrix_fill(mat1, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); mat2 = cpl_matrix_duplicate(mat1); cpl_test_matrix_abs(mat1, mat2, 0.0); error = cpl_matrix_add_scalar(mat1, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_matrix_abs(mat1, mat2, 1.0 + FLT_EPSILON); /* Round-off */ arr1i = cpl_array_new(IMAGESZ, CPL_TYPE_INT); error = cpl_array_fill_window(arr1i, 0, IMAGESZ, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); arr2i = cpl_array_duplicate(arr1i); cpl_test_array_abs(arr1i, arr2i, 0.0); error = cpl_array_add_scalar(arr1i, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_array_abs(arr1i, arr2i, 1.0 + FLT_EPSILON); /* Round-off */ arr1f = cpl_array_new(IMAGESZ, CPL_TYPE_FLOAT); error = cpl_array_fill_window(arr1f, 0, IMAGESZ, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); arr2f = cpl_array_duplicate(arr1f); cpl_test_array_abs(arr1f, arr2f, 0.0); error = cpl_array_add_scalar(arr1f, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_array_abs(arr1f, arr2f, 1.0 + FLT_EPSILON); /* Round-off */ arr1d = cpl_array_new(IMAGESZ, CPL_TYPE_DOUBLE); error = cpl_array_fill_window(arr1d, 0, IMAGESZ, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); arr2d = cpl_array_duplicate(arr1d); cpl_test_array_abs(arr1d, arr2d, 0.0); error = cpl_array_add_scalar(arr1d, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_array_abs(arr1d, arr2d, 1.0 + FLT_EPSILON); /* Round-off */ /* Arrays with different types */ cpl_test_array_abs(arr1d, arr2f, 1.0 + FLT_EPSILON); /* Round-off */ cpl_test_array_abs(arr1d, arr2i, 1.0 + FLT_EPSILON); /* Round-off */ cpl_test_array_abs(arr1f, arr2i, 1.0 + FLT_EPSILON); /* Round-off */ arr1s = cpl_array_new(IMAGESZ, CPL_TYPE_STRING); cpl_test_nonnull(arr1s); arr2s = cpl_array_new(IMAGESZ, CPL_TYPE_STRING); cpl_test_nonnull(arr2s); /* FIXME: Add test for arrays of type string */ cpl_test_noneq_ptr(arr1s, arr2s); img1 = cpl_image_fill_test_create(IMAGESZ, IMAGESZ); img2 = cpl_image_duplicate(img1); cpl_test_image_abs(img1, img2, 0.0); cpl_test_image_rel(img1, img2, 0.0); error = cpl_image_multiply_scalar(img1, 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_rel(img1, img2, 1.0); error = cpl_image_multiply_scalar(img1, 0.5); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_add_scalar(img1, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(img1, img2, 1.0 + FLT_EPSILON); /* Round-off */ cpl_test_eq(cpl_test_get_bytes_image(img1), cpl_test_get_bytes_image(img2)); imglist1 = cpl_imagelist_new(); cpl_imagelist_set(imglist1, img1, 0); cpl_imagelist_set(imglist1, img2, 1); imglist2 = cpl_imagelist_duplicate(imglist1); error = cpl_imagelist_add_scalar(imglist2, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_imagelist_abs(imglist1, imglist2, 1.0 + FLT_EPSILON); cpl_test_eq(cpl_test_get_bytes_imagelist(imglist1), cpl_test_get_bytes_imagelist(imglist2)); poly1 = cpl_polynomial_new(2); poly2 = cpl_polynomial_duplicate(poly1); cpl_test_polynomial_abs(poly1, poly2, 0.0); mask1 = cpl_mask_new(IMAGESZ, IMAGESZ); mask2 = cpl_mask_new(IMAGESZ, IMAGESZ); error = cpl_mask_not(mask2); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq_mask(mask1, mask1); cpl_test_eq_mask(mask2, mask2); cpl_test_zero(cpl_test_get_bytes_vector(NULL)); cpl_test_zero(cpl_test_get_bytes_matrix(NULL)); cpl_test_zero(cpl_test_get_bytes_image(NULL)); cpl_test_zero(cpl_test_get_bytes_imagelist(NULL)); if (getenv(CPL_TEST_FITS)) { /* FIXME: Create real, valid FITS here ? */ } failed = cpl_test_get_failed(); cpl_test_zero(failed); /* Turn off messaging during testing of expected failures */ level = cpl_msg_get_level(); cpl_msg_set_level(CPL_MSG_OFF); cpl_test(0); nxfail++; cpl_test_zero(41); nxfail++; cpl_test_null(cpl_func); nxfail++; cpl_test_nonnull(NULL); nxfail++; cpl_test_eq_ptr(NULL, cpl_func); nxfail++; cpl_test_eq_ptr(cpl_func, NULL);nxfail++; cpl_test_noneq_ptr(NULL, NULL); nxfail++; cpl_test_noneq_ptr(cpl_func, cpl_func); nxfail++; cpl_test_errorstate(errstate); nxfail++; cpl_test_error(CPL_ERROR_EOL); nxfail++; cpl_test_eq_error(CPL_ERROR_NONE, CPL_ERROR_EOL); nxfail++; /* Set a CPL error */ (void)cpl_msg_set_log_name(NULL); cpl_test_errorstate(cleanstate); nxfail++; /* Set a CPL error */ (void)cpl_msg_set_log_name(NULL); cpl_test_error(CPL_ERROR_NONE); nxfail++; /* Set a CPL error */ (void)cpl_msg_set_log_name(NULL); cpl_test_eq_error(CPL_ERROR_NONE, cpl_error_get_code()); nxfail++; /* Set a CPL error */ (void)cpl_msg_set_log_name(NULL); cpl_test_eq_error(CPL_ERROR_EOL, CPL_ERROR_EOL); nxfail++; cpl_test_eq(0, 1); nxfail++; cpl_test_noneq(0, 0); nxfail++; cpl_test_eq_string("A", "B"); nxfail++; cpl_test_eq_string(NULL, ""); nxfail++; cpl_test_eq_string(NULL, NULL); nxfail++; cpl_test_noneq_string(cpl_func, cpl_func); nxfail++; cpl_test_noneq_string(cpl_func, NULL); nxfail++; cpl_test_noneq_string(NULL, cpl_func); nxfail++; cpl_test_noneq_string(NULL, NULL); nxfail++; cpl_test_abs(0.0, 0.0, -1.0); nxfail++; cpl_test_abs(0.0, 2.0, 1.0); nxfail++; cpl_test_abs(2.0, 0.0, 1.0); nxfail++; cpl_test_abs_complex(0.0, 0.0, -1.0); nxfail++; cpl_test_abs_complex(0.0, 2.0 * _Complex_I, 1.0); nxfail++; cpl_test_abs_complex(2.0 * _Complex_I, 0.0, 1.0); nxfail++; cpl_test_rel(0.0, 0.0, -1.0); nxfail++; cpl_test_rel(0.0, 1.0, 1.0); nxfail++; cpl_test_rel(1.0, 0.0, 1.0); nxfail++; cpl_test_rel(1.0, 3.0, 1.0); nxfail++; cpl_test_leq(1.0, 0.0); nxfail++; cpl_test_lt(0.0, 0.0); nxfail++; cpl_test_vector_abs(NULL, NULL, 1.0); nxfail++; cpl_test_vector_abs(vec1, vec2, 0.5); nxfail++; cpl_test_matrix_abs(mat1, mat2, 0.5); nxfail++; cpl_test_array_abs(NULL, NULL, 1.0); nxfail++; cpl_test_array_abs(arr1i, arr2i, 0.5); nxfail++; cpl_test_array_abs(arr1f, arr2f, 0.5); nxfail++; cpl_test_array_abs(arr1d, arr2d, 0.5); nxfail++; cpl_test_array_abs(arr1s, arr2s, 0.0); nxfail++; cpl_test_image_abs(img1, NULL, 1.0); nxfail++; cpl_test_image_abs(NULL, img2, 1.0); nxfail++; cpl_test_image_rel(img1, NULL, 1.0); nxfail++; cpl_test_image_rel(NULL, img2, 1.0); nxfail++; cpl_test_image_abs(img1, img2, 0.5); nxfail++; cpl_test_image_rel(img1, img1, -0.5); nxfail++; img3 = cpl_image_duplicate(img1); error = cpl_image_multiply_scalar(img1, 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_rel(img1, img3, 1.0 - FLT_EPSILON); nxfail++; error = cpl_image_multiply_scalar(img1, 0.5); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_imagelist_abs(NULL, NULL, 1.0); nxfail++; cpl_test_imagelist_abs(imglist1, NULL, 1.0); nxfail++; cpl_test_imagelist_abs(NULL, imglist2, 1.0); nxfail++; cpl_test_imagelist_abs(imglist1, imglist2, 0.5); nxfail++; (void)cpl_imagelist_unset(imglist1, 0); cpl_test_imagelist_abs(imglist1, imglist2, 1.0 + FLT_EPSILON); nxfail++; cpl_test_polynomial_abs(poly1, poly2, -1.0); nxfail++; cpl_polynomial_delete(poly2); poly2 = cpl_polynomial_new(cpl_polynomial_get_dimension(poly1)+1); cpl_test_polynomial_abs(poly1, poly2, 0.0); nxfail++; cpl_test_polynomial_abs(NULL, poly2, 0.0); nxfail++; cpl_test_polynomial_abs(poly1, NULL, 0.0); nxfail++; cpl_test_polynomial_abs(NULL, NULL, 0.0); nxfail++; cpl_test_eq_mask(mask1, NULL); nxfail++; cpl_test_eq_mask(NULL, mask1); nxfail++; cpl_test_eq_mask(mask1, mask2); nxfail++; cpl_mask_delete(mask2); mask2 = cpl_mask_new(IMAGESZ+1, IMAGESZ); cpl_test_eq_mask(mask1, mask2); nxfail++; cpl_mask_delete(mask2); mask2 = cpl_mask_new(IMAGESZ, IMAGESZ+1); cpl_test_eq_mask(mask1, mask2); nxfail++; cpl_test_fits(NULL); nxfail++; cpl_test_fits("/dev/null"); nxfail++; if (getenv(CPL_TEST_FITS)) { cpl_test_fits("."); nxfail++; } fp = fopen(CPL_TEST_FITS_NAME, "w"); cpl_test_nonnull(fp); if (fp != NULL) { /* This file size is non-FITS */ const size_t size = fwrite(B2880, 1, 80, fp) + fwrite(B2880, 1, 2880, fp) + fwrite(B2880, 1, 2880, fp); cpl_test_zero(fclose(fp)); cpl_test_eq(size, 80 + 2880 + 2880); cpl_test_fits(CPL_TEST_FITS_NAME); nxfail++; cpl_test_zero(remove(CPL_TEST_FITS_NAME)); } else { (void)remove(CPL_TEST_FITS_NAME); } cpl_test_fits(CPL_TEST_FITS_NAME); nxfail++; /* Tests done - reinstate normal messaging */ cpl_msg_set_level(level); cpl_msg_info(cpl_func, "Did %d failure tests", nxfail); failed = cpl_test_get_failed(); cpl_test_eq(failed, nxfail); cpl_vector_delete(vec1); cpl_vector_delete(vec2); cpl_matrix_delete(mat1); cpl_matrix_delete(mat2); cpl_array_delete(arr1i); cpl_array_delete(arr2i); cpl_array_delete(arr1f); cpl_array_delete(arr2f); cpl_array_delete(arr1d); cpl_array_delete(arr2d); cpl_array_delete(arr1s); cpl_array_delete(arr2s); cpl_image_delete(img1); cpl_image_delete(img2); cpl_image_delete(img3); (void)cpl_imagelist_unset(imglist1, 0); cpl_imagelist_delete(imglist1); cpl_imagelist_delete(imglist2); cpl_polynomial_delete(poly1); cpl_polynomial_delete(poly2); cpl_mask_delete(mask1); cpl_mask_delete(mask2); #ifdef HAVE_UNISTD_H tleft = sleep(tsleep); #else tleft = tsleep; #endif wallstop = cpl_test_get_walltime(); cpustop = cpl_test_get_cputime(); cpl_test_leq(wallstart + (double)tsleep, wallstop + (double)tleft); cpl_test_leq(cpustart, cpustop); cpl_msg_info(cpl_func, "Wall-clock time [s]: %g", wallstop-wallstart); cpl_msg_info(cpl_func, "CPU time [s]: %g", cpustop-cpustart); return cpl_test_end(-nxfail); } cpl-6.4.1/cplcore/tests/cpl_filter-test.c0000644000460300003120000003313111663162543015257 00000000000000/* $Id: cpl_filter-test.c,v 1.19 2011-11-23 12:21:55 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-11-23 12:21:55 $ * $Revision: 1.19 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include /* sqrt() */ #include #include /* memcpy() */ #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef BENCHSIZE #define BENCHSIZE 32 #endif #define assure(x) assert(x) #ifdef bool #define mybool bool #else #define mybool unsigned char #endif #ifdef true #define mytrue true #else #define mytrue 1 #endif #ifdef false #define myfalse false #else #define myfalse 0 #endif /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void test_filter(void); static void benchmark(cpl_filter_mode filter, cpl_border_mode border_mode, unsigned); static double rand_gauss(void); static void test_cpl_image_filter_double(unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned); static void test_cpl_image_filter_float(unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned); static void test_cpl_image_filter_int(unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned); static void test_cpl_image_filter(int, int, int, int, cpl_filter_mode, cpl_border_mode); #ifdef CPL_FILTER_TEST_AVERAGE_FAST static void image_filter_average_ref_double(double *, const double *, int, int, int, int, unsigned); static void image_filter_average_ref_float(float *, const float *, int, int, int, int, unsigned); static void image_filter_average_ref_int(int *, const int *, int, int, int, int, unsigned); #elif 1 static void image_filter_average_bf_double(double *, const double *, int, int, int, int, unsigned); static void image_filter_average_bf_float(float *, const float *, int, int, int, int, unsigned); static void image_filter_average_bf_int(int *, const int *, int, int, int, int, unsigned); #else static cpl_error_code filter_average_bf(cpl_image *, const cpl_image *, unsigned, unsigned, unsigned); #endif /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_filter_test Testing of the CPL filter functions */ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Test of cpl_image_filter **/ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Unit tests of filter module **/ /*----------------------------------------------------------------------------*/ int main(void) { cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); test_filter(); return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @brief Unit tests of filter module **/ /*----------------------------------------------------------------------------*/ static void test_filter(void) { const cpl_filter_mode filter_mode[] = {CPL_FILTER_AVERAGE, CPL_FILTER_AVERAGE_FAST, CPL_FILTER_MEDIAN}; const cpl_border_mode border_mode[] = {CPL_BORDER_NOP, CPL_BORDER_FILTER, CPL_BORDER_CROP, CPL_BORDER_COPY}; const int dopix[] = {1, 2, 3, 4, 7, 8}; const int dor[] = {0, 1, 2, 3, 7}; unsigned ifilt; for (ifilt = 0; ifilt < sizeof(filter_mode)/sizeof(filter_mode[0]); ifilt++) { unsigned ibord; for (ibord = 0; ibord < sizeof(border_mode)/sizeof(border_mode[0]); ibord++) { unsigned ix; if ((filter_mode[ifilt] == CPL_FILTER_STDEV || filter_mode[ifilt] == CPL_FILTER_AVERAGE || filter_mode[ifilt] == CPL_FILTER_AVERAGE_FAST) && border_mode[ibord] != CPL_BORDER_FILTER) continue; for (ix = 0; ix < sizeof(dopix)/sizeof(dopix[0]); ix++) { const int nx = dopix[ix]; unsigned iy; for (iy = 0; iy < sizeof(dopix)/sizeof(dopix[0]); iy++) { const int ny = dopix[iy]; unsigned irx; for (irx = 0; irx < sizeof(dor)/sizeof(dor[0]); irx++) { const int rx = 2*dor[irx] + 1 >= nx ? (nx-1)/2 : dor[irx]; unsigned iry; for (iry = 0; iry < sizeof(dor)/sizeof(dor[0]); iry++) { const int ry = 2*dor[iry] + 1 >= ny ? (ny-1)/2 : dor[iry]; if (2*rx + 1 <= nx && 2*ry + 1 <= ny) { test_cpl_image_filter(nx, ny, rx, ry, filter_mode[ifilt], border_mode[ibord]); } } } } } benchmark(filter_mode[ifilt], border_mode[ibord], BENCHSIZE); } } } static void test_cpl_image_filter(int nx, int ny, int rx, int ry, cpl_filter_mode filter, cpl_border_mode border_mode) { cpl_msg_debug(cpl_func, "Testing %dx%d image, " "%dx%d kernel, filter = %d, border = %d", nx, ny, rx, ry, filter, border_mode); /* Failure runs */ { cpl_image * in = cpl_image_new(nx, ny, CPL_TYPE_FLOAT); cpl_image * out = cpl_image_new(nx, ny, CPL_TYPE_FLOAT); cpl_mask * mask = cpl_mask_new(1 + 2 * rx, 1 + 2 * ry); cpl_error_code error; cpl_test_nonnull(in); cpl_test_nonnull(out); cpl_test_nonnull(mask); error = cpl_image_filter_mask(NULL, in, mask, filter, border_mode); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_image_filter_mask(in, NULL, mask, filter, border_mode); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_image_filter_mask(in, out, NULL, filter, border_mode); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); cpl_image_delete(in); cpl_image_delete(out); cpl_mask_delete(mask); } /* Successful runs */ test_cpl_image_filter_double(nx, ny, rx, ry, filter, border_mode, 1, 1); test_cpl_image_filter_float(nx, ny, rx, ry, filter, border_mode, 1, 1); test_cpl_image_filter_int(nx, ny, rx, ry, filter, border_mode, 1, 1); return; } static void benchmark(cpl_filter_mode filter, cpl_border_mode border_mode, unsigned benchsize) { test_cpl_image_filter_float(benchsize, benchsize, 1, 1, filter, border_mode, 100, 3); test_cpl_image_filter_double(benchsize, benchsize, 1, 1, filter, border_mode, 100, 3); test_cpl_image_filter_int(benchsize, benchsize, 1, 1, filter, border_mode, 100, 3); test_cpl_image_filter_float(benchsize, benchsize, 2, 2, filter, border_mode, 20, 3); test_cpl_image_filter_double(benchsize, benchsize, 2, 2, filter, border_mode, 20, 3); test_cpl_image_filter_int(benchsize, benchsize, 2, 2, filter, border_mode, 20, 3); test_cpl_image_filter_float(benchsize, benchsize, 14, 14, filter, border_mode, 20, 3); test_cpl_image_filter_double(benchsize, benchsize, 14, 14, filter, border_mode, 20, 3); test_cpl_image_filter_int(benchsize, benchsize, 14, 14, filter, border_mode, 20, 3); return; } static double rand_gauss(void) { static double V1, V2, S; static int phase = 0; double X; if(phase == 0) { do { double U1 = (double)rand() / RAND_MAX; double U2 = (double)rand() / RAND_MAX; V1 = 2 * U1 - 1; V2 = 2 * U2 - 1; S = V1 * V1 + V2 * V2; } while(S >= 1 || S == 0); X = V1 * sqrt(-2 * log(S) / S); } else X = V2 * sqrt(-2 * log(S) / S); phase = 1 - phase; return X; } #if 0 static cpl_error_code filter_average_bf(cpl_image * self, const cpl_image * other, unsigned hsizex, unsigned hsizey, unsigned mode) { const int nx = cpl_image_get_size_x(self); const int ny = cpl_image_get_size_y(self); cpl_matrix * kernel = cpl_matrix_new(1+2*hsizex, 1+2*hsizey); cpl_image * copy; cpl_errorstate prevstate = cpl_errorstate_get(); cpl_matrix_fill(kernel, 1.0); copy = cpl_image_filter_linear(other, kernel); if (cpl_error_get_code()) { cpl_errorstate_dump(prevstate, CPL_FALSE, NULL); } assert(copy != NULL); assert(cpl_image_get_type(copy) == cpl_image_get_type(self)); assert(cpl_image_get_size_x(copy) == nx); assert(cpl_image_get_size_y(copy) == ny); assert((mode & ~CPL_BORDER_MODE) == CPL_FILTER_AVERAGE || (mode & ~CPL_BORDER_MODE) == CPL_FILTER_AVERAGE_FAST); switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: { const double * sour = cpl_image_get_data_double_const(copy); double * dest = cpl_image_get_data_double(self); (void)memcpy(dest, sour, nx*ny*sizeof(double)); break; } case CPL_TYPE_FLOAT: { const float * sour = cpl_image_get_data_float_const(copy); float * dest = cpl_image_get_data_float(self); (void)memcpy(dest, sour, nx*ny*sizeof(float)); break; } case CPL_TYPE_INT: { const int * sour = cpl_image_get_data_int_const(copy); int * dest = cpl_image_get_data_int(self); (void)memcpy(dest, sour, nx*ny*sizeof(int)); break; } default: /* It is an error in CPL to reach this point */ (void)cpl_error_set_(CPL_ERROR_UNSPECIFIED); } cpl_image_delete(copy); return cpl_error_get_code(); } #endif /* These macros are needed for support of the different pixel types */ #define CONCAT(a,b) a ## _ ## b #define CONCAT2X(a,b) CONCAT(a,b) #define PIXEL_TYPE double #define PIXEL_MIN (-DBL_MAX) #define PIXEL_MAX DBL_MAX #include "cpl_filter_body.h" #undef PIXEL_TYPE #undef PIXEL_MIN #undef PIXEL_MAX #define PIXEL_TYPE float #define PIXEL_MIN (-FLT_MAX) #define PIXEL_MAX FLT_MAX #include "cpl_filter_body.h" #undef PIXEL_TYPE #undef PIXEL_MIN #undef PIXEL_MAX #define PIXEL_TYPE_IS_INT 1 #define PIXEL_TYPE int #define PIXEL_MIN (-INT_MAX) #define PIXEL_MAX INT_MAX #include "cpl_filter_body.h" #undef PIXEL_TYPE #undef PIXEL_TYPE_IS_INT #undef PIXEL_MIN #undef PIXEL_MAX cpl-6.4.1/cplcore/tests/cpl_propertylist-test.c0000644000460300003120000020742311737256204016561 00000000000000/* $Id: cpl_propertylist-test.c,v 1.80 2012-04-05 08:49:08 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-04-05 08:49:08 $ * $Revision: 1.80 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include #include "cpl_init.h" #include "cpl_image_io.h" #include "cpl_error.h" #include "cpl_propertylist_impl.h" #include "cpl_table.h" #include "cpl_msg.h" #include "cpl_test.h" #include "cpl_memory.h" #include "cpl_fits.h" #include "cpl_io_fits.h" #include #include #include #include #include #include /*---------------------------------------------------------------------------- Defines ----------------------------------------------------------------------------*/ #define BASE "cpl_propertylist-test" #define NOKEY "Non-existing key" #define BADNUM "l.O" /* This complex format is not supported */ #define COMPLEXVAL "1D1,2E2" #define LONGNAME80 "0123456789012345678901234567890123456789" \ "0123456789012345678901234567890123456789" /*---------------------------------------------------------------------------- Functions prototypes ----------------------------------------------------------------------------*/ static int cpl_test_property_compare_name(const cpl_property *, const cpl_property *); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { const char *keys[] = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "A", "B", "C", "D", "E", "F", "G", "H", "I" }; const char *comments[] = { "A character value", "A boolean value", "A integer value", "A long integer value", "A floating point number", "A double precision number", "A string value", "A floating point complex number", "A double precision complex number" }; cpl_type types[] = { CPL_TYPE_CHAR, CPL_TYPE_BOOL, CPL_TYPE_INT, CPL_TYPE_LONG, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE, CPL_TYPE_STRING, CPL_TYPE_FLOAT_COMPLEX, CPL_TYPE_DOUBLE_COMPLEX }; int status, j; long i; long naxes[2] = {256,256}; const float fval0 = -1.23456789; float fval1, fval2; const double dval0 = -1.23456789; double dval1, dval2; const float complex zf0 = fval0 + fval0 * fval0 * _Complex_I; float complex zf1, zf2; const double complex zd0 = zf0; double complex zd1, zd2; float f0,f1,f2; double d0,d1,d2; const int nprops = sizeof(types)/sizeof(types[0]); const char *filename3 = BASE ".fits"; /*const char regex[] = "^(DATE-OBS|ESO|COMMENT|HISTORY)$";*/ const char to_rm[] = "^HIERARCH ESO |^NBXIS1$|^NBXIS2$|^HISTORY$"; cpl_propertylist *plist, *_plist, *plist2; cpl_property *pro, *pro2; const cpl_property *pro1; cpl_table *t; cpl_type t1; cpl_error_code code; int value; cpl_boolean do_bench; int bench_size; const char * strval; fitsfile *fptr = NULL; fitsfile *_fptr; FILE *stream; #ifdef CPL_PROPERTYLIST_TEST_FCARD struct fcard { const char *key; const char *val; const char *com; cpl_type type; }; struct fcard hdr[] = { {"SIMPLE", "T", "Standard FITS format (NOST-100.0)", CPL_TYPE_BOOL}, {"BITPIX", "16", "# of bits storing pix values", CPL_TYPE_INT}, {"NAXIS", "2", "# of axes in frame", CPL_TYPE_INT}, {"NAXIS1", "2148", "# pixels/axis", CPL_TYPE_INT}, {"NAXIS2", "2340", "# pixels/axis", CPL_TYPE_INT}, {"ORIGIN", "ESO", "European Southern Observatory", CPL_TYPE_STRING}, {"DATE", "2002-03-08T04:27:21.420", "Date this file was written (dd/mm/yyyy)", CPL_TYPE_STRING}, {"MJD-OBS", "52341.17813019", "Obs start 2002-03-08T04:16:30.448", CPL_TYPE_DOUBLE}, {"DATE-OBS", "2002-03-08T04:16:30.448", "Date of observation", CPL_TYPE_STRING}, {"EXPTIME", "600.000", "Total integration time. 00:10:00.000", CPL_TYPE_DOUBLE}, {"TELESCOP", "VLT", "ESO ", CPL_TYPE_STRING}, {"RA", "181.41734", "12:05:40.1 RA (J2000) pointing", CPL_TYPE_DOUBLE}, {"DEC", "-7.65555", "-07:39:19.9 DEC (J2000) pointing", CPL_TYPE_DOUBLE}, {"EQUINOX", "2000.", "Standard FK5 (years)", CPL_TYPE_DOUBLE}, {"RADECSYS", "FK5", "Coordinate reference frame", CPL_TYPE_STRING}, {"LST", "38309.370", "10:38:29.370 LST at start", CPL_TYPE_DOUBLE}, {"UTC", "15438.000", "04:17:18.000 UT at start", CPL_TYPE_DOUBLE}, {"OBSERVER", "UNKNOWN", "Name of observer", CPL_TYPE_STRING}, {"INSTRUME", "UNKNOWN", "Instrument used", CPL_TYPE_STRING}, {"PI-COI", "'555555555'", "Name of PI and COI", CPL_TYPE_STRING}, {"OBJECT", "None", "Original target", CPL_TYPE_STRING}, {"PCOUNT", "0", "Number of parameters per group", CPL_TYPE_INT}, {"GCOUNT", "1", "Number of groups", CPL_TYPE_INT}, {"CRVAL1", "181.41734", "12:05:40.1, RA at ref pixel", CPL_TYPE_DOUBLE}, {"CRPIX1", "2341.8585366", "Reference pixel in X", CPL_TYPE_DOUBLE}, {"CDELT1", "0.20500000", "SS arcsec per pixel in RA", CPL_TYPE_DOUBLE}, {"CTYPE1", "RA---TAN", "pixel coordinate system", CPL_TYPE_STRING}, {"CRVAL2", "-7.65555", "-07:39:19.9, DEC at ref pixel", CPL_TYPE_DOUBLE}, {"CRPIX2", "2487.8585366", "Reference pixel in Y", CPL_TYPE_DOUBLE}, {"CDELT2", "0.20500000", "SS arcsec per pixel in DEC", CPL_TYPE_DOUBLE}, {"CTYPE2", "DEC--TAN", "pixel coordinate system", CPL_TYPE_STRING}, {"BSCALE", "1.0", "pixel=FITS*BSCALE+BZERO", CPL_TYPE_DOUBLE}, {"BZERO", "32768.0", "pixel=FITS*BSCALE+BZERO", CPL_TYPE_DOUBLE}, {"CD1_1", "0.000057", "Translation matrix element", CPL_TYPE_DOUBLE}, {"CD1_2", "0.000000", "Translation matrix element", CPL_TYPE_DOUBLE}, {"CD2_1", "0.000000", "Translation matrix element", CPL_TYPE_DOUBLE}, {"CD2_2", "0.000057", "Translation matrix element", CPL_TYPE_DOUBLE}, {"HIERARCH ESO OBS DID", "ESO-VLT-DIC.OBS-1.7", "OBS Dictionary", CPL_TYPE_STRING}, {"HIERARCH ESO OBS OBSERVER", "UNKNOWN", "Observer Name", CPL_TYPE_STRING}, {"HIERARCH ESO OBS PI-COI NAME", "UNKNOWN", "PI-COI name", CPL_TYPE_STRING}, {"HIERARCH ESO INS GRAT NAME", "HR", "Grating name", CPL_TYPE_STRING}, {"HIERARCH ESO PRO CATG", "X", "Product category", CPL_TYPE_STRING}, {"HIERARCH ESO TPL NEXP", "5", "Number of exposures", CPL_TYPE_INT}, {"HISTORY", "1st history record", NULL, CPL_TYPE_STRING}, {"COMMENT", "1st comment record", NULL, CPL_TYPE_STRING}, {"HISTORY", "2st history record", NULL, CPL_TYPE_STRING}, {"COMMENT", "2st comment record", NULL, CPL_TYPE_STRING}, {"COMMENT", "3st comment record", NULL, CPL_TYPE_STRING}, {"HISTORY", "3st history record", NULL, CPL_TYPE_STRING}, {"END", NULL, NULL, CPL_TYPE_STRING} }; #endif const char *longname = LONGNAME80; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); do_bench = cpl_msg_get_level() <= CPL_MSG_INFO ? CPL_TRUE : CPL_FALSE; /* Always test the _dump functions, but produce no output when the message level is above info */ stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; cpl_test_nonnull(stream); cpl_test_eq(sizeof(comments)/sizeof(comments[0]), nprops); cpl_test_eq(sizeof(keys)/sizeof(keys[0]), 2 * nprops); /* * Test 1: Create a property list and check its validity. */ plist = cpl_propertylist_new(); cpl_test_nonnull(plist); cpl_test(cpl_propertylist_is_empty(plist)); cpl_test_zero(cpl_propertylist_get_size(plist)); pro1 = cpl_propertylist_get_const(plist, 100); cpl_test_error(CPL_ERROR_NONE); cpl_test_null(pro1); /* * Test 2: Append properties to the list created in the previous test * and verify the data. */ cpl_propertylist_append_char(plist, keys[0], 'a'); cpl_propertylist_set_comment(plist, keys[0], comments[0]); cpl_propertylist_append_bool(plist, keys[1], 1); cpl_propertylist_set_comment(plist, keys[1], comments[1]); cpl_propertylist_append_int(plist, keys[2], -1); cpl_propertylist_set_comment(plist, keys[2], comments[2]); cpl_propertylist_append_long(plist, keys[3], 32768); cpl_propertylist_set_comment(plist, keys[3], comments[3]); cpl_propertylist_append_float(plist, keys[4], fval0); cpl_propertylist_set_comment(plist, keys[4], comments[4]); cpl_propertylist_append_double(plist, keys[5], dval0); cpl_propertylist_set_comment(plist, keys[5], comments[5]); cpl_propertylist_append_string(plist, keys[6], comments[6]); cpl_propertylist_set_comment(plist, keys[6], comments[6]); cpl_propertylist_append_float_complex(plist, keys[7], zf0); cpl_propertylist_set_comment(plist, keys[7], comments[7]); cpl_propertylist_append_double_complex(plist, keys[8], zd0); cpl_propertylist_set_comment(plist, keys[8], comments[8]); cpl_test_zero(cpl_propertylist_is_empty(plist)); cpl_test_eq(cpl_propertylist_get_size(plist), nprops); pro1 = cpl_propertylist_get_const(plist, nprops-1); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(pro1); pro1 = cpl_propertylist_get_const(plist, nprops); cpl_test_error(CPL_ERROR_NONE); cpl_test_null(pro1); code = cpl_propertylist_save(plist, BASE "_2.fits", CPL_IO_CREATE); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_fits(BASE "_2.fits"); _plist = cpl_propertylist_load(BASE "_2.fits", 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(_plist); /* Some properties are added */ cpl_test_leq(nprops, cpl_propertylist_get_size(_plist)); for (i = 0; i < nprops; i++) { const cpl_property * p1 = cpl_propertylist_get_property_const(plist, keys[i]); const cpl_property * p2 = cpl_propertylist_get_property_const(_plist, keys[i + nprops]); cpl_test_eq(i, i); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(p1); cpl_test_nonnull(p2); if (types[i] == CPL_TYPE_CHAR) { /* FITS I/O promotes this type to a single character string */ cpl_test_eq(cpl_property_get_type(p2), CPL_TYPE_STRING); cpl_test_eq(cpl_property_get_string(p2)[0], cpl_property_get_char(p1)); } else if (types[i] == CPL_TYPE_LONG) { /* FITS I/O casts this type to int */ cpl_test_eq(cpl_property_get_type(p2), CPL_TYPE_INT); cpl_test_eq(cpl_property_get_int(p2), cpl_property_get_long(p1)); } else if (types[i] == CPL_TYPE_FLOAT) { /* FITS I/O promotes this type to double */ cpl_test_eq(cpl_property_get_type(p2), CPL_TYPE_DOUBLE); cpl_test_abs(cpl_property_get_double(p2), cpl_property_get_float(p1), 2.0 * FLT_EPSILON); } else if (types[i] == CPL_TYPE_FLOAT_COMPLEX) { /* FITS I/O promotes this type to double complex */ cpl_test_eq(cpl_property_get_type(p2), CPL_TYPE_DOUBLE_COMPLEX); zd1 = cpl_property_get_float_complex(p1); zd2 = cpl_property_get_double_complex(p2); cpl_test_abs_complex(zd1, zd2, 2.0 * FLT_EPSILON); } else { cpl_test_eq(cpl_property_get_type(p2), types[i]); if (types[i] == CPL_TYPE_BOOL) { cpl_test_eq(cpl_property_get_bool(p2), cpl_property_get_bool(p1)); } else if (types[i] == CPL_TYPE_INT) { cpl_test_eq(cpl_property_get_int(p2), cpl_property_get_int(p1)); } else if (types[i] == CPL_TYPE_DOUBLE) { cpl_test_abs(cpl_property_get_double(p2), cpl_property_get_double(p1), DBL_EPSILON); } else if (types[i] == CPL_TYPE_STRING) { cpl_test_eq_string(cpl_property_get_string(p2), cpl_property_get_string(p1)); } else if (types[i] == CPL_TYPE_DOUBLE_COMPLEX) { zd1 = cpl_property_get_double_complex(p1); zd2 = cpl_property_get_double_complex(p2); cpl_test_abs_complex(zd1, zd2, 32.0 * DBL_EPSILON); } } cpl_test_zero(strncmp(cpl_property_get_comment(p2), comments[i], strlen(cpl_property_get_comment(p2)))); } cpl_propertylist_delete(_plist); for (i = 0; i < nprops; i++) { const cpl_property *p = cpl_propertylist_get_const(plist, i); cpl_test_eq_string(cpl_property_get_name(p), keys[i]); cpl_test_eq_string(cpl_property_get_comment(p), comments[i]); cpl_test_eq(cpl_property_get_type(p), types[i]); cpl_test(cpl_propertylist_has(plist, keys[i])); cpl_test_eq_string(cpl_propertylist_get_comment(plist, keys[i]), comments[i]); cpl_test_eq(cpl_propertylist_get_type(plist, keys[i]), types[i]); } cpl_test_eq(cpl_propertylist_get_char(plist, keys[0]), 'a'); cpl_test_eq(cpl_propertylist_get_bool(plist, keys[1]), 1); cpl_test_eq(cpl_propertylist_get_int(plist, keys[2]), -1); cpl_test_eq(cpl_propertylist_get_long(plist, keys[3]), 32768); fval1 = cpl_propertylist_get_float(plist, keys[4]); cpl_test_abs(fval0, fval1, 0.0); dval1 = cpl_propertylist_get_double(plist, keys[5]); cpl_test_abs(dval0, dval1, 0.0); cpl_test_eq_string(cpl_propertylist_get_string(plist, keys[6]), comments[6]); /* * Test 3: Modify the values of the property list entries * and verify the data. */ cpl_test_zero(cpl_propertylist_set_char(plist, keys[0], 'b')); cpl_test_eq(cpl_propertylist_get_char(plist, keys[0]), 'b'); cpl_test_zero(cpl_propertylist_set_bool(plist, keys[1], 0)); cpl_test_zero(cpl_propertylist_get_bool(plist, keys[1])); cpl_test_zero(cpl_propertylist_set_int(plist, keys[2], -1)); cpl_test_eq(cpl_propertylist_get_int(plist, keys[2]), -1); cpl_test_zero(cpl_propertylist_set_long(plist, keys[3], 1)); cpl_test_eq(cpl_propertylist_get_long(plist, keys[3]), 1); fval1 = 9.87654321; cpl_test_noneq(fval0, fval1); cpl_test_zero(cpl_propertylist_set_float(plist, keys[4], fval1)); fval2 = cpl_propertylist_get_float(plist, keys[4]); cpl_test_abs(fval1, fval2, 0.0); dval1 = -9.87654321; cpl_test_noneq(dval0, dval1); cpl_test_zero(cpl_propertylist_set_double(plist, keys[5], dval1)); dval2 = cpl_propertylist_get_double(plist, keys[5]); cpl_test_abs(dval1, dval2, 0.0); cpl_test_zero(cpl_propertylist_set_string(plist, keys[6], comments[0])); cpl_test_eq_string(cpl_propertylist_get_string(plist, keys[6]), comments[0]); zf1 = 9.87654321 * zf0; cpl_test_noneq(zf0, zf1); cpl_test_zero(cpl_propertylist_set_float_complex(plist, keys[7], zf1)); zf2 = cpl_propertylist_get_float_complex(plist, keys[7]); cpl_test_abs_complex(zf1, zf2, 0.0); zd1 = -9.87654321 * zd0; cpl_test_noneq(zd0, zd1); cpl_test_zero(cpl_propertylist_set_double_complex(plist, keys[8], zd1)); zd2 = cpl_propertylist_get_double_complex(plist, keys[8]); cpl_test_abs_complex(zd1, zd2, 0.0); /* * Test 4: Check that trying to modify an entry with a different * type is properly failing. */ code = cpl_propertylist_set_char(plist, keys[1], 'a'); cpl_test_eq_error(code, CPL_ERROR_TYPE_MISMATCH); code = cpl_propertylist_set_bool(plist, keys[2], 1); cpl_test_eq_error(code, CPL_ERROR_TYPE_MISMATCH); code = cpl_propertylist_set_int(plist, keys[3], 1); cpl_test_eq_error(code, CPL_ERROR_TYPE_MISMATCH); code = cpl_propertylist_set_long(plist, keys[4], 1); cpl_test_eq_error(code, CPL_ERROR_TYPE_MISMATCH); code = cpl_propertylist_set_float(plist, keys[5], 1.); cpl_test_eq_error(code, CPL_ERROR_TYPE_MISMATCH); code = cpl_propertylist_set_double(plist, keys[6], 1.); cpl_test_eq_error(code, CPL_ERROR_TYPE_MISMATCH); code = cpl_propertylist_set_string(plist, keys[0], comments[0]); cpl_test_eq_error(code, CPL_ERROR_TYPE_MISMATCH); code = cpl_propertylist_set_float(plist, keys[7], 1.); cpl_test_eq_error(code, CPL_ERROR_TYPE_MISMATCH); code = cpl_propertylist_set_double(plist, keys[8], 1.); cpl_test_eq_error(code, CPL_ERROR_TYPE_MISMATCH); /* * Test 5: Verify that values are inserted correctly into the property * list. */ cpl_test_eq(cpl_propertylist_insert_char(plist, keys[0], keys[0 + nprops], 'a'), 0); cpl_test_eq(cpl_propertylist_insert_after_char(plist, keys[0], keys[0 + nprops], 'c'), 0); cpl_test_eq(cpl_propertylist_insert_bool(plist, keys[1], keys[1 + nprops], 0), 0); cpl_test_eq(cpl_propertylist_insert_after_bool(plist, keys[1], keys[1 + nprops], 1), 0); cpl_test_eq(cpl_propertylist_insert_int(plist, keys[2], keys[2 + nprops], 0), 0); cpl_test_eq(cpl_propertylist_insert_after_int(plist, keys[2], keys[2 + nprops], 1), 0); cpl_test_eq(cpl_propertylist_insert_long(plist, keys[3], keys[3 + nprops], 123456789), 0); cpl_test_eq(cpl_propertylist_insert_after_long(plist, keys[3], keys[3 + nprops], 123456789), 0); cpl_test_eq(cpl_propertylist_insert_float(plist, keys[4], keys[4 + nprops], fval0), 0); cpl_test_eq(cpl_propertylist_insert_after_float(plist, keys[4], keys[4 + nprops], -fval0), 0); cpl_test_eq(cpl_propertylist_insert_double(plist, keys[5], keys[5 + nprops], dval0), 0); cpl_test_eq(cpl_propertylist_insert_after_double(plist, keys[5], keys[5 + nprops], -dval0), 0); cpl_test_eq(cpl_propertylist_insert_string(plist, keys[6], keys[6 + nprops], ""), 0); cpl_test_eq(cpl_propertylist_insert_after_string(plist, keys[6], keys[6 + nprops], ""), 0); cpl_test_eq(cpl_propertylist_insert_float(plist, keys[7], keys[7 + nprops], fval0), 0); cpl_test_eq(cpl_propertylist_insert_after_float(plist, keys[7], keys[7 + nprops], -fval0), 0); cpl_test_eq(cpl_propertylist_insert_double(plist, keys[8], keys[8 + nprops], dval0), 0); cpl_test_eq(cpl_propertylist_insert_after_double(plist, keys[8], keys[8 + nprops], -dval0), 0); for (i = 0; i < nprops; i++) { cpl_property *p0 = cpl_propertylist_get(plist, 3 * i); cpl_property *p1 = cpl_propertylist_get(plist, 3 * i + 1); cpl_property *p2 = cpl_propertylist_get(plist, 3 * i + 2); cpl_test_eq_string(cpl_property_get_name(p0), keys[i + nprops]); cpl_test_eq_string(cpl_property_get_name(p1), keys[i]); cpl_test_eq_string(cpl_property_get_name(p2), keys[i + nprops]); switch (cpl_property_get_type(p0)) { case CPL_TYPE_CHAR: cpl_test_eq(cpl_property_get_char(p0), 'a'); cpl_test_eq(cpl_property_get_char(p2), 'c'); break; case CPL_TYPE_BOOL: cpl_test_zero(cpl_property_get_bool(p0)); cpl_test_eq(cpl_property_get_bool(p2), 1); break; case CPL_TYPE_INT: cpl_test_zero(cpl_property_get_int(p0)); cpl_test_zero(cpl_property_get_int(p0)); break; case CPL_TYPE_LONG: cpl_test_eq(cpl_property_get_long(p0), 123456789); cpl_test_eq(cpl_property_get_long(p0), 123456789); break; case CPL_TYPE_FLOAT: fval1 = cpl_property_get_float(p0); cpl_test_abs(fval0, fval1, 0.0); fval1 = -cpl_property_get_float(p2); cpl_test_abs(fval0, fval1, 0.0); break; case CPL_TYPE_DOUBLE: dval1 = cpl_property_get_double(p0); cpl_test_abs(dval0, dval1, 0.0); dval1 = -cpl_property_get_double(p2); cpl_test_abs(dval0, dval1, 0.0); break; case CPL_TYPE_STRING: cpl_test_eq_string(cpl_property_get_string(p0), ""); cpl_test_eq_string(cpl_property_get_string(p2), ""); break; default: /* This point should never be reached */ cpl_test(0); break; } } /* * Test 6: Verify that modification of or insertion at/after a non * existing elements is reported correctly. */ cpl_test_zero(cpl_propertylist_has(plist, NOKEY)); code = cpl_propertylist_set_char(plist, NOKEY, 'a'); cpl_test_eq_error(code, CPL_ERROR_DATA_NOT_FOUND); code = cpl_propertylist_set_bool(plist, NOKEY, 1); cpl_test_eq_error(code, CPL_ERROR_DATA_NOT_FOUND); code = cpl_propertylist_set_int(plist, NOKEY, 1); cpl_test_eq_error(code, CPL_ERROR_DATA_NOT_FOUND); code = cpl_propertylist_set_long(plist, NOKEY, 1); cpl_test_eq_error(code, CPL_ERROR_DATA_NOT_FOUND); code = cpl_propertylist_set_float(plist, NOKEY, 1); cpl_test_eq_error(code, CPL_ERROR_DATA_NOT_FOUND); code = cpl_propertylist_set_double(plist, NOKEY, 1); cpl_test_eq_error(code, CPL_ERROR_DATA_NOT_FOUND); code = cpl_propertylist_set_string(plist, NOKEY, ""); cpl_test_eq_error(code, CPL_ERROR_DATA_NOT_FOUND); code = cpl_propertylist_insert_char(plist, NOKEY, "h", 'a'); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_bool(plist, NOKEY, "h", 1); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_int(plist, NOKEY, "h", 1); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_long(plist, NOKEY, "h", 1); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_float(plist, NOKEY, "h", 1.0); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_double(plist, NOKEY, "h", 1.0); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_string(plist, NOKEY, "h", ""); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_after_char(plist, NOKEY, "h", 'a'); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_after_bool(plist, NOKEY, "h", 1); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_after_int(plist, NOKEY, "h", 1); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_after_long(plist, NOKEY, "h", 1); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_after_float(plist, NOKEY, "h", 1.0); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_after_double(plist, NOKEY, "h", 1.0); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); code = cpl_propertylist_insert_after_string(plist, NOKEY, "h", ""); cpl_test_eq_error(code, CPL_ERROR_UNSPECIFIED); /* * Test 7: Create a copy of the property list and verify that original * and copy are identical but do not share any resources. */ _plist = cpl_propertylist_duplicate(plist); plist2 = cpl_propertylist_duplicate(plist); cpl_test_nonnull(_plist); cpl_test_assert(_plist != plist); cpl_test_nonnull(plist2); cpl_test_assert(plist2 != plist); cpl_test_error(CPL_ERROR_NONE); for (i = 0; i < cpl_propertylist_get_size(plist); i++) { cpl_property *p = cpl_propertylist_get(plist, i); cpl_property *_p = cpl_propertylist_get(_plist, i); cpl_test_assert(cpl_property_get_name(p) != cpl_property_get_name(_p)); cpl_test_eq_string(cpl_property_get_name(p), cpl_property_get_name(_p)); cpl_test_assert(cpl_property_get_comment(p) == NULL || (cpl_property_get_comment(p) != cpl_property_get_comment(_p))); cpl_test_assert(cpl_property_get_comment(p) == NULL || !strcmp(cpl_property_get_comment(p), cpl_property_get_comment(_p))); switch (cpl_property_get_type(p)) { case CPL_TYPE_CHAR: cpl_test_eq(cpl_property_get_char(p), cpl_property_get_char(_p)); break; case CPL_TYPE_BOOL: cpl_test_eq(cpl_property_get_bool(p), cpl_property_get_bool(_p)); break; case CPL_TYPE_INT: cpl_test_eq(cpl_property_get_int(p), cpl_property_get_int(_p)); break; case CPL_TYPE_LONG: cpl_test_eq(cpl_property_get_long(p), cpl_property_get_long(_p)); break; case CPL_TYPE_FLOAT: fval1 = cpl_property_get_float(p); fval2 = cpl_property_get_float(_p); cpl_test_abs(fval1, fval2, 0.0); break; case CPL_TYPE_DOUBLE: dval1 = cpl_property_get_double(p); dval2 = cpl_property_get_double(_p); cpl_test_abs(dval1, dval2, 0.0); break; case CPL_TYPE_STRING: cpl_test_eq_string(cpl_property_get_string(p), cpl_property_get_string(_p)); break; case CPL_TYPE_FLOAT_COMPLEX: zf1 = cpl_property_get_float_complex(p); zf2 = cpl_property_get_float_complex(_p); cpl_test_abs_complex(zf1, zf2, 0.0); break; case CPL_TYPE_DOUBLE_COMPLEX: zd1 = cpl_property_get_double_complex(p); zd2 = cpl_property_get_double_complex(_p); cpl_test_abs_complex(zd1, zd2, 0.0); break; default: /* This point should never be reached */ cpl_test(0); break; } } cpl_propertylist_delete(_plist); cpl_test_error(CPL_ERROR_NONE); /* * Test 8: Erase elements from the property list and verify the list * structure and the data. Each key exists twice in capital * letters and once in lowercase letters. */ for (i = 0; i < nprops; i++) { cpl_propertylist_erase(plist, keys[i + nprops]); cpl_test_eq(cpl_propertylist_has(plist, keys[i + nprops]), 1); cpl_propertylist_erase(plist, keys[i + nprops]); cpl_test_zero(cpl_propertylist_has(plist, keys[i + nprops])); } cpl_test_eq(cpl_propertylist_get_size(plist), nprops); for (i = 0; i < nprops; i++) { cpl_property *p = cpl_propertylist_get(plist, i); cpl_test_eq_string(cpl_property_get_name(p), keys[i]); } cpl_test_eq(cpl_propertylist_get_char(plist, keys[0]), 'b'); cpl_test_zero(cpl_propertylist_get_bool(plist, keys[1])); cpl_test_eq(cpl_propertylist_get_int(plist, keys[2]), -1); cpl_test_eq(cpl_propertylist_get_long(plist, keys[3]), 1); fval1 = 9.87654321; cpl_test_noneq(fval0, fval1); fval2 = cpl_propertylist_get_float(plist, keys[4]); cpl_test_abs(fval1, fval2, 0.0); dval1 = -9.87654321; cpl_test_noneq(dval0, dval1); dval2 = cpl_propertylist_get_double(plist, keys[5]); cpl_test_abs(dval1, dval2, 0.0); cpl_test_eq_string(cpl_propertylist_get_string(plist, keys[6]), comments[0]); /* * Test 9: Erase all elements from the property list and verify that * the list is empty. */ cpl_propertylist_empty(plist); // cpl_test_assert(cpl_propertylist_is_empty(plist)); cpl_test(cpl_propertylist_is_empty(plist)); cpl_test_zero(cpl_propertylist_get_size(plist)); cpl_propertylist_delete(plist); /* * Test 10: Write a propertylist to a FITS file * and save it in disk */ code = cpl_propertylist_update_string(plist2,"ESO OBS DID", "BLABLA"); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_propertylist_update_string(plist2,"ESO OBS OBSERVER", "NAME"); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_propertylist_update_string(plist2,"ESO OBS PI-COI NAME", "NAME"); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_propertylist_update_string(plist2,"ESO INS GRAT NAME", "DODO"); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_propertylist_update_string(plist2,"ESO PRO CATG", "PRODUCT"); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_propertylist_update_int(plist2,"ESO TPL NEXP", 4); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_propertylist_update_int(plist2, "TOFITS", 6); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_propertylist_set_comment(plist2, "TOFITS", "Test TOFITS function"); cpl_test_eq_error(code, CPL_ERROR_NONE); (void)remove(filename3); status = 0; fits_create_diskfile(&fptr, filename3, &status); cpl_test_zero(status); /* * Create simple HDU */ fits_create_img(fptr, 8, 0, naxes, &status); cpl_test_zero(status); /*Save a propertylist to a FITS file*/ code = cpl_propertylist_to_fitsfile(fptr, plist2, NULL); cpl_test_eq_error(code, CPL_ERROR_NONE); fits_close_file(fptr, &status); cpl_test_zero(status); cpl_test_fits(filename3); cpl_propertylist_delete(plist2); /* Test 11: Load back the propertylist from a FITS file using CFITSIO * and compare it with a plist loaded using CPL. * Retrieve a property usign its name */ plist2 = cpl_propertylist_load(filename3, 0); cpl_test_nonnull(plist2); /* Try to load a non-existent extension and check that the proper error code is set */ plist = cpl_propertylist_load(filename3, 10); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(plist); pro2 = cpl_propertylist_get_property(plist2, "TOFITS"); cpl_test_nonnull(pro2); cpl_test_eq_string("TOFITS", cpl_property_get_name(pro2)); cpl_test_eq(cpl_property_get_int(pro2), 6); status = 0; fits_open_diskfile(&_fptr, filename3, READONLY, &status); cpl_test_zero(status); _plist = cpl_propertylist_from_fitsfile(_fptr); cpl_test_nonnull(_plist); /* Check that the property of both lists are the same */ pro = cpl_propertylist_get_property(_plist, "TOFITS"); cpl_test_nonnull(pro); cpl_test_eq(cpl_property_get_int(pro), cpl_property_get_int(pro2)); // cpl_propertylist_delete(plist2); fits_close_file(_fptr, &status); cpl_test_zero(status); cpl_test_fits(filename3); /* * Test 12: Compare the properties of both lists */ cpl_test_eq(cpl_propertylist_get_size(plist2), cpl_propertylist_get_size(_plist)); for (i = 0; i < cpl_propertylist_get_size(plist2); i++) { const cpl_property *p = cpl_propertylist_get_const(plist2, i); cpl_property *_p = cpl_propertylist_get(_plist, i); cpl_test_eq_string(cpl_property_get_name(p), cpl_property_get_name(_p)); cpl_test_eq_string(cpl_property_get_comment(p), cpl_property_get_comment(_p)); cpl_test_eq(cpl_property_get_type(p), cpl_property_get_type(_p)); switch (cpl_property_get_type(p)) { case CPL_TYPE_BOOL: cpl_test_eq(cpl_property_get_bool(p), cpl_property_get_bool(_p)); break; case CPL_TYPE_INT: cpl_test_eq(cpl_property_get_int(p), cpl_property_get_int(_p)); break; case CPL_TYPE_DOUBLE: cpl_test_eq(cpl_property_get_double(p), cpl_property_get_double(_p)); break; case CPL_TYPE_STRING: cpl_test_eq_string(cpl_property_get_string(p), cpl_property_get_string(_p)); break; default: /* This point should never be reached */ cpl_test(0); break; } } cpl_propertylist_delete(_plist); plist = cpl_propertylist_duplicate(plist2); cpl_propertylist_delete(plist2); /* * Test 13: Copy all properties matching a given pattern from one * property list to another. */ _plist = cpl_propertylist_new(); cpl_propertylist_copy_property_regexp(_plist, plist, "^ESO .*", 0); cpl_test(cpl_propertylist_has(_plist, "ESO OBS DID")); cpl_test(cpl_propertylist_has(_plist, "ESO OBS OBSERVER")); cpl_test(cpl_propertylist_has(_plist, "ESO OBS PI-COI NAME")); cpl_test(cpl_propertylist_has(_plist, "ESO INS GRAT NAME")); cpl_test(cpl_propertylist_has(_plist, "ESO PRO CATG")); cpl_test(cpl_propertylist_has(_plist, "ESO TPL NEXP")); cpl_propertylist_empty(_plist); cpl_test(cpl_propertylist_is_empty(_plist)); cpl_propertylist_copy_property_regexp(_plist, plist, "^ESO .*", 1); cpl_test_zero(cpl_propertylist_has(_plist, "ESO OBS DID")); /* * Test 14a: Erase all properties matching the given pattern from the * property list. */ cpl_propertylist_empty(_plist); cpl_test(cpl_propertylist_is_empty(_plist)); code = cpl_propertylist_copy_property_regexp(NULL, plist, ".", 0); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); code = cpl_propertylist_copy_property_regexp(_plist, NULL, ".", 0); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); code = cpl_propertylist_copy_property_regexp(_plist, plist, NULL, 0); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); code = cpl_propertylist_copy_property_regexp(_plist, plist, ")|(", 1); cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT); code = cpl_propertylist_copy_property_regexp(_plist, plist, "^ESO .*", 0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_eq(cpl_propertylist_get_size(_plist), 6); value = cpl_propertylist_erase_regexp(_plist, "^ESO OBS .*", 0); cpl_test_eq(value, 3); cpl_test_eq(cpl_propertylist_get_size(_plist), 3); value = cpl_propertylist_erase_regexp(_plist, "ESO TPL NEXP", 0); cpl_test_eq(value, 1); cpl_test_eq(cpl_propertylist_get_size(_plist), 2); /* * Test 14b: Erase a non-existing property and check return. When regexp is null, the return should be -1 */ value = cpl_propertylist_erase_regexp(_plist, "ESO TPL NEXP", 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(value); value = cpl_propertylist_erase_regexp(_plist, ")|(", 1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq(value, -1); value = cpl_propertylist_erase_regexp(NULL, ".", 1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(value, -1); value = cpl_propertylist_erase_regexp(_plist, NULL, 0); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(value, -1); cpl_propertylist_delete(_plist); cpl_propertylist_delete(plist); /* * Test 15: Create a property list from a file. Only properties matching * the given pattern are loaded. */ plist = cpl_propertylist_load_regexp(filename3, 0, "^ESO .*", 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(plist); cpl_test_zero(cpl_propertylist_is_empty(plist)); cpl_test_eq(cpl_propertylist_get_size(plist), 6); cpl_test(cpl_propertylist_has(plist, "ESO OBS DID")); cpl_test(cpl_propertylist_has(plist, "ESO OBS OBSERVER")); cpl_test(cpl_propertylist_has(plist, "ESO OBS PI-COI NAME")); cpl_test(cpl_propertylist_has(plist, "ESO INS GRAT NAME")); cpl_test(cpl_propertylist_has(plist, "ESO PRO CATG")); cpl_test(cpl_propertylist_has(plist, "ESO TPL NEXP")); cpl_propertylist_delete(plist); /* * Test 15b: Failure tests of cpl_propertylist_load{,_regexp}(). */ remove("no.fits"); value = cpl_fits_count_extensions(filename3); cpl_test_leq(0, value); plist = cpl_propertylist_load(NULL, 0); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(plist); plist = cpl_propertylist_load_regexp(NULL, 0, ".", 0); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(plist); plist = cpl_propertylist_load_regexp(filename3, 0, NULL, 0); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(plist); plist = cpl_propertylist_load("no.fits", 0); cpl_test_error(CPL_ERROR_FILE_IO); cpl_test_null(plist); plist = cpl_propertylist_load_regexp("no.fits", 0, ".", 0); cpl_test_error(CPL_ERROR_FILE_IO); cpl_test_null(plist); plist = cpl_propertylist_load("/dev/null", 0); cpl_test_error(CPL_ERROR_BAD_FILE_FORMAT); cpl_test_null(plist); plist = cpl_propertylist_load_regexp("/dev/null", 0, ".", 0); cpl_test_error(CPL_ERROR_BAD_FILE_FORMAT); cpl_test_null(plist); plist = cpl_propertylist_load(filename3, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(plist); plist = cpl_propertylist_load_regexp(filename3, -1, ".", 0); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(plist); plist = cpl_propertylist_load(filename3, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(plist); plist = cpl_propertylist_load_regexp(filename3, -1, ".", 0); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(plist); plist = cpl_propertylist_load(filename3, value + 1); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(plist); plist = cpl_propertylist_load_regexp(filename3, value + 1, ".", 0); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(plist); plist = cpl_propertylist_load_regexp(filename3, 0, "\\", 0); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(plist); /* * Test 16: Append a property list to another. */ plist = cpl_propertylist_new(); _plist = cpl_propertylist_new(); cpl_propertylist_append_char(plist, keys[0], 'a'); cpl_propertylist_set_comment(plist, keys[0], comments[0]); cpl_propertylist_append_bool(plist, keys[1], 1); cpl_propertylist_set_comment(plist, keys[1], comments[1]); cpl_propertylist_append_int(plist, keys[2], -1); cpl_propertylist_set_comment(plist, keys[2], comments[2]); cpl_propertylist_append_long(plist, keys[3], 32768); cpl_propertylist_set_comment(plist, keys[3], comments[3]); cpl_propertylist_append_float(_plist, keys[4], fval0); cpl_propertylist_set_comment(_plist, keys[4], comments[4]); cpl_propertylist_append_double(_plist, keys[5], dval0); cpl_propertylist_set_comment(_plist, keys[5], comments[5]); cpl_propertylist_append_string(_plist, keys[6], comments[6]); cpl_propertylist_set_comment(_plist, keys[6], comments[6]); cpl_propertylist_append_float_complex(_plist, keys[7], zf0); cpl_propertylist_set_comment(_plist, keys[7], comments[7]); cpl_propertylist_append_double_complex(_plist, keys[8], zd0); cpl_propertylist_set_comment(_plist, keys[8], comments[8]); cpl_test_zero(cpl_propertylist_is_empty(plist)); cpl_test_eq(cpl_propertylist_get_size(plist), 4); cpl_test_zero(cpl_propertylist_is_empty(_plist)); cpl_test_eq(cpl_propertylist_get_size(_plist), 5); code = cpl_propertylist_append(plist, _plist); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_zero(cpl_propertylist_is_empty(plist)); cpl_test_eq(cpl_propertylist_get_size(plist), nprops); cpl_test_zero(cpl_propertylist_is_empty(_plist)); cpl_test_eq(cpl_propertylist_get_size(_plist), 5); for (i = 0; i < cpl_propertylist_get_size(plist); i++) { cpl_property *p = cpl_propertylist_get(plist, i); cpl_test_eq_string(cpl_property_get_name(p), keys[i]); cpl_test_eq_string(cpl_property_get_comment(p), comments[i]); cpl_test_eq(cpl_property_get_type(p), types[i]); cpl_test(cpl_propertylist_has(plist, keys[i])); cpl_test_eq_string(cpl_propertylist_get_comment(plist, keys[i]), comments[i]); cpl_test_eq(cpl_propertylist_get_type(plist, keys[i]), types[i]); } /* * Test 17: Sequentially access the elements of a property list */ /* First element */ /* pro = cpl_propertylist_get_first(plist); cpl_test_nonnull(pro); cpl_test_eq_string(cpl_property_get_name(pro), keys[0]); cpl_test_eq_string(cpl_property_get_comment(pro), comments[0]); cpl_test_eq(cpl_property_get_type(pro), types[0]);*/ /* * Test 18: Loop through all elements except the first, * and check the results. */ /* for (i = 1; i < cpl_propertylist_get_size(plist); i++) { cpl_property *p = cpl_propertylist_get_next(plist); cpl_test_eq_string(cpl_property_get_name(p), keys[i]); cpl_test_eq_string(cpl_property_get_comment(p), comments[i]); cpl_test_eq(cpl_property_get_type(p), types[i]); cpl_test_assert(cpl_propertylist_has(plist, keys[i])); cpl_test_zero(strcmp(cpl_propertylist_get_comment(plist, keys[i]), comments[i])); cpl_test_eq(cpl_propertylist_get_type(plist, keys[i]), types[i]); }*/ /* * Test 19: Try to access the next element and see * if the end of list is handled properly. */ /* pro = cpl_propertylist_get_next(plist); cpl_test_eq(pro, NULL);*/ /* * Test 20: Create a FITS header using a list containing a property with * a name of length 80 characters (the length of a FITS card) */ cpl_propertylist_empty(plist); code = cpl_propertylist_append_string(plist, longname, comments[6]); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_propertylist_delete(_plist); _plist = NULL; cpl_propertylist_delete(plist); plist = NULL; /* * Test 21: Sort a property list */ plist = cpl_propertylist_new(); cpl_test_nonnull(plist); cpl_test(cpl_propertylist_is_empty(plist)); cpl_test_zero(cpl_propertylist_get_size(plist)); for(i = 0; i < 1; i++) { cpl_propertylist_append_int(plist, "FDEBACGH", -1); cpl_propertylist_set_comment(plist, "FDEBACGH", comments[2]); cpl_propertylist_append_char(plist, "CDEFGB1", 'a'); cpl_propertylist_set_comment(plist, "CDEFGB1", comments[0]); cpl_propertylist_append_bool(plist, "ABCDEFGH", 1); cpl_propertylist_set_comment(plist, "ABCDEFGH", comments[1]); cpl_propertylist_append_float(plist, "ZZZGDBCA", fval0); cpl_propertylist_set_comment(plist, "ZZZGDBCA", comments[4]); cpl_propertylist_append_string(plist, "BBBBB2", comments[6]); cpl_propertylist_set_comment(plist, "BBBBB2", comments[6]); cpl_propertylist_append_long(plist, "HISTORY", 32768); cpl_propertylist_set_comment(plist, "HISTORY", comments[3]); cpl_propertylist_append_int(plist, "HISTORY", 0); cpl_propertylist_set_comment(plist, "HISTORY", comments[3]); cpl_propertylist_append_double(plist, "HISTORY", dval0); cpl_propertylist_set_comment(plist, "HISTORY", comments[5]); } cpl_test_zero(cpl_propertylist_is_empty(plist)); cpl_test_eq(cpl_propertylist_get_size(plist), 8); code = cpl_propertylist_sort(plist, cpl_test_property_compare_name); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_propertylist_delete(plist); /* * Test 21a: Save a propertylist which contains a HISTORY * field without a value */ plist = cpl_propertylist_new(); cpl_propertylist_append_string(plist, "HISTORY", "HELLO"); cpl_propertylist_append_string(plist, "HISTORY", "WORLD"); cpl_propertylist_append_string(plist, "HISTORY", ""); cpl_propertylist_append_string(plist, "HISTORY", "HELLO"); cpl_propertylist_append_string(plist, "HISTORY", "AGAIN"); cpl_propertylist_append_string(plist, "COMMENT", "HELLO"); cpl_propertylist_append_string(plist, "COMMENT", "WORLD"); cpl_propertylist_append_string(plist, "COMMENT", ""); cpl_propertylist_append_string(plist, "COMMENT", "HELLO"); cpl_propertylist_append_string(plist, "COMMENT", "AGAIN"); cpl_test_error(CPL_ERROR_NONE); t = cpl_table_new(1); code = cpl_table_save(t, plist, NULL, BASE "_21a.fits", CPL_IO_CREATE); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_fits(BASE "_21a.fits"); cpl_propertylist_delete(plist); cpl_table_delete(t); /* * Test 21b: load plist from an image and sort it. * This test was compared with result from cpl_propertylist_sort(). * Results are expected to be the same. */ plist = cpl_propertylist_load(BASE "_image.fits", 0); if (plist == NULL) { cpl_test_error(CPL_ERROR_FILE_IO); } else { /* Inactive per default */ code = cpl_propertylist_sort(plist, cpl_test_property_compare_name); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_save(NULL, BASE "_sorted.fits", CPL_TYPE_UCHAR, plist, CPL_IO_CREATE); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_fits(BASE "_sorted.fits"); cpl_test_zero(remove(BASE "_sorted.fits")); cpl_propertylist_delete(plist); } /* * Test 21c: Save a very long property list into a FITS file */ plist = cpl_propertylist_new(); cpl_test_nonnull(plist); cpl_test(cpl_propertylist_is_empty(plist)); cpl_test_zero(cpl_propertylist_get_size(plist)); bench_size = do_bench ? 100000 : 10000; for(i = 0; i < bench_size; i++) { cpl_propertylist_append_float(plist, keys[4], fval0); cpl_propertylist_set_comment(plist, keys[4], comments[4]); cpl_propertylist_append_int(plist, keys[2], -1); cpl_propertylist_set_comment(plist, keys[2], comments[2]); cpl_propertylist_append_char(plist, keys[0], 'a'); cpl_propertylist_set_comment(plist, keys[0], comments[0]); cpl_propertylist_append_bool(plist, keys[1], 1); cpl_propertylist_set_comment(plist, keys[1], comments[1]); cpl_propertylist_append_string(plist, keys[6], comments[6]); cpl_propertylist_set_comment(plist, keys[6], comments[6]); cpl_propertylist_append_long(plist, keys[3], 32768); cpl_propertylist_set_comment(plist, keys[3], comments[3]); cpl_propertylist_append_double(plist, keys[5], dval0); cpl_propertylist_set_comment(plist, keys[5], comments[5]); cpl_propertylist_append_float_complex(plist, keys[7], fval0); cpl_propertylist_set_comment(plist, keys[7], comments[7]); cpl_propertylist_append_double_complex(plist, keys[8], dval0); cpl_propertylist_set_comment(plist, keys[8], comments[8]); } cpl_test_zero(cpl_propertylist_is_empty(plist)); cpl_test_eq(cpl_propertylist_get_size(plist), nprops * bench_size); remove(filename3); status = 0; fits_create_diskfile(&fptr, filename3, &status); cpl_test_zero(status); fits_create_img(fptr, 8, 0, naxes, &status); cpl_test_zero(status); code = cpl_propertylist_to_fitsfile(fptr, plist, NULL); cpl_test_eq_error(code, CPL_ERROR_NONE); fits_close_file(fptr, &status); cpl_test_zero(status); cpl_test_fits(filename3); cpl_propertylist_delete(plist); /* * Test 22: Save a property list into a FITS file using * cpl_propertylist_save() */ plist = cpl_propertylist_new(); cpl_propertylist_append_char(plist, keys[0], 'a'); cpl_propertylist_set_comment(plist, keys[0], comments[0]); cpl_propertylist_append_bool(plist, keys[1], 1); cpl_propertylist_set_comment(plist, keys[1], comments[1]); cpl_propertylist_append_int(plist, keys[2], -1); cpl_propertylist_set_comment(plist, keys[2], comments[2]); cpl_propertylist_append_long(plist, keys[3], 32768); cpl_propertylist_set_comment(plist, keys[3], comments[3]); cpl_propertylist_append_float(plist, keys[4], fval0); cpl_propertylist_set_comment(plist, keys[4], comments[4]); cpl_propertylist_append_double(plist, keys[5], dval0); cpl_propertylist_set_comment(plist, keys[5], comments[5]); cpl_propertylist_append_string(plist, keys[6], comments[6]); cpl_propertylist_set_comment(plist, keys[6], comments[6]); cpl_propertylist_append_float_complex(plist, keys[7], zf0); cpl_propertylist_set_comment(plist, keys[7], comments[7]); cpl_propertylist_append_double_complex(plist, keys[8], zd0); cpl_propertylist_set_comment(plist, keys[8], comments[8]); cpl_test_zero(cpl_propertylist_is_empty(plist)); cpl_test_eq(cpl_propertylist_get_size(plist), nprops); code = cpl_propertylist_save(plist, BASE "_22.fits", CPL_IO_CREATE); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_fits(BASE "_22.fits"); code = cpl_propertylist_save(plist, BASE "_22.fits", CPL_IO_APPEND); cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT); cpl_test_fits(BASE "_22.fits"); cpl_propertylist_update_string(plist, keys[6], "updated string"); code = cpl_propertylist_save(plist, BASE "_22.fits", CPL_IO_EXTEND); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_fits(BASE "_22.fits"); cpl_propertylist_delete(plist); /* * Save a NULL property list to an extension */ remove(BASE "_null.fits"); plist = cpl_propertylist_new(); code = cpl_propertylist_save(plist, BASE "_null.fits", CPL_IO_CREATE); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_fits(BASE "_null.fits"); code = cpl_propertylist_save(NULL, BASE "_null.fits", CPL_IO_EXTEND); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_fits(BASE "_null.fits"); cpl_propertylist_delete(plist); /* * Check that XTENSION is set to IMAGE */ plist = cpl_propertylist_load(BASE "_null.fits",1); cpl_test_eq_string("IMAGE", cpl_propertylist_get_string(plist, "XTENSION")); cpl_propertylist_delete(plist); /* * Test 23: Save a property list to a FITS file using * a regexp to remove keys */ remove(filename3); status = 0; fits_create_diskfile(&fptr, filename3, &status); cpl_test_zero(status); /* * Create simple HDU */ fits_create_img(fptr, 8, 0, naxes, &status); cpl_test_zero(status); plist = cpl_propertylist_new(); cpl_propertylist_append_char(plist, keys[0], 'a'); cpl_propertylist_set_comment(plist, keys[0], comments[0]); cpl_propertylist_append_bool(plist, keys[1], 1); cpl_propertylist_set_comment(plist, keys[1], comments[1]); cpl_propertylist_append_int(plist, keys[2], -1); cpl_propertylist_set_comment(plist, keys[2], comments[2]); cpl_propertylist_append_long(plist, "NBXIS1", 32768); cpl_propertylist_set_comment(plist, "NBXIS1", comments[3]); cpl_propertylist_append_float(plist, keys[4], fval0); cpl_propertylist_set_comment(plist, keys[4], comments[4]); cpl_propertylist_append_double(plist, keys[5], dval0); cpl_propertylist_set_comment(plist, keys[5], comments[5]); cpl_propertylist_append_string(plist, "HIERARCH ESO TEST1", "One string without any comment"); cpl_propertylist_append_string(plist, "HIERARCH ESO TEST2", "Two string without any comment"); cpl_propertylist_append_float_complex(plist, keys[7], zf0); cpl_propertylist_set_comment(plist, keys[7], comments[7]); cpl_propertylist_append_double_complex(plist, keys[8], zd0); cpl_propertylist_set_comment(plist, keys[8], comments[8]); cpl_propertylist_append_long(plist, "NBXIS2", 32769); cpl_propertylist_set_comment(plist, "NBXIS2", comments[3]); cpl_propertylist_append_string(plist, "HISTORY", "One history string without any comment"); cpl_propertylist_append_string(plist, "HISTORY", "Two history string without any comment"); cpl_propertylist_append_string(plist, "HISTORY", "Three history string without any comment"); #ifdef CPL_FITS_TEST_NON_STRING_HISTORY_COMMENT /* This will produce a pretty strange FITS header */ /* Check handling of HISTORY of non-string type */ cpl_propertylist_append_float(plist, "HISTORY", 4.0); /* Check handling of COMMENT of non-string type */ cpl_propertylist_append_float(plist, "COMMENT", 5.0); cpl_test_eq(cpl_propertylist_get_size(plist), 16); #else cpl_test_eq(cpl_propertylist_get_size(plist), 14); #endif cpl_test_zero(cpl_propertylist_is_empty(plist)); /* Remove the following keys from the saving HIERARCH ESO |NBXIS1|NBXIS2|HISTORY */ code = cpl_propertylist_to_fitsfile(fptr, plist, ")|("); cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT); code = cpl_propertylist_to_fitsfile(fptr, plist, to_rm); cpl_test_eq_error(code, CPL_ERROR_NONE); /* Pass a null regexp to the function*/ code = cpl_propertylist_to_fitsfile(fptr, plist, NULL); cpl_test_eq_error(code, CPL_ERROR_NONE); /* Pass an empty property list to the function */ cpl_propertylist_empty(plist); code = cpl_propertylist_to_fitsfile(fptr, plist, to_rm); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_propertylist_to_fitsfile(fptr, NULL, to_rm); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); code = cpl_propertylist_to_fitsfile(NULL, plist, to_rm); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); fits_close_file(fptr, &status); cpl_test_zero(status); cpl_test_fits(filename3); cpl_propertylist_delete(plist); plist = cpl_propertylist_load(filename3, 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(plist); /* * Test 24: Create a property list with compressed * keywords and save it in disk and in a table. * Check if compressed * keywords are removed after saving it. */ remove(BASE "_24.fits"); cpl_propertylist_empty(plist); cpl_propertylist_append_string(plist,"ZTENSION", "COMPRESSED_EMPTY"); cpl_propertylist_append_long(plist, "ZNAXIS", 2); cpl_propertylist_set_comment(plist, "ZNAXIS", "compressed NAXIS"); cpl_propertylist_append_long(plist, "ZNAXIS1", 2048); cpl_propertylist_set_comment(plist, "ZNAXIS1", "compressed NAXIS1"); cpl_propertylist_append_long(plist, "ZNAXIS2", 1024); cpl_propertylist_set_comment(plist, "ZNAXIS2", "compressed NAXIS2"); cpl_test_zero(cpl_propertylist_is_empty(plist)); cpl_test_eq(cpl_propertylist_get_size(plist), 4); /* Save it in disk and check if compression keywords are removed */ code = cpl_propertylist_save(plist, BASE "_24.fits", CPL_IO_CREATE); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_fits(BASE "_24.fits"); code = cpl_propertylist_save(plist, BASE "_24.fits", CPL_IO_EXTEND); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_fits(BASE "_24.fits"); // cpl_propertylist_delete(plist); /* primary header */ plist2 = cpl_propertylist_load(BASE "_24.fits", 0); cpl_test_zero(cpl_propertylist_has(plist2, "ZTENSION")); cpl_propertylist_delete(plist2); /* extension header */ plist2 = cpl_propertylist_load(BASE "_24.fits", 1); cpl_test_zero(cpl_propertylist_has(plist2, "ZNAXIS")); cpl_propertylist_delete(plist2); (void)remove(BASE "_24.fits"); t = cpl_table_new(1); /* Compressed keywords should be removed when saving table*/ code = cpl_table_save(t, plist, NULL, BASE "_24.fits", CPL_IO_CREATE); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_fits(BASE "_24.fits"); code = cpl_table_save(t, NULL, plist, BASE "_24.fits", CPL_IO_EXTEND); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_fits(BASE "_24.fits"); cpl_propertylist_delete(plist); /* Check if compressed keywords were removed from headers*/ plist = cpl_propertylist_load(BASE "_24.fits",1); cpl_test_zero(cpl_propertylist_has(plist, "ZTENSION")); cpl_test_zero(cpl_propertylist_has(plist, "ZNAXIS")); cpl_test_zero(cpl_propertylist_has(plist, "ZNAXIS1")); cpl_test_zero(cpl_propertylist_has(plist, "ZNAXIS2")); cpl_propertylist_delete(plist); plist = cpl_propertylist_load(BASE "_24.fits",2); cpl_test_zero(cpl_propertylist_has(plist, "ZTENSION")); cpl_test_zero(cpl_propertylist_has(plist, "ZNAXIS")); cpl_test_zero(cpl_propertylist_has(plist, "ZNAXIS1")); cpl_test_zero(cpl_propertylist_has(plist, "ZNAXIS2")); /* Test propertylist dump */ cpl_propertylist_dump(plist, stream); cpl_table_delete(t); cpl_propertylist_delete(plist); /* * Test 25: Test the new error message function */ plist = cpl_propertylist_load(BASE "_null.fits", 2); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); /* * Test 26: Verify that NANs cannot be saved */ cpl_propertylist_delete(plist); /* Could be non-NULL */ plist = cpl_propertylist_new(); cpl_test_zero(cpl_propertylist_append_double(plist, "NANKEY", 0.0/0.0)); /* Allow verification that the value is really NAN */ cpl_propertylist_dump(plist, stream); code = cpl_propertylist_save(plist, BASE "_26.fits", CPL_IO_CREATE); cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT); cpl_propertylist_empty(plist); /* * Test 26A: Verify that a (non-FITS) NaN cannot be loaded */ cpl_test_zero(cpl_propertylist_append_string(plist, "BADKEY", BADNUM)); cpl_test_zero(cpl_propertylist_save(plist, BASE "_26.fits", CPL_IO_CREATE)); cpl_test_fits(BASE "_26.fits"); cpl_propertylist_delete(plist); #ifdef CPL_NO_PERL plist = cpl_propertylist_load(BASE "_26.fits", 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_propertylist_get_type(plist, "BADKEY"), CPL_TYPE_STRING); cpl_propertylist_delete(plist); #else /* Need to close file due to non CPL access */ cpl_test_zero(cpl_io_fits_close(BASE "_26.fits", &status)); cpl_test_zero(status); cpl_test_eq(strlen(BADNUM), 3); /* For the below substitution to work */ /* Remove quotes from value in FITS card */ if (system("perl -pi -e 's/." BADNUM " ./ " BADNUM " /' " BASE "_26.fits") == 0) { /* The file is no longer valid FITS, and should not be loadable */ plist = cpl_propertylist_load(BASE "_26.fits", 0); cpl_test_error(CPL_ERROR_BAD_FILE_FORMAT); cpl_test_null(plist); } #endif /* * Test 26B: Verify that a complex number cannot be loaded */ plist = cpl_propertylist_new(); code = cpl_propertylist_append_string(plist, "BADKEY", COMPLEXVAL); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_zero(cpl_propertylist_save(plist, BASE "_26.fits", CPL_IO_CREATE)); cpl_test_fits(BASE "_26.fits"); cpl_propertylist_delete(plist); #ifdef CPL_NO_PERL plist = cpl_propertylist_load(BASE "_26.fits", 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_propertylist_get_type(plist, "BADKEY"), CPL_TYPE_STRING); #else /* Need to close file due to non CPL access */ cpl_test_zero(cpl_io_fits_close(BASE "_26.fits", &status)); cpl_test_zero(status); cpl_test_eq(strlen(COMPLEXVAL), 7); /* For the below substitution to work */ /* Replace quotes with parenthesis to form a complex number */ cpl_test_zero(system("perl -pi -e 's/\\047" COMPLEXVAL " \\047/(" COMPLEXVAL ") /' " BASE "_26.fits")); /* The file should still be valid FITS, but no longer loadable by CPL */ cpl_test_fits(BASE "_26.fits"); plist = cpl_propertylist_load(BASE "_26.fits", 0); cpl_test_error(CPL_ERROR_BAD_FILE_FORMAT); cpl_test_null(plist); /* - Except if the complex card is ignored */ plist = cpl_propertylist_load_regexp(BASE "_26.fits", 0, "BADKEY", 1); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(cpl_propertylist_has(plist, "BADKEY")); #endif cpl_propertylist_delete(plist); /* * Test 27: Append a property to a property list */ plist = cpl_propertylist_new(); /* Catch error code */ code = cpl_propertylist_append_property(plist, NULL); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); for(j = 0; j < 6; j++) { char *name = cpl_sprintf("HIERARCH ESO TEST%d APPEND", j); cpl_property *p = cpl_property_new(name, CPL_TYPE_INT); cpl_free(name); cpl_test_nonnull(p); cpl_test_zero(cpl_property_set_int(p, j+2)); cpl_test_zero(cpl_propertylist_append_property(plist, p)); cpl_property_delete(p); } cpl_test_eq(cpl_propertylist_get_size(plist),6); cpl_test_eq(cpl_propertylist_get_int(plist,"HIERARCH ESO TEST1 APPEND"),3); /* * Test 28: Prepend a property to a property list */ /* Catch error code */ code = cpl_propertylist_prepend_property(plist, NULL); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); for(j = 0; j < 3; j++) { char *name = cpl_sprintf("HIERARCH ESO TEST%d PREPEND",j); cpl_property *p = cpl_property_new(name,CPL_TYPE_STRING); cpl_free(name); cpl_test_nonnull(p); cpl_test_zero(cpl_property_set_string(p,"test prepend")); cpl_test_zero(cpl_propertylist_prepend_property(plist,p)); cpl_property_delete(p); } cpl_test_eq(cpl_propertylist_get_size(plist),9); /* Test 29: Insert a property into a property list */ code = cpl_propertylist_insert_property(plist, "HIERARCH ESO TEST0 APPEND", NULL); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); for(j = 0; j < 1; j++){ const char *name = "HIERARCH ESO TEST0 APPEND"; cpl_property *p = cpl_property_new("INSERT1", CPL_TYPE_FLOAT); cpl_property *p1 = cpl_property_new("INSERT2", CPL_TYPE_FLOAT); cpl_test_nonnull(p); cpl_test_nonnull(p1); cpl_test_zero(cpl_property_set_float(p, 1.0)); cpl_test_zero(cpl_propertylist_insert_property(plist,name,p)); cpl_test_zero(cpl_property_set_float(p1, 2.0)); cpl_test_zero(cpl_propertylist_insert_after_property(plist,name,p1)); cpl_property_delete(p); cpl_property_delete(p1); } cpl_test_eq(cpl_propertylist_get_size(plist),11); // cpl_propertylist_dump(plist,stdout); cpl_propertylist_delete(plist); /* * Test 30: Test the casting on the float and double accessors */ plist = cpl_propertylist_new(); cpl_test_zero(cpl_propertylist_update_string(plist,"C","String")); cpl_test_zero(cpl_propertylist_update_int(plist,"I",8)); f0 = 235.89; cpl_test_zero(cpl_propertylist_update_float(plist,"F",f0)); d0 = 1234.9994048; cpl_test_zero(cpl_propertylist_update_double(plist,"D",d0)); cpl_test_zero(cpl_propertylist_save(plist,BASE "_30.fits",CPL_IO_CREATE)); cpl_test_fits(BASE "_30.fits"); cpl_propertylist_delete(plist); plist = cpl_propertylist_load(BASE "_30.fits",0); cpl_test_nonnull(plist); /* The float keyword is casted to double when loaded from disk */ t1 = cpl_propertylist_get_type(plist,"F"); cpl_test_eq(t1,CPL_TYPE_DOUBLE); /* Test that the casting in cpl works */ f1 = cpl_propertylist_get_float(plist, "F"); cpl_test_error(CPL_ERROR_NONE); d1 = cpl_propertylist_get_double(plist, "F"); cpl_test_error(CPL_ERROR_NONE); f2 = cpl_propertylist_get_float(plist,"D"); cpl_test_error(CPL_ERROR_NONE); d2 = cpl_propertylist_get_double(plist, "D"); cpl_test_error(CPL_ERROR_NONE); /* Test the values */ cpl_test_abs(f0, f1, 0.0); cpl_test_abs(d0, d2, 0.0); cpl_test_rel(d1, f1, FLT_EPSILON); cpl_test_rel(d2, f2, FLT_EPSILON); /* * Test 31: Verify the truncation of a long string in I/O */ cpl_propertylist_empty(plist); code = cpl_propertylist_append_string(plist, "ESO PRO REC1 PIPE ID", LONGNAME80); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_propertylist_save(plist, BASE "_31.fits", CPL_IO_CREATE); cpl_test_fits(BASE "_31.fits"); plist2 = cpl_propertylist_load(BASE "_31.fits", 0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_nonnull(plist2); strval = cpl_propertylist_get_string(plist2, "ESO PRO REC1 PIPE ID"); cpl_test_nonnull(strval); if (strval != NULL) { value = strlen(strval); cpl_test_leq(value, 80); cpl_test_zero(strncmp(strval, LONGNAME80, value)); } cpl_propertylist_delete(plist2); cpl_propertylist_empty(plist); /* * Test 32: Verify the handling of setting a string property to NULL */ code = cpl_propertylist_update_string(plist, keys[6], NULL); cpl_test_eq_error(CPL_ERROR_NULL_INPUT, code); code = cpl_propertylist_append_string(plist, keys[6], comments[6]); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_propertylist_set_string(plist, keys[6], NULL); cpl_test_eq_error(CPL_ERROR_NULL_INPUT, code); code = cpl_propertylist_insert_string(plist, keys[6], keys[6 + nprops], NULL); cpl_test_eq_error(CPL_ERROR_NULL_INPUT, code); code = cpl_propertylist_insert_after_string(plist, keys[6], keys[6 + nprops], NULL); cpl_test_eq_error(CPL_ERROR_NULL_INPUT, code); code = cpl_propertylist_prepend_string(plist, keys[6], NULL); cpl_test_eq_error(CPL_ERROR_NULL_INPUT, code); cpl_propertylist_delete(plist); if (stream != stdout) cpl_test_zero( fclose(stream) ); /* * All tests done */ return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Compare two properties @param p1 First property to compare @param p2 Second property to compare @return An integer less than, equal to, or greater than zero if the name of p1 is found, respectively, to be less than, to match, or be greater than that of p2. @see cpl_property_get_name(), strcmp() */ /*----------------------------------------------------------------------------*/ static int cpl_test_property_compare_name( const cpl_property * p1, const cpl_property * p2) { /* * Compare the two properties */ return strcmp(cpl_property_get_name(p1), cpl_property_get_name(p2)); } cpl-6.4.1/cplcore/tests/cpl_image_bpm-test.c0000644000460300003120000002143412247045553015715 00000000000000/* $Id: cpl_image_bpm-test.c,v 1.27 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.27 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image_bpm.h" #include "cpl_image_gen.h" #include "cpl_image_io.h" #include "cpl_mask.h" #include "cpl_test.h" #include "cpl_memory.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef IMAGESZ #define IMAGESZ 512 #endif /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_image_bpm_reject_value_test(void); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_image * img; const cpl_mask * tmp_map; cpl_mask * map; const int nx = 10; const int ny = 10; const int nbad = 10; /* the bad pixels positions */ const int bad_pos_x[] = {4, 5, 6, 4, 5, 6, 4, 5, 6, 8}; const int bad_pos_y[] = {5, 5, 5, 6, 6, 6, 7, 7, 7, 9}; cpl_error_code error; int i; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ /* Generate test image */ cpl_msg_info(cpl_func, "Create a DOUBLE %dx%d test image", nx, ny); img = cpl_image_fill_test_create(nx, ny); tmp_map = cpl_image_get_bpm_const(img); cpl_test_error(CPL_ERROR_NONE); cpl_test_null(tmp_map); /* Cause the bpm to be created */ map = cpl_image_get_bpm(img); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(map); /* Set some bad pixels */ cpl_msg_info(cpl_func, "Set %d bad pixels in the test image", nbad); for (i=0; i #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef IMAGESZ #define IMAGESZ 512 #endif #ifndef MASKSZ #define MASKSZ 8 #endif #define FILENAME "cpl_mask_test.fits" /*----------------------------------------------------------------------------- Private functions -----------------------------------------------------------------------------*/ static cpl_error_code cpl_mask_shift_bf(cpl_mask *, int, int, cpl_binary); static cpl_error_code cpl_mask_shift_filter(cpl_mask *, int, int, cpl_filter_mode); static void cpl_mask_flip_turn_test(const cpl_mask *); static void cpl_mask_shift_test(int, int); static void cpl_mask_test(cpl_boolean); static void cpl_mask_filter_test(int); static void cpl_mask_filter_test_schalkoff(void); static void cpl_mask_filter_test_matrix(int); static void cpl_mask_filter_bench(int, int, int, int, int, int); static void cpl_mask_count_bench(int, int); static cpl_error_code cpl_mask_closing_matrix(cpl_mask *, const cpl_matrix *); static cpl_error_code cpl_mask_opening_matrix(cpl_mask *, const cpl_matrix *); static cpl_error_code cpl_mask_erosion_matrix(cpl_mask *, const cpl_matrix *); static cpl_error_code cpl_mask_dilation_matrix(cpl_mask *, const cpl_matrix *); static cpl_error_code cpl_mask_fill_test(cpl_mask *, double); static cpl_error_code cpl_mask_fill_border(cpl_mask *, int, int, cpl_binary); static cpl_error_code cpl_mask_filter_bf(cpl_mask *, const cpl_mask *, const cpl_mask *, cpl_filter_mode, cpl_border_mode); static void cpl_mask_erosion_bf(cpl_binary *, const cpl_binary *, const cpl_binary *, int, int, int, int, cpl_border_mode); static void cpl_mask_dilation_bf(cpl_binary *, const cpl_binary *, const cpl_binary *, int, int, int, int, cpl_border_mode); static void cpl_mask_opening_bf(cpl_binary *, const cpl_binary *, const cpl_binary *, int, int, int, int, cpl_border_mode); static void cpl_mask_closing_bf(cpl_binary *, const cpl_binary *, const cpl_binary *, int, int, int, int, cpl_border_mode); static double tshift = 0.0; static double tshiftbf = 0.0; static double tshiftfl = 0.0; static double tshiftb2 = 0.0; /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_mask * bin1, * bin2, * bin1_dup; cpl_mask * null; cpl_image * labels1, * labels2; int count; cpl_size nb_objs1, nb_objs2; const cpl_size new_pos[] = {1,2,3,4}; const int nsize = IMAGESZ; cpl_binary * bins; cpl_error_code error; cpl_boolean do_bench; FILE * stream; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); do_bench = cpl_msg_get_level() <= CPL_MSG_INFO ? CPL_TRUE : CPL_FALSE; stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; /* Insert tests below */ cpl_test_nonnull( stream ); if (do_bench) { cpl_mask_count_bench(1024, 1000); } else { cpl_mask_count_bench(10, 1); } cpl_mask_filter_test_schalkoff(); cpl_mask_filter_test(IMAGESZ); cpl_mask_filter_bench(do_bench ? 1024 : 32, do_bench ? 3 : 1, 0, 1, 0, 0); cpl_mask_filter_bench(do_bench ? 1024 : 32, do_bench ? 3 : 1, 0, 1, 1, 1); cpl_mask_filter_bench(do_bench ? 1024 : 32, do_bench ? 3 : 1, 0, 1, 2, 2); cpl_mask_filter_bench(do_bench ? 1024 : 32, do_bench ? 3 : 1, 0, 1, 3, 3); cpl_mask_filter_bench(do_bench ? 1024 : 32, do_bench ? 3 : 1, 2, 3, 0, 0); cpl_mask_filter_bench(do_bench ? 1024 : 32, do_bench ? 3 : 1, 2, 3, 1, 1); cpl_mask_filter_bench(do_bench ? 1024 : 32, do_bench ? 3 : 1, 2, 3, 2, 2); cpl_mask_filter_bench(do_bench ? 1024 : 32, do_bench ? 3 : 1, 2, 3, 3, 3); cpl_mask_filter_test_matrix(2); cpl_mask_filter_test_matrix(do_bench ? IMAGESZ/4 : 32); cpl_mask_test(do_bench); cpl_mask_shift_test(1, 1); cpl_mask_shift_test(1, 2); cpl_mask_shift_test(2, 1); cpl_mask_shift_test(2, 2); cpl_mask_shift_test(MASKSZ, 1); cpl_mask_shift_test(1, MASKSZ); cpl_mask_shift_test(MASKSZ, 2); cpl_mask_shift_test(2, MASKSZ); cpl_mask_shift_test(MASKSZ, 3); cpl_mask_shift_test(3, MASKSZ); cpl_mask_shift_test(MASKSZ, MASKSZ); if (do_bench) { cpl_mask_shift_test(IMAGESZ/4, 4 * MASKSZ); } cpl_msg_info(cpl_func, "Time to shift [s]: %g <=> %g (brute force)", tshift, tshiftbf); cpl_msg_info(cpl_func, "Time to filter shift [s]: %g <=> %g (brute force)", tshiftfl, tshiftb2); /* Create test image */ cpl_msg_info("","Create a %dx%d test image", nsize, nsize); bin1 = cpl_mask_new(nsize, nsize); cpl_test_nonnull(bin1); error = cpl_mask_fill_test(bin1, 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_mask_is_empty(bin1)); cpl_mask_flip_turn_test(bin1); /* Test wrap / unwrap */ bins = cpl_calloc(100, sizeof(cpl_binary)); bin2 = cpl_mask_wrap(10, 10, bins); cpl_test(cpl_mask_is_empty(bin2)); cpl_mask_delete(bin2); bins = cpl_calloc(100, sizeof(cpl_binary)); bin2 = cpl_mask_wrap(10, 10, bins); cpl_test(cpl_mask_is_empty(bin2)); cpl_test_eq_ptr(bins, cpl_mask_unwrap(bin2)); cpl_free(bins); /* Binarize the image with a second threshold */ bin2 = cpl_mask_new(nsize, nsize); cpl_test_nonnull(bin2); error = cpl_mask_fill_test(bin2, 5.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_mask_is_empty(bin2)); /* Test cpl_mask_get() */ /* Test cpl_mask_set() */ count = cpl_mask_count(bin1); if (cpl_mask_get(bin1, 1, 1) == CPL_BINARY_0) { cpl_test_zero(cpl_mask_count_window(bin1, 1, 1, 1, 1)); cpl_mask_set(bin1, 1, 1, CPL_BINARY_1); cpl_test_eq(cpl_mask_count(bin1), count + 1); cpl_test_eq(cpl_mask_count_window(bin1, 1, 1, 1, 1), 1); } else { cpl_test_eq(cpl_mask_count_window(bin1, 1, 1, 1, 1), 1); cpl_mask_set(bin1, 1, 1, CPL_BINARY_0); cpl_test_eq(cpl_mask_count(bin1), count - 1); cpl_test_zero(cpl_mask_count_window(bin1, 1, 1, 1, 1)); /* Later a non-zero mask is required */ cpl_mask_set(bin1, 1, 1, CPL_BINARY_1); } /* Test error handling of cpl_mask_set() */ error = cpl_mask_set(NULL, 1, 1, CPL_BINARY_1); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_mask_set(bin1, 0, 1, CPL_BINARY_1); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_mask_set(bin1, 1, 0, CPL_BINARY_1); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_mask_set(bin1, 1, 1+nsize, CPL_BINARY_1); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_mask_set(bin1, 1+nsize, 1, CPL_BINARY_1); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_mask_set(bin1, 1, 1, (cpl_binary)-1); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Compute number of selected pixels */ cpl_test_eq(cpl_mask_count(bin1), cpl_mask_count_window(bin1, 1, 1, nsize, nsize)); /* Test cpl_mask_duplicate() */ bin1_dup = cpl_mask_duplicate(bin1); cpl_test_eq_mask(bin1, bin1_dup); cpl_test_eq(cpl_mask_is_empty(bin1), cpl_mask_is_empty(bin1_dup)); cpl_test_eq(cpl_mask_count(bin1), cpl_mask_count(bin1_dup)); /* Test error handling of cpl_mask_collapse_create() */ null = cpl_mask_collapse_create(NULL, 0); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(null); null = cpl_mask_collapse_create(bin1, 2); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(null); null = cpl_mask_collapse_create(bin1, -1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(null); /* Test cpl_mask_turn() */ /* Rotate the mask all the way around */ cpl_test(cpl_mask_turn(bin1, 9) == CPL_ERROR_NONE); cpl_test(cpl_mask_turn(bin1, 6) == CPL_ERROR_NONE); cpl_test(cpl_mask_turn(bin1, -13) == CPL_ERROR_NONE); cpl_test(cpl_mask_turn(bin1, 10) == CPL_ERROR_NONE); cpl_test(cpl_mask_turn(bin1, 4) == CPL_ERROR_NONE); cpl_test_eq_mask(bin1, bin1_dup); /* Compare to its copy */ cpl_test_zero(cpl_mask_xor(bin1_dup, bin1)); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(cpl_mask_count(bin1_dup)); cpl_test_eq(cpl_mask_is_empty(bin1_dup), CPL_TRUE); cpl_mask_delete(bin1_dup); error = cpl_mask_save(bin1, FILENAME, NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_mask_save(bin1, FILENAME, NULL, CPL_IO_EXTEND); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(FILENAME); cpl_test_eq(cpl_fits_count_extensions(FILENAME), 1); bin1_dup = cpl_mask_load(FILENAME, 0, 1); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq_mask(bin1, bin1_dup); cpl_mask_delete(bin1_dup); bin1_dup = cpl_mask_load_window(FILENAME, 0, 1, 1, 1, nsize, nsize ); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq_mask(bin1, bin1_dup); cpl_mask_delete(bin1_dup); cpl_test_zero( remove(FILENAME) ); /* Labelize the binary maps */ labels1 = cpl_image_labelise_mask_create(bin1, &nb_objs1); cpl_test_nonnull(labels1); cpl_msg_info("","Labelize bin1 ---> %" CPL_SIZE_FORMAT " objects found", nb_objs1); labels2 = cpl_image_labelise_mask_create(bin2, &nb_objs2); cpl_test_nonnull(labels2); cpl_msg_info("","Labelize bin2 ---> %" CPL_SIZE_FORMAT " objects found", nb_objs2); /* sprintf(outname, "labelized1.fits"); */ /* cpl_image_save(labels1, outname, CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE); */ /* sprintf(outname, "labelized2.fits"); */ /* cpl_image_save(labels2, outname, CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE); */ cpl_image_delete(labels1); cpl_image_delete(labels2); /* The following tests need to be done on a non-empty mask */ cpl_test_zero(cpl_mask_is_empty(bin2)); cpl_test_zero(cpl_mask_set(bin1, IMAGESZ, IMAGESZ, CPL_BINARY_1)); cpl_test_zero(cpl_mask_set(bin2, IMAGESZ, IMAGESZ, CPL_BINARY_0)); /* Test cpl_mask_and */ cpl_test_zero(cpl_mask_and(bin1, bin2)); cpl_test_error(CPL_ERROR_NONE); cpl_test_leq(cpl_mask_count(bin1), cpl_mask_count(bin2)); /* Test cpl_mask_or */ cpl_test_zero(cpl_mask_or(bin1, bin2)); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq_mask(bin1, bin2); /* Test cpl_mask_not */ cpl_test_zero(cpl_mask_not(bin2)); cpl_test_error(CPL_ERROR_NONE); /* Test cpl_mask_xor */ cpl_test_zero(cpl_mask_xor(bin1, bin2)); cpl_test_error(CPL_ERROR_NONE); /* bin1 is now all ones... */ /* Test cpl_mask_copy() */ cpl_test_zero(cpl_mask_copy(bin2, bin1, 1, 1)); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq_mask(bin1, bin2); cpl_test_zero(cpl_mask_not(bin2)); cpl_test_error(CPL_ERROR_NONE); cpl_test(cpl_mask_is_empty(bin2)); /* Test error handling in cpl_mask_copy() */ error = cpl_mask_copy(NULL, bin2, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_mask_copy(bin1, NULL, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_mask_copy(bin2, bin1, 0, 1); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_mask_copy(bin2, bin1, 1, 0); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_mask_copy(bin2, bin1, nsize+1, 1); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_mask_copy(bin2, bin1, 1, nsize+1); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); cpl_mask_delete(bin2); /* Test cpl_mask_extract() */ bin2 = cpl_mask_extract(bin1, 1, 1, 1, 1); cpl_test_nonnull(bin2); cpl_test_eq(cpl_mask_get_size_x(bin2), 1); cpl_test_eq(cpl_mask_get_size_y(bin2), 1); cpl_mask_delete(bin2); /* Test cpl_mask_shift() */ cpl_test_zero(cpl_mask_shift(bin1, 1, 1)); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(cpl_mask_set(bin1, IMAGESZ, IMAGESZ, CPL_BINARY_1)); cpl_test_zero(cpl_mask_is_empty(bin1)); if (IMAGESZ % 2 == 0) { /* Test cpl_mask_move() */ cpl_test_zero(cpl_mask_move(bin1, 2, new_pos)); cpl_test_error(CPL_ERROR_NONE); } /* Test cpl_mask_extract_subsample() */ bin2 = cpl_mask_extract_subsample(bin1, 2, 2); cpl_test_nonnull(bin2); cpl_test_zero(cpl_mask_dump_window(bin1, 1, 1, MASKSZ/2, MASKSZ/2, stream)); cpl_test_zero(cpl_mask_dump_window(bin2, 1, 1, 1, 1, stream)); error = cpl_mask_dump_window(bin2, 1, 1, IMAGESZ, MASKSZ, stream); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); error = cpl_mask_dump_window(bin2, 1, 1, MASKSZ, IMAGESZ, stream); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); error = cpl_mask_dump_window(bin2, 0, 1, MASKSZ, MASKSZ, stream); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); error = cpl_mask_dump_window(bin2, 1, 0, MASKSZ, MASKSZ, stream); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); error = cpl_mask_dump_window(NULL, 1, 1, MASKSZ, MASKSZ, stream); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_mask_dump_window(bin1, 1, 1, MASKSZ, MASKSZ, NULL); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); cpl_mask_delete(bin1); cpl_mask_delete(bin2); if (stream != stdout) cpl_test_zero( fclose(stream) ); /* End of tests */ return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Shift a mask using brute force @param in mask to shift @param x_shift shift to apply in x @param y_shift shift to apply in y @param edge_fill The value to fill at the border @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_shift() */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_mask_shift_bf(cpl_mask * in, int x_shift, int y_shift, cpl_binary edge_fill) { int xs_abs, ys_abs; cpl_mask * loc; cpl_binary * ploc; cpl_binary * pin; int i, j; const int nx = cpl_mask_get_size_x(in); const int ny = cpl_mask_get_size_y(in); /* Initialise */ xs_abs = abs(x_shift); ys_abs = abs(y_shift); /* Check entries */ cpl_ensure_code(in != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code((xs_abs=0) && (i-x_shift=0) && (j-y_shift time0) tshift += time1 - time0; time0 = cpl_test_get_cputime(); cpl_test_zero(cpl_mask_shift_bf(mask2, i, j, CPL_BINARY_1)); time1 = cpl_test_get_cputime(); if (time1 > time0) tshiftbf += time1 - time0; cpl_test_eq_mask(mask1, mask2); if (4 * abs(i) < m && 4 * abs(j) < n) { const cpl_filter_mode filter[] = {CPL_FILTER_EROSION, CPL_FILTER_DILATION}; const size_t nfilter = sizeof(filter)/sizeof(*filter); size_t k; for (k = 0; k < nfilter; k++) { cpl_mask_copy(mask1, mask0, 1, 1); cpl_mask_fill_border(mask1, 2 * abs(i), 2 * abs(j), CPL_BINARY_0); cpl_mask_copy(mask2, mask1, 1, 1); time0 = cpl_test_get_cputime(); error = cpl_mask_shift_filter(mask1, i, j, filter[k]); cpl_test_eq_error(error, CPL_ERROR_NONE); time1 = cpl_test_get_cputime(); if (time1 > time0) tshiftfl += time1 - time0; time0 = cpl_test_get_cputime(); cpl_mask_shift_bf(mask2, i, j, CPL_BINARY_0); time1 = cpl_test_get_cputime(); if (time1 > time0) tshiftb2 += time1 - time0; cpl_test_eq_mask(mask1, mask2); } } } } cpl_mask_delete(mask1); cpl_mask_delete(mask2); } cpl_mask_delete(mask0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Fill the mask with a test mask @param self Mask to be filled @param threshold Binarization threshold @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_mask_fill_test(cpl_mask * self, double threshold) { const int nx = cpl_mask_get_size_x(self); const int ny = cpl_mask_get_size_y(self); cpl_image * img = cpl_image_fill_test_create(nx, ny); double med_dist; /* Compute the median and the mean dist. to the median of the image */ const double median = cpl_image_get_median_dev(img, &med_dist); const double minval = median + threshold * med_dist; cpl_mask * other = cpl_mask_threshold_image_create(img, minval, DBL_MAX); cpl_ensure_code(img != NULL, cpl_error_get_code()); cpl_image_delete(img); cpl_ensure_code(!cpl_mask_copy(self, other, 1, 1), cpl_error_get_code()); cpl_mask_delete(other); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Fill the mask border @param self Mask to be filled at the border @param hx Number of borders columns to fill @param hy Number of borders rows to fill @param fill Value to use in fill @param threshold Binarization threshold @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_mask_fill_border(cpl_mask * self, int hx, int hy, cpl_binary fill) { const int nx = cpl_mask_get_size_x(self); const int ny = cpl_mask_get_size_y(self); cpl_binary * pself = cpl_mask_get_data(self); int j; cpl_ensure_code(pself != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(hx >= 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(hy >= 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(2 * hx <= nx, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(2 * hy <= ny, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(fill == CPL_BINARY_0 || fill == CPL_BINARY_1, CPL_ERROR_ILLEGAL_INPUT); /* Modified from cpl_mask_erosion_() */ /* Handle border for first hy rows and first hx elements of next row */ (void)memset(pself, fill, hx + hy * nx); /* self-col now indexed from -hy to hy */ pself += hy * nx; for (j = hy; j < ny-hy; j++, pself += nx) { if (j > hy) { /* Do also last hx border elements of previous row */ (void)memset(pself - hx, fill, 2 * hx); } } /* Do also last hx border elements of previous row */ (void)memset(pself - hx, fill, hx + hy * nx); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @param do_bench True iff benchmarking is enabled @brief Test various cpl_mask functions @return void */ /*----------------------------------------------------------------------------*/ static void cpl_mask_test(cpl_boolean do_bench) { const int npix[] = {1, 2, 3, 5, 10, 11, do_bench ? 2*IMAGESZ : 13}; const cpl_binary buf9[] = {CPL_BINARY_1, CPL_BINARY_0, CPL_BINARY_1, CPL_BINARY_0, CPL_BINARY_0, CPL_BINARY_1, CPL_BINARY_1, CPL_BINARY_0, CPL_BINARY_1}; /* Rotation 90 degrees clockwise */ const cpl_binary rot9[] = {CPL_BINARY_1, CPL_BINARY_1, CPL_BINARY_1, CPL_BINARY_0, CPL_BINARY_0, CPL_BINARY_0, CPL_BINARY_1, CPL_BINARY_0, CPL_BINARY_1}; /* This mask is not modified while wrapping around this buffer */ cpl_mask * ref = cpl_mask_wrap(3, 3, (cpl_binary*)rot9); cpl_mask * raw = cpl_mask_new(3, 3); cpl_error_code error; size_t ipix; double tflip = 0.0; double tturn = 0.0; double tassi = 0.0; double tcol0 = 0.0; double tcol1 = 0.0; /* Test 1: Verify direction of 90 degree rotation */ cpl_test_nonnull(memcpy(cpl_mask_get_data(raw), buf9, 9*sizeof(cpl_binary))); cpl_test_zero(cpl_mask_turn(raw, 1)); cpl_test_eq_mask(raw, ref); cpl_mask_delete(raw); (void)cpl_mask_unwrap(ref); /* Test 2: Check error handling */ error = cpl_image_turn(NULL, 1); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); /* Test 3: Verify consistency of rotations across types */ for (ipix = 0; ipix < sizeof(npix)/sizeof(npix[0]); ipix++) { const int nx = npix[ipix]; size_t jpix; for (jpix = 0; jpix < sizeof(npix)/sizeof(npix[0]); jpix++) { const int ny = npix[jpix]; cpl_image * noise = cpl_image_new(nx, ny, CPL_TYPE_FLOAT); cpl_mask * collapsed; double ttemp0, ttemp1; int i; cpl_test_zero(cpl_image_fill_noise_uniform(noise, (double)-ny, (double)nx)); /* About 1/4 of the pixels are flagged */ raw = cpl_mask_threshold_image_create(noise, -0.25*ny, 0.25*nx); cpl_image_delete(noise); ref = cpl_mask_extract(raw, 1, 1, nx, ny); ttemp0 = cpl_test_get_cputime(); /* Turn the mask all the way around */ cpl_test_zero(cpl_mask_turn(raw, 1)); cpl_test_zero(cpl_mask_turn(raw, 2)); cpl_test_zero(cpl_mask_turn(raw, 3)); cpl_test_zero(cpl_mask_turn(raw, 4)); cpl_test_zero(cpl_mask_turn(raw,-1)); cpl_test_zero(cpl_mask_turn(raw,-2)); cpl_test_zero(cpl_mask_turn(raw,-3)); cpl_test_zero(cpl_mask_turn(raw, 0)); ttemp1 = cpl_test_get_cputime(); if (ttemp1 > ttemp0) tturn += ttemp1 - ttemp0; cpl_test_eq_mask(raw, ref); ttemp0 = cpl_test_get_cputime(); /* Flip the mask all the way around */ cpl_test_zero(cpl_mask_flip(raw, 0)); cpl_test_zero(cpl_mask_flip(raw, 1)); cpl_test_zero(cpl_mask_flip(raw, 2)); cpl_test_zero(cpl_mask_flip(raw, 3)); cpl_test_zero(cpl_mask_flip(raw, 0)); cpl_test_zero(cpl_mask_flip(raw, 1)); cpl_test_zero(cpl_mask_flip(raw, 2)); cpl_test_zero(cpl_mask_flip(raw, 3)); ttemp1 = cpl_test_get_cputime(); if (ttemp1 > ttemp0) tflip += ttemp1 - ttemp0; cpl_test_eq_mask(raw, ref); ttemp0 = cpl_test_get_cputime(); cpl_test_zero(cpl_mask_or(raw, ref)); cpl_test_eq_mask(raw, ref); cpl_test_zero(cpl_mask_and(raw, ref)); cpl_test_eq_mask(raw, ref); /* Empty the mask */ cpl_test_zero(cpl_mask_xor(raw, ref)); cpl_test(cpl_mask_is_empty(raw)); /* cpl_mask_copy()... */ cpl_test_nonnull(memcpy(cpl_mask_get_data(raw), cpl_mask_get_data_const(ref), nx * ny * sizeof(cpl_binary))); /* Empty the mask */ cpl_test_zero(cpl_mask_not(raw)); cpl_test_zero(cpl_mask_and(raw, ref)); cpl_test(cpl_mask_is_empty(raw)); /* cpl_mask_copy()... */ cpl_test_nonnull(memcpy(cpl_mask_get_data(raw), cpl_mask_get_data_const(ref), nx * ny * sizeof(cpl_binary))); /* Fill the mask */ cpl_test_zero(cpl_mask_not(raw)); cpl_test_zero(cpl_mask_or(raw, ref)); cpl_test_eq(cpl_mask_count(raw), nx * ny); ttemp1 = cpl_test_get_cputime(); if (ttemp1 > ttemp0) tassi += ttemp1 - ttemp0; for (i = 1; i <= nx; i++) { /* First collapsed element will be CPL_BINARY_0 */ cpl_mask_set(raw, i, 1, CPL_BINARY_0); } if (ny > 2) { /* Second collapsed element will be CPL_BINARY_0 */ cpl_mask_set(raw, 1, 2, CPL_BINARY_0); } ttemp0 = cpl_test_get_cputime(); collapsed = cpl_mask_collapse_create(raw, 1); ttemp1 = cpl_test_get_cputime(); if (ttemp1 > ttemp0) tcol1 += ttemp1 - ttemp0; cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(collapsed); cpl_test_eq(cpl_mask_get_size_x(collapsed), 1); cpl_test_eq(cpl_mask_get_size_y(collapsed), ny); cpl_test_zero(cpl_mask_get(collapsed, 1, 1)); if (ny > 2) { cpl_test_zero(cpl_mask_get(collapsed, 1, 2)); } cpl_test_eq(cpl_mask_count(collapsed), ny > 2 ? ny - 2 : ny - 1); cpl_mask_delete(collapsed); /* cpl_mask_copy()... */ cpl_test_nonnull(memcpy(cpl_mask_get_data(raw), cpl_mask_get_data_const(ref), nx * ny * sizeof(cpl_binary))); /* Fill the mask */ ttemp0 = cpl_test_get_cputime(); cpl_test_zero(cpl_mask_not(raw)); cpl_test_zero(cpl_mask_or(raw, ref)); ttemp1 = cpl_test_get_cputime(); if (ttemp1 > ttemp0) tassi += ttemp1 - ttemp0; cpl_test_eq(cpl_mask_count(raw), nx * ny); for (i = 1; i <= ny; i++) { /* First collapsed element will be CPL_BINARY_0 */ cpl_mask_set(raw, 1, i, CPL_BINARY_0); } if (nx > 2) { /* Second collapsed element will be CPL_BINARY_0 */ cpl_mask_set(raw, 2, 1, CPL_BINARY_0); } ttemp0 = cpl_test_get_cputime(); collapsed = cpl_mask_collapse_create(raw, 0); ttemp1 = cpl_test_get_cputime(); if (ttemp1 > ttemp0) tcol0 += ttemp1 - ttemp0; cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(collapsed); cpl_test_eq(cpl_mask_get_size_x(collapsed), nx); cpl_test_eq(cpl_mask_get_size_y(collapsed), 1); cpl_test_zero(cpl_mask_get(collapsed, 1, 1)); if (nx > 2) { cpl_test_zero(cpl_mask_get(collapsed, 2, 1)); } cpl_test_eq(cpl_mask_count(collapsed), nx > 2 ? nx - 2 : nx - 1); cpl_mask_delete(collapsed); if (nx > 1 && ny > 1) { int nzero = 0; const int nmin = nx < ny ? nx : ny; /* Fill the mask */ ttemp0 = cpl_test_get_cputime(); cpl_test_zero(cpl_mask_xor(raw, raw)); cpl_test(cpl_mask_is_empty(raw)); cpl_test_zero(cpl_mask_not(raw)); ttemp1 = cpl_test_get_cputime(); if (ttemp1 > ttemp0) tassi += ttemp1 - ttemp0; cpl_test_eq(cpl_mask_count(raw), nx * ny); /* Every other element on the diagonal is CPL_BINARY_0 */ for (i = 1; i <= nmin; i += 2) { cpl_test_zero(cpl_mask_set(raw, i, i, CPL_BINARY_0)); nzero++; } cpl_test_eq(cpl_mask_count(raw), nx * ny-nzero); ttemp0 = cpl_test_get_cputime(); collapsed = cpl_mask_collapse_create(raw, 1); ttemp1 = cpl_test_get_cputime(); if (ttemp1 > ttemp0) tcol1 += ttemp1 - ttemp0; cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(collapsed); cpl_test_eq(cpl_mask_get_size_x(collapsed), 1); cpl_test_eq(cpl_mask_get_size_y(collapsed), ny); for (i = 1; i <= nmin; i += 2) { cpl_test_zero(cpl_mask_get(collapsed, 1, i)); } cpl_test_eq(cpl_mask_count(collapsed), ny - nzero); cpl_mask_delete(collapsed); ttemp0 = cpl_test_get_cputime(); collapsed = cpl_mask_collapse_create(raw, 0); ttemp1 = cpl_test_get_cputime(); if (ttemp1 > ttemp0) tcol0 += ttemp1 - ttemp0; cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(collapsed); cpl_test_eq(cpl_mask_get_size_x(collapsed), nx); cpl_test_eq(cpl_mask_get_size_y(collapsed), 1); for (i = 1; i <= nmin; i += 2) { cpl_test_zero(cpl_mask_get(collapsed, i, 1)); } cpl_test_eq(cpl_mask_count(collapsed), nx - nzero); cpl_mask_delete(collapsed); /* Fill the mask */ ttemp0 = cpl_test_get_cputime(); cpl_test_zero(cpl_mask_xor(raw, raw)); cpl_test(cpl_mask_is_empty(raw)); cpl_test_zero(cpl_mask_not(raw)); ttemp1 = cpl_test_get_cputime(); if (ttemp1 > ttemp0) tassi += ttemp1 - ttemp0; cpl_test_eq(cpl_mask_count(raw), nx * ny); /* The first row is all CPL_BINARY_0 */ for (i = 1; i <= nx; i++) { cpl_test_zero(cpl_mask_set(raw, i, 1, CPL_BINARY_0)); } cpl_test_eq(cpl_mask_count(raw), nx * (ny-1)); ttemp0 = cpl_test_get_cputime(); collapsed = cpl_mask_collapse_create(raw, 0); ttemp1 = cpl_test_get_cputime(); if (ttemp1 > ttemp0) tcol0 += ttemp1 - ttemp0; cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(collapsed); cpl_test_eq(cpl_mask_get_size_x(collapsed), nx); cpl_test_eq(cpl_mask_get_size_y(collapsed), 1); cpl_test(cpl_mask_is_empty(collapsed)); cpl_mask_delete(collapsed); } cpl_mask_delete(ref); cpl_mask_delete(raw); } } cpl_msg_info(cpl_func, "Time to flip [s]: %g", tflip); cpl_msg_info(cpl_func, "Time to turn [s]: %g", tturn); cpl_msg_info(cpl_func, "Time to assign [s]: %g", tassi); cpl_msg_info(cpl_func, "Time to collapse 0 [s]: %g", tcol0); cpl_msg_info(cpl_func, "Time to collapse 1 [s]: %g", tcol1); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @param nsize The object size to use for testing @return void */ /*----------------------------------------------------------------------------*/ static void cpl_mask_filter_test(int nsize) { cpl_error_code error; const cpl_filter_mode filter[] = {CPL_FILTER_EROSION, CPL_FILTER_DILATION, CPL_FILTER_OPENING, CPL_FILTER_CLOSING}; const size_t nfilter = sizeof(filter)/sizeof(*filter); size_t k; /* Build a 3x3 kernel */ cpl_mask * kernel = cpl_mask_new(3, 3); cpl_mask * mask1 = cpl_mask_new(nsize, nsize); cpl_mask * copy1 = cpl_mask_new(nsize, nsize); cpl_msg_info(cpl_func,"Testing filtering functions with %d x %d mask", nsize, nsize); error = cpl_mask_fill_test(mask1, 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_mask_is_empty(mask1)); cpl_mask_set(kernel, 1, 2, CPL_BINARY_1); cpl_mask_set(kernel, 2, 2, CPL_BINARY_1); cpl_mask_set(kernel, 3, 2, CPL_BINARY_1); cpl_mask_set(kernel, 2, 1, CPL_BINARY_1); cpl_mask_set(kernel, 2, 3, CPL_BINARY_1); cpl_test_eq(cpl_mask_count(kernel), 5); for (k = 0; k < nfilter; k++) { cpl_mask * evenr = cpl_mask_new(3, 4); cpl_mask * evenc = cpl_mask_new(4, 3); cpl_mask * id = cpl_mask_new(1,1); cpl_mask * copy2 = cpl_mask_new(nsize, nsize); /* Error: NULL pointer */ error = cpl_mask_filter(NULL, mask1, kernel, filter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_mask_filter(copy1, NULL, kernel, filter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_mask_filter(copy1, mask1, NULL, filter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); /* Error: Even sized kernels */ error = cpl_mask_filter(copy1, mask1, evenr, filter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_mask_filter(copy1, mask1, evenc, filter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Error: Empty kernel */ error = cpl_mask_filter(copy1, mask1, id, filter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_DATA_NOT_FOUND); /* Error: Unsupported boder mode */ error = cpl_mask_filter(copy1, mask1, id, filter[k], CPL_BORDER_CROP); cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); if (filter[k] == CPL_FILTER_OPENING || filter[k] == CPL_FILTER_CLOSING) { error = cpl_mask_filter(copy1, mask1, id, filter[k], CPL_BORDER_NOP); cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); } /* The identity kernel */ error = cpl_mask_not(id); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_mask_filter(copy1, mask1, id, filter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq_mask(copy1, mask1); cpl_mask_delete(evenr); cpl_mask_delete(evenc); cpl_mask_delete(copy2); cpl_mask_delete(id); } error = cpl_mask_filter(copy1, mask1, kernel, CPL_FILTER_EROSION, CPL_BORDER_NOP); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_lt(cpl_mask_count(copy1), cpl_mask_count(mask1)); error = cpl_mask_filter(copy1, mask1, kernel, CPL_FILTER_MEDIAN, CPL_BORDER_NOP); cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); cpl_mask_delete(mask1); cpl_mask_delete(copy1); cpl_mask_delete(kernel); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function using example from Schalkoff @param nsize The object size to use for testing @return void @see R. Schallkoff, "Digital Image Processing and Computer Vision" */ /*----------------------------------------------------------------------------*/ static void cpl_mask_filter_test_schalkoff(void) { #define nx 21 #define ny 18 const int borders[] = {CPL_BORDER_NOP, CPL_BORDER_ZERO, CPL_BORDER_COPY}; const size_t nborders = sizeof(borders)/sizeof(borders[0]); /* Binary Image 6.36a */ const cpl_binary schallkoff_A[nx*ny] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* Binary Image 6.37b from R. Schallkoff (Dilation w. 3x3 full kernel) */ const cpl_binary schallkoff_D[nx*ny] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* Binary Image 6.37c from R. Schallkoff (Erosion w. 3x3 full kernel) */ const cpl_binary schallkoff_E[nx*ny] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* Binary Image 6.39a from R. Schallkoff (Opening w. 3x3 full kernel) */ const cpl_binary schallkoff_O[nx*ny] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* Binary Image 6.39b from R. Schallkoff (Closing w. 3x3 full kernel) */ const cpl_binary schallkoff_C[nx*ny] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; cpl_mask * mask0 = cpl_mask_new(nx, ny); /* NOT modified */ cpl_mask * maskA = cpl_mask_wrap(nx, ny, (cpl_binary*)schallkoff_A); cpl_mask * maskD = cpl_mask_wrap(nx, ny, (cpl_binary*)schallkoff_D); cpl_mask * maskE = cpl_mask_wrap(nx, ny, (cpl_binary*)schallkoff_E); cpl_mask * maskO = cpl_mask_wrap(nx, ny, (cpl_binary*)schallkoff_O); cpl_mask * maskC = cpl_mask_wrap(nx, ny, (cpl_binary*)schallkoff_C); /* Build a 3x3 kernel inside a 5 x 5 mask */ cpl_mask * kernel = cpl_mask_new(5, 5); cpl_error_code error; size_t iborder; cpl_msg_info(cpl_func, "Schalkoff filter test on " CPL_STRINGIFY(nx) " x " CPL_STRINGIFY(ny) " mask"); cpl_mask_flip_turn_test(maskA); /* Fill 3x3 kernel */ cpl_mask_set(kernel, 2, 2, CPL_BINARY_1); cpl_mask_set(kernel, 2, 3, CPL_BINARY_1); cpl_mask_set(kernel, 2, 4, CPL_BINARY_1); cpl_mask_set(kernel, 3, 2, CPL_BINARY_1); cpl_mask_set(kernel, 3, 3, CPL_BINARY_1); cpl_mask_set(kernel, 3, 4, CPL_BINARY_1); cpl_mask_set(kernel, 4, 2, CPL_BINARY_1); cpl_mask_set(kernel, 4, 3, CPL_BINARY_1); cpl_mask_set(kernel, 4, 4, CPL_BINARY_1); cpl_test_eq(cpl_mask_count(kernel), 3 * 3); for (iborder = 0; iborder < nborders; iborder++) { int iflip; for (iflip = 0; iflip < 3; iflip++) { /* Test also with flipped images since the mask is traversed in one specific direction */ cpl_mask * flip = cpl_mask_new(nx, ny); /* Test erosion */ error = cpl_mask_copy(flip, maskA, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); if (iflip != 1) { error = cpl_mask_flip(flip, iflip); cpl_test_eq_error(error, CPL_ERROR_NONE); } error = cpl_mask_filter(mask0, flip, kernel, CPL_FILTER_EROSION, borders[iborder]); cpl_test_eq_error(error, CPL_ERROR_NONE); if (iflip != 1) { error = cpl_mask_flip(mask0, iflip); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_test_eq_mask(maskE, mask0); /* Test dilation */ error = cpl_mask_copy(flip, maskA, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); if (iflip != 1) { error = cpl_mask_flip(flip, iflip); cpl_test_eq_error(error, CPL_ERROR_NONE); } error = cpl_mask_filter(mask0, flip, kernel, CPL_FILTER_DILATION, borders[iborder]); cpl_test_eq_error(error, CPL_ERROR_NONE); if (iflip != 1) { error = cpl_mask_flip(mask0, iflip); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_test_eq_mask(maskD, mask0); /* Test duality of erosion and dilation (kernel is symmetric) */ cpl_mask_not(flip); error = cpl_mask_filter(mask0, flip, kernel, CPL_FILTER_DILATION, borders[iborder]); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_mask_not(mask0); /* No duality on border */ cpl_mask_fill_border(mask0, 3, 3, CPL_BINARY_0); if (iflip != 1) { error = cpl_mask_flip(mask0, iflip); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_test_eq_mask(maskE, mask0); /* Test duality of dilation and erosion (kernel is symmetric) */ error = cpl_mask_filter(mask0, flip, kernel, CPL_FILTER_EROSION, borders[iborder]); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_mask_not(mask0); /* No duality on border */ cpl_mask_fill_border(mask0, 3, 3, CPL_BINARY_0); if (iflip != 1) { error = cpl_mask_flip(mask0, iflip); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_test_eq_mask(maskD, mask0); if (borders[iborder] != CPL_BORDER_NOP) { int nidem; /* Test opening */ error = cpl_mask_copy(flip, maskA, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); if (iflip != 1) { error = cpl_mask_flip(flip, iflip); cpl_test_eq_error(error, CPL_ERROR_NONE); } nidem = 2; do { /* Idempotency test as well */ error = cpl_mask_filter(mask0, flip, kernel, CPL_FILTER_OPENING, borders[iborder]); cpl_test_eq_error(error, CPL_ERROR_NONE); } while (--nidem); if (iflip != 1) { error = cpl_mask_flip(mask0, iflip); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_test_eq_mask(maskO, mask0); /* Test closing */ error = cpl_mask_copy(flip, maskA, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); if (iflip != 1) { error = cpl_mask_flip(flip, iflip); cpl_test_eq_error(error, CPL_ERROR_NONE); } nidem = 2; do { /* Idempotency test as well */ error = cpl_mask_filter(mask0, flip, kernel, CPL_FILTER_CLOSING, borders[iborder]); cpl_test_eq_error(error, CPL_ERROR_NONE); } while (--nidem > 0); if (iflip != 1) { error = cpl_mask_flip(mask0, iflip); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_test_eq_mask(maskC, mask0); /* Test duality of opening and closing */ cpl_mask_not(flip); error = cpl_mask_filter(mask0, flip, kernel, CPL_FILTER_OPENING, borders[iborder]); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_mask_not(mask0); /* No duality on border */ cpl_mask_fill_border(mask0, 3, 3, CPL_BINARY_0); if (iflip != 1) { error = cpl_mask_flip(mask0, iflip); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_test_eq_mask(maskC, mask0); /* Test duality of closing and opening */ error = cpl_mask_filter(mask0, flip, kernel, CPL_FILTER_CLOSING, borders[iborder]); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_mask_not(mask0); /* No duality on border */ cpl_mask_fill_border(mask0, 3, 3, CPL_BINARY_0); if (iflip != 1) { error = cpl_mask_flip(mask0, iflip); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_test_eq_mask(maskO, mask0); } /* Tests for one flip done */ cpl_mask_delete(flip); } } cpl_test_eq_ptr(cpl_mask_unwrap(maskA), schallkoff_A); cpl_test_eq_ptr(cpl_mask_unwrap(maskD), schallkoff_D); cpl_test_eq_ptr(cpl_mask_unwrap(maskE), schallkoff_E); cpl_test_eq_ptr(cpl_mask_unwrap(maskO), schallkoff_O); cpl_test_eq_ptr(cpl_mask_unwrap(maskC), schallkoff_C); cpl_mask_delete(mask0); cpl_mask_delete(kernel); #undef nx #undef ny } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function against the matrix based ones @param nsize The object size to use for testing @return void */ /*----------------------------------------------------------------------------*/ static void cpl_mask_filter_test_matrix(int nsize) { const int maxhxy = CX_MIN(9, nsize/4); cpl_error_code (*ffilter[4])(cpl_mask *, const cpl_matrix *) = {cpl_mask_erosion_matrix, cpl_mask_dilation_matrix, cpl_mask_opening_matrix, cpl_mask_closing_matrix}; const cpl_filter_mode mfilter[] = {CPL_FILTER_EROSION, CPL_FILTER_DILATION, CPL_FILTER_OPENING, CPL_FILTER_CLOSING}; const cpl_filter_mode mdual[] = {CPL_FILTER_DILATION, CPL_FILTER_EROSION, CPL_FILTER_CLOSING, CPL_FILTER_OPENING}; const size_t nfilter = sizeof(ffilter)/sizeof(*ffilter); size_t k; cpl_mask * raw = cpl_mask_new(nsize, nsize); int hx, hy; cpl_error_code error; double time_mask = 0.0; double time_bf = 0.0; double time_matrix = 0.0; error = cpl_mask_fill_test(raw, 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_msg_info(cpl_func, "Matrix testing of cpl_mask_filter() filters with " "%d x %d mask", nsize, nsize); for (hy = 0; hy < maxhxy; hy++) { for (hx = 0; hx < maxhxy; hx++) { const int mx = 1 + 2 * hx; const int my = 1 + 2 * hy; int do_full; if (mx > nsize || my > nsize) continue; for (do_full = mx * my > 1 ? 0 : 1; do_full < 2; do_full++) { cpl_mask * kernel = cpl_mask_new(mx, my); cpl_matrix * matrix = cpl_matrix_new(my, mx); cpl_mask * filtered = cpl_mask_new(nsize, nsize); cpl_mask * rawcopy = cpl_mask_new(nsize, nsize); if (do_full) { error = cpl_mask_not(kernel); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_matrix_fill(matrix, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); } else { int i, j; int ncount; do { error = cpl_mask_fill_test(kernel, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); ncount = cpl_mask_count(kernel); } while (ncount == 0 || ncount == mx * my); for (j = 0; j < my; j++) { for (i = 0; i < mx; i++) { if (cpl_mask_get(kernel, i + 1, j + 1)) cpl_matrix_set(matrix, my - j - 1, i, 1.0); } } cpl_msg_info(cpl_func, "The %u filters w. %d x %d kernel " "(full and %d element(s))", (unsigned)nfilter, mx, my, ncount); } for (k = 0; k < nfilter; k++) { double time0, time1; error = cpl_mask_copy(rawcopy, raw, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); time0 = cpl_test_get_cputime(); error = cpl_mask_filter(filtered, raw, kernel, mfilter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); time1 = cpl_test_get_cputime(); if (time1 > time0) time_mask += time1 - time0; time0 = cpl_test_get_cputime(); error = ffilter[k](rawcopy, matrix); cpl_test_eq_error(error, CPL_ERROR_NONE); time1 = cpl_test_get_cputime(); if (time1 > time0) time_matrix += time1 - time0; cpl_test_eq_mask(filtered, rawcopy); time0 = cpl_test_get_cputime(); error = cpl_mask_filter_bf(filtered, raw, kernel, mfilter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); time1 = cpl_test_get_cputime(); if (time1 > time0) time_bf += time1 - time0; cpl_test_eq_mask(filtered, rawcopy); if (mfilter[k] == CPL_FILTER_OPENING || mfilter[k] == CPL_FILTER_CLOSING) { /* Opening and closing can also be done in-place */ error = cpl_mask_copy(rawcopy, raw, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_mask_filter(rawcopy, rawcopy, kernel, mfilter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq_mask(filtered, rawcopy); } /* Duality test */ cpl_mask_not(raw); error = cpl_mask_filter(filtered, raw, kernel, mdual[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_mask_not(filtered); /* No duality on border */ cpl_mask_fill_border(filtered, mx, my, CPL_BINARY_0); cpl_mask_fill_border(rawcopy, mx, my, CPL_BINARY_0); cpl_test_eq_mask(filtered, rawcopy); error = cpl_mask_filter_bf(filtered, raw, kernel, mdual[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_mask_not(filtered); /* No duality on border */ cpl_mask_fill_border(filtered, mx, my, CPL_BINARY_0); cpl_mask_fill_border(rawcopy, mx, my, CPL_BINARY_0); cpl_test_eq_mask(filtered, rawcopy); /* End of duality test - restore */ cpl_mask_not(raw); if (mfilter[k] == CPL_FILTER_OPENING || mfilter[k] == CPL_FILTER_CLOSING) { /* Idempotency test */ int nidem = 2; do { error = cpl_mask_filter(filtered, raw, kernel, mfilter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); } while (--nidem > 0); /* No idempotency on border */ cpl_mask_fill_border(filtered, mx, my, CPL_BINARY_0); cpl_test_eq_mask(filtered, rawcopy); nidem = 2; do { error = cpl_mask_filter_bf(filtered, raw, kernel, mfilter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); } while (--nidem > 0); /* No idempotency on border */ cpl_mask_fill_border(filtered, mx, my, CPL_BINARY_0); cpl_test_eq_mask(filtered, rawcopy); } } cpl_mask_delete(filtered); cpl_mask_delete(rawcopy); cpl_mask_delete(kernel); cpl_matrix_delete(matrix); } } } if (time_mask > 0.0 || time_matrix > 0.0 || time_bf > 0.0) cpl_msg_info(cpl_func, "Time to filter, mask <=> brute force <=> " "matrix [s]: %g <=> %g <=> %g", time_mask, time_bf, time_matrix); cpl_mask_delete(raw); } /*----------------------------------------------------------------------------*/ /** @internal @brief Benchmark the CPL function @param nsize The object size to use for testing @param nreps The number of repetitions @return void */ /*----------------------------------------------------------------------------*/ static void cpl_mask_count_bench(int nsize, int nreps) { cpl_mask * mask1 = cpl_mask_new(nsize, nsize); cpl_mask * mask2; cpl_error_code error; double time0, time_mask = 0.0; int irep; error = cpl_mask_fill_test(mask1, 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); mask2 = cpl_mask_duplicate(mask1); error = cpl_mask_not(mask2); cpl_test_eq_error(error, CPL_ERROR_NONE); time0 = cpl_test_get_cputime(); for (irep = 0; irep < nreps; irep++) { cpl_test_eq(cpl_mask_count(mask1) + cpl_mask_count(mask2), nsize * nsize); } time_mask = cpl_test_get_cputime() - time0; cpl_msg_info(cpl_func, "Time to count elements 2 X %d mask of size %d x %d " "[s]: %g", nreps, nsize, nsize, time_mask); cpl_mask_delete(mask1); cpl_mask_delete(mask2); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function against the matrix based ones @param nsize The object size to use for testing @param nreps The number of repetitions @return void */ /*----------------------------------------------------------------------------*/ static void cpl_mask_filter_bench(int nsize, int nreps, int minhx, int maxhx, int minhy, int maxhy) { const cpl_filter_mode mfilter[] = {CPL_FILTER_EROSION, CPL_FILTER_DILATION, CPL_FILTER_OPENING, CPL_FILTER_CLOSING}; const cpl_filter_mode mdual[] = {CPL_FILTER_DILATION, CPL_FILTER_EROSION, CPL_FILTER_CLOSING, CPL_FILTER_OPENING}; const size_t nfilter = sizeof(mfilter)/sizeof(*mfilter); size_t k; cpl_mask * raw = cpl_mask_new(nsize, nsize); int hx, hy; cpl_error_code error; double time_mask = 0.0; double time_bf = 0.0; int irep; error = cpl_mask_fill_test(raw, 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_msg_info(cpl_func, "Matrix testing of cpl_mask_filter() filters with " "%d x %d mask", nsize, nsize); for (irep = 0; irep < nreps; irep++) { for (hy = minhy; hy <= maxhy; hy++) { for (hx = minhx; hx <= maxhx; hx++) { const int mx = 1 + 2 * hx; const int my = 1 + 2 * hy; int do_full; if (mx > nsize || my > nsize) continue; for (do_full = mx * my > 1 ? 0 : 1; do_full < 2; do_full++) { cpl_mask * kernel = cpl_mask_new(mx, my); cpl_mask * filtered = cpl_mask_new(nsize, nsize); cpl_mask * rawcopy = cpl_mask_new(nsize, nsize); if (do_full) { error = cpl_mask_not(kernel); cpl_test_eq_error(error, CPL_ERROR_NONE); } else { int ncount; do { error = cpl_mask_fill_test(kernel, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); ncount = cpl_mask_count(kernel); } while (ncount == 0 || ncount == mx * my); cpl_msg_info(cpl_func, "The %u filters w. %d x %d kernel " "(full and %d element(s))", (unsigned)nfilter, mx, my, ncount); } for (k = 0; k < nfilter; k++) { double time0, time1; time0 = cpl_test_get_cputime(); error = cpl_mask_filter(filtered, raw, kernel, mfilter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); time1 = cpl_test_get_cputime(); if (time1 > time0) time_mask += time1 - time0; time0 = cpl_test_get_cputime(); error = cpl_mask_filter_bf(rawcopy, raw, kernel, mfilter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); time1 = cpl_test_get_cputime(); if (time1 > time0) time_bf += time1 - time0; cpl_test_eq_mask(filtered, rawcopy); if (mfilter[k] == CPL_FILTER_OPENING || mfilter[k] == CPL_FILTER_CLOSING) { /* Opening and closing can also be done in-place */ error = cpl_mask_copy(rawcopy, raw, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_mask_filter(rawcopy, rawcopy, kernel, mfilter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq_mask(filtered, rawcopy); } /* Duality test */ cpl_mask_not(raw); error = cpl_mask_filter(filtered, raw, kernel, mdual[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_mask_not(filtered); /* No duality on border */ cpl_mask_fill_border(filtered, mx, my, CPL_BINARY_0); cpl_mask_fill_border(rawcopy, mx, my, CPL_BINARY_0); cpl_test_eq_mask(filtered, rawcopy); error = cpl_mask_filter_bf(filtered, raw, kernel, mdual[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_mask_not(filtered); /* No duality on border */ cpl_mask_fill_border(filtered, mx, my, CPL_BINARY_0); cpl_mask_fill_border(rawcopy, mx, my, CPL_BINARY_0); cpl_test_eq_mask(filtered, rawcopy); /* End of duality test - restore */ cpl_mask_not(raw); if (mfilter[k] == CPL_FILTER_OPENING || mfilter[k] == CPL_FILTER_CLOSING) { /* Idempotency test */ int nidem = 2; do { error = cpl_mask_filter(filtered, raw, kernel, mfilter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); } while (--nidem > 0); /* No idempotency on border */ cpl_mask_fill_border(filtered, mx, my, CPL_BINARY_0); cpl_test_eq_mask(filtered, rawcopy); nidem = 2; do { error = cpl_mask_filter_bf(filtered, raw, kernel, mfilter[k], CPL_BORDER_ZERO); cpl_test_eq_error(error, CPL_ERROR_NONE); } while (--nidem > 0); /* No idempotency on border */ cpl_mask_fill_border(filtered, mx, my, CPL_BINARY_0); cpl_test_eq_mask(filtered, rawcopy); } } cpl_mask_delete(filtered); cpl_mask_delete(rawcopy); cpl_mask_delete(kernel); } } } } if (time_mask > 0.0 || time_bf > 0.0) cpl_msg_info(cpl_func, "Time to filter, mask <=> brute force [s]: " "%g <=> %g", time_mask, time_bf); cpl_mask_delete(raw); } /*----------------------------------------------------------------------------*/ /** @internal @brief Compute a morphological opening @param in input mask @param ker binary kernel (0 for 0, any other value is considered as 1) @return the #_cpl_error_code_ or CPL_ERROR_NONE @note The original filter function, only used for testing The morphological opening is an erosion followed by a dilation. The input mask is modified. The input kernel should have an odd number of rows and columns. The maximum size of the kernel is 31x31. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if the kernel is such that the erosion or the dilation cannot be done */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_mask_opening_matrix( cpl_mask * in, const cpl_matrix * ker) { cpl_ensure_code(in && ker, CPL_ERROR_NULL_INPUT); if (cpl_mask_erosion_matrix(in, ker) != CPL_ERROR_NONE) return CPL_ERROR_ILLEGAL_INPUT; if (cpl_mask_dilation_matrix(in, ker) != CPL_ERROR_NONE) return CPL_ERROR_ILLEGAL_INPUT; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Compute a morphological closing @param in input mask @param ker binary kernel (0 for 0, any other value is considered as 1) @return the #_cpl_error_code_ or CPL_ERROR_NONE @note The original filter function, only used for testing The morphological closing is a dilation followed by an erosion. The input mask is modified. The input kernel should have an odd number of rows and columns. The maximum size of the kernel is 31x31. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if the kernel is such that the erosion or the dilation cannot be done */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_mask_closing_matrix( cpl_mask * in, const cpl_matrix * ker) { cpl_ensure_code(in && ker, CPL_ERROR_NULL_INPUT); if (cpl_mask_dilation_matrix(in, ker) != CPL_ERROR_NONE) return CPL_ERROR_ILLEGAL_INPUT; if (cpl_mask_erosion_matrix(in, ker) != CPL_ERROR_NONE) return CPL_ERROR_ILLEGAL_INPUT; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Compute a morphological erosion @param in input mask @param ker binary kernel (0 for 0, any other value is considered as 1) @return the #_cpl_error_code_ or CPL_ERROR_NONE @note The original filter function, only used for testing The input mask is modified. The input kernel should have an odd number of rows and columns. The maximum size of the kernel is 31x31. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if the kernel is not as requested */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_mask_erosion_matrix( cpl_mask * in, const cpl_matrix * ker) { const int nx = cpl_mask_get_size_x(in); const int ny = cpl_mask_get_size_y(in); cpl_binary * datain = cpl_mask_get_data(in); cpl_binary * dataout; cpl_mask * out; const double * ker_arr; int nc, nr; int hsx, hsy; int curr_pos, im_pos, filt_pos; int i, j, k, l; /* Test entries */ cpl_ensure_code(in && ker, CPL_ERROR_NULL_INPUT); /* Get kernel informations */ nr = cpl_matrix_get_nrow(ker); nc = cpl_matrix_get_ncol(ker); ker_arr = cpl_matrix_get_data_const(ker); /* Test the kernel validity */ cpl_ensure_code(nc%2 && nr%2, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(nc<=31 && nr<=31, CPL_ERROR_ILLEGAL_INPUT); /* Initialise */ hsx = (nc-1) / 2; hsy = (nr-1) / 2; /* Create a tmp mask */ out = cpl_mask_new(nx, ny); dataout = cpl_mask_get_data(out); /* Main filter loop */ for (j=0; j=nx-hsx) || (j=ny-hsy)) { dataout[curr_pos] = CPL_BINARY_0; } else { /* Initialise */ dataout[curr_pos] = CPL_BINARY_1; /* Go into upper left corner of current pixel */ im_pos = curr_pos - hsx + hsy*nx; filt_pos = 0; for (k=0; k FLT_MIN)) (dataout)[curr_pos] = CPL_BINARY_0; /* Next col */ filt_pos++; im_pos++; } /* Next row */ im_pos -= nx + nc; } } } } memcpy(datain, dataout, nx * ny * sizeof(cpl_binary)); cpl_mask_delete(out); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Compute a morphological dilation @param in input mask @param ker binary kernel (0 for 0, any other value is considered as 1) @return the #_cpl_error_code_ or CPL_ERROR_NONE @note The original filter function, only used for testing The input mask is modified. The input kernel should have an odd number of rows and columns. The maximum size of the kernel is 31x31. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if the kernel is not as requested */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_mask_dilation_matrix( cpl_mask * in, const cpl_matrix * ker) { const int nx = cpl_mask_get_size_x(in); const int ny = cpl_mask_get_size_y(in); cpl_binary * datain = cpl_mask_get_data(in); cpl_binary * dataout; cpl_mask * out; const double * ker_arr; int nc, nr; int hsx, hsy; int curr_pos, im_pos, filt_pos; int i, j, k, l; /* Test entries */ cpl_ensure_code(in && ker, CPL_ERROR_NULL_INPUT); /* Get kernel informations */ nr = cpl_matrix_get_nrow(ker); nc = cpl_matrix_get_ncol(ker); ker_arr = cpl_matrix_get_data_const(ker); /* Test the kernel validity */ cpl_ensure_code(nc%2 && nr%2, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(nc<=31 && nr<=31, CPL_ERROR_ILLEGAL_INPUT); /* Initialise */ hsx = (nc-1) / 2; hsy = (nr-1) / 2; /* Create a tmp mask */ out = cpl_mask_new(nx, ny); dataout = cpl_mask_get_data(out); /* Main filter loop */ for (j=0; j=nx-hsx) || (j=ny-hsy)) { (dataout)[curr_pos] = CPL_BINARY_0; } else { /* Initialise */ (dataout)[curr_pos] = CPL_BINARY_0; /* Go into upper left corner of current pixel */ im_pos = curr_pos - hsx + hsy*nx; filt_pos = 0; for (k=0; k FLT_MIN)) (dataout)[curr_pos] = CPL_BINARY_1; /* Next col */ filt_pos++; im_pos++; } /* Next row */ im_pos -= nx + nc; } } } } memcpy(datain, dataout, nx * ny * sizeof(cpl_binary)); cpl_mask_delete(out); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Brute force (single byte) filter a mask using a binary kernel @param self Filtered mask @param other Mask to filter @param kernel Elements to use, if set to CPL_BINARY_1 @param filter CPL_FILTER_EROSION, CPL_FILTER_DILATION, CPL_FILTER_OPENING, CPL_FILTER_CLOSING @param border CPL_BORDER_NOP, CPL_BORDER_ZERO or CPL_BORDER_COPY @return CPL_ERROR_NONE or the relevant CPL error code @see cpl_mask_filter() */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_mask_filter_bf(cpl_mask * self, const cpl_mask * other, const cpl_mask * kernel, cpl_filter_mode filter, cpl_border_mode border) { /* Modified from cpl_mask_filter() :-((((( */ const int nsx = cpl_mask_get_size_x(self); const int nsy = cpl_mask_get_size_y(self); const int nx = cpl_mask_get_size_x(other); const int ny = cpl_mask_get_size_y(other); const int mx = cpl_mask_get_size_x(kernel); const int my = cpl_mask_get_size_y(kernel); const int hsizex = mx >> 1; const int hsizey = my >> 1; const cpl_binary * pmask = cpl_mask_get_data_const(kernel); const cpl_binary * pother = cpl_mask_get_data_const(other); cpl_binary * pself = cpl_mask_get_data(self); /* assert( sizeof(cpl_binary) == 1 ) */ const cpl_binary * polast = pother + nx * ny; const cpl_binary * psrows = pself + nsx * (1 + hsizey); /* pmask may not overlap pself at all */ const cpl_binary * pmlast = pmask + mx * my; const cpl_binary * pslast = pself + nsx * nsy; /* In filtering it is generally faster with a special case for the full kernel. Some tests indicate that this is not the case of mask filtering. This may be due to the typically small kernels - and the simple operations involved. */ void (*filter_func)(cpl_binary *, const cpl_binary *, const cpl_binary *, int, int, int, int, cpl_border_mode); cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(other != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(kernel != NULL, CPL_ERROR_NULL_INPUT); if (filter == CPL_FILTER_OPENING || filter == CPL_FILTER_CLOSING) { cpl_ensure_code(border == CPL_BORDER_ZERO || border == CPL_BORDER_COPY, CPL_ERROR_UNSUPPORTED_MODE); } else { /* pself has to be above all of the other buffer, or */ /* ...pother has to be above the first hsize+1 rows of pself */ cpl_ensure_code(pself >= polast || pother >= psrows, CPL_ERROR_UNSUPPORTED_MODE); cpl_ensure_code(border == CPL_BORDER_NOP || border == CPL_BORDER_ZERO || border == CPL_BORDER_COPY, CPL_ERROR_UNSUPPORTED_MODE); } /* If this check fails, the caller is doing something really weird... */ cpl_ensure_code(pmask >= pslast || pself >= pmlast, CPL_ERROR_UNSUPPORTED_MODE); /* Only odd-sized masks allowed */ cpl_ensure_code((mx&1) == 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code((my&1) == 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(mx <= nx, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(my <= ny, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (border == CPL_BORDER_CROP) { cpl_ensure_code(nsx == nx - 2 * hsizex, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(nsy == ny - 2 * hsizey, CPL_ERROR_INCOMPATIBLE_INPUT); } else { cpl_ensure_code(nsx == nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(nsy == ny, CPL_ERROR_INCOMPATIBLE_INPUT); } cpl_ensure_code(!cpl_mask_is_empty(kernel), CPL_ERROR_DATA_NOT_FOUND); filter_func = NULL; if (filter == CPL_FILTER_EROSION) { filter_func = cpl_mask_erosion_bf; } else if (filter == CPL_FILTER_DILATION) { filter_func = cpl_mask_dilation_bf; } else if (filter == CPL_FILTER_OPENING) { filter_func = cpl_mask_opening_bf; } else if (filter == CPL_FILTER_CLOSING) { filter_func = cpl_mask_closing_bf; } if (filter_func != NULL) { filter_func(pself, pother, pmask, nx, ny, hsizex, hsizey, border); } else { return cpl_error_set(cpl_func, CPL_ERROR_UNSUPPORTED_MODE); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Apply the erosion filter @param self The output binary 2D array to hold the filtered result @param other The input binary 2D array to filter @param kernel The input binary 2D kernel @param nx The X-size of the input array @param ny The Y-size of the input array @param hx The X-half-size of the kernel @param hy The Y-half-size of the kernel @return void @see cpl_mask_erosion_() @note No error checking in this internal function! FIXME: Changes to this function must also be made to cpl_mask_dilation_bf() */ /*----------------------------------------------------------------------------*/ static void cpl_mask_erosion_bf(cpl_binary * self, const cpl_binary * other, const cpl_binary * kernel, int nx, int ny, int hx, int hy, cpl_border_mode border) { /* Modified from cpl_mask_erosion_() :-((((( */ if (border == CPL_BORDER_NOP || border == CPL_BORDER_ZERO || border == CPL_BORDER_COPY) { const int mx = 2 * hx + 1; int i, j; /* Handle border for first hy rows and first hx elements of next row */ if (border == CPL_BORDER_ZERO) { (void)memset(self, CPL_BINARY_0, hx + hy * nx); } else if (border == CPL_BORDER_COPY) { (void)memcpy(self, other, hx + hy * nx); } self += hy * nx; kernel += hx; for (j = hy; j < ny-hy; j++, self += nx, other += nx) { if (j > hy) { /* Do also last hx border elements of previous row */ if (border == CPL_BORDER_ZERO) { (void)memset(self - hx, CPL_BINARY_0, 2 * hx); } else if (border == CPL_BORDER_COPY) { (void)memcpy(self - hx, other - hx + hy * nx, 2 * hx); } } for (i = hx; i < nx-hx; i++) { const cpl_binary * otheri = other + i; const cpl_binary * kernelk = kernel; int k, l; for (k = -hy; k <= hy; k++, otheri += nx, kernelk += mx) { /* FIXME: Do binary ops using 64, 32, 16 bit integers */ for (l = -hx; l <= hx; l++) { if (!otheri[l] && kernelk[l]) break; } if (l <= hx) break; } self[i] = k <= hy ? CPL_BINARY_0 : CPL_BINARY_1; } } /* Do also last hx border elements of previous row */ if (border == CPL_BORDER_ZERO) { (void)memset(self - hx, CPL_BINARY_0, hx + hy * nx); } else if (border == CPL_BORDER_COPY) { (void)memcpy(self - hx, other - hx + hy * nx, hx + hy * nx); } } } /*----------------------------------------------------------------------------*/ /** @internal @brief Apply the dilation filter @param self The output binary 2D array to hold the filtered result @param other The input binary 2D array to filter @param kernel The input binary 2D kernel - rows padded with 0 to fit u32 @param nx The X-size of the input array @param ny The Y-size of the input array @param hx The X-half-size of the kernel @param hy The Y-half-size of the kernel @return void @note No error checking in this internal function! @see cpl_mask_erosion_bf() Modified from cpl_mask_erosion_bf(). FIXME: Changes to this function must also be made to cpl_mask_erosion_bf() */ /*----------------------------------------------------------------------------*/ static void cpl_mask_dilation_bf(cpl_binary * self, const cpl_binary * other, const cpl_binary * kernel, int nx, int ny, int hx, int hy, cpl_border_mode border) { if (border == CPL_BORDER_NOP || border == CPL_BORDER_ZERO || border == CPL_BORDER_COPY) { const int mx = 2 * hx + 1; int i, j; /* Handle border for first hy rows and first hx elements of next row */ if (border == CPL_BORDER_ZERO) { (void)memset(self, CPL_BINARY_0, hx + hy * nx); } else if (border == CPL_BORDER_COPY) { (void)memcpy(self, other, hx + hy * nx); } self += hy * nx; /* self-col now indexed from -hy to hy */ kernel += hx; for (j = hy; j < ny-hy; j++, self += nx, other += nx) { if (j > hy) { /* Do also last hx border elements of previous row */ if (border == CPL_BORDER_ZERO) { (void)memset(self - hx, CPL_BINARY_0, 2 * hx); } else if (border == CPL_BORDER_COPY) { (void)memcpy(self - hx, other - hx + hy * nx, 2 * hx); } } for (i = hx; i < nx-hx; i++) { const cpl_binary * otheri = other + i; const cpl_binary * kernelk = kernel; int k, l; for (k = -hy; k <= hy; k++, otheri += nx, kernelk += mx) { /* FIXME: Do binary ops using 64, 32, 16 bit integers */ for (l = -hx; l <= hx; l++) { if (otheri[l] && kernelk[l]) break; } if (l <= hx) break; } self[i] = k <= hy ? CPL_BINARY_1 : CPL_BINARY_0; } } /* Do also last hx border elements of previous row */ if (border == CPL_BORDER_ZERO) { (void)memset(self - hx, CPL_BINARY_0, hx + hy * nx); } else if (border == CPL_BORDER_COPY) { (void)memcpy(self - hx, other - hx + hy * nx, hx + hy * nx); } } } /*----------------------------------------------------------------------------*/ /** @internal @brief Apply the opening filter @param self The output binary 2D array to hold the filtered result @param other The input binary 2D array to filter @param kernel The input binary 2D kernel - rows padded with 0 to fit u32 @param nx The X-size of the input array @param ny The Y-size of the input array @param hx The X-half-size of the kernel @param hy The Y-half-size of the kernel @return void @note No error checking in this internal function! @see cpl_mask_opening_() */ /*----------------------------------------------------------------------------*/ static void cpl_mask_opening_bf(cpl_binary * self, const cpl_binary * other, const cpl_binary * kernel, int nx, int ny, int hx, int hy, cpl_border_mode border) { cpl_binary * middle = cpl_malloc((size_t)nx * ny * sizeof(cpl_binary)); cpl_mask_erosion_bf(middle, other, kernel, nx, ny, hx, hy, border); cpl_mask_dilation_bf(self, middle, kernel, nx, ny, hx, hy, border); cpl_free(middle); } /*----------------------------------------------------------------------------*/ /** @internal @brief Apply the closing filter @param self The output binary 2D array to hold the filtered result @param other The input binary 2D array to filter @param kernel The input binary 2D kernel - rows padded with 0 to fit u32 @param nx The X-size of the input array @param ny The Y-size of the input array @param hx The X-half-size of the kernel @param hy The Y-half-size of the kernel @return void @note No error checking in this internal function! @see cpl_mask_closing_() */ /*----------------------------------------------------------------------------*/ static void cpl_mask_closing_bf(cpl_binary * self, const cpl_binary * other, const cpl_binary * kernel, int nx, int ny, int hx, int hy, cpl_border_mode border) { cpl_binary * middle = cpl_malloc((size_t)nx * ny * sizeof(cpl_binary)); cpl_mask_dilation_bf(middle, other, kernel, nx, ny, hx, hy, border); cpl_mask_erosion_bf(self, middle, kernel, nx, ny, hx, hy, border); cpl_free(middle); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test cpl_mask_flip(), cpl_mask_turn() @param self The mask to test @return void A: Rotate 90 counterclock-wise, then flip around the vertical axis, then flip around x=y, and it should be back to its original. B: Rotate 90 counterclock-wise, then flip around the horizontal axis, then flip around x=-y, and it should be back to its original. */ /*----------------------------------------------------------------------------*/ static void cpl_mask_flip_turn_test(const cpl_mask * self) { cpl_error_code error; cpl_mask * tmp = cpl_mask_duplicate(self); error = cpl_mask_turn(tmp, -1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_mask_flip(tmp, 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_mask_flip(tmp, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq_mask(self, tmp); error = cpl_mask_turn(tmp, -1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_mask_flip(tmp, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_mask_flip(tmp, 3); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq_mask(self, tmp); cpl_mask_delete(tmp); } cpl-6.4.1/cplcore/tests/cpl_property-test.c0000644000460300003120000002706412013450152015650 00000000000000/* $Id: cpl_property-test.c,v 1.19 2012-08-17 14:08:42 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-08-17 14:08:42 $ * $Revision: 1.19 $ * $Name: not supported by cvs2svn $ */ #include #include "cpl_test.h" #include "cpl_property.h" #include #include #ifdef CPL_PROPERTY_TEST_DUMP static void cpl_test_property_dump(cpl_property *property) { const char *name = cpl_property_get_name(property); const char *comment = cpl_property_get_comment(property); char c; cpl_size size = cpl_property_get_size(property); cpl_type type = cpl_property_get_type(property); fprintf(stderr, "Property at address %p\n", property); fprintf(stderr, "\tname : %p '%s'\n", name, name); fprintf(stderr, "\tcomment: %p '%s'\n", comment, comment); fprintf(stderr, "\ttype : %#09x\n", type); fprintf(stderr, "\tsize : %ld\n", size); fprintf(stderr, "\tvalue : "); switch (type) { case CPL_TYPE_CHAR: c = cpl_property_get_char(property); if (!c) fprintf(stderr, "''"); else fprintf(stderr, "'%c'", c); break; case CPL_TYPE_BOOL: fprintf(stderr, "%d", cpl_property_get_bool(property)); break; case CPL_TYPE_INT: fprintf(stderr, "%d", cpl_property_get_int(property)); break; case CPL_TYPE_LONG: fprintf(stderr, "%ld", cpl_property_get_long(property)); break; case CPL_TYPE_LONG_LONG: fprintf(stderr, "%lld", cpl_property_get_long_long(property)); break; case CPL_TYPE_FLOAT: fprintf(stderr, "%g", cpl_property_get_float(property)); break; case CPL_TYPE_DOUBLE: fprintf(stderr, "%g", cpl_property_get_double(property)); break; case CPL_TYPE_STRING: fprintf(stderr, "'%s'", cpl_property_get_string(property)); break; default: fprintf(stderr, "unknown."); break; } fprintf(stderr, "\n"); return; } #endif int main(void) { size_t i, j; const char *names[] = { "char", "bool", "int", "long", "float", "double", "string", "float complex", "double complex" }; const char *strings[] = { "Mary", "Mary had a little lamb", "Mary had a" }; const float fval0 = 1.23456789; float fval1, fval2; const double dval0 = fval0; double dval1, dval2; const float complex zf0 = fval0 + fval0 * fval0 * _Complex_I; float complex zf1, zf2; const double complex zd0 = zf0; double complex zd1, zd2; cpl_error_code code; const cpl_type types[] = { CPL_TYPE_CHAR, CPL_TYPE_BOOL, CPL_TYPE_INT, CPL_TYPE_LONG, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE, CPL_TYPE_STRING, CPL_TYPE_FLOAT_COMPLEX, CPL_TYPE_DOUBLE_COMPLEX }; cpl_property *property; cpl_property *plist[9]; const size_t nprops = 9; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* * Test 1: Create a properties of different types, check their validity * and destroy them again. */ cpl_test_eq(sizeof(names)/sizeof(names[0]), sizeof(types)/sizeof(types[0])); for (i = 0; i < nprops; i++) { plist[i] = cpl_property_new(names[i], types[i]); cpl_test_nonnull(plist[i]); cpl_test_eq_string(cpl_property_get_name(plist[i]), names[i]); cpl_test_null(cpl_property_get_comment(plist[i])); cpl_test_eq(cpl_property_get_type(plist[i]), types[i]); cpl_test(cpl_property_get_size(plist[i])); cpl_property_delete(plist[i]); } /* * Test 2: Create properties of different size and types, verify the * properties and destroy them again. Note that only types * having the array flag set will have sizes different from * one. */ for (i = 0; i < nprops; i++) for (j = 1; j <= 100; j += 10) { property = cpl_property_new_array(names[i], types[i], j); cpl_test_nonnull(property); cpl_test_eq_string(cpl_property_get_name(property), names[i]); cpl_test_null(cpl_property_get_comment(property)); cpl_test_eq(cpl_property_get_type(property), types[i]); cpl_test(cpl_property_get_size(property)); cpl_property_delete(property); } /* * Test 3: Create a properties of different types, set their comments, * modify their names and verify the new settings. */ for (i = 0; i < nprops; i++) { plist[i] = cpl_property_new(names[i], types[i]); cpl_property_set_comment(plist[i], strings[0]); cpl_test_eq_string(cpl_property_get_comment(plist[i]), strings[0]); cpl_property_set_comment(plist[i], strings[1]); cpl_test_eq_string(cpl_property_get_comment(plist[i]), strings[1]); cpl_property_set_comment(plist[i], strings[2]); cpl_test_eq_string(cpl_property_get_comment(plist[i]), strings[2]); cpl_property_set_comment(plist[i], NULL); cpl_test_null(cpl_property_get_comment(plist[i])); } for (i = 0; i < nprops; i++) { cpl_property_set_name(plist[i], names[nprops - 1 - i]); cpl_test_eq_string(cpl_property_get_name(plist[i]), names[nprops -1 - i]); cpl_property_delete(plist[i]); } /* * Test 4: Create properties for the supported types, set their * values and verify them. */ for (i = 0; i < nprops; i++) plist[i] = cpl_property_new(names[i], types[i]); cpl_property_set_char(plist[0], 'a'); cpl_test_eq(cpl_property_get_char(plist[0]), 'a'); cpl_property_set_bool(plist[1], 1); cpl_test_eq(cpl_property_get_bool(plist[1]), 1); cpl_property_set_int(plist[2], 100); cpl_test_eq(cpl_property_get_int(plist[2]), 100); cpl_property_set_long(plist[3], 10L); cpl_test_eq(cpl_property_get_long(plist[3]), 10L); cpl_property_set_float(plist[4], fval0); fval1 = cpl_property_get_float(plist[4]); cpl_test_abs(fval0, fval1, 0.0); cpl_property_set_double(plist[5], dval0); dval1 = cpl_property_get_double(plist[5]); cpl_test_abs(dval0, dval1, 0.0); /* * Try strings with different length to verify that the value is * properly resized. Note that the size of a string property includes * the byte for the trailing zero. */ cpl_property_set_string(plist[6], strings[0]); cpl_test_eq(cpl_property_get_size(plist[6]), ((cpl_size)strlen(strings[0]) + 1)); cpl_test_eq_string(cpl_property_get_string(plist[6]), strings[0]); cpl_property_set_string(plist[6], strings[1]); cpl_test_eq(cpl_property_get_size(plist[6]), ((cpl_size)strlen(strings[1]) + 1)); cpl_test_eq_string(cpl_property_get_string(plist[6]), strings[1]); cpl_property_set_string(plist[6], strings[2]); cpl_test_eq(cpl_property_get_size(plist[6]), ((cpl_size)strlen(strings[2]) + 1)); cpl_test_eq_string(cpl_property_get_string(plist[6]), strings[2]); code = cpl_property_set_float_complex(plist[7], zf0); cpl_test_eq_error(code, CPL_ERROR_NONE); zf1 = cpl_property_get_float_complex(plist[7]); cpl_test_error(CPL_ERROR_NONE); cpl_test_abs_complex(zf0, zf1, 0.0); cpl_test_eq(cpl_type_get_sizeof(CPL_TYPE_FLOAT_COMPLEX), sizeof(zf0)); cpl_property_set_double_complex(plist[8], zd0); cpl_test_eq_error(code, CPL_ERROR_NONE); zd1 = cpl_property_get_double_complex(plist[8]); cpl_test_error(CPL_ERROR_NONE); cpl_test_abs_complex(zd0, zd1, 0.0); /* * Test 5: Use the properties from the previous test, copy them and * and verify that original and copy are identical but don't * share any resources. */ for (i = 0; i < nprops; i++) { cpl_property_set_comment(plist[i], strings[1]); property = cpl_property_duplicate(plist[i]); cpl_test_noneq_ptr(property, plist[i]); cpl_test_noneq_ptr(cpl_property_get_name(property), cpl_property_get_name(plist[i])); cpl_test_noneq_ptr(cpl_property_get_comment(property), cpl_property_get_comment(plist[i])); cpl_test_eq(cpl_property_get_size(property), cpl_property_get_size(plist[i])); cpl_test_eq(cpl_property_get_type(property), cpl_property_get_type(plist[i])); switch (cpl_property_get_type(property)) { case CPL_TYPE_CHAR: cpl_test_eq(cpl_property_get_char(property), cpl_property_get_char(plist[i])); break; case CPL_TYPE_BOOL: cpl_test_eq(cpl_property_get_bool(property), cpl_property_get_bool(plist[i])); break; case CPL_TYPE_INT: cpl_test_eq(cpl_property_get_int(property), cpl_property_get_int(plist[i])); break; case CPL_TYPE_LONG: cpl_test_eq(cpl_property_get_long(property), cpl_property_get_long(plist[i])); break; case CPL_TYPE_FLOAT: fval1 = cpl_property_get_float(property); fval2 = cpl_property_get_float(plist[i]); cpl_test_abs(fval1, fval2, 0.0); break; case CPL_TYPE_DOUBLE: dval1 = cpl_property_get_double(property); dval2 = cpl_property_get_double(plist[i]); cpl_test_abs(dval1, dval2, 0.0); break; case CPL_TYPE_STRING: cpl_test_eq_string(cpl_property_get_string(property), cpl_property_get_string(plist[i])); break; case CPL_TYPE_FLOAT_COMPLEX: zf1 = cpl_property_get_float_complex(property); zf2 = cpl_property_get_float_complex(plist[i]); cpl_test_abs_complex(zf1, zf2, 0.0); break; case CPL_TYPE_DOUBLE_COMPLEX: zd1 = cpl_property_get_double_complex(property); zd2 = cpl_property_get_double_complex(plist[i]); cpl_test_abs_complex(zd1, zd2, 0.0); break; default: /* This should never happen */ cpl_test(0); break; } cpl_property_delete(plist[i]); cpl_property_delete(property); } /* * All tests finished */ return cpl_test_end(0); } cpl-6.4.1/cplcore/tests/cpl_filter_body.h0000644000460300003120000003050511663162543015326 00000000000000/* $Id: cpl_filter_body.h,v 1.15 2011-11-23 12:21:55 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-11-23 12:21:55 $ * $Revision: 1.15 $ * $Name: not supported by cvs2svn $ */ #define TYPE_ADD(a) CONCAT2X(a, PIXEL_TYPE) static void TYPE_ADD(filter_median_bf)(const PIXEL_TYPE *in, PIXEL_TYPE *out, unsigned Nx, unsigned Ny, unsigned Rx, unsigned Ry, unsigned mode) { PIXEL_TYPE *data = cpl_malloc((size_t)(2*Rx+1) * (size_t)(2*Ry+1) * sizeof(*data)); unsigned y; if (mode == CPL_BORDER_FILTER) { const unsigned Nx_larger = Nx + 2*Rx; const unsigned Ny_larger = Ny + 2*Ry; PIXEL_TYPE *in_larger = cpl_malloc((size_t)Nx_larger * (size_t)Ny_larger * sizeof(*in_larger)); assure( in_larger != NULL ); TYPE_ADD(cpl_image_filter_fill_chess)(in_larger, in, Nx_larger, Ny_larger, Nx, Ny, Rx, Ry); TYPE_ADD(filter_median_bf)(in_larger, out, Nx_larger, Ny_larger, Rx, Ry, CPL_BORDER_CROP); cpl_free(in_larger); } else { if (mode == CPL_BORDER_CROP) { out += Rx; } else { if (mode == CPL_BORDER_COPY) (void)memcpy(out, in, (Ry*Nx+Rx)*sizeof(*out)); out += Ry * Nx; } for (y = 0 + Ry; y < Ny-Ry; y++, out += Nx) { unsigned x = Rx; if (mode == CPL_BORDER_CROP) { out -= 2*Rx; /* Nx - 2 Rx medians in each row */ } else if (mode == CPL_BORDER_COPY) { if (y != Ry) { (void)memcpy(out-Rx, in + y * Nx - Rx, 2*Rx*sizeof(*out)); } } for (; x < Nx - Rx; x++) { unsigned k = 0; unsigned i, j; for (j = y-Ry; j <= y+Ry; j++) for (i = x-Rx; i <= x+Rx; i++) data[k++] = in[i + j*Nx]; out[x] = TYPE_ADD(cpl_tools_get_median)(data, k); } if (mode == CPL_BORDER_COPY) { if (y == Ny - Ry - 1) { (void)memcpy(out + Nx-Rx, in + Nx-Rx + y * Nx, Rx*sizeof(*out)); } } } if (mode == CPL_BORDER_COPY) { (void)memcpy(out, in + y * Nx, Ry*Nx*sizeof(*out)); } } cpl_free(data); return; } static void TYPE_ADD(test_cpl_image_filter)(unsigned Nx, unsigned Ny, unsigned Rx, unsigned Ry, unsigned filter, unsigned border_mode, unsigned Nreps1, unsigned Nreps2) { PIXEL_TYPE *in = cpl_malloc((size_t)Nx * (size_t)Ny * sizeof(*in)); /* Too large in crop mode */ PIXEL_TYPE *out = cpl_malloc((size_t)Nx * (size_t)Ny * sizeof(*out)); /* Too large in crop mode */ PIXEL_TYPE *ref = cpl_malloc((size_t)Nx * (size_t)Ny * sizeof(*ref)); cpl_mask * mask = cpl_mask_new(1 + 2 * Rx, 1 + 2 * Ry); const double myeps #ifdef PIXEL_TYPE_IS_INT = 0.0; #else = filter == CPL_FILTER_MEDIAN ? 0.0 : 1e1 * Nx * Ny * (sizeof(PIXEL_TYPE) == 4 ? FLT_EPSILON : DBL_EPSILON); #endif cpl_error_code error; assure( Nx > 0 ); assure( Ny > 0 ); assure( in != NULL ); assure( out != NULL ); assure( ref != NULL ); assure( mask != NULL ); error = cpl_mask_not(mask); cpl_test_eq_error(error, CPL_ERROR_NONE); { unsigned i, j; for (j = 0; j < Ny; j++) { for (i = 0; i < Nx; i++) { in[i + j*Nx] = (PIXEL_TYPE)(10.0 + rand_gauss()*3.0); /* fprintf(stderr, "(%d, %d): %f", i, j, in[i+j*Nx]); */ } /* fprintf(stderr, "\n"); */ } } { const unsigned Nxc = border_mode == CPL_BORDER_CROP ? Nx - 2 * Rx : Nx; const unsigned Nyc = border_mode == CPL_BORDER_CROP ? Ny - 2 * Ry : Ny; cpl_image *imgin = TYPE_ADD(cpl_image_wrap)(Nx, Ny, in); cpl_image *imgout = TYPE_ADD(cpl_image_wrap)(Nxc, Nyc, out); cpl_image *imgref = TYPE_ADD(cpl_image_wrap)(Nxc, Nyc, ref); unsigned i; for (i = 0; i < Nreps2; i++) { double t, tbf; unsigned j; if (border_mode == CPL_BORDER_NOP) { /* The border will not be set by the filtering, so preset it (to zero) */ memset(out, 0, Nxc*Nyc * sizeof(PIXEL_TYPE)); memset(ref, 0, Nxc*Nyc * sizeof(PIXEL_TYPE)); } /* binary heap + column arrays */ error = CPL_ERROR_NONE; t = cpl_test_get_cputime(); for (j = 0; j < Nreps1; j++) { error |= cpl_image_filter_mask(imgout, imgin, mask, filter, border_mode); } cpl_test_eq_error(error, CPL_ERROR_NONE); t = cpl_test_get_cputime()-t; if (1) { tbf = cpl_test_get_cputime(); for (j = 0; j < Nreps1; j++) { if (filter == CPL_FILTER_MEDIAN) { TYPE_ADD(filter_median_bf)(in, ref, Nx, Ny, Rx, Ry, border_mode); } else if (filter == CPL_FILTER_STDEV) { cpl_test(0); /* FIXME: Unsupported */ } else { #ifdef CPL_FILTER_TEST_AVERAGE_FAST TYPE_ADD(image_filter_average_ref)(ref, in, Nx, Ny, Rx, Ry, border_mode); #elif 1 TYPE_ADD(image_filter_average_bf)(ref, in, Nx, Ny, Rx, Ry, border_mode); #else error = filter_average_bf(imgref, imgin, Rx, Ry, border_mode); cpl_test_eq_error(error, CPL_ERROR_NONE); #endif } } tbf = cpl_test_get_cputime()-tbf; cpl_msg_info(cpl_func, "Time to %u-filter %u X %u " CPL_STRINGIFY(PIXEL_TYPE) " with %u X %u [s]: %f %f", border_mode, Nx, Ny, Rx, Ry, t, tbf); cpl_test_image_abs(imgout, imgref, myeps); } } cpl_test_eq_ptr(cpl_image_unwrap(imgin), in); cpl_test_eq_ptr(cpl_image_unwrap(imgout), out); cpl_test_eq_ptr(cpl_image_unwrap(imgref), ref); } cpl_free(in); cpl_free(out); cpl_free(ref); cpl_mask_delete(mask); } #ifdef CPL_FILTER_TEST_AVERAGE_FAST /*----------------------------------------------------------------------------*/ /** @internal @brief Average filter @param out filtered image @param in raw image @param nx Number of rows on image @param ny Number of cols on image @param hsizex width of filter window is 2*radius_x + 1 @param hsizey height of filter window is 2*radius_y + 1 @return void @see uves_filter_image_average() */ /*----------------------------------------------------------------------------*/ static void TYPE_ADD(image_filter_average_ref)(PIXEL_TYPE * out, const PIXEL_TYPE * in, int nx, int ny, int hsizex, int hsizey, unsigned border_mode) { PIXEL_TYPE * aux = calloc((nx+1)*(ny+1), sizeof(PIXEL_TYPE)); int i; assert(border_mode == CPL_BORDER_FILTER); /* First build auxillary image: * * aux(x,y) = sum_{i=0,x-1} sum_{j=0,y-1} image(i,j) * = sum of rectangle (0,0)-(x-1,y-1) * */ /* Column x=0 and row y=0 are already zero and need not be calculated, * start from 1. */ for (i = 0; i < (nx+1)*(ny+1); i++) { int x = i % (nx+1); int y = i / (nx+1); if ( x >= 1 && y >= 1) { aux[x + y*(nx+1)] = (PIXEL_TYPE)in[x-1 + (y-1) * nx] + aux [x-1 + y * (nx+1)] + aux [x + (y-1)* (nx+1)] - aux [x-1 + (y-1)* (nx+1)]; } /* Proof of induction step * (assume that formula holds up to (x-1,y) and (x,y-1) and prove formula for (x,y)) * * aux(x,y) = image(x-1, y-1) + aux(x-1, y) + aux(x, y-1) - aux(x-1, y-1) (see code) * * = image(x-1, y-1) * + sum_{i=0,x-2}_{j=0,y-1} image(i,j) _ * + sum_{i=0,x-1}_{j=0,y-2} image(i,j) \_ sum_{j=0,y-2} image(x-1, j) * - sum_{i=0,x-2}_{j=0,y-2} image(i,j) _/ * * = sum_{i=0,x-2}_{j=0,y-1} image(i,j) * + sum_ {j=0,y-1} image(x-1, j) * * = sum_{j=0,y-1} [ ( sum_{i=0,x-2} image(i,j) ) + image(x-1,j) ] * = sum_{j=0,y-1} sum_{i=0,x-1} image(i,j) q.e.d. * * It's simpler when you draw it... */ } /* Then calculate average = (flux in window) / (image size) */ for (i = 0; i < nx*ny; i++) { int x = (i % nx); int y = (i / nx); int lower, upper; int left, right; lower = y - hsizey; if (lower < 0) lower = 0; upper = y + hsizey; if (upper >= ny) upper = ny - 1; left = x - hsizex; if (left < 0) left = 0; right = x + hsizex; if (right >= nx) right = nx - 1; out[x + y*nx] = (PIXEL_TYPE)(( ( aux[(right+1) + (upper+1)*(nx+1)] + aux[ left + lower *(nx+1)] - aux[ left + (upper+1)*(nx+1)] - aux[(right+1) + lower *(nx+1)] ) / (PIXEL_TYPE) ( (upper-lower+1) * (right-left+1) ))); } free(aux); return; } #else /*----------------------------------------------------------------------------*/ /** @internal @brief Average filter @param out filtered image @param in raw image @param nx Number of rows on image @param ny Number of cols on image @param hsizex width of filter window is 2*radius_x + 1 @param hsizey height of filter window is 2*radius_y + 1 @return void @see uves_filter_image_average() */ /*----------------------------------------------------------------------------*/ static void TYPE_ADD(image_filter_average_bf)(PIXEL_TYPE * out, const PIXEL_TYPE * in, int Nx, int Ny, int hsizex, int hsizey, unsigned border_mode) { int y; assert(border_mode == CPL_BORDER_FILTER); for (y = 0; y < Ny; y++, out += Nx) { int x; for (x = 0; x < Nx; x++) { int k = 0; int i, j; PIXEL_TYPE sum = (PIXEL_TYPE)0; for (j = y < hsizey ? 0 : y-hsizey; j <= (y+hsizey >= Ny ? Ny - 1 : y+hsizey); j++) { for (i = x < hsizex ? 0 : x-hsizex; i <= (x+hsizex >= Nx ? Nx-1 : x+hsizex); i++) { sum += in[i + j*Nx]; k++; } } out[x] = sum/(PIXEL_TYPE)k; } } return; } #endif #undef SWAP_ONE #undef SORT_ONE cpl-6.4.1/cplcore/tests/cpl_memory-test.c0000644000460300003120000002607711674355763015327 00000000000000/* $Id: cpl_memory-test.c,v 1.27 2011-12-21 13:15:31 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-12-21 13:15:31 $ * $Revision: 1.27 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_memory.h" #include "cpl_test.h" #include "cpl_io_fits.h" #include "cpl_tools.h" #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef CPL_XMEMORY_MODE # error "Must know CPL_XMEMORY_MODE" #endif #ifndef CPL_XMEMORY_MAXPTRS # error "Must know CPL_XMEMORY_MAXPTRS" #endif /* Fill the xmemory table to this level */ /* A positive number not exceeding 1.0 */ #ifndef CPL_XMEMORY_FILL # define CPL_XMEMORY_FILL 0.999 #endif /* Half the number of pointers to test with */ #if CPL_XMEMORY_MODE == 2 #define CPL_MEMORY_MAXPTRS_HALF \ ((int)(0.5*CPL_XMEMORY_MAXPTRS*CPL_XMEMORY_FILL)) #else #define CPL_MEMORY_MAXPTRS_HALF \ ((int)(0.5*200003*CPL_XMEMORY_FILL)) #endif #if CPL_XMEMORY_MODE == 0 # define CPL_MEMORY_IS_EMPTY -1 # define CPL_MEMORY_IS_NON_EMPTY -1 #else # define CPL_MEMORY_IS_EMPTY 1 # define CPL_MEMORY_IS_NON_EMPTY 0 #endif static int cpl_memory_test_is_empty(void); static int cpl_memory_test_is_non_empty(void); /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_utils_test Testing of the CPL memory functions */ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Unit tests of CPL memory module **/ /*----------------------------------------------------------------------------*/ int main(void) { cpl_boolean do_bench; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Need to disable the (unused) FITS caching so no memory is allocated */ (void)cpl_io_fits_end(); do_bench = cpl_msg_get_level() <= CPL_MSG_INFO ? CPL_TRUE : CPL_FALSE; /* Insert tests below */ #if defined CPL_XMEMORY_MODE cpl_msg_info(cpl_func, CPL_XSTRINGIFY(CPL_XMEMORY_MODE) ": " CPL_STRINGIFY(CPL_XMEMORY_MODE) "\n"); #else cpl_msg_info(cpl_func, "CPL_XMEMORY_MODE is not defined\n"); #endif /* Test cpl_malloc(), cpl_calloc, cpl_realloc(), cpl_free() */ { const size_t size = 997; void * buf1; void * buf2; cpl_free(NULL); if (cpl_msg_get_level() <= CPL_MSG_INFO) cpl_memory_dump(); cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_empty()); if (cpl_msg_get_level() <= CPL_MSG_INFO) cpl_memory_dump(); buf1 = cpl_malloc(size); buf2 = cpl_calloc(size, size); cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_non_empty()); cpl_free(buf1); cpl_free(buf2); cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_empty()); buf1 = cpl_malloc(size); buf2 = cpl_calloc(size, size); cpl_test_nonnull(buf1); cpl_test_nonnull(buf2); cpl_test(buf1 != buf2); cpl_test(memset(buf1, 0, size) == buf1); cpl_test_zero(memcmp(buf1, buf2, size)); buf2 = cpl_realloc(buf2, size); cpl_test_nonnull(buf2); cpl_test(buf1 != buf2); cpl_test_zero(memcmp(buf1, buf2, size)); cpl_free(buf1); cpl_free(buf2); cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_empty()); /* Test cpl_malloc() involving zero size */ buf1 = cpl_malloc(0); if (buf1 == NULL) { cpl_msg_info(cpl_func, "cpl_malloc(0) returned NULL"); } else { cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_non_empty()); } cpl_free(buf1); cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_empty()); /* Test cpl_calloc() involving zero size */ buf2 = cpl_calloc(0, 0); if (buf2 == NULL) { cpl_msg_info(cpl_func, "cpl_calloc(0, 0) returned NULL"); } else { cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_non_empty()); } cpl_free(buf2); buf1 = cpl_calloc(0, size); if (buf1 == NULL) { cpl_msg_info(cpl_func, "cpl_calloc(0, size) returned NULL"); } cpl_free(buf1); buf1 = cpl_calloc(size, 0); if (buf1 == NULL) { cpl_msg_info(cpl_func, "cpl_calloc(size, 0) returned NULL"); } else { cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_non_empty()); } cpl_free(buf1); /* Test cpl_realloc() involving zero size */ buf1 = cpl_realloc(NULL, 0); if (buf1 == NULL) { cpl_msg_info(cpl_func, "cpl_realloc(NULL, 0) returned NULL"); } else { cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_non_empty()); } buf1 = cpl_realloc(buf1, 0); if (buf1 == NULL) { cpl_msg_info(cpl_func, "cpl_realloc(buf1, 0) returned NULL"); } else { cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_non_empty()); } buf1 = cpl_realloc(buf1, size); cpl_test_nonnull(buf1); buf1 = cpl_realloc(buf1, 0); if (buf1 == NULL) { cpl_msg_info(cpl_func, "cpl_realloc(buf1, 0) returned NULL"); } else { cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_non_empty()); } cpl_free(buf1); cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_empty()); } /* Test cpl_sprintf() */ { const char * string = __FILE__; /* Some non-empty string */ char * null; /* This string is supposed to always be NULL */ const char * null2; /* This string is supposed to always be NULL */ char * nonnull; /* String is supposed to never be NULL */ /* Create a copy of an empty string */ nonnull = cpl_sprintf("%s", ""); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq_string(nonnull, ""); cpl_free(nonnull); /* Create a copy of the string */ nonnull = cpl_sprintf("%s", string); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq_string(nonnull, string); cpl_free(nonnull); /* Successfully create an illegal format string */ nonnull = cpl_sprintf("%s %s", string, "%"); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq_string(nonnull, __FILE__ " %"); /* Check if an error is produced using that illegal format */ null = cpl_sprintf(nonnull, "."); if (null != NULL) { cpl_test_error(CPL_ERROR_NONE); cpl_msg_warning(cpl_func, "The supposedly illegal format '%s' " "produced the string: '%s'", nonnull, null); cpl_free(null); null = NULL; } else { cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); } cpl_free(nonnull); null2 = cpl_sprintf(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(null2); /* A NULL-pointer as a format argument does not trigger an error */ nonnull = cpl_sprintf("%s", null2); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(nonnull); cpl_free(nonnull); } /* Test cpl_strdup() */ { const char * string = __FILE__; /* Some non-empty string */ char * nonnull; /* String is supposed to never be NULL */ /* Create a copy of the string */ nonnull = cpl_strdup(string); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(nonnull); cpl_test_eq_string(nonnull, string); cpl_free(nonnull); } if (do_bench && CPL_MEMORY_MAXPTRS_HALF > 0) { /* Always compile the bench-marking code */ int ii = 2; int i; void * buf1[CPL_MEMORY_MAXPTRS_HALF]; void * buf2[CPL_MEMORY_MAXPTRS_HALF]; cpl_msg_info("", "Testing memory allocation with %d X 2*%d", ii, CPL_MEMORY_MAXPTRS_HALF); do { for (i = 0; i < CPL_MEMORY_MAXPTRS_HALF; i++) { buf1[i] = cpl_malloc(16); buf2[i] = cpl_calloc(4, 16); } cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_non_empty()); for (i = 0; i < CPL_MEMORY_MAXPTRS_HALF; i++) { buf1[i] = cpl_realloc(buf1[i], 32); buf2[i] = cpl_realloc(buf2[i], 32); } cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_non_empty()); for (i = 0; i < CPL_MEMORY_MAXPTRS_HALF; i++) { cpl_free(buf1[i]); cpl_free(buf2[i]); } cpl_test_eq(cpl_memory_is_empty(), cpl_memory_test_is_empty()); } while (--ii); } if (cpl_msg_get_level() <= CPL_MSG_INFO) cpl_memory_dump(); return cpl_test_end(0); } static int cpl_memory_test_is_empty(void) { #if defined CPL_XMEMORY_MODE && CPL_XMEMORY_MODE != 0 int is_empty = 1; #else int is_empty = -1; #endif /* Copied from cpl_init() */ const char * memory_mode_string = getenv("CPL_MEMORY_MODE"); if (memory_mode_string != NULL) { if (strcmp("0", memory_mode_string) == 0) { is_empty = -1; } else if (strcmp("1", memory_mode_string) == 0) { is_empty = 1; } else if (strcmp("2", memory_mode_string) == 0) { is_empty = 1; } } return is_empty; } static int cpl_memory_test_is_non_empty(void) { #if defined CPL_XMEMORY_MODE && CPL_XMEMORY_MODE != 0 int is_non_empty = 0; #else int is_non_empty = -1; #endif /* Copied from cpl_init() */ const char * memory_mode_string = getenv("CPL_MEMORY_MODE"); if (memory_mode_string != NULL) { if (strcmp("0", memory_mode_string) == 0) { is_non_empty = -1; } else if (strcmp("1", memory_mode_string) == 0) { is_non_empty = 0; } else if (strcmp("2", memory_mode_string) == 0) { is_non_empty = 0; } } return is_non_empty; } cpl-6.4.1/cplcore/tests/cpl_error-test.c0000644000460300003120000003410212136437212015114 00000000000000/* $Id: cpl_error-test.c,v 1.25 2013-04-26 08:44:58 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-26 08:44:58 $ * $Revision: 1.25 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include /*----------------------------------------------------------------------------- Prototypes of private functions -----------------------------------------------------------------------------*/ static cpl_error_code cpl_error_test_set(cpl_error_code); static cpl_error_code cpl_error_test_set_where(void); static cpl_error_code cpl_error_test_set_message(cpl_error_code); static cpl_error_code cpl_error_test_set_message_empty(cpl_error_code); static cpl_error_code cpl_error_test_set_fits(cpl_error_code); static cpl_error_code cpl_error_test_set_regex(cpl_error_code); static cpl_error_code cpl_error_test_ensure(cpl_error_code); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { const cpl_boolean has_func = strcmp(cpl_func, "main") ? CPL_FALSE : CPL_TRUE; cpl_error_code ierror; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests here */ /* Test 1: Verify that the error state is empty on start-up */ cpl_test_zero( CPL_ERROR_NONE ); cpl_test_eq( cpl_error_get_code(), CPL_ERROR_NONE ); cpl_test_zero( cpl_error_get_line() ); cpl_test_zero( strlen(cpl_error_get_function()) ); cpl_test_zero( strlen(cpl_error_get_file()) ); /* Test 1b: Verify that cpl_error_set() will not change that */ cpl_test_eq( cpl_error_test_set(CPL_ERROR_NONE), CPL_ERROR_NONE ); cpl_test_eq( cpl_error_get_code(), CPL_ERROR_NONE ); cpl_test_zero( cpl_error_get_line() ); cpl_test_zero( strlen(cpl_error_get_function()) ); cpl_test_zero( strlen(cpl_error_get_file()) ); /* Test 1c: Verify that cpl_error_set_where() will not change that */ cpl_test_eq( cpl_error_test_set_where(), CPL_ERROR_NONE ); cpl_test_eq( cpl_error_get_code(), CPL_ERROR_NONE ); cpl_test_zero( cpl_error_get_line() ); cpl_test_zero( strlen(cpl_error_get_function()) ); cpl_test_zero( strlen(cpl_error_get_file()) ); /* Test 1d: Verify that cpl_error_set_message() will not change that */ cpl_test_eq( cpl_error_test_set_message(CPL_ERROR_NONE), CPL_ERROR_NONE); cpl_test_eq( cpl_error_get_code(), CPL_ERROR_NONE ); cpl_test_zero( cpl_error_get_line() ); cpl_test_zero( strlen(cpl_error_get_function()) ); cpl_test_zero( strlen(cpl_error_get_file()) ); /* Test 1e: Verify that cpl_error_set_fits() will not change that */ cpl_test_eq( cpl_error_test_set_fits(CPL_ERROR_NONE), CPL_ERROR_NONE); cpl_test_eq( cpl_error_get_code(), CPL_ERROR_NONE ); cpl_test_zero( cpl_error_get_line() ); cpl_test_zero( strlen(cpl_error_get_function()) ); cpl_test_zero( strlen(cpl_error_get_file()) ); /* Test 1f: Verify that cpl_error_set_regex() will not change that */ cpl_test_eq( cpl_error_test_set_regex(CPL_ERROR_NONE), CPL_ERROR_NONE); cpl_test_eq( cpl_error_get_code(), CPL_ERROR_NONE ); cpl_test_zero( cpl_error_get_line() ); cpl_test_zero( strlen(cpl_error_get_function()) ); cpl_test_zero( strlen(cpl_error_get_file()) ); /* Do a number of tests on all (other) error codes */ for (ierror = CPL_ERROR_NONE; ierror <= CPL_ERROR_EOL+1; ierror++) { char msg[CPL_ERROR_MAX_MESSAGE_LENGTH]; unsigned line; /* The expected error code */ const cpl_error_code eerror = ierror == CPL_ERROR_HISTORY_LOST ? CPL_ERROR_UNSPECIFIED : ierror; /* Test 2: Verify that cpl_error_set_message() correctly sets the error */ cpl_test_eq( cpl_error_test_set_message(ierror), eerror ); cpl_test_eq( cpl_error_get_code(), eerror ); /* - Except if the CPL error code is CPL_ERROR_NONE */ if (ierror == CPL_ERROR_NONE) continue; cpl_test( cpl_error_get_line() > __LINE__ ); cpl_test_eq_string(cpl_error_get_file(), __FILE__); cpl_test_eq_string(cpl_error_get_function(), "hardcoded"); cpl_test_noneq_string(cpl_error_get_message(), cpl_error_get_message_default(eerror)); cpl_test_eq_ptr(strstr(cpl_error_get_message(), cpl_error_get_message_default(eerror)), cpl_error_get_message()); strncpy(msg, cpl_error_get_message(), CPL_ERROR_MAX_MESSAGE_LENGTH); msg[CPL_ERROR_MAX_MESSAGE_LENGTH-1] = '\0'; cpl_test( strlen(msg) > 0 ); /* Test 3: Verify that cpl_error_set_message() correctly sets the error */ cpl_test_eq( cpl_error_test_set_message_empty(ierror), eerror ); cpl_test_eq( cpl_error_get_code(), eerror ); cpl_test( cpl_error_get_line() > __LINE__ ); cpl_test_eq_string(cpl_error_get_file(), __FILE__); cpl_test_eq_string(cpl_error_get_function(), "hardcoded"); cpl_test_eq_string( cpl_error_get_message(), cpl_error_get_message_default(eerror) ); /* Test 4: Verify that cpl_error_set_fits() correctly sets the error */ cpl_test_eq( cpl_error_test_set_fits(ierror), eerror ); cpl_test_eq( cpl_error_get_code(), eerror ); cpl_test( cpl_error_get_line() > __LINE__ ); cpl_test_eq_string(cpl_error_get_file(), __FILE__); cpl_test_eq_string(cpl_error_get_function(), "cpl_error_test_set_fits"); cpl_test_noneq_string(cpl_error_get_message(), cpl_error_get_message_default(eerror)); cpl_test_eq_ptr(strstr(cpl_error_get_message(), cpl_error_get_message_default(eerror)), cpl_error_get_message()); /* Test 5: Verify that cpl_error_reset() correctly resets the error */ cpl_error_reset(); cpl_test_eq( cpl_error_get_code(), CPL_ERROR_NONE ); cpl_test_zero( cpl_error_get_line() ); cpl_test_zero( strlen(cpl_error_get_function()) ); cpl_test_zero( strlen(cpl_error_get_file()) ); /* Test 4a: Verify that cpl_error_set_regex() correctly sets the error */ cpl_test_eq( cpl_error_test_set_regex(ierror), eerror ); cpl_test_eq( cpl_error_get_code(), eerror ); cpl_test( cpl_error_get_line() > __LINE__ ); cpl_test_eq_string(cpl_error_get_file(), __FILE__); cpl_test_eq_string(cpl_error_get_function(), "cpl_error_test_set_regex"); cpl_test_noneq_string(cpl_error_get_message(), cpl_error_get_message_default(eerror)); cpl_test_eq_ptr(strstr(cpl_error_get_message(), cpl_error_get_message_default(eerror)), cpl_error_get_message()); /* Test 5a: Verify that cpl_error_reset() correctly resets the error */ cpl_error_reset(); cpl_test_eq( cpl_error_get_code(), CPL_ERROR_NONE ); cpl_test_zero( cpl_error_get_line() ); cpl_test_zero( strlen(cpl_error_get_function()) ); cpl_test_zero( strlen(cpl_error_get_file()) ); /* Test 6: Verify that cpl_ensure() correctly sets the error */ cpl_test_eq( cpl_error_test_ensure(ierror), eerror ); cpl_test_eq( cpl_error_get_code(), eerror ); cpl_test( cpl_error_get_line() > __LINE__ ); cpl_test_eq_string(cpl_error_get_file(), __FILE__); cpl_test_eq_ptr( strstr(msg, cpl_error_get_message()), msg ); cpl_test( strlen(msg) > strlen(cpl_error_get_message()) ); if (has_func) cpl_test_eq_string( cpl_error_get_function(), "cpl_error_test_ensure" ); line = cpl_error_get_line(); /* Test 7: Verify that cpl_error_set_where() propagates correctly */ cpl_test_eq( cpl_error_test_set_where(), eerror ); cpl_test_eq( cpl_error_get_code(), eerror ); cpl_test( cpl_error_get_line() > __LINE__ ); cpl_test_noneq( cpl_error_get_line(), line ); cpl_test_eq_string(cpl_error_get_file(), __FILE__); cpl_test( strstr(msg, cpl_error_get_message()) == msg ); cpl_test( strlen(msg) > strlen(cpl_error_get_message()) ); if (has_func) cpl_test_eq_string( cpl_error_get_function(), "where" ); /* Test 8: Verify that cpl_error_set() correctly sets the error */ cpl_test_eq( cpl_error_test_set(ierror), eerror ); cpl_test_eq( cpl_error_get_code(), eerror ); cpl_test( cpl_error_get_line() > __LINE__ ); cpl_test_eq_string(cpl_error_get_file(), __FILE__); cpl_test( strstr(msg, cpl_error_get_message()) == msg ); cpl_test( strlen(msg) > strlen(cpl_error_get_message()) ); if (has_func) cpl_test_eq_string( cpl_error_get_function(), "set" ); /* Test 9: Verify that cpl_error_reset() correctly resets the error */ cpl_error_reset(); cpl_test_eq( cpl_error_get_code(), CPL_ERROR_NONE ); cpl_test_zero( cpl_error_get_line() ); cpl_test_zero( strlen(cpl_error_get_function()) ); cpl_test_zero( strlen(cpl_error_get_file()) ); } /* End of actual test code */ return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Set the error using the supplied code and cpl_error_set() @param code The error code to set @return The error code */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_error_test_set(cpl_error_code code) { return cpl_error_set("set", code); } /*----------------------------------------------------------------------------*/ /** @internal @brief Propagate the CPL error @return The error code */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_error_test_set_where(void) { const cpl_error_code error = cpl_error_set_where("where"); const char * where = cpl_error_get_where(); if (error) { cpl_test_eq_ptr(where, strstr(where, "where")); cpl_test_nonnull(strstr(where, __FILE__)); } else { cpl_test_null(strstr(where, "where")); cpl_test_null(strstr(where, __FILE__)); } return error; } /*----------------------------------------------------------------------------*/ /** @internal @brief Set the error using the supplied code and cpl_error_set() @param code The error code to set @return The error code */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_error_test_set_message(cpl_error_code code) { return cpl_error_set_message("hardcoded", code, "Error-code=%u", (unsigned)code); } /*----------------------------------------------------------------------------*/ /** @internal @brief Set the error using the supplied code and cpl_error_set() @param code The error code to set @return The error code */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_error_test_set_fits(cpl_error_code code) { return cpl_error_set_fits(code, 0, "cfitsio_dummy", "Error-code=%u", (unsigned)code); } /*----------------------------------------------------------------------------*/ /** @internal @brief Set the error using the supplied code and cpl_error_set() @param code The error code to set @return The error code */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_error_test_set_regex(cpl_error_code code) { regex_t re; const int errcode = regcomp(&re, ")|(", REG_EXTENDED | REG_NOSUB); const cpl_error_code rcode = cpl_error_set_regex(code, errcode, code == CPL_ERROR_NULL_INPUT ? NULL : &re, "Error-code=%u", (unsigned)code); regfree(&re); return rcode; } /*----------------------------------------------------------------------------*/ /** @internal @brief Set the error using the supplied code and cpl_error_set() @param code The error code to set @return The error code */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_error_test_set_message_empty(cpl_error_code code) { return cpl_error_set_message("hardcoded", code, " "); } /*----------------------------------------------------------------------------*/ /** @internal @brief Set the error using the supplied code and cpl_error_ensure() @param code The error code to set @return The error code */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_error_test_ensure(cpl_error_code code) { cpl_ensure_code(0, code); } cpl-6.4.1/cplcore/tests/cpl_stats-test.c0000644000460300003120000004431612032326632015127 00000000000000/* $Id: cpl_stats-test.c,v 1.44 2012-10-01 14:50:02 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-10-01 14:50:02 $ * $Revision: 1.44 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include "cpl_stats.h" #include "cpl_image_stats.h" #include "cpl_image_gen.h" #include "cpl_image_io.h" #include "cpl_image_bpm.h" #include "cpl_memory.h" #include "cpl_test.h" #include "cpl_math_const.h" /*----------------------------------------------------------------------------- defines -----------------------------------------------------------------------------*/ #ifndef IMAGE_SIZE_X #define IMAGE_SIZE_X 256 #endif #ifndef IMAGE_SIZE_Y #define IMAGE_SIZE_Y IMAGE_SIZE_X #endif #if defined SIZEOF_SIZE_T && SIZEOF_SIZE_T == 4 #define TOL (800.0 * FLT_EPSILON) #else #define TOL (16.0 * DBL_EPSILON) #endif #define CPL_STAT_CMP(OP, FUNC) \ do { \ \ cpl_stats * statone; \ \ cpl_test_nonnull( statone = cpl_stats_new_from_image \ (img, CPL_CONCAT2X(CPL_STATS,OP))); \ \ /* Compare result from one-stats object with all-stats object */ \ cpl_test_abs( CPL_CONCAT2X(cpl_stats_get, FUNC)(statall), \ CPL_CONCAT2X(cpl_stats_get, FUNC)(statone), \ TOL); \ \ cpl_stats_delete(statone); \ \ } while (0) #define CPL_STAT_CMP_IMAGE(OP) \ do { \ \ /* Test NULL input */ \ (void)CPL_CONCAT2X(cpl_stats_get, OP)(NULL); \ cpl_test_error(CPL_ERROR_NULL_INPUT); \ \ (void)CPL_CONCAT2X(cpl_image_get, OP)(NULL); \ cpl_test_error(CPL_ERROR_NULL_INPUT); \ \ (void)CPL_CONCAT2X(cpl_image_get, CPL_CONCAT2X(OP,window)) \ (NULL, 1, 1, IMAGE_SIZE_X, IMAGE_SIZE_Y); \ cpl_test_error(CPL_ERROR_NULL_INPUT); \ \ /* Test out-of-range windows parameters */ \ (void)CPL_CONCAT2X(cpl_image_get, CPL_CONCAT2X(OP,window)) \ (img, 0, 1, IMAGE_SIZE_X, IMAGE_SIZE_Y); \ cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); \ \ (void)CPL_CONCAT2X(cpl_image_get, CPL_CONCAT2X(OP,window)) \ (img, 1, 0, IMAGE_SIZE_X, IMAGE_SIZE_Y); \ cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); \ \ (void)CPL_CONCAT2X(cpl_image_get, CPL_CONCAT2X(OP,window)) \ (img, 1, 1, IMAGE_SIZE_X+1, IMAGE_SIZE_Y); \ cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); \ \ (void)CPL_CONCAT2X(cpl_image_get, CPL_CONCAT2X(OP,window)) \ (img, 1, 1, IMAGE_SIZE_X, IMAGE_SIZE_Y+1); \ cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); \ \ /* Compare result from stats object with image window accessor */ \ cpl_test_abs( CPL_CONCAT2X(cpl_stats_get, OP)(statall), \ CPL_CONCAT2X(cpl_image_get, CPL_CONCAT2X(OP,window)) \ (img, 1, 1, IMAGE_SIZE_X, IMAGE_SIZE_Y), \ TOL); \ \ /* Compare result from stats object with image accessor */ \ cpl_test_abs( CPL_CONCAT2X(cpl_stats_get, OP)(statall), \ CPL_CONCAT2X(cpl_image_get, OP)(img), \ TOL); \ } while (0) #define CPL_STAT_CMP_VECTOR(OP, TOL) \ do { \ cpl_vector * vtest \ = cpl_vector_wrap(IMAGE_SIZE_X*IMAGE_SIZE_Y, \ cpl_image_get_data_double(img)); \ cpl_test_nonnull(vtest); \ cpl_test_abs(CPL_CONCAT2X(cpl_stats_get, OP)(statall), \ CPL_CONCAT2X(cpl_vector_get, OP)(vtest), \ TOL* DBL_EPSILON); \ cpl_test_nonnull(cpl_vector_unwrap(vtest)); \ } while (0) /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_stats_new_all_bench(const cpl_image *, int); static void cpl_stats_new_std_bench(const cpl_image *, int); static void cpl_stats_new_median_bench(const cpl_image *, int); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { const cpl_type img_types[] = {CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT}; const cpl_stats_mode istats[] = {CPL_STATS_MIN, CPL_STATS_MAX, CPL_STATS_MEDIAN, CPL_STATS_MEDIAN_DEV, CPL_STATS_MAD, CPL_STATS_STDEV, CPL_STATS_FLUX, CPL_STATS_ABSFLUX, CPL_STATS_SQFLUX, CPL_STATS_MINPOS, CPL_STATS_MAXPOS, CPL_STATS_CENTROID, CPL_STATS_MEAN}; FILE * stream; unsigned itype; cpl_boolean do_bench; cpl_mask * ones; cpl_error_code error; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); do_bench = cpl_msg_get_level() <= CPL_MSG_INFO ? CPL_TRUE : CPL_FALSE; stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; /* Test 1: NULL image */ cpl_test_null( cpl_stats_new_from_image(NULL, CPL_STATS_ALL) ); cpl_test_error(CPL_ERROR_NULL_INPUT); error = cpl_stats_dump(NULL, CPL_STATS_ALL, stream); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); ones = cpl_mask_new(IMAGE_SIZE_X, IMAGE_SIZE_Y); cpl_test_nonnull(ones); error = cpl_mask_not(ones); cpl_test_eq_error(error, CPL_ERROR_NONE); for (itype = 0; itype < sizeof(img_types)/sizeof(img_types[0]); itype++) { const cpl_type img_type = img_types[itype]; cpl_image * img = cpl_image_new(IMAGE_SIZE_X, IMAGE_SIZE_Y, img_type); cpl_stats * statall; unsigned istat; double med1, med2; double sig1, sig2; cpl_msg_info(cpl_func, "Testing %d X %d-image (type %u)", IMAGE_SIZE_X, IMAGE_SIZE_Y, (unsigned)img_type); cpl_test_nonnull(img); /* Test 2: Illegal stat-ops */ cpl_test_null( cpl_stats_new_from_image(img, CPL_STATS_MIN || CPL_STATS_MAX) ); cpl_test_error(CPL_ERROR_INVALID_TYPE); cpl_test_null( cpl_stats_new_from_image(img, ~CPL_STATS_ALL) ); cpl_test_error(CPL_ERROR_UNSUPPORTED_MODE); cpl_test_null( cpl_stats_new_from_image_window(img, CPL_STATS_ALL, 2, 2, 1, 1) ); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null( cpl_stats_new_from_image_window(img, CPL_STATS_ALL, 1, 1, IMAGE_SIZE_X, IMAGE_SIZE_Y+1) ); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_null( cpl_stats_new_from_image_window(img, CPL_STATS_ALL, 0, 0, IMAGE_SIZE_X, IMAGE_SIZE_Y) ); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_zero( cpl_image_fill_noise_uniform(img, (double)-IMAGE_SIZE_Y, (double)IMAGE_SIZE_X) ); cpl_test_nonnull( statall = cpl_stats_new_from_image(img, CPL_STATS_ALL) ); /* Test 3: NULL stream */ error = cpl_stats_dump(statall, CPL_STATS_ALL, NULL); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); /* Test 4: Illegal stat-ops on valid stat object */ error = cpl_stats_dump(statall, ~CPL_STATS_ALL, stream); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_stats_dump(statall, CPL_STATS_MIN || CPL_STATS_MAX, stream); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Test 5: Dump all */ cpl_test_zero( cpl_stats_dump(statall, CPL_STATS_ALL, stream) ); for (istat = 0; istat < sizeof(istats)/sizeof(istats[0]); istat++) { cpl_stats * statone; cpl_test_nonnull( statone = cpl_stats_new_from_image(img, istats[istat])); /* Test 6: Illegal dump on valid object */ error = cpl_stats_dump(statone, CPL_STATS_ALL | (~istats[istat]), stream); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Test 7: Valid dump on valid object */ cpl_test_zero( cpl_stats_dump(statone, istats[istat], stream) ); cpl_stats_delete(statone); } /* Test 7a: Compare result from one-stats object with all-stats object */ CPL_STAT_CMP(MIN, min); CPL_STAT_CMP(MAX, max); CPL_STAT_CMP(MEAN, mean); CPL_STAT_CMP(MEDIAN, median); CPL_STAT_CMP(MEDIAN_DEV, median_dev); CPL_STAT_CMP(MAD, mad); CPL_STAT_CMP(STDEV, stdev); CPL_STAT_CMP(FLUX, flux); CPL_STAT_CMP(ABSFLUX, absflux); CPL_STAT_CMP(SQFLUX, sqflux); CPL_STAT_CMP(CENTROID, centroid_x); CPL_STAT_CMP(CENTROID, centroid_y); CPL_STAT_CMP(MINPOS, min_y); CPL_STAT_CMP(MINPOS, min_x); CPL_STAT_CMP(MAXPOS, max_y); CPL_STAT_CMP(MAXPOS, max_x); /* Test 8: Verify that CPL_STAT_ALL yields equal result */ CPL_STAT_CMP_IMAGE(min); CPL_STAT_CMP_IMAGE(max); CPL_STAT_CMP_IMAGE(mean); CPL_STAT_CMP_IMAGE(median); CPL_STAT_CMP_IMAGE(stdev); CPL_STAT_CMP_IMAGE(flux); CPL_STAT_CMP_IMAGE(absflux); CPL_STAT_CMP_IMAGE(sqflux); CPL_STAT_CMP_IMAGE(centroid_x); CPL_STAT_CMP_IMAGE(centroid_y); cpl_test_abs( cpl_stats_get_median(statall), cpl_image_get_mad_window(img, 1, 1, IMAGE_SIZE_X, IMAGE_SIZE_Y, &sig1), 0.0); cpl_test_abs( cpl_stats_get_median(statall), cpl_image_get_mad(img, &sig2), 0.0); cpl_test_abs( sig1, sig2, 0.0); /* Pixel values are not Gaussian, so the MAD cannot be used to estimate the standard deviation. */ cpl_msg_info(cpl_func, "MAD as std.dev. estimator: MAD * 1.4826 = %g " "<=> %g = st.dev.", sig1 * CPL_MATH_STD_MAD, cpl_stats_get_stdev(statall)); cpl_test_abs( cpl_stats_get_median(statall), cpl_image_get_median_dev_window(img, 1, 1, IMAGE_SIZE_X, IMAGE_SIZE_Y, &sig1), 0.0); cpl_test_abs( cpl_stats_get_median(statall), cpl_image_get_median_dev(img, &sig2), 0.0); cpl_test_abs( sig1, sig2, 0.0); if (img_type == CPL_TYPE_DOUBLE) { /* FIXME: Tolerance needed for mean and stdev */ CPL_STAT_CMP_VECTOR(min, 0.0); CPL_STAT_CMP_VECTOR(max, 0.0); CPL_STAT_CMP_VECTOR(mean, 16.0); CPL_STAT_CMP_VECTOR(stdev, 16.0 * IMAGE_SIZE_X); } cpl_stats_delete(statall); med2 = cpl_image_get_median(img); /* Test cpl_image_get_median_dev() */ med1 = cpl_image_get_median_dev(img, &sig1); cpl_test_abs( med1, med2, 0.0 ); cpl_test_leq( 0.0, sig1 ); if (do_bench) { cpl_stats_new_all_bench(img, 500); cpl_stats_new_std_bench(img, 500); cpl_stats_new_median_bench(img, 100); } else { cpl_stats_new_all_bench(img, 1); cpl_stats_new_std_bench(img, 1); cpl_stats_new_median_bench(img, 1); } /* Check error handling on all-rejected image */ cpl_test_zero(cpl_image_reject_from_mask(img, ones)); (void)cpl_image_get_median_dev(img, &sig1); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); (void)cpl_image_get_median_dev(img, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_image_delete(img); (void)cpl_image_get_median_dev(NULL, &sig1); cpl_test_error(CPL_ERROR_NULL_INPUT); } cpl_mask_delete(ones); if (stream != stdout) cpl_test_zero( fclose(stream) ); return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Benchmark the CPL function @param image The image to test on @param n The number of repeats @return void */ /*----------------------------------------------------------------------------*/ static void cpl_stats_new_all_bench(const cpl_image * image, int n) { double secs; int i; secs = cpl_test_get_cputime(); for (i = 0; i < n; i++) { cpl_stats * self = cpl_stats_new_from_image_window(image, CPL_STATS_ALL, 2, 2, IMAGE_SIZE_X-1, IMAGE_SIZE_Y-1); cpl_test_nonnull(self); cpl_stats_delete(self); } secs = cpl_test_get_cputime() - secs; cpl_msg_info(cpl_func,"Time spent computing %d %d X %d - sized image " "statistics [s]: %g", n, IMAGE_SIZE_X, IMAGE_SIZE_Y, secs); } /*----------------------------------------------------------------------------*/ /** @internal @brief Benchmark the CPL function @param image The image to test on @param n The number of repeats @return void */ /*----------------------------------------------------------------------------*/ static void cpl_stats_new_std_bench(const cpl_image * image, int n) { double secs; int i; secs = cpl_test_get_cputime(); for (i = 0; i < n; i++) { cpl_stats * self = cpl_stats_new_from_image_window(image, CPL_STATS_MEAN | CPL_STATS_STDEV, 2, 2, IMAGE_SIZE_X-1, IMAGE_SIZE_Y-1); cpl_test_nonnull(self); cpl_stats_delete(self); } secs = cpl_test_get_cputime() - secs; cpl_msg_info(cpl_func,"Time spent computing %d %d X %d - sized image " "mean and stdev [s]: %g", n, IMAGE_SIZE_X, IMAGE_SIZE_Y, secs); } /*----------------------------------------------------------------------------*/ /** @internal @brief Benchmark the CPL function @param image The image to test on @param n The number of repeats @return void */ /*----------------------------------------------------------------------------*/ static void cpl_stats_new_median_bench(const cpl_image * image, int n) { double secs; int i; secs = cpl_test_get_cputime(); for (i = 0; i < n; i++) { cpl_stats * self = cpl_stats_new_from_image_window(image, CPL_STATS_MEDIAN, 2, 2, IMAGE_SIZE_X-1, IMAGE_SIZE_Y-1); cpl_test_nonnull(self); cpl_stats_delete(self); } secs = cpl_test_get_cputime() - secs; cpl_msg_info(cpl_func,"Time spent computing %d %d X %d - sized image " "median [s]: %g", n, IMAGE_SIZE_X, IMAGE_SIZE_Y, secs); } cpl-6.4.1/cplcore/tests/cpl_table-test.c0000644000460300003120000072547012135504567015100 00000000000000/* $Id: cpl_table-test.c,v 1.75 2013-04-23 13:15:35 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-23 13:15:35 $ * $Revision: 1.75 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif /* Ensure declaration of the complex functions */ #include #include "cpl_table.h" #include "cpl_math_const.h" #include "cpl_test.h" #include "cpl_memory.h" #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define VERBOSE /* The actual verbosity is controlled with CPLs messaging */ #ifdef CPL_TEST_LARGE #define NROWS_LARGE 25000000 #elif !defined NROWS_LARGE #define NROWS_LARGE 2 #endif #ifndef NROWS #define NROWS 10 #endif #define BASE "cpl_table-test" /* * Test for functions returning a generic pointer to data. * * r = variable to store returned pointer to data - expected non-NULL * f = function call * m = message */ #define test_data(r,f,m) \ do { \ cpl_msg_info("test_data", "%s", m); \ r = f; \ cpl_assert(r != NULL); \ cpl_test_error(CPL_ERROR_NONE); \ } while (0) \ /* * Test for functions returning 0 on success. * * f = function call * m = message */ #define test(f,m) \ do { \ cpl_msg_info("test", "%s", m); \ cpl_test_zero(f); \ cpl_test_error(CPL_ERROR_NONE); \ } while (0) /* * Test for expected failure in functions returning 0 on success. * * e = expected error code * f = function call * m = message */ #define test_failure(e,f,m) \ do { \ cpl_msg_info("test_failure", "%s", m); \ cpl_test_eq_error(f, e); \ } while (0) /* * Test for functions returning an expected integer value. * * e = expected value * f = function call * m = message */ #define test_ivalue(e,f,m) \ do { \ cpl_msg_info("test_ivalue", "%s", m); \ cpl_test_eq(f, e); \ cpl_test_error(CPL_ERROR_NONE); \ } while (0) /* * Test for functions returning an expected pointer value. * * e = expected value * f = function call * m = message */ #define test_pvalue(e,f,m) \ do { \ cpl_msg_info("test_pvalue", "%s", m); \ cpl_test_eq_ptr(f, e); \ cpl_test_error(CPL_ERROR_NONE); \ } while (0) /* * Test for functions returning an expected floating point value. * * e = expected value * t = tolerance on expected value * f = function call * m = message */ #define test_fvalue(e,t,f,m) \ do { \ cpl_msg_info("test_fvalue", "%s", m); \ cpl_test_abs(f, e, t); \ cpl_test_error(CPL_ERROR_NONE); \ } while (0) /* * Test for functions returning an expected complex value. * * e = expected value * t = tolerance on expected value * f = function call * m = message */ #define test_cvalue(e,t,f,m) \ do { \ cpl_msg_info("test_cvalue", "%s", m); \ cpl_test_abs_complex(f, e, t); \ cpl_test_error(CPL_ERROR_NONE); \ } while (0) /* * Test for functions returning an expected character string. * * e = expected value * f = function call * m = message */ #define test_svalue(e,f,m) \ do { \ cpl_msg_info("test_svalue", "%s", m); \ cpl_test_eq_string(f, e); \ cpl_test_error(CPL_ERROR_NONE); \ } while (0) /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_table_test_zero_one(void); static void cpl_table_test_large(cpl_size); static int cpl_table_test_main(void); static int cpl_table_test_rest(void); static void cpl_table_test_20(cpl_table *); static void cpl_table_test_21(cpl_table *); static void cpl_table_test_22(cpl_table *); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* * Testing begins here */ cpl_table_test_zero_one(); (void)cpl_table_test_main(); (void)cpl_table_test_rest(); cpl_table_test_large(NROWS_LARGE); return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the main part of the CPL table functions @return Zero iff successful */ /*----------------------------------------------------------------------------*/ static int cpl_table_test_main(void) { int nrows = NROWS; int i, j, k, null; char message[80]; int *iArray; long long *llArray; float *fArray; double *dArray; double *ddArray; #ifdef _Complex_I float complex *cfArray; double complex *cdArray; double complex *cddArray; #endif char **sArray; int icheck[25]; float fcheck[25]; double dcheck[25]; #ifdef _Complex_I float complex cfcheck[25]; double complex cdcheck[25]; #endif const char *scheck[25]; const char *names[2]; cpl_table *table; cpl_table *copia; cpl_array *array; cpl_array *new_array; cpl_array *colnames; cpl_propertylist *reflist; cpl_error_code error; iArray = cpl_malloc(nrows * sizeof(int)); llArray = cpl_malloc(nrows * sizeof(long long)); fArray = cpl_malloc(nrows * sizeof(float)); dArray = cpl_malloc(nrows * sizeof(double)); ddArray = cpl_malloc(nrows * sizeof(double)); #ifdef _Complex_I cfArray = cpl_malloc(nrows * sizeof(float complex)); cdArray = cpl_malloc(nrows * sizeof(double complex)); cddArray = cpl_malloc(nrows * sizeof(double complex)); #endif sArray = cpl_malloc(nrows * sizeof(char *)); iArray[0] = 5; iArray[1] = 0; iArray[2] = 2; iArray[3] = 8; iArray[4] = 9; iArray[5] = 3; iArray[6] = 7; iArray[7] = 1; iArray[8] = 4; iArray[9] = 6; llArray[0] = 5LL; llArray[1] = 0LL; llArray[2] = 2LL; llArray[3] = 8LL; llArray[4] = 9LL; llArray[5] = 3LL; llArray[6] = 7LL; llArray[7] = 1LL; llArray[8] = 4LL; llArray[9] = 6LL; fArray[0] = 5.1; fArray[1] = 0.1; fArray[2] = 2.1; fArray[3] = 8.1; fArray[4] = 9.1; fArray[5] = 3.1; fArray[6] = 7.1; fArray[7] = 1.1; fArray[8] = 4.1; fArray[9] = 6.1; ddArray[0] = dArray[0] = 5.11; ddArray[1] = dArray[1] = 0.11; ddArray[2] = dArray[2] = 2.11; ddArray[3] = dArray[3] = 8.11; ddArray[4] = dArray[4] = 9.11; ddArray[5] = dArray[5] = 3.11; ddArray[6] = dArray[6] = 7.11; ddArray[7] = dArray[7] = 1.11; ddArray[8] = dArray[8] = 4.11; ddArray[9] = dArray[9] = 6.11; #ifdef _Complex_I cfArray[0] = 5.1; cfArray[1] = 0.1 * I; cfArray[2] = 2.1; cfArray[3] = 8.1 * I; cfArray[4] = 9.1 + 9.1 * I; cfArray[5] = 3.1 - 3.1 * I; cfArray[6] = 7.1 + 1.1 * I; cfArray[7] = 1.1 - 7.1 * I; cfArray[8] = -4.1 + 4.1 * I; cfArray[9] = -6.1 - 6.1 * I; cddArray[0] = cdArray[0] = 5.11; cddArray[1] = cdArray[1] = 0.11 * I; cddArray[2] = cdArray[2] = 2.11; cddArray[3] = cdArray[3] = 8.11 * I; cddArray[4] = cdArray[4] = 9.11 + 9.11 * I; cddArray[5] = cdArray[5] = 3.11 - 3.11 * I; cddArray[6] = cdArray[6] = 7.11 + 1.11 * I; cddArray[7] = cdArray[7] = 1.11 - 7.11 * I; cddArray[8] = cdArray[8] = -4.11 + 4.11 * I; cddArray[9] = cdArray[9] = -6.11 - 6.11 * I; #endif sArray[0] = cpl_strdup("caaa"); sArray[1] = cpl_strdup("abcd"); sArray[2] = cpl_strdup("aaaa"); sArray[3] = cpl_strdup("daaa"); sArray[4] = cpl_strdup("acde"); sArray[5] = cpl_strdup("baaa"); sArray[6] = cpl_strdup("aaaa"); sArray[7] = cpl_strdup("acde"); sArray[8] = cpl_strdup(" sss"); sArray[9] = cpl_strdup("daaa"); /* * Testing tables with more rows */ test_data(table, cpl_table_new(nrows), "Creating the test table... "); test(cpl_table_wrap_int(table, iArray, "Integer"), "Wrapping the Integer column... "); test_pvalue(iArray, cpl_table_unwrap(table, "Integer"), "Unwrap the Integer column data... "); test(cpl_table_wrap_int(table, iArray, "Integer"), "Creating the Integer column... "); test(cpl_table_wrap_long_long(table, llArray, "LongLong"), "Creating the LongLong column... "); test(cpl_table_wrap_double(table, dArray, "Double"), "Creating the Double column... "); test(cpl_table_wrap_double(table, ddArray, "DoubleDouble"), "Creating the DoubleDouble column... "); #ifdef _Complex_I test(cpl_table_wrap_double_complex(table, cdArray, "CDouble"), "Creating the CDouble column... "); test(cpl_table_wrap_double_complex(table, cddArray, "CDoubleDouble"), "Creating the CDoubleDouble column... "); #endif test(cpl_table_wrap_string(table, sArray, "String"), "Creating the String column... "); test(cpl_table_new_column(table, "Float", CPL_TYPE_FLOAT), "Creating the Float column... "); for (i = 0; i < nrows; i++) { sprintf(message, "Writing to row %d of the Float column... ", i); test(cpl_table_set_float(table, "Float", i, fArray[i]), message); } test(cpl_table_new_column(table, "CFloat", CPL_TYPE_FLOAT_COMPLEX), "Creating the CFloat column... "); #ifdef _Complex_I for (i = 0; i < nrows; i++) { sprintf(message, "Writing to row %d of the CFloat column... ", i); test(cpl_table_set_float_complex(table, "CFloat", i, cfArray[i]), message); } #endif test(cpl_table_new_column_array(table, "AInt", CPL_TYPE_INT | CPL_TYPE_POINTER, 20), "Creating the ArrayInt column... "); test(cpl_table_new_column_array(table, "ALongLong", CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER, 20), "Creating the ArrayLongLong column... "); test(cpl_table_new_column_array(table, "AFloat", CPL_TYPE_FLOAT, 20), "Creating the ArrayFloat column... "); test(cpl_table_new_column_array(table, "ADouble", CPL_TYPE_DOUBLE | CPL_TYPE_POINTER, 20), "Creating the ArrayDouble column... "); test(cpl_table_new_column_array(table, "CAFloat", CPL_TYPE_FLOAT_COMPLEX, 20), "Creating the CArrayFloat column... "); test(cpl_table_new_column_array(table, "CADouble", CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER, 20), "Creating the CArrayDouble column... "); test_ivalue(20, cpl_table_get_column_depth(table, "AInt"), "Check \"AInt\" depth (2)... "); k = 0; array = cpl_array_new(20, CPL_TYPE_INT); for (i = 0; i < nrows; i++) { for (j = 0; j < 20; j++) { sprintf(message, "Writing element %d of array %d of the AInt column... ", j, i); k++; test(cpl_array_set_int(array, j, k), message); } sprintf(message, "Setting array at position %d of the AInt column... ", i); test(cpl_table_set_array(table, "AInt", i, array), message); } new_array = cpl_array_cast(array, CPL_TYPE_DOUBLE); cpl_array_delete(new_array); cpl_array_delete(array); k = 0; for (i = 0; i < nrows; i++) { sprintf(message, "Getting array %d of the AInt column... ", i); test_data(array, (cpl_array *)cpl_table_get_array(table, "AInt", i), message); for (j = 0; j < 20; j++) { sprintf(message, "Reading element %d of array %d of the AInt column... ", j, i); k++; test_ivalue(k, cpl_array_get_int(array, j, &null), message); cpl_test_zero(null); } } k = 0; array = cpl_array_new(20, CPL_TYPE_LONG_LONG); for (i = 0; i < nrows; i++) { for (j = 0; j < 20; j++) { sprintf(message, "Writing element %d of array %d of the ALongLong column... ", j, i); k++; test(cpl_array_set_long_long(array, j, k), message); } sprintf(message, "Setting array at position %d of the ALongLong column... ", i); test(cpl_table_set_array(table, "ALongLong", i, array), message); } new_array = cpl_array_cast(array, CPL_TYPE_DOUBLE); cpl_array_delete(new_array); cpl_array_delete(array); k = 0; for (i = 0; i < nrows; i++) { sprintf(message, "Getting array %d of the ALongLong column... ", i); test_data(array, (cpl_array *)cpl_table_get_array(table, "ALongLong", i), message); for (j = 0; j < 20; j++) { sprintf(message, "Reading element %d of array %d of the ALongLong column... ", j, i); k++; test_ivalue((long long)k, cpl_array_get_long_long(array, j, &null), message); cpl_test_zero(null); } } k = 0; array = cpl_array_new(20, CPL_TYPE_FLOAT); for (i = 0; i < nrows; i++) { for (j = 0; j < 20; j++) { sprintf(message, "Writing element %d of array %d of the AFloat column... ", j, i); k++; test(cpl_array_set_float(array, j, k), message); } sprintf(message, "Setting array at position %d of the AFloat column... ", i); test(cpl_table_set_array(table, "AFloat", i, array), message); } new_array = cpl_array_cast(array, CPL_TYPE_INT); cpl_array_delete(new_array); cpl_array_delete(array); k = 0; for (i = 0; i < nrows; i++) { sprintf(message, "Getting array %d of the AFloat column... ", i); test_data(array, (cpl_array *)cpl_table_get_array(table, "AFloat", i), message); for (j = 0; j < 20; j++) { sprintf(message, "Reading element %d of array %d of the AFloat column... ", j, i); k++; test_fvalue((float)k, 0.0001, cpl_array_get_float(array, j, &null), message); cpl_test_zero(null); } } #ifdef _Complex_I k = 0; array = cpl_array_new(20, CPL_TYPE_FLOAT_COMPLEX); for (i = 0; i < nrows; i++) { for (j = 0; j < 20; j++) { sprintf(message, "Writing element %d of array %d of the CAFloat column... ", j, i); k++; test(cpl_array_set_float_complex(array, j, k + k * I), message); } sprintf(message, "Setting array at position %d of the CAFloat column... ", i); test(cpl_table_set_array(table, "CAFloat", i, array), message); } cpl_array_delete(array); k = 0; for (i = 0; i < nrows; i++) { sprintf(message, "Getting array %d of the CAFloat column... ", i); test_data(array, (cpl_array *)cpl_table_get_array(table, "CAFloat", i), message); for (j = 0; j < 20; j++) { sprintf(message, "Reading element %d of array %d of the CAFloat column... ", j, i); k++; test_cvalue(k + k * I, 0.0001, cpl_array_get_float_complex(array, j, &null), message); cpl_test_zero(null); } } #endif k = 0; array = cpl_array_new(20, CPL_TYPE_DOUBLE); for (i = 0; i < nrows; i++) { for (j = 0; j < 20; j++) { sprintf(message, "Writing element %d of array %d of the ADouble column... ", j, i); k++; test(cpl_array_set_double(array, j, k), message); } sprintf(message, "Setting array at position %d of the ADouble column... ", i); test(cpl_table_set_array(table, "ADouble", i, array), message); } cpl_array_delete(array); k = 0; for (i = 0; i < nrows; i++) { sprintf(message, "Getting array %d of the ADouble column... ", i); test_data(array, (cpl_array *)cpl_table_get_array(table, "ADouble", i), message); for (j = 0; j < 20; j++) { sprintf(message, "Reading element %d of array %d of the ADouble column... ", j, i); k++; test_fvalue((float)k, 0.0001, cpl_array_get_double(array, j, &null), message); cpl_test_zero(null); } } #ifdef _Complex_I k = 0; array = cpl_array_new(20, CPL_TYPE_DOUBLE_COMPLEX); for (i = 0; i < nrows; i++) { for (j = 0; j < 20; j++) { sprintf(message, "Writing element %d of array %d of the CADouble column... ", j, i); k++; test(cpl_array_set_double_complex(array, j, k + k * I), message); } sprintf(message, "Setting array at position %d of the CADouble column... ", i); test(cpl_table_set_array(table, "CADouble", i, array), message); } cpl_array_delete(array); k = 0; for (i = 0; i < nrows; i++) { sprintf(message, "Getting array %d of the CADouble column... ", i); test_data(array, (cpl_array *)cpl_table_get_array(table, "CADouble", i), message); for (j = 0; j < 20; j++) { sprintf(message, "Reading element %d of array %d of the CADouble column... ", j, i); k++; test_cvalue(k + k * I, 0.0001, cpl_array_get_double_complex(array, j, &null), message); cpl_test_zero(null); } } #endif test_ivalue(20, cpl_table_get_column_depth(table, "AInt"), "Check \"AInt\" depth (3)... "); test_data(array, (cpl_array *)cpl_table_get_array(table, "AInt", 0), "Get AInt array "); test_ivalue(CPL_TYPE_INT, cpl_array_get_type(array), "Array AInt must be int... "); test_ivalue(10, cpl_table_get_nrow(table), "Check table length (1)... "); test_ivalue(15, cpl_table_get_ncol(table), "Check table width... "); test_failure(CPL_ERROR_DATA_NOT_FOUND, cpl_table_erase_column(table, "Diable"), "Trying to delete a not existing column... "); test(cpl_table_erase_column(table, "DoubleDouble"), "Delete column \"DoubleDouble\"... "); test_ivalue(14, cpl_table_get_ncol(table), "Check again table width... "); test_ivalue(CPL_TYPE_INT, cpl_table_get_column_type(table, "Integer"), "Column Integer must be int... "); test_ivalue(CPL_TYPE_DOUBLE, cpl_table_get_column_type(table, "Double"), "Column Double must be double... "); test_ivalue(CPL_TYPE_STRING, cpl_table_get_column_type(table, "String"), "Column String must be char*... "); test_ivalue(CPL_TYPE_FLOAT, cpl_table_get_column_type(table, "Float"), "Column Float must be float... "); test_ivalue(CPL_TYPE_FLOAT_COMPLEX, cpl_table_get_column_type(table, "CFloat"), "Column CFloat must be float complex... "); test_ivalue(CPL_TYPE_DOUBLE_COMPLEX, cpl_table_get_column_type(table, "CDouble"), "Column CDouble must be double complex... "); test_ivalue((CPL_TYPE_INT | CPL_TYPE_POINTER), cpl_table_get_column_type(table, "AInt"), "Column AInt must be arrays of int... "); test_ivalue((CPL_TYPE_DOUBLE | CPL_TYPE_POINTER), cpl_table_get_column_type(table, "ADouble"), "Column Double must be arrays of double... "); test_ivalue((CPL_TYPE_FLOAT | CPL_TYPE_POINTER), cpl_table_get_column_type(table, "AFloat"), "Column Float must be arrays of float... "); test_ivalue((CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER), cpl_table_get_column_type(table, "CAFloat"), "Column CAFloat must be arrays of float complex... "); test_ivalue((CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER), cpl_table_get_column_type(table, "CADouble"), "Column CADouble must be arrays of double complex... "); test_pvalue(iArray, cpl_table_get_data_int(table, "Integer"), "Check pointer to column Integer data... "); test_pvalue(dArray, cpl_table_get_data_double(table, "Double"), "Check pointer to column Double data... "); test_pvalue(sArray, cpl_table_get_data_string(table, "String"), "Check pointer to column String data... "); copia = cpl_table_new(5); error = cpl_table_set_column_unit(table, "Integer", "Counts"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_column_unit(table, "Double", "erg/sec"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_column_unit(table, "String", "Name"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_column_unit(table, "AFloat", "erg/sec"); cpl_test_eq_error(error, CPL_ERROR_NONE); test(cpl_table_copy_structure(copia, table), "Creating a new cpl_table modeled on an existing cpl_table... "); test_ivalue(5, cpl_table_get_nrow(copia), "Check table length (2)... "); test_ivalue(14, cpl_table_get_ncol(copia), "Check table width... "); test(cpl_table_compare_structure(table, copia), "Tables must have the same structure... "); cpl_table_erase_column(copia, "Double"); test_ivalue(1, cpl_table_compare_structure(table, copia), "Deleting column Double - now tables must have different structure... "); test(cpl_table_new_column(copia, "Double", CPL_TYPE_DOUBLE), "Creating again the Double column... "); error = cpl_table_set_column_unit(copia, "Double", "erg/sec"); cpl_test_eq_error(error, CPL_ERROR_NONE); test(cpl_table_compare_structure(table, copia), "Tables must have the same structure again... "); test(cpl_table_fill_column_window_int(copia, "Integer", 0, 5, -1), "Fill column Integer of new table... "); test(cpl_table_fill_column_window_long_long(copia, "LongLong", 0, 5, -1), "Fill column LongLong of new table... "); test(cpl_table_fill_column_window_double(copia, "Double", 0, 5, -1.11), "Fill column Double of new table... "); test(cpl_table_fill_column_window_float(copia, "Float", 0, 5, -1.1), "Fill column Float of new table... "); #ifdef _Complex_I test(cpl_table_fill_column_window_double_complex(copia, "CDouble", 0, 5, -1.11 + 4.11 * I), "Fill column CDouble of new table... "); test(cpl_table_fill_column_window_float_complex(copia, "CFloat", 0, 5, -1.1 + 4.1 * I), "Fill column CFloat of new table... "); #endif test(cpl_table_fill_column_window_string(copia, "String", 0, 5, "extra"), "Fill column String of new table... "); array = cpl_array_new(20, CPL_TYPE_INT); for (j = 0; j < 20; j++) cpl_array_set_int(array, j, j); test(cpl_table_fill_column_window_array(copia, "AInt", 0, 5, array), "Fill column AInt of new table... "); cpl_array_delete(array); array = cpl_array_new(20, CPL_TYPE_LONG_LONG); for (j = 0; j < 20; j++) cpl_array_set_long_long(array, j, j); test(cpl_table_fill_column_window_array(copia, "ALongLong", 0, 5, array), "Fill column ALongLong of new table... "); cpl_array_delete(array); array = cpl_array_new(20, CPL_TYPE_FLOAT); for (j = 0; j < 20; j++) cpl_array_set_float(array, j, j); test(cpl_table_fill_column_window_array(copia, "AFloat", 0, 5, array), "Fill column AFloat of new table... "); cpl_array_delete(array); array = cpl_array_new(20, CPL_TYPE_DOUBLE); for (j = 0; j < 20; j++) cpl_array_set_double(array, j, j); test(cpl_table_fill_column_window_array(copia, "ADouble", 0, 5, array), "Fill column ADouble of new table... "); cpl_array_delete(array); #ifdef _Complex_I array = cpl_array_new(20, CPL_TYPE_FLOAT_COMPLEX); for (j = 0; j < 20; j++) cpl_array_set_float_complex(array, j, j + 0.5*I); test(cpl_table_fill_column_window_array(copia, "CAFloat", 0, 5, array), "Fill column CAFloat of new table... "); cpl_array_delete(array); array = cpl_array_new(20, CPL_TYPE_DOUBLE_COMPLEX); for (j = 0; j < 20; j++) cpl_array_set_double_complex(array, j, j + 0.5*I); test(cpl_table_fill_column_window_array(copia, "CADouble", 0, 5, array), "Fill column CADouble of new table... "); cpl_array_delete(array); #endif test(cpl_table_insert(table, copia, 15), "Appending new table to old table... "); test(cpl_table_insert(table, copia, 5), "Inserting new table in old table... "); test(cpl_table_insert(table, copia, 0), "Prepending new table to old table... "); cpl_table_delete(copia); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "2.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "2.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "2.fits", 1, 1); cpl_test_nonnull(table); /**/ test_ivalue(25, cpl_table_get_nrow(table), "Check table length (3)... "); icheck[0] = -1; icheck[1] = -1; icheck[2] = -1; icheck[3] = -1; icheck[4] = -1; icheck[5] = 5; icheck[6] = 0; icheck[7] = 2; icheck[8] = 8; icheck[9] = 9; icheck[10] = -1; icheck[11] = -1; icheck[12] = -1; icheck[13] = -1; icheck[14] = -1; icheck[15] = 3; icheck[16] = 7; icheck[17] = 1; icheck[18] = 4; icheck[19] = 6; icheck[20] = -1; icheck[21] = -1; icheck[22] = -1; icheck[23] = -1; icheck[24] = -1; for (i = 0; i < 25; i++) { test_ivalue(icheck[i], cpl_table_get_int(table, "Integer", i, &null), "Check Integer column... "); cpl_test_zero(null); } for (i = 0; i < 25; i++) { test_ivalue(icheck[i], cpl_table_get_long_long(table, "LongLong", i, &null), "Check LongLong column... "); cpl_test_zero(null); } dcheck[0] = -1.1100; dcheck[1] = -1.1100; dcheck[2] = -1.1100; dcheck[3] = -1.1100; dcheck[4] = -1.1100; dcheck[5] = 5.1100; dcheck[6] = 0.1100; dcheck[7] = 2.1100; dcheck[8] = 8.1100; dcheck[9] = 9.1100; dcheck[10] = -1.1100; dcheck[11] = -1.1100; dcheck[12] = -1.1100; dcheck[13] = -1.1100; dcheck[14] = -1.1100; dcheck[15] = 3.1100; dcheck[16] = 7.1100; dcheck[17] = 1.1100; dcheck[18] = 4.1100; dcheck[19] = 6.1100; dcheck[20] = -1.1100; dcheck[21] = -1.1100; dcheck[22] = -1.1100; dcheck[23] = -1.1100; dcheck[24] = -1.1100; for (i = 0; i < 25; i++) { test_fvalue(dcheck[i], 0.00001, cpl_table_get_double(table, "Double", i, &null), "Check Double column... "); cpl_test_zero(null); } scheck[0] = "extra"; scheck[1] = "extra"; scheck[2] = "extra"; scheck[3] = "extra"; scheck[4] = "extra"; scheck[5] = "caaa"; scheck[6] = "abcd"; scheck[7] = "aaaa"; scheck[8] = "daaa"; scheck[9] = "acde"; scheck[10] = "extra"; scheck[11] = "extra"; scheck[12] = "extra"; scheck[13] = "extra"; scheck[14] = "extra"; scheck[15] = "baaa"; scheck[16] = "aaaa"; scheck[17] = "acde"; scheck[18] = " sss"; scheck[19] = "daaa"; scheck[20] = "extra"; scheck[21] = "extra"; scheck[22] = "extra"; scheck[23] = "extra"; scheck[24] = "extra"; for (i = 0; i < 25; i++) { test_svalue(scheck[i], cpl_table_get_string(table, "String", i), "Check String column... "); } fcheck[0] = -1.10; fcheck[1] = -1.10; fcheck[2] = -1.10; fcheck[3] = -1.10; fcheck[4] = -1.10; fcheck[5] = 5.10; fcheck[6] = 0.10; fcheck[7] = 2.10; fcheck[8] = 8.10; fcheck[9] = 9.10; fcheck[10] = -1.10; fcheck[11] = -1.10; fcheck[12] = -1.10; fcheck[13] = -1.10; fcheck[14] = -1.10; fcheck[15] = 3.10; fcheck[16] = 7.10; fcheck[17] = 1.10; fcheck[18] = 4.10; fcheck[19] = 6.10; fcheck[20] = -1.10; fcheck[21] = -1.10; fcheck[22] = -1.10; fcheck[23] = -1.10; fcheck[24] = -1.10; for (i = 0; i < 25; i++) { test_fvalue(fcheck[i], 0.00001, cpl_table_get_float(table, "Float", i, &null), "Check Float column... "); cpl_test_zero(null); } #ifdef _Complex_I cfcheck[0] = -1.1 + 4.1 * I; cfcheck[1] = -1.1 + 4.1 * I; cfcheck[2] = -1.1 + 4.1 * I; cfcheck[3] = -1.1 + 4.1 * I; cfcheck[4] = -1.1 + 4.1 * I; cfcheck[5] = 5.1; cfcheck[6] = 0.1 * I; cfcheck[7] = 2.1; cfcheck[8] = 8.1 * I; cfcheck[9] = 9.1 + 9.1 * I; cfcheck[10] = -1.1 + 4.1 * I; cfcheck[11] = -1.1 + 4.1 * I; cfcheck[12] = -1.1 + 4.1 * I; cfcheck[13] = -1.1 + 4.1 * I; cfcheck[14] = -1.1 + 4.1 * I; cfcheck[15] = 3.1 - 3.1 * I; cfcheck[16] = 7.1 + 1.1 * I; cfcheck[17] = 1.1 - 7.1 * I; cfcheck[18] = -4.1 + 4.1 * I; cfcheck[19] = -6.1 - 6.1 * I; cfcheck[20] = -1.1 + 4.1 * I; cfcheck[21] = -1.1 + 4.1 * I; cfcheck[22] = -1.1 + 4.1 * I; cfcheck[23] = -1.1 + 4.1 * I; cfcheck[24] = -1.1 + 4.1 * I; for (i = 0; i < 25; i++) { test_cvalue(cfcheck[i], 0.00001, cpl_table_get_float_complex(table, "CFloat", i, &null), "Check CFloat column... "); cpl_test_zero(null); } cdcheck[0] = -1.11 + 4.11 * I; cdcheck[1] = -1.11 + 4.11 * I; cdcheck[2] = -1.11 + 4.11 * I; cdcheck[3] = -1.11 + 4.11 * I; cdcheck[4] = -1.11 + 4.11 * I; cdcheck[5] = 5.11; cdcheck[6] = 0.11 * I; cdcheck[7] = 2.11; cdcheck[8] = 8.11 * I; cdcheck[9] = 9.11 + 9.11 * I; cdcheck[10] = -1.11 + 4.11 * I; cdcheck[11] = -1.11 + 4.11 * I; cdcheck[12] = -1.11 + 4.11 * I; cdcheck[13] = -1.11 + 4.11 * I; cdcheck[14] = -1.11 + 4.11 * I; cdcheck[15] = 3.11 - 3.11 * I; cdcheck[16] = 7.11 + 1.11 * I; cdcheck[17] = 1.11 - 7.11 * I; cdcheck[18] = -4.11 + 4.11 * I; cdcheck[19] = -6.11 - 6.11 * I; cdcheck[20] = -1.11 + 4.11 * I; cdcheck[21] = -1.11 + 4.11 * I; cdcheck[22] = -1.11 + 4.11 * I; cdcheck[23] = -1.11 + 4.11 * I; cdcheck[24] = -1.11 + 4.11 * I; for (i = 0; i < 25; i++) { test_cvalue(cdcheck[i], 0.00001, cpl_table_get_double_complex(table, "CDouble", i, &null), "Check CDouble column... "); cpl_test_zero(null); } #endif test(cpl_table_set_invalid(table, "Integer", 0), "Set Integer 0 to NULL... "); test(cpl_table_set_invalid(table, "Integer", 5), "Set Integer 5 to NULL... "); test(cpl_table_set_invalid(table, "Integer", 24), "Set Integer 24 to NULL... "); test(cpl_table_set_invalid(table, "LongLong", 0), "Set LongLong 0 to NULL... "); test(cpl_table_set_invalid(table, "LongLong", 5), "Set LongLong 5 to NULL... "); test(cpl_table_set_invalid(table, "LongLong", 24), "Set LongLong 24 to NULL... "); test(cpl_table_set_invalid(table, "AInt", 0), "Set AInt 0 to NULL... "); test(cpl_table_set_invalid(table, "ALongLong", 0), "Set ALongLong 0 to NULL... "); test(cpl_table_set_invalid(table, "AFloat", 5), "Set AFloat 5 to NULL... "); test(cpl_table_set_invalid(table, "ADouble", 24), "Set ADouble 24 to NULL... "); test(cpl_table_set_invalid(table, "CAFloat", 5), "Set CAFloat 5 to NULL... "); test(cpl_table_set_invalid(table, "CADouble", 24), "Set CADouble 24 to NULL... "); test_ivalue(3, cpl_table_count_invalid(table, "Integer"), "Count Integer written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "AInt"), "Count AInt written NULLs... "); test_ivalue(3, cpl_table_count_invalid(table, "LongLong"), "Count LongLong written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "ALongLong"), "Count ALongLong written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "AFloat"), "Count AFloat written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "ADouble"), "Count ADouble written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "CAFloat"), "Count CAFloat written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "CADouble"), "Count CADouble written NULLs... "); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); #ifdef CPL_TABLE_TEST_FILL_INVALID test_ivalue(3, cpl_table_count_invalid(table, "Integer"), "Count Integer written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "AInt"), "Count AInt written NULLs... "); test_ivalue(3, cpl_table_count_invalid(table, "LongLong"), "Count LongLong written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "ALongLong"), "Count ALongLong written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "AFloat"), "Count AFloat written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "ADouble"), "Count ADouble written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "CAFloat"), "Count CAFloat written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "CADouble"), "Count CADouble written NULLs... "); #endif error = cpl_table_save(table, NULL, NULL, BASE "3.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "3.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "3.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ test_ivalue(3, cpl_table_count_invalid(table, "Integer"), "Count Integer written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "AInt"), "Count AInt written NULLs... "); test_ivalue(3, cpl_table_count_invalid(table, "LongLong"), "Count LongLong written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "ALongLong"), "Count ALongLong written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "AFloat"), "Count AFloat written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "ADouble"), "Count ADouble written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "CAFloat"), "Count CAFloat written NULLs... "); test_ivalue(1, cpl_table_count_invalid(table, "CADouble"), "Count CADouble written NULLs... "); for (i = 0; i < 25; i++) { const int ival = cpl_table_get_int(table, "Integer", i, &null); if (!null) { test_ivalue(icheck[i], ival, "Check Integer column... "); } else { cpl_test(i == 0 || i == 5 || i == 24); } } for (i = 0; i < 25; i++) { const long long ival = cpl_table_get_long_long(table, "LongLong", i, &null); if (!null) { test_ivalue(icheck[i], ival, "Check LongLong column... "); } else { cpl_test(i == 0 || i == 5 || i == 24); } } test(cpl_table_set_int(table, "Integer", 0, -1), "Set Integer 0 to -1... "); test(cpl_table_set_int(table, "Integer", 5, 5), "Set Integer 5 to 5... "); test(cpl_table_set_int(table, "Integer", 24, -1), "Set Integer 24 to -1... "); array = cpl_array_new(20, CPL_TYPE_INT); for (j = 0; j < 20; j++) cpl_array_set_int(array, j, j); test(cpl_table_set_array(table, "AInt", 0, array), "Set a valid array to AInt 0... "); cpl_array_delete(array); test_ivalue(0, cpl_table_count_invalid(table, "AInt"), "No invalid elements in AInt... "); test(cpl_table_set_long_long(table, "LongLong", 0, -1), "Set LongLong 0 to -1... "); test(cpl_table_set_long_long(table, "LongLong", 5, 5), "Set LongLong 5 to 5... "); test(cpl_table_set_long_long(table, "LongLong", 24, -1), "Set LongLong 24 to -1... "); array = cpl_array_new(20, CPL_TYPE_LONG_LONG); for (j = 0; j < 20; j++) cpl_array_set_long_long(array, j, j); test(cpl_table_set_array(table, "ALongLong", 0, array), "Set a valid array to ALongLong 0... "); cpl_array_delete(array); test_ivalue(0, cpl_table_count_invalid(table, "ALongLong"), "No invalid elements in ALongLong... "); array = cpl_array_new(20, CPL_TYPE_FLOAT); for (j = 0; j < 20; j++) cpl_array_set_float(array, j, j); test(cpl_table_set_array(table, "AFloat", 5, array), "Set a valid array to AFloat 5... "); cpl_array_delete(array); test_ivalue(0, cpl_table_count_invalid(table, "AFloat"), "No invalid elements in AFloat... "); array = cpl_array_new(20, CPL_TYPE_DOUBLE); for (j = 0; j < 20; j++) cpl_array_set_double(array, j, j); test(cpl_table_set_array(table, "ADouble", 24, array), "Set a valid array to ADouble 24... "); cpl_array_delete(array); test_ivalue(0, cpl_table_count_invalid(table, "ADouble"), "No invalid elements in ADouble... "); #ifdef _Complex_I array = cpl_array_new(20, CPL_TYPE_FLOAT_COMPLEX); for (j = 0; j < 20; j++) cpl_array_set_float_complex(array, j, j + 0.5*I); test(cpl_table_set_array(table, "CAFloat", 5, array), "Set a valid array to CAFloat 5... "); cpl_array_delete(array); test_ivalue(0, cpl_table_count_invalid(table, "CAFloat"), "No invalid elements in CAFloat... "); array = cpl_array_new(20, CPL_TYPE_DOUBLE_COMPLEX); for (j = 0; j < 20; j++) cpl_array_set_double_complex(array, j, j + 0.5*I); test(cpl_table_set_array(table, "CADouble", 24, array), "Set a valid array to CADouble 24... "); cpl_array_delete(array); test_ivalue(0, cpl_table_count_invalid(table, "CADouble"), "No invalid elements in CADouble... "); #endif /**+ FIXME: RESTORE!!! %%%%% */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "4.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "4.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "4.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ test_ivalue(0, cpl_table_count_invalid(table, "Integer"), "Count NULLs... "); for (i = 0; i < 25; i++) { const int ival = cpl_table_get_int(table, "Integer", i, &null); cpl_test_zero(null); if (!null) { test_ivalue(icheck[i], ival, "Check Integer column... "); } } test_ivalue(0, cpl_table_count_invalid(table, "LongLong"), "Count NULLs... "); for (i = 0; i < 25; i++) { const int ival = cpl_table_get_long_long(table, "LongLong", i, &null); cpl_test_zero(null); if (!null) { test_ivalue(icheck[i], ival, "Check LongLong column... "); } } test(cpl_table_set_invalid(table, "Double", 0), "Set Double 0 to NULL... "); test(cpl_table_set_invalid(table, "Double", 5), "Set Double 5 to NULL... "); test(cpl_table_set_invalid(table, "Double", 24), "Set Double 24 to NULL... "); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "5.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "5.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "5.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ test_ivalue(3, cpl_table_count_invalid(table, "Double"), "Count written Double NULLs... "); for (i = 0; i < 25; i++) { const double dval = cpl_table_get_double(table, "Double", i, &null); if (!null) { test_fvalue(dcheck[i], 0.0, dval, "Check Double column... "); } else { cpl_test(i == 0 || i == 5 || i == 24); } } test(cpl_table_set_double(table, "Double", 0, -1.11), "Set Double 0 to -1.11... "); test(cpl_table_set_double(table, "Double", 5, 5.11), "Set Double 5 to 5.11... "); test(cpl_table_set_double(table, "Double", 24, -1.11), "Set Double 24 to -1.11... "); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "6.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "6.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "6.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ test_ivalue(0, cpl_table_count_invalid(table, "Double"), "Count NULLs... "); for (i = 0; i < 25; i++) { const double dval = cpl_table_get_double(table, "Double", i, &null); cpl_test_zero(null); if (!null) { test_fvalue(dcheck[i], 0.00001, dval, "Check Double column... "); } } test(cpl_table_set_invalid(table, "String", 0), "Set String 0 to NULL... "); test(cpl_table_set_invalid(table, "String", 5), "Set String 5 to NULL... "); test(cpl_table_set_invalid(table, "String", 24), "Set String 24 to NULL... "); /**+ FIXME: RESTORE!!! %%% */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "7.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "7.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "7.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ test_ivalue(3, cpl_table_count_invalid(table, "String"), "Count written String NULLs... "); for (i = 0; i < 25; i++) { const char * sval = cpl_table_get_string(table, "String", i); if (sval != NULL) { test_svalue(scheck[i], sval, "Check String column... "); } else { cpl_test(i == 0 || i == 5 || i == 24); } } test(cpl_table_set_string(table, "String", 0, "extra"), "Set String 0 to \"extra\"... "); test(cpl_table_set_string(table, "String", 5, "caaa"), "Set String 5 to \"caaa\"... "); test(cpl_table_set_string(table, "String", 24, "extra"), "Set String 24 to \"extra\"... "); /**+ FIXME: RESTORE!!! %%% */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "8.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "8.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "8.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ test_ivalue(0, cpl_table_count_invalid(table, "String"), "Count NULLs... "); for (i = 0; i < 25; i++) { test_svalue(scheck[i], cpl_table_get_string(table, "String", i), "Check String column... "); } test(cpl_table_set_invalid(table, "Float", 0), "Set Float 0 to NULL... "); test(cpl_table_set_invalid(table, "Float", 5), "Set Float 5 to NULL... "); test(cpl_table_set_invalid(table, "Float", 24), "Set Float 24 to NULL... "); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "9.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "9.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "9.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ test_ivalue(3, cpl_table_count_invalid(table, "Float"), "Count written Float NULLs... "); for (i = 0; i < 25; i++) { const float fval = cpl_table_get_float(table, "Float", i, &null); if (!null) { test_fvalue(fcheck[i], 0.0, fval, "Check Float column... "); } else { cpl_test(i == 0 || i == 5 || i == 24); } } test(cpl_table_set_float(table, "Float", 0, -1.1), "Set Float 0 to -1.1... "); test(cpl_table_set_float(table, "Float", 5, 5.1), "Set Float 5 to 5.1... "); test(cpl_table_set_float(table, "Float", 24, -1.1), "Set Float 24 to -1.1... "); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "10.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "10.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "10.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ test_ivalue(0, cpl_table_count_invalid(table, "Float"), "Count NULLs... "); for (i = 0; i < 25; i++) { const float fval = cpl_table_get_float(table, "Float", i, &null); cpl_test_zero(null); if (!null) { test_fvalue(fcheck[i], 0.00001, fval, "Check Float column... "); } } /* %%% */ test(cpl_table_set_invalid(table, "CFloat", 0), "Set CFloat 0 to NULL... "); test(cpl_table_set_invalid(table, "CFloat", 5), "Set CFloat 5 to NULL... "); test(cpl_table_set_invalid(table, "CFloat", 24), "Set CFloat 24 to NULL... "); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "9a.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "9a.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "9a.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ #ifdef _Complex_I test_ivalue(3, cpl_table_count_invalid(table, "CFloat"), "Count written CFloat NULLs... "); for (i = 0; i < 25; i++) { const float complex fval = cpl_table_get_float_complex(table, "CFloat", i, &null); if (!null) { test_cvalue(cfcheck[i], 0.0, fval, "Check CFloat column... "); } else { cpl_test(i == 0 || i == 5 || i == 24); } } test(cpl_table_set_float_complex(table, "CFloat", 0, -1.1 + 4.1*I), "Set CFloat 0 to -1.1 + i4.1... "); test(cpl_table_set_float_complex(table, "CFloat", 5, 5.1), "Set CFloat 5 to 5.1... "); test(cpl_table_set_float_complex(table, "CFloat", 24, -1.1 + 4.1*I), "Set CFloat 24 to -1.1 + i4.1... "); #endif /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "10.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "10.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "10.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ #ifdef _Complex_I test_ivalue(0, cpl_table_count_invalid(table, "CFloat"), "Count NULLs... "); for (i = 0; i < 25; i++) { const float complex fval = cpl_table_get_float_complex(table, "CFloat", i, &null); cpl_test_zero(null); if (!null) { test_cvalue(cfcheck[i], 0.00001, fval, "Check CFloat column... "); } } #endif /* %%% */ test(cpl_table_set_column_invalid(table, "Integer", 0, 3), "Set Integer 0-2 to NULL... "); test(cpl_table_set_column_invalid(table, "Integer", 5, 3), "Set Integer 5-7 to NULL... "); test(cpl_table_set_column_invalid(table, "Integer", 20, 20), "Set Integer 20 till end to NULL... "); test(cpl_table_set_column_invalid(table, "AInt", 0, 3), "Set AInt 0-2 to NULL... "); test(cpl_table_set_column_invalid(table, "AInt", 5, 3), "Set AInt 5-7 to NULL... "); test(cpl_table_set_column_invalid(table, "AInt", 20, 20), "Set AInt 20 till end to NULL... "); /********/ array = (cpl_array *)cpl_table_get_array(table, "AInt", 3); test_ivalue(0, cpl_array_get_int(array, 0, &null), "Read array element 0..."); test_ivalue(0, null, "Check array element 0 is valid..."); test_ivalue(5, cpl_array_get_int(array, 5, &null), "Read array element 5..."); test_ivalue(0, null, "Check array element 5 is valid..."); test_ivalue(19, cpl_array_get_int(array, 19, &null), "Read array element 19..."); test_ivalue(0, null, "Check array element 19 is valid..."); cpl_array_set_invalid(array, 0); cpl_array_set_invalid(array, 5); cpl_array_set_invalid(array, 19); test_ivalue(0, cpl_array_get_int(array, 0, &null), "Read again array element 0..."); test_ivalue(1, null, "Check array element 0 is invalid..."); test_ivalue(0, cpl_array_get_int(array, 5, &null), "Read again array element 5..."); test_ivalue(1, null, "Check array element 5 is invalid..."); test_ivalue(0, cpl_array_get_int(array, 19, &null), "Read again array element 19..."); test_ivalue(1, null, "Check array element 19 is invalid..."); test(cpl_table_set_column_invalid(table, "LongLong", 0, 3), "Set LongLong 0-2 to NULL... "); test(cpl_table_set_column_invalid(table, "LongLong", 5, 3), "Set LongLong 5-7 to NULL... "); test(cpl_table_set_column_invalid(table, "LongLong", 20, 20), "Set LongLong 20 till end to NULL... "); test(cpl_table_set_column_invalid(table, "ALongLong", 0, 3), "Set ALongLong 0-2 to NULL... "); test(cpl_table_set_column_invalid(table, "ALongLong", 5, 3), "Set ALongLong 5-7 to NULL... "); test(cpl_table_set_column_invalid(table, "ALongLong", 20, 20), "Set ALongLong 20 till end to NULL... "); array = (cpl_array *)cpl_table_get_array(table, "ALongLong", 3); test_ivalue(0, cpl_array_get_long_long(array, 0, &null), "Read array element 0..."); test_ivalue(0, null, "Check array element 0 is valid..."); test_ivalue(5, cpl_array_get_long_long(array, 5, &null), "Read array element 5..."); test_ivalue(0, null, "Check array element 5 is valid..."); test_ivalue(19, cpl_array_get_long_long(array, 19, &null), "Read array element 19..."); test_ivalue(0, null, "Check array element 19 is valid..."); cpl_array_set_invalid(array, 0); cpl_array_set_invalid(array, 5); cpl_array_set_invalid(array, 19); test_ivalue(0, cpl_array_get_long_long(array, 0, &null), "Read again array element 0..."); test_ivalue(1, null, "Check array element 0 is invalid..."); test_ivalue(0, cpl_array_get_long_long(array, 5, &null), "Read again array element 5..."); test_ivalue(1, null, "Check array element 5 is invalid..."); test_ivalue(0, cpl_array_get_long_long(array, 19, &null), "Read again array element 19..."); test_ivalue(1, null, "Check array element 19 is invalid..."); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "11.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "11.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "11.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ test_ivalue(11, cpl_table_count_invalid(table, "Integer"), "Count Integer NULLs... "); test_ivalue(11, cpl_table_count_invalid(table, "AInt"), "Count AInt NULLs... "); for (i = 0; i < 25; i++) { const int ival = cpl_table_get_int(table, "Integer", i, &null); if (!null) { test_ivalue(icheck[i], ival, "Check Integer column... "); } else { cpl_test(i <= 2 || i >= 5); cpl_test(i <= 7 || i >= 20); } } test_ivalue(11, cpl_table_count_invalid(table, "LongLong"), "Count LongLong NULLs... "); test_ivalue(11, cpl_table_count_invalid(table, "ALongLong"), "Count ALongLong NULLs... "); for (i = 0; i < 25; i++) { const long long llval = cpl_table_get_long_long(table, "LongLong", i, &null); if (!null) { test_ivalue(icheck[i], llval, "Check LongLong column... "); } else { cpl_test(i <= 2 || i >= 5); cpl_test(i <= 7 || i >= 20); } } /* * Test valid and invalid elements of an array of AInt (after loading). */ array = (cpl_array *)cpl_table_get_array(table, "AInt", 3); test_ivalue(0, cpl_array_get_int(array, 0, &null), "Load again array element 0..."); test_ivalue(1, null, "Reloaded array element 0 is invalid..."); test_ivalue(0, cpl_array_get_int(array, 5, &null), "Load again array element 5..."); test_ivalue(1, null, "Reloaded array element 5 is invalid..."); test_ivalue(0, cpl_array_get_int(array, 19, &null), "Load again array element 19..."); test_ivalue(1, null, "Reloaded array element 19 is invalid..."); test_ivalue(6, cpl_array_get_int(array, 6, &null), "Load array element 6..."); test_ivalue(0, null, "Reloaded array element 6 is valid..."); /* * Test valid and invalid elements of an array of ALongLong (after loading). */ array = (cpl_array *)cpl_table_get_array(table, "ALongLong", 3); test_ivalue(0, cpl_array_get_long_long(array, 0, &null), "Load again array element 0..."); test_ivalue(1, null, "Reloaded array element 0 is invalid..."); test_ivalue(0, cpl_array_get_long_long(array, 5, &null), "Load again array element 5..."); test_ivalue(1, null, "Reloaded array element 5 is invalid..."); test_ivalue(0, cpl_array_get_long_long(array, 19, &null), "Load again array element 19..."); test_ivalue(1, null, "Reloaded array element 19 is invalid..."); test_ivalue(6, cpl_array_get_long_long(array, 6, &null), "Load array element 6..."); test_ivalue(0, null, "Reloaded array element 6 is valid..."); /****/ test(cpl_table_set_column_invalid(table, "Double", 0, 3), "Set Double 0-2 to NULL... "); test(cpl_table_set_column_invalid(table, "Double", 5, 3), "Set Double 5-7 to NULL... "); test(cpl_table_set_column_invalid(table, "Double", 20, 20), "Set Double 20 till end to NULL... "); array = (cpl_array *)cpl_table_get_array(table, "ADouble", 3); test_fvalue(0.0, 0.0001, cpl_array_get_double(array, 0, &null), "Read double array element 0..."); test_ivalue(0, null, "Check double array element 0 is valid..."); test_fvalue(5.0, 0.0001, cpl_array_get_double(array, 5, &null), "Read double array element 5..."); test_ivalue(0, null, "Check double array element 5 is valid..."); test_fvalue(19.0, 0.0001, cpl_array_get_double(array, 19, &null), "Read double array element 19..."); test_ivalue(0, null, "Check array element 19 is valid..."); cpl_array_set_invalid(array, 0); cpl_array_set_invalid(array, 5); cpl_array_set_invalid(array, 19); test_fvalue(0.0, 0.0001, cpl_array_get_double(array, 0, &null), "Read again double array element 0..."); test_ivalue(1, null, "Check double array element 0 is invalid..."); test_fvalue(0.0, 0.0001, cpl_array_get_double(array, 5, &null), "Read again double array element 5..."); test_ivalue(1, null, "Check double array element 5 is invalid..."); test_fvalue(0.0, 0.0001, cpl_array_get_double(array, 19, &null), "Read again double array element 19..."); test_ivalue(1, null, "Check double array element 19 is invalid..."); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "12.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "12.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "12.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ test_ivalue(11, cpl_table_count_invalid(table, "Double"), "Re-count written Double NULLs... "); for (i = 0; i < 25; i++) { const double dval = cpl_table_get_double(table, "Double", i, &null); if (!null) { test_fvalue(dcheck[i], 0.000001, dval, "Check Double column... "); } else { cpl_test(i <= 2 || i >= 5); cpl_test(i <= 7 || i >= 20); } } /* * Check double array after reload */ array = (cpl_array *)cpl_table_get_array(table, "ADouble", 3); test_fvalue(0.0, 0.0001, cpl_array_get_double(array, 0, &null), "Read loaded double array element 0..."); test_ivalue(1, null, "Loaded double array element 0 is invalid..."); test_fvalue(0.0, 0.0001, cpl_array_get_double(array, 5, &null), "Read loaded double array element 5..."); test_ivalue(1, null, "Loaded double array element 5 is invalid..."); test_fvalue(0.0, 0.0001, cpl_array_get_double(array, 19, &null), "Read loaded double array element 19..."); test_ivalue(1, null, "Loaded double array element 19 is invalid..."); /****/ test(cpl_table_set_column_invalid(table, "Float", 0, 3), "Set Float 0-2 to NULL... "); test(cpl_table_set_column_invalid(table, "Float", 5, 3), "Set Float 5-7 to NULL... "); test(cpl_table_set_column_invalid(table, "Float", 20, 20), "Set Float 20 till end to NULL... "); array = (cpl_array *)cpl_table_get_array(table, "AFloat", 3); test_fvalue(0.0, 0.0001, cpl_array_get_float(array, 0, &null), "Read float array element 0..."); test_ivalue(0, null, "Check float array element 0 is valid..."); test_fvalue(5.0, 0.0001, cpl_array_get_float(array, 5, &null), "Read float array element 5..."); test_ivalue(0, null, "Check double array element 5 is valid..."); test_fvalue(19.0, 0.0001, cpl_array_get_float(array, 19, &null), "Read float array element 19..."); test_ivalue(0, null, "Check float array element 19 is valid..."); cpl_array_set_invalid(array, 0); cpl_array_set_invalid(array, 5); cpl_array_set_invalid(array, 19); test_fvalue(0.0, 0.0001, cpl_array_get_float(array, 0, &null), "Read again float array element 0..."); test_ivalue(1, null, "Check float array element 0 is invalid..."); test_fvalue(0.0, 0.0001, cpl_array_get_float(array, 5, &null), "Read again float array element 5..."); test_ivalue(1, null, "Check float array element 5 is invalid..."); test_fvalue(0.0, 0.0001, cpl_array_get_float(array, 19, &null), "Read again float array element 19..."); test_ivalue(1, null, "Check float array element 19 is invalid..."); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "13.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "13.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "13.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ test_ivalue(11, cpl_table_count_invalid(table, "Float"), "Re-count written Float NULLs... "); for (i = 0; i < 25; i++) { const float fval = cpl_table_get_float(table, "Float", i, &null); if (!null) { test_fvalue(fcheck[i], 0.000001, fval, "Check Float column... "); } else { cpl_test(i <= 2 || i >= 5); cpl_test(i <= 7 || i >= 20); } } /* * Check float array after reload */ array = (cpl_array *)cpl_table_get_array(table, "AFloat", 3); test_fvalue(0.0, 0.0001, cpl_array_get_float(array, 0, &null), "Read loaded float array element 0..."); test_ivalue(1, null, "Loaded float array element 0 is invalid..."); test_fvalue(0.0, 0.0001, cpl_array_get_float(array, 5, &null), "Read loaded float array element 5..."); test_ivalue(1, null, "Loaded float array element 5 is invalid..."); test_fvalue(0.0, 0.0001, cpl_array_get_float(array, 19, &null), "Read loaded float array element 19..."); test_ivalue(1, null, "Loaded float array element 19 is invalid..."); /****/ test(cpl_table_set_column_invalid(table, "String", 0, 3), "Set String 0-2 to NULL... "); test(cpl_table_set_column_invalid(table, "String", 5, 3), "Set String 5-7 to NULL... "); test(cpl_table_set_column_invalid(table, "String", 20, 20), "Set String 20 till end to NULL... "); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "14.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "14.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "14.fits", 1, 1); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), 25); /**/ test_ivalue(11, cpl_table_count_invalid(table, "String"), "Re-count written String NULLs... "); for (i = 0; i < 25; i++) { const char * sval = cpl_table_get_string(table, "String", i); if (sval != NULL) { test_svalue(scheck[i], sval, "Check String column... "); } else { cpl_test(i <= 2 || i >= 5); cpl_test(i <= 7 || i >= 20); } } test(cpl_table_erase_window(table, 21, 4), "Delete last 4 table rows... "); test(cpl_table_erase_window(table, 7, 4), "Delete table rows from 7 to 10... "); test(cpl_table_erase_window(table, 3, 3), "Delete table rows from 3 to 5... "); test(cpl_table_erase_window(table, 0, 2), "Delete first two table rows... "); test_ivalue(12, cpl_table_get_nrow(table), "Check table length (4)... "); test_ivalue(3, cpl_table_count_invalid(table, "Integer"), "Count Integer NULLs... "); test_ivalue(3, cpl_table_count_invalid(table, "LongLong"), "Count LongLong NULLs... "); test_ivalue(3, cpl_table_count_invalid(table, "Double"), "Count Double NULLs... "); test_ivalue(3, cpl_table_count_invalid(table, "String"), "Count String NULLs... "); test_ivalue(3, cpl_table_count_invalid(table, "Float"), "Count Float NULLs... "); test_ivalue(3, cpl_table_count_invalid(table, "AInt"), "Count AInt NULLs... "); test_ivalue(0, cpl_table_count_invalid(table, "ADouble"), "Count ADouble NULLs... "); test_ivalue(0, cpl_table_count_invalid(table, "AFloat"), "Count AFloat NULLs... "); test(cpl_table_insert_window(table, 20, 5), "Append 5 NULLs at table end... "); test(cpl_table_insert_window(table, 6, 4), "Insert segment of 4 NULLs at row 6... "); test(cpl_table_insert_window(table, 1, 2), "Insert segment of 2 NULLs at row 1... "); test_ivalue(23, cpl_table_get_nrow(table), "Check table length (5)... "); test_ivalue(14, cpl_table_count_invalid(table, "Integer"), "Count Integer NULLs... "); test_ivalue(14, cpl_table_count_invalid(table, "LongLong"), "Count LongLong NULLs... "); test_ivalue(14, cpl_table_count_invalid(table, "Double"), "Count Double NULLs... "); test_ivalue(14, cpl_table_count_invalid(table, "String"), "Count String NULLs... "); test_ivalue(14, cpl_table_count_invalid(table, "Float"), "Count Float NULLs... "); test(cpl_table_fill_column_window_int(table, "Integer", 0, 2, 999), "Write 999 in \"Integer\" column from 0 to 1... "); test(cpl_table_fill_column_window_int(table, "Integer", 3, 3, 999), "Write 999 in \"Integer\" column from 3 to 5... "); test(cpl_table_fill_column_window_int(table, "Integer", 7, 4, 999), "Write 999 in \"Integer\" column from 7 to 10... "); test(cpl_table_fill_column_window_int(table, "Integer", 20, 7, 999), "Write 999 in \"Integer\" column from 20 to end... "); test(cpl_table_fill_column_window_long_long(table, "LongLong", 0, 2, 999), "Write 999 in \"LongLong\" column from 0 to 1... "); test(cpl_table_fill_column_window_long_long(table, "LongLong", 3, 3, 999), "Write 999 in \"LongLong\" column from 3 to 5... "); test(cpl_table_fill_column_window_long_long(table, "LongLong", 7, 4, 999), "Write 999 in \"LongLong\" column from 7 to 10... "); test(cpl_table_fill_column_window_long_long(table, "LongLong", 20, 7, 999), "Write 999 in \"LongLong\" column from 20 to end... "); test(cpl_table_fill_column_window_float(table, "Float", 0, 2, 999.99), "Write 999.99 in \"Float\" column from 0 to 1... "); test(cpl_table_fill_column_window_float(table, "Float", 3, 3, 999.99), "Write 999.99 in \"Float\" column from 3 to 5... "); test(cpl_table_fill_column_window_float(table, "Float", 7, 4, 999.99), "Write 999.99 in \"Float\" column from 7 to 10... "); test(cpl_table_fill_column_window_float(table, "Float", 20, 7, 999.99), "Write 999.99 in \"Float\" column from 20 to end... "); test(cpl_table_fill_column_window_double(table, "Double", 0, 2, 999.88), "Write 999.88 in \"Double\" column from 0 to 1... "); test(cpl_table_fill_column_window_double(table, "Double", 3, 3, 999.88), "Write 999.88 in \"Double\" column from 3 to 5... "); test(cpl_table_fill_column_window_double(table, "Double", 7, 4, 999.88), "Write 999.88 in \"Double\" column from 7 to 10... "); test(cpl_table_fill_column_window_double(table, "Double", 20, 7, 999.88), "Write 999.88 in \"Double\" column from 20 to end... "); test(cpl_table_fill_column_window_string(table, "String", 0, 2, "999"), "Write \"999\" in \"String\" column from 0 to 1... "); test(cpl_table_fill_column_window_string(table, "String", 3, 3, "999"), "Write \"999\" in \"String\" column from 3 to 5... "); test(cpl_table_fill_column_window_string(table, "String", 7, 4, "999"), "Write \"999\" in \"String\" column from 7 to 10... "); test(cpl_table_fill_column_window_string(table, "String", 20, 7, "999"), "Write \"999\" in \"String\" column from 20 to end... "); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "15.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "15.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "15.fits", 1, 1); /**/ test_ivalue(23, cpl_table_get_nrow(table), "Check table length (6)... "); test_ivalue(5, cpl_table_count_invalid(table, "Integer"), "Count Integer NULLs... "); test_ivalue(5, cpl_table_count_invalid(table, "LongLong"), "Count LongLong NULLs... "); test_ivalue(5, cpl_table_count_invalid(table, "Float"), "Count Float NULLs... "); test_ivalue(5, cpl_table_count_invalid(table, "Double"), "Count Double NULLs... "); test_ivalue(5, cpl_table_count_invalid(table, "String"), "Count String NULLs... "); test_ivalue(14, cpl_table_count_invalid(table, "AInt"), "Count AInt NULLs... "); test_ivalue(14, cpl_table_count_invalid(table, "ALongLong"), "Count AInt NULLs... "); test_ivalue(11, cpl_table_count_invalid(table, "AFloat"), "Count AFloat NULLs... "); test_ivalue(11, cpl_table_count_invalid(table, "ADouble"), "Count ADouble NULLs... "); test_ivalue(0, cpl_table_is_valid(table, "Integer", 2), "Check that third element of \"Integer\" is NULL... "); test_ivalue(0, cpl_table_is_valid(table, "LongLong", 2), "Check that third element of \"LongLong\" is NULL... "); test_ivalue(1, cpl_table_is_valid(table, "Double", 0), "Check that first element of \"Double\" is not NULL... "); test_ivalue(1, cpl_table_is_valid(table, "String", 0), "Check that first element of \"String\" is not NULL... "); test_ivalue(0, cpl_table_is_valid(table, "String", 2), "Check that third element of \"String\" is NULL... "); test_ivalue(0, cpl_table_is_valid(table, "AInt", 17), "Check that third element of \"AInt\" is NULL... "); test_ivalue(0, cpl_table_is_valid(table, "ALongLong", 17), "Check that third element of \"ALongLong\" is NULL... "); test_ivalue(1, cpl_table_is_valid(table, "ADouble", 17), "Check that first element of \"ADouble\" is not NULL... "); test_ivalue(1, cpl_table_is_valid(table, "AFloat", 17), "Check that third element of \"AFloat\" is NULL... "); test_data(copia, cpl_table_duplicate(table), "Duplicate table... "); test(cpl_table_duplicate_column(table, "New Integer", table, "Integer"), "Duplicate \"Integer\" column within same table... "); test(cpl_table_duplicate_column(table, "New LongLong", table, "LongLong"), "Duplicate \"LongLong\" column within same table... "); test(cpl_table_duplicate_column(table, "New Float", table, "Float"), "Duplicate \"Float\" column within same table... "); test(cpl_table_duplicate_column(table, "New Double", table, "Double"), "Duplicate \"Double\" column within same table... "); test(cpl_table_duplicate_column(table, "New String", table, "String"), "Duplicate \"String\" column within same table... "); test(cpl_table_duplicate_column(table, "New AInt", table, "AInt"), "Duplicate \"AInt\" column within same table... "); test(cpl_table_duplicate_column(table, "New ALongLong", table, "ALongLong"), "Duplicate \"ALongLong\" column within same table... "); test(cpl_table_duplicate_column(table, "New AFloat", table, "AFloat"), "Duplicate \"AFloat\" column within same table... "); test(cpl_table_duplicate_column(table, "New ADouble", table, "ADouble"), "Duplicate \"ADouble\" column within same table... "); test_ivalue(5, cpl_table_count_invalid(table, "New Integer"), "Count New Integer NULLs... "); test_ivalue(5, cpl_table_count_invalid(table, "New LongLong"), "Count New LongLong NULLs... "); test_ivalue(5, cpl_table_count_invalid(table, "New Float"), "Count New Float NULLs... "); test_ivalue(5, cpl_table_count_invalid(table, "New Double"), "Count New Double NULLs... "); test_ivalue(5, cpl_table_count_invalid(table, "New String"), "Count New String NULLs... "); test_ivalue(14, cpl_table_count_invalid(table, "New AInt"), "Count New AInt NULLs... "); test_ivalue(14, cpl_table_count_invalid(table, "New ALongLong"), "Count New ALongLong NULLs... "); test_ivalue(11, cpl_table_count_invalid(table, "New AFloat"), "Count New AFloat NULLs... "); test_ivalue(11, cpl_table_count_invalid(table, "New ADouble"), "Count New ADouble NULLs... "); test(cpl_table_move_column(copia, "New Integer", table), "Moving column \"New Integer\" to another table... "); test(cpl_table_move_column(copia, "New LongLong", table), "Moving column \"New LongLong\" to another table... "); test(cpl_table_move_column(copia, "New Float", table), "Moving column \"New Float\" to another table... "); test(cpl_table_move_column(copia, "New Double", table), "Moving column \"New Double\" to another table... "); test(cpl_table_move_column(copia, "New String", table), "Moving column \"New String\" to another table... "); test_failure(CPL_ERROR_ILLEGAL_OUTPUT, cpl_table_name_column(copia, "New String", "String"), "Try illegal column renaming... "); test(cpl_table_name_column(copia, "New Integer", "Old Integer"), "Try legal column renaming... "); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "New AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "New ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "16.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "16.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "16.fits", 1, 1); /**/ test_ivalue(!0, cpl_table_has_column(copia, "Old Integer"), "Check if column \"Old Integer\" exists... "); test_svalue("Integer", cpl_table_get_column_name(copia), "Check name column 1... "); test_svalue("LongLong", cpl_table_get_column_name(NULL), "Check name column 2... "); test_svalue("Double", cpl_table_get_column_name(NULL), "Check name column 3... "); test_svalue("CDouble", cpl_table_get_column_name(NULL), "Check name column 3a... "); test_svalue("CDoubleDouble", cpl_table_get_column_name(NULL), "Check name column 3b... "); test_svalue("String", cpl_table_get_column_name(NULL), "Check name column 4... "); test_svalue("Float", cpl_table_get_column_name(NULL), "Check name column 5... "); test_svalue("CFloat", cpl_table_get_column_name(NULL), "Check name column 5a... "); test_svalue("AInt", cpl_table_get_column_name(NULL), "Check name column 6... "); test_svalue("ALongLong", cpl_table_get_column_name(NULL), "Check name column 7... "); test_svalue("AFloat", cpl_table_get_column_name(NULL), "Check name column 8... "); test_svalue("ADouble", cpl_table_get_column_name(NULL), "Check name column 9... "); test_svalue("CAFloat", cpl_table_get_column_name(NULL), "Check name column 8a... "); test_svalue("CADouble", cpl_table_get_column_name(NULL), "Check name column 9a... "); test_svalue("Old Integer", cpl_table_get_column_name(NULL), "Check name column 10... "); test_svalue("New LongLong", cpl_table_get_column_name(NULL), "Check name column 11... "); test_svalue("New Float", cpl_table_get_column_name(NULL), "Check name column 12... "); test_svalue("New Double", cpl_table_get_column_name(NULL), "Check name column 13... "); test_svalue("New String", cpl_table_get_column_name(NULL), "Check name column 14... "); test_pvalue(NULL, (void *)cpl_table_get_column_name(NULL), "Check if no more colums... "); /* * Test new function cpl_table_get_column_names() */ colnames = cpl_table_get_column_names(copia); test_ivalue(19, cpl_array_get_size(colnames), "Count table colnames... "); test_svalue("Integer", cpl_array_get_string(colnames, 0), "Check name col 1... "); test_svalue("LongLong", cpl_array_get_string(colnames, 1), "Check name col 2... "); test_svalue("Double", cpl_array_get_string(colnames, 2), "Check name col 3... "); test_svalue("CDouble", cpl_array_get_string(colnames, 3), "Check name col 4... "); test_svalue("CDoubleDouble", cpl_array_get_string(colnames, 4), "Check name column 5... "); test_svalue("String", cpl_array_get_string(colnames, 5), "Check name col 6... "); test_svalue("Float", cpl_array_get_string(colnames, 6), "Check name col 7... "); test_svalue("CFloat", cpl_array_get_string(colnames, 7), "Check name col 8... "); test_svalue("AInt", cpl_array_get_string(colnames, 8), "Check name col 9... "); test_svalue("ALongLong", cpl_array_get_string(colnames, 9), "Check name col 10... "); test_svalue("AFloat", cpl_array_get_string(colnames, 10), "Check name col 11... "); test_svalue("ADouble", cpl_array_get_string(colnames, 11), "Check name col 12... "); test_svalue("CAFloat", cpl_array_get_string(colnames, 12), "Check name col 13... "); test_svalue("CADouble", cpl_array_get_string(colnames, 13), "Check name col 14... "); test_svalue("Old Integer", cpl_array_get_string(colnames, 14), "Check name col 15... "); test_svalue("New LongLong", cpl_array_get_string(colnames, 15), "Check name col 16... "); test_svalue("New Float", cpl_array_get_string(colnames, 16), "Check name col 17... "); test_svalue("New Double", cpl_array_get_string(colnames, 17), "Check name col 18... "); test_svalue("New String", cpl_array_get_string(colnames, 18), "Check name col 19... "); cpl_array_delete(colnames); cpl_table_delete(copia); test(cpl_table_set_size(table, 30), "Expanding table to 30 rows... "); /* * The following would do the same as cpl_table_set_size(table, 30), in * case cpl_table_set_size() would be crossed out... test(cpl_table_insert_window(table, 24, 7), "Expanding table to 30 rows... "); */ test_ivalue(12, cpl_table_count_invalid(table, "Integer"), "Count \"Integer\" NULLs... "); test_ivalue(12, cpl_table_count_invalid(table, "String"), "Count \"String\" NULLs... "); test(cpl_table_set_size(table, 22), "Truncating table to 22 rows... "); /* * The following would do the same as cpl_table_set_size(table, 30), in * case cpl_table_set_size() would be crossed out... test(cpl_table_erase_window(table, 22, 1000), "Truncating table to 22 rows... "); */ /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "New AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "LongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_long_long(table, "New ALongLong", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "17.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "17.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "17.fits", 1, 1); /**/ cpl_table_erase_column(table, "CDouble"); cpl_table_erase_column(table, "CDoubleDouble"); cpl_table_erase_column(table, "CFloat"); cpl_table_erase_column(table, "CAFloat"); cpl_table_erase_column(table, "CADouble"); //FIXME: To be continued. cpl_table_erase_column(table, "LongLong"); cpl_table_erase_column(table, "ALongLong"); cpl_table_erase_column(table, "New ALongLong"); test_ivalue(5, cpl_table_count_invalid(table, "Integer"), "Count \"Integer\" NULLs (2)... "); test_ivalue(5, cpl_table_count_invalid(table, "String"), "Count \"String\" NULLs (2)... "); test_data(copia, cpl_table_extract(table, 0, 5), "Creating subtable from rows 0-5 of original... "); test_ivalue(1, cpl_table_count_invalid(copia, "Integer"), "Count \"Integer\" NULLs... "); test_ivalue(1, cpl_table_count_invalid(copia, "String"), "Count \"String\" NULLs... "); cpl_table_delete(copia); test_data(copia, cpl_table_extract(table, 8, 5), "Creating subtable from rows 8-5 of original... "); test_ivalue(1, cpl_table_count_invalid(copia, "Float"), "Count \"Float\" NULLs... "); test_ivalue(1, cpl_table_count_invalid(copia, "String"), "Count \"String\" NULLs... "); cpl_table_delete(copia); test_data(copia, cpl_table_extract(table, 15, 30), "Creating subtable from rows 15 till end of original... "); test_ivalue(3, cpl_table_count_invalid(copia, "Double"), "Count \"Double\" NULLs... "); test_ivalue(3, cpl_table_count_invalid(copia, "String"), "Count \"String\" NULLs... "); cpl_table_delete(copia); test(cpl_table_cast_column(table, "Float", "FloatToInt", CPL_TYPE_INT), "Casting float column to integer colum... "); /**+ FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "FloatToInt", -2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "New AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "18.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "18.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "18.fits", 1, 1); /**/ test_ivalue(999, cpl_table_get_int(table, "FloatToInt", 0, &null), "Check element 1 of casted column... "); cpl_test_zero(null); test_ivalue(999, cpl_table_get_int(table, "FloatToInt", 1, &null), "Check element 2 of casted column... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "FloatToInt", 2), "Check element 3 of casted column... "); test_ivalue(999, cpl_table_get_int(table, "FloatToInt", 3, &null), "Check element 4 of casted column... "); cpl_test_zero(null); test_ivalue(999, cpl_table_get_int(table, "FloatToInt", 4, &null), "Check element 5 of casted column... "); cpl_test_zero(null); test_ivalue(999, cpl_table_get_int(table, "FloatToInt", 5, &null), "Check element 6 of casted column... "); cpl_test_zero(null); test_ivalue(-1, cpl_table_get_int(table, "FloatToInt", 6, &null), "Check element 7 of casted column... "); cpl_test_zero(null); test_ivalue(999, cpl_table_get_int(table, "FloatToInt", 7, &null), "Check element 8 of casted column... "); cpl_test_zero(null); test_ivalue(999, cpl_table_get_int(table, "FloatToInt", 8, &null), "Check element 9 of casted column... "); cpl_test_zero(null); test_ivalue(999, cpl_table_get_int(table, "FloatToInt", 9, &null), "Check element 10 of casted column... "); cpl_test_zero(null); test_ivalue(999, cpl_table_get_int(table, "FloatToInt", 10, &null), "Check element 11 of casted column... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "FloatToInt", 11), "Check element 12 of casted column... "); test_ivalue(3, cpl_table_get_int(table, "FloatToInt", 12, &null), "Check element 13 of casted column... "); cpl_test_zero(null); test_ivalue(7, cpl_table_get_int(table, "FloatToInt", 13, &null), "Check element 14 of casted column... "); cpl_test_zero(null); test_ivalue(1, cpl_table_get_int(table, "FloatToInt", 14, &null), "Check element 15 of casted column... "); cpl_test_zero(null); test_ivalue(4, cpl_table_get_int(table, "FloatToInt", 15, &null), "Check element 16 of casted column... "); cpl_test_zero(null); test_ivalue(6, cpl_table_get_int(table, "FloatToInt", 16, &null), "Check element 17 of casted column... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "FloatToInt", 17), "Check element 18 of casted column... "); test_ivalue(0, cpl_table_is_valid(table, "FloatToInt", 18), "Check element 19 of casted column... "); test_ivalue(0, cpl_table_is_valid(table, "FloatToInt", 19), "Check element 20 of casted column... "); test_ivalue(999, cpl_table_get_int(table, "FloatToInt", 20, &null), "Check element 21 of casted column... "); cpl_test_zero(null); test_ivalue(999, cpl_table_get_int(table, "FloatToInt", 21, &null), "Check element 22 of casted column... "); cpl_test_zero(null); test(cpl_table_erase_column(table, "FloatToInt"), "Delete casted column... "); test(cpl_table_cast_column(table, "Integer", "IntToFloat", CPL_TYPE_FLOAT), "Casting integer column to float colum... "); /**- FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "New AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "19.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "19.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "19.fits", 1, 1); /**/ test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 0, &null), "Check element 1 of casted column (2)... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 1, &null), "Check element 2 of casted column (2)... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 2), "Check element 3 of casted column (2)... "); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 3, &null), "Check element 4 of casted column (2)... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 4, &null), "Check element 5 of casted column (2)... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 5, &null), "Check element 6 of casted column (2)... "); cpl_test_zero(null); test_fvalue(-1.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 6, &null), "Check element 7 of casted column (2)... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 7, &null), "Check element 8 of casted column (2)... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 8, &null), "Check element 9 of casted column (2)... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 9, &null), "Check element 10 of casted column (2)... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 10, &null), "Check element 11 of casted column (2)... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 11), "Check element 12 of casted column (2)... "); test_fvalue(3.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 12, &null), "Check element 13 of casted column (2)... "); cpl_test_zero(null); test_fvalue(7.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 13, &null), "Check element 14 of casted column (2)... "); cpl_test_zero(null); test_fvalue(1.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 14, &null), "Check element 15 of casted column (2)... "); cpl_test_zero(null); test_fvalue(4.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 15, &null), "Check element 16 of casted column (2)... "); cpl_test_zero(null); test_fvalue(6.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 16, &null), "Check element 17 of casted column (2)... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 17), "Check element 18 of casted column (2)... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 18), "Check element 19 of casted column (2)... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 19), "Check element 20 of casted column (2)... "); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 20, &null), "Check element 21 of casted column (2)... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 21, &null), "Check element 22 of casted column (2)... "); cpl_test_zero(null); test(cpl_table_shift_column(table, "IntToFloat", 1), "Shift new column one position down... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 0), "Check element 1 of shifted column... "); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 1, &null), "Check element 2 of shifted column... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 2, &null), "Check element 3 of shifted column... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 3), "Check element 4 of shifted column... "); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 4, &null), "Check element 5 of shifted column... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 5, &null), "Check element 6 of shifted column... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 6, &null), "Check element 7 of shifted column... "); cpl_test_zero(null); test_fvalue(-1.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 7, &null), "Check element 8 of shifted column... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 8, &null), "Check element 9 of shifted column... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 9, &null), "Check element 10 of shifted column... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 10, &null), "Check element 11 of shifted column... "); cpl_test_zero(null); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 11, &null), "Check element 12 of shifted column... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 12), "Check element 13 of shifted column... "); test_fvalue(3.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 13, &null), "Check element 14 of shifted column... "); cpl_test_zero(null); test_fvalue(7.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 14, &null), "Check element 15 of shifted column... "); cpl_test_zero(null); test_fvalue(1.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 15, &null), "Check element 16 of shifted column... "); cpl_test_zero(null); test_fvalue(4.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 16, &null), "Check element 17 of shifted column... "); cpl_test_zero(null); test_fvalue(6.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 17, &null), "Check element 18 of shifted column... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 18), "Check element 19 of shifted column... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 19), "Check element 20 of shifted column... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 20), "Check element 21 of shifted column... "); test_fvalue(999.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 21, &null), "Check element 22 of shifted column... "); cpl_test_zero(null); test(cpl_table_add_columns(table, "Integer", "IntToFloat"), "Sum \"IntToFloat\" to \"Integer\"... "); /**- FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "New AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "20.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "20.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "20.fits", 1, 1); /**/ cpl_table_test_20(table); test(cpl_table_name_column(table, "IntToFloat", "Float"), "Renaming \"IntToFloat\" to \"Float\"... "); test(cpl_table_set_column_invalid(table, "Integer", 7, 2), "Set NULLs in \"Integer\" column... "); test(cpl_table_set_invalid(table, "Float", 7), "Set NULL in \"Float\" column... "); test(cpl_table_set_invalid(table, "Float", 9), "Set another NULL in \"Float\" column... "); test(cpl_table_set_invalid(table, "Double", 7), "Set NULL in \"Double\" column... "); test(cpl_table_set_invalid(table, "String", 7), "Set NULL in \"String\" column... "); test(cpl_table_new_column(table, "Sequence", CPL_TYPE_INT), "Creating the \"Sequence\" column... "); for (i = 0; i < 18; i++) { sprintf(message, "Writing to row %d of the \"Sequence\" column... ", i); test(cpl_table_set_int(table, "Sequence", i, i), message); } names[0] = "Integer"; reflist = cpl_propertylist_new(); cpl_propertylist_append_bool(reflist, names[0], 0); /* %$% */ /* *+ error = cpl_table_set_column_unit(table, "Integer", "Pixel"); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_table_dump_structure(table, NULL); cpl_table_dump(table, 0, cpl_table_get_nrow(table), NULL); exit; +* */ { int *hold = cpl_table_get_data_int(table, "Integer"); test(cpl_table_sort(table, reflist), "Sorting by increasing values of the \"Integer\" column... "); test_pvalue(hold, cpl_table_get_data_int(table, "Integer"), "Check pointer... "); cpl_propertylist_delete(reflist); error = cpl_table_set_column_unit(table, "AInt", "Pixel"); cpl_test_eq_error(error, CPL_ERROR_NONE); test_svalue("Pixel", cpl_table_get_column_unit(table, "AInt"), "Check column unit... "); } /* if (strcmp(unit = (char *)cpl_table_get_column_unit(table, "AInt"), "Pixel")) { printf("Check column unit... "); printf("Expected \"Pixel\", obtained \"%s\"\n", unit); cpl_end(); return 1; } */ /**- FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "New AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "21.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "21.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "21.fits", 1, 1); /**/ cpl_table_test_21(table); cpl_table_delete(table); table = cpl_table_load(BASE "22.fits", 1, 1); /**/ cpl_table_test_22(table); /* * Here partial loading of table is tested */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "New AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "24.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "24.fits"); cpl_table_delete(table); colnames = cpl_array_new(7, CPL_TYPE_STRING); cpl_array_set_string(colnames, 0, "Integer"); cpl_array_set_string(colnames, 1, "Double"); cpl_array_set_string(colnames, 2, "String"); cpl_array_set_string(colnames, 3, "AInt"); cpl_array_set_string(colnames, 4, "AFloat"); cpl_array_set_string(colnames, 5, "ADouble"); cpl_array_set_string(colnames, 6, "Float"); table = cpl_table_load_window(BASE "24.fits", 1, 1, colnames, 7, 6); cpl_array_delete(colnames); /* Test some values here... */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "25.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "25.fits"); cpl_table_delete(table); cpl_free(fArray); #ifdef _Complex_I cpl_free(cfArray); #endif return 0; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the another part of the CPL table functions @return Zero iff successful */ /*----------------------------------------------------------------------------*/ static int cpl_table_test_rest(void) { int nrows = NROWS; int i, j, k, null; int pp; char message[80]; const char *unit; cpl_table *table; cpl_table *copia; cpl_array *array; cpl_array *dimensions; cpl_array **arrays; FILE *stream; cpl_error_code error; stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; cpl_test_nonnull( stream ); /* * Powers */ nrows = 7; table = cpl_table_new(nrows); error = cpl_table_new_column(table, "Int", CPL_TYPE_INT); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Float", CPL_TYPE_FLOAT); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Double", CPL_TYPE_DOUBLE); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "CFloat", CPL_TYPE_FLOAT_COMPLEX); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "CDouble", CPL_TYPE_DOUBLE_COMPLEX); cpl_test_eq_error(error, CPL_ERROR_NONE); for (i = 0; i < nrows; i++) { error = cpl_table_set_int(table, "Int", i, i); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_float(table, "Float", i, i); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_double(table, "Double", i, i); cpl_test_eq_error(error, CPL_ERROR_NONE); #ifdef _Complex_I error = cpl_table_set_float_complex(table, "CFloat", i, i + i * I); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_double_complex(table, "CDouble", i, i + I); cpl_test_eq_error(error, CPL_ERROR_NONE); #endif } error = cpl_table_exponential_column(table, "Int", 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_exponential_column(table, "Float", 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_exponential_column(table, "Double", 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_exponential_column(table, "CFloat", 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_exponential_column(table, "CDouble", 2); cpl_test_eq_error(error, CPL_ERROR_NONE); pp = 1; for (i = 0; i < nrows; i++) { #ifdef _Complex_I const double ln2 = CPL_MATH_LN2; test_cvalue(exp(i*ln2)*(cos(i*ln2) + I*sin(i*ln2)), 0.00001, cpl_table_get_float_complex(table, "CFloat", i, &null), "Check expo CFloat... "); cpl_test_zero(null); test_cvalue(exp(i*ln2)*(cos(ln2) + I*sin(ln2)), 0.00001, cpl_table_get_double_complex(table, "CDouble", i, &null), "Check expo CDouble... "); cpl_test_zero(null); #endif test_ivalue(pp, cpl_table_get_int(table, "Int", i, &null), "Check expo Int... "); cpl_test_zero(null); test_fvalue((float)pp, 0.00001, cpl_table_get_float(table, "Float", i, &null), "Check expo Float... "); cpl_test_zero(null); test_fvalue((float)pp, 0.00001, cpl_table_get_double(table, "Double", i, &null), "Check expo Double... "); cpl_test_zero(null); pp *= 2; } error = cpl_table_logarithm_column(table, "Int", 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_logarithm_column(table, "Float", 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_logarithm_column(table, "Double", 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_logarithm_column(table, "CFloat", 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_logarithm_column(table, "CDouble", 2); cpl_test_eq_error(error, CPL_ERROR_NONE); for (i = 0; i < nrows; i++) { #ifdef _Complex_I const double ln2 = CPL_MATH_LN2; test_cvalue(clog(exp(i*ln2)*(cos(i*ln2) + I*sin(i*ln2)))/ln2, 0.00001, cpl_table_get_float_complex(table, "CFloat", i, &null), "Check log CFloat... "); cpl_test_zero(null); test_cvalue(clog(exp(i*ln2)*(cos(ln2) + I*sin(ln2)))/ln2, 0.00001, cpl_table_get_double_complex(table, "CDouble", i, &null), "Check log CDouble... "); cpl_test_zero(null); #endif test_ivalue(i, cpl_table_get_int(table, "Int", i, &null), "Check log Int... "); cpl_test_zero(null); test_fvalue((float)i, 0.00001, cpl_table_get_float(table, "Float", i, &null), "Check log Float... "); cpl_test_zero(null); test_fvalue((float)i, 0.00001, cpl_table_get_double(table, "Double", i, &null), "Check log Double... "); cpl_test_zero(null); } #ifdef _Complex_I for (i = 0; i < nrows; i++) { error = cpl_table_set_float_complex(table, "CFloat", i, i + i * I); cpl_test_eq_error(error, CPL_ERROR_NONE); test_cvalue(i + i*I, 0.0, cpl_table_get_float_complex(table, "CFloat", i, &null), " "); cpl_test_zero(null); error = cpl_table_set_double_complex(table, "CDouble", i, i + I); cpl_test_eq_error(error, CPL_ERROR_NONE); test_cvalue(i + I, 0.0, cpl_table_get_double_complex(table, "CDouble", i, &null), " "); cpl_test_zero(null); } #endif cpl_test_zero(cpl_table_count_invalid(table, "CFloat")); cpl_test_zero(cpl_table_count_invalid(table, "CDouble")); error = cpl_table_power_column(table, "Int", 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "Float", 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "Double", 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "CFloat", 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "CDouble", 2.0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_table_count_invalid(table, "CFloat")); cpl_test_zero(cpl_table_count_invalid(table, "CDouble")); for (i = 0; i < nrows; i++) { test_ivalue(i*i, cpl_table_get_int(table, "Int", i, &null), "Check pow Int... "); cpl_test_zero(null); test_fvalue((float)i*i, 0.00001, cpl_table_get_float(table, "Float", i, &null), "Check pow Float... "); cpl_test_zero(null); test_fvalue((float)i*i, 0.00001, cpl_table_get_double(table, "Double", i, &null), "Check pow Double... "); cpl_test_zero(null); #ifdef _Complex_I test_cvalue(2*I*i*i, 0.00001, cpl_table_get_float_complex(table, "CFloat", i, &null), "Check pow CFloat... "); cpl_test_zero(null); test_cvalue(i*i - 1 + 2*i*I, 0.00001, cpl_table_get_double_complex(table, "CDouble", i, &null), "Check pow CDouble... "); cpl_test_zero(null); #endif } #ifdef _Complex_I /* On a ppc-Mac with gcc 4.0 cpowf(0.0, 2.0) returns NaN */ /* FIXME: For a proper unit test the table should be re-set for each test */ error = cpl_table_set_float_complex(table, "CFloat", 0, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); #endif error = cpl_table_power_column(table, "Int", 0.5); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "Float", 0.5); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "Double", 0.5); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "CFloat", 0.5); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "CDouble", 0.5); cpl_test_eq_error(error, CPL_ERROR_NONE); for (i = 0; i < nrows; i++) { test_ivalue(i, cpl_table_get_int(table, "Int", i, &null), "Check sqrt Int... "); cpl_test_zero(null); test_fvalue((float)i, 0.00001, cpl_table_get_float(table, "Float", i, &null), "Check sqrt Float... "); cpl_test_zero(null); test_fvalue((float)i, 0.00001, cpl_table_get_double(table, "Double", i, &null), "Check sqrt Double... "); cpl_test_zero(null); #ifdef _Complex_I test_cvalue(i + i*I, 0.00001, cpl_table_get_float_complex(table, "CFloat", i, &null), "Check sqrt CFloat... "); cpl_test_zero(null); test_cvalue(i + I, 0.00001, cpl_table_get_double_complex(table, "CDouble", i, &null), "Check sqrt CDouble... "); cpl_test_zero(null); #endif } #ifdef _Complex_I /* On a ppc-Mac with gcc 4.0 cpowf(0.0, 0.5) returns NaN */ /* FIXME: For a proper unit test the table should be re-set for each test */ error = cpl_table_set_float_complex(table, "CFloat", 0, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); #endif error = cpl_table_power_column(table, "Int", -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "Float", -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "Double", -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "CFloat", -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "CDouble", -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Zero valued elements are rejected */ cpl_test_zero(cpl_table_is_valid(table, "Int", 0)); cpl_test_zero(cpl_table_is_valid(table, "Float", 0)); cpl_test_zero(cpl_table_is_valid(table, "Double", 0)); cpl_test_zero(cpl_table_is_valid(table, "CFloat", 0)); cpl_test_eq(cpl_table_count_invalid(table, "Int"), 1); cpl_test_eq(cpl_table_count_invalid(table, "Float"), 1); cpl_test_eq(cpl_table_count_invalid(table, "Double"), 1); cpl_test_eq(cpl_table_count_invalid(table, "CFloat"), 1); for (i = 1; i < nrows; i++) { test_ivalue(i == 1 || i == 2 ? 1.0 : 0.0, cpl_table_get_int(table, "Int", i, &null), "Check pow(-1) Int... "); cpl_test_zero(null); test_fvalue(1.0/(double)i, 0.00001, cpl_table_get_float(table, "Float", i, &null), "Check pow(-1) Float... "); cpl_test_zero(null); test_fvalue(1.0/(double)i, 0.00001, cpl_table_get_double(table, "Double", i, &null), "Check pow(-1) Double... "); cpl_test_zero(null); #ifdef _Complex_I test_cvalue(1.0/((double)i + (double)i*I), 0.00001, cpl_table_get_float_complex(table, "CFloat", i, &null), "Check pow(-1) CFloat... "); cpl_test_zero(null); test_cvalue(1.0/((double)i + I), 0.00001, cpl_table_get_double_complex(table, "CDouble", i, &null), "Check pow(-1) CDouble... "); cpl_test_zero(null); #endif } /* Set the values back */ for (i = 0; i < nrows; i++) { error = cpl_table_set_int(table, "Int", i, i); cpl_test_eq_error(error, CPL_ERROR_NONE); } error = cpl_table_power_column(table, "Float", -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "Double", -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "CFloat", -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_power_column(table, "CDouble", -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_float(table, "Float", 0, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_double(table, "Double", 0, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); #ifdef _Complex_I error = cpl_table_set_float_complex(table, "CFloat", 0, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); #endif cpl_test_zero(cpl_table_has_invalid(table, "Int")); cpl_test_zero(cpl_table_has_invalid(table, "Float")); cpl_test_zero(cpl_table_has_invalid(table, "Double")); cpl_test_zero(cpl_table_has_invalid(table, "CFloat")); cpl_test_zero(cpl_table_has_invalid(table, "CDouble")); /* * Test cpl_table_abs_column() */ error = cpl_table_set_int(table, "Int", 2, -2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_float(table, "Float", 2, -2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_double(table, "Double", 2, -2); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_table_abs_column(table, "Int"); cpl_table_abs_column(table, "Float"); cpl_table_abs_column(table, "Double"); cpl_table_abs_column(table, "CFloat"); cpl_table_abs_column(table, "CDouble"); for (i = 0; i < nrows; i++) { double s2 = sqrt(2.0); test_ivalue(i, cpl_table_get_int(table, "Int", i, &null), "Check abs Int... "); cpl_test_zero(null); test_fvalue((float)i, 0.00001, cpl_table_get_float(table, "Float", i, &null), "Check abs Float... "); cpl_test_zero(null); test_fvalue((float)i, 0.00001, cpl_table_get_double(table, "Double", i, &null), "Check abs Double... "); cpl_test_zero(null); test_fvalue(i*s2, 0.00001, cpl_table_get_float(table, "CFloat", i, &null), "Check abs CFloat... "); cpl_test_zero(null); test_fvalue(sqrt(i*i + 1), 0.00001, cpl_table_get_double(table, "CDouble", i, &null), "Check abs CDouble... "); cpl_test_zero(null); } cpl_table_delete(table); /* * Testing the selection functions */ nrows = 7; table = cpl_table_new(nrows); cpl_table_new_column(table, "Int", CPL_TYPE_INT); cpl_table_new_column(table, "String", CPL_TYPE_STRING); unit = "abcd\0efgh\0ijkl\0mnop\0qrst\0uvwx\0yz"; for (i = 0; i < nrows; i++) { error = cpl_table_set_int(table, "Int", i, i); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_string(table, "String", i, unit + i*5); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_table_duplicate_column(table, "Int2", table, "Int"); cpl_table_multiply_columns(table, "Int2", "Int2"); cpl_table_cast_column(table, "Int", "Float", CPL_TYPE_FLOAT); #ifdef VERBOSE cpl_msg_info(cpl_func, "This is the test table:\n\n"); cpl_table_dump(table, 0, cpl_table_get_nrow(table), stream); cpl_msg_info(cpl_func, "Now erase all selected:\n\n"); #endif copia = cpl_table_duplicate(table); test_ivalue(7, cpl_table_count_selected(copia), "Check all selected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(0, cpl_table_get_nrow(copia), "Check length erase all selected... "); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "This is the test table:\n\n"); cpl_table_dump(table, 0, cpl_table_get_nrow(table), stream); cpl_msg_info(cpl_func, "Now delete all Int >= Int2:\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_and_selected(copia, "Int", CPL_NOT_LESS_THAN, "Int2"); test_ivalue(2, cpl_table_count_selected(copia), "Check Int >= Int2 selected... "); array = cpl_table_where_selected(copia); test_ivalue(CPL_TYPE_SIZE, cpl_array_get_type(array), "Check type of where array..."); test_ivalue(2, cpl_array_get_size(array), "Check size of where array..."); test_ivalue(0, cpl_array_get_cplsize(array, 0, &null), "Check first element of where array..."); cpl_test_zero(null); test_ivalue(1, cpl_array_get_cplsize(array, 1, &null), "Check second element of where array..."); cpl_test_zero(null); cpl_array_delete(array); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(5, cpl_table_get_nrow(copia), "Check length erase all Int >= Int2... "); array = cpl_table_where_selected(copia); test_ivalue(CPL_TYPE_SIZE, cpl_array_get_type(array), "Check type of everywhere array..."); test_ivalue(5, cpl_array_get_size(array), "Check size of everywhere array..."); test_ivalue(0, cpl_array_get_cplsize(array, 0, &null), "Check first element of everywhere array..."); cpl_test_zero(null); test_ivalue(1, cpl_array_get_cplsize(array, 1, &null), "Check second element of everywhere array..."); cpl_test_zero(null); test_ivalue(2, cpl_array_get_cplsize(array, 2, &null), "Check third element of everywhere array..."); cpl_test_zero(null); test_ivalue(3, cpl_array_get_cplsize(array, 3, &null), "Check fourth element of everywhere array..."); cpl_test_zero(null); test_ivalue(4, cpl_array_get_cplsize(array, 4, &null), "Check fifth element of everywhere array..."); cpl_test_zero(null); cpl_array_delete(array); cpl_table_unselect_all(copia); array = cpl_table_where_selected(copia); test_ivalue(CPL_TYPE_SIZE, cpl_array_get_type(array), "Check type of nowhere array..."); test_ivalue(0, cpl_array_get_size(array), "Check size of nowhere array..."); cpl_array_delete(array); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "This is the test table:\n\n"); cpl_table_dump(table, 0, cpl_table_get_nrow(table), stream); cpl_msg_info(cpl_func, "Now delete all Int > 3:\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_and_selected_int(copia, "Int", CPL_GREATER_THAN, 3); test_ivalue(3, cpl_table_count_selected(copia), "Check Int > 3 selected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(4, cpl_table_get_nrow(copia), "Check length erase all Int > 3... "); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "This is the test table:\n\n"); cpl_table_dump(table, 0, cpl_table_get_nrow(table), stream); cpl_msg_info(cpl_func, "Now delete all Int2 > Float:\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_and_selected(copia, "Int2", CPL_GREATER_THAN, "Float"); test_ivalue(5, cpl_table_count_selected(copia), "Check Int2 > Float selected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(2, cpl_table_get_nrow(copia), "Check length erase all Int2 > Float... "); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "This is the test table:\n\n"); cpl_table_dump(table, 0, cpl_table_get_nrow(table), stream); cpl_msg_info(cpl_func, "Now delete all String == \"^[a-l].*\":\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_and_selected_string(copia, "String", CPL_EQUAL_TO, "^[a-l].*"); test_ivalue(3, cpl_table_count_selected(copia), "Check String == \"^[a-l].*\" selected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(4, cpl_table_get_nrow(copia), "Check length erase all String == \"^[a-l].*\"... "); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "This is the test table:\n\n"); cpl_table_dump(table, 0, cpl_table_get_nrow(table), stream); cpl_msg_info(cpl_func, "Now delete all String > \"carlo\":\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_and_selected_string(copia, "String", CPL_GREATER_THAN, "carlo"); test_ivalue(6, cpl_table_count_selected(copia), "Check String > \"carlo\" selected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(1, cpl_table_get_nrow(copia), "Check length erase all String > \"carlo\"... "); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "This is the test table:\n\n"); cpl_table_dump(table, 0, cpl_table_get_nrow(table), stream); cpl_msg_info(cpl_func, "Now delete all String > \"tattoo\" and Int == 3:\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_and_selected_string(copia, "String", CPL_GREATER_THAN, "tattoo"); cpl_table_or_selected_int(copia, "Int", CPL_EQUAL_TO, 3); test_ivalue(3, cpl_table_count_selected(copia), "Check String > \"tattoo\" and Int == 3 selected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(4, cpl_table_get_nrow(copia), "Check length erase all String > \"tattoo\" and Int == 3... "); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "Now keep all String > \"tattoo\" and Int == 3:\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_and_selected_string(copia, "String", CPL_GREATER_THAN, "tattoo"); cpl_table_or_selected_int(copia, "Int", CPL_EQUAL_TO, 3); cpl_table_not_selected(copia); test_ivalue(4, cpl_table_count_selected(copia), "Check String > \"tattoo\" and Int == 3 rejected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(3, cpl_table_get_nrow(copia), "Check length keep all String > \"tattoo\" and Int == 3... "); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "This is the test table:\n\n"); cpl_table_dump(table, 0, cpl_table_get_nrow(table), stream); cpl_msg_info(cpl_func, "Now delete rows 0, 2, and 6:\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_unselect_all(copia); cpl_table_select_row(copia, 0); cpl_table_select_row(copia, 2); cpl_table_select_row(copia, 6); test_ivalue(3, cpl_table_count_selected(copia), "Check rows 0, 2, and 6 selected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(4, cpl_table_get_nrow(copia), "Check length erase rows 0, 2, and 6... "); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "Now keep rows 0, 2, and 6:\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_unselect_row(copia, 0); cpl_table_unselect_row(copia, 2); cpl_table_unselect_row(copia, 6); test_ivalue(4, cpl_table_count_selected(copia), "Check rows 0, 2, and 6 rejected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(3, cpl_table_get_nrow(copia), "Check length erase rows 0, 2, and 6... "); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "This is the test table:\n\n"); cpl_table_dump(table, 0, cpl_table_get_nrow(table), stream); cpl_msg_info(cpl_func, "Now delete first 3 rows:\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_and_selected_window(copia, 0, 3); test_ivalue(3, cpl_table_count_selected(copia), "Check first 3 rows selected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(4, cpl_table_get_nrow(copia), "Check length erase first 3 rows... "); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "Now delete last 2 rows:\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_and_selected_window(copia, 5, 2); test_ivalue(2, cpl_table_count_selected(copia), "Check last 2 rows selected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(5, cpl_table_get_nrow(copia), "Check length erase last 2 rows... "); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "Now delete rows from 2 to 3:\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_and_selected_window(copia, 2, 2); test_ivalue(2, cpl_table_count_selected(copia), "Check middle 2 rows selected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(5, cpl_table_get_nrow(copia), "Check length erase rows from 2 to 3... "); cpl_table_delete(copia); #ifdef VERBOSE cpl_msg_info(cpl_func, "Now delete rows from 1 to 3 and row 6:\n\n"); #endif copia = cpl_table_duplicate(table); cpl_table_and_selected_window(copia, 1, 3); cpl_table_or_selected_window(copia, 6, 1); test_ivalue(4, cpl_table_count_selected(copia), "Check rows 1 to 3 and row 6 rejected... "); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(3, cpl_table_get_nrow(copia), "Check length erase rows from 1 to 3 and row 6... "); cpl_table_delete(copia); /* Erase only invalid elements */ copia = cpl_table_duplicate(table); for (i = 0; i < nrows; i++) { error = cpl_table_set_invalid(copia, "Int", i); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_table_unselect_row(copia, nrows-1); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(1, cpl_table_get_nrow(copia), "Check length erase last row, only invalid values... "); cpl_table_delete(copia); /* Erase array column with valid/invalid values */ copia = cpl_table_duplicate(table); cpl_table_cast_column(copia, "Int", "Double", CPL_TYPE_DOUBLE); test(cpl_table_new_column_array(copia, "ADouble", CPL_TYPE_DOUBLE | CPL_TYPE_POINTER, 2), "Creating the ArrayDouble column... "); array = cpl_array_new(2, CPL_TYPE_DOUBLE); test(cpl_table_set_array(copia, "ADouble", 1, array), "Set a valid array to ADouble 1... "); test(cpl_table_set_array(copia, "ADouble", 2, array), "Set a valid array to ADouble 2... "); cpl_array_delete(array); cpl_table_unselect_row(copia, 0); cpl_table_unselect_row(copia, 2); error = cpl_table_set_invalid(copia, "Int", 6); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_invalid(copia, "Int2", 0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_invalid(copia, "Int2", 1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_invalid(copia, "Double", 0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_invalid(copia, "Double", 1); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_table_erase_selected(copia); #ifdef VERBOSE cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), stream); #endif test_ivalue(2, cpl_table_get_nrow(copia), "Check length erase valid/invalid values... "); test_ivalue(0, cpl_table_is_valid(copia, "Int2", 0), "Check that first element of \"Int2\" is still NULL... "); test_ivalue(1, cpl_table_is_valid(copia, "Int2", 1), "Check that first element of \"Int2\" is now valid... "); cpl_table_unselect_row(copia, 0); cpl_table_unselect_row(copia, 1); cpl_table_erase_selected(copia); test_ivalue(2, cpl_table_count_selected(copia), "Check that rows are selected... "); cpl_table_delete(copia); cpl_table_delete(table); /* * Select invalid rows */ nrows = 3; table = cpl_table_new(nrows); cpl_table_new_column(table, "Int", CPL_TYPE_INT); cpl_table_new_column(table, "String", CPL_TYPE_STRING); error = cpl_table_set_int(table, "Int", 0, 18); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_int(table, "Int", 1, 18); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_invalid(table, "Int", 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_string(table, "String", 0, "hello"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_string(table, "String", 1, "hello"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_invalid(table, "String", 2); cpl_test_eq_error(error, CPL_ERROR_NONE); #ifdef VERBOSE cpl_table_dump(table, 0, cpl_table_get_nrow(table), stream); #endif cpl_table_select_all(table); /* * This test (next 4 calls) is related to ticket DFS03619 */ test_ivalue(1, cpl_table_and_selected_invalid(table, "String"), "Check number of selected rows (string)... "); test_ivalue(0, cpl_table_is_selected(table, 0), "Check that row is not selected..."); test_ivalue(0, cpl_table_is_selected(table, 1), "Check that row is not selected..."); test_ivalue(1, cpl_table_is_selected(table, 2), "Check that row is selected..."); cpl_table_select_all(table); test_ivalue(1, cpl_table_and_selected_invalid(table, "Int"), "Check number of selected rows (integer)... "); test_ivalue(0, cpl_table_is_selected(table, 0), "Check that row is not selected..."); test_ivalue(0, cpl_table_is_selected(table, 1), "Check that row is not selected..."); test_ivalue(1, cpl_table_is_selected(table, 2), "Check that row is selected..."); cpl_table_delete(table); /* * Test case: dividing a double column by integer */ nrows = 100; table = cpl_table_new(nrows); cpl_table_new_column(table, "Int", CPL_TYPE_INT); for (i = 0; i < nrows; i++) error = cpl_table_set_int(table, "Int", i, i + 1); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_table_cast_column(table, "Int", "Double", CPL_TYPE_DOUBLE); test(cpl_table_divide_columns(table, "Double", "Int"), "Divide double column with integer column... "); for (i = 0; i < nrows; i++) { sprintf(message, "Check element %d of result column... ", i); test_fvalue(1.0, 0.00001, cpl_table_get_double(table, "Double", i, &null), message); cpl_test_zero(null); } #ifdef VERBOSE cpl_table_dump(table, 0, cpl_table_get_nrow(table), stream); #endif cpl_table_delete(table); /* * Test table of images */ table = cpl_table_new(5); test(cpl_table_new_column_array(table, "ADouble", CPL_TYPE_DOUBLE, 30), "Creating the ADouble column... "); k = 0; arrays = cpl_table_get_data_array(table, "ADouble"); for (i = 0; i < 5; i++) { arrays[i] = cpl_array_new(30, CPL_TYPE_DOUBLE); for (j = 0; j < 30; j++) { cpl_array_set_double(arrays[i], j, k * .123456); k++; } } dimensions = cpl_array_new(2, CPL_TYPE_INT); cpl_array_set_int(dimensions, 0, 5); cpl_array_set_int(dimensions, 1, 5); test_failure(CPL_ERROR_INCOMPATIBLE_INPUT, cpl_table_set_column_dimensions(table, "ADouble", dimensions), "Try impossible column dimensions... "); cpl_array_set_int(dimensions, 1, 6); test_ivalue(1, cpl_table_get_column_dimensions(table, "ADouble"), "Check no dimensions assigned to column ADouble... "); test(cpl_table_set_column_dimensions(table, "ADouble", dimensions), "Set appropriate dimensions for column of images... "); cpl_array_delete(dimensions); error = cpl_table_save(table, NULL, NULL, BASE "23.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "23.fits"); cpl_table_delete(table); table = cpl_table_load(BASE "23.fits", 1, 1); test_ivalue(2, cpl_table_get_column_dimensions(table, "ADouble"), "Check column ADouble has dimension 2... "); test_ivalue(5, cpl_table_get_column_dimension(table, "ADouble", 0), "Check column ADouble dimension 1 is 5... "); test_ivalue(6, cpl_table_get_column_dimension(table, "ADouble", 1), "Check column ADouble dimension 2 is 6... "); test_failure(cpl_table_save(table, NULL, NULL, BASE "23.fits", CPL_IO_APPEND), CPL_ERROR_UNSUPPORTED_MODE, "Verify failure with CPL_IO_APPEND"); cpl_test_fits(BASE "23.fits"); cpl_table_delete(table); /*********************************************** * Testing all types of casting ***********************************************/ table = cpl_table_new(10); cpl_table_new_column(table, "double" , CPL_TYPE_DOUBLE); for (i = 0; i < 10; i++) if (i != 5) /* Leave intentionally an invalid value */ error = cpl_table_set_double(table, "double", i, i/3.); cpl_test_eq_error(error, CPL_ERROR_NONE); /* * Case 7: * from_name type = CPL_TYPE_XXX * specified type = CPL_TYPE_YYY * to_name type = CPL_TYPE_YYY */ cpl_table_cast_column(table, "double", "float_from_double", CPL_TYPE_FLOAT); cpl_table_cast_column(table, "double", "int_from_double", CPL_TYPE_INT); cpl_table_cast_column(table, "int_from_double", "double_from_int", CPL_TYPE_DOUBLE); cpl_table_cast_column(table, "int_from_double", "float_from_int", CPL_TYPE_FLOAT); cpl_table_cast_column(table, "float_from_double", "double_from_float", CPL_TYPE_DOUBLE); cpl_table_cast_column(table, "float_from_double", "int_from_float", CPL_TYPE_INT); for (i = 0; i < 10; i++) { if (i != 5) { test_fvalue(i/3., 0.00001, cpl_table_get_float(table, "float_from_double", i, &null), "Invalid cast from double to float"); cpl_test_zero(null); test_ivalue(i/3, cpl_table_get_int(table, "int_from_double", i, &null), "Invalid cast from double to int"); cpl_test_zero(null); test_fvalue(i/3, 0.00001, cpl_table_get_double(table, "double_from_int", i, &null), "Invalid cast from int to double"); cpl_test_zero(null); test_fvalue(i/3, 0.00001, cpl_table_get_float(table, "float_from_int", i, &null), "Invalid cast from int to float"); cpl_test_zero(null); test_fvalue(i/3., 0.00001, cpl_table_get_double(table, "double_from_float", i, &null), "Invalid cast from float to double"); cpl_test_zero(null); test_ivalue(i/3, cpl_table_get_int(table, "int_from_float", i, &null), "Invalid cast from float to int"); cpl_test_zero(null); } else { test_ivalue(0, cpl_table_is_valid(table, "float_from_double", i), "Invalid cast from double to float"); test_ivalue(0, cpl_table_is_valid(table, "int_from_double", i), "Invalid cast from double to int"); test_ivalue(0, cpl_table_is_valid(table, "double_from_int", i), "Invalid cast from int to double"); test_ivalue(0, cpl_table_is_valid(table, "float_from_int", i), "Invalid cast from int to float"); test_ivalue(0, cpl_table_is_valid(table, "double_from_float", i), "Invalid cast from float to double"); test_ivalue(0, cpl_table_is_valid(table, "int_from_float", i), "Invalid cast from float to int"); } } /* In place: */ cpl_table_cast_column(table, "double_from_int", NULL, CPL_TYPE_INT); cpl_table_cast_column(table, "float_from_int", NULL, CPL_TYPE_INT); cpl_table_cast_column(table, "double_from_float", NULL, CPL_TYPE_FLOAT); cpl_table_cast_column(table, "int_from_float", NULL, CPL_TYPE_FLOAT); cpl_table_cast_column(table, "float_from_double", NULL, CPL_TYPE_DOUBLE); cpl_table_cast_column(table, "int_from_double", NULL, CPL_TYPE_DOUBLE); for (i = 0; i < 10; i++) { if (i != 5) { test_ivalue(i/3, cpl_table_get_int(table, "double_from_int", i, &null), "Invalid in-place cast from double to int"); cpl_test_zero(null); test_ivalue(i/3, cpl_table_get_int(table, "float_from_int", i, &null), "Invalid in-place cast from float to int"); cpl_test_zero(null); test_fvalue(i/3., 0.00001, cpl_table_get_float(table, "double_from_float", i, &null), "Invalid in-place cast from double to float"); cpl_test_zero(null); test_fvalue(i/3, 0.00001, cpl_table_get_float(table, "int_from_float", i, &null), "Invalid in-place cast from int to float"); cpl_test_zero(null); test_fvalue(i/3., 0.00001, cpl_table_get_double(table, "float_from_double", i, &null), "Invalid in-place cast from float to double"); cpl_test_zero(null); test_fvalue(i/3, 0.00001, cpl_table_get_double(table, "int_from_double", i, &null), "Invalid in-place cast from int to double"); cpl_test_zero(null); } else { test_ivalue(0, cpl_table_is_valid(table, "double_from_int", i), "Invalid in-place cast from double to int"); test_ivalue(0, cpl_table_is_valid(table, "float_from_int", i), "Invalid in-place cast from float to int"); test_ivalue(0, cpl_table_is_valid(table, "double_from_float", i), "Invalid in-place cast from double to float"); test_ivalue(0, cpl_table_is_valid(table, "int_from_float", i), "Invalid in-place cast from int to float"); test_ivalue(0, cpl_table_is_valid(table, "float_from_double", i), "Invalid in-place cast from float to double"); test_ivalue(0, cpl_table_is_valid(table, "int_from_double", i), "Invalid in-place cast from int to double"); } } /* * Case 1: * from_name type = CPL_TYPE_XXX * specified type = CPL_TYPE_XXX * to_name type = CPL_TYPE_XXX * * (Note that now double_from_float is float, and double_from_int is int) */ cpl_table_cast_column(table, "double", "double_from_double", CPL_TYPE_DOUBLE); cpl_table_cast_column(table, "double_from_float", "float_from_float", CPL_TYPE_FLOAT); cpl_table_cast_column(table, "double_from_int", "int_from_int", CPL_TYPE_INT); for (i = 0; i < 10; i++) { if (i != 5) { test_ivalue(i/3, cpl_table_get_int(table, "int_from_int", i, &null), "Invalid cast from int to int"); cpl_test_zero(null); test_fvalue(i/3., 0.00001, cpl_table_get_float(table, "float_from_float", i, &null), "Invalid cast from float to float"); cpl_test_zero(null); test_fvalue(i/3., 0.00001, cpl_table_get_double(table, "double_from_double", i, &null), "Invalid cast from double to double"); cpl_test_zero(null); } else { test_ivalue(0, cpl_table_is_valid(table, "int_from_int", i), "Invalid cast from int to int"); test_ivalue(0, cpl_table_is_valid(table, "float_from_float", i), "Invalid cast from float to float"); test_ivalue(0, cpl_table_is_valid(table, "double_from_double", i), "Invalid cast from double to double"); } } /* In place: */ cpl_table_cast_column(table, "double_from_double", NULL, CPL_TYPE_DOUBLE); cpl_table_cast_column(table, "float_from_float", NULL, CPL_TYPE_FLOAT); cpl_table_cast_column(table, "int_from_int", NULL, CPL_TYPE_INT); for (i = 0; i < 10; i++) { if (i != 5) { test_ivalue(i/3, cpl_table_get_int(table, "int_from_int", i, &null), "Invalid cast from int to int"); cpl_test_zero(null); test_fvalue(i/3., 0.00001, cpl_table_get_float(table, "float_from_float", i, &null), "Invalid cast from float to float"); cpl_test_zero(null); test_fvalue(i/3., 0.00001, cpl_table_get_double(table, "double_from_double", i, &null), "Invalid cast from double to double"); cpl_test_zero(null); } else { test_ivalue(0, cpl_table_is_valid(table, "int_from_int", i), "Invalid cast from int to int"); test_ivalue(0, cpl_table_is_valid(table, "float_from_float", i), "Invalid cast from float to float"); test_ivalue(0, cpl_table_is_valid(table, "double_from_double", i), "Invalid cast from double to double"); } } /* * RESET: start from a new table */ cpl_table_delete(table); table = cpl_table_new(10); cpl_table_new_column(table, "double" , CPL_TYPE_DOUBLE); for (i = 0; i < 10; i++) if (i != 5) /* Leave intentionally an invalid value */ error = cpl_table_set_double(table, "double", i, i/3.); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_table_cast_column(table, "double", "float", CPL_TYPE_FLOAT); cpl_table_cast_column(table, "double", "int", CPL_TYPE_INT); /* * Case 11: * from_name type = CPL_TYPE_XXX * specified type = CPL_TYPE_YYY | CPL_TYPE_POINTER * to_name type = CPL_TYPE_YYY | CPL_TYPE_POINTER (depth = 1) */ cpl_table_cast_column(table, "double", "float1_from_double", CPL_TYPE_FLOAT | CPL_TYPE_POINTER); cpl_table_cast_column(table, "double", "int1_from_double", CPL_TYPE_INT | CPL_TYPE_POINTER); cpl_table_cast_column(table, "int", "double1_from_int", CPL_TYPE_DOUBLE | CPL_TYPE_POINTER); cpl_table_cast_column(table, "int", "float1_from_int", CPL_TYPE_FLOAT | CPL_TYPE_POINTER); cpl_table_cast_column(table, "float", "double1_from_float", CPL_TYPE_DOUBLE | CPL_TYPE_POINTER); cpl_table_cast_column(table, "float", "int1_from_float", CPL_TYPE_INT | CPL_TYPE_POINTER); for (i = 0; i < 10; i++) { if (i != 5) { test_fvalue(i/3., 0.00001, cpl_array_get_float(cpl_table_get_array(table, "float1_from_double", i), 0, NULL), "Invalid cast from double to float1"); test_ivalue(i/3, cpl_array_get_int(cpl_table_get_array(table, "int1_from_double", i), 0, NULL), "Invalid cast from double to int1"); test_fvalue(i/3, 0.00001, cpl_array_get_double(cpl_table_get_array(table, "double1_from_int", i), 0, NULL), "Invalid cast from int to double1"); test_fvalue(i/3, 0.00001, cpl_array_get_float(cpl_table_get_array(table, "float1_from_int", i), 0, NULL), "Invalid cast from int to float1"); test_fvalue(i/3., 0.00001, cpl_array_get_double(cpl_table_get_array(table, "double1_from_float", i), 0, NULL), "Invalid cast from float to double1"); test_ivalue(i/3, cpl_array_get_int(cpl_table_get_array(table, "int1_from_float", i), 0, NULL), "Invalid cast from float to int1"); } else { test_ivalue(0, cpl_table_is_valid(table, "float1_from_double", i), "Invalid cast from double to float1"); test_ivalue(0, cpl_table_is_valid(table, "int1_from_double", i), "Invalid cast from double to int1"); test_ivalue(0, cpl_table_is_valid(table, "double1_from_int", i), "Invalid cast from int to double1"); test_ivalue(0, cpl_table_is_valid(table, "float1_from_int", i), "Invalid cast from int to float1"); test_ivalue(0, cpl_table_is_valid(table, "double1_from_float", i), "Invalid cast from float to double1"); test_ivalue(0, cpl_table_is_valid(table, "int1_from_float", i), "Invalid cast from float to int1"); } } /* * Case 10 in-place: * from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth = 1) * specified type = CPL_TYPE_YYY * to_name type = CPL_TYPE_YYY */ cpl_table_cast_column(table, "float1_from_double", NULL, CPL_TYPE_DOUBLE); cpl_table_cast_column(table, "int1_from_double", NULL, CPL_TYPE_DOUBLE); cpl_table_cast_column(table, "double1_from_int", NULL, CPL_TYPE_INT); cpl_table_cast_column(table, "float1_from_int", NULL, CPL_TYPE_INT); cpl_table_cast_column(table, "double1_from_float", NULL, CPL_TYPE_FLOAT); cpl_table_cast_column(table, "int1_from_float", NULL, CPL_TYPE_FLOAT); for (i = 0; i < 10; i++) { if (i != 5) { test_fvalue(i/3., 0.00001, cpl_table_get_double(table, "float1_from_double", i, &null), "Invalid cast from float1 to double"); cpl_test_zero(null); test_fvalue(i/3, 0.00001, cpl_table_get_double(table, "int1_from_double", i, &null), "Invalid cast from int1 to double"); cpl_test_zero(null); test_ivalue(i/3, cpl_table_get_int(table, "double1_from_int", i, &null), "Invalid cast from double1 to int"); cpl_test_zero(null); test_fvalue(i/3, 0.00001, cpl_table_get_int(table, "float1_from_int", i, &null), "Invalid cast from float1 to int"); cpl_test_zero(null); test_fvalue(i/3., 0.00001, cpl_table_get_float(table, "double1_from_float", i, &null), "Invalid cast from double1 to float"); cpl_test_zero(null); test_ivalue(i/3, cpl_table_get_float(table, "int1_from_float", i, &null), "Invalid cast from int1 to float"); cpl_test_zero(null); } else { test_ivalue(0, cpl_table_is_valid(table, "float1_from_double", i), "Invalid cast from float1 to double"); test_ivalue(0, cpl_table_is_valid(table, "int1_from_double", i), "Invalid cast from int1 to double"); test_ivalue(0, cpl_table_is_valid(table, "double1_from_int", i), "Invalid cast from double1 to int"); test_ivalue(0, cpl_table_is_valid(table, "float1_from_int", i), "Invalid cast from float1 to int"); test_ivalue(0, cpl_table_is_valid(table, "double1_from_float", i), "Invalid cast from double1 to float"); test_ivalue(0, cpl_table_is_valid(table, "int1_from_float", i), "Invalid cast from int1 to float"); } } /* * RESET: start from a new table */ cpl_table_delete(table); table = cpl_table_new(10); cpl_table_new_column(table, "double" , CPL_TYPE_DOUBLE); for (i = 0; i < 10; i++) if (i != 5) /* Leave intentionally an invalid value */ error = cpl_table_set_double(table, "double", i, i/3.); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_table_duplicate_column(table, "double_to_float1", table, "double"); cpl_table_duplicate_column(table, "double_to_int1", table, "double"); cpl_table_cast_column(table, "double", "float", CPL_TYPE_FLOAT); cpl_table_duplicate_column(table, "float_to_double1", table, "float"); cpl_table_duplicate_column(table, "float_to_int1", table, "float"); cpl_table_cast_column(table, "double", "int", CPL_TYPE_INT); cpl_table_duplicate_column(table, "int_to_double1", table, "int"); cpl_table_duplicate_column(table, "int_to_float1", table, "int"); /* * Case 11, in-place: * from_name type = CPL_TYPE_XXX * specified type = CPL_TYPE_YYY | CPL_TYPE_POINTER * to_name type = CPL_TYPE_YYY | CPL_TYPE_POINTER (depth = 1) */ cpl_table_cast_column(table, "double_to_float1", NULL, CPL_TYPE_FLOAT | CPL_TYPE_POINTER); cpl_table_cast_column(table, "double_to_int1", NULL, CPL_TYPE_INT | CPL_TYPE_POINTER); cpl_table_cast_column(table, "int_to_double1", NULL, CPL_TYPE_DOUBLE | CPL_TYPE_POINTER); cpl_table_cast_column(table, "int_to_float1", NULL, CPL_TYPE_FLOAT | CPL_TYPE_POINTER); cpl_table_cast_column(table, "float_to_double1", NULL, CPL_TYPE_DOUBLE | CPL_TYPE_POINTER); cpl_table_cast_column(table, "float_to_int1", NULL, CPL_TYPE_INT | CPL_TYPE_POINTER); for (i = 0; i < 10; i++) { if (i != 5) { test_fvalue(i/3., 0.00001, cpl_array_get_float(cpl_table_get_array(table, "double_to_float1", i), 0, NULL), "Invalid cast from double to float1"); test_ivalue(i/3, cpl_array_get_int(cpl_table_get_array(table, "double_to_int1", i), 0, NULL), "Invalid cast from double to int1"); test_fvalue(i/3, 0.00001, cpl_array_get_double(cpl_table_get_array(table, "int_to_double1", i), 0, NULL), "Invalid cast from int to double1"); test_fvalue(i/3, 0.00001, cpl_array_get_float(cpl_table_get_array(table, "int_to_float1", i), 0, NULL), "Invalid cast from int to float1"); test_fvalue(i/3., 0.00001, cpl_array_get_double(cpl_table_get_array(table, "float_to_double1", i), 0, NULL), "Invalid cast from float to double1"); test_ivalue(i/3, cpl_array_get_int(cpl_table_get_array(table, "float_to_int1", i), 0, NULL), "Invalid cast from float to int1"); } else { test_ivalue(0, cpl_table_is_valid(table, "double_to_float1", i), "Invalid cast from double to float1"); test_ivalue(0, cpl_table_is_valid(table, "double_to_int1", i), "Invalid cast from double to int1"); test_ivalue(0, cpl_table_is_valid(table, "int_to_double1", i), "Invalid cast from int to double1"); test_ivalue(0, cpl_table_is_valid(table, "int_to_float1", i), "Invalid cast from int to float1"); test_ivalue(0, cpl_table_is_valid(table, "float_to_double1", i), "Invalid cast from float to double1"); test_ivalue(0, cpl_table_is_valid(table, "float_to_int1", i), "Invalid cast from float to int1"); } } /* * RESET: start from a new table */ cpl_table_delete(table); table = cpl_table_new(10); cpl_table_new_column(table, "double" , CPL_TYPE_DOUBLE); for (i = 0; i < 10; i++) if (i != 5) /* Leave intentionally an invalid value */ error = cpl_table_set_double(table, "double", i, i/3.); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_table_cast_column(table, "double", "float", CPL_TYPE_FLOAT); cpl_table_cast_column(table, "double", "int", CPL_TYPE_INT); /* * Case 5 & 6: * from_name type = CPL_TYPE_XXX * specified type = CPL_TYPE_XXX | CPL_TYPE_POINTER * to_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth = 1) * * from_name type = CPL_TYPE_XXX * specified type = CPL_TYPE_POINTER * to_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth = 1) */ cpl_table_cast_column(table, "double", "double1", CPL_TYPE_POINTER); cpl_table_cast_column(table, "float", "float1", CPL_TYPE_POINTER); cpl_table_cast_column(table, "int", "int1", CPL_TYPE_POINTER); for (i = 0; i < 10; i++) { if (i != 5) { test_fvalue(i/3., 0.00001, cpl_array_get_float(cpl_table_get_array(table, "float1", i), 0, NULL), "Invalid cast from float to float1"); test_ivalue(i/3, cpl_array_get_int(cpl_table_get_array(table, "int1", i), 0, NULL), "Invalid cast from int to int1"); test_fvalue(i/3., 0.00001, cpl_array_get_double(cpl_table_get_array(table, "double1", i), 0, NULL), "Invalid cast from double to double1"); } else { test_ivalue(0, cpl_table_is_valid(table, "float1", i), "Invalid cast from float to float1"); test_ivalue(0, cpl_table_is_valid(table, "int1", i), "Invalid cast from int to int1"); test_ivalue(0, cpl_table_is_valid(table, "double1", i), "Invalid cast from double to double1"); } } /* * RESET: start from a new table */ cpl_table_delete(table); table = cpl_table_new(10); cpl_table_new_column(table, "double" , CPL_TYPE_DOUBLE); for (i = 0; i < 10; i++) if (i != 5) /* Leave intentionally an invalid value */ error = cpl_table_set_double(table, "double", i, i/3.); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_table_cast_column(table, "double", "float", CPL_TYPE_FLOAT); cpl_table_cast_column(table, "double", "int", CPL_TYPE_INT); /* * Case 5 in-place: * from_name type = CPL_TYPE_XXX * specified type = CPL_TYPE_POINTER * to_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth = 1) */ cpl_table_cast_column(table, "double", NULL, CPL_TYPE_POINTER); cpl_table_cast_column(table, "float", NULL, CPL_TYPE_POINTER); cpl_table_cast_column(table, "int", NULL, CPL_TYPE_POINTER); for (i = 0; i < 10; i++) { if (i != 5) { test_fvalue(i/3., 0.00001, cpl_array_get_float(cpl_table_get_array(table, "float", i), 0, NULL), "Invalid in-place cast from float to float1"); test_ivalue(i/3, cpl_array_get_int(cpl_table_get_array(table, "int", i), 0, NULL), "Invalid in-place cast from int to int1"); test_fvalue(i/3., 0.00001, cpl_array_get_double(cpl_table_get_array(table, "double", i), 0, NULL), "Invalid in-place cast from double to double1"); } else { test_ivalue(0, cpl_table_is_valid(table, "float", i), "Invalid in-place cast from float to float1"); test_ivalue(0, cpl_table_is_valid(table, "int", i), "Invalid in-place cast from int to int1"); test_ivalue(0, cpl_table_is_valid(table, "double", i), "Invalid in-place cast from double to double1"); } } /* * RESET: start from a new table */ cpl_table_delete(table); table = cpl_table_new(10); cpl_table_new_column_array(table, "double", CPL_TYPE_DOUBLE | CPL_TYPE_POINTER, 2); array = cpl_array_new(2, CPL_TYPE_DOUBLE); for (i = 0; i < 2; i++) cpl_array_set_double(array, i, (i+5)/3.); for (i = 0; i < 10; i++) if (i != 5) /* Leave intentionally an invalid value */ error = cpl_table_set_array(table, "double", i, array); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_array_delete(array); cpl_table_duplicate_column(table, "double1", table, "double"); /* * Case 8 & 9: * from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER * specified type = CPL_TYPE_YYY | CPL_TYPE_POINTER * to_name type = CPL_TYPE_YYY | CPL_TYPE_POINTER */ cpl_table_cast_column(table, "double", "float", CPL_TYPE_FLOAT | CPL_TYPE_POINTER); cpl_table_cast_column(table, "double", "float1", CPL_TYPE_FLOAT); for (i = 0; i < 10; i++) { if (i != 5) { test_fvalue(5/3., 0.00001, cpl_array_get_float(cpl_table_get_array(table, "float", i), 0, NULL), "Invalid cast from double2 to float2"); test_fvalue(6/3., 0.00001, cpl_array_get_float(cpl_table_get_array(table, "float", i), 1, NULL), "Invalid cast from double2 to float2"); test_fvalue(5/3., 0.00001, cpl_array_get_float(cpl_table_get_array(table, "float1", i), 0, NULL), "Invalid cast from double2 to float2"); test_fvalue(6/3., 0.00001, cpl_array_get_float(cpl_table_get_array(table, "float1", i), 1, NULL), "Invalid cast from double2 to float2"); } else { test_ivalue(0, cpl_table_is_valid(table, "float1", i), "Invalid cast from double2 to float2"); } } /* In place: */ cpl_table_cast_column(table, "double", NULL, CPL_TYPE_FLOAT | CPL_TYPE_POINTER); cpl_table_cast_column(table, "double1", NULL, CPL_TYPE_FLOAT); for (i = 0; i < 10; i++) { if (i != 5) { test_fvalue(5/3., 0.00001, cpl_array_get_float(cpl_table_get_array(table, "double", i), 0, NULL), "Invalid in-place cast from double2 to float2"); test_fvalue(6/3., 0.00001, cpl_array_get_float(cpl_table_get_array(table, "double", i), 1, NULL), "Invalid in-place cast from double2 to float2"); test_fvalue(5/3., 0.00001, cpl_array_get_float(cpl_table_get_array(table, "double1", i), 0, NULL), "Invalid in-place cast from double2 to float2"); test_fvalue(6/3., 0.00001, cpl_array_get_float(cpl_table_get_array(table, "double1", i), 1, NULL), "Invalid in-place cast from double2 to float2"); } else { test_ivalue(0, cpl_table_is_valid(table, "float1", i), "Invalid in-place cast from doueble1 to float1"); } } cpl_table_delete(table); /* * Testing comparison between string columns. */ table = cpl_table_new(5); cpl_table_new_column(table, "stringa", CPL_TYPE_STRING); cpl_table_new_column(table, "stringb", CPL_TYPE_STRING); error = cpl_table_set_string(table, "stringa", 0, "bb"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_string(table, "stringa", 1, "bb"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_string(table, "stringa", 2, "bb"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_string(table, "stringa", 3, "bb"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_string(table, "stringa", 4, "bb"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_string(table, "stringb", 0, "a"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_string(table, "stringb", 1, "ba"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_string(table, "stringb", 2, "bb"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_string(table, "stringb", 3, "bbb"); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_set_string(table, "stringb", 4, "bc"); cpl_test_eq_error(error, CPL_ERROR_NONE); /* * And equal to */ test_ivalue(1, cpl_table_and_selected(table, "stringa", CPL_EQUAL_TO, "stringb"), "Invalid string comparison (and equal to)"); array = cpl_table_where_selected(table); test_ivalue(1, cpl_array_get_size(array), "Check how many equal to..."); test_ivalue(2, cpl_array_get_cplsize(array, 0, &null), "Check where equal to..."); cpl_test_zero(null); cpl_array_delete(array); cpl_table_select_all(table); /* * And not equal to */ cpl_table_select_all(table); test_ivalue(4, cpl_table_and_selected(table, "stringa", CPL_NOT_EQUAL_TO, "stringb"), "Invalid string comparison (and not equal to)"); array = cpl_table_where_selected(table); test_ivalue(4, cpl_array_get_size(array), "Check how many not equal to..."); test_ivalue(0, cpl_array_get_cplsize(array, 0, &null), "Check where not equal to..."); cpl_test_zero(null); test_ivalue(1, cpl_array_get_cplsize(array, 1, &null), "Check where not equal to..."); cpl_test_zero(null); test_ivalue(3, cpl_array_get_cplsize(array, 2, &null), "Check where not equal to..."); cpl_test_zero(null); test_ivalue(4, cpl_array_get_cplsize(array, 3, &null), "Check where not equal to..."); cpl_test_zero(null); cpl_array_delete(array); /* * And greater than */ cpl_table_select_all(table); test_ivalue(2, cpl_table_and_selected(table, "stringa", CPL_GREATER_THAN, "stringb"), "Invalid string comparison (and greater than)"); array = cpl_table_where_selected(table); test_ivalue(2, cpl_array_get_size(array), "Check how many greater than..."); test_ivalue(0, cpl_array_get_cplsize(array, 0, &null), "Check where greater than..."); cpl_test_zero(null); test_ivalue(1, cpl_array_get_cplsize(array, 1, &null), "Check where greater than..."); cpl_test_zero(null); cpl_array_delete(array); /* * And not greater than */ cpl_table_select_all(table); test_ivalue(3, cpl_table_and_selected(table, "stringa", CPL_NOT_GREATER_THAN, "stringb"), "Invalid string comparison (and not greater than)"); array = cpl_table_where_selected(table); test_ivalue(3, cpl_array_get_size(array), "Check how many not greater than..."); test_ivalue(2, cpl_array_get_cplsize(array, 0, &null), "Check where not greater than..."); cpl_test_zero(null); test_ivalue(3, cpl_array_get_cplsize(array, 1, &null), "Check where not greater than..."); cpl_test_zero(null); test_ivalue(4, cpl_array_get_cplsize(array, 2, &null), "Check where not greater than..."); cpl_test_zero(null); cpl_array_delete(array); /* * And less than */ cpl_table_select_all(table); test_ivalue(2, cpl_table_and_selected(table, "stringa", CPL_LESS_THAN, "stringb"), "Invalid string comparison (and less than)"); array = cpl_table_where_selected(table); test_ivalue(2, cpl_array_get_size(array), "Check how many less than..."); test_ivalue(3, cpl_array_get_cplsize(array, 0, &null), "Check where less than..."); cpl_test_zero(null); test_ivalue(4, cpl_array_get_cplsize(array, 1, &null), "Check where less than..."); cpl_test_zero(null); cpl_array_delete(array); /* * And not less than */ cpl_table_select_all(table); test_ivalue(3, cpl_table_and_selected(table, "stringa", CPL_NOT_LESS_THAN, "stringb"), "Invalid string comparison (and not less than)"); array = cpl_table_where_selected(table); test_ivalue(3, cpl_array_get_size(array), "Check how many not less than..."); test_ivalue(0, cpl_array_get_cplsize(array, 0, &null), "Check where not less than..."); cpl_test_zero(null); test_ivalue(1, cpl_array_get_cplsize(array, 1, &null), "Check where not less than..."); cpl_test_zero(null); test_ivalue(2, cpl_array_get_cplsize(array, 2, &null), "Check where not less than..."); cpl_test_zero(null); cpl_array_delete(array); /* * Or equal to */ cpl_table_unselect_all(table); test_ivalue(1, cpl_table_or_selected(table, "stringa", CPL_EQUAL_TO, "stringb"), "Invalid string comparison (or equal to)"); array = cpl_table_where_selected(table); test_ivalue(1, cpl_array_get_size(array), "Check how many equal to..."); test_ivalue(2, cpl_array_get_cplsize(array, 0, &null), "Check where equal to..."); cpl_test_zero(null); cpl_array_delete(array); cpl_table_select_all(table); /* * Or not equal to */ cpl_table_unselect_all(table); test_ivalue(4, cpl_table_or_selected(table, "stringa", CPL_NOT_EQUAL_TO, "stringb"), "Invalid string comparison (or not equal to)"); array = cpl_table_where_selected(table); test_ivalue(4, cpl_array_get_size(array), "Check how many not equal to..."); test_ivalue(0, cpl_array_get_cplsize(array, 0, &null), "Check where not equal to..."); cpl_test_zero(null); test_ivalue(1, cpl_array_get_cplsize(array, 1, &null), "Check where not equal to..."); cpl_test_zero(null); test_ivalue(3, cpl_array_get_cplsize(array, 2, &null), "Check where not equal to..."); cpl_test_zero(null); test_ivalue(4, cpl_array_get_cplsize(array, 3, &null), "Check where not equal to..."); cpl_test_zero(null); cpl_array_delete(array); /* * Or greater than */ cpl_table_unselect_all(table); test_ivalue(2, cpl_table_or_selected(table, "stringa", CPL_GREATER_THAN, "stringb"), "Invalid string comparison (or greater than)"); array = cpl_table_where_selected(table); test_ivalue(2, cpl_array_get_size(array), "Check how many greater than..."); test_ivalue(0, cpl_array_get_cplsize(array, 0, &null), "Check where greater than..."); cpl_test_zero(null); test_ivalue(1, cpl_array_get_cplsize(array, 1, &null), "Check where greater than..."); cpl_test_zero(null); cpl_array_delete(array); /* * Or not greater than */ cpl_table_unselect_all(table); test_ivalue(3, cpl_table_or_selected(table, "stringa", CPL_NOT_GREATER_THAN, "stringb"), "Invalid string comparison (or not greater than)"); array = cpl_table_where_selected(table); test_ivalue(3, cpl_array_get_size(array), "Check how many not greater than..."); test_ivalue(2, cpl_array_get_cplsize(array, 0, &null), "Check where not greater than..."); cpl_test_zero(null); test_ivalue(3, cpl_array_get_cplsize(array, 1, &null), "Check where not greater than..."); cpl_test_zero(null); test_ivalue(4, cpl_array_get_cplsize(array, 2, &null), "Check where not greater than..."); cpl_test_zero(null); cpl_array_delete(array); /* * Or less than */ cpl_table_unselect_all(table); test_ivalue(2, cpl_table_or_selected(table, "stringa", CPL_LESS_THAN, "stringb"), "Invalid string comparison (or less than)"); array = cpl_table_where_selected(table); test_ivalue(2, cpl_array_get_size(array), "Check how many less than..."); test_ivalue(3, cpl_array_get_cplsize(array, 0, &null), "Check where less than..."); cpl_test_zero(null); test_ivalue(4, cpl_array_get_cplsize(array, 1, &null), "Check where less than..."); cpl_test_zero(null); cpl_array_delete(array); /* * Or not less than */ cpl_table_unselect_all(table); test_ivalue(3, cpl_table_or_selected(table, "stringa", CPL_NOT_LESS_THAN, "stringb"), "Invalid string comparison (or not less than)"); array = cpl_table_where_selected(table); test_ivalue(3, cpl_array_get_size(array), "Check how many not less than..."); test_ivalue(0, cpl_array_get_cplsize(array, 0, &null), "Check where not less than..."); cpl_test_zero(null); test_ivalue(1, cpl_array_get_cplsize(array, 1, &null), "Check where not less than..."); cpl_test_zero(null); test_ivalue(2, cpl_array_get_cplsize(array, 2, &null), "Check where not less than..."); cpl_test_zero(null); cpl_array_delete(array); cpl_table_delete(table); if (stream != stdout) cpl_test_zero( fclose(stream) ); return 0; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test a potentially large table @return void */ /*----------------------------------------------------------------------------*/ static void cpl_table_test_large(cpl_size nrows) { cpl_table *table; cpl_error_code error; double time0, time1; cpl_msg_info("test", "Testing table with %" CPL_SIZE_FORMAT " rows", nrows); table = cpl_table_new(nrows); cpl_test_nonnull(table); error = cpl_table_new_column(table, "Int", CPL_TYPE_INT); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Float", CPL_TYPE_FLOAT); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Double", CPL_TYPE_DOUBLE); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Int2", CPL_TYPE_INT); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Float2", CPL_TYPE_FLOAT); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Double2", CPL_TYPE_DOUBLE); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Int3", CPL_TYPE_INT); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Float3", CPL_TYPE_FLOAT); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Double3", CPL_TYPE_DOUBLE); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Int4", CPL_TYPE_INT); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Float4", CPL_TYPE_FLOAT); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_new_column(table, "Double4", CPL_TYPE_DOUBLE); #if 1 error = cpl_table_new_column(table, "String", CPL_TYPE_STRING); cpl_test_eq_error(error, CPL_ERROR_NONE); #endif error = cpl_table_fill_column_window_int(table, "Int", 0, nrows, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_column_window_float(table, "Float", 0, nrows, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_column_window_double(table, "Double", 0, nrows, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_column_window_int(table, "Int2", 0, nrows, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_column_window_float(table, "Float2", 0, nrows, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_column_window_double(table, "Double2", 0, nrows, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_column_window_int(table, "Int3", 0, nrows, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_column_window_float(table, "Float3", 0, nrows, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_column_window_double(table, "Double3", 0, nrows, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_column_window_int(table, "Int4", 0, nrows, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_column_window_float(table, "Float4", 0, nrows, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_column_window_double(table, "Double4", 0, nrows, 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); #if 1 error = cpl_table_fill_column_window_string(table, "String", 0, nrows, "dummy"); cpl_test_eq_error(error, CPL_ERROR_NONE); #endif cpl_msg_info("test", "Saving table with %" CPL_SIZE_FORMAT " rows", nrows); time0 = cpl_test_get_walltime(); error = cpl_table_save(table, NULL, NULL, BASE "26.fits", CPL_IO_CREATE); cpl_test_fits(BASE "26.fits"); cpl_test_eq_error(error, CPL_ERROR_NONE); time1 = cpl_test_get_walltime(); cpl_table_delete(table); cpl_msg_info("test", "%f sec", time1 - time0); cpl_msg_info("test", "Loading table with %" CPL_SIZE_FORMAT " rows", nrows); time0 = time1; table = cpl_table_load(BASE "26.fits", 1, 1); time1 = cpl_test_get_walltime(); cpl_test_nonnull(table); cpl_test_eq(cpl_table_get_nrow(table), NROWS_LARGE); cpl_msg_info("test", "%f sec", time1 - time0); cpl_table_delete(table); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test tables with 0 and 1 rows, saving with empty propertylist @return void */ /*----------------------------------------------------------------------------*/ static void cpl_table_test_zero_one(void) { /* Test 1: Test saving a table with empty propertylists */ cpl_table *table = cpl_table_new(1); cpl_propertylist *tlist = cpl_propertylist_new(); cpl_propertylist *plist = cpl_propertylist_new(); (void)remove(BASE ".fits"); test(cpl_table_save(table, plist, tlist, BASE ".fits", CPL_IO_CREATE), "Saving 1-length table to disk using empty propertylists..."); cpl_test_fits(BASE ".fits"); cpl_propertylist_delete(plist); cpl_propertylist_delete(tlist); cpl_table_delete(table); cpl_test_zero(remove(BASE ".fits")); /* * Testing tables with zero rows. */ cpl_msg_info("test", "Creating a table without rows... "); table = cpl_table_new(0); cpl_test_nonnull(table); cpl_test_zero(cpl_table_get_nrow(table)); test(cpl_table_new_column(table, "Int", CPL_TYPE_INT), "Creating empty Integer column... "); test(cpl_table_new_column(table, "LongLong", CPL_TYPE_LONG_LONG), "Creating empty Integer column... "); test(cpl_table_new_column(table, "Float", CPL_TYPE_FLOAT), "Creating empty Float column... "); test(cpl_table_new_column(table, "Double", CPL_TYPE_DOUBLE), "Creating empty Double column... "); test(cpl_table_new_column(table, "CFloat", CPL_TYPE_FLOAT_COMPLEX), "Creating empty Float Complex column... "); test(cpl_table_new_column(table, "CDouble", CPL_TYPE_DOUBLE_COMPLEX), "Creating empty Double Complex column... "); test(cpl_table_new_column(table, "String", CPL_TYPE_STRING), "Creating empty String column... "); test(cpl_table_new_column_array(table, "AInt", CPL_TYPE_INT | CPL_TYPE_POINTER, 232), "Creating empty IntegerArray column... "); test(cpl_table_new_column_array(table, "ALongLong", CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER, 232), "Creating empty LongLongArray column... "); test(cpl_table_new_column_array(table, "AFloat", CPL_TYPE_FLOAT | CPL_TYPE_POINTER, 232), "Creating empty FloatArray column... "); test(cpl_table_new_column_array(table, "ADouble", CPL_TYPE_DOUBLE | CPL_TYPE_POINTER, 232), "Creating empty DoubleArray column... "); test(cpl_table_new_column_array(table, "CAFloat", CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER, 232), "Creating empty FloatComplexArray column... "); test(cpl_table_new_column_array(table, "CADouble", CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER, 232), "Creating empty DoubleComplexArray column... "); test_ivalue(0, cpl_table_get_nrow(table), "Check zero table length... "); test_ivalue(13, cpl_table_get_ncol(table), "Check zero table width... "); test_ivalue(0, cpl_table_get_column_depth(table, "Double"), "Check \"Double\" depth... "); test_ivalue(0, cpl_table_get_column_depth(table, "CDouble"), "Check \"CDouble\" depth... "); test_ivalue(232, cpl_table_get_column_depth(table, "AInt"), "Check \"AInt\" depth... "); test_ivalue(232, cpl_table_get_column_depth(table, "CAFloat"), "Check \"CAFloat\" depth... "); test_ivalue(232, cpl_table_get_column_depth(table, "CADouble"), "Check \"CADouble\" depth... "); test(cpl_table_set_size(table, 1), "Expanding table to one row... "); test_ivalue(1, cpl_table_get_nrow(table), "Check table with one row... "); test(cpl_table_set_size(table, 0), "Deleting all rows from table... "); test_ivalue(0, cpl_table_get_nrow(table), "Check again zero table length... "); test(cpl_table_erase_column(table, "Double"), "Delete zero-column \"Double\"... "); test_ivalue(12, cpl_table_get_ncol(table), "Check zero-column removal... "); test(cpl_table_erase_column(table, "AInt"), "Delete zero-column \"AInt\"... "); test_ivalue(11, cpl_table_get_ncol(table), "Check zero-column array removal... "); test(cpl_table_erase_column(table, "CFloat"), "Delete zero-column \"CFloat\"... "); test_ivalue(10, cpl_table_get_ncol(table), "Check zero-column \"CFloat\" removal... "); test_pvalue(NULL, cpl_table_get_data_float(table, "Float"), "Check NULL pointer to column Float... "); test_failure(CPL_ERROR_NULL_INPUT, cpl_table_erase_selected(NULL), "Erase selected on NULL table... "); test(cpl_table_erase_selected(table), "Erase selected on empty table... "); test_failure(CPL_ERROR_NULL_INPUT, cpl_table_set_column_unit(NULL, "Float", "arcsec"), "Try to assign unit to NULL table... "); test_failure(CPL_ERROR_NULL_INPUT, cpl_table_set_column_unit(table, NULL, "arcsec"), "Try to assign unit to NULL column... "); test_failure(CPL_ERROR_DATA_NOT_FOUND, cpl_table_set_column_unit(table, "Double", "arcsec"), "Try to assign unit to non existing column... "); test(cpl_table_set_column_unit(table, "Float", "arcsec"), "Assign unit 'arcsec' to column Float... "); test_svalue("arcsec", cpl_table_get_column_unit(table, "Float"), "Check column unit... "); /* if (strcmp(unit = (char *)cpl_table_get_column_unit(table, "Float"), "arcsec")) { printf("Check column unit... "); printf("Expected \"arcsec\", obtained \"%s\"\n", unit); cpl_end(); return 1; } */ test(cpl_table_set_column_unit(table, "Float", NULL), "Assign unit NULL to column Float... "); test_pvalue(NULL, (char *)cpl_table_get_column_unit(table, "Float"), "Get unit NULL from column Float... "); test(cpl_table_save(table, NULL, NULL, BASE "1.fits", CPL_IO_CREATE), "Saving 0-length table to disk..."); cpl_test_fits(BASE "1.fits"); cpl_table_delete(table); cpl_msg_info("test", "Loading 0-length table from disk... "); table = cpl_table_load(BASE "1.fits", 1, 1); cpl_test_nonnull(table); test(cpl_table_set_size(table, 1), "Expanding again table to one row... "); test(cpl_table_erase_invalid_rows(table), "Pruning table to zero... "); /* * The returned value must be 1, because columns are deleted first, * and what is left is a columnless table with 1 row - a perfectly * legal CPL table. For instance, when we create a new table having * n rows, * * table = cpl_table_new(n); * * a table is created. No column is yet defined, but still the number * of rows is assigned. */ test_ivalue(1, cpl_table_get_nrow(table), "Checking zero-table length after pruning... "); test_ivalue(0, cpl_table_get_ncol(table), "Checking zero-table width after pruning... "); cpl_table_delete(table); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test table 20 @param table The table to test @return void @see cpl_table_test_main() @note A ppc-based Mac with gcc 4.0 cannot compile this code and that for table 21 + 22 if it is pasted into cpl_table_test_main() */ /*----------------------------------------------------------------------------*/ static void cpl_table_test_20(cpl_table * table) { int null; cpl_table *copia; test_ivalue(0, cpl_table_is_valid(table, "Integer", 0), "Check element 1 of \"Integer\" += \"IntToFloat\"... "); test_ivalue(1998, cpl_table_get_int(table, "Integer", 1, &null), "Check element 2 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Integer", 2), "Check element 3 of \"Integer\" += \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Integer", 3), "Check element 4 of \"Integer\" += \"IntToFloat\"... "); test_ivalue(1998, cpl_table_get_int(table, "Integer", 4, &null), "Check element 5 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(1998, cpl_table_get_int(table, "Integer", 5, &null), "Check element 6 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(998, cpl_table_get_int(table, "Integer", 6, &null), "Check element 7 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(998, cpl_table_get_int(table, "Integer", 7, &null), "Check element 8 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(1998, cpl_table_get_int(table, "Integer", 8, &null), "Check element 9 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(1998, cpl_table_get_int(table, "Integer", 9, &null), "Check element 10 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(1998, cpl_table_get_int(table, "Integer", 10, &null), "Check element 11 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Integer", 11), "Check element 12 of \"Integer\" += \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Integer", 12), "Check element 13 of \"Integer\" += \"IntToFloat\"... "); test_ivalue(10, cpl_table_get_int(table, "Integer", 13, &null), "Check element 14 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(8, cpl_table_get_int(table, "Integer", 14, &null), "Check element 15 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(5, cpl_table_get_int(table, "Integer", 15, &null), "Check element 16 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(10, cpl_table_get_int(table, "Integer", 16, &null), "Check element 17 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Integer", 17), "Check element 18 of \"Integer\" += \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Integer", 18), "Check element 19 of \"Integer\" += \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Integer", 19), "Check element 20 of \"Integer\" += \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Integer", 20), "Check element 21 of \"Integer\" += \"IntToFloat\"... "); test_ivalue(1998, cpl_table_get_int(table, "Integer", 21, &null), "Check element 22 of \"Integer\" += \"IntToFloat\"... "); cpl_test_zero(null); test(cpl_table_subtract_columns(table, "Integer", "IntToFloat"), "Subtract \"IntToFloat\" from \"Integer\"... "); test(cpl_table_subtract_columns(table, "IntToFloat", "Integer"), "Subtract \"Integer\" from \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 0), "Check element 1 of \"IntToFloat\" -= \"Integer\"... "); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 1, &null), "Check element 2 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 2), "Check element 3 of \"IntToFloat\" -= \"Integer\"... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 3), "Check element 4 of \"IntToFloat\" -= \"Integer\"... "); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 4, &null), "Check element 5 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 5, &null), "Check element 6 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test_fvalue(1000.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 6, &null), "Check element 7 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test_fvalue(-1000.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 7, &null), "Check element 8 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 8, &null), "Check element 9 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 9, &null), "Check element 10 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 10, &null), "Check element 11 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 11), "Check element 12 of \"IntToFloat\" -= \"Integer\"... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 12), "Check element 13 of \"IntToFloat\" -= \"Integer\"... "); test_fvalue(-4.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 13, &null), "Check element 14 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test_fvalue(6.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 14, &null), "Check element 15 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test_fvalue(-3.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 15, &null), "Check element 16 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test_fvalue(-2.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 16, &null), "Check element 17 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 17), "Check element 18 of \"IntToFloat\" -= \"Integer\"... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 18), "Check element 19 of \"IntToFloat\" -= \"Integer\"... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 19), "Check element 20 of \"IntToFloat\" -= \"Integer\"... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 20), "Check element 21 of \"IntToFloat\" -= \"Integer\"... "); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 21, &null), "Check element 22 of \"IntToFloat\" -= \"Integer\"... "); cpl_test_zero(null); test(cpl_table_multiply_columns(table, "IntToFloat", "Double"), "Multiply double column with float column... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 0), "Check element 1 of \"IntToFloat\" *= \"Double\"... "); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 1, &null), "Check element 2 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 2), "Check element 3 of \"IntToFloat\" *= \"Double\"... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 3), "Check element 4 of \"IntToFloat\" *= \"Double\"... "); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 4, &null), "Check element 5 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 5, &null), "Check element 6 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test_fvalue(-1110.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 6, &null), "Check element 7 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test_fvalue(-999880.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 7, &null), "Check element 8 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 8, &null), "Check element 9 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 9, &null), "Check element 10 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 10, &null), "Check element 11 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 11), "Check element 12 of \"IntToFloat\" *= \"Double\"... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 12), "Check element 13 of \"IntToFloat\" *= \"Double\"... "); test_fvalue(-28.44, 0.00001, cpl_table_get_float(table, "IntToFloat", 13, &null), "Check element 14 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test_fvalue(6.66, 0.00001, cpl_table_get_float(table, "IntToFloat", 14, &null), "Check element 15 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test_fvalue(-12.33, 0.00001, cpl_table_get_float(table, "IntToFloat", 15, &null), "Check element 16 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test_fvalue(-12.22, 0.00001, cpl_table_get_float(table, "IntToFloat", 16, &null), "Check element 17 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 17), "Check element 18 of \"IntToFloat\" *= \"Double\"... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 18), "Check element 19 of \"IntToFloat\" *= \"Double\"... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 19), "Check element 20 of \"IntToFloat\" *= \"Double\"... "); test_ivalue(0, cpl_table_is_valid(table, "IntToFloat", 20), "Check element 21 of \"IntToFloat\" *= \"Double\"... "); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "IntToFloat", 21, &null), "Check element 22 of \"IntToFloat\" *= \"Double\"... "); cpl_test_zero(null); test(cpl_table_divide_columns(table, "Float", "IntToFloat"), "Divide float column with float column... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 0), "Check element 1 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 1), "Check element 2 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 2), "Check element 3 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 3), "Check element 4 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 4), "Check element 5 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 5), "Check element 6 of \"Float\" /= \"IntToFloat\"... "); test_fvalue(0.000991, 0.0000001, cpl_table_get_float(table, "Float", 6, &null), "Check element 7 of \"Float\" /= \"IntToFloat\"... "); cpl_test_zero(null); test_fvalue(-0.0010001, 0.0000001, cpl_table_get_float(table, "Float", 7, &null), "Check element 8 of \"Float\" /= \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Float", 8), "Check element 9 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 9), "Check element 10 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 10), "Check element 11 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 11), "Check element 12 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 12), "Check element 13 of \"Float\" /= \"IntToFloat\"... "); test_fvalue(-0.2496484, 0.0000001, cpl_table_get_float(table, "Float", 13, &null), "Check element 14 of \"Float\" /= \"IntToFloat\"... "); cpl_test_zero(null); test_fvalue(0.1651652, 0.0000001, cpl_table_get_float(table, "Float", 14, &null), "Check element 15 of \"Float\" /= \"IntToFloat\"... "); cpl_test_zero(null); test_fvalue(-0.3325223, 0.0000001, cpl_table_get_float(table, "Float", 15, &null), "Check element 16 of \"Float\" /= \"IntToFloat\"... "); cpl_test_zero(null); test_fvalue(-0.4991817, 0.0000001, cpl_table_get_float(table, "Float", 16, &null), "Check element 17 of \"Float\" /= \"IntToFloat\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Float", 17), "Check element 18 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 18), "Check element 19 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 19), "Check element 20 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 20), "Check element 21 of \"Float\" /= \"IntToFloat\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 21), "Check element 22 of \"Float\" /= \"IntToFloat\"... "); test(cpl_table_add_scalar(table, "Float", 1), "Add integer constant to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 0), "Check element 1 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 1), "Check element 2 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 2), "Check element 3 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 3), "Check element 4 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 4), "Check element 5 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 5), "Check element 6 of adding 1 to \"Float\"... "); test_fvalue(1.000991, 0.0000001, cpl_table_get_float(table, "Float", 6, &null), "Check element 7 of adding 1 to \"Float\"... "); cpl_test_zero(null); test_fvalue(1-0.0010001, 0.0000001, cpl_table_get_float(table, "Float", 7, &null), "Check element 8 of adding 1 to \"Float\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Float", 8), "Check element 9 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 9), "Check element 10 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 10), "Check element 11 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 11), "Check element 12 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 12), "Check element 13 of adding 1 to \"Float\"... "); test_fvalue(1-0.2496484, 0.0000001, cpl_table_get_float(table, "Float", 13, &null), "Check element 14 of adding 1 to \"Float\"... "); cpl_test_zero(null); test_fvalue(1.1651652, 0.0000001, cpl_table_get_float(table, "Float", 14, &null), "Check element 15 of adding 1 to \"Float\"... "); cpl_test_zero(null); test_fvalue(1-0.3325223, 0.0000001, cpl_table_get_float(table, "Float", 15, &null), "Check element 16 of adding 1 to \"Float\"... "); cpl_test_zero(null); test_fvalue(1-0.4991817, 0.0000001, cpl_table_get_float(table, "Float", 16, &null), "Check element 17 of adding 1 to \"Float\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Float", 17), "Check element 18 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 18), "Check element 19 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 19), "Check element 20 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 20), "Check element 21 of adding 1 to \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 21), "Check element 22 of adding 1 to \"Float\"... "); test(cpl_table_set_column_invalid(table, "Float", 0, cpl_table_get_nrow(table)), "Set \"Float\" column to NULL... "); copia = cpl_table_duplicate(table); cpl_test_nonnull(copia); test(cpl_table_erase_invalid_rows(table), "Pruning table... "); test_ivalue(18, cpl_table_get_nrow(table), "Checking table length after pruning... "); test_ivalue(10, cpl_table_get_ncol(table), "Checking table width after pruning... "); test(cpl_table_erase_invalid(copia), "Cleaning table... "); test_ivalue(8, cpl_table_get_nrow(copia), "Checking table length after cleaning... "); test_ivalue(10, cpl_table_get_ncol(copia), "Checking table width after cleaning... "); cpl_table_delete(copia); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test table 21 @param table The table to test @return void @see cpl_table_test_main() @note A ppc-based Mac with gcc 4.0 cannot compile this code and that for table 20 + 22 if it is pasted into cpl_table_test_main() */ /*----------------------------------------------------------------------------*/ static void cpl_table_test_21(cpl_table * table) { cpl_size i; int null; char message[80]; const char *names[2]; cpl_table *copia; cpl_propertylist *reflist; cpl_error_code error; test_svalue("Pixel", cpl_table_get_column_unit(table, "AInt"), "Check column unit... "); /* if (strcmp(unit = (char *)cpl_table_get_column_unit(table, "AInt"), "Pixel")) { printf("Check column unit... "); printf("Expected \"Pixel\", obtained \"%s\"\n", unit); cpl_end(); return 1; } */ test_ivalue(18, cpl_table_get_nrow(table), "Checking table length after sorting... "); test_ivalue(11, cpl_table_get_ncol(table), "Checking table width after sorting... "); test_ivalue(7, cpl_table_count_invalid(table, "Integer"), "Count \"Integer\" NULLs after sorting... "); test_ivalue(7, cpl_table_count_invalid(table, "Float"), "Count \"Float\" NULLs after sorting... "); test_ivalue(2, cpl_table_count_invalid(table, "Double"), "Count \"Double\" NULLs after sorting... "); test_ivalue(2, cpl_table_count_invalid(table, "String"), "Count \"String\" NULLs after sorting... "); for (i = 0; i < 7; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of sorted \"Integer\"... ", i + 1); test_ivalue(0, cpl_table_is_valid(table, "Integer", i), message); } test_ivalue(-1, cpl_table_get_int(table, "Integer", 7, &null), "Check element 7 of sorted \"Integer\"... "); cpl_test_zero(null); test_ivalue(1, cpl_table_get_int(table, "Integer", 8, &null), "Check element 8 of sorted \"Integer\"... "); cpl_test_zero(null); test_ivalue(4, cpl_table_get_int(table, "Integer", 9, &null), "Check element 9 of sorted \"Integer\"... "); cpl_test_zero(null); test_ivalue(6, cpl_table_get_int(table, "Integer", 10, &null), "Check element 10 of sorted \"Integer\"... "); cpl_test_zero(null); test_ivalue(7, cpl_table_get_int(table, "Integer", 11, &null), "Check element 11 of sorted \"Integer\"... "); cpl_test_zero(null); for (i = 12; i < 18; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of sorted \"Integer\"... ", i + 1); test_ivalue(999, cpl_table_get_int(table, "Integer", i, &null), message); cpl_test_zero(null); } test_fvalue(999.88, 0.00001, cpl_table_get_double(table, "Double", 0, &null), "Check element 1 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(999.88, 0.00001, cpl_table_get_double(table, "Double", 1, &null), "Check element 2 of sorted \"Double\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Double", 2), "Check element 3 of sorted \"Double\"... "); test_fvalue(999.88, 0.00001, cpl_table_get_double(table, "Double", 3, &null), "Check element 4 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(3.11, 0.00001, cpl_table_get_double(table, "Double", 4, &null), "Check element 5 of sorted \"Double\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Double", 5), "Check element 6 of sorted \"Double\"... "); test_fvalue(999.88, 0.00001, cpl_table_get_double(table, "Double", 6, &null), "Check element 7 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(-1.11, 0.00001, cpl_table_get_double(table, "Double", 7, &null), "Check element 8 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(1.11, 0.00001, cpl_table_get_double(table, "Double", 8, &null), "Check element 9 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(4.11, 0.00001, cpl_table_get_double(table, "Double", 9, &null), "Check element 10 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(6.11, 0.00001, cpl_table_get_double(table, "Double", 10, &null), "Check element 11 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(7.11, 0.00001, cpl_table_get_double(table, "Double", 11, &null), "Check element 12 of sorted \"Double\"... "); cpl_test_zero(null); for (i = 12; i < 18; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of sorted \"Double\"... ", i + 1); test_fvalue(999.88, 0.00001, cpl_table_get_double(table, "Double", i, &null), message); cpl_test_zero(null); } test_svalue("999", cpl_table_get_string(table, "String", 0), "Check element 1 of sorted \"String\"... "); test_svalue("999", cpl_table_get_string(table, "String", 1), "Check element 2 of sorted \"String\"... "); test_ivalue(0, cpl_table_is_valid(table, "String", 2), "Check element 3 of sorted \"String\"... "); test_svalue("999", cpl_table_get_string(table, "String", 3), "Check element 4 of sorted \"String\"... "); test_svalue("baaa", cpl_table_get_string(table, "String", 4), "Check element 5 of sorted \"String\"... "); test_ivalue(0, cpl_table_is_valid(table, "String", 5), "Check element 6 of sorted \"String\"... "); test_svalue("999", cpl_table_get_string(table, "String", 6), "Check element 7 of sorted \"String\"... "); test_svalue("extra", cpl_table_get_string(table, "String", 7), "Check element 8 of sorted \"String\"... "); test_svalue("acde", cpl_table_get_string(table, "String", 8), "Check element 9 of sorted \"String\"... "); test_svalue(" sss", cpl_table_get_string(table, "String", 9), "Check element 10 of sorted \"String\"... "); test_svalue("daaa", cpl_table_get_string(table, "String", 10), "Check element 11 of sorted \"String\"... "); test_svalue("aaaa", cpl_table_get_string(table, "String", 11), "Check element 11 of sorted \"String\"... "); for (i = 12; i < 18; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of sorted \"String\"... ", i + 1); test_svalue("999", cpl_table_get_string(table, "String", i), message); } test_ivalue(0, cpl_table_is_valid(table, "Float", 0), "Check element 1 of sorted \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 1), "Check element 2 of sorted \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 2), "Check element 3 of sorted \"Float\"... "); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "Float", 3, &null), "Check element 4 of sorted \"Float\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Float", 4), "Check element 5 of sorted \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 5), "Check element 6 of sorted \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 6), "Check element 7 of sorted \"Float\"... "); test_fvalue(-1110.0, 0.00001, cpl_table_get_float(table, "Float", 7, &null), "Check element 8 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(6.66, 0.00001, cpl_table_get_float(table, "Float", 8, &null), "Check element 9 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(-12.33, 0.00001, cpl_table_get_float(table, "Float", 9, &null), "Check element 10 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(-12.22, 0.00001, cpl_table_get_float(table, "Float", 10, &null), "Check element 11 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(-28.44, 0.00001, cpl_table_get_float(table, "Float", 11, &null), "Check element 12 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "Float", 12, &null), "Check element 13 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "Float", 13, &null), "Check element 14 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "Float", 14, &null), "Check element 15 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(-999880.0, 0.00001, cpl_table_get_float(table, "Float", 15, &null), "Check element 16 of sorted \"Float\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Float", 16), "Check element 17 of sorted \"Float\"... "); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "Float", 17, &null), "Check element 18 of sorted \"Float\"... "); cpl_test_zero(null); names[0] = "Sequence"; reflist = cpl_propertylist_new(); cpl_propertylist_append_bool(reflist, names[0], 0); test(cpl_table_sort(table, reflist), "Undo table sorting... "); cpl_propertylist_delete(reflist); names[0] = "Integer"; reflist = cpl_propertylist_new(); cpl_propertylist_append_bool(reflist, names[0], 1); test(cpl_table_sort(table, reflist), "Sorting by decreasing values of the \"Integer\" column... "); /* %$% */ /* cpl_table_dump_structure(table, NULL); cpl_table_dump(table, 0, cpl_table_get_nrow(table), NULL); */ /* cpl_table_dump_structure(table, NULL); cpl_table_dump(table, 0, cpl_table_get_nrow(table), NULL); printf("Median of Integer: %d\n", cpl_table_median_int(table, "Integer")); printf("Median of Float: %f\n", cpl_table_median_float(table, "Float")); printf("Median of Double: %f\n", cpl_table_median_double(table, "Double")); printf("Median of Sequence: %d\n", cpl_table_median_int(table, "Sequence")); */ copia = cpl_table_extract(table, 12, 6); /* cpl_table_dump_structure(table, NULL); cpl_table_dump(table, 0, cpl_table_get_nrow(table), NULL); cpl_table_dump_structure(copia, NULL); cpl_table_dump(copia, 0, cpl_table_get_nrow(copia), NULL); */ test_fvalue(999.000000, 0.001, cpl_table_get_column_median(table, "Integer"), "Median of Integer..."); test_fvalue(0.000000, 0.001, cpl_table_get_column_median(table, "Float"), "Median of Float..."); test_fvalue(999.880000, 0.001, cpl_table_get_column_median(table, "Double"), "Median of Double..."); test_fvalue(8.000000, 0.001, cpl_table_get_column_median(table, "Sequence"), "Median of Sequence..."); test_fvalue(546.454545, 0.001, cpl_table_get_column_mean(table, "Integer"), "Mean of Integer..."); test_fvalue(-91003.302727, 0.001, cpl_table_get_column_mean(table, "Float"), "Mean of Float..."); test_fvalue(626.202500, 0.001, cpl_table_get_column_mean(table, "Double"), "Mean of Double..."); test_fvalue(8.500000, 0.001, cpl_table_get_column_mean(table, "Sequence"), "Mean of Sequence..."); test_fvalue(519.939489, 0.001, cpl_table_get_column_stdev(table, "Integer"), "Stdev of Integer..."); test_fvalue(301440.480937, 0.001, cpl_table_get_column_stdev(table, "Float"), "Stdev of Float..."); test_fvalue(498.239830, 0.001, cpl_table_get_column_stdev(table, "Double"), "Stdev of Double..."); test_fvalue(5.338539, 0.001, cpl_table_get_column_stdev(table, "Sequence"), "Stdev of Sequence..."); /* Test on columns without invalid elements */ test_fvalue(406.463118, 0.001, cpl_table_get_column_stdev(copia, "Integer"), "Stdev of Integer from 6 last elements..."); test_fvalue(449.534137, 0.001, cpl_table_get_column_stdev(copia, "Float"), "Stdev of Float from 6 last elements..."); test_fvalue(406.795909, 0.001, cpl_table_get_column_stdev(copia, "Double"), "Stdev of Double from 6 last elements..."); cpl_table_delete(copia); cpl_msg_info(cpl_func, "median of Integer: %f\n", cpl_table_get_column_median(table, "Integer")); cpl_msg_info(cpl_func, "median of Float: %f\n", cpl_table_get_column_median(table, "Float")); cpl_msg_info(cpl_func, "median of Double: %f\n", cpl_table_get_column_median(table, "Double")); cpl_msg_info(cpl_func, "median of Sequence: %f\n", cpl_table_get_column_median(table, "Sequence")); cpl_msg_info(cpl_func, "mean of Integer: %f\n", cpl_table_get_column_mean(table, "Integer")); cpl_msg_info(cpl_func, "mean of Float: %f\n", cpl_table_get_column_mean(table, "Float")); cpl_msg_info(cpl_func, "mean of Double: %f\n", cpl_table_get_column_mean(table, "Double")); cpl_msg_info(cpl_func, "mean of Sequence: %f\n", cpl_table_get_column_mean(table, "Sequence")); cpl_msg_info(cpl_func, "Stdev of Integer: %f\n", cpl_table_get_column_stdev(table, "Integer")); cpl_msg_info(cpl_func, "Stdev of Float: %f\n", cpl_table_get_column_stdev(table, "Float")); cpl_msg_info(cpl_func, "Stdev of Double: %f\n", cpl_table_get_column_stdev(table, "Double")); cpl_msg_info(cpl_func, "Stdev of Sequence: %f\n", cpl_table_get_column_stdev(table, "Sequence")); /**- FIXME: RESTORE!!! */ error = cpl_table_fill_invalid_int(table, "Integer", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_fill_invalid_int(table, "New AInt", 320); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_table_save(table, NULL, NULL, BASE "22.fits", CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(BASE "22.fits"); /* Test sorting table with only invalid elements (exposes DFS04044) */ for (i = 0; i < cpl_table_get_nrow(table); i++) { error = cpl_table_set_invalid(table, "Integer",i); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_table_sort(table, reflist); cpl_propertylist_delete(reflist); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test table 22 @param table The table to test @return void @see cpl_table_test_main() @note A ppc-based Mac with gcc 4.0 cannot compile this code and that for table 20 + 21 if it is pasted into cpl_table_test_main() */ /*----------------------------------------------------------------------------*/ static void cpl_table_test_22(cpl_table * table) { cpl_size i; int null; char message[80]; test_ivalue(18, cpl_table_get_nrow(table), "Checking table length after decreasing sorting... "); test_ivalue(11, cpl_table_get_ncol(table), "Checking table width after decreasing sorting... "); test_ivalue(7, cpl_table_count_invalid(table, "Integer"), "Count \"Integer\" NULLs after decreasing sorting... "); test_ivalue(7, cpl_table_count_invalid(table, "Float"), "Count \"Float\" NULLs after decreasing sorting... "); test_ivalue(2, cpl_table_count_invalid(table, "Double"), "Count \"Double\" NULLs after decreasing sorting... "); test_ivalue(2, cpl_table_count_invalid(table, "String"), "Count \"String\" NULLs after decreasing sorting... "); for (i = 0; i < 7; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of sorted \"Integer\"... ", i + 1); test_ivalue(0, cpl_table_is_valid(table, "Integer", i), message); } for (i = 7; i < 13; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of sorted \"Integer\"... ", i + 1); test_ivalue(999, cpl_table_get_int(table, "Integer", i, &null), message); cpl_test_zero(null); } test_ivalue(7, cpl_table_get_int(table, "Integer", 13, &null), "Check element 13 of sorted \"Integer\"... "); cpl_test_zero(null); test_ivalue(6, cpl_table_get_int(table, "Integer", 14, &null), "Check element 14 of sorted \"Integer\"... "); cpl_test_zero(null); test_ivalue(4, cpl_table_get_int(table, "Integer", 15, &null), "Check element 15 of sorted \"Integer\"... "); cpl_test_zero(null); test_ivalue(1, cpl_table_get_int(table, "Integer", 16, &null), "Check element 16 of sorted \"Integer\"... "); cpl_test_zero(null); test_ivalue(-1, cpl_table_get_int(table, "Integer", 17, &null), "Check element 17 of sorted \"Integer\"... "); cpl_test_zero(null); test_fvalue(999.88, 0.00001, cpl_table_get_double(table, "Double", 0, &null), "Check element 1 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(999.88, 0.00001, cpl_table_get_double(table, "Double", 1, &null), "Check element 2 of sorted \"Double\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Double", 2), "Check element 3 of sorted \"Double\"... "); test_fvalue(999.88, 0.00001, cpl_table_get_double(table, "Double", 3, &null), "Check element 4 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(3.11, 0.00001, cpl_table_get_double(table, "Double", 4, &null), "Check element 5 of sorted \"Double\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Double", 5), "Check element 6 of sorted \"Double\"... "); test_fvalue(999.88, 0.00001, cpl_table_get_double(table, "Double", 6, &null), "Check element 7 of sorted \"Double\"... "); cpl_test_zero(null); for (i = 7; i < 13; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of sorted \"Double\"... ", i + 1); test_fvalue(999.88, 0.00001, cpl_table_get_double(table, "Double", i, &null), message); cpl_test_zero(null); } test_fvalue(7.11, 0.00001, cpl_table_get_double(table, "Double", 13, &null), "Check element 14 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(6.11, 0.00001, cpl_table_get_double(table, "Double", 14, &null), "Check element 15 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(4.11, 0.00001, cpl_table_get_double(table, "Double", 15, &null), "Check element 16 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(1.11, 0.00001, cpl_table_get_double(table, "Double", 16, &null), "Check element 17 of sorted \"Double\"... "); cpl_test_zero(null); test_fvalue(-1.11, 0.00001, cpl_table_get_double(table, "Double", 17, &null), "Check element 18 of sorted \"Double\"... "); cpl_test_zero(null); test_svalue("999", cpl_table_get_string(table, "String", 0), "Check element 1 of sorted \"String\"... "); test_svalue("999", cpl_table_get_string(table, "String", 1), "Check element 2 of sorted \"String\"... "); test_ivalue(0, cpl_table_is_valid(table, "String", 2), "Check element 3 of sorted \"String\"... "); test_svalue("999", cpl_table_get_string(table, "String", 3), "Check element 4 of sorted \"String\"... "); test_svalue("baaa", cpl_table_get_string(table, "String", 4), "Check element 5 of sorted \"String\"... "); test_ivalue(0, cpl_table_is_valid(table, "String", 5), "Check element 6 of sorted \"String\"... "); test_svalue("999", cpl_table_get_string(table, "String", 6), "Check element 7 of sorted \"String\"... "); for (i = 7; i < 13; i++) { sprintf(message, "Check element %" CPL_SIZE_FORMAT " of sorted \"String\"... ", i + 1); test_svalue("999", cpl_table_get_string(table, "String", i), message); } test_svalue("aaaa", cpl_table_get_string(table, "String", 13), "Check element 14 of sorted \"String\"... "); test_svalue("daaa", cpl_table_get_string(table, "String", 14), "Check element 15 of sorted \"String\"... "); test_svalue(" sss", cpl_table_get_string(table, "String", 15), "Check element 16 of sorted \"String\"... "); test_svalue("acde", cpl_table_get_string(table, "String", 16), "Check element 17 of sorted \"String\"... "); test_svalue("extra", cpl_table_get_string(table, "String", 17), "Check element 18 of sorted \"String\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 0), "Check element 1 of sorted \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 1), "Check element 2 of sorted \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 2), "Check element 3 of sorted \"Float\"... "); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "Float", 3, &null), "Check element 4 of sorted \"Float\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Float", 4), "Check element 5 of sorted \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 5), "Check element 6 of sorted \"Float\"... "); test_ivalue(0, cpl_table_is_valid(table, "Float", 6), "Check element 7 of sorted \"Float\"... "); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "Float", 7, &null), "Check element 8 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "Float", 8, &null), "Check element 9 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "Float", 9, &null), "Check element 10 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(-999880.0, 0.00001, cpl_table_get_float(table, "Float", 10, &null), "Check element 11 of sorted \"Float\"... "); cpl_test_zero(null); test_ivalue(0, cpl_table_is_valid(table, "Float", 11), "Check element 12 of sorted \"Float\"... "); test_fvalue(0.0, 0.00001, cpl_table_get_float(table, "Float", 12, &null), "Check element 13 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(-28.44, 0.00001, cpl_table_get_float(table, "Float", 13, &null), "Check element 14 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(-12.22, 0.00001, cpl_table_get_float(table, "Float", 14, &null), "Check element 15 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(-12.33, 0.00001, cpl_table_get_float(table, "Float", 15, &null), "Check element 16 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(6.66, 0.00001, cpl_table_get_float(table, "Float", 16, &null), "Check element 17 of sorted \"Float\"... "); cpl_test_zero(null); test_fvalue(-1110.0, 0.00001, cpl_table_get_float(table, "Float", 17, &null), "Check element 18 of sorted \"Float\"... "); cpl_test_zero(null); } cpl-6.4.1/cplcore/tests/cpl_image_filter-test.c0000644000460300003120000004754212063603230016420 00000000000000/* $Id: cpl_image_filter-test.c,v 1.53 2012-12-17 11:48:40 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-12-17 11:48:40 $ * $Revision: 1.53 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "cpl_image_filter.h" #include "cpl_image_gen.h" #include "cpl_image_io.h" #include "cpl_tools.h" #include "cpl_test.h" #include "cpl_image_bpm.h" #include "cpl_memory.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define CPL_IMAGE_FILTER_LINEAR 0 #define CPL_IMAGE_FILTER_MORPHO 1 #define CPL_IMAGE_FILTER_SIZE 2 #ifndef IMAGE_SIZE_X #define IMAGE_SIZE_X 64 #endif #ifndef IMAGE_SIZE_Y #define IMAGE_SIZE_Y IMAGE_SIZE_X #endif /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_image_filter_test(int, int, int, int); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ cpl_image_filter_test(8, 8, 0, 0); cpl_image_filter_test(8, 8, 1, 0); cpl_image_filter_test(8, 8, 0, 1); cpl_image_filter_test(8, 8, 1, 1); cpl_image_filter_test(8, 8, 2, 0); cpl_image_filter_test(8, 8, 0, 2); cpl_image_filter_test(8, 8, 2, 2); cpl_image_filter_test(31, 31, 2, 2); cpl_image_filter_test(15, 63, 1, 1); return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @brief Test cpl_image_filter() and cpl_image_filter_mask() @param nx The image X-size @param ny The image Y-size @param hm The kernel X-halfsize @param hn The kernel Y-halfsize @param type The filtering type @return void */ /*----------------------------------------------------------------------------*/ static void cpl_image_filter_test(int nx, int ny, int hm, int hn) { const cpl_filter_mode filter_mode[] = {CPL_FILTER_MEDIAN, CPL_FILTER_STDEV, CPL_FILTER_STDEV_FAST, CPL_FILTER_AVERAGE, CPL_FILTER_AVERAGE_FAST, CPL_FILTER_LINEAR, CPL_FILTER_LINEAR_SCALE}; /* Whether the above filter is used with cpl_image_filter_mask() */ const cpl_boolean filter_mask[] = {CPL_TRUE, CPL_TRUE, CPL_TRUE, CPL_TRUE, CPL_TRUE, CPL_FALSE, CPL_FALSE}; /* Compare with different filter on a kernel also of all ones */ const cpl_filter_mode filter_ones[] = {CPL_FILTER_MEDIAN, CPL_FILTER_STDEV_FAST, CPL_FILTER_STDEV, CPL_FILTER_LINEAR, CPL_FILTER_LINEAR, CPL_FILTER_MORPHO, CPL_FILTER_MORPHO_SCALE}; /* Whether the above filter is used with cpl_image_filter_mask() */ const cpl_boolean filter_mask1[] = {CPL_TRUE, CPL_TRUE, CPL_TRUE, CPL_FALSE, CPL_FALSE, CPL_FALSE, CPL_FALSE}; const cpl_type pixel_type[] = {CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE}; const int m = 1 + 2 * hm; const int n = 1 + 2 * hn; const double xmin = -100.0; const double xmax = 200.0; cpl_mask * window1 = cpl_mask_new(m, n); cpl_mask * window2 = cpl_mask_new(m+2, n+2); cpl_mask * shift = cpl_mask_new(m, n); cpl_matrix * xwindow1 = cpl_matrix_new(n, m); cpl_matrix * xwindow2 = cpl_matrix_new(n+2, m+2); cpl_matrix * xshift = cpl_matrix_new(n, m); unsigned itype1; int i, j; cpl_test_eq(sizeof(filter_mode)/sizeof(filter_mode[0]), sizeof(filter_mask)/sizeof(filter_mask[0])); cpl_test_eq(sizeof(filter_mask)/sizeof(filter_mask[0]), sizeof(filter_mask1)/sizeof(filter_mask1[0])); cpl_test_eq(sizeof(filter_ones)/sizeof(filter_ones[0]), sizeof(filter_mask1)/sizeof(filter_mask1[0])); cpl_test_zero(cpl_mask_not(window1)); cpl_test_zero(cpl_matrix_fill(xwindow1, 1.0)); for (j = 2; j <= n+1; j++) { for (i = 2; i <= m+1; i++) { cpl_mask_set(window2, i, j, CPL_BINARY_1); cpl_matrix_set(xwindow2, j-1, i-1, 1.0); } } cpl_test_eq(cpl_mask_count(window1), m*n); cpl_test_eq(cpl_mask_count(window2), m*n); for (itype1 = 0; itype1 < sizeof(pixel_type)/sizeof(pixel_type[0]); itype1++) { unsigned itype2; for (itype2 = 0; itype2 < sizeof(pixel_type)/sizeof(pixel_type[0]); itype2++) { unsigned ifilt; for (ifilt = 0; ifilt < sizeof(filter_mode)/sizeof(filter_mode[0]); ifilt++) { const cpl_error_code exp_err = m == 1 && n == 1 && (filter_mode[ifilt] == CPL_FILTER_STDEV || filter_mode[ifilt] == CPL_FILTER_STDEV_FAST) ? CPL_ERROR_DATA_NOT_FOUND : CPL_ERROR_NONE; if (filter_mode[ifilt] != CPL_FILTER_MEDIAN || itype1 == itype2) { /* FIXME: Need to test with bad pixels as well */ cpl_image * testimg = cpl_image_new(nx, ny, pixel_type[itype1]); cpl_image * filtim1 = cpl_image_new(nx, ny, pixel_type[itype2]); cpl_image * filtim2 = cpl_image_new(nx, ny, pixel_type[itype2]); cpl_error_code error; double tol = 0.0; cpl_msg_info(cpl_func, "%u <=> %u - filtering %u X %u %s " "to %s with %u X %u", filter_mode[ifilt], filter_ones[ifilt], nx, ny, cpl_type_get_name(pixel_type[itype1]), cpl_type_get_name(pixel_type[itype2]), m, n); cpl_test_zero(cpl_image_fill_noise_uniform(testimg, xmin, xmax)); error = filter_mask[ifilt] ? cpl_image_filter_mask(filtim1, testimg, window1, filter_mode[ifilt], CPL_BORDER_FILTER) : cpl_image_filter(filtim1, testimg, xwindow1, filter_mode[ifilt], CPL_BORDER_FILTER); cpl_test_eq_error(error, exp_err); error = filter_mask[ifilt] ? cpl_image_filter_mask(filtim2, testimg, window2, filter_mode[ifilt], CPL_BORDER_FILTER) : cpl_image_filter(filtim2, testimg, xwindow2, filter_mode[ifilt], CPL_BORDER_FILTER); cpl_test_eq_error(error, exp_err); if (exp_err == CPL_ERROR_NONE) { if (filter_mode[ifilt] == CPL_FILTER_MEDIAN) { /* FIXME: Cannot trust border (with even numbers) */ for (j = 1; j <= ny; j++) { for (i = 1; i <= nx; i++) { if (j < n || ny - n < j || i < m || nx - m < i) { cpl_image_reject(filtim1, i, j); cpl_image_reject(filtim2, i, j); } } } } else { /* filt1 and filt2 must be identical, because the mask of filt2 equals filt1, except that is has a halo of zeros */ if (filter_mode[ifilt] == CPL_FILTER_AVERAGE_FAST || filter_mode[ifilt] == CPL_FILTER_STDEV_FAST) { /* In this case filtim1 is actually done with CPL_FILTER_AVERAGE */ tol = 10.0 * (xmax - xmin) * ((pixel_type[itype1] == CPL_TYPE_FLOAT || pixel_type[itype2] == CPL_TYPE_FLOAT) ? FLT_EPSILON : DBL_EPSILON); } else if (filter_mode[ifilt] == CPL_FILTER_STDEV && pixel_type[itype2] == CPL_TYPE_DOUBLE && m*n > 1 && nx > m && ny > n) { /* Verify a non-border value */ int is_bad; const double stdev = cpl_image_get_stdev_window(testimg, nx-m+1, ny-n+1, nx, ny); const double filtered = cpl_image_get(filtim1, nx-hm, ny-hn, &is_bad); if (!is_bad) { cpl_test_rel(stdev, filtered, DBL_EPSILON); } } /* The precision loss is higher in this case */ if (filter_mode[ifilt] == CPL_FILTER_STDEV_FAST) tol = 1.0; } cpl_test_image_abs(filtim1, filtim2, tol); if (filter_ones[ifilt] != filter_mode[ifilt]) { /* Result should equal that of a different filter also with all ones */ /* The additions are reordered (sorted), i.e. different round-off */ const cpl_boolean isfloat = pixel_type[itype1] == CPL_TYPE_FLOAT || pixel_type[itype2] == CPL_TYPE_FLOAT; tol = (xmax - xmin) * (isfloat ? FLT_EPSILON : DBL_EPSILON); if (filter_mode[ifilt] == CPL_FILTER_LINEAR_SCALE && !isfloat) tol *= (double)(n*m); else if (filter_mode[ifilt] == CPL_FILTER_LINEAR && filter_ones[ifilt] == CPL_FILTER_MORPHO && !isfloat) tol *= 1.5; if (filter_mode[ifilt] == CPL_FILTER_AVERAGE_FAST) tol *= (1.0 + (double)n)*(1.0 + (double)m); if (filter_mode[ifilt] == CPL_FILTER_STDEV_FAST || filter_ones[ifilt] == CPL_FILTER_STDEV_FAST) { if (pixel_type[itype1] == CPL_TYPE_INT && pixel_type[itype2] == CPL_TYPE_INT) tol = -1.0; /* FIXME: Not supported */ else tol *= 100.0 * (double)(n * m); } error = filter_mask1[ifilt] ? cpl_image_filter_mask(filtim2, testimg, window1, filter_ones[ifilt], CPL_BORDER_FILTER) : cpl_image_filter(filtim2, testimg, xwindow1, filter_ones[ifilt], CPL_BORDER_FILTER); cpl_test_eq_error(error, exp_err); if (tol >= 0.0) cpl_test_image_abs(filtim1, filtim2, tol); } if (itype1 == itype2) { /* If the input and output pixel types are identical a mask with 1 element corresponds to a shift */ /* Try all possible 1-element masks */ for (j = 1; j <= n; j++) { for (i = 1; i <= m; i++) { /* Empty mask */ cpl_test_zero(cpl_mask_xor(shift, shift)); cpl_test_zero(cpl_matrix_fill(xshift, 0.0)); /* Set one element */ cpl_test_zero(cpl_mask_set(shift, i, j, CPL_BINARY_1)); cpl_test_zero(cpl_matrix_set(xshift, n-j, i-1, 1.0)); cpl_test_eq(cpl_mask_count(shift), 1); /* This filter corresponds to a shift of ((hm+1) - i, (hn+1) - j) */ error = filter_mask[ifilt] ? cpl_image_filter_mask(filtim1, testimg, shift, filter_mode[ifilt], CPL_BORDER_FILTER) : cpl_image_filter(filtim1, testimg, xshift, filter_mode[ifilt], CPL_BORDER_FILTER); cpl_test_error(error); if (filter_mode[ifilt] == CPL_FILTER_STDEV || filter_mode[ifilt] == CPL_FILTER_STDEV_FAST) { cpl_test_eq(error, CPL_ERROR_DATA_NOT_FOUND); } else { cpl_test_zero(error); cpl_test_zero(cpl_image_copy(filtim2, testimg, 1, 1)); cpl_test_zero(cpl_image_shift(filtim2, (hm+1)-i, (hn+1)-j)); cpl_test_image_abs(filtim1, filtim2, 0.0); } if (filter_mode[ifilt] == CPL_FILTER_MEDIAN) { error = cpl_image_filter_mask(filtim1, testimg, shift, filter_mode[ifilt], CPL_BORDER_COPY); cpl_test_eq_error(error, CPL_ERROR_NONE); if (i == hm+1 && j == hn+1) { /* FIXME: Verify result also for non-zero shifts */ cpl_test_image_abs(filtim1, testimg, 0.0); } error = cpl_image_filter_mask(filtim1, testimg, shift, filter_mode[ifilt], CPL_BORDER_NOP); cpl_test_eq_error(error, CPL_ERROR_NONE); if (i == hm+1 && j == hn+1) { /* FIXME: Verify result also for non-zero shifts */ cpl_test_image_abs(filtim1, testimg, 0.0); } } } } } } cpl_image_delete(testimg); cpl_image_delete(filtim1); cpl_image_delete(filtim2); } } } } cpl_mask_delete(shift); cpl_mask_delete(window1); cpl_mask_delete(window2); cpl_matrix_delete(xshift); cpl_matrix_delete(xwindow1); cpl_matrix_delete(xwindow2); return; } cpl-6.4.1/cplcore/tests/cpl_vector-test.c0000644000460300003120000011626212137423611015274 00000000000000/* $Id: cpl_vector-test.c,v 1.99 2013-04-29 07:55:53 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-29 07:55:53 $ * $Revision: 1.99 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_io_fits.h" #include "cpl_test.h" #include "cpl_tools.h" #include "cpl_math_const.h" #include "cpl_memory.h" #include #include #include /* Must have three digits, for perl-test to work */ #define VECTOR_SIZE 256 #define VECTOR_CUT 24 /* alphaev56 SIGFPE's with more than 20 */ #define POLY_SIZE 20 /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_vector_save_bench(int); static void cpl_vector_get_stdev_bench(int); static void cpl_vector_corr_bench(int); static void cpl_vector_fit_gaussian_test_one(FILE *); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { double xc; double emax = 0; /* Maximum observed xc-error */ double tmp; cpl_vector * null; cpl_vector * sinus; cpl_vector * cosinus; cpl_vector * tmp_vec; cpl_vector * taylor; cpl_vector * tmp_vec2; cpl_vector * vxc; cpl_vector * vxc1; cpl_vector * vxc3; double * data; const double five[] = {1,2,3,4,5}; const cpl_size vdif = VECTOR_SIZE - VECTOR_CUT > VECTOR_CUT ? VECTOR_CUT : VECTOR_SIZE - VECTOR_CUT; const cpl_size vdif2 = (VECTOR_SIZE - VECTOR_CUT)/2 > VECTOR_CUT/2 ? VECTOR_CUT/2 : (VECTOR_SIZE - VECTOR_CUT)/2; cpl_size delta; cpl_size half_search; cpl_size i,k; cpl_boolean do_bench; FILE * stream; FILE * f_out; char filename[1024]; cpl_boolean did_test_large = CPL_FALSE; cpl_error_code error; const int omp_num_threads = #ifdef _OPENMP /* Measure scaled speed-up */ getenv("OMP_NUM_THREADS") ? atoi(getenv("OMP_NUM_THREADS")) : #endif 1; const int npe = omp_num_threads > 1 ? omp_num_threads : 1; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; do_bench = cpl_msg_get_level() <= CPL_MSG_INFO ? CPL_TRUE : CPL_FALSE; /* Insert tests below */ cpl_test_nonnull( stream ); cpl_vector_fit_gaussian_test_one(stream); null = cpl_vector_new(0); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(null); /* Verify cpl_vector_get_median() with even number of samples (DFS12089) */ /* Test on unsorted vector */ tmp_vec = cpl_vector_new(4); cpl_vector_set(tmp_vec, 0, 0.0); cpl_vector_set(tmp_vec, 1, 1.0); cpl_vector_set(tmp_vec, 2, 3.0); cpl_vector_set(tmp_vec, 3, 2.0); cpl_test_rel(1.5, cpl_vector_get_median(tmp_vec), DBL_EPSILON); cpl_test_rel(1.5, cpl_vector_get_median_const(tmp_vec), DBL_EPSILON); /* Test on sorted vector */ cpl_vector_set(tmp_vec, 0, 0.0); cpl_vector_set(tmp_vec, 1, 1.0); cpl_vector_set(tmp_vec, 2, 2.0); cpl_vector_set(tmp_vec, 3, 3.0); cpl_test_rel(1.5, cpl_vector_get_median(tmp_vec), DBL_EPSILON); cpl_test_rel(1.5, cpl_vector_get_median_const(tmp_vec), DBL_EPSILON); cpl_vector_delete(tmp_vec); /* Create the vector sinus */ cpl_test_nonnull( sinus = cpl_vector_new(VECTOR_SIZE) ); /* Test cpl_vector_get_size() */ cpl_test_eq( cpl_vector_get_size(sinus), VECTOR_SIZE ); /* Fill the vector sinus */ /* Test cpl_vector_get_data(), cpl_vector_set(), cpl_vector_get() */ data = cpl_vector_get_data(sinus); cpl_test_nonnull( data ); for (i=0; i < VECTOR_SIZE; i++) { const double value = sin(i*CPL_MATH_2PI/VECTOR_SIZE); cpl_test_zero( cpl_vector_set(sinus, i, value) ); cpl_test_eq( cpl_vector_get(sinus, i), data[i] ); } /* Create a Taylor-expansion of exp() */ cpl_test_nonnull( taylor = cpl_vector_new(POLY_SIZE) ); i = 0; cpl_vector_set(taylor, i, 1); for (i=1; i 0; k--) { cpl_test_zero( cpl_vector_multiply(tmp_vec2, sinus) ); if (k&1) { cpl_test_zero( cpl_vector_add_scalar(tmp_vec2, cpl_vector_get(taylor, k-1)) ); } else { cpl_test_zero( cpl_vector_subtract_scalar(tmp_vec2, -cpl_vector_get(taylor, k-1)) ); } } /* Verify the result (against cpl_vector_exponential() ) */ cpl_test( tmp_vec = cpl_vector_duplicate(sinus) ); cpl_test_zero( cpl_vector_exponential(tmp_vec, CPL_MATH_E) ); cpl_test_zero( cpl_vector_subtract(tmp_vec2, tmp_vec) ); cpl_test_zero( cpl_vector_divide(tmp_vec2, tmp_vec) ); cpl_test_zero( cpl_vector_divide_scalar(tmp_vec2, DBL_EPSILON) ); cpl_test_leq( fabs(cpl_vector_get_max(tmp_vec2)), 2.60831 ); cpl_test_leq( fabs(cpl_vector_get_min(tmp_vec2)), 2.03626 ); /* Evaluate exp() using cpl_vector_pow() on the Taylor expansion */ cpl_test_zero( cpl_vector_fill(tmp_vec2, cpl_vector_get(taylor, 0)) ); /* POLY_SIZE > 20 on alphaev56: Program received signal SIGFPE, Arithmetic exception. 0x200000a3ff0 in cpl_vector_multiply_scalar () */ for (k=1; k < POLY_SIZE; k++) { cpl_vector * vtmp = cpl_vector_duplicate(sinus); cpl_test_zero( cpl_vector_power(vtmp, k) ); cpl_test_zero( cpl_vector_multiply_scalar(vtmp, cpl_vector_get(taylor, k)) ); cpl_test_zero( cpl_vector_add(tmp_vec2, vtmp) ); cpl_vector_delete(vtmp); } /* Much less precise than Horner ... */ cpl_test_vector_abs(tmp_vec, tmp_vec2, 8.0 * DBL_EPSILON); cpl_vector_delete(taylor); /* Verify cpl_vector_logarithm() ) */ cpl_test_zero( cpl_vector_logarithm(tmp_vec, CPL_MATH_E) ); for (i=0; i < VECTOR_SIZE; i++) { const double value = cpl_vector_get(sinus, i); double lerror = value - cpl_vector_get(tmp_vec, i); if (2*i == VECTOR_SIZE) { /* value should really be zero */ cpl_test_abs( value, 0.0, 0.552 * DBL_EPSILON ); } else { if (value != 0) lerror /= value; cpl_test_abs( lerror, 0.0, 330 * DBL_EPSILON ); } } /* Verify cpl_vector_power() */ cpl_test_zero( cpl_vector_copy(tmp_vec, sinus) ); /* Just be positive */ cpl_test_zero( cpl_vector_exponential(tmp_vec, CPL_MATH_E) ); cpl_test_zero( cpl_vector_copy(tmp_vec2, tmp_vec) ); cpl_test_zero( cpl_vector_sqrt(tmp_vec2) ); cpl_test_zero( cpl_vector_power(tmp_vec, 0.5) ); /* Necessary on AMD 64 (x86_64) Linux */ cpl_test_vector_abs(tmp_vec, tmp_vec2, 1.1 * DBL_EPSILON); cpl_test_zero( cpl_vector_copy(tmp_vec, sinus) ); cpl_test_zero( cpl_vector_exponential(tmp_vec, CPL_MATH_E) ); cpl_test_zero( cpl_vector_multiply(tmp_vec2, tmp_vec) ); cpl_test_zero( cpl_vector_power(tmp_vec, 1.5) ); cpl_test_vector_abs(tmp_vec, tmp_vec2, 8.0 * DBL_EPSILON); cpl_test_zero( cpl_vector_copy(tmp_vec2, tmp_vec) ); cpl_test_zero( cpl_vector_power(tmp_vec, 2) ); cpl_test_zero( cpl_vector_divide(tmp_vec2, tmp_vec) ); cpl_test_zero( cpl_vector_power(tmp_vec, -0.5) ); cpl_test_vector_abs(tmp_vec, tmp_vec2, 8.0 * DBL_EPSILON); cpl_test_zero( cpl_vector_fill(tmp_vec, 1) ); cpl_test_zero( cpl_vector_power(tmp_vec2, 0) ); cpl_test_vector_abs(tmp_vec, tmp_vec2, 0.0); cpl_vector_delete(tmp_vec2); /* Test 0^0 */ cpl_test_nonnull( tmp_vec2 = cpl_vector_new(VECTOR_SIZE) ); for (i = 0; i < VECTOR_SIZE; i++) cpl_test_zero( cpl_vector_set(tmp_vec2, i, 0.0) ); cpl_test_zero( cpl_vector_power(tmp_vec2, 0.0) ); cpl_test_vector_abs(tmp_vec, tmp_vec2, 0.0); cpl_vector_delete(tmp_vec); cpl_vector_delete(tmp_vec2); /* Test cpl_vector_dump() */ cpl_vector_dump(NULL, stream); cpl_vector_dump(sinus, stream); /* Test failures on cpl_vector_read() */ tmp_vec = cpl_vector_read(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null( tmp_vec ); tmp_vec = cpl_vector_read("/dev/null"); cpl_test_error(CPL_ERROR_BAD_FILE_FORMAT); cpl_test_null( tmp_vec ); /* Test correct case on cpl_vector_read() */ sprintf(filename, "cpl_vector_dump.txt"); cpl_test_nonnull( filename ); cpl_test_nonnull( f_out = fopen(filename, "w") ); cpl_vector_dump(sinus, f_out); fclose(f_out); tmp_vec = cpl_vector_read("cpl_vector_dump.txt"); cpl_test_zero( remove("cpl_vector_dump.txt") ); cpl_test_nonnull( tmp_vec ); cpl_test_eq( cpl_vector_get_size(tmp_vec), cpl_vector_get_size(sinus) ); /* Test cpl_vector_save() / cpl_vector_load() */ error = cpl_vector_save(tmp_vec, "cpl_vector_save.fits", CPL_TYPE_DOUBLE, NULL, CPL_IO_CREATE | CPL_IO_EXTEND); cpl_test_eq_error( error, CPL_ERROR_ILLEGAL_INPUT ); error = cpl_vector_save(tmp_vec, "cpl_vector_save.fits", CPL_TYPE_DOUBLE, NULL, CPL_IO_APPEND); cpl_test_eq_error( error, CPL_ERROR_ILLEGAL_INPUT ); error = cpl_vector_save(tmp_vec, "cpl_vector_save.fits", CPL_TYPE_DOUBLE, NULL, CPL_IO_CREATE | CPL_IO_APPEND); cpl_test_eq_error( error, CPL_ERROR_ILLEGAL_INPUT ); error = cpl_vector_save(tmp_vec, "cpl_vector_save.fits", CPL_TYPE_DOUBLE, NULL, CPL_IO_CREATE); cpl_test_eq_error( error, CPL_ERROR_NONE ); cpl_test_fits("cpl_vector_save.fits"); tmp_vec2 = cpl_vector_load("cpl_vector_save.fits", 0); cpl_test_error( CPL_ERROR_NONE ); cpl_test_zero( remove("cpl_vector_save.fits") ); cpl_test_nonnull( tmp_vec2 ); /* Verify that the save/load did not change the vector */ cpl_test_vector_abs(tmp_vec, tmp_vec2, 0.0); cpl_vector_delete(tmp_vec2); /* Repeat test cpl_vector_save() / cpl_vector_load() on APPEND mode*/ error = cpl_vector_save(tmp_vec, "cpl_vector_save.fits", CPL_TYPE_DOUBLE, NULL, CPL_IO_CREATE); cpl_test_eq_error( error, CPL_ERROR_NONE ); cpl_test_fits("cpl_vector_save.fits"); error = cpl_vector_save(tmp_vec, "cpl_vector_save.fits", CPL_TYPE_DOUBLE, NULL, CPL_IO_EXTEND); cpl_test_eq_error( error, CPL_ERROR_NONE ); cpl_test_fits("cpl_vector_save.fits"); /* Verify that the save/load did not change the vector on 0. ext. */ tmp_vec2 = cpl_vector_load("cpl_vector_save.fits", 0); cpl_test_nonnull( tmp_vec2 ); cpl_test_vector_abs(tmp_vec, tmp_vec2, 0.0); cpl_vector_delete(tmp_vec2); /* Verify that the save/load did not change the vector on 1. ext. */ tmp_vec2 = cpl_vector_load("cpl_vector_save.fits", 1); cpl_test_nonnull( tmp_vec2 ); cpl_test_vector_abs(tmp_vec, tmp_vec2, 0.0); cpl_vector_delete(tmp_vec2); if (!cpl_io_fits_is_enabled()) { /* Decrease the number of elements by one, thus verifying that an external application may modify the file */ if (system("perl -pi -e 'BEGIN{sleep(1)};/NAXIS1/ and s/" CPL_STRINGIFY(VECTOR_SIZE) "/sprintf(\"%d\"," CPL_STRINGIFY(VECTOR_SIZE-1) ")/e' cpl_vector_save.fits") == 0) { tmp_vec2 = cpl_vector_load("cpl_vector_save.fits", 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull( tmp_vec2 ); cpl_test_eq(cpl_vector_get_size(tmp_vec2), VECTOR_SIZE-1); cpl_vector_delete(tmp_vec2); } } if (sizeof(cpl_size) == 4) { #if !defined CPL_SIZE_BITS || CPL_SIZE_BITS != 32 if (!cpl_io_fits_is_enabled()) { /* Cannot load a vector longer than 2**31 - 1 */ /* Increase the number of elements to more than 2**31 */ if (system("perl -pi -e '/NAXIS1/ and s/ " CPL_STRINGIFY(VECTOR_SIZE) "/2200000000/' cpl_vector_save.fits") == 0) { tmp_vec2 = cpl_vector_load("cpl_vector_save.fits", 0); cpl_test_error(CPL_ERROR_UNSUPPORTED_MODE); cpl_test_null( tmp_vec2 ); if (tmp_vec2 != NULL) { /* The original size is VECTOR_SIZE */ cpl_test_noneq(cpl_vector_get_size(tmp_vec2), VECTOR_SIZE); cpl_vector_delete(tmp_vec2); cpl_test_assert(0); } did_test_large = CPL_TRUE; } } #endif #ifdef CPL_TEST_LARGE } else if (sizeof(cpl_size) == 8) { cpl_vector * long_vec = cpl_vector_new(2200000000L); error = cpl_vector_save(long_vec, "cpl_vector_save.fits", CPL_TYPE_DOUBLE, NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits("cpl_vector_save.fits"); cpl_vector_delete(long_vec); long_vec = cpl_vector_load("cpl_vector_save.fits", 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(long_vec); cpl_vector_delete(long_vec); did_test_large = CPL_TRUE; #endif } if (!did_test_large) { cpl_msg_info(cpl_func, "I/O-testing of large vectors inactive"); } cpl_test_zero( remove("cpl_vector_save.fits") ); /* Loss of precision in cpl_vector_dump() */ cpl_test_vector_abs(tmp_vec, sinus, 10.0 * FLT_EPSILON); cpl_vector_subtract(tmp_vec, sinus); /* Same loss for positive as for negative numbers */ cpl_test_abs( cpl_vector_get_max(tmp_vec)+cpl_vector_get_min(tmp_vec), 0.0, 2.5 * DBL_EPSILON); cpl_vector_delete(tmp_vec); /* Test cpl_vector_duplicate */ tmp_vec = cpl_vector_duplicate(sinus); cpl_test_vector_abs(tmp_vec, sinus, 0.0); /* Test fill function */ cpl_test_eq_error( cpl_vector_fill(tmp_vec, 1.0), CPL_ERROR_NONE ); cpl_test_abs( cpl_vector_get_mean(tmp_vec), 1.0, DBL_EPSILON ); cpl_test_abs( cpl_vector_get_sum(tmp_vec), (double)(VECTOR_SIZE), DBL_EPSILON * sqrt((double)(VECTOR_SIZE))); (void)cpl_vector_get_sum(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); /* Test extract function */ tmp_vec2 = cpl_vector_extract(tmp_vec, 0, VECTOR_SIZE/2, 1); cpl_test_nonnull( tmp_vec2 ); cpl_vector_delete(tmp_vec2); null = cpl_vector_extract(NULL, 0, 1, 1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null( null ); null = cpl_vector_extract(tmp_vec, 2, 1, 1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null( null ); null = cpl_vector_extract(tmp_vec, 1, 2, 2); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null( null ); null = cpl_vector_extract(tmp_vec, -1, 2, 1); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_null( null ); null = cpl_vector_extract(tmp_vec, 0, VECTOR_SIZE + 2, 1); cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_test_null( null ); vxc = cpl_vector_wrap(5, (double*)five); vxc1 = cpl_vector_extract(vxc, 1, 4, 1); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq_ptr(five, cpl_vector_unwrap(vxc)); vxc = cpl_vector_wrap(4, (double*)five + 1); cpl_test_vector_abs(vxc, vxc1, 0.0); (void)cpl_vector_unwrap(vxc); cpl_vector_delete(vxc1); /* Create the vector cosinus */ cosinus = cpl_vector_new(VECTOR_SIZE); cpl_test_eq( cpl_vector_get_size(sinus), VECTOR_SIZE ); /* Fill the vector cosinus */ data = cpl_vector_get_data(cosinus); cpl_test_nonnull( data ); for (i=0; i emax) emax = fabs(1-xc); if (VECTOR_SIZE % 2 == 0) { /* Sinus and cosinus have zero cross-correlation with zero shift */ cpl_test_zero( cpl_vector_correlate(vxc1, sinus, cosinus) ); xc = cpl_vector_get(vxc1, 0); cpl_test_leq( fabs(xc), 2.82*DBL_EPSILON ); if (fabs(xc) > emax) emax = fabs(xc); } /* cosinus and -cosinus have cross-correlation -1 with zero shift */ tmp_vec = cpl_vector_duplicate(cosinus); cpl_test_vector_abs(tmp_vec, cosinus, 0.0); cpl_test_zero( cpl_vector_divide_scalar(tmp_vec, -1) ); cpl_test_zero( cpl_vector_correlate(vxc1, tmp_vec, cosinus) ); xc = cpl_vector_get(vxc1, 0); cpl_vector_delete(tmp_vec); cpl_test_abs( xc, -1.0, 5.0 * DBL_EPSILON ); if (fabs(1+xc) > emax) emax = fabs(1+xc); vxc = cpl_vector_new( 1 ); if (VECTOR_SIZE % 2 == 0) { /* Cross-correlation between sinus and cosinus grows to maximum at shift of pi/2 */ for (i=0; i xcp ); cpl_test_eq( abs(delta-(i+1)), i+1 ); } cpl_test_abs( xc, 1.0, 260*DBL_EPSILON); half_search = VECTOR_SIZE/3; cpl_test_zero( cpl_vector_set_size(vxc, 2*half_search + 1) ); delta = cpl_vector_correlate(vxc, sinus, cosinus); xc = cpl_vector_get(vxc, delta ); cpl_test_eq( abs(delta-VECTOR_SIZE/3), VECTOR_SIZE/4 ); if (fabs(1-xc) > emax) emax = fabs(1-xc); } cpl_vector_delete(sinus); /* Vectors of almost the same length - no commutativity */ /* Create the vector sinus */ cpl_test_nonnull( sinus = cpl_vector_new(VECTOR_SIZE-VECTOR_CUT) ); /* Fill the vector sinus */ data = cpl_vector_get_data(sinus); cpl_test_nonnull( data ); for (i=0; i emax) emax = fabs(1-xc); /* Compare with increasing shift and increasing drop of elements - only up to the length-difference */ for (k = 1; k < vdif; k++) { for (i=0; i emax) emax = fabs(1-xc); } /* Continue - maximum xc found with drop */ for (; k < vdif; k++) { half_search = k-VECTOR_CUT/2; cpl_test_zero( cpl_vector_set_size(vxc, 2*half_search + 1) ); for (i=0; i emax) emax = fabs(1-xc); } /* Compare with increasing negative shift and increasing drop of elements - only up to half the length-difference */ half_search = VECTOR_CUT; cpl_test_zero( cpl_vector_set_size(vxc, 2*half_search + 1) ); xc = 1; for (k = 1; k < vdif2; k++) { const double xcp = xc; for (i=0; i emax) emax = fabs(1-xc); /* Verify commutativity */ cpl_test_eq( delta+half_search, cpl_vector_correlate(vxc, cosinus, sinus) ); cpl_test_eq( xc, cpl_vector_get(vxc, delta+half_search) ); data = cpl_vector_get_data(sinus); cpl_test_nonnull( data ); half_search = VECTOR_SIZE/2; cpl_test_zero( cpl_vector_set_size(vxc, 2*half_search + 1) ); /* Compare with increasing shift and increasing drop of elements - delta tests will not hold for large shifts */ xc = 1; for (k = 1; k < VECTOR_SIZE/50; k+=7) { const double xcp = xc; double xcn; for (i=0; i emax) emax = fabs(1-xc); } cpl_msg_info("","Largest cross-correlation rounding error [DBL_EPSILON]: " "%g", emax/DBL_EPSILON); if (do_bench) { cpl_vector_corr_bench(4 * npe); cpl_vector_get_stdev_bench(64 * npe); /* cpl_msg_set_component_on(); */ cpl_vector_save_bench(200); /* cpl_msg_set_component_off(); */ } else { cpl_vector_corr_bench(1); cpl_vector_get_stdev_bench(1); cpl_vector_save_bench(1); } /* Free and return */ cpl_vector_delete(cosinus); cpl_vector_delete(sinus); cpl_vector_delete(vxc); cpl_vector_delete(vxc1); cpl_vector_delete(vxc3); if (stream != stdout) cpl_test_zero( fclose(stream) ); /* End of tests */ return cpl_test_end(0); } /**@}*/ /*----------------------------------------------------------------------------*/ /** @brief Benchmark the CPL function @param n The number of repeats @return void */ /*----------------------------------------------------------------------------*/ static void cpl_vector_corr_bench(int n) { double secs; const cpl_size nsize = 10*VECTOR_SIZE*VECTOR_SIZE; cpl_vector * cosinus = cpl_vector_new(nsize); cpl_vector * vxc = cpl_vector_new(5*VECTOR_SIZE | 1); double * data = cpl_vector_get_data(cosinus); cpl_flops flops0; const size_t bytes = (size_t)n * cpl_test_get_bytes_vector(cosinus); int i; /* Fill the vector cosinus */ for (i=0; i < nsize; i++) data[i] = cos(i*CPL_MATH_2PI/nsize); flops0 = cpl_tools_get_flops(); secs = cpl_test_get_walltime(); #ifdef _OPENMP #pragma omp parallel for private(i) #endif for (i = 0; i < n; i++) { cpl_vector_correlate(vxc, cosinus, cosinus); } secs = cpl_test_get_walltime() - secs; flops0 = cpl_tools_get_flops() - flops0; if (secs > 0.0) { cpl_msg_info("","Speed during %d correlations of size %" CPL_SIZE_FORMAT " in %g secs [Mflop/s]: %g (%g)", n, nsize, secs, flops0/secs/1e6, (double)flops0); cpl_msg_info(cpl_func,"Processing rate [MB/s]: %g", 1e-6 * (double)bytes / secs); } cpl_vector_delete(cosinus); cpl_vector_delete(vxc); } /*----------------------------------------------------------------------------*/ /** @brief Benchmark the CPL function @param n The number of repeats @return void */ /*----------------------------------------------------------------------------*/ static void cpl_vector_get_stdev_bench(int n) { double secs; const cpl_size nsize = 10 * VECTOR_SIZE*VECTOR_SIZE; cpl_vector * cosinus = cpl_vector_new(nsize); double * data = cpl_vector_get_data(cosinus); cpl_flops flops0; const size_t bytes = (size_t)n * cpl_test_get_bytes_vector(cosinus); int i; /* Fill the vector cosinus */ for (i=0; i < nsize; i++) data[i] = cos(i*CPL_MATH_2PI/nsize); flops0 = cpl_tools_get_flops(); secs = cpl_test_get_walltime(); #ifdef _OPENMP #pragma omp parallel for private(i) #endif for (i = 0; i < n; i++) { cpl_test_abs( cpl_vector_get_stdev(cosinus), sqrt(nsize*0.5/(nsize - 1)), 0.36 * DBL_EPSILON * sqrt(nsize)); } secs = cpl_test_get_walltime() - secs; flops0 = cpl_tools_get_flops() - flops0; if (secs > 0.0) { cpl_msg_info(cpl_func,"Speed during %d standard devs of size %" CPL_SIZE_FORMAT "in %g secs [Mflop/s]: %g (%g)", n, nsize, secs, flops0/secs/1e6, (double)flops0); cpl_msg_info(cpl_func,"Processing rate [MB/s]: %g", 1e-6 * (double)bytes / secs); } cpl_vector_delete(cosinus); } /*----------------------------------------------------------------------------*/ /** @brief Benchmark the CPL function @param n The number of repeats @return void */ /*----------------------------------------------------------------------------*/ static void cpl_vector_save_bench(int n) { const int nprops = 100; int i; double secs; const char * filename = "cpl_vector_save_bench.fits"; const double vval[] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}; const int nvals = (int)(sizeof(vval)/sizeof(double)); const cpl_vector * vec = cpl_vector_wrap(nvals, (double*)vval); cpl_propertylist * qclist = cpl_propertylist_new(); const size_t bytes = (size_t)n * cpl_test_get_bytes_vector(vec); char key[81]; cpl_msg_info(cpl_func, "Benchmarking with %d %d-length vectors", n, nvals); for (i = 0; i < nprops; i++) { const int nlen = snprintf(key, 81, "ESO QC CARD%04d", i); cpl_test( nlen > 0 && nlen < 81); cpl_test_zero( cpl_propertylist_append_int(qclist, key, i)); } cpl_test_eq( cpl_propertylist_get_size(qclist), nprops); secs = cpl_test_get_cputime(); for (i = 0; i < n; i++) { cpl_test_zero( cpl_vector_save(vec, filename, CPL_TYPE_DOUBLE, qclist, CPL_IO_CREATE)); } secs = cpl_test_get_cputime() - secs; cpl_msg_info(cpl_func,"Time spent saving %d %d-sized vectors [s]: %g", n, nvals, secs); if (secs > 0.0) { cpl_msg_info(cpl_func,"Processing rate [MB/s]: %g", 1e-6 * (double)bytes / secs); } cpl_test_fits(filename); cpl_test_zero( remove(filename) ); cpl_vector_unwrap((cpl_vector*)vec); cpl_propertylist_delete(qclist); return; } /*----------------------------------------------------------------------------*/ /** @brief Reproduce DFS06126, original version by H. Lorch @param stream Output dump stream @return void */ /*----------------------------------------------------------------------------*/ static void cpl_vector_fit_gaussian_test_one(FILE * stream) { const int N = 50; cpl_vector *yval = cpl_vector_new(N); cpl_vector *xval = cpl_vector_new(N); cpl_vector *ysig = cpl_vector_new(N); cpl_matrix *cov = NULL; const double in_sigma = 10.0, in_centre = 25.0, peak = 769.52; int n; double pos = 0.0, centre, offset, sigma, area, mse, chisq; cpl_error_code error; for (n = 0; n < N; n++) { const double d = (double)pos - in_centre; error = cpl_vector_set(xval, n, pos); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_set(yval, n, peak*exp(-d*d/(2.0*in_sigma*in_sigma))); cpl_test_eq_error(error, CPL_ERROR_NONE); /* the following line seems to make it fail. * normally, it should have no influence at all since all sigmas * are the same. strangely, using 1.0/sqrt(N-1) also fails, * but modifying this value slightly (e.g. by adding 1e-6) * lets the fitting succeed. is there a meaning in the failure * for 1.0/sqrt(integer)? */ error = cpl_vector_set(ysig, n, 1.0/sqrt(N)); cpl_test_eq_error(error, CPL_ERROR_NONE); pos += 1.0; /* create one missing value, * this has no special meaning, just replicates the generation of * the test data with which I found the problem */ if (n == 34) pos += 1.0; } if (cpl_msg_get_level() <= CPL_MSG_INFO) { cpl_vector_dump(xval, stream); cpl_vector_dump(yval, stream); cpl_vector_dump(ysig, stream); } error = cpl_vector_fit_gaussian(xval, NULL, yval, ysig, CPL_FIT_ALL, ¢re, &sigma, &area, &offset, &mse, &chisq, &cov); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_nonnull(cov); cpl_vector_delete(yval); cpl_vector_delete(ysig); cpl_vector_delete(xval); cpl_matrix_delete(cov); } cpl-6.4.1/cplcore/tests/Makefile.am0000644000460300003120000001201412127227645014045 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO Common Pipeline Library ## Copyright (C) 2001-2008 European Southern Observatory ## 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 2 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 02111-1307 USA AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ if MAINTAINER_MODE MAINTAINERCLEANFILES = $(srcdir)/Makefile.in endif AM_CPPFLAGS = $(CPLCORE_INCLUDES) $(CX_INCLUDES) $(CFITSIO_INCLUDES) \ $(CPL_CFLAGS) AM_LDFLAGS = $(CFITSIO_LDFLAGS) LDADD = $(LIBCPLCORE) $(LIBCFITSIO) EXTRA_DIST = cpl_filter_body.h check_PROGRAMS = cpl_type-test \ cpl_tools-test \ cpl_image_io-test \ cpl_image_basic-test \ cpl_image_iqe-test \ cpl_image_bpm-test \ cpl_image_resample-test \ cpl_filter-test \ cpl_fits-test \ cpl_stats-test \ cpl_math-test \ cpl_image_filter-test \ cpl_image_gen-test \ cpl_imagelist_io-test \ cpl_imagelist_basic-test \ cpl_io_fits-test \ cpl_mask-test \ cpl_table-test \ cpl_test-test \ cpl_test_init-test \ cpl_matrix-test \ cpl_msg-test \ cpl_memory-test \ cpl_plot-test \ cpl_polynomial-test \ cpl_error-test \ cpl_errorstate-test \ cpl_vector-test \ cpl_bivector-test \ cpl_property-test \ cpl_propertylist-test cpl_image_io_test_SOURCES = cpl_image_io-test.c cpl_image_basic_test_SOURCES = cpl_image_basic-test.c cpl_image_iqe_test_SOURCES = cpl_image_iqe-test.c cpl_image_bpm_test_SOURCES = cpl_image_bpm-test.c cpl_image_resample_test_SOURCES = cpl_image_resample-test.c cpl_filter_test_SOURCES = cpl_filter-test.c cpl_fits_test_SOURCES = cpl_fits-test.c cpl_stats_test_SOURCES = cpl_stats-test.c cpl_math_test_SOURCES = cpl_math-test.c cpl_image_gen_test_SOURCES = cpl_image_gen-test.c cpl_image_filter_test_SOURCES = cpl_image_filter-test.c cpl_imagelist_io_test_SOURCES = cpl_imagelist_io-test.c cpl_imagelist_basic_test_SOURCES = cpl_imagelist_basic-test.c cpl_io_fits_test_SOURCES = cpl_io_fits-test.c cpl_mask_test_SOURCES = cpl_mask-test.c cpl_table_test_SOURCES = cpl_table-test.c cpl_test_test_SOURCES = cpl_test-test.c cpl_test_init_test_SOURCES = cpl_test_init-test.c cpl_type_test_SOURCES = cpl_type-test.c cpl_tools_test_SOURCES = cpl_tools-test.c cpl_matrix_test_SOURCES = cpl_matrix-test.c cpl_msg_test_SOURCES = cpl_msg-test.c cpl_memory_test_SOURCES = cpl_memory-test.c cpl_plot_test_SOURCES = cpl_plot-test.c cpl_polynomial_test_SOURCES = cpl_polynomial-test.c cpl_error_test_SOURCES = cpl_error-test.c cpl_errorstate_test_SOURCES = cpl_errorstate-test.c cpl_vector_test_SOURCES = cpl_vector-test.c cpl_bivector_test_SOURCES = cpl_bivector-test.c cpl_property_test_SOURCES = cpl_property-test.c cpl_propertylist_test_SOURCES = cpl_propertylist-test.c # Be sure to reexport important environment variables. TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" TESTS = cpl_image_io-test \ cpl_image_basic-test \ cpl_image_iqe-test \ cpl_image_bpm-test \ cpl_image_resample-test \ cpl_filter-test \ cpl_fits-test \ cpl_stats-test \ cpl_math-test \ cpl_image_gen-test \ cpl_image_filter-test \ cpl_imagelist_io-test \ cpl_imagelist_basic-test \ cpl_io_fits-test \ cpl_mask-test \ cpl_plot-test \ cpl_polynomial-test \ cpl_error-test \ cpl_errorstate-test \ cpl_table-test \ cpl_test-test \ cpl_test_init-test \ cpl_type-test \ cpl_tools-test \ cpl_matrix-test \ cpl_msg-test \ cpl_memory-test \ cpl_vector-test \ cpl_bivector-test \ cpl_property-test \ cpl_propertylist-test # We need to remove any files that the above tests created. clean-local: $(RM) *.fits *.tfits *.log if USE_PURIFY include $(top_builddir)/Makefile.purify endif cpl-6.4.1/cplcore/tests/cpl_io_fits-test.c0000644000460300003120000003427111750212110015413 00000000000000 /* $Id: cpl_io_fits-test.c,v 1.14 2012-05-02 11:02:32 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-05-02 11:02:32 $ * $Revision: 1.14 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_io_fits.h" #include "cpl_test.h" #include "cpl_fits.h" #include "cpl_memory.h" #include #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef NEXT #define NEXT 17 #endif #ifndef NFILE #define NFILE 4 #endif #define BASENAME "cpl_io_fits_test" /*---------------------------------------------------------------------------- Function prototypes ----------------------------------------------------------------------------*/ static void cpl_io_fits_test_many(int); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_boolean do_bench; int next = NEXT; int j; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); do_bench = cpl_msg_get_level() <= CPL_MSG_INFO ? CPL_TRUE : CPL_FALSE; if (do_bench) next *= next; /* Insert tests below */ cpl_io_fits_test_many(1 + CPL_IO_FITS_MAX_OPEN); #ifdef _OPENMP #pragma omp parallel for private(j) #endif for (j = 0; j < NFILE; j++) { char * filename = cpl_sprintf(BASENAME "-%d.fits", j + 1); int base = j * next * 10; /* Assume at most 10 load-loops */ int i; cpl_msg_info(cpl_func, "Testing with file %s", filename); /* Creation + append only */ #ifdef _OPENMP /* Multi-threaded writing is limited to one thread writing at a time */ #pragma omp parallel for ordered private(i) #endif for (i = 0; i <= next; i++) { cpl_error_code myerror; cpl_image * myimage = cpl_image_new(1, 1, CPL_TYPE_INT); cpl_propertylist * plist = cpl_propertylist_new(); myerror = cpl_propertylist_append_int(plist, "MYINT", i + base); cpl_test_eq_error(myerror, CPL_ERROR_NONE); myerror = cpl_image_add_scalar(myimage, i + base); cpl_test_eq_error(myerror, CPL_ERROR_NONE); #ifdef _OPENMP #pragma omp ordered #endif { myerror = cpl_image_save(myimage, filename, CPL_TYPE_INT, plist, i ? CPL_IO_EXTEND : CPL_IO_CREATE); } cpl_test_eq_error(myerror, CPL_ERROR_NONE); cpl_image_delete(myimage); cpl_propertylist_delete(plist); } cpl_test_eq(cpl_fits_count_extensions(filename), next); /* Reading only */ #ifdef _OPENMP #pragma omp parallel for private(i) #endif for (i = 0; i <= next; i++) { int is_bad; cpl_image * myimage = cpl_image_load(filename, CPL_TYPE_INT, 0, i); cpl_propertylist * plist; cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(myimage); cpl_test_eq(cpl_image_get(myimage, 1, 1, &is_bad), i + base); cpl_test_zero(is_bad); cpl_image_delete(myimage); /* Make sure to jump around between the extensions */ cpl_test_eq(cpl_fits_count_extensions(filename), next); plist = cpl_propertylist_load(filename, i); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(plist); cpl_test_eq(cpl_propertylist_get_int(plist, "MYINT"), i + base); cpl_propertylist_delete(plist); } base += next; /* Alternating creation + append only */ #ifdef _OPENMP /* Multi-threaded writing is limited to one thread writing at a time */ #pragma omp parallel for ordered private(i) #endif for (i = 0; i <= next; i++) { cpl_error_code myerror; cpl_image * myimage = cpl_image_new(1, 1, CPL_TYPE_INT); cpl_propertylist * plist = cpl_propertylist_new(); myerror = cpl_propertylist_append_int(plist, "MYINT", i + base); cpl_test_eq_error(myerror, CPL_ERROR_NONE); myerror = cpl_image_add_scalar(myimage, i + base); cpl_test_eq_error(myerror, CPL_ERROR_NONE); #ifdef _OPENMP #pragma omp ordered #endif { myerror = cpl_image_save(myimage, filename, CPL_TYPE_INT, plist, (i & 1) ? CPL_IO_EXTEND : CPL_IO_CREATE); } cpl_test_eq_error(myerror, CPL_ERROR_NONE); cpl_image_delete(myimage); cpl_propertylist_delete(plist); } cpl_test_eq(cpl_fits_count_extensions(filename), next & 1); /* Reading only */ #ifdef _OPENMP #pragma omp parallel for private(i) #endif for (i = 0; i <= (next & 1); i++) { int is_bad; cpl_image * myimage = cpl_image_load(filename, CPL_TYPE_INT, 0, i); cpl_propertylist * plist; cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(myimage); cpl_test_eq(cpl_image_get(myimage, 1, 1, &is_bad), i + (next & ~1) + base); cpl_test_zero(is_bad); cpl_image_delete(myimage); plist = cpl_propertylist_load(filename, i); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(plist); cpl_test_eq(cpl_propertylist_get_int(plist, "MYINT"), i + (next & ~1) + base); cpl_propertylist_delete(plist); } base += next; /* Creation + append and reading */ #ifdef _OPENMP /* Multi-threaded writing is limited to one thread writing at a time */ #pragma omp parallel for ordered private(i) #endif for (i = 0; i <= next; i++) { int is_bad; cpl_error_code myerror; cpl_image * myimage = cpl_image_new(1, 1, CPL_TYPE_INT); cpl_propertylist * plist = cpl_propertylist_new(); myerror = cpl_propertylist_append_int(plist, "MYINT", i + base); cpl_test_eq_error(myerror, CPL_ERROR_NONE); myerror = cpl_image_add_scalar(myimage, i + base); cpl_test_eq_error(myerror, CPL_ERROR_NONE); cpl_test_eq(i, i); #ifdef _OPENMP #pragma omp ordered #endif { myerror = cpl_image_save(myimage, filename, CPL_TYPE_INT, plist, i ? CPL_IO_EXTEND : CPL_IO_CREATE); cpl_test_eq_error(myerror, CPL_ERROR_NONE); cpl_image_delete(myimage); /* Make sure to jump around between the extensions */ cpl_test_eq(cpl_fits_count_extensions(filename), i); myimage = cpl_image_load(filename, CPL_TYPE_INT, 0, i); cpl_test_error(CPL_ERROR_NONE); cpl_propertylist_delete(plist); plist = cpl_propertylist_load(filename, i); cpl_test_error(CPL_ERROR_NONE); } cpl_test_nonnull(myimage); cpl_test_eq(cpl_image_get(myimage, 1, 1, &is_bad), i + base); cpl_test_zero(is_bad); cpl_test_nonnull(plist); cpl_test_eq(cpl_propertylist_get_int(plist, "MYINT"), i + base); cpl_image_delete(myimage); cpl_propertylist_delete(plist); } cpl_test_eq(cpl_fits_count_extensions(filename), next); base += next; /* Creation + append from one thread, reading from from another*/ #ifdef _OPENMP /* Multi-threaded writing is limited to one thread writing at a time */ #pragma omp parallel for ordered private(i) #endif for (i = 0; i <= 2 * next + 1; i++) #ifdef _OPENMP #pragma omp ordered #endif { if (i & 1) { if (i > 2) { /* Read the previously written extension */ const int i2 = i / 2 - 1; int is_bad; cpl_propertylist * plist; cpl_image * myimage = cpl_image_load(filename, CPL_TYPE_INT, 0, i2); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(myimage); cpl_test_eq(cpl_image_get(myimage, 1, 1, &is_bad), i2 + base); cpl_test_zero(is_bad); cpl_image_delete(myimage); plist = cpl_propertylist_load(filename, i2); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(plist); cpl_test_eq(cpl_propertylist_get_int(plist, "MYINT"), i2 + base); cpl_propertylist_delete(plist); } } else { cpl_error_code myerror; cpl_image * myimage = cpl_image_new(1, 1, CPL_TYPE_INT); cpl_propertylist * plist = cpl_propertylist_new(); myerror = cpl_propertylist_append_int(plist, "MYINT", i/2 + base); cpl_test_eq_error(myerror, CPL_ERROR_NONE); myerror = cpl_image_add_scalar(myimage, i/2 + base); cpl_test_eq_error(myerror, CPL_ERROR_NONE); cpl_test_eq(i, i); myerror = cpl_image_save(myimage, filename, CPL_TYPE_INT, plist, i ? CPL_IO_EXTEND : CPL_IO_CREATE); cpl_test_eq_error(myerror, CPL_ERROR_NONE); cpl_image_delete(myimage); cpl_propertylist_delete(plist); } } cpl_test_eq(cpl_fits_count_extensions(filename), next); base += next; /* Alternating creation + append and reading */ #ifdef _OPENMP /* Multi-threaded writing is limited to one thread writing at a time */ #pragma omp parallel for ordered private(i) #endif for (i = 0; i <= next; i++) { int is_bad; cpl_error_code myerror; cpl_image * myimage = cpl_image_new(1, 1, CPL_TYPE_INT); cpl_propertylist * plist = cpl_propertylist_new(); myerror = cpl_propertylist_append_int(plist, "MYINT", i + base); cpl_test_eq_error(myerror, CPL_ERROR_NONE); myerror = cpl_image_add_scalar(myimage, i + base); cpl_test_eq_error(myerror, CPL_ERROR_NONE); #ifdef _OPENMP #pragma omp ordered #endif { myerror = cpl_image_save(myimage, filename, CPL_TYPE_INT, plist, (i & 1) ? CPL_IO_EXTEND : CPL_IO_CREATE); cpl_test_eq_error(myerror, CPL_ERROR_NONE); /* Make sure to jump around between the extensions */ cpl_test_eq(cpl_fits_count_extensions(filename), i & 1); cpl_image_delete(myimage); myimage = cpl_image_load(filename, CPL_TYPE_INT, 0, i & 1); cpl_test_error(CPL_ERROR_NONE); cpl_propertylist_delete(plist); plist = cpl_propertylist_load(filename, i & 1); cpl_test_error(CPL_ERROR_NONE); } cpl_test_nonnull(myimage); cpl_test_eq(cpl_image_get(myimage, 1, 1, &is_bad), i + base); cpl_test_zero(is_bad); cpl_image_delete(myimage); cpl_test_nonnull(plist); cpl_test_eq(cpl_propertylist_get_int(plist, "MYINT"), i + base); cpl_propertylist_delete(plist); } cpl_test_eq(cpl_fits_count_extensions(filename), next & 1); cpl_free((void*)filename); } /* End of tests */ return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @brief Open multiple files @param n The number of files to process @return void */ /*----------------------------------------------------------------------------*/ static void cpl_io_fits_test_many(int n) { int i; cpl_propertylist * plist = cpl_propertylist_new(); for (i = 0; i< n; i++) { char * filename = cpl_sprintf(BASENAME "-%d.fits", i + 1); cpl_error_code myerror; myerror = cpl_propertylist_update_int(plist, "MYINT", i); cpl_test_eq_error(myerror, CPL_ERROR_NONE); myerror = cpl_propertylist_save(plist, filename, CPL_IO_CREATE); cpl_test_eq_error(myerror, CPL_ERROR_NONE); cpl_propertylist_delete(plist); plist = cpl_propertylist_load(filename, 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(plist); cpl_test_eq(cpl_propertylist_get_int(plist, "MYINT"), i); cpl_free(filename); } cpl_propertylist_delete(plist); } cpl-6.4.1/cplcore/tests/cpl_imagelist_io-test.c0000644000460300003120000007531712136434640016447 00000000000000/* $Id: cpl_imagelist_io-test.c,v 1.61 2013-04-26 08:24:00 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-26 08:24:00 $ * $Revision: 1.61 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_imagelist_io.h" #include "cpl_test.h" #include "cpl_fits.h" #include "cpl_tools.h" /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ #ifndef IMAGESZ #define IMAGESZ 127 #endif #ifndef NIMAGES #define NIMAGES 10 #endif #define FILENAME "cpl_imagelist_test.fits" /*----------------------------------------------------------------------------- Static functions -----------------------------------------------------------------------------*/ static void cpl_imagelist_save_compression_test(void); static void cpl_imagelist_save_compression_bench(cpl_size, cpl_size, cpl_size, cpl_size); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { const char * file = FILENAME; cpl_imagelist * imlist; cpl_imagelist * imlist2; cpl_imagelist * imlista; cpl_imagelist * nulllist; cpl_image * image; cpl_image * nullimg; double flags[NIMAGES]; cpl_vector * eraser; cpl_size i; FILE * stream; int next; #if IMAGESZ > 127 const cpl_size boxsize = 5; #elif IMAGESZ < 25 /* FIXME: Will the tests pass with this ? */ const cpl_size boxsize = 1; #else const cpl_size boxsize = IMAGESZ / 25; #endif cpl_error_code error; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; /* Insert tests below */ cpl_test_nonnull(stream); eraser = cpl_vector_wrap(NIMAGES, flags); cpl_msg_info("", "Checking various failures"); image = cpl_image_fill_test_create(IMAGESZ, IMAGESZ); cpl_test_nonnull( image ); /* Test cpl_imagelist_new() */ imlist = cpl_imagelist_new(); cpl_test_nonnull( imlist ); cpl_test_zero( cpl_imagelist_get_size(imlist) ); cpl_test_eq( cpl_imagelist_is_uniform(imlist), 1); /* Failure tests involving NULL end empty lists */ i = cpl_imagelist_get_size(NULL); cpl_test_error( CPL_ERROR_NULL_INPUT ); cpl_test_eq( i, -1 ); i = cpl_imagelist_is_uniform(NULL); cpl_test_error( CPL_ERROR_NULL_INPUT ); cpl_test( i < 0); error = cpl_imagelist_set(NULL, image, 0); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT ); error = cpl_imagelist_set(imlist, NULL, 0); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT ); error = cpl_imagelist_set(imlist, image, -1); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT ); error = cpl_imagelist_set(imlist, image, 1); cpl_test_eq_error( error, CPL_ERROR_ACCESS_OUT_OF_RANGE ); nullimg = cpl_imagelist_get(NULL, 0); cpl_test_error( CPL_ERROR_NULL_INPUT ); cpl_test_null( nullimg ); nullimg = cpl_imagelist_get(imlist, -1); cpl_test_error( CPL_ERROR_ILLEGAL_INPUT ); cpl_test_null( nullimg ); nullimg = cpl_imagelist_get(imlist, 0); cpl_test_error( CPL_ERROR_ACCESS_OUT_OF_RANGE ); cpl_test_null( nullimg ); error = cpl_imagelist_erase(imlist, NULL); cpl_test_eq_error( error, CPL_ERROR_NULL_INPUT ); /* The elements of eraser are not initialized at this point, but they are also not supposed to be accessed */ error = cpl_imagelist_erase(NULL, eraser); cpl_test_eq_error( error, CPL_ERROR_NULL_INPUT ); error = cpl_imagelist_erase(imlist, eraser); cpl_test_eq_error( error, CPL_ERROR_INCOMPATIBLE_INPUT ); nulllist = cpl_imagelist_duplicate(NULL); cpl_test_error( CPL_ERROR_NULL_INPUT ); cpl_test_null( nulllist ); error = cpl_imagelist_save(imlist, NULL, CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE); cpl_test_eq_error( error, CPL_ERROR_NULL_INPUT ); error = cpl_imagelist_save(NULL, file, CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE); cpl_test_eq_error( error, CPL_ERROR_NULL_INPUT ); error = cpl_imagelist_save(imlist, file, CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE); cpl_test_eq_error( error, CPL_ERROR_ILLEGAL_INPUT ); nulllist = cpl_imagelist_load(NULL, CPL_TYPE_INT, 0); cpl_test_error( CPL_ERROR_NULL_INPUT ); cpl_test_null( nulllist ); nulllist = cpl_imagelist_load(".", CPL_TYPE_INT, 0); cpl_test_error( CPL_ERROR_FILE_IO ); cpl_test_null( nulllist ); nulllist = cpl_imagelist_load_window(NULL, CPL_TYPE_INT, 0, 1, 1, 2, 2); cpl_test_error( CPL_ERROR_NULL_INPUT ); cpl_test_null( nulllist ); nulllist = cpl_imagelist_load_window(file, CPL_TYPE_INT, -1, 1, 1, 2, 2); cpl_test_error( CPL_ERROR_ILLEGAL_INPUT ); cpl_test_null( nulllist ); nulllist = cpl_imagelist_load_window(".", CPL_TYPE_INT, 0, 1, 1, 2, 2); cpl_test_error( CPL_ERROR_FILE_IO ); cpl_test_null( nulllist ); /* Test cpl_imagelist_duplicate() of empty list */ imlist2 = cpl_imagelist_duplicate(imlist); cpl_test_nonnull( imlist2 ); cpl_test_zero( cpl_imagelist_get_size(imlist2) ); cpl_test_eq( cpl_imagelist_is_uniform(imlist2), 1); cpl_imagelist_empty(imlist2); /* Test cpl_imagelist_unset() */ cpl_imagelist_delete(imlist2); cpl_msg_info("", "Create an image list of %d images", NIMAGES); /* Test cpl_imagelist_set() */ for (i=0; i < NIMAGES; i++) { cpl_image * copy = cpl_image_fill_test_create(IMAGESZ, IMAGESZ); flags[i] = i % 2 ? 1.0 : -1.0; error = cpl_imagelist_set(imlist, copy, i); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( cpl_imagelist_get_size(imlist), i+1 ); cpl_test_eq_ptr( cpl_imagelist_get(imlist, i), copy ); /* Insert image twice, last image will remain twice in list */ error = cpl_imagelist_set(imlist, copy, i + 1); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_image_delete(image); (void)cpl_imagelist_unset(imlist, NIMAGES); /* No real testing, but at least make use of cpl_imagelist_dump_{structure, window} */ cpl_imagelist_dump_structure(imlist, stream); cpl_imagelist_dump_window(imlist, (IMAGESZ / 2) - boxsize, (IMAGESZ / 2) - boxsize, (IMAGESZ / 2) + boxsize, (IMAGESZ / 2) + boxsize, stream); cpl_msg_info("", "Cast the image list"); error = cpl_imagelist_cast(NULL, NULL, CPL_TYPE_UNSPECIFIED); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_imagelist_cast(NULL, imlist, CPL_TYPE_UNSPECIFIED); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_imagelist_cast(imlist, imlist, CPL_TYPE_UNSPECIFIED); cpl_test_eq_error(error, CPL_ERROR_INCOMPATIBLE_INPUT); imlist2 = cpl_imagelist_new(); error = cpl_imagelist_cast(imlist2, imlist, CPL_TYPE_INVALID); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); cpl_test_zero( cpl_imagelist_get_size(imlist2)); error = cpl_imagelist_cast(imlist2, imlist, CPL_TYPE_UNSPECIFIED); cpl_test_eq_error(error, CPL_ERROR_INVALID_TYPE); cpl_test_zero( cpl_imagelist_get_size(imlist2)); error = cpl_imagelist_cast(imlist2, imlist, CPL_TYPE_FLOAT); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlist2)); cpl_test_eq( cpl_imagelist_get_size(imlist2), NIMAGES ); error = cpl_imagelist_cast(imlist2, NULL, CPL_TYPE_INT); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlist2)); cpl_test_eq( cpl_imagelist_get_size(imlist2), NIMAGES ); error = cpl_imagelist_cast(imlist2, imlist, CPL_TYPE_UNSPECIFIED); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlist2)); cpl_test_eq( cpl_imagelist_get_size(imlist2), 2 * NIMAGES ); error = cpl_imagelist_cast(imlist2, NULL, CPL_TYPE_FLOAT_COMPLEX); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlist2)); cpl_test_eq( cpl_imagelist_get_size(imlist2), 2 * NIMAGES ); error = cpl_imagelist_cast(imlist2, NULL, CPL_TYPE_FLOAT); cpl_test_eq_error(error, CPL_ERROR_TYPE_MISMATCH); cpl_test_zero( cpl_imagelist_is_uniform(imlist2)); cpl_test_eq( cpl_imagelist_get_size(imlist2), 2 * NIMAGES ); cpl_imagelist_delete(imlist2); cpl_msg_info("", "Duplicate the image list"); imlist2 = cpl_imagelist_duplicate(imlist); cpl_test_nonnull( imlist2 ); cpl_test_zero( cpl_imagelist_is_uniform(imlist2)); cpl_test_eq( cpl_imagelist_get_size(imlist2), NIMAGES ); /* Failure tests involving non-empty, valid list */ error = cpl_imagelist_save(imlist2, ".", CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE); cpl_test_eq_error( error, CPL_ERROR_FILE_IO ); remove(file); error = cpl_imagelist_save(imlist2, file, CPL_TYPE_FLOAT, NULL, CPL_IO_APPEND); cpl_test_eq_error( error, CPL_ERROR_FILE_IO ); error = cpl_imagelist_save(imlist2, file, CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE | CPL_IO_EXTEND); cpl_test_eq_error( error, CPL_ERROR_ILLEGAL_INPUT ); error = cpl_imagelist_save(imlist2, file, CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE | CPL_IO_EXTEND | CPL_IO_APPEND); cpl_test_eq_error( error, CPL_ERROR_ILLEGAL_INPUT ); image = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_INT); cpl_test_nonnull( image ); error = cpl_imagelist_set(imlist2, image, 0); cpl_test_eq_error( error, CPL_ERROR_TYPE_MISMATCH ); cpl_test_zero( cpl_imagelist_is_uniform(imlist2) ); cpl_test_eq( cpl_imagelist_get_size(imlist2), NIMAGES ); cpl_image_delete(image); image = cpl_image_new(IMAGESZ/2, IMAGESZ, CPL_TYPE_INT); cpl_test_nonnull( image ); error = cpl_imagelist_set(imlist2, image, 0); cpl_test_eq_error( error, CPL_ERROR_INCOMPATIBLE_INPUT ); cpl_test_zero( cpl_imagelist_is_uniform(imlist2) ); cpl_test_eq( cpl_imagelist_get_size(imlist2), NIMAGES ); nullimg = cpl_imagelist_get(imlist2, NIMAGES+1); cpl_test_error( CPL_ERROR_ACCESS_OUT_OF_RANGE ); cpl_test_null( nullimg ); cpl_test_zero( cpl_imagelist_is_uniform(imlist2) ); cpl_test_eq( cpl_imagelist_get_size(imlist2), NIMAGES ); cpl_imagelist_empty(imlist2); /* Test cpl_imagelist_unset() */ /* Imagelist with 1 image */ error = cpl_imagelist_set(imlist2, image, 0); cpl_test_eq_error( error, CPL_ERROR_NONE ); /* Must be allowed to replace it w. image of different size/type */ image = cpl_image_new(IMAGESZ, IMAGESZ/2, CPL_TYPE_DOUBLE); cpl_test_nonnull( image ); error = cpl_imagelist_set(imlist2, image, 0); cpl_test_eq_error( error, CPL_ERROR_NONE ); cpl_imagelist_delete(imlist2); /* Normal conditions */ /* Create double-length list, with images inserted twice */ imlista = cpl_imagelist_duplicate(imlist); for (i = 0; i < NIMAGES; i++) { image = cpl_imagelist_get(imlista, i); error = cpl_imagelist_set(imlista, image, i + NIMAGES); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlista) ); cpl_test_eq( cpl_imagelist_get_size(imlista), i+1 + NIMAGES ); cpl_test_eq_ptr( cpl_imagelist_get_const(imlista, i + NIMAGES), cpl_imagelist_get_const(imlista, i) ); } /* Test cpl_imagelist_save() */ cpl_msg_info("", "Save the image list to %s", file); error = cpl_imagelist_save(imlist, file, CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(file); cpl_test_zero( cpl_fits_count_extensions(file)); next = 0; error = cpl_imagelist_save(imlist, file, CPL_TYPE_FLOAT, NULL, CPL_IO_EXTEND); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(file); cpl_test_eq( cpl_fits_count_extensions(file), ++next); /* cpl_image_load(): Test loading of NAXIS=3 data (DFS09929) */ image = cpl_image_load(file, CPL_TYPE_UNSPECIFIED, 0, 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_image_abs(image, cpl_imagelist_get_const(imlist, 0), 15.0 * FLT_EPSILON); cpl_image_delete(image); /* Test cpl_imagelist_load() handling of negative extension */ nulllist = cpl_imagelist_load(file, CPL_TYPE_INT, -1); cpl_test_error( CPL_ERROR_ILLEGAL_INPUT ); cpl_test_null( nulllist ); /* Append error test */ error = cpl_imagelist_save(imlist, file, CPL_TYPE_DOUBLE, NULL, CPL_IO_APPEND); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); image = cpl_image_new(IMAGESZ+1,IMAGESZ+1, CPL_TYPE_FLOAT); imlist2 = cpl_imagelist_new(); cpl_imagelist_set(imlist2, image, 0); error = cpl_imagelist_save(imlist2, file, CPL_TYPE_FLOAT, NULL, CPL_IO_APPEND); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); cpl_imagelist_delete(imlist2); /* Tests cpl_imagelist_load() for no-casting type */ imlist2 = cpl_imagelist_load(file, CPL_TYPE_UNSPECIFIED, 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(imlist2); cpl_test_imagelist_abs(imlist, imlist2, 10.0 * FLT_EPSILON); cpl_imagelist_delete(imlist2); error = cpl_imagelist_save(imlist, file, CPL_TYPE_FLOAT, NULL, CPL_IO_APPEND); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(file); cpl_test_eq( cpl_fits_count_extensions(file), next); imlist2 = cpl_imagelist_load(file, CPL_TYPE_UNSPECIFIED, 1); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(imlist2); cpl_test_imagelist_abs(imlista, imlist2, 10.0 * FLT_EPSILON); cpl_imagelist_delete(imlista); error = cpl_imagelist_erase(imlist, eraser); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( 2*cpl_imagelist_get_size(imlist), NIMAGES ); cpl_imagelist_empty(imlist); /* Test cpl_imagelist_unset() */ cpl_imagelist_delete(imlist); /* Tests cpl_imagelist_load() for no-casting type */ imlist = cpl_imagelist_load(file, CPL_TYPE_UNSPECIFIED, 0); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(imlist); image = cpl_imagelist_get(imlist, 0); cpl_test_eq(cpl_image_get_type(image), CPL_TYPE_FLOAT); cpl_imagelist_delete(imlist); imlist = cpl_imagelist_load_window(file, CPL_TYPE_UNSPECIFIED, 0, IMAGESZ/4, IMAGESZ/4, 3*IMAGESZ/4, 3*IMAGESZ/4); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(imlist); image = cpl_imagelist_get(imlist, 0); cpl_test_eq(cpl_image_get_type(image), CPL_TYPE_FLOAT); cpl_imagelist_delete(imlist); /* Test cpl_imagelist_load() */ cpl_msg_info("", "Load image list as type DOUBLE"); imlist = cpl_imagelist_load(file, CPL_TYPE_DOUBLE, 0); cpl_test_nonnull( imlist ); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( cpl_imagelist_get_size(imlist), NIMAGES ); error = cpl_imagelist_erase(imlist, eraser); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( 2*cpl_imagelist_get_size(imlist), NIMAGES ); cpl_imagelist_empty(imlist); /* Test cpl_imagelist_unset() */ cpl_imagelist_delete(imlist); /* Test cpl_imagelist_load() */ cpl_msg_info("", "Load image list as type FLOAT"); imlist = cpl_imagelist_load(file, CPL_TYPE_FLOAT, 0); cpl_test_nonnull( imlist ); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( cpl_imagelist_get_size(imlist), NIMAGES ); error = cpl_imagelist_erase(imlist, eraser); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( 2*cpl_imagelist_get_size(imlist), NIMAGES ); cpl_imagelist_empty(imlist); /* Test cpl_imagelist_unset() */ cpl_imagelist_delete(imlist); /* Test cpl_imagelist_load() */ cpl_msg_info("", "Load image list as type INTEGER"); imlist = cpl_imagelist_load(file, CPL_TYPE_INT, 0); cpl_test_nonnull( imlist ); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( cpl_imagelist_get_size(imlist), NIMAGES ); error = cpl_imagelist_erase(imlist, eraser); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( 2*cpl_imagelist_get_size(imlist), NIMAGES ); cpl_imagelist_empty(imlist); /* Test cpl_imagelist_unset() */ cpl_imagelist_delete(imlist); /* Test cpl_imagelist_load_window() */ cpl_msg_info("", "Load image list as type DOUBLE from a window"); imlist = cpl_imagelist_load_window(file, CPL_TYPE_DOUBLE, 0, IMAGESZ/4, IMAGESZ/4, 3*IMAGESZ/4, 3*IMAGESZ/4); cpl_test_nonnull( imlist ); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( cpl_imagelist_get_size(imlist), NIMAGES ); error = cpl_imagelist_erase(imlist, eraser); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( 2*cpl_imagelist_get_size(imlist), NIMAGES ); cpl_imagelist_empty(imlist); /* Test cpl_imagelist_unset() */ cpl_imagelist_delete(imlist); /* Test cpl_imagelist_load_window() */ cpl_msg_info("", "Load image list as type FLOAT from a window"); imlist = cpl_imagelist_load_window(file, CPL_TYPE_FLOAT, 0, IMAGESZ/4, IMAGESZ/4, 3*IMAGESZ/4, 3*IMAGESZ/4); cpl_test_nonnull( imlist ); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( cpl_imagelist_get_size(imlist), NIMAGES ); error = cpl_imagelist_erase(imlist, eraser); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( 2*cpl_imagelist_get_size(imlist), NIMAGES ); cpl_imagelist_empty(imlist); /* Test cpl_imagelist_unset() */ cpl_imagelist_delete(imlist); /* Test cpl_imagelist_load_window() */ cpl_msg_info("", "Load image list as type INTEGER from a window"); imlist = cpl_imagelist_load_window(file, CPL_TYPE_INT, 0, IMAGESZ/4, IMAGESZ/4, 3*IMAGESZ/4, 3*IMAGESZ/4); cpl_test_nonnull( imlist ); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( cpl_imagelist_get_size(imlist), NIMAGES ); error = cpl_imagelist_erase(imlist, eraser); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero( cpl_imagelist_is_uniform(imlist) ); cpl_test_eq( 2*cpl_imagelist_get_size(imlist), NIMAGES ); /* Clean up */ cpl_imagelist_empty(imlist); /* Test cpl_imagelist_unset() */ cpl_imagelist_delete(imlist); cpl_imagelist_empty(imlist2); /* Test cpl_imagelist_unset() */ cpl_imagelist_delete(imlist2); cpl_vector_unwrap(eraser); cpl_imagelist_save_compression_test(); if (cpl_msg_get_level() <= CPL_MSG_INFO) { cpl_imagelist_save_compression_bench(256, 256, 12, 256); } else { cpl_imagelist_save_compression_bench(IMAGESZ, IMAGESZ, 32, 3); } cpl_test_zero( remove(FILENAME) ); if (stream != stdout) cpl_test_zero( fclose(stream) ); /* End of tests */ return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @brief Test saving with compression @return void @see cpl_imagelist_save() */ /*----------------------------------------------------------------------------*/ static void cpl_imagelist_save_compression_test(void) { /* Default CFITSIO quantization parameter for lossy floating point compression is q = 1, reducing precision to 4.08 % */ const double prec = 0.0408; const double maxval = 255.0; const cpl_type imtypes[] = {CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT}; const size_t ntyp = sizeof(imtypes)/sizeof(imtypes[0]); size_t ityp; /* Saving with different image types, bitpix and compression types */ for (ityp = 0; ityp < ntyp; ityp++) { const cpl_type bpps[] = {CPL_TYPE_UCHAR, CPL_TYPE_SHORT, CPL_TYPE_USHORT, CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE, CPL_TYPE_UNSPECIFIED}; const size_t nbpp = sizeof(bpps)/sizeof(bpps[0]); size_t ibpp; const cpl_type imtype = imtypes[ityp]; cpl_image * img = cpl_image_new(IMAGESZ, IMAGESZ, imtype); cpl_imagelist * imglist = cpl_imagelist_new(); cpl_error_code error; error = cpl_image_fill_noise_uniform(img, 0.0, maxval); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_set(imglist, img, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); for (ibpp = 0; ibpp < nbpp; ibpp++) { const cpl_io_type comp_meths[] = {CPL_IO_COMPRESS_GZIP, CPL_IO_COMPRESS_RICE, CPL_IO_COMPRESS_HCOMPRESS, CPL_IO_COMPRESS_PLIO}; const size_t ncomp = sizeof(comp_meths)/sizeof(comp_meths[0]); size_t icomp; const int bitpix = cpl_tools_get_bpp(bpps[ibpp] == CPL_TYPE_UNSPECIFIED ? imtype : bpps[ibpp]); int ext = 0; error = cpl_imagelist_save(imglist, FILENAME, bpps[ibpp], NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Tests with compression */ for(icomp = 0; icomp < ncomp; icomp++) { const cpl_io_type comp_method = comp_meths[icomp]; /* The compression method flag must be non-zero */ cpl_test(comp_method); /* Saving with compression in non supported combinations */ error = cpl_imagelist_save(NULL, FILENAME, bpps[ibpp], NULL, CPL_IO_EXTEND | comp_method); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); /* Compression is only supported when adding new extensions, * not creating a new file and saving data in the main header */ error = cpl_imagelist_save(imglist, FILENAME, bpps[ibpp], NULL, CPL_IO_CREATE | comp_method); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_imagelist_save(imglist, FILENAME, bpps[ibpp], NULL, CPL_IO_APPEND | comp_method); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); for(size_t icomp2 = 0; icomp2 < icomp; icomp2++) { const cpl_io_type comp_method2 = comp_meths[icomp2]; error = cpl_imagelist_save(imglist, FILENAME, bpps[ibpp], NULL, CPL_IO_EXTEND | comp_method | comp_method2); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_imagelist_save(imglist, FILENAME, bpps[ibpp], NULL, CPL_IO_APPEND | comp_method | comp_method2); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); for(size_t icomp3 = 0; icomp3 < icomp2; icomp3++) { const cpl_io_type comp_method3 = comp_meths[icomp3]; error = cpl_imagelist_save(imglist, FILENAME, bpps[ibpp], NULL, CPL_IO_EXTEND | comp_method | comp_method2 | comp_method3); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_imagelist_save(imglist, FILENAME, bpps[ibpp], NULL, CPL_IO_APPEND | comp_method | comp_method2 | comp_method3); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); } } error = cpl_imagelist_save(imglist, FILENAME, bpps[ibpp], NULL, CPL_IO_EXTEND | CPL_IO_COMPRESS_GZIP | CPL_IO_COMPRESS_RICE| CPL_IO_COMPRESS_HCOMPRESS | CPL_IO_COMPRESS_PLIO); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_imagelist_save(imglist, FILENAME, bpps[ibpp], NULL, CPL_IO_APPEND | CPL_IO_COMPRESS_GZIP | CPL_IO_COMPRESS_RICE| CPL_IO_COMPRESS_HCOMPRESS | CPL_IO_COMPRESS_PLIO); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_imagelist_save(imglist, FILENAME, bpps[ibpp], NULL, CPL_IO_EXTEND | comp_method); if ( #ifndef CPL_IO_COMPRESSION_LOSSY /* Currently, compression only allowed with integer data */ bitpix < 0 || #endif /* FP-data compresses only to int, float or double */ /* RICE-compression supports only int, float or double */ /* In fact, this applies to all compressions... */ abs(bitpix) < 32) { cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); } else { cpl_image * img_load; cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(FILENAME); ext++; cpl_test_eq( cpl_fits_count_extensions(FILENAME), ext); img_load = cpl_image_load(FILENAME, CPL_TYPE_UNSPECIFIED, 0, ext); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_image_get_size_x(img_load), IMAGESZ); cpl_test_eq(cpl_image_get_size_y(img_load), IMAGESZ); if (imtype == CPL_TYPE_INT) { cpl_test_image_abs(img, img_load, 0.0); } else if (cpl_image_get_type(img_load) != CPL_TYPE_INT) { cpl_test_image_abs(img, img_load, prec * maxval); } cpl_image_delete(img_load); /* Can (currently) not insert images into an existing, compressed cube */ error = cpl_imagelist_save(imglist, FILENAME, bpps[ibpp], NULL, CPL_IO_APPEND); cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); } } } cpl_imagelist_delete(imglist); } } /*----------------------------------------------------------------------------*/ /** @brief Benchmark saving with compression @param nx NX @param ny NY @param nz NZ @param nr Number of repetitions @return void @see cpl_image_save() */ /*----------------------------------------------------------------------------*/ static void cpl_imagelist_save_compression_bench(cpl_size nx, cpl_size ny, cpl_size nz, cpl_size nr) { cpl_image * img = cpl_image_new(nx, ny, CPL_TYPE_INT); cpl_imagelist * imglist = cpl_imagelist_new(); cpl_error_code error; cpl_size i; double tsum = 0.0; error = cpl_image_fill_noise_uniform(img, 0.0, 255.0); cpl_test_eq_error(error, CPL_ERROR_NONE); for (i = 0; i < nz; i++) { error = cpl_imagelist_set(imglist, img, i); cpl_test_eq_error(error, CPL_ERROR_NONE); } error = cpl_image_save(NULL, FILENAME, CPL_TYPE_UNSPECIFIED, NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_imagelist_save(imglist, FILENAME, CPL_TYPE_UNSPECIFIED, NULL, CPL_IO_EXTEND | CPL_IO_COMPRESS_RICE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(FILENAME); cpl_test_eq( cpl_fits_count_extensions(FILENAME), 1); #ifdef _OPENMP #pragma omp parallel for private(i) reduction(+ : tsum) #endif for (i = 0; i < nr; i++) { const double t0 = cpl_test_get_walltime(); cpl_imagelist * imgload = cpl_imagelist_load(FILENAME, CPL_TYPE_UNSPECIFIED, 1); const double t1 = cpl_test_get_walltime() - t0; int j; cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(cpl_imagelist_get_size(imgload), nz); tsum += t1; for (j = 0; j < nz; j++) { cpl_test_image_abs(cpl_imagelist_get_const(imgload, j), img, 0.0); } cpl_imagelist_delete(imgload); } cpl_msg_info(cpl_func, "Time to load Rice-compressed image list %d X %d " "X %d %d times [s]: %g", (int)nx, (int)ny, (int)nz, (int)nr, tsum); cpl_imagelist_unwrap(imglist); cpl_image_delete(img); } cpl-6.4.1/cplcore/tests/cpl_image_io-test.c0000644000460300003120000013364112111700315015532 00000000000000/* $Id: cpl_image_io-test.c,v 1.75 2013-02-22 14:29:33 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-02-22 14:29:33 $ * $Revision: 1.75 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image_io_impl.h" #include "cpl_test.h" #include "cpl_fits.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef IMAGESZ #define IMAGESZ 32 #endif #define FILENAME "cpl_image_test.fits" /*----------------------------------------------------------------------------- Static functions -----------------------------------------------------------------------------*/ static double cpl_image_get_precision(cpl_type, cpl_type, double); static void cpl_image_fill_int_test(void); static void cpl_image_save_compression_test(void); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { const cpl_type imtypes[] = {CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT, CPL_TYPE_DOUBLE_COMPLEX, CPL_TYPE_FLOAT_COMPLEX}; const cpl_type bpps[] = {CPL_TYPE_UCHAR, CPL_TYPE_SHORT, CPL_TYPE_USHORT, CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE}; const double minval[] = {0.0, -32767.0, 0.0, -2147483647.0, -65535.0, -2147483647.0}; const double maxval[] = {255.0, 32767.0, 65535.0, 2147483647.0, 65535.0, 2147483647.0}; const int nbad = 5; const int bad_pos_x[] = {20, 20, 30, 31, 10}; const int bad_pos_y[] = {30, 10, 20, 20, 22}; const int nbpp = (int)(sizeof(bpps)/sizeof(bpps[0])); FILE * stream; const cpl_image * nullimg; int ibpp; int ityp; int i; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; /* Insert tests below */ cpl_test_nonnull(stream); (void)remove(FILENAME); /* May (also) exist with wrong perms */ /* Check the image type size */ cpl_test_eq( cpl_type_get_sizeof(CPL_TYPE_DOUBLE), sizeof(double)); cpl_test_eq( cpl_type_get_sizeof(CPL_TYPE_FLOAT), sizeof(float)); cpl_test_eq( cpl_type_get_sizeof(CPL_TYPE_INT), sizeof(int)); cpl_test_eq( cpl_type_get_sizeof(CPL_TYPE_DOUBLE_COMPLEX), sizeof(double complex)); cpl_test_eq( cpl_type_get_sizeof(CPL_TYPE_FLOAT_COMPLEX), sizeof(float complex)); /* Check error handling in image creation */ nullimg = cpl_image_new(0, IMAGESZ, CPL_TYPE_INT); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_new(IMAGESZ, 0, CPL_TYPE_INT); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_CHAR); cpl_test_error(CPL_ERROR_INVALID_TYPE); cpl_test_null(nullimg); nullimg = cpl_image_load(NULL, CPL_TYPE_UNSPECIFIED, 0, 0); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_load_window(NULL, CPL_TYPE_UNSPECIFIED, 0, 0, 1, 1, 1, 1); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_load(FILENAME, CPL_TYPE_UNSPECIFIED, 0, 0); cpl_test_error(CPL_ERROR_FILE_IO); cpl_test_null(nullimg); nullimg = cpl_image_load(".", CPL_TYPE_UNSPECIFIED, 0, 0); cpl_test_error(CPL_ERROR_FILE_IO); cpl_test_null(nullimg); /* Error handling in the cpl_image_wrap*() functions */ nullimg = cpl_image_wrap(1, 1, CPL_TYPE_INT, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap(1, 1, CPL_TYPE_POINTER, (void*)stream); cpl_test_error(CPL_ERROR_INVALID_TYPE); cpl_test_null(nullimg); nullimg = cpl_image_wrap(0, 1, CPL_TYPE_INT, (void*)stream); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap(1, 0, CPL_TYPE_INT, (void*)stream); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_double(1, 1, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_double(0, 1, (void*)stream); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_double(1, 0, (void*)stream); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_float(1, 1, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_float(0, 1, (void*)stream); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_float(1, 0, (void*)stream); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_int(1, 1, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_int(0, 1, (void*)stream); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_int(1, 0, (void*)stream); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_double_complex(1, 1, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_double_complex(0, 1, (void*)stream); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_double_complex(1, 0, (void*)stream); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_float_complex(1, 1, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_float_complex(0, 1, (void*)stream); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_wrap_float_complex(1, 0, (void*)stream); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); cpl_image_fill_int_test(); /* Create a data-less HDU, and append another to it */ for (ibpp = 0; ibpp < nbpp; ibpp++) { cpl_msg_info(cpl_func, "Testing saving with save type '%s' and no " "pixels", cpl_type_get_name(bpps[ibpp])); cpl_test_zero(cpl_image_save(NULL, FILENAME, bpps[ibpp], NULL, CPL_IO_CREATE)); cpl_test_fits(FILENAME); cpl_test_zero( cpl_fits_count_extensions(FILENAME) ); cpl_test_zero(cpl_image_save(NULL, FILENAME, bpps[ibpp], NULL, CPL_IO_EXTEND)); cpl_test_fits(FILENAME); cpl_test_eq( cpl_fits_count_extensions(FILENAME), 1 ); } /* Check error handling with no data unit */ nullimg = cpl_image_load(FILENAME, CPL_TYPE_UNSPECIFIED, 0, 0); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(nullimg); /* Iterate through all pixel types */ for (ityp = 0; ityp < (int)(sizeof(imtypes)/sizeof(imtypes[0])); ityp++) { const cpl_type imtype = imtypes[ityp]; const void * nulldata; cpl_error_code error; int ityp2; cpl_image * img = cpl_image_new(IMAGESZ, IMAGESZ, imtype); cpl_image * copy; cpl_msg_info(cpl_func, "Testing image with type '%s'", cpl_type_get_name(imtype)); cpl_test_nonnull(img); error = cpl_image_dump_structure(img, stream); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_image_get_type(img), imtype); cpl_test_eq(cpl_image_get_size_x(img), IMAGESZ); cpl_test_eq(cpl_image_get_size_y(img), IMAGESZ); /* Test cpl_image_get_data() */ cpl_test_nonnull( cpl_image_get_data(img) ); cpl_test_nonnull( cpl_image_get_data_const(img) ); if (imtype != CPL_TYPE_FLOAT_COMPLEX && imtype != CPL_TYPE_DOUBLE_COMPLEX) { /* Largest number with 8 BPP */ error = cpl_image_add_scalar(img, 255.0); cpl_test_eq_error(error, CPL_ERROR_NONE); } if (imtype == CPL_TYPE_DOUBLE) { cpl_test_nonnull( cpl_image_get_data_double(img) ); cpl_test_nonnull( cpl_image_get_data_double_const(img) ); nulldata = cpl_image_get_data_float(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null(nulldata); nulldata = cpl_image_get_data_float_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_int(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_int_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_double_complex(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_double_complex_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float_complex(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float_complex_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); copy = cpl_image_wrap_double(IMAGESZ, IMAGESZ, cpl_image_get_data_double(img)); } else if (imtype == CPL_TYPE_FLOAT) { cpl_test_nonnull( cpl_image_get_data_float(img) ); cpl_test_nonnull( cpl_image_get_data_float_const(img) ); nulldata = cpl_image_get_data_double(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_double_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_int(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_int_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_double_complex(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_double_complex_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float_complex(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float_complex_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); copy = cpl_image_wrap_float(IMAGESZ, IMAGESZ, cpl_image_get_data_float(img)); } else if (imtype == CPL_TYPE_INT) { cpl_test_nonnull( cpl_image_get_data_int(img) ); cpl_test_nonnull( cpl_image_get_data_int_const(img) ); nulldata = cpl_image_get_data_double(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_double_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_double_complex(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_double_complex_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float_complex(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float_complex_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); copy = cpl_image_wrap_int(IMAGESZ, IMAGESZ, cpl_image_get_data_int(img)); } else if (imtype == CPL_TYPE_DOUBLE_COMPLEX) { cpl_test_nonnull( cpl_image_get_data_double_complex(img) ); cpl_test_nonnull( cpl_image_get_data_double_complex_const(img) ); nulldata = cpl_image_get_data_double(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_double_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_int(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_int_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float_complex(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float_complex_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); copy = cpl_image_wrap_double_complex( IMAGESZ, IMAGESZ, cpl_image_get_data_double_complex(img) ); } else { /* CPL_TYPE_FLOAT_COMPLEX */ cpl_test_nonnull( cpl_image_get_data_float_complex(img) ); cpl_test_nonnull( cpl_image_get_data_float_complex_const(img) ); nulldata = cpl_image_get_data_double(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_double_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_float_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_int(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_int_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_double_complex(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); nulldata = cpl_image_get_data_double_complex_const(img); cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null( nulldata ); copy = cpl_image_wrap_float_complex( IMAGESZ, IMAGESZ, cpl_image_get_data_float_complex(img) ); } cpl_test_nonnull(copy); cpl_test_noneq_ptr(img, copy); cpl_test_eq_ptr(cpl_image_get_data_const(img), cpl_image_get_data_const(copy)); cpl_test_nonnull(cpl_image_unwrap(copy)); copy = cpl_image_wrap(IMAGESZ, IMAGESZ, imtype, cpl_image_get_data(img)); cpl_test_nonnull(copy); cpl_test_noneq_ptr(img, copy); cpl_test_eq_ptr(cpl_image_get_data_const(img), cpl_image_get_data_const(copy)); if ( imtype != CPL_TYPE_FLOAT_COMPLEX && imtype != CPL_TYPE_DOUBLE_COMPLEX) cpl_test_image_abs(img, copy, 0.0); else { cpl_image * real_img = cpl_image_extract_real(img); cpl_image * imag_img = cpl_image_extract_imag(img); cpl_image * real_copy = cpl_image_extract_real(copy); cpl_image * imag_copy = cpl_image_extract_imag(copy); cpl_test_image_abs(real_img, real_copy, 0.0); cpl_test_image_abs(imag_img, imag_copy, 0.0); /* Test cpl_image_conjugate() and cpl_image_fill_re_im() */ error = cpl_image_conjugate(img, img); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_multiply_scalar(imag_copy, -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_fill_re_im(real_img, imag_img, img); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(real_img, real_copy, 0.0); cpl_test_image_abs(imag_img, imag_copy, 0.0); error = cpl_image_fill_re_im(NULL, imag_img, img); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_fill_re_im(real_img, NULL, img); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(real_img, real_copy, 0.0); cpl_test_image_abs(imag_img, imag_copy, 0.0); /* Test in-place */ error = cpl_image_fill_re_im(copy, NULL, copy); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(copy, real_img, 0.0); error = cpl_image_fill_re_im(NULL, copy, copy); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_image_delete(real_img); cpl_image_delete(imag_img); cpl_image_delete(real_copy); cpl_image_delete(imag_copy); } cpl_test_nonnull(cpl_image_unwrap(copy)); /* Saving is not supported for complex types */ if ( imtype != CPL_TYPE_FLOAT_COMPLEX && imtype != CPL_TYPE_DOUBLE_COMPLEX) { for (ibpp = 0; ibpp < nbpp; ibpp++) { int j; cpl_msg_info(cpl_func, "Testing saving with BITPIX=%d and pixels " "ranging: %g -> %g", bpps[ibpp], minval[ibpp], maxval[ibpp]); /* Use bpp-specific value */ cpl_test_zero(cpl_image_fill_noise_uniform(img, minval[ibpp], maxval[ibpp])); /* First, do some failure testing */ /* NULL filename - and no image */ error = cpl_image_save(NULL, NULL, bpps[ibpp], NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); /* Directory as filename - and no image */ error = cpl_image_save(NULL, ".", bpps[ibpp], NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_FILE_IO); /* Invalid mode - and no image */ error = cpl_image_save(NULL, FILENAME, bpps[ibpp], NULL, -1); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* More failure tests, with an image */ /* NULL filename */ error = cpl_image_save(img, NULL, bpps[ibpp], NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); /* Directory as filename */ error = cpl_image_save(img, ".", bpps[ibpp], NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_FILE_IO); /* Invalid BPP */ error = cpl_image_save(img, FILENAME, 0, NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Invalid mode */ error = cpl_image_save(img, FILENAME, bpps[ibpp], NULL, -1); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Illegal mode combination */ error = cpl_image_save(img, FILENAME, bpps[ibpp], NULL, CPL_IO_CREATE | CPL_IO_EXTEND); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Illegal mode combination */ error = cpl_image_save(img, FILENAME, bpps[ibpp], NULL, CPL_IO_APPEND); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Create/Append file */ error = cpl_image_save(img, FILENAME, bpps[ibpp], NULL, ibpp ? CPL_IO_EXTEND : CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(FILENAME); cpl_test_eq( cpl_fits_count_extensions(FILENAME), ibpp ); error = cpl_image_save(img, FILENAME, bpps[ibpp] == CPL_TYPE_USHORT ? CPL_TYPE_SHORT : bpps[ibpp], NULL, CPL_IO_APPEND); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); cpl_test_eq( cpl_fits_count_extensions(FILENAME), ibpp ); for (j = 0; j < 1; j++) { /* Only 1 iteration, no append */ /* Tests for no-casting type */ copy = cpl_image_load(FILENAME, CPL_TYPE_UNSPECIFIED, j, ibpp); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(copy); if (bpps[ibpp] == CPL_TYPE_UCHAR || bpps[ibpp] == CPL_TYPE_SHORT || bpps[ibpp] == CPL_TYPE_USHORT || bpps[ibpp] == CPL_TYPE_INT ) { cpl_test_eq(cpl_image_get_type(copy), CPL_TYPE_INT); cpl_test_image_abs(copy, img, 0.0); } else if (bpps[ibpp] == CPL_TYPE_FLOAT) { cpl_test_eq(cpl_image_get_type(copy), CPL_TYPE_FLOAT); cpl_test_image_abs(copy, img, maxval[ibpp] * FLT_EPSILON); } else { cpl_test_eq(cpl_image_get_type(copy), CPL_TYPE_DOUBLE); cpl_test_image_abs(copy, img, maxval[ibpp] * DBL_EPSILON); } cpl_image_delete(copy); } /* Check error handling in windowed image loading */ nullimg = cpl_image_load_window(FILENAME, CPL_TYPE_UNSPECIFIED, 0, ibpp, 0, IMAGESZ/4, 3*IMAGESZ/4, 3*IMAGESZ/4); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_load_window(FILENAME, CPL_TYPE_UNSPECIFIED, 0, ibpp, IMAGESZ/4, 0, 3*IMAGESZ/4, 3*IMAGESZ/4); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_load_window(FILENAME, CPL_TYPE_UNSPECIFIED, 0, ibpp, 3*IMAGESZ/4, IMAGESZ/4, IMAGESZ/4, 3*IMAGESZ/4); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_load_window(FILENAME, CPL_TYPE_UNSPECIFIED, 0, ibpp, IMAGESZ/4, 3*IMAGESZ/4, 3*IMAGESZ/4, IMAGESZ/4); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_load_window(FILENAME, CPL_TYPE_UNSPECIFIED, 0, ibpp, IMAGESZ/4, IMAGESZ/4, IMAGESZ+1, 3*IMAGESZ/4); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); nullimg = cpl_image_load_window(FILENAME, CPL_TYPE_UNSPECIFIED, 0, ibpp, IMAGESZ/4, IMAGESZ/4, 3*IMAGESZ/4, IMAGESZ+1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(nullimg); copy = cpl_image_load_window(FILENAME, CPL_TYPE_UNSPECIFIED, 0, ibpp, IMAGESZ/4, IMAGESZ/4, 3*IMAGESZ/4, 3*IMAGESZ/4); cpl_test_nonnull(copy); cpl_test_error(CPL_ERROR_NONE); if (bpps[ibpp] == CPL_TYPE_UCHAR || bpps[ibpp] == CPL_TYPE_SHORT || bpps[ibpp] == CPL_TYPE_USHORT || bpps[ibpp] == CPL_TYPE_INT ) cpl_test_eq(cpl_image_get_type(copy), CPL_TYPE_INT); else if (bpps[ibpp] == CPL_TYPE_FLOAT) cpl_test_eq(cpl_image_get_type(copy), CPL_TYPE_FLOAT); else cpl_test_eq(cpl_image_get_type(copy), CPL_TYPE_DOUBLE); cpl_image_delete(copy); /* Load it again with casting */ for (ityp2 = 0; ityp2 < (int)(sizeof(imtypes)/sizeof(imtypes[0]) - 2); ityp2++) { /* The '- 2' is to avoid complex types */ const cpl_type imtype2 = imtypes[ityp2]; copy = cpl_image_load(ibpp % 2 ? FILENAME : "./" FILENAME, imtype2, 0, ibpp); cpl_test_nonnull(copy); cpl_test_eq(cpl_image_get_type(copy), imtype2); if (imtype == imtype2) { const double precision = cpl_image_get_precision(imtype, bpps[ibpp], maxval[ibpp]); cpl_test_image_abs(img, copy, precision); } cpl_image_delete(copy); copy = cpl_image_load_window(FILENAME, imtype2, 0, ibpp, 1, 1, IMAGESZ, IMAGESZ); cpl_test_nonnull(copy); cpl_test_eq(cpl_image_get_type(copy), imtype2); if (imtype == imtype2) { const double precision = cpl_image_get_precision(imtype, bpps[ibpp], maxval[ibpp]); cpl_test_image_abs(img, copy, precision); } cpl_image_delete(copy); copy = cpl_image_load_window(FILENAME, imtype2, 0, ibpp, IMAGESZ/4, IMAGESZ/4, 3*IMAGESZ/4, 3*IMAGESZ/4); cpl_test_nonnull(copy); cpl_test_eq(cpl_image_get_type(copy), imtype2); cpl_test_eq(cpl_image_get_size_x(copy), 1+IMAGESZ/2); cpl_test_eq(cpl_image_get_size_y(copy), 1+IMAGESZ/2); cpl_image_delete(copy); copy = cpl_image_load_window(FILENAME, imtype2, 0, ibpp, IMAGESZ, IMAGESZ, IMAGESZ, IMAGESZ); cpl_test_nonnull(copy); cpl_test_eq(cpl_image_get_type(copy), imtype2); cpl_test_eq(cpl_image_get_size_x(copy), 1); cpl_test_eq(cpl_image_get_size_y(copy), 1); cpl_image_delete(copy); copy = cpl_image_load_window(FILENAME, imtype2, 0, ibpp, 2, 2, 1, 1); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(copy); } } /* Append one data-less extension (DFS06130) */ cpl_test_zero(cpl_image_save(NULL, FILENAME, CPL_TYPE_UCHAR, NULL, CPL_IO_EXTEND)); cpl_test_fits(FILENAME); /* Create overflow with 8 BPP */ cpl_image_threshold(img, 256.0, 256.0, 256.0, 256.0); cpl_image_save(img, FILENAME, CPL_TYPE_UCHAR, NULL, CPL_IO_EXTEND); cpl_test_error(CPL_ERROR_FILE_IO); /* Create underflow with 16 BPP signed */ cpl_image_subtract_scalar(img, (double)(1<<15) + 256.0 + 1.0); cpl_image_save(img, FILENAME, CPL_TYPE_SHORT, NULL, CPL_IO_EXTEND); cpl_test_error(CPL_ERROR_FILE_IO); /* Create overflow with 16 BPP unsigned */ cpl_image_add_scalar(img, (double)(3<<16)); cpl_image_save(img, FILENAME, CPL_TYPE_USHORT, NULL, CPL_IO_EXTEND); cpl_test_error(CPL_ERROR_FILE_IO); if (imtype != CPL_TYPE_INT) { /* Create overflow with 32 BPP signed */ cpl_image_add_scalar(img, 4294967296.0); cpl_image_save(img, FILENAME, CPL_TYPE_INT, NULL, CPL_IO_EXTEND); cpl_test_error(CPL_ERROR_FILE_IO); } } /* End of test on saving for non-complex types */ /* Saving tests specific for double images */ if (imtype == CPL_TYPE_DOUBLE) { /* Create overflow with 32 BPP float */ cpl_image_add_scalar(img, 1e40); cpl_test_zero(cpl_image_save(img, FILENAME, CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE)); cpl_test_error(CPL_ERROR_NONE); cpl_test_fits(FILENAME); copy = cpl_image_load(FILENAME, CPL_TYPE_FLOAT, 0, 0); cpl_test_nonnull(copy); /* The file will actually be saved, with inf values all over ! */ cpl_test_leq(cpl_image_get_max(img), cpl_image_get_min(copy)); cpl_image_delete(copy); } /* Create a bad pixel map for this image */ /* FIXME: Move to cpl_image_bpm-test.c */ for (i=0; i < nbad-1; i++) cpl_test_zero(cpl_image_reject(img, bad_pos_x[i], bad_pos_y[i])); error = cpl_image_dump_structure(img, stream); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_dump_window(img, bad_pos_x[0]-1, bad_pos_y[0]-1, bad_pos_x[0]+1, bad_pos_y[0]+1, stream); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq( nbad-1, cpl_image_count_rejected(img) ); cpl_test_zero(cpl_image_reject(img, bad_pos_x[nbad-1], bad_pos_y[nbad-1])); cpl_test_eq( nbad, cpl_image_count_rejected(img) ); for (i=0; i < nbad-1; i++) cpl_test_zero(cpl_image_reject(img, bad_pos_x[i], bad_pos_y[i])); cpl_test_eq( nbad, cpl_image_count_rejected(img) ); cpl_test_zero(cpl_image_fill_rejected(img, 0.0) ); cpl_test_eq( cpl_image_count_rejected(img), nbad); /* Test cpl_image_duplicate() */ copy = cpl_image_duplicate(img); cpl_test_nonnull(copy); cpl_test_eq( cpl_image_count_rejected(copy), nbad); if ( imtype != CPL_TYPE_FLOAT_COMPLEX && imtype != CPL_TYPE_DOUBLE_COMPLEX) cpl_test_image_abs(img, copy, 0.0); else { cpl_image * real_img = cpl_image_extract_real(img); cpl_image * imag_img = cpl_image_extract_imag(img); cpl_image * real_copy = cpl_image_extract_real(copy); cpl_image * imag_copy = cpl_image_extract_imag(copy); cpl_test_image_abs(real_img, real_copy, 0.0); cpl_test_image_abs(imag_img, imag_copy, 0.0); /* Test cpl_image_conjugate() and cpl_image_fill_re_im() */ error = cpl_image_conjugate(img, img); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_multiply_scalar(imag_copy, -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_fill_re_im(real_img, imag_img, img); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(real_img, real_copy, 0.0); cpl_test_image_abs(imag_img, imag_copy, 0.0); /* Test in-place */ error = cpl_image_fill_re_im(copy, NULL, copy); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(copy, real_img, 0.0); error = cpl_image_fill_re_im(NULL, copy, copy); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_image_delete(real_img); cpl_image_delete(imag_img); cpl_image_delete(real_copy); cpl_image_delete(imag_copy); } cpl_image_delete(copy); for (ityp2 = 0; ityp2 < (int)(sizeof(imtypes)/sizeof(imtypes[0])); ityp2++) { const cpl_type imtype2 = imtypes[ityp2]; copy = cpl_image_cast(img, imtype2); if (((imtype2 == CPL_TYPE_DOUBLE || imtype2 == CPL_TYPE_FLOAT || imtype2 == CPL_TYPE_INT) && (imtype == CPL_TYPE_DOUBLE_COMPLEX || imtype == CPL_TYPE_FLOAT_COMPLEX))) { cpl_test_error(CPL_ERROR_TYPE_MISMATCH); cpl_test_null(copy); } else { cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(copy); if (imtype == imtype2) { if ( imtype != CPL_TYPE_FLOAT_COMPLEX && imtype != CPL_TYPE_DOUBLE_COMPLEX) cpl_test_image_abs(img, copy, 0.0); else { cpl_image * real_img = cpl_image_extract_real(img); cpl_image * imag_img = cpl_image_extract_imag(img); cpl_image * real_copy = cpl_image_extract_real(copy); cpl_image * imag_copy = cpl_image_extract_imag(copy); /* Test cpl_image_conjugate() and cpl_image_fill_re_im() */ error = cpl_image_conjugate(img, img); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_multiply_scalar(imag_copy, -1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_fill_re_im(real_img, imag_img, img); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(real_img, real_copy, 0.0); cpl_test_image_abs(imag_img, imag_copy, 0.0); error = cpl_image_fill_re_im(NULL, imag_img, img); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_fill_re_im(real_img, NULL, img); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(real_img, real_copy, 0.0); cpl_test_image_abs(imag_img, imag_copy, 0.0); /* Test in-place */ error = cpl_image_fill_re_im(copy, NULL, copy); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(copy, real_img, 0.0); error = cpl_image_fill_re_im(NULL, copy, copy); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_image_delete(real_img); cpl_image_delete(imag_img); cpl_image_delete(real_copy); cpl_image_delete(imag_copy); } } cpl_test_eq( cpl_image_count_rejected(copy), nbad); cpl_image_delete(copy); } } cpl_test_zero( cpl_image_accept_all(img)); cpl_test_zero( cpl_image_count_rejected(img)); cpl_image_delete(img); } /* Image compression tests */ cpl_image_save_compression_test(); cpl_test_zero( remove(FILENAME) ); if (stream != stdout) cpl_test_zero( fclose(stream) ); return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the precision obtainable for the combined types @param pixeltype The CPL image pixel type @param bpptype The CFITSIO pixel type to be used on disk @param rel2abs The largest absolute value used in the image @note Ugly, incorrect kludge for CPL_TYPE_FLOAT + CPL_TYPE_DOUBLE */ /*----------------------------------------------------------------------------*/ static double cpl_image_get_precision(cpl_type pixeltype, cpl_type bpptype, double rel2abs) { double precision = 0.0; if (pixeltype == CPL_TYPE_DOUBLE) { switch (bpptype) { case CPL_TYPE_DOUBLE: break; case CPL_TYPE_FLOAT: precision = FLT_EPSILON * rel2abs; break; default: precision = 1.0; } } else if (pixeltype == CPL_TYPE_FLOAT) { switch (bpptype) { case CPL_TYPE_DOUBLE: case CPL_TYPE_FLOAT: break; default: precision = 1.0; } } return precision; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @return void */ /*----------------------------------------------------------------------------*/ static void cpl_image_fill_int_test(void) { cpl_image * self = cpl_image_new(2, 3, CPL_TYPE_FLOAT); cpl_error_code error; error = cpl_image_fill_int(NULL, 0); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_image_fill_int(self, 0); cpl_test_eq_error(error, CPL_ERROR_TYPE_MISMATCH); cpl_image_delete(self); self = cpl_image_new(2, 3, CPL_TYPE_INT); error = cpl_image_fill_int(self, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_zero(cpl_image_get_min(self)); cpl_test_zero(cpl_image_get_max(self)); error = cpl_image_fill_int(self, -2); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_eq(cpl_image_get_min(self), -2); cpl_test_eq(cpl_image_get_max(self), -2); cpl_image_delete(self); } /*----------------------------------------------------------------------------*/ /** @brief Test saving with compression @return void @see cpl_image_save() */ /*----------------------------------------------------------------------------*/ static void cpl_image_save_compression_test(void) { /* Default CFITSIO quantization parameter for lossy floating point compression is q = 1, reducing precision to 4.08 % */ const double prec = 0.0408; const double maxval = 255.0; const cpl_type imtypes[] = {CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT}; const size_t ntyp = sizeof(imtypes)/sizeof(imtypes[0]); size_t ityp; /* Saving with different image types, bitpix and compression types */ for (ityp = 0; ityp < ntyp; ityp++) { const cpl_type bpps[] = {CPL_TYPE_UCHAR, CPL_TYPE_SHORT, CPL_TYPE_USHORT, CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE, CPL_TYPE_UNSPECIFIED}; const size_t nbpp = sizeof(bpps)/sizeof(bpps[0]); const cpl_type imtype = imtypes[ityp]; cpl_image * img = cpl_image_new(IMAGESZ, IMAGESZ, imtype); cpl_error_code error; int isig; error = cpl_image_add_scalar(img, maxval); cpl_test_eq_error(error, CPL_ERROR_NONE); for (isig=0; isig < 2; isig++) { size_t ibpp; for (ibpp = 0; ibpp < nbpp; ibpp++) { const cpl_io_type comp_meths[] = {CPL_IO_COMPRESS_GZIP, CPL_IO_COMPRESS_RICE, CPL_IO_COMPRESS_HCOMPRESS, CPL_IO_COMPRESS_PLIO}; const size_t ncomp = sizeof(comp_meths)/sizeof(comp_meths[0]); const int bitpix = cpl_tools_get_bpp(bpps[ibpp] == CPL_TYPE_UNSPECIFIED ? imtype : bpps[ibpp]); size_t icomp; int ext = 0; error = cpl_image_save(img, FILENAME, bpps[ibpp], NULL, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Tests with compression */ for (icomp = 0; icomp < ncomp; icomp++) { const cpl_io_type comp_method = comp_meths[icomp]; /* The compression method flag must be non-zero */ cpl_test(comp_method); /* Saving with compression in non supported combinations */ error = cpl_image_save(NULL, FILENAME, bpps[ibpp], NULL, CPL_IO_EXTEND | comp_method); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); /* Compression is only supported when adding new extensions, * not creating a new file and saving data in the main header */ error = cpl_image_save(img, FILENAME, bpps[ibpp], NULL, CPL_IO_CREATE | comp_method); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); for (size_t icomp2 = 0; icomp2 < icomp; icomp2++) { const cpl_io_type comp_method2 = comp_meths[icomp2]; error = cpl_image_save(img, FILENAME, bpps[ibpp], NULL, CPL_IO_EXTEND | comp_method | comp_method2); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); for (size_t icomp3 = 0; icomp3 < icomp2; icomp3++) { const cpl_io_type comp_method3 = comp_meths[icomp3]; error = cpl_image_save(img, FILENAME, bpps[ibpp], NULL, CPL_IO_EXTEND | comp_method | comp_method2 | comp_method3); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); } } error = cpl_image_save(img, FILENAME, bpps[ibpp], NULL, CPL_IO_EXTEND | CPL_IO_COMPRESS_GZIP | CPL_IO_COMPRESS_RICE | CPL_IO_COMPRESS_HCOMPRESS | CPL_IO_COMPRESS_PLIO); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_image_save(img, FILENAME, bpps[ibpp], NULL, CPL_IO_EXTEND | comp_method); if ( #ifndef CPL_IO_COMPRESSION_LOSSY /* Currently, compression only allowed with integer data */ bitpix < 0 || #endif /* FP-data compresses only to int, float or double */ /* RICE-compression supports only int, float or double */ /* In fact, this applies to all compressions... */ abs(bitpix) < 32) { cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); } else { cpl_image * img_load; cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_fits(FILENAME); ext++; cpl_test_eq( cpl_fits_count_extensions(FILENAME), ext); img_load = cpl_image_load(FILENAME, CPL_TYPE_UNSPECIFIED, 0, ext); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img_load); if (img_load != NULL) { cpl_test_eq(cpl_image_get_size_x(img_load), IMAGESZ); cpl_test_eq(cpl_image_get_size_y(img_load), IMAGESZ); if (imtype == CPL_TYPE_INT) { cpl_test_image_abs(img, img_load, 0.0); } else { cpl_test_image_abs(img, img_load, prec * maxval); } cpl_image_delete(img_load); } } } } error = cpl_image_subtract_scalar(img, maxval); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_fill_noise_uniform(img, 0.0, maxval); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_image_delete(img); } } cpl-6.4.1/cplcore/tests/cpl_image_basic-test.c0000644000460300003120000022652212272176370016225 00000000000000/* $Id: cpl_image_basic-test.c,v 1.103 2013-07-25 09:47:57 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-07-25 09:47:57 $ * $Revision: 1.103 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include "cpl_image_basic.h" #include "cpl_image_stats.h" #include "cpl_image_filter.h" #include "cpl_image_gen.h" #include "cpl_image_bpm.h" #include "cpl_image_io.h" #include "cpl_stats.h" #include "cpl_vector.h" #include "cpl_memory.h" #include "cpl_test.h" #include "cpl_math_const.h" #include "cpl_tools.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef IMAGESZ #define IMAGESZ 512 #endif #define MAGIC_PIXEL 42 #define POLY_SIZE 24 /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_image_flip_turn_test(const cpl_image *); static void cpl_image_turn_flip_test(void); static void cpl_image_copy_test(void); static void cpl_image_collapse_median_test(void); static void cpl_image_complex_mult(size_t o1, size_t o2, size_t n); static void cpl_image_complex_mult_d(size_t o1, size_t o2, size_t n); static void cpl_image_get_fwhm_test(void); static void cpl_image_divide_test_one(void); static void cpl_image_power_test(void); static void cpl_image_hypot_test(void); static void cpl_image_bitwise_test(cpl_size, cpl_size); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_image * imf1; cpl_image * imf2; cpl_image * imd1; cpl_image * imd2; cpl_image * imi1; cpl_image * imi2; cpl_image * imf; cpl_image * imd; cpl_image * imi; cpl_image * imtmp; cpl_image * imfc1; cpl_image * imfc2; cpl_image * imfc3; float complex * dataf1; float complex * dataf2; float complex * dataf3; cpl_image * imdc1; cpl_image * imdc2; cpl_image * imdc3; double complex * data1; double complex * data2; double complex * data3; cpl_vector * taylor; double * ddata; int nb_cut; const cpl_size new_pos[9] = {9, 8, 7, 6, 5, 4, 3, 2, 1}; double err; double value; int is_rejected; cpl_mask * mask; int is_bad; int i, j, k; cpl_error_code error; cpl_boolean do_bench; /* * FIXME: Ideally, we should simply use the macro I * (ISO/IEC 9899:1999(E) - Section 7.3.1 - Paragraph 4) * for arithmetics involving the imaginary unit. * * However, the usage of this macro I makes gcc issue the following * * warning: imaginary constants are a GCC extension * * when the flag --pedantic is on. * * This is a bug in gcc (seems to be related to Bugzilla #7263) and, as a * workaround in order to avoid that warning, we compute ourselves the * value of the macro. */ double complex cpl_i = csqrt(-1.0); cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); do_bench = cpl_msg_get_level() <= CPL_MSG_INFO ? CPL_TRUE : CPL_FALSE; /* Insert tests below */ cpl_image_bitwise_test(IMAGESZ, IMAGESZ); cpl_image_bitwise_test(1, 1); cpl_image_bitwise_test(17, 15); cpl_image_bitwise_test(3, 32); if (do_bench) { double secs = cpl_test_get_walltime(); for (i = 0; i < 2; i++) { cpl_image_bitwise_test(IMAGESZ/2, IMAGESZ/2); cpl_image_bitwise_test(IMAGESZ, IMAGESZ); cpl_image_bitwise_test(IMAGESZ*2, IMAGESZ*2); cpl_image_bitwise_test(IMAGESZ*4, IMAGESZ*4); } secs = cpl_test_get_walltime() - secs; cpl_msg_info(cpl_func, "Time to test bit-wise calls [s]: %g", secs); } cpl_image_hypot_test(); cpl_image_power_test(); cpl_image_divide_test_one(); cpl_image_get_fwhm_test(); cpl_image_collapse_median_test(); cpl_image_copy_test(); cpl_image_turn_flip_test(); /* Tests of cpl_image_collapse_window_create() */ /* Tests of cpl_image_collapse_create() */ imtmp = cpl_image_collapse_create(NULL, 1); cpl_test_error( CPL_ERROR_NULL_INPUT ); cpl_test_null( imtmp ); imtmp = cpl_image_collapse_window_create(NULL, 1, 1, 1, 1, 1); cpl_test_error( CPL_ERROR_NULL_INPUT ); cpl_test_null( imtmp ); imd = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE); imtmp = cpl_image_collapse_create(imd, -1); cpl_test_error( CPL_ERROR_ILLEGAL_INPUT ); cpl_test_null( imtmp ); /* Set two pixels in the last columns to 1 */ cpl_test_zero(cpl_image_set(imd, IMAGESZ-1, IMAGESZ, 1.0)); cpl_test_zero(cpl_image_set(imd, IMAGESZ, IMAGESZ, 1.0)); /* No BPM */ /* Collapse the x-direction to an image with 1 row */ imtmp = cpl_image_collapse_create(imd, 1); cpl_test_eq( cpl_image_get_type(imtmp), cpl_image_get_type(imd)); cpl_test_eq( cpl_image_get_size_x(imtmp), 1); cpl_test_eq( cpl_image_get_size_y(imtmp), IMAGESZ); cpl_test_zero( cpl_image_get(imtmp, 1, IMAGESZ-1, &is_bad)); cpl_test_zero( is_bad ); cpl_test_eq( cpl_image_get(imtmp, 1, IMAGESZ, &is_bad), 2); cpl_test_zero( is_bad ); cpl_image_delete(imtmp); imtmp = cpl_image_collapse_window_create(imd, IMAGESZ-1, IMAGESZ-1, IMAGESZ, IMAGESZ, 1); cpl_test_eq( cpl_image_get_type(imtmp), cpl_image_get_type(imd)); cpl_test_eq( cpl_image_get_size_x(imtmp), 1); cpl_test_eq( cpl_image_get_size_y(imtmp), 2); cpl_test_zero( cpl_image_get(imtmp, 1, 1, &is_bad)); cpl_test_zero( is_bad ); cpl_test_eq( cpl_image_get(imtmp, 1, 2, &is_bad), 2); cpl_test_zero( is_bad ); cpl_image_delete(imtmp); /* Collapse the y-direction to an image with 1 column */ imtmp = cpl_image_collapse_create(imd, 0); cpl_test_eq( cpl_image_get_type(imtmp), cpl_image_get_type(imd)); cpl_test_eq( cpl_image_get_size_x(imtmp), IMAGESZ); cpl_test_eq( cpl_image_get_size_y(imtmp), 1); cpl_test_eq( cpl_image_get(imtmp, IMAGESZ - 1, 1, &is_bad), 1); cpl_test_zero( is_bad ); cpl_test_eq( cpl_image_get(imtmp, IMAGESZ, 1, &is_bad), 1); cpl_test_zero( is_bad ); cpl_image_delete(imtmp); imtmp = cpl_image_collapse_window_create(imd, IMAGESZ-1, IMAGESZ-1, IMAGESZ, IMAGESZ, 0); cpl_test_eq( cpl_image_get_type(imtmp), cpl_image_get_type(imd)); cpl_test_eq( cpl_image_get_size_x(imtmp), 2); cpl_test_eq( cpl_image_get_size_y(imtmp), 1); cpl_test_eq( cpl_image_get(imtmp, 1, 1, &is_bad), 1); cpl_test_zero( is_bad ); cpl_test_eq( cpl_image_get(imtmp, 2, 1, &is_bad), 1); cpl_test_zero( is_bad ); cpl_image_delete(imtmp); /* Force creation of BPM */ mask = cpl_image_get_bpm(imd); /* Collapse the x-direction to an image with 1 row */ imtmp = cpl_image_collapse_window_create(imd, IMAGESZ-1, IMAGESZ-1, IMAGESZ, IMAGESZ, 1); cpl_test_eq( cpl_image_get_type(imtmp), cpl_image_get_type(imd)); cpl_test_eq( cpl_image_get_size_x(imtmp), 1); cpl_test_eq( cpl_image_get_size_y(imtmp), 2); cpl_test_zero( cpl_image_get(imtmp, 1, 1, &is_bad)); cpl_test_zero( is_bad ); cpl_test_eq( cpl_image_get(imtmp, 1, 2, &is_bad), 2); cpl_test_zero( is_bad ); cpl_image_delete(imtmp); /* Collapse the y-direction to an image with 1 column */ imtmp = cpl_image_collapse_window_create(imd, IMAGESZ-1, IMAGESZ-1, IMAGESZ, IMAGESZ, 0); cpl_test_eq( cpl_image_get_type(imtmp), cpl_image_get_type(imd)); cpl_test_eq( cpl_image_get_size_x(imtmp), 2); cpl_test_eq( cpl_image_get_size_y(imtmp), 1); cpl_test_eq( cpl_image_get(imtmp, 1, 1, &is_bad), 1); cpl_test_zero( is_bad ); cpl_test_eq( cpl_image_get(imtmp, 2, 1, &is_bad), 1); cpl_test_zero( is_bad ); cpl_image_delete(imtmp); /* Flag the two zero pixels in the last row as bad */ cpl_test_zero( cpl_mask_set(mask, IMAGESZ-1, IMAGESZ-1, CPL_BINARY_1)); cpl_test_zero( cpl_mask_set(mask, IMAGESZ, IMAGESZ-1, CPL_BINARY_1)); /* Collapse the x-direction to an image with 1 row */ imtmp = cpl_image_collapse_window_create(imd, IMAGESZ-1, IMAGESZ-1, IMAGESZ, IMAGESZ, 1); cpl_test_eq( cpl_image_get_type(imtmp), cpl_image_get_type(imd)); cpl_test_eq( cpl_image_get_size_x(imtmp), 1); cpl_test_eq( cpl_image_get_size_y(imtmp), 2); value = cpl_image_get(imtmp, 1, 1, &is_bad); cpl_test( is_bad ); cpl_test_eq( cpl_image_get(imtmp, 1, 2, &is_bad), 2); cpl_test_zero( is_bad ); cpl_image_delete(imtmp); /* Collapse the y-direction to an image with 1 column */ imtmp = cpl_image_collapse_window_create(imd, IMAGESZ-1, IMAGESZ-1, IMAGESZ, IMAGESZ, 0); cpl_test_eq( cpl_image_get_type(imtmp), cpl_image_get_type(imd)); cpl_test_eq( cpl_image_get_size_x(imtmp), 2); cpl_test_eq( cpl_image_get_size_y(imtmp), 1); cpl_test_eq( cpl_image_get(imtmp, 1, 1, &is_bad), 2); cpl_test_zero( is_bad ); cpl_test_eq( cpl_image_get(imtmp, 2, 1, &is_bad), 2); cpl_test_zero( is_bad ); cpl_image_delete(imtmp); /* Finished testing cpl_image_collapse_window_create() */ /* Finished testing cpl_image_collapse_create() */ cpl_image_delete(imd); /* Test for DFS 1724 */ imd1 = cpl_image_new(2, 2, CPL_TYPE_DOUBLE); imd2 = cpl_image_new(2, 2, CPL_TYPE_DOUBLE); imi1 = cpl_image_new(2, 2, CPL_TYPE_INT); imi2 = cpl_image_new(2, 2, CPL_TYPE_INT); /* Fill images with values 0, 1, 2, 3 */ value = 0.0; for (i=1; i <= 2; i++) { for (j=1; j <= 2; j++) { cpl_test_zero( cpl_image_set(imd1, i, j, value)); cpl_test_zero( cpl_image_set(imd2, i, j, value)); cpl_test_zero( cpl_image_set(imi1, i, j, value)); cpl_test_zero( cpl_image_set(imi2, i, j, value)); value++; } } /* Test cpl_image_divide_create() on integer and double */ imd = cpl_image_divide_create(imd1, imd2); cpl_test_nonnull( imd); imi = cpl_image_divide_create(imi1, imi2); cpl_test_nonnull( imi); value = 0.0; for (i=1; i <= 2; i++) { for (j=1; j <= 2; j++, value++) { const double vald = cpl_image_get(imd, i, j, &is_bad); const double vali = cpl_image_get(imi, i, j, &is_bad); if (value != 0.0) cpl_test_abs(vald, 1.0, 0.0); if (value != 0.0) cpl_test_abs(vali, 1.0, 0.0); } } /* Test with lo_cut equal to hi_cut */ error = cpl_image_threshold(imd1, (double)MAGIC_PIXEL, (double)MAGIC_PIXEL, (double)MAGIC_PIXEL, (double)MAGIC_PIXEL); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_leq( cpl_image_get_max(imd1), (double)MAGIC_PIXEL); cpl_test_leq( (double)MAGIC_PIXEL, cpl_image_get_min(imd1)); cpl_image_delete(imd1); cpl_image_delete(imd2); cpl_image_delete(imd); cpl_image_delete(imi1); cpl_image_delete(imi2); cpl_image_delete(imi); /* Test for DFS02782 */ imi = cpl_image_new(1, 1, CPL_TYPE_INT); imd = cpl_image_new(1, 1, CPL_TYPE_DOUBLE); cpl_image_set(imi, 1, 1, 10); cpl_image_set(imd, 1, 1, 0.5); imi1 = cpl_image_divide_create(imi, imd); cpl_image_delete(imi); cpl_image_delete(imd); value = cpl_image_get(imi1, 1, 1, &is_bad); cpl_test_abs(value, 20.0, 0.0); cpl_image_delete(imi1); imd = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE); /* Fill the image with a sinus */ ddata = cpl_image_get_data(imd); cpl_test_nonnull( ddata ); for (i=0; i < IMAGESZ; i++) { for (j=0; j < IMAGESZ; j++) { value = sin(i*CPL_MATH_2PI/IMAGESZ) * sin(j*CPL_MATH_2PI/IMAGESZ); if (cpl_image_set(imd, i+1, j+1, value)) break; if ( ddata[i + j * IMAGESZ] != value ) break; if (cpl_image_get(imd, i+1, j+1, &is_rejected) != value) break; if (is_rejected) break; /* Not really useful */ } cpl_test_eq( j, IMAGESZ); } imd1 = cpl_image_duplicate(imd); cpl_test_nonnull( imd1 ); cpl_test_zero( cpl_image_fft(imd1, NULL, CPL_FFT_DEFAULT) ); cpl_test_zero( cpl_image_abs(imd1) ); /* 4 FFT-components are non-zero */ value = IMAGESZ*IMAGESZ/4; err = fabs(cpl_image_get(imd1, 2, 2, &is_rejected) - value); cpl_test_zero( cpl_image_set(imd1, 2, 2, err) ); err = fabs(cpl_image_get(imd1, 2, IMAGESZ, &is_rejected) - value); cpl_test_zero( cpl_image_set(imd1, 2, IMAGESZ, err) ); err = fabs(cpl_image_get(imd1, IMAGESZ, 2, &is_rejected) - value); cpl_test_zero( cpl_image_set(imd1, IMAGESZ, 2, err) ); err = fabs(cpl_image_get(imd1, IMAGESZ, IMAGESZ, &is_rejected) - value); cpl_test_zero( cpl_image_set(imd1, IMAGESZ, IMAGESZ, err) ); err = cpl_image_get_max(imd1); cpl_msg_info("", "FFT(%g) round-off [DBL_EPSILON]: %g < %d", value, err/DBL_EPSILON, IMAGESZ*IMAGESZ); cpl_test_leq( fabs(err), IMAGESZ*IMAGESZ * DBL_EPSILON); cpl_image_delete(imd1); /* Create a Taylor-expansion of exp() */ cpl_test_nonnull( taylor = cpl_vector_new(POLY_SIZE) ); i = 0; cpl_vector_set(taylor, i, 1); for (i=1; i 0; k--) { cpl_test_zero( cpl_image_multiply(imd2, imd) ); if (k&1) { cpl_test_zero( cpl_image_add_scalar(imd2, cpl_vector_get(taylor, k-1)) ); } else { cpl_test_zero( cpl_image_subtract_scalar(imd2, -cpl_vector_get(taylor, k-1)) ); } } /* Verify the result (against cpl_image_exponential() ) */ imd1 = cpl_image_duplicate(imd); cpl_test_nonnull( imd1 ); cpl_test_zero( cpl_image_exponential(imd1, CPL_MATH_E) ); cpl_test_zero( cpl_image_subtract(imd2, imd1) ); cpl_test_zero( cpl_image_divide(imd2, imd1) ); cpl_test_zero( cpl_image_divide_scalar(imd2, DBL_EPSILON) ); cpl_test_leq( fabs(cpl_image_get_max(imd2)), 2.64494 ); cpl_test_leq( fabs(cpl_image_get_min(imd2)), 2.03626 ); cpl_image_delete(imd2); /* Evaluate exp() using cpl_image_pow() on the Taylor expansion */ imd2 = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE); cpl_test_nonnull( imd2 ); cpl_test_zero( cpl_image_add_scalar(imd2, cpl_vector_get(taylor, 0)) ); /* POLY_SIZE > 10 on alphaev56: Program received signal SIGFPE, Arithmetic exception. 0x200000a3ff0 in cpl_vector_multiply_scalar () */ for (k=1; k < POLY_SIZE; k++) { imtmp = cpl_image_duplicate(imd); cpl_test_zero( cpl_image_power(imtmp, k) ); cpl_test_zero( cpl_image_multiply_scalar(imtmp, cpl_vector_get(taylor, k)) ); cpl_test_zero( cpl_image_add(imd2, imtmp) ); cpl_image_delete(imtmp); } cpl_vector_delete(taylor); /* Much less precise than Horner ... */ cpl_test_image_abs(imd2, imd1, 16 * DBL_EPSILON); /* Verify cpl_image_logarithm() ) */ cpl_test_zero( cpl_image_logarithm(imd1, 10) ); cpl_test_zero( cpl_image_multiply_scalar(imd1, CPL_MATH_LN10) ); cpl_test_image_abs(imd, imd1, 3 * DBL_EPSILON); cpl_test_zero( cpl_image_exponential(imd, CPL_MATH_E) ); cpl_test_zero( cpl_image_copy(imd1, imd,1,1) ); cpl_test_zero( cpl_image_fft(imd1, NULL, CPL_FFT_DEFAULT) ); cpl_image_delete(imd2); imd2 = cpl_image_duplicate(imd1); cpl_test_nonnull( imd2 ); imtmp = cpl_image_duplicate(imd1); cpl_test_nonnull( imtmp ); cpl_test_zero( cpl_image_copy(imd1, imd2, 1, 1) ); cpl_test_zero( cpl_image_add(imd1, imd2) ); cpl_test_zero( cpl_image_add(imd1, imd2) ); cpl_test_zero( cpl_image_add(imd1, imd2) ); cpl_test_zero( cpl_image_subtract(imd1, imd2) ); cpl_test_zero( cpl_image_multiply_scalar(imtmp, 3) ); cpl_test_eq(cpl_image_count_rejected(imtmp), 0); cpl_test_zero( cpl_image_divide(imtmp, imd1) ); cpl_test_zero( cpl_image_abs(imtmp) ); cpl_test_abs( modf(IMAGESZ*IMAGESZ - cpl_image_get_flux(imtmp), &err), 0.0, DBL_EPSILON); cpl_test_eq(cpl_image_count_rejected(imtmp), err); cpl_test_zero( cpl_image_fft(imd1, NULL, CPL_FFT_INVERSE) ); cpl_test_zero( cpl_image_divide_scalar(imd1, 3) ); cpl_test_image_abs(imd, imd1, 32 * DBL_EPSILON); cpl_test_zero( cpl_image_copy(imd1, imd, 1, 1) ); cpl_test_zero( cpl_image_fft(imd1, NULL, CPL_FFT_INVERSE) ); cpl_test_zero( cpl_image_fft(imd1, NULL, CPL_FFT_DEFAULT) ); cpl_test_image_abs(imd, imd1, 32 * DBL_EPSILON); cpl_image_delete(imd); cpl_image_delete(imd1); cpl_image_delete(imd2); cpl_image_delete(imtmp); /* Create test images */ imd1 = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE); cpl_image_fill_noise_uniform(imd1, 1, 100); imf1 = cpl_image_cast(imd1, CPL_TYPE_FLOAT); imi1 = cpl_image_cast(imd1, CPL_TYPE_INT); cpl_image_flip_turn_test(imd1); cpl_image_flip_turn_test(imf1); cpl_image_flip_turn_test(imi1); imd2 = cpl_image_fill_test_create(IMAGESZ, IMAGESZ); cpl_image_save(imd2, "test.fits", CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE); remove("test.fits"); imf2 = cpl_image_cast(imd2, CPL_TYPE_FLOAT); imi2 = cpl_image_cast(imd2, CPL_TYPE_INT); cpl_test_nonnull( imd1 ); cpl_test_nonnull( imd2 ); cpl_test_nonnull( imf1 ); cpl_test_nonnull( imf2 ); cpl_test_nonnull( imi1 ); cpl_test_nonnull( imi2 ); /* COMPUTE imi =(imi1-imi2)*imi1/(imi1+imi2) with local functions */ cpl_msg_info("","Compute imi = (imi1-imi2)*imi1/(imi1+imi2) in INTEGER"); imi = cpl_image_duplicate(imi1); cpl_test_zero( cpl_image_subtract(imi, imi2) ); cpl_test_zero( cpl_image_multiply(imi, imi1) ); imtmp = cpl_image_duplicate(imi1); cpl_test_zero( cpl_image_add(imtmp, imi2) ); cpl_test_zero( cpl_image_divide(imi, imtmp) ); cpl_image_delete(imtmp); /* Delete imi1 and imi2 */ cpl_image_delete(imi1); cpl_image_delete(imi2); /* COMPUTE imf =(imf1-imf2)*imf1/(imf1+imf2) with local functions */ cpl_msg_info("","Compute imf = (imf1-imf2)*imf1/(imf1+imf2) in FLOAT"); imf = cpl_image_duplicate(imf1); cpl_test_zero( cpl_image_subtract(imf, imf2) ); cpl_test_zero( cpl_image_multiply(imf, imf1) ); imtmp = cpl_image_duplicate(imf1); cpl_test_zero( cpl_image_add(imtmp, imf2) ); cpl_test_zero( cpl_image_divide(imf, imtmp) ); cpl_image_delete(imtmp); /* Delete imf1 and imf2 */ cpl_image_delete(imf1); cpl_image_delete(imf2); /* COMPUTE imd =(imd1-imd2)*imd1/(imd1+imd2) with local functions */ cpl_msg_info("","Compute imd = (imd1-imd2)*imd1/(imd1+imd2) in DOUBLE"); imd = cpl_image_duplicate(imd1); cpl_test_zero( cpl_image_subtract(imd, imd2) ); cpl_test_zero( cpl_image_multiply(imd, imd1) ); imtmp = cpl_image_duplicate(imd1); cpl_test_zero( cpl_image_add(imtmp, imd2) ); cpl_test_zero( cpl_image_divide(imd, imtmp) ); cpl_image_delete(imtmp); /* Delete imd1 and imd2 */ cpl_image_delete(imd1); cpl_image_delete(imd2); /* At this point imi, imf and imd are int, resp float and double type */ /* images with the same values - apart from differences in rounding. */ /* Test cpl_image_average_create() */ cpl_image_delete( cpl_image_average_create(imf, imd) ); /* Test collapse functions */ /* Set all pixels as bad */ mask = cpl_mask_new(IMAGESZ, IMAGESZ); cpl_mask_not(mask); cpl_image_reject_from_mask(imd, mask); cpl_mask_delete(mask); /* Collapse with bad pixels */ imtmp = cpl_image_collapse_create(imd, 0); cpl_test_eq( cpl_mask_count(cpl_image_get_bpm(imtmp)), IMAGESZ); cpl_image_delete(imtmp); /* Reset the bad pixlels in imd */ cpl_image_accept_all(imd); /* Collapse */ imtmp = cpl_image_collapse_create(imd, 0); cpl_test_zero( cpl_mask_count(cpl_image_get_bpm(imtmp))); cpl_image_delete(imtmp); /* Median collapse */ imtmp = cpl_image_collapse_median_create(imf, 0, 10, 10); cpl_image_delete(imtmp); /* imf=((((imf+MAGIC_PIXEL)*MAGIC_PIXEL)-MAGIC_PIXEL)/-MAGIC_PIXEL)*/ /* with non local functions */ cpl_msg_info("","Compute imf = ((((imf+42)*42)-42)/-42)"); cpl_test_zero( cpl_image_add_scalar(imf, (double)MAGIC_PIXEL) ); cpl_test_zero( cpl_image_multiply_scalar(imf, (double)MAGIC_PIXEL) ); cpl_test_zero( cpl_image_subtract_scalar(imf, (double)MAGIC_PIXEL) ); cpl_test_zero( cpl_image_divide_scalar(imf, -(double)MAGIC_PIXEL) ); /* imd=((((imd+MAGIC_PIXEL)*MAGIC_PIXEL)-MAGIC_PIXEL)/-MAGIC_PIXEL)*/ /* with local functions */ cpl_msg_info("","Compute imd = ((((imd+42)*42)-42)/-42)"); cpl_test_zero( cpl_image_add_scalar(imd, (double)MAGIC_PIXEL) ); cpl_test_zero( cpl_image_multiply_scalar(imd, (double)MAGIC_PIXEL) ); cpl_test_zero( cpl_image_subtract_scalar(imd, (double)MAGIC_PIXEL) ); cpl_test_zero( cpl_image_divide_scalar(imd, -(double)MAGIC_PIXEL) ); /* imi=((((imi+MAGIC_PIXEL)*MAGIC_PIXEL)-MAGIC_PIXEL)/-MAGIC_PIXEL)*/ /* with local functions */ cpl_msg_info("","Compute imi = ((((imi+42)*42)-42)/-42)"); cpl_test_zero( cpl_image_add_scalar(imi, (double)MAGIC_PIXEL) ); cpl_test_zero( cpl_image_multiply_scalar(imi, (double)MAGIC_PIXEL) ); cpl_test_zero( cpl_image_subtract_scalar(imi, (double)MAGIC_PIXEL) ); cpl_test_zero( cpl_image_divide_scalar(imi, -(double)MAGIC_PIXEL) ); /* Compute imi = |imi|, imf = |imf| and imd = |imd| */ cpl_msg_info("","Take the absolute value of imi, imf and imd"); imtmp = cpl_image_abs_create(imi); cpl_image_delete(imi); imi = imtmp; imtmp = NULL; imtmp = cpl_image_abs_create(imf); cpl_image_delete(imf); imf = imtmp; imtmp = NULL; imtmp = cpl_image_abs_create(imd); cpl_image_delete(imd); imd = imtmp; imtmp = NULL; /* Test cpl_image_move() */ cpl_msg_info("","Test the pixels moving function on imd"); imd1 = cpl_image_extract(imd, 11, 11, 13, 16); nb_cut = 3; error = cpl_image_move(imd1, nb_cut, new_pos); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_image_delete(imd1); /* Test extraction w. a bad pixel */ cpl_test_zero(cpl_image_reject(imd, 12, 14)); cpl_test_eq(cpl_image_count_rejected(imd), 1); imd1 = cpl_image_extract(imd, 11, 11, 13, 16); cpl_test_eq(cpl_image_get_size_x(imd1), 3); cpl_test_eq(cpl_image_get_size_y(imd1), 6); cpl_test(cpl_image_is_rejected(imd1, 2, 4)); cpl_image_delete(imd1); /* Threshold imi, imf and imd */ cpl_msg_info("","Threshold imi, imf and imd"); cpl_image_threshold(imi, -DBL_MAX, (double)MAGIC_PIXEL, 0.0, (double)MAGIC_PIXEL); cpl_image_threshold(imf, -DBL_MAX, (double)MAGIC_PIXEL, 0.0, (double)MAGIC_PIXEL); cpl_image_threshold(imd, -DBL_MAX, (double)MAGIC_PIXEL, 0.0, (double)MAGIC_PIXEL); /* Subtract the min of the image from the image -> imi, imf and imd */ cpl_msg_info("","Subtract the minimum for imi, imf and imd"); cpl_test_zero( cpl_image_subtract_scalar(imi, cpl_image_get_min(imi)) ); cpl_test_zero( cpl_image_subtract_scalar(imf, cpl_image_get_min(imf)) ); cpl_test_zero( cpl_image_subtract_scalar(imd, cpl_image_get_min(imd)) ); /* Extract sub windows from imf and imd */ cpl_msg_info("","Extract the central part of imi, imf and imd"); imtmp = cpl_image_extract(imi, IMAGESZ/4, IMAGESZ/4, IMAGESZ/2, IMAGESZ/2); cpl_test_nonnull( imtmp ); cpl_image_delete(imi); imi = imtmp; imtmp = NULL; imtmp = cpl_image_extract(imf, IMAGESZ/4, IMAGESZ/4, IMAGESZ/2, IMAGESZ/2); cpl_test_nonnull( imtmp ); cpl_image_delete(imf); imf = imtmp; imtmp = NULL; imtmp = cpl_image_extract(imd, IMAGESZ/4, IMAGESZ/4, IMAGESZ/2, IMAGESZ/2); cpl_test_nonnull( imtmp ); cpl_image_delete(imd); imd = imtmp; imtmp = NULL; /* Test exp operation */ cpl_msg_info("","Compute exp(imi), exp(imf) and exp(imd)"); cpl_test_zero( cpl_image_exponential(imi, CPL_MATH_E) ); cpl_test_zero( cpl_image_exponential(imf, CPL_MATH_E) ); cpl_test_zero( cpl_image_exponential(imd, CPL_MATH_E) ); /* Test log operation */ cpl_msg_info("","Compute log(imi), log(imf) and log(imd)"); cpl_test_zero( cpl_image_logarithm(imi, CPL_MATH_E) ); cpl_test_zero( cpl_image_logarithm(imf, CPL_MATH_E) ); cpl_test_zero( cpl_image_logarithm(imd, CPL_MATH_E) ); /* Test ^ operation */ cpl_msg_info("","Compute imi^2, imf^2 and imd^2"); cpl_test_zero( cpl_image_power(imi, 2.0) ); cpl_test_zero( cpl_image_power(imf, 2.0) ); cpl_test_zero( cpl_image_power(imd, 2.0) ); /* Test sqrt operation */ cpl_msg_info("","Compute imf^0.5 and imd^0.5"); cpl_test_zero( cpl_image_power(imf, 0.5) ); cpl_test_zero( cpl_image_power(imd, 0.5) ); /* TEST CROSS-TYPES OPERATIONS */ cpl_msg_info("","Test cross types operations"); imtmp = cpl_image_add_create(imf, imd); cpl_msg_info("","Get mean of imf + imd : %g", cpl_image_get_mean(imtmp)); cpl_image_delete(imtmp); imtmp = cpl_image_add_create(imd, imf); cpl_msg_info("","Get mean of imd + imf : %g", cpl_image_get_mean(imtmp)); cpl_image_delete(imtmp); imtmp = cpl_image_subtract_create(imf, imd); cpl_msg_info("","Get mean of imf - imd : %g", cpl_image_get_mean(imtmp)); cpl_image_delete(imtmp); imtmp = cpl_image_subtract_create(imd, imf); cpl_msg_info("","Get mean of imd - imf : %g", cpl_image_get_mean(imtmp)); cpl_image_delete(imtmp); imtmp = cpl_image_multiply_create(imf, imd); cpl_msg_info("","Get mean of imf * imd : %g", cpl_image_get_mean(imtmp)); cpl_image_delete(imtmp); imtmp = cpl_image_multiply_create(imd, imf); cpl_msg_info("","Get mean of imd * imf : %g", cpl_image_get_mean(imtmp)); cpl_image_delete(imtmp); imtmp = cpl_image_divide_create(imf, imd); cpl_msg_info("","Get mean of imf / imd : %g", cpl_image_get_mean(imtmp)); cpl_image_delete(imtmp); imtmp = cpl_image_divide_create(imd, imf); cpl_msg_info("","Get mean of imd / imf : %g", cpl_image_get_mean(imtmp)); cpl_image_delete(imtmp); /* Normalize imf and imd */ cpl_msg_info("","Normalize imf and imd"); imtmp = cpl_image_normalise_create(imf, CPL_NORM_MEAN); cpl_test_nonnull( imtmp ); cpl_image_delete(imf); imf = imtmp; imtmp = NULL; imtmp = cpl_image_normalise_create(imd, CPL_NORM_MEAN); cpl_test_nonnull( imtmp ); cpl_image_delete(imd); imd = imtmp; imtmp = NULL; /* Test the insertion function */ cpl_msg_info("","Insert an image in an other one"); imtmp = cpl_image_duplicate(imd); cpl_image_reject(imtmp, 1, 1); cpl_test_zero( cpl_image_copy(imd, imtmp, 100, 100) ); cpl_test(cpl_image_is_rejected(imd, 100, 100)); cpl_image_delete(imtmp); /* Test the shift function */ cpl_msg_info("","Compute various shifts on imi, imf and imda"); cpl_test_zero( cpl_image_shift(imd, 1, 1) ); cpl_test_zero( cpl_image_shift(imf, 1, 1) ); cpl_test_zero( cpl_image_shift(imi, 1, 1) ); cpl_image_delete(imi); cpl_image_delete(imf); cpl_image_delete(imd); /* Test for DFS02049 : Handle the division by ZERO */ /* Divide 3 | 4 by 2 | 0 --> 1.5 | X */ /* - - - - - - */ /* 2 | 3 2 | 0 1 | X */ imtmp = cpl_image_new(2, 2, CPL_TYPE_DOUBLE); imd = cpl_image_new(2, 2, CPL_TYPE_DOUBLE); imf = cpl_image_new(2, 2, CPL_TYPE_FLOAT); imi = cpl_image_new(2, 2, CPL_TYPE_INT); for (i=0; i<2; i++) { for (j=0; j<2; j++) { if (i==0) cpl_image_set(imtmp, i+1, j+1, 2.0); cpl_image_set(imi, i+1, j+1, (double)(i+j+2)); cpl_image_set(imf, i+1, j+1, (double)(i+j+2)); cpl_image_set(imd, i+1, j+1, (double)(i+j+2)); } } imd1 = cpl_image_divide_create(imd, imtmp); imf1 = cpl_image_divide_create(imf, imtmp); imi1 = cpl_image_divide_create(imi, imtmp); cpl_test_nonnull( imd1 ); cpl_test_nonnull( imf1 ); cpl_test_nonnull( imi1 ); cpl_test_abs( cpl_image_get_flux(imd1), 2.5, 0.0 ); cpl_test_abs( cpl_image_get_flux(imf1), 2.5, 0.0 ); cpl_test_abs( cpl_image_get_flux(imi1), 2.0, 0.0 ); cpl_image_delete(imd1); cpl_image_delete(imf1); cpl_image_delete(imi1); cpl_test_zero( cpl_image_divide(imd, imtmp) ); cpl_test_zero( cpl_image_divide(imf, imtmp) ); cpl_test_zero( cpl_image_divide(imi, imtmp) ); cpl_test_abs( cpl_image_get_flux(imd), 2.5, 0.0 ); cpl_test_abs( cpl_image_get_flux(imf), 2.5, 0.0 ); cpl_test_abs( cpl_image_get_flux(imi), 2.0, 0.0 ); cpl_image_delete(imtmp); cpl_image_delete(imd); cpl_image_delete(imf); cpl_image_delete(imi); /* Test 0^0 operation */ imf = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_FLOAT); imd = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE); imf1 = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_FLOAT); imd1 = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE); cpl_msg_info("","Compute imf(0.0)^0.0"); cpl_test_zero( cpl_image_power(imf, 0.0) ); cpl_test_zero( cpl_image_power(imd, 0.0) ); cpl_test_zero( cpl_image_subtract_scalar(imf, 1.0) ); cpl_test_zero( cpl_image_subtract_scalar(imd, 1.0) ); cpl_test_image_abs(imf, imf1, 0.0); cpl_test_image_abs(imd, imd1, 0.0); cpl_image_delete(imf); cpl_image_delete(imd); cpl_image_delete(imf1); cpl_image_delete(imd1); /* New tests for complex images */ /* DOUBLE */ imdc1 = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE_COMPLEX); imdc2 = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE_COMPLEX); data1 = cpl_image_get_data_double_complex(imdc1); data2 = cpl_image_get_data_double_complex(imdc2); for (i = 0; i < IMAGESZ * IMAGESZ; i++) { data1[i] = i + i * cpl_i; data2[i] = 2 * i + 2 * i * cpl_i; } imdc3 = cpl_image_add_create(imdc1, imdc2); data3 = cpl_image_get_data_double_complex(imdc3); for (i = 0; i < IMAGESZ * IMAGESZ; i++) { cpl_test_abs( data3[i], 3 * i + 3 * i * cpl_i, 0.0 ); } cpl_image_delete(imdc1); cpl_image_delete(imdc2); cpl_image_delete(imdc3); /* FLOAT */ imfc1 = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_FLOAT_COMPLEX); imfc2 = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_FLOAT_COMPLEX); dataf1 = cpl_image_get_data_float_complex(imfc1); dataf2 = cpl_image_get_data_float_complex(imfc2); for (i = 0; i < IMAGESZ * IMAGESZ; i++) { dataf1[i] = i + i * cpl_i; dataf2[i] = 2 * i + 2 * i * cpl_i; } imfc3 = cpl_image_add_create(imfc1, imfc2); dataf3 = cpl_image_get_data_float_complex(imfc3); for (i = 0; i < IMAGESZ * IMAGESZ; i++) { cpl_test_abs( dataf3[i], 3 * i + 3 * i * cpl_i, 0.0 ); } cpl_image_delete(imfc1); cpl_image_delete(imfc2); cpl_image_delete(imfc3); /* test complex multiplication with several alignments and sizes */ cpl_image_complex_mult(0, 0, 64); cpl_image_complex_mult(1, 1, 64); cpl_image_complex_mult(1, 0, 64); cpl_image_complex_mult(0, 0, 63); cpl_image_complex_mult(1, 1, 63); cpl_image_complex_mult(1, 0, 63); /* test complex multiplication with several alignments and sizes */ cpl_image_complex_mult_d(0, 0, 64); cpl_image_complex_mult_d(1, 1, 64); cpl_image_complex_mult_d(1, 0, 64); cpl_image_complex_mult_d(0, 0, 63); cpl_image_complex_mult_d(1, 1, 63); cpl_image_complex_mult_d(1, 0, 63); /* End of tests */ return cpl_test_end(0); } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Test cpl_image_complex multiplication @param o1 image 1 offset @param o2 image 2 offset @param n npixels @return void */ /*----------------------------------------------------------------------------*/ static void cpl_image_complex_mult(size_t o1, size_t o2, size_t n) { /* test multiplication, compares vector version with scalar version */ const size_t nl = n + 2; const float complex cpl_i = csqrtf(-1.0); float complex * dataf1_ = cpl_malloc(nl * nl * sizeof(float complex)); float complex * dataf2_ = cpl_malloc(nl * nl * sizeof(float complex)); float complex * dataf3; float complex * dataf4 = cpl_malloc(n * n * sizeof(float complex)); float complex * dataf1 = dataf1_; float complex * dataf2 = dataf2_; size_t do1 = ((intptr_t)dataf1) % 16; size_t do2 = ((intptr_t)dataf2) % 16; cpl_image * imfc1; cpl_image * imfc2; cpl_msg_info(cpl_func, "Float complex vector multiply, " "size: %zu, offsets: %zu %zu", n * n, o1, o2); do1 = (do1 ? (16u - do1) / sizeof(float complex) : 0u) + o1; do2 = (do2 ? (16u - do2) / sizeof(float complex) : 0u) + o2; dataf1 = dataf1 + do1; dataf2 = dataf2 + do2; for (size_t i = 0; i < n * n; i++) { dataf1[i] = i + 12.2e-1 * i * cpl_i; dataf2[i] = 3.23 * i + 2. * i * cpl_i; } /* add multiplication overflows, ignored in -ffast-math mode */ dataf1[0] = 1e30; dataf2[0] = 1e30; dataf1[1] = -1e30; dataf2[1] = -1e30; /* only one of the vector bad */ dataf2[2] = NAN + 1e30 * cpl_i; dataf2[3] = -34.231e-5 + 4.111e+9 * cpl_i; dataf2[4] = NAN + INFINITY * cpl_i; dataf1[5] = 35.126e14 - INFINITY * cpl_i; dataf2[5] = 35.126e14 - INFINITY * cpl_i; /* subnormals */ dataf1[6] = 0.0000032e-37f - 0.0000001e-36f * cpl_i; dataf2[6] = 0.16f - INFINITY * cpl_i; dataf1[7] = 0.0000032e-37f - 0.0000001e-36f * cpl_i; dataf2[7] = 1.16f - 0.0000001e-36f * cpl_i; for (size_t i = 0; i < n * n; i++) dataf4[i] = dataf1[i] * dataf2[i]; imfc1 = cpl_image_wrap(n, n, CPL_TYPE_FLOAT_COMPLEX, dataf1); imfc2 = cpl_image_wrap(n, n, CPL_TYPE_FLOAT_COMPLEX, dataf2); dataf3 = cpl_image_get_data_float_complex(imfc1); /* multiply several times to get get multiplications * involving special float values */ for (int j = 0; j < 3; j++) { cpl_msg_info(cpl_func, "iteration: %d", j); cpl_image_multiply(imfc1, imfc2); for (size_t i = 0; i < n * n; i++) { float r1 = creal(dataf3[i]); float r2 = creal(dataf4[i]); float i1 = cimag(dataf3[i]); float i2 = cimag(dataf4[i]); if (isnan(r1) || isnan(r2)) cpl_test_eq(isnan(r1), isnan(r2)); else if (isnan(i1) || isnan(i2)) cpl_test_eq(isnan(i1), isnan(i2)); else if (!isfinite(r1) || !isfinite(r2)) cpl_test_eq(isinf(r1), isinf(r2)); else if (!isfinite(i1) || !isfinite(i2)) cpl_test_eq(isinf(i1), isinf(i2)); else { /* this test will fail if SSE is enabled but mfpmath=387, as * the comparison numbers are then generated with different * precision, the relative difference stays below ~ 1e-6, * also set mfpmath=sse for consistent results */ cpl_test_abs(i1, i2, FLT_EPSILON); cpl_test_abs(r1, r2, FLT_EPSILON); } dataf4[i] *= dataf2[i]; } } cpl_image_unwrap(imfc1); cpl_image_unwrap(imfc2); cpl_free(dataf1_); cpl_free(dataf2_); cpl_free(dataf4); } static void cpl_image_complex_mult_d(size_t o1, size_t o2, size_t n) { /* test multiplication, compares vector version with scalar version */ const size_t nl = n + 2; const double complex cpl_i = csqrt(-1.0); double complex * dataf1_ = cpl_malloc(nl * nl * sizeof(double complex)); double complex * dataf2_ = cpl_malloc(nl * nl * sizeof(double complex)); double complex * dataf3; double complex * dataf4 = cpl_malloc(n * n * sizeof(double complex)); double complex * dataf1 = dataf1_; double complex * dataf2 = dataf2_; size_t do1 = ((intptr_t)dataf1) % 16; size_t do2 = ((intptr_t)dataf2) % 16; cpl_image * imfc1; cpl_image * imfc2; cpl_msg_info(cpl_func, "Double complex vector multiply, " "size: %zu, offsets: %zu %zu", n * n, o1, o2); /* i386 aligns complex double 8 bytes */ do1 = (do1 ? (16u - do1) / sizeof(double) : 0u) + o1; do2 = (do2 ? (16u - do2) / sizeof(double) : 0u) + o2; dataf1 = (double complex *)((double *)dataf1 + do1); dataf2 = (double complex *)((double *)dataf2 + do2); for (size_t i = 0; i < n * n; i++) { dataf1[i] = i + 12.2e-1 * i * cpl_i; dataf2[i] = 3.23 * i + 2. * i * cpl_i; } /* add multiplication overflows, ignored in -ffast-math mode */ dataf1[0] = 1e30; dataf2[0] = 1e30; dataf1[1] = -1e30; dataf2[1] = -1e30; /* only one of the vector bad */ dataf2[2] = NAN + 1e30 * cpl_i; dataf2[3] = -34.231e-5 + 4.111e+9 * cpl_i; dataf2[4] = NAN + INFINITY * cpl_i; dataf1[5] = 35.126e14 - INFINITY * cpl_i; dataf2[5] = 35.126e14 - INFINITY * cpl_i; /* subnormals */ dataf1[6] = 0.00000000032e-307 - 0.0000000001e-306 * cpl_i; dataf2[6] = 0.16 - INFINITY * cpl_i; dataf1[7] = 0.0000000032e-307 - 443.1 * cpl_i; dataf2[7] = 1.16 - 0.00000000001e-306 * cpl_i; for (size_t i = 0; i < n * n; i++) dataf4[i] = dataf1[i] * dataf2[i]; imfc1 = cpl_image_wrap(n, n, CPL_TYPE_DOUBLE_COMPLEX, dataf1); imfc2 = cpl_image_wrap(n, n, CPL_TYPE_DOUBLE_COMPLEX, dataf2); dataf3 = cpl_image_get_data_double_complex(imfc1); /* multiply several times to get get multiplications * involving special double values */ for (int j = 0; j < 3; j++) { cpl_msg_info(cpl_func, "iteration: %d", j); cpl_image_multiply(imfc1, imfc2); for (size_t i = 0; i < n * n; i++) { double r1 = creal(dataf3[i]); double r2 = creal(dataf4[i]); double i1 = cimag(dataf3[i]); double i2 = cimag(dataf4[i]); if (isnan(r1) || isnan(r2)) cpl_test_eq(isnan(r1), isnan(r2)); else if (isnan(i1) || isnan(i2)) cpl_test_eq(isnan(i1), isnan(i2)); else if (!isfinite(r1) || !isfinite(r2)) cpl_test_eq(isinf(r1), isinf(r2)); else if (!isfinite(i1) || !isfinite(i2)) cpl_test_eq(isinf(i1), isinf(i2)); else { /* this test will fail if SSE is enabled but mfpmath=387, as * the comparison numbers are then generated with different * precision, the relative difference stays below ~ 1e-15, * also set mfpmath=sse for consistent results */ cpl_test_abs(i1, i2, DBL_EPSILON); cpl_test_abs(r1, r2, DBL_EPSILON); } dataf4[i] *= dataf2[i]; } } cpl_image_unwrap(imfc1); cpl_image_unwrap(imfc2); cpl_free(dataf1_); cpl_free(dataf2_); cpl_free(dataf4); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test cpl_image_copy @return void */ /*----------------------------------------------------------------------------*/ static void cpl_image_copy_test(void) { cpl_image * im1 = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE); cpl_image * im2 = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_INT); cpl_error_code error; error = cpl_image_copy(NULL, im1, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_image_copy(im1, NULL, 1, 1); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_image_copy(im1, im2, 1, 1); cpl_test_eq_error(error, CPL_ERROR_TYPE_MISMATCH); cpl_image_delete(im1); im1 = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_INT); error = cpl_image_copy(im1, im2, 0, 1); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); error = cpl_image_copy(im1, im2, 1, 0); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); error = cpl_image_copy(im1, im2, IMAGESZ+1, 1); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); error = cpl_image_copy(im1, im2, 1, IMAGESZ+1); cpl_test_eq_error(error, CPL_ERROR_ACCESS_OUT_OF_RANGE); /* Test copy of whole image */ cpl_test_zero(cpl_image_add_scalar(im1, 1.0)); cpl_test_zero(cpl_image_copy(im1, im2, 1, 1)); cpl_test_zero(cpl_image_get_max(im1)); /* Test copy of whole number of columns (all but two) */ cpl_test_zero(cpl_image_add_scalar(im1, 1.0)); cpl_test_zero(cpl_image_copy(im1, im2, 3, 1)); cpl_test_abs(cpl_image_get_flux(im1), 2.0 * IMAGESZ, 0.0); cpl_test_abs(cpl_image_get_flux_window(im1, 1, 1, 1, IMAGESZ), IMAGESZ, 0.0); cpl_test_abs(cpl_image_get_flux_window(im1, 2, 1, 2, IMAGESZ), IMAGESZ, 0.0); cpl_test_abs(cpl_image_get_flux_window(im1, 3, 1, IMAGESZ, IMAGESZ), 0.0, 0.0); /* Test copy of whole number of rows (all but two) */ cpl_test_zero(cpl_image_copy(im1, im2, 1, 1)); cpl_test_zero(cpl_image_add_scalar(im1, 1.0)); cpl_test_zero(cpl_image_copy(im1, im2, 1, 3)); cpl_test_abs(cpl_image_get_flux(im1), 2.0 * IMAGESZ, 0.0); cpl_test_abs(cpl_image_get_flux_window(im1, 1, 1, IMAGESZ, 1), IMAGESZ, 0.0); cpl_test_abs(cpl_image_get_flux_window(im1, 1, 2, IMAGESZ, 2), IMAGESZ, 0.0); cpl_test_abs(cpl_image_get_flux_window(im1, 1, 3, IMAGESZ, IMAGESZ), 0.0, 0.0); cpl_image_delete(im1); cpl_image_delete(im2); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test cpl_image_turn() and cpl_image_flip() @return void */ /*----------------------------------------------------------------------------*/ static void cpl_image_turn_flip_test(void) { const cpl_type ttype[] = {CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE}; size_t itype; const int npix[] = {1, 2, 3, 5, 10, 11}; const int buf9[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; /* Rotate this 90 degrees clockwise to get buf9 */ const int rot9[] = {7, 4, 1, 8, 5, 2, 9, 6, 3}; /* This image is not modified while wrapping around this buffer */ cpl_image * ref = cpl_image_new(3, 3, CPL_TYPE_INT); cpl_image * raw = cpl_image_new(3, 3, CPL_TYPE_INT); cpl_error_code error; cpl_test_eq_ptr(memcpy(cpl_image_get_data_int(ref), buf9, 9*sizeof(int)), cpl_image_get_data_int_const(ref)); /* Test 1: Verify direction of 90 degree rotation */ cpl_test_eq_ptr(memcpy(cpl_image_get_data_int(raw), rot9, 9*sizeof(int)), cpl_image_get_data_int_const(raw)); error = cpl_image_turn(raw, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(raw, ref, 0.0); cpl_image_delete(raw); /* Test 1a: Verify flip around x=y and x=-y */ cpl_image_flip_turn_test(ref); cpl_image_delete(ref); /* Test 2: Check error handling */ error = cpl_image_turn(NULL, 1); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); /* Test 3: Verify consistency of rotations across types */ for (itype = 0; itype < sizeof(ttype)/sizeof(ttype[0]); itype++) { const cpl_type imtype = ttype[itype]; size_t ipix; for (ipix = 0; ipix < sizeof(npix)/sizeof(npix[0]); ipix++) { const int nx = npix[ipix]; size_t jpix; for (jpix = 0; jpix < sizeof(npix)/sizeof(npix[0]); jpix++) { const int ny = npix[jpix]; cpl_mask * bpm; raw = cpl_image_new(nx, ny, imtype); error = cpl_image_fill_noise_uniform(raw, (double)-ny, (double)nx); cpl_test_eq_error(error, CPL_ERROR_NONE); /* About 1/4 of the pixels are flagged */ bpm = cpl_mask_threshold_image_create(raw, -0.25*ny, 0.25*nx); if (cpl_mask_count(bpm) < nx * ny) { /* Will not test with no good pixels */ error = cpl_image_reject_from_mask(raw, bpm); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_mask_delete(bpm); ref = cpl_image_duplicate(raw); /* Turn the image all the way around */ error = cpl_image_turn(raw, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_turn(raw, 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_turn(raw, 3); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_turn(raw, 4); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_turn(raw,-1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_turn(raw,-2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_turn(raw,-3); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_turn(raw, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(raw, ref, 0.0); /* Flip the image all the way around */ error = cpl_image_flip(raw, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_flip(raw, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_flip(raw, 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_flip(raw, 3); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_flip(raw, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_flip(raw, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_flip(raw, 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_flip(raw, 3); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(raw, ref, 0.0); cpl_image_delete(ref); cpl_image_delete(raw); } } } return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test cpl_image_collapse_median_create() @return void */ /*----------------------------------------------------------------------------*/ static void cpl_image_collapse_median_test(void) { const int mx = IMAGESZ | 1; const int my = IMAGESZ/2 | 1; const cpl_type types[] = {CPL_TYPE_DOUBLE_COMPLEX, CPL_TYPE_FLOAT_COMPLEX}; const cpl_type imtypes[] = {CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT}; cpl_image * null; int ityp; null = cpl_image_collapse_median_create(NULL, 0, 0, 0); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(null); /* Iterate through all non-supported pixel types */ for (ityp = 0; ityp < (int)(sizeof(types)/sizeof(types[0])); ityp++) { const cpl_type imtype = types[ityp]; cpl_image * img = cpl_image_new(mx, my, imtype); cpl_test_nonnull(img); null = cpl_image_collapse_median_create(img, 0, 0, 0); cpl_test_error(CPL_ERROR_INVALID_TYPE); cpl_test_null(null); cpl_image_delete(img); } /* Iterate through all supported pixel types */ for (ityp = 0; ityp < (int)(sizeof(imtypes)/sizeof(imtypes[0])); ityp++) { const cpl_type imtype = imtypes[ityp]; cpl_image * img = cpl_image_new(mx, my, imtype); int idrop; cpl_test_nonnull(img); cpl_image_fill_noise_uniform(img, 0.0, IMAGESZ); null = cpl_image_collapse_median_create(img, 0, my, 0); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(null); null = cpl_image_collapse_median_create(img, 0, 0, my); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(null); null = cpl_image_collapse_median_create(img, 1, 0, mx); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(null); null = cpl_image_collapse_median_create(img, 1, mx, 0); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(null); null = cpl_image_collapse_median_create(img, 2, 0, 0); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); cpl_test_null(null); /* Iterate through various drop combinations for dir == 0 */ for (idrop = 0; idrop * 2 < 5; idrop ++) { cpl_image * filt = cpl_image_new(mx, 1 + 2 * idrop, imtype); cpl_mask * mask = cpl_mask_new(1, my - 2 * idrop); int jdrop; cpl_error_code error; cpl_mask_not(mask); error = cpl_image_filter_mask(filt, img, mask, CPL_FILTER_MEDIAN, CPL_BORDER_CROP); cpl_test_eq_error(error, CPL_ERROR_NONE); for (jdrop = 0; jdrop <= 2 * idrop; jdrop++) { cpl_image * med = cpl_image_collapse_median_create(img, 0, jdrop, 2 * idrop - jdrop); cpl_image * img1d = cpl_image_extract(filt, 1, 1 + jdrop, mx, 1 + jdrop); int k, is_bad, is_bad2; cpl_test_nonnull(med); cpl_test_nonnull(img1d); cpl_test_eq(cpl_image_get_type(med), imtype); cpl_test_eq(cpl_image_get_size_x(med), mx); cpl_test_eq(cpl_image_get_size_y(med), 1); cpl_test_image_abs(med, img1d, 0.0); cpl_image_delete(med); /* Fail on all bad pixels */ cpl_mask_not(cpl_image_get_bpm(img)); cpl_test_eq(cpl_image_count_rejected(img), mx * my); null = cpl_image_collapse_median_create(img, 0, jdrop, 2 * idrop - jdrop); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(null); /* Accept all pixels in one column */ for (k = 1; k <= my; k++) { cpl_image_accept(img, mx/2, k); } cpl_test_eq(cpl_image_count_rejected(img), mx * my - my); med = cpl_image_collapse_median_create(img, 0, jdrop, 2 * idrop - jdrop); cpl_test_nonnull(med); cpl_test_eq(cpl_image_count_rejected(med), mx - 1); cpl_test_abs(cpl_image_get(med, mx/2, 1, &is_bad), cpl_image_get(img1d, mx/2, 1, &is_bad2), 0.0); cpl_test_zero(is_bad); cpl_test_zero(is_bad2); cpl_test_abs(cpl_image_get(med, 1, 1, &is_bad), 0.0, 0.0); cpl_test(is_bad); cpl_image_delete(med); cpl_image_delete(img1d); cpl_image_accept_all(img); /* Accept all pixels in one row */ cpl_mask_not(cpl_image_get_bpm(img)); for (k = 1; k <= mx; k++) { cpl_image_accept(img, k, my/2); } med = cpl_image_collapse_median_create(img, 0, jdrop, 2 * idrop - jdrop); cpl_test_nonnull(med); cpl_test_zero(cpl_image_count_rejected(med)); img1d = cpl_image_extract(img, 1, my/2, mx, my/2); cpl_test_image_abs(med, img1d, 0.0); cpl_image_delete(img1d); cpl_image_delete(med); cpl_image_accept_all(img); } cpl_image_delete(filt); cpl_mask_delete(mask); } /* Iterate through various drop combinations for dir == 1 */ for (idrop = 0; idrop * 2 < 5; idrop ++) { cpl_image * filt = cpl_image_new(1 + 2 * idrop, my, imtype); cpl_mask * mask = cpl_mask_new(mx - 2 * idrop, 1); int jdrop; cpl_error_code error; cpl_mask_not(mask); error = cpl_image_filter_mask(filt, img, mask, CPL_FILTER_MEDIAN, CPL_BORDER_CROP); cpl_test_eq_error(error, CPL_ERROR_NONE); for (jdrop = 0; jdrop <= 2 * idrop; jdrop++) { cpl_image * med = cpl_image_collapse_median_create(img, 1, jdrop, 2 * idrop - jdrop); cpl_image * img1d = cpl_image_extract(filt, 1 + jdrop, 1, 1 + jdrop, my); int k, is_bad, is_bad2; cpl_test_nonnull(med); cpl_test_nonnull(img1d); cpl_test_eq(cpl_image_get_type(med), imtype); cpl_test_eq(cpl_image_get_size_x(med), 1); cpl_test_eq(cpl_image_get_size_y(med), my); cpl_test_image_abs(med, img1d, 0.0); cpl_image_delete(med); /* Fail on all bad pixels */ cpl_mask_not(cpl_image_get_bpm(img)); cpl_test_eq(cpl_image_count_rejected(img), mx * my); null = cpl_image_collapse_median_create(img, 1, jdrop, 2 * idrop - jdrop); cpl_test_error(CPL_ERROR_DATA_NOT_FOUND); cpl_test_null(null); /* Accept all pixels in one row */ for (k = 1; k <= mx; k++) { cpl_image_accept(img, k, my/2); } cpl_test_eq(cpl_image_count_rejected(img), mx * my - mx); med = cpl_image_collapse_median_create(img, 1, jdrop, 2 * idrop - jdrop); cpl_test_nonnull(med); cpl_test_eq(cpl_image_count_rejected(med), my - 1); cpl_test_abs(cpl_image_get(med, 1, my/2, &is_bad), cpl_image_get(img1d, 1, my/2, &is_bad2), 0.0); cpl_test_zero(is_bad); cpl_test_zero(is_bad2); cpl_test_abs(cpl_image_get(med, 1, 1, &is_bad), 0.0, 0.0); cpl_test(is_bad); cpl_image_delete(med); cpl_image_accept_all(img); cpl_image_delete(img1d); /* Accept all pixels in one column */ cpl_mask_not(cpl_image_get_bpm(img)); for (k = 1; k <= my; k++) { cpl_image_accept(img, mx/2, k); } med = cpl_image_collapse_median_create(img, 1, jdrop, 2 * idrop - jdrop); cpl_test_nonnull(med); cpl_test_zero(cpl_image_count_rejected(med)); img1d = cpl_image_extract(img, mx/2, 1, mx/2, my); cpl_test_image_abs(med, img1d, 0.0); cpl_image_delete(img1d); cpl_image_delete(med); cpl_image_accept_all(img); } cpl_image_delete(filt); cpl_mask_delete(mask); } cpl_image_delete(img); } return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test cpl_image_flip(), cpl_image_turn() @param self The image to test @return void @see cpl_mask_flip_turn_test() A: Rotate 90 counterclock-wise, then flip around the vertical axis, then flip around x=y, and it should be back to its original. B: Rotate 90 counterclock-wise, then flip around the horizontal axis, then flip around x=-y, and it should be back to its original. */ /*----------------------------------------------------------------------------*/ static void cpl_image_flip_turn_test(const cpl_image * self) { cpl_error_code error; cpl_image * tmp = cpl_image_duplicate(self); error = cpl_image_turn(tmp, -1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_flip(tmp, 2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_flip(tmp, 1); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(self, tmp, 0.0); error = cpl_image_turn(tmp, -1); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_flip(tmp, 0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_image_flip(tmp, 3); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_image_abs(self, tmp, 0.0); cpl_image_delete(tmp); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @return void @see cpl_image_get_fwhm() */ /*----------------------------------------------------------------------------*/ static void cpl_image_get_fwhm_test(void) { /* Test case for DFS12346 */ const double x[] = { -13.9055, -2.24811, -4.60207, 12.0745, -9.29113, 19.4861, 17.6999, 32.2417, 68.0725, 120.824, 172.361, 242.671, 302.048, 355.937, 348.458, 309.819, 240.489, 179.107, 117.223, 66.3061, 32.7849, 22.9367, }; const cpl_size sz = (cpl_size)(sizeof(x)/sizeof(x[0])); /* x will _not_ be modified */ cpl_image * im1d = cpl_image_wrap_double(sz, 1, (double*)x); cpl_size xmaxpos, ymaxpos; double xfwhm, yfwhm, xref; cpl_error_code code; cpl_msg_info(cpl_func, "Testing cpl_image_get_fwhm() with %u elements", (unsigned)sz); code = cpl_image_get_maxpos(im1d, &xmaxpos, &ymaxpos); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_eq(xmaxpos, 14); cpl_test_eq(ymaxpos, 1); /* Test some error input */ code = cpl_image_get_fwhm(NULL, xmaxpos, ymaxpos, &xfwhm, &yfwhm); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); code = cpl_image_get_fwhm(im1d, xmaxpos, ymaxpos, NULL, &yfwhm); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); code = cpl_image_get_fwhm(im1d, xmaxpos, ymaxpos, &xfwhm, NULL); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); code = cpl_image_get_fwhm(im1d, 0, ymaxpos, &xfwhm, &yfwhm); cpl_test_eq_error(code, CPL_ERROR_ACCESS_OUT_OF_RANGE); code = cpl_image_get_fwhm(im1d, xmaxpos, 0, &xfwhm, &yfwhm); cpl_test_eq_error(code, CPL_ERROR_ACCESS_OUT_OF_RANGE); code = cpl_image_get_fwhm(im1d, 0, ymaxpos, &xfwhm, &yfwhm); cpl_test_eq_error(code, CPL_ERROR_ACCESS_OUT_OF_RANGE); code = cpl_image_get_fwhm(im1d, sz+1, ymaxpos, &xfwhm, &yfwhm); cpl_test_eq_error(code, CPL_ERROR_ACCESS_OUT_OF_RANGE); code = cpl_image_get_fwhm(im1d, xmaxpos, 2, &xfwhm, &yfwhm); cpl_test_eq_error(code, CPL_ERROR_ACCESS_OUT_OF_RANGE); code = cpl_image_get_fwhm(im1d, ymaxpos, ymaxpos, &xfwhm, &yfwhm); cpl_test_eq_error(code, CPL_ERROR_DATA_NOT_FOUND); /* Test with valid input */ code = cpl_image_get_fwhm(im1d, xmaxpos, ymaxpos, &xfwhm, &yfwhm); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_abs(xfwhm, 6.7434, 1e-4); cpl_test_abs(yfwhm, -1.0, 0.0); /* Rotate the image 90 degrees (this does not modfy the pixel buffer) */ code = cpl_image_turn(im1d, -1); cpl_test_eq_error(code, CPL_ERROR_NONE); /* Call again, with x/y variables swapped */ xref = xfwhm; code = cpl_image_get_fwhm(im1d, ymaxpos, xmaxpos, &yfwhm, &xfwhm); cpl_test_eq_error(code, CPL_ERROR_NONE); /* Expect exactly same result */ cpl_test_abs(xfwhm, xref, 0.0); cpl_test_abs(yfwhm, -1.0, 0.0); cpl_test_eq_ptr((const void*)x, cpl_image_unwrap(im1d)); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @return void @see cpl_image_divide() */ /*----------------------------------------------------------------------------*/ static void cpl_image_divide_test_one(void) { cpl_image * img1 = cpl_image_new(1, 2, CPL_TYPE_DOUBLE); cpl_image * img2 = cpl_image_new(1, 2, CPL_TYPE_DOUBLE); cpl_error_code code; code = cpl_image_add_scalar(img1, 5.0); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_add_scalar(img2, 1.0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_abs(cpl_image_get_flux(img1), 10.0, DBL_EPSILON); cpl_test_zero(cpl_image_count_rejected(img1)); cpl_test_zero(cpl_image_count_rejected(img2)); code = cpl_image_reject(img1, 1, 1); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_eq(cpl_image_count_rejected(img1), 1); cpl_test_abs(cpl_image_get_flux(img1), 5.0, DBL_EPSILON); code = cpl_image_divide(img1, img2); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_abs(cpl_image_get_flux(img1), 5.0, DBL_EPSILON); cpl_test_eq(cpl_image_count_rejected(img1), 1); cpl_image_delete(img1); cpl_image_delete(img2); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @return void @see cpl_image_power() */ /*----------------------------------------------------------------------------*/ static void cpl_image_hypot_test(void) { const cpl_type htype[2] = {CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE}; for (int i1type = 0; i1type < 2; i1type++) { for (int i2type = 0; i2type < 2; i2type++) { for (int i3type = 0; i3type < 2; i3type++) { const double tol = htype[i1type] == CPL_TYPE_FLOAT || htype[i2type] == CPL_TYPE_FLOAT || htype[i3type] == CPL_TYPE_FLOAT ? 40.0 * FLT_EPSILON : 40.0 * DBL_EPSILON; cpl_image * img1 = cpl_image_new(IMAGESZ, IMAGESZ, htype[i1type]); cpl_image * img2 = cpl_image_new(IMAGESZ, IMAGESZ, htype[i2type]); cpl_image * img3 = cpl_image_new(IMAGESZ, IMAGESZ, htype[i3type]); cpl_image * img1copy; cpl_image * img2copy; cpl_error_code code; code = cpl_image_fill_noise_uniform(img1, 1.0, MAGIC_PIXEL); cpl_test_eq_error(code, CPL_ERROR_NONE); img1copy = cpl_image_duplicate(img1); code = cpl_image_fill_noise_uniform(img2, 1.0, MAGIC_PIXEL); cpl_test_eq_error(code, CPL_ERROR_NONE); img2copy = cpl_image_duplicate(img2); code = cpl_image_hypot(img3, img1, img2); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_power(img1, 2.0); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_power(img2, 2.0); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_add(img1, img2); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_power(img1, 0.5); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_image_abs(img1, img3, tol); code = cpl_image_hypot(img1copy, NULL, img2copy); cpl_test_eq_error(code, CPL_ERROR_NONE); /* The in-place is not as accurate (w. all float data) ... */ cpl_test_image_abs(img1copy, img3, 1.5 * tol); cpl_image_delete(img1); cpl_image_delete(img2); cpl_image_delete(img3); /* Verify handling of incompatible size */ img3 = cpl_image_new(IMAGESZ+1, IMAGESZ, htype[i1type]); code = cpl_image_hypot(img3, img1copy, img2copy); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = cpl_image_hypot(img1copy, img3, img2copy); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = cpl_image_hypot(img1copy, img2copy, img3); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = cpl_image_hypot(img3, NULL, img2copy); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = cpl_image_hypot(img2copy, NULL, img3); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_image_delete(img3); /* Verify handling of unsupported type */ img3 = cpl_image_new(IMAGESZ+1, IMAGESZ, htype[i1type] | CPL_TYPE_COMPLEX); code = cpl_image_hypot(img3, img1copy, img2copy); cpl_test_eq_error(code, CPL_ERROR_INVALID_TYPE); code = cpl_image_hypot(img1copy, img3, img2copy); cpl_test_eq_error(code, CPL_ERROR_INVALID_TYPE); code = cpl_image_hypot(img1copy, img2copy, img3); cpl_test_eq_error(code, CPL_ERROR_INVALID_TYPE); code = cpl_image_hypot(img3, NULL, img2copy); cpl_test_eq_error(code, CPL_ERROR_INVALID_TYPE); code = cpl_image_hypot(img2copy, NULL, img3); cpl_test_eq_error(code, CPL_ERROR_INVALID_TYPE); cpl_image_delete(img3); /* Verify handling of NULL pointers */ code = cpl_image_hypot(img1copy, img2copy, NULL); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); code = cpl_image_hypot(NULL, img1copy, img2copy); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); cpl_image_delete(img1copy); cpl_image_delete(img2copy); } } } } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @return void @see cpl_image_power() */ /*----------------------------------------------------------------------------*/ static void cpl_image_power_test(void) { cpl_image * img1 = cpl_image_new(IMAGESZ, IMAGESZ, CPL_TYPE_DOUBLE); cpl_image * img2; cpl_error_code code; /* Avoid division by zero for now */ code = cpl_image_fill_noise_uniform(img1, 1.0, MAGIC_PIXEL); cpl_test_eq_error(code, CPL_ERROR_NONE); img2 = cpl_image_power_create(img1, 1.0); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img2); code = cpl_image_power(img1, -2.0); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_power(img1, -0.5); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_image_abs(img1, img2, 40.0 * DBL_EPSILON); cpl_image_delete(img2); img2 = cpl_image_power_create(img1, 1.0); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(img2); code = cpl_image_power(img1, -3.0); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_power(img1, -1.0/3.0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_image_abs(img1, img2, 100.0 * DBL_EPSILON); cpl_image_delete(img1); cpl_image_delete(img2); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @return void @see cpl_image_and(), cpl_image_or(), cpl_image_xor() */ /*----------------------------------------------------------------------------*/ static void cpl_image_bitwise_test(cpl_size nx, cpl_size ny) { cpl_error_code (*fimage[3])(cpl_image *, const cpl_image *, const cpl_image *) = {cpl_image_and, cpl_image_or, cpl_image_xor}; cpl_error_code (*fscalar[3])(cpl_image *, const cpl_image *, cpl_bitmask) = {cpl_image_and_scalar, cpl_image_or_scalar, cpl_image_xor_scalar}; const size_t nfunc = sizeof(fimage)/sizeof(*fimage); cpl_image * imf = cpl_image_new(nx, ny, CPL_TYPE_FLOAT); cpl_image * im01 = cpl_image_new(nx, ny + 1, CPL_TYPE_INT); cpl_image * im10 = cpl_image_new(nx + 1, ny, CPL_TYPE_INT); cpl_image * im0 = cpl_image_new(nx, ny, CPL_TYPE_INT); cpl_image * im1 = cpl_image_new(nx, ny, CPL_TYPE_INT); cpl_image * im2 = cpl_image_new(nx, ny, CPL_TYPE_INT); cpl_mask * mask0 = cpl_mask_new(nx, ny); cpl_error_code code; cpl_test_eq( sizeof(fimage), sizeof(fscalar)); /* Test the handling of the 3 possible error types for all 7 functions */ for (size_t i = 0; i < nfunc; i++) { const cpl_image * im3 = im1; for (size_t i2 = 0; i2 < 2; i2++, im3 = NULL) { code = fimage[i](NULL, im3, im2); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); code = fimage[i](im1, im3, NULL); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); code = fscalar[i](NULL, im3, 0); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); code = fimage[i](im01, im3, im2); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = fimage[i](im10, im3, im2); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = fimage[i](im1, im3, im01); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = fimage[i](im1, im3, im10); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = fimage[i](imf, im3, im2); cpl_test_eq_error(code, CPL_ERROR_INVALID_TYPE); code = fimage[i](im1, im3, imf); cpl_test_eq_error(code, CPL_ERROR_INVALID_TYPE); code = fscalar[i](imf, im3, 0); cpl_test_eq_error(code, CPL_ERROR_INVALID_TYPE); if (i == 0) { code = cpl_image_not(NULL, im3); cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT); code = cpl_image_not(imf, im3); cpl_test_eq_error(code, CPL_ERROR_INVALID_TYPE); } } code = fimage[i](im1, im01, im2); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = fimage[i](im1, im10, im2); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = fscalar[i](im1, im01, 0); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = fscalar[i](im1, im10, 0); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = fscalar[i](im01, im1, 0); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = fscalar[i](im10, im1, 0); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = fimage[i](im1, imf, im2); cpl_test_eq_error(code, CPL_ERROR_INVALID_TYPE); code = fscalar[i](im1, imf, 0); cpl_test_eq_error(code, CPL_ERROR_INVALID_TYPE); } code = cpl_image_not(im1, im01); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = cpl_image_not(im1, im10); cpl_test_eq_error(code, CPL_ERROR_INCOMPATIBLE_INPUT); code = cpl_image_fill_noise_uniform(im1, -cpl_tools_ipow(2.0, 31), cpl_tools_ipow(2.0, 31) - 1.0); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_not(im2, im1); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_or(im0, im1, im2); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_mask_threshold_image(mask0, im0, -1.5, -0.5, CPL_BINARY_0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_zero(cpl_mask_count(mask0)); code = cpl_image_xor(im0, im1, im2); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_mask_threshold_image(mask0, im0, -1.5, -0.5, CPL_BINARY_0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_zero(cpl_mask_count(mask0)); code = cpl_image_and(im0, im1, im2); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_mask_threshold_image(mask0, im0, -0.5, 0.5, CPL_BINARY_0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_zero(cpl_mask_count(mask0)); code = cpl_image_and_scalar(im0, im1, 15); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_mask_threshold_image(mask0, im0, -0.5, 15.5, CPL_BINARY_0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_zero(cpl_mask_count(mask0)); if (cpl_mask_count(mask0)) { int idummy; cpl_test_eq(cpl_image_get(im0, 1, 1, &idummy), 15); } code = cpl_image_and_scalar(im0, im1, 0); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_mask_threshold_image(mask0, im0, -0.5, 0.5, CPL_BINARY_0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_zero(cpl_mask_count(mask0)); code = cpl_image_and_scalar(im0, im1, 15); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_mask_threshold_image(mask0, im0, -0.5, 15.5, CPL_BINARY_0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_zero(cpl_mask_count(mask0)); code = cpl_image_and_scalar(im0, im1, (cpl_bitmask)-1); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_image_abs(im0, im1, 0.0); code = cpl_image_or_scalar(im0, im1, 0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_image_abs(im0, im1, 0.0); code = cpl_image_xor_scalar(im0, im1, 0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_image_abs(im0, im1, 0.0); code = cpl_image_or_scalar(im0, im1, (cpl_bitmask)-1); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_mask_threshold_image(mask0, im0, -1.5, -0.5, CPL_BINARY_0); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_zero(cpl_mask_count(mask0)); code = cpl_image_xor_scalar(im0, im1, (cpl_bitmask)-1); cpl_test_eq_error(code, CPL_ERROR_NONE); code = cpl_image_not(im0, NULL); cpl_test_eq_error(code, CPL_ERROR_NONE); cpl_test_image_abs(im0, im1, 0.0); cpl_image_delete(imf); cpl_image_delete(im01); cpl_image_delete(im10); cpl_image_delete(im0); cpl_image_delete(im1); cpl_image_delete(im2); cpl_mask_delete(mask0); } cpl-6.4.1/cplcore/tests/cpl_type-test.c0000644000460300003120000001324011545313331014742 00000000000000/* $Id: cpl_type-test.c,v 1.10 2011-04-01 09:11:53 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-04-01 09:11:53 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_type.h" #include "cpl_test.h" #include #include /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { typedef struct { cpl_type type; size_t size; } typelist; const typelist supported[] = { {CPL_TYPE_INVALID, 0}, {CPL_TYPE_STRING, sizeof(char)}, {CPL_TYPE_CHAR, sizeof(char)}, {CPL_TYPE_UCHAR, sizeof(unsigned char)}, {CPL_TYPE_BOOL, sizeof(cpl_boolean)}, {CPL_TYPE_SHORT, sizeof(short)}, {CPL_TYPE_USHORT, sizeof(unsigned short)}, {CPL_TYPE_INT, sizeof(int)}, {CPL_TYPE_UINT, sizeof(unsigned int)}, {CPL_TYPE_LONG, sizeof(long int)}, {CPL_TYPE_ULONG, sizeof(unsigned long int)}, {CPL_TYPE_LONG_LONG, sizeof(long long int)}, {CPL_TYPE_FLOAT, sizeof(float)}, {CPL_TYPE_DOUBLE, sizeof(double)}, {CPL_TYPE_FLOAT_COMPLEX, sizeof(float complex)}, {CPL_TYPE_DOUBLE_COMPLEX, sizeof(double complex)}, {CPL_TYPE_UNSPECIFIED, 0}, {CPL_TYPE_POINTER, sizeof(void*)}}; const int nsupported = (int)(sizeof(supported) / sizeof(typelist)); const char * empty; int i; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ cpl_test_zero(CPL_FALSE); cpl_test_noneq(CPL_FALSE, CPL_TRUE); for (i = 0; i < nsupported; i++) { const char * name = cpl_type_get_name(supported[i].type); cpl_msg_info(cpl_func, "Testing type: %s (size=%u)", name, (unsigned)supported[i].size); cpl_test_eq(cpl_type_get_sizeof(supported[i].type), supported[i].size); cpl_test_eq(cpl_type_get_sizeof(supported[i].type | CPL_TYPE_FLAG_ARRAY), supported[i].size); cpl_test_nonnull(name); if (supported[i].size != 0) { const char * array = cpl_type_get_name(supported[i].type | CPL_TYPE_POINTER); cpl_test_nonnull(array); if (array != NULL) { if (name != NULL) { /* Array name starts with type name, e.g. "double array" */ cpl_test_eq_string(strstr(array, name), array); } if (supported[i].type != CPL_TYPE_POINTER) { /* And also contains the sub-string " array" */ cpl_test_nonnull(strstr(array, " array")); } else { cpl_test_null(strstr(array, " array")); } } } /* Get a new name by combining with flag array */ /* Cannot be done for pointer, nor for char/string since those two are defined using this combination */ if (supported[i].size != 0 && supported[i].type != CPL_TYPE_POINTER && supported[i].type != CPL_TYPE_STRING && supported[i].type != CPL_TYPE_CHAR) { const char * array = cpl_type_get_name(supported[i].type | CPL_TYPE_FLAG_ARRAY); cpl_test_nonnull(array); if (array != NULL) { if (name != NULL) { /* Array name starts with type name, e.g. "double array" */ cpl_test_eq_string(strstr(array, name), array); } /* And also contains the sub-string " array" */ cpl_test_nonnull(strstr(array, " array")); } } } cpl_test_nonnull(cpl_type_get_name(CPL_TYPE_FLAG_ARRAY)); /* Unsupported combination */ empty = cpl_type_get_name(CPL_TYPE_POINTER | CPL_TYPE_FLAG_ARRAY); cpl_test_error(CPL_ERROR_INVALID_TYPE); cpl_test_nonnull(empty); if (empty != NULL) cpl_test_zero(*empty); return cpl_test_end(0); } cpl-6.4.1/cplcore/tests/cpl_bivector-test.c0000644000460300003120000005077311502153122015603 00000000000000/* $Id: cpl_bivector-test.c,v 1.38 2010-12-15 14:53:06 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-12-15 14:53:06 $ * $Revision: 1.38 $ * $Name: not supported by cvs2svn $ */ #include #include #include #include #include #include "cpl_bivector.h" #include "cpl_test.h" #include "cpl_tools.h" #include "cpl_memory.h" #include "cpl_math_const.h" #ifndef FUNCTION_SIZE #define FUNCTION_SIZE 1024 #endif #define LIN_SIZE 3 #define POL_SIZE 3 static void cpl_bivector_sort_test(void); static void cpl_bivector_sort_random(int); static cpl_error_code cpl_bivector_sort_ok(cpl_bivector *, const cpl_bivector *, cpl_sort_direction, cpl_sort_mode, int); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_bivector * sinus; cpl_bivector * cosinus; cpl_bivector * tmp_fun; cpl_bivector * source; double * data_x, * data_y; const double * dnull; const cpl_vector* vnull; cpl_vector * vec1; cpl_vector * vec2; cpl_vector * vec3; const double scale = CPL_MATH_2PI / FUNCTION_SIZE; FILE * f_out; const char * filename = "cpl_bivector_dump.txt"; cpl_error_code error; const double linear[LIN_SIZE] = {2.0, 3.0, 4.0}; const double interpol[POL_SIZE] = {CPL_MATH_LN10, CPL_MATH_E, CPL_MATH_PI}; int i; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); cpl_bivector_sort_test(); cpl_bivector_sort_random(1); cpl_bivector_sort_random(21); cpl_bivector_sort_random(41); cpl_bivector_sort_random(100); cpl_bivector_sort_random(1001); /* Test 1: NULL input to accessors */ i = cpl_bivector_get_size(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_lt(i, 0); dnull = cpl_bivector_get_x_data(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(dnull); dnull = cpl_bivector_get_x_data_const(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(dnull); dnull = cpl_bivector_get_y_data(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(dnull); dnull = cpl_bivector_get_y_data_const(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(dnull); vnull = cpl_bivector_get_x(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(vnull); vnull = cpl_bivector_get_x_const(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(vnull); vnull = cpl_bivector_get_y(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(vnull); vnull = cpl_bivector_get_y_const(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_null(vnull); /* Create the first 1d function : sinus function */ cpl_test_nonnull( sinus = cpl_bivector_new(FUNCTION_SIZE) ); /* Fill the sinus function */ data_x = cpl_bivector_get_x_data(sinus); data_y = cpl_bivector_get_y_data(sinus); cpl_test_eq_ptr(cpl_bivector_get_x_data_const(sinus), data_x); cpl_test_eq_ptr(cpl_bivector_get_y_data_const(sinus), data_y); for (i = 0; i < FUNCTION_SIZE; i++) { data_x[i] = i * scale; data_y[i] = sin(data_x[i]); } /* Create the second 1d function : cosinus function */ cpl_test_nonnull (cosinus = cpl_bivector_new(FUNCTION_SIZE)); /* Fill the cosinus function */ data_x = cpl_bivector_get_x_data(cosinus); data_y = cpl_bivector_get_y_data(cosinus); for (i = 0; i < FUNCTION_SIZE; i++) { data_x[i] = i * scale - CPL_MATH_PI; data_y[i] = cos(data_x[i]); } /* Test cpl_bivector_get_y() */ cpl_test_nonnull( cpl_bivector_get_y(sinus) ); cpl_test_nonnull( cpl_bivector_get_x(sinus) ); cpl_test_noneq_ptr( cpl_bivector_get_x(sinus), cpl_bivector_get_y(sinus) ); /* Test cpl_bivector_get_size() */ cpl_test_eq( cpl_bivector_get_size(sinus), FUNCTION_SIZE ); /* Test cpl_bivector_dump() */ f_out = fopen(filename, "w"); cpl_test_nonnull( f_out ); /* Will not print any values */ cpl_bivector_dump(NULL, f_out); cpl_bivector_dump(sinus, f_out); cpl_test_zero( fclose(f_out) ); /* Test cpl_bivector_read() */ tmp_fun = cpl_bivector_read(NULL); cpl_test_error( CPL_ERROR_NULL_INPUT ); cpl_test_null( tmp_fun ); tmp_fun = cpl_bivector_read("/dev/null"); cpl_test_error(CPL_ERROR_BAD_FILE_FORMAT); cpl_test_null( tmp_fun ); cpl_test_nonnull( tmp_fun = cpl_bivector_duplicate(sinus) ); cpl_bivector_delete(sinus); cpl_test_nonnull( sinus = cpl_bivector_read(filename) ); cpl_test_zero(remove(filename)); /* Measure the error incurred through the dump/read */ cpl_test_vector_abs(cpl_bivector_get_x(tmp_fun), cpl_bivector_get_x(sinus), 48.0 * FLT_EPSILON); cpl_test_vector_abs(cpl_bivector_get_y(tmp_fun), cpl_bivector_get_y(sinus), 6.0 * FLT_EPSILON); cpl_bivector_delete(tmp_fun); /* Test cpl_bivector_interpolate_linear */ tmp_fun = cpl_bivector_new(FUNCTION_SIZE); vec1 = cpl_bivector_get_x(tmp_fun); vec2 = cpl_bivector_get_x(sinus); error = cpl_vector_copy(vec1, vec2); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_add_scalar(vec1, 0.5); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Verify error handling of lower extrapolation */ error = cpl_bivector_interpolate_linear(tmp_fun, sinus); cpl_test_eq_error(error, CPL_ERROR_DATA_NOT_FOUND); error = cpl_vector_subtract_scalar(vec1, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Verify error handling of upper extrapolation */ error = cpl_bivector_interpolate_linear(tmp_fun, sinus); cpl_test_eq_error(error, CPL_ERROR_DATA_NOT_FOUND); /* Verify "interpolation" with values that an all-constant vector */ error = cpl_vector_fill(cpl_bivector_get_x(sinus), 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_fill(cpl_bivector_get_y(sinus), 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_fill(cpl_bivector_get_x(tmp_fun), 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_interpolate_linear(tmp_fun, sinus); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_vector_abs(cpl_bivector_get_y(tmp_fun), cpl_bivector_get_y(sinus), 0.0); /* Free */ cpl_bivector_delete(tmp_fun); cpl_bivector_delete(sinus); cpl_bivector_delete(cosinus); sinus = cpl_bivector_new(FUNCTION_SIZE+1); /* Create a function with sine values, with abscissa offset by 0.5 */ data_x = cpl_bivector_get_x_data(sinus); data_y = cpl_bivector_get_y_data(sinus); for (i = 0; i < FUNCTION_SIZE + 1; i++) { data_x[i] = (i-0.5) * scale; data_y[i] = sin(data_x[i]); } tmp_fun = cpl_bivector_new(FUNCTION_SIZE); vec1 = cpl_bivector_get_x(tmp_fun); data_x = cpl_vector_get_data(vec1); for (i = 0; i < FUNCTION_SIZE; i++) data_x[i] = i * scale; error = cpl_bivector_interpolate_linear(tmp_fun, sinus); cpl_test_eq_error(error, CPL_ERROR_NONE); data_y = cpl_bivector_get_y_data(tmp_fun); cpl_test_nonnull(data_y); /* Check interpolation error at 0, pi/2, pi, 3*pi/2 */ cpl_test_abs( data_y[0], 0.0, FLT_EPSILON); cpl_test_abs( data_y[FUNCTION_SIZE/2], 0.0, 10 * DBL_EPSILON); cpl_test_abs( 1.0, data_y[FUNCTION_SIZE/4], 1.0 / FUNCTION_SIZE ); cpl_test_abs( -1.0, data_y[3*FUNCTION_SIZE/4], 1.0 / FUNCTION_SIZE ); cpl_bivector_delete(tmp_fun); tmp_fun = cpl_bivector_duplicate(sinus); error = cpl_vector_copy(cpl_bivector_get_x(tmp_fun), cpl_bivector_get_x(sinus)); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_fill(cpl_bivector_get_y(tmp_fun), 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_interpolate_linear(tmp_fun, sinus); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_vector_abs(cpl_bivector_get_y(tmp_fun), cpl_bivector_get_y(sinus), 10.0 * DBL_EPSILON); cpl_bivector_delete(tmp_fun); cpl_bivector_delete(sinus); vec1 = cpl_vector_wrap(LIN_SIZE, (double*)linear); source = cpl_bivector_wrap_vectors(vec1, vec1); vec2 = cpl_vector_wrap(POL_SIZE, (double*)interpol); vec3 = cpl_vector_new(POL_SIZE); tmp_fun = cpl_bivector_wrap_vectors(vec2, vec3); error = cpl_bivector_interpolate_linear(tmp_fun, source); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_vector_abs(vec2, vec3, DBL_EPSILON); cpl_bivector_unwrap_vectors(source); cpl_bivector_unwrap_vectors(tmp_fun); (void)cpl_vector_unwrap(vec1); (void)cpl_vector_unwrap(vec2); cpl_vector_delete(vec3); /* End of actual test code */ return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Call the function and validate its output @param self cpl_bivector to hold sorted result @param other Input cpl_bivector to sort @param dir CPL_SORT_ASCENDING or CPL_SORT_DESCENDING @param mode CPL_SORT_BY_X or CPL_SORT_BY_Y @param line __LINE__ @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_bivector_sort */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_bivector_sort_ok(cpl_bivector * self, const cpl_bivector * other, cpl_sort_direction dir, cpl_sort_mode mode, int line) { const cpl_error_code error = cpl_bivector_sort(self, other, dir, mode); if (error != CPL_ERROR_NONE) { cpl_msg_error(cpl_func, "Failure from line %u", line); } else { cpl_vector * tosort = cpl_vector_duplicate((mode == CPL_SORT_BY_X ? cpl_bivector_get_x_const : cpl_bivector_get_y_const)(other)); const cpl_vector * sorted = (mode == CPL_SORT_BY_X ? cpl_bivector_get_x_const : cpl_bivector_get_y_const)(self); const double * data = cpl_vector_get_data_const(sorted); const int n = cpl_bivector_get_size(self); const int ia = dir == CPL_SORT_ASCENDING ? 1 : 0; const int ib = dir == CPL_SORT_ASCENDING ? 0 : 1; int i; for (i = 1; i < n; i++) { cpl_test_leq(data[i - ia], data[i - ib]); } cpl_test_zero(cpl_vector_sort(tosort, dir)); cpl_test_vector_abs(sorted, tosort, 0.0); cpl_vector_delete(tosort); } return error; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @return void */ /*----------------------------------------------------------------------------*/ static void cpl_bivector_sort_test(void) { /* In an ascending stable sort, both arrays will have same permutations */ const double xval[] = {8.0, 1.0, 2.0, 3.0, 4.0, 4.0, 6.0, 7.0, 0.0}; const double yval[] = {8.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 0.0}; const int nvals = (int)(sizeof(xval)/sizeof(double)); cpl_vector * tosortx = cpl_vector_wrap(nvals, (double*)xval); cpl_vector * tosorty = cpl_vector_wrap(nvals, (double*)yval); cpl_bivector * tosort = cpl_bivector_wrap_vectors(tosortx, tosorty); cpl_bivector * sorted = cpl_bivector_new(nvals); cpl_bivector * sorted2 = cpl_bivector_new(nvals); cpl_bivector * toolong = cpl_bivector_new(nvals + 1); cpl_error_code error; /* 1: Check error handling */ error = cpl_bivector_sort(NULL, tosort, CPL_SORT_ASCENDING, CPL_SORT_BY_X); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_bivector_sort(sorted, NULL, CPL_SORT_ASCENDING, CPL_SORT_BY_X); cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); error = cpl_bivector_sort(sorted, tosort, CPL_SORT_ASCENDING, 2); cpl_test_eq_error(error, CPL_ERROR_UNSUPPORTED_MODE); error = cpl_bivector_sort(sorted, tosort, 2, CPL_SORT_BY_X); cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); error = cpl_bivector_sort(toolong, tosort, CPL_SORT_ASCENDING, CPL_SORT_BY_X); cpl_test_eq_error(error, CPL_ERROR_INCOMPATIBLE_INPUT); /* 2: Sorting by X or Y doesn't matter with this data */ error = cpl_bivector_sort_ok(sorted, tosort, CPL_SORT_ASCENDING, CPL_SORT_BY_X, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_sort_ok(sorted2, tosort, CPL_SORT_ASCENDING, CPL_SORT_BY_Y, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_vector_abs(cpl_bivector_get_x(sorted), cpl_bivector_get_x(sorted2), 0.0); cpl_test_vector_abs(cpl_bivector_get_y(sorted), cpl_bivector_get_y(sorted2), 0.0); /* 2: Sorting already sorted data doesn't matter */ error = cpl_bivector_sort_ok(sorted2, sorted, CPL_SORT_ASCENDING, CPL_SORT_BY_X, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_vector_abs(cpl_bivector_get_x(sorted), cpl_bivector_get_x(sorted2), 0.0); cpl_test_vector_abs(cpl_bivector_get_y(sorted), cpl_bivector_get_y(sorted2), 0.0); /* 2: Ascending sort + descending sort + ascending sort == ascending sort */ /* - for unique elements */ error = cpl_bivector_sort_ok(sorted, tosort, CPL_SORT_ASCENDING, CPL_SORT_BY_X, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_sort_ok(sorted2, sorted, CPL_SORT_DESCENDING, CPL_SORT_BY_X, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_sort_ok(sorted, sorted2, CPL_SORT_ASCENDING, CPL_SORT_BY_X, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_sort_ok(sorted2, tosort, CPL_SORT_ASCENDING, CPL_SORT_BY_X, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_vector_abs(cpl_bivector_get_x(sorted), cpl_bivector_get_x(sorted2), 0.0); cpl_test_vector_abs(cpl_bivector_get_y(sorted), cpl_bivector_get_y(sorted2), 0.0); /* 2: Ascending sort + descending sort + ascending sort == ascending sort */ /* - and for non-unique elements */ error = cpl_bivector_sort_ok(sorted, tosort, CPL_SORT_ASCENDING, CPL_SORT_BY_Y, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_sort_ok(sorted2, sorted, CPL_SORT_DESCENDING, CPL_SORT_BY_Y, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_sort_ok(sorted, sorted2, CPL_SORT_ASCENDING, CPL_SORT_BY_Y, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_sort_ok(sorted2, tosort, CPL_SORT_ASCENDING, CPL_SORT_BY_Y, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_vector_abs(cpl_bivector_get_x(sorted), cpl_bivector_get_x(sorted2), 0.0); cpl_test_vector_abs(cpl_bivector_get_y(sorted), cpl_bivector_get_y(sorted2), 0.0); /* 3: In-place */ error = cpl_vector_copy(cpl_bivector_get_x(sorted), tosortx); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_copy(cpl_bivector_get_y(sorted), tosorty); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_sort_ok(sorted, sorted, CPL_SORT_ASCENDING, CPL_SORT_BY_X, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_copy(cpl_bivector_get_x(sorted), tosortx); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_copy(cpl_bivector_get_y(sorted), tosorty); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_sort_ok(sorted, sorted, CPL_SORT_ASCENDING, CPL_SORT_BY_Y, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_bivector_unwrap_vectors(tosort); cpl_test_eq_ptr(cpl_vector_unwrap(tosortx), xval); cpl_test_eq_ptr(cpl_vector_unwrap(tosorty), yval); cpl_bivector_delete(sorted); cpl_bivector_delete(sorted2); cpl_bivector_delete(toolong); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function using random numbers @param size The number of elements to test with @return void */ /*----------------------------------------------------------------------------*/ static void cpl_bivector_sort_random(int size) { cpl_bivector * source = cpl_bivector_new(size); cpl_bivector * destination = cpl_bivector_new(size); double * xdata = cpl_bivector_get_x_data(source); cpl_image * ximage = cpl_image_wrap_double(size, 1, xdata); double * ydata = cpl_bivector_get_x_data(source); cpl_image * yimage = cpl_image_wrap_double(size, 1, ydata); cpl_error_code error; int inplace; cpl_test_leq(1, size); for (inplace = 0; inplace < 2; inplace++) { cpl_bivector * tosort = source; cpl_bivector * sorted = destination; error = cpl_image_fill_noise_uniform(ximage, -1.0, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_vector_fill(cpl_bivector_get_y(source), 0.0); cpl_test_eq_error(error, CPL_ERROR_NONE); if (inplace) { tosort = sorted; error = cpl_bivector_copy(tosort, source); cpl_test_eq_error(error, CPL_ERROR_NONE); } /* Sort up and down on X */ error = cpl_bivector_sort_ok(sorted, tosort, CPL_SORT_ASCENDING, CPL_SORT_BY_X, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_sort_ok(sorted, tosort, CPL_SORT_DESCENDING, CPL_SORT_BY_X, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Same, with all values identical */ error = cpl_bivector_sort_ok(sorted, tosort, CPL_SORT_ASCENDING, CPL_SORT_BY_Y, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_sort_ok(sorted, tosort, CPL_SORT_DESCENDING, CPL_SORT_BY_Y, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); /* Sort up and down on Y */ error = cpl_image_fill_noise_uniform(yimage, -1.0, 1.0); cpl_test_eq_error(error, CPL_ERROR_NONE); if (inplace) { error = cpl_bivector_copy(tosort, source); cpl_test_eq_error(error, CPL_ERROR_NONE); } error = cpl_bivector_sort_ok(sorted, tosort, CPL_SORT_ASCENDING, CPL_SORT_BY_Y, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_bivector_sort_ok(sorted, tosort, CPL_SORT_DESCENDING, CPL_SORT_BY_Y, __LINE__); cpl_test_eq_error(error, CPL_ERROR_NONE); } cpl_test_eq_ptr(cpl_image_unwrap(ximage), xdata); cpl_test_eq_ptr(cpl_image_unwrap(yimage), ydata); cpl_bivector_delete(source); cpl_bivector_delete(destination); } cpl-6.4.1/cplcore/tests/cpl_tools-test.c0000644000460300003120000004427511622771735015151 00000000000000/* $Id: cpl_tools-test.c,v 1.12 2011-08-17 17:01:17 cgarcia Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: cgarcia $ * $Date: 2011-08-17 17:01:17 $ * $Revision: 1.12 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define NBC 8 #define NBC2 11 /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_tools_get_kth_quickselection_bench(int, int, cpl_boolean); static void cpl_tools_get_median_bench(int, int, cpl_boolean); static void cpl_tools_sort_bench(int, int, cpl_boolean); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { /* Some binomial coefficients - in reverse order */ const int p15[NBC2] = {646646, 497420, 319770, 170544, 74613, 26334, 7315, 1540, 231, 22, 1}; const float pf15[NBC2] = {646646, 497420, 319770, 170544, 74613, 26334, 7315, 1540, 231, 22, 1}; int c15[NBC2]; float cf15[NBC2]; int c0[NBC] = {1, 1, 1, 1, 0, 0, 0, 0}; cpl_boolean do_bench; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); do_bench = cpl_msg_get_level() <= CPL_MSG_INFO ? CPL_TRUE : CPL_FALSE; cpl_test_abs( cpl_tools_ipow(1.0, 0), 1.0, 0.0); cpl_test_abs( cpl_tools_ipow(0.0, 0), 1.0, 0.0); cpl_test_abs( cpl_tools_ipow(0.0, 1), 0.0, 0.0); cpl_test_abs( cpl_tools_ipow(0.0, 2), 0.0, 0.0); cpl_test_eq_ptr(c15, memcpy(c15, p15, sizeof(p15))); /* Find two smallest */ cpl_test_eq(p15[NBC2-2], cpl_tools_get_kth_int(c15, NBC2, 1)); /* Find two largest */ cpl_test_eq(p15[1], cpl_tools_get_kth_int(c15, NBC2, NBC2-2)); cpl_test_eq(p15[0], c15[NBC2-1]); cpl_test_eq(p15[NBC2-1], c15[0]); /* Check of 2nd smallest delayed */ cpl_test_zero(cpl_tools_get_kth_int(c0, NBC, 3)); cpl_test_zero(c0[0]); cpl_test_zero(c0[1]); cpl_test_zero(c0[2]); cpl_test_zero(c0[3]); cpl_test_eq(c0[4], 1); cpl_test_eq(c0[5], 1); cpl_test_eq(c0[6], 1); cpl_test_eq(c0[7], 1); cpl_test_eq_ptr(c15, memcpy(c15, p15, sizeof(p15))); /* Find median */ cpl_test_eq(p15[(NBC2-1)/2], cpl_tools_quickselection_int(c15, NBC2, (NBC2-1)/2)); cpl_test_eq(p15[(NBC2-1)/2], c15[(NBC2-1)/2]); /* Special case: 3 element median computation */ cpl_test_eq_ptr(c15, memcpy(c15, p15, sizeof(p15))); cpl_test_eq(p15[1], cpl_tools_get_median_int(c15, 3)); cpl_test_eq(p15[0], c15[2]); cpl_test_eq(p15[2], c15[0]); /* Special case: 5 element median computation */ cpl_test_eq_ptr(c15, memcpy(c15, p15, sizeof(p15))); cpl_test_eq(p15[2], cpl_tools_get_median_int(c15, 5)); cpl_test_lt(c15[0], c15[2]); cpl_test_lt(c15[1], c15[2]); cpl_test_lt(c15[2], c15[3]); cpl_test_lt(c15[2], c15[4]); /* Special case: 6 element median computation */ cpl_test_eq_ptr(c15, memcpy(c15, p15, sizeof(p15))); cpl_test_eq((p15[2]+p15[3])/2, cpl_tools_get_median_int(c15, 6)); cpl_test_lt(c15[0], c15[2]); cpl_test_lt(c15[1], c15[2]); cpl_test_lt(c15[2], c15[3]); cpl_test_lt(c15[2], c15[4]); cpl_test_lt(c15[2], c15[5]); /* Special case: 7 element median computation */ cpl_test_eq_ptr(c15, memcpy(c15, p15, sizeof(p15))); cpl_test_eq(p15[3], cpl_tools_get_median_int(c15, 7)); cpl_test_lt(c15[0], c15[3]); cpl_test_lt(c15[1], c15[3]); cpl_test_lt(c15[2], c15[3]); cpl_test_lt(c15[3], c15[4]); cpl_test_lt(c15[3], c15[5]); cpl_test_lt(c15[3], c15[6]); /* Normal median case with even number: 10 element median computation */ cpl_test_eq_ptr(c15, memcpy(c15, p15, sizeof(p15))); cpl_test_eq((p15[4]+p15[5])/2, cpl_tools_get_median_int(c15, 10)); cpl_test_lt(c15[0], c15[4]); cpl_test_lt(c15[1], c15[4]); cpl_test_lt(c15[2], c15[4]); cpl_test_lt(c15[3], c15[4]); cpl_test_lt(c15[5], c15[6]); cpl_test_lt(c15[5], c15[7]); cpl_test_lt(c15[5], c15[8]); cpl_test_lt(c15[5], c15[9]); /* Normal median case with even number: 11 element median computation */ cpl_test_eq_ptr(c15, memcpy(c15, p15, sizeof(p15))); cpl_test_eq(p15[5], cpl_tools_get_median_int(c15, 11)); cpl_test_lt(c15[0], c15[5]); cpl_test_lt(c15[1], c15[5]); cpl_test_lt(c15[2], c15[5]); cpl_test_lt(c15[3], c15[5]); cpl_test_lt(c15[4], c15[5]); cpl_test_lt(c15[5], c15[6]); cpl_test_lt(c15[5], c15[7]); cpl_test_lt(c15[5], c15[8]); cpl_test_lt(c15[5], c15[9]); cpl_test_lt(c15[5], c15[10]); /* Float case */ /* Normal median case with even number: 10 element median computation */ cpl_test_eq_ptr(cf15, memcpy(cf15, pf15, sizeof(pf15))); cpl_test_eq((pf15[4]+pf15[5])/2., cpl_tools_get_median_float(cf15, 10)); cpl_test_lt(cf15[0], cf15[4]); cpl_test_lt(cf15[1], cf15[4]); cpl_test_lt(cf15[2], cf15[4]); cpl_test_lt(cf15[3], cf15[4]); cpl_test_lt(cf15[5], cf15[6]); cpl_test_lt(cf15[5], cf15[7]); cpl_test_lt(cf15[5], cf15[8]); cpl_test_lt(cf15[5], cf15[9]); /* Float case */ /* Normal median case with even number: 11 element median computation */ cpl_test_eq_ptr(cf15, memcpy(cf15, pf15, sizeof(pf15))); cpl_test_eq(pf15[5], cpl_tools_get_median_float(cf15, 11)); cpl_test_lt(cf15[0], cf15[5]); cpl_test_lt(cf15[1], cf15[5]); cpl_test_lt(cf15[2], cf15[5]); cpl_test_lt(cf15[3], cf15[5]); cpl_test_lt(cf15[4], cf15[5]); cpl_test_lt(cf15[5], cf15[6]); cpl_test_lt(cf15[5], cf15[7]); cpl_test_lt(cf15[5], cf15[8]); cpl_test_lt(cf15[5], cf15[9]); cpl_test_lt(cf15[5], cf15[10]); cpl_tools_get_kth_quickselection_bench(1, 5, CPL_FALSE); cpl_tools_get_kth_quickselection_bench(1, 9, CPL_FALSE); cpl_tools_get_kth_quickselection_bench(1, 31, CPL_FALSE); cpl_tools_get_kth_quickselection_bench(1, 5, CPL_TRUE); cpl_tools_get_kth_quickselection_bench(1, 9, CPL_TRUE); cpl_tools_get_kth_quickselection_bench(1, 31, CPL_TRUE); cpl_tools_get_median_bench(1, 5, CPL_FALSE); cpl_tools_get_median_bench(1, 30, CPL_FALSE); cpl_tools_get_median_bench(1, 31, CPL_FALSE); cpl_tools_get_median_bench(1, 5, CPL_TRUE); cpl_tools_get_median_bench(1, 30, CPL_TRUE); cpl_tools_get_median_bench(1, 31, CPL_TRUE); cpl_tools_sort_bench(1, 5, CPL_FALSE); cpl_tools_sort_bench(1, 9, CPL_FALSE); cpl_tools_sort_bench(1, 31, CPL_FALSE); cpl_tools_sort_bench(1, 5, CPL_TRUE); cpl_tools_sort_bench(1, 9, CPL_TRUE); cpl_tools_sort_bench(1, 31, CPL_TRUE); if (do_bench) { cpl_tools_sort_bench(5, 100001, CPL_FALSE); cpl_tools_sort_bench(5, 10001, CPL_TRUE); cpl_tools_get_kth_quickselection_bench(5, 10001, CPL_FALSE); cpl_tools_get_kth_quickselection_bench(5, 10001, CPL_TRUE); cpl_tools_get_kth_quickselection_bench(5, 25001, CPL_FALSE); cpl_tools_get_kth_quickselection_bench(5, 25001, CPL_TRUE); cpl_tools_get_kth_quickselection_bench(5, 200001, CPL_FALSE); cpl_tools_get_kth_quickselection_bench(5, 2000001, CPL_FALSE); #ifdef CPL_TOOLS_TEST_LONG /* Example output (Intel E6750 @ 2.66GHz): [ INFO ] Benchmarked kth 5 x 200001 [s]: 484.03 <=> 311.49 [ INFO ] Benchmarked kth 5 x 2000001 [s]: 52318.6 <=> 32385.4 */ cpl_tools_get_kth_quickselection_bench(5, 200001, CPL_TRUE); cpl_tools_get_kth_quickselection_bench(5, 2000001, CPL_TRUE); #endif cpl_tools_get_median_bench(5, 25000, CPL_FALSE); cpl_tools_get_median_bench(5, 25000, CPL_TRUE); cpl_tools_get_median_bench(5, 25001, CPL_FALSE); cpl_tools_get_median_bench(5, 25001, CPL_TRUE); cpl_tools_get_median_bench(5, 200000, CPL_FALSE); cpl_tools_get_median_bench(5, 200001, CPL_FALSE); cpl_tools_get_median_bench(5, 2000000, CPL_FALSE); cpl_tools_get_median_bench(5, 2000001, CPL_FALSE); } return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Benchmark the two CPL functions @param m The number of repeats @param n The number of elements @param do_sortmost Sort all but three elements @return void */ /*----------------------------------------------------------------------------*/ static void cpl_tools_get_kth_quickselection_bench(int m, int n, cpl_boolean do_sortmost) { double tqsel = 0.0; double tkth = 0.0; int i; for (i = 0; i < m; i++) { double * dd = (double*)cpl_malloc((size_t)n * sizeof(double)); float * df = (float*) cpl_malloc((size_t)n * sizeof(float)); int * di = (int*) cpl_malloc((size_t)n * sizeof(int)); double * cd = (double*)cpl_malloc((size_t)n * sizeof(double)); float * cf = (float*) cpl_malloc((size_t)n * sizeof(float)); int * ci = (int*) cpl_malloc((size_t)n * sizeof(int)); double sec0; double dmed1, dmed2; float fmed1, fmed2; int imed1, imed2; int j; for (j = 0; j < n; j++) { di[j] = rand(); } if (do_sortmost) { cpl_tools_sort_int(di, n); di[n/2-1] = di[n/2]; di[n/2] = RAND_MAX; di[n/2+1] = -1; } for (j = 0; j < n; j++) { df[j] = (float)di[j]; dd[j] = (double)di[j]; } /* Benchmark in double precision */ cpl_test_eq_ptr(cd, memcpy(cd, dd, n * sizeof(*dd))); sec0 = cpl_test_get_cputime(); dmed1 = cpl_tools_get_kth_double(cd, n, (n&1) ? n / 2 : n / 2 - 1); tkth += cpl_test_get_cputime() - sec0; cpl_test_eq_ptr(cd, memcpy(cd, dd, n * sizeof(*dd))); sec0 = cpl_test_get_cputime(); dmed2 = cpl_tools_quickselection_double(cd, n, (n-1)/2); tqsel += cpl_test_get_cputime() - sec0; cpl_test_abs(dmed1, dmed2, DBL_EPSILON); /* Benchmark with float */ cpl_test_eq_ptr(cf, memcpy(cf, df, n * sizeof(*df))); sec0 = cpl_test_get_cputime(); fmed1 = cpl_tools_get_kth_float(cf, n, (n&1) ? n / 2 : n / 2 - 1); tkth += cpl_test_get_cputime() - sec0; cpl_test_eq_ptr(cf, memcpy(cf, df, n * sizeof(*df))); sec0 = cpl_test_get_cputime(); fmed2 = cpl_tools_quickselection_float(cf, n, (n-1)/2); tqsel += cpl_test_get_cputime() - sec0; cpl_test_abs(fmed1, fmed2, FLT_EPSILON); /* Benchmark with int */ cpl_test_eq_ptr(ci, memcpy(ci, di, n * sizeof(*di))); sec0 = cpl_test_get_cputime(); imed1 = cpl_tools_get_kth_int(ci, n, (n&1) ? n / 2 : n / 2 - 1); tkth += cpl_test_get_cputime() - sec0; cpl_test_eq_ptr(ci, memcpy(ci, di, n * sizeof(*di))); sec0 = cpl_test_get_cputime(); imed2 = cpl_tools_quickselection_int(ci, n, (n-1)/2); tqsel += cpl_test_get_cputime() - sec0; cpl_test_eq(imed1, imed2); cpl_free(dd); cpl_free(df); cpl_free(di); cpl_free(cd); cpl_free(cf); cpl_free(ci); } cpl_msg_info(cpl_func, "Benchmarked kth <=> QuickSelect%s %d x %d [s]: " "%g <=> %g", do_sortmost ? " (NS)" : "", m, n, tkth, tqsel); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Benchmark the two CPL functions @param m The number of repeats @param n The number of elements @param do_sortmost Sort all but three elements @return void */ /*----------------------------------------------------------------------------*/ static void cpl_tools_get_median_bench(int m, int n, cpl_boolean do_sortmost) { double tmedian = 0.0; int i; for (i = 0; i < m; i++) { double * dd = (double*)cpl_malloc((size_t)n * sizeof(double)); float * df = (float*) cpl_malloc((size_t)n * sizeof(float)); int * di = (int*) cpl_malloc((size_t)n * sizeof(int)); double * cd = (double*)cpl_malloc((size_t)n * sizeof(double)); float * cf = (float*) cpl_malloc((size_t)n * sizeof(float)); int * ci = (int*) cpl_malloc((size_t)n * sizeof(int)); double sec0; int j; for (j = 0; j < n; j++) { di[j] = rand(); } if (do_sortmost) { cpl_tools_sort_int(di, n); di[n/2-1] = di[n/2]; di[n/2] = RAND_MAX; di[n/2+1] = -1; } for (j = 0; j < n; j++) { df[j] = (float)di[j]; dd[j] = (double)di[j]; } /* Benchmark in double precision */ cpl_test_eq_ptr(cd, memcpy(cd, dd, n * sizeof(*dd))); sec0 = cpl_test_get_cputime(); cpl_tools_get_median_double(cd, n); tmedian += cpl_test_get_cputime() - sec0; /* Benchmark with float */ cpl_test_eq_ptr(cf, memcpy(cf, df, n * sizeof(*df))); sec0 = cpl_test_get_cputime(); cpl_tools_get_median_float(cf, n); tmedian += cpl_test_get_cputime() - sec0; /* Benchmark with int */ cpl_test_eq_ptr(ci, memcpy(ci, di, n * sizeof(*di))); sec0 = cpl_test_get_cputime(); cpl_tools_get_median_int(ci, n); tmedian += cpl_test_get_cputime() - sec0; cpl_free(dd); cpl_free(df); cpl_free(di); cpl_free(cd); cpl_free(cf); cpl_free(ci); } cpl_msg_info(cpl_func, "Benchmarked median%s %d x %d [s]: " "%g", do_sortmost ? " (NS)" : "", m, n, tmedian); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Benchmark the CPL sort function against qsort() @param m The number of repeats @param n The number of elements @param do_sortmost Sort all but three elements @return void @see qsort */ /*----------------------------------------------------------------------------*/ static void cpl_tools_sort_bench(int m, int n, cpl_boolean do_sortmost) { double tqs = 0.0; double tcpl = 0.0; int i; for (i = 0; i < m; i++) { double * dd = (double*)cpl_malloc((size_t)n * sizeof(double)); float * df = (float*) cpl_malloc((size_t)n * sizeof(float)); int * di = (int*) cpl_malloc((size_t)n * sizeof(int)); double * cd = (double*)cpl_malloc((size_t)n * sizeof(double)); float * cf = (float*) cpl_malloc((size_t)n * sizeof(float)); int * ci = (int*) cpl_malloc((size_t)n * sizeof(int)); double sec0; double dmed1, dmed2; float fmed1, fmed2; int imed1, imed2; int j; for (j = 0; j < n; j++) { di[j] = rand(); } if (do_sortmost) { cpl_tools_sort_int(di, n); di[n/2-1] = di[n/2]; di[n/2] = RAND_MAX; di[n/2+1] = -1; } for (j = 0; j < n; j++) { df[j] = (float)di[j]; dd[j] = (double)di[j]; } /* Benchmark in double precision */ cpl_test_eq_ptr(cd, memcpy(cd, dd, n * sizeof(*dd))); sec0 = cpl_test_get_cputime(); cpl_tools_sort_double(cd, n); tcpl += cpl_test_get_cputime() - sec0; dmed1 = cd[n/2]; cpl_test_eq_ptr(cd, memcpy(cd, dd, n * sizeof(*dd))); sec0 = cpl_test_get_cputime(); cpl_tools_sort_ascn_double(cd, n); tqs += cpl_test_get_cputime() - sec0; dmed2 = cd[n/2]; cpl_test_abs(dmed1, dmed2, DBL_EPSILON); /* Benchmark with float */ cpl_test_eq_ptr(cf, memcpy(cf, df, n * sizeof(*df))); sec0 = cpl_test_get_cputime(); cpl_tools_sort_float(cf, n); tcpl += cpl_test_get_cputime() - sec0; fmed1 = cf[n/2]; cpl_test_eq_ptr(cf, memcpy(cf, df, n * sizeof(*df))); sec0 = cpl_test_get_cputime(); cpl_tools_sort_ascn_float(cf, n); tqs += cpl_test_get_cputime() - sec0; fmed2 = cf[n/2]; cpl_test_abs(fmed1, fmed2, DBL_EPSILON); /* Benchmark with int */ cpl_test_eq_ptr(ci, memcpy(ci, di, n * sizeof(*di))); sec0 = cpl_test_get_cputime(); cpl_tools_sort_int(ci, n); tcpl += cpl_test_get_cputime() - sec0; imed1 = ci[n/2]; cpl_test_eq_ptr(ci, memcpy(ci, di, n * sizeof(*di))); sec0 = cpl_test_get_cputime(); cpl_tools_sort_ascn_int(ci, n); tqs += cpl_test_get_cputime() - sec0; imed2 = ci[n/2]; cpl_test_eq(imed1, imed2); cpl_free(dd); cpl_free(df); cpl_free(di); cpl_free(cd); cpl_free(cf); cpl_free(ci); } cpl_msg_info(cpl_func, "Benchmarked sort %d x %d [s]: %g <=> %g", m, n, tcpl, tqs); return; } cpl-6.4.1/cplcore/tests/cpl_plot-test.c0000644000460300003120000002173611466733006014757 00000000000000/* $Id: cpl_plot-test.c,v 1.17 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.17 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_SETENV extern int setenv(const char *, const char *, int); #endif #include #include #include "cpl_plot.h" #include "cpl_math_const.h" #include "cpl_test.h" #include "cpl_memory.h" /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ #define VEC_SIZE 1024 #define IMA_SIZE 100 #define TAB_SIZE 100 #define CPL_PLOT_MIN(A, B) ((A) < (B) ? (A) : (B)) /*----------------------------------------------------------------------------- Private functions -----------------------------------------------------------------------------*/ void cpl_plot_test_all(int, int, int); void cpl_plot_test(const cpl_image *, const cpl_mask *, const cpl_table *, int, const char *[], const cpl_vector *, const cpl_bivector *, int, const cpl_vector **); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); cpl_plot_test_all(IMA_SIZE, VEC_SIZE, TAB_SIZE); cpl_plot_test_all(1, 1, 1); /* Some unusual sizes */ return cpl_test_end(0); } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Test the plotting functions @param n2d The size of the 2D-objects @param nvec The length of the vector-objects @param nrow The number of tables rows/columns lengths @return void */ /*----------------------------------------------------------------------------*/ void cpl_plot_test_all(int n2d, int nvec, int nrow) { cpl_vector * sinus; cpl_vector * cosinus; cpl_vector * x_deg; cpl_vector * vec_array[3]; cpl_bivector * sin_deg; cpl_image * ima; double med_dist, median, threshold; cpl_mask * mask; cpl_table * tab; double * px; double * py; const char * names[] = {"COLUMN1", "COLUMN2", "COLUMN3"}; int i; /* Create the vector sinus */ sinus = cpl_vector_new(nvec); x_deg = cpl_vector_new(nvec); px = cpl_vector_get_data(x_deg); py = cpl_vector_get_data(sinus); for (i=0; i < nvec; i++) { px[i] = i * 360.0 / nvec; py[i] = sin( i * CPL_MATH_2PI / nvec); } /* Create the vector cosinus */ cosinus = cpl_vector_new(nvec); py = cpl_vector_get_data(cosinus); for (i=0; i < nvec; i++) py[i] = cos( i * CPL_MATH_2PI / nvec); /* Create the vectors array */ vec_array[0] = x_deg; vec_array[1] = sinus; vec_array[2] = cosinus; /* Create the bivector */ sin_deg = cpl_bivector_wrap_vectors(x_deg, sinus); /* Create the image */ ima = cpl_image_fill_test_create(n2d, n2d); /* Compute the median and the av. dist. to the median of the loaded image */ median = cpl_image_get_median_dev(ima, &med_dist); threshold = median + 2.0 * med_dist; mask = cpl_mask_threshold_image_create(ima, threshold, DBL_MAX); /* Create the table */ tab = cpl_table_new(nrow); cpl_table_new_column(tab, names[0], CPL_TYPE_DOUBLE); cpl_table_new_column(tab, names[1], CPL_TYPE_DOUBLE); cpl_table_new_column(tab, names[2], CPL_TYPE_DOUBLE); for (i=0; i < nrow; i++) { cpl_table_set_double(tab, names[0], i, (double)(10*i+1)); cpl_table_set_double(tab, names[1], i, sin(10*i+1)/10*i+1); cpl_table_set_double(tab, names[2], i, log(i+1)/i+1); } /* No errors should have happened in the plot preparation */ cpl_test_error(CPL_ERROR_NONE); /* No plotting is done unless the message level is modified */ if (cpl_msg_get_level() <= CPL_MSG_INFO) { cpl_plot_test(ima, mask, tab, 3, names, sinus, sin_deg, 3, (const cpl_vector**)vec_array); #ifdef HAVE_SETENV if (!setenv("CPL_IMAGER", "display - &", 1) && !setenv("CPL_PLOTTER", "cat > /dev/null; echo gnuplot > /dev/null", 1)) { cpl_plot_test(ima, mask, tab, 3, names, sinus, sin_deg, 3, (const cpl_vector**)vec_array); } } else { if (!setenv("CPL_IMAGER", "cat > /dev/null", 1) && !setenv("CPL_PLOTTER", "cat > /dev/null; echo gnuplot > /dev/null", 1)) { cpl_plot_test(ima, mask, tab, 3, names, sinus, sin_deg, 3, (const cpl_vector**)vec_array); } #endif } /* Free and return */ cpl_table_delete(tab); cpl_image_delete(ima); cpl_mask_delete(mask); cpl_bivector_unwrap_vectors(sin_deg); cpl_vector_delete(sinus); cpl_vector_delete(cosinus); cpl_vector_delete(x_deg); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test plotting of the given CPL objects @param image image @param mask mask @param table table w. at least three columns @param names Column labels of table @param vector vector @param bivector bivector @param nvector Number of vectors in vector array @param vec_array Array of vectors @return void */ /*----------------------------------------------------------------------------*/ void cpl_plot_test(const cpl_image * image, const cpl_mask * mask, const cpl_table * table, int ncolumns, const char *names[], const cpl_vector * vector, const cpl_bivector * bivector, int nvector, const cpl_vector **vec_array) { /* An error may occur, e.g. in the absence of gnuplot. The unit test should still succeed, and it is only verified that the return code equals the CPL error code. */ /* - and that all plotting calls either succeed or fail in the same way */ cpl_error_code error; const cpl_error_code error0 = cpl_plot_vector("", "w lines", "", vector); cpl_test_error(error0); cpl_test_eq(cpl_table_get_ncol(table), ncolumns); cpl_test_leq(3, ncolumns); error = cpl_plot_bivector("", "w lines", "", bivector); cpl_test_eq_error(error, error0); error = cpl_plot_vector("", "w lines", "", vector); cpl_test_eq_error(error, error0); error = cpl_plot_vectors("", "w lines", "", vec_array, nvector); cpl_test_eq_error(error, error0); error = cpl_plot_image("", "w lines", "", image); cpl_test_eq_error(error, error0); error = cpl_plot_mask("", "w lines", "", mask); cpl_test_eq_error(error, error0); error = cpl_plot_column("set grid;", "w lines", "", table, names[0], names[1]); cpl_test_eq_error(error, error0); error = cpl_plot_column("set grid;", "w lines", "", table, NULL, names[2]); cpl_test_eq_error(error, error0); error = cpl_plot_columns("set grid;", "w lines", "", table, names, ncolumns); cpl_test_eq_error(error, error0); /* Example of some plotting using the options */ error = cpl_plot_image_row("set xlabel 'X Position (pixels)';" "set ylabel 'Counts (ADU)';", "", "", image, 1, CPL_PLOT_MIN(10, cpl_image_get_size_y(image)), 1); cpl_test_eq_error(error, error0); error = cpl_plot_image_col("set xlabel 'Y Position (pixels)';" "set ylabel 'Counts (ADU)';", "", "", image, 1, 1, 1); cpl_test_eq_error(error, error0); } cpl-6.4.1/cplcore/tests/cpl_errorstate-test.c0000644000460300003120000003176311470442422016166 00000000000000/* $Id: cpl_errorstate-test.c,v 1.20 2010-11-16 08:47:14 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-16 08:47:14 $ * $Revision: 1.20 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include /*----------------------------------------------------------------------------- Private functions and their variables -----------------------------------------------------------------------------*/ static void my_error_counter(unsigned, unsigned, unsigned); static unsigned nerrors; static cpl_boolean did_dump; /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_error_code ierror; cpl_errorstate state_none; cpl_errorstate state, state1; /* In order to produce a sequence of unique CPL errors, each call to cpl_error_set() is done with its own error code which is guatanteed not to originate from within CPL itself. */ unsigned icode, ncode = (unsigned)CPL_ERROR_EOL; unsigned i; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_OFF); state_none = cpl_errorstate_get(); /* Insert tests here */ /* This is a test for DFS05408 */ /* Set some errors */ for (i=0; i < CPL_ERROR_HISTORY_SIZE/2; i++) { cpl_error_set(cpl_func, i + ncode); } /* Be able to recover to have only these errors */ state1 = cpl_errorstate_get(); /* Overflow the error history */ for (i=0; i < 2 * CPL_ERROR_HISTORY_SIZE; i++) { cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT); } /* Recover to the original errors - the details of which have been lost */ cpl_errorstate_set(state1); /* The dump should provide details only for the last error */ cpl_errorstate_dump(state_none, CPL_FALSE, NULL); cpl_test_eq(cpl_error_get_code(), CPL_ERROR_HISTORY_LOST); /* Append one new error */ cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_OUTPUT); /* The dump should provide details only for the last error */ cpl_errorstate_dump(state_none, CPL_FALSE, NULL); cpl_test_eq(cpl_error_get_code(), CPL_ERROR_ILLEGAL_OUTPUT); cpl_errorstate_set(state1); /* The dump should provide no details */ cpl_errorstate_dump(state_none, CPL_FALSE, NULL); cpl_test_eq(cpl_error_get_code(), CPL_ERROR_HISTORY_LOST); cpl_errorstate_set(state_none); /* Test 1: Verify that the error state is empty on start-up */ cpl_test( cpl_errorstate_is_equal(state_none) ); /* Test 1a: Verify that the current error cannot be used to modify the error state*/ cpl_errorstate_set(state_none); cpl_test( cpl_errorstate_is_equal(state_none) ); cpl_errorstate_dump(state_none, CPL_FALSE, NULL); nerrors = 0; did_dump = CPL_FALSE; cpl_errorstate_dump(state_none, CPL_FALSE, my_error_counter); cpl_test_eq( nerrors, 1 ); cpl_test_eq( did_dump, CPL_FALSE ); /* Test 2a: Detect a change in error state */ cpl_error_set_message(cpl_func, ++ncode, "Hello, world"); cpl_test_zero( cpl_errorstate_is_equal(state_none) ); cpl_errorstate_dump(state_none, CPL_FALSE, NULL); nerrors = 0; did_dump = CPL_FALSE; cpl_errorstate_dump(state_none, CPL_FALSE, my_error_counter); cpl_test_eq( nerrors, 1 ); cpl_test_eq( did_dump, CPL_TRUE ); /* Test 2b: Try to dump zero errors with an existing errorstate */ cpl_errorstate_dump(cpl_errorstate_get(), CPL_FALSE, NULL); nerrors = 0; did_dump = CPL_FALSE; cpl_errorstate_dump(cpl_errorstate_get(), CPL_FALSE, my_error_counter); cpl_test_eq( nerrors, 1 ); cpl_test_eq( did_dump, CPL_FALSE ); /* Add some errors without filling up the error history */ for (ierror=1; ierror < CPL_ERROR_HISTORY_SIZE/2; ierror++) { ++ncode; cpl_error_set_message(cpl_func, ncode, "Error-code=%u", (unsigned)ncode); cpl_test_eq( ncode, cpl_error_get_code() ); } /* Preserve that error for later tests */ state = cpl_errorstate_get(); icode = ncode; cpl_errorstate_dump(state_none, CPL_FALSE, NULL); nerrors = 0; did_dump = CPL_FALSE; cpl_errorstate_dump(state_none, CPL_FALSE, my_error_counter); cpl_test_eq( nerrors, CPL_ERROR_HISTORY_SIZE/2 ); cpl_test_eq( did_dump, CPL_TRUE ); /* Test 3: Fill up the error history and check the 1st error */ for (ierror=1; ierror < CPL_ERROR_HISTORY_SIZE; ierror++) { ++ncode; cpl_error_set_message(cpl_func, ncode, "Error-code=%u", (unsigned)ncode); cpl_test_eq( ncode, cpl_error_get_code() ); } cpl_test_eq( ncode + 1, icode + CPL_ERROR_HISTORY_SIZE ); /* - error state is still non-empty */ cpl_test_zero( cpl_errorstate_is_equal(state_none) ); cpl_errorstate_dump(state_none, CPL_FALSE, NULL); nerrors = 0; did_dump = CPL_FALSE; cpl_errorstate_dump(state_none, CPL_FALSE, my_error_counter); cpl_test_eq( nerrors, CPL_ERROR_HISTORY_SIZE/2 + CPL_ERROR_HISTORY_SIZE - 1); cpl_test_eq( did_dump, CPL_TRUE ); /* - different from the 1st error */ cpl_test_zero( cpl_errorstate_is_equal(state) ); cpl_errorstate_dump(state, CPL_FALSE, NULL); nerrors = 0; did_dump = CPL_FALSE; cpl_errorstate_dump(state, CPL_FALSE, my_error_counter); cpl_test_eq( nerrors, CPL_ERROR_HISTORY_SIZE - 1); cpl_test_eq( did_dump, CPL_TRUE ); cpl_errorstate_set(state); cpl_errorstate_dump(state, CPL_FALSE, NULL); nerrors = 0; did_dump = CPL_FALSE; cpl_errorstate_dump(state, CPL_FALSE, my_error_counter); cpl_test_eq( nerrors, 1); cpl_test_eq( did_dump, CPL_FALSE ); /* - the details of that 1st error are preserved */ cpl_test_eq( cpl_error_get_code(), icode ); cpl_test( cpl_error_get_line() != 0 ); cpl_test_zero( strcmp(cpl_error_get_file(), __FILE__) ); cpl_test_zero( strcmp(cpl_error_get_function(), cpl_func) ); /* Set two new, 2nd and 3rd errors, discarding all errors set after 'state'. */ ++ncode; cpl_error_set_message(cpl_func, ncode, "Error-code=%u", (unsigned)ncode); state1 = cpl_errorstate_get(); ++ncode; cpl_error_set_message(cpl_func, ncode, "Error-code=%u", (unsigned)ncode); nerrors = 0; did_dump = CPL_FALSE; cpl_errorstate_dump(state, CPL_FALSE, my_error_counter); cpl_test_eq( nerrors, 2); cpl_test_eq( did_dump, CPL_TRUE ); /* Preserve that error for later tests */ state = cpl_errorstate_get(); icode = ncode; cpl_errorstate_dump(state_none, CPL_FALSE, NULL); nerrors = 0; did_dump = CPL_FALSE; cpl_errorstate_dump(state_none, CPL_FALSE, my_error_counter); cpl_test_eq( nerrors, CPL_ERROR_HISTORY_SIZE/2 + 2); cpl_test_eq( did_dump, CPL_TRUE ); /* Test 4: Fill up the error history and check that error */ for (ierror=1; ierror < CPL_ERROR_HISTORY_SIZE; ierror++) { ++ncode; cpl_error_set_message(cpl_func, ncode, "Error-code=%u", (unsigned)ncode); cpl_test_eq( ncode, cpl_error_get_code() ); } cpl_test_eq( ncode + 1, icode + CPL_ERROR_HISTORY_SIZE ); /* - error state is still non-empty */ cpl_test_zero( cpl_errorstate_is_equal(state_none) ); /* - different from the 3rd error */ cpl_test_zero( cpl_errorstate_is_equal(state) ); cpl_errorstate_dump(state_none, CPL_FALSE, NULL); nerrors = 0; did_dump = CPL_FALSE; cpl_errorstate_dump(state_none, CPL_FALSE, my_error_counter); cpl_test_eq( nerrors, CPL_ERROR_HISTORY_SIZE/2 + CPL_ERROR_HISTORY_SIZE + 1); cpl_test_eq( did_dump, CPL_TRUE ); cpl_errorstate_set(state); /* - the details of that 3rd error are preserved */ cpl_test_eq( cpl_error_get_code(), icode ); cpl_test( cpl_error_get_line() != 0 ); cpl_test_zero( strcmp(cpl_error_get_file(), __FILE__) ); cpl_test_zero( strcmp(cpl_error_get_function(), cpl_func) ); /* Test 5: Fill the error history and check the 3rd error */ for (ierror=1; ierror < CPL_ERROR_HISTORY_SIZE; ierror++) { ++ncode; cpl_error_set_message(cpl_func, ncode, "Error-code=%u", (unsigned)ncode); cpl_test_eq( ncode, cpl_error_get_code() ); } cpl_test_eq( ncode + 2, icode + 2 * CPL_ERROR_HISTORY_SIZE ); /* - and error state is still non-empty */ cpl_test_zero( cpl_errorstate_is_equal(state_none) ); /* - and different from the 3rd error */ cpl_test_zero( cpl_errorstate_is_equal(state) ); cpl_errorstate_dump(state_none, CPL_TRUE, NULL); nerrors = 0; did_dump = CPL_FALSE; cpl_errorstate_dump(state_none, CPL_TRUE, my_error_counter); cpl_test_eq( nerrors, CPL_ERROR_HISTORY_SIZE/2 + CPL_ERROR_HISTORY_SIZE + 1); cpl_test_eq( did_dump, CPL_TRUE ); /* Test 6: Set the error state back to that 3rd error */ cpl_errorstate_set(state); /* - error state is still non-empty */ cpl_test_zero( cpl_errorstate_is_equal(state_none) ); /* - and distinguiable from the 2nd error */ cpl_test_zero( cpl_errorstate_is_equal(state1) ); /* - and the details of that 3rd error are preserved */ cpl_test_eq( cpl_error_get_code(), icode ); cpl_test( cpl_error_get_line() != 0); cpl_test_zero( strcmp(cpl_error_get_file(), __FILE__) ); cpl_test_zero( strcmp(cpl_error_get_function(), cpl_func) ); /* Test 7: Verify that the details of the previous, 2nd error have been lost */ cpl_errorstate_set(state1); /* - error state is still non-empty */ cpl_test_zero( cpl_errorstate_is_equal(state_none) ); /* - and distinguiable from the 3rd error */ cpl_test_zero( cpl_errorstate_is_equal(state) ); /* - but the details of that 2nd error has been lost */ cpl_test_eq( cpl_error_get_code(), CPL_ERROR_HISTORY_LOST ); cpl_test_zero( cpl_error_get_line()); cpl_test_zero( strlen(cpl_error_get_file()) ); cpl_test_zero( strlen(cpl_error_get_function()) ); /* Test 8: Verify that error state cannot be advanced */ cpl_errorstate_set(state); cpl_test( cpl_errorstate_is_equal(state1) ); /* Test 8: Verify that error state can be cleared regardless */ cpl_errorstate_set(state_none); cpl_test( cpl_errorstate_is_equal(state_none) ); /* All tests are finished */ return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Count the number of errors dumped @param self The number of the current error to be dumped @param first The number of the first error to be dumped @param last The number of the last error to be dumped @note Verifies also that the dumped errors are consequtive. Tries also to modify the CPL error state; if that were possible the counting should be corrupted. */ /*----------------------------------------------------------------------------*/ static void my_error_counter(unsigned self, unsigned first, unsigned last) { static cpl_errorstate prevstate; /* Don't try this at home */ static unsigned preverror; if (self != 0) { if (self != first) { /* Error dump must be in steps of 1 */ if (first < last) { cpl_test_eq( self, preverror + 1 ); } else { cpl_test_eq( self, preverror - 1 ); } /* Verify that the CPL error state cannot be modified from here */ cpl_errorstate_set(prevstate); } preverror = self; prevstate = cpl_errorstate_get(); } /* Verify that the CPL error state cannot be modified from here */ cpl_error_reset(); (void)cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_OUTPUT); cpl_error_set_where(cpl_func); nerrors++; if (first != 0 || last != 0) did_dump = CPL_TRUE; } cpl-6.4.1/cplcore/tests/cpl_image_resample-test.c0000644000460300003120000005150711712450215016742 00000000000000/* $Id: cpl_image_resample-test.c,v 1.50 2012-02-02 08:59:57 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-02-02 08:59:57 $ * $Revision: 1.50 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include "cpl_image_io.h" #include "cpl_vector.h" #include "cpl_image_gen.h" #include "cpl_memory.h" #include "cpl_image_resample.h" #include "cpl_test.h" #include "cpl_tools.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef IMAGESZ #define IMAGESZ 64 #endif #define PIXRANGE 100 /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void check_kernel(cpl_image *, const cpl_image *, const cpl_image *, const cpl_polynomial *, const cpl_polynomial *, cpl_vector *, double, double); static void cpl_image_warp_polynomial_test_turn(int, int, cpl_vector *, double); static void cpl_image_warp_polynomial_test_shift(int, int, int, int, cpl_vector *, double); static void cpl_image_extract_subsample_test(void); static void cpl_image_get_interpolated_test(void); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_image * imf; cpl_image * imd; cpl_image * imtmp; cpl_image * dx; cpl_image * dy; cpl_image * warped; cpl_polynomial * px; cpl_polynomial * py; cpl_vector * xyprofile; const double xyradius = 2.2; /* 2.3 gives much higher rounding ? */ cpl_size expo[2]; FILE * stream; cpl_size i, j; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; cpl_test_nonnull( stream ); cpl_image_get_interpolated_test(); cpl_image_extract_subsample_test(); xyprofile = cpl_vector_new(1 + xyradius * CPL_KERNEL_TABSPERPIX); cpl_test_nonnull( xyprofile); for (i = 1-IMAGESZ; i < IMAGESZ; i += IMAGESZ/2) { for (j = 1-IMAGESZ; j < IMAGESZ; j += IMAGESZ/2) { cpl_image_warp_polynomial_test_shift(IMAGESZ, IMAGESZ, i, j, xyprofile, xyradius); } } cpl_image_warp_polynomial_test_turn(IMAGESZ, IMAGESZ, xyprofile, xyradius); cpl_test_zero( cpl_vector_set_size(xyprofile, CPL_KERNEL_DEF_SAMPLES)); cpl_test_zero( cpl_vector_fill_kernel_profile(xyprofile, CPL_KERNEL_DEFAULT, CPL_KERNEL_DEF_WIDTH) ); /* Define the following polynomials : */ /* x = 0.945946.u + -0.135135.v + -6.75676 */ /* y = -0.202703.u + 0.743243.v + -12.8378 */ px = cpl_polynomial_new(2); py = cpl_polynomial_new(2); expo[0] = 1; expo[1] = 0; cpl_polynomial_set_coeff(px, expo, 0.945946); expo[0] = 0; expo[1] = 1; cpl_polynomial_set_coeff(px, expo, -0.135135); expo[0] = 0; expo[1] = 0; cpl_polynomial_set_coeff(px, expo, -6.75676); expo[0] = 1; expo[1] = 0; cpl_polynomial_set_coeff(py, expo, -0.202703); expo[0] = 0; expo[1] = 1; cpl_polynomial_set_coeff(py, expo, 0.743243); expo[0] = 0; expo[1] = 0; cpl_polynomial_set_coeff(py, expo, -12.8378); /* First create a test image */ cpl_msg_info("", "Create double and float test images."); imd = cpl_image_fill_test_create(IMAGESZ, IMAGESZ); imf = cpl_image_cast(imd, CPL_TYPE_FLOAT); cpl_msg_info("", "Apply the polynomial warping to the DOUBLE image."); /* Apply polynomial warping on the DOUBLE image */ warped = cpl_image_new(IMAGESZ/3, IMAGESZ*2, CPL_TYPE_DOUBLE); cpl_test_nonnull( warped ); cpl_test_zero( cpl_image_warp_polynomial(warped, imd, px, py, xyprofile, 2, xyprofile, 2) ); cpl_image_multiply_scalar(warped, 0.0); cpl_test_zero( cpl_image_fill_jacobian_polynomial(warped, px, py) ); cpl_image_multiply_scalar(warped, 0.0); /* Apply polynomial warping on the FLOAT image */ cpl_test_zero( cpl_image_warp_polynomial(warped, imf, px, py, xyprofile, 2, xyprofile, 2) ); cpl_image_multiply_scalar(warped, 0.0); cpl_polynomial_delete(px); cpl_polynomial_delete(py); /* Test cpl_image_warp() */ dx = cpl_image_new(cpl_image_get_size_x(warped), cpl_image_get_size_y(warped), CPL_TYPE_DOUBLE); dy = cpl_image_new(cpl_image_get_size_x(warped), cpl_image_get_size_y(warped), CPL_TYPE_DOUBLE); cpl_image_add_scalar(dx, 1.0); cpl_image_add_scalar(dy, -2.0); cpl_test_zero( cpl_image_warp(warped, imd, dx, dy, xyprofile, 2, xyprofile, 2)); cpl_image_multiply_scalar(warped, 0.0); cpl_test_zero( cpl_image_fill_jacobian(warped, dx, dy) ); cpl_image_multiply_scalar(warped, 0.0); cpl_test_zero( cpl_image_warp(warped, imf, dx, dy, xyprofile, 2, xyprofile, 2)); cpl_image_multiply_scalar(warped, 0.0); cpl_image_delete(dx); cpl_image_delete(dy); cpl_image_delete(warped); cpl_vector_delete(xyprofile); /* Test sub-sampling on imf and imd */ cpl_msg_info("", "Sub sample imf and imd"); imtmp = cpl_image_extract_subsample(imf, 2, 2); cpl_test_nonnull( imtmp ); cpl_image_delete(imtmp); imtmp = cpl_image_extract_subsample(imd, 2, 2); cpl_test_nonnull( imtmp ); cpl_image_delete(imtmp); cpl_image_delete(imf); cpl_image_delete(imd); if (stream != stdout) cpl_test_zero( fclose(stream) ); return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @internal @brief Check if a pixel move with the kernel preserves the pixel values @param temp Preallocated image for interpolation @param ref Reference image verification @param warp Image to transform @param px Polynomial Pu(x,y) @param py Polynomial Pv(x,y) @param kernel Kernel type to test @param xyprofile Interpolation weight as a function of the distance @param xyradius Positive inclusion radius @param tol Tolerance on pixel comparison @return void */ /*----------------------------------------------------------------------------*/ static void check_kernel(cpl_image * temp, const cpl_image * ref, const cpl_image * warp, const cpl_polynomial * px, const cpl_polynomial * py, cpl_vector * xyprofile, double xyradius, double imtol) { /* These kernels preserve the actual pixel-values */ cpl_kernel kernels[] = {CPL_KERNEL_TANH, CPL_KERNEL_SINC, CPL_KERNEL_SINC2, CPL_KERNEL_LANCZOS, CPL_KERNEL_HANN, CPL_KERNEL_NEAREST, CPL_KERNEL_HAMMING}; /* FIXME: Integer tolerence higher (1 for int) for CPL_KERNEL_TANH */ const double imtol0 = cpl_image_get_type(ref) == CPL_TYPE_INT ? 1.0 : imtol * 10.0 * PIXRANGE; int ityp; for (ityp = 0; ityp < (int)(sizeof(kernels)/sizeof(kernels[0])); ityp++) { const double tol = ityp ? imtol : imtol0; cpl_msg_debug(cpl_func, "%g-tol transform with kernel-radius (%d): %g", tol, kernels[ityp], xyradius); cpl_test_zero(cpl_vector_fill_kernel_profile(xyprofile, kernels[ityp], xyradius)); cpl_test_zero(cpl_image_warp_polynomial(temp, warp, px, py, xyprofile, xyradius, xyprofile, xyradius)); cpl_test_image_abs(temp, ref, xyradius * xyradius * tol); } return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Verify a warp-shift with an explicit shift @param nx Image X-size @param ny Image Y-size @param dx Shift in X @param dy Shift in Y @param xyprofile Interpolation weight as a function of the distance @param xyradius Positive inclusion radius @return void */ /*----------------------------------------------------------------------------*/ static void cpl_image_warp_polynomial_test_shift(int nx, int ny, int dx, int dy, cpl_vector * xyprofile, double xyradius) { const cpl_type imtypes[] = {CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT}; const double imtol[] = {DBL_EPSILON, FLT_EPSILON, 0.0}; cpl_polynomial * px = cpl_polynomial_new(2); cpl_polynomial * py = cpl_polynomial_new(2); cpl_mask * mask = NULL; cpl_size expo[2]; int ityp; /* The shift: (u,v) = (x-dx, y-dy) */ expo[0] = 0; expo[1] = 0; cpl_polynomial_set_coeff(px, expo, -dx); cpl_polynomial_set_coeff(py, expo, -dy); expo[0] = 1; expo[1] = 0; cpl_polynomial_set_coeff(px, expo, 1.0); expo[0] = 0; expo[1] = 1; cpl_polynomial_set_coeff(py, expo, 1.0); for (ityp = 0; ityp < (int)(sizeof(imtypes)/sizeof(imtypes[0])); ityp++) { cpl_image * noise = cpl_image_new(nx, ny, imtypes[ityp]); cpl_image * trans = cpl_image_new(nx, ny, imtypes[ityp]); cpl_image * temp = cpl_image_new(nx, ny, imtypes[ityp]); cpl_msg_info(cpl_func, "%d x %d shift a %d x %d %s image with a " "polynomial-warp", dx, dy, nx, ny, cpl_type_get_name(imtypes[ityp])); cpl_test_zero(cpl_image_fill_noise_uniform(noise, -PIXRANGE, PIXRANGE)); if (mask == NULL) { int count; do { /* Need a mask with a mix of elements */ cpl_mask_delete(mask); mask = cpl_mask_threshold_image_create(noise, -0.2 * PIXRANGE, 0.2 * PIXRANGE); count = cpl_mask_count(mask); } while (count == 0 || count == nx*ny); cpl_msg_info(cpl_func, "Rejecting %d of %d pixels", count, nx*ny); cpl_test_zero(cpl_image_reject_from_mask(noise, mask)); } cpl_test_zero(cpl_image_copy(trans, noise, 1, 1)); cpl_test_zero(cpl_image_shift(trans, dx, dy)); check_kernel(temp, trans, noise, px, py, xyprofile, xyradius, imtol[ityp]); cpl_image_delete(temp); cpl_image_delete(noise); cpl_image_delete(trans); } cpl_mask_delete(mask); cpl_polynomial_delete(px); cpl_polynomial_delete(py); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Verify a warp-turn with an explicit turn @param nx Image X-size @param ny Image Y-size @param xyprofile Interpolation weight as a function of the distance @param xyradius Positive inclusion radius @return void */ /*----------------------------------------------------------------------------*/ static void cpl_image_warp_polynomial_test_turn(int nx, int ny, cpl_vector * xyprofile, double xyradius) { const cpl_type imtypes[] = {CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT}; const double imtol[] = {DBL_EPSILON, FLT_EPSILON, 0.0}; cpl_polynomial * px = cpl_polynomial_new(2); cpl_polynomial * py = cpl_polynomial_new(2); cpl_mask * mask = NULL; cpl_size expo[2]; int ityp; /* The rotation: (u,v) = (y, N+1-x) */ expo[0] = 0; expo[1] = 0; cpl_polynomial_set_coeff(py, expo, 1+IMAGESZ); expo[0] = 0; expo[1] = 1; cpl_polynomial_set_coeff(px, expo, 1); expo[0] = 1; expo[1] = 0; cpl_polynomial_set_coeff(py, expo, -1); for (ityp = 0; ityp < (int)(sizeof(imtypes)/sizeof(imtypes[0])); ityp++) { cpl_image * noise = cpl_image_new(nx, ny, imtypes[ityp]); cpl_image * trans = cpl_image_new(nx, ny, imtypes[ityp]); cpl_image * temp = cpl_image_new(nx, ny, imtypes[ityp]); cpl_msg_info(cpl_func, "Turn a %d x %d %s image with a polynomial-" "warp", nx, ny, cpl_type_get_name(imtypes[ityp])); cpl_test_zero(cpl_image_fill_noise_uniform(noise, -PIXRANGE, PIXRANGE)); if (mask == NULL) { int count; do { /* Need a mask with a mix of elements */ cpl_mask_delete(mask); mask = cpl_mask_threshold_image_create(noise, -0.2 * PIXRANGE, 0.2 * PIXRANGE); count = cpl_mask_count(mask); } while (count == 0 || count == nx*ny); cpl_msg_info(cpl_func, "Rejecting %d of %d pixels", count, nx*ny); cpl_test_zero(cpl_image_reject_from_mask(noise, mask)); } cpl_test_zero(cpl_image_copy(trans, noise, 1, 1)); cpl_test_zero(cpl_image_turn(trans, -1)); check_kernel(temp, trans, noise, px, py, xyprofile, xyradius, imtol[ityp]); cpl_image_delete(temp); cpl_image_delete(noise); cpl_image_delete(trans); } cpl_mask_delete(mask); cpl_polynomial_delete(px); cpl_polynomial_delete(py); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @return void @see cpl_image_extract_subsample(), cpl_image_rebin() @note Adding some real tests */ /*----------------------------------------------------------------------------*/ static void cpl_image_extract_subsample_test(void) { cpl_image *carlo; cpl_image *subcarlo; cpl_image *expected; int data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18,19, 20,21,22,23,24,25,26,27,28,29, 30,31,32,33,34,35,36,37,38,39, 40,41,42,43,44,45,46,47,48,49, 50,51,52,53,54,55,56,57,58,59}; int exp_data[] = {0, 2, 4, 6, 8, 20,22,24,26,28, 40,42,44,46,48}; int exp_data2[] = {0, 3, 6, 9, 40,43,46,49}; int exp_data3[] = {102,120,138, 222,240,258}; int exp_data4[] = {264, 328}; cpl_error_code error; carlo = cpl_image_wrap_int(10, 6, data); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(carlo); error = cpl_image_reject(carlo, 3, 3); cpl_test_eq_error(error, CPL_ERROR_NONE); subcarlo = cpl_image_extract_subsample(carlo, 2, 2); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(subcarlo); expected = cpl_image_wrap_int(5, 3, exp_data); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(expected); cpl_test_image_abs(subcarlo, expected, 0); cpl_image_delete(subcarlo); cpl_test_eq_ptr(cpl_image_unwrap(expected), exp_data); subcarlo = cpl_image_extract_subsample(carlo, 3, 4); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(subcarlo); expected = cpl_image_wrap_int(4, 2, exp_data2); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(expected); cpl_test_image_abs(subcarlo, expected, 0); cpl_image_delete(subcarlo); cpl_test_eq_ptr(cpl_image_unwrap(expected), exp_data2); subcarlo = cpl_image_rebin(carlo, 2, 2, 3, 2); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(subcarlo); expected = cpl_image_wrap_int(3, 2, exp_data3); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(expected); cpl_test_image_abs(subcarlo, expected, 0); cpl_image_delete(subcarlo); cpl_test_eq_ptr(cpl_image_unwrap(expected), exp_data3); subcarlo = cpl_image_rebin(carlo, 1, 1, 4, 4); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(subcarlo); expected = cpl_image_wrap_int(2, 1, exp_data4); cpl_test_error(CPL_ERROR_NONE); cpl_test_nonnull(expected); cpl_test_image_abs(subcarlo, expected, 0); cpl_image_delete(subcarlo); cpl_test_eq_ptr(cpl_image_unwrap(expected), exp_data4); cpl_test_eq_ptr(cpl_image_unwrap(carlo), data); } /*----------------------------------------------------------------------------*/ /** @internal @brief Test the CPL function @return void @see cpl_image_get_interpolated() */ /*----------------------------------------------------------------------------*/ static void cpl_image_get_interpolated_test(void) { const cpl_type ttype[] = {CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE}; const cpl_size tsize[] = {50, 500}; const double value1[] = {2, 3}; const double value2[] = {5, 7}; const double mean = (value1[0] + value1[1] + value2[0] + value2[1])/4.0; const double txyrad[] = {-1.0, 0.0, CPL_KERNEL_DEF_WIDTH, 24.0, 100.0, 240.0}; cpl_vector * xyprofile = cpl_vector_new(CPL_KERNEL_DEF_SAMPLES); size_t isize; for (isize = 0; isize < sizeof(tsize)/sizeof(tsize[0]); isize++) { size_t itype; const cpl_size imsize = tsize[isize]; const double c = 0.5 + (double)imsize / 2.0; cpl_size i, j; cpl_error_code error; cpl_image * dimage = cpl_image_new(imsize, imsize, CPL_TYPE_DOUBLE); cpl_test_nonnull(dimage); for (j = 0; j < imsize; j++) { const double * pvalue = 2 * j < imsize ? value1 : value2; for (i = 0; i < imsize; i++) { (void)cpl_image_set(dimage, i+1, j+1, pvalue[2 * i < imsize ? 0 : 1]); } } for (itype = 0; itype < sizeof(ttype)/sizeof(ttype[0]); itype++) { size_t ixyrad; const cpl_type imtype = ttype[itype]; cpl_image * image = imtype == CPL_TYPE_DOUBLE ? dimage : cpl_image_cast(dimage, imtype); for (ixyrad = 0; ixyrad < sizeof(txyrad)/sizeof(txyrad[0]); ixyrad++) { const double xyradius = txyrad[ixyrad]; double value, confidence; cpl_msg_info(cpl_func, "Interpolating from %d X %d %s-image, " "r=%g", (int)imsize, (int)imsize, cpl_type_get_name(imtype), xyradius); error = cpl_vector_fill_kernel_profile(xyprofile, CPL_KERNEL_DEFAULT, xyradius); cpl_test_eq_error(error, xyradius > 0.0 ? CPL_ERROR_NONE : CPL_ERROR_ILLEGAL_INPUT); value = cpl_image_get_interpolated(image, c, c, xyprofile, xyradius, xyprofile, xyradius, &confidence); if (xyradius > 0.0) { cpl_test_eq_error(error, CPL_ERROR_NONE); cpl_test_abs(value, mean, 4.0 * xyradius * DBL_EPSILON); if (xyradius < imsize) { cpl_test_abs(confidence, 1.0, 30.0 * DBL_EPSILON); } else { cpl_test_abs(confidence, 1.0, xyradius * DBL_EPSILON); } } else { cpl_test_eq_error(error, CPL_ERROR_ILLEGAL_INPUT); } } if (image != dimage) cpl_image_delete(image); } cpl_image_delete(dimage); } cpl_vector_delete(xyprofile); } cpl-6.4.1/cplcore/tests/cpl_test_init-test.c0000644000460300003120000002625012044221537015771 00000000000000/* $Id: cpl_test_init-test.c,v 1.1 2012-10-31 13:10:55 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2012 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-10-31 13:10:55 $ * $Revision: 1.1 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #ifdef HAVE_UNISTD_H /* Used for fork(), pipe(), read() and write() */ #include #endif /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define NUMBER_OF_FILENAMES 26 /*----------------------------------------------------------------------------- Private functions -----------------------------------------------------------------------------*/ #ifdef HAVE_UNISTD_H /* The pipe on which the child writes the log file name to the parent. */ int pipefd[2] = {-1, -1}; /* The signal handler for writing the log file name in the child process. We do the writing in a signal handler at the abort stage since the cpl_test_init_macro() routine that we are testing might abort if it can not create a file with the filename it generated during the test. */ static void signal_handler(int sig) { if (sig == SIGABRT) { ssize_t total_written = 0; /* We are assuming that cpl_msg_get_log_name() is reentrant and safe for a signal handler. Since this only happens once at abort it probably does not matter much anyway, even if it technically is not safe. */ const char* logname = cpl_msg_get_log_name(); /* Write the message taking into account partial writes. Note: on the child side we only ever touch pipefd in the signal handler so no chance of a race condition. Plus these routines are all fine to use in signal handlers according to POSIX. */ do { ssize_t bytes_written = write(pipefd[1], logname+total_written, strlen(logname)+1-total_written); if (bytes_written < 0) break; total_written += bytes_written; } while (total_written != (ssize_t)(strlen(logname)+1)); /* Do not bother testing fsync() or close() success in the child since we are not interested in reporting such errors. We have anyway closed all the standard input and output files. If there was a failure then the parent process will anyway receive an incorrect string and print an error. */ fsync(pipefd[1]); close(pipefd[0]); close(pipefd[1]); /* Stop the logging to make sure the log file is closed to prevent unnecessary valgrind warnings. */ cpl_msg_stop_log(); } } #endif /* HAVE_UNISTD_H */ /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { #ifdef HAVE_UNISTD_H int pipe_create_result = 0; int pipe_close_result = 0; pid_t child_pid = 0; ssize_t bytes_read = 0; int current_file = 0; /* The filenames to check. */ const char* filename[NUMBER_OF_FILENAMES] = { "", ".", "..", "../", "file", "/file", "./file", "./file.c", "./file.cxx", "./file.name", "./file.name.c", "/dir/file", "/dir/file.c", "/dir/file.cxx", "/dir.name/file", "..\\", "\\file", ".\\file", ".\\file.c", ".\\file.cxx", ".\\file.name", ".\\file.name.c", "\\dir\\file", "\\dir\\file.c", "\\dir\\file.cxx", "\\dir.name\\file" }; /* List of expected filenames. */ const char* expected_filename[NUMBER_OF_FILENAMES] = { ".log", ".log", ".log", ".log", "file.log", "file.log", "file.log", "file.log", "file.log", "file.log", "file.name.log", "file.log", "file.log", "file.log", "file.log", ".log", "file.log", "file.log", "file.log", "file.log", "file.log", "file.name.log", "file.log", "file.log", "file.log", "file.log" }; /* Buffer containing the generated filename returned by the child. */ char generated_filename[1024]; /* We run the test on cpl_test_init_macro(). However, this is a bit tricky since we can only make one call to cpl_test_init_macro() per process. In addition, that routine might abort if a failure is triggered, which will be the case if the routine is buggy. Thats exactly what we want to test and catch. The solution is to fork off children processes that will make the test call to cpl_test_init_macro(). However this means that the parent cannot make a call to cpl_test_init() until all the children have been forked, since they will have a copy of the state at the point of the fork. We just have to perform all the tests silently in the parent and on the first sign of error we stop, initialise the CPL test library and print the diagnostics. We use a pipe to deliver the file name actually created by the cpl_test_init_macro() routine in the child to the parent process. */ for (current_file = 0; current_file < NUMBER_OF_FILENAMES; ++current_file) { pipe_create_result = pipe(pipefd); if (pipe_create_result != 0) break; child_pid = fork(); if (child_pid == -1) break; if (child_pid == 0) { /* Child process code: */ struct sigaction siginfo; /* Catch the abort signal that will be generated by the child either in cpl_test_init_macro because the log file could not be created or from the explicit call afterwards. */ memset(&siginfo, 0x0, sizeof(siginfo)); siginfo.sa_handler = &signal_handler; sigemptyset(&siginfo.sa_mask); sigaction(SIGABRT, &siginfo, NULL); /* Close all std(in)(out)(err) so the child does not write there. */ close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); cpl_test_init_macro(filename[current_file], PACKAGE_BUGREPORT, CPL_MSG_OFF); /* Children always abort so that we can then handle the write to the output pipe in one place (the signal handler). */ abort(); } else { /* Parent process code: */ size_t total_read = 0; /* Make the filename a null terminated string by filling the buffer with zeros. */ memset(&generated_filename, 0x0, sizeof(generated_filename)); /* The parent has to close the write end of the pipe before trying to read from it. If we do not do this we could deadlock, because only when all file descriptors for the write end of the pipe get closed by the child and parent, will the read fail. Otherwise it will block. The read and write end of the pipe in the child is closed in one go in its signal_handler. Note that we actually test if this close() was successful because we must make sure the write end is indeed closed to avoid any deadlock. */ pipe_close_result = close(pipefd[1]); if (pipe_close_result != 0) break; /* Read the filename string from the child. We keep going if we get interrupted or until a NULL terminator is read. */ do { bytes_read = read(pipefd[0], generated_filename + total_read, sizeof(generated_filename)-1-total_read); if (bytes_read > 0) { total_read += bytes_read; if (generated_filename[total_read-1] == '\0') break; } } while (bytes_read == -1 && errno == EINTR); /* Can now close the pipe. Do not bother checking the status of the file closure, since any error here means that generated_filename contains a value that was not expected and an error will be generated later anyway. */ close(pipefd[0]); /* Try remove the generated log file. We do not check the return status since the file might not actually have been generated, so we will fail in remove() in such a case. */ remove(generated_filename); if (bytes_read < 0) break; /* Had a read error? */ /* Check that we got the correct response from the child. */ if (strcmp(generated_filename, expected_filename[current_file]) != 0) { break; } } } /* We can finally initialise the CPL subsystem in the parent since no more children will be created, check the status and print test diagnostics. */ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); cpl_test_assert(pipe_create_result == 0); cpl_test_assert(pipe_close_result == 0); cpl_test_assert(child_pid != -1); cpl_test_assert(bytes_read >= 0); if (current_file < NUMBER_OF_FILENAMES) { cpl_test_eq_string(generated_filename, expected_filename[current_file]); } cpl_test_eq(current_file, NUMBER_OF_FILENAMES); #else /* HAVE_UNISTD_H */ /* In the case that we dont have unistd.h we just write a warning. */ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); cpl_msg_warn(cpl_func, "No support for unistd.h, so this test cannot be completed"); #endif /* HAVE_UNISTD_H */ return cpl_test_end(0); } cpl-6.4.1/cplcore/tests/cpl_image_iqe-test.c0000644000460300003120000001040412075554424015711 00000000000000/* $Id: cpl_image_iqe-test.c,v 1.21 2013-01-16 16:45:07 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-01-16 16:45:07 $ * $Revision: 1.21 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image_iqe.h" #include "cpl_image_io.h" #include "cpl_test.h" #include "cpl_memory.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef IMAGESZ #define IMAGESZ 512 #endif #ifndef IMAGEMIN #define IMAGEMIN 185 #endif #ifndef IMAGEMAX #define IMAGEMAX 225 #endif /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_image * imf; cpl_image * imd; cpl_bivector * res; FILE * stream; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ stream = cpl_msg_get_level() > CPL_MSG_INFO ? fopen("/dev/null", "a") : stdout; cpl_test_nonnull( stream ); /* Create the images */ imd = cpl_image_fill_test_create(IMAGESZ, IMAGESZ); cpl_test_nonnull(imd); imf = cpl_image_cast(imd, CPL_TYPE_FLOAT); cpl_test_nonnull(imf); /* Check error handling */ res = cpl_image_iqe(NULL, IMAGEMIN, IMAGEMIN, IMAGEMAX, IMAGEMAX); cpl_test_error( CPL_ERROR_NULL_INPUT ); cpl_test_null(res); res = cpl_image_iqe(imd, IMAGEMIN, IMAGEMIN, IMAGEMAX, IMAGEMAX); cpl_test_error( CPL_ERROR_INVALID_TYPE ); cpl_test_null(res); res = cpl_image_iqe(imf, IMAGESZ, IMAGESZ, IMAGESZ+1, IMAGESZ+1); cpl_test_error( CPL_ERROR_ILLEGAL_INPUT ); cpl_test_null(res); res = cpl_image_iqe(imf, IMAGEMIN, IMAGEMIN, IMAGEMIN+2, IMAGEMAX); cpl_test_error( CPL_ERROR_ILLEGAL_INPUT ); cpl_test_null(res); res = cpl_image_iqe(imf, IMAGEMIN, IMAGEMIN, IMAGEMAX, IMAGEMIN+2); cpl_test_error( CPL_ERROR_ILLEGAL_INPUT ); cpl_test_null(res); /* Compute the IQE */ res = cpl_image_iqe(imf, IMAGEMIN, IMAGEMIN, IMAGEMAX, IMAGEMAX); cpl_test_error( CPL_ERROR_NONE ); cpl_test_nonnull(res); cpl_test_eq( cpl_bivector_get_size(res), 7); cpl_bivector_dump(res, stream); cpl_bivector_delete(res); cpl_image_delete(imd); cpl_image_delete(imf); /* * Regression test for a copy and paste bug found in line cpl_image_iqe.c:745. */ imf = cpl_image_new(200, 64, CPL_TYPE_FLOAT); cpl_test_nonnull(imf); cpl_image_fill_noise_uniform(imf, -10, 10); cpl_test_error( CPL_ERROR_NONE ); imd = cpl_image_duplicate(imf); cpl_test_nonnull(imd); cpl_image_fill_gaussian(imd, 168, 32, 50000.0, 15, 4); cpl_test_error( CPL_ERROR_NONE ); cpl_image_add(imf, imd); cpl_test_error( CPL_ERROR_NONE ); res = cpl_image_iqe(imf, 1, 1, cpl_image_get_size_x(imf), cpl_image_get_size_y(imf)); cpl_test_error( CPL_ERROR_NONE ); cpl_test_nonnull(res); cpl_bivector_delete(res); cpl_image_delete(imd); cpl_image_delete(imf); if (stream != stdout) cpl_test_zero( fclose(stream) ); return cpl_test_end(0); } /**@}*/ cpl-6.4.1/cplcore/tests/Makefile.in0000644000460300003120000017606112310332723014057 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = cpl_type-test$(EXEEXT) cpl_tools-test$(EXEEXT) \ cpl_image_io-test$(EXEEXT) cpl_image_basic-test$(EXEEXT) \ cpl_image_iqe-test$(EXEEXT) cpl_image_bpm-test$(EXEEXT) \ cpl_image_resample-test$(EXEEXT) cpl_filter-test$(EXEEXT) \ cpl_fits-test$(EXEEXT) cpl_stats-test$(EXEEXT) \ cpl_math-test$(EXEEXT) cpl_image_filter-test$(EXEEXT) \ cpl_image_gen-test$(EXEEXT) cpl_imagelist_io-test$(EXEEXT) \ cpl_imagelist_basic-test$(EXEEXT) cpl_io_fits-test$(EXEEXT) \ cpl_mask-test$(EXEEXT) cpl_table-test$(EXEEXT) \ cpl_test-test$(EXEEXT) cpl_test_init-test$(EXEEXT) \ cpl_matrix-test$(EXEEXT) cpl_msg-test$(EXEEXT) \ cpl_memory-test$(EXEEXT) cpl_plot-test$(EXEEXT) \ cpl_polynomial-test$(EXEEXT) cpl_error-test$(EXEEXT) \ cpl_errorstate-test$(EXEEXT) cpl_vector-test$(EXEEXT) \ cpl_bivector-test$(EXEEXT) cpl_property-test$(EXEEXT) \ cpl_propertylist-test$(EXEEXT) TESTS = cpl_image_io-test$(EXEEXT) cpl_image_basic-test$(EXEEXT) \ cpl_image_iqe-test$(EXEEXT) cpl_image_bpm-test$(EXEEXT) \ cpl_image_resample-test$(EXEEXT) cpl_filter-test$(EXEEXT) \ cpl_fits-test$(EXEEXT) cpl_stats-test$(EXEEXT) \ cpl_math-test$(EXEEXT) cpl_image_gen-test$(EXEEXT) \ cpl_image_filter-test$(EXEEXT) cpl_imagelist_io-test$(EXEEXT) \ cpl_imagelist_basic-test$(EXEEXT) cpl_io_fits-test$(EXEEXT) \ cpl_mask-test$(EXEEXT) cpl_plot-test$(EXEEXT) \ cpl_polynomial-test$(EXEEXT) cpl_error-test$(EXEEXT) \ cpl_errorstate-test$(EXEEXT) cpl_table-test$(EXEEXT) \ cpl_test-test$(EXEEXT) cpl_test_init-test$(EXEEXT) \ cpl_type-test$(EXEEXT) cpl_tools-test$(EXEEXT) \ cpl_matrix-test$(EXEEXT) cpl_msg-test$(EXEEXT) \ cpl_memory-test$(EXEEXT) cpl_vector-test$(EXEEXT) \ cpl_bivector-test$(EXEEXT) cpl_property-test$(EXEEXT) \ cpl_propertylist-test$(EXEEXT) subdir = cplcore/tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/admin/depcomp $(top_srcdir)/admin/test-driver ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/cpl.m4 $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/omp.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_cpl_bivector_test_OBJECTS = cpl_bivector-test.$(OBJEXT) cpl_bivector_test_OBJECTS = $(am_cpl_bivector_test_OBJECTS) cpl_bivector_test_LDADD = $(LDADD) am__DEPENDENCIES_1 = cpl_bivector_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_cpl_error_test_OBJECTS = cpl_error-test.$(OBJEXT) cpl_error_test_OBJECTS = $(am_cpl_error_test_OBJECTS) cpl_error_test_LDADD = $(LDADD) cpl_error_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_errorstate_test_OBJECTS = cpl_errorstate-test.$(OBJEXT) cpl_errorstate_test_OBJECTS = $(am_cpl_errorstate_test_OBJECTS) cpl_errorstate_test_LDADD = $(LDADD) cpl_errorstate_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_filter_test_OBJECTS = cpl_filter-test.$(OBJEXT) cpl_filter_test_OBJECTS = $(am_cpl_filter_test_OBJECTS) cpl_filter_test_LDADD = $(LDADD) cpl_filter_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_fits_test_OBJECTS = cpl_fits-test.$(OBJEXT) cpl_fits_test_OBJECTS = $(am_cpl_fits_test_OBJECTS) cpl_fits_test_LDADD = $(LDADD) cpl_fits_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_image_basic_test_OBJECTS = cpl_image_basic-test.$(OBJEXT) cpl_image_basic_test_OBJECTS = $(am_cpl_image_basic_test_OBJECTS) cpl_image_basic_test_LDADD = $(LDADD) cpl_image_basic_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_image_bpm_test_OBJECTS = cpl_image_bpm-test.$(OBJEXT) cpl_image_bpm_test_OBJECTS = $(am_cpl_image_bpm_test_OBJECTS) cpl_image_bpm_test_LDADD = $(LDADD) cpl_image_bpm_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_image_filter_test_OBJECTS = cpl_image_filter-test.$(OBJEXT) cpl_image_filter_test_OBJECTS = $(am_cpl_image_filter_test_OBJECTS) cpl_image_filter_test_LDADD = $(LDADD) cpl_image_filter_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_image_gen_test_OBJECTS = cpl_image_gen-test.$(OBJEXT) cpl_image_gen_test_OBJECTS = $(am_cpl_image_gen_test_OBJECTS) cpl_image_gen_test_LDADD = $(LDADD) cpl_image_gen_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_image_io_test_OBJECTS = cpl_image_io-test.$(OBJEXT) cpl_image_io_test_OBJECTS = $(am_cpl_image_io_test_OBJECTS) cpl_image_io_test_LDADD = $(LDADD) cpl_image_io_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_image_iqe_test_OBJECTS = cpl_image_iqe-test.$(OBJEXT) cpl_image_iqe_test_OBJECTS = $(am_cpl_image_iqe_test_OBJECTS) cpl_image_iqe_test_LDADD = $(LDADD) cpl_image_iqe_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_image_resample_test_OBJECTS = \ cpl_image_resample-test.$(OBJEXT) cpl_image_resample_test_OBJECTS = \ $(am_cpl_image_resample_test_OBJECTS) cpl_image_resample_test_LDADD = $(LDADD) cpl_image_resample_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_imagelist_basic_test_OBJECTS = \ cpl_imagelist_basic-test.$(OBJEXT) cpl_imagelist_basic_test_OBJECTS = \ $(am_cpl_imagelist_basic_test_OBJECTS) cpl_imagelist_basic_test_LDADD = $(LDADD) cpl_imagelist_basic_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_imagelist_io_test_OBJECTS = cpl_imagelist_io-test.$(OBJEXT) cpl_imagelist_io_test_OBJECTS = $(am_cpl_imagelist_io_test_OBJECTS) cpl_imagelist_io_test_LDADD = $(LDADD) cpl_imagelist_io_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_io_fits_test_OBJECTS = cpl_io_fits-test.$(OBJEXT) cpl_io_fits_test_OBJECTS = $(am_cpl_io_fits_test_OBJECTS) cpl_io_fits_test_LDADD = $(LDADD) cpl_io_fits_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_mask_test_OBJECTS = cpl_mask-test.$(OBJEXT) cpl_mask_test_OBJECTS = $(am_cpl_mask_test_OBJECTS) cpl_mask_test_LDADD = $(LDADD) cpl_mask_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_math_test_OBJECTS = cpl_math-test.$(OBJEXT) cpl_math_test_OBJECTS = $(am_cpl_math_test_OBJECTS) cpl_math_test_LDADD = $(LDADD) cpl_math_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_matrix_test_OBJECTS = cpl_matrix-test.$(OBJEXT) cpl_matrix_test_OBJECTS = $(am_cpl_matrix_test_OBJECTS) cpl_matrix_test_LDADD = $(LDADD) cpl_matrix_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_memory_test_OBJECTS = cpl_memory-test.$(OBJEXT) cpl_memory_test_OBJECTS = $(am_cpl_memory_test_OBJECTS) cpl_memory_test_LDADD = $(LDADD) cpl_memory_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_msg_test_OBJECTS = cpl_msg-test.$(OBJEXT) cpl_msg_test_OBJECTS = $(am_cpl_msg_test_OBJECTS) cpl_msg_test_LDADD = $(LDADD) cpl_msg_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_plot_test_OBJECTS = cpl_plot-test.$(OBJEXT) cpl_plot_test_OBJECTS = $(am_cpl_plot_test_OBJECTS) cpl_plot_test_LDADD = $(LDADD) cpl_plot_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_polynomial_test_OBJECTS = cpl_polynomial-test.$(OBJEXT) cpl_polynomial_test_OBJECTS = $(am_cpl_polynomial_test_OBJECTS) cpl_polynomial_test_LDADD = $(LDADD) cpl_polynomial_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_property_test_OBJECTS = cpl_property-test.$(OBJEXT) cpl_property_test_OBJECTS = $(am_cpl_property_test_OBJECTS) cpl_property_test_LDADD = $(LDADD) cpl_property_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_propertylist_test_OBJECTS = cpl_propertylist-test.$(OBJEXT) cpl_propertylist_test_OBJECTS = $(am_cpl_propertylist_test_OBJECTS) cpl_propertylist_test_LDADD = $(LDADD) cpl_propertylist_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_stats_test_OBJECTS = cpl_stats-test.$(OBJEXT) cpl_stats_test_OBJECTS = $(am_cpl_stats_test_OBJECTS) cpl_stats_test_LDADD = $(LDADD) cpl_stats_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_table_test_OBJECTS = cpl_table-test.$(OBJEXT) cpl_table_test_OBJECTS = $(am_cpl_table_test_OBJECTS) cpl_table_test_LDADD = $(LDADD) cpl_table_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_test_test_OBJECTS = cpl_test-test.$(OBJEXT) cpl_test_test_OBJECTS = $(am_cpl_test_test_OBJECTS) cpl_test_test_LDADD = $(LDADD) cpl_test_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_test_init_test_OBJECTS = cpl_test_init-test.$(OBJEXT) cpl_test_init_test_OBJECTS = $(am_cpl_test_init_test_OBJECTS) cpl_test_init_test_LDADD = $(LDADD) cpl_test_init_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_tools_test_OBJECTS = cpl_tools-test.$(OBJEXT) cpl_tools_test_OBJECTS = $(am_cpl_tools_test_OBJECTS) cpl_tools_test_LDADD = $(LDADD) cpl_tools_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_type_test_OBJECTS = cpl_type-test.$(OBJEXT) cpl_type_test_OBJECTS = $(am_cpl_type_test_OBJECTS) cpl_type_test_LDADD = $(LDADD) cpl_type_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_cpl_vector_test_OBJECTS = cpl_vector-test.$(OBJEXT) cpl_vector_test_OBJECTS = $(am_cpl_vector_test_OBJECTS) cpl_vector_test_LDADD = $(LDADD) cpl_vector_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(cpl_bivector_test_SOURCES) $(cpl_error_test_SOURCES) \ $(cpl_errorstate_test_SOURCES) $(cpl_filter_test_SOURCES) \ $(cpl_fits_test_SOURCES) $(cpl_image_basic_test_SOURCES) \ $(cpl_image_bpm_test_SOURCES) $(cpl_image_filter_test_SOURCES) \ $(cpl_image_gen_test_SOURCES) $(cpl_image_io_test_SOURCES) \ $(cpl_image_iqe_test_SOURCES) \ $(cpl_image_resample_test_SOURCES) \ $(cpl_imagelist_basic_test_SOURCES) \ $(cpl_imagelist_io_test_SOURCES) $(cpl_io_fits_test_SOURCES) \ $(cpl_mask_test_SOURCES) $(cpl_math_test_SOURCES) \ $(cpl_matrix_test_SOURCES) $(cpl_memory_test_SOURCES) \ $(cpl_msg_test_SOURCES) $(cpl_plot_test_SOURCES) \ $(cpl_polynomial_test_SOURCES) $(cpl_property_test_SOURCES) \ $(cpl_propertylist_test_SOURCES) $(cpl_stats_test_SOURCES) \ $(cpl_table_test_SOURCES) $(cpl_test_test_SOURCES) \ $(cpl_test_init_test_SOURCES) $(cpl_tools_test_SOURCES) \ $(cpl_type_test_SOURCES) $(cpl_vector_test_SOURCES) DIST_SOURCES = $(cpl_bivector_test_SOURCES) $(cpl_error_test_SOURCES) \ $(cpl_errorstate_test_SOURCES) $(cpl_filter_test_SOURCES) \ $(cpl_fits_test_SOURCES) $(cpl_image_basic_test_SOURCES) \ $(cpl_image_bpm_test_SOURCES) $(cpl_image_filter_test_SOURCES) \ $(cpl_image_gen_test_SOURCES) $(cpl_image_io_test_SOURCES) \ $(cpl_image_iqe_test_SOURCES) \ $(cpl_image_resample_test_SOURCES) \ $(cpl_imagelist_basic_test_SOURCES) \ $(cpl_imagelist_io_test_SOURCES) $(cpl_io_fits_test_SOURCES) \ $(cpl_mask_test_SOURCES) $(cpl_math_test_SOURCES) \ $(cpl_matrix_test_SOURCES) $(cpl_memory_test_SOURCES) \ $(cpl_msg_test_SOURCES) $(cpl_plot_test_SOURCES) \ $(cpl_polynomial_test_SOURCES) $(cpl_property_test_SOURCES) \ $(cpl_propertylist_test_SOURCES) $(cpl_stats_test_SOURCES) \ $(cpl_table_test_SOURCES) $(cpl_test_test_SOURCES) \ $(cpl_test_init_test_SOURCES) $(cpl_tools_test_SOURCES) \ $(cpl_type_test_SOURCES) $(cpl_vector_test_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/admin/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/admin/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFITSIO_INCLUDES = @CFITSIO_INCLUDES@ CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@ CFLAGS = @CFLAGS@ CPLCORE_INCLUDES = @CPLCORE_INCLUDES@ CPLDFS_INCLUDES = @CPLDFS_INCLUDES@ CPLDRS_INCLUDES = @CPLDRS_INCLUDES@ CPLUI_INCLUDES = @CPLUI_INCLUDES@ CPL_BINARY_AGE = @CPL_BINARY_AGE@ CPL_BINARY_VERSION = @CPL_BINARY_VERSION@ CPL_CFLAGS = @CPL_CFLAGS@ CPL_INTERFACE_AGE = @CPL_INTERFACE_AGE@ CPL_LDFLAGS = @CPL_LDFLAGS@ CPL_MAJOR_VERSION = @CPL_MAJOR_VERSION@ CPL_MICRO_VERSION = @CPL_MICRO_VERSION@ CPL_MINOR_VERSION = @CPL_MINOR_VERSION@ CPL_VERSION = @CPL_VERSION@ CPL_VERSION_STRING = @CPL_VERSION_STRING@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_INCLUDES = @CX_INCLUDES@ CX_LDFLAGS = @CX_LDFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FFTWF_INCLUDES = @FFTWF_INCLUDES@ FFTWF_LDFLAGS = @FFTWF_LDFLAGS@ FFTW_INCLUDES = @FFTW_INCLUDES@ FFTW_LDFLAGS = @FFTW_LDFLAGS@ FGREP = @FGREP@ GASGANO_CLASSPATH = @GASGANO_CLASSPATH@ GASGANO_SHREXT = @GASGANO_SHREXT@ GREP = @GREP@ INCLTDL = @INCLTDL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JAVA_INCLUDES = @JAVA_INCLUDES@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCEXT = @LIBCEXT@ LIBCFITSIO = @LIBCFITSIO@ LIBCPLCORE = @LIBCPLCORE@ LIBCPLDFS = @LIBCPLDFS@ LIBCPLDRS = @LIBCPLDRS@ LIBCPLUI = @LIBCPLUI@ LIBFFTW = @LIBFFTW@ LIBFFTWF = @LIBFFTWF@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBWCS = @LIBWCS@ LIPO = @LIPO@ LN_S = @LN_S@ LTDLDEPS = @LTDLDEPS@ LTDLINCL = @LTDLINCL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ WCS_INCLUDES = @WCS_INCLUDES@ WCS_LDFLAGS = @WCS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ cpl_includes = @cpl_includes@ cpl_libraries = @cpl_libraries@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libcext = @libcext@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = *~ @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in AM_CPPFLAGS = $(CPLCORE_INCLUDES) $(CX_INCLUDES) $(CFITSIO_INCLUDES) \ $(CPL_CFLAGS) AM_LDFLAGS = $(CFITSIO_LDFLAGS) LDADD = $(LIBCPLCORE) $(LIBCFITSIO) EXTRA_DIST = cpl_filter_body.h cpl_image_io_test_SOURCES = cpl_image_io-test.c cpl_image_basic_test_SOURCES = cpl_image_basic-test.c cpl_image_iqe_test_SOURCES = cpl_image_iqe-test.c cpl_image_bpm_test_SOURCES = cpl_image_bpm-test.c cpl_image_resample_test_SOURCES = cpl_image_resample-test.c cpl_filter_test_SOURCES = cpl_filter-test.c cpl_fits_test_SOURCES = cpl_fits-test.c cpl_stats_test_SOURCES = cpl_stats-test.c cpl_math_test_SOURCES = cpl_math-test.c cpl_image_gen_test_SOURCES = cpl_image_gen-test.c cpl_image_filter_test_SOURCES = cpl_image_filter-test.c cpl_imagelist_io_test_SOURCES = cpl_imagelist_io-test.c cpl_imagelist_basic_test_SOURCES = cpl_imagelist_basic-test.c cpl_io_fits_test_SOURCES = cpl_io_fits-test.c cpl_mask_test_SOURCES = cpl_mask-test.c cpl_table_test_SOURCES = cpl_table-test.c cpl_test_test_SOURCES = cpl_test-test.c cpl_test_init_test_SOURCES = cpl_test_init-test.c cpl_type_test_SOURCES = cpl_type-test.c cpl_tools_test_SOURCES = cpl_tools-test.c cpl_matrix_test_SOURCES = cpl_matrix-test.c cpl_msg_test_SOURCES = cpl_msg-test.c cpl_memory_test_SOURCES = cpl_memory-test.c cpl_plot_test_SOURCES = cpl_plot-test.c cpl_polynomial_test_SOURCES = cpl_polynomial-test.c cpl_error_test_SOURCES = cpl_error-test.c cpl_errorstate_test_SOURCES = cpl_errorstate-test.c cpl_vector_test_SOURCES = cpl_vector-test.c cpl_bivector_test_SOURCES = cpl_bivector-test.c cpl_property_test_SOURCES = cpl_property-test.c cpl_propertylist_test_SOURCES = cpl_propertylist-test.c # Be sure to reexport important environment variables. TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cplcore/tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign cplcore/tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list cpl_bivector-test$(EXEEXT): $(cpl_bivector_test_OBJECTS) $(cpl_bivector_test_DEPENDENCIES) $(EXTRA_cpl_bivector_test_DEPENDENCIES) @rm -f cpl_bivector-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_bivector_test_OBJECTS) $(cpl_bivector_test_LDADD) $(LIBS) cpl_error-test$(EXEEXT): $(cpl_error_test_OBJECTS) $(cpl_error_test_DEPENDENCIES) $(EXTRA_cpl_error_test_DEPENDENCIES) @rm -f cpl_error-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_error_test_OBJECTS) $(cpl_error_test_LDADD) $(LIBS) cpl_errorstate-test$(EXEEXT): $(cpl_errorstate_test_OBJECTS) $(cpl_errorstate_test_DEPENDENCIES) $(EXTRA_cpl_errorstate_test_DEPENDENCIES) @rm -f cpl_errorstate-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_errorstate_test_OBJECTS) $(cpl_errorstate_test_LDADD) $(LIBS) cpl_filter-test$(EXEEXT): $(cpl_filter_test_OBJECTS) $(cpl_filter_test_DEPENDENCIES) $(EXTRA_cpl_filter_test_DEPENDENCIES) @rm -f cpl_filter-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_filter_test_OBJECTS) $(cpl_filter_test_LDADD) $(LIBS) cpl_fits-test$(EXEEXT): $(cpl_fits_test_OBJECTS) $(cpl_fits_test_DEPENDENCIES) $(EXTRA_cpl_fits_test_DEPENDENCIES) @rm -f cpl_fits-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_fits_test_OBJECTS) $(cpl_fits_test_LDADD) $(LIBS) cpl_image_basic-test$(EXEEXT): $(cpl_image_basic_test_OBJECTS) $(cpl_image_basic_test_DEPENDENCIES) $(EXTRA_cpl_image_basic_test_DEPENDENCIES) @rm -f cpl_image_basic-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_image_basic_test_OBJECTS) $(cpl_image_basic_test_LDADD) $(LIBS) cpl_image_bpm-test$(EXEEXT): $(cpl_image_bpm_test_OBJECTS) $(cpl_image_bpm_test_DEPENDENCIES) $(EXTRA_cpl_image_bpm_test_DEPENDENCIES) @rm -f cpl_image_bpm-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_image_bpm_test_OBJECTS) $(cpl_image_bpm_test_LDADD) $(LIBS) cpl_image_filter-test$(EXEEXT): $(cpl_image_filter_test_OBJECTS) $(cpl_image_filter_test_DEPENDENCIES) $(EXTRA_cpl_image_filter_test_DEPENDENCIES) @rm -f cpl_image_filter-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_image_filter_test_OBJECTS) $(cpl_image_filter_test_LDADD) $(LIBS) cpl_image_gen-test$(EXEEXT): $(cpl_image_gen_test_OBJECTS) $(cpl_image_gen_test_DEPENDENCIES) $(EXTRA_cpl_image_gen_test_DEPENDENCIES) @rm -f cpl_image_gen-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_image_gen_test_OBJECTS) $(cpl_image_gen_test_LDADD) $(LIBS) cpl_image_io-test$(EXEEXT): $(cpl_image_io_test_OBJECTS) $(cpl_image_io_test_DEPENDENCIES) $(EXTRA_cpl_image_io_test_DEPENDENCIES) @rm -f cpl_image_io-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_image_io_test_OBJECTS) $(cpl_image_io_test_LDADD) $(LIBS) cpl_image_iqe-test$(EXEEXT): $(cpl_image_iqe_test_OBJECTS) $(cpl_image_iqe_test_DEPENDENCIES) $(EXTRA_cpl_image_iqe_test_DEPENDENCIES) @rm -f cpl_image_iqe-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_image_iqe_test_OBJECTS) $(cpl_image_iqe_test_LDADD) $(LIBS) cpl_image_resample-test$(EXEEXT): $(cpl_image_resample_test_OBJECTS) $(cpl_image_resample_test_DEPENDENCIES) $(EXTRA_cpl_image_resample_test_DEPENDENCIES) @rm -f cpl_image_resample-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_image_resample_test_OBJECTS) $(cpl_image_resample_test_LDADD) $(LIBS) cpl_imagelist_basic-test$(EXEEXT): $(cpl_imagelist_basic_test_OBJECTS) $(cpl_imagelist_basic_test_DEPENDENCIES) $(EXTRA_cpl_imagelist_basic_test_DEPENDENCIES) @rm -f cpl_imagelist_basic-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_imagelist_basic_test_OBJECTS) $(cpl_imagelist_basic_test_LDADD) $(LIBS) cpl_imagelist_io-test$(EXEEXT): $(cpl_imagelist_io_test_OBJECTS) $(cpl_imagelist_io_test_DEPENDENCIES) $(EXTRA_cpl_imagelist_io_test_DEPENDENCIES) @rm -f cpl_imagelist_io-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_imagelist_io_test_OBJECTS) $(cpl_imagelist_io_test_LDADD) $(LIBS) cpl_io_fits-test$(EXEEXT): $(cpl_io_fits_test_OBJECTS) $(cpl_io_fits_test_DEPENDENCIES) $(EXTRA_cpl_io_fits_test_DEPENDENCIES) @rm -f cpl_io_fits-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_io_fits_test_OBJECTS) $(cpl_io_fits_test_LDADD) $(LIBS) cpl_mask-test$(EXEEXT): $(cpl_mask_test_OBJECTS) $(cpl_mask_test_DEPENDENCIES) $(EXTRA_cpl_mask_test_DEPENDENCIES) @rm -f cpl_mask-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_mask_test_OBJECTS) $(cpl_mask_test_LDADD) $(LIBS) cpl_math-test$(EXEEXT): $(cpl_math_test_OBJECTS) $(cpl_math_test_DEPENDENCIES) $(EXTRA_cpl_math_test_DEPENDENCIES) @rm -f cpl_math-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_math_test_OBJECTS) $(cpl_math_test_LDADD) $(LIBS) cpl_matrix-test$(EXEEXT): $(cpl_matrix_test_OBJECTS) $(cpl_matrix_test_DEPENDENCIES) $(EXTRA_cpl_matrix_test_DEPENDENCIES) @rm -f cpl_matrix-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_matrix_test_OBJECTS) $(cpl_matrix_test_LDADD) $(LIBS) cpl_memory-test$(EXEEXT): $(cpl_memory_test_OBJECTS) $(cpl_memory_test_DEPENDENCIES) $(EXTRA_cpl_memory_test_DEPENDENCIES) @rm -f cpl_memory-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_memory_test_OBJECTS) $(cpl_memory_test_LDADD) $(LIBS) cpl_msg-test$(EXEEXT): $(cpl_msg_test_OBJECTS) $(cpl_msg_test_DEPENDENCIES) $(EXTRA_cpl_msg_test_DEPENDENCIES) @rm -f cpl_msg-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_msg_test_OBJECTS) $(cpl_msg_test_LDADD) $(LIBS) cpl_plot-test$(EXEEXT): $(cpl_plot_test_OBJECTS) $(cpl_plot_test_DEPENDENCIES) $(EXTRA_cpl_plot_test_DEPENDENCIES) @rm -f cpl_plot-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_plot_test_OBJECTS) $(cpl_plot_test_LDADD) $(LIBS) cpl_polynomial-test$(EXEEXT): $(cpl_polynomial_test_OBJECTS) $(cpl_polynomial_test_DEPENDENCIES) $(EXTRA_cpl_polynomial_test_DEPENDENCIES) @rm -f cpl_polynomial-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_polynomial_test_OBJECTS) $(cpl_polynomial_test_LDADD) $(LIBS) cpl_property-test$(EXEEXT): $(cpl_property_test_OBJECTS) $(cpl_property_test_DEPENDENCIES) $(EXTRA_cpl_property_test_DEPENDENCIES) @rm -f cpl_property-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_property_test_OBJECTS) $(cpl_property_test_LDADD) $(LIBS) cpl_propertylist-test$(EXEEXT): $(cpl_propertylist_test_OBJECTS) $(cpl_propertylist_test_DEPENDENCIES) $(EXTRA_cpl_propertylist_test_DEPENDENCIES) @rm -f cpl_propertylist-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_propertylist_test_OBJECTS) $(cpl_propertylist_test_LDADD) $(LIBS) cpl_stats-test$(EXEEXT): $(cpl_stats_test_OBJECTS) $(cpl_stats_test_DEPENDENCIES) $(EXTRA_cpl_stats_test_DEPENDENCIES) @rm -f cpl_stats-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_stats_test_OBJECTS) $(cpl_stats_test_LDADD) $(LIBS) cpl_table-test$(EXEEXT): $(cpl_table_test_OBJECTS) $(cpl_table_test_DEPENDENCIES) $(EXTRA_cpl_table_test_DEPENDENCIES) @rm -f cpl_table-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_table_test_OBJECTS) $(cpl_table_test_LDADD) $(LIBS) cpl_test-test$(EXEEXT): $(cpl_test_test_OBJECTS) $(cpl_test_test_DEPENDENCIES) $(EXTRA_cpl_test_test_DEPENDENCIES) @rm -f cpl_test-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_test_test_OBJECTS) $(cpl_test_test_LDADD) $(LIBS) cpl_test_init-test$(EXEEXT): $(cpl_test_init_test_OBJECTS) $(cpl_test_init_test_DEPENDENCIES) $(EXTRA_cpl_test_init_test_DEPENDENCIES) @rm -f cpl_test_init-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_test_init_test_OBJECTS) $(cpl_test_init_test_LDADD) $(LIBS) cpl_tools-test$(EXEEXT): $(cpl_tools_test_OBJECTS) $(cpl_tools_test_DEPENDENCIES) $(EXTRA_cpl_tools_test_DEPENDENCIES) @rm -f cpl_tools-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_tools_test_OBJECTS) $(cpl_tools_test_LDADD) $(LIBS) cpl_type-test$(EXEEXT): $(cpl_type_test_OBJECTS) $(cpl_type_test_DEPENDENCIES) $(EXTRA_cpl_type_test_DEPENDENCIES) @rm -f cpl_type-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_type_test_OBJECTS) $(cpl_type_test_LDADD) $(LIBS) cpl_vector-test$(EXEEXT): $(cpl_vector_test_OBJECTS) $(cpl_vector_test_DEPENDENCIES) $(EXTRA_cpl_vector_test_DEPENDENCIES) @rm -f cpl_vector-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cpl_vector_test_OBJECTS) $(cpl_vector_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_bivector-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_error-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_errorstate-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_filter-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_fits-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_basic-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_bpm-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_filter-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_gen-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_io-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_iqe-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_resample-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_imagelist_basic-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_imagelist_io-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_io_fits-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_mask-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_math-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_matrix-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_memory-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_msg-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_plot-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_polynomial-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_property-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_propertylist-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_stats-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_table-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_test-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_test_init-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_tools-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_type-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_vector-test.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # exand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ else \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? cpl_image_io-test.log: cpl_image_io-test$(EXEEXT) @p='cpl_image_io-test$(EXEEXT)'; \ b='cpl_image_io-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_image_basic-test.log: cpl_image_basic-test$(EXEEXT) @p='cpl_image_basic-test$(EXEEXT)'; \ b='cpl_image_basic-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_image_iqe-test.log: cpl_image_iqe-test$(EXEEXT) @p='cpl_image_iqe-test$(EXEEXT)'; \ b='cpl_image_iqe-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_image_bpm-test.log: cpl_image_bpm-test$(EXEEXT) @p='cpl_image_bpm-test$(EXEEXT)'; \ b='cpl_image_bpm-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_image_resample-test.log: cpl_image_resample-test$(EXEEXT) @p='cpl_image_resample-test$(EXEEXT)'; \ b='cpl_image_resample-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_filter-test.log: cpl_filter-test$(EXEEXT) @p='cpl_filter-test$(EXEEXT)'; \ b='cpl_filter-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_fits-test.log: cpl_fits-test$(EXEEXT) @p='cpl_fits-test$(EXEEXT)'; \ b='cpl_fits-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_stats-test.log: cpl_stats-test$(EXEEXT) @p='cpl_stats-test$(EXEEXT)'; \ b='cpl_stats-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_math-test.log: cpl_math-test$(EXEEXT) @p='cpl_math-test$(EXEEXT)'; \ b='cpl_math-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_image_gen-test.log: cpl_image_gen-test$(EXEEXT) @p='cpl_image_gen-test$(EXEEXT)'; \ b='cpl_image_gen-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_image_filter-test.log: cpl_image_filter-test$(EXEEXT) @p='cpl_image_filter-test$(EXEEXT)'; \ b='cpl_image_filter-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_imagelist_io-test.log: cpl_imagelist_io-test$(EXEEXT) @p='cpl_imagelist_io-test$(EXEEXT)'; \ b='cpl_imagelist_io-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_imagelist_basic-test.log: cpl_imagelist_basic-test$(EXEEXT) @p='cpl_imagelist_basic-test$(EXEEXT)'; \ b='cpl_imagelist_basic-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_io_fits-test.log: cpl_io_fits-test$(EXEEXT) @p='cpl_io_fits-test$(EXEEXT)'; \ b='cpl_io_fits-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_mask-test.log: cpl_mask-test$(EXEEXT) @p='cpl_mask-test$(EXEEXT)'; \ b='cpl_mask-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_plot-test.log: cpl_plot-test$(EXEEXT) @p='cpl_plot-test$(EXEEXT)'; \ b='cpl_plot-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_polynomial-test.log: cpl_polynomial-test$(EXEEXT) @p='cpl_polynomial-test$(EXEEXT)'; \ b='cpl_polynomial-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_error-test.log: cpl_error-test$(EXEEXT) @p='cpl_error-test$(EXEEXT)'; \ b='cpl_error-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_errorstate-test.log: cpl_errorstate-test$(EXEEXT) @p='cpl_errorstate-test$(EXEEXT)'; \ b='cpl_errorstate-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_table-test.log: cpl_table-test$(EXEEXT) @p='cpl_table-test$(EXEEXT)'; \ b='cpl_table-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_test-test.log: cpl_test-test$(EXEEXT) @p='cpl_test-test$(EXEEXT)'; \ b='cpl_test-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_test_init-test.log: cpl_test_init-test$(EXEEXT) @p='cpl_test_init-test$(EXEEXT)'; \ b='cpl_test_init-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_type-test.log: cpl_type-test$(EXEEXT) @p='cpl_type-test$(EXEEXT)'; \ b='cpl_type-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_tools-test.log: cpl_tools-test$(EXEEXT) @p='cpl_tools-test$(EXEEXT)'; \ b='cpl_tools-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_matrix-test.log: cpl_matrix-test$(EXEEXT) @p='cpl_matrix-test$(EXEEXT)'; \ b='cpl_matrix-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_msg-test.log: cpl_msg-test$(EXEEXT) @p='cpl_msg-test$(EXEEXT)'; \ b='cpl_msg-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_memory-test.log: cpl_memory-test$(EXEEXT) @p='cpl_memory-test$(EXEEXT)'; \ b='cpl_memory-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_vector-test.log: cpl_vector-test$(EXEEXT) @p='cpl_vector-test$(EXEEXT)'; \ b='cpl_vector-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_bivector-test.log: cpl_bivector-test$(EXEEXT) @p='cpl_bivector-test$(EXEEXT)'; \ b='cpl_bivector-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_property-test.log: cpl_property-test$(EXEEXT) @p='cpl_property-test$(EXEEXT)'; \ b='cpl_property-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cpl_propertylist-test.log: cpl_propertylist-test$(EXEEXT) @p='cpl_propertylist-test$(EXEEXT)'; \ b='cpl_propertylist-test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool clean-local \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am # We need to remove any files that the above tests created. clean-local: $(RM) *.fits *.tfits *.log @USE_PURIFY_TRUE@include $(top_builddir)/Makefile.purify # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/cplcore/tests/cpl_fits-test.c0000644000460300003120000001544711753211077014746 00000000000000/* $Id: cpl_fits-test.c,v 1.22 2012-05-11 13:21:03 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-05-11 13:21:03 $ * $Revision: 1.22 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_fits.h" #include "cpl_memory.h" #include "cpl_test.h" /* Needed for CPL_IO_FITS_MAX_OPEN */ #include "cpl_io_fits.h" #include #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define CPL_FITS_NAME "cpl_fits-test.fits" #ifndef CPL_FITS_NEXT #define CPL_FITS_NEXT 12 #endif /*---------------------------------------------------------------------------- Private function prototypes ----------------------------------------------------------------------------*/ static void cpl_fits_mode_test(void); /*----------------------------------------------------------------------------- Main -----------------------------------------------------------------------------*/ int main(void) { cpl_propertylist * pl; cpl_size ivalue; cpl_error_code error; cpl_size iext; cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); /* Insert tests below */ cpl_fits_mode_test(); ivalue = cpl_fits_count_extensions(NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(ivalue, -1); ivalue = cpl_fits_find_extension(CPL_FITS_NAME, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(ivalue, -1); ivalue = cpl_fits_find_extension(NULL, "EXT0"); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_test_eq(ivalue, -1); ivalue = cpl_fits_count_extensions("."); cpl_test_error(CPL_ERROR_FILE_IO); cpl_test_eq(ivalue, -1); ivalue = cpl_fits_find_extension(".", "EXT0"); cpl_test_error(CPL_ERROR_FILE_IO); cpl_test_eq(ivalue, -1); /* Create a test MEF */ /* Empty primary unit */ pl = cpl_propertylist_new(); cpl_test_nonnull(pl); error = cpl_propertylist_save(pl, CPL_FITS_NAME, CPL_IO_CREATE); cpl_test_eq_error(error, CPL_ERROR_NONE); ivalue = cpl_fits_count_extensions(CPL_FITS_NAME); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(ivalue); ivalue = cpl_fits_find_extension(CPL_FITS_NAME, "EXT0"); cpl_test_error(CPL_ERROR_NONE); cpl_test_zero(ivalue); /* First extension is without the EXTNAME card */ error = cpl_propertylist_save(pl, CPL_FITS_NAME, CPL_IO_EXTEND); cpl_test_eq_error(error, CPL_ERROR_NONE); ivalue = cpl_fits_count_extensions(CPL_FITS_NAME); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(ivalue, 1); for (iext = 2; iext <= CPL_FITS_NEXT; iext++) { const char * extname = cpl_sprintf("EXT%" CPL_SIZE_FORMAT, iext); cpl_size jext; error = cpl_propertylist_update_string(pl, "EXTNAME", extname); cpl_test_eq_error(error, CPL_ERROR_NONE); error = cpl_propertylist_save(pl, CPL_FITS_NAME, CPL_IO_EXTEND); cpl_test_eq_error(error, CPL_ERROR_NONE); ivalue = cpl_fits_count_extensions(CPL_FITS_NAME); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(ivalue, iext); cpl_free((void*)extname); for (jext = 0; jext <= iext; jext++) { extname = cpl_sprintf("EXT%" CPL_SIZE_FORMAT, jext); ivalue = cpl_fits_find_extension(CPL_FITS_NAME, extname); cpl_test_error(CPL_ERROR_NONE); cpl_free((void*)extname); if (jext > 1) { cpl_test_eq(ivalue, jext); } else { /* EXT0/1 not found */ cpl_test_zero(ivalue); } } } cpl_propertylist_delete(pl); cpl_test_zero(remove(CPL_FITS_NAME)); return cpl_test_end(0); } /*----------------------------------------------------------------------------*/ /** @brief Test the CPL function(s) @return void */ /*----------------------------------------------------------------------------*/ static void cpl_fits_mode_test(void) { cpl_error_code code; cpl_fits_mode mode, modec; #if CPL_IO_FITS_MAX_OPEN > 0 cpl_fits_mode modeo; /* Copied from cpl_init() */ const char * io_fits_mode_string = getenv("CPL_IO_MODE"); const cpl_boolean use_io_fits = io_fits_mode_string != NULL && strcmp("1", io_fits_mode_string) == 0; #else const cpl_boolean use_io_fits = CPL_FALSE; #endif /* Get the mode */ mode = cpl_fits_get_mode(); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(mode, use_io_fits ? CPL_FITS_START_CACHING : CPL_FITS_STOP_CACHING); /* Set the mode to what it already is */ code = cpl_fits_set_mode(mode); cpl_test_eq_error(code, CPL_ERROR_NONE); /* Verify that it did not change */ modec = cpl_fits_get_mode(); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(mode, modec); #if CPL_IO_FITS_MAX_OPEN > 0 /* Change to the other mode */ modeo = use_io_fits ? CPL_FITS_STOP_CACHING : CPL_FITS_START_CACHING; code = cpl_fits_set_mode(modeo); cpl_test_eq_error(code, CPL_ERROR_NONE); /* Verify that it did change */ modec = cpl_fits_get_mode(); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(modeo, modec); #endif /* Change back */ code = cpl_fits_set_mode(mode); cpl_test_eq_error(code, CPL_ERROR_NONE); /* Verify that it did change */ modec = cpl_fits_get_mode(); cpl_test_error(CPL_ERROR_NONE); cpl_test_eq(mode, modec); /* Test handling of incorrect mode combination */ code = cpl_fits_set_mode(CPL_FITS_STOP_CACHING & CPL_FITS_START_CACHING); cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT); code = cpl_fits_set_mode(CPL_FITS_STOP_CACHING || CPL_FITS_START_CACHING); cpl_test_eq_error(code, CPL_ERROR_INVALID_TYPE); } cpl-6.4.1/cplcore/cpl_table.c0000644000460300003120000345174512300400550012742 00000000000000/* $Id: cpl_table.c,v 1.261 2013-08-26 06:55:36 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-08-26 06:55:36 $ * $Revision: 1.261 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #define ERASE_WCS_REGEXP "WCSAXES|WCSNAME|(PC|CD|PV|PS)[0-9]+_[0-9]+|" \ "C(RVAL|RPIX|DELT|TYPE|UNIT|RDER|SYER)[0-9]+" #include #include #include #include #include #include #include #include #include #include #include #include "cpl_error_impl.h" #include "cpl_errorstate.h" #include #include #include #include #include #include #include #include #include #include #include #include /** * @defgroup cpl_table Tables * * This module provides functions to create, use, and destroy * a @em cpl_table. A @em cpl_table is made of columns, and * a column consists of an array of elements of a given type. * Currently three numerical types are supported, @c CPL_TYPE_INT, * @c CPL_TYPE_FLOAT, and @c CPL_TYPE_DOUBLE, plus a type indicating * columns containing character strings, @c CPL_TYPE_STRING. * Moreover, it is possible to define columns of arrays, i.e. * columns whose elements are arrays of all the basic types * listed above. Within the same column all arrays must have * the same type and the same length. * * A table column is accessed by specifying its name. The ordering * of the columns within a table is undefined: a @em cpl_table is * not an n-tuple of columns, but just a set of columns. The N * elements of a column are counted from 0 to N-1, with element * 0 on top. The set of all the table columns elements with the * same index constitutes a table row, and table rows are counted * according to the same convention. It is possible to flag each * @em cpl_table row as "selected" or "unselected", and each column * element as "valid" or "invalid". Selecting table rows is mainly * a way to extract just those table parts fulfilling any given * condition, while invalidating column elements is a way to * exclude such elements from any computation. A @em cpl_table * is created with all rows selected, and a column is created with * all elements invalidated. * * @note * The @em cpl_table pointers specified in the argument list of all * the @em cpl_table functions must point to valid objects: these * functions do not perform any check in this sense. Only in the * particular case of a @c NULL pointer the functions will set a * @c CPL_ERROR_NULL_INPUT error code, unless differently specified. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * The table type; */ struct _cpl_table_ { cpl_size nc; cpl_size nr; cpl_column **columns; cpl_column_flag *select; cpl_size selectcount; }; /* * Prototypes for CPL_TYPE_LONG columns. Support for this type is implemented, * but disabled, since the FITS standard has no counterpart for this type. * This means that on saving a column of this type it needs to be converted * to either CPL_TYPE_INT or CPL_TYPE_LONG_LONG. * * Still, the prototypes are needed for correct compilation of the code. * * Confirmation of CPL_TYPE_LONG columns is still pending. */ cpl_error_code cpl_table_wrap_long(cpl_table *, long *, const char *) CPL_INTERNAL; long *cpl_table_get_data_long(cpl_table *, const char *name) CPL_INTERNAL; const long *cpl_table_get_data_long_const(const cpl_table *, const char *name) CPL_INTERNAL; long cpl_table_get_long(const cpl_table *, const char *, cpl_size, int *null) CPL_INTERNAL; cpl_error_code cpl_table_set_long(cpl_table *, const char *, cpl_size, long) CPL_INTERNAL; cpl_error_code cpl_table_fill_column_window_long(cpl_table *, const char *, cpl_size, cpl_size, long) CPL_INTERNAL; cpl_error_code cpl_table_copy_data_long(cpl_table *, const char *, const long *) CPL_INTERNAL; cpl_error_code cpl_table_fill_invalid_long(cpl_table *, const char *, long) CPL_INTERNAL; cpl_size cpl_table_and_selected_long(cpl_table *, const char *, cpl_table_select_operator, long) CPL_INTERNAL; cpl_size cpl_table_or_selected_long(cpl_table *, const char *, cpl_table_select_operator, long) CPL_INTERNAL; /* * Private method declarations (that have some attribute): */ static cpl_column *cpl_table_find_column(const cpl_table *, const char *) CPL_ATTR_NONNULL; static cpl_error_code cpl_table_append_column(cpl_table *, cpl_column *) CPL_ATTR_NONNULL; static int strmatch(regex_t *, const char *) CPL_ATTR_NONNULL; /* * Private methods: */ /* * @internal * @brief * Find a column or set the specified error * * @param table Pointer to table where to search for the column. * @param name Column name. * * @return Pointer to found column, or @c NULL on error * @see cpl_table_find_column() * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror */ static cpl_column *cpl_table_find_column_(const cpl_table *table, const char *name) { cpl_column *column = NULL; if (table == NULL) { (void)cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "table is NULL"); } else if (name == NULL) { (void)cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "name is NULL"); } else { column = cpl_table_find_column(table, name); if (!column) { (void)cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "name='%s'", name); } } return column; } /* * @internal * @brief * Find a column of the specified type or set the specified error * * @param table Pointer to table where to search for the column. * @param name Column name. * @param exptype The expected type of the column, CPL_TYPE_POINTER means any cpl_type of type pointer * * @return Pointer to found column, or @c NULL on error * @see cpl_table_find_column_() * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of the specified type. *
* @enderror */ static cpl_column *cpl_table_find_column_type(const cpl_table *table, const char *name, cpl_type exptype) { cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); } else { const cpl_type type = cpl_column_get_type(column); if (type != exptype && (exptype != CPL_TYPE_POINTER || !(type & CPL_TYPE_POINTER))) { column = NULL; (void)cpl_error_set_message_(CPL_ERROR_TYPE_MISMATCH, "name='%s', " "type=%s != %s", name, cpl_type_get_name(type), cpl_type_get_name(exptype)); } } return column; } /* * @brief * Find a column. * * @param table Pointer to table where to search for the column. * @param name Column name. * * @return Pointer to found column, or @c NULL. * * This private function looks for a column with a given name in * @em table. A @c NULL is returned if no column with the specified * @em name is found. The input @em table and @em name are assumed * not to be @c NULL. */ static cpl_column *cpl_table_find_column(const cpl_table *table, const char *name) { cpl_column **column; const char *column_name; cpl_size i; column = table->columns; for (i = 0; i < table->nc; i++, column++) { column_name = cpl_column_get_name(*column); if (strcmp(name, column_name) == 0) { return *column; } } return NULL; } /* * @brief * Extract a column from a table. * * @param table Pointer to table. * @param name Column name. * * @return Pointer to extracted column, or @c NULL. * * This private function looks for a column with a given name in * @em table. If found, the column is extracted from the table, and the * table will have one column less. If no columns are left in table, * also the selection flags are lost. A @c NULL is returned if no column * with the specified @em name is found. The input @em table and @em name * are expected not to be @c NULL. */ static cpl_column *cpl_table_extract_column(cpl_table *table, const char *name) { cpl_column *column = cpl_table_find_column(table, name); if (column) { const cpl_size width = cpl_table_get_ncol(table); cpl_size i, j; for (i = 0; i < width; i++) if (column == table->columns[i]) break; j = i + 1; while(j < width) table->columns[i++] = table->columns[j++]; table->nc--; if (table->nc) { table->columns = cpl_realloc(table->columns, table->nc * sizeof(column)); } else { cpl_free(table->columns); table->columns = NULL; } if (table->nc == 0) /* Last column deleted */ cpl_table_select_all(table); } return column; } /* * @brief * Append a column to a table. * * @param table Pointer to table where to append the column. * @param column Column to append. * * @return @c CPL_ERROR_NONE on success. * * This private function appends a column to the column list of a table. * It is assumed that a column with the same name does not exist already * in the table. The input @em table and @em column are expected not to * be @c NULL, and the input column is expected not to be nameless. Also, * the input column is assumed to have the same length as all the other * columns in the table. */ static cpl_error_code cpl_table_append_column(cpl_table *table, cpl_column *column) { if (table->columns) { table->columns = cpl_realloc(table->columns, (table->nc + 1) * sizeof(column)); } else table->columns = cpl_malloc(sizeof(column)); table->columns[table->nc] = column; table->nc++; return CPL_ERROR_NONE; } /* * @brief * Check if a string matches a compiled regular expression. * * @param pattern Compiled regular expression. * @param string String to test. * * @return 1 on match, 0 on mismatch. * * This private function tests a string against an extended regular expression. * The inputs are assumed not to be @c NULL. It is assumed also that the * check on the availability of regexec() are done elsewhere. */ static int strmatch(regex_t *pattern, const char *string) { if (regexec(pattern, string, (size_t)0, NULL, 0) == REG_NOMATCH) return 0; return 1; } /* * @brief * Sort table rows according to columns values. * * @param table Pointer to table. * @param reflist Names of reference columns with corresponding sorting mode. * @param n Use only n first elements of @em reflist * @param sort_pattern Work space * @param sort_null_pattern Work space * * @return See @c cpl_table_sort() * * The table is sorted after each of the n columns, less significant columns * before more significant columns. This method depends on the sorting * algorithm being stable (i.e. it must conserve the order of equal elements). */ static cpl_error_code table_sort(cpl_table *table, const cpl_propertylist *reflist, unsigned n, cpl_size *sort_pattern, cpl_size *sort_null_pattern) { const cpl_property *info; const char *name; int reverse; const int stable = 1; cpl_column *column; cpl_column *column_sorted_null; cpl_type type; cpl_size i, j; cpl_size nullcount; int *idata; int *work_idata; long *ldata; long *work_ldata; long long *lldata; long long *work_lldata; float *fdata; float *work_fdata; double *ddata; double *work_ddata; float complex *cfdata; float complex *work_cfdata; double complex *cddata; double complex *work_cddata; char **sdata; char **work_sdata; cpl_array **adata; cpl_array **work_adata; cpl_column_flag *ndata; cpl_column_flag *work_ndata; if (n == 0) { return CPL_ERROR_NONE; } /* * Sort after least significant column */ info = cpl_propertylist_get_const(reflist, n - 1); name = cpl_property_get_name(info); if (cpl_property_get_type(info) == CPL_TYPE_BOOL) { reverse = cpl_property_get_bool(info); } else { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } if (name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } if ((column = cpl_table_find_column(table, name)) == NULL) { return cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); } type = cpl_column_get_type(column); if (type & CPL_TYPE_POINTER) { /* Arrays not as reference */ return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } /* * Independent of the reverse flag, put rows with invalid values at the * beginning of the table */ nullcount = cpl_column_count_invalid(column); ndata = cpl_column_get_data_invalid(column); j = 0; for (i = 0; i < table->nr; i++) { if (nullcount == table->nr || (ndata != NULL && ndata[i])) { sort_null_pattern[j++] = i; } } /* assert( j == nullcount ); */ for (i = 0; i < table->nr; i++) { if (! (nullcount == table->nr || (ndata != NULL && ndata[i])) ) { sort_null_pattern[j++] = i; } } /* assert( j == table->nr ); */ /* * Apply NULL pattern */ column_sorted_null = cpl_column_duplicate(column); for (i = 0; i < nullcount; i++) { cpl_column_set_invalid(column_sorted_null, i); } for (i = nullcount; i < table->nr; i++) { int isnull; switch (type) { case CPL_TYPE_INT: cpl_column_set_int( column_sorted_null, i, cpl_column_get_int(column, sort_null_pattern[i], &isnull)); break; case CPL_TYPE_LONG: cpl_column_set_long( column_sorted_null, i, cpl_column_get_long(column, sort_null_pattern[i], &isnull)); break; case CPL_TYPE_LONG_LONG: cpl_column_set_long_long( column_sorted_null, i, cpl_column_get_long_long(column, sort_null_pattern[i], &isnull)); break; case CPL_TYPE_FLOAT: cpl_column_set_float( column_sorted_null, i, cpl_column_get_float(column, sort_null_pattern[i], &isnull)); break; case CPL_TYPE_DOUBLE: cpl_column_set_double( column_sorted_null, i, cpl_column_get_double(column, sort_null_pattern[i], &isnull)); break; case CPL_TYPE_STRING: cpl_column_set_string( column_sorted_null, i, cpl_column_get_string(column, sort_null_pattern[i])); break; default: /* You should never get here */ /* assert( 0 ); */ break; } } /* * Get remaining sort pattern */ for (i = 0; i < nullcount; i++) { sort_pattern[i] = i; } switch (type) { case CPL_TYPE_INT: cpl_tools_sort_stable_pattern_int( cpl_column_get_data_int(column_sorted_null) + nullcount, table->nr - nullcount, reverse, stable, sort_pattern + nullcount); break; case CPL_TYPE_LONG: cpl_tools_sort_stable_pattern_long( cpl_column_get_data_long(column_sorted_null) + nullcount, table->nr - nullcount, reverse, stable, sort_pattern + nullcount); break; case CPL_TYPE_LONG_LONG: cpl_tools_sort_stable_pattern_long_long( cpl_column_get_data_long_long(column_sorted_null) + nullcount, table->nr - nullcount, reverse, stable, sort_pattern + nullcount); break; case CPL_TYPE_FLOAT: cpl_tools_sort_stable_pattern_float( cpl_column_get_data_float(column_sorted_null) + nullcount, table->nr - nullcount, reverse, stable, sort_pattern + nullcount); break; case CPL_TYPE_DOUBLE: cpl_tools_sort_stable_pattern_double( cpl_column_get_data_double(column_sorted_null) + nullcount, table->nr - nullcount, reverse, stable, sort_pattern + nullcount); break; case CPL_TYPE_STRING: cpl_tools_sort_stable_pattern_string( cpl_column_get_data_string(column_sorted_null) + nullcount, table->nr - nullcount, reverse, stable, sort_pattern + nullcount); break; default: /* You should never get here */ /* assert( 0 ); */ break; } cpl_column_delete(column_sorted_null); /* * Transform sort pattern */ for (i = nullcount; i < table->nr; i++) { sort_pattern[i] += nullcount; } /* * Now apply the combined sort pattern to each column in the table: */ j = 0; while (j < table->nc) { cpl_column *work_column; switch (cpl_column_get_type(table->columns[j])) { case CPL_TYPE_INT: work_column = cpl_column_duplicate(table->columns[j]); nullcount = cpl_column_count_invalid(table->columns[j]); if (nullcount != table->nr) { ndata = cpl_column_get_data_invalid(table->columns[j]); if (ndata) { work_ndata = cpl_column_get_data_invalid(work_column); for (i = 0; i < table->nr; i++) ndata[i] = work_ndata[sort_null_pattern[sort_pattern[i]]]; } } work_idata = cpl_column_get_data_int(work_column); idata = cpl_column_get_data_int(table->columns[j]); for (i = 0; i < table->nr; i++) idata[i] = work_idata[sort_null_pattern[sort_pattern[i]]]; cpl_column_delete(work_column); break; case CPL_TYPE_LONG: work_column = cpl_column_duplicate(table->columns[j]); nullcount = cpl_column_count_invalid(table->columns[j]); if (nullcount != table->nr) { ndata = cpl_column_get_data_invalid(table->columns[j]); if (ndata) { work_ndata = cpl_column_get_data_invalid(work_column); for (i = 0; i < table->nr; i++) ndata[i] = work_ndata[sort_null_pattern[sort_pattern[i]]]; } } work_ldata = cpl_column_get_data_long(work_column); ldata = cpl_column_get_data_long(table->columns[j]); for (i = 0; i < table->nr; i++) ldata[i] = work_ldata[sort_null_pattern[sort_pattern[i]]]; cpl_column_delete(work_column); break; case CPL_TYPE_LONG_LONG: work_column = cpl_column_duplicate(table->columns[j]); nullcount = cpl_column_count_invalid(table->columns[j]); if (nullcount != table->nr) { ndata = cpl_column_get_data_invalid(table->columns[j]); if (ndata) { work_ndata = cpl_column_get_data_invalid(work_column); for (i = 0; i < table->nr; i++) ndata[i] = work_ndata[sort_null_pattern[sort_pattern[i]]]; } } work_lldata = cpl_column_get_data_long_long(work_column); lldata = cpl_column_get_data_long_long(table->columns[j]); for (i = 0; i < table->nr; i++) lldata[i] = work_lldata[sort_null_pattern[sort_pattern[i]]]; cpl_column_delete(work_column); break; case CPL_TYPE_FLOAT: work_column = cpl_column_duplicate(table->columns[j]); nullcount = cpl_column_count_invalid(table->columns[j]); if (nullcount != table->nr) { ndata = cpl_column_get_data_invalid(table->columns[j]); if (ndata) { work_ndata = cpl_column_get_data_invalid(work_column); for (i = 0; i < table->nr; i++) ndata[i] = work_ndata[sort_null_pattern[sort_pattern[i]]]; } } work_fdata = cpl_column_get_data_float(work_column); fdata = cpl_column_get_data_float(table->columns[j]); for (i = 0; i < table->nr; i++) fdata[i] = work_fdata[sort_null_pattern[sort_pattern[i]]]; cpl_column_delete(work_column); break; case CPL_TYPE_DOUBLE: work_column = cpl_column_duplicate(table->columns[j]); nullcount = cpl_column_count_invalid(table->columns[j]); if (nullcount != table->nr) { ndata = cpl_column_get_data_invalid(table->columns[j]); if (ndata) { work_ndata = cpl_column_get_data_invalid(work_column); for (i = 0; i < table->nr; i++) ndata[i] = work_ndata[sort_null_pattern[sort_pattern[i]]]; } } work_ddata = cpl_column_get_data_double(work_column); ddata = cpl_column_get_data_double(table->columns[j]); for (i = 0; i < table->nr; i++) ddata[i] = work_ddata[sort_null_pattern[sort_pattern[i]]]; cpl_column_delete(work_column); break; case CPL_TYPE_FLOAT_COMPLEX: work_column = cpl_column_duplicate(table->columns[j]); nullcount = cpl_column_count_invalid(table->columns[j]); if (nullcount != table->nr) { ndata = cpl_column_get_data_invalid(table->columns[j]); if (ndata) { work_ndata = cpl_column_get_data_invalid(work_column); for (i = 0; i < table->nr; i++) ndata[i] = work_ndata[sort_null_pattern[sort_pattern[i]]]; } } work_cfdata = cpl_column_get_data_float_complex(work_column); cfdata = cpl_column_get_data_float_complex(table->columns[j]); for (i = 0; i < table->nr; i++) cfdata[i] = work_cfdata[sort_null_pattern[sort_pattern[i]]]; cpl_column_delete(work_column); break; case CPL_TYPE_DOUBLE_COMPLEX: work_column = cpl_column_duplicate(table->columns[j]); nullcount = cpl_column_count_invalid(table->columns[j]); if (nullcount != table->nr) { ndata = cpl_column_get_data_invalid(table->columns[j]); if (ndata) { work_ndata = cpl_column_get_data_invalid(work_column); for (i = 0; i < table->nr; i++) ndata[i] = work_ndata[sort_null_pattern[sort_pattern[i]]]; } } work_cddata = cpl_column_get_data_double_complex(work_column); cddata = cpl_column_get_data_double_complex(table->columns[j]); for (i = 0; i < table->nr; i++) cddata[i] = work_cddata[sort_null_pattern[sort_pattern[i]]]; cpl_column_delete(work_column); break; case CPL_TYPE_STRING: work_column = cpl_column_new_string(table->nr); work_sdata = cpl_column_get_data_string(work_column); sdata = cpl_column_get_data_string(table->columns[j]); for (i = 0; i < table->nr; i++) work_sdata[i] = sdata[i]; for (i = 0; i < table->nr; i++) sdata[i] = work_sdata[sort_null_pattern[sort_pattern[i]]]; cpl_column_delete_but_strings(work_column); break; case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: work_column = cpl_column_new_array(cpl_column_get_type(table->columns[j]), table->nr, cpl_column_get_depth(table->columns[j])); work_adata = cpl_column_get_data_array(work_column); adata = cpl_column_get_data_array(table->columns[j]); for (i = 0; i < table->nr; i++) work_adata[i] = adata[i]; for (i = 0; i < table->nr; i++) adata[i] = work_adata[sort_null_pattern[sort_pattern[i]]]; cpl_column_delete_but_arrays(work_column); break; default: break; /* Should never get here */ } j++; } /* * Finished sorting after least significant column. * Sort after remaining columns */ return table_sort(table, reflist, n - 1, sort_pattern, sort_null_pattern); } /* * Public methods: */ /** * @brief * Create an empty table structure. * * @param length Number of rows in table. * * @return Pointer to new table, or @c NULL in case of error. * * @error * * * * * *
CPL_ERROR_ILLEGAL_INPUT * The specified length is negative. *
* @enderror * * This function allocates and initialises memory for a table data container. * A new table is created with no columns, but the size of the columns that * will be created is defined in advance, to ensure that all columns will * be created with the same length. All table rows are marked a priori as * selected. This should be considered the normal status of a table, as * long as no row selection has been applied to it. */ cpl_table *cpl_table_new(cpl_size length) { cpl_table *table; if (length < 0) { cpl_error_set("cpl_table_new", CPL_ERROR_ILLEGAL_INPUT); return NULL; } table = cpl_calloc(1, sizeof(cpl_table)); table->nc = 0; table->nr = length; table->columns = NULL; table->select = NULL; table->selectcount = length; return table; } /** * @brief * Give to a table the same structure of another table. * * @param table Pointer to empty table. * @param mtable Pointer to model table. * * @return @c CPL_ERROR_NONE in case of success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * table contains columns. *
* @enderror * * This function assignes to a columnless table the same column structure * (names, types, units) of a given model table. All columns are physically * created in the new table, and they are initialised to contain just * invalid elements. */ cpl_error_code cpl_table_copy_structure(cpl_table *table, const cpl_table *mtable) { const char *unit = NULL; const char *form = NULL; cpl_column **column; cpl_type type; cpl_size width = cpl_table_get_ncol(mtable); cpl_size i = 0; if (table == 0x0 || mtable == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (table->nc > 0) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); column = mtable->columns; for (i = 0; i < width; i++, column++) { type = cpl_column_get_type(*column); unit = cpl_column_get_unit(*column); form = cpl_column_get_format(*column); if (type & CPL_TYPE_POINTER) { cpl_table_new_column_array(table, cpl_column_get_name(*column), type, cpl_column_get_depth(*column)); } else { cpl_table_new_column(table, cpl_column_get_name(*column), type); } cpl_table_set_column_unit(table, cpl_column_get_name(*column), unit); cpl_table_set_column_format(table, cpl_column_get_name(*column), form); } return CPL_ERROR_NONE; } /** * @brief * Create an empty column in a table. * * @param table Pointer to table. * @param name Name of the new column. * @param type Type of the new column. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified type is not supported. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the same name already exists in table. *
* @enderror * * This function allocates memory for a new column of specified @em type, * excluding @em array types (for creating a column of arrays use the * function @c cpl_table_new_column_array(), where the column depth * must also be specified). The new column name must be different from * any other column name in the table. All the elements of the new column * are marked as invalid. */ cpl_error_code cpl_table_new_column(cpl_table *table, const char *name, cpl_type type) { cpl_column *column; if (table == 0x0 || name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_table_find_column(table, name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); switch(type) { case CPL_TYPE_INT: column = cpl_column_new_int(table->nr); break; #if defined(USE_COLUMN_TYPE_LONG) case CPL_TYPE_LONG: column = cpl_column_new_long(table->nr); break; #endif case CPL_TYPE_LONG_LONG: column = cpl_column_new_long_long(table->nr); break; case CPL_TYPE_FLOAT: column = cpl_column_new_float(table->nr); break; case CPL_TYPE_DOUBLE: column = cpl_column_new_double(table->nr); break; case CPL_TYPE_FLOAT_COMPLEX: column = cpl_column_new_float_complex(table->nr); break; case CPL_TYPE_DOUBLE_COMPLEX: column = cpl_column_new_double_complex(table->nr); break; case CPL_TYPE_STRING: column = cpl_column_new_string(table->nr); break; default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } cpl_column_set_name(column, name); cpl_table_append_column(table, column); return CPL_ERROR_NONE; } /** * @brief * Create an empty column of arrays in a table. * * @param table Pointer to table. * @param name Name of the new column. * @param type Type of the new column. * @param depth Depth of the new column. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified type is not supported. *
CPL_ERROR_ILLEGAL_INPUT * The specified depth is negative. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the same name already exists in table. *
* @enderror * * This function allocates memory for a new column of specified array * @em type, (for creating a column of simple scalars or character strings * use the function @c cpl_table_new_column() instead). It doesn't make * any difference if a simple or an array @em type is specified, the * corresponding array type will always be created (e.g., specifying * a @em type @c CPL_TYPE_INT or a type @c CPL_TYPE_INT | @c CPL_TYPE_POINTER * would always create a column of type @c CPL_TYPE_INT | @c CPL_TYPE_POINTER). * The new column name must be different from any other column name in the * table. All the elements of the new column are marked as invalid. */ cpl_error_code cpl_table_new_column_array(cpl_table *table, const char *name, cpl_type type, cpl_size depth) { cpl_column *column; if (table == 0x0 || name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); #if !defined(USE_COLUMN_TYPE_LONG) if (type == CPL_TYPE_LONG) return cpl_error_set_(CPL_ERROR_INVALID_TYPE); #endif if (depth < 0) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); if (cpl_table_find_column(table, name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_column_new_array(type, table->nr, depth); cpl_column_set_name(column, name); cpl_table_append_column(table, column); return CPL_ERROR_NONE; } /* * @brief * Change saving type for a given column. * * @param table Pointer to table. * @param name Name of existing column. * @param type New saving type for this column. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name does not exist. *
CPL_ERROR_ILLEGAL_INPUT * The specified column cannot be saved with the specified type. *
* @enderror * * This function indicates that the specified column should be saved * by the function @c cpl_table_save() into the specified type. * If this function is not called for a given column, that column * would be saved into the same type of the column. It is not * possible to save an integer column into a floating point type, * or the other way around: if you need to do so, use the function * @c cpl_table_cast_column() first. For each column type, the * (currently) legal saving types are listed below, together with * their matching CFITSIO and FITS types: * * @code * * CPL_TYPE_INT: CPL_TYPE_INT TINT 'J' (default) * CPL_TYPE_BOOL TLOGICAL 'L' * CPL_TYPE_CHAR TSBYTE 'B' with TZERO = -128) * CPL_TYPE_UCHAR TBYTE 'B' * CPL_TYPE_SHORT TSHORT 'I' * CPL_TYPE_LONG_LONG: CPL_TYPE_LONG_LONG TLONGLONG 'K' (default) * CPL_TYPE_INT TINT 'J' * CPL_TYPE_BOOL TLOGICAL 'L' * CPL_TYPE_CHAR TSBYTE 'B' with TZERO = -128) * CPL_TYPE_UCHAR TBYTE 'B' * CPL_TYPE_SHORT TSHORT 'I' * CPL_TYPE_FLOAT: CPL_TYPE_FLOAT TFLOAT 'E' (default) * CPL_TYPE_DOUBLE: CPL_TYPE_DOUBLE TDOUBLE 'D' (default) * CPL_TYPE_FLOAT_COMPLEX: CPL_TYPE_FLOAT_COMPLEX TCOMPLEX 'C' (default) * CPL_TYPE_DOUBLE_COMPLEX: CPL_TYPE_DOUBLE_COMPLEX TDBLCOMPLEX 'M' (default) * * @endcode * * @note * Saving CPL_TYPE_INT into shorter integer types (such as * unsigned byte) may introduce loss of information, in case * the integer values overflowed the lower datatype. Only the * least significant bits will be transferred, according to * the C casting rules. This would not be signalled in any way * (neither as an error nor as a warning) by the @c cpl_table_save() * function: it is entirely a responsibility of the programmer * to ensure that integer columns to be saved to lower types * would not overflow such types. */ cpl_error_code cpl_table_set_column_savetype(cpl_table *table, const char *name, cpl_type type) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_save_type(column, type) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /* * @brief * Get the saving type of a given table column. * * @param table Pointer to table. * @param name Column name. * * @return Column saving type, or @c CPL_TYPE_INVALID in case of failure. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * Get the saving type of a column. See function * @c cpl_table_set_column_save_type() */ /* cpl_type cpl_table_get_column_save_type(const cpl_table *table, const char *name) { cpl_column *column; if (table == 0x0 || name == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return CPL_TYPE_INVALID; } column = cpl_table_find_column(table, name); if (!column) { cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); return CPL_TYPE_INVALID; } return cpl_column_get_save_type(column); } */ /** * @brief * Create in table a new @em integer column obtained from existing data. * * @param table Pointer to table where to create the new column. * @param name Name of the new column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the same name already exists in table. *
* @enderror * * This function creates a new column of type @c CPL_TYPE_INT that will * encapsulate the given data. The size of the input data array is not * checked in any way, and it is expected to match the number of rows * assigned to the given table. The pointed data values are all taken * as valid: invalid values should be marked using the functions * @c cpl_table_set_invalid() and @c cpl_table_set_column_invalid(). * The data buffer is not copied, so it should not be deallocated while * the table column is still in use: the functions @c cpl_table_erase_column() * or @c cpl_table_delete() would take care of deallocating it. To avoid * problems with the memory managment, the specified data buffer should * have been allocated using the functions of the @em cpl_memory module, * and statically allocated data should be avoided too. If this is not * possible, then the function @c cpl_table_unwrap() should be used on * that column before destroying the table that contains it. */ cpl_error_code cpl_table_wrap_int(cpl_table *table, int *data, const char *name) { cpl_column *column; if (table == 0x0 || data == 0x0 || name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_table_find_column(table, name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_column_wrap_int(data, table->nr); cpl_column_set_name(column, name); cpl_table_append_column(table, column); return CPL_ERROR_NONE; } /** * @brief * Create in table a new @em long column obtained from existing data. * * @param table Pointer to table. * @param name Name of the new column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the same name already exists in table. *
* @enderror * * This function creates a new column of type @c CPL_TYPE_LONG * that will encapsulate the given data. See the description of * @c cpl_table_wrap_int() for further details. */ cpl_error_code cpl_table_wrap_long(cpl_table *table, long *data, const char *name) { cpl_column *column; if (table == 0x0 || data == 0x0 || name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_table_find_column(table, name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_column_wrap_long(data, table->nr); cpl_column_set_name(column, name); cpl_table_append_column(table, column); return CPL_ERROR_NONE; } /** * @brief * Create in table a new @em long @em long column obtained from existing data. * * @param table Pointer to table. * @param name Name of the new column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the same name already exists in table. *
* @enderror * * This function creates a new column of type @c CPL_TYPE_LONG_LONG * that will encapsulate the given data. See the description of * @c cpl_table_wrap_int() for further details. */ cpl_error_code cpl_table_wrap_long_long(cpl_table *table, long long *data, const char *name) { cpl_column *column; if (table == 0x0 || data == 0x0 || name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_table_find_column(table, name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_column_wrap_long_long(data, table->nr); cpl_column_set_name(column, name); cpl_table_append_column(table, column); return CPL_ERROR_NONE; } /** * @brief * Create in table a new @em float column obtained from existing data. * * @param table Pointer to table. * @param name Name of the new column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the same name already exists in table. *
* @enderror * * This function creates a new column of type @c CPL_TYPE_FLOAT * that will encapsulate the given data. See the description of * @c cpl_table_wrap_int() for further details. */ cpl_error_code cpl_table_wrap_float(cpl_table *table, float *data, const char *name) { cpl_column *column; if (table == 0x0 || data == 0x0 || name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_table_find_column(table, name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_column_wrap_float(data, table->nr); cpl_column_set_name(column, name); cpl_table_append_column(table, column); return CPL_ERROR_NONE; } /** * @brief * Create in table a new @em float complex column obtained from existing data. * * @param table Pointer to table. * @param name Name of the new column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the same name already exists in table. *
* @enderror * * This function creates a new column of type @c CPL_TYPE_FLOAT_COMPLEX * that will encapsulate the given data. See the description of * @c cpl_table_wrap_int() for further details. */ cpl_error_code cpl_table_wrap_float_complex(cpl_table *table, float complex *data, const char *name) { cpl_column *column; if (table == 0x0 || data == 0x0 || name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_table_find_column(table, name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_column_wrap_float_complex(data, table->nr); cpl_column_set_name(column, name); cpl_table_append_column(table, column); return CPL_ERROR_NONE; } /** * @brief * Create in table a new @em double column obtained from existing data. * * @param table Pointer to table. * @param name Name of the new column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the same name already exists in table. *
* @enderror * * This function creates a new column of type @c CPL_TYPE_DOUBLE * that will encapsulate the given data. See the description of * @c cpl_table_wrap_int() for further details. */ cpl_error_code cpl_table_wrap_double(cpl_table *table, double *data, const char *name) { cpl_column *column; if (table == 0x0 || data == 0x0 || name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_table_find_column(table, name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_column_wrap_double(data, table->nr); cpl_column_set_name(column, name); cpl_table_append_column(table, column); return CPL_ERROR_NONE; } /** * @brief * Create in table a new @em double complex column from existing data. * * @param table Pointer to table. * @param name Name of the new column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the same name already exists in table. *
* @enderror * * This function creates a new column of type @c CPL_TYPE_FLOAT_COMPLEX * that will encapsulate the given data. See the description of * @c cpl_table_wrap_int() for further details. */ cpl_error_code cpl_table_wrap_double_complex(cpl_table *table, double complex *data, const char *name) { cpl_column *column; if (table == 0x0 || data == 0x0 || name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_table_find_column(table, name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_column_wrap_double_complex(data, table->nr); cpl_column_set_name(column, name); cpl_table_append_column(table, column); return CPL_ERROR_NONE; } /** * @brief * Create in table a new @em string column obtained from existing data. * * @param table Pointer to table. * @param name Name of the new column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the same name already exists in table. *
* @enderror * * This function creates a new column of type @c CPL_TYPE_STRING that will * encapsulate the given data. See the description of @c cpl_table_wrap_int() * for further details, especially with regard to memory managment. In the * specific case of @em string columns the described restrictions applies * also to the single column elements (strings). To deallocate specific * column elements the functions @c cpl_table_set_invalid() and * @c cpl_table_set_column_invalid() should be used. */ cpl_error_code cpl_table_wrap_string(cpl_table *table, char **data, const char *name) { cpl_column *column; if (table == 0x0 || data == 0x0 || name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_table_find_column(table, name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_column_wrap_string(data, table->nr); cpl_column_set_name(column, name); cpl_table_append_column(table, column); return CPL_ERROR_NONE; } /** * @brief * Unwrap a table column * * @param table Pointer to table. * @param name Name of the column. * * @return Pointer to internal data buffer, @c NULL in case of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_UNSUPPORTED_MODE * The column with the given name is a column of arrays. *
* @enderror * * This function deallocates all the memory associated to a table column, * with the exception of its data buffer. This type of destructor * should be used on columns created with the @c cpl_table_wrap_() * constructors, if the data buffer specified then was not allocated * using the functions of the @c cpl_memory module. In such a case, the * data buffer should be deallocated separately. See the documentation * of the functions @c cpl_table_wrap_(). * * @note * Columns of arrays cannot be unwrapped. Use the function * @c cpl_table_get_data_array() to directly access the column * data buffer. */ void *cpl_table_unwrap(cpl_table *table, const char *name) { cpl_column *column; if (table == 0x0 || name == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if (cpl_table_get_column_type(table, name) & CPL_TYPE_POINTER) { cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); return NULL; } column = cpl_table_extract_column(table, name); if (!column) { cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); return NULL; } return cpl_column_unwrap(column); } /** * @brief * Copy existing data to a table @em integer column. * * @param table Pointer to table. * @param name Name of the column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_INT. *
* @enderror * * The input data values are copied to the specified column. The size of the * input array is not checked in any way, and it is expected to be compatible * with the number of rows in the given table. The copied data values are * all taken as valid: invalid values should be marked using the functions * @c cpl_table_set_invalid() and @c cpl_table_set_column_invalid(). */ cpl_error_code cpl_table_copy_data_int(cpl_table *table, const char *name, const int *data) { cpl_column *column = cpl_table_find_column_(table, name); if (data == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); return cpl_column_copy_data_int(column, data) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Copy existing data to a table @em long column. * * @param table Pointer to table. * @param name Name of the column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG. *
* @enderror * * See the description of @c cpl_table_copy_data_int() for details. */ cpl_error_code cpl_table_copy_data_long(cpl_table *table, const char *name, const long *data) { cpl_column *column = cpl_table_find_column_(table, name); if (data == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); return cpl_column_copy_data_long(column, data) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Copy existing data to a table @em long @em long column. * * @param table Pointer to table. * @param name Name of the column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG_LONG. *
* @enderror * * See the description of @c cpl_table_copy_data_int() for details. */ cpl_error_code cpl_table_copy_data_long_long(cpl_table *table, const char *name, const long long *data) { cpl_column *column = cpl_table_find_column_(table, name); if (data == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); return cpl_column_copy_data_long_long(column, data) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Copy existing data to a table @em float column. * * @param table Pointer to table. * @param name Name of the column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT. *
* @enderror * * See the description of @c cpl_table_copy_data_int() for details. */ cpl_error_code cpl_table_copy_data_float(cpl_table *table, const char *name, const float *data) { cpl_column *column = cpl_table_find_column_(table, name); if (data == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); return cpl_column_copy_data_float(column, data) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Copy existing data to a table @em float complex column. * * @param table Pointer to table. * @param name Name of the column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT_COMPLEX. *
* @enderror * * See the description of @c cpl_table_copy_data_int() for details. */ cpl_error_code cpl_table_copy_data_float_complex(cpl_table *table, const char *name, const float complex *data) { cpl_column *column = cpl_table_find_column_(table, name); if (data == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); return cpl_column_copy_data_float_complex(column, data) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Copy existing data to a table @em double column. * * @param table Pointer to table. * @param name Name of the column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE. *
* @enderror * * See the description of @c cpl_table_copy_data_int() for details. */ cpl_error_code cpl_table_copy_data_double(cpl_table *table, const char *name, const double *data) { cpl_column *column = cpl_table_find_column_(table, name); if (data == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); return cpl_column_copy_data_double(column, data) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Copy existing data to a table @em double complex column. * * @param table Pointer to table. * @param name Name of the column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX. *
* @enderror * * See the description of @c cpl_table_copy_data_int() for details. */ cpl_error_code cpl_table_copy_data_double_complex(cpl_table *table, const char *name, const double complex *data) { cpl_column *column = cpl_table_find_column_(table, name); if (data == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); return cpl_column_copy_data_double_complex(column, data) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Copy existing data to a table @em string column. * * @param table Pointer to table. * @param name Name of the column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_STRING. *
* @enderror * * See the description of @c cpl_table_copy_data_int() for details. * In the particular case of a string column, it should be noted that * the data are copied in-depth, i.e., also the pointed strings are * duplicated. Strings contained in the existing table column are * deallocated before being replaced by the new ones. */ cpl_error_code cpl_table_copy_data_string(cpl_table *table, const char *name, const char **data) { cpl_column *column = cpl_table_find_column_(table, name); if (data == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); return cpl_column_copy_data_string(column, data) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Delete a table. * * @param table Pointer to table to be deleted. * * @return Nothing. * * This function deletes a table, releasing all the memory associated * to it, including any existing column. If @em table is @c NULL, * nothing is done, and no error is set. */ void cpl_table_delete(cpl_table *table) { int width; cpl_column **column; if (table) { width = cpl_table_get_ncol(table); column = table->columns; while (width--) cpl_column_delete(*column++); if (table->columns) cpl_free(table->columns); if (table->select) cpl_free(table->select); cpl_free(table); } } /** * @brief * Get the number of rows in a table. * * @param table Pointer to table to examine. * * @return Number of rows in the table. If a @c NULL table pointer * is passed, -1 is returned. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * table is a NULL pointer. *
* @enderror * * Get the number of rows in a table. */ cpl_size cpl_table_get_nrow(const cpl_table *table) { if (table) return table->nr; cpl_error_set("cpl_table_get_nrow", CPL_ERROR_NULL_INPUT); return -1; } /** * @brief * Get the number of columns in a table. * * @param table Pointer to table to examine. * * @return Number of columns in the table. If a @c NULL table pointer * is passed, -1 is returned. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * table is a NULL pointer. *
* @enderror * * Get the number of columns in a table. */ cpl_size cpl_table_get_ncol(const cpl_table *table) { if (table) return table->nc; cpl_error_set("cpl_table_get_ncol", CPL_ERROR_NULL_INPUT); return -1; } /** * @brief * Get the type of a table column. * * @param table Pointer to table. * @param name Column name. * * @return Column type, or @c CPL_TYPE_INVALID in case of failure. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * Get the type of a column. */ cpl_type cpl_table_get_column_type(const cpl_table *table, const char *name) { const cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return CPL_TYPE_INVALID; } return cpl_column_get_type(column); } /** * @brief * Get the depth of a table column. * * @param table Pointer to table. * @param name Column name. * * @return Column depth, or -1 in case of failure. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * Get the depth of a column. Columns of type @em array always have positive * depth, while columns listing numbers or character strings have depth 0. */ cpl_size cpl_table_get_column_depth(const cpl_table *table, const char *name) { const cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return -1; } return cpl_column_get_depth(column); } /** * @brief * Get the number of dimensions of a table column of arrays. * * @param table Pointer to table. * @param name Column name. * * @return Column number of dimensions, or 0 in case of failure. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * Get the number of dimensions of a column. If a column is not an array * column, or if it has no dimensions, 1 is returned. */ cpl_size cpl_table_get_column_dimensions(const cpl_table *table, const char *name) { cpl_size dim; const cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return 0; } dim = cpl_column_get_dimensions(column); if (dim == 0) { (void)cpl_error_set_where_(); } return dim; } /** * @brief * Set the dimensions of a table column of arrays. * * @param table Pointer to table. * @param name Column name. * @param dimensions Integer array containing the sizes of the column dimensions * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_ILLEGAL_INPUT * Either the specified column is not of type array, * or the dimensions array contains invalid elements. *
CPL_ERROR_TYPE_MISMATCH * The dimensions array is not of type CPL_TYPE_INT. *
CPL_ERROR_INCOMPATIBLE_INPUT * The specified dimensions are incompatible with the total number * of elements in the column arrays. *
* @enderror * * Set the number of dimensions of a column. If the @em dimensions array * has size less than 2, nothing is done and no error is returned. */ cpl_error_code cpl_table_set_column_dimensions(cpl_table *table, const char *name, const cpl_array *dimensions) { cpl_column *column = cpl_table_find_column_(table, name); if (dimensions == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); return column ? cpl_column_set_dimensions(column, dimensions) : cpl_error_set_where_(); } /** * @brief * Get size of one dimension of a table column of arrays. * * @param table Pointer to table. * @param name Column name. * @param indx Indicate dimension to query (0 = x, 1 = y, 2 = z, etc.). * * @return Size of queried dimension of the column, or zero in case of error. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_UNSUPPORTED_MODE * The specified column is not of type array. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The specified indx array is not compatible with * the column dimensions. *
CPL_ERROR_INCOMPATIBLE_INPUT * The specified dimensions are incompatible with the total number * of elements in the column arrays. *
* @enderror * * Get the size of one dimension of a column. If a column is not an array * column, or if it has no dimensions, 1 is returned. */ cpl_size cpl_table_get_column_dimension(const cpl_table *table, const char *name, cpl_size indx) { cpl_size dim; const cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return 0; } dim = cpl_column_get_dimension(column, indx); if (dim == 0) { (void)cpl_error_set_where_(); } return dim; } /** * @brief * Give a new unit to a table column. * * @param table Pointer to table. * @param name Column name. * @param unit New unit. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * The input unit string is duplicated before being used as the column * unit. If @em unit is a @c NULL pointer, the column will be unitless. * The unit associated to a column has no effect on any operation performed * on columns, and it must be considered just an optional description of * the content of a column. It is however saved to a FITS file when using * cpl_table_save(). */ cpl_error_code cpl_table_set_column_unit(cpl_table *table, const char *name, const char *unit) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_unit(column, unit) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Get the unit of a table column. * * @param table Pointer to table. * @param name Column name. * * @return Unit of column, or @c NULL if no unit can be returned. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * Return the unit of a column if present, otherwise a NULL pointer is * returned. Note that the returned string is a pointer to the column * unit, not its copy. Its manipulation will directly affect the column * unit, while changing the column unit using @c cpl_column_set_unit() * will turn it into garbage. Therefore it should be considered read-only, * and if a real copy of a column unit is required, this function should * be called as an argument of the function @c strdup(). */ const char *cpl_table_get_column_unit(const cpl_table *table, const char *name) { const cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return NULL; } /* May return NULL but cannot fail now */ return cpl_column_get_unit(column); } /** * @brief * Give a new format to a table column. * * @param table Pointer to table. * @param name Column name. * @param format New format. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * The input format string is duplicated before being used as the column * format. If @em format is a @c NULL pointer, "%%s" will be used if * the column is of type @c CPL_TYPE_STRING, "% 1.5e" if the column is * of type @c CPL_TYPE_FLOAT or @c CPL_TYPE_DOUBLE, and "% 7d" if it is * of type @c CPL_TYPE_INT. The format associated to a column has no * effect on any operation performed on columns, and it is used just * in the @c printf() calls made while printing a table using the * function @c cpl_table_dump(). This information is lost after saving * the table in FITS format using @c cpl_table_save(). */ cpl_error_code cpl_table_set_column_format(cpl_table *table, const char *name, const char *format) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_format(column, format) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Get the format of a table column. * * @param table Pointer to table. * @param name Column name. * * @return Format of column, or @c NULL in case of error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * Return the format of a column. Note that the returned string is * a pointer to the column format, not its copy. Its manipulation * will directly affect the column format, while changing the column * format using @c cpl_column_set_format() will turn it into garbage. * Therefore it should be considered read-only, and if a real copy of * a column format is required, this function should be called as an * argument of the function @c strdup(). */ const char *cpl_table_get_column_format(const cpl_table *table, const char *name) { const char * format; const cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return NULL; } format = cpl_column_get_format(column); if (format == NULL) { (void)cpl_error_set_where_(); } return format; } /** * @brief * Get a pointer to @em integer column data. * * @param table Pointer to table. * @param name Column name. * * @return Pointer to column data, or @c NULL if the column has zero length, * or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_INT. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_INT includes an array of * values of type @em int. This function returns a pointer to this array. * The data buffer elements corresponding to invalid column elements would * in general contain garbage. To avoid this, @c cpl_table_fill_invalid_int() * should be called just before this function, assigning to all the invalid * column elements an @em ad @em hoc numerical value. See the description * of function @c cpl_table_fill_invalid_int() for further details. * * @note * Use at your own risk: direct manipulation of column data rules out * any check performed by the table object interface, and may introduce * inconsistencies between the information maintained internally, and * the actual column data and structure. */ int *cpl_table_get_data_int(cpl_table *table, const char *name) { cpl_errorstate prestate = cpl_errorstate_get(); int *data = (int *)cpl_table_get_data_int_const(table, name); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em integer column data. * * @param table Pointer to constant table. * @param name Column name. * * @return Pointer to constant column data, or @c NULL if the column * has zero length, or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_INT. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_INT includes an array of * values of type @em int. This function returns a pointer to this array. * The data buffer elements corresponding to invalid column elements would * in general contain garbage. To avoid this, @c cpl_table_fill_invalid_int() * should be called just before this function, assigning to all the invalid * column elements an @em ad @em hoc numerical value. See the description * of function @c cpl_table_fill_invalid_int() for further details. */ const int *cpl_table_get_data_int_const(const cpl_table *table, const char *name) { const cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_INT); if (!column) { (void)cpl_error_set_where_(); return NULL; } return cpl_column_get_data_int_const(column); } /** * @brief * Get a pointer to @em long column data. * * @param table Pointer to table. * @param name Column name. * * @return Pointer to column data, or @c NULL if the column has zero length, * or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_LONG includes an array of * values of type @em long. This function returns a pointer to this array. * The data buffer elements corresponding to invalid column elements would * in general contain garbage. To avoid this, @c cpl_table_fill_invalid_long() * should be called just before this function, assigning to all the invalid * column elements an @em ad @em hoc numerical value. See the description * of function @c cpl_table_fill_invalid_long() for further details. * * @note * Use at your own risk: direct manipulation of column data rules out * any check performed by the table object interface, and may introduce * inconsistencies between the information maintained internally, and * the actual column data and structure. */ long *cpl_table_get_data_long(cpl_table *table, const char *name) { cpl_errorstate prestate = cpl_errorstate_get(); long *data = (long *)cpl_table_get_data_long_const(table, name); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em long column data. * * @param table Pointer to constant table. * @param name Column name. * * @return Pointer to constant column data, or @c NULL if the column * has zero length, or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_LONG includes an array of * values of type @em long. This function returns a pointer to this array. * The data buffer elements corresponding to invalid column elements would * in general contain garbage. To avoid this, @c cpl_table_fill_invalid_long() * should be called just before this function, assigning to all the invalid * column elements an @em ad @em hoc numerical value. See the description * of function @c cpl_table_fill_invalid_long() for further details. */ const long *cpl_table_get_data_long_const(const cpl_table *table, const char *name) { const cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_LONG); if (!column) { (void)cpl_error_set_where_(); return NULL; } return cpl_column_get_data_long_const(column); } /** * @brief * Get a pointer to @em long @em long column data. * * @param table Pointer to table. * @param name Column name. * * @return Pointer to column data, or @c NULL if the column has zero length, * or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG_LONG. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_LONG_LONG includes an array of * values of type @em long long. This function returns a pointer to this array. * The data buffer elements corresponding to invalid column elements would * in general contain garbage. To avoid this, * @c cpl_table_fill_invalid_long_long() should be called just before this * function, assigning to all the invalid column elements an @em ad @em hoc * numerical value. See the description of function * @c cpl_table_fill_invalid_long_long() for further details. * * @note * Use at your own risk: direct manipulation of column data rules out * any check performed by the table object interface, and may introduce * inconsistencies between the information maintained internally, and * the actual column data and structure. */ long long *cpl_table_get_data_long_long(cpl_table *table, const char *name) { cpl_errorstate prestate = cpl_errorstate_get(); long long *data = (long long *)cpl_table_get_data_long_long_const(table, name); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em long long column data. * * @param table Pointer to constant table. * @param name Column name. * * @return Pointer to constant column data, or @c NULL if the column * has zero length, or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG_LONG. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_LONG_LONG includes an array of * values of type @em long long. This function returns a pointer to this array. * The data buffer elements corresponding to invalid column elements would * in general contain garbage. To avoid this, * @c cpl_table_fill_invalid_long_long() should be called just before this * function, assigning to all the invalid column elements an @em ad @em hoc * numerical value. See the description of function * @c cpl_table_fill_invalid_long_long() for further details. */ const long long *cpl_table_get_data_long_long_const(const cpl_table *table, const char *name) { const cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_LONG_LONG); if (!column) { (void)cpl_error_set_where_(); return NULL; } return cpl_column_get_data_long_long_const(column); } /** * @brief * Get a pointer to @em float column data. * * @param table Pointer to table. * @param name Column name. * * @return Pointer to column data, or @c NULL if the column has zero length, * or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_FLOAT includes an array * of values of type @em float. This function returns a pointer to this array. * The data buffer elements corresponding to invalid column elements would * in general contain garbage. To avoid this, @c cpl_table_fill_invalid_float() * should be called just before this function, assigning to all the invalid * column elements an @em ad @em hoc numerical value. See the description * of function @c cpl_table_fill_invalid_float() for further details. * * @note * Use at your own risk: direct manipulation of column data rules out * any check performed by the table object interface, and may introduce * inconsistencies between the information maintained internally, and * the actual column data and structure. */ float *cpl_table_get_data_float(cpl_table *table, const char *name) { cpl_errorstate prestate = cpl_errorstate_get(); float *data = (float *)cpl_table_get_data_float_const(table, name); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em float column data. * * @param table Pointer to constant table. * @param name Column name. * * @return Pointer to constant column data, or @c NULL if the column * has zero length, or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_FLOAT includes an array * of values of type @em float. This function returns a pointer to this array. * The data buffer elements corresponding to invalid column elements would * in general contain garbage. To avoid this, @c cpl_table_fill_invalid_float() * should be called just before this function, assigning to all the invalid * column elements an @em ad @em hoc numerical value. See the description * of function @c cpl_table_fill_invalid_float() for further details. */ const float *cpl_table_get_data_float_const(const cpl_table *table, const char *name) { const cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_FLOAT); if (!column) { (void)cpl_error_set_where_(); return NULL; } return cpl_column_get_data_float_const(column); } /** * @brief * Get a pointer to @em float complex column data. * * @param table Pointer to table. * @param name Column name. * * @return Pointer to column data, or @c NULL if the column has zero length, * or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT_COMPLEX. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_FLOAT_COMPLEX includes an array * of values of type @em float complex. This function returns a pointer to * this array. * The data buffer elements corresponding to invalid column elements would * in general contain garbage. To avoid this, * @c cpl_table_fill_invalid_float_complex() * should be called just before this function, assigning to all the invalid * column elements an @em ad @em hoc numerical value. See the description * of function @c cpl_table_fill_invalid_float_complex() for further details. * * @note * Use at your own risk: direct manipulation of column data rules out * any check performed by the table object interface, and may introduce * inconsistencies between the information maintained internally, and * the actual column data and structure. */ float complex *cpl_table_get_data_float_complex(cpl_table *table, const char *name) { cpl_errorstate prestate = cpl_errorstate_get(); float complex *data = (float complex *)cpl_table_get_data_float_complex_const(table, name); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em float complex column data. * * @param table Pointer to constant table. * @param name Column name. * * @return Pointer to constant column data, or @c NULL if the column * has zero length, or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT_COMPLEX. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_FLOAT_COMPLEX includes an array * of values of type @em float complex. This function returns a pointer to * this array. * The data buffer elements corresponding to invalid column elements would * in general contain garbage. To avoid this, * @c cpl_table_fill_invalid_float_complex() * should be called just before this function, assigning to all the invalid * column elements an @em ad @em hoc numerical value. See the description * of function @c cpl_table_fill_invalid_float_complex() for further details. */ const float complex * cpl_table_get_data_float_complex_const(const cpl_table *table, const char *name) { const cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_FLOAT_COMPLEX); if (!column) { (void)cpl_error_set_where_(); return NULL; } return cpl_column_get_data_float_complex_const(column); } /** * @brief * Get a pointer to @em double column data. * * @param table Pointer to table. * @param name Column name. * * @return Pointer to column data, or @c NULL if the column has zero length, * or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_DOUBLE includes an array of * values of type @em double. This function returns a pointer to this array. * The data buffer elements corresponding to invalid column elements would in * general contain garbage. To avoid this, @c cpl_table_fill_invalid_double() * should be called just before this function, assigning to all the invalid * column elements an @em ad @em hoc numerical value. See the description * of function @c cpl_table_fill_invalid_double() for further details. * * @note * Use at your own risk: direct manipulation of column data rules out * any check performed by the table object interface, and may introduce * inconsistencies between the information maintained internally, and * the actual column data and structure. */ double *cpl_table_get_data_double(cpl_table *table, const char *name) { cpl_errorstate prestate = cpl_errorstate_get(); double *data = (double *)cpl_table_get_data_double_const(table, name); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em double column data. * * @param table Pointer to constant table. * @param name Column name. * * @return Pointer to constant column data, or @c NULL if the column * has zero length, or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_DOUBLE includes an array of * values of type @em double. This function returns a pointer to this array. * The data buffer elements corresponding to invalid column elements would in * general contain garbage. To avoid this, @c cpl_table_fill_invalid_double() * should be called just before this function, assigning to all the invalid * column elements an @em ad @em hoc numerical value. See the description * of function @c cpl_table_fill_invalid_double() for further details. */ const double *cpl_table_get_data_double_const(const cpl_table *table, const char *name) { const cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_DOUBLE); if (!column) { (void)cpl_error_set_where_(); return NULL; } return cpl_column_get_data_double_const(column); } /** * @brief * Get a pointer to @em double complex column data. * * @param table Pointer to table. * @param name Column name. * * @return Pointer to column data, or @c NULL if the column has zero length, * or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_DOUBLE_COMPLEX includes an array * of values of type @em double complex. This function returns a pointer to * this array. * The data buffer elements corresponding to invalid column elements would * in general contain garbage. To avoid this, * @c cpl_table_fill_invalid_double_complex() * should be called just before this function, assigning to all the invalid * column elements an @em ad @em hoc numerical value. See the description * of function @c cpl_table_fill_invalid_double_complex() for further details. * * @note * Use at your own risk: direct manipulation of column data rules out * any check performed by the table object interface, and may introduce * inconsistencies between the information maintained internally, and * the actual column data and structure. */ double complex *cpl_table_get_data_double_complex(cpl_table *table, const char *name) { cpl_errorstate prestate = cpl_errorstate_get(); double complex *data = (double complex *)cpl_table_get_data_double_complex_const(table, name); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em double complex column data. * * @param table Pointer to constant table. * @param name Column name. * * @return Pointer to constant column data, or @c NULL if the column * has zero length, or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX. *
* @enderror * * A @em cpl_table column of type @c CPL_TYPE_DOUBLE_COMPLEX includes an array * of values of type @em double complex. This function returns a pointer to * this array. * The data buffer elements corresponding to invalid column elements would * in general contain garbage. To avoid this, * @c cpl_table_fill_invalid_double_complex() * should be called just before this function, assigning to all the invalid * column elements an @em ad @em hoc numerical value. See the description * of function @c cpl_table_fill_invalid_double_complex() for further details. */ const double complex * cpl_table_get_data_double_complex_const(const cpl_table *table, const char *name) { const cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_DOUBLE_COMPLEX); if (!column) { (void)cpl_error_set_where_(); return NULL; } return cpl_column_get_data_double_complex_const(column); } /** * @brief * Get a pointer to @em string column data. * * @param table Pointer to table. * @param name Column name. * * @return Pointer to column data, or @c NULL if the column has zero length, * or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_STRING. *
* @enderror * * A table column of type @c CPL_TYPE_STRING includes an array of values * of type @em char*. This function returns a pointer to this array. * * @note * Use at your own risk: direct manipulation of column data rules out * any check performed by the table object interface, and may introduce * inconsistencies between the information maintained internally, and * the actual column data and structure. */ char **cpl_table_get_data_string(cpl_table *table, const char *name) { cpl_errorstate prestate = cpl_errorstate_get(); char **data = (char **)cpl_table_get_data_string_const(table, name); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em string column data. * * @param table Pointer to constant table. * @param name Column name. * * @return Pointer to constant column data, or @c NULL if the column has * zero length, or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_STRING. *
* @enderror * * A table column of type @c CPL_TYPE_STRING includes an array of values * of type @em char*. This function returns a pointer to this array. */ const char **cpl_table_get_data_string_const(const cpl_table *table, const char *name) { const cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_STRING); if (!column) { (void)cpl_error_set_where_(); return NULL; } return cpl_column_get_data_string_const(column); } /** * @brief * Get a pointer to @em array column data. * * @param table Pointer to table. * @param name Column name. * * @return Pointer to column data, or @c NULL if the column has zero length, * or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type array. *
* @enderror * * A table column of type @em array includes an array of values * of type @em cpl_array*. This function returns a pointer to this array. * * @note * Use at your own risk: direct manipulation of column data rules out * any check performed by the table object interface, and may introduce * inconsistencies between the information maintained internally, and * the actual column data and structure. */ cpl_array **cpl_table_get_data_array(cpl_table *table, const char *name) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_array **data = (cpl_array **)cpl_table_get_data_array_const(table, name); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to @em array column data. * * @param table Pointer to table. * @param name Column name. * * @return Pointer to column data, or @c NULL if the column has zero length, * or in case of failure. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type array. *
* @enderror * * A table column of type @em array includes an array of values * of type @em cpl_array*. This function returns a pointer to this array. */ const cpl_array **cpl_table_get_data_array_const(const cpl_table *table, const char *name) { const cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_POINTER); if (!column) { (void)cpl_error_set_where_(); return NULL; } return cpl_column_get_data_array_const(column); } /** * @brief * Delete a column from a table. * * @param table Pointer to table. * @param name Name of table column to delete. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * Delete a column from a table. If the table is left without columns, * also the selection flags are lost. */ cpl_error_code cpl_table_erase_column(cpl_table *table, const char *name) { cpl_column *column; if (table == 0x0 || name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); column = cpl_table_extract_column(table, name); if (!column) return cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); cpl_column_delete(column); return CPL_ERROR_NONE; } /** * @brief * Delete a table segment. * * @param table Pointer to table. * @param start First row to delete. * @param count Number of rows to delete. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * table is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has length zero, or start is * outside the table range. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
* @enderror * * A portion of the table data is physically removed. The pointers to column * data may change, therefore pointers previously retrieved by calling * @c cpl_table_get_data_int(), @c cpl_table_get_data_string(), etc., * should be discarded. The table selection flags are set back to * "all selected". The specified segment can extend beyond the end of * the table, and in that case rows will be removed up to the end of * the table. */ cpl_error_code cpl_table_erase_window(cpl_table *table, cpl_size start, cpl_size count) { cpl_size width = cpl_table_get_ncol(table); cpl_column **column; if (table == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (count > table->nr - start) count = table->nr - start; column = table->columns; /* * If it will fail, it will be at the first column: the table * will never be returned half-done. */ while (width--) { if (cpl_column_erase_segment(*column++, start, count)) { return cpl_error_set_where_(); } } table->nr -= count; return cpl_table_select_all(table); } /** * @brief * Delete the selected rows of a table. * * @param table Pointer to table * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * table is a NULL pointer. *
* @enderror * * A portion of the table data is physically removed. The pointer to * column data may change, therefore pointers previously retrieved by * calling @c cpl_table_get_data_int(), @c cpl_table_get_data_string(), * etc., should be discarded. The table selection flags are set back to * "all selected". */ cpl_error_code cpl_table_erase_selected(cpl_table *table) { cpl_size length = cpl_table_get_nrow(table); cpl_size i, width; if (table == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (table->selectcount == 0) return cpl_table_select_all(table); if (table->selectcount == length) return cpl_table_set_size(table, 0); width = cpl_table_get_ncol(table); for (i = 0; i < width; i++) if (cpl_column_erase_pattern(table->columns[i], table->select)) { return cpl_error_set_where_(); } table->nr -= table->selectcount; return cpl_table_select_all(table); } /** * @brief * Insert a segment of rows into table data. * * @param table Pointer to table * @param start Row where to insert the segment. * @param count Length of the segment. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * table is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * start is negative. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
* @enderror * * Insert a segment of empty rows, just containing invalid elements. * Setting @em start to a number greater than the column length is legal, * and has the effect of appending extra rows at the end of the table: * this is equivalent to expanding the table using @c cpl_table_set_size(). * The input @em column may also have zero length. The pointers to column * data values may change, therefore pointers previously retrieved by * calling @c cpl_table_get_data_int(), @c cpl_table_get_data_string(), * etc., should be discarded. The table selection flags are set back to * "all selected". */ cpl_error_code cpl_table_insert_window(cpl_table *table, cpl_size start, cpl_size count) { cpl_size width = cpl_table_get_ncol(table); cpl_column **column; if (table == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); column = table->columns; /* * If it will fail, it will be at the first column: the table * will never be returned half-done. */ while (width--) { if (cpl_column_insert_segment(*column++, start, count)) { return cpl_error_set_where_(); } } table->nr += count; return cpl_table_select_all(table); } /** * @brief * Compare the structure of two tables. * * @param table1 Pointer to a table. * @param table2 Pointer to another table. * * @return 0 if the tables have the same structure, 1 otherwise. * In case of error, -1 is returned. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
* @enderror * * Two tables have the same structure if they have the same number * of columns, with the same names, the same types, and the same units. * The order of the columns is not relevant. */ int cpl_table_compare_structure(const cpl_table *table1, const cpl_table *table2) { cpl_size width1 = cpl_table_get_ncol(table1); cpl_size width2 = cpl_table_get_ncol(table2); const char *name = NULL; if (table1 == 0x0 || table2 == 0x0) { cpl_error_set_where_(); return -1; } if (width1 == width2) { cpl_array *names = cpl_table_get_column_names(table1); cpl_size i; for (i = 0; i < width1; i++) { name = cpl_array_get_string(names, i); if (!cpl_table_has_column(table2, name)) return 1; if (cpl_table_get_column_type(table1, name) != cpl_table_get_column_type(table2, name)) return 1; if (cpl_table_get_column_depth(table1, name) != cpl_table_get_column_depth(table2, name)) return 1; if (cpl_table_get_column_unit(table1, name) && cpl_table_get_column_unit(table2, name)) { if (strcmp(cpl_table_get_column_unit(table1, name), cpl_table_get_column_unit(table2, name)) != 0) return 1; } if (cpl_table_get_column_unit(table1, name) == NULL && cpl_table_get_column_unit(table2, name)) { return 1; } if (cpl_table_get_column_unit(table2, name) == NULL && cpl_table_get_column_unit(table1, name)) { return 1; } } cpl_array_delete(names); return 0; /* Same structure */ } return 1; } /** * @brief * Merge two tables. * * @param target_table Target table. * @param insert_table Table to be inserted in the target table. * @param row Row where to insert the insert table. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any input table is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * row is negative. *
CPL_ERROR_INCOMPATIBLE_INPUT * The input tables do not have the same structure. *
* @enderror * * The input tables must have the same structure, as defined by the function * @c cpl_table_compare_structure() . Data from the @em insert_table are * duplicated and inserted at the specified position of the @em target_table. * If the specified @em row is not less than the target table length, the * second table will be appended to the target table. The selection flags * of the target table are always set back to "all selected". The pointers * to column data in the target table may change, therefore pointers * previously retrieved by calling @c cpl_table_get_data_int(), * @c cpl_table_get_data_string(), etc., should be discarded. */ cpl_error_code cpl_table_insert(cpl_table *target_table, const cpl_table *insert_table, cpl_size row) { cpl_size width = cpl_table_get_ncol(target_table); cpl_column **column; if (cpl_table_compare_structure(target_table, insert_table)) return cpl_error_set_(CPL_ERROR_INCOMPATIBLE_INPUT); column = target_table->columns; while (width--) { if (cpl_column_merge(*column, cpl_table_find_column(insert_table, cpl_column_get_name(*column)), row)) { return cpl_error_set_where_(); } column++; } target_table->nr += insert_table->nr; return cpl_table_select_all(target_table); } /** * @brief * Read a value from a numerical column. * * @param table Pointer to table. * @param name Name of table column to be accessed. * @param row Position of element to be read. * @param null Flag indicating @em null values, or error condition. * * @return Value read. In case of invalid table element, or in case of * error, 0.0 is returned. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is not numerical, or is a column of arrays. *
* @enderror * * Rows are counted starting from 0. The @em null flag is used to * indicate whether the accessed table element is valid (0) or * invalid (1). The @em null flag also signals an error condition (-1). * The @em null argument can be left to @c NULL. */ double cpl_table_get(const cpl_table *table, const char *name, cpl_size row, int *null) { cpl_type type; /* FIXME: Should be const */ cpl_column *column = cpl_table_find_column_(table, name); if (null) *null = -1; /* Ensure initialization in case of an error */ if (!column) { (void)cpl_error_set_where_(); return 0.0; } type = cpl_column_get_type(column); if ((type == CPL_TYPE_STRING) || (type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { (void)cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "name='%s', row=%" CPL_SIZE_FORMAT ", type='%s'", name, row, cpl_type_get_name(type)); return 0.0; } return cpl_column_get(column, row, null); } /** * @brief * Read a value from a complex column. * * @param table Pointer to table. * @param name Name of table column to be accessed. * @param row Position of element to be read. * @param null Flag indicating @em null values, or error condition. * * @return Value read. In case of invalid table element, or in case of * error, 0.0 is returned. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is not complex, or is a column of arrays. *
* @enderror * * Rows are counted starting from 0. The @em null flag is used to * indicate whether the accessed table element is valid (0) or * invalid (1). The @em null flag also signals an error condition (-1). * The @em null argument can be left to @c NULL. */ double complex cpl_table_get_complex(const cpl_table *table, const char *name, cpl_size row, int *null) { cpl_type type; /* FIXME: Should be const */ cpl_column *column = cpl_table_find_column_(table, name); if (null) *null = -1; /* Ensure initialization in case of an error */ if (!column) { (void)cpl_error_set_where_(); return 0.0; } type = cpl_column_get_type(column); if (!(type & CPL_TYPE_COMPLEX) || (type & CPL_TYPE_POINTER)) { (void)cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "name='%s', row=%" CPL_SIZE_FORMAT ", type='%s'", name, row, cpl_type_get_name(type)); return 0.0; } return cpl_column_get_complex(column, row, null); } /** * @brief * Read a value from an @em integer column. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position of element to be read. * @param null Flag indicating @em null values, or error condition. * * @return Integer value read. In case of an invalid table element, or in * case of error, 0 is always returned. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_INT. *
* @enderror * * Read a value from a column of type @c CPL_TYPE_INT. If the @em null * flag is a valid pointer, it is used to indicate whether the accessed * column element is valid (0) or invalid (1). The @em null flag also signals * an error condition (-1). The @em null flag pointer can also be @c NULL, * and in that case this option will be disabled. Rows are counted starting * from 0. * * @note * For automatic conversion (always to type @em double), use the function * @c cpl_table_get(). */ int cpl_table_get_int(const cpl_table *table, const char *name, cpl_size row, int *null) { cpl_column *column; cpl_type type; if (null) *null = -1; /* Ensure initialization in case of an error */ if (name == 0x0) { (void)cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "name is NULL"); return 0; } if (table == 0x0) { (void)cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "table is NULL"); return 0; } column = cpl_table_find_column(table, name); if (!column) { (void)cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "name='%s', " "row=%" CPL_SIZE_FORMAT, name, row); return 0; } type = cpl_column_get_type(column); if (type != CPL_TYPE_INT) { (void)cpl_error_set_message_(CPL_ERROR_TYPE_MISMATCH, "name='%s', row=%" CPL_SIZE_FORMAT ", Non-int type='%s'", name, row, cpl_type_get_name(type)); return 0; } return cpl_column_get_int(column, row, null); } /** * @brief * Read a value from a @em long column. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position of element to be read. * @param null Flag indicating @em null values, or error condition. * * @return Long integer value read. In case of an invalid table element, or in * case of error, 0 is always returned. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG. *
* @enderror * * Read a value from a column of type @c CPL_TYPE_LONG. See the documentation * of function cpl_table_get_int(). */ long cpl_table_get_long(const cpl_table *table, const char *name, cpl_size row, int *null) { /* FIXME: Should be const */ cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_LONG); if (null) *null = -1; /* Ensure initialization in case of an error */ if (!column) { (void)cpl_error_set_where_(); return 0L; } return cpl_column_get_long(column, row, null); } /** * @brief * Read a value from a @em long @em long column. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position of element to be read. * @param null Flag indicating @em null values, or error condition. * * @return Long long integer value read. In case of an invalid table element, * or in case of error, 0 is always returned. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG_LONG. *
* @enderror * * Read a value from a column of type @c CPL_TYPE_LONG_LONG. See the * documentation of function cpl_table_get_int(). */ long long cpl_table_get_long_long(const cpl_table *table, const char *name, cpl_size row, int *null) { /* FIXME: Should be const */ cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_LONG_LONG); if (null) *null = -1; /* Ensure initialization in case of an error */ if (!column) { (void)cpl_error_set_where_(); return 0L; } return cpl_column_get_long_long(column, row, null); } /** * @brief * Read a value from a @em float column. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position of element to be read. * @param null Flag indicating @em null values, or error condition. * * @return Float value read. In case of an invalid table element, or in * case of error, 0.0 is always returned. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT. *
* @enderror * * Read a value from a column of type @c CPL_TYPE_FLOAT. See the documentation * of function cpl_table_get_int(). */ float cpl_table_get_float(const cpl_table *table, const char *name, cpl_size row, int *null) { /* FIXME: Should be const */ cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_FLOAT); if (null) *null = -1; /* Ensure initialization in case of an error */ if (!column) { (void)cpl_error_set_where_(); return 0.0; } return cpl_column_get_float(column, row, null); } /** * @brief * Read a value from a @em float complex column. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position of element to be read. * @param null Flag indicating @em null values, or error condition. * * @return Float complex value read. In case of an invalid table element, or in * case of error, 0.0 is always returned. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT_COMPLEX. *
* @enderror * * Read a value from a column of type @c CPL_TYPE_FLOAT_COMPLEX. * See the documentation of function cpl_table_get_int(). */ float complex cpl_table_get_float_complex(const cpl_table *table, const char *name, cpl_size row, int *null) { /* FIXME: Should be const */ cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_FLOAT_COMPLEX); if (null) *null = -1; /* Ensure initialization in case of an error */ if (!column) { (void)cpl_error_set_where_(); return 0.0; } return cpl_column_get_float_complex(column, row, null); } /** * @brief * Read a value from a @em double column. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position of element to be read. * @param null Flag indicating @em null values, or error condition. * * @return Double value read. In case of an invalid table element, or in * case of error, 0.0 is always returned. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE. *
* @enderror * * Read a value from a column of type @c CPL_TYPE_DOUBLE. See the * documentation of function cpl_table_get_int(). */ double cpl_table_get_double(const cpl_table *table, const char *name, cpl_size row, int *null) { /* FIXME: Should be const */ cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_DOUBLE); if (null) *null = -1; /* Ensure initialization in case of an error */ if (!column) { (void)cpl_error_set_where_(); return 0.0; } return cpl_column_get_double(column, row, null); } /** * @brief * Read a value from a @em double complex column. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position of element to be read. * @param null Flag indicating @em null values, or error condition. * * @return Double complex value read. In case of an invalid table element, or in * case of error, 0.0 is always returned. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX. *
* @enderror * * Read a value from a column of type @c CPL_TYPE_DOUBLE_COMPLEX. See the * documentation of function cpl_table_get_int(). */ double complex cpl_table_get_double_complex(const cpl_table *table, const char *name, cpl_size row, int *null) { /* FIXME: Should be const */ cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_DOUBLE_COMPLEX); if (null) *null = -1; /* Ensure initialization in case of an error */ if (!column) { (void)cpl_error_set_where_(); return 0.0; } return cpl_column_get_double_complex(column, row, null); } /** * @brief * Read a value from a @em string column. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position of element to be read. * * @return Pointer to string. In case of an invalid column element, or in * case of error, a @c NULL pointer is always returned. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_STRING. *
* @enderror * * Read a value from a column of type @c CPL_TYPE_STRING. * Rows are counted starting from 0. * * @note * The returned string is a pointer to a table element, not its copy. * Its manipulation will directly affect that element, while changing * that element using @c cpl_table_set_string() will turn it into garbage. * Therefore, if a real copy of a string column element is required, this * function should be called as an argument of the function @c strdup(). */ const char *cpl_table_get_string(const cpl_table *table, const char *name, cpl_size row) { /* FIXME: Should be const */ cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_STRING); if (!column) { (void)cpl_error_set_where_(); return NULL; } return cpl_column_get_string(column, row); } /** * @brief * Read an array from an @em array column. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position of element to be read. * * @return Pointer to array. In case of an invalid column element, or in * case of error, a @c NULL pointer is always returned. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type array. *
* @enderror * * Read a value from a column of any array type. * Rows are counted starting from 0. * * @note * The returned array is a pointer to a table element, not its copy. * Its manipulation will directly affect that element, while changing * that element using @c cpl_table_set_array() will turn it into garbage. * Therefore, if a real copy of an array column element is required, * this function should be called as an argument of the function * @c cpl_array_duplicate(). */ const cpl_array *cpl_table_get_array(const cpl_table *table, const char *name, cpl_size row) { /* FIXME: Should be const */ cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_POINTER); if (!column) { (void)cpl_error_set_where_(); return NULL; } return cpl_column_get_array(column, row); } /** * @brief * Write a value to a numerical table column element. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is not numerical, or it is of type * array. *
* @enderror * * Write a value to a numerical column element. The value is cast to the * accessed column type according to the C casting rules. The written value * is automatically marked as valid. To invalidate a column value use * @c cpl_table_set_invalid(). Table rows are counted starting from 0. */ cpl_error_code cpl_table_set(cpl_table *table, const char *name, cpl_size row, double value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set(column, row, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a complex value to a complex numerical table column element. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is not complex, or it is of type * array. *
* @enderror * * Write a value to a complex column element. The value is cast to the * accessed column type according to the C casting rules. The written value * is automatically marked as valid. To invalidate a column value use * @c cpl_table_set_invalid(). Table rows are counted starting from 0. */ cpl_error_code cpl_table_set_complex(cpl_table *table, const char *name, cpl_size row, double complex value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_complex(column, row, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to an @em integer table column element. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_INT. *
* @enderror * * Write a value to a table column of type @c CPL_TYPE_INT. The written * value is automatically marked as valid. To invalidate a column value use * @c cpl_table_set_invalid(). Table rows are counted starting from 0. * * @note * For automatic conversion to the column type, use the function * @c cpl_table_set(). */ cpl_error_code cpl_table_set_int(cpl_table *table, const char *name, cpl_size row, int value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_int(column, row, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to an @em long table column element. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG. *
* @enderror * * Write a value to a table column of type @c CPL_TYPE_LONG. The written * value is automatically marked as valid. To invalidate a column value use * @c cpl_table_set_invalid(). Table rows are counted starting from 0. * * @note * For automatic conversion to the column type, use the function * @c cpl_table_set(). */ cpl_error_code cpl_table_set_long(cpl_table *table, const char *name, cpl_size row, long value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_long(column, row, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to an @em long @em long table column element. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG_LONG. *
* @enderror * * Write a value to a table column of type @c CPL_TYPE_LONG_LONG. The written * value is automatically marked as valid. To invalidate a column value use * @c cpl_table_set_invalid(). Table rows are counted starting from 0. * * @note * For automatic conversion to the column type, use the function * @c cpl_table_set(). */ cpl_error_code cpl_table_set_long_long(cpl_table *table, const char *name, cpl_size row, long long value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_long_long(column, row, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to a @em float table column element. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT. *
* @enderror * * Write a value to a table column of type @c CPL_TYPE_FLOAT. The written * value is automatically marked as valid. To invalidate a column value use * @c cpl_table_set_invalid(). Table rows are counted starting from 0. * * @note * For automatic conversion to the column type, use the function * @c cpl_table_set(). */ cpl_error_code cpl_table_set_float(cpl_table *table, const char *name, cpl_size row, float value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_float(column, row, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to a @em float complex table column element. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT_COMPLEX. *
* @enderror * * Write a value to a table column of type @c CPL_TYPE_FLOAT_COMPLEX. * The written value is automatically marked as valid. To invalidate * a column value use @c cpl_table_set_invalid(). Table rows are counted * starting from 0. * * @note * For automatic conversion to the column type, use the function * @c cpl_table_set_complex(). */ cpl_error_code cpl_table_set_float_complex(cpl_table *table, const char *name, cpl_size row, float complex value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_float_complex(column, row, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to a @em double table column element. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE. *
* @enderror * * Write a value to a table column of type @c CPL_TYPE_DOUBLE. The written * value is automatically marked as valid. To invalidate a column value use * @c cpl_table_set_invalid(). Table rows are counted starting from 0. * * @note * For automatic conversion to the column type, use the function * @c cpl_table_set(). */ cpl_error_code cpl_table_set_double(cpl_table *table, const char *name, cpl_size row, double value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_double(column, row, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to a @em double complex table column element. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX. *
* @enderror * * Write a value to a table column of type @c CPL_TYPE_DOUBLE_COMPLEX. * The written value is automatically marked as valid. To invalidate * a column value use @c cpl_table_set_invalid(). Table rows are counted * starting from 0. * * @note * For automatic conversion to the column type, use the function * @c cpl_table_set_complex(). */ cpl_error_code cpl_table_set_double_complex(cpl_table *table, const char *name, cpl_size row, double complex value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_double_complex(column, row, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a character string to a @em string table column element. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position where to write the character string. * @param value Character string to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_STRING. *
* @enderror * * Write a string to a table column of type @c CPL_TYPE_STRING. The written * value can also be a @c NULL pointer, that is equivalent to a call to * @c cpl_table_set_invalid(). Note that the character string is copied, * therefore the original can be modified without affecting the table * element. To "plug" a character string directly into a table element, * use the function @c cpl_table_get_data_string(). */ cpl_error_code cpl_table_set_string(cpl_table *table, const char *name, cpl_size row, const char *value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_string(column, row, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write an array to an @em array table column element. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Position where to write the array. * @param array Array to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type array. *
CPL_ERROR_INCOMPATIBLE_INPUT * The size of the input array is different from the * depth of the specified column. *
* @enderror * * Write an array to a table column of type @em array. The written * value can also be a @c NULL pointer, that is equivalent to a call * to @c cpl_table_set_invalid(). Note that the array is copied, * therefore the original can be modified without affecting the * table element. To "plug" an array directly into a table element, * use the function @c cpl_table_get_data_array(). Beware that the * "plugged" array must have the same type and depth declared for * the column. */ cpl_error_code cpl_table_set_array(cpl_table *table, const char *name, cpl_size row, const cpl_array *array) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_array(column, row, array) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Flag a column element as invalid. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Row where to write a @em null. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * In the case of either a @em string or an @em array column, the * corresponding string or array is set free and its pointer is set * to @c NULL. For other data types, the corresponding table element * is flagged internally as invalid. */ cpl_error_code cpl_table_set_invalid(cpl_table *table, const char *name, cpl_size row) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_set_invalid(column, row) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to a numerical column segment. * * @param table Pointer to table. * @param name Name of table column to access. * @param start Position where to begin to write the value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is not numerical, or is of type array. *
* @enderror * * Write the same value to a numerical column segment. The value is cast * to the type of the accessed column according to the C casting rules. * The written values are automatically marked as valid. To invalidate * a column interval use @c cpl_table_set_column_invalid() instead. * If the sum of @em start and @em count exceeds the number of table * rows, the column is filled up to its end. */ cpl_error_code cpl_table_fill_column_window(cpl_table *table, const char *name, cpl_size start, cpl_size count, double value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill(column, start, count, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to a complex column segment. * * @param table Pointer to table. * @param name Name of table column to access. * @param start Position where to begin to write the value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is not complex, or is of type array. *
* @enderror * * Write the same value to a complex column segment. The value is cast * to the type of the accessed column according to the C casting rules. * The written values are automatically marked as valid. To invalidate * a column interval use @c cpl_table_set_column_invalid() instead. * If the sum of @em start and @em count exceeds the number of table * rows, the column is filled up to its end. */ cpl_error_code cpl_table_fill_column_window_complex(cpl_table *table, const char *name, cpl_size start, cpl_size count, double complex value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_complex(column, start, count, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to an @em integer column segment. * * @param table Pointer to table. * @param name Name of table column to access. * @param start Position where to begin to write the value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_INT. *
* @enderror * * Write the same value to an @em integer column segment. The written * values are automatically marked as valid. To invalidate a column * interval use @c cpl_table_set_column_invalid() instead. If the sum * of @em start and @em count exceeds the number of table rows, the * column is filled up to its end. * * @note * For automatic conversion to the accessed column type use the function * @c cpl_table_fill_column_window(). */ cpl_error_code cpl_table_fill_column_window_int(cpl_table *table, const char *name, cpl_size start, cpl_size count, int value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_int(column, start, count, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to an @em long column segment. * * @param table Pointer to table. * @param name Name of table column to access. * @param start Position where to begin to write the value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG. *
* @enderror * * Write the same value to an @em long column segment. The written * values are automatically marked as valid. To invalidate a column * interval use @c cpl_table_set_column_invalid() instead. If the sum * of @em start and @em count exceeds the number of table rows, the * column is filled up to its end. * * @note * For automatic conversion to the accessed column type use the function * @c cpl_table_fill_column_window(). */ cpl_error_code cpl_table_fill_column_window_long(cpl_table *table, const char *name, cpl_size start, cpl_size count, long value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_long(column, start, count, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to an @em long @em long column segment. * * @param table Pointer to table. * @param name Name of table column to access. * @param start Position where to begin to write the value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG_LONG. *
* @enderror * * Write the same value to an @em long @em long column segment. The written * values are automatically marked as valid. To invalidate a column * interval use @c cpl_table_set_column_invalid() instead. If the sum * of @em start and @em count exceeds the number of table rows, the * column is filled up to its end. * * @note * For automatic conversion to the accessed column type use the function * @c cpl_table_fill_column_window(). */ cpl_error_code cpl_table_fill_column_window_long_long(cpl_table *table, const char *name, cpl_size start, cpl_size count, long long value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_long_long(column, start, count, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to a @em float column segment. * * @param table Pointer to table. * @param name Name of table column to access. * @param start Position where to begin to write the value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT. *
* @enderror * * Write the same value to a @em float column segment. The written * values are automatically marked as valid. To invalidate a column * interval use @c cpl_table_set_column_invalid() instead. If the sum * of @em start and @em count exceeds the number of table rows, the * column is filled up to its end. */ cpl_error_code cpl_table_fill_column_window_float(cpl_table *table, const char *name, cpl_size start, cpl_size count, float value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_float(column, start, count, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to a @em float complex column segment. * * @param table Pointer to table. * @param name Name of table column to access. * @param start Position where to begin to write the value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT_COMPLEX. *
* @enderror * * Write the same value to a @em float complex column segment. The written * values are automatically marked as valid. To invalidate a column * interval use @c cpl_table_set_column_invalid() instead. If the sum * of @em start and @em count exceeds the number of table rows, the * column is filled up to its end. */ cpl_error_code cpl_table_fill_column_window_float_complex(cpl_table *table, const char *name, cpl_size start, cpl_size count, float complex value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_float_complex(column, start, count, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to a @em double column segment. * * @param table Pointer to table. * @param name Name of table column to access. * @param start Position where to begin to write the value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE. *
* @enderror * * Write the same value to a @em double column segment. The written * values are automatically marked as valid. To invalidate a column * interval use @c cpl_table_set_column_invalid() instead. If the sum * of @em start and @em count exceeds the number of table rows, the * column is filled up to its end. */ cpl_error_code cpl_table_fill_column_window_double(cpl_table *table, const char *name, cpl_size start, cpl_size count, double value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_double(column, start, count, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a value to a @em double complex column segment. * * @param table Pointer to table. * @param name Name of table column to access. * @param start Position where to begin to write the value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX. *
* @enderror * * Write the same value to a @em double complex column segment. The written * values are automatically marked as valid. To invalidate a column * interval use @c cpl_table_set_column_invalid() instead. If the sum * of @em start and @em count exceeds the number of table rows, the * column is filled up to its end. */ cpl_error_code cpl_table_fill_column_window_double_complex(cpl_table *table, const char *name, cpl_size start, cpl_size count, double complex value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_double_complex(column, start, count, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write a character string to a @em string column segment. * * @param table Pointer to table. * @param name Name of table column to access. * @param start Position where to begin to write the character string. * @param count Number of strings to write. * @param value Character string to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_STRING. *
* @enderror * * Write the same value to a @em string column segment. If the input string * is not a @c NULL pointer, it is duplicated for each accessed column * element. If the input string is a @c NULL pointer, this call is equivalent * to a call to @c cpl_table_set_column_invalid(). If the sum of @em start * and @em count exceeds the number of rows in the table, the column is * filled up to its end. */ cpl_error_code cpl_table_fill_column_window_string(cpl_table *table, const char *name, cpl_size start, cpl_size count, const char *value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_string(column, start, count, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write an array to an @em array column segment. * * @param table Pointer to table. * @param name Name of table column to access. * @param start Position where to begin to write the array. * @param count Number of arrays to write. * @param array Array to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column does not match the type of the input * array, or it is not made of arrays. *
CPL_ERROR_INCOMPATIBLE_INPUT * The size of the input array is different from the * depth of the specified column. *
* @enderror * * Write the same array to a segment of an array column. If the input array * is not a @c NULL pointer, it is duplicated for each accessed column * element. If the input array is a @c NULL pointer, this call is equivalent * to a call to @c cpl_table_set_column_invalid(). If the sum of @em start * and @em count exceeds the number of rows in the table, the column is * filled up to its end. */ cpl_error_code cpl_table_fill_column_window_array(cpl_table *table, const char *name, cpl_size start, cpl_size count, const cpl_array *array) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_array(column, start, count, array) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Invalidate a column segment. * * @param table Pointer to table. * @param name Name of table column to access. * @param start Position where to begin invalidation. * @param count Number of column elements to invalidate. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * All the column elements in the specified interval are invalidated. * In the case of either a @em string or an @em array column, the * corresponding strings or arrays are set free. If the sum of @em start * and @em count exceeds the number of rows in the table, the column is * invalidated up to its end. */ cpl_error_code cpl_table_set_column_invalid(cpl_table *table, const char *name, cpl_size start, cpl_size count) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_invalid(column, start, count) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Check if a column element is valid. * * @param table Pointer to table. * @param name Name of table column to access. * @param row Column element to examine. * * @return 1 if the column element is valid, 0 if invalid, -1 in case of * error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
* @enderror * * Check if a column element is valid. */ int cpl_table_is_valid(const cpl_table *table, const char *name, cpl_size row) { int validity; cpl_errorstate prevstate = cpl_errorstate_get(); cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return -1; } validity = cpl_column_is_invalid(column, row) ? 0 : 1; if (!cpl_errorstate_is_equal(prevstate)) { cpl_error_set_where_(); return -1; } return validity; } /** * @brief * Check if a column contains at least one invalid value. * * @param table Pointer to table. * @param name Name of table column to access. * * @return 1 if the column contains at least one invalid element, 0 if not, * -1 in case of error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * Check if there are invalid elements in a column. In case of columns * of arrays, invalid values within an array are not considered: an * invalid element here means that an array element is not allocated, * i.e., it is a @c NULL pointer. In order to detect invalid elements * within an array element, this element must be extracted using * the function @c cpl_table_get_array(), and then use the function * @c cpl_array_has_invalid(). */ int cpl_table_has_invalid(const cpl_table *table, const char *name) { int answer; cpl_errorstate prevstate = cpl_errorstate_get(); cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return -1; } answer = cpl_column_has_invalid(column); if (!cpl_errorstate_is_equal(prevstate)) cpl_error_set_where_(); return answer; } /** * @brief * Check if a column contains at least one valid value. * * @param table Pointer to table. * @param name Name of table column to access. * * @return 1 if the column contains at least one valid value, 0 if not, * -1 in case of error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * Check if there are valid elements in a column. In case of columns * of arrays, invalid values within an array are not considered: an * invalid element here means that an array element is not allocated, * i.e., it is a @c NULL pointer. In order to detect valid elements * within an array element, this element must be extracted using * the function @c cpl_table_get_array(), and then use the function * @c cpl_array_has_valid(). */ int cpl_table_has_valid(const cpl_table *table, const char *name) { int answer; cpl_errorstate prevstate = cpl_errorstate_get(); cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return -1; } answer = cpl_column_has_valid(column); if (!cpl_errorstate_is_equal(prevstate)) cpl_error_set_where_(); return answer; } /** * @brief * Count number of invalid values in a table column. * * @param table Pointer to table. * @param name Name of table column to examine. * * @return Number of invalid elements in a table column, or -1 in case of * error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in table. *
* @enderror * * Count number of invalid elements in a table column. */ cpl_size cpl_table_count_invalid(const cpl_table *table, const char *name) { /* FIXME: Should be const */ cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return -1; } return cpl_column_count_invalid(column); } /** * @brief * Move a column from a table to another. * * @param to_table Target table. * @param name Name of column to move. * @param from_table Source table. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_INCOMPATIBLE_INPUT * The input tables do not have the same number of rows. *
CPL_ERROR_ILLEGAL_INPUT * Source and target tables are the same table. *
CPL_ERROR_DATA_NOT_FOUND * A column with the given name is not found in the * source table. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the same name already exists in the * target table. *
* @enderror * * Move a column from a table to another. */ cpl_error_code cpl_table_move_column(cpl_table *to_table, const char *name, cpl_table *from_table) { cpl_column *column; if (to_table == 0x0 || from_table == 0x0 || name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (to_table == from_table) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); if (to_table->nr != from_table->nr) return cpl_error_set_(CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_table_find_column(to_table, name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_table_extract_column(from_table, name); if (!column) return cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); cpl_table_append_column(to_table, column); return CPL_ERROR_NONE; } /** * @brief * Copy a column from a table to another. * * @param to_table Target table. * @param to_name New name of copied column. * @param from_table Source table. * @param from_name Name of column to copy. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_INCOMPATIBLE_INPUT * The input tables do not have the same number of rows. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified from_name is not found in the * source table. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the specified to_name already exists in the * target table. *
* @enderror * * Copy a column from a table to another. The column is duplicated. A column * may be duplicated also within the same table. */ cpl_error_code cpl_table_duplicate_column(cpl_table *to_table, const char *to_name, const cpl_table *from_table, const char *from_name) { cpl_column *column; if (to_table == 0x0 || from_table == 0x0 || to_name == 0x0 || from_name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (to_table->nr != from_table->nr) return cpl_error_set_(CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_table_find_column(to_table, to_name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_table_find_column(from_table, from_name); if (!column) return cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); column = cpl_column_duplicate(column); cpl_column_set_name(column, to_name); cpl_table_append_column(to_table, column); return CPL_ERROR_NONE; } /** * @brief * Rename a table column. * * @param table Pointer to table. * @param from_name Name of table column to rename. * @param to_name New name of column. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified from_name is not found * in table. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the specified to_name already exists in * table. *
* @enderror * * This function is used to change the name of a column. */ cpl_error_code cpl_table_name_column(cpl_table *table, const char *from_name, const char *to_name) { cpl_column *column; if (from_name == 0x0 || to_name == 0x0 || table == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_table_find_column(table, to_name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_table_find_column(table, from_name); if (!column) return cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); return cpl_column_set_name(column, to_name); } /** * @brief * Check if a column with a given name exists. * * @param table Pointer to table. * @param name Name of table column. * * @return 1 if column exists, 0 if column doesn't exist, -1 in case of error. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
* @enderror * * Check if a column with a given name exists in the specified table. */ int cpl_table_has_column(const cpl_table *table, const char *name) { if (table == 0x0 || name == 0x0) { cpl_error_set("cpl_table_has_column", CPL_ERROR_NULL_INPUT); return -1; } return (cpl_table_find_column(table, name) != NULL ? 1 : 0); } /** * @brief * Get table columns names. * * @param table Pointer to table. * * @return Name of a table column. * * If this function is not called with a @c NULL pointer the name of * the first table column will be returned. Further calls made with * a @c NULL pointer would return the next columns names, till the * end of the list of columns when a @c NULL would be returned. This * function only guarantees that all the table column names would be * returned by subsequent calls to this function, but the order in which * the column names are returned is undefined. The table structure must * not be modified (e.g. by deleting, creating, moving, or renaming * columns) between a sequence of calls to @c cpl_table_get_column_name() * related to the same table, or this function behaviour will be * undetermined. This function returns a pointer to the table column * name, and not to its copy, therefore the pointed string shouldn't * be deallocated or manipulated in any way. Its manipulation would * directly affect the column name, while changing the column name * using @c cpl_table_name_column() would turn it into garbage. * Therefore, if a real copy of a column name is required, this * function should be called as an argument of the function @c strdup(). * * @deprecated * This function is deprecated, because its usage could create * serious problems in case it is attempted to get names from * different tables simultaneously. For instance, a programmer * may call cpl_table_get_column_name() in a loop, and in the * same loop call a CPL function that calls as well the same * function. The behaviour in this case would be unpredictable. * The function cpl_table_get_column_names() should be used * instead. */ const char *cpl_table_get_column_name(const cpl_table *table) { static const cpl_table *looking = NULL; static cpl_size width = 0; static cpl_size i = 0; if (table) { looking = table; width = cpl_table_get_ncol(table); i = 0; } else { if (looking) i++; else return NULL; } if (i < width) return cpl_column_get_name(looking->columns[i]); return NULL; } /** * @brief * Get table columns names. * * @param table Pointer to table. * * @return Array of table columns names. * * The returned CPL array of strings should be finally destroyed * using cpl_array_delete(). */ cpl_array *cpl_table_get_column_names(const cpl_table *table) { cpl_array *names; cpl_size i; if (table == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } names = cpl_array_new(table->nc, CPL_TYPE_STRING); for (i = 0; i < table->nc; i++) cpl_array_set_string(names, i, cpl_column_get_name(table->columns[i])); return names; } /** * @brief * Resize a table to a new number of rows. * * @param table Pointer to table. * @param new_length New number of rows in table. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The specified new length is negative. *
* @enderror * * The contents of the columns will be unchanged up to the lesser of the * new and old sizes. If the table is expanded, the extra table rows would * just contain invalid elements. The table selection flags are set back * to "all selected". The pointer to column data may change, therefore * pointers previously retrieved by calling @c cpl_table_get_data_int(), * @c cpl_table_get_data_string(), etc. should be discarded. */ cpl_error_code cpl_table_set_size(cpl_table *table, cpl_size new_length) { cpl_size width = cpl_table_get_ncol(table); cpl_column **column; if (table == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (new_length < 0) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); column = table->columns; /* * If it will fail, it will be at the first column: the table * will never be returned half-done. */ while (width--) { if (cpl_column_set_size(*column++, new_length)) { return cpl_error_set_where_(); } } table->nr = new_length; return cpl_table_select_all(table); } /** * @brief * Modify depth of a column of arrays * * @param table Pointer to table. * @param name Column name. * @param depth New column depth. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any input argument is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The specified new depth is negative. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found * in table. *
CPL_ERROR_TYPE_MISMATCH * The column with the specified name is not an * array type. *
* @enderror * * This function is applicable just to columns of arrays. The contents * of the arrays in the specified column will be unchanged up to the * lesser of the new and old depths. If the depth is increased, the * extra array elements would be flagged as invalid. The pointers to * array data may change, therefore pointers previously retrieved by * calling @c cpl_array_get_data_int(), @c cpl_array_get_data_string(), * etc. should be discarded. */ cpl_error_code cpl_table_set_column_depth(cpl_table *table, const char *name, cpl_size depth) { cpl_size length; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_POINTER); if (!column) { return cpl_error_set_where_(); } if (depth < 0) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); length = table->nr; /* * If it will fail, it will be at the first array: the column * will never be returned half-done. */ while (length--) { if (cpl_column_set_depth(column, depth)) { return cpl_error_set_where_(); } } return CPL_ERROR_NONE; } /** * @brief * Make a copy of a table. * * @param table Pointer to table. * * @return Pointer to the new table, or @c NULL in case of @c NULL input, * or in case of error. * * The copy operation is done "in depth": columns data are duplicated * too, not just their pointers. Also the selection flags of the original * table are transferred to the new table. */ cpl_table *cpl_table_duplicate(const cpl_table *table) { cpl_size length = cpl_table_get_nrow(table); cpl_size width = cpl_table_get_ncol(table); cpl_size i; cpl_table *new_table = NULL; cpl_column *column; if (table) new_table = cpl_table_new(length); else return NULL; if (table->select) { new_table->select = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_table->select, table->select, length * sizeof(cpl_column_flag)); } new_table->selectcount = table->selectcount; for (i = 0; i < width; i++) { column = cpl_column_duplicate(table->columns[i]); cpl_table_append_column(new_table, column); } return new_table; } /** * @brief * Create a table from a section of another table. * * @param table Pointer to table. * @param start First row to be copied to new table. * @param count Number of rows to be copied. * * @return Pointer to the new table, or @c NULL in case or error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
* @enderror * * A number of consecutive rows are copied from an input table to a * newly created table. The new table will have the same structure of * the original table (see function @c cpl_table_compare_structure() ). * If the sum of @em start and @em count goes beyond the end of the * input table, rows are copied up to the end. All the rows of the * new table are selected, i.e., existing selection flags are not * transferred from the old table to the new one. */ cpl_table *cpl_table_extract(const cpl_table *table, cpl_size start, cpl_size count) { cpl_size width = cpl_table_get_ncol(table); cpl_size length = cpl_table_get_nrow(table); cpl_size i; cpl_table *new_table = NULL; cpl_column *column = NULL; if (table == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if (count > length - start) count = length - start; new_table = cpl_table_new(count); for (i = 0; i < width; i++) { column = cpl_column_extract(table->columns[i], start, count); if (column) { cpl_column_set_name(column, cpl_column_get_name(table->columns[i])); cpl_table_append_column(new_table, column); } else { cpl_error_set_where_(); cpl_table_delete(new_table); return NULL; } } return new_table; } /** * @brief * Cast a numeric or complex column to a new numeric or complex type column. * * @param table Pointer to table. * @param from_name Name of table column to cast. * @param to_name Name of new table column. * @param type Type of new table column. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any of table or from_name is a NULL pointer. *
CPL_ERROR_ILLEGAL_OUTPUT * A column with the specified to_name already exists in * table. Note however that to_name equal to * from_name is legal (in-place cast). *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified from_name is not found * in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex. *
CPL_ERROR_ILLEGAL_INPUT * The specified type is neither numerical nor complex. *
* @enderror * * A new column of the specified type is created, and the content of the * given numeric column is cast to the new type. If the input column type * is identical to the specified type the column is duplicated as is done * by the function @c cpl_table_duplicate_column(). Note that a column of * arrays is always cast to another column of arrays of the specified type, * unless it has depth 1. Consistently, a column of numbers can be cast * to a column of arrays of depth 1. * Here is a complete summary of how any (legal) @em type specification * would be interpreted, depending on the type of the input column: * * @code * from_name type = CPL_TYPE_XXX * specified type = CPL_TYPE_XXX * to_name type = CPL_TYPE_XXX * * from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER * specified type = CPL_TYPE_XXX | CPL_TYPE_POINTER * to_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER * * from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth > 1) * specified type = CPL_TYPE_XXX * to_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER * * from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth = 1) * specified type = CPL_TYPE_XXX * to_name type = CPL_TYPE_XXX * * from_name type = CPL_TYPE_XXX * specified type = CPL_TYPE_XXX | CPL_TYPE_POINTER * to_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth = 1) * * from_name type = CPL_TYPE_XXX * specified type = CPL_TYPE_POINTER * to_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth = 1) * * from_name type = CPL_TYPE_XXX * specified type = CPL_TYPE_YYY * to_name type = CPL_TYPE_YYY * * from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER * specified type = CPL_TYPE_YYY | CPL_TYPE_POINTER * to_name type = CPL_TYPE_YYY | CPL_TYPE_POINTER * * from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth > 1) * specified type = CPL_TYPE_YYY * to_name type = CPL_TYPE_YYY | CPL_TYPE_POINTER * * from_name type = CPL_TYPE_XXX | CPL_TYPE_POINTER (depth = 1) * specified type = CPL_TYPE_YYY * to_name type = CPL_TYPE_YYY * * from_name type = CPL_TYPE_XXX * specified type = CPL_TYPE_YYY | CPL_TYPE_POINTER * to_name type = CPL_TYPE_YYY | CPL_TYPE_POINTER (depth = 1) * @endcode * * @note * If @em to_name is a NULL pointer, or it is equal to @em from_name, * the cast is done in-place. The pointers to data will change, * therefore pointers previously retrieved by @c cpl_table_get_data_xxx(), * should be discarded. */ cpl_error_code cpl_table_cast_column(cpl_table *table, const char *from_name, const char *to_name, cpl_type type) { int in_place = 0; cpl_size depth = 0; int array = 0; cpl_column *column = cpl_table_find_column_(table, from_name); if (!column) { return cpl_error_set_where_(); } if (to_name) { if (strcmp(from_name, to_name) == 0) { in_place = 1; } else { if (cpl_table_find_column(table, to_name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } } else { in_place = 1; } /* * Inherit input type in case output type was not specified. */ if (type == CPL_TYPE_POINTER) type |= cpl_table_get_column_type(table, from_name); /* * Ensure depth of input column: 0 means number, 1 means arrays * of one element each which can conceivably be expressed with * a depth 0 column, >1 means generical arrays. */ depth = cpl_table_get_column_depth(table, from_name); /* * Record an explicit request that the output column should * be an array: useful only if the input array has depth = 0, * to produce a column of depth = 1. */ if (type & CPL_TYPE_POINTER) array = 1; /* * If cast is to be done in-place, and the output type is * identical to the input one, no doubt there is nothing to do. */ if (in_place) if (cpl_table_get_column_type(table, from_name) == type) return CPL_ERROR_NONE; /* * If cast is to be done in-place, and the _basic_ output type is * identical to the input one, and the input column has depth > 1, * no doubt there is nothing to do. */ if (in_place) if (depth > 1) if (cpl_table_get_column_type(table, from_name) == (type | CPL_TYPE_POINTER)) return CPL_ERROR_NONE; /* * Transform type into the basic type, no matter whether array or not. */ type &= ~CPL_TYPE_POINTER; /* * Now perform the cast */ if (depth == 0 && array == 1) { switch (type) { case CPL_TYPE_INT: column = cpl_column_cast_to_int_array(column); break; #if defined(USE_COLUMN_TYPE_LONG) case CPL_TYPE_LONG: column = cpl_column_cast_to_long_array(column); break; #endif case CPL_TYPE_LONG_LONG: column = cpl_column_cast_to_long_long_array(column); break; case CPL_TYPE_FLOAT: column = cpl_column_cast_to_float_array(column); break; case CPL_TYPE_DOUBLE: column = cpl_column_cast_to_double_array(column); break; case CPL_TYPE_FLOAT_COMPLEX: column = cpl_column_cast_to_float_complex_array(column); break; case CPL_TYPE_DOUBLE_COMPLEX: column = cpl_column_cast_to_double_complex_array(column); break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } } else if (depth == 1 && array == 0) { switch (type) { case CPL_TYPE_INT: column = cpl_column_cast_to_int_flat(column); break; #if defined(USE_COLUMN_TYPE_LONG) case CPL_TYPE_LONG: column = cpl_column_cast_to_long_flat(column); break; #endif case CPL_TYPE_LONG_LONG: column = cpl_column_cast_to_long_long_flat(column); break; case CPL_TYPE_FLOAT: column = cpl_column_cast_to_float_flat(column); break; case CPL_TYPE_DOUBLE: column = cpl_column_cast_to_double_flat(column); break; case CPL_TYPE_FLOAT_COMPLEX: column = cpl_column_cast_to_float_complex_flat(column); break; case CPL_TYPE_DOUBLE_COMPLEX: column = cpl_column_cast_to_double_complex_flat(column); break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } } else { switch (type) { case CPL_TYPE_INT: column = cpl_column_cast_to_int(column); break; #if defined(USE_COLUMN_TYPE_LONG) case CPL_TYPE_LONG: column = cpl_column_cast_to_long(column); break; #endif case CPL_TYPE_LONG_LONG: column = cpl_column_cast_to_long_long(column); break; case CPL_TYPE_FLOAT: column = cpl_column_cast_to_float(column); break; case CPL_TYPE_DOUBLE: column = cpl_column_cast_to_double(column); break; case CPL_TYPE_FLOAT_COMPLEX: column = cpl_column_cast_to_float_complex(column); break; case CPL_TYPE_DOUBLE_COMPLEX: column = cpl_column_cast_to_double_complex(column); break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } } if (column) { if (in_place) { cpl_table_erase_column(table, from_name); cpl_column_set_name(column, from_name); } else { cpl_column_set_name(column, to_name); } cpl_table_append_column(table, column); } else { return cpl_error_set_where_(); } return CPL_ERROR_NONE; } /** * @brief * Add the values of two numeric or complex table columns. * * @param table Pointer to table. * @param to_name Name of target column. * @param from_name Name of source column. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or any column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with any specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * Any specified column is neither numerical nor complex, * or it is an array column. *
* @enderror * * The columns are summed element by element, and the result of the sum is * stored in the target column. The columns' types may differ, and in that * case the operation would be performed using the standard C upcasting * rules, with a final cast of the result to the target column type. * Invalid elements are propagated consistently: if either or both members * of the sum are invalid, the result will be invalid too. Underflows and * overflows are ignored. */ cpl_error_code cpl_table_add_columns(cpl_table *table, const char *to_name, const char *from_name) { cpl_column *to_column = cpl_table_find_column_(table, to_name); /* FIXME: Should be const */ cpl_column *from_column = cpl_table_find_column_(table, from_name); return !to_column || !from_column || cpl_column_add(to_column, from_column) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Subtract two numeric or complex table columns. * * @param table Pointer to table. * @param to_name Name of target column. * @param from_name Name of column to be subtracted from target column. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or any column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with any specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * Any specified column is neither numerical non complex, * or it is an array column. *
* @enderror * * The columns are subtracted element by element, and the result of the * subtraction is stored in the target column. See the documentation of * the function @c cpl_table_add_columns() for further details. */ cpl_error_code cpl_table_subtract_columns(cpl_table *table, const char *to_name, const char *from_name) { cpl_column *to_column = cpl_table_find_column_(table, to_name); /* FIXME: Should be const */ cpl_column *from_column = cpl_table_find_column_(table, from_name); return !to_column || !from_column || cpl_column_subtract(to_column, from_column) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Multiply two numeric or complex table columns. * * @param table Pointer to table. * @param to_name Name of target column. * @param from_name Name of column to be multiplied with target column. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or any column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with any specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * Any specified column is neither numerical nor complex, * or it is an array column. *
* @enderror * * The columns are multiplied element by element, and the result of the * multiplication is stored in the target column. See the documentation of * the function @c cpl_table_add_columns() for further details. */ cpl_error_code cpl_table_multiply_columns(cpl_table *table, const char *to_name, const char *from_name) { cpl_column *to_column = cpl_table_find_column_(table, to_name); /* FIXME: Should be const */ cpl_column *from_column = cpl_table_find_column_(table, from_name); return !to_column || !from_column || cpl_column_multiply(to_column, from_column) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Divide two numeric or complex table columns. * * @param table Pointer to table. * @param to_name Name of target column. * @param from_name Name of column dividing the target column. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or any column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with any specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * Any specified column is neither numerical nor complex, * or it is an array column. *
* @enderror * * The columns are divided element by element, and the result of the * division is stored in the target column. The columns' types may * differ, and in that case the operation would be performed using * the standard C upcasting rules, with a final cast of the result * to the target column type. Invalid elements are propagated consistently: * if either or both members of the division are invalid, the result * will be invalid too. Underflows and overflows are ignored, but a * division by exactly zero will set an invalid column element. */ cpl_error_code cpl_table_divide_columns(cpl_table *table, const char *to_name, const char *from_name) { cpl_column *to_column = cpl_table_find_column_(table, to_name); /* FIXME: Should be const */ cpl_column *from_column = cpl_table_find_column_(table, from_name); return !to_column || !from_column || cpl_column_divide(to_column, from_column) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Add a constant value to a numerical or complex column. * * @param table Pointer to table. * @param name Column name. * @param value Value to add. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex, * or it is an array column. *
* @enderror * * The operation is always performed in double precision, with a final * cast of the result to the target column type. Invalid elements are * are not modified by this operation. */ cpl_error_code cpl_table_add_scalar(cpl_table *table, const char *name, double value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_add_scalar(column, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Add a constant complex value to a numerical or complex column. * * @param table Pointer to table. * @param name Column name. * @param value Value to add. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex, * or it is an array column. *
* @enderror * * The operation is always performed in double precision, with a final * cast of the result to the target column type. Invalid elements are * are not modified by this operation. */ cpl_error_code cpl_table_add_scalar_complex(cpl_table *table, const char *name, double complex value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_add_scalar_complex(column, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Subtract a constant value from a numerical or complex column. * * @param table Pointer to table. * @param name Column name. * @param value Value to subtract. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex, * or it is an array column. *
* @enderror * * See the description of the function @c cpl_table_add_scalar(). */ cpl_error_code cpl_table_subtract_scalar(cpl_table *table, const char *name, double value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_subtract_scalar(column, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Subtract a constant complex value from a numerical or complex column. * * @param table Pointer to table. * @param name Column name. * @param value Value to subtract. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex, * or it is an array column. *
* @enderror * * See the description of the function @c cpl_table_add_scalar_complex(). */ cpl_error_code cpl_table_subtract_scalar_complex(cpl_table *table, const char *name, double complex value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_subtract_scalar_complex(column, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Multiply a numerical or complex column by a constant. * * @param table Pointer to table. * @param name Column name. * @param value Multiplication factor. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex, * or it is an array column. *
* @enderror * * See the description of the function @c cpl_table_add_scalar(). */ cpl_error_code cpl_table_multiply_scalar(cpl_table *table, const char *name, double value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_multiply_scalar(column, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Multiply a numerical or complex column by a complex constant. * * @param table Pointer to table. * @param name Column name. * @param value Multiplication factor. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex, * or it is an array column. *
* @enderror * * See the description of the function @c cpl_table_add_scalar_complex(). */ cpl_error_code cpl_table_multiply_scalar_complex(cpl_table *table, const char *name, double complex value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_multiply_scalar_complex(column, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Divide a numerical or complex column by a constant. * * @param table Pointer to table. * @param name Column name. * @param value Divisor value. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex, * or it is an array column. *
CPL_ERROR_DIVISION_BY_ZERO * The input value is 0.0. *
* @enderror * * The operation is always performed in double precision, with a final * cast of the result to the target column type. Invalid elements are * not modified by this operation. */ cpl_error_code cpl_table_divide_scalar(cpl_table *table, const char *name, double value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_divide_scalar(column, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Divide a numerical or complex column by a complex constant. * * @param table Pointer to table. * @param name Column name. * @param value Divisor value. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex, * or it is an array column. *
CPL_ERROR_DIVISION_BY_ZERO * The input value is 0.0. *
* @enderror * * The operation is always performed in double precision, with a final * cast of the result to the target column type. Invalid elements are * not modified by this operation. */ cpl_error_code cpl_table_divide_scalar_complex(cpl_table *table, const char *name, double complex value) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_divide_scalar_complex(column, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Compute the absolute value of column values. * * @param table Pointer to table. * @param name Table column name. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is not numerical, or has type array. *
* @enderror * * Each column element is replaced by its absolute value. * Invalid elements are not modified by this operation. * If the column is complex, its type will be turned to * real (CPL_TYPE_FLOAT_COMPLEX will be changed into CPL_TYPE_FLOAT, * and CPL_TYPE_DOUBLE_COMPLEX will be changed into CPL_TYPE_DOUBLE), * and any pointer retrieved by calling @c cpl_table_get_data_float_complex() * and @c cpl_array_get_data_double_complex() should be discarded. */ cpl_error_code cpl_table_abs_column(cpl_table *table, const char *name) { cpl_type type; cpl_column *column = cpl_table_find_column_(table, name); if (!column) { return cpl_error_set_where_(); } type = cpl_table_get_column_type(table, name); if (type & CPL_TYPE_COMPLEX) { cpl_column *new_column = cpl_column_absolute_complex(column); if (new_column) { cpl_column_set_name(new_column, name); cpl_table_extract_column(table, name); cpl_table_append_column(table, new_column); cpl_column_delete(column); } else return cpl_error_set_where_(); } else { if (cpl_column_absolute(column)) return cpl_error_set_where_(); } return CPL_ERROR_NONE; } /** * @brief * Compute the logarithm of column values. * * @param table Pointer to table. * @param name Table column name. * @param base Logarithm base. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex, * or it is an array column. *
CPL_ERROR_ILLEGAL_INPUT * The input base is not positive. *
* @enderror * * Each column element is replaced by its logarithm in the specified base. * The operation is always performed in double precision, with a final * cast of the result to the target column type. Invalid elements are * not modified by this operation, but zero or negative elements are * invalidated by this operation. In case of complex numbers, values * very close to the origin may cause an overflow. The imaginary part * of the result is chosen in the interval [-pi/ln(base),pi/ln(base)], * so it should be kept in mind that doing the logarithm of exponential * of a complex number will not always express the phase angle with the * same number. For instance, the exponential in base 2 of (5.00, 5.00) * is (-30.33, -10.19), and the logarithm in base 2 of the latter will * be expressed as (5.00, -4.06). */ cpl_error_code cpl_table_logarithm_column(cpl_table *table, const char *name, double base) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_logarithm(column, base) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Compute the exponential of column values. * * @param table Pointer to table. * @param name Column name. * @param base Exponential base. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex, or it * is an array column. *
CPL_ERROR_ILLEGAL_INPUT * The input base is not positive. *
* @enderror * * Each column element is replaced by its exponential in the specified base. * The operation is always performed in double precision, with a final * cast of the result to the target column type. Invalid elements are * not modified by this operation. */ cpl_error_code cpl_table_exponential_column(cpl_table *table, const char *name, double base) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_exponential(column, base) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Compute the complex conjugate of column values. * * @param table Pointer to table. * @param name Column name. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex, or it * is integer, or it is an array column. *
CPL_ERROR_ILLEGAL_INPUT * The input base is not positive. *
* @enderror * * Each column element is replaced by its complex conjugate. * The operation is always performed in double precision, with a final * cast of the result to the target column type. Invalid elements are * not modified by this operation. */ cpl_error_code cpl_table_conjugate_column(cpl_table *table, const char *name) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_conjugate(column) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Compute the power of column values. * * @param table Pointer to table. * @param name Column name. * @param exponent Constant exponent. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex. *
* @enderror * * Each column element is replaced by its power to the specified exponent. * The operation is always performed in double precision, with a final * cast of the result to the target column type. Invalid elements are * not modified by this operation, but elements are invalidated at any * illegal operation: if the specified @em exponent is not negative, all * column elements must be not negative, and if the specified @em exponent * is negative, all column elements must be positive; column values not * fulfilling this condition will be invalidated. Only in case of complex * arrays this operation becomes legal. If the exponent is 0.0, * then any (valid) column element would be assigned the value 1.0. */ cpl_error_code cpl_table_power_column(cpl_table *table, const char *name, double exponent) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_power(column, exponent) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Compute the phase angle value of table column elements. * * @param table Pointer to table. * @param name Column name. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex. *
* @enderror * * Each column element is replaced by its phase angle value. * The phase angle will be in the range of [-pi,pi]. * Invalid elements are not modified by this operation. * If the column is complex, its type will be turned to * real (CPL_TYPE_FLOAT_COMPLEX will be changed into CPL_TYPE_FLOAT, * and CPL_TYPE_DOUBLE_COMPLEX will be changed into CPL_TYPE_DOUBLE), * and any pointer retrieved by calling @c cpl_table_get_data_float_complex(), * @c cpl_table_get_data_double_complex(), etc., should be discarded. */ cpl_error_code cpl_table_arg_column(cpl_table *table, const char *name) { cpl_type type; cpl_column *column = cpl_table_find_column_(table, name); if (!column) { return cpl_error_set_where_(); } type = cpl_table_get_column_type(table, name); if (type & CPL_TYPE_COMPLEX) { cpl_column *new_column = cpl_column_phase_complex(column); if (new_column) { cpl_column_set_name(new_column, name); cpl_table_extract_column(table, name); cpl_table_append_column(table, new_column); cpl_column_delete(column); } else return cpl_error_set_where_(); } else { float *fdata; double *ddata; int length = cpl_table_get_nrow(table); switch (type) { case CPL_TYPE_FLOAT: if (length) { fdata = cpl_table_get_data_float(table, name); memset(fdata, 0.0, length * sizeof(float)); // keep NULLs } break; case CPL_TYPE_DOUBLE: if (length) { ddata = cpl_table_get_data_double(table, name); memset(ddata, 0.0, length * sizeof(double)); } break; default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } return CPL_ERROR_NONE; } /** * @brief * Compute the real part value of table column elements. * * @param table Pointer to table. * @param name Column name. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex. *
* @enderror * * Each column element is replaced by its real party value only. * Invalid elements are not modified by this operation. * If the column is complex, its type will be turned to * real (CPL_TYPE_FLOAT_COMPLEX will be changed into CPL_TYPE_FLOAT, * and CPL_TYPE_DOUBLE_COMPLEX will be changed into CPL_TYPE_DOUBLE), * and any pointer retrieved by calling @c cpl_table_get_data_float_complex(), * @c cpl_table_get_data_double_complex(), etc., should be discarded. */ cpl_error_code cpl_table_real_column(cpl_table *table, const char *name) { cpl_type type; cpl_column *column = cpl_table_find_column_(table, name); if (!column) { return cpl_error_set_where_(); } type = cpl_table_get_column_type(table, name); if (type & CPL_TYPE_COMPLEX) { cpl_column *new_column = cpl_column_extract_real(column); if (new_column) { cpl_column_set_name(new_column, name); cpl_table_extract_column(table, name); cpl_table_append_column(table, new_column); cpl_column_delete(column); } else return cpl_error_set_where_(); } else { switch (type) { case CPL_TYPE_FLOAT: case CPL_TYPE_DOUBLE: break; default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } return CPL_ERROR_NONE; } /** * @brief * Compute the imaginary part value of table column elements. * * @param table Pointer to table. * @param name Column name. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex. *
* @enderror * * Each column element is replaced by its imaginary party value only. * Invalid elements are not modified by this operation. * If the column is complex, its type will be turned to * real (CPL_TYPE_FLOAT_COMPLEX will be changed into CPL_TYPE_FLOAT, * and CPL_TYPE_DOUBLE_COMPLEX will be changed into CPL_TYPE_DOUBLE), * and any pointer retrieved by calling @c cpl_table_get_data_float_complex(), * @c cpl_table_get_data_double_complex(), etc., should be discarded. */ cpl_error_code cpl_table_imag_column(cpl_table *table, const char *name) { cpl_type type; cpl_column *column = cpl_table_find_column_(table, name); if (!column) { return cpl_error_set_where_(); } type = cpl_table_get_column_type(table, name); if (type & CPL_TYPE_COMPLEX) { cpl_column *new_column = cpl_column_extract_imag(column); if (new_column) { cpl_column_set_name(new_column, name); cpl_table_extract_column(table, name); cpl_table_append_column(table, new_column); cpl_column_delete(column); } else return cpl_error_set_where_(); } else { float *fdata; double *ddata; int length = cpl_table_get_nrow(table); switch (type) { case CPL_TYPE_FLOAT: if (length) { fdata = cpl_table_get_data_float(table, name); memset(fdata, 0.0, length * sizeof(float)); // keep NULLs } break; case CPL_TYPE_DOUBLE: if (length) { ddata = cpl_table_get_data_double(table, name); memset(ddata, 0.0, length * sizeof(double)); } break; default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } return CPL_ERROR_NONE; } /** * @brief * Compute the mean value of a numerical column. * * @param table Pointer to table. * @param name Column name. * * @return Mean value. In case of error 0.0 is returned. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in * table, or it just contains invalid elements, or * the table has length zero. *
CPL_ERROR_INVALID_TYPE * The specified column is not numerical. *
* @enderror * * Invalid column values are excluded from the computation. The table * selection flags have no influence on the result. */ double cpl_table_get_column_mean(const cpl_table *table, const char *name) { double mean; cpl_errorstate prevstate = cpl_errorstate_get(); cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return 0.0; } mean = cpl_column_get_mean(column); if (!cpl_errorstate_is_equal(prevstate)) cpl_error_set_where_(); return mean; } /** * @brief * Compute the mean value of a numerical or complex column. * * @param table Pointer to table. * @param name Column name. * * @return Mean value. In case of error 0.0 is returned. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in * table, or it just contains invalid elements, or * the table has length zero. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex. *
* @enderror * * Invalid column values are excluded from the computation. The table * selection flags have no influence on the result. */ double complex cpl_table_get_column_mean_complex(const cpl_table *table, const char *name) { double complex mean; cpl_errorstate prevstate = cpl_errorstate_get(); cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return 0.0; } mean = cpl_column_get_mean_complex(column); if (!cpl_errorstate_is_equal(prevstate)) cpl_error_set_where_(); return mean; } /** * @brief * Compute the median value of a numerical column. * * @param table Pointer to table. * @param name Column name. * * @return Median value. See documentation of @c cpl_table_get_column_mean(). * * See the description of the function @c cpl_table_get_column_mean(). */ double cpl_table_get_column_median(const cpl_table *table, const char *name) { double median; cpl_errorstate prevstate = cpl_errorstate_get(); cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return 0.0; } median = cpl_column_get_median(column); if (!cpl_errorstate_is_equal(prevstate)) cpl_error_set_where_(); return median; } /** * @brief * Find the standard deviation of a table column. * * @param table Pointer to table. * @param name Column name. * * @return Standard deviation. See documentation of * @c cpl_table_get_column_mean(). * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in * table, or it just contains invalid elements, or * the table has length zero. *
CPL_ERROR_INVALID_TYPE * The specified column is not numerical. *
* @enderror * * Invalid column values are excluded from the computation of the * standard deviation. If just one valid element is found, 0.0 is * returned but no error is set. The table selection flags have no * influence on the result. */ double cpl_table_get_column_stdev(const cpl_table *table, const char *name) { double stdev; cpl_errorstate prevstate = cpl_errorstate_get(); cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return 0.0; } stdev = cpl_column_get_stdev(column); if (!cpl_errorstate_is_equal(prevstate)) cpl_error_set_where_(); return stdev; } /** * @brief * Get maximum value in a numerical column. * * @param table Pointer to table. * @param name Column name. * * @return Maximum value. See documentation of @c cpl_table_get_column_mean(). * * See the description of the function @c cpl_table_get_column_mean(). */ double cpl_table_get_column_max(const cpl_table *table, const char *name) { double max; cpl_errorstate prevstate = cpl_errorstate_get(); cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return 0.0; } max = cpl_column_get_max(column); if (!cpl_errorstate_is_equal(prevstate)) cpl_error_set_where_(); return max; } /** * @brief * Get minimum value in a numerical column. * * @param table Pointer to table. * @param name Column name. * * @return Minimum value. See documentation of @c cpl_table_get_column_mean(). * * See the description of the function @c cpl_table_get_column_mean(). */ double cpl_table_get_column_min(const cpl_table *table, const char *name) { double min; cpl_errorstate prevstate = cpl_errorstate_get(); cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return 0.0; } min = cpl_column_get_min(column); if (!cpl_errorstate_is_equal(prevstate)) cpl_error_set_where_(); return min; } /** * @brief * Get position of maximum in a numerical column. * * @param table Pointer to table. * @param name Column name. * @param row Returned position of maximum value. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in * table, or it just contains invalid elements, or * the table has length zero. *
CPL_ERROR_INVALID_TYPE * The specified column is not numerical. *
* @enderror * * Invalid column values are excluded from the search. The @em row argument * will be assigned the position of the maximum value, where rows are counted * starting from 0. If more than one column element correspond to the max * value, the position with the lowest row number is returned. In case of * error, @em row is left untouched. The table selection flags have no * influence on the result. */ cpl_error_code cpl_table_get_column_maxpos(const cpl_table *table, const char *name, cpl_size *row) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_get_maxpos(column, row) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Get position of minimum in a numerical column. * * @param table Pointer to table. * @param name Column name. * @param row Returned position of minimum value. * * @return See function @c cpl_table_get_column_maxpos(). * * See the description of the function @c cpl_table_get_column_maxpos(). */ cpl_error_code cpl_table_get_column_minpos(const cpl_table *table, const char *name, cpl_size *row) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_get_minpos(column, row) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Remove from a table columns and rows just containing invalid elements. * * @param table Pointer to table. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
* @enderror * * Table columns and table rows just containing invalid elements are deleted * from the table, i.e. a column or a row is deleted only if all of its * elements are invalid. The selection flags are set back to "all selected" * even if no rows or columns are removed. The pointers to data may change, * therefore pointers previously retrieved by @c cpl_table_get_data_int(), * @c cpl_table_get_data_string(), etc., should be discarded. * * @note * If the input table just contains invalid elements, all columns are * deleted. */ cpl_error_code cpl_table_erase_invalid_rows(cpl_table *table) { cpl_size length = cpl_table_get_nrow(table); cpl_size width = cpl_table_get_ncol(table); cpl_size new_width; cpl_size count = 0; int any_valid; int all_valid = 0; if (table == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); while (width--) { if (!cpl_column_has_valid(table->columns[width])) cpl_table_erase_column(table, cpl_column_get_name(table->columns[width])); else if (!cpl_column_has_invalid(table->columns[width])) all_valid = 1; } if (all_valid) return cpl_table_select_all(table); new_width = cpl_table_get_ncol(table); if (new_width == 0) return CPL_ERROR_NONE; while (length--) { width = new_width; any_valid = 0; while (width--) { if (!cpl_column_is_invalid(table->columns[width], length)) { any_valid = 1; break; } } if (any_valid) { /* Current row does not contain just invalids */ if (count) { /* End of segment of just invalids */ cpl_table_erase_window(table, length + 1, count); count = 0; } } else /* Current row just contains invalids */ count++; } if (count) /* The first table row is invalid */ cpl_table_erase_window(table, 0, count); return cpl_table_select_all(table); } /** * @brief * Remove from a table all columns just containing invalid elements, * and then all rows containing at least one invalid element. * * @param table Pointer to table. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
* @enderror * * Firstly, all columns consisting just of invalid elements are deleted * from the table. Next, the remaining table rows containing at least * one invalid element are also deleted from the table. The selection * flags are set back to "all selected" even if no rows or columns are * erased. The pointers to data may change, therefore pointers previously * retrieved by calling @c cpl_table_get_data_int(), etc., should be * discarded. * * The function is similar to the function cpl_table_erase_invalid_rows(), * except for the criteria to remove rows containing invalid elements after * all invalid columns have been removed. While cpl_table_erase_invalid_rows() * requires all elements to be invalid in order to remove a row from the * table, this function requires only one (or more) elements to be invalid. * * @note * If the input table just contains invalid elements, all columns are * deleted. * * @see * cpl_table_erase_invalid_rows() */ cpl_error_code cpl_table_erase_invalid(cpl_table *table) { cpl_size length = 0; cpl_size width = 0; cpl_size new_width; cpl_size count = 0; int any_null; if (table == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); length = cpl_table_get_nrow(table); width = cpl_table_get_ncol(table); while (width--) if (!cpl_column_has_valid(table->columns[width])) cpl_table_erase_column(table, cpl_column_get_name(table->columns[width])); new_width = cpl_table_get_ncol(table); if (new_width == 0) return CPL_ERROR_NONE; while (length--) { width = new_width; any_null = 0; while (width--) { if (cpl_column_is_invalid(table->columns[width], length)) { any_null = 1; break; } } if (any_null) { /* Current row contains at least an invalid */ count++; } else { /* Current row contains no invalids */ if (count) { /* End of segment of rows with some invalids */ cpl_table_erase_window(table, length + 1, count); count = 0; } } } if (count) /* The first table row has at least a NULL */ cpl_table_erase_window(table, 0, count); return cpl_table_select_all(table); } /** * @brief * Flag a table row as selected. * * @param table Pointer to table. * @param row Row to select. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
* @enderror * * Flag a table row as selected. Any previous selection is kept. */ cpl_error_code cpl_table_select_row(cpl_table *table, cpl_size row) { if (table == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (row < 0 || row >= table->nr) return cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); if (table->selectcount == table->nr) return CPL_ERROR_NONE; if (table->selectcount == 0) table->select = cpl_calloc(table->nr, sizeof(cpl_column_flag)); if (table->select[row] == 0) { table->select[row] = 1; table->selectcount++; if (table->selectcount == table->nr) { cpl_free(table->select); table->select = NULL; } } return CPL_ERROR_NONE; } /** * @brief * Select all table rows. * * @param table Pointer to table. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
* @enderror * * The table selection flags are reset, meaning that they are * all marked as selected. This is the initial state of any * table. */ cpl_error_code cpl_table_select_all(cpl_table *table) { if (table == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (table->select) cpl_free(table->select); table->select = NULL; table->selectcount = table->nr; return CPL_ERROR_NONE; } /** * @brief * Flag a table row as unselected. * * @param table Pointer to table. * @param row Row to unselect. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
* @enderror * * Flag a table row as unselected. Any previous selection is kept. */ cpl_error_code cpl_table_unselect_row(cpl_table *table, cpl_size row) { int length; if (table == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (row < 0 || row >= table->nr) return cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); if (table->selectcount == 0) return CPL_ERROR_NONE; length = table->nr; if (table->selectcount == length) table->select = cpl_malloc(table->nr * sizeof(cpl_column_flag)); if (table->selectcount == length) while (length--) table->select[length] = 1; if (table->select[row] == 1) { table->select[row] = 0; table->selectcount--; if (table->selectcount == 0) { if (table->select) cpl_free(table->select); table->select = NULL; } } return CPL_ERROR_NONE; } /** * @brief * Unselect all table rows. * * @param table Pointer to table. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
* @enderror * * The table selection flags are all unset, meaning that no table * rows are selected. */ cpl_error_code cpl_table_unselect_all(cpl_table *table) { if (table == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (table->select) cpl_free(table->select); table->select = NULL; table->selectcount = 0; return CPL_ERROR_NONE; } /** * @brief * Describe the structure and the contents of a table. * * @param table Pointer to table. * @param stream The output stream * * @return Nothing. * * This function is mainly intended for debug purposes. Some information * about the structure of a table and its contents is printed to terminal: * * - Number of columns, with their names and types * - Number of invalid elements for each column * - Number of rows and of selected rows * * If the specified stream is @c NULL, it is set to @em stdout. The function * used for printing is the standard C @c fprintf(). */ void cpl_table_dump_structure(const cpl_table *table, FILE *stream) { cpl_size width = cpl_table_get_ncol(table); cpl_size i = 0; if (stream == 0x0) stream = stdout; if (table == 0x0) { fprintf(stream, "NULL table\n\n"); return; } if (width > 0) fprintf(stream, "Table with %" CPL_SIZE_FORMAT "/%" CPL_SIZE_FORMAT " selected rows and %" CPL_SIZE_FORMAT " columns:\n\n", table->selectcount, table->nr, table->nc); while (i < width) { if (cpl_column_get_unit(table->columns[i])) { fprintf(stream, " %s [%s]:\n %" CPL_SIZE_FORMAT " ", cpl_column_get_name(table->columns[i]), cpl_column_get_unit(table->columns[i]), cpl_column_get_size(table->columns[i])); } else { fprintf(stream, " %s:\n %" CPL_SIZE_FORMAT " ", cpl_column_get_name(table->columns[i]), cpl_column_get_size(table->columns[i])); } switch (cpl_column_get_type(table->columns[i])) { case CPL_TYPE_INT: fprintf(stream, "integer "); break; case CPL_TYPE_LONG: fprintf(stream, "long integer "); break; case CPL_TYPE_LONG_LONG: fprintf(stream, "long long integer "); break; case CPL_TYPE_FLOAT: fprintf(stream, "float "); break; case CPL_TYPE_DOUBLE: fprintf(stream, "double "); break; case CPL_TYPE_STRING: fprintf(stream, "string "); break; case CPL_TYPE_INT | CPL_TYPE_POINTER: fprintf(stream, "arrays of integer "); break; case CPL_TYPE_LONG | CPL_TYPE_POINTER: fprintf(stream, "arrays of long integer "); break; case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: fprintf(stream, "arrays of long long integer "); break; case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: fprintf(stream, "arrays of float "); break; case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: fprintf(stream, "arrays of double "); break; case CPL_TYPE_STRING | CPL_TYPE_POINTER: fprintf(stream, "arrays of string "); break; case CPL_TYPE_FLOAT_COMPLEX: fprintf(stream, "float complex "); break; case CPL_TYPE_DOUBLE_COMPLEX: fprintf(stream, "double complex "); break; case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: fprintf(stream, "arrays of float complex "); break; case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: fprintf(stream, "arrays of double complex "); break; default: fprintf(stream, "UNDEFINED "); break; } fprintf(stream, "elements, of which %" CPL_SIZE_FORMAT " are flagged " "invalid.\n", cpl_column_count_invalid(table->columns[i])); i++; } return; } /** * @brief * Print a table. * * @param table Pointer to table * @param start First row to print * @param count Number of rows to print * @param stream The output stream * * @return Nothing. * * This function is mainly intended for debug purposes. * All column elements are printed according to the column formats, * that may be specified for each table column with the function * @c cpl_table_set_column_format(). The default column formats * have been chosen to provide a reasonable printout in most cases. * Table rows are counted from 0, and their sequence number is printed * at the left of each row. Invalid table elements are represented * as a sequence of "-" as wide as the field occupied by the column * to which they belong. Array elements are not resolved, and are * represented by a sequence of "+" as wide as the field occupied by the * column to which they belong. It is not shown whether a table row is * selected or not. Specifying a @em start beyond the table boundaries, * or a non-positive @em count, would generate a warning message, but no * error would be set. The specified number of rows to print may exceed * the table end, and in that case the table would be printed up to its * last row. If the specified stream is @c NULL, it is set to @em stdout. * The function used for printing is the standard C @c fprintf(). */ void cpl_table_dump(const cpl_table *table, cpl_size start, cpl_size count, FILE *stream) { cpl_size size; cpl_size nc = cpl_table_get_ncol(table); cpl_size offset; cpl_size i, j, k; cpl_size end; int *field_size; int *label_len; int row; char **fields; cpl_array *array; char *row_field; int null; int found; if (stream == 0x0) stream = stdout; if (table == 0x0) { fprintf(stream, "NULL table\n\n"); return; } if (table->nr == 0) { fprintf(stream, "Zero length table\n\n"); return; } if (start < 0 || start >= table->nr || count < 1) { fprintf(stream, "Illegal cpl_table_dump() arguments!\n"); return; } if (count > table->nr - start) count = table->nr - start; end = start + count; row = cx_snprintf(NULL, 0, "% -" CPL_SIZE_FORMAT, end); row_field = cpl_malloc((row + 1) * sizeof(char)); memset(row_field, ' ', row + 1); row_field[row] = '\0'; label_len = cpl_calloc(nc, sizeof(int)); field_size = cpl_calloc(nc, sizeof(int)); fields = cpl_calloc(nc, sizeof(char *)); for (j = 0; j < nc; j++) { label_len[j] = field_size[j] = strlen(cpl_column_get_name(table->columns[j])); switch (cpl_column_get_type(table->columns[j])) { case CPL_TYPE_INT: for (i = start; i < end; i++) { int inum = cpl_column_get_int(table->columns[j], i, &null); if (null) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(table->columns[j]), inum); if (size > field_size[j]) field_size[j] = size; } break; case CPL_TYPE_LONG: for (i = start; i < end; i++) { long lnum = cpl_column_get_long(table->columns[j], i, &null); if (null) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(table->columns[j]), lnum); if (size > field_size[j]) field_size[j] = size; } break; case CPL_TYPE_LONG_LONG: for (i = start; i < end; i++) { long long llnum = cpl_column_get_long_long(table->columns[j], i, &null); if (null) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(table->columns[j]), llnum); if (size > field_size[j]) field_size[j] = size; } break; case CPL_TYPE_FLOAT: for (i = start; i < end; i++) { float fnum = cpl_column_get_float(table->columns[j], i, &null); if (null) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(table->columns[j]), fnum); if (size > field_size[j]) field_size[j] = size; } break; case CPL_TYPE_DOUBLE: for (i = start; i < end; i++) { double dnum = cpl_column_get_double(table->columns[j], i, &null); if (null) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(table->columns[j]), dnum); if (size > field_size[j]) field_size[j] = size; } break; case CPL_TYPE_FLOAT_COMPLEX: for (i = start; i < end; i++) { float complex cfnum = cpl_column_get_float_complex(table->columns[j], i, &null); if (null) size = 4; else size = 3 + cx_snprintf(NULL, 0, cpl_column_get_format(table->columns[j]), crealf(cfnum)) + cx_snprintf(NULL, 0, cpl_column_get_format(table->columns[j]), cimagf(cfnum)); if (size > field_size[j]) field_size[j] = size; } break; case CPL_TYPE_DOUBLE_COMPLEX: for (i = start; i < end; i++) { double complex cdnum = cpl_column_get_double_complex(table->columns[j], i, &null); if (null) size = 4; else size = 3 + cx_snprintf(NULL, 0, cpl_column_get_format(table->columns[j]), creal(cdnum)) + cx_snprintf(NULL, 0, cpl_column_get_format(table->columns[j]), cimag(cdnum)); if (size > field_size[j]) field_size[j] = size; } break; case CPL_TYPE_STRING: for (i = start; i < end; i++) { char *string = (char *)cpl_column_get_string(table->columns[j], i); if (string == 0x0) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(table->columns[j]), string); if (size > field_size[j]) field_size[j] = size; } break; case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: break; default: field_size[j] = 4; break; } field_size[j]++; label_len[j]++; fields[j] = cpl_malloc(field_size[j] * sizeof(char)); } fprintf(stream, "%s ", row_field); for (j = 0; j < nc; j++) { offset = (field_size[j] - label_len[j]) / 2; for (i = 0; i < offset; i++) fields[j][i] = ' '; cx_snprintf(fields[j] + offset, label_len[j], "%s", cpl_column_get_name(table->columns[j])); for (i = label_len[j] + offset - 1; i < field_size[j]; i++) fields[j][i] = ' '; fields[j][field_size[j] - 1] = '\0'; fprintf(stream, "%-*s ", label_len[j], fields[j]); } fprintf(stream, "\n\n"); for (i = start; i < end; i++) { fprintf(stream, "%*" CPL_SIZE_FORMAT " ", row, i); for (j = 0; j < nc; j++) { switch (cpl_column_get_type(table->columns[j])) { case CPL_TYPE_INT: { int inum = cpl_column_get_int(table->columns[j], i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(table->columns[j]), inum); break; } case CPL_TYPE_LONG: { long lnum = cpl_column_get_long(table->columns[j], i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(table->columns[j]), lnum); break; } case CPL_TYPE_LONG_LONG: { long long llnum = cpl_column_get_long(table->columns[j], i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(table->columns[j]), llnum); break; } case CPL_TYPE_FLOAT: { float fnum = cpl_column_get_float(table->columns[j], i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(table->columns[j]), fnum); break; } case CPL_TYPE_DOUBLE: { double dnum = cpl_column_get_double(table->columns[j], i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(table->columns[j]), dnum); break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex cfnum = cpl_column_get_float_complex(table->columns[j], i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else { char *s = cpl_sprintf("(%s,%s)", cpl_column_get_format(table->columns[j]), cpl_column_get_format(table->columns[j])); cx_snprintf(fields[j], field_size[j], s, crealf(cfnum), cimagf(cfnum)); cpl_free(s); } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex cdnum = cpl_column_get_double_complex(table->columns[j], i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else { char *s = cpl_sprintf("(%s,%s)", cpl_column_get_format(table->columns[j]), cpl_column_get_format(table->columns[j])); cx_snprintf(fields[j], field_size[j], s, creal(cdnum), cimag(cdnum)); cpl_free(s); } break; } case CPL_TYPE_STRING: { char *string = (char *)cpl_column_get_string(table->columns[j], i); if (!string) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(table->columns[j]), string); break; } case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG| CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: default: array = (cpl_array *)cpl_column_get_array(table->columns[j], i); if (!array) { memset(fields[j], '-', field_size[j]); } else memset(fields[j], '+', field_size[j]); fields[j][field_size[j] - 1] = '\0'; break; } found = 0; for (k = 0; k < field_size[j]; k++) { if (fields[j][k] == '\0') found = 1; if (found) fields[j][k] = ' '; } fields[j][field_size[j] - 1] = '\0'; fprintf(stream, "%-*s ", field_size[j], fields[j]); } fprintf(stream, "\n"); } for (j = 0; j < nc; j++) cpl_free(fields[j]); cpl_free(fields); cpl_free(row_field); cpl_free(label_len); cpl_free(field_size); return; } /** * @brief * Shift the position of numeric or complex column values. * * @param table Pointer to table. * @param name Name of table column to shift. * @param shift Shift column values by so many rows. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_INVALID_TYPE * The specified column is neither numerical nor complex. *
CPL_ERROR_ILLEGAL_INPUT * The absolute value of shift is greater than the column * length. *
* @enderror * * The position of all column values is shifted by the specified amount. * If @em shift is positive, all values will be moved toward the bottom * of the column, otherwise toward its top. In either case as many column * elements as the amount of the @em shift will be left undefined, either * at the top or at the bottom of the column according to the direction * of the shift. These column elements will be marked as invalid. This * function is applicable just to numeric and complex columns, and not * to strings and or array types. The selection flags are always set back * to "all selected" after this operation. */ cpl_error_code cpl_table_shift_column(cpl_table *table, const char *name, cpl_size shift) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_shift(column, shift) || cpl_table_select_all(table) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write to invalid @em integer column elements a numeric code. * * @param table Pointer to table containing the column. * @param name Column name. * @param code Code to write to invalid column elements. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_INT, * or of type CPL_TYPE_INT | CPL_TYPE_POINTER. *
* @enderror * * This function can be applied also to columns of arrays of integers. * In general, numeric column elements that are flagged as invalid may contain * any value, that should not be given any meaning whatsoever. In order to * export the column data (using a call to @c cpl_table_get_data_int() ) to * procedures that are external to the CPL column system, it may turn out * to be appropriate assigning to all the invalid elements a conventional * code value. This code value will supposedly be recognized and handled * properly by a given foreign method applied directly to the column data * buffer. Note that only existing invalid elements will be coded as * indicated: new invalid column elements would still have their actual * values left undefined. Also, any further processing of the column would * not take care of maintaining the assigned code to a given invalid column * element: therefore the code should be applied just before it is actually * needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_table_fill_invalid_int(cpl_table *table, const char *name, int code) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_invalid_int(column, code) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write to invalid @em long column elements a numeric code. * * @param table Pointer to table containing the column. * @param name Column name. * @param code Code to write to invalid column elements. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG, * or of type CPL_TYPE_LONG | CPL_TYPE_POINTER. *
* @enderror * * This function can be applied also to columns of arrays of integers. * In general, numeric column elements that are flagged as invalid may contain * any value, that should not be given any meaning whatsoever. In order to * export the column data (using a call to @c cpl_table_get_data_long() ) to * procedures that are external to the CPL column system, it may turn out * to be appropriate assigning to all the invalid elements a conventional * code value. This code value will supposedly be recognized and handled * properly by a given foreign method applied directly to the column data * buffer. Note that only existing invalid elements will be coded as * indicated: new invalid column elements would still have their actual * values left undefined. Also, any further processing of the column would * not take care of maintaining the assigned code to a given invalid column * element: therefore the code should be applied just before it is actually * needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_table_fill_invalid_long(cpl_table *table, const char *name, long code) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_invalid_long(column, code) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write to invalid @em long @em long column elements a numeric code. * * @param table Pointer to table containing the column. * @param name Column name. * @param code Code to write to invalid column elements. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG_LONG, * or of type CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER. *
* @enderror * * This function can be applied also to columns of arrays of integers. * In general, numeric column elements that are flagged as invalid may contain * any value, that should not be given any meaning whatsoever. In order to * export the column data (using a call to @c cpl_table_get_data_long_long() ) * to procedures that are external to the CPL column system, it may turn out * to be appropriate assigning to all the invalid elements a conventional * code value. This code value will supposedly be recognized and handled * properly by a given foreign method applied directly to the column data * buffer. Note that only existing invalid elements will be coded as * indicated: new invalid column elements would still have their actual * values left undefined. Also, any further processing of the column would * not take care of maintaining the assigned code to a given invalid column * element: therefore the code should be applied just before it is actually * needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_table_fill_invalid_long_long(cpl_table *table, const char *name, long long code) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_invalid_long_long(column, code) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write to invalid @em float column elements a numeric code. * * @param table Pointer to table containing the column. * @param name Column name. * @param code Code to write to invalid column elements. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT, * or of type CPL_TYPE_FLOAT | CPL_TYPE_POINTER. *
* @enderror * * This function can be applied also to columns of arrays of floats. * In general, numeric column elements that are flagged as invalid may contain * any value, that should not be given any meaning whatsoever. In order to * export the column data (using a call to @c cpl_table_get_data_float() ) * to procedures that are external to the CPL column system, it may turn out * to be appropriate assigning to all the invalid elements a conventional * code value. This code value will supposedly be recognized and handled * properly by a given foreign method applied directly to the column data * buffer. Note that only existing invalid elements will be coded as * indicated: new invalid column elements would still have their actual * values left undefined. Also, any further processing of the column would * not take care of maintaining the assigned code to a given invalid column * element: therefore the code should be applied just before it is actually * needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_table_fill_invalid_float(cpl_table *table, const char *name, float code) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_invalid_float(column, code) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write to invalid @em float complex column elements a numeric code. * * @param table Pointer to table containing the column. * @param name Column name. * @param code Code to write to invalid column elements. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT_COMPLEX, * or of type CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER. *
* @enderror * * This function can be applied also to columns of arrays of complex floats. * In general, complex column elements that are flagged as invalid may contain * any value, that should not be given any meaning whatsoever. In order to * export the column data (calling to @c cpl_table_get_data_float_complex() ) * to procedures which are external to the CPL column system, it may turn out * to be appropriate assigning a conventional code value to all the invalid * elements. This code value will supposedly be recognized and handled * properly by a given foreign method applied directly to the column data * buffer. Note that only existing invalid elements will be coded as * indicated: new invalid column elements would still have their actual * values left undefined. Also, any further processing of the column would * not take care of maintaining the assigned code to a given invalid column * element: therefore the code should be applied just before it is actually * needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_table_fill_invalid_float_complex(cpl_table *table, const char *name, float complex code) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_invalid_float_complex(column, code) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write to invalid @em double column elements a numeric code. * * @param table Pointer to table containing the column. * @param name Column name. * @param code Code to write to invalid column elements. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE, * or of type CPL_TYPE_DOUBLE | CPL_TYPE_POINTER. *
* @enderror * * This function can be applied also to columns of arrays of doubles. * In general, numeric column elements that are flagged as invalid may contain * any value, that should not be given any meaning whatsoever. In order to * export the column data (using a call to @c cpl_table_get_data_double() ) * to procedures that are external to the CPL column system, it may turn out * to be appropriate assigning to all the invalid elements a conventional * code value. This code value will supposedly be recognized and handled * properly by a given foreign method applied directly to the column data * buffer. Note that only existing invalid elements will be coded as * indicated: new invalid column elements would still have their actual * values left undefined. Also, any further processing of the column would * not take care of maintaining the assigned code to a given invalid column * element: therefore the code should be applied just before it is actually * needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_table_fill_invalid_double(cpl_table *table, const char *name, double code) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_invalid_double(column, code) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Write to invalid @em double complex column elements a numeric code. * * @param table Pointer to table containing the column. * @param name Column name. * @param code Code to write to invalid column elements. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX, * or of type CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER. *
* @enderror * * This function can be applied also to columns of arrays of complex doubles. * In general, complex column elements that are flagged as invalid may contain * any value, that should not be given any meaning whatsoever. In order to * export the column data (calling to @c cpl_table_get_data_double_complex() ) * to procedures which are external to the CPL column system, it may turn out * to be appropriate assigning a conventional code value to all the invalid * elements. This code value will supposedly be recognized and handled * properly by a given foreign method applied directly to the column data * buffer. Note that only existing invalid elements will be coded as * indicated: new invalid column elements would still have their actual * values left undefined. Also, any further processing of the column would * not take care of maintaining the assigned code to a given invalid column * element: therefore the code should be applied just before it is actually * needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_table_fill_invalid_double_complex(cpl_table *table, const char *name, double complex code) { cpl_column *column = cpl_table_find_column_(table, name); return !column || cpl_column_fill_invalid_double_complex(column, code) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Select from selected table rows, by comparing @em integer column * values with a constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_INT. *
* @enderror * * For all the already selected table rows, the values of the specified * column are compared with the reference value. All table rows not * fulfilling the comparison are unselected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, and @c CPL_NOT_LESS_THAN. * If the table has no rows, no error is set, and 0 is returned. See * also the function @c cpl_table_or_selected_int(). */ cpl_size cpl_table_and_selected_int(cpl_table *table, const char *name, cpl_table_select_operator operator, int value) { cpl_column_flag *nulldata; int *data; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_INT); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_int(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); /* * All invalid elements by definition do not fulfill any comparison */ if (nullcount == length) cpl_table_unselect_all(table); if (table->selectcount == 0) return 0; if (nulldata) /* Some (not all!) invalid elements */ while (length--) if (nulldata[length]) cpl_table_unselect_row(table, length); if (table->selectcount == 0) return 0; /* * Moreover unselect anything that does not fulfill the comparison: */ length = cpl_table_get_nrow(table); /* Restore */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_unselect_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] <= value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] <= value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] > value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] > value) cpl_table_unselect_row(table, length); } break; case CPL_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] >= value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] >= value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] < value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] < value) cpl_table_unselect_row(table, length); } break; } return table->selectcount; } /** * @brief * Select from unselected table rows, by comparing @em integer column * values with a constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_INT. *
* @enderror * * For all the unselected table rows, the values of the specified * column are compared with the reference value. The table rows * fulfilling the comparison are selected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, and @c CPL_NOT_LESS_THAN. * If the table has no rows, no error is set, and 0 is returned. See * also the description of the function @c cpl_table_and_selected_int(). */ cpl_size cpl_table_or_selected_int(cpl_table *table, const char *name, cpl_table_select_operator operator, int value) { cpl_column_flag *nulldata; int *data; int length; int nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_INT); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_int(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); if (table->selectcount == length) /* It's already all selected */ return length; if (nullcount == length) /* Just invalids, no need to check values */ return table->selectcount; /* * Select anything that fulfills the comparison, avoiding the invalids: */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] > value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] > value) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] <= value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] <= value) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] < value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] < value) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] >= value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] >= value) cpl_table_select_row(table, length); } break; } return table->selectcount; } /** * @brief * Select from selected table rows, by comparing @em long column * values with a constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG. *
* @enderror * * For all the already selected table rows, the values of the specified * column are compared with the reference value. All table rows not * fulfilling the comparison are unselected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, and @c CPL_NOT_LESS_THAN. * If the table has no rows, no error is set, and 0 is returned. See * also the function @c cpl_table_or_selected_long(). */ cpl_size cpl_table_and_selected_long(cpl_table *table, const char *name, cpl_table_select_operator operator, long value) { cpl_column_flag *nulldata; long *data; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_LONG); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_long(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); /* * All invalid elements by definition do not fulfill any comparison */ if (nullcount == length) cpl_table_unselect_all(table); if (table->selectcount == 0) return 0; if (nulldata) /* Some (not all!) invalid elements */ while (length--) if (nulldata[length]) cpl_table_unselect_row(table, length); if (table->selectcount == 0) return 0; /* * Moreover unselect anything that does not fulfill the comparison: */ length = cpl_table_get_nrow(table); /* Restore */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_unselect_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] <= value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] <= value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] > value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] > value) cpl_table_unselect_row(table, length); } break; case CPL_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] >= value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] >= value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] < value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] < value) cpl_table_unselect_row(table, length); } break; } return table->selectcount; } /** * @brief * Select from unselected table rows, by comparing @em long column * values with a constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG. *
* @enderror * * For all the unselected table rows, the values of the specified * column are compared with the reference value. The table rows * fulfilling the comparison are selected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, and @c CPL_NOT_LESS_THAN. * If the table has no rows, no error is set, and 0 is returned. See * also the description of the function @c cpl_table_and_selected_long(). */ cpl_size cpl_table_or_selected_long(cpl_table *table, const char *name, cpl_table_select_operator operator, long value) { cpl_column_flag *nulldata; long *data; int length; int nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_LONG); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_long(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); if (table->selectcount == length) /* It's already all selected */ return length; if (nullcount == length) /* Just invalids, no need to check values */ return table->selectcount; /* * Select anything that fulfills the comparison, avoiding the invalids: */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] > value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] > value) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] <= value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] <= value) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] < value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] < value) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] >= value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] >= value) cpl_table_select_row(table, length); } break; } return table->selectcount; } /** * @brief * Select from selected table rows, by comparing @em long @em long column * values with a constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG_LONG. *
* @enderror * * For all the already selected table rows, the values of the specified * column are compared with the reference value. All table rows not * fulfilling the comparison are unselected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, and @c CPL_NOT_LESS_THAN. * If the table has no rows, no error is set, and 0 is returned. See * also the function @c cpl_table_or_selected_long_long(). */ cpl_size cpl_table_and_selected_long_long(cpl_table *table, const char *name, cpl_table_select_operator operator, long long value) { cpl_column_flag *nulldata; long long *data; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_LONG_LONG); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_long_long(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); /* * All invalid elements by definition do not fulfill any comparison */ if (nullcount == length) cpl_table_unselect_all(table); if (table->selectcount == 0) return 0; if (nulldata) /* Some (not all!) invalid elements */ while (length--) if (nulldata[length]) cpl_table_unselect_row(table, length); if (table->selectcount == 0) return 0; /* * Moreover unselect anything that does not fulfill the comparison: */ length = cpl_table_get_nrow(table); /* Restore */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_unselect_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] <= value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] <= value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] > value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] > value) cpl_table_unselect_row(table, length); } break; case CPL_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] >= value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] >= value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] < value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] < value) cpl_table_unselect_row(table, length); } break; } return table->selectcount; } /** * @brief * Select from unselected table rows, by comparing @em long @em long column * values with a constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_LONG_LONG. *
* @enderror * * For all the unselected table rows, the values of the specified * column are compared with the reference value. The table rows * fulfilling the comparison are selected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, and @c CPL_NOT_LESS_THAN. * If the table has no rows, no error is set, and 0 is returned. See * also the description of the function @c cpl_table_and_selected_long_long(). */ cpl_size cpl_table_or_selected_long_long(cpl_table *table, const char *name, cpl_table_select_operator operator, long long value) { cpl_column_flag *nulldata; long long *data; int length; int nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_LONG_LONG); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_long_long(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); if (table->selectcount == length) /* It's already all selected */ return length; if (nullcount == length) /* Just invalids, no need to check values */ return table->selectcount; /* * Select anything that fulfills the comparison, avoiding the invalids: */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] > value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] > value) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] <= value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] <= value) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] < value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] < value) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] >= value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] >= value) cpl_table_select_row(table, length); } break; } return table->selectcount; } /** * @brief * Select from selected table rows, by comparing @em float column values * with a constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT. *
* @enderror * * For all the already selected table rows, the values of the specified * column are compared with the reference value. All table rows not * fulfilling the comparison are unselected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, and @c CPL_NOT_LESS_THAN. * If the table has no rows, no error is set, and 0 is returned. See * also the function @c cpl_table_or_selected_float(). */ cpl_size cpl_table_and_selected_float(cpl_table *table, const char *name, cpl_table_select_operator operator, float value) { cpl_column_flag *nulldata; float *data; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_FLOAT); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_float(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); /* * All invalid elements by definition do not fulfill any comparison */ if (nullcount == length) cpl_table_unselect_all(table); if (table->selectcount == 0) return 0; if (nulldata) /* Some (not all!) invalids */ while (length--) if (nulldata[length]) cpl_table_unselect_row(table, length); if (table->selectcount == 0) return 0; /* * Moreover unselect anything that does not fulfill the comparison: */ length = cpl_table_get_nrow(table); /* Restore */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_unselect_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] <= value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] <= value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] > value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] > value) cpl_table_unselect_row(table, length); } break; case CPL_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] >= value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] >= value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] < value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] < value) cpl_table_unselect_row(table, length); } break; } return table->selectcount; } /** * @brief * Select from selected table rows, by comparing @em float complex column * values with a complex constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT_COMPLEX. *
CPL_ERROR_ILLEGAL_INPUT * Operator other than CPL_EQUAL_TO or * CPL_NOT_EQUAL_TO was specified. *
* @enderror * * For all the already selected table rows, the values of the specified * column are compared with the reference value. All table rows not * fulfilling the comparison are unselected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO and @c CPL_NOT_EQUAL_TO. * If the table has no rows, no error is set, and 0 is returned. See * also the function @c cpl_table_or_selected_float_complex(). */ cpl_size cpl_table_and_selected_float_complex(cpl_table *table, const char *name, cpl_table_select_operator operator, float complex value) { cpl_column_flag *nulldata; float complex *data; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_FLOAT_COMPLEX); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_float_complex(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); /* * All invalid elements by definition do not fulfill any comparison */ if (nullcount == length) cpl_table_unselect_all(table); if (table->selectcount == 0) return 0; if (nulldata) /* Some (not all!) invalids */ while (length--) if (nulldata[length]) cpl_table_unselect_row(table, length); if (table->selectcount == 0) return 0; /* * Moreover unselect anything that does not fulfill the comparison: */ length = cpl_table_get_nrow(table); /* Restore */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_unselect_row(table, length); } break; case CPL_GREATER_THAN: case CPL_NOT_GREATER_THAN: case CPL_LESS_THAN: case CPL_NOT_LESS_THAN: cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return -1; } return table->selectcount; } /** * @brief * Select from unselected table rows, by comparing @em float column * values with a constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT. *
* @enderror * * For all the unselected table rows, the values of the specified * column are compared with the reference value. The table rows * fulfilling the comparison are selected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, and @c CPL_NOT_LESS_THAN. * If the table has no rows, no error is set, and 0 is returned. See * also the description of the function @c cpl_table_and_selected_float(). */ cpl_size cpl_table_or_selected_float(cpl_table *table, const char *name, cpl_table_select_operator operator, float value) { cpl_column_flag *nulldata; float *data; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_FLOAT); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_float(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); if (table->selectcount == length) return length; if (nullcount == length) return table->selectcount; /* * Select anything that fulfills the comparison, avoiding the invalids: */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] > value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] > value) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] <= value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] <= value) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] < value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] < value) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] >= value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] >= value) cpl_table_select_row(table, length); } break; } return table->selectcount; } /** * @brief * Select from unselected table rows, by comparing @em float complex column * values with a complex constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_FLOAT_COMPLEX. *
CPL_ERROR_ILLEGAL_INPUT * Operator other than CPL_EQUAL_TO or * CPL_NOT_EQUAL_TO was specified. *
* @enderror * * For all the unselected table rows, the values of the specified * column are compared with the reference value. The table rows * fulfilling the comparison are selected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO and @c CPL_NOT_EQUAL_TO. If the table has no * rows, no error is set, and 0 is returned. See also the description * of the function @c cpl_table_and_selected_float_complex(). */ cpl_size cpl_table_or_selected_float_complex(cpl_table *table, const char *name, cpl_table_select_operator operator, float complex value) { cpl_column_flag *nulldata; float complex *data; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_FLOAT_COMPLEX); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_float_complex(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); if (table->selectcount == length) return length; if (nullcount == length) return table->selectcount; /* * Select anything that fulfills the comparison, avoiding the invalids: */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: case CPL_NOT_GREATER_THAN: case CPL_LESS_THAN: case CPL_NOT_LESS_THAN: cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return -1; } return table->selectcount; } /** * @brief * Select from selected table rows, by comparing @em double column values * with a constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE. *
* @enderror * * For all the already selected table rows, the values of the specified * column are compared with the reference value. All table rows not * fulfilling the comparison are unselected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, and @c CPL_NOT_LESS_THAN. * If the table has no rows, no error is set, and 0 is returned. See * also the function @c cpl_table_or_selected_double(). */ cpl_size cpl_table_and_selected_double(cpl_table *table, const char *name, cpl_table_select_operator operator, double value) { cpl_column_flag *nulldata; double *data; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_DOUBLE); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_double(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); /* * All invalid by definition do not fulfill any comparison */ if (nullcount == length) cpl_table_unselect_all(table); if (table->selectcount == 0) return 0; if (nulldata) /* Some (not all!) invalids */ while (length--) if (nulldata[length]) cpl_table_unselect_row(table, length); if (table->selectcount == 0) return 0; /* * Moreover unselect anything that does not fulfill the comparison: */ length = cpl_table_get_nrow(table); /* Restore */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_unselect_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] <= value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] <= value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] > value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] > value) cpl_table_unselect_row(table, length); } break; case CPL_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] >= value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] >= value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] < value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] < value) cpl_table_unselect_row(table, length); } break; } return table->selectcount; } /** * @brief * Select from selected table rows, by comparing @em double complex column * values with a complex constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX. *
CPL_ERROR_ILLEGAL_INPUT * Operator other than CPL_EQUAL_TO or * CPL_NOT_EQUAL_TO was specified. *
* @enderror * * For all the already selected table rows, the values of the specified * column are compared with the reference value. All table rows not * fulfilling the comparison are unselected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO and @c CPL_NOT_EQUAL_TO. * If the table has no rows, no error is set, and 0 is returned. See * also the function @c cpl_table_or_selected_double_complex(). */ cpl_size cpl_table_and_selected_double_complex(cpl_table *table, const char *name, cpl_table_select_operator operator, double complex value) { cpl_column_flag *nulldata; double complex *data; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_DOUBLE_COMPLEX); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_double_complex(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); /* * All invalid by definition do not fulfill any comparison */ if (nullcount == length) cpl_table_unselect_all(table); if (table->selectcount == 0) return 0; if (nulldata) /* Some (not all!) invalids */ while (length--) if (nulldata[length]) cpl_table_unselect_row(table, length); if (table->selectcount == 0) return 0; /* * Moreover unselect anything that does not fulfill the comparison: */ length = cpl_table_get_nrow(table); /* Restore */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_unselect_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_unselect_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_unselect_row(table, length); } break; case CPL_GREATER_THAN: case CPL_NOT_GREATER_THAN: case CPL_LESS_THAN: case CPL_NOT_LESS_THAN: cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return -1; } return table->selectcount; } /** * @brief * Select from unselected table rows, by comparing @em double column * values with a constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE. *
* @enderror * * For all the unselected table rows, the values of the specified * column are compared with the reference value. The table rows * fulfilling the comparison are selected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, and @c CPL_NOT_LESS_THAN. * If the table has no rows, no error is set, and 0 is returned. See * also the description of the function @c cpl_table_and_selected_double(). */ cpl_size cpl_table_or_selected_double(cpl_table *table, const char *name, cpl_table_select_operator operator, double value) { cpl_column_flag *nulldata; double *data; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_DOUBLE); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_double(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); if (table->selectcount == length) return length; if (nullcount == length) return table->selectcount; /* * Select anything that fulfills the comparison, avoiding the invalids: */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] > value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] > value) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] <= value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] <= value) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] < value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] < value) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] >= value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] >= value) cpl_table_select_row(table, length); } break; } return table->selectcount; } /** * @brief * Select from unselected table rows, by comparing @em double complex column * values with a complex constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param value Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_DOUBLE_COMPLEX. *
CPL_ERROR_ILLEGAL_INPUT * Operator other than CPL_EQUAL_TO or * CPL_NOT_EQUAL_TO was specified. *
* @enderror * * For all the unselected table rows, the values of the specified * column are compared with the reference value. The table rows * fulfilling the comparison are selected. An invalid element never * fulfills any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO and @c CPL_NOT_EQUAL_TO. If the table has no * rows, no error is set, and 0 is returned. See also the description * of the function @c cpl_table_and_selected_double_complex(). */ cpl_size cpl_table_or_selected_double_complex(cpl_table *table, const char *name, cpl_table_select_operator operator, double complex value) { cpl_column_flag *nulldata; double complex *data; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_DOUBLE_COMPLEX); if (!column) { (void)cpl_error_set_where_(); return -1; } nulldata = cpl_column_get_data_invalid(column); data = cpl_column_get_data_double_complex(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); if (table->selectcount == length) return length; if (nullcount == length) return table->selectcount; /* * Select anything that fulfills the comparison, avoiding the invalids: */ switch (operator) { case CPL_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] == value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] == value) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata) { while (length--) if (nulldata[length] == 0) if (data[length] != value) cpl_table_select_row(table, length); } else { while (length--) if (data[length] != value) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: case CPL_NOT_GREATER_THAN: case CPL_LESS_THAN: case CPL_NOT_LESS_THAN: cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return -1; } return table->selectcount; } /** * @brief * Select from selected table rows, by comparing @em string column values * with a character string. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param string Reference character string. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_STRING. *
CPL_ERROR_ILLEGAL_INPUT * Invalid regular expression. *
* @enderror * * For all the already selected table rows, the values of the specified * column are compared with the reference string. The comparison function * used is the C standard @c strcmp(), but in case the relational operators * @c CPL_EQUAL_TO or @c CPL_NOT_EQUAL_TO are specified, the comparison * string is treated as a regular expression. All table rows not fulfilling * the comparison are unselected. An invalid element never fulfills * any comparison by definition. Allowed relational operators are * @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, and @c CPL_NOT_LESS_THAN. * If the table has no rows, no error is set, and 0 is returned. See also * the function @c cpl_table_or_selected_string(). */ cpl_size cpl_table_and_selected_string(cpl_table *table, const char *name, cpl_table_select_operator operator, const char *string) { char **data; cpl_size length; cpl_size nullcount; int status; regex_t re; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_STRING); if (!column) { (void)cpl_error_set_where_(); return -1; } data = cpl_column_get_data_string(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); if (length == 0) return 0; /* * Compile the regular expression only if a match operator is used. */ if (operator == CPL_EQUAL_TO || operator == CPL_NOT_EQUAL_TO) { status = regcomp(&re, string, REG_EXTENDED|REG_NOSUB); if (status) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return -1; } } /* * All invalids by definition do not fulfill any comparison */ if (nullcount == length) cpl_table_unselect_all(table); if (table->selectcount == 0) return 0; if (nullcount) /* Some (not all!) invalids */ while (length--) if (data[length] == NULL) cpl_table_unselect_row(table, length); if (table->selectcount == 0) return 0; /* * Moreover unselect anything that does not fulfill the comparison: */ length = cpl_table_get_nrow(table); /* Restore */ switch (operator) { case CPL_EQUAL_TO: while (length--) if (data[length]) if (!strmatch(&re, data[length])) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (data[length]) if (strmatch(&re, data[length])) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (data[length]) if (strcmp(data[length], string) <= 0) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (data[length]) if (strcmp(data[length], string) > 0) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (data[length]) if (strcmp(data[length], string) >= 0) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (data[length]) if (strcmp(data[length], string) < 0) cpl_table_unselect_row(table, length); break; } if (operator == CPL_EQUAL_TO || operator == CPL_NOT_EQUAL_TO) regfree(&re); return table->selectcount; } /** * @brief * Select from unselected table rows, by comparing column values with * a constant. * * @param table Pointer to table. * @param name Column name. * @param operator Relational operator. * @param string Reference value. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
CPL_ERROR_TYPE_MISMATCH * The specified column is not of type CPL_TYPE_STRING. *
CPL_ERROR_ILLEGAL_INPUT * Invalid regular expression. *
* @enderror * * For all the unselected table rows, the values of the specified column * are compared with the reference value. The comparison function used * is the C standard @c strcmp(), but in case the relational operators * @c CPL_EQUAL_TO or @c CPL_NOT_EQUAL_TO are specified, the comparison * string is treated as a regular expression. The table rows fulfilling * the comparison are selected. An invalid element never fulfills any * comparison by definition. Allowed relational operators are @c CPL_EQUAL_TO, * @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, @c CPL_NOT_GREATER_THAN, * @c CPL_LESS_THAN, and @c CPL_NOT_LESS_THAN. If the table has no rows, * no error is set, and 0 is returned. See also the description of the * function @c cpl_table_and_selected_string(). */ cpl_size cpl_table_or_selected_string(cpl_table *table, const char *name, cpl_table_select_operator operator, const char *string) { char **data; cpl_size length; cpl_size nullcount; int status; regex_t re; cpl_column *column = cpl_table_find_column_type(table, name, CPL_TYPE_STRING); if (!column) { (void)cpl_error_set_where_(); return -1; } data = cpl_column_get_data_string(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); if (length == 0) return 0; /* * Compile the regular expression only if a match operator is used. */ if (operator == CPL_EQUAL_TO || operator == CPL_NOT_EQUAL_TO) { status = regcomp(&re, string, REG_EXTENDED|REG_NOSUB); if (status) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return -1; } } if (table->selectcount == length) return length; if (nullcount == length) return table->selectcount; /* * Select anything that fulfills the comparison, avoiding the NULLs: */ switch (operator) { case CPL_EQUAL_TO: while (length--) if (data[length]) if (strmatch(&re, data[length])) cpl_table_select_row(table, length); regfree(&re); break; case CPL_NOT_EQUAL_TO: while (length--) if (data[length]) if (!strmatch(&re, data[length])) cpl_table_select_row(table, length); regfree(&re); break; case CPL_GREATER_THAN: while (length--) if (data[length]) if (strcmp(data[length], string) > 0) cpl_table_select_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (data[length]) if (strcmp(data[length], string) <= 0) cpl_table_select_row(table, length); break; case CPL_LESS_THAN: while (length--) if (data[length]) if (strcmp(data[length], string) < 0) cpl_table_select_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (data[length]) if (strcmp(data[length], string) >= 0) cpl_table_select_row(table, length); break; } return table->selectcount; } /** * @brief * Select from selected table rows all rows with an invalid value in * a specified column. * * @param table Pointer to table. * @param name Column name. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
* @enderror * * For all the already selected table rows, all the rows containing valid * values at the specified column are unselected. See also the function * @c cpl_table_or_selected_invalid(). */ cpl_size cpl_table_and_selected_invalid(cpl_table *table, const char *name) { cpl_type type; cpl_column_flag *nulldata = NULL; cpl_array **adata = NULL; char **cdata = NULL; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return -1; } type = cpl_column_get_type(column); if (type == CPL_TYPE_STRING) cdata = cpl_column_get_data_string(column); else if (type & CPL_TYPE_POINTER) adata = cpl_column_get_data_array(column); else nulldata = cpl_column_get_data_invalid(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); if (nullcount == length) return table->selectcount; if (nullcount == 0) cpl_table_unselect_all(table); if (table->selectcount == 0) return 0; /* * If this point is reached, there are some (not all!) invalid elements. */ if (cdata) { /* String column */ while (length--) if (cdata[length]) cpl_table_unselect_row(table, length); } else if (adata) { /* Array column */ while (length--) if (adata[length]) cpl_table_unselect_row(table, length); } else { while (length--) if (!nulldata[length]) cpl_table_unselect_row(table, length); } return table->selectcount; } /** * @brief * Select from unselected table rows all rows with an invalid value in * a specified column. * * @param table Pointer to table. * @param name Column name. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column name are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with the specified name is not found in table. *
* @enderror * * For all the unselected table rows, all the rows containing invalid * values at the specified column are selected. See also the function * @c cpl_table_and_selected_invalid(). */ cpl_size cpl_table_or_selected_invalid(cpl_table *table, const char *name) { cpl_type type; cpl_column_flag *nulldata = NULL; cpl_array **adata = NULL; char **cdata = NULL; cpl_size length; cpl_size nullcount; cpl_column *column = cpl_table_find_column_(table, name); if (!column) { (void)cpl_error_set_where_(); return -1; } type = cpl_column_get_type(column); if (type == CPL_TYPE_STRING) cdata = cpl_column_get_data_string(column); else if (type & CPL_TYPE_POINTER) adata = cpl_column_get_data_array(column); else nulldata = cpl_column_get_data_invalid(column); length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); if (nullcount == 0) return table->selectcount; if (nullcount == length) cpl_table_select_all(table); if (table->selectcount == length) return length; /* * If this point is reached, there are some (not all!) invalid elements. */ if (cdata) { /* String column */ while (length--) if (!cdata[length]) cpl_table_select_row(table, length); } else if (adata) { /* Array column */ while (length--) if (!adata[length]) cpl_table_select_row(table, length); } else { while (length--) if (nulldata[length]) cpl_table_select_row(table, length); } return table->selectcount; } /** * @brief * Select from selected rows only those within a table segment. * * @param table Pointer to table. * @param start First row of table segment. * @param count Length of segment. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
* @enderror * * All the selected table rows that are outside the specified interval are * unselected. If the sum of @em start and @em count goes beyond the end * of the input table, rows are checked up to the end of the table. See * also the function @c cpl_table_or_selected_window(). */ cpl_size cpl_table_and_selected_window(cpl_table *table, cpl_size start, cpl_size count) { cpl_size i; if (table == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } if (start < 0 || start >= table->nr) { cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); return -1; } if (count < 0) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return -1; } if (table->selectcount == 0) /* Nothing was selected, nothing to "and" */ return 0; if (count > table->nr - start) count = table->nr - start; if (count == table->nr) /* "Anding" the whole table, no change */ return table->selectcount; if (table->selectcount == table->nr) { table->select = cpl_calloc(table->nr, sizeof(cpl_column_flag)); i = start; table->selectcount = count; while (count--) { table->select[i] = 1; i++; } } else { i = 0; while (i < start) { if (table->select[i] == 1) { table->select[i] = 0; table->selectcount--; } i++; } i += count; while (i < table->nr) { if (table->select[i] == 1) { table->select[i] = 0; table->selectcount--; } i++; } if (table->selectcount == 0) { if (table->select) cpl_free(table->select); table->select = NULL; } } return table->selectcount; } /** * @brief * Select from unselected rows only those within a table segment. * * @param table Table to handle. * @param start First row of table segment. * @param count Length of segment. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or start is * outside the table boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
* @enderror * * All the unselected table rows that are within the specified interval are * selected. If the sum of @em start and @em count goes beyond the end of * the input table, rows are checked up to the end of the table. See also * the function @c cpl_table_and_selected_window(). */ cpl_size cpl_table_or_selected_window(cpl_table *table, cpl_size start, cpl_size count) { cpl_size i = start; if (table == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } if (start < 0 || start >= table->nr) { cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); return -1; } if (count < 0) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return -1; } if (count > table->nr - start) count = table->nr - start; if (count == table->nr) /* "Oring" the whole table */ cpl_table_select_all(table); if (table->selectcount == table->nr) /* All was selected, no "or" is due */ return table->selectcount; if (table->selectcount == 0) { table->select = cpl_calloc(table->nr, sizeof(cpl_column_flag)); table->selectcount = count; while (count--) { table->select[i] = 1; i++; } } else { while (count--) { if (table->select[i] == 0) { table->select[i] = 1; table->selectcount++; } i++; } if (table->selectcount == table->nr) { if (table->select) cpl_free(table->select); table->select = NULL; } } return table->selectcount; } /** * @brief * Select unselected table rows, and unselect selected ones. * * @param table Pointer to table. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
* @enderror * * Select unselected table rows, and unselect selected ones. */ cpl_size cpl_table_not_selected(cpl_table *table) { cpl_size length; if (table == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } if (table->selectcount == 0) return table->selectcount = table->nr; if (table->selectcount == table->nr) return table->selectcount = 0; length = table->nr; while (length--) { if (table->select[length]) table->select[length] = 0; else table->select[length] = 1; } return table->selectcount = table->nr - table->selectcount; } /** * @brief * Select from selected table rows, by comparing the values of two * numerical columns. * * @param table Pointer to table. * @param name1 Name of first table column. * @param operator Relational operator. * @param name2 Name of second table column. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column names are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with any of the specified names is not found in * table. *
CPL_ERROR_INVALID_TYPE * Invalid types for comparison. *
* @enderror * * Either both columns must be numerical, or they both must be strings. * The comparison between strings is lexicographical. Comparison between * complex types and array types are not supported. * * For all the already selected table rows, the values of the specified * columns are compared. The table rows not fulfilling the comparison * are unselected. Invalid elements from either columns never fulfill * any comparison by definition. Allowed relational operators are * @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, @c CPL_NOT_LESS_THAN. * See also the function @c cpl_table_or_selected(). */ cpl_size cpl_table_and_selected(cpl_table *table, const char *name1, cpl_table_select_operator operator, const char *name2) { cpl_type type1; cpl_type type2; cpl_column_flag *nulldata1; cpl_column_flag *nulldata2; char **sdata1; char **sdata2; cpl_size nullcount1; cpl_size nullcount2; cpl_size length; cpl_column *column1 = cpl_table_find_column_(table, name1); cpl_column *column2 = cpl_table_find_column_(table, name2); if (!column1 || !column2) { (void)cpl_error_set_where_(); return -1; } type1 = cpl_column_get_type(column1); type2 = cpl_column_get_type(column2); if (type1 == type2) { if ((type1 & CPL_TYPE_COMPLEX) || (type1 & CPL_TYPE_POINTER)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return -1; } } else { if ((type1 == CPL_TYPE_STRING) || (type2 == CPL_TYPE_STRING) || (type1 & CPL_TYPE_COMPLEX) || (type2 & CPL_TYPE_COMPLEX) || (type1 & CPL_TYPE_POINTER) || (type2 & CPL_TYPE_POINTER)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return -1; } } nulldata1 = cpl_column_get_data_invalid(column1); nulldata2 = cpl_column_get_data_invalid(column2); nullcount1 = cpl_column_count_invalid(column1); nullcount2 = cpl_column_count_invalid(column2); length = cpl_column_get_size(column1); if (length == 0) return 0; /* * All invalid elements by definition do not fulfill any comparison */ if (nullcount1 == length || nullcount2 == length) cpl_table_unselect_all(table); if (table->selectcount == 0) return 0; if (nulldata1) /* Some (not all!) NULLs */ while (length--) if (nulldata1[length]) cpl_table_unselect_row(table, length); if (type1 == CPL_TYPE_STRING) { /* In case of string comparison */ sdata1 = cpl_column_get_data_string(column1); while (length--) { if (sdata1[length] == NULL) { cpl_table_unselect_row(table, length); } } } if (table->selectcount == 0) return 0; length = cpl_table_get_nrow(table); /* Restore */ if (nulldata2) /* Some (not all!) NULLs */ while (length--) if (nulldata2[length]) cpl_table_unselect_row(table, length); if (type2 == CPL_TYPE_STRING) { /* In case of string comparison */ sdata2 = cpl_column_get_data_string(column2); while (length--) { if (sdata2[length] == NULL) { cpl_table_unselect_row(table, length); } } } if (table->selectcount == 0) return 0; /* * Moreover unselect anything that does not fulfill the comparison: */ length = cpl_table_get_nrow(table); /* Restore */ switch (type1) { case CPL_TYPE_INT: { int *idata1 = cpl_column_get_data_int(column1); switch (type2) { case CPL_TYPE_INT: { int *idata2 = cpl_column_get_data_int(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (idata1[length] != idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (idata1[length] == idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (idata1[length] <= idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (idata1[length] > idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (idata1[length] >= idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (idata1[length] < idata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_LONG: { long *ldata2 = cpl_column_get_data_long(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if ((long)idata1[length] != ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if ((long)idata1[length] == ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if ((long)idata1[length] <= ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if ((long)idata1[length] > ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if ((long)idata1[length] >= ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if ((long)idata1[length] < ldata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_LONG_LONG: { long long *lldata2 = cpl_column_get_data_long_long(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if ((long long)idata1[length] != lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if ((long long)idata1[length] == lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if ((long long)idata1[length] <= lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if ((long long)idata1[length] > lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if ((long long)idata1[length] >= lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if ((long long)idata1[length] < lldata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_FLOAT: { float *fdata2 = cpl_column_get_data_float(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if ((float)idata1[length] != fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if ((float)idata1[length] == fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if ((float)idata1[length] <= fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if ((float)idata1[length] > fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if ((float)idata1[length] >= fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if ((float)idata1[length] < fdata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_DOUBLE: { double *ddata2 = cpl_column_get_data_double(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if ((double)idata1[length] != ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if ((double)idata1[length] == ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if ((double)idata1[length] <= ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if ((double)idata1[length] > ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if ((double)idata1[length] >= ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if ((double)idata1[length] < ddata2[length]) cpl_table_unselect_row(table, length); break; } break; } default: break; } // switch(type2) break; } // case CPL_TYPE_INT case CPL_TYPE_LONG: { long *ldata1 = cpl_column_get_data_long(column1); switch (type2) { case CPL_TYPE_INT: { int *idata2 = cpl_column_get_data_int(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (ldata1[length] != (long)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (ldata1[length] == (long)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (ldata1[length] <= (long)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (ldata1[length] > (long)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (ldata1[length] >= (long)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (ldata1[length] < (long)idata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_LONG: { long *ldata2 = cpl_column_get_data_long(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (ldata1[length] != ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (ldata1[length] == ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (ldata1[length] <= ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (ldata1[length] > ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (ldata1[length] >= ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (ldata1[length] < ldata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_LONG_LONG: { long long *lldata2 = cpl_column_get_data_long_long(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if ((long long)ldata1[length] != lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if ((long long)ldata1[length] == lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if ((long long)ldata1[length] <= lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if ((long long)ldata1[length] > lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if ((long long)ldata1[length] >= lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if ((long long)ldata1[length] < lldata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_FLOAT: { float *fdata2 = cpl_column_get_data_float(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if ((float)ldata1[length] != fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if ((float)ldata1[length] == fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if ((float)ldata1[length] <= fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if ((float)ldata1[length] > fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if ((float)ldata1[length] >= fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if ((float)ldata1[length] < fdata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_DOUBLE: { double *ddata2 = cpl_column_get_data_double(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if ((double)ldata1[length] != ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if ((double)ldata1[length] == ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if ((double)ldata1[length] <= ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if ((double)ldata1[length] > ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if ((double)ldata1[length] >= ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if ((double)ldata1[length] < ddata2[length]) cpl_table_unselect_row(table, length); break; } break; } default: break; } // switch (type2) break; } // case CPL_TYPE_LONG case CPL_TYPE_LONG_LONG: { long long *lldata1 = cpl_column_get_data_long_long(column1); switch (type2) { case CPL_TYPE_INT: { int *idata2 = cpl_column_get_data_int(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (lldata1[length] != (long long)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (lldata1[length] == (long long)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (lldata1[length] <= (long long)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (lldata1[length] > (long long)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (lldata1[length] >= (long long)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (lldata1[length] < (long long)idata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_LONG: { long *ldata2 = cpl_column_get_data_long(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (lldata1[length] != (long long)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (lldata1[length] == (long long)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (lldata1[length] <= (long long)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (lldata1[length] > (long long)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (lldata1[length] >= (long long)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (lldata1[length] < (long long)ldata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_LONG_LONG: { long long *lldata2 = cpl_column_get_data_long_long(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (lldata1[length] != lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (lldata1[length] == lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (lldata1[length] <= lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (lldata1[length] > lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (lldata1[length] >= lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (lldata1[length] < lldata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_FLOAT: { float *fdata2 = cpl_column_get_data_float(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if ((float)lldata1[length] != fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if ((float)lldata1[length] == fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if ((float)lldata1[length] <= fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if ((float)lldata1[length] > fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if ((float)lldata1[length] >= fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if ((float)lldata1[length] < fdata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_DOUBLE: { double *ddata2 = cpl_column_get_data_double(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if ((double)lldata1[length] != ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if ((double)lldata1[length] == ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if ((double)lldata1[length] <= ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if ((double)lldata1[length] > ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if ((double)lldata1[length] >= ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if ((double)lldata1[length] < ddata2[length]) cpl_table_unselect_row(table, length); break; } break; } default: break; } // switch (type2) break; } // case CPL_TYPE_LONG_LONG case CPL_TYPE_FLOAT: { float *fdata1 = cpl_column_get_data_float(column1); switch (type2) { case CPL_TYPE_INT: { int *idata2 = cpl_column_get_data_int(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (fdata1[length] != (float)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (fdata1[length] == (float)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (fdata1[length] <= (float)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (fdata1[length] > (float)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (fdata1[length] >= (float)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (fdata1[length] < (float)idata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_LONG: { long *ldata2 = cpl_column_get_data_long(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (fdata1[length] != (float)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (fdata1[length] == (float)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (fdata1[length] <= (float)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (fdata1[length] > (float)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (fdata1[length] >= (float)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (fdata1[length] < (float)ldata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_LONG_LONG: { long long *lldata2 = cpl_column_get_data_long_long(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (fdata1[length] != (float)lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (fdata1[length] == (float)lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (fdata1[length] <= (float)lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (fdata1[length] > (float)lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (fdata1[length] >= (float)lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (fdata1[length] < (float)lldata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_FLOAT: { float *fdata2 = cpl_column_get_data_float(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (fdata1[length] != fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (fdata1[length] == fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (fdata1[length] <= fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (fdata1[length] > fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (fdata1[length] >= fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (fdata1[length] < fdata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_DOUBLE: { double *ddata2 = cpl_column_get_data_double(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if ((double)fdata1[length] != ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if ((double)fdata1[length] == ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if ((double)fdata1[length] <= ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if ((double)fdata1[length] > ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if ((double)fdata1[length] >= ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if ((double)fdata1[length] < ddata2[length]) cpl_table_unselect_row(table, length); break; } break; } default: break; } // switch (type2) break; } //case CPL_TYPE_FLOAT case CPL_TYPE_DOUBLE: { double *ddata1 = cpl_column_get_data_double(column1); switch (type2) { case CPL_TYPE_INT: { int *idata2 = cpl_column_get_data_int(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (ddata1[length] != (double)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (ddata1[length] == (double)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (ddata1[length] <= (double)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (ddata1[length] > (double)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (ddata1[length] >= (double)idata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (ddata1[length] < (double)idata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_LONG: { long *ldata2 = cpl_column_get_data_long(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (ddata1[length] != (double)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (ddata1[length] == (double)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (ddata1[length] <= (double)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (ddata1[length] > (double)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (ddata1[length] >= (double)ldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (ddata1[length] < (double)ldata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_LONG_LONG: { long long *lldata2 = cpl_column_get_data_long_long(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (ddata1[length] != (double)lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (ddata1[length] == (double)lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (ddata1[length] <= (double)lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (ddata1[length] > (double)lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (ddata1[length] >= (double)lldata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (ddata1[length] < (double)lldata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_FLOAT: { float *fdata2 = cpl_column_get_data_float(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (ddata1[length] != (double)fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (ddata1[length] == (double)fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (ddata1[length] <= (double)fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (ddata1[length] > (double)fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (ddata1[length] >= (double)fdata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (ddata1[length] < (double)fdata2[length]) cpl_table_unselect_row(table, length); break; } break; } case CPL_TYPE_DOUBLE: { double *ddata2 = cpl_column_get_data_double(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (ddata1[length] != ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (ddata1[length] == ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (ddata1[length] <= ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (ddata1[length] > ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (ddata1[length] >= ddata2[length]) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (ddata1[length] < ddata2[length]) cpl_table_unselect_row(table, length); break; } break; } default: break; } // end switch (type2) break; } // end CPL_TYPE_DOUBLE case CPL_TYPE_STRING: { sdata1 = cpl_column_get_data_string(column1); sdata2 = cpl_column_get_data_string(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (strcmp(sdata1[length], sdata2[length])) cpl_table_unselect_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (!strcmp(sdata1[length], sdata2[length])) cpl_table_unselect_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (strcmp(sdata1[length], sdata2[length]) <= 0) cpl_table_unselect_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (strcmp(sdata1[length], sdata2[length]) > 0) cpl_table_unselect_row(table, length); break; case CPL_LESS_THAN: while (length--) if (strcmp(sdata1[length], sdata2[length]) >= 0) cpl_table_unselect_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (strcmp(sdata1[length], sdata2[length]) < 0) cpl_table_unselect_row(table, length); break; } break; } // end CASE_TYPE_STRING default: break; } // end switch (type1) return table->selectcount; } /** * @brief * Select from unselected table rows, by comparing the values of two * numerical columns. * * @param table Pointer to table. * @param name1 Name of first table column. * @param operator Relational operator. * @param name2 Name of second table column. * * @return Current number of selected rows, or a negative number in case * of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or column names are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * A column with any of the specified names is not found in * table. *
CPL_ERROR_INVALID_TYPE * Invalid types for comparison. *
* @enderror * * Either both columns must be numerical, or they both must be strings. * The comparison between strings is lexicographical. Comparison between * complex types and array types are not supported. * * Both columns must be numerical. For all the unselected table rows, the * values of the specified columns are compared. The table rows fulfilling * the comparison are selected. Invalid elements from either columns never * fulfill any comparison by definition. Allowed relational operators * are @c CPL_EQUAL_TO, @c CPL_NOT_EQUAL_TO, @c CPL_GREATER_THAN, * @c CPL_NOT_GREATER_THAN, @c CPL_LESS_THAN, @c CPL_NOT_LESS_THAN. * See also the function @c cpl_table_and_selected(). */ cpl_size cpl_table_or_selected(cpl_table *table, const char *name1, cpl_table_select_operator operator, const char *name2) { cpl_type type1; cpl_type type2; cpl_column_flag *nulldata1; cpl_column_flag *nulldata2; char **sdata1; char **sdata2; cpl_size nullcount1; cpl_size nullcount2; cpl_size length; cpl_column *column1 = cpl_table_find_column_(table, name1); cpl_column *column2 = cpl_table_find_column_(table, name2); if (!column1 || !column2) { (void)cpl_error_set_where_(); return -1; } type1 = cpl_column_get_type(column1); type2 = cpl_column_get_type(column2); if (type1 == type2) { if ((type1 & CPL_TYPE_COMPLEX) || (type1 & CPL_TYPE_POINTER)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return -1; } } else { if ((type1 == CPL_TYPE_STRING) || (type2 == CPL_TYPE_STRING) || (type1 & CPL_TYPE_COMPLEX) || (type2 & CPL_TYPE_COMPLEX) || (type1 & CPL_TYPE_POINTER) || (type2 & CPL_TYPE_POINTER)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return -1; } } nulldata1 = cpl_column_get_data_invalid(column1); nulldata2 = cpl_column_get_data_invalid(column2); nullcount1 = cpl_column_count_invalid(column1); nullcount2 = cpl_column_count_invalid(column2); length = cpl_column_get_size(column1); if (length == 0) return 0; if (table->selectcount == length) /* It's already all selected */ return length; if (nullcount1 == length || nullcount2 == length) return table->selectcount; /* * Select anything that fulfills the comparison, avoiding the NULLs: */ switch (type1) { case CPL_TYPE_INT: { int *idata1 = cpl_column_get_data_int(column1); switch (type2) { case CPL_TYPE_INT: { int *idata2 = cpl_column_get_data_int(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (idata1[length] == idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (idata1[length] == idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (idata1[length] == idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (idata1[length] == idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (idata1[length] != idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (idata1[length] != idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (idata1[length] != idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (idata1[length] != idata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (idata1[length] > idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (idata1[length] > idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (idata1[length] > idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (idata1[length] > idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (idata1[length] <= idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (idata1[length] <= idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (idata1[length] <= idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (idata1[length] <= idata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (idata1[length] < idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (idata1[length] < idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (idata1[length] < idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (idata1[length] < idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (idata1[length] >= idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (idata1[length] >= idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (idata1[length] >= idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (idata1[length] >= idata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_LONG: { long *ldata2 = cpl_column_get_data_long(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long)idata1[length] == ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long)idata1[length] == ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long)idata1[length] == ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long)idata1[length] == ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long)idata1[length] != ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long)idata1[length] != ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long)idata1[length] != ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long)idata1[length] != ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long)idata1[length] > ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long)idata1[length] > ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long)idata1[length] > ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long)idata1[length] > ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long)idata1[length] <= ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long)idata1[length] <= ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long)idata1[length] <= ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long)idata1[length] <= ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long)idata1[length] < ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long)idata1[length] < ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long)idata1[length] < ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long)idata1[length] < ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long)idata1[length] >= ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long)idata1[length] >= ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long)idata1[length] >= ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long)idata1[length] >= ldata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_LONG_LONG: { long long *lldata2 = cpl_column_get_data_long_long(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long long)idata1[length] == lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long long)idata1[length] == lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long long)idata1[length] == lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long long)idata1[length] == lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long long)idata1[length] != lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long long)idata1[length] != lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long long)idata1[length] != lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long long)idata1[length] != lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long long)idata1[length] > lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long long)idata1[length] > lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long long)idata1[length] > lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long long)idata1[length] > lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long long)idata1[length] <= lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long long)idata1[length] <= lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long long)idata1[length] <= lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long long)idata1[length] <= lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long long)idata1[length] < lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long long)idata1[length] < lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long long)idata1[length] < lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long long)idata1[length] < lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long long)idata1[length] >= lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long long)idata1[length] >= lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long long)idata1[length] >= lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long long)idata1[length] >= lldata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_FLOAT: { float *fdata2 = cpl_column_get_data_float(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)idata1[length] == fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)idata1[length] == fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)idata1[length] == fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)idata1[length] == fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)idata1[length] != fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)idata1[length] != fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)idata1[length] != fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)idata1[length] != fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)idata1[length] > fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)idata1[length] > fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)idata1[length] > fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)idata1[length] > fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)idata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)idata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)idata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)idata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)idata1[length] < fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)idata1[length] < fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)idata1[length] < fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)idata1[length] < fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)idata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)idata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)idata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)idata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_DOUBLE: { double *ddata2 = cpl_column_get_data_double(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)idata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)idata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)idata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)idata1[length] == ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)idata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)idata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)idata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)idata1[length] != ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)idata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)idata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)idata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)idata1[length] > ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)idata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)idata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)idata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)idata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)idata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)idata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)idata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)idata1[length] < ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)idata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)idata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)idata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)idata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } break; } break; } default: break; } // end switch (type2) break; } // end case CPL_TYPE_INT case CPL_TYPE_LONG: { long *ldata1 = cpl_column_get_data_long(column1); switch (type2) { case CPL_TYPE_INT: { int *idata2 = cpl_column_get_data_int(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ldata1[length] == (long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ldata1[length] == (long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ldata1[length] == (long)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ldata1[length] == (long)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ldata1[length] != (long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ldata1[length] != (long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ldata1[length] != (long)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ldata1[length] != (long)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ldata1[length] > (long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ldata1[length] > (long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ldata1[length] > (long)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ldata1[length] > (long)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ldata1[length] <= (long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ldata1[length] <= (long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ldata1[length] <= (long)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ldata1[length] <= (long)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ldata1[length] < (long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ldata1[length] < (long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ldata1[length] < (long)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ldata1[length] < (long)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ldata1[length] >= (long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ldata1[length] >= (long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ldata1[length] >= (long)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ldata1[length] >= (long)idata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_LONG: { long *ldata2 = cpl_column_get_data_long(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ldata1[length] == ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ldata1[length] == ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ldata1[length] == ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ldata1[length] == ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ldata1[length] != ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ldata1[length] != ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ldata1[length] != ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ldata1[length] != ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ldata1[length] > ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ldata1[length] > ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ldata1[length] > ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ldata1[length] > ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ldata1[length] <= ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ldata1[length] <= ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ldata1[length] <= ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ldata1[length] <= ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ldata1[length] < ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ldata1[length] < ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ldata1[length] < ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ldata1[length] < ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ldata1[length] >= ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ldata1[length] >= ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ldata1[length] >= ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ldata1[length] >= ldata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_LONG_LONG: { long long *lldata2 = cpl_column_get_data_long_long(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long long)ldata1[length] == lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long long)ldata1[length] == lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long long)ldata1[length] == lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long long)ldata1[length] == lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long long)ldata1[length] != lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long long)ldata1[length] != lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long long)ldata1[length] != lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long long)ldata1[length] != lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long long)ldata1[length] > lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long long)ldata1[length] > lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long long)ldata1[length] > lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long long)ldata1[length] > lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long long)ldata1[length] <= lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long long)ldata1[length] <= lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long long)ldata1[length] <= lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long long)ldata1[length] <= lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long long)ldata1[length] < lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long long)ldata1[length] < lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long long)ldata1[length] < lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long long)ldata1[length] < lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((long long)ldata1[length] >= lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((long long)ldata1[length] >= lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((long long)ldata1[length] >= lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((long long)ldata1[length] >= lldata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_FLOAT: { float *fdata2 = cpl_column_get_data_float(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)ldata1[length] == fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)ldata1[length] == fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)ldata1[length] == fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)ldata1[length] == fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)ldata1[length] != fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)ldata1[length] != fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)ldata1[length] != fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)ldata1[length] != fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)ldata1[length] > fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)ldata1[length] > fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)ldata1[length] > fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)ldata1[length] > fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)ldata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)ldata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)ldata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)ldata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)ldata1[length] < fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)ldata1[length] < fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)ldata1[length] < fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)ldata1[length] < fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)ldata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)ldata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)ldata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)ldata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_DOUBLE: { double *ddata2 = cpl_column_get_data_double(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)ldata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)ldata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)ldata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)ldata1[length] == ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)ldata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)ldata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)ldata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)ldata1[length] != ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)ldata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)ldata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)ldata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)ldata1[length] > ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)ldata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)ldata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)ldata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)ldata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)ldata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)ldata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)ldata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)ldata1[length] < ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)ldata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)ldata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)ldata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)ldata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } break; } break; } default: break; } // end switch (type2) break; } // end case CPL_TYPE_LONG case CPL_TYPE_LONG_LONG: { long long *lldata1 = cpl_column_get_data_long_long(column1); switch (type2) { case CPL_TYPE_INT: { int *idata2 = cpl_column_get_data_int(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] == (long long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] == (long long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] == (long long)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] == (long long)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] != (long long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] != (long long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] != (long long)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] != (long long)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] > (long long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] > (long long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] > (long long)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] > (long long)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] <= (long long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] <= (long long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] <= (long long)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] <= (long long)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] < (long long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] < (long long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] < (long long)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] < (long long)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] >= (long long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] >= (long long)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] >= (long long)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] >= (long long)idata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_LONG: { long *ldata2 = cpl_column_get_data_long(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] == (long long)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] == (long long)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] == (long long)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] == (long long)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] != (long long)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] != (long long)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] != (long long)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] != (long long)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] > (long long)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] > (long long)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] > (long long)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] > (long long)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] <= (long long)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] <= (long long)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] <= (long long)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] <= (long long)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] < (long long)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] < (long long)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] < (long long)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] < (long long)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] >= (long long)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] >= (long long)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] >= (long long)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] >= (long long)ldata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_LONG_LONG: { long long *lldata2 = cpl_column_get_data_long_long(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] == lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] == lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] == lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] == lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] != lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] != lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] != lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] != lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] > lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] > lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] > lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] > lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] <= lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] <= lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] <= lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] <= lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] < lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] < lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] < lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] < lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (lldata1[length] >= lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (lldata1[length] >= lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (lldata1[length] >= lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (lldata1[length] >= lldata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_FLOAT: { float *fdata2 = cpl_column_get_data_float(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)lldata1[length] == fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)lldata1[length] == fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)lldata1[length] == fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)lldata1[length] == fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)lldata1[length] != fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)lldata1[length] != fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)lldata1[length] != fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)lldata1[length] != fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)lldata1[length] > fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)lldata1[length] > fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)lldata1[length] > fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)lldata1[length] > fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)lldata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)lldata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)lldata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)lldata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)lldata1[length] < fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)lldata1[length] < fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)lldata1[length] < fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)lldata1[length] < fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((float)lldata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((float)lldata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((float)lldata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((float)lldata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_DOUBLE: { double *ddata2 = cpl_column_get_data_double(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)lldata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)lldata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)lldata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)lldata1[length] == ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)lldata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)lldata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)lldata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)lldata1[length] != ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)lldata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)lldata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)lldata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)lldata1[length] > ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)lldata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)lldata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)lldata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)lldata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)lldata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)lldata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)lldata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)lldata1[length] < ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)lldata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)lldata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)lldata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)lldata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } break; } break; } default: break; } // end switch (type2) break; } // end case CPL_TYPE_LONG_LONG case CPL_TYPE_FLOAT: { float *fdata1 = cpl_column_get_data_float(column1); switch (type2) { case CPL_TYPE_INT: { int *idata2 = cpl_column_get_data_int(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] == (float)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] == (float)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] == (float)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] == (float)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] != (float)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] != (float)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] != (float)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] != (float)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] > (float)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] > (float)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] > (float)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] > (float)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] <= (float)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] <= (float)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] <= (float)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] <= (float)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] < (float)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] < (float)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] < (float)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] < (float)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] >= (float)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] >= (float)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] >= (float)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] >= (float)idata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_LONG: { long *ldata2 = cpl_column_get_data_long(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] == (float)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] == (float)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] == (float)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] == (float)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] != (float)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] != (float)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] != (float)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] != (float)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] > (float)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] > (float)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] > (float)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] > (float)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] <= (float)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] <= (float)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] <= (float)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] <= (float)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] < (float)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] < (float)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] < (float)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] < (float)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] >= (float)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] >= (float)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] >= (float)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] >= (float)ldata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_LONG_LONG: { long long *lldata2 = cpl_column_get_data_long_long(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] == (float)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] == (float)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] == (float)lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] == (float)lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] != (float)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] != (float)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] != (float)lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] != (float)lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] > (float)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] > (float)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] > (float)lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] > (float)lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] <= (float)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] <= (float)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] <= (float)lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] <= (float)lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] < (float)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] < (float)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] < (float)lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] < (float)lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] >= (float)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] >= (float)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] >= (float)lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] >= (float)lldata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_FLOAT: { float *fdata2 = cpl_column_get_data_float(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] == fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] == fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] == fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] == fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] != fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] != fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] != fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] != fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] > fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] > fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] > fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] > fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] <= fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] < fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] < fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] < fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] < fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (fdata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (fdata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (fdata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (fdata1[length] >= fdata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_DOUBLE: { double *ddata2 = cpl_column_get_data_double(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)fdata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)fdata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)fdata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)fdata1[length] == ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)fdata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)fdata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)fdata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)fdata1[length] != ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)fdata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)fdata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)fdata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)fdata1[length] > ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)fdata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)fdata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)fdata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)fdata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)fdata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)fdata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)fdata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)fdata1[length] < ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if ((double)fdata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if ((double)fdata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if ((double)fdata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if ((double)fdata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } break; } break; } default: break; } // end switch (type2) break; } // end case CPL_TYPE_FLOAT case CPL_TYPE_DOUBLE: { double *ddata1 = cpl_column_get_data_double(column1); switch (type2) { case CPL_TYPE_INT: { int *idata2 = cpl_column_get_data_int(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] == (double)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] == (double)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] == (double)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] == (double)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] != (double)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] != (double)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] != (double)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] != (double)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] > (double)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] > (double)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] > (double)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] > (double)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] <= (double)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] <= (double)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] <= (double)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] <= (double)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] < (double)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] < (double)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] < (double)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] < (double)idata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] >= (double)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] >= (double)idata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] >= (double)idata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] >= (double)idata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_LONG: { long *ldata2 = cpl_column_get_data_long(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] == (double)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] == (double)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] == (double)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] == (double)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] != (double)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] != (double)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] != (double)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] != (double)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] > (double)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] > (double)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] > (double)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] > (double)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] <= (double)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] <= (double)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] <= (double)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] <= (double)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] < (double)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] < (double)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] < (double)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] < (double)ldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] >= (double)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] >= (double)ldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] >= (double)ldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] >= (double)ldata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_LONG_LONG: { long long *lldata2 = cpl_column_get_data_long_long(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] == (double)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] == (double)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] == (double)lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] == (double)lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] != (double)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] != (double)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] != (double)lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] != (double)lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] > (double)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] > (double)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] > (double)lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] > (double)lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] <= (double)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] <= (double)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] <= (double)lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] <= (double)lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] < (double)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] < (double)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] < (double)lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] < (double)lldata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] >= (double)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] >= (double)lldata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] >= (double)lldata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] >= (double)lldata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_FLOAT: { float *fdata2 = cpl_column_get_data_float(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] == (double)fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] == (double)fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] == (double)fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] == (double)fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] != (double)fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] != (double)fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] != (double)fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] != (double)fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] > (double)fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] > (double)fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] > (double)fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] > (double)fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] <= (double)fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] <= (double)fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] <= (double)fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] <= (double)fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] < (double)fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] < (double)fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] < (double)fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] < (double)fdata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] >= (double)fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] >= (double)fdata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] >= (double)fdata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] >= (double)fdata2[length]) cpl_table_select_row(table, length); } break; } break; } case CPL_TYPE_DOUBLE: { double *ddata2 = cpl_column_get_data_double(column2); switch (operator) { case CPL_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] == ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] == ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_EQUAL_TO: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] != ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] != ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] > ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] > ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_GREATER_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] <= ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] < ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] < ddata2[length]) cpl_table_select_row(table, length); } break; case CPL_NOT_LESS_THAN: if (nulldata1 && nulldata2) { while (length--) if (nulldata1[length] == 0 && nulldata2[length] == 0) if (ddata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata1) { while (length--) if (nulldata1[length] == 0) if (ddata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else if (nulldata2) { while (length--) if (nulldata2[length] == 0) if (ddata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } else { while (length--) if (ddata1[length] >= ddata2[length]) cpl_table_select_row(table, length); } break; } break; } default: break; } // end switch (type2) break; } // end case CPL_TYPE_DOUBLE case CPL_TYPE_STRING: { sdata1 = cpl_column_get_data_string(column1); sdata2 = cpl_column_get_data_string(column2); switch (operator) { case CPL_EQUAL_TO: while (length--) if (sdata1[length] && sdata2[length]) if (!strcmp(sdata1[length], sdata2[length])) cpl_table_select_row(table, length); break; case CPL_NOT_EQUAL_TO: while (length--) if (sdata1[length] && sdata2[length]) if (strcmp(sdata1[length], sdata2[length])) cpl_table_select_row(table, length); break; case CPL_GREATER_THAN: while (length--) if (sdata1[length] && sdata2[length]) if (strcmp(sdata1[length], sdata2[length]) > 0) cpl_table_select_row(table, length); break; case CPL_NOT_GREATER_THAN: while (length--) if (sdata1[length] && sdata2[length]) if (strcmp(sdata1[length], sdata2[length]) <= 0) cpl_table_select_row(table, length); break; case CPL_LESS_THAN: while (length--) if (sdata1[length] && sdata2[length]) if (strcmp(sdata1[length], sdata2[length]) < 0) cpl_table_select_row(table, length); break; case CPL_NOT_LESS_THAN: while (length--) if (sdata1[length] && sdata2[length]) if (strcmp(sdata1[length], sdata2[length]) >= 0) cpl_table_select_row(table, length); break; } break; } // end case CPL_TYPE_STRING default: break; } // end switch (type1) return table->selectcount; } /** * @brief * Determine whether a table row is selected or not. * * @param table Pointer to table. * @param row Table row to check. * * @return 1 if row is selected, 0 if it is not selected, -1 in case of error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input table has zero length, or row is * outside the table boundaries. *
* @enderror * * Check if a table row is selected. */ int cpl_table_is_selected(const cpl_table *table, cpl_size row) { if (table == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } if (row < 0 || row >= table->nr) { cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); return -1; } if (table->selectcount == 0) return 0; if (table->selectcount == table->nr) return 1; return table->select[row]; } /** * @brief * Get number of selected rows in given table. * * @param table Pointer to table. * * @return Number of selected rows, or a negative number in case of error. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
* @enderror * * Get number of selected rows in given table. */ cpl_size cpl_table_count_selected(const cpl_table *table) { if (table == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } return table->selectcount; } /** * @brief * Get array of indexes to selected table rows * * @param table Pointer to table. * * @return Indexes to selected table rows, or NULL in case of error. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
* @enderror * * Get array of indexes to selected table rows. If no rows are selected, * an array of size zero is returned. The returned array must be deleted * using @c cpl_array_delete(). */ cpl_array *cpl_table_where_selected(const cpl_table *table) { cpl_array *array; cpl_size *flags; cpl_size i; if (table == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } array = cpl_array_new(table->selectcount, CPL_TYPE_SIZE); cpl_array_fill_window(array, 0, table->selectcount, 0); flags = cpl_array_get_data_cplsize(array); if (table->selectcount == table->nr) for (i = 0; i < table->nr; i++) *flags++ = i; else if (table->selectcount > 0) for (i = 0; i < table->nr; i++) if (table->select[i]) *flags++ = i; return array; } /** * @brief * Create a new table from the selected rows of another table. * * @param table Pointer to table. * * @return Pointer to new table, or @c NULL in case of error. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * Input table is a NULL pointer. *
* @enderror * * A new table is created, containing a copy of all the selected * rows of the input table. In the output table all rows are selected. */ cpl_table *cpl_table_extract_selected(const cpl_table *table) { cpl_table *new_table; int ivalue; float fvalue; double dvalue; char *svalue; cpl_array *avalue; cpl_size from_row; cpl_size to_row; cpl_size count; cpl_size i, j, l, m, n; int isnull; if (table == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if (table->selectcount == table->nr) return cpl_table_duplicate(table); new_table = cpl_table_new(table->selectcount); cpl_table_copy_structure(new_table, table); if (table->selectcount == 0) return new_table; from_row = 0; to_row = 0; count = 0; i = 0; while (i < table->nr) { if (table->select[i]) { if (count == 0) from_row = i; count++; i++; if (i != table->nr) continue; i--; } if (count) { j = 0; while (j < table->nc) { l = 0; m = from_row; n = to_row; switch (cpl_column_get_type(table->columns[j])) { case CPL_TYPE_INT: /* * This is slow, but acceptable for the moment. * It should be replaced by a call to a function * that copies efficiently column segments into * other column segments (including the NULL * flags). */ while (l < count) { ivalue = cpl_column_get_int(table->columns[j], m, &isnull); if (isnull) cpl_column_set_invalid(new_table->columns[j], n); else cpl_column_set_int(new_table->columns[j], n, ivalue); l++; m++; n++; } break; case CPL_TYPE_FLOAT: while (l < count) { fvalue = cpl_column_get_float(table->columns[j], m, &isnull); if (isnull) cpl_column_set_invalid(new_table->columns[j], n); else cpl_column_set_float( new_table->columns[j], n, fvalue); l++; m++; n++; } break; case CPL_TYPE_DOUBLE: while (l < count) { dvalue = cpl_column_get_double(table->columns[j], m, &isnull); if (isnull) cpl_column_set_invalid(new_table->columns[j], n); else cpl_column_set_double( new_table->columns[j], n, dvalue); l++; m++; n++; } break; case CPL_TYPE_STRING: while (l < count) { svalue = (char *)cpl_column_get_string(table->columns[j], m); cpl_column_set_string(new_table->columns[j], n, svalue); l++; m++; n++; } break; case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: while (l < count) { avalue = (cpl_array *)cpl_column_get_array(table->columns[j], m); cpl_column_set_array(new_table->columns[j], n, avalue); l++; m++; n++; } break; default: break; } j++; } to_row += count; count = 0; if (to_row == new_table->nr) break; } i++; } return new_table; } /** * @brief * Sort table rows according to columns values. * * @param table Pointer to table. * @param reflist Names of reference columns with corresponding sorting mode. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or reflist are NULL pointers. *
CPL_ERROR_DATA_NOT_FOUND * Any reference column specified in reflist is not found in * table. *
CPL_ERROR_ILLEGAL_INPUT * The size of reflist exceeds the total number of columns * in table, or reflist is empty. *
CPL_ERROR_TYPE_MISMATCH * The input reflist includes properties of type * different from CPL_TYPE_BOOL. *
CPL_ERROR_UNSUPPORTED_MODE * Any reference column specified in reflist is of type * array. *
* @enderror * * The table rows are sorted according to the values of the specified * reference columns. The reference column names are listed in the input * @em reflist, that associates to each reference column a boolean value. * If the associated value is @c FALSE, the table is sorted according * to the ascending values of the specified column, otherwise if the * associated value is @c TRUE, the table is sorted according to the * descending values of that column. The sorting will be performed by * comparing the values of the first reference column; if the compared * values are equal, the values from the next column in the list are * compared, and so on till the end of the reference columns list. * An invalid table element is always treated as if it doesn't fulfill * any comparison, i.e., sorting either by increasing or decreasing * column values would accumulate invalid elements toward the top of * the table. The sorting is made in-place, therefore pointers to * data retrieved with calls to @c cpl_table_get_data_() * remain valid. */ cpl_error_code cpl_table_sort(cpl_table *table, const cpl_propertylist *reflist) { cpl_size *sort_pattern, *sort_null_pattern; cpl_error_code ec; if (table == NULL || reflist == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_propertylist_get_size(reflist) == 0) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); if (table->nr < 2) return CPL_ERROR_NONE; sort_pattern = cpl_malloc(table->nr * sizeof(cpl_size)); sort_null_pattern = cpl_malloc(table->nr * sizeof(cpl_size)); ec = table_sort(table, reflist, cpl_propertylist_get_size(reflist), sort_pattern, sort_null_pattern); cpl_free(sort_pattern); cpl_free(sort_null_pattern); return ec; } #ifdef OLDTABLE cpl_error_code cpl_table_sort(cpl_table *table, const cpl_propertylist *reflist) { cpl_column **columns; cpl_column *sorted_column; cpl_type *types; char **names; int *reverse; long i, j; long ncol; int *sort_pattern; int *p; int reach; int keep; int nullcount; cpl_property *info; int *idata; int *sorted_idata; float *fdata; float *sorted_fdata; double *ddata; double *sorted_ddata; char **sdata; char **sorted_sdata; cpl_array **adata; cpl_array **sorted_adata; cpl_column_flag *ndata; cpl_column_flag *sorted_ndata; if (table == 0x0 || reflist == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); ncol = cpl_propertylist_get_size(reflist); if (ncol <= 0 || ncol > table->nc) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); if (table->nr < 2) return CPL_ERROR_NONE; names = cpl_malloc(ncol * sizeof(char *)); reverse = cpl_malloc(ncol * sizeof(int)); for (i = 0; i < ncol; i++) { info = cpl_propertylist_get((cpl_propertylist *)reflist, i); names[i] = (char *)cpl_property_get_name(info); if (cpl_property_get_type(info) == CPL_TYPE_BOOL) reverse[i] = cpl_property_get_bool(info); else return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } /* * Get pointers to reference columns. */ columns = cpl_malloc(ncol * sizeof(*columns)); for (i = 0; i < ncol; i++) { columns[i] = cpl_table_find_column_(table, names[i]); if (!columns[i]) { cpl_free(columns); cpl_free(names); cpl_free(reverse); return cpl_error_set_where_(); } } /* * Get type of each column. */ types = cpl_malloc(ncol * sizeof(cpl_type)); for (i = 0; i < ncol; i++) { types[i] = cpl_column_get_type(columns[i]); if (types[i] & CPL_TYPE_POINTER) { /* Arrays not yet as reference */ cpl_free(types); cpl_free(columns); cpl_free(names); cpl_free(reverse); return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } } /* * Allocate the arrays for computing the sort pattern (i.e., the * list of arrival positions of array values after sorting). */ sort_pattern = cpl_malloc(table->nr * sizeof(int)); p = cpl_malloc(table->nr * sizeof(int)); for (i = 0; i < table->nr; i++) sort_pattern[i] = p[i] = i; /* * Find sorting pattern examining selected columns. */ j = 0; i = 1; reach = 1; while (i < table->nr) { ndata = cpl_column_get_data_invalid(columns[j]); switch (types[j]) { case CPL_TYPE_INT: idata = cpl_column_get_data_int(columns[j]); if (!reverse || reverse[j] == 0) { while (i < table->nr) { if (ndata) { if (ndata[p[i]]) { if (ndata[p[i-1]]) { /* Two NULLs */ if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } else { /* Not-NULL followed by NULL */ keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } if (j) { j = 0; break; } continue; } else if (ndata[p[i-1]]) { /* NULL flwd by not-NULL */ i++; if (i > reach) reach = i; if (j) { j = 0; break; } continue; } } if (idata[p[i]] > idata[p[i-1]]) { i++; if (i > reach) reach = i; } else if (idata[p[i]] < idata[p[i-1]]) { keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } else { if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } if (j) { j = 0; break; } } } else { while (i < table->nr) { if (ndata) { if (ndata[p[i]]) { if (ndata[p[i-1]]) { /* Two NULLs */ if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } else { /* Not-NULL followed by NULL */ keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } if (j) { j = 0; break; } continue; } else if (ndata[p[i-1]]) { /* NULL flwd by not-NULL */ i++; if (i > reach) reach = i; if (j) { j = 0; break; } continue; } } if (idata[p[i]] < idata[p[i-1]]) { i++; if (i > reach) reach = i; } else if (idata[p[i]] > idata[p[i-1]]) { keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } else { if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } if (j) { j = 0; break; } } } break; case CPL_TYPE_FLOAT: fdata = cpl_column_get_data_float(columns[j]); if (!reverse || reverse[j] == 0) { while (i < table->nr) { if (ndata) { if (ndata[p[i]]) { if (ndata[p[i-1]]) { /* Two NULLs */ if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } else { /* Not-NULL followed by NULL */ keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } if (j) { j = 0; break; } continue; } else if (ndata[p[i-1]]) { /* NULL flwd by not-NULL */ i++; if (i > reach) reach = i; if (j) { j = 0; break; } continue; } } if (fdata[p[i]] > fdata[p[i-1]]) { i++; if (i > reach) reach = i; } else if (fdata[p[i]] < fdata[p[i-1]]) { keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } else { if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } if (j) { j = 0; break; } } } else { while (i < table->nr) { if (ndata) { if (ndata[p[i]]) { if (ndata[p[i-1]]) { /* Two NULLs */ if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } else { /* Not-NULL followed by NULL */ keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } if (j) { j = 0; break; } continue; } else if (ndata[p[i-1]]) { /* NULL flwd by not-NULL */ i++; if (i > reach) reach = i; if (j) { j = 0; break; } continue; } } if (fdata[p[i]] < fdata[p[i-1]]) { i++; if (i > reach) reach = i; } else if (fdata[p[i]] > fdata[p[i-1]]) { keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } else { if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } if (j) { j = 0; break; } } } break; case CPL_TYPE_DOUBLE: ddata = cpl_column_get_data_double(columns[j]); if (!reverse || reverse[j] == 0) { while (i < table->nr) { if (ndata) { if (ndata[p[i]]) { if (ndata[p[i-1]]) { /* Two NULLs */ if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } else { /* Not-NULL followed by NULL */ keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } if (j) { j = 0; break; } continue; } else if (ndata[p[i-1]]) { /* NULL flwd by not-NULL */ i++; if (i > reach) reach = i; if (j) { j = 0; break; } continue; } } if (ddata[p[i]] > ddata[p[i-1]]) { i++; if (i > reach) reach = i; } else if (ddata[p[i]] < ddata[p[i-1]]) { keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } else { if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } if (j) { j = 0; break; } } } else { while (i < table->nr) { if (ndata) { if (ndata[p[i]]) { if (ndata[p[i-1]]) { /* Two NULLs */ if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } else { /* Not-NULL followed by NULL */ keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } if (j) { j = 0; break; } continue; } else if (ndata[p[i-1]]) { /* NULL flwd by not-NULL */ i++; if (i > reach) reach = i; if (j) { j = 0; break; } continue; } } if (ddata[p[i]] < ddata[p[i-1]]) { i++; if (i > reach) reach = i; } else if (ddata[p[i]] > ddata[p[i-1]]) { keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } else { if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } if (j) { j = 0; break; } } } break; case CPL_TYPE_STRING: sdata = cpl_column_get_data_string(columns[j]); if (!reverse || reverse[j] == 0) { while (i < table->nr) { if (!sdata[p[i]]) { if (!sdata[p[i-1]]) { /* Two NULLs */ if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } else { /* Not-NULL followed by NULL */ keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } if (j) { j = 0; break; } continue; } else if (!sdata[p[i-1]]) { /* NULL flwd by not-NULL */ i++; if (i > reach) reach = i; if (j) { j = 0; break; } continue; } if (strcmp(sdata[p[i]], sdata[p[i-1]]) > 0) { i++; if (i > reach) reach = i; } else if (strcmp(sdata[p[i]], sdata[p[i-1]]) < 0) { keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } else { if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } if (j) { j = 0; break; } } } else { while (i < table->nr) { if (!sdata[p[i]]) { if (!sdata[p[i-1]]) { /* Two NULLs */ if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } else { /* Not-NULL followed by NULL */ keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } if (j) { j = 0; break; } continue; } else if (!sdata[p[i-1]]) { /* NULL flwd by not-NULL */ i++; if (i > reach) reach = i; if (j) { j = 0; break; } continue; } if (strcmp(sdata[p[i]], sdata[p[i-1]]) < 0) { i++; if (i > reach) reach = i; } else if (strcmp(sdata[p[i]], sdata[p[i-1]]) > 0) { keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } else { if (ncol == 1) { i++; continue; } j++; if (j == ncol) { j = 0; i++; if (i > reach) reach = i; } break; } if (j) { j = 0; break; } } } break; default: break; /* Should never come to this point */ } } /* * To obtain the sort pattern this is the trick: */ reach = 1; i = 1; while (i < table->nr) { if (p[sort_pattern[i]] > p[sort_pattern[i-1]]) { i++; if (i > reach) reach = i; } else { keep = sort_pattern[i-1]; sort_pattern[i-1] = sort_pattern[i]; sort_pattern[i] = keep; if (i > 1) i--; else i = reach + 1; } } /* * Now apply the sorting pattern to each column in the table: */ j = 0; while (j < table->nc) { switch (cpl_column_get_type(table->columns[j])) { case CPL_TYPE_INT: sorted_column = cpl_column_new_int(table->nr); cpl_column_set_name(sorted_column, cpl_column_get_name(table->columns[j])); nullcount = cpl_column_count_invalid(table->columns[j]); if (nullcount != table->nr) { /* * This is just a trick to make the null column exist, * with the right number of nulls: */ cpl_column_fill_int(sorted_column, 0, table->nr - nullcount, 0); ndata = cpl_column_get_data_invalid(table->columns[j]); if (ndata) { sorted_ndata = cpl_column_get_data_invalid(sorted_column); for (i = 0; i < table->nr; i++) sorted_ndata[sort_pattern[i]] = ndata[i]; } } sorted_idata = cpl_column_get_data_int(sorted_column); idata = cpl_column_get_data_int(table->columns[j]); for (i = 0; i < table->nr; i++) sorted_idata[sort_pattern[i]] = idata[i]; cpl_column_delete(table->columns[j]); table->columns[j] = sorted_column; break; case CPL_TYPE_FLOAT: sorted_column = cpl_column_new_float(table->nr); cpl_column_set_name(sorted_column, cpl_column_get_name(table->columns[j])); nullcount = cpl_column_count_invalid(table->columns[j]); if (nullcount != table->nr) { /* * This is just a trick to make the null column exist, * with the right number of nulls: */ cpl_column_fill_float(sorted_column, 0, table->nr - nullcount, 0.0); ndata = cpl_column_get_data_invalid(table->columns[j]); if (ndata) { sorted_ndata = cpl_column_get_data_invalid(sorted_column); for (i = 0; i < table->nr; i++) sorted_ndata[sort_pattern[i]] = ndata[i]; } } sorted_fdata = cpl_column_get_data_float(sorted_column); fdata = cpl_column_get_data_float(table->columns[j]); for (i = 0; i < table->nr; i++) sorted_fdata[sort_pattern[i]] = fdata[i]; cpl_column_delete(table->columns[j]); table->columns[j] = sorted_column; break; case CPL_TYPE_DOUBLE: sorted_column = cpl_column_new_double(table->nr); cpl_column_set_name(sorted_column, cpl_column_get_name(table->columns[j])); nullcount = cpl_column_count_invalid(table->columns[j]); if (nullcount != table->nr) { /* * This is just a trick to make the null column exist, * with the right number of nulls: */ cpl_column_fill_double(sorted_column, 0, table->nr - nullcount, 0.0); ndata = cpl_column_get_data_invalid(table->columns[j]); if (ndata) { sorted_ndata = cpl_column_get_data_invalid(sorted_column); for (i = 0; i < table->nr; i++) sorted_ndata[sort_pattern[i]] = ndata[i]; } } sorted_ddata = cpl_column_get_data_double(sorted_column); ddata = cpl_column_get_data_double(table->columns[j]); for (i = 0; i < table->nr; i++) sorted_ddata[sort_pattern[i]] = ddata[i]; cpl_column_delete(table->columns[j]); table->columns[j] = sorted_column; break; case CPL_TYPE_STRING: sorted_column = cpl_column_new_string(table->nr); cpl_column_set_name(sorted_column, cpl_column_get_name(table->columns[j])); sorted_sdata = cpl_column_get_data_string(sorted_column); sdata = cpl_column_get_data_string(table->columns[j]); for (i = 0; i < table->nr; i++) sorted_sdata[sort_pattern[i]] = sdata[i]; cpl_column_delete_but_strings(table->columns[j]); table->columns[j] = sorted_column; break; case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: sorted_column = cpl_column_new_array(cpl_column_get_type(table->columns[j]), table->nr, cpl_column_get_depth(table->columns[j])); cpl_column_set_name(sorted_column, cpl_column_get_name(table->columns[j])); sorted_adata = cpl_column_get_data_array(sorted_column); adata = cpl_column_get_data_array(table->columns[j]); for (i = 0; i < table->nr; i++) sorted_adata[sort_pattern[i]] = adata[i]; cpl_column_delete_but_arrays(table->columns[j]); table->columns[j] = sorted_column; break; default: break; /* Should never get here */ } j++; } cpl_free(names); cpl_free(reverse); cpl_free(columns); cpl_free(types); cpl_free(p); cpl_free(sort_pattern); return CPL_ERROR_NONE; } #endif static cpl_table *cpl_table_overload_window(const char *filename, int xtnum, int check_nulls, const cpl_array *selcol, cpl_size firstrow, cpl_size nrow) { fitsfile *fptr; cpl_table *table; char colname[FLEN_VALUE]; char colunit[FLEN_VALUE]; char comment[FLEN_COMMENT]; char keyname[FLEN_KEYWORD]; char scolnum[5]; /* Keeping column numbers up to 9999 */ cpl_size nullcount; int extension_count; cpl_size field_size; int ncol; cpl_size nrows; int naxis; cpl_size *naxes; int i, k; cpl_size j; cpl_size depth; cpl_size z, zz; cpl_array *adim; cpl_array **array; cpl_column *acolumn; cpl_column_flag *nulldata; char err_text[FLEN_STATUS]; const char **extcol = NULL; char *barray; int xcol = 0; int extract; int colnum; int status = 0; int hdutype; int typecode; err_text[0] = '\0'; if (filename == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if (access(filename, F_OK)) { cpl_error_set_(CPL_ERROR_FILE_NOT_FOUND); return NULL; } cpl_io_fits_open_diskfile(&fptr, filename, READONLY, &status); fits_get_num_hdus(fptr, &extension_count, &status); if (status) { fits_get_errstatus(status, err_text); cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "CFITSIO: %s", err_text); status = 0; cpl_io_fits_close_file(fptr, &status); return NULL; } if (extension_count < 0) { cpl_error_set_(CPL_ERROR_BAD_FILE_FORMAT); cpl_io_fits_close_file(fptr, &status); return NULL; } if (extension_count == 0) { cpl_error_set_(CPL_ERROR_BAD_FILE_FORMAT); cpl_io_fits_close_file(fptr, &status); return NULL; } /* * HDUs in the CFITSIO convention are counted starting from 1 * (the primary array). Therefore we need to adapt the input to * this convention: */ xtnum++; if (xtnum < 2 || xtnum > extension_count) { cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_io_fits_close_file(fptr, &status); return NULL; } fits_movabs_hdu(fptr, xtnum, NULL, &status); fits_get_hdu_type(fptr, &hdutype, &status); if (status) { fits_get_errstatus(status, err_text); cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "CFITSIO: %s", err_text); status = 0; cpl_io_fits_close_file(fptr, &status); return NULL; } if (hdutype != ASCII_TBL && hdutype != BINARY_TBL) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); cpl_io_fits_close_file(fptr, &status); return NULL; } /* * CPL table initialisation */ fits_get_num_cols(fptr, &ncol, &status); { /*FIXME: debug purpose only. * Compatibility with cpl_size = int. */ LONGLONG longnrows; fits_get_num_rowsll(fptr, &longnrows, &status); nrows = (cpl_size)longnrows; } if (status) { fits_get_errstatus(status, err_text); cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "CFITSIO: %s", err_text); status = 0; cpl_io_fits_close_file(fptr, &status); return NULL; } if (ncol > 9999) { cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Tables with more than 9999 columns " "are not supported."); cpl_io_fits_close_file(fptr, &status); return NULL; } if (ncol < 1 || nrows < 0) { cpl_io_fits_close_file(fptr, &status); cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); return NULL; } if (firstrow > nrows) { cpl_io_fits_close_file(fptr, &status); cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); return NULL; } /* * nrows is the actual number of rows in table, while nrow is the * requested number of rows to extract. */ if (nrows == 0) check_nulls = 0; if (firstrow < 0) { firstrow = 0; if (nrow < 0) { nrow = nrows; } } if (nrow > nrows - firstrow) nrow = nrows - firstrow; table = cpl_table_new(nrow); /* * In case they were given, get the names of the columns to extract. */ if (selcol) { extcol = cpl_array_get_data_string_const(selcol); if (extcol == NULL) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); cpl_io_fits_close_file(fptr, &status); cpl_table_delete(table); return NULL; } xcol = cpl_array_get_size(selcol); /* * Check if all specified columns exist in table */ for (i = 0; i < xcol; i++) { if (extcol[i] == NULL) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); cpl_io_fits_close_file(fptr, &status); cpl_table_delete(table); return NULL; } /* fits_get_colnum() (v.3.330) is missing a const modifier, but extcol[i] is _not_ modified. :-(((((((((( */ fits_get_colnum(fptr, CASEINSEN, (char*)extcol[i], &colnum, &status); if (status) { cpl_table_delete(table); cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); status = 0; cpl_io_fits_close_file(fptr, &status); return NULL; } } } /* * Columns initialisation - k counts the really created columns. */ for (i = 0, k = 0; i < ncol; i++) { cpl_size repeat; cpl_size width; int anynul; char *nullarray; sprintf(scolnum, "%d", i + 1); fits_get_colname(fptr, CASEINSEN, scolnum, colname, &colnum, &status); if (status) { fits_get_errstatus(status, err_text); cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "CFITSIO: %s", err_text); status = 0; cpl_io_fits_close_file(fptr, &status); return NULL; } if (colnum != i + 1) { /* * This has the sense of an assertion */ cpl_io_fits_close_file(fptr, &status); cpl_error_set_message_(CPL_ERROR_UNSPECIFIED, "Unexpected column number " "(%d instead of %d)", colnum, i + 1); return NULL; } if (extcol) { /* * Check if this column should be extracted */ extract = 0; for (j = 0; j < xcol; j++) { if (strcmp(extcol[j], colname) == 0) { extract = 1; break; } } if (extract == 0) continue; } { /*FIXME: debug purpose only. * Compatibility with cpl_size = int. */ LONGLONG longrepeat, longwidth; fits_get_eqcoltypell(fptr, i + 1, &typecode, &longrepeat, &longwidth, &status); repeat = (cpl_size)longrepeat; width = (cpl_size)longwidth; } if (status) { fits_get_errstatus(status, err_text); cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "CFITSIO: %s", err_text); status = 0; cpl_io_fits_close_file(fptr, &status); return NULL; } /* * Here is another place where we like to think that * cpl_size = LONGLONG */ depth = repeat; if (depth < 1) { cpl_msg_debug(cpl_func, "Found dummy column (%d)\n", i); continue; } switch (typecode) { case TSTRING: if (hdutype == ASCII_TBL) { /* * No arrays of strings in ASCII tables (i.e., repeat = 1 * always, it's the width that rules). */ repeat = width; } field_size = width + 1; depth = repeat / width; if (depth > 1) { cpl_table_new_column_array(table, colname, CPL_TYPE_STRING, depth); array = cpl_table_get_data_array(table, colname); nullarray = cpl_malloc(depth * sizeof(char)); for (j = 0; j < nrow; j++) { char **scolumn = NULL; array[j] = cpl_array_new(depth, CPL_TYPE_STRING); scolumn = cpl_array_get_data_string(array[j]); for (z = 0; z < depth; z++) scolumn[z] = cpl_malloc(field_size * sizeof(char)); if (check_nulls) { fits_read_colnull(fptr, TSTRING, i + 1, firstrow + j + 1, 1, depth, scolumn, nullarray, &anynul, &status); nullcount = 0; if (anynul) { for (z = 0; z < depth; z++) { if (nullarray[z]) { nullcount++; cpl_free(scolumn[z]); scolumn[z] = NULL; } } } if (nullcount == depth) { cpl_free(array[j]); array[j] = NULL; } } else { fits_read_col(fptr, TSTRING, i + 1, firstrow + j + 1, 1, depth, 0, scolumn, &anynul, &status); } } cpl_free(nullarray); } else { char **scolumn = NULL; cpl_table_new_column(table, colname, CPL_TYPE_STRING); scolumn = cpl_table_get_data_string(table, colname); for (j = 0; j < nrow; j++) scolumn[j] = cpl_malloc(field_size * sizeof(char)); if (check_nulls) { nullarray = cpl_malloc(nrow * sizeof(char)); fits_read_colnull(fptr, TSTRING, i + 1, firstrow + 1, 1, nrow, scolumn, nullarray, &anynul, &status); if (anynul) { for (j = 0; j < nrow; j++) { if (nullarray[j]) { cpl_free(scolumn[j]); scolumn[j] = NULL; } } } cpl_free(nullarray); } else { fits_read_col(fptr, TSTRING, i + 1, firstrow + 1, 1, nrow, 0, scolumn, &anynul, &status); } } break; case TLOGICAL: if (depth > 1) { barray = cpl_malloc(depth * sizeof(char)); cpl_table_new_column_array(table, colname, CPL_TYPE_INT, depth); array = cpl_table_get_data_array(table, colname); nullarray = cpl_malloc(depth * sizeof(char)); for (j = 0; j < nrow; j++) { int *icolumn = NULL; array[j] = cpl_array_new(depth, CPL_TYPE_INT); acolumn = cpl_array_get_column(array[j]); icolumn = cpl_column_get_data_int(acolumn); if (check_nulls) { fits_read_colnull(fptr, TLOGICAL, i + 1, firstrow + j + 1, 1, depth, barray, nullarray, &anynul, &status); nullcount = 0; if (anynul) { for (z = 0; z < depth; z++) if (nullarray[z]) nullcount++; if (nullcount == depth) { cpl_array_delete(array[j]); array[j] = NULL; } else { nulldata = cpl_malloc(depth * sizeof(cpl_column_flag)); for (z = 0; z < depth; z++) nulldata[z] = nullarray[z]; cpl_column_set_data_invalid(acolumn, nulldata, nullcount); } } else { cpl_column_set_data_invalid(acolumn, NULL, 0); } } else { fits_read_col(fptr, TLOGICAL, i + 1, firstrow + j + 1, 1, depth, 0, barray, &anynul, &status); cpl_column_set_data_invalid(acolumn, NULL, 0); } for (z = 0; z < depth; z++) icolumn[z] = barray[z]; } cpl_free(barray); cpl_free(nullarray); } else { int *icolumn = NULL; barray = cpl_malloc(nrow * sizeof(char)); cpl_table_new_column(table, colname, CPL_TYPE_INT); icolumn = cpl_table_get_data_int(table, colname); if (check_nulls) { nullarray = cpl_malloc(nrow * sizeof(char)); fits_read_colnull(fptr, TLOGICAL, i + 1, firstrow + 1, 1, nrow, barray, nullarray, &anynul, &status); nullcount = 0; nulldata = NULL; if (anynul) { for (j = 0; j < nrow; j++) if (nullarray[j]) nullcount++; if (nullcount < nrow) { nulldata = cpl_malloc(nrow * sizeof(cpl_column_flag)); for (j = 0; j < nrow; j++) nulldata[j] = nullarray[j]; } } cpl_free(nullarray); cpl_column_set_data_invalid(table->columns[k], nulldata, nullcount); } else { fits_read_col(fptr, TLOGICAL, i + 1, firstrow + 1, 1, nrow, 0, barray, &anynul, &status); cpl_column_set_data_invalid(table->columns[k], NULL, 0); } for (j = 0; j < nrow; j++) icolumn[j] = barray[j]; cpl_free(barray); } break; case TBYTE: case TSBYTE: case TSHORT: case TUSHORT: case TINT: case TLONG: if (depth > 1) { cpl_table_new_column_array(table, colname, CPL_TYPE_INT, depth); array = cpl_table_get_data_array(table, colname); nullarray = cpl_malloc(depth * sizeof(char)); for (j = 0; j < nrow; j++) { int *icolumn = NULL; array[j] = cpl_array_new(depth, CPL_TYPE_INT); acolumn = cpl_array_get_column(array[j]); icolumn = cpl_column_get_data_int(acolumn); if (check_nulls) { fits_read_colnull(fptr, TINT, i + 1, firstrow + j + 1, 1, depth, icolumn, nullarray, &anynul, &status); nullcount = 0; if (anynul) { for (z = 0; z < depth; z++) if (nullarray[z]) nullcount++; if (nullcount == depth) { cpl_array_delete(array[j]); array[j] = NULL; } else { nulldata = cpl_malloc(depth * sizeof(cpl_column_flag)); for (z = 0; z < depth; z++) nulldata[z] = nullarray[z]; cpl_column_set_data_invalid(acolumn, nulldata, nullcount); } } else { cpl_column_set_data_invalid(acolumn, NULL, 0); } } else { fits_read_col(fptr, TINT, i + 1, firstrow + j + 1, 1, depth, 0, icolumn, &anynul, &status); cpl_column_set_data_invalid(acolumn, NULL, 0); } } cpl_free(nullarray); } else { int *icolumn = NULL; cpl_table_new_column(table, colname, CPL_TYPE_INT); icolumn = cpl_table_get_data_int(table, colname); if (check_nulls) { nullarray = cpl_malloc(nrow * sizeof(char)); fits_read_colnull(fptr, TINT, i + 1, firstrow + 1, 1, nrow, icolumn, nullarray, &anynul, &status); nullcount = 0; nulldata = NULL; if (anynul) { for (j = 0; j < nrow; j++) if (nullarray[j]) nullcount++; if (nullcount < nrow) { nulldata = cpl_malloc(nrow * sizeof(cpl_column_flag)); for (j = 0; j < nrow; j++) nulldata[j] = nullarray[j]; } } cpl_free(nullarray); cpl_column_set_data_invalid(table->columns[k], nulldata, nullcount); } else { fits_read_col(fptr, TINT, i + 1, firstrow + 1, 1, nrow, 0, icolumn, &anynul, &status); cpl_column_set_data_invalid(table->columns[k], NULL, 0); } } break; case TLONGLONG: if (depth > 1) { cpl_table_new_column_array(table, colname, CPL_TYPE_LONG_LONG, depth); array = cpl_table_get_data_array(table, colname); nullarray = cpl_malloc(depth * sizeof(char)); for (j = 0; j < nrow; j++) { long long *llcolumn = NULL; array[j] = cpl_array_new(depth, CPL_TYPE_LONG_LONG); acolumn = cpl_array_get_column(array[j]); llcolumn = cpl_column_get_data_long_long(acolumn); if (check_nulls) { fits_read_colnull(fptr, TLONGLONG, i + 1, firstrow + j + 1, 1, depth, llcolumn, nullarray, &anynul, &status); nullcount = 0; if (anynul) { for (z = 0; z < depth; z++) if (nullarray[z]) nullcount++; if (nullcount == depth) { cpl_array_delete(array[j]); array[j] = NULL; } else { nulldata = cpl_malloc(depth * sizeof(cpl_column_flag)); for (z = 0; z < depth; z++) nulldata[z] = nullarray[z]; cpl_column_set_data_invalid(acolumn, nulldata, nullcount); } } else { cpl_column_set_data_invalid(acolumn, NULL, 0); } } else { fits_read_col(fptr, TLONGLONG, i + 1, firstrow + j + 1, 1, depth, 0, llcolumn, &anynul, &status); cpl_column_set_data_invalid(acolumn, NULL, 0); } } cpl_free(nullarray); } else { long long *llcolumn = NULL; cpl_table_new_column(table, colname, CPL_TYPE_LONG_LONG); llcolumn = cpl_table_get_data_long_long(table, colname); if (check_nulls) { nullarray = cpl_malloc(nrow * sizeof(char)); fits_read_colnull(fptr, TLONGLONG, i + 1, firstrow + 1, 1, nrow, llcolumn, nullarray, &anynul, &status); nullcount = 0; nulldata = NULL; if (anynul) { for (j = 0; j < nrow; j++) if (nullarray[j]) nullcount++; if (nullcount < nrow) { nulldata = cpl_malloc(nrow * sizeof(cpl_column_flag)); for (j = 0; j < nrow; j++) nulldata[j] = nullarray[j]; } } cpl_free(nullarray); cpl_column_set_data_invalid(table->columns[k], nulldata, nullcount); } else { fits_read_col(fptr, TLONGLONG, i + 1, firstrow + 1, 1, nrow, 0, llcolumn, &anynul, &status); cpl_column_set_data_invalid(table->columns[k], NULL, 0); } } break; case TFLOAT: if (depth > 1) { cpl_table_new_column_array(table, colname, CPL_TYPE_FLOAT, depth); array = cpl_table_get_data_array(table, colname); nullarray = cpl_malloc(depth * sizeof(char)); for (j = 0; j < nrow; j++) { float *fcolumn = NULL; array[j] = cpl_array_new(depth, CPL_TYPE_FLOAT); acolumn = cpl_array_get_column(array[j]); fcolumn = cpl_column_get_data_float(acolumn); if (check_nulls) { fits_read_colnull(fptr, TFLOAT, i + 1, firstrow + j + 1, 1, depth, fcolumn, nullarray, &anynul, &status); nullcount = 0; if (anynul) { for (z = 0; z < depth; z++) if (nullarray[z]) nullcount++; if (nullcount == depth) { cpl_array_delete(array[j]); array[j] = NULL; } else { nulldata = cpl_malloc(depth * sizeof(cpl_column_flag)); for (z = 0; z < depth; z++) nulldata[z] = nullarray[z]; cpl_column_set_data_invalid(acolumn, nulldata, nullcount); } } else { cpl_column_set_data_invalid(acolumn, NULL, 0); } } else { fits_read_col(fptr, TFLOAT, i + 1, firstrow + j + 1, 1, depth, 0, fcolumn, &anynul, &status); cpl_column_set_data_invalid(acolumn, NULL, 0); } } cpl_free(nullarray); } else { float *fcolumn = NULL; cpl_table_new_column(table, colname, CPL_TYPE_FLOAT); fcolumn = cpl_table_get_data_float(table, colname); if (check_nulls) { nullarray = cpl_malloc(nrow * sizeof(char)); fits_read_colnull(fptr, TFLOAT, i + 1, firstrow + 1, 1, nrow, fcolumn, nullarray, &anynul, &status); nullcount = 0; nulldata = NULL; if (anynul) { for (j = 0; j < nrow; j++) if (nullarray[j]) nullcount++; if (nullcount < nrow) { nulldata = cpl_malloc(nrow * sizeof(cpl_column_flag)); for (j = 0; j < nrow; j++) nulldata[j] = nullarray[j]; } } cpl_free(nullarray); cpl_column_set_data_invalid(table->columns[k], nulldata, nullcount); } else { fits_read_col(fptr, TFLOAT, i + 1, firstrow + 1, 1, nrow, 0, fcolumn, &anynul, &status); cpl_column_set_data_invalid(table->columns[k], NULL, 0); } } break; case TDOUBLE: if (depth > 1) { cpl_table_new_column_array(table, colname, CPL_TYPE_DOUBLE, depth); array = cpl_table_get_data_array(table, colname); nullarray = cpl_malloc(depth * sizeof(char)); for (j = 0; j < nrow; j++) { double *dcolumn = NULL; array[j] = cpl_array_new(depth, CPL_TYPE_DOUBLE); acolumn = cpl_array_get_column(array[j]); dcolumn = cpl_column_get_data_double(acolumn); if (check_nulls) { fits_read_colnull(fptr, TDOUBLE, i + 1, firstrow + j + 1, 1, depth, dcolumn, nullarray, &anynul, &status); nullcount = 0; if (anynul) { for (z = 0; z < depth; z++) if (nullarray[z]) nullcount++; if (nullcount == depth) { cpl_array_delete(array[j]); array[j] = NULL; } else { nulldata = cpl_malloc(depth * sizeof(cpl_column_flag)); for (z = 0; z < depth; z++) nulldata[z] = nullarray[z]; cpl_column_set_data_invalid(acolumn, nulldata, nullcount); } } else { cpl_column_set_data_invalid(acolumn, NULL, 0); } } else { fits_read_col(fptr, TDOUBLE, i + 1, firstrow + j + 1, 1, depth, 0, dcolumn, &anynul, &status); cpl_column_set_data_invalid(acolumn, NULL, 0); } } cpl_free(nullarray); } else { double *dcolumn = NULL; cpl_table_new_column(table, colname, CPL_TYPE_DOUBLE); dcolumn = cpl_table_get_data_double(table, colname); if (check_nulls) { nullarray = cpl_malloc(nrow * sizeof(char)); fits_read_colnull(fptr, TDOUBLE, i + 1, firstrow + 1, 1, nrow, dcolumn, nullarray, &anynul, &status); nullcount = 0; nulldata = NULL; if (anynul) { for (j = 0; j < nrow; j++) if (nullarray[j]) nullcount++; if (nullcount < nrow) { nulldata = cpl_malloc(nrow * sizeof(cpl_column_flag)); for (j = 0; j < nrow; j++) nulldata[j] = nullarray[j]; } } cpl_free(nullarray); cpl_column_set_data_invalid(table->columns[k], nulldata, nullcount); } else { fits_read_col(fptr, TDOUBLE, i + 1, firstrow + 1, 1, nrow, 0, dcolumn, &anynul, &status); cpl_column_set_data_invalid(table->columns[k], NULL, 0); } } break; case TCOMPLEX: if (depth > 1) { float *fcolumn = NULL; cpl_table_new_column_array(table, colname, CPL_TYPE_FLOAT_COMPLEX, depth); array = cpl_table_get_data_array(table, colname); nullarray = cpl_malloc(depth * sizeof(char)); fcolumn = cpl_malloc(2 * depth * sizeof(float)); for (j = 0; j < nrow; j++) { float complex *cfcolumn = NULL; array[j] = cpl_array_new(depth, CPL_TYPE_FLOAT_COMPLEX); acolumn = cpl_array_get_column(array[j]); cfcolumn = cpl_column_get_data_float_complex(acolumn); if (check_nulls) { fits_read_colnull(fptr, TCOMPLEX, i + 1, firstrow + j + 1, 1, depth, fcolumn, nullarray, &anynul, &status); for (zz = z = 0; z < depth; z++, zz += 2) cfcolumn[z] = fcolumn[zz] + I*fcolumn[zz+1]; nullcount = 0; if (anynul) { for (z = 0; z < depth; z++) if (nullarray[z]) nullcount++; if (nullcount == depth) { cpl_array_delete(array[j]); array[j] = NULL; } else { nulldata = cpl_malloc(depth * sizeof(cpl_column_flag)); for (z = 0; z < depth; z++) nulldata[z] = nullarray[z]; cpl_column_set_data_invalid(acolumn, nulldata, nullcount); } } else { cpl_column_set_data_invalid(acolumn, NULL, 0); } } else { fits_read_col(fptr, TCOMPLEX, i + 1, firstrow + j + 1, 1, depth, 0, fcolumn, &anynul, &status); for (zz = z = 0; z < depth; z++, zz += 2) cfcolumn[z] = fcolumn[zz] + I*fcolumn[zz+1]; cpl_column_set_data_invalid(acolumn, NULL, 0); } } cpl_free(fcolumn); cpl_free(nullarray); } else { float *fcolumn = NULL; float complex *cfcolumn = NULL; cpl_table_new_column(table, colname, CPL_TYPE_FLOAT_COMPLEX); cfcolumn = cpl_table_get_data_float_complex(table, colname); fcolumn = cpl_malloc(2 * nrow * sizeof(float)); if (check_nulls) { nullarray = cpl_malloc(nrow * sizeof(char)); fits_read_colnull(fptr, TCOMPLEX, i + 1, firstrow + 1, 1, nrow, fcolumn, nullarray, &anynul, &status); nullcount = 0; nulldata = NULL; if (anynul) { for (j = 0; j < nrow; j++) if (nullarray[j]) nullcount++; if (nullcount < nrow) { nulldata = cpl_malloc(nrow * sizeof(cpl_column_flag)); for (j = 0; j < nrow; j++) nulldata[j] = nullarray[j]; } } cpl_free(nullarray); cpl_column_set_data_invalid(table->columns[k], nulldata, nullcount); } else { fits_read_col(fptr, TCOMPLEX, i + 1, firstrow + 1, 1, nrow, 0, fcolumn, &anynul, &status); cpl_column_set_data_invalid(table->columns[k], NULL, 0); } for (z = zz = 0; z < nrow; z++, zz += 2) cfcolumn[z] = fcolumn[zz] + I*fcolumn[zz+1]; cpl_free(fcolumn); } break; case TDBLCOMPLEX: if (depth > 1) { double *dcolumn = NULL; cpl_table_new_column_array(table, colname, CPL_TYPE_DOUBLE_COMPLEX, depth); array = cpl_table_get_data_array(table, colname); nullarray = cpl_malloc(depth * sizeof(char)); dcolumn = cpl_malloc(2 * depth * sizeof(double)); for (j = 0; j < nrow; j++) { double complex *cdcolumn = NULL; array[j] = cpl_array_new(depth, CPL_TYPE_DOUBLE_COMPLEX); acolumn = cpl_array_get_column(array[j]); cdcolumn = cpl_column_get_data_double_complex(acolumn); if (check_nulls) { fits_read_colnull(fptr, TDBLCOMPLEX, i + 1, firstrow + j + 1, 1, depth, dcolumn, nullarray, &anynul, &status); for (zz = z = 0; z < depth; z++, zz += 2) cdcolumn[z] = dcolumn[zz] + I*dcolumn[zz+1]; nullcount = 0; if (anynul) { for (z = 0; z < depth; z++) if (nullarray[z]) nullcount++; if (nullcount == depth) { cpl_array_delete(array[j]); array[j] = NULL; } else { nulldata = cpl_malloc(depth * sizeof(cpl_column_flag)); for (z = 0; z < depth; z++) nulldata[z] = nullarray[z]; cpl_column_set_data_invalid(acolumn, nulldata, nullcount); } } else { cpl_column_set_data_invalid(acolumn, NULL, 0); } } else { fits_read_col(fptr, TDBLCOMPLEX, i + 1, firstrow + j + 1, 1, depth, 0, dcolumn, &anynul, &status); for (zz = z = 0; z < depth; z++, zz += 2) cdcolumn[z] = dcolumn[zz] + I*dcolumn[zz+1]; cpl_column_set_data_invalid(acolumn, NULL, 0); } } cpl_free(dcolumn); cpl_free(nullarray); } else { double *dcolumn = NULL; double complex *cdcolumn = NULL; cpl_table_new_column(table, colname, CPL_TYPE_DOUBLE_COMPLEX); cdcolumn = cpl_table_get_data_double_complex(table, colname); dcolumn = cpl_malloc(2 * nrow * sizeof(double)); if (check_nulls) { nullarray = cpl_malloc(nrow * sizeof(char)); fits_read_colnull(fptr, TDBLCOMPLEX, i + 1, firstrow + 1, 1, nrow, dcolumn, nullarray, &anynul, &status); nullcount = 0; nulldata = NULL; if (anynul) { for (j = 0; j < nrow; j++) if (nullarray[j]) nullcount++; if (nullcount < nrow) { nulldata = cpl_malloc(nrow * sizeof(cpl_column_flag)); for (j = 0; j < nrow; j++) nulldata[j] = nullarray[j]; } } cpl_free(nullarray); cpl_column_set_data_invalid(table->columns[k], nulldata, nullcount); } else { fits_read_col(fptr, TDBLCOMPLEX, i + 1, firstrow + 1, 1, nrow, 0, dcolumn, &anynul, &status); cpl_column_set_data_invalid(table->columns[k], NULL, 0); } for (z = zz = 0; z < nrow; z++, zz += 2) cdcolumn[z] = dcolumn[zz] + I*dcolumn[zz+1]; cpl_free(dcolumn); } break; default: cpl_msg_debug(cpl_func, "Found unsupported type (%s)\n", colname); /* cx_print("cpl_table_load(): found unsupported type (%s)\n", colname); */ continue; } if (status) { fits_get_errstatus(status, err_text); cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "CFITSIO: %s", err_text); status = 0; cpl_io_fits_close_file(fptr, &status); return NULL; } /* * Get the column unit (if present). */ colunit[0] = '\0'; cx_snprintf(keyname, FLEN_KEYWORD, "%s%d", "TUNIT", colnum); if (fits_read_key(fptr, TSTRING, keyname, colunit, comment, &status)) { status = 0; } else { cpl_column_set_unit(table->columns[k], colunit); } if (depth > 1 && typecode != TSTRING) { /* * Read TDIM keyword. The first call is just to get the * number of dimensions. */ fits_read_tdimll(fptr, i + 1, 0, &naxis, NULL, &status); naxes = cpl_malloc(naxis * sizeof(cpl_size)); { /*FIXME: debug purpose only. * Compatibility with cpl_size = int. */ LONGLONG *longnaxes = cpl_malloc(naxis * sizeof(LONGLONG)); int t; fits_read_tdimll(fptr, i + 1, naxis, &naxis, longnaxes, &status); for (t = 0; t < naxis; t++) { naxes[t] = (cpl_size)longnaxes[t]; } cpl_free(longnaxes); } if (status) { fits_get_errstatus(status, err_text); cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "CFITSIO: %s", err_text); status = 0; cpl_io_fits_close_file(fptr, &status); return NULL; } /*FIXME: * This is one of those places where arrays of type * CPL_TYPE_INT64 are wished to be available... */ adim = cpl_array_new(naxis, CPL_TYPE_INT); for (j = 0; j < naxis; j++) cpl_array_set_int(adim, j, (int) naxes[j]); cpl_free(naxes); cpl_column_set_dimensions(table->columns[k], adim); cpl_array_delete(adim); } k++; /* A valid column was successfully processed */ } cpl_io_fits_close_file(fptr, &status); if (status) { cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "CFITSIO: %s", err_text); return NULL; } return table; } /** * @brief * Load a FITS table extension into a new @em cpl_table. * * @param filename Name of FITS file with at least one table extension. * @param xtnum Number of extension to read, starting from 1. * @param check_nulls If set to 0, identified invalid values are not marked. * * @return New table, or @c NULL in case of failure. * * @error * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input filename is a NULL pointer. *
CPL_ERROR_FILE_NOT_FOUND * A file named as specified in filename is not found. *
CPL_ERROR_BAD_FILE_FORMAT * The input file is not in FITS format. *
CPL_ERROR_ILLEGAL_INPUT * The specified FITS file extension is not a table, or, if it * is a table, it has more than 9999 columns. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * xtnum is greater than the number of FITS extensions * in the FITS file, or is less than 1. *
CPL_ERROR_DATA_NOT_FOUND * The FITS table has no rows or no columns. *
CPL_ERROR_UNSPECIFIED * Generic error condition, that should be reported to the * CPL Team. *
* @enderror * * The selected FITS file table extension is just read and converted into * the @em cpl_table conventions. */ cpl_table *cpl_table_load(const char *filename, int xtnum, int check_nulls) { cpl_table *table = cpl_table_overload_window(filename, xtnum, check_nulls, NULL, -1, -1); return table; } /** * @brief * Load part of a FITS table extension into a new @em cpl_table. * * @param filename Name of FITS file with at least one table extension. * @param xtnum Number of extension to read, starting from 1. * @param check_nulls If set to 0, identified invalid values are not marked. * @param selcol Array with the names of the columns to extract. * @param firstrow First table row to extract. * @param nrow Number of rows to extract. * * @return New table, or @c NULL in case of failure. * * @error * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input filename is a NULL pointer. *
CPL_ERROR_FILE_NOT_FOUND * A file named as specified in filename is not found. *
CPL_ERROR_BAD_FILE_FORMAT * The input file is not in FITS format. *
CPL_ERROR_ILLEGAL_INPUT * The specified FITS file extension is not a table. * Or the specified number of rows to extract is less than zero. * Or the array of column names to extract contains empty fields. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * xtnum is greater than the number of FITS extensions * in the FITS file, or is less than 1. * Or firstrow is either less than zero, or greater * than the number of rows in the table. *
CPL_ERROR_DATA_NOT_FOUND * The FITS table has no columns. * Or selcol includes columns that are not found in table. *
CPL_ERROR_UNSPECIFIED * Generic error condition, that should be reported to the * CPL Team. *
* @enderror * * The selected FITS file table extension is just read in the specified * columns and rows intervals, and converted into the @em cpl_table * conventions. If @em selcol is NULL, all columns are selected. */ cpl_table *cpl_table_load_window(const char *filename, int xtnum, int check_nulls, const cpl_array *selcol, cpl_size firstrow, cpl_size nrow) { cpl_table *table; if (firstrow < 0) { cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); return NULL; } if (nrow < 0) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return NULL; } table = cpl_table_overload_window(filename, xtnum, check_nulls, selcol, firstrow, nrow); return table; } /** * @brief * Save a @em cpl_table to a FITS file. * * @param table Input table. * @param pheader Primary header entries. * @param header Table header entries. * @param filename Name of output FITS file. * @param mode Output mode. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input table or filename are NULL pointers. *
CPL_ERROR_UNSUPPORTED_MODE * A saving mode other than CPL_IO_CREATE and * CPL_IO_EXTEND was specified. *
CPL_ERROR_FILE_NOT_FOUND * While mode is set to CPL_IO_EXTEND, * a file named as specified in filename is not found. *
CPL_ERROR_BAD_FILE_FORMAT * While mode is set to CPL_IO_EXTEND, the * specified file is not in FITS format. *
CPL_ERROR_FILE_NOT_CREATED * The FITS file could not be created. *
CPL_ERROR_FILE_IO * The FITS file could only partially be created. *
CPL_ERROR_UNSPECIFIED * Generic error condition, that should be reported to the * CPL Team. *
* @enderror * * This function can be used to convert a CPL table into a binary FITS * table extension. If the @em mode is set to @c CPL_IO_CREATE, a new * FITS file will be created containing an empty primary array, with * just one FITS table extension. An existing (and writable) FITS file * with the same name would be overwritten. If the @em mode flag is set * to @c CPL_IO_EXTEND, a new table extension would be appended to an * existing FITS file. Note that also in this case the file must be * writable (and do not take for granted that a file is writable just * because it was created by the same application, as this depends * from the system @em umask). * Two property lists may be passed to this function, both * optionally. The first property list, @em pheader, is just used if * the @em mode is set to @c CPL_IO_CREATE, and it is assumed to * contain entries for the FITS file primary header. In @em pheader any * property name related to the FITS convention, as SIMPLE, BITPIX, * NAXIS, EXTEND, BLOCKED, and END, are ignored: such entries would * be written anyway to the primary header and set to some standard * values. * If a @c NULL @em pheader is passed, the primary array would be created * with just such entries, that are mandatory in any regular FITS file. * The second property list, @em header, is assumed to contain entries * for the FITS table extension header. In this property list any * property name related to the FITS convention, as XTENSION, BITPIX, * NAXIS, PCOUNT, GCOUNT, and END, and to the table structure, as * TFIELDS, TTYPEi, TUNITi, TDISPi, TNULLi, TFORMi, would be ignored: * such entries are always computed internally, to guarantee their * consistency with the actual table structure. A DATE keyword * containing the date of table creation in ISO8601 format is also * added automatically. * * @note * Invalid strings in columns of type @c CPL_TYPE_STRING are * written to FITS as blanks. Invalid values in columns of type * @c CPL_TYPE_FLOAT or @c CPL_TYPE_DOUBLE will be written to * the FITS file as a @c NaN. Invalid values in columns of type * @c CPL_TYPE_INT and @c CPL_TYPE_LONG_LONG are the only ones * that need a specific code to be explicitly assigned to them. * This can be realised by calling the functions cpl_table_fill_invalid_int() * and cpl_table_fill_invalid_long_long(), respectively, for each table * column of type @c CPL_TYPE_INT and @c CPL_TYPE_LONG_LONG * containing invalid values, just before saving the table to FITS. The * numerical values identifying invalid integer column elements * are written to the FITS keywords TNULLn (where n is the column * sequence number). Beware that if valid column elements have * the value identical to the chosen null-code, they will also * be considered invalid in the FITS convention. */ cpl_error_code cpl_table_save(const cpl_table *table, const cpl_propertylist *pheader, const cpl_propertylist *header, const char *filename, unsigned mode) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_size depth; cpl_size dimensions; cpl_array **arrays; cpl_column *acolumn; cpl_column **column; fitsfile *outfile; cpl_size nc = cpl_table_get_ncol(table); cpl_size nr = cpl_table_get_nrow(table); cpl_size bwidth, field_size; cpl_size j, k, z; int i; int *found; cpl_size *nb; cpl_size count; cpl_size chunk, spell; long optimal_nrows; cpl_size fcount = 0; long long *nval; int *idata; short int *sidata; long long *lldata; float *fdata; double *ddata; float complex *cfdata; double complex *cddata; const char **sdata; cpl_column_flag *ndata; const char *nstring; char *sval; char *bdata; unsigned char *ubdata; const char **tunit; const char **ttype; const char **tform; char tnull[FLEN_KEYWORD]; char err_text[FLEN_STATUS]; int status = 0; err_text[0] = '\0'; if (table == 0x0 || filename == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (mode & CPL_IO_EXTEND) { /* * The file must exist, and must be writable. */ if (access(filename, F_OK)) return cpl_error_set_(CPL_ERROR_FILE_NOT_FOUND); if (access(filename, W_OK)) return cpl_error_set_(CPL_ERROR_FILE_NOT_CREATED); if (cpl_io_fits_open_diskfile(&outfile, filename, READWRITE, &status)) { fits_get_errstatus(status, err_text); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } else if (mode & CPL_IO_CREATE) { /* * If the file exists, it must be (over)writable. */ if (!access(filename, F_OK)) { if (access(filename, W_OK)) { return cpl_error_set_(CPL_ERROR_FILE_NOT_CREATED); } /* DFS04866 else { cpl_io_fits_open_diskfile(&outfile, filename, READWRITE, &status); if (status == 0) { fits_delete_file(outfile, &status); if (status) { fits_get_errstatus(status, err_text); return cpl_error_set_message_( CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } status = 0; } */ } sval = cpl_sprintf("!%s", filename); cpl_io_fits_create_file(&outfile, sval, &status); cpl_free(sval); if (status) { fits_get_errstatus(status, err_text); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } if (pheader) { /* * Write property list to primary FITS header */ if (fits_create_img(outfile, SHORT_IMG, 0, NULL, &status)) { fits_get_errstatus(status, err_text); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } fits_write_date(outfile, &status); if (cpl_fits_add_properties(outfile, pheader, "^(" ERASE_WCS_REGEXP ")$|" CPL_FITS_BADKEYS_PRIM "|" CPL_FITS_COMPRKEYS) != CPL_ERROR_NONE) { fits_delete_file(outfile, &status); if (status) { fits_get_errstatus(status, err_text); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } return cpl_error_set_(CPL_ERROR_FILE_NOT_CREATED); } } } else { return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } /* * Defining the FITS table and its columns. */ /* * The table width is the sum of all column widths (in bytes). */ nb = cpl_calloc(nc, sizeof(cpl_size)); bwidth = 0; column = table->columns; ttype = cpl_calloc(nc, sizeof(char *)); tform = cpl_calloc(nc, sizeof(char *)); tunit = cpl_calloc(nc, sizeof(char *)); for (i = 0; i < nc; i++, column++) { depth = cpl_table_get_column_depth(table, cpl_column_get_name(*column)); /* * Note that strings ttype[i] and tunit[i] do not need to be * deallocated (this is done by cpl_table_delete()), while * tform[i] do. This is because of the string format (see below), * and this is why cpl_strdup() is also used below. */ ttype[i] = cpl_column_get_name(*column); tunit[i] = cpl_column_get_unit(*column); if (tunit[i] == NULL) tunit[i] = ""; switch (cpl_column_get_type(*column)) { case CPL_TYPE_INT: switch (cpl_column_get_save_type(*column)) { case CPL_TYPE_BOOL: tform[i] = cpl_strdup("1L"); break; case CPL_TYPE_CHAR: tform[i] = cpl_strdup("1S"); break; case CPL_TYPE_UCHAR: tform[i] = cpl_strdup("1B"); break; case CPL_TYPE_SHORT: tform[i] = cpl_strdup("1I"); break; default: tform[i] = cpl_strdup("1J"); break; } nb[i] = 1; /* if (cpl_column_get_save_type(*column) == CPL_TYPE_BOOL) tform[i] = cpl_strdup("1L"); else tform[i] = cpl_strdup("1J"); nb[i] = 1; */ break; case CPL_TYPE_LONG_LONG: switch (cpl_column_get_save_type(*column)) { case CPL_TYPE_BOOL: tform[i] = cpl_strdup("1L"); break; case CPL_TYPE_CHAR: tform[i] = cpl_strdup("1S"); break; case CPL_TYPE_UCHAR: tform[i] = cpl_strdup("1B"); break; case CPL_TYPE_SHORT: tform[i] = cpl_strdup("1I"); break; case CPL_TYPE_INT: tform[i] = cpl_strdup("1J"); break; default: tform[i] = cpl_strdup("1K"); break; } nb[i] = 1; break; case CPL_TYPE_FLOAT: tform[i] = cpl_strdup("1E"); nb[i] = 1; break; case CPL_TYPE_DOUBLE: tform[i] = cpl_strdup("1D"); nb[i] = 1; break; case CPL_TYPE_FLOAT_COMPLEX: tform[i] = cpl_strdup("1C"); nb[i] = 2; break; case CPL_TYPE_DOUBLE_COMPLEX: tform[i] = cpl_strdup("1M"); nb[i] = 2; break; case CPL_TYPE_STRING: /* * Determine the longest string in column. */ sdata = cpl_column_get_data_string_const(*column); field_size = 0; for (j = 0; j < nr; j++) if (sdata[j]) if ((int)strlen(sdata[j]) > field_size) field_size = strlen(sdata[j]); if (field_size == 0) field_size = 1; nb[i] = field_size; tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "A", field_size); break; case CPL_TYPE_STRING | CPL_TYPE_POINTER: /* New part */ /* * A new kind of "depth" needs to be defined. * If an element of a table is an array of strings, * this is expressed in FITS like a string as long * as the concatenation of all the strings in the * array. We need therefore to take first of all * the longest string in all the arrays of strings. */ arrays = cpl_column_get_data_array(*column); field_size = 0; for (k = 0; k < nr; k++) { if (arrays[k]) { sdata = cpl_array_get_data_string_const(arrays[k]); for (j = 0; j < depth; j++) { if (sdata[j]) { if ((int)strlen(sdata[j]) > field_size) { field_size = strlen(sdata[j]); } } } } } if (field_size == 0) field_size = 1; /* * The new depth is the number of strings for each array, * multiplied by the length of the longest string in all * the arrays. */ tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "A", depth * field_size); /* * In the TDIM keyword will have to be written the total number * of characters for each string field, field_size, and the * number of fields for one table element, depth. */ /* End new part */ break; case CPL_TYPE_INT | CPL_TYPE_POINTER: if (depth > 0) { switch (cpl_column_get_save_type(*column)) { case CPL_TYPE_BOOL: tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "L", depth); break; case CPL_TYPE_CHAR: tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "S", depth); break; case CPL_TYPE_UCHAR: tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "B", depth); break; case CPL_TYPE_SHORT: tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "I", depth); break; default: tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "J", depth); } nb[i] = depth; /* tform[i] = cpl_sprintf(cpl_column_get_save_type(*column) == CPL_TYPE_BOOL ? "%dL" : "%dJ", depth); nb[i] = depth; */ } else { cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } break; case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: if (depth > 0) { switch (cpl_column_get_save_type(*column)) { case CPL_TYPE_BOOL: tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "L", depth); break; case CPL_TYPE_CHAR: tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "S", depth); break; case CPL_TYPE_UCHAR: tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "B", depth); break; case CPL_TYPE_SHORT: tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "I", depth); break; case CPL_TYPE_INT: tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "J", depth); break; default: tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "K", depth); break; } nb[i] = depth; } else { cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } break; case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: if (depth > 0) { tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "E", depth); nb[i] = depth; } else { cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } break; case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: if (depth > 0) { tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "D", depth); nb[i] = depth; } else { cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } break; case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: if (depth > 0) { tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "C", depth); nb[i] = 2 * depth; } else { cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } break; case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: if (depth > 0) { tform[i] = cpl_sprintf("%" CPL_SIZE_FORMAT "M", depth); nb[i] = 2 * depth; } else { cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } break; default: fits_delete_file(outfile, &status); if (status) { fits_get_errstatus(status, err_text); } cpl_free(nb); for (i = 0; i < nc; i++) cpl_free((void*)tform[i]); cpl_free((void*)tform); return cpl_error_set_message_(CPL_ERROR_UNSPECIFIED, "CFITSIO: %s", err_text); } bwidth += nb[i]; } /* fits_create_tbl() (v.3.330) is missing const modifiers, but the character arrays are _not_ modified. :-(((((((((( */ if (cpl_errorstate_is_equal(prestate)) { fits_create_tbl(outfile, BINARY_TBL, nr, nc, (char**)ttype, (char**)tform, (char**)tunit, NULL, &status); } for (i = 0; i < nc; i++) cpl_free((void*)tform[i]); cpl_free((void*)tform); cpl_free((void*)ttype); cpl_free((void*)tunit); if (!cpl_errorstate_is_equal(prestate)) return cpl_error_set_where_(); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Determine column properties for each column (null value, dimensions, * etc.). * * In order to use a single array for the null values of all types * of integer columns, it is created for the largest supported integer * type and the values are cast to the correct type as needed. */ nval = cpl_calloc(nc, sizeof(long long)); found = cpl_calloc(nc, sizeof(int)); column = table->columns; for (i = 0; i < nc; i++, column++) { cpl_type column_type = cpl_column_get_type(*column); depth = cpl_table_get_column_depth(table, cpl_column_get_name(*column)); /* * Determine the NULL value (if any). The TNULLi keyword * can be used just for integer type columns. The following * code checks that the caller sets the NULL column * elements to a special value. If this was not done, then * no TNULLi keyword will be generated, and the NULL column * elements may contain garbage. */ switch (column_type) { case CPL_TYPE_INT: if (cpl_column_has_invalid(*column)) { idata = cpl_column_get_data_int(*column); ndata = cpl_column_get_data_invalid(*column); if (ndata == NULL) { for (j = 0; j < nr; j++) { if (found[i]) { if (nval[i] != idata[j]) { found[i] = 0; break; } } else { found[i] = 1; nval[i] = idata[j]; } } } else { for (j = 0; j < nr; j++) { if (ndata[j]) { if (found[i]) { if (nval[i] != idata[j]) { found[i] = 0; break; } } else { found[i] = 1; nval[i] = idata[j]; } } } } } /* * Write the appropriate TNULLi keyword to header if necessary */ if (found[i]) { int inval = (int)nval[i]; sprintf(tnull, "TNULL%d", i + 1); fits_write_key(outfile, TINT, tnull, &inval, NULL, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } break; case CPL_TYPE_LONG_LONG: if (cpl_column_has_invalid(*column)) { lldata = cpl_column_get_data_long_long(*column); ndata = cpl_column_get_data_invalid(*column); if (ndata == NULL) { for (j = 0; j < nr; j++) { if (found[i]) { if (nval[i] != lldata[j]) { found[i] = 0; break; } } else { found[i] = 1; nval[i] = lldata[j]; } } } else { for (j = 0; j < nr; j++) { if (ndata[j]) { if (found[i]) { if (nval[i] != lldata[j]) { found[i] = 0; break; } } else { found[i] = 1; nval[i] = lldata[j]; } } } } } /* * Write the appropriate TNULLi keyword to header if necessary */ if (found[i]) { long long llnval = nval[i]; /* for consistency only! */ sprintf(tnull, "TNULL%d", i + 1); fits_write_key(outfile, TLONGLONG, tnull, &llnval, NULL, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } break; case CPL_TYPE_INT | CPL_TYPE_POINTER: arrays = cpl_column_get_data_array(*column); for (j = 0; j < nr; j++) { if (arrays[j] == NULL) { arrays[j] = cpl_array_new(depth, CPL_TYPE_INT); } acolumn = cpl_array_get_column(arrays[j]); if (cpl_column_has_invalid(acolumn) == 1) { idata = cpl_column_get_data_int(acolumn); ndata = cpl_column_get_data_invalid(acolumn); if (ndata == NULL) { for (z = 0; z < depth; z++) { if (found[i]) { if (nval[i] != idata[z]) { found[i] = 0; break; } } else { found[i] = 1; nval[i] = idata[z]; } } } else { for (z = 0; z < depth; z++) { if (ndata[z]) { if (found[i]) { if (nval[i] != idata[z]) { found[i] = 0; break; } } else { found[i] = 1; nval[i] = idata[z]; } } } } } } /* * Write the appropriate TNULLi keyword to header if necessary */ if (found[i]) { int inval = (int)nval[i]; sprintf(tnull, "TNULL%d", i + 1); fits_write_key(outfile, TINT, tnull, &inval, NULL, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } break; case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: arrays = cpl_column_get_data_array(*column); for (j = 0; j < nr; j++) { if (arrays[j] == NULL) { arrays[j] = cpl_array_new(depth, CPL_TYPE_LONG_LONG); } acolumn = cpl_array_get_column(arrays[j]); if (cpl_column_has_invalid(acolumn) == 1) { lldata = cpl_column_get_data_long_long(acolumn); ndata = cpl_column_get_data_invalid(acolumn); if (ndata == NULL) { for (z = 0; z < depth; z++) { if (found[i]) { if (nval[i] != lldata[z]) { found[i] = 0; break; } } else { found[i] = 1; nval[i] = lldata[z]; } } } else { for (z = 0; z < depth; z++) { if (ndata[z]) { if (found[i]) { if (nval[i] != lldata[z]) { found[i] = 0; break; } } else { found[i] = 1; nval[i] = lldata[z]; } } } } } } /* * Write the appropriate TNULLi keyword to header if necessary */ if (found[i]) { long long llnval = nval[i]; /* for consistency only! */ sprintf(tnull, "TNULL%d", i + 1); fits_write_key(outfile, TLONGLONG, tnull, &llnval, NULL, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } break; default: break; } /* * Determine TDIM if the current column is an array column. */ if (column_type & CPL_TYPE_POINTER) { switch (column_type) { case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: dimensions = cpl_column_get_dimensions(*column); if (dimensions > 1) { cpl_size *naxes = cpl_malloc(dimensions * sizeof(cpl_size)); for (z = 0; z < dimensions; z++) naxes[z] = cpl_column_get_dimension(*column, z); /* * Note the cast to int, to prevent compiler warnings. * Naturally "dimensions" is a size, so it should be * of type cpl_size. However in cfitsio is int. */ { /*FIXME: debug purpose only. * Compatibility with cpl_size = int. */ LONGLONG *longnaxes = cpl_malloc(dimensions * sizeof(LONGLONG)); int t; for (t = 0; t < dimensions; t++) { longnaxes[t] = (LONGLONG)naxes[t]; } fits_write_tdimll(outfile, i + 1, (int)dimensions, longnaxes, &status); cpl_free(longnaxes); } if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } cpl_free(naxes); } break; /* New part */ case CPL_TYPE_STRING | CPL_TYPE_POINTER: /* * In the TDIM keyword will have to be written the total number * of characters for each string field, field_size, and the * number of fields for one table element, depth. */ { cpl_size *naxes = cpl_malloc(2 * sizeof(cpl_size)); naxes[0] = field_size; naxes[1] = depth; { /*FIXME: debug purpose only. * Compatibility with cpl_size = int. */ LONGLONG *longnaxes = cpl_malloc(2 * sizeof(LONGLONG)); int t; for (t = 0; t < 2; t++) { longnaxes[t] = (LONGLONG)naxes[t]; } fits_write_tdimll(outfile, i + 1, 2, longnaxes, &status); cpl_free(longnaxes); } cpl_free(naxes); } break; /* End new part */ default: break; /* Nothing to do for other types... */ } } } if (header) { /* * Complete secondary header with property list information */ if (cpl_fits_add_properties(outfile, header, "^(" ERASE_WCS_REGEXP ")$|" CPL_FITS_BADKEYS_EXT "|" CPL_FITS_COMPRKEYS) != CPL_ERROR_NONE) { fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } /* * Finally prepare the data section. */ /* * Get the max ideal number of rows to process at a time */ fits_get_rowsize(outfile, &optimal_nrows, &status); if (status) { status = 0; chunk = nr; } else { chunk = (int)optimal_nrows; /* Note, this cast is really BAD */ if (chunk > nr) chunk = nr; } spell = chunk; for (k = 0; k < nr; k += chunk) { if (chunk > nr - k) { spell = nr - k; } column = table->columns; for (i = 0; i < nc; i++, column++) { depth = cpl_table_get_column_depth(table, cpl_column_get_name(*column)); switch (cpl_column_get_type(*column)) { case CPL_TYPE_STRING: sdata = cpl_column_get_data_string_const(*column); sdata += k; /* * If there are NULL strings, assign a zero-length string * or a call to strcmp() in fits_write_colnull() would segfault. */ nstring = ""; for (j = 0; j < spell; j++) if (sdata[j] == NULL) sdata[j] = nstring; /* fits_write_colnull() (v.3.330) is missing const modifiers, but the character arrays are _not_ modified. */ fits_write_colnull(outfile, TSTRING, i + 1, k + 1, 1, spell, (void*)sdata, (void*)nstring, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Restore the fake zero-length strings to a NULL pointer. * Note that this is done only if the zero-length string * is the one pointed by nstring: in this way the zero-length * strings that were already present in the table are not * leaked. */ for (j = 0; j < spell; j++) if (sdata[j] == nstring) sdata[j] = NULL; break; case CPL_TYPE_STRING | CPL_TYPE_POINTER: /* New part */ { int eccolo; int m, n; char *long_string = cpl_malloc(depth * field_size * sizeof(char)); arrays = cpl_column_get_data_array(*column); arrays += k; nstring = ""; for (z = 0; z < spell; z++) { if (arrays[z]) { sdata = cpl_array_get_data_string_const(arrays[z]); for (j = 0; j < depth; j++) { if (sdata[j] == NULL) { sdata[j] = nstring; } } } else { sdata = cpl_malloc(depth * sizeof(char *)); for (j = 0; j < depth; j++) { sdata[j] = nstring; } } for (m = 0, j = 0; j < depth; j++) { eccolo = 0; for (n = 0; n < field_size; n++, m++) { if (sdata[j][n] == '\0') { eccolo = 1; } if (eccolo) { long_string[m] = ' '; } else { long_string[m] = sdata[j][n]; } } // strncpy(long_string + j * field_size, sdata[j], field_size); } long_string[depth*field_size - 1] = '\0'; /* "Correct one" fits_write_colnull(outfile, TSTRING, i + 1, k + z + 1, 1, depth, sdata, nstring, &status); */ /* fits_write_colnull() (v.3.330) is missing const modifiers, but the arrays are _not_ modified. :-(( */ fits_write_colnull(outfile, TSTRING, i + 1, k + z + 1, 1, 1, (void *)&long_string, (void *)nstring, &status); if (arrays[z]) { for (j = 0; j < depth; j++) { if (sdata[j] == nstring) { sdata[j] = NULL; } } } else { cpl_free(sdata); } } cpl_free(long_string); } /* End new part */ break; case CPL_TYPE_INT: /* * Get the data buffer of the current column. */ idata = cpl_column_get_data_int(*column); idata += k; if (cpl_column_get_save_type(*column) == CPL_TYPE_BOOL) { bdata = cpl_malloc(spell * sizeof(char)); for (j = 0; j < spell; j++) { bdata[j] = idata[j]; } if (found[i]) { char bnval = (char)nval[i]; fits_write_colnull(outfile, TLOGICAL, i + 1, k + 1, 1, spell, bdata, &bnval, &status); } else { fits_write_col(outfile, TLOGICAL, i + 1, k + 1, 1, spell, bdata, &status); } cpl_free(bdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_CHAR) { bdata = cpl_malloc(spell * sizeof(char)); for (j = 0; j < spell; j++) { bdata[j] = idata[j]; } if (found[i]) { char bnval = (char)nval[i]; fits_write_colnull(outfile, TSBYTE, i + 1, k + 1, 1, spell, bdata, &bnval, &status); } else { fits_write_col(outfile, TSBYTE, i + 1, k + 1, 1, spell, bdata, &status); } cpl_free(bdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_UCHAR) { ubdata = cpl_malloc(spell * sizeof(unsigned char)); for (j = 0; j < spell; j++) { ubdata[j] = idata[j]; } if (found[i]) { unsigned char ubnval = (unsigned char)nval[i]; fits_write_colnull(outfile, TBYTE, i + 1, k + 1, 1, spell, ubdata, &ubnval, &status); } else { fits_write_col(outfile, TBYTE, i + 1, k + 1, 1, spell, ubdata, &status); } cpl_free(ubdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_SHORT) { sidata = cpl_malloc(spell * sizeof(short)); for (j = 0; j < spell; j++) { sidata[j] = idata[j]; } if (found[i]) { short sinval = (short)nval[i]; fits_write_colnull(outfile, TSHORT, i + 1, k + 1, 1, spell, sidata, &sinval, &status); } else { fits_write_col(outfile, TSHORT, i + 1, k + 1, 1, spell, sidata, &status); } cpl_free(sidata); } else { if (found[i]) { int inval = (int)nval[i]; fits_write_colnull(outfile, TINT, i + 1, k + 1, 1, spell, idata, &inval, &status); } else { fits_write_col(outfile, TINT, i + 1, k + 1, 1, spell, idata, &status); } } if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } break; case CPL_TYPE_LONG_LONG: /* * Get the data buffer of the current column. */ lldata = cpl_column_get_data_long_long(*column); lldata += k; if (cpl_column_get_save_type(*column) == CPL_TYPE_BOOL) { bdata = cpl_malloc(spell * sizeof(char)); for (j = 0; j < spell; j++) { bdata[j] = lldata[j]; } if (found[i]) { char bnval = (char)nval[i]; fits_write_colnull(outfile, TLOGICAL, i + 1, k + 1, 1, spell, bdata, &bnval, &status); } else { fits_write_col(outfile, TLOGICAL, i + 1, k + 1, 1, spell, bdata, &status); } cpl_free(bdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_CHAR) { bdata = cpl_malloc(spell * sizeof(char)); for (j = 0; j < spell; j++) { bdata[j] = lldata[j]; } if (found[i]) { char bnval = (char)nval[i]; fits_write_colnull(outfile, TSBYTE, i + 1, k + 1, 1, spell, bdata, &bnval, &status); } else { fits_write_col(outfile, TSBYTE, i + 1, k + 1, 1, spell, bdata, &status); } cpl_free(bdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_UCHAR) { ubdata = cpl_malloc(spell * sizeof(unsigned char)); for (j = 0; j < spell; j++) { ubdata[j] = lldata[j]; } if (found[i]) { unsigned char ubnval = (unsigned char)nval[i]; fits_write_colnull(outfile, TBYTE, i + 1, k + 1, 1, spell, ubdata, &ubnval, &status); } else { fits_write_col(outfile, TBYTE, i + 1, k + 1, 1, spell, ubdata, &status); } cpl_free(ubdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_SHORT) { sidata = cpl_malloc(spell * sizeof(short)); for (j = 0; j < spell; j++) { sidata[j] = lldata[j]; } if (found[i]) { short sinval = (short)nval[i]; fits_write_colnull(outfile, TSHORT, i + 1, k + 1, 1, spell, sidata, &sinval, &status); } else { fits_write_col(outfile, TSHORT, i + 1, k + 1, 1, spell, sidata, &status); } cpl_free(sidata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_INT) { idata = cpl_malloc(spell * sizeof(int)); for (j = 0; j < spell; j++) { idata[j] = lldata[j]; } if (found[i]) { int inval = (int)nval[i]; fits_write_colnull(outfile, TINT, i + 1, k + 1, 1, spell, idata, &inval, &status); } else { fits_write_col(outfile, TINT, i + 1, k + 1, 1, spell, idata, &status); } cpl_free(idata); } else { if (found[i]) { long long llnval = nval[i]; /* for consistency only! */ fits_write_colnull(outfile, TLONGLONG, i + 1, k + 1, 1, spell, lldata, &llnval, &status); } else { fits_write_col(outfile, TLONGLONG, i + 1, k + 1, 1, spell, lldata, &status); } } if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } break; case CPL_TYPE_FLOAT: /* * Get the data buffer of the current column. */ fdata = cpl_column_get_data_float(*column); fdata += k; if (cpl_column_has_invalid(*column)) { /* * If some invalid values are present, * get also the array with invalid flags. */ ndata = cpl_column_get_data_invalid(*column); if (ndata) { ndata += k; /* * Preliminarily fill this data section * including also the garbage (i.e., the * invalid values). */ fits_write_col(outfile, TFLOAT, i + 1, k + 1, 1, spell, fdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Finally overwrite the garbage with NaN. * The function fits_write_colnull(), that * would allow to do this operation in a single * step, is not used here because * * 1) it is based on == comparison between * floats, and * 2) it would introduce an API change, * forcing the user to specify a float * value before saving a table column. */ count = 0; for (j = 0; j < spell; j++) { if (ndata[j]) { /* * Invalid flag found. If the first of * a sequence mark its position, and * keep counting. */ if (count == 0) { fcount = k + j + 1; } count++; } else { /* * Valid element found. If it's closing * a sequence of invalid elements, dump * it to this data section and reset * counter. */ if (count) { fits_write_col_null(outfile, i + 1, fcount, 1, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } count = 0; } } } if (count) { fits_write_col_null(outfile, i + 1, fcount, 1, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, k + 1, 1, spell, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * No invalid values are present, simply copy * the whole array buffer to this data section. */ fits_write_col(outfile, TFLOAT, i + 1, k + 1, 1, spell, fdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } break; case CPL_TYPE_DOUBLE: /* * Get the data buffer of the current column. */ ddata = cpl_column_get_data_double(*column); ddata += k; if (cpl_column_has_invalid(*column)) { /* * If some invalid values are present, * get also the array with invalid flags. */ ndata = cpl_column_get_data_invalid(*column); if (ndata) { ndata += k; /* * Preliminarily fill this data section * including also the garbage (i.e., the * invalid values). */ fits_write_col(outfile, TDOUBLE, i + 1, k + 1, 1, spell, ddata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Finally overwrite the garbage with NaN. * The function fits_write_colnull(), that * would allow to do this operation in a single * step, is not used here because * * 1) it is based on == comparison between * floats, and * 2) it would introduce an API change, * forcing the user to specify a float * value before saving a table column. */ count = 0; for (j = 0; j < spell; j++) { if (ndata[j]) { /* * Invalid flag found. If the first of * a sequence mark its position, and * keep counting. */ if (count == 0) { fcount = k + j + 1; } count++; } else { /* * Valid element found. If it's closing * a sequence of invalid elements, dump * it to this data section and reset * counter. */ if (count) { fits_write_col_null(outfile, i + 1, fcount, 1, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } count = 0; } } } if (count) { fits_write_col_null(outfile, i + 1, fcount, 1, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, k + 1, 1, spell, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * No invalid values are present, simply copy * the whole array buffer to this data section. */ fits_write_col(outfile, TDOUBLE, i + 1, k + 1, 1, spell, ddata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } break; case CPL_TYPE_FLOAT_COMPLEX: /* * Get the data buffer of the current column. */ fdata = cpl_malloc(2 * spell * sizeof(float)); cfdata = cpl_column_get_data_float_complex(*column); cfdata += k; for (j = 0; j < spell; j++) { fdata[2*j] = crealf(cfdata[j]); fdata[2*j + 1] = cimagf(cfdata[j]); } if (cpl_column_has_invalid(*column)) { /* * If some invalid values are present, * get also the array with invalid flags. */ ndata = cpl_column_get_data_invalid(*column); if (ndata) { ndata += k; /* * Preliminarily fill this data section * including also the garbage (i.e., the * invalid values). */ fits_write_col(outfile, TCOMPLEX, i + 1, k + 1, 1, spell, fdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Finally overwrite the garbage with NaN. * The function fits_write_colnull(), that * would allow to do this operation in a single * step, is not used here because * * 1) it is based on == comparison between * floats, and * 2) it would introduce an API change, * forcing the user to specify a float * value before saving a table column. */ count = 0; for (j = 0; j < spell; j++) { if (ndata[j]) { /* * Invalid flag found. If the first of * a sequence, mark its position and * keep counting. */ if (count == 0) { fcount = k + j + 1; } count++; } else { /* * Valid element found. If it's closing * a sequence of invalid elements, dump * it to this data section and reset * counter. */ if (count) { fits_write_col_null(outfile, i + 1, fcount, 1, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } count = 0; } } } if (count) { fits_write_col_null(outfile, i + 1, fcount, 1, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, k + 1, 1, spell, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * No invalid values are present, simply copy * the whole array buffer to this data section. */ fits_write_col(outfile, TCOMPLEX, i + 1, k + 1, 1, spell, fdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } cpl_free(fdata); break; case CPL_TYPE_DOUBLE_COMPLEX: /* * Get the data buffer of the current column. */ ddata = cpl_malloc(2 * spell * sizeof(double)); cddata = cpl_column_get_data_double_complex(*column); cddata += k; for (j = 0; j < spell; j++) { ddata[2*j] = creal(cddata[j]); ddata[2*j + 1] = cimag(cddata[j]); } if (cpl_column_has_invalid(*column)) { /* * If some invalid values are present, * get also the array with invalid flags. */ ndata = cpl_column_get_data_invalid(*column); if (ndata) { ndata += k; /* * Preliminarily fill this data section * including also the garbage (i.e., the * invalid values). */ fits_write_col(outfile, TDBLCOMPLEX, i + 1, k + 1, 1, spell, ddata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Finally overwrite the garbage with NaN. * The function fits_write_colnull(), that * would allow to do this operation in a single * step, is not used here because * * 1) it is based on == comparison between * floats, and * 2) it would introduce an API change, * forcing the user to specify a float * value before saving a table column. */ count = 0; for (j = 0; j < spell; j++) { if (ndata[j]) { /* * Invalid flag found. If the first of * a sequence mark its position, and * keep counting. */ if (count == 0) { fcount = k + j + 1; } count++; } else { /* * Valid element found. If it's closing * a sequence of invalid elements, dump * it to this data section and reset * counter. */ if (count) { fits_write_col_null(outfile, i + 1, fcount, 1, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } count = 0; } } } if (count) { fits_write_col_null(outfile, i + 1, fcount, 1, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, k + 1, 1, spell, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * No invalid values are present, simply copy * the whole array buffer to this data section. */ fits_write_col(outfile, TDBLCOMPLEX, i + 1, k + 1, 1, spell, ddata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } cpl_free(ddata); break; case CPL_TYPE_INT | CPL_TYPE_POINTER: if(depth == 0) break; arrays = cpl_column_get_data_array(*column); arrays += k; if (cpl_column_get_save_type(*column) == CPL_TYPE_BOOL) { bdata = cpl_malloc(depth * sizeof(char)); if (found[i]) { char bnval = (char)nval[i]; for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { bdata[z] = idata[z]; } fits_write_colnull(outfile, TLOGICAL, i + 1, k + j + 1, 1, depth, bdata, &bnval, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { bdata[z] = idata[z]; } fits_write_col(outfile, TLOGICAL, i + 1, k + j + 1, 1, depth, bdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(bdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_CHAR) { bdata = cpl_malloc(depth * sizeof(char)); if (found[i]) { char bnval = (char)nval[i]; for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { bdata[z] = idata[z]; } fits_write_colnull(outfile, TSBYTE, i + 1, k + j + 1, 1, depth, bdata, &bnval, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { bdata[z] = idata[z]; } fits_write_col(outfile, TSBYTE, i + 1, k + j + 1, 1, depth, bdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(bdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_UCHAR) { ubdata = cpl_malloc(depth * sizeof(unsigned char)); if (found[i]) { unsigned char ubnval = (unsigned char)nval[i]; for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { ubdata[z] = idata[z]; } fits_write_colnull(outfile, TBYTE, i + 1, k + j + 1, 1, depth, ubdata, &ubnval, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { ubdata[z] = idata[z]; } fits_write_col(outfile, TBYTE, i + 1, k + j + 1, 1, depth, ubdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(ubdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_SHORT) { sidata = cpl_malloc(depth * sizeof(short)); if (found[i]) { short sinval = (short)nval[i]; for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { sidata[z] = idata[z]; } fits_write_colnull(outfile, TSHORT, i + 1, k + j + 1, 1, depth, sidata, &sinval, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { sidata[z] = idata[z]; } fits_write_col(outfile, TSHORT, i + 1, k + j + 1, 1, depth, sidata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(sidata); } else { if (found[i]) { int inval = (int)nval[i]; for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); fits_write_colnull(outfile, TINT, i + 1, k + j + 1, 1, depth, cpl_column_get_data_int(acolumn), &inval, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); fits_write_col(outfile, TINT, i + 1, k + j + 1, 1, depth, cpl_column_get_data_int(acolumn), &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } } break; case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: if(depth == 0) break; arrays = cpl_column_get_data_array(*column); arrays += k; if (cpl_column_get_save_type(*column) == CPL_TYPE_BOOL) { bdata = cpl_malloc(depth * sizeof(char)); if (found[i]) { char bnval = (char)nval[i]; for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); lldata = cpl_column_get_data_long_long(acolumn); for (z = 0; z < depth; z++) { bdata[z] = lldata[z]; } fits_write_colnull(outfile, TLOGICAL, i + 1, k + j + 1, 1, depth, bdata, &bnval, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); lldata = cpl_column_get_data_long_long(acolumn); for (z = 0; z < depth; z++) { bdata[z] = lldata[z]; } fits_write_col(outfile, TLOGICAL, i + 1, k + j + 1, 1, depth, bdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(bdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_CHAR) { bdata = cpl_malloc(depth * sizeof(char)); if (found[i]) { char bnval = (char)nval[i]; for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); lldata = cpl_column_get_data_long_long(acolumn); for (z = 0; z < depth; z++) { bdata[z] = lldata[z]; } fits_write_colnull(outfile, TSBYTE, i + 1, k + j + 1, 1, depth, bdata, &bnval, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); lldata = cpl_column_get_data_long_long(acolumn); for (z = 0; z < depth; z++) { bdata[z] = lldata[z]; } fits_write_col(outfile, TSBYTE, i + 1, k + j + 1, 1, depth, bdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(bdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_UCHAR) { ubdata = cpl_malloc(depth * sizeof(unsigned char)); if (found[i]) { unsigned char ubnval = (unsigned char)nval[i]; for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); lldata = cpl_column_get_data_long_long(acolumn); for (z = 0; z < depth; z++) { ubdata[z] = lldata[z]; } fits_write_colnull(outfile, TBYTE, i + 1, k + j + 1, 1, depth, ubdata, &ubnval, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); lldata = cpl_column_get_data_long_long(acolumn); for (z = 0; z < depth; z++) { ubdata[z] = lldata[z]; } fits_write_col(outfile, TBYTE, i + 1, k + j + 1, 1, depth, ubdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(ubdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_SHORT) { sidata = cpl_malloc(depth * sizeof(short)); if (found[i]) { short sinval = (short)nval[i]; for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); lldata = cpl_column_get_data_long_long(acolumn); for (z = 0; z < depth; z++) { sidata[z] = lldata[z]; } fits_write_colnull(outfile, TSHORT, i + 1, k + j + 1, 1, depth, sidata, &sinval, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); lldata = cpl_column_get_data_long_long(acolumn); for (z = 0; z < depth; z++) { sidata[z] = lldata[z]; } fits_write_col(outfile, TSHORT, i + 1, k + j + 1, 1, depth, sidata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(sidata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_INT) { idata = cpl_malloc(depth * sizeof(int)); if (found[i]) { int inval = (int)nval[i]; for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); lldata = cpl_column_get_data_long_long(acolumn); for (z = 0; z < depth; z++) { idata[z] = lldata[z]; } fits_write_colnull(outfile, TINT, i + 1, k + j + 1, 1, depth, idata, &inval, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); lldata = cpl_column_get_data_long_long(acolumn); for (z = 0; z < depth; z++) { idata[z] = lldata[z]; } fits_write_col(outfile, TINT, i + 1, k + j + 1, 1, depth, idata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(idata); } else { if (found[i]) { long long llnval = nval[i]; /* for consistency only! */ for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); fits_write_colnull(outfile, TLONGLONG, i + 1, k + j + 1, 1, depth, cpl_column_get_data_long_long(acolumn), &llnval, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < spell; j++) { acolumn = cpl_array_get_column(arrays[j]); fits_write_col(outfile, TLONGLONG, i + 1, k + j + 1, 1, depth, cpl_column_get_data_long_long(acolumn), &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } } break; case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: if (depth == 0) break; arrays = cpl_column_get_data_array(*column); arrays += k; for (j = 0; j < spell; j++) { if (arrays[j]) { /* * Get the data buffer of the current array. */ acolumn = cpl_array_get_column(arrays[j]); fdata = cpl_column_get_data_float(acolumn); if (cpl_column_has_invalid(acolumn)) { /* * If some invalid values are present, * get also the array with invalid flags. */ ndata = cpl_column_get_data_invalid(acolumn); if (ndata) { /* * Preliminarily fill this data section * including also the garbage (i.e., the * invalid values). */ fits_write_col(outfile, TFLOAT, i + 1, k + j + 1, 1, depth, fdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Finally overwrite the garbage with NaN. * The function fits_write_colnull(), that * would allow to do this operation in a single * step, is not used here because * * 1) it is based on == comparison between * floats, and * 2) it would introduce an API change, * forcing the user to specify a float * value before saving a table column. */ count = 0; for (z = 0; z < depth; z++) { if (ndata[z]) { /* * Invalid flag found. If the first of * a sequence mark its position, and * keep counting. */ if (count == 0) { fcount = z + 1; } count++; } else { /* * Valid element found. If it's closing * a sequence of invalid elements, dump * it to this data section and reset * counter. */ if (count) { fits_write_col_null(outfile, i + 1, k + j + 1, fcount, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } count = 0; } } } if (count) { fits_write_col_null(outfile, i + 1, k + j + 1, fcount, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, k + j + 1, 1, depth, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * No invalid values are present, simply copy * the whole array buffer to this data section. */ fits_write_col(outfile, TFLOAT, i + 1, k + j + 1, 1, depth, fdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, k + j + 1, 1, depth, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } break; case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: if (depth == 0) break; arrays = cpl_column_get_data_array(*column); arrays += k; for (j = 0; j < spell; j++) { if (arrays[j]) { /* * Get the data buffer of the current array. */ acolumn = cpl_array_get_column(arrays[j]); ddata = cpl_column_get_data_double(acolumn); if (cpl_column_has_invalid(acolumn)) { /* * If some invalid values are present, * get also the array with invalid flags. */ ndata = cpl_column_get_data_invalid(acolumn); if (ndata) { /* * Preliminarily fill this data section * including also the garbage (i.e., the * invalid values). */ fits_write_col(outfile, TDOUBLE, i + 1, k + j + 1, 1, depth, ddata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Finally overwrite the garbage with NaN. * The function fits_write_colnull(), that * would allow to do this operation in a single * step, is not used here because * * 1) it is based on == comparison between * floats, and * 2) it would introduce an API change, * forcing the user to specify a float * value before saving a table column. */ count = 0; for (z = 0; z < depth; z++) { if (ndata[z]) { /* * Invalid flag found. If the first of * a sequence mark its position, and * keep counting. */ if (count == 0) { fcount = z + 1; } count++; } else { /* * Valid element found. If it's closing * a sequence of invalid elements, dump * it to this data section and reset * counter. */ if (count) { fits_write_col_null(outfile, i + 1, k + j + 1, fcount, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } count = 0; } } } if (count) { fits_write_col_null(outfile, i + 1, k + j + 1, fcount, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, k + j + 1, 1, depth, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * No invalid values are present, simply copy * the whole array buffer to this data section. */ fits_write_col(outfile, TDOUBLE, i + 1, k + j + 1, 1, depth, ddata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, k + j + 1, 1, depth, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } break; case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: if (depth == 0) break; fdata = cpl_malloc(2 * depth * sizeof(float)); arrays = cpl_column_get_data_array(*column); arrays += k; for (j = 0; j < spell; j++) { if (arrays[j]) { /* * Get the data buffer of the current array. */ acolumn = cpl_array_get_column(arrays[j]); cfdata = cpl_column_get_data_float_complex(acolumn); for (z = 0; z < depth; z++) { fdata[2*z] = crealf(cfdata[z]); fdata[2*z + 1] = cimagf(cfdata[z]); } if (cpl_column_has_invalid(acolumn)) { /* * If some invalid values are present, * get also the array with invalid flags. */ ndata = cpl_column_get_data_invalid(acolumn); if (ndata) { /* * Preliminarily fill this data section * including also the garbage (i.e., the * invalid values). */ fits_write_col(outfile, TCOMPLEX, i + 1, k + j + 1, 1, depth, fdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Finally overwrite the garbage with NaN. * The function fits_write_colnull(), that * would allow to do this operation in a single * step, is not used here because * * 1) it is based on == comparison between * floats, and * 2) it would introduce an API change, * forcing the user to specify a float * value before saving a table column. */ count = 0; for (z = 0; z < depth; z++) { if (ndata[z]) { /* * Invalid flag found. If the first of * a sequence mark its position, and * keep counting. */ if (count == 0) { fcount = z + 1; } count++; } else { /* * Valid element found. If it's closing * a sequence of invalid elements, dump * it to this data section and reset * counter. */ if (count) { fits_write_col_null(outfile, i + 1, k + j + 1, fcount, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } count = 0; } } } if (count) { fits_write_col_null(outfile, i + 1, k + j + 1, fcount, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, k + j + 1, 1, depth, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * No invalid values are present, simply copy * the whole array buffer to this data section. */ fits_write_col(outfile, TCOMPLEX, i + 1, k + j + 1, 1, depth, fdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, k + j + 1, 1, depth, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(fdata); break; case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: if (depth == 0) break; ddata = cpl_malloc(2 * depth * sizeof(double)); arrays = cpl_column_get_data_array(*column); arrays += k; for (j = 0; j < spell; j++) { if (arrays[j]) { /* * Get the data buffer of the current array. */ acolumn = cpl_array_get_column(arrays[j]); cddata = cpl_column_get_data_double_complex(acolumn); for (z = 0; z < depth; z++) { ddata[2*z] = creal(cddata[z]); ddata[2*z + 1] = cimag(cddata[z]); } if (cpl_column_has_invalid(acolumn)) { /* * If some invalid values are present, * get also the array with invalid flags. */ ndata = cpl_column_get_data_invalid(acolumn); if (ndata) { /* * Preliminarily fill this data section * including also the garbage (i.e., the * invalid values). */ fits_write_col(outfile, TDBLCOMPLEX, i + 1, k + j + 1, 1, depth, ddata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Finally overwrite the garbage with NaN. * The function fits_write_colnull(), that * would allow to do this operation in a single * step, is not used here because * * 1) it is based on == comparison between * floats, and * 2) it would introduce an API change, * forcing the user to specify a float * value before saving a table column. */ count = 0; for (z = 0; z < depth; z++) { if (ndata[z]) { /* * Invalid flag found. If the first of * a sequence mark its position, and * keep counting. */ if (count == 0) { fcount = z + 1; } count++; } else { /* * Valid element found. If it's closing * a sequence of invalid elements, dump * it to this data section and reset * counter. */ if (count) { fits_write_col_null(outfile, i + 1, k + j + 1, fcount, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } count = 0; } } } if (count) { fits_write_col_null(outfile, i + 1, k + j + 1, fcount, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, k + j + 1, 1, depth, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * No invalid values are present, simply copy * the whole array buffer to this data section. */ fits_write_col(outfile, TDBLCOMPLEX, i + 1, k + j + 1, 1, depth, ddata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, k + j + 1, 1, depth, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(ddata); break; default: break; /* Should never get here... */ } } } cpl_free(nval); cpl_free(found); cpl_free(nb); /* * Overwrite the date of creation to the primary array. * The "DATE" record was already written, for reserving * that position in header and not having "DATE" as the * last record in header (DFS04595), but that wouldn't * be exactly the creation date. */ fits_movabs_hdu(outfile, 1, NULL, &status); fits_write_date(outfile, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } cpl_io_fits_close_file(outfile, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } return CPL_ERROR_NONE; } #ifdef CPL_TABLE_USE_OLD_SAVE cpl_error_code cpl_table_save_old(const cpl_table *table, const cpl_propertylist *pheader, const cpl_propertylist *header, const char *filename, unsigned mode) { int depth; int dimensions; cpl_array **arrays; cpl_column *acolumn; cpl_column **column; fitsfile *outfile; int nc = cpl_table_get_ncol(table); int nr = cpl_table_get_nrow(table); int bwidth, field_size; int i, j, z; int *found; int *nb; int count; int fcount = 0; int *nval; int *idata; float *fdata; double *ddata; const char **sdata; cpl_column_flag *ndata; const char *nstring; char *sval; char *bdata; unsigned char *ubdata; const char **tunit; const char **ttype; const char **tform; char tnull[FLEN_KEYWORD]; char err_text[FLEN_STATUS]; int status = 0; err_text[0] = '\0'; if (table == 0x0 || filename == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (mode & CPL_IO_EXTEND) { /* * The file must exist, and must be writable. */ if (access(filename, F_OK)) return cpl_error_set_(CPL_ERROR_FILE_NOT_FOUND); if (access(filename, W_OK)) return cpl_error_set_(CPL_ERROR_FILE_NOT_CREATED); if (cpl_io_fits_open_diskfile(&outfile, filename, READWRITE, &status)) { fits_get_errstatus(status, err_text); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } else { /* * If the file exists, it must be (over)writable. */ if (!access(filename, F_OK)) { if (access(filename, W_OK)) { return cpl_error_set_(CPL_ERROR_FILE_NOT_CREATED); } /* DFS04866 else { cpl_io_fits_open_diskfile(&outfile, filename, READWRITE, &status); if (status == 0) { fits_delete_file(outfile, &status); if (status) { fits_get_errstatus(status, err_text); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } status = 0; } */ } sval = cpl_sprintf("!%s", filename); cpl_io_fits_create_file(&outfile, sval, &status); cpl_free(sval); if (status) { fits_get_errstatus(status, err_text); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } if (pheader) { /* * Write property list to primary FITS header */ if (fits_create_img(outfile, SHORT_IMG, 0, NULL, &status)) { fits_get_errstatus(status, err_text); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } fits_write_date(outfile, &status); if (cpl_fits_add_properties(outfile, pheader, "^(" ERASE_WCS_REGEXP ")$|" CPL_FITS_BADKEYS_PRIM "|" CPL_FITS_COMPRKEYS) != CPL_ERROR_NONE) { fits_delete_file(outfile, &status); if (status) { fits_get_errstatus(status, err_text); } return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } /* * Defining the FITS table and its columns. */ /* * The table width is the sum of all column widths (in bytes). */ nb = cpl_calloc(nc, sizeof(int)); bwidth = 0; column = table->columns; ttype = cpl_calloc(nc, sizeof(char *)); tform = cpl_calloc(nc, sizeof(char *)); tunit = cpl_calloc(nc, sizeof(char *)); for (i = 0; i < nc; i++, column++) { depth = cpl_table_get_column_depth(table, cpl_column_get_name(*column)); /* * Note that strings ttype[i] and tunit[i] do not need to be * deallocated (this is done by cpl_table_delete()), while * tform[i] do. This is because of the string format (see below), * and this is why cpl_strdup() is also used below. */ ttype[i] = cpl_column_get_name(*column); tunit[i] = cpl_column_get_unit(*column); if (tunit[i] == NULL) tunit[i] = ""; switch (cpl_column_get_type(*column)) { case CPL_TYPE_INT: switch (cpl_column_get_save_type(*column)) { case CPL_TYPE_BOOL: tform[i] = cpl_strdup("1L"); break; case CPL_TYPE_CHAR: tform[i] = cpl_strdup("1S"); break; case CPL_TYPE_UCHAR: tform[i] = cpl_strdup("1B"); break; default: tform[i] = cpl_strdup("1J"); } nb[i] = 1; /* if (cpl_column_get_save_type(*column) == CPL_TYPE_BOOL) tform[i] = cpl_strdup("1L"); else tform[i] = cpl_strdup("1J"); nb[i] = 1; */ break; case CPL_TYPE_FLOAT: tform[i] = cpl_strdup("1E"); nb[i] = 1; break; case CPL_TYPE_DOUBLE: tform[i] = cpl_strdup("1D"); nb[i] = 1; break; case CPL_TYPE_STRING: /* * Determine the longest string in column. */ sdata = cpl_column_get_data_string_const(*column); field_size = 0; for (j = 0; j < nr; j++) if (sdata[j]) if ((int)strlen(sdata[j]) > field_size) field_size = strlen(sdata[j]); if (field_size == 0) field_size = 1; nb[i] = field_size; tform[i] = cpl_sprintf("%dA", field_size); break; case CPL_TYPE_STRING | CPL_TYPE_POINTER: cpl_msg_debug(cpl_func, "Unsupported type found (%s)\n", cpl_column_get_name(*column)); break; case CPL_TYPE_INT | CPL_TYPE_POINTER: if (depth > 0) { switch (cpl_column_get_save_type(*column)) { case CPL_TYPE_BOOL: tform[i] = cpl_sprintf("%dL", depth); break; case CPL_TYPE_CHAR: tform[i] = cpl_sprintf("%dS", depth); break; case CPL_TYPE_UCHAR: tform[i] = cpl_sprintf("%dB", depth); break; default: tform[i] = cpl_sprintf("%dJ", depth); } nb[i] = depth; /* tform[i] = cpl_sprintf(cpl_column_get_save_type(*column) == CPL_TYPE_BOOL ? "%dL" : "%dJ", depth); nb[i] = depth; */ } else { cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } break; case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: if (depth > 0) { tform[i] = cpl_sprintf("%dE", depth); nb[i] = depth; } else { cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } break; case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: if (depth > 0) { tform[i] = cpl_sprintf("%dD", depth); nb[i] = depth; } else { cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } break; default: fits_delete_file(outfile, &status); if (status) { fits_get_errstatus(status, err_text); } cpl_free(nb); for (i = 0; i < nc; i++) cpl_free((void*)tform[i]); cpl_free((void*)tform); return cpl_error_set_message_(CPL_ERROR_UNSPECIFIED, "CFITSIO: %s", err_text); } bwidth += nb[i]; } /* fits_create_tbl() (v.3.330) is missing const modifiers, but the character arrays are _not_ modified. :-(((((((((( */ fits_create_tbl(outfile, BINARY_TBL, nr, nc, (char**)ttype, (char**)tform, (char**)tunit, NULL, &status); for (i = 0; i < nc; i++) cpl_free((void*)tform[i]); cpl_free((void*)tform); cpl_free((void*)ttype); cpl_free((void*)tunit); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Special treatment for integer columns (null value). */ nval = cpl_calloc(nc, sizeof(int)); found = cpl_calloc(nc, sizeof(int)); column = table->columns; for (i = 0; i < nc; i++, column++) { depth = cpl_table_get_column_depth(table, cpl_column_get_name(*column)); switch (cpl_column_get_type(*column)) { case CPL_TYPE_INT: /* * Determine the NULL value (if any). The TNULLi keyword * can be used just for integer column types. The following * code is just a check that the caller sets the NULL column * elements to a special value. If this was not done, then * no TNULLi keyword will be generated, and the NULL column * elements may contain garbage. */ if (cpl_column_has_invalid(*column)) { idata = cpl_column_get_data_int(*column); ndata = cpl_column_get_data_invalid(*column); if (ndata == NULL) { for (j = 0; j < nr; j++) { if (found[i]) { if (nval[i] != idata[j]) { found[i] = 0; break; } } else { found[i] = 1; nval[i] = idata[j]; } } } else { for (j = 0; j < nr; j++) { if (ndata[j]) { if (found[i]) { if (nval[i] != idata[j]) { found[i] = 0; break; } } else { found[i] = 1; nval[i] = idata[j]; } } } } } /* * Write the appropriate TNULLi keyword to header if necessary */ if (found[i]) { sprintf(tnull, "TNULL%d", i + 1); fits_write_key(outfile, TINT, tnull, nval + i, NULL, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } break; case CPL_TYPE_INT | CPL_TYPE_POINTER: arrays = cpl_column_get_data_array(*column); for (j = 0; j < nr; j++) { if (arrays[j] == NULL) { break; } acolumn = cpl_array_get_column(arrays[j]); if (cpl_column_has_invalid(acolumn) == 1) { idata = cpl_column_get_data_int(acolumn); ndata = cpl_column_get_data_invalid(acolumn); if (ndata == NULL) { for (z = 0; z < depth; z++) { if (found[i]) { if (nval[i] != idata[z]) { found[i] = 0; break; } } else { found[i] = 1; nval[i] = idata[z]; } } } else { for (z = 0; z < depth; z++) { if (ndata[z]) { if (found[i]) { if (nval[i] != idata[z]) { found[i] = 0; break; } } else { found[i] = 1; nval[i] = idata[z]; } } } } } } /* * Write the appropriate TNULLi keyword to header if necessary */ if (found[i]) { sprintf(tnull, "TNULL%d", i + 1); fits_write_key(outfile, TINT, tnull, nval + i, NULL, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } /* * The "break" statement is intentionally missing here: * fall through the next cases, where the TDIM keyword * must be handled. */ case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: dimensions = cpl_column_get_dimensions(*column); if (dimensions > 1) { cpl_size *naxes = cpl_malloc(dimensions * sizeof(cpl_size)); for (z = 0; z < dimensions; z++) naxes[z] = cpl_column_get_dimension(*column, z); fits_write_tdimll(outfile, i + 1, dimensions, naxes, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } cpl_free(naxes); } break; default: break; /* Nothing to do for other types... */ } } if (header) { /* * Complete secondary header with property list information */ if (cpl_fits_add_properties(outfile, header, "^(" ERASE_WCS_REGEXP ")$|" CPL_FITS_BADKEYS_EXT "|" CPL_FITS_COMPRKEYS) != CPL_ERROR_NONE) { fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } /* * Finally prepare the data section. */ column = table->columns; for (i = 0; i < nc; i++, column++) { depth = cpl_table_get_column_depth(table, cpl_column_get_name(*column)); switch (cpl_column_get_type(*column)) { case CPL_TYPE_STRING: sdata = cpl_column_get_data_string_const(*column); /* * If there are NULL strings, assign a zero-length string * or a call to strcmp() in fits_write_colnull() would segfault. */ nstring = ""; for (j = 0; j < nr; j++) if (sdata[j] == NULL) sdata[j] = nstring; /* fits_write_colnull() (v.3.330) is missing const modifiers, but the character arrays are _not_ modified. :-(((((((((( */ fits_write_colnull(outfile, TSTRING, i + 1, 1, 1, nr, (void*)sdata, (void*)nstring, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Restore the fake zero-length strings to a NULL pointer. * Note that this is done only if the zero-length string * is the one pointed by nstring: in this way the zero-length * strings that were already present in the table are not * leaked. */ for (j = 0; j < nr; j++) if (sdata[j] == nstring) sdata[j] = NULL; break; case CPL_TYPE_INT: /* * Get the data buffer of the current column. */ idata = cpl_column_get_data_int(*column); if (cpl_column_get_save_type(*column) == CPL_TYPE_BOOL) { bdata = cpl_malloc(nr * sizeof(char)); for (j = 0; j < nr; j++) { bdata[j] = idata[j]; } if (found[i]) { fits_write_colnull(outfile, TLOGICAL, i + 1, 1, 1, nr, bdata, nval + i, &status); } else { fits_write_col(outfile, TLOGICAL, i + 1, 1, 1, nr, bdata, &status); } cpl_free(bdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_CHAR) { bdata = cpl_malloc(nr * sizeof(char)); for (j = 0; j < nr; j++) { bdata[j] = idata[j]; } if (found[i]) { fits_write_colnull(outfile, TSBYTE, i + 1, 1, 1, nr, bdata, nval + i, &status); } else { fits_write_col(outfile, TSBYTE, i + 1, 1, 1, nr, bdata, &status); } cpl_free(bdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_UCHAR) { ubdata = cpl_malloc(nr * sizeof(unsigned char)); for (j = 0; j < nr; j++) { ubdata[j] = idata[j]; } if (found[i]) { fits_write_colnull(outfile, TBYTE, i + 1, 1, 1, nr, ubdata, nval + i, &status); } else { fits_write_col(outfile, TBYTE, i + 1, 1, 1, nr, ubdata, &status); } cpl_free(ubdata); } else { if (found[i]) { fits_write_colnull(outfile, TINT, i + 1, 1, 1, nr, idata, nval + i, &status); } else { fits_write_col(outfile, TINT, i + 1, 1, 1, nr, idata, &status); } } if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } break; case CPL_TYPE_FLOAT: /* * Get the data buffer of the current column. */ fdata = cpl_column_get_data_float(*column); if (cpl_column_has_invalid(*column)) { /* * If some invalid values are present, * get also the array with invalid flags. */ ndata = cpl_column_get_data_invalid(*column); if (ndata) { /* * Preliminarily fill this data section * including also the garbage (i.e., the * invalid values). */ fits_write_col(outfile, TFLOAT, i + 1, 1, 1, nr, fdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Finally overwrite the garbage with NaN. * The function fits_write_colnull(), that * would allow to do this operation in a single * step, is not used here because * * 1) it is based on == comparison between * floats, and * 2) it would introduce an API change, * forcing the user to specify a float * value before saving a table column. */ count = 0; for (j = 0; j < nr; j++) { if (ndata[j]) { /* * Invalid flag found. If the first of * a sequence mark its position, and * keep counting. */ if (count == 0) { fcount = j + 1; } count++; } else { /* * Valid element found. If it's closing * a sequence of invalid elements, dump * it to this data section and reset * counter. */ if (count) { fits_write_col_null(outfile, i + 1, fcount, 1, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } count = 0; } } } if (count) { fits_write_col_null(outfile, i + 1, fcount, 1, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, 1, 1, nr, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * No invalid values are present, simply copy * the whole array buffer to this data section. */ fits_write_col(outfile, TFLOAT, i + 1, 1, 1, nr, fdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } break; case CPL_TYPE_DOUBLE: /* * Get the data buffer of the current column. */ ddata = cpl_column_get_data_double(*column); if (cpl_column_has_invalid(*column)) { /* * If some invalid values are present, * get also the array with invalid flags. */ ndata = cpl_column_get_data_invalid(*column); if (ndata) { /* * Preliminarily fill this data section * including also the garbage (i.e., the * invalid values). */ fits_write_col(outfile, TDOUBLE, i + 1, 1, 1, nr, ddata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Finally overwrite the garbage with NaN. * The function fits_write_colnull(), that * would allow to do this operation in a single * step, is not used here because * * 1) it is based on == comparison between * floats, and * 2) it would introduce an API change, * forcing the user to specify a float * value before saving a table column. */ count = 0; for (j = 0; j < nr; j++) { if (ndata[j]) { /* * Invalid flag found. If the first of * a sequence mark its position, and * keep counting. */ if (count == 0) { fcount = j + 1; } count++; } else { /* * Valid element found. If it's closing * a sequence of invalid elements, dump * it to this data section and reset * counter. */ if (count) { fits_write_col_null(outfile, i + 1, fcount, 1, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } count = 0; } } } if (count) { fits_write_col_null(outfile, i + 1, fcount, 1, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, 1, 1, nr, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * No invalid values are present, simply copy * the whole array buffer to this data section. */ fits_write_col(outfile, TDOUBLE, i + 1, 1, 1, nr, ddata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } break; case CPL_TYPE_STRING | CPL_TYPE_POINTER: break; case CPL_TYPE_INT | CPL_TYPE_POINTER: if(depth == 0) break; arrays = cpl_column_get_data_array(*column); if (cpl_column_get_save_type(*column) == CPL_TYPE_BOOL) { bdata = cpl_malloc(depth * sizeof(char)); if (found[i]) { for (j = 0; j < nr; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { bdata[z] = idata[z]; } fits_write_colnull(outfile, TLOGICAL, i + 1, j + 1, 1, depth, bdata, nval + i, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < nr; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { bdata[z] = idata[z]; } fits_write_col(outfile, TLOGICAL, i + 1, j + 1, 1, depth, bdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(bdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_CHAR) { bdata = cpl_malloc(depth * sizeof(char)); if (found[i]) { for (j = 0; j < nr; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { bdata[z] = idata[z]; } fits_write_colnull(outfile, TSBYTE, i + 1, j + 1, 1, depth, bdata, nval + i, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < nr; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { bdata[z] = idata[z]; } fits_write_col(outfile, TSBYTE, i + 1, j + 1, 1, depth, bdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(bdata); } else if (cpl_column_get_save_type(*column) == CPL_TYPE_UCHAR) { ubdata = cpl_malloc(depth * sizeof(unsigned char)); if (found[i]) { for (j = 0; j < nr; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { ubdata[z] = idata[z]; } fits_write_colnull(outfile, TBYTE, i + 1, j + 1, 1, depth, ubdata, nval + i, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < nr; j++) { acolumn = cpl_array_get_column(arrays[j]); idata = cpl_column_get_data_int(acolumn); for (z = 0; z < depth; z++) { ubdata[z] = idata[z]; } fits_write_col(outfile, TBYTE, i + 1, j + 1, 1, depth, ubdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } cpl_free(ubdata); } else { if (found[i]) { for (j = 0; j < nr; j++) { acolumn = cpl_array_get_column(arrays[j]); fits_write_colnull(outfile, TINT, i + 1, j + 1, 1, depth, cpl_column_get_data_int(acolumn), nval + i, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { for (j = 0; j < nr; j++) { acolumn = cpl_array_get_column(arrays[j]); fits_write_col(outfile, TINT, i + 1, j + 1, 1, depth, cpl_column_get_data_int(acolumn), &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } } break; case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: if (depth == 0) break; arrays = cpl_column_get_data_array(*column); for (j = 0; j < nr; j++) { if (arrays[j]) { /* * Get the data buffer of the current array. */ acolumn = cpl_array_get_column(arrays[j]); fdata = cpl_column_get_data_float(acolumn); if (cpl_column_has_invalid(acolumn)) { /* * If some invalid values are present, * get also the array with invalid flags. */ ndata = cpl_column_get_data_invalid(acolumn); if (ndata) { /* * Preliminarily fill this data section * including also the garbage (i.e., the * invalid values). */ fits_write_col(outfile, TFLOAT, i + 1, j + 1, 1, depth, fdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Finally overwrite the garbage with NaN. * The function fits_write_colnull(), that * would allow to do this operation in a single * step, is not used here because * * 1) it is based on == comparison between * floats, and * 2) it would introduce an API change, * forcing the user to specify a float * value before saving a table column. */ count = 0; for (z = 0; z < depth; z++) { if (ndata[z]) { /* * Invalid flag found. If the first of * a sequence mark its position, and * keep counting. */ if (count == 0) { fcount = z + 1; } count++; } else { /* * Valid element found. If it's closing * a sequence of invalid elements, dump * it to this data section and reset * counter. */ if (count) { fits_write_col_null(outfile, i + 1, j + 1, fcount, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } count = 0; } } } if (count) { fits_write_col_null(outfile, i + 1, j + 1, fcount, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, j + 1, 1, depth, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * No invalid values are present, simply copy * the whole array buffer to this data section. */ fits_write_col(outfile, TFLOAT, i + 1, j + 1, 1, depth, fdata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, j + 1, 1, depth, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } break; case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: if (depth == 0) break; arrays = cpl_column_get_data_array(*column); for (j = 0; j < nr; j++) { if (arrays[j]) { /* * Get the data buffer of the current array. */ acolumn = cpl_array_get_column(arrays[j]); ddata = cpl_column_get_data_double(acolumn); if (cpl_column_has_invalid(acolumn)) { /* * If some invalid values are present, * get also the array with invalid flags. */ ndata = cpl_column_get_data_invalid(acolumn); if (ndata) { /* * Preliminarily fill this data section * including also the garbage (i.e., the * invalid values). */ fits_write_col(outfile, TDOUBLE, i + 1, j + 1, 1, depth, ddata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } /* * Finally overwrite the garbage with NaN. * The function fits_write_colnull(), that * would allow to do this operation in a single * step, is not used here because * * 1) it is based on == comparison between * floats, and * 2) it would introduce an API change, * forcing the user to specify a float * value before saving a table column. */ count = 0; for (z = 0; z < depth; z++) { if (ndata[z]) { /* * Invalid flag found. If the first of * a sequence mark its position, and * keep counting. */ if (count == 0) { fcount = z + 1; } count++; } else { /* * Valid element found. If it's closing * a sequence of invalid elements, dump * it to this data section and reset * counter. */ if (count) { fits_write_col_null(outfile, i + 1, j + 1, fcount, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } count = 0; } } } if (count) { fits_write_col_null(outfile, i + 1, j + 1, fcount, count, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, j + 1, 1, depth, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * No invalid values are present, simply copy * the whole array buffer to this data section. */ fits_write_col(outfile, TDOUBLE, i + 1, j + 1, 1, depth, ddata, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } else { /* * All elements are invalid: just pad with NaN * the current data section. */ fits_write_col_null(outfile, i + 1, j + 1, 1, depth, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_ (CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } } } break; default: break; /* Should never get here... */ } } cpl_free(nval); cpl_free(found); cpl_free(nb); /* * Overwrite the date of creation to the primary array. * The "DATE" record was already written, for reserving * that position in header and not having "DATE" as the * last record in header (DFS04595), but that wouldn't * be exactly the creation date. */ fits_movabs_hdu(outfile, 1, NULL, &status); fits_write_date(outfile, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } cpl_io_fits_close_file(outfile, &status); if (status) { fits_get_errstatus(status, err_text); status = 0; fits_delete_file(outfile, &status); return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "CFITSIO: %s", err_text); } return CPL_ERROR_NONE; } #endif /**@}*/ cpl-6.4.1/cplcore/cpl_func.h.bot0000644000460300003120000000003110501543627013363 00000000000000 #endif /* CPL_FUNC_H */ cpl-6.4.1/cplcore/cpl_tools.c0000644000460300003120000006635411722725614013030 00000000000000/* $Id: cpl_tools.c,v 1.124 2012-02-27 16:12:47 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-02-27 16:12:47 $ * $Revision: 1.124 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include "cpl_propertylist_impl.h" #include "cpl_memory.h" #include "cpl_tools.h" #include "cpl_error_impl.h" #include #include #include #include #include #include #include #include /* Needed by strcmp(), strncmp(), strlen() */ #include #include "cpl_tools.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef inline #define inline /* inline */ #endif #ifndef CPL_PIX_STACK_SIZE #define CPL_PIX_STACK_SIZE 50 #endif /* Swap macros */ #define CPL_INT_SWAP(a,b) { register const cpl_size t=(a); (a)=(b); (b)=t; } #define CONCAT(a,b) a ## _ ## b #define CONCAT2X(a,b) CONCAT(a,b) /*----------------------------------------------------------------------------*/ /** @enum cpl_fits_keytype @internal @brief Possible FITS key types This enum stores all possible types for a FITS keyword. These determine the order of appearance in a header, they are a crucial point for DICB (ESO) compatibility. This classification is internal to this module. */ /*----------------------------------------------------------------------------*/ typedef enum _cpl_fits_keytype_ { cpl_fits_keytype_undef =0, cpl_fits_keytype_top =1, /* Mandatory keywords */ /* All FITS files */ cpl_fits_keytype_bitpix =2, cpl_fits_keytype_naxis =3, cpl_fits_keytype_naxis1 =11, cpl_fits_keytype_naxis2 =12, cpl_fits_keytype_naxis3 =13, cpl_fits_keytype_naxis4 =14, cpl_fits_keytype_naxisi =20, /* Random groups only */ cpl_fits_keytype_group =30, /* Extensions */ cpl_fits_keytype_pcount =31, cpl_fits_keytype_gcount =32, /* Main header */ cpl_fits_keytype_extend =33, /* Images */ cpl_fits_keytype_bscale =34, cpl_fits_keytype_bzero =35, /* Tables */ cpl_fits_keytype_tfields =36, cpl_fits_keytype_tbcoli =40, cpl_fits_keytype_tformi =41, /* Other primary keywords */ cpl_fits_keytype_primary =100, /* HIERARCH ESO keywords ordered according to DICB */ cpl_fits_keytype_hierarch_dpr =200, cpl_fits_keytype_hierarch_obs =201, cpl_fits_keytype_hierarch_tpl =202, cpl_fits_keytype_hierarch_gen =203, cpl_fits_keytype_hierarch_tel =204, cpl_fits_keytype_hierarch_ins =205, cpl_fits_keytype_hierarch_det =206, cpl_fits_keytype_hierarch_log =207, cpl_fits_keytype_hierarch_pro =208, /* Other HIERARCH keywords */ cpl_fits_keytype_hierarch =300, /* HISTORY and COMMENT */ cpl_fits_keytype_history =400, cpl_fits_keytype_comment =500, /* END */ cpl_fits_keytype_end =1000 } cpl_fits_keytype; /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static int cpl_fits_property_comparison(const cpl_property *, const cpl_property *); static cpl_fits_keytype cpl_fits_property_get_type(const char *) CPL_ATTR_PURE; /*----------------------------------------------------------------------------- Private variables -----------------------------------------------------------------------------*/ static cpl_flops flop_count = 0; /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_tools Utility functions * * This module provides various functions to apply simple operations on * data arrays (sorting, median computation). * * @par Synopsis: * @code * #include "cpl_tools.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ #define CPL_TYPE_IS_NUM #define CPL_TYPE int #define CPL_TYPE_NAME int #define CPL_TOOLS_SORT_LT(x,y) ((x) < (y)) #include "cpl_tools_body.h" #undef CPL_TYPE #undef CPL_TYPE_NAME #undef CPL_TOOLS_SORT_LT #define CPL_TYPE_IS_NUM #define CPL_TYPE long #define CPL_TYPE_NAME long #define CPL_TOOLS_SORT_LT(x,y) ((x) < (y)) #include "cpl_tools_body.h" #undef CPL_TYPE #undef CPL_TYPE_NAME #undef CPL_TOOLS_SORT_LT #define CPL_TYPE_IS_NUM #define CPL_TYPE long long #define CPL_TYPE_NAME long_long #define CPL_TOOLS_SORT_LT(x,y) ((x) < (y)) #include "cpl_tools_body.h" #undef CPL_TYPE #undef CPL_TYPE_NAME #undef CPL_TOOLS_SORT_LT #define CPL_TYPE cpl_size #define CPL_TYPE_NAME cplsize #define CPL_TOOLS_SORT_LT(x,y) ((x) < (y)) #include "cpl_tools_body.h" #undef CPL_TYPE #undef CPL_TYPE_NAME #undef CPL_TOOLS_SORT_LT #define CPL_TYPE float #define CPL_TYPE_NAME float #define CPL_TOOLS_SORT_LT(x,y) ((x) < (y)) #include "cpl_tools_body.h" #undef CPL_TYPE #undef CPL_TYPE_NAME #undef CPL_TOOLS_SORT_LT #define CPL_TYPE double #define CPL_TYPE_NAME double #define CPL_TOOLS_SORT_LT(x,y) ((x) < (y)) #include "cpl_tools_body.h" #undef CPL_TYPE #undef CPL_TYPE_NAME #undef CPL_TOOLS_SORT_LT #undef CPL_TYPE_IS_NUM #define CPL_TYPE char * #define CPL_TYPE_NAME string #define CPL_TOOLS_SORT_LT(x,y) (((x) == NULL && (y) != NULL) || \ ((x) != NULL && (y) != NULL && \ strcmp((x), (y)) < 0)) #include "cpl_tools_body.h" #undef CPL_TYPE #undef CPL_TYPE_NAME #undef CPL_TOOLS_SORT_LT /*----------------------------------------------------------------------------*/ /** @internal @brief Find the FITS BITPIX value corresponding to the given CPL type. @param type The CPL type. @return The corresponding FITS BITPIX value, or zero on error. @note The input type may have its array/pointer bit set, which is ignored. The supported types (and their corresponding BITPIX) are: CPL_TYPE_UCHAR: BYTE_IMG (8) CPL_TYPE_SHORT: SHORT_IMG (16) CPL_TYPE_USHORT: USHORT_IMG (20) CPL_TYPE_INT: LONG_IMG (32) CPL_TYPE_FLOAT: FLOAT_IMG (-32) CPL_TYPE_DOUBLE: DOUBLE_IMG (-64) Possible #_cpl_error_code_ set in this function: - CPL_ERROR_INVALID_TYPE if no BITPIX value corresponds to the type */ /*----------------------------------------------------------------------------*/ int cpl_tools_get_bpp(cpl_type type) { int bpp; /* switch on type without POINTER and ARRAY bits */ switch (type & ~CPL_TYPE_POINTER & ~CPL_TYPE_FLAG_ARRAY) { case CPL_TYPE_UCHAR: bpp = BYTE_IMG; /* 8 */ break; case CPL_TYPE_SHORT: bpp = SHORT_IMG; /* 16 */ break; case CPL_TYPE_USHORT: bpp = USHORT_IMG; /* 20 */ break; case CPL_TYPE_INT: bpp = LONG_IMG; /* 32 */ break; case CPL_TYPE_FLOAT: bpp = FLOAT_IMG; /* -32 */ break; case CPL_TYPE_DOUBLE: bpp = DOUBLE_IMG; /* -64 */ break; default: bpp = 0; (void)cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "type=0x%x", (int)type); } return bpp; } /*----------------------------------------------------------------------------*/ /** @internal @brief Determine if an integer is a power of 2. @param p Integer to check. @return The corresponding power of 2 or -1 if p is not a power of 2 */ /*----------------------------------------------------------------------------*/ cpl_size cpl_tools_is_power_of_2(cpl_size p) { cpl_size ipow = 0; cpl_size done; if (p <= 0) return -1; /* Count until 1st non-zero bit is found */ do { done = p & 1; p >>= 1; ipow++; } while (!done); /* The number is a power iff p is now zero */ return p == 0 ? ipow-1 : -1; } /*----------------------------------------------------------------------------*/ /** @internal @brief Compute x to the power of y @param x The base @param y The power @return x to the power of y @note Iff y is negative and x is zero an actual division by zero will occur Apart from a possible difference in round-off the result equals pow(x,y). */ /*----------------------------------------------------------------------------*/ double cpl_tools_ipow(double x, int y) { double result; double pow2 = x; int p = abs(y); /* Compute the result as a product of powers of 2 of x. - this method may produce (slightly) different results than pow(x,y) */ /* Handle least significant bit in p here in order to avoid an unnecessary multiplication of pow2 - which could cause an over- or underflow */ /* Also, 0^0 is 1, while any other power of 0 is 0 */ result = p & 1 ? x : 1.0; while (p >>= 1) { pow2 *= pow2; /* Process least significant bit in p */ if (p & 1) result *= pow2; } /* It is left to the caller to ensure that no division by zero occurs */ return y < 0 ? 1.0/result : result; } /*----------------------------------------------------------------------------*/ /** @internal @brief Generate a valid FITS header for saving functions @param self The fitsfile to modify @param to_add The set of keywords to add to the minimal header @param to_rm The set of keys to remove @return 1 newly allocated valid header The passed file should contain a minimal header. The propertylist is sorted (DICB) and added after the miniaml header. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if self is NULL - CPL_ERROR_ILLEGAL_INPUT if the propertylist cannot be written */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_fits_add_properties(fitsfile * self, const cpl_propertylist * to_add, const char * to_rm) { cpl_error_code error = CPL_ERROR_NONE; if (to_add != NULL) { cpl_propertylist * out; /* Failure here would indicate a bug in CPL */ cpl_ensure_code(self, CPL_ERROR_NULL_INPUT); if (to_rm != NULL) { /* Copy all but the black-listed properties */ out = cpl_propertylist_new(); if (cpl_propertylist_copy_property_regexp(out, to_add, to_rm, 1)) { error = cpl_error_set_where_(); } } else { out = cpl_propertylist_duplicate(to_add); } if (!error) { /* Sort and write the propertylist to the file */ if (cpl_propertylist_sort(out, cpl_fits_property_comparison) || cpl_propertylist_to_fitsfile(self, out, NULL)) { error = cpl_error_set_where_(); } } cpl_propertylist_delete(out); } return error; } /*----------------------------------------------------------------------------*/ /** @internal @brief Comparison function of two properties @param p1 the first property @param p2 the second property @return -1 if p1p2 This function implements the sorting of the FITS header keywords to insure DICB compliant products */ /*----------------------------------------------------------------------------*/ static int cpl_fits_property_comparison( const cpl_property * p1, const cpl_property * p2) { const char * key1; const char * key2; cpl_fits_keytype kt1, kt2; /* Get the keys */ key1 = cpl_property_get_name(p1); key2 = cpl_property_get_name(p2); /* Get the keywords types */ kt1 = cpl_fits_property_get_type(key1); kt2 = cpl_fits_property_get_type(key2); /* Compare the types */ if (kt1 > kt2) return 1; else if (kt1 < kt2) return -1; else return 0; } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the FITS keyword type @param key the keyword @return the keyword type or -1 */ /*----------------------------------------------------------------------------*/ static cpl_fits_keytype cpl_fits_property_get_type(const char * key) { cpl_fits_keytype kt; /* Check entries */ if (key == NULL) return cpl_fits_keytype_undef; kt = cpl_fits_keytype_undef; if (!strcmp(key, "SIMPLE") || !strcmp(key, "XTENSION")) kt = cpl_fits_keytype_top; else if (!strcmp(key, "END")) kt = cpl_fits_keytype_end; else if (!strcmp(key, "BITPIX")) kt = cpl_fits_keytype_bitpix; else if (!strcmp(key, "NAXIS")) kt = cpl_fits_keytype_naxis; else if (!strcmp(key, "NAXIS1")) kt = cpl_fits_keytype_naxis1; else if (!strcmp(key, "NAXIS2")) kt = cpl_fits_keytype_naxis2; else if (!strcmp(key, "NAXIS3")) kt = cpl_fits_keytype_naxis3; else if (!strcmp(key, "NAXIS4")) kt = cpl_fits_keytype_naxis4; else if (!strncmp(key, "NAXIS", 5)) kt = cpl_fits_keytype_naxisi; else if (!strcmp(key, "GROUP")) kt = cpl_fits_keytype_group; else if (!strcmp(key, "PCOUNT")) kt = cpl_fits_keytype_pcount; else if (!strcmp(key, "GCOUNT")) kt = cpl_fits_keytype_gcount; else if (!strcmp(key, "EXTEND")) kt = cpl_fits_keytype_extend; else if (!strcmp(key, "BSCALE")) kt = cpl_fits_keytype_bscale; else if (!strcmp(key, "BZERO")) kt = cpl_fits_keytype_bzero; else if (!strcmp(key, "TFIELDS")) kt = cpl_fits_keytype_tfields; else if (!strncmp(key, "TBCOL", 5)) kt = cpl_fits_keytype_tbcoli; else if (!strncmp(key, "TFORM", 5)) kt = cpl_fits_keytype_tformi; else if (!strncmp(key, "ESO DPR", 7)) kt = cpl_fits_keytype_hierarch_dpr; else if (!strncmp(key, "ESO OBS", 7)) kt = cpl_fits_keytype_hierarch_obs; else if (!strncmp(key, "ESO TPL", 7)) kt = cpl_fits_keytype_hierarch_tpl; else if (!strncmp(key, "ESO GEN", 7)) kt = cpl_fits_keytype_hierarch_gen; else if (!strncmp(key, "ESO TEL", 7)) kt = cpl_fits_keytype_hierarch_tel; else if (!strncmp(key, "ESO INS", 7)) kt = cpl_fits_keytype_hierarch_ins; else if (!strncmp(key, "ESO DET", 7)) kt = cpl_fits_keytype_hierarch_det; else if (!strncmp(key, "ESO LOG", 7)) kt = cpl_fits_keytype_hierarch_log; else if (!strncmp(key, "ESO PRO", 7)) kt = cpl_fits_keytype_hierarch_pro; else if (!strncmp(key, "ESO", 3)) kt = cpl_fits_keytype_hierarch; else if (!strcmp(key, "HISTORY")) kt = cpl_fits_keytype_history; else if (!strcmp(key, "COMMENT")) kt = cpl_fits_keytype_comment; else if ((int)strlen(key)<9) kt = cpl_fits_keytype_primary; return kt; } /*----------------------------------------------------------------------------*/ /** @internal @brief Add to the FLOPS counter. @param flops FLOPS to add @return void @note This function is intended to be used only by the CPL test modules. */ /*----------------------------------------------------------------------------*/ inline void cpl_tools_add_flops(cpl_flops flops) { #ifdef _OPENMP #pragma omp atomic #endif flop_count += flops; } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the FLOPS count. @return The FLOPS count @note This function is intended to be used only by the CPL test modules. */ /*----------------------------------------------------------------------------*/ cpl_flops cpl_tools_get_flops(void) { return flop_count; } /*----------------------------------------------------------------------------*/ /** @internal @brief Transform: xhat = x- mean(x) @param x The vector to be transformed @param pm On return, *pm is the mean of x @return The created transformed vector @note The function will cx_assert() on NULL input. */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_vector_transform_mean(const cpl_vector * x, double * pm) { cpl_vector * xhat = cpl_vector_duplicate(x); cx_assert( xhat != NULL ); cx_assert( pm != NULL ); *pm = cpl_vector_get_mean(xhat); cpl_vector_subtract_scalar(xhat, *pm); return xhat; } /*----------------------------------------------------------------------------*/ /** @internal @brief Count the number of distinct values in the vector @param self The vector to check, it will be sorted @param pndistinct The number of distinct values @return CPL_ERROR_NONE iff the check is sucessful */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_count_distinct(cpl_vector * self, cpl_size * pndistinct) { if (pndistinct == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } else if (cpl_vector_sort(self, CPL_SORT_ASCENDING)) { return cpl_error_set_where_(); } else { const double * dx = cpl_vector_get_data_const(self); double xmin = dx[0]; const cpl_size n = cpl_vector_get_size(self); cpl_size i, j; for (j = i = 1; i < n; i++) { if (dx[i] > xmin) { xmin = dx[i]; j++; } } *pndistinct = j; } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Ensure that the vector has the required number of distinct values @param self The vector to check @param ndistinct The (positive) number of distinct values to require @return CPL_ERROR_NONE iff the check is sucessful @see cpl_vector_count_distinct() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_ensure_distinct(const cpl_vector * self, cpl_size ndistinct) { if (ndistinct > 1) { const cpl_size n = cpl_vector_get_size(self); if (n < 1) { return cpl_error_set_where_(); } else if (ndistinct > n) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "A %" CPL_SIZE_FORMAT "-element " "vector cannot have at least %" CPL_SIZE_FORMAT " distinct values", n, ndistinct); } else { cpl_vector * tmp = cpl_vector_duplicate(self); cpl_size idistinct = 0; (void)cpl_vector_count_distinct(tmp, &idistinct); cpl_vector_delete(tmp); if (idistinct < ndistinct) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%" CPL_SIZE_FORMAT "-element vector " "must have at least %" CPL_SIZE_FORMAT " (not %" CPL_SIZE_FORMAT ") distinct " " values", n, ndistinct, idistinct); } } } else if (ndistinct < 1) { return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Copy a rectangular memory area from one place to another @param self Preallocated location to copy to @param src Location to copy from @param size Size of each element [bytes] @param nx Number of elements in x direction in source @param ny Number of elements in y direction in source @param llx Lower left x position (starting with 1) @param lly Lower left y position (starting with 1) @param urx Upper right x position @param ury Upper right y position @return CPL_ERROR_NONE if OK, otherwise the relevant #_cpl_error_code_. @note self must have place for (urx-llx+1) * (ury-lly+1) elements of size size @see mempcy() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the window coordinates are not valid */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_tools_copy_window(void *self, const void *src, size_t size, cpl_size nx, cpl_size ny, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { /* FIXME: Need to do pointer arithmetic */ const char * csrc = (const char*)src; cpl_ensure_code(self, CPL_ERROR_NULL_INPUT); cpl_ensure_code(src, CPL_ERROR_NULL_INPUT); cpl_ensure_code(size != 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(llx <= urx, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(lly > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(lly <= ury, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(ury <= ny, CPL_ERROR_ILLEGAL_INPUT); /* assert(sizeof(char) == 1); */ if (llx == 1 && urx == nx) { /* Number of bytes in one row of self */ const size_t rowsize = size * (size_t)nx; (void)memcpy(self, csrc + rowsize * (size_t)(lly-1), rowsize * (size_t)(ury-lly+1)); } else { /* FIXME: Need to do pointer arithmetic */ char * cself = (char*)self; /* Number of bytes in one row of self */ const size_t rowsize = size * (size_t)(urx-llx+1); /* Byte just after last byte to write to self */ const char * cstop = cself + rowsize * (size_t)(ury-lly+1); cpl_ensure_code(llx > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(urx <= nx, CPL_ERROR_ILLEGAL_INPUT); /* Point to first byte to read */ csrc += size * (size_t)((llx - 1) + (lly-1) * nx); for (; cself < cstop; cself += rowsize, csrc += size * (size_t)nx) { (void)memcpy(cself, csrc, rowsize); } } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Shift a rectangular memory area @param self Location of 1st element @param size Size of each element [bytes] @param nx Number of elements in x direction in source @param ny Number of elements in y direction in source @param null Value to insert into 'empty' zone' @param dx Shift in X @param dy Shift in Y @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_mask_shift() The 'empty zone' in the shifted rectangle is filled with size null's. The shift values have to be valid: -nx < x_shift < nx and -ny < y_shift < ny Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if in is NULL - CPL_ERROR_ILLEGAL_INPUT if the offsets are too big, or size is zero, or nx or ny non-positive */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_tools_shift_window(void * self, size_t size, cpl_size nx, cpl_size ny, int null, cpl_size dx, cpl_size dy) { /* Need to do pointer arithmetic */ char * myself = (char*)self; /* Number of elements to be set to null */ const size_t sset = (size_t)(labs((long int)dy) * nx) * size; /* Remainder of buffer will be moved */ const size_t smove = (size_t)(ny * nx) * size - sset; char * pdest = dy < 0 ? myself : myself + sset; char * psrc = dy > 0 ? myself : myself + sset; /* const */ char * pset = dy > 0 ? myself : myself + smove; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(size > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(nx > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(ny > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code( dx < nx, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(-dx < nx, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code( dy < ny, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(-dy < ny, CPL_ERROR_ILLEGAL_INPUT); if (dx != 0) { /* Have to shift one row at a time */ /* Size of a row */ const size_t rsize = (size_t)nx * size; /* Number of elements to be set to null */ const size_t srset = (size_t)labs((long int)dx) * size; /* Remainder of buffer will be moved */ const size_t srmove = rsize - srset; char * prdest = dx < 0 ? pdest : pdest + srset; char * prsrc = dx > 0 ? psrc : psrc + srset; char * prset = dx > 0 ? pdest : pdest + srmove; /* source and dest overlap when dy is zero */ void * (*myshift)(void *, const void *, size_t) = dy ? memcpy : memmove; cpl_size j; if (dy <= 0) { for (j = -dy; j < ny; j++, prdest += rsize, prsrc += rsize, prset += rsize) { (void)myshift(prdest, prsrc, srmove); (void)memset(prset, null, srset); } } else { /* With a positive dy the rows must be shifted in reverse order */ prdest += smove - rsize; prsrc += smove - rsize; prset += smove - rsize; for (j = dy; j < ny; j++, prdest -= rsize, prsrc -= rsize, prset -= rsize) { (void)memcpy(prdest, prsrc, srmove); (void)memset(prset, null, srset); } } } else if (dy != 0) { /* Shift all rows at once */ (void)memmove(pdest, psrc, smove); } /* Set all of the 'empty' rows */ if (dy != 0) (void)memset(pset, null, sset); return CPL_ERROR_NONE; } /**@}*/ cpl-6.4.1/cplcore/cpl_xmemory.c0000644000460300003120000007325212051141414013345 00000000000000/* $Id: cpl_xmemory.c,v 1.43 2012-11-15 10:25:16 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-11-15 10:25:16 $ * $Revision: 1.43 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include "cpl_xmemory.h" /* The below doxygen has been inactivated by removing the '**' comment. */ /*----------------------------------------------------------------------------*/ /* * @defgroup cpl_xmemory POSIX-compatible extended memory handling * * cpl_xmemory is a small and efficient module offering memory extension * capabitilies to ANSI C programs running on POSIX-compliant systems. It * offers several useful features such as memory leak detection, protection for * free on NULL or unallocated pointers. * This module has been tested on a number of * current Unix * flavours and is reported to work fine. * The current limitation is the limited number of pointers it can handle at * the same time - and its absence of thread-safety. * */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef inline #define inline /* inline */ #endif #define CPL_XSTRINGIFY(TOSTRING) #TOSTRING #define CPL_STRINGIFY(TOSTRING) CPL_XSTRINGIFY(TOSTRING) /* This symbol defines the level of usage of the memory module. 0 Use the memory system calls. 1 Use the memory system calls, but abort() if they are not succesfull 2 Fully use the memory functions */ /* Initial number of entries in memory table */ /* If this number is big, the size of the memory table can become problematic. */ /* Use a prime number to reduce risk of hashing clashes */ #ifndef CPL_XMEMORY_MAXPTRS #error "CPL_XMEMORY_MAXPTRS is not defined" #endif #if CPL_XMEMORY_MAXPTRS <= 0 #error "CPL_XMEMORY_MAXPTRS must be positive" #endif #ifndef CPL_XMEMORY_RESIZE_THRESHOLD #define CPL_XMEMORY_RESIZE_THRESHOLD 0.9 #endif #ifndef CPL_XMEMORY_RESIZE_FACTOR #define CPL_XMEMORY_RESIZE_FACTOR 2 #endif /* A very simple hash */ #define PTR_HASH(ptr) (((size_t)ptr) % cpl_xmemory_table_size) #define CPL_XMEMORY_TYPE_FREE 0 #define CPL_XMEMORY_TYPE_MALLOC 1 #define CPL_XMEMORY_TYPE_CALLOC 2 #define CPL_XMEMORY_TYPE_REALLOC 3 /*----------------------------------------------------------------------------- Private variables -----------------------------------------------------------------------------*/ static const char * cpl_xmemory_type[] = {"free", "malloc", "calloc", "realloc"}; /* Number of active cells */ static size_t cpl_xmemory_ncells = 0; /* Peak number of pointers ever seen for diagnostics */ static size_t cpl_xmemory_max_cells = 0; /* Total allocated RAM in bytes */ static size_t cpl_xmemory_alloc_ram = 0; /* Peak allocation ever seen for diagnostics */ static size_t cpl_xmemory_alloc_max = 0; /* The current size of the xmemory table */ static size_t cpl_xmemory_table_size = 0; /* The default size of the xmemory table, when it is non-empty */ static size_t cpl_xmemory_table_size_max = 0; static int cpl_xmemory_fatal = 0; /* Various infos about the pointers */ /* List of pointers */ static const void ** cpl_xmemory_p_val; /* Type of allocation */ /* - CPL_XMEMORY_TYPE_FREE means no allocation */ static unsigned char * cpl_xmemory_p_type; /* Size of allocated memory [bytes] */ static size_t * cpl_xmemory_p_size; /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_xmemory_init(void); static void cpl_xmemory_init_alloc(void); static void cpl_xmemory_end(void); static void cpl_xmemory_resize(void); static void cpl_xmemory_addcell(size_t, const void *, size_t, unsigned char); static void cpl_xmemory_remcell(size_t); static size_t cpl_xmemory_findcell(const void *) CPL_ATTR_PURE; static size_t cpl_xmemory_findfree(const void *); /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @internal @brief malloc() with failure check @param size Size (in bytes) to allocate. @return 1 newly allocated pointer (possibly NULL on zero bytes) @note Will abort() on failure */ /*----------------------------------------------------------------------------*/ inline void * cpl_xmemory_malloc_count(size_t size) { void * ptr = malloc(size); if (ptr != NULL) { # ifdef _OPENMP # pragma omp atomic # endif cpl_xmemory_ncells++; /* Remember peak allocation */ /* FIXME: This non-thread-safe check is incorrect, but might still produce a useful estimate */ if (cpl_xmemory_ncells > cpl_xmemory_max_cells) cpl_xmemory_max_cells = cpl_xmemory_ncells; } else if (size != 0) { fprintf(stderr, "cpl_xmemory fatal error: malloc(%zu) returned NULL:\n", size); perror(NULL); cpl_xmemory_fatal = 1; cpl_xmemory_status(cpl_xmemory_table_size ? 2 : 1); assert(ptr != NULL); /* More informative, if enabled */ abort(); } return ptr; } /*----------------------------------------------------------------------------*/ /** @internal @brief calloc() with failure check @param nmemb Number of elements to allocate. @param size Size (in bytes) to allocate. @return 1 newly allocated pointer (possibly NULL on zero bytes) @note Will abort() on failure */ /*----------------------------------------------------------------------------*/ inline void * cpl_xmemory_calloc_count(size_t nmemb, size_t size) { void * ptr = calloc(nmemb, size); if (ptr != NULL) { # ifdef _OPENMP # pragma omp atomic # endif cpl_xmemory_ncells++; /* Remember peak allocation */ /* FIXME: This non-thread-safe check is incorrect, but might still produce a useful estimate */ if (cpl_xmemory_ncells > cpl_xmemory_max_cells) cpl_xmemory_max_cells = cpl_xmemory_ncells; } else if (size != 0 && nmemb != 0) { fprintf(stderr, "cpl_xmemory fatal error: calloc(%zu, %zu) returned " "NULL:\n", nmemb, size); perror(NULL); cpl_xmemory_fatal = 1; cpl_xmemory_status(cpl_xmemory_table_size ? 2 : 1); assert(ptr != NULL); /* More informative, if enabled */ abort(); } return ptr; } /*----------------------------------------------------------------------------*/ /** @internal @brief realloc() with failure check @param oldptr Pointer to reallocate. @param size Size (in bytes) to reallocate. @return 1 newly allocated pointer (possibly NULL on zero bytes) @note Will abort() on failure */ /*----------------------------------------------------------------------------*/ inline void * cpl_xmemory_realloc_count(void * oldptr, size_t size) { void * ptr; if (oldptr == NULL) { /* This is just another way to do a malloc() */ ptr = cpl_xmemory_malloc_count(size); } else if (cpl_xmemory_ncells == 0) { fprintf(stderr, "cpl_xmemory error: Ignoring realloc() to %zu bytes on " "unallocated pointer (%p)\n", size, oldptr); ptr = NULL; } else { /* assert( oldptr != NULL ); */ ptr = realloc(oldptr, size); if (ptr == NULL) { if (size != 0) { fprintf(stderr, "cpl_xmemory fatal error: realloc(%p, %zu) " "returned NULL:\n", oldptr, size); perror(NULL); cpl_xmemory_fatal = 1; cpl_xmemory_status(cpl_xmemory_table_size ? 2 : 1); assert(ptr != NULL); /* More informative, if enabled */ abort(); } /* This is just another way to do a free() */ # ifdef _OPENMP # pragma omp atomic # endif cpl_xmemory_ncells--; } } return ptr; } /*----------------------------------------------------------------------------*/ /** @internal @brief Free memory. @param ptr Pointer to free. @return void @see free() */ /*----------------------------------------------------------------------------*/ void cpl_xmemory_free_count(void * ptr) { if (ptr != NULL) { if (cpl_xmemory_ncells == 0) { fprintf(stderr, "cpl_xmemory error: Ignoring free() on " "unallocated pointer (%p)\n", ptr); } else { free(ptr); # ifdef _OPENMP # pragma omp atomic # endif cpl_xmemory_ncells--; } } return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Allocate memory. @param size Size (in bytes) to allocate. @return 1 newly allocated pointer. */ /*----------------------------------------------------------------------------*/ void * cpl_xmemory_malloc(size_t size) { void * ptr; size_t pos; if (size == 0) { /* In this case it is allowed to return NULL - do that and save space in the table */ return NULL; } ptr = cpl_xmemory_malloc_count(size); if (cpl_xmemory_ncells >= cpl_xmemory_table_size * CPL_XMEMORY_RESIZE_THRESHOLD) { /* Initialize table if needed */ if (cpl_xmemory_table_size == 0) { cpl_xmemory_init(); } /* Memory table is too full, resize */ cpl_xmemory_resize(); } /* Add cell into general table */ pos = cpl_xmemory_findfree(ptr); cpl_xmemory_addcell(pos, ptr, size, CPL_XMEMORY_TYPE_MALLOC); return ptr; } /*----------------------------------------------------------------------------*/ /** @internal @brief Allocate memory. @param nmemb Number of elements to allocate. @param size Size (in bytes) of each element. @return 1 newly allocated pointer. */ /*----------------------------------------------------------------------------*/ void * cpl_xmemory_calloc(size_t nmemb, size_t size) { void * ptr; size_t pos; if (size == 0 || nmemb == 0) { /* In this case it is allowed to return NULL - do that and save space in the table */ return NULL; } ptr = cpl_xmemory_calloc_count(nmemb, size); if (cpl_xmemory_ncells >= cpl_xmemory_table_size * CPL_XMEMORY_RESIZE_THRESHOLD) { /* Initialize table if needed */ if (cpl_xmemory_table_size == 0) { cpl_xmemory_init(); } /* Memory table is too full, resize */ cpl_xmemory_resize(); } /* Add cell into general table */ pos = cpl_xmemory_findfree(ptr); cpl_xmemory_addcell(pos, ptr, nmemb * size, CPL_XMEMORY_TYPE_CALLOC); return ptr; } /*----------------------------------------------------------------------------*/ /** @internal @brief Re-Allocate memory. @param oldptr Pointer to free. @param size Size (in bytes) to allocate. @return 1 newly allocated pointer. */ /*----------------------------------------------------------------------------*/ void * cpl_xmemory_realloc(void * oldptr, size_t size) { void * ptr; size_t pos = cpl_xmemory_table_size; /* Avoid (false) uninit warning */ if (size == 0) { /* In this case it is allowed to return NULL - do that and save space in the table */ cpl_xmemory_free(oldptr); return NULL; } if (oldptr != NULL) { if (cpl_xmemory_table_size == 0) { fprintf(stderr, "cpl_xmemory error: Ignoring realloc() of %zu bytes" " requested on unallocated pointer (%p)\n", size, oldptr); return NULL; } pos = cpl_xmemory_findcell(oldptr); if (pos == cpl_xmemory_table_size) { fprintf(stderr, "cpl_xmemory error: Ignoring realloc() of %zu bytes" " requested on unallocated pointer (%p)\n", size, oldptr); return NULL; } if (size == cpl_xmemory_p_size[pos]) { /* No actual realloc() is needed, so just update the allocation type since the caller will expect the pointer to come from realloc(). */ cpl_xmemory_p_type[pos] = CPL_XMEMORY_TYPE_REALLOC; return oldptr; } /* Remove cell from main table */ cpl_xmemory_remcell(pos); } ptr = cpl_xmemory_realloc_count(oldptr, size); /* assert( ptr != NULL ); */ if (ptr != oldptr) { if (cpl_xmemory_ncells >= cpl_xmemory_table_size * CPL_XMEMORY_RESIZE_THRESHOLD) { /* Initialize table if needed */ if (cpl_xmemory_table_size == 0) { cpl_xmemory_init(); } /* Memory table is too full, resize */ cpl_xmemory_resize(); } pos = cpl_xmemory_findfree(ptr); } /* Add cell into general table */ cpl_xmemory_addcell(pos, ptr, size, CPL_XMEMORY_TYPE_REALLOC); return ptr; } /*----------------------------------------------------------------------------*/ /** @internal @brief Free memory. @param ptr Pointer to free. @return void @note Nothing is done on NULL @see free() Free the memory associated to a given pointer. Prints a warning on stderr if the requested pointer cannot be found in the memory table. If the pointer @em ptr is @c NULL, nothing is done and no error is set. */ /*----------------------------------------------------------------------------*/ void cpl_xmemory_free(void * ptr) { size_t pos; /* Do nothing for a NULL pointer */ if (ptr == NULL) return; if (cpl_xmemory_ncells == 0) { fprintf(stderr, "cpl_xmemory error: Ignoring free() on unallocated " "pointer (%p)\n", ptr); return; } /* assert( cpl_xmemory_table_size > 0 ); */ pos = cpl_xmemory_findcell(ptr); if (pos == cpl_xmemory_table_size) { fprintf(stderr, "cpl_xmemory error: Ignoring free() on unallocated " "pointer (%p)\n", ptr); return; } /* free + below decrement copied from cpl_xmemory_free_count() */ free(ptr); /* Decrement number of allocated pointers */ # ifdef _OPENMP # pragma omp atomic # endif cpl_xmemory_ncells--; if (cpl_xmemory_ncells > 0) { /* Remove cell from main table */ cpl_xmemory_remcell(pos); } else { /* There are no more active pointers, deallocate internal memory */ cpl_xmemory_end(); } return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Display memory status information. @param mode Mode (0: system, 1: Xmemory-failure check, 2: Xmemory-full) @return void This function is meant for debugging purposes, but it is recommended to call it at the end of every executable making use of the extended memory features. */ /*----------------------------------------------------------------------------*/ void cpl_xmemory_status(int mode) { if (mode > 0) { const size_t rowsize = sizeof(void*) + sizeof(size_t)+ sizeof(unsigned char); fprintf(stderr, "#----- Memory Diagnostics -----\n"); if (mode == 2) { fprintf(stderr, "Peak pointer usage [pointer]: %zu\n" "Peak memory allocation [B]: %zu\n" "Peak table size [pointer]: %zu\n" "Peak table size [B]: %zu\n", cpl_xmemory_max_cells, cpl_xmemory_alloc_max, cpl_xmemory_table_size_max, cpl_xmemory_table_size_max * rowsize); } else { fprintf(stderr, "Maximum number of pointers" # ifdef _OPENMP /* cpl_xmemory_max_cells is not updated thread-safely */ " (approximate)" # endif ": %zu\n", cpl_xmemory_max_cells); } fprintf(stderr, "#----- Memory Currently Allocated -----\n"); fprintf(stderr, "Number of active pointers: %zu\n", cpl_xmemory_ncells); if (mode == 2 && cpl_xmemory_ncells > 0) { size_t ii; size_t ntype[4] = {0, 0, 0, 0}; /* assert( cpl_xmemory_table_size != 0 ); */ fprintf(stderr, "Memory allocation [B]: %zu\n" "Current table size [pointer]: %zu\n" "Current table size [B]: %zu\n", cpl_xmemory_alloc_ram, cpl_xmemory_table_size, cpl_xmemory_table_size * rowsize); /* Do not print entire table on fatal error - it is likely huge */ if (cpl_xmemory_fatal == 0) fprintf(stderr, "#- Active pointer details\n"); for (ii=0; ii < cpl_xmemory_table_size; ii++) { if (cpl_xmemory_p_type[ii] != CPL_XMEMORY_TYPE_FREE) { ntype[cpl_xmemory_p_type[ii]]++; if (cpl_xmemory_fatal == 0) fprintf(stderr, "(%p) - %s() of %zu bytes\n", cpl_xmemory_p_val[ii], cpl_xmemory_type[cpl_xmemory_p_type[ii]], cpl_xmemory_p_size[ii]); } } fprintf(stderr, "#- Types of active pointers\n"); fprintf(stderr, "%7s(): %zu\n", cpl_xmemory_type[1], ntype[1]); fprintf(stderr, "%7s(): %zu\n", cpl_xmemory_type[2], ntype[2]); fprintf(stderr, "%7s(): %zu\n", cpl_xmemory_type[3], ntype[3]); } if (cpl_xmemory_fatal != 0) (void)fflush(stderr); } return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Tell if there is still some memory allocated @param mode Mode (0: system, 1: Xmemory-failure check, 2: Xmemory-full) @return 1 if the memory table is empty, 0 if no, -1 if the memory model is off */ /*----------------------------------------------------------------------------*/ int cpl_xmemory_is_empty(int mode) { if (mode > 0) { /* assert(cpl_xmemory_ncells > 0 || cpl_xmemory_alloc_ram == 0); if (mode == 2) assert(cpl_xmemory_ncells == 0 || cpl_xmemory_alloc_ram > 0); */ return cpl_xmemory_ncells == 0 ? 1 : 0; } else { return -1; } } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Initialize extended memory features. @return void This function is implicitly called by the first of xmemory_alloc() and xmemory_free(). It allocates the default number of memory cells. */ /*----------------------------------------------------------------------------*/ static void cpl_xmemory_init(void) { if (CPL_XMEMORY_RESIZE_THRESHOLD > 1.0) { fprintf(stderr, "cpl_xmemory fatal error: Memory table resize threshold " CPL_XSTRINGIFY(CPL_XMEMORY_RESIZE_THRESHOLD) " must be less " "than or equal to 1, not " CPL_STRINGIFY(CPL_XMEMORY_RESIZE_THRESHOLD) "\n"); assert(CPL_XMEMORY_RESIZE_THRESHOLD <= 1.0); /* More informative */ abort(); } if (CPL_XMEMORY_RESIZE_THRESHOLD <= 0.0) { fprintf(stderr, "cpl_xmemory fatal error: Memory table resize threshold " CPL_XSTRINGIFY(CPL_XMEMORY_RESIZE_THRESHOLD) " must be positive" ", not " CPL_STRINGIFY(CPL_XMEMORY_RESIZE_THRESHOLD) "\n"); assert(CPL_XMEMORY_RESIZE_THRESHOLD > 0.0); /* More informative */ abort(); } if (CPL_XMEMORY_RESIZE_FACTOR <= 1.0) { fprintf(stderr, "cpl_xmemory fatal error: Memory table resize factor " CPL_XSTRINGIFY(CPL_XMEMORY_RESIZE_FACTOR) " must be greater " "than 1, not " CPL_STRINGIFY(CPL_XMEMORY_RESIZE_FACTOR) "\n"); assert(CPL_XMEMORY_RESIZE_FACTOR > 1.0); /* More informative */ abort(); } cpl_xmemory_table_size = CPL_XMEMORY_MAXPTRS; cpl_xmemory_init_alloc(); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Allocate memory for memory features. @return void @note This allocation is done directly with calloc() */ /*----------------------------------------------------------------------------*/ static void cpl_xmemory_init_alloc(void) { { cpl_xmemory_p_val = calloc(cpl_xmemory_table_size, sizeof(void*)); cpl_xmemory_p_type = calloc(cpl_xmemory_table_size, sizeof(unsigned char)); cpl_xmemory_p_size = malloc(cpl_xmemory_table_size * sizeof(size_t)); /* FIXME: pragma omp atomic */ if (cpl_xmemory_table_size > cpl_xmemory_table_size_max) { cpl_xmemory_table_size_max = cpl_xmemory_table_size; } } if (cpl_xmemory_p_val == NULL || cpl_xmemory_p_size == NULL || cpl_xmemory_p_type == NULL) { /* The table could not be allocated */ fprintf(stderr, "cpl_xmemory fatal error: calloc() of memory table " "failed with size %zu:\n", cpl_xmemory_table_size); perror(NULL); cpl_xmemory_fatal = 1; cpl_xmemory_status(1); /* Mode-2 data is invalid! */ assert(cpl_xmemory_p_val != NULL); /* More informative, if enabled */ assert(cpl_xmemory_p_size != NULL); assert(cpl_xmemory_p_type != NULL); abort(); } return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Resize the pointer allocation table @return void */ /*----------------------------------------------------------------------------*/ static void cpl_xmemory_resize(void) { const void ** p_val = cpl_xmemory_p_val; size_t * p_size = cpl_xmemory_p_size; unsigned char * p_type = cpl_xmemory_p_type; const size_t old_size = cpl_xmemory_table_size; size_t ii; assert( cpl_xmemory_table_size > 0 ); assert( cpl_xmemory_ncells > 0 ); cpl_xmemory_table_size = cpl_xmemory_table_size * CPL_XMEMORY_RESIZE_FACTOR; /* Ensure that the table size is odd, to reduce hashing clashes */ cpl_xmemory_table_size |= 1; if (cpl_xmemory_table_size <= old_size) { /* The table could not be resized */ fprintf(stderr, "cpl_xmemory fatal error: Memory table could not be " "resized, %zu < %zu:\n", cpl_xmemory_table_size, old_size); perror(NULL); cpl_xmemory_fatal = 1; cpl_xmemory_status(1); /* Mode-2 data is invalid! */ assert(cpl_xmemory_table_size > old_size); /* More informative */ abort(); } cpl_xmemory_init_alloc(); /* Locate pointer in main table */ /* # pragma omp parallel for private(ii,pos) schedule(static) */ for (ii = 0; ii < old_size; ii++) { if (p_type[ii]) { /* Old table has a pointer here */ /* Find position in enlarged table */ const size_t pos = cpl_xmemory_findfree(p_val[ii]); /* Duplicated from cpl_xmemory_addcell() */ cpl_xmemory_p_val[pos] = p_val[ii]; cpl_xmemory_p_size[pos] = p_size[ii]; cpl_xmemory_p_type[pos] = p_type[ii]; } } free((void*)p_val); free(p_size); free(p_type); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Deinitialize extended memory features. @return void */ /*----------------------------------------------------------------------------*/ inline static void cpl_xmemory_end(void) { assert( cpl_xmemory_ncells == 0 ); cpl_xmemory_table_size = 0; cpl_xmemory_alloc_ram = 0; free(cpl_xmemory_p_val); free(cpl_xmemory_p_type); free(cpl_xmemory_p_size); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Add allocation cell. @param pos Position in the table @param pointer Pointer value. @param size Pointer size. @param type Allocation type @return void Add a memory cell in the xtended memory table to register that a new allocation took place. This call is not protected against illegal parameter values, so make sure the passed values are correct! */ /*----------------------------------------------------------------------------*/ inline static void cpl_xmemory_addcell(size_t pos, const void * pointer, size_t size, unsigned char type) { /* Store information */ cpl_xmemory_p_val[pos] = pointer; cpl_xmemory_p_size[pos] = size; /* Allocation type */ cpl_xmemory_p_type[pos] = type; cpl_xmemory_alloc_ram += size; /* Remember peak allocation */ /* FIXME: pragma omp atomic */ if (cpl_xmemory_alloc_ram > cpl_xmemory_alloc_max) cpl_xmemory_alloc_max = cpl_xmemory_alloc_ram; return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Find the cell of a given pointer @param ptr Xmemory-allocated pointer, i.e. not NULL @return Index of cell with pointer, or cpl_xmemory_table_size when not found */ /*----------------------------------------------------------------------------*/ inline static size_t cpl_xmemory_findcell(const void * ptr) { const size_t pos = PTR_HASH(ptr); size_t ii = pos; /* Locate pointer in main table */ do { if (cpl_xmemory_p_val[ii] == ptr) return ii; /* Found */ if (++ii == cpl_xmemory_table_size) ii = 0; /* Wrap around */ } while (ii != pos); /* Not found */ return cpl_xmemory_table_size; } /*----------------------------------------------------------------------------*/ /** @internal @brief Find the first free cell suitable for the pointer @param ptr Allocated pointer to keep in Xmemory @return Index of cell with pointer @note This function will exit when the table is full */ /*----------------------------------------------------------------------------*/ inline static size_t cpl_xmemory_findfree(const void * ptr) { /* Find an available slot */ const size_t pos = PTR_HASH(ptr); /* In comparison with the method of cpl_xmemory_findcell() this is faster when the table starts to be full */ const void * ppos = memchr(cpl_xmemory_p_type+pos, CPL_XMEMORY_TYPE_FREE, cpl_xmemory_table_size - pos); if (ppos == NULL) { ppos = memchr(cpl_xmemory_p_type, CPL_XMEMORY_TYPE_FREE, pos); if (ppos == NULL) { /* No available slot */ fprintf(stderr, "cpl_xmemory internal, fatal error: " "Could not find place for new pointer\n"); cpl_xmemory_fatal = 1; cpl_xmemory_status(2); assert(ppos != NULL); /* More informative, if enabled */ abort(); } } return ((size_t)ppos - (size_t)cpl_xmemory_p_type); } /*----------------------------------------------------------------------------*/ /** @internal @brief Remove the specified memory cell from the xtended memory table. @param pos Position of the pointer in the table. @return void @note This call is not protected against illegal parameter values, so make sure the passed value is correct! */ /*----------------------------------------------------------------------------*/ inline static void cpl_xmemory_remcell(size_t pos) { /* Set pointer to NULL */ cpl_xmemory_p_val[pos] = NULL; /* Set type to free */ cpl_xmemory_p_type[pos] = CPL_XMEMORY_TYPE_FREE; cpl_xmemory_alloc_ram -= cpl_xmemory_p_size[pos]; return; } cpl-6.4.1/cplcore/cpl_array.h0000644000460300003120000002263512270505777013012 00000000000000/* $Id: cpl_array.h,v 1.22 2012-02-27 16:12:47 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-02-27 16:12:47 $ * $Revision: 1.22 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_ARRAY_H #define CPL_ARRAY_H #include #include #include #include #include CPL_BEGIN_DECLS typedef struct _cpl_array_ cpl_array; cpl_array *cpl_array_new(cpl_size, cpl_type); cpl_array *cpl_array_wrap_int(int *, cpl_size); cpl_array *cpl_array_wrap_long(long *, cpl_size); cpl_array *cpl_array_wrap_long_long(long long *, cpl_size); cpl_array *cpl_array_wrap_cplsize(cpl_size *, cpl_size); cpl_array *cpl_array_wrap_float(float *, cpl_size); cpl_array *cpl_array_wrap_double(double *, cpl_size); #ifdef _Complex_I cpl_array *cpl_array_wrap_float_complex(_Complex float *, cpl_size); cpl_array *cpl_array_wrap_double_complex(_Complex double *, cpl_size); #endif cpl_array *cpl_array_wrap_string(char **, cpl_size); cpl_error_code cpl_array_copy_data(cpl_array *, const double *); cpl_error_code cpl_array_copy_data_int(cpl_array *, const int *); cpl_error_code cpl_array_copy_data_long(cpl_array *, const long *); cpl_error_code cpl_array_copy_data_long_long(cpl_array *, const long long *); cpl_error_code cpl_array_copy_data_cplsize(cpl_array *, const cpl_size *); cpl_error_code cpl_array_copy_data_float(cpl_array *, const float *); cpl_error_code cpl_array_copy_data_double(cpl_array *, const double *); cpl_error_code cpl_array_copy_data_string(cpl_array *, const char **); #ifdef _Complex_I cpl_error_code cpl_array_copy_data_complex(cpl_array *, const _Complex double *); cpl_error_code cpl_array_copy_data_float_complex(cpl_array *, const _Complex float *); cpl_error_code cpl_array_copy_data_double_complex(cpl_array *, const _Complex double *); #endif void cpl_array_delete(cpl_array *); void *cpl_array_unwrap(cpl_array *); cpl_size cpl_array_get_size(const cpl_array *); cpl_error_code cpl_array_set_size(cpl_array *, cpl_size); cpl_type cpl_array_get_type(const cpl_array *); int cpl_array_has_invalid(const cpl_array *); int cpl_array_has_valid(const cpl_array *); int cpl_array_is_valid(const cpl_array *, cpl_size); cpl_size cpl_array_count_invalid(const cpl_array *); int *cpl_array_get_data_int(cpl_array *); const int *cpl_array_get_data_int_const(const cpl_array *); long *cpl_array_get_data_long(cpl_array *); const long *cpl_array_get_data_long_const(const cpl_array *); long long *cpl_array_get_data_long_long(cpl_array *); const long long *cpl_array_get_data_long_long_const(const cpl_array *); cpl_size *cpl_array_get_data_cplsize(cpl_array *); const cpl_size *cpl_array_get_data_cplsize_const(const cpl_array *); float *cpl_array_get_data_float(cpl_array *); const float *cpl_array_get_data_float_const(const cpl_array *); double *cpl_array_get_data_double(cpl_array *); const double *cpl_array_get_data_double_const(const cpl_array *); #ifdef _Complex_I _Complex float *cpl_array_get_data_float_complex(cpl_array *); const _Complex float *cpl_array_get_data_float_complex_const(const cpl_array *); const _Complex double *cpl_array_get_data_double_complex_const (const cpl_array *); _Complex double *cpl_array_get_data_double_complex(cpl_array *); #endif char **cpl_array_get_data_string(cpl_array *); const char **cpl_array_get_data_string_const(const cpl_array *); double cpl_array_get(const cpl_array *, cpl_size, int *); int cpl_array_get_int(const cpl_array *, cpl_size, int *); long cpl_array_get_long(const cpl_array *, cpl_size, int *); long long cpl_array_get_long_long(const cpl_array *, cpl_size, int *); cpl_size cpl_array_get_cplsize(const cpl_array *, cpl_size, int *); float cpl_array_get_float(const cpl_array *, cpl_size, int *); double cpl_array_get_double(const cpl_array *, cpl_size, int *); const char *cpl_array_get_string(const cpl_array *, cpl_size); #ifdef _Complex_I _Complex double cpl_array_get_complex(const cpl_array *, cpl_size, int *); _Complex float cpl_array_get_float_complex(const cpl_array *, cpl_size, int *); _Complex double cpl_array_get_double_complex(const cpl_array *, cpl_size, int *); #endif cpl_error_code cpl_array_set(cpl_array *array, cpl_size, double); cpl_error_code cpl_array_set_int(cpl_array *, cpl_size, int); cpl_error_code cpl_array_set_long(cpl_array *, cpl_size, long); cpl_error_code cpl_array_set_long_long(cpl_array *, cpl_size, long long); cpl_error_code cpl_array_set_cplsize(cpl_array *, cpl_size, cpl_size); cpl_error_code cpl_array_set_float(cpl_array *, cpl_size, float); cpl_error_code cpl_array_set_double(cpl_array *, cpl_size, double); cpl_error_code cpl_array_set_string(cpl_array *, cpl_size, const char *); cpl_error_code cpl_array_set_invalid(cpl_array *, cpl_size); #ifdef _Complex_I cpl_error_code cpl_array_set_complex(cpl_array *, cpl_size, _Complex double); cpl_error_code cpl_array_set_float_complex(cpl_array *, cpl_size, _Complex float); cpl_error_code cpl_array_set_double_complex(cpl_array *, cpl_size, _Complex double); #endif cpl_error_code cpl_array_fill_window(cpl_array *, cpl_size, cpl_size, double); cpl_error_code cpl_array_fill_window_int(cpl_array *, cpl_size, cpl_size, int); cpl_error_code cpl_array_fill_window_long(cpl_array *, cpl_size, cpl_size, long); cpl_error_code cpl_array_fill_window_long_long(cpl_array *, cpl_size, cpl_size, long long); cpl_error_code cpl_array_fill_window_cplsize(cpl_array *, cpl_size, cpl_size, cpl_size); cpl_error_code cpl_array_fill_window_float(cpl_array *, cpl_size, cpl_size, float); cpl_error_code cpl_array_fill_window_double(cpl_array *, cpl_size, cpl_size, double); cpl_error_code cpl_array_fill_window_string(cpl_array *, cpl_size, cpl_size, const char *); #ifdef _Complex_I cpl_error_code cpl_array_fill_window_complex(cpl_array *, cpl_size, cpl_size, _Complex double); cpl_error_code cpl_array_fill_window_float_complex(cpl_array *, cpl_size, cpl_size, _Complex float); cpl_error_code cpl_array_fill_window_double_complex(cpl_array *, cpl_size, cpl_size, _Complex double); #endif cpl_error_code cpl_array_fill_window_invalid(cpl_array *, cpl_size, cpl_size); cpl_array *cpl_array_duplicate(const cpl_array *); cpl_array *cpl_array_extract(const cpl_array *, cpl_size start, cpl_size count); cpl_array *cpl_array_extract_real(cpl_array *); cpl_array *cpl_array_extract_imag(cpl_array *); cpl_error_code cpl_array_insert_window(cpl_array *, cpl_size start, cpl_size count); cpl_error_code cpl_array_erase_window(cpl_array *, cpl_size start, cpl_size count); cpl_error_code cpl_array_insert(cpl_array *, const cpl_array *, cpl_size); cpl_error_code cpl_array_add(cpl_array *, const cpl_array *); cpl_error_code cpl_array_subtract(cpl_array *, const cpl_array *); cpl_error_code cpl_array_multiply(cpl_array *, const cpl_array *); cpl_error_code cpl_array_divide(cpl_array *, const cpl_array *); cpl_error_code cpl_array_add_scalar(cpl_array *, double); cpl_error_code cpl_array_subtract_scalar(cpl_array *, double); cpl_error_code cpl_array_multiply_scalar(cpl_array *, double); cpl_error_code cpl_array_divide_scalar(cpl_array *, double); cpl_error_code cpl_array_abs(cpl_array *); cpl_error_code cpl_array_arg(cpl_array *); cpl_error_code cpl_array_logarithm(cpl_array *, double); cpl_error_code cpl_array_power(cpl_array *, double); cpl_error_code cpl_array_exponential(cpl_array *, double); #ifdef _Complex_I cpl_error_code cpl_array_add_scalar_complex(cpl_array *, _Complex double); cpl_error_code cpl_array_subtract_scalar_complex(cpl_array *, _Complex double); cpl_error_code cpl_array_multiply_scalar_complex(cpl_array *, _Complex double); cpl_error_code cpl_array_divide_scalar_complex(cpl_array *, _Complex double); #endif #ifdef _Complex_I _Complex double cpl_array_get_mean_complex(const cpl_array *); #endif double cpl_array_get_mean(const cpl_array *); double cpl_array_get_median(const cpl_array *); double cpl_array_get_stdev(const cpl_array *); double cpl_array_get_max(const cpl_array *); double cpl_array_get_min(const cpl_array *); cpl_error_code cpl_array_get_maxpos(const cpl_array *, cpl_size *); cpl_error_code cpl_array_get_minpos(const cpl_array *, cpl_size *); void cpl_array_dump_structure(const cpl_array *, FILE *); void cpl_array_dump(const cpl_array *, cpl_size start, cpl_size count, FILE *); cpl_array *cpl_array_cast(cpl_array *, cpl_type); CPL_END_DECLS #endif /* end of cpl_array.h */ cpl-6.4.1/cplcore/cpl_version.h.bot0000644000460300003120000000074611466501417014134 00000000000000 CPL_BEGIN_DECLS unsigned int cpl_version_get_major(void) CPL_ATTR_CONST; unsigned int cpl_version_get_minor(void) CPL_ATTR_CONST; unsigned int cpl_version_get_micro(void) CPL_ATTR_CONST; unsigned int cpl_version_get_interface_age(void) CPL_ATTR_CONST; unsigned int cpl_version_get_binary_age(void) CPL_ATTR_CONST; const char *cpl_version_get_version(void) CPL_ATTR_CONST; unsigned int cpl_version_get_binary_version(void) CPL_ATTR_CONST; CPL_END_DECLS #endif /* CPL_VERSION_H */ cpl-6.4.1/cplcore/cpl_polynomial.c0000644000460300003120000034625412267247536014062 00000000000000/* $Id: cpl_polynomial.c,v 1.151 2012-11-19 09:39:14 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-11-19 09:39:14 $ * $Revision: 1.151 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_polynomial_impl.h" #include "cpl_tools.h" #include "cpl_error_impl.h" #include "cpl_matrix_impl.h" #include "cpl_memory.h" #include #include #include #include #include #include /*----------------------------------------------------------------------------- Macro definitions -----------------------------------------------------------------------------*/ #ifdef CPL_POLYNOMIAL_USE_MULTI_HORNER /* FIXME: Not ready yet :-( */ #define CPL_POLYNOMIAL_EVAL_FUNCTION cpl_polynomial_eval_horner #else #define CPL_POLYNOMIAL_EVAL_FUNCTION cpl_polynomial_eval_bf #endif /* Maximum number of Newton-Raphson iterations */ #ifndef CPL_NR_MAXITE #define CPL_NR_MAXITE 100 #endif #define CPL_POLYNOMIAL_CMP \ /* Verify that it differs within tolerance */ \ if (fabs(p1->c[i] - p2->c[j]) <= tol) { \ /* Verify that the powers match */ \ for (dim=0; dim < p1->dim; dim++) \ if (p1->pow[p1->dim * i + dim] \ != p2->pow[p1->dim * j + dim]) break; \ if (dim == p1->dim) break; /* - found it */ \ } /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_polynomial Polynomials * * This module provides functions to handle uni- and multivariate polynomials. * * Univariate (1D) polynomials use the Horner rule for evaluation, while * multivariate polynomials are evaluated simply as the sum of each term. * * This means that of the two polynomials * @verbatim * P1(x) = p0 + p1.x + p4.x^2 * @endverbatim and * @verbatim * P2(x,y) = p0 + p1.x + p2.y + p3.x.y + p4.x^2 + p5.y^2 * @endverbatim * P1(x) may evaluate to more accurate results than P2(x,0), * especially around the roots. * * Note that a polynomial like P3(z) = p0 + p1.z + p2.z^2 + p3.z^3, z=x^4 * is preferable to p4(x) = p0 + p1.x^4 + p2.x^8 + p3.x^12. * */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Type definition -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /* Polynomial object. If you want to store the following polynomial: @verbatim p(x,y) = p0 + p1.x + p2.y + p3.x.y + p4.x^2 + p5.y^2 @endverbatim You would internally have: @verbatim nc = 6 (from 0 to 5 incl.) dim = 2 (x and y) c[] pow[] contains (pow[] is stored row-wise): p0 0 0 p1 1 0 p2 0 1 p3 1 1 p4 2 0 p5 0 2 @endverbatim i.e. the i'th coefficient is multiplied by the variable in dimension j lifted to this power: pow[dim * i + j] 1-dimensional polynomials are stored differently: pow[] is not used. dim == 1. Instead all coefficients (including those with zero-value) are stored in order of increasing power - in c. Thus the constant coefficient is stored in c[0] while the leading coefficient is stored in c[nc-1]. This storage scheme allows for the usage of the Horner rule. */ /*----------------------------------------------------------------------------*/ struct _cpl_polynomial_ { /* The dimension of the polynomial */ cpl_size dim; /* if dim == 1: The number of coefficients in c (degree + 1). if dim > 1: The number of (non-zero) coefficients in c. */ cpl_size nc; /* The coefficients. If dim == 1: c0, c_1, ..., c_{nc - 1} */ double * c; /* If dim == 1: Not used If dim > 1: The nc * dim powers of the variables x1, x2, ..., xdim */ cpl_size * pow; /* If dim == 1: Not used If dim > 1: Temporary storage to speed up evaluation max_degree[i] is the largest power used for dimension i. eval_pow[i] holds space for 1+max_degree[i] double's. max_degree_alldims is the largest power counting all dims (i.e. 5 for x2y3) */ cpl_size * max_degree; cpl_size max_degree_alldims; double ** eval_pow; #ifdef CPL_POLYNOMIAL_USE_MULTI_HORNER /* Cache variables for Horner evaluation */ double * added_horner; int * added_exist_iterations; int added_exist_index; int added_iter; #endif }; /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static cpl_error_code cpl_polynomial_delete_coeff(cpl_polynomial *, const cpl_size *); static void cpl_matrix_fill_normal_vandermonde(cpl_matrix *, cpl_matrix *, const cpl_vector *, cpl_boolean, cpl_size, const cpl_vector *) CPL_ATTR_NONNULL; static cpl_error_code cpl_polynomial_fit_2d(cpl_polynomial *, const cpl_bivector *, const cpl_vector *, cpl_boolean, const cpl_size *, double *); static int cpl_vector_is_eqdist(const cpl_vector *); #ifdef CPL_POLYNOMIAL_USE_MULTI_HORNER static double cpl_polynomial_eval_horner(const cpl_polynomial * p, const cpl_vector * x); static double cpl_polynomial_register_horner(cpl_polynomial * p, int ireg, int * step, int * powers_tmp, const double * x); static void cpl_polynomial_arrange_coeffs_horner(cpl_polynomial * p, int ireg, int * step, int * powers_tmp); static int cpl_polynomial_coeff_index(const cpl_polynomial *, const int *); #else static double cpl_polynomial_eval_bf(const cpl_polynomial *, const cpl_vector *) CPL_ATTR_NONNULL; #endif /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Create a new cpl_polynomial @param dim The positive polynomial dimension (number of variables) @return 1 newly allocated cpl_polynomial, or NULL on error The returned object must be deallocated using cpl_polynomial_delete(). A newly created polynomial has degree 0 and evaluates as 0. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if dim is negative or zero */ /*----------------------------------------------------------------------------*/ cpl_polynomial * cpl_polynomial_new(cpl_size dim) { cpl_polynomial * p; /* Test input */ cpl_ensure(dim > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Allocate struct - and set nc == 0 */ p = cpl_calloc(1, sizeof(cpl_polynomial)); p->dim = dim; p->nc = 0; return p; } /*----------------------------------------------------------------------------*/ /** @brief Delete a cpl_polynomial @param p cpl_polynomial to delete @return void The function deallocates the memory used by the polynomial @em p. If @em p is @c NULL, nothing is done, and no error is set. */ /*----------------------------------------------------------------------------*/ void cpl_polynomial_delete(cpl_polynomial * p) { if (p == NULL) return; if (p->nc > 0) { cpl_free(p->c); if (p->dim > 1) { while (p->dim--) { cpl_free(p->eval_pow[p->dim]); } cpl_free(p->pow); cpl_free(p->eval_pow); cpl_free(p->max_degree); #ifdef CPL_POLYNOMIAL_USE_MULTI_HORNER cpl_free(p->added_horner); cpl_free(p->added_exist_iterations); #endif } } cpl_free(p); return; } /*----------------------------------------------------------------------------*/ /** @brief Dump a cpl_polynomial as ASCII to a stream @param p Input cpl_polynomial to dump @param stream Output stream, accepts @c stdout or @c stderr @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ Each coefficient is preceded by its integer power(s) and written on a single line. If the polynomial has non-zero coefficients, only those are printed, otherwise the (zero-valued) constant term is printed. Comment lines start with the hash character. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_FILE_IO if the write operation fails */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_dump(const cpl_polynomial * p, FILE * stream) { const cpl_error_code err = CPL_ERROR_FILE_IO; int i, dim; cpl_ensure_code(stream != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(p != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code( fprintf(stream, "#----- %" CPL_SIZE_FORMAT " dimensional polynomial -----\n", p->dim) > 0, err); for (i=0; i < p->dim; i++) cpl_ensure_code(fprintf(stream, "%d.dim.power ", i+1) > 0, err); cpl_ensure_code(fprintf(stream, "coefficient\n") > 0, err); if (p->nc == 0) { for (dim=0; dim < p->dim; dim++) cpl_ensure_code(fprintf(stream, " %5d ", 0) > 0, err); cpl_ensure_code(fprintf(stream, "0\n") > 0, err); } for (i=0; i < p->nc; i++) { if (p->dim == 1) { if (p->c[i] == 0.0) continue; /* Only non-zero coefficients */ cpl_ensure_code(fprintf(stream, " %5d ", i) > 0, err); } else for (dim=0; dim < p->dim; dim++) cpl_ensure_code(fprintf(stream, " %5" CPL_SIZE_FORMAT " ", p->pow[p->dim * i + dim]) > 0, err); cpl_ensure_code(fprintf(stream, "%g\n", p->c[i]) > 0, err); } cpl_ensure_code( fprintf(stream, "#------------------------------------\n") > 0, err); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief This function duplicates an existing polynomial @param p The input cpl_polynomial @return A newly allocated cpl_polynomial or NULL on error Notice that the returned object is a newly allocated cpl_polynomial that must be deallocated by the caller using cpl_polynomial_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_polynomial * cpl_polynomial_duplicate(const cpl_polynomial * p) { cpl_polynomial * out; /* Test inputs */ cpl_ensure(p != NULL, CPL_ERROR_NULL_INPUT, NULL); if (p->nc == 0) return cpl_polynomial_new(p->dim); /* Create a new cpl_polynomial and copy the non-pointer members */ out = cpl_malloc(sizeof(cpl_polynomial)); memcpy(out, p, sizeof(cpl_polynomial)); /* Copy the coefficients */ out->c = cpl_malloc((size_t)out->nc * sizeof(double)); memcpy(out->c, p->c, (size_t)out->nc * sizeof(double)); if (out->dim > 1) { /* Copy the powers - and eval-workspace */ int dim; out->pow = cpl_malloc((size_t)out->nc * (size_t)out->dim * sizeof(cpl_size)); memcpy(out->pow, p->pow, (size_t)out->nc * (size_t)out->dim * sizeof(cpl_size)); out->max_degree = cpl_malloc((size_t)out->dim * sizeof(cpl_size)); memcpy(out->max_degree, p->max_degree, (size_t)out->dim * sizeof(cpl_size)); /* out->max_degree_alldims = p->max_degree_alldims; Unnecesary.. */ out->eval_pow = cpl_malloc((size_t)out->dim * sizeof(double*)); for (dim=0; dim < out->dim; dim++) { out->eval_pow[dim] = cpl_malloc((size_t)(1+out->max_degree[dim]) * sizeof(double)); out->eval_pow[dim][0] = 1.0; /* Always 1 */ } #ifdef CPL_POLYNOMIAL_USE_MULTI_HORNER out->added_horner = cpl_malloc(out->nc * sizeof(*out->added_horner)); out->added_exist_iterations = cpl_malloc(out->nc * sizeof(*out->added_exist_iterations)); #endif } return out; } /*----------------------------------------------------------------------------*/ /** @brief This function copies contents of a polynomial into another one @param out Pre-allocated output cpl_polynomial @param in Input cpl_polynomial @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ in and out must point to different polynomials. If out already contains coefficients, they are overwritten. This is the only function that can modify the dimension of a polynomial. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if in and out point to the same polynomial */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_copy(cpl_polynomial * out, const cpl_polynomial * in) { /* Check input */ cpl_ensure_code(out != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(in != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(in != out, CPL_ERROR_INCOMPATIBLE_INPUT); /* Verify: Should this be done only when in->pow == out->pow ?? */ if (out->dim == in->dim && in->nc > 0 && out->nc > 0) { /* The polynomials have equal dimension - realloc() if needed and just copy all buffers */ if (in->dim > 1) { /* Copy the powers */ int dim; if (out->nc != in->nc) out->pow = cpl_realloc(out->pow, (size_t)in->dim * (size_t)in->nc * sizeof(cpl_size)); memcpy(out->pow, in->pow, (size_t)in->dim * (size_t)in->nc * sizeof(cpl_size)); memcpy(out->max_degree, in->max_degree, (size_t)in->dim * sizeof(cpl_size)); out->max_degree_alldims = in->max_degree_alldims; for (dim=0; dim < in->dim; dim++) { out->eval_pow[dim] = cpl_realloc(out->eval_pow[dim], (size_t)(1+out->max_degree[dim]) * sizeof(double)); } #ifdef CPL_POLYNOMIAL_USE_MULTI_HORNER cpl_free(out->added_horner); cpl_free(out->added_exist_iterations); out->added_horner = cpl_malloc((size_t)out->nc * sizeof(*out->added_horner)); out->added_exist_iterations = cpl_malloc((size_t)out->nc * sizeof(*out->added_exist_iterations)); #endif } /* Resize the coefficient buffer */ if (out->nc != in->nc) { out->nc = in->nc; out->c = cpl_realloc(out->c, (size_t)in->nc * sizeof(double)); } memcpy(out->c, in->c, (size_t)in->nc * sizeof(double)); } else { /* When the dimensions are different, or if one of the polynomials have no coefficients, avoiding the malloc()/free()'s is too complicated - instead just duplicate the source and swap it into place */ cpl_polynomial * tmp = cpl_polynomial_duplicate(in); void * swap = cpl_malloc(sizeof(cpl_polynomial)); memcpy(swap, out, sizeof(cpl_polynomial)); memcpy(out, tmp, sizeof(cpl_polynomial)); memcpy(tmp, swap, sizeof(cpl_polynomial)); /* Delete the buffers originally used by out - and the swap space */ cpl_polynomial_delete(tmp); cpl_free(swap); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Compare the coefficients of two polynomials @param p1 the 1st polynomial @param p2 the 2nd polynomial @param tol The absolute (non-negative) tolerance @return 0 when equal, positive when different, negative on error. The two polynomials are considered equal iff they have identical dimensions and the absolute difference between their coefficients does not exceed the tolerance. This means that the following pair of polynomials per definition are considered different: P1(x1,x2) = 3*x1 different from P2(x1) = 3*x1. If all parameters are valid and p1 and p2 point to the same polynomial the functions returns 0. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if tol is negative */ /*----------------------------------------------------------------------------*/ int cpl_polynomial_compare(const cpl_polynomial * p1, const cpl_polynomial * p2, double tol) { cpl_size i; /* Test parameters */ cpl_ensure(p1 != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(p2 != NULL, CPL_ERROR_NULL_INPUT, -2); cpl_ensure(tol >= 0, CPL_ERROR_ILLEGAL_INPUT, -5); if (p1 == p2) return 0; if (p1->dim != p2->dim) return 1; if (p1->dim == 1) { /* If the degrees differ, the leading coefficient(s) must be smaller than tol */ for (i = p1->nc; i > p2->nc; i--) if (fabs(p1->c[i]) > tol) return 2; for (i = p2->nc; i > p1->nc; i--) if (fabs(p2->c[i]) > tol) return 3; /* At this point i is equal to min(p1->nc, p2->nc) */ while (i--) if (fabs(p1->c[i]-p2->c[i]) > tol) return 4; } else { /* For each 'non-zero' coefficient in p1, the same one must be in p2 and vice-versa */ cpl_size * found2 = cpl_calloc((size_t)p2->nc, sizeof(cpl_size)); cpl_size dim; cpl_size j; /* Verify that each coefficient in p1 is either below tol or present in p2. Remember which of the coefficients in p2 were found */ for (i = 0; i < p1->nc; i++) { if (fabs(p1->c[i]) <= tol) continue; for (j = 0; j < p2->nc; j++) { if (found2[j]) continue; /* Use a coefficient just once */ CPL_POLYNOMIAL_CMP; } /* Verify that one was found */ if (j == p2->nc) break; found2[j] = TRUE; } if (i < p1->nc) { cpl_free(found2); return 5; } for (j = 0; j < p2->nc; j++) { if (found2[j] || fabs(p2->c[j]) <= tol) continue; for (i=0; i < p1->nc; i++) { CPL_POLYNOMIAL_CMP; } /* Verify that one was found */ if (i == p1->nc) break; } cpl_free(found2); if (j < p2->nc) return 6; } return 0; } /*----------------------------------------------------------------------------*/ /** @brief The degree of the polynomial @param p the polynomial @return The degree or negative on error The degree is the highest sum of exponents (with a non-zero coefficient). If there are no non-zero coefficients the degree is zero. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_polynomial_get_degree(const cpl_polynomial * p) { cpl_size degree; /* Test parameters */ cpl_ensure(p != NULL, CPL_ERROR_NULL_INPUT, -1); if (p->nc == 0) return 0; if (p->dim == 1) { return p->nc-1; } else { cpl_size dim; cpl_size sum; cpl_size i; degree = -1; for (i = 0; i < p->nc; i++) { if (p->c[i] == 0) continue; sum = 0; for (dim = 0; dim < p->dim; dim++) sum += p->pow[p->dim * i + dim]; if (sum > degree) degree = sum; } } /* User may have reset leading coefficient(s) to zero */ if (degree < 0) return 0; return degree; } /*----------------------------------------------------------------------------*/ /** @brief The dimension of the polynomial @param p the polynomial @return The dimension or negative on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_polynomial_get_dimension(const cpl_polynomial * p) { /* Test entries */ cpl_ensure(p != NULL, CPL_ERROR_NULL_INPUT, -1); return p->dim; } /*----------------------------------------------------------------------------*/ /** @brief Get a coefficient of the polynomial @param in the input polynomial @param pows the powers of the different variables @return The coefficient or undefined on error The array pows must have the size of the polynomial dimension and have non-negative elements. It is allowed to specify a (set of) power(s) for which no coefficient has previously been set. In this case the function returns zero. Example of usage: @code const cpl_size power = 3; double coefficient = cpl_polynomial_get_coeff(poly1d, &power); @endcode Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if pows contains negative values */ /*----------------------------------------------------------------------------*/ double cpl_polynomial_get_coeff(const cpl_polynomial * in, const cpl_size * pows) { double coef = 0.0; /* Default value */ cpl_size dim; /* Test entries */ cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, coef); cpl_ensure(pows != NULL, CPL_ERROR_NULL_INPUT, coef); for (dim = 0; dim < in->dim; dim++) { if (pows[dim] < 0) break; } if (dim < in->dim) { (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Dimension %" CPL_SIZE_FORMAT " of %" CPL_SIZE_FORMAT " has negative power %" CPL_SIZE_FORMAT, dim+1, in->dim, pows[dim]); } else if (in->dim == 1) { if (pows[0] < in->nc) coef = in->c[pows[0]]; } else { cpl_size i; for (i=0; i < in->nc; i++) { if (!memcmp(in->pow + (size_t)(in->dim * i), pows, (size_t)in->dim * sizeof(*pows))) break; /* Found the right combination of powers */ } if (i < in->nc) coef = in->c[i]; } return coef; } /*----------------------------------------------------------------------------*/ /** @brief Set a coefficient of the polynomial @param in the input polynomial @param pows the powers of the different variables @param c the coefficient @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ The array pows must have the size of the polynomial dimension and have non-negative elements. If the coefficient is already there, it is overwritten, if not, a new coefficient is added to the polynomial. This may cause the degree of the polynomial to be increased. Setting the coefficient of x1^4 * x3^2 in the 4-dimensional polynomial poly4d to 12.3 would be performed by: @code const cpl_size pows[] = {4, 0, 2, 0}; cpl_error_code error = cpl_polynomial_set_coeff(poly4d, pows, 12.3); @endcode Setting the coefficient of x^3 in the 1-dimensional polynomial poly1d to 12.3 would be performed by: @code const cpl_size power = 3; cpl_error_code error = cpl_polynomial_set_coeff(poly1d, &power, 12.3); @endcode For efficiency reasons the coefficients of a 1D-polynomial are best inserted with that of the highest power first. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if pows contains negative values */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_set_coeff(cpl_polynomial * in, const cpl_size * pows, double c) { cpl_size newnc; cpl_size dim; cpl_size ind = -1; /* Assume coefficient is absent */ #ifdef CPL_POLYNOMIAL_USE_MULTI_HORNER /* Variables for Horner speed-up */ int * horner_step; int ireg; int istep; int * powers_tmp; #endif /* Test entries */ cpl_ensure_code(in, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pows, CPL_ERROR_NULL_INPUT); for (dim=0; dim < in->dim; dim++) cpl_ensure_code(pows[dim] >= 0, CPL_ERROR_ILLEGAL_INPUT); /* Handle zero-valued coefficients as a special case */ /* FIXME: 0 is a valid value */ if (c == 0.0) return cpl_polynomial_delete_coeff(in, pows); /* Find the coeff */ if (in->dim == 1) { if (pows[0] < in->nc) ind = pows[0]; } else { cpl_size i; for (i=0; i < in->nc; i++) { if (!memcmp(in->pow + (size_t)in->dim * (size_t)i, pows, (size_t)in->dim * sizeof(cpl_size))) break; /* Found the right combination of powers */ } if (i < in->nc) ind = i; } /* The coefficient already exists : replace it and return */ if (ind >= 0) { in->c[ind] = c; return CPL_ERROR_NONE; } /* The coefficient is a new one */ /* Extend the arrays and update counter */ /* New size. 1D-polynomials can grow with more than one coefficient */ newnc = in->dim == 1 ? 1 + pows[0] : 1 + in->nc; in->c = in->nc ? cpl_realloc(in->c, (size_t)newnc * sizeof(double)) : cpl_malloc((size_t)newnc * sizeof(double)); if (in->dim == 1) { /* Initialize coefficients between existing and new one to zero */ if (newnc - in->nc > 1) memset(in->c + (size_t)in->nc, 0, (size_t)(newnc - in->nc - 1) * sizeof(double)); } else { /* Extend and copy the power arrays */ in->pow = newnc == 1 ? cpl_malloc((size_t)in->dim * (size_t)newnc * sizeof(cpl_size)) : cpl_realloc(in->pow, (size_t)in->dim * (size_t)newnc * sizeof(cpl_size)); memcpy(in->pow + (size_t)in->dim * (size_t)in->nc, pows, (size_t)in->dim * sizeof(cpl_size)); if (in->nc == 0) { in->max_degree = cpl_malloc((size_t)in->dim * sizeof(cpl_size)); in->eval_pow = cpl_malloc((size_t)in->dim * sizeof(double*)); in->max_degree_alldims = 0; for (dim=0; dim < in->dim; dim++) { in->max_degree[dim] = pows[dim]; in->max_degree_alldims += in->max_degree[dim]; in->eval_pow[dim] = cpl_malloc((size_t)(1+in->max_degree[dim]) * sizeof(double)); in->eval_pow[dim][0] = 1.0; /* Always 1 */ } #ifdef CPL_POLYNOMIAL_USE_MULTI_HORNER /* FIXME: This is going to be deleted a few lines below, anyway */ in->added_horner = cpl_malloc(in->nc * sizeof(*in->added_horner)); in->added_exist_iterations = cpl_malloc(in->nc * sizeof(*in->added_exist_iterations)); #endif } else { for (dim = 0; dim < in->dim; dim++) { /* Verify */ if (pows[dim] <= in->max_degree[dim]) continue; in->max_degree_alldims += pows[dim] - in->max_degree[dim]; in->max_degree[dim] = pows[dim]; in->eval_pow[dim] = cpl_realloc(in->eval_pow[dim], (size_t)(1+in->max_degree[dim]) * sizeof(double)); } } } /* Set the new number of coefficients */ in->nc = newnc; /* Set the new coefficient */ in->c[in->nc-1] = c; #ifdef CPL_POLYNOMIAL_USE_MULTI_HORNER /* Arrange the added terms for Horner scheme */ if(in->dim != 1) { horner_step = cpl_malloc(sizeof(int) * dim); for(istep = 0; istep < dim; ++istep) { horner_step[istep] = in->max_degree_alldims; } cpl_free(in->added_horner); cpl_free(in->added_exist_iterations); in->added_horner = cpl_malloc(in->nc * sizeof(*in->added_horner)); in->added_exist_iterations = cpl_malloc(in->nc * sizeof(*in->added_exist_iterations)); ireg = 0; powers_tmp = cpl_malloc(sizeof(int) * dim); in->added_exist_index = 0; in->added_iter = 0; cpl_polynomial_arrange_coeffs_horner (in, ireg, horner_step, powers_tmp); cpl_free(horner_step); cpl_free(powers_tmp); } #endif return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Evaluate the polynomial at the given point @param p The polynomial @param x Point of evaluation @return The computed value or undefined on error. The length of x must be the polynomial dimension. A polynomial with no non-zero coefficients evaluates as 0. If the classical evaluation method is used, the computational cost is: For 1-dimensional polynomials the call requires 2n FLOPs where n+1 is the number of coefficients in p, see also cpl_polynomial_eval_1d(). For multivariate polynomials the call requires n*(1+dim) + d_1 + d_2 + ... + d_dim FLOPs, where dim is the dimension, n is the number of coefficients in p and d_i is the highest power used in dimension i, i = 1, 2, ..., dim. If the Horner evaluation method is used the complexity has not been studied yet. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the length of x differs from the dimension of the polynomial */ /*----------------------------------------------------------------------------*/ double cpl_polynomial_eval(const cpl_polynomial * p, const cpl_vector * x) { /* Test entries */ cpl_ensure(p, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(x, CPL_ERROR_NULL_INPUT, -2); cpl_ensure(p->dim == cpl_vector_get_size(x), CPL_ERROR_INCOMPATIBLE_INPUT, -3); if (p->dim == 1) { return cpl_polynomial_eval_1d(p, cpl_vector_get(x, 0), NULL); } else if (p->nc == 0) { return 0; } else { return CPL_POLYNOMIAL_EVAL_FUNCTION(p,x); } } #ifdef CPL_POLYNOMIAL_USE_MULTI_HORNER /*----------------------------------------------------------------------------*/ /** @brief Evaluate the polynomial at the given point @param p The polynomial @param x Point of evaluation @return The computed value or undefined on error. The length of x must be the polynomial dimension. See http://www.uni-giessen.de/tomas.sauer/Publ/runhorner.pdf.gz for a study of the Horner multivariate evaluation algorithm. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the length of x differs from the dimension of the polynomial */ /*----------------------------------------------------------------------------*/ double cpl_polynomial_eval_horner(const cpl_polynomial * p, const cpl_vector * x) { /* This variable is used by the Horner recursive algorithm to know in * which step of the multivariate evaluation we are. */ int * horner_step; /* The ireg is another variable which specifies in which Horner "register" * we are interested. */ int ireg; int istep; int ndim; double val; const double * x_ptr; int * powers_tmp; cpl_polynomial * p_nonconst; ndim = p->dim; /* Have a non-const copy */ p_nonconst = (cpl_polynomial*)p; /* Fill the step array */ /* Consider making this a member (cast to non-const before) */ horner_step = cpl_malloc(sizeof(int) * ndim); /* Consider a memcpy from a reference copy */ for(istep = 0; istep < ndim; ++istep) horner_step[istep] = p->max_degree_alldims; /* The final value is the first "register" in the Horner tree */ ireg = 0; x_ptr = cpl_vector_get_data_const(x); //For performance improvement powers_tmp = cpl_malloc(sizeof(int) * ndim); p_nonconst->added_exist_index = 0; p_nonconst->added_iter = 0; val = cpl_polynomial_register_horner(p_nonconst, ireg, horner_step, powers_tmp, x_ptr); /* Housekeeping */ cpl_free(horner_step); cpl_free(powers_tmp); return val; } /*----------------------------------------------------------------------------*/ /** @brief Arrange the coefficients so that they are suitable to be used efficiently by the Horner algorithm @param p The polynomial Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ void cpl_polynomial_arrange_coeffs_horner(cpl_polynomial * p, int ireg, int * step, int * powers_tmp) { double multiply; double added; int * new_step; int ndim; /* Allocate and copy the new step */ ndim = p->dim; /* If we are in ireg == ndim - 1 the "added" term is one of the coefficients */ if(ireg == p->dim - 1) { int i; int coeff_index; /* Fill the powers for this iteration */ powers_tmp[0] = p->max_degree_alldims - step[0]; for(i = 1; i < ndim; ++i) powers_tmp[i] = step[i-1] - step[i]; coeff_index = cpl_polynomial_coeff_index(p, powers_tmp); if(coeff_index != -1) { added = p->c[coeff_index]; p->added_horner[p->added_exist_index] = added; p->added_exist_iterations[p->added_exist_index] = p->added_iter; p->added_exist_index++; } p->added_iter++; } /* If not, call recursively to get the next register */ else cpl_polynomial_arrange_coeffs_horner(p, ireg + 1, step, powers_tmp); /* If we are in the last step for this register, the multiply term is 0 */ if(step[ireg] == 0) multiply = 0; /* If not, recursively call with different step */ else { int i; new_step = cpl_malloc(sizeof(int) * ndim); memcpy(new_step, step, sizeof(int) * ndim); for(i = ireg; idim; /* If we are in ireg == ndim - 1 the "added" term is one of the coefficients */ if(ireg == p->dim - 1) { /* Verify that this iteration has an existing coefficient */ if(p->added_exist_iterations[p->added_exist_index] == p->added_iter) { added = p->added_horner[p->added_exist_index]; p->added_exist_index++; } else added = 0; p->added_iter++; } /* If not, call recursively to get the next register */ else added = cpl_polynomial_register_horner(p, ireg + 1, step, powers_tmp, x); /* If we are in the last step for this register, the multiply term is 0 */ if(step[ireg] == 0) multiply = 0; /* If not, recursively call with different step */ else { int i; new_step = cpl_malloc(sizeof(int) * ndim); memcpy(new_step, step, sizeof(int) * ndim); for(i = ireg; idim; dim++) { cpl_error_ensure(pows[dim] >= 0, CPL_ERROR_ILLEGAL_INPUT, return(idx), "Dimension %d of %d has negative power %d", dim+1, in->dim, pows[dim]); } /* Find the coeff */ if (in->dim == 1) { if (pows[0] < in->nc) idx = pows[0]; } else { int i; for (i=0; i < in->nc; i++) { if (!memcmp(in->pow + in->dim * i, pows, in->dim * sizeof(int))) break; /* Found the right combination of powers */ } if (i < in->nc) idx = i; } return idx; } #else /*----------------------------------------------------------------------------*/ /** @internal @brief Evaluate the polynomial at the given point (brute force algorithm) @param p The polynomial @param x Point of evaluation @return The computed value or undefined on error. The length of x must be the polynomial dimension. A polynomial with no non-zero coefficients evaluates as 0. For 1-dimensional polynomials the call requires 2n FLOPs where n+1 is the number of coefficients in p, see also cpl_polynomial_eval_1d(). For multivariate polynomials the call requires n*(1+dim) + d_1 + d_2 + ... + d_dim FLOPs, where dim is the dimension, n is the number of coefficients in p and d_i is the highest power used in dimension i, i = 1, 2, ..., dim. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the length of x differs from the dimension of the polynomial */ /*----------------------------------------------------------------------------*/ static double cpl_polynomial_eval_bf(const cpl_polynomial * p, const cpl_vector * x) { const double * x_val = cpl_vector_get_data_const(x); double z = 0; double val; cpl_size i, j; /* Build the table of powers of the evaluation point */ for (j=0; j < p->dim; j++) { /* Allow changes to (the eval-buffer of) p! This is acceptable, because the data that is modified here is not accessed outside this else-block. FIXME: Revise this approach for shared memory parallelism. */ double * eval_powj = (double *) p->eval_pow[j]; /* Already done: eval_powj[0] = 1.0; */ for (i=1; i <= p->max_degree[j]; i++) eval_powj[i] = eval_powj[i-1] * x_val[j]; cpl_tools_add_flops( p->max_degree[j]); } /* Evaluate the polynomial using the table. If the p->eval_pow does not fit in the cache, its memory layout should be changed */ for (i=0; inc; i++) { /* dim is at least 2 */ val = p->eval_pow[0][p->pow[p->dim * i + 0]] * p->eval_pow[1][p->pow[p->dim * i + 1]]; for (j=2; j < p->dim; j++) { val *= p->eval_pow[j][p->pow[p->dim * i + j]]; } z += p->c[i] * val; } cpl_tools_add_flops( p->nc * ( 1 + p->dim ) ); return z; } #endif /*----------------------------------------------------------------------------*/ /** @brief Collapse one dimension of a multi-variate polynomial by composition @param self The multi-variate polynomial @param dim The dimension to collapse (zero for first dimension) @param other The polynomial to replace dimension dim of self @return The collapsed polynomial or NULL on error The dimension of the polynomial self must be one greater than that of the other polynomial. Given these two polynomials the dimension dim of self is collapsed by creating a new polynomial from self(x0, x1, ..., x{dim-1}, other(x0, x1, ..., x{dim-1}, x{dim+1}, x{dim+2}, ..., x{n-1}), x{dim+1}, x{dim+2}, ..., x{n-1}). The created polynomial thus has a dimension which is one less than the polynomial self and which is equal to that of the other polynomial. Collapsing one dimension of a 1D-polynomial is equivalent to evaluating it, which can be done with cpl_polynomial_eval_1d(). FIXME: The other polynomial must currently have a degree of zero, i.e. it must be a constant. Currently, the call requires dn + p FLOPs, where d the dimension of the polynomial self, p is the largest power of dimension dim and n the number of (non-zero) coefficients of the polynomial self. The returned object is a newly allocated cpl_polynomial that must be deallocated by the caller using cpl_polynomial_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the polynomial is uni-variate. - CPL_ERROR_ILLEGAL_INPUT if dim is negative. - CPL_ERROR_ACCESS_OUT_OF_RANGE if dim exceeds the dimension of self. - CPL_ERROR_INCOMPATIBLE_INPUT if other has the wrong dimension. - CPL_ERROR_UNSUPPORTED_MODE if other is not of degree 0. */ /*----------------------------------------------------------------------------*/ cpl_polynomial * cpl_polynomial_extract(const cpl_polynomial * self, cpl_size dim, const cpl_polynomial * other) { cpl_polynomial * collapsed; cpl_size newdim; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(other != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(self->dim > 1, CPL_ERROR_INVALID_TYPE, NULL); cpl_ensure(dim >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(dim < self->dim, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); newdim = self->dim - 1; cpl_ensure(other->dim == newdim, CPL_ERROR_INCOMPATIBLE_INPUT, NULL); /* FIXME: Generalize this */ cpl_ensure(cpl_polynomial_get_degree(other) == 0, CPL_ERROR_UNSUPPORTED_MODE, NULL); collapsed = cpl_polynomial_new(newdim); if (self->nc > 0) { double * eval_powj; cpl_size * pows = (cpl_size*)cpl_malloc((size_t)newdim * sizeof(*pows)); const double x = other->nc == 0 ? 0.0 : other->c[0]; cpl_size i; /* Build the table of powers of the evaluation point */ /* Allow changes to (the eval-buffer of) self! This is acceptable, because the data that is modified here is not accessed outside this else-block. FIXME: Revise this approach for shared memory parallelism. */ eval_powj = (double *) self->eval_pow[dim]; /* Already done: eval_powj[0] = 1.0; */ for (i=1; i <= self->max_degree[dim]; i++) eval_powj[i] = eval_powj[i-1] * x; for (i=0; i < self->nc; i++) { double coeff = self->c[i]; cpl_size j, k; for (k=0, j=0; j < self->dim; j++) { if (j == dim) { coeff *= eval_powj[self->pow[self->dim * i + j]]; } else { pows[k++] = self->pow[self->dim * i + j]; } } coeff += cpl_polynomial_get_coeff(collapsed, pows); (void)cpl_polynomial_set_coeff(collapsed, pows, coeff); } cpl_tools_add_flops( self->max_degree[dim] + self->nc * self->dim ); cpl_free(pows); } return collapsed; } /*----------------------------------------------------------------------------*/ /** @brief Compute a first order partial derivative @param self The polynomial to be modified in place @param dim The dimension to differentiate (zero for first dimension) @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ The dimension of the polynomial is preserved, even if the operation may cause the polynomial to become independent of the dimension dim of the variable. The call requires n FLOPs, where n is the number of (non-zero) polynomial coefficients whose power in dimension dim is at least 1. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if dim is negative. - CPL_ERROR_ACCESS_OUT_OF_RANGE if dim exceeds the dimension of self. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_derivative(cpl_polynomial * self, cpl_size dim) { cpl_size i; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(dim >= 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(dim < self->dim, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (self->nc == 0) return CPL_ERROR_NONE; if (self->dim == 1) { for (i=0; i < self->nc-1; i++) { self->c[i] = self->c[i+1] * (double) (i+1); } cpl_polynomial_delete_coeff(self, &i); } else { /* Remove the terms that are constant with respect to dim */ for (i=0; i < self->nc; ) { if (self->pow[self->dim * i + dim] == 0) { /* FIXME: Memory aliasing occurs here - the contents of the const pointer is actually modified */ cpl_polynomial_delete_coeff(self, self->pow + self->dim * i); } else { i++; } } /* At this point self contains the correct number of terms which now need to be differentiated */ if (self->nc > 0) { for (i=0; i < self->nc; i++) { assert(self->pow[self->dim * i + dim] > 0); self->c[i] *= (double) self->pow[self->dim * i + dim]--; } if (self->max_degree[dim] > 0) { /* Decrement the size of the work-array */ self->eval_pow[dim] = cpl_realloc(self->eval_pow[dim], (size_t)self->max_degree[dim] * sizeof(double)); self->max_degree[dim]--; self->max_degree_alldims--; } } } cpl_tools_add_flops( self->nc ); return CPL_ERROR_NONE; } /* A nested Horner algorithm can be used to evaluate both differences and derivatives. Caveat: All four arguments are evaluated more than once */ #define CPL_HORNER_NESTED(A, B, PA, PB) \ do { \ PB = PA; \ while (n> 1) { \ PA = PA * A + self->c[--n]; \ PB = PB * B + PA; \ } \ PA = PA * A + self->c[0]; \ \ } while (0) /*----------------------------------------------------------------------------*/ /** @brief Evaluate a univariate (1D) polynomial using Horners rule. @param self The 1D-polynomial @param x The point of evaluation @param pd Iff pd is non-NULL, the derivative evaluated at x @return The result or undefined on error. A polynomial with no non-zero coefficents evaluates to 0 with a derivative that does likewise. The result is computed as p_0 + x * ( p_1 + x * ( p_2 + ... x * p_n )) and requires 2n FLOPs where n+1 is the number of coefficients. If the derivative is requested it is computed using a nested Horner rule. This requires 4n FLOPs in total. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the polynomial is not (1D) univariate */ /*----------------------------------------------------------------------------*/ double cpl_polynomial_eval_1d(const cpl_polynomial * self, double x, double * pd) { cpl_long_double result; cpl_size n; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(self->dim == 1, CPL_ERROR_INVALID_TYPE, -3); if (self->nc == 0) { if (pd != NULL) *pd = 0; return 0; } n = self->nc; result = self->c[--n]; if (pd == NULL) { cpl_tools_add_flops( 2 * n ); while (n) result = x * result + self->c[--n]; } else { cpl_long_double d = 0; cpl_tools_add_flops( 4 * n ); if (n) CPL_HORNER_NESTED(x, x, result, d); *pd = d; } return result; } /*----------------------------------------------------------------------------*/ /** @brief Evaluate p(a) - p(b) using Horners rule. @param self The 1D-polynomial @param a The evaluation point of the minuend @param b The evaluation point of the subtrahend @param ppa Iff ppa is not NULL, p(a) @return The difference or undefined on error The call requires about 4n FLOPs where n is the number of coefficients in self, which is the same as that required for two separate polynomial evaluations. cpl_polynomial_eval_1d_diff() is however more accurate. ppa may be NULL. If it is not, *ppa is set to self(a), which is calculated at no extra cost. The underlying algorithm is the same as that used in cpl_polynomial_eval_1d() when the derivative is also requested. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the polynomial has the wrong dimension */ /*----------------------------------------------------------------------------*/ double cpl_polynomial_eval_1d_diff(const cpl_polynomial * self, double a, double b, double * ppa) { cpl_long_double diff, pa; cpl_size n; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(self->dim == 1, CPL_ERROR_INVALID_TYPE, -3); if (self->nc == 0) { if (ppa != NULL) *ppa = 0; return 0; } n = self->nc; pa = self->c[--n]; cpl_tools_add_flops( 4 * n ); CPL_HORNER_NESTED(a, b, pa, diff); if (ppa != NULL) *ppa = pa; return diff * (a - b); } #undef CPL_HORNER_NESTED /*----------------------------------------------------------------------------*/ /** @brief Evaluate a 1D-polynomial on equidistant points using Horners rule @param v Preallocated vector to contain the result @param p The 1D-polynomial @param x0 The first point of evaluation @param d The increment between points of evaluation @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ @see cpl_vector_fill The evaluation points are x_i = x0 + i * d, i=0, 1, ..., n-1, where n is the length of the vector. If d is zero it is preferable to simply use cpl_vector_fill(v, cpl_polynomial_eval_1d(p, x0, NULL)). The call requires about 2nm FLOPs, where m+1 is the number of coefficients in p. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the polynomial has the wrong dimension */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_fill_polynomial(cpl_vector * v, const cpl_polynomial * p, double x0, double d) { cpl_size i = cpl_vector_get_size(v); double * dv = cpl_vector_get_data(v); cpl_ensure_code(v != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(p != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(p->dim == 1, CPL_ERROR_INVALID_TYPE); do { i--; dv[i] = cpl_polynomial_eval_1d(p, x0 + (double)i * d, NULL); } while (i > 0); cpl_tools_add_flops( 2 * cpl_vector_get_size(v) ); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief A real solution to p(x) = 0 using Newton-Raphsons method @param p The 1D-polynomial @param x0 First guess of the solution @param px The solution, on error see below @param mul The root multiplicity (or 1 if unknown) @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ Even if a real solution exists, it may not be found if the first guess is too far from the solution. But a solution is guaranteed to be found if all roots of p are real. If the constant term is zero, the solution 0 will be returned regardless of the first guess. No solution is found when the iterative process stops because: 1) It can not proceed because p`(x) = 0 (CPL_ERROR_DIVISION_BY_ZERO). 2) Only a finite number of iterations are allowed (CPL_ERROR_CONTINUE). Both cases may be due to lack of a real solution or a bad first guess. In these two cases *px is set to the value where the error occurred. In case of other errors *px is unmodified. The accuracy and robustness deteriorates with increasing multiplicity of the solution. This is also the case with numerical multiplicity, i.e. when multiple solutions are located close together. mul is assumed to be the multiplicity of the solution. Knowledge of the root multiplicity often improves the robustness and accuracy. If there is no knowledge of the root multiplicity mul should be 1. Setting mul to a too high value should be avoided. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the polynomial has the wrong dimension - CPL_ERROR_ILLEGAL_INPUT if the multiplicity is non-positive - CPL_ERROR_DIVISION_BY_ZERO if a division by zero occurs - CPL_ERROR_CONTINUE if the algorithm does not converge */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_solve_1d(const cpl_polynomial * p, double x0, double * px, cpl_size mul) { return cpl_polynomial_solve_1d_(p, x0, px, mul, CPL_FALSE) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Fit a polynomial to a set of samples in a least squares sense @param self Polynomial of dimension d to hold the coefficients @param samppos Matrix of p sample positions, with d rows and p columns @param sampsym NULL, or d booleans, true iff the sampling is symmetric @param fitvals Vector of the p values to fit @param fitsigm Uncertainties of the sampled values, or NULL for all ones @param dimdeg True iff there is a fitting degree per dimension @param mindeg Pointer to 1 or d minimum fitting degree(s), or NULL @param maxdeg Pointer to 1 or d maximum fitting degree(s), at least mindeg @return CPL_ERROR_NONE on success, else the relevant #_cpl_error_code_ @note Currently only uni- and bi-variate polynomials are supported, fitsigm must be NULL. For all but uni-variate polynomials mindeg must be zero. @see cpl_vector_fill_polynomial_fit_residual() Any pre-set non-zero coefficients in self are overwritten or reset by the fit. For 1D-polynomials N = 1 + maxdeg - mindeg coefficients are fitted. For multi-variate polynomials the fit depends on dimdeg: If dimdeg is false, an n-degree coefficient is fitted iff mindeg <= n <= maxdeg. For a 2D-polynomial this means that N * (N + 1) / 2 coefficients are fitted. If dimdeg is true, nci = 1 + maxdeg[i] + mindeg[i] coefficients are fitted for dimension i, i.e. for a 2D-polynomial N = nc1 * nc2 coefficients are fitted. The number of distinct samples should exceed the number of coefficients to fit. The number of distinct samples may also equal the number of coefficients to fit, but in this case the fit has another meaning (any non-zero residual is due to rounding errors, not a fitting error). It is an error to try to fit more coefficients than there are distinct samples. If the relative uncertainties of the sampled values are known, they may be passed via fitsigm. NULL means that all uncertainties equals one. symsamp is ignored if mindeg is nonzero, otherwise the caller may use sampsym to indicate an a priori knowledge that the sampling positions are symmetric. NULL indicates no knowledge of such symmetry. sampsym[i] may be set to true iff the sampling is symmetric around u_i, where u_i is the mean of the sampling positions in dimension i. In 1D this implies that the sampling points as pairs average u_0 (with an odd number of samples one sample must equal u_0). E.g. both x = (1, 2, 4, 6, 7) and x = (1, 6, 4, 2, 7) have sampling symmetry, while x = (1, 2, 4, 6) does not. In 2D this implies that the sampling points are symmetric in the 2D-plane. For the first dimension sampling symmetry means that the sampling is line- symmetric around y = u_1, while for the second dimension, sampling symmetry implies line-symmetry around x = u_2. Point symmetry around (x,y) = (u_1, u_2) means that both sampsym[0] and sampsym[1] may be set to true. Knowledge of symmetric sampling allows the fit to be both faster and eliminates certain round-off errors. For higher order fitting the fitting problem known as "Runge's phenomenon" is minimized using the socalled "Chebyshev nodes" as sampling points. For Chebyshev nodes symsamp can be set to CPL_TRUE. Warning: An increase in the polynomial degree will normally reduce the fitting error. However, due to rounding errors and the limited accuracy of the solver of the normal equations, an increase in the polynomial degree may at some point cause the fitting error to _increase_. In some cases this happens with an increase of the polynomial degree from 8 to 9. The fit is done in the following steps: 1) If mindeg is zero, the sampling positions are first transformed into Xhat_i = X_i - mean(X_i), i=1, .., dimension. 2) The Vandermonde matrix is formed from Xhat. 3) The normal equations of the Vandermonde matrix is solved. 4) If mindeg is zero, the resulting polynomial in Xhat is transformed back to X. For a univariate (1D) fit the call requires 6MN + N^3/3 + 7/2N^2 + O(M) FLOPs where M is the number of data points and where N is the number of polynomial coefficients to fit, N = 1 + maxdeg - mindeg. For a bivariate fit the call requires MN^2 + N^3/3 + O(MN) FLOPs where M is the number of data points and where N is the number of polynomial coefficients to fit. Examples of usage: @code cpl_polynomial * fit1d = cpl_polynomial_new(1); cpl_matrix * samppos1d = my_sampling_points_1d(); // 1-row matrix cpl_vector * fitvals = my_sampling_values(); const cpl_boolean sampsym = CPL_TRUE; const int maxdeg1d = 4; // Fit 5 coefficients cpl_error_code error1d = cpl_polynomial_fit(fit1d, samppos1d, &sampsym, fitvals, NULL, CPL_FALSE, NULL, &maxdeg1d); @endcode @code cpl_polynomial * fit2d = cpl_polynomial_new(2); cpl_matrix * samppos2d = my_sampling_points_2d(); // 2-row matrix cpl_vector * fitvals = my_sampling_values(); const int maxdeg2d[] = {2, 1}; // Fit 6 coefficients cpl_error_code error2d = cpl_polynomial_fit(fit2d, samppos2d, NULL, fitvals, NULL, CPL_FALSE, NULL, maxdeg2d); @endcode Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if a mindeg value is negative, or if a maxdeg value is less than the corresponding mindeg value. - CPL_ERROR_DATA_NOT_FOUND if the number of columns in samppos is less than the number of coefficients to be determined. - CPL_ERROR_INCOMPATIBLE_INPUT if samppos, fitvals or fitsigm have incompatible sizes, or if samppos, self or sampsym have incompatible sizes. - CPL_ERROR_SINGULAR_MATRIX if samppos contains too few distinct values - CPL_ERROR_DIVISION_BY_ZERO if an element in fitsigm is zero - CPL_ERROR_UNSUPPORTED_MODE if the polynomial dimension exceeds two, or if there is a non-zero value in the mindeg array. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_fit(cpl_polynomial * self, const cpl_matrix * samppos, const cpl_boolean * sampsym, const cpl_vector * fitvals, const cpl_vector * fitsigm, cpl_boolean dimdeg, const cpl_size * mindeg, const cpl_size * maxdeg) { const cpl_size mdim = cpl_polynomial_get_dimension(self); const cpl_size np = cpl_vector_get_size(fitvals); cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(samppos != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(fitvals != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(maxdeg != NULL, CPL_ERROR_NULL_INPUT); if (cpl_matrix_get_ncol(samppos) != np) return cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "Number of " "fitting values = %" CPL_SIZE_FORMAT " <=> % " CPL_SIZE_FORMAT " = samppos col" "umns", np, cpl_matrix_get_ncol(samppos)); if (cpl_matrix_get_nrow(samppos) != mdim) return cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "Fitting " "dimension = %" CPL_SIZE_FORMAT " <=> %" CPL_SIZE_FORMAT " = samppos rows", mdim, cpl_matrix_get_nrow(samppos)); if (fitsigm != NULL && cpl_vector_get_size(fitsigm) != np) return cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "Number of " "fitting values = %" CPL_SIZE_FORMAT " <=" "> % " CPL_SIZE_FORMAT " = number of er" "rors", np, cpl_vector_get_size(fitsigm)); if (fitsigm != NULL) return cpl_error_set_message_(CPL_ERROR_UNSUPPORTED_MODE, "fitsigm = " "%p != NULL is not supported (yet)", (const void*)fitsigm); CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual); if (mdim == 1) { cpl_vector * x_pos = cpl_vector_wrap(np, cpl_matrix_get_data((cpl_matrix*)samppos)); const cpl_boolean isampsym = sampsym ? sampsym[0] : CPL_FALSE; const int mindeg0 = mindeg ? mindeg[0] : 0; const cpl_error_code error = cpl_polynomial_fit_1d(self, x_pos, fitvals, mindeg0, maxdeg[0], isampsym, NULL); CPL_DIAG_PRAGMA_POP; (void)cpl_vector_unwrap(x_pos); if (error) return cpl_error_set_where_(); } else if (mdim > 2) { return cpl_error_set_message_(CPL_ERROR_UNSUPPORTED_MODE, "The fitting " "dimension %d > 2 is not supported", (int)mdim); CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual); } else if ((!mindeg || (mindeg[0] == 0 && (!dimdeg || mindeg[1] == 0)))) { cpl_vector * x_pos = cpl_vector_wrap(np, cpl_matrix_get_data((cpl_matrix *)samppos)); cpl_vector * y_pos = cpl_vector_wrap(np, np + cpl_matrix_get_data((cpl_matrix *)samppos)); cpl_bivector * xy_pos = cpl_bivector_wrap_vectors(x_pos, y_pos); const cpl_error_code error = cpl_polynomial_fit_2d(self, xy_pos, fitvals, dimdeg, maxdeg, NULL); CPL_DIAG_PRAGMA_POP; assert( mdim == 2 ); (void)cpl_vector_unwrap(x_pos); (void)cpl_vector_unwrap(y_pos); cpl_bivector_unwrap_vectors(xy_pos); if (error) return cpl_error_set_where_(); } else { assert( mdim == 2 ); return cpl_error_set_message_(CPL_ERROR_UNSUPPORTED_MODE, "In a 2D-fit " "mindeg must be NULL or contain zero(s)"); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Compute the residual of a polynomial fit @param self Vector to hold the fitting residuals, fitvals may be used @param fitvals Vector of the p fitted values @param fitsigm Uncertainties of the sampled values or NULL for a uniform uncertainty @param fit The fitted polynomial @param samppos Matrix of p sample positions, with d rows and p columns @param rechisq If non-NULL, the reduced chi square of the fit @return CPL_ERROR_NONE on success, else the relevant #_cpl_error_code_ @note If necessary, self is resized to the length of fitvals. @see cpl_polynomial_fit() It is allowed to pass the same vector as both fitvals and as self, in which case fitvals is overwritten with the residuals. If the relative uncertainties of the sampled values are known, they may be passed via fitsigm. NULL means that all uncertainties equal one. The uncertainties are taken into account when computing the reduced chi square value. If rechisq is non-NULL, the reduced chi square of the fit is computed as well. The mean square error, which was computed directly by the former CPL functions cpl_polynomial_fit_1d_create() and cpl_polynomial_fit_2d_create() can be computed from the fitting residual like this: @code const double mse = cpl_vector_product(fitresidual, fitresidual) / cpl_vector_get_size(fitresidual); @endcode Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer (other than fitsigm) is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if samppos, fitvals, fitsigm or fit have incompatible sizes - CPL_ERROR_DIVISION_BY_ZERO if an element in fitsigm is zero - CPL_ERROR_DATA_NOT_FOUND if the number of columns in samppos is less than the number of coefficients in the fitted polynomial. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_fill_polynomial_fit_residual(cpl_vector * self, const cpl_vector * fitvals, const cpl_vector * fitsigm, const cpl_polynomial * fit, const cpl_matrix * samppos, double * rechisq) { const cpl_size mdim = cpl_polynomial_get_dimension(fit); const cpl_size np = cpl_vector_get_size(fitvals); cpl_vector * sampoint; double * dsampoint; double * dself; cpl_size i, j; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(fitvals != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(fit != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(samppos != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_matrix_get_ncol(samppos) == np, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(cpl_matrix_get_nrow(samppos) == mdim, CPL_ERROR_INCOMPATIBLE_INPUT); /* May not be under-determined */ cpl_ensure_code(np >= fit->nc, CPL_ERROR_DATA_NOT_FOUND); cpl_vector_set_size(self, np); dself = cpl_vector_get_data(self); sampoint = cpl_vector_new(mdim); dsampoint = cpl_vector_get_data(sampoint); /* FIXME: Use direct pointer access for matrix ? */ for (i = 0; i < np; i++) { for (j = 0; j < mdim; j++) { dsampoint[j] = cpl_matrix_get(samppos, j, i); } dself[i] = cpl_vector_get(fitvals, i) - cpl_polynomial_eval(fit, sampoint); } cpl_vector_delete(sampoint); cpl_tools_add_flops( np ); if (rechisq != NULL) { /* Assuming that the np sampling points are distinct! */ const int nfree = np - fit->nc; cpl_ensure_code(nfree > 0, CPL_ERROR_DATA_NOT_FOUND); if (fitsigm == NULL) { *rechisq = cpl_vector_product(self, self) / nfree; } else { const double * dsigm = cpl_vector_get_data_const(fitsigm); double delta; double dot = 0.0; cpl_ensure_code(cpl_vector_get_size(fitsigm) == np, CPL_ERROR_INCOMPATIBLE_INPUT); for (i = 0; i < np; i++) { /* Sigmas may be negative, the sign is ignored */ cpl_ensure_code(dsigm[i] != 0.0, CPL_ERROR_DIVISION_BY_ZERO); delta = dself[i] / dsigm[i]; dot += delta * delta; } *rechisq = dot / nfree; cpl_tools_add_flops( 3 * np ); } } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Modify p, p(x0, x1, ..., xi, ...) := (x0, x1, ..., xi+u, ...) @param p The polynomial to be modified in place @param i The dimension to shift (0 for first) @param u The shift @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ @note Currently, only dimensions 1 and 2 are supported Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if i is negative - CPL_ERROR_ACCESS_OUT_OF_RANGE if i exceeds the dimension of p - CPL_ERROR_UNSUPPORTED_MODE if the polynomial has a dimension larger than 2 */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_shift_1d(cpl_polynomial * p, cpl_size i, double u) { const cpl_size ndim = cpl_polynomial_get_dimension(p); cpl_ensure_code(p != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(i >= 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(i < ndim, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (ndim == 1) { /* Should not be able to fail now */ if (p->nc) cpl_polynomial_shift_double( p->c, p->nc, u); } else if (ndim == 2) { const cpl_size ndeg = cpl_polynomial_get_degree(p); cpl_polynomial * p1d = cpl_polynomial_new(1); cpl_size powers[2]; cpl_size * pi2 = powers + 1 - i; /* Other power */ cpl_ensure_code(p1d != NULL, CPL_ERROR_NULL_INPUT); /* Should not be able to fail now */ for (*pi2 = ndeg; *pi2 >=0; (*pi2)--) { cpl_size * pshift = powers + i; /* Copy to a 1D all coefficients with this power*/ /* - *pi2 decreases so all coeffs in p1d are overwritten */ /* - *pshift decreases to avoid realloc() in _set_coeff() */ for (*pshift = ndeg - *pi2; *pshift >= 0; (*pshift)--) { assert(powers[i] == *pshift); cpl_polynomial_set_coeff(p1d, pshift, cpl_polynomial_get_coeff(p, powers)); } if (p1d->nc) cpl_polynomial_shift_double( p1d->c, p1d->nc, u); /* Copy back, overwriting any old coeffs */ for (*pshift = ndeg - *pi2; *pshift >= 0; (*pshift)--) { assert(powers[i] == *pshift); cpl_polynomial_set_coeff(p, powers, cpl_polynomial_get_coeff(p1d, pshift)); } } cpl_polynomial_delete(p1d); } else { return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Fit a 1D-polynomial to a 1D-signal in a least squares sense @param x_pos Vector of positions of the signal to fit. @param values Vector of values of the signal to fit. @param degree Non-negative polynomial degree. @param mse Iff mse is not null, the mean squared error on success @return The fitted polynomial or NULL on error @see cpl_polynomial_fit() @deprecated Replace this call with cpl_polynomial_fit() and optionally cpl_vector_fill_polynomial_fit_residual(). */ /*----------------------------------------------------------------------------*/ cpl_polynomial * cpl_polynomial_fit_1d_create(const cpl_vector * x_pos, const cpl_vector * values, cpl_size degree, double * mse) { cpl_polynomial * self = cpl_polynomial_new(1); const cpl_boolean is_eqdist = cpl_vector_is_eqdist(x_pos) == 1; const cpl_error_code error = cpl_polynomial_fit_1d(self, x_pos, values, 0, degree, is_eqdist, mse); if (error != CPL_ERROR_NONE) { cpl_polynomial_delete(self); self = NULL; cpl_error_set_(error); } return self; } /*----------------------------------------------------------------------------*/ /** @brief Fit a 2D-polynomial to a 2D-surface in a least squares sense @param xy_pos Bivector positions of the surface to fit. @param values Vector of values of the surface to fit. @param degree Non-negative polynomial degree. @param mse Iff mse is not null, the mean squared error on success @return The fitted polynomial or NULL on error @see cpl_polynomial_fit() @deprecated Replace this call with cpl_polynomial_fit() and optionally cpl_vector_fill_polynomial_fit_residual(). */ /*----------------------------------------------------------------------------*/ cpl_polynomial * cpl_polynomial_fit_2d_create(cpl_bivector * xy_pos, cpl_vector * values, cpl_size degree, double * mse) { cpl_polynomial * self = cpl_polynomial_new(2); const cpl_error_code error = cpl_polynomial_fit_2d(self, xy_pos, values, CPL_FALSE, °ree, mse); if (error != CPL_ERROR_NONE) { cpl_polynomial_delete(self); self = NULL; cpl_error_set_(error); } return self; } /*----------------------------------------------------------------------------*/ /** @brief Add two polynomials of the same dimension @param self The polynomial to hold the result @param first The 1st polynomial to add @param second The 2nd polynomial to add @return CPL_ERROR_NONE or the relevant CPL error code @note self may be passed also as first and/or second Possible CPL error code set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the polynomials do not have identical dimensions - CPL_ERROR_UNSUPPORTED_MODE if the dimension is not 1 (FIXME) */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_add(cpl_polynomial * self, const cpl_polynomial * first, const cpl_polynomial * second) { cpl_size degree0 = cpl_polynomial_get_degree(self); const cpl_size degree1 = cpl_polynomial_get_degree(first); const cpl_size degree2 = cpl_polynomial_get_degree(second); const cpl_size maxdeg = degree1 > degree2 ? degree1 : degree2; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(first != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(second != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_polynomial_get_dimension(self) == cpl_polynomial_get_dimension(first), CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(cpl_polynomial_get_dimension(self) == cpl_polynomial_get_dimension(second), CPL_ERROR_INCOMPATIBLE_INPUT); /* FIXME: */ cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1, CPL_ERROR_UNSUPPORTED_MODE); if (degree0 < maxdeg) { degree0 = maxdeg; } else { /* Reset coefficients in self as needed */ for (; degree0 > maxdeg; degree0--) { cpl_polynomial_delete_coeff(self, °ree0); } } assert( degree0 == maxdeg ); for (; degree0 >= 0; degree0--) { const double val1 = cpl_polynomial_get_coeff(first, °ree0); const double val2 = cpl_polynomial_get_coeff(second, °ree0); cpl_polynomial_set_coeff(self, °ree0, val1 + val2); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Subtract two polynomials of the same dimension @param self The polynomial to hold the result @param first The polynomial to subtract from @param second The polynomial to subtract @return CPL_ERROR_NONE or the relevant CPL error code @note self may be passed also as first and/or second Possible CPL error code set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the polynomials do not have identical dimensions - CPL_ERROR_UNSUPPORTED_MODE if the dimension is not 1 (FIXME) */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_subtract(cpl_polynomial * self, const cpl_polynomial * first, const cpl_polynomial * second) { cpl_size degree0 = cpl_polynomial_get_degree(self); const cpl_size degree1 = cpl_polynomial_get_degree(first); const cpl_size degree2 = cpl_polynomial_get_degree(second); const cpl_size maxdeg = degree1 > degree2 ? degree1 : degree2; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(first != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(second != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_polynomial_get_dimension(self) == cpl_polynomial_get_dimension(first), CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(cpl_polynomial_get_dimension(self) == cpl_polynomial_get_dimension(second), CPL_ERROR_INCOMPATIBLE_INPUT); /* FIXME: */ cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1, CPL_ERROR_UNSUPPORTED_MODE); if (degree0 < maxdeg) { degree0 = maxdeg; } else { /* Reset coefficients in self as needed */ for (; degree0 > maxdeg; degree0--) { cpl_polynomial_delete_coeff(self, °ree0); } } assert( degree0 == maxdeg ); for (; degree0 >= 0; degree0--) { const double val1 = cpl_polynomial_get_coeff(first, °ree0); const double val2 = cpl_polynomial_get_coeff(second, °ree0); cpl_polynomial_set_coeff(self, °ree0, val1 - val2); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Multiply a polynomial with a scalar @param self The polynomial to hold the result @param other The polynomial to scale, may equal self @param factor The factor to multiply with @return CPL_ERROR_NONE or the relevant CPL error code Possible CPL error code set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_UNSUPPORTED_MODE if the dimension is not 1 (FIXME) */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_multiply_scalar(cpl_polynomial * self, const cpl_polynomial * other, double factor) { const cpl_size maxdeg = cpl_polynomial_get_degree(other); const cpl_size zerodeg = cpl_polynomial_get_degree(self); cpl_size degree; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(other != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1, CPL_ERROR_UNSUPPORTED_MODE); cpl_ensure_code(cpl_polynomial_get_dimension(other) == 1, CPL_ERROR_UNSUPPORTED_MODE); for (degree = 0; degree <= maxdeg; degree++) { const double val = factor * cpl_polynomial_get_coeff(other, °ree); cpl_polynomial_set_coeff(self, °ree, val); } /* Reset coefficients in self as needed */ for (; degree <= zerodeg; degree++) { cpl_polynomial_delete_coeff(self, &zerodeg); } return CPL_ERROR_NONE; } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Fit a 1D-polynomial to a 1D-signal in a least squares sense @param self 1D-polynomial to hold the fit @param x_pos Vector of positions of the signal to fit. @param values Vector of values of the signal to fit. @param mindeg The non-negative minimum fitting degree @param degree The polynomial fitting degree, at least mindeg @param symsamp True iff the x_pos values are symmetric around their mean @param mse Iff mse is not null, the mean squared error on success @return The fitted polynomial or NULL on error @see cpl_polynomial_fit_1d_create() symsamp is ignored if mindeg is nonzero, otherwise symsamp may to be set to CPL_TRUE if and only if the values in x_pos are known a-priori to be symmetric around their mean, e.g. (1, 2, 4, 6, 10, 14, 16, 18, 19), but not (1, 2, 4, 6, 10, 14, 16). Setting symsamp to CPL_TRUE while mindeg is zero eliminates certain round-off errors. For higher order fitting the fitting problem known as "Runge's phenomenon" is minimized using the socalled "Chebyshev nodes" as sampling points. For Chebyshev nodes symsamp can be set to CPL_TRUE. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_fit_1d(cpl_polynomial * self, const cpl_vector * x_pos, const cpl_vector * values, cpl_size mindeg, cpl_size degree, cpl_boolean symsamp, double * mse) { /* Number of unknowns to determine */ const cpl_size pdeg = cpl_polynomial_get_degree(self); const cpl_size nc = 1 + degree - mindeg; const cpl_size np = cpl_vector_get_size(x_pos); double mean; double delta, xval; cpl_vector * xhat; const cpl_vector * xuse; cpl_matrix * mh; /* Hankel matrix */ cpl_matrix * mx; cpl_size i, j; cpl_error_code error; cpl_ensure_code(np > 0, cpl_error_get_code()); cpl_ensure_code(values, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_vector_get_size(values) == np, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(mindeg >= 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(degree >= mindeg, CPL_ERROR_ILLEGAL_INPUT); symsamp = symsamp && (mindeg == 0); /* symsamp not usable with mindeg > 0 */ /* Reset coefficients below mindeg */ for (i = 0; i < mindeg; i++) { cpl_polynomial_delete_coeff(self, &i); } /* Reset coefficients above degree */ for (i = degree + 1; i <= pdeg; i++) { cpl_polynomial_delete_coeff(self, &i); } if (degree == mindeg) { /* Handle this one-coefficient polynomial as a special case */ if (degree == 0) { /* Handle this zero-degree polynomial as a special case */ /* If requested, compute mean squared error */ if (mse != NULL) *mse = cpl_tools_get_variance_double(cpl_vector_get_data_const(values), np, &mean); else mean = cpl_vector_get_mean(values); } else { /* A polynomial with just one coefficient and a positive degree is requested. The coefficient must therefore be non-zero. */ /* Raise values to the power of mindeg */ const double * xpos = cpl_vector_get_data_const(x_pos); const double * dval = cpl_vector_get_data_const(values); double h = 0.0; /* Hankel = Transpose(Vandermonde) * Vandermonde */ double vtv = 0.0; /* Transpose(Vandermonde) * values */ for (i=0; i < np; i++) { const double xn = cpl_tools_ipow(xpos[i], (int)mindeg); vtv += xn * dval[i]; h += xn * xn; } if (h > 0.0) { mean = vtv / h; } else { return cpl_error_set_message_(CPL_ERROR_DIVISION_BY_ZERO, "mindeg=%" CPL_SIZE_FORMAT ". " "degree=%" CPL_SIZE_FORMAT ". " "nc=%" CPL_SIZE_FORMAT ". " "np=%" CPL_SIZE_FORMAT ". " "Coeff = %g / %g", mindeg, degree, nc, np, vtv, h); } } /* Should not be able to fail now, nevertheless propagate */ return cpl_error_set_(cpl_polynomial_set_coeff(self, °ree, mean)); } cpl_ensure_code(np >= nc, CPL_ERROR_DATA_NOT_FOUND); /* The Hankel matrix may be singular in such a fashion, that the pivot points in its Cholesky decomposition are positive due to rounding errors. To ensure that such singular systems are robustly detected, the number of distinct sampling points is counted. */ cpl_ensure_code(!cpl_vector_ensure_distinct(x_pos, nc), CPL_ERROR_SINGULAR_MATRIX); /* Try to detect if the x-points are equidistant - in which every other skew diagonal of the Hankel matrix is zero */ xval = cpl_vector_get(x_pos, 1); delta = xval - cpl_vector_get(x_pos, 0); for (i=1; i < np-1; i++) { const double dprev = delta; const double xprev = xval; xval = cpl_vector_get(x_pos, i+1); delta = xval - xprev; if (delta != dprev) break; } if (mindeg == 0) { /* Transform: xhat = x - mean(x) */ xhat = cpl_vector_transform_mean(x_pos, &mean); xuse = xhat; } else { mean = 0.0; xhat = NULL; xuse = x_pos; } assert( xuse != NULL ); /* Generate Hankel matrix, H = V' * V, where V is the Vandermonde matrix */ /* FIXME: It is faster and likely more accurate to compute the QR factorization of the Vandermonde matrix, QR = V, see C.J. Demeure: Fast QR Factorization of Vandermonde Matrices */ /* mh is initialized only if xuse is not equidistant */ mh = symsamp ? cpl_matrix_new(nc, nc) : cpl_matrix_wrap(nc, nc, cpl_malloc((size_t)(nc * nc) * sizeof(double))); mx = cpl_matrix_wrap(nc, 1, cpl_malloc((size_t)(nc * 1) * sizeof(double))); cpl_matrix_fill_normal_vandermonde(mh, mx, xuse, symsamp, mindeg, values); #ifdef CPL_POLYNOMIAL_FIT_DEBUG cpl_msg_warning(cpl_func, "MINDEG=%" CPL_SIZE_FORMAT ". degree=%" CPL_SIZE_FORMAT ". nc=%" CPL_SIZE_FORMAT ". np=%" CPL_SIZE_FORMAT ". mean=%g", mindeg, degree, nc, np, mean); cpl_matrix_dump(mh, stdout); cpl_matrix_dump(mx, stdout); #endif cpl_vector_delete(xhat); error = cpl_matrix_solve_spd(mh, mx); cpl_matrix_delete(mh); if (error) { cpl_matrix_delete(mx); return cpl_error_set_message_(error, "mindeg=%" CPL_SIZE_FORMAT ". degree=%" CPL_SIZE_FORMAT ". nc=%" CPL_SIZE_FORMAT ". np=%" CPL_SIZE_FORMAT ". mean=%g", mindeg, degree, nc, np, mean); } /* Scale back - and store coefficients - with leading coefficient first, see doxygen of cpl_polynomial_set_coeff() */ for (j = nc-1; j >= 0; j--) { const double coeff = cpl_matrix_get(mx, j, 0); const cpl_size k = j + mindeg; cpl_polynomial_set_coeff(self, &k, coeff); } cpl_matrix_delete(mx); if (mindeg == 0) { /* Shift back */ cpl_polynomial_shift_1d(self, 0, -mean); } /* If requested, compute mean squared error */ if (mse != NULL) { *mse = 0; for (i=0; i < np; i++) { /* Subtract from the true value, square, accumulate */ const double residue = cpl_vector_get(values, i) - cpl_polynomial_eval_1d(self, cpl_vector_get(x_pos, i), NULL); *mse += residue * residue; } /* Average the error term */ *mse /= (double)np; cpl_tools_add_flops( 3 * np + 1 ); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Fit a 2D-polynomial to a 2D-surface in a least squares sense @param xy_pos Bivector positions of the surface to fit. @param values Vector of values of the surface to fit. @param dimdeg True iff there is a fitting degree per dimension @param maxdeg Pointer to 1 or d maximum fitting degree(s), at least mindeg @param mse Iff mse is not null, the mean squared error on success @return The fitted polynomial or NULL on error @see cpl_polynomial_fit_2d_create */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_polynomial_fit_2d(cpl_polynomial * self, const cpl_bivector * xy_pos, const cpl_vector * values, cpl_boolean dimdeg, const cpl_size * maxdeg, double * mse) { const cpl_size np = cpl_bivector_get_size(xy_pos); cpl_size degree; /* The degree of the fitted polynomial */ /* Number of unknowns to determine */ cpl_size nc; cpl_matrix * mv; /* The transpose of the Vandermonde matrix */ cpl_matrix * mh; /* Block-Hankel matrix, V'*V */ cpl_matrix * mb; cpl_matrix * mx; const double * coeffs1d; double * dmv; cpl_vector * xhat; cpl_vector * yhat; double xmean; double ymean; cpl_size powers[2]; cpl_size degx, degy; cpl_size i, j; cpl_error_code error; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_polynomial_get_dimension(self) == 2, CPL_ERROR_INVALID_TYPE); cpl_ensure_code(np > 0, cpl_error_get_code()); cpl_ensure_code(values != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(maxdeg != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_vector_get_size(values) == np, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(maxdeg[0] >= 0, CPL_ERROR_ILLEGAL_INPUT); if (dimdeg) { cpl_ensure_code(maxdeg[1] >= 0, CPL_ERROR_ILLEGAL_INPUT); degree = maxdeg[0] + maxdeg[1]; nc = (maxdeg[0] + 1) * (maxdeg[1] + 1); } else { degree = maxdeg[0]; nc = (maxdeg[0] + 1) * (maxdeg[0] + 2) / 2; } cpl_ensure_code(np >= nc, CPL_ERROR_DATA_NOT_FOUND); /* Reset coefficients above degree, using easy direct access. */ for (i = 0; i < self->nc;) { if (dimdeg ? self->pow[2 * i + 0] > maxdeg[0] || self->pow[2 * i + 1] > maxdeg[1] : self->pow[2 * i + 0] + self->pow[2 * i + 1] > degree) { cpl_polynomial_delete_coeff(self, self->pow + 2 * i); } else { i++; } } if (degree == 0) { /* Handle this as a special case */ powers[0] = powers[1] = 0; /* Copy-paste from 1D 0-degree */ /* If requested, compute mean squared error */ if (mse != NULL) *mse = cpl_tools_get_variance_double(cpl_vector_get_data_const (values), np, &xmean); else xmean = cpl_vector_get_mean(values); return cpl_polynomial_set_coeff(self, powers, xmean); } /* Transform: xhat = x - mean(x) */ xhat = cpl_vector_transform_mean(cpl_bivector_get_x_const(xy_pos), &xmean); assert( xhat != NULL ); /* Transform: yhat = y - mean(y) */ yhat = cpl_vector_transform_mean(cpl_bivector_get_y_const(xy_pos), &ymean); assert( yhat != NULL ); /* Initialize matrices */ /* mv contains the polynomial terms in the order described */ /* above in each row, for each input point. */ dmv = (double*)cpl_malloc((size_t)(nc * np) * sizeof(double)); mv = cpl_matrix_wrap(nc, np, dmv); /* Has redundant FLOPs, appears to improve accuracy */ for (i=0; i < np; i++) { const double x = cpl_vector_get(xhat, i); const double y = cpl_vector_get(yhat, i); double yvalue = 1.0; j = 0; for (degy = 0; degy <= (dimdeg ? maxdeg[1] : degree); degy++) { double xvalue = 1.0; for (degx = 0; degx <= (dimdeg ? maxdeg[0] : degree - degy); degx++, j++) { dmv[np * j + i] = xvalue * yvalue; xvalue *= x; } yvalue *= y; } assert( j == nc ); } cpl_tools_add_flops( np * (nc * 2 + 1 + (dimdeg ? maxdeg[1] : degree))); cpl_vector_delete(xhat); cpl_vector_delete(yhat); /* mb contains the values, it is _not_ modified */ CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual); mb = cpl_matrix_wrap(np, 1, cpl_vector_get_data((cpl_vector*)values)); CPL_DIAG_PRAGMA_POP; /* Form the right hand side of the normal equations */ mx = cpl_matrix_product_create(mv, mb); (void)cpl_matrix_unwrap(mb); /* Form the matrix of the normal equations */ mh = cpl_matrix_product_normal_create(mv); cpl_matrix_delete(mv); /* Solve XA=B by a least-square solution (aka pseudo-inverse). */ error = cpl_matrix_solve_spd(mh, mx); cpl_matrix_delete(mh); if (error) { cpl_matrix_delete(mx); return cpl_error_set_(error); } /* Store coefficients for output */ coeffs1d = cpl_matrix_get_data(mx); for (j = 0; j < nc; j++) { if (isnan(coeffs1d[j])) { cpl_matrix_delete(mx); return cpl_error_set_(CPL_ERROR_DIVISION_BY_ZERO); } } j = 0; for (degy = 0; degy <= (dimdeg ? maxdeg[1] : degree); degy++) { powers[1] = degy; for (degx = 0; degx <= (dimdeg ? maxdeg[0] : degree - degy); degx++, j++) { powers[0] = degx; if (coeffs1d[j] != cpl_matrix_get(mx, j, 0)) break; cpl_polynomial_set_coeff(self, powers, cpl_matrix_get(mx, j, 0)); } if (degx <= (dimdeg ? maxdeg[0] : degree - degy)) break; } cpl_matrix_delete(mx); cpl_ensure_code(j == nc, CPL_ERROR_UNSPECIFIED); /* Transform the polynomial back */ cpl_polynomial_shift_1d(self, 0, -xmean); cpl_polynomial_shift_1d(self, 1, -ymean); /* If requested, compute mean squared error */ if (mse != NULL) { const cpl_vector * x_pos = cpl_bivector_get_x_const(xy_pos); const cpl_vector * y_pos = cpl_bivector_get_y_const(xy_pos); cpl_vector * x_val = cpl_vector_new(2); double residue; *mse = 0; for (i=0; ipow as pows causes memory aliasing. This is allowed, but pows[] will be modified (or even unallocated) by the call. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if pows contains negative values */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_polynomial_delete_coeff(cpl_polynomial * self, const cpl_size * pows) { cpl_size i, dim; cpl_size ind; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pows != NULL, CPL_ERROR_NULL_INPUT); for (dim=0; dim < self->dim; dim++) cpl_ensure_code(pows[dim] >= 0, CPL_ERROR_ILLEGAL_INPUT); if (self->dim == 1) { /* Handle 1D as a special case */ if (pows[0] == self->nc-1) { /* Leading 1D-coefficient is zero - find the new leading */ do { self->nc--; } while (self->nc > 0 && self->c[self->nc - 1] == 0.0); if (self->nc > 0) self->c = cpl_realloc(self->c, (size_t)self->nc * sizeof(double)); else cpl_free(self->c); } else if (pows[0] < self->nc-1) { self->c[pows[0]] = 0.0; } return CPL_ERROR_NONE; } /* Find the coeff of the multi-variate polynomial */ for (i=0; i < self->nc; i++) { if (!memcmp(self->pow + (size_t)(self->dim * i), pows, (size_t)self->dim * sizeof(cpl_size))) break; /* Found the right combination of powers */ } if (i == self->nc) return CPL_ERROR_NONE; /* The coefficient exists: Set it to zero and return */ ind = i; /* Shrink polynomium */ self->nc--; /* Shrink array of powers */ if (self->nc > 0) { /* self->nc now points to the last coefficient in the polynomial */ /* Reduce (if possible) the length of the power-table */ for (dim = 0; dim < self->dim; dim++) { cpl_size new_max; if (self->pow[self->dim * ind + dim] < self->max_degree[dim]) continue; /* The max-power of this dim may decrease */ new_max = 0; for (i=0; i < self->nc && new_max < self->max_degree[dim]; i++) { if (self->pow[self->dim * i + dim] > new_max) new_max = self->pow[self->dim * i + dim]; } if (new_max == self->max_degree[dim]) continue; /* The max-power of this dim decreases */ self->max_degree_alldims -= self->max_degree[dim] - new_max; self->max_degree[dim] = new_max; self->eval_pow[dim] = cpl_realloc(self->eval_pow[dim], (size_t)(1+self->max_degree[dim]) * sizeof(double)); } if (ind < self->nc) { /* Move last coefficient to place of zero-valued one */ self->c[ind] = self->c[self->nc]; /* Copy last powers to place of those of the zero-valued one */ memcpy(self->pow + (size_t)(self->dim * ind), self->pow + (size_t)(self->dim * self->nc), (size_t)self->dim * sizeof(cpl_size)); } self->c = cpl_realloc(self->c, (size_t)self->nc * sizeof(double)); self->pow = cpl_realloc(self->pow, (size_t)self->dim * (size_t)self->nc * sizeof(cpl_size)); #ifdef CPL_POLYNOMIAL_USE_MULTI_HORNER cpl_free(self->added_horner); cpl_free(self->added_exist_iterations); self->added_horner = cpl_malloc(self->nc * sizeof(*self->added_horner)); self->added_exist_iterations = cpl_malloc(self->nc * sizeof(*self->added_exist_iterations)); #endif } else { cpl_free(self->c); cpl_free(self->pow); cpl_free(self->max_degree); #ifdef CPL_POLYNOMIAL_USE_MULTI_HORNER cpl_free(self->added_horner); cpl_free(self->added_exist_iterations); #endif self->max_degree_alldims = 0; for (dim=0; dim < self->dim; dim++) { cpl_free(self->eval_pow[dim]); } cpl_free(self->eval_pow); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Fill the Hankel Matrix H=V'*V, where V is a 1D-Vandermonde matrix @param self The matrix H @param mx A right multiplication with V', mx = V' * values @param xhat The mean-transformed x-values @param is_eqdist True iff xhat contains equidistant points @param mindeg The non-negative minimum fitting degree @param values The values to be interpolated @return void @note self must have its elements initialized to zero iff is_eqdist is true. */ /*----------------------------------------------------------------------------*/ static void cpl_matrix_fill_normal_vandermonde(cpl_matrix * self, cpl_matrix * mx, const cpl_vector * xhat, cpl_boolean is_eqdist, cpl_size mindeg, const cpl_vector * values) { cpl_vector * phat = cpl_vector_duplicate(xhat); /* Powers of xhat */ cpl_vector * qhat = NULL; /* mindeg Power of xhat */ double * dhat = cpl_vector_get_data(phat); double * ehat = NULL; const cpl_size nc = cpl_matrix_get_ncol(self); const cpl_size np = cpl_vector_get_size(xhat); cpl_size i,j; assert( nc == cpl_matrix_get_nrow(self) ); assert( nc == cpl_matrix_get_nrow(mx) ); assert( 1 == cpl_matrix_get_ncol(mx) ); assert( np == cpl_vector_get_size(values) ); /* Fill Hankel matrix from top-left to main skew diagonal - on and above (non-skew) main diagonal */ /* Also compute transpose(V) * b */ /* Peel off 1st iteration */ if (mindeg > 0) { double hsum = 0.0; cpl_size k; qhat = mindeg == 1 ? cpl_vector_duplicate(xhat) : cpl_vector_new(np); ehat = cpl_vector_get_data(qhat); /* Raise xhat to the power of mindeg */ for (k=0; k < np; k++) { const double x = cpl_vector_get(xhat, k); if (mindeg > 1) ehat[k] = cpl_tools_ipow(x, (int)mindeg); dhat[k] *= ehat[k]; hsum += ehat[k] * ehat[k]; } cpl_matrix_set(self, 0, 0, hsum); } else { cpl_matrix_set(self, 0, 0, (double)np); } /* qhat is xhat to the power of mindeg, iff mindeg > 0 */ /* dhat is xhat to the power of 1+mindeg, iff mindeg > 0 */ for (j=1; j < 2; j++) { double vsum0 = 0.0; double hsum = 0.0; double vsum = 0.0; cpl_size k; for (k=0; k < np; k++) { const double y = cpl_vector_get(values, k); hsum += mindeg > 0 ? ehat[k] * dhat[k] : dhat[k]; vsum += y * dhat[k]; vsum0 += mindeg > 0 ? ehat[k] * y : y; } cpl_matrix_set(mx, 0, 0, vsum0); cpl_matrix_set(mx, j, 0, vsum); if (is_eqdist) continue; k = j; for (i=0; i <= k; i++, k--) { cpl_matrix_set(self, i, k, hsum); } } for (; j < nc; j++) { double hsum = 0.0; double vsum = 0.0; cpl_size k; for (k=0; k < np; k++) { const double x = cpl_vector_get(xhat, k); const double y = cpl_vector_get(values, k); dhat[k] *= x; hsum += mindeg > 0 ? ehat[k] * dhat[k] : dhat[k]; vsum += y * dhat[k]; } cpl_matrix_set(mx, j, 0, vsum); if (is_eqdist && (j&1)) continue; k = j; for (i=0; i <= k; i++, k--) { cpl_matrix_set(self, i, k, hsum); } } /* Fill remaining Hankel matrix - on and above (non-skew) main diagonal */ if (mindeg > 0) cpl_vector_multiply(phat, qhat); cpl_vector_delete(qhat); for (i = 1; i < nc; i++) { cpl_size k; double hsum = 0.0; if (is_eqdist && ((i+nc)&1)==0) { cpl_vector_multiply(phat, xhat); continue; } for (k=0; k < np; k++) { const double x = cpl_vector_get(xhat, k); dhat[k] *= x; hsum += dhat[k]; } k = i; for (j = nc-1; k <= j; k++, j--) { cpl_matrix_set(self, k, j, hsum); } } cpl_tools_add_flops( 6 * np * ( nc - 1) ); cpl_vector_delete(phat); } /*----------------------------------------------------------------------------*/ /** @internal @brief Try to detect if the x-points are equidistant @param self The points to check @return 1 if equidistant, 0 if not, -1 on error. @note If yes, then every other skew diagonal of the Hankel matrix is zero, H = V' * V, where V is the 1D-Vandermonde matrix from the x-points. */ /*----------------------------------------------------------------------------*/ static int cpl_vector_is_eqdist(const cpl_vector * self) { double xval, delta; const cpl_size np = cpl_vector_get_size(self); cpl_size i; cpl_ensure(self, CPL_ERROR_NULL_INPUT, -1); if (cpl_vector_get_size(self) == 1) return 1; xval = cpl_vector_get(self, 1); delta = xval - cpl_vector_get(self, 0); for (i=1; i < np-1; i++) { const double dprev = delta; const double xprev = xval; xval = cpl_vector_get(self, i+1); delta = xval - xprev; if (delta != dprev) break; } return i == np-1 ? 1 : 0; } /*----------------------------------------------------------------------------*/ /** @internal @brief Given p and u, modify the polynomial to p(x) := p(x+u) @param p The polynomial coefficients to be modified in place @param n The number of coefficients @param u The shift @return void @see cpl_polynomial_shift_1d @note The function will seg-fault on NULL input. */ /*----------------------------------------------------------------------------*/ void cpl_polynomial_shift_double(double * coeffs, cpl_size n, double u) { cpl_size i, j; for (j = 0; j < n-1; j++) for (i = 1; i < n - j; i++ ) coeffs[n-1-i] += coeffs[n-i] * u; cpl_tools_add_flops( n * ( n - 1) ); } /*----------------------------------------------------------------------------*/ /** @internal @brief A real solution to p(x) = 0 using Newton-Raphsons method @param p The 1D-polynomial @param x0 First guess of the solution @param px The solution, on error see above @param mul The root multiplicity (or 1 if unknown) @param bpos Iff CPL_TRUE, then fail if a derivative is non-positive @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ @see cpl_polynomial_solve_1d() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_polynomial_solve_1d_(const cpl_polynomial * p, double x0, double * px, cpl_size mul, cpl_boolean bpos) { /* Initialize to ensure at least one iteration */ double r = 1; double d = 0; double xprev = 2 * x0 + 1; const double mm = (double)mul; /* Root multiplicity */ cpl_size mite; cpl_size i; cpl_ensure_code(px != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(p != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(p->dim == 1, CPL_ERROR_INVALID_TYPE); cpl_ensure_code(mul > 0, CPL_ERROR_ILLEGAL_INPUT); /* Iterating towards zero is not as simple as it sounds, so don't */ if (p->nc == 0 || p->c[0] == 0.0) { *px = 0.0; return CPL_ERROR_NONE; } *px = x0; mite = p->nc * CPL_NR_MAXITE; for (i = 0; i < mite; i++, xprev = *px) { const double rprev = r; const double dprev = d; /* Compute residual, r = p(x) and derivative, d = p`(x) */ r = cpl_polynomial_eval_1d(p, *px, &d); /* Stop if: 0) If bpos is true and d <= 0.0. This indicates a failure to solve 1) Correction did not decrease - unless p`(x) changed sign 2) p`(x) == 0. It is insufficient to implement this as d == 0, because some non-zero divisors can still result in inf. */ if (bpos && d <= 0.0) break; if (d * dprev >= 0.0 && fabs(r * dprev) >= fabs(rprev * d)) break; /* Compute and apply the accelerated Newton-Raphson correction */ *px -= mm * r / d; /* *px can become NaN - in which case the iteration goes on until the maximum number of iterations is reached. In one case this happens because a p'(x) == 0 is pertubed by round-off. */ /* Stop also if: 3) The correction did not change the solution - will typically save at most one Horner-evaluation */ if (fabs(*px-xprev) < fabs(*px) * DBL_EPSILON) break; /* if x_i == x_j for i > j > 0 the iteration cannot converge. This can only happen with at least two sign-changes for p`(x_k) i >= k >= j. This is not checked for. */ } cpl_tools_add_flops( i * 12 ); if (i == mite) return cpl_error_set_message_(CPL_ERROR_CONTINUE, "x0=%g, mul=%" CPL_SIZE_FORMAT ", degree=%" CPL_SIZE_FORMAT ", p(%g)=%g", x0, mul, p->nc-1, *px, cpl_polynomial_eval_1d(p, *px, NULL)); /* At this point: In absence of rounding r or d is zero. Due to rounding r or d is zero or close to zero. If there is no solution only d is (close to) zero. If there is a single solution only r is (close to) zero. If there is a multiple solution both r and d are (close to) zero - in this case |r| cannot be bigger than |d| because p is one degree higher than p'. */ if (bpos && d <= 0.0) return cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "x0=%g, mul=%" CPL_SIZE_FORMAT ", degree=%" CPL_SIZE_FORMAT ", p(x)=%g, p'(x)=%g <= 0.0", x0, mul, p->nc-1, r, d); if (fabs(r) > fabs(d)) { /* When d is computed in long double precision at a multiple root, |r| _can_ be bigger than |d|. Quick fix: Assume that solution is still OK, if |r| is small compared to the largest coefficient */ /* Since r is non-zero, at least one coefficient must be non-zero */ cpl_size n = p->nc; double max = 0.0; while (n--) if (fabs(p->c[n]) > max) max = fabs(p->c[n]); if (fabs(r) > max * DBL_EPSILON) return cpl_error_set_message_(CPL_ERROR_DIVISION_BY_ZERO, "x0=%g, mul=%" CPL_SIZE_FORMAT ", degree=%" CPL_SIZE_FORMAT ", p(x)=%g, p'(x)=%g", x0, mul, p->nc-1, r, d); } return CPL_ERROR_NONE; } cpl-6.4.1/cplcore/cpl_property.h0000644000460300003120000000727312270505777013561 00000000000000/* $Id: cpl_property.h,v 1.15 2012-05-21 14:29:54 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-05-21 14:29:54 $ * $Revision: 1.15 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_PROPERTY_H #define CPL_PROPERTY_H #include #include CPL_BEGIN_DECLS /** * @ingroup cpl_property * * @brief * The opaque property data type. */ typedef struct _cpl_property_ cpl_property; /* * Create, copy and destroy operations. */ cpl_property *cpl_property_new(const char *name, cpl_type type) CPL_ATTR_ALLOC; cpl_property *cpl_property_new_array(const char *name, cpl_type type, cpl_size size) CPL_ATTR_ALLOC; cpl_property *cpl_property_duplicate(const cpl_property *other) CPL_ATTR_ALLOC; void cpl_property_delete(cpl_property *self); /* * Non modifying operations */ cpl_size cpl_property_get_size(const cpl_property *self); cpl_type cpl_property_get_type(const cpl_property *self); /* * Assignment operations */ cpl_error_code cpl_property_set_name(cpl_property *self, const char *name); cpl_error_code cpl_property_set_comment(cpl_property *self, const char *comment); cpl_error_code cpl_property_set_char(cpl_property *self, char value); cpl_error_code cpl_property_set_bool(cpl_property *self, int value); cpl_error_code cpl_property_set_int(cpl_property *self, int value); cpl_error_code cpl_property_set_long(cpl_property *self, long value); cpl_error_code cpl_property_set_long_long(cpl_property *self, long long value); cpl_error_code cpl_property_set_float(cpl_property *self, float value); cpl_error_code cpl_property_set_double(cpl_property *self, double value); cpl_error_code cpl_property_set_string(cpl_property *self, const char *value); #ifdef _Complex_I cpl_error_code cpl_property_set_double_complex(cpl_property *self, _Complex double value); cpl_error_code cpl_property_set_float_complex(cpl_property *self, _Complex float value); #endif /* * Element access */ const char *cpl_property_get_name(const cpl_property *self); const char *cpl_property_get_comment(const cpl_property *self); char cpl_property_get_char(const cpl_property *self); int cpl_property_get_bool(const cpl_property *self); int cpl_property_get_int(const cpl_property *self); long cpl_property_get_long(const cpl_property *self); long long cpl_property_get_long_long(const cpl_property *self); float cpl_property_get_float(const cpl_property *self); double cpl_property_get_double(const cpl_property *self); const char *cpl_property_get_string(const cpl_property *self); #ifdef _Complex_I _Complex float cpl_property_get_float_complex(const cpl_property *self); _Complex double cpl_property_get_double_complex(const cpl_property *self); #endif CPL_END_DECLS #endif /* CPL_PROPERTY_H */ cpl-6.4.1/cplcore/cpl_stats_body.h0000644000460300003120000002372212005615436014033 00000000000000/* $Id: cpl_stats_body.h,v 1.16 2012-07-30 23:39:10 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Type dependent macros */ #if CPL_CLASS == CPL_CLASS_DOUBLE #define CPL_TYPE double #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_ADD_FLOPS cpl_tools_add_flops #elif CPL_CLASS == CPL_CLASS_FLOAT #define CPL_TYPE float #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_ADD_FLOPS cpl_tools_add_flops #elif CPL_CLASS == CPL_CLASS_INT #define CPL_TYPE int #define CPL_TYPE_T CPL_TYPE_INT #define CPL_ADD_FLOPS(N) /* N integer ops */ #else #undef CPL_TYPE #undef CPL_TYPE_T #endif #define CPL_TYPE_ADD(a) CPL_CONCAT2X(a, CPL_TYPE) #if CPL_OPERATION == CPL_IMAGE_STATS_ALL case CPL_TYPE_T: { const CPL_TYPE * pi = (const CPL_TYPE*)image->pixels; min_pos = max_pos = firstgoodpos; min_pix = (double)pi[firstgoodpos]; max_pix = (double)pi[firstgoodpos]; for (j=llysz-1; jnx; for (i=llxsz-1; i max_pix) max_pix = (double)pi[max_pos = pos]; pix_sum += (double)pi[pos]; abs_sum += fabs((double)pi[pos]); dev_sum += fabs((double)pi[pos]-self->med); sqr_sum += (double)pi[pos] * (double)pi[pos]; } pos++; } } CPL_ADD_FLOPS(17 * npix); break; } #elif CPL_OPERATION == CPL_IMAGE_STATS_VARIANCE case CPL_TYPE_T: { const CPL_TYPE * pi = (const CPL_TYPE*)image->pixels; for (j=llysz-1; jnx; for (i=llxsz-1; ipixels; const double min_pix_tmp = min_pix < 0.0 ? min_pix : 0.0; for (j=llysz-1; jnx; for (i=llxsz-1; ipixels; /* Avoid in-loop casting */ CPL_TYPE min_tmp = pi[firstgoodpos]; CPL_TYPE max_tmp = pi[firstgoodpos]; min_pos = max_pos = firstgoodpos; for (j=llysz-1; jnx; for (i=llxsz-1; i max_tmp) max_tmp = pi[max_pos = pos]; } pos++; } } min_pix = (double)min_tmp; max_pix = (double)max_tmp; CPL_ADD_FLOPS(2 * npix); break; } #elif CPL_OPERATION == CPL_IMAGE_STATS_FLUX case CPL_TYPE_T: { const CPL_TYPE * pi = (const CPL_TYPE*)image->pixels; for (j=llysz-1; jnx; for (i=llxsz-1; ipixels, sizeof(CPL_TYPE), image->nx, image->ny, llxsz, llysz, urxsz, urysz); } else { /* Point to first pixel in first row to read */ const CPL_TYPE * pi = (const CPL_TYPE*)image->pixels + (llysz-1)*image->nx; /* - ditto for bad pixel map */ const cpl_binary * pbpm = badmap + (llysz-1)*image->nx; cpl_size ngood = 0; for (j = llysz - 1; j < urysz; j++, pi += image->nx, pbpm += image->nx) { for (i = llxsz - 1; i < urxsz; i++) { /* Take only good pixels */ if (pbpm[i] == CPL_BINARY_0) { copybuf[ngood++] = pi[i]; } } } /* assert( ngood == npix ) */ } /* Compute the median */ self->med = CPL_TYPE_ADD(cpl_tools_get_median)(copybuf, npix); cpl_free(copybuf); break; } #elif CPL_OPERATION == CPL_IMAGE_STATS_MEDIAN_DEV case CPL_TYPE_T: { /* Could be done in two FLOPs instead of three * - but this would lead to more complicated code... */ if (nbadpix != 0) { /* Need to check bad pixel buffer */ /* Point to first pixel in first row to read */ const CPL_TYPE * pi = (const CPL_TYPE*)image->pixels + (llysz-1)*image->nx; /* - ditto for bad pixel map */ const cpl_binary * pbpm = badmap + (llysz-1)*image->nx; for (j = llysz - 1; j < urysz; j++, pi += image->nx, pbpm += image->nx) { for (i = llxsz - 1; i < urxsz; i++) { /* Take only good pixels */ if (pbpm[i] == CPL_BINARY_0) { dev_sum += fabs((double)pi[i]-self->med); } } } } else { /* Point to first pixel in first row to read */ const CPL_TYPE * pi = (const CPL_TYPE*)image->pixels + (llysz-1)*image->nx; for (j = llysz - 1; j < urysz; j++, pi += image->nx) { for (i = llxsz - 1; i < urxsz; i++) { dev_sum += fabs((double)pi[i]-self->med); } } } cpl_tools_add_flops( 3 * npix + 1 ); break; } #elif CPL_OPERATION == CPL_IMAGE_STATS_MAD case CPL_TYPE_T: { /* Duplicate the pixels inside the window */ CPL_TYPE * copybuf = cpl_malloc((size_t)npix * sizeof(CPL_TYPE)); cpl_size ngood = 0; if (nbadpix != 0) { /* Need to check bad pixel buffer */ /* Point to first pixel in first row to read */ const CPL_TYPE * pi = (const CPL_TYPE*)image->pixels + (llysz-1)*image->nx; /* - ditto for bad pixel map */ const cpl_binary * pbpm = badmap + (llysz-1)*image->nx; for (j = llysz - 1; j < urysz; j++, pi += image->nx, pbpm += image->nx) { for (i = llxsz - 1; i < urxsz; i++) { /* Take only good pixels */ if (pbpm[i] == CPL_BINARY_0) { copybuf[ngood++] = fabs((double)pi[i]-self->med); } } } } else { /* Point to first pixel in first row to read */ const CPL_TYPE * pi = (const CPL_TYPE*)image->pixels + (llysz-1)*image->nx; for (j = llysz - 1; j < urysz; j++, pi += image->nx) { for (i = llxsz - 1; i < urxsz; i++) { copybuf[ngood++] = fabs((double)pi[i]-self->med); } } } /* assert( ngood == npix ) */ cpl_tools_add_flops( 2 * npix ); /* Compute the median */ self->mad = CPL_TYPE_ADD(cpl_tools_get_median)(copybuf, npix); cpl_free(copybuf); break; } #endif #undef CPL_TYPE #undef CPL_TYPE_T #undef CPL_ADD_FLOPS #undef CPL_TYPE_ADD cpl-6.4.1/cplcore/cpl_msg.c0000644000460300003120000014431612243346473012452 00000000000000/* $Id: cpl_msg.c,v 1.58 2013-02-08 09:48:02 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-02-08 09:48:02 $ * $Revision: 1.58 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #ifdef _OPENMP #include #endif #ifdef HAVE_TERMIOS_H # include #else # ifdef HAVE_TERMIO_H # include # else # error Neither termios.h nor termio.h found! # endif #endif #ifdef HAVE_STROPTS_H # include #endif #if !defined(HAVE_STROPTS_H) || defined(HAVE_TERMIOS_H) || \ defined(GWINSZ_IN_SYS_IOCTL) # ifdef HAVE_SYS_IOCTL_H # include # else # error Cannot find header file for ioctl()! # endif #endif #undef CPL_HAVE_STREAM_DUPLICATION #undef CPL_HAVE_WINDOW_RESIZING #ifndef __STRICT_ANSI__ /* gcc -ansi and gcc -std=... enters here */ #if defined HAVE_FILENO && defined HAVE_FDOPEN && defined HAVE_DUP #if defined HAVE_DECL_FILENO && defined HAVE_DECL_FDOPEN && defined HAVE_DECL_DUP #define CPL_HAVE_STREAM_DUPLICATION #if defined HAVE_SIGACTION && defined HAVE_SIGEMPTYSET #define CPL_HAVE_WINDOW_RESIZING #endif #endif #endif #endif #include #include #include #include #include /** * @defgroup cpl_msg Messages * * This module provides functions to display and log messages. * The following operations are supported: * * - Enable messages output to terminal or to log file. * - Optionally adding informative tags to messages. * - Setting width for message line wrapping. * - Control the message indentation level. * - Filtering messages according to their severity level. * * To activate and deactivate the messaging system, the functions * @c cpl_msg_init() and @c cpl_msg_stop() need to be used. However, * since they are called anyway by the functions @c cpl_init() and * @c cpl_end(), there is generally no need to call them explicitly, * and starting from CPL 2.1 they are deprecated. * These functions would typically be called at the beginning and at * the end of a program. An attempt to use an uninitialised messaging * system would generate a warning message. More functions may also * be used to configure the messaging system, and here is an example * of a possible initialisation: * * @code * ... * cpl_msg_set_time_on(); * cpl_msg_set_component_on(); * cpl_msg_set_domain("Source detection"); * cpl_msg_set_domain_on(); * cpl_msg_set_level(CPL_MSG_ERROR); * cpl_msg_set_log_level(CPL_MSG_DEBUG); * ... * @endcode * * The functions of these kind, are meant to configure the messaging * system, defining its "style", once and for all. For this reason * such functions are not supposed to be called from threads. * Three different tags may be attached to any message: @em time, * @em domain, and @em component. The @em time tag is the time * of printing of the message, and can optionally be turned * on or off with the functions @c cpl_msg_set_time_on() and * @c cpl_msg_set_time_off(). The @em domain tag is an identifier * of the main program running (typically, a pipeline recipe), * and can be optionally turned on or off with the functions * @c cpl_msg_set_domain_on() and @c cpl_msg_set_domain_off(). * Finally, the @em component tag is used to identify a component * of the program running (typically, a function), and can be optionally * turned on or off with the functions @c cpl_msg_set_component_on() * and @c cpl_msg_set_component_off(). As a default, none of the * above tags are attached to messages sent to terminal. However, * all tags are always used in messages sent to the log file. A * further tag, the @em severity tag, can never be turned off. * This tag depends on the function used to print a message, that * can be either @c cpl_msg_debug(), @c cpl_msg_info(), @c cpl_msg_warning(), * or @c cpl_msg_error(). The @em time and @em severity tags are * all prepended to any message, and are not affected by the message * indentation controlled by the functions @c cpl_msg_indent(), * @c cpl_msg_indent_more(), @c cpl_msg_indent_less(), and * @c cpl_msg_set_indentation(). * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * This is the length for a time string in ISO 8601 format */ #define TIME_ISO8601_LENGTH (20) /* * This is the max length for text lines that are written to the log file. * It is also the max length for text lines sent to the terminal, in case * the window size cannot be determined by the appropriate call to ioctl(). * If this number is zero or negative, then lines are not splitted. */ #define DEFAULT_WIDTH (-1) /* * Strings used for the severity field in the message: */ #define ERROR_STRING "[ ERROR ] " #define WARNING_STRING "[WARNING] " #define INFO_STRING "[ INFO ] " #define DEBUG_STRING "[ DEBUG ] " inline static void cpl_msg_out(cpl_msg_severity, const char *, int, const char *, va_list) CPL_ATTR_PRINTF(4,0); static const char default_component[] = ""; static const char default_format[] = ""; static cpl_msg_severity log_min_level = CPL_MSG_OFF; static cpl_msg_severity term_min_level = CPL_MSG_INFO; static int time_tag = 0; static int threadid_tag = 0; static int domain_tag = 0; static int component_tag = 0; static int msg_init = 0; static char domain[CPL_MAX_DOMAIN_NAME] = "Undefined domain"; static char logfile_name[CPL_MAX_LOGFILE_NAME] = ".logfile"; static FILE *logfile = NULL; static int page_width = DEFAULT_WIDTH; static const int log_width = DEFAULT_WIDTH; static int indent_step = 2; static int indent_value = 0; static int overwrite = 0; #ifdef _OPENMP #pragma omp threadprivate(indent_value, overwrite) #endif static FILE *msg_stdout; static FILE *msg_stderr; #ifdef CPL_HAVE_STREAM_DUPLICATION static int out_stream; #ifdef CPL_HAVE_WINDOW_RESIZING static struct sigaction act, oact; #endif #endif static cx_print_func default_printer; static cx_print_func default_error; /* * @brief * Ensure system initialisation if it was forgotten. * * @return Nothing. * * This private function is used to call cpl_msg_init() if it was not * called by the user. */ inline static void _cpl_msg_init(const char *component) { if (msg_init == 0) { if (cpl_msg_init() == CPL_ERROR_NONE) { cpl_msg_warning("CPL messaging", "The CPL messaging function %s() was called before the system " "had been initialised. Please call the function cpl_init() " "before attempting to use any CPL function.", component); } else { fprintf(stderr, "%s\n", cpl_error_get_message()); fprintf(stderr, "SEVERE ERROR: The CPL messaging system has " "not been initialised, and this may cause undefined program " "behaviour: please call the function cpl_init() before " "attempting to use any CPL function."); } msg_init = 1; } } /* * @brief * Get current date and time in ISO8601 format. * @param * String of size at least TIME_ISO8601_LENGTH * * @return void * * This private function just returns the current time in ISO8601 format. */ static void getTimeISO8601(char * timeISO8601) { const time_t seconds = time((time_t *)NULL); if (strftime(timeISO8601, TIME_ISO8601_LENGTH, "%Y-%m-%dT%T", localtime(&seconds)) == 0) strcpy(timeISO8601, "0000-00-00T00:00:00"); } #ifdef CPL_HAVE_STREAM_DUPLICATION /* * @brief * Signal handler for signal @c SIGWINCH * * @param i Dummy argument (not used!) * * @return Nothing. * * This private function accomodates the output line width of the messaging * subsystem to the new window size on arrival of the signal @c SIGWINCH. */ static void _cpl_change_width(int i) { struct winsize win; (void) i; /* To avoid compiler warning */ if (ioctl(out_stream, TIOCGWINSZ, &win) < 0 || win.ws_col < 1) page_width = DEFAULT_WIDTH; else page_width = win.ws_col; } #endif /* * @brief * Handler for printing to standard output. * * @param String to print. * * @return Nothing. * * This private function is used by cx_print() to write any message * to standard output. */ static void _cpl_print_out(const cxchar *message) { fputs(message, msg_stdout); fflush(msg_stdout); } /* * @brief * Handler for printing to standard error. * * @param String to print. * * @return Nothing. * * This private function is used by cx_printerr() to write any message * to standard output. */ static void _cpl_print_err(const cxchar *message) { fputs(message, msg_stderr); fflush(msg_stderr); } /* * @brief * Split a string according to the max allowed page width. * * @param split Processed output string at least of size CPL_MAX_MSG_LENGTH * @param s Input string to be processed. * @param blanks Number of blanks to be inserted at every split point. * @param width Max number of characters between split points. * * @return Pointer to the modified character string, or if the width is less * than one, pointer to the unmodified input string. * * This private function is used for splitting a string avoiding to exceed * a maximum width (as for instance the width of the terminal where the * string is going to be printed). The splitting is performed without * breaking words, i.e. by replacing with a newline character ('\\n') * the last blank character before the maximum allowed width. Newline * characters already present in the input string are preserved. * Single words that exceed the max allowed width would not be split, * just in this case long lines are tolerated. A number of blanks to * be inserted at every split point must be specified, setting the * left indentation level for the printed string. This number must * not exceed the maximum allowed width. */ static const char *strsplit(char * split, const char *s, int blanks, int width) { int i, j, k; int cuti = 0; int cutj = 0; int limit = width; if (width < 1) return s; if (blanks >= width) blanks = width - 1; /* Give up indentation */ for (i = 0, j = 0; i < CPL_MAX_MSG_LENGTH && j < CPL_MAX_MSG_LENGTH; i++, j++) { split[j] = s[i]; if (s[i] == ' ' || s[i] == '\0' || s[i] == '\n') { if (i >= limit) { /* * Go back to the previous cuttable position, if possible */ if (limit - cuti < width - blanks) { j = cutj; i = cuti; } else { if (s[i] == '\0') break; } /* * Split here, and insert blanks */ split[j] = '\n'; for (k = 0, j++; k < blanks && j < CPL_MAX_MSG_LENGTH; k++, j++) split[j] = ' '; j--; limit = width - blanks + i; } else { if (s[i] == '\0') break; if (s[i] == '\n') { /* * Split point already present in input string: just add * the specified number of blanks */ if (s[i+1] == '\0') { split[j] = '\0'; break; } for (k = 0, j++; k < blanks && j < CPL_MAX_MSG_LENGTH; k++, j++) split[j] = ' '; j--; limit = width - blanks + i; } /* * Keep track of the last cuttable position */ cutj = j; cuti = i; } } } /* * Safety belt! */ split[CPL_MAX_MSG_LENGTH - 1] = '\0'; return split; } /* * @brief * Format and output message string. * * @param severity Severity level of the incoming message. * @param component Name of the component/function generating the message. * @param caller 1 = cpl_msg_info_overwritable, 0 = all the others. * @param format Format string in the usual C convention. * @param al Variable argument list associated to the @em format. * * @return Nothing. * * This private function is used to actually display/add the message * to terminal and/or log file. Messages with severity level equal to * "error" or greater would be sent to stderr, the other messages * would go to stdout. * * If the severity level is lower than the levels set by * @b cpl_msg_set_level() and @b cpl_msg_set_log_level(), then * the message is not displayed. * * @see cpl_msg_set_level(), cpl_msg_set_log_level() */ inline static void cpl_msg_out(cpl_msg_severity severity, const char *component, int caller, const char *format, va_list al) { time_t seconds; char msg_text[CPL_MAX_MSG_LENGTH] = ""; char msg_log[CPL_MAX_MSG_LENGTH] = ""; char msg_term[CPL_MAX_MSG_LENGTH] = ""; char split[CPL_MAX_MSG_LENGTH]; #ifdef _OPENMP char *tid; #endif int start_log_line, start_term_line; int copy_only; int i; if (severity < term_min_level && severity < log_min_level) return; if (severity == CPL_MSG_OFF) return; seconds = time((time_t *)0); cx_vsnprintf(msg_text, CPL_MAX_MSG_LENGTH, format, al); /* * Date and time. Note that time tag and severity field are not * affected by indentation. Date and time are always present in * the log file, optional in the terminal output. */ strftime(msg_log, CPL_MAX_MSG_LENGTH, "%H:%M:%S ", localtime(&seconds)); if (time_tag) strftime(msg_term, CPL_MAX_MSG_LENGTH, "%H:%M:%S ", localtime(&seconds)); else msg_term[0] = '\0'; /* * Severity label */ if (severity == CPL_MSG_ERROR) { strncat(msg_log, ERROR_STRING, CPL_MAX_MSG_LENGTH - strlen(msg_log) - 1); strncat(msg_term, ERROR_STRING, CPL_MAX_MSG_LENGTH - strlen(msg_term) - 1); } else if (severity == CPL_MSG_WARNING) { strncat(msg_log, WARNING_STRING, CPL_MAX_MSG_LENGTH - strlen(msg_log) - 1); strncat(msg_term, WARNING_STRING, CPL_MAX_MSG_LENGTH - strlen(msg_term) - 1); } else if (severity == CPL_MSG_INFO) { strncat(msg_log, INFO_STRING, CPL_MAX_MSG_LENGTH - strlen(msg_log) - 1); strncat(msg_term, INFO_STRING, CPL_MAX_MSG_LENGTH - strlen(msg_term) - 1); } else if (severity == CPL_MSG_DEBUG) { strncat(msg_log, DEBUG_STRING, CPL_MAX_MSG_LENGTH - strlen(msg_log) - 1); strncat(msg_term, DEBUG_STRING, CPL_MAX_MSG_LENGTH - strlen(msg_term) - 1); } /* * Domain, component name, and message appended: */ if (domain_tag) { strncat(msg_term, domain, CPL_MAX_MSG_LENGTH - strlen(msg_term) - 1); strncat(msg_term, ": ", CPL_MAX_MSG_LENGTH - strlen(msg_term) - 1); } if (component_tag || term_min_level == CPL_MSG_DEBUG) { strncat(msg_term, component, CPL_MAX_MSG_LENGTH - strlen(msg_term) - 1); strncat(msg_term, ": ", CPL_MAX_MSG_LENGTH - strlen(msg_term) - 1); } strncat(msg_log, component, CPL_MAX_MSG_LENGTH - strlen(msg_log) - 1); strncat(msg_log, ": ", CPL_MAX_MSG_LENGTH - strlen(msg_log) - 1); #ifdef _OPENMP /* * Thread ID */ tid = cpl_sprintf("[tid=%03d] ", omp_get_thread_num()); strncat(msg_log, tid, CPL_MAX_MSG_LENGTH - strlen(msg_log) - 1); if (threadid_tag) strncat(msg_term, tid, CPL_MAX_MSG_LENGTH - strlen(msg_term) - 1); cpl_free(tid); #endif /* * Message indentation */ for (i = 0; i < indent_value; i++) { strncat(msg_log, " ", CPL_MAX_MSG_LENGTH - strlen(msg_log) - 1); strncat(msg_term, " ", CPL_MAX_MSG_LENGTH - strlen(msg_term) - 1); } start_log_line = strlen(msg_log); start_term_line = strlen(msg_term); /* * Finally add the message text. If message is too long * it is truncated. */ copy_only = CPL_MAX_MSG_LENGTH - strlen(msg_log) - 1; strncat(msg_log, msg_text, copy_only); copy_only = CPL_MAX_MSG_LENGTH - strlen(msg_term) - 1; strncat(msg_term, msg_text, copy_only); if (severity >= log_min_level) fprintf(logfile, "%s\n", strsplit(split, msg_log, start_log_line, log_width)); if (severity >= term_min_level) { if (severity > CPL_MSG_WARNING) { if (overwrite) { cx_printerr("\n%s\n", strsplit(split, msg_term, start_term_line, page_width)); overwrite = 0; } else cx_printerr("%s\n", strsplit(split, msg_term, start_term_line, page_width)); } else if (caller) { char *c = strrchr(msg_term, '\n'); if (c >= msg_term) *c = '\0'; cx_print("\r%s", msg_term); } else if (overwrite) { cx_print("\n%s\n", strsplit(split, msg_term, start_term_line, page_width)); overwrite = 0; } else cx_print("%s\n", strsplit(split, msg_term, start_term_line, page_width)); } } /** * @brief * Initialise the messaging system * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_FILE_ALREADY_OPEN * The messaging system was already initialised. *
CPL_ERROR_DUPLICATING_STREAM * stdout and stderr streams cannot be duplicated. *
CPL_ERROR_ASSIGNING_STREAM * A stream cannot be associated with a file descriptor. *
* @enderror * * This function needs to be called to activate the messaging system, * typically at the beginning of a program. An attempt to use any * messaging function before turning the system on would generate * a warning message. The messaging system needs to be deactivated * by calling the function @c cpl_msg_stop(). However, since these * functions are called anyway by the functions @c cpl_init() and * @c cpl_end(), there is generally no need to call them explicitly, * and starting from CPL 2.1 they are deprecated. * * When @c cpl_msg_init() is called, the @em stdout and * @em stderr streams are duplicated for greater flexibility of * the system. The terminal width is determined (if possible), * and the resized window signal handler is deployed to monitor * possible changes of the terminal window width. If the width of * the output device cannot be determined, lines of text are not * splitted when written to output. If line splitting is not wanted, * the function @c cpl_msg_set_width() should be called specifying * a non positive width. */ cpl_error_code cpl_msg_init(void) { #ifdef CPL_HAVE_STREAM_DUPLICATION struct winsize win; static int err_stream; #endif if (msg_init > 0) return cpl_error_set_(CPL_ERROR_FILE_ALREADY_OPEN); #ifdef CPL_HAVE_STREAM_DUPLICATION /* * First duplicate stdout and stderr streams */ if ((out_stream = dup(fileno(stdout))) < 0) return cpl_error_set_(CPL_ERROR_DUPLICATING_STREAM); if (!(err_stream = dup(fileno(stderr)))) return cpl_error_set_(CPL_ERROR_DUPLICATING_STREAM); if (!(msg_stdout = fdopen(out_stream, "a"))) return cpl_error_set_(CPL_ERROR_ASSIGNING_STREAM); if (!(msg_stderr = fdopen(err_stream, "a"))) return cpl_error_set_(CPL_ERROR_ASSIGNING_STREAM); #else msg_stdout = stdout; msg_stderr = stderr; #endif default_printer = cx_print_set_handler(_cpl_print_out); default_error = cx_printerr_set_handler(_cpl_print_err); msg_init = 1; #ifdef CPL_HAVE_STREAM_DUPLICATION #ifdef CPL_HAVE_WINDOW_RESIZING /* * Get the terminal window size, and if successful deploy the handler * for any image resizing at runtime. */ if (ioctl(out_stream, TIOCGWINSZ, &win) < 0 || win.ws_col < 1) return CPL_ERROR_NONE; page_width = win.ws_col; act.sa_handler = _cpl_change_width; sigemptyset(&act.sa_mask); act.sa_flags = 0; /* Probably more appropriate flags * * initialisation should be inserted here. */ act.sa_flags &= ~SA_SIGINFO; /* Eliminates SA_SIGINFO from any setting * * above. */ sigaction(SIGWINCH, &act, &oact); #endif #endif return CPL_ERROR_NONE; } /** * @brief * Turn the messaging system off. * * @return Nothing * * This function needs to be called to turn the messaging system off, * typically at the end of a program. To turn the messaging system * on the function @c cpl_msg_init() needs to be called. However, since * these functions are called anyway by the functions @c cpl_init() * and @c cpl_end(), there is generally no need to call them explicitly, * and starting from CPL 2.1 they are deprecated. * * When @c cpl_msg_stop() is called, the default resized window signal * handler is restored, and the duplicated output streams are closed. * If a log file is still open, it is closed, and the log verbosity * level is set to CPL_MSG_OFF. If the messaging system is not on, * nothing is done, and no error is set. */ void cpl_msg_stop(void) { if (msg_init == 0) return; #ifdef CPL_HAVE_STREAM_DUPLICATION #ifdef CPL_HAVE_WINDOW_RESIZING if (act.sa_handler == _cpl_change_width) sigaction(SIGWINCH, &oact, NULL); #endif #endif cx_print_set_handler(default_printer); cx_printerr_set_handler(default_error); if (msg_stdout != stdout) fclose(msg_stdout); if (msg_stderr != stderr) fclose(msg_stderr); cpl_msg_stop_log(); msg_init = 0; } /** * @brief * Open and initialise a log file. * * @param verbosity Verbosity level. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_FILE_ALREADY_OPEN * A log file was already started. *
CPL_ERROR_FILE_NOT_CREATED * Log file cannot be created. *
* @enderror * * If the specified @em verbosity level is different from @c CPL_MSG_OFF, * a log file is created and initialised with a header containing the * start logging time, the @em domain identifier set by the function * @c cpl_msg_set_domain(), and the chosen @em verbosity level. The * @em verbosity specifies the lowest severity level that a message * should have to be written to the log file. The name of the created * log file may be previously set with the function @c cpl_msg_set_log_name(), * otherwise it is left to a default ".logfile". The log file name can * be obtained by calling the function @c cpl_msg_get_log_name(). * Typically this function is called at the beginning of a program. * Calling it while a log file is already open has no effect, but it * will return an error code. * * @note * This function is meant to configure once and for all the behaviour * and the "style" of the messaging system, and it is not supposed to * be called in threads. */ cpl_error_code cpl_msg_set_log_level(cpl_msg_severity verbosity) { _cpl_msg_init(cpl_func); if (logfile) { /* * If a log file was already open, nothing is done, but a status * is returned. */ return cpl_error_set_(CPL_ERROR_FILE_ALREADY_OPEN); } if (verbosity != CPL_MSG_OFF) { char timeLabel[TIME_ISO8601_LENGTH]; if ((logfile = fopen(logfile_name, "w")) == NULL) return cpl_error_set_message_(CPL_ERROR_FILE_NOT_CREATED, "%s", logfile_name); (void)setvbuf(logfile, (char *) NULL, _IOLBF, 0); log_min_level = verbosity; /* * Write log file header */ getTimeISO8601(timeLabel); fprintf(logfile, "\n"); fprintf(logfile, "Start time : %s\n", timeLabel); fprintf(logfile, "Program name : %s\n", domain); fprintf(logfile, "Severity level : "); switch(verbosity) { case CPL_MSG_DEBUG : fprintf(logfile, DEBUG_STRING); break; case CPL_MSG_INFO : fprintf(logfile, INFO_STRING); break; case CPL_MSG_WARNING : fprintf(logfile, WARNING_STRING); break; case CPL_MSG_ERROR : fprintf(logfile, ERROR_STRING); break; default : break; } fprintf(logfile, "\n\n"); } return CPL_ERROR_NONE; } /** * @brief * Close the current log file. * * @return @c CPL_ERROR_NONE on success. * * The log file is closed. The name of the created log file is always the same, * and can be obtained by calling the function @c cpl_msg_get_log_name(). * An attempt to close a non existing log file would not generate an error * condition. This routine may be called in case the logging should be * terminated before the end of a program. Otherwise, the function * @c cpl_msg_stop() would automatically close the log file when called * at the end of the program. */ cpl_error_code cpl_msg_stop_log(void) { _cpl_msg_init("cpl_msg_stop_log"); if (log_min_level != CPL_MSG_OFF) { log_min_level = CPL_MSG_OFF; fclose(logfile); logfile = NULL; } return CPL_ERROR_NONE; } /** * @brief * Get the log file name. * * @return Logfile name * * The name of the log file is returned. */ const char *cpl_msg_get_log_name(void) { _cpl_msg_init("cpl_msg_get_log_name"); return logfile_name; } /** * @brief * Set the log file name. * * @param name Name of log file. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The specified name is a NULL pointer. *
CPL_ERROR_FILE_ALREADY_OPEN * A log file was already started. *
CPL_ERROR_ILLEGAL_INPUT * The specified name is longer than * CPL_MAX_LOGFILE_NAME characters (including the * terminating '\\0'). *
* @enderror * * This function is used to set the log file name, and can only be * called before the log is opened by @c cpl_msg_set_log_level(). * If this function is not called, or the specified @em name is * longer than CPL_MAX_LOGFILE_NAME characters, the log * file name is left to its default, ".logfile". * * @note * This function is meant to configure once and for all the behaviour * and the "style" of the messaging system, and it is not supposed to * be called in threads. */ cpl_error_code cpl_msg_set_log_name(const char *name) { _cpl_msg_init(cpl_func); if (name == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (logfile) return cpl_error_set_message_(CPL_ERROR_FILE_ALREADY_OPEN, "%s: %p", name, (const void*)logfile); if (strlen(name) > CPL_MAX_LOGFILE_NAME - 1) return cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "%s: %u + 1 > " CPL_STRINGIFY(CPL_MAX_LOGFILE_NAME) " = " CPL_XSTRINGIFY(CPL_MAX_LOGFILE_NAME), name, (unsigned)strlen(name)); strcpy(logfile_name, name); return CPL_ERROR_NONE; } /** * @brief * Set verbosity level of output to terminal. * * @param verbosity Verbosity level. * * @return Nothing. * * The @em verbosity specifies the lowest severity level that a message * should have for being displayed to terminal. If this function is not * called, the verbosity level defaults to @c CPL_MSG_INFO. * * @note * This function is not supposed to be called in threads. */ void cpl_msg_set_level(cpl_msg_severity verbosity) { _cpl_msg_init("cpl_msg_set_level"); term_min_level = verbosity; } /*----------------------------------------------------------------------------*/ /** @brief Set verbosity level of terminal output using an environment variable @return void @see cpl_msg_set_level @note This function can be used for run-time control of the verbosity level of unit test modules. The CPL verbosity level of output to terminal is set according to the environment variable CPL_MSG_LEVEL: debug: CPL_MSG_DEBUG info: CPL_MSG_INFO warning: CPL_MSG_WARNING error: CPL_MSG_ERROR off: CPL_MSG_OFF Any other value (including NULL) will cause the function to do nothing. */ /*----------------------------------------------------------------------------*/ void cpl_msg_set_level_from_env(void) { const char * level = getenv("CPL_MSG_LEVEL"); if (level == NULL) return; if (!strcmp(level, "debug")) cpl_msg_set_level(CPL_MSG_DEBUG); else if (!strcmp(level, "info")) cpl_msg_set_level(CPL_MSG_INFO); else if (!strcmp(level, "warning")) cpl_msg_set_level(CPL_MSG_WARNING); else if (!strcmp(level, "error")) cpl_msg_set_level(CPL_MSG_ERROR); else if (!strcmp(level, "off")) cpl_msg_set_level(CPL_MSG_OFF); return; } /** * @brief * Get current log verbosity level. * * @return Current verbosity level. * * Get current verbosity level set for the output to the log file. */ cpl_msg_severity cpl_msg_get_log_level(void) { _cpl_msg_init("cpl_msg_get_log_level"); return log_min_level; } /** * @brief * Get current terminal verbosity level. * * @return Current verbosity level. * * Get current verbosity level set for the output to terminal. */ cpl_msg_severity cpl_msg_get_level(void) { _cpl_msg_init("cpl_msg_get_level"); return term_min_level; } /** * @brief * Attach a @em time tag to output messages. * * @return Nothing. * * As a default, @em time tags are attached just to messages written * to the log file. This function must be called to display the @em time * tag also in messages written to terminal. To turn the @em time tag * off the function @c cpl_msg_set_time_off() should be called. * * @note * This function is meant to configure once and for all the behaviour * and the "style" of the messaging system, and it is not supposed to * be called in threads. */ void cpl_msg_set_time_on(void) { _cpl_msg_init("cpl_msg_set_time_on"); time_tag = 1; } /** * @brief * Disable the @em time tag in output messages. * * @return Nothing. * * The @em time tag is turned off in messages written to terminal. * The @em time tag cannot be turned off in messages written to the * log file. * * @note * This function is meant to configure once and for all the behaviour * and the "style" of the messaging system, and it is not supposed to * be called in threads. */ void cpl_msg_set_time_off(void) { _cpl_msg_init("cpl_msg_set_time_off"); time_tag = 0; } /** * @brief * Attach a @em thread id tag to output messages. * * @return Nothing. * * As a default, @em thread ids tags are attached just to messages written * to the log file. This function must be called to display the @em thread id * tag also in messages written to terminal. To turn the @em thread id tag * off the function @c cpl_msg_set_threadid_off() should be called. * * @note * This function is meant to configure once and for all the behaviour * and the "style" of the messaging system, and it is not supposed to * be called in threads. */ void cpl_msg_set_threadid_on(void) { _cpl_msg_init("cpl_msg_set_threadid_on"); threadid_tag = 1; } /** * @brief * Disable the @em thread id tag to output messages * * @return Nothing. * * The @em thread id tag is turned off in messages written to terminal. * The @em thread id tag cannot be turned off in messages written to the * log file. * * @note * This function is meant to configure once and for all the behaviour * and the "style" of the messaging system, and it is not supposed to * be called in threads. */ void cpl_msg_set_threadid_off(void) { _cpl_msg_init("cpl_msg_set_threadid_off"); threadid_tag = 0; } /** * @brief * Attach the @em domain tag to output messages. * * @return Nothing. * * As a default, the @em domain tag is just written to the header of * the log file. This function must be called to attach the @em domain * tag to all messages written to terminal. If the @em domain tag is * on and no domain tag was specified, the string "Undefined domain" * (or something analogous) would be attached to all messages. To turn * the @em domain tag off the function @c cpl_msg_set_domain_off() must * be called. * * @note * This function is meant to configure once and for all the behaviour * and the "style" of the messaging system, and it is not supposed to * be called in threads. */ void cpl_msg_set_domain_on(void) { _cpl_msg_init("cpl_msg_set_domain_on"); domain_tag = 1; } /** * @brief * Disable the @em domain tag in output messages. * * @return Nothing. * * The @em domain tag is turned off in messages written to terminal. * * @note * This function is meant to configure once and for all the behaviour * and the "style" of the messaging system, and it is not supposed to * be called in threads. */ void cpl_msg_set_domain_off(void) { _cpl_msg_init("cpl_msg_set_domain_off"); domain_tag = 0; } /** * @brief * Attach the @em component tag to output messages. * * @return Nothing. * * As a default, the @em component tag is attached just to messages written * to the log file. This function must be called to display the @em component * tag also in messages written to terminal. To turn the @em component tag * off the function @c cpl_msg_set_component_off() should be called. However, * the @em component tag is always shown when the verbosity level is set * to @c CPL_MSG_DEBUG. * * @note * This function is meant to configure once and for all the behaviour * and the "style" of the messaging system, and it is not supposed to * be called in threads. */ void cpl_msg_set_component_on(void) { _cpl_msg_init("cpl_msg_set_component_on"); component_tag = 1; } /** * @brief * Disable the @em component tag in output messages. * * @return Nothing. * * The @em component tag is turned off in messages written to terminal, * unless the verbosity level is set to @c CPL_MSG_DEBUG. The @em component * tag cannot be turned off in messages written to the log file. * * @note * This function is meant to configure once and for all the behaviour * and the "style" of the messaging system, and it is not supposed to * be called in threads. */ void cpl_msg_set_component_off(void) { _cpl_msg_init("cpl_msg_set_component_off"); component_tag = 0; } /** * @brief * Set the @em domain name. * * @param name Any task identifier, typically a pipeline recipe name. * * @return Nothing. * * This routine should be called at a pipeline recipe start, and * before a possible call to the function cpl_msg_set_log_level() or the * proper task identifier would not appear in the log file header. * The @em domain tag is attached to messages sent to terminal only * if the function @c cpl_msg_set_domain_on() is called. If the * @em domain tag is on and no domain tag was specified, the string * "Undefined domain" (or something analogous) would be attached * to all messages. To turn the @em domain tag off the function * @c cpl_msg_set_domain_off() should be called. If @em name is a * @c NULL pointer, nothing is done, and no error is set. * * @note * This function is meant to configure once and for all the behaviour * and the "style" of the messaging system, and it is not supposed to * be called in threads. */ void cpl_msg_set_domain(const char *name) { _cpl_msg_init("cpl_msg_set_domain"); if (name == NULL) return; if (strlen(name) >= CPL_MAX_DOMAIN_NAME) { strncpy(domain, name, CPL_MAX_DOMAIN_NAME); domain[CPL_MAX_DOMAIN_NAME-1] = '\0'; } else { strcpy(domain, name); } } /** * @brief * Get the @em domain name. * * @return Pointer to "domain" string. * * This routine returns always the same pointer to the statically * allocated buffer containing the "domain" string. */ const char *cpl_msg_get_domain(void) { _cpl_msg_init("cpl_msg_get_domain"); return domain; } /** * @brief * Set the maximum width of the displayed text. * * @param width Max width of the displayed text. * * @return Nothing. * * If a message is longer than @em width characters, it would be broken * into shorter lines before being displayed to terminal. However, words * longer than @em width would not be broken, and in this case longer * lines would be printed. This function is automatically called by the * messaging system every time the terminal window is resized, and the * width is set equal to the new width of the terminal window. If @em width * is zero or negative, long message lines would not be broken. Lines are * never broken in log files. */ void cpl_msg_set_width(int width) { _cpl_msg_init("cpl_msg_set_width"); if (width < 0) width = 0; page_width = width; } /** * @brief * Set the indentation step. * * @param step Indentation step. * * @return Nothing. * * To maintain a consistent message display style, this routine * should be called at most once, and just at program start. * A message line might be moved leftward or rightward by a * number of characters that is a multiple of the specified * indentation step. Setting the indentation step to zero or * to a negative number would eliminate messages indentation. * If this function is not called, the indentation step defaults to 2. * * @note * This function is meant to configure once and for all the behaviour * and the "style" of the messaging system, and it is not supposed to * be called in threads. */ void cpl_msg_set_indentation(int step) { _cpl_msg_init("cpl_msg_set_indentation"); if (step < 0) step = 0; indent_step = step; } /** * @brief * Set the indentation level. * * @return Nothing. * * @param level Indentation level. * * Any message printed after a call to this function would be indented * by a number of characters equal to the @em level multiplied by the * indentation step specified with the function @c cpl_msg_set_indentation(). * Specifying a negative indentation level would set the indentation * level to zero. */ void cpl_msg_indent(int level) { _cpl_msg_init("cpl_msg_indent"); if (level < 0) level = 0; indent_value = level * indent_step; } /** * @brief * Increase the message indentation by one indentation step. * * @return Nothing. * * Calling this function is equivalent to increase the indentation * level by 1. See function @c cpl_msg_indent(). */ void cpl_msg_indent_more(void) { _cpl_msg_init("cpl_msg_indent_more"); indent_value += indent_step; } /** * @brief * Decrease the message indentation by one indentation step. * * @return Nothing. * * Calling this function is equivalent to decrease the indentation level * by 1. If the indentation level is already 0, it is not decreased. */ void cpl_msg_indent_less(void) { _cpl_msg_init("cpl_msg_indent_less"); if (indent_value > 0) indent_value -= indent_step; } /** * @brief * Display an error message. * * @return Nothing. * * @param component Name of the component generating the message. * @param format Format string. * @param ... Variable argument list associated to the format string. * * The @em format string should follow the usual @c printf() convention. * Newline characters shouldn't generally be used, as the message * would be split automatically according to the width specified with * @b cpl_msg_set_width(). Inserting a newline character would * enforce breaking a line of text even before the current row is * filled. Newline characters at the end of the @em format string * are not required. If @em component is a @c NULL pointer, it would * be set to the string "". If @em format is a @c NULL * pointer, the message "" would be printed. */ void cpl_msg_error(const char *component, const char *format, ...) { va_list al; const char *c; _cpl_msg_init("cpl_msg_error"); if (component == NULL) c = default_component; else c = component; if (format == NULL) { cpl_msg_error(c, default_format); return; } va_start(al, format); cpl_msg_out(CPL_MSG_ERROR, c, 0, format, al); va_end(al); } /** * @brief * Display a warning message. * * @return Nothing. * * @param component Name of the function generating the message. * @param format Format string. * @param ... Variable argument list associated to the format string. * * See the description of the function @c cpl_msg_error(). */ void cpl_msg_warning(const char *component, const char *format, ...) { va_list al; const char *c; _cpl_msg_init("cpl_msg_warning"); if (component == NULL) c = default_component; else c = component; if (format == NULL) { cpl_msg_warning(c, default_format); return; } va_start(al, format); cpl_msg_out(CPL_MSG_WARNING, c, 0, format, al); va_end(al); } /** * @brief * Display an information message. * * @return Nothing. * * @param component Name of the function generating the message. * @param format Format string. * @param ... Variable argument list associated to the format string. * * See the description of the function @c cpl_msg_error(). */ void cpl_msg_info(const char *component, const char *format, ...) { va_list al; const char *c; _cpl_msg_init("cpl_msg_info"); if (component == NULL) c = default_component; else c = component; if (format == NULL) { cpl_msg_info(c, default_format); return; } va_start(al, format); cpl_msg_out(CPL_MSG_INFO, c, 0, format, al); va_end(al); } /** * @brief * Display an overwritable information message. * * @return Nothing. * * @param component Name of the function generating the message. * @param format Format string. * @param ... Variable argument list associated to the format string. * * See the description of the function @c cpl_msg_error(). The severity * of the message issued by @c cpl_msg_info_overwritable() is the same * as the severity of a message issued using @c cpl_msg_info(). The only * difference with the @c cpl_msg_info() function is that the printed * message would be overwritten by a new message issued using again * cpl_msg_info_overwritable(), if no other meassages were issued with * other messaging functions in between. This function would be used * typically in loops, as in the following example: * @code * iter = 1000; * for (i = 0; i < iter; i++) { * cpl_msg_info_overwritable(cpl_func, "Median computation... %d out of %d", i, iter); * * } * @endcode * * @note * In the current implementation, an overwritable message is obtained * by not adding the new-line character ('\\n') at the end of the message * (contrary to what @c cpl_msg_info() does). */ void cpl_msg_info_overwritable(const char *component, const char *format, ...) { va_list al; const char *c; _cpl_msg_init("cpl_msg_info_overwritable"); overwrite = 1; if (component == NULL) c = default_component; else c = component; if (format == NULL) { cpl_msg_info(c, default_format); return; } va_start(al, format); cpl_msg_out(CPL_MSG_INFO, c, 1, format, al); va_end(al); } /** * @brief * Display a debug message. * * @return Nothing. * * @param component Name of the function generating the message. * @param format Format string. * @param ... Variable argument list associated to the format string. * * See the description of the function @c cpl_msg_error(). */ void cpl_msg_debug(const char *component, const char *format, ...) { va_list al; const char *c; _cpl_msg_init("cpl_msg_debug"); if (component == NULL) c = default_component; else c = component; if (format == NULL) { cpl_msg_debug(c, default_format); return; } va_start(al, format); cpl_msg_out(CPL_MSG_DEBUG, c, 0, format, al); va_end(al); } /** * @brief * Display a progress message predicting the time required in a loop. * * @return Nothing. * * @param component Name of the function generating the message. * @param i Iteration, starting with 0 and less than iter. * @param iter Total number of iterations. * @param format Format string. * @param ... Variable argument list associated to the format string. * @see cpl_msg_info() * @deprecated Use standard calls such as cpl_msg_info() instead. * */ void cpl_msg_progress(const char *component, int i, int iter, const char *format, ...) { va_list al; const char *c; const double tquiet = 10.0; /* Accept silence for this many seconds */ static double tstart = 0.0; /* Initialize to avoid false warnings */ static double tend = 0.0; /* Initialize to avoid false warnings */ double tspent; static int iprev = 0; /* Used to detect some illegal calls */ static int nprev = 0; /* Used to detect some illegal calls */ static int didmsg = 0; int percent; _cpl_msg_init("cpl_msg_progress"); if (component == NULL) c = default_component; else c = component; if (format == NULL) format = default_format; if (i >= iter || i < 0 || iter < 1) return; if (i == 0) { if (iter == 1) return; /* A meaningful message is not possible */ /* Reset check variables */ nprev = iter; iprev = 0; /* Assume caller printed a message before the loop started */ /* Find out how much CPU was spent at this point */ tstart = cpl_test_get_cputime(); tend = 0; didmsg = 0; return; } /* More input errors: i must increase during loop */ if (i <= iprev) return; /* cpl_ensure() ? */ iprev = i; /* More input errors: iter may not change during loop */ if (iter != nprev) return; /* cpl_ensure() ? */ /* Compute the time spent in the loop so far */ tspent = cpl_test_get_cputime() - tstart; /* This fraction (rounded down) of iterations has been completed */ percent = (i * 100) / iter; if (i == iter-1 && didmsg) cpl_msg_debug(c, "Loop time prediction offset (%d%% done) [s]: " "%.2g", percent, tend - tspent); /* Return if the time spent is within the allowed time of silence + the predicted time if any */ if (tspent < tquiet + tend) return; /* A prediction has not (yet) been made, or the prediction was too optismistic. Make a (new) prediction on the assumption that the average time so far required per iteration is unchanged for the remaining iteration(s). */ tend = tspent * (iter - i) / (double) i; /* Update the starting point for the prediction */ tstart += tspent; if (tend >= 0.5) { /* Do not predict less than 1 second */ const int itend = 0.5 + tend; /* Roundoff to integer */ /* %% is expanded twice */ const char * myformat = "%s. %d%%%% done, about %d seconds left"; /* The length of the string to pass to cpl_msg_out() - the factor 3 is a round-up of 8 / log2(10) */ const int size = strlen(format) + strlen(myformat) + 3 * sizeof(int); char * extformat = cpl_malloc(size * sizeof(char)); if (sprintf(extformat, myformat, format, percent, itend) > 0) { va_start(al, format); cpl_msg_out(CPL_MSG_INFO, c, 0, extformat, al); va_end(al); didmsg++; } cpl_free(extformat); } } /**@}*/ cpl-6.4.1/cplcore/cpl_memory_impl.h0000644000460300003120000000230311466733006014205 00000000000000/* $Id: cpl_memory_impl.h,v 1.11 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.11 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_MEMORY_IMPL_H #define CPL_MEMORY_IMPL_H #include #include CPL_BEGIN_DECLS void cpl_memory_init(int); CPL_END_DECLS #endif /* CPL_MEMORY_IMPL_H */ cpl-6.4.1/cplcore/cpl_image_basic.h0000644000460300003120000001624412272176370014111 00000000000000/* $Id: cpl_image_basic.h,v 1.50 2013-07-24 09:45:53 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-07-24 09:45:53 $ * $Revision: 1.50 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGE_BASIC_H #define CPL_IMAGE_BASIC_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image.h" #include "cpl_vector.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /** * Each FFT mode is listed below. * The modes can be combined with bitwise or. */ #define CPL_FFT_DEFAULT ((unsigned)0) /* Inverse FFT */ #define CPL_FFT_INVERSE ((unsigned)1 << 1) /* No normalization */ #define CPL_FFT_UNNORMALIZED ((unsigned)1 << 2) /* Swap halves of output */ #define CPL_FFT_SWAP_HALVES ((unsigned)1 << 3) enum _cpl_norm_ { CPL_NORM_SCALE, CPL_NORM_MEAN, CPL_NORM_FLUX, CPL_NORM_ABSFLUX }; typedef enum _cpl_norm_ cpl_norm; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* Basic operations */ cpl_image * cpl_image_add_create(const cpl_image *, const cpl_image *) CPL_ATTR_ALLOC; cpl_image * cpl_image_subtract_create(const cpl_image *, const cpl_image *) CPL_ATTR_ALLOC; cpl_image * cpl_image_multiply_create(const cpl_image *, const cpl_image *) CPL_ATTR_ALLOC; cpl_image * cpl_image_divide_create(const cpl_image *, const cpl_image *) CPL_ATTR_ALLOC; cpl_error_code cpl_image_add(cpl_image *, const cpl_image *); cpl_error_code cpl_image_subtract(cpl_image *, const cpl_image *); cpl_error_code cpl_image_multiply(cpl_image *, const cpl_image *); cpl_error_code cpl_image_divide(cpl_image *, const cpl_image *); cpl_error_code cpl_image_add_scalar(cpl_image *, double); cpl_error_code cpl_image_subtract_scalar(cpl_image *, double); cpl_error_code cpl_image_multiply_scalar(cpl_image *, double); cpl_error_code cpl_image_divide_scalar(cpl_image *, double); cpl_error_code cpl_image_power(cpl_image *, double); cpl_error_code cpl_image_exponential(cpl_image *, double); cpl_error_code cpl_image_logarithm(cpl_image *, double); cpl_error_code cpl_image_normalise(cpl_image *, cpl_norm); cpl_error_code cpl_image_abs(cpl_image *); cpl_error_code cpl_image_hypot(cpl_image *, const cpl_image *, const cpl_image *); cpl_error_code cpl_image_and(cpl_image *, const cpl_image *, const cpl_image *); cpl_error_code cpl_image_or(cpl_image *, const cpl_image *, const cpl_image *); cpl_error_code cpl_image_xor(cpl_image *, const cpl_image *, const cpl_image *); cpl_error_code cpl_image_not(cpl_image *, const cpl_image *); cpl_error_code cpl_image_and_scalar(cpl_image *, const cpl_image *, cpl_bitmask); cpl_error_code cpl_image_or_scalar(cpl_image *, const cpl_image *, cpl_bitmask); cpl_error_code cpl_image_xor_scalar(cpl_image *, const cpl_image *, cpl_bitmask); cpl_image * cpl_image_add_scalar_create(const cpl_image *, double) CPL_ATTR_ALLOC; cpl_image * cpl_image_subtract_scalar_create(const cpl_image *, double) CPL_ATTR_ALLOC; cpl_image * cpl_image_multiply_scalar_create(const cpl_image *, double) CPL_ATTR_ALLOC; cpl_image * cpl_image_divide_scalar_create(const cpl_image *, double) CPL_ATTR_ALLOC; cpl_image * cpl_image_power_create(const cpl_image *, double) CPL_ATTR_ALLOC; cpl_image * cpl_image_exponential_create(const cpl_image *, double) CPL_ATTR_ALLOC; cpl_image * cpl_image_logarithm_create(const cpl_image *, double) CPL_ATTR_ALLOC; cpl_image * cpl_image_normalise_create(const cpl_image *, cpl_norm) CPL_ATTR_ALLOC; cpl_image * cpl_image_abs_create(const cpl_image *) CPL_ATTR_ALLOC; cpl_error_code cpl_image_threshold(cpl_image *, double, double, double, double); cpl_image * cpl_image_average_create(const cpl_image *, const cpl_image *) CPL_ATTR_ALLOC; /* Collapse functions */ cpl_image * cpl_image_collapse_window_create(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size, int) CPL_ATTR_ALLOC; cpl_image * cpl_image_collapse_create(const cpl_image *, int) CPL_ATTR_ALLOC; cpl_image * cpl_image_collapse_median_create(const cpl_image *, int, cpl_size, cpl_size) CPL_ATTR_ALLOC; /* Extraction function */ cpl_image * cpl_image_extract(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_vector * cpl_vector_new_from_image_row(const cpl_image *, cpl_size) CPL_ATTR_ALLOC; cpl_vector * cpl_vector_new_from_image_column(const cpl_image *, cpl_size) CPL_ATTR_ALLOC; /* Rotation and Shift */ cpl_error_code cpl_image_turn(cpl_image *, int); cpl_error_code cpl_image_shift(cpl_image *, cpl_size, cpl_size); /* Insert an image in an other one */ cpl_error_code cpl_image_copy(cpl_image *, const cpl_image *, cpl_size, cpl_size); /* Symmetry function */ cpl_error_code cpl_image_flip(cpl_image *, int); /* Pixels re-organization */ cpl_error_code cpl_image_move(cpl_image *, cpl_size, const cpl_size *); /* Gaussian fit of an image zone */ cpl_error_code cpl_image_fit_gaussian(const cpl_image *, cpl_size, cpl_size, cpl_size, double *, double *, double *, double *, double *, double *, double *) CPL_ATTR_DEPRECATED; /* FWHM computation on a local maximum */ cpl_error_code cpl_image_get_fwhm(const cpl_image *, cpl_size, cpl_size, double *, double *); /* FFT computation */ cpl_error_code cpl_image_fft(cpl_image *, cpl_image *, unsigned); CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_image_iqe.c0000644000460300003120000010254112075554424013576 00000000000000/* $Id: cpl_image_iqe.c,v 1.33 2013-01-16 16:45:08 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-01-16 16:45:08 $ * $Revision: 1.33 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image_iqe.h" #include "cpl_error_impl.h" #include "cpl_bivector.h" #include "cpl_image_basic.h" #include "cpl_image_defs.h" #include "cpl_math_const.h" #include /*----------------------------------------------------------------------------- Private Function prototypes - more are declared below -----------------------------------------------------------------------------*/ static int cpl_iqe(float *, int, int, float *, float *); /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Compute an image quality estimation for an object @param in the input image @param llx @param lly the zone to analyse ((1, 1) for the first pixel) @param urx The zone must be at least 4 by 4 pixels @param ury @return a newly allocated cpl_bivector containing the results or NULL in error case. This function makes internal use of the iqe() MIDAS function (called here cpl_iqe()) written by P. Grosbol. Refer to the MIDAS documentation for more details. This function has proven to give good results over the years when called from RTD. The goal is to provide the exact same functionality in CPL as the one provided in RTD. The code is simply copied from the MIDAS package, it is not maintained by the CPL team. The returned object must be deallocated with cpl_bivector_delete(). It contains in the first vector the computed values, and in the second one, the associated errors. The computed values are: - x position of the object - y position of the object - FWHM along the major axis - FWHM along the minor axis - the angle of the major axis with the horizontal in degrees - the peak value of the object - the background computed The bad pixels map of the image is not taken into account. The input image must be of type float. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if the specified zone is not valid or if the computation fails on this zone - CPL_ERROR_INVALID_TYPE if the input image has the wrong type @note This function may lead to a strong underestimation of the sigmas and FWHMs (up to 25% underestimation in the case of noiseless data with a box 4 times the sigma, 1% underestimation in the case of noiseless data with a box 7 times the sigma). */ /*----------------------------------------------------------------------------*/ cpl_bivector * cpl_image_iqe(const cpl_image * in, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { cpl_image * extracted; float parm[8], sdev[8]; float * pextracted; cpl_bivector * res; double * res_x; double * res_y; int iqe_error; cpl_size nx, ny; int inx, iny; /* Check entries */ cpl_ensure(in, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(in->type == CPL_TYPE_FLOAT, CPL_ERROR_INVALID_TYPE, NULL); cpl_ensure(urx >= llx + 3, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(ury >= lly + 3, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Extract the image */ extracted = cpl_image_extract(in, llx, lly, urx, ury); cpl_ensure(extracted, CPL_ERROR_ILLEGAL_INPUT, NULL); nx = cpl_image_get_size_x(extracted); ny = cpl_image_get_size_y(extracted); inx = (int)nx; iny = (int)ny; if ((cpl_size)inx != nx || (cpl_size)iny != ny) { cpl_image_delete(extracted); (void)cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return NULL; } /* Get the pointer to the data */ pextracted = cpl_image_get_data_float(extracted); iqe_error = cpl_iqe(pextracted, inx, iny, parm, sdev); cpl_image_delete(extracted); cpl_ensure(!iqe_error, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Create the result cpl_bivector */ res = cpl_bivector_new(7); res_x = cpl_bivector_get_x_data(res); res_y = cpl_bivector_get_y_data(res); res_x[0] = (double)llx + parm[0]; res_y[0] = sdev[0]; res_x[1] = (double)lly + parm[2]; res_y[1] = sdev[2]; res_x[2] = parm[1]; res_y[2] = sdev[1]; res_x[3] = parm[3]; res_y[3] = sdev[3]; res_x[4] = parm[4]; res_y[4] = sdev[4]; res_x[5] = parm[5]; res_y[5] = sdev[5]; res_x[6] = parm[6]; res_y[6] = sdev[6]; return res; } /* Declare local functions private to avoid namespace conflicts */ /* Also add function declaration, to prevent problems in case the ieq() code is copied once again from RTD. */ static int gaussj(double *, int, double *, int); static int covsrt(double *, int, int [], int); static int estm9p(float *, int, int, int, int, float *, float *, float *); static int iqebgv(float *, int, int, float *, float *, int *); static int iqemnt(float *, int, int, float, float, float *, int); static int iqesec(float *, int, int, float, float *, float *, int); static int iqefit(float *, int, int, float, float *, float *, float *, int); static void indexx(int, float [], int []); static void hsort(int, float *); static int mrqmin(int, float [], int, int [], int, double *, double *, double *, int (*)(), double *); static int mrqcof(int, float [], int, int [], int, double *, double [], double *, int (*)()); static int g2efit(float *, float *, int, int, float [], float [], double *); static int g2einit(float *, float *, int, int); static int g2efunc(int, float *, float *, float *, float *, float *); /******************************************************************************/ /* iqe() COPIED FROM RTD 20-06-2003 */ /* - unused function definition indexd() removed */ /* - static modifier added to private functions */ /* - old-style function definitions replaced */ /******************************************************************************/ /* define constants */ #define hsq2 CPL_MATH_SQRT1_2 /* constant 0.5*sqrt(2) */ #define MA 6 /* No. of variables */ #define MITER 64 /* Max. no. of iterations */ #define MMA 16 /* Max. size of matrix */ #define SWAP(a,b) {double temp=(a);(a)=(b);(b)=temp;} /* end define */ static float *pval; static float *pwght; static int mxx, mp; static double w[9]; static double xi[9]; static double yi[9]; #ifdef _OPENMP #pragma omp threadprivate(pval,pwght,mxx,mp,w,xi,yi) #endif static int cpl_iqe( /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .PURPOSE Estimate parameters for the Image Quality using a small frame around the object. The following parameters are estimated and given in the array 'parm': parm[0] = mean X position within array, first pixel = 0 parm[1] = FWHM in X parm[2] = mean Y position within array, first pixel = 0 parm[3] = FWHM in Y parm[4] = angle of major axis, degrees, along X = 0 parm[5] = peak value of object above background parm[6] = mean background level Further, estimates of the standard deviation of the parameters are given in 'sdev'. The routine is just a sequence of calls to 'iqebgv', 'iqemnt', 'iqesec' and 'iqefit'. .RETURN status, 0: OK, <0: estimate failed, ------------------------------------------------------------------------*/ float *pfm, int mx, int my, float *parm, float *sdev ) { int n, err, nbg; int winsize; float bgv, bgs; float ap[6], cv[6], est[6], sec[6]; for (n=0; n<7; n++) parm[n] = sdev[n] = 0.0; winsize = (mx * my) - 1; /* size of sub window */ if ((err=iqebgv(pfm, mx, my, &bgv, &bgs, &nbg))) return -1; parm[6] = bgv; sdev[6] = bgs; if ((err=iqemnt(pfm, mx, my, bgv, bgs, est, winsize))) return -2; parm[0] = est[1]; parm[1] = CPL_MATH_FWHM_SIG*est[2]; /* Sigma to FWHM */ parm[2] = est[3]; parm[3] = CPL_MATH_FWHM_SIG*est[4]; /* Sigma to FWHM */ parm[5] = est[0]; if ((err=iqesec(pfm, mx, my, bgv, est, sec, winsize))) return -3; parm[4] = CPL_MATH_DEG_RAD*sec[5]; /* Radian to Degrees */ if ((err=iqefit(pfm, mx, my, bgv, sec, ap, cv, winsize))<0) return -4; parm[0] = ap[1]; sdev[0] = cv[1]; parm[1] = CPL_MATH_FWHM_SIG*ap[2]; /* Sigma to FWHM */ sdev[1] = CPL_MATH_FWHM_SIG*cv[2]; /* Sigma to FWHM */ parm[2] = ap[3]; sdev[2] = cv[3]; parm[3] = CPL_MATH_FWHM_SIG*ap[4]; /* Sigma to FWHM */ sdev[3] = CPL_MATH_FWHM_SIG*cv[4]; /* Sigma to FWHM */ parm[4] = fmod(CPL_MATH_DEG_RAD*ap[5]+180.0, 180.0); sdev[4] = CPL_MATH_DEG_RAD*cv[5]; /* Radian to Degrees */ if (sdev[4] > 180.) sdev[4] = 180.0; /* max is: Pi */ parm[5] = ap[0]; sdev[5] = cv[0]; return 0; } static int iqebgv( /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .PURPOSE Estimate background level for subimage .RETURN status, 0: OK, -1:no buffer space, -2: no points left ------------------------------------------------------------------------*/ float *pfm, int mx, int my, float *bgm, float *bgs, int *nbg ) { int n, m, ns, ms, nt, mt; float *pfb, *pwb, *pf, *pw; float *pf0, *pf1, *pf2, *pf3, *pfs0, *pfs1, *pfs2, *pfs3; double val, fks, ba, bm, bs; *bgm = 0.0; *bgs = 0.0; *nbg = 0; pfs0 = pfm; pfs1 = pfm + mx - 1; pfs2 = pfm + mx*(my-1); pfs3 = pfm + mx*my - 1; ns = (mx winsize)) return -99; val = *pf - bgv; am = val; ax = val*x; ay = val*y; axx = val*x*x; ayy = val*y*y; axy = val*x*y; nt++; ki = ks = kn = 1; while (n--) { k = kn; if (!ki && ks==-1) { if (nx) nx = 0; else break; } ioff = (ki) ? ks : ks*mx; while (k--) { if (ki) x += ks; else y += ks; if (x<0.0 || y<0.0 || xm winsize)) break; val = *pf - bgv; if (dv winsize)) break; dx = x - xc; dy = y - yc; r = sqrt(dx*dx + dy*dy); if (rl winsize)) { free (pfb); return -99; } pf = pfb; pw = pwb; iy = ny; while (iy--) { ix = nx; while (ix--) { *pf++ = *pfm++ - bgv; psize = pfm - pfmo; if (psize > winsize) { free (pfb); return -99; } *pw++ = 1.0; } pfm += mx - nx; psize = pfm - pfmo; if ((psize < 0) || (psize > winsize)) { free (pfb); return -99; } } /* initialize parameters for fitting */ ap[0] = est[0]; ap[1] = est[1] - nxs; ap[2] = est[2]; ap[3] = est[3] - nys; ap[4] = est[4]; ap[5] = est[5]; /* perform actual 2D Gauss fit on small subimage */ n = g2efit(pfb, pwb, nx, ny, ap, cm, &chi); /* normalize parameters and uncertainties, and exit */ ap[1] += nxs; ap[3] += nys; free(pfb); return n; } static int g2einit( /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .PURPOSE Initiate gauss fit function, set pointers to data and weights .RETURN status, 0: OK, -1: error - bad pixel no. ------------------------------------------------------------------------*/ float *val, float *wght, int nx, int ny ) { double fh, w1, w2, w3; if (nx<1) { /* if NO x-pixel set to NULL */ pval = (float *) 0; pwght = (float *) 0; mxx = mp = 0; return -1; } pval = val; /* otherwise initiate static varables */ pwght = wght; mxx = nx; mp = (0 1) return -1; } if (kk != ma) return -2; *alamda = 0.001; mrqcof(ndata, a, ma, lista, mfit, alpha, beta, chisq, funcs); if (*chisq<=0.0) return -4; ochisq = (*chisq); } for (j=0; j= big) { big = dum; irow = j; icol = k; } } else if (ipiv[k] > 1) return -1; } } ++(ipiv[icol]); if (irow != icol) { for (l=0; l=0; l--) { if (indxr[l] != indxc[l]) for (k=0; k lista[i]) covar[lista[j]+lista[i]*ma] = covar[i+j*ma]; else covar[lista[i]+lista[j]*ma] = covar[i+j*ma]; } swap = covar[0]; for (j=0; j> 1; ir = n - 1; while(1) { if (l>0) { indxt = indx[--l]; q = arrin[indxt]; } else { indxt = indx[ir]; q = arrin[indxt]; indx[ir] = indx[0]; if (--ir == 0) { indx[0] = indxt; return; } } i = l; j = (l<<1) + 1; while (j<=ir) { if (j> 1; ir = n - 1; while (1) { if (l>0) rra = ra[--l]; else { rra = ra[ir]; ra[ir] = ra[0]; if (--ir == 0) { ra[0] = rra; return; } } i = l; j = (l << 1) + 1; while (j<=ir) { if (j #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include "cpl_tools.h" #include "cpl_error_impl.h" #include "cpl_math_const.h" #include "cpl_image_gen.h" #include "cpl_image_basic.h" #include "cpl_image_defs.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define CPL_IMAGE_GEN_NOISE_UNIFORM 1 #define CPL_IMAGE_GEN_GAUSSIAN 2 #define CPL_IMAGE_GEN_POLYNOMIAL 3 #define CPL_IMAGE_GEN_NBPOINTS 10 /* Sun Studio 12.1 expands the macro I to 1.0iF which the compiler does not recognize, so try something else */ #ifdef _Imaginary_I #define CPL_I _Imaginary_I #elif defined _Complex_I #define CPL_I _Complex_I #else #define CPL_I I #endif /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ static double cpl_gaussian_2d(double, double, double, double, double); /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ #define CPL_OPERATION CPL_IMAGE_GEN_NOISE_UNIFORM /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Generate an image with uniform random noise distribution. @param ima the image to generate @param min_pix Minimum output pixel value. @param max_pix Maximum output pixel value. @return the #_cpl_error_code_ or CPL_ERROR_NONE Generate an image with a uniform random noise distribution. Pixel values are within the provided bounds. This function expects an already allocated image. The input image type can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if min_pix is bigger than max_pix - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_noise_uniform( cpl_image * ima, double min_pix, double max_pix) { int i, j; /* Test entries */ cpl_ensure_code(ima, CPL_ERROR_NULL_INPUT); cpl_ensure_code(min_pixtype) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_gen_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_gen_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_gen_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_DOUBLE_COMPLEX #include "cpl_image_gen_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT_COMPLEX #include "cpl_image_gen_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_GEN_GAUSSIAN /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Generate an image from a 2d gaussian function. @param ima the gaussian image to generate @param xcen x position of the center (1 for the first pixel) @param ycen y position of the center (1 for the first pixel) @param norm norm of the gaussian. @param sig_x Sigma in x for the gaussian distribution. @param sig_y Sigma in y for the gaussian distribution. @return the #_cpl_error_code_ or CPL_ERROR_NONE This function expects an already allocated image. This function generates an image of a 2d gaussian. The gaussian is defined by the position of its centre, given in pixel coordinates inside the image with the FITS convention (x from 1 to nx, y from 1 to ny), its norm and the value of sigma in x and y. f(x, y) = (norm/(2*pi*sig_x*sig_y)) * exp(-(x-xcen)^2/(2*sig_x^2)) * exp(-(y-ycen)^2/(2*sig_y^2)) The input image type can be CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_gaussian( cpl_image * ima, double xcen, double ycen, double norm, double sig_x, double sig_y) { double x, y; int i, j; /* Test entries */ cpl_ensure_code(ima, CPL_ERROR_NULL_INPUT); /* Switch on image type */ switch (ima->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_gen_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_gen_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_GEN_POLYNOMIAL /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Generate an image from a 2d polynomial function. @param ima the polynomial image to generate @param poly the 2d polynomial @param startx the x value associated with the left pixels column @param stepx the x step @param starty the y value associated with the bottom pixels row @param stepy the y step @return the #_cpl_error_code_ or CPL_ERROR_NONE This function expects an already allocated image. The pixel value of the pixel (i, j) is set to poly(startx+(i-1)*stepx, starty+(j-1)*stepy). The input image type can be CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. If you want to generate an image whose pixel values are the values of the polynomial applied to the pixel positions, just call cpl_image_fill_polynomial(ima, poly, 1.0, 1.0, 1.0, 1.0); Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if the polynomial's dimension is not 2 - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_polynomial( cpl_image * ima, const cpl_polynomial * poly, double startx, double stepx, double starty, double stepy) { cpl_vector * x; double * xdata; int i, j; /* Test entries */ cpl_ensure_code(ima && poly, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_polynomial_get_dimension(poly) == 2, CPL_ERROR_ILLEGAL_INPUT); /* Switch on image type */ switch (ima->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_gen_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_gen_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Generate a test image with pixel type CPL_TYPE_DOUBLE @param nx x size @param ny y size @return 1 newly allocated image or NULL on error Generates a reference pattern for testing purposes only. The created image has to be deallocated with cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if nx or ny is non-positive */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_fill_test_create(cpl_size nx, cpl_size ny) { const double xposrate[] = {0.4, 0.5, 0.8, 0.9, 0.2, 0.5, 0.9, 0.3, 0.1, 0.7}; const double yposrate[10] = {0.4, 0.2, 0.3, 0.9, 0.7, 0.8, 0.9, 0.8, 0.7, 0.7}; double xpos[CPL_IMAGE_GEN_NBPOINTS]; double ypos[CPL_IMAGE_GEN_NBPOINTS]; cpl_image * test_im = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE); cpl_image * tmp_im = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE); const cpl_size nbpoints = CPL_IMAGE_GEN_NBPOINTS; const double sigma = 10.0; const double flux = 1000.0; cpl_size i; cpl_ensure(nx > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(ny > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); for (i=0; i < nbpoints; i++) { xpos[i] = (double)nx * xposrate[i]; ypos[i] = (double)ny * yposrate[i]; } /* Set the background */ cpl_image_fill_noise_uniform(test_im, -1, 1); /* Put fake stars */ for (i = 0; i < nbpoints; i++) { cpl_image_fill_gaussian(tmp_im, xpos[i], ypos[i], 10.0, sigma, sigma); cpl_image_multiply_scalar(tmp_im, flux / (double)(i+1)); cpl_image_add(test_im, tmp_im); } cpl_image_delete(tmp_im); return test_im; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Compute the value of a Gaussian function at a given point. @param x x coordinate where to compute the function. @param y y coordinate where to compute the function. @param norm The norm of the gaussian. @param sig_x Sigma in x for the Gauss distribution. @param sig_y Sigma in y for the Gauss distribution. @return the gaussian value Compute the value of a 2d Gaussian function at a given point: f(x, y) = (norm/(2*pi*sig_x*sig_y)) * exp(-x^2/(2*sig_x^2)) * exp(-y^2/(2*sig_y^2)) */ /*----------------------------------------------------------------------------*/ static double cpl_gaussian_2d(double x, double y, double norm, double sig_x, double sig_y) { return norm / (sig_x * sig_y * CPL_MATH_2PI * exp(x * x / (2.0 * sig_x * sig_x) + y * y / (2.0 * sig_y * sig_y))); } cpl-6.4.1/cplcore/cpl_image_filter.c0000644000460300003120000014353212111713325014276 00000000000000/* $Id: cpl_image_filter.c,v 1.131 2013-02-22 16:03:33 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-02-22 16:03:33 $ * $Revision: 1.131 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_memory.h" #include "cpl_error_impl.h" #include "cpl_image_filter_impl.h" #include "cpl_image_bpm.h" #include "cpl_mask.h" #include "cpl_tools.h" #include "cpl_image_defs.h" #include #include #include #include #include #include #include #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /* These macros are needed for support of the different pixel types */ #define CONCAT(a,b) a ## _ ## b #define CONCAT2X(a,b) CONCAT(a,b) #define ADDTYPE(a) CONCAT2X(a, IN_TYPE) #define ADDTYPE_TWO(a) CONCAT2X(a, CONCAT2X(OUT_TYPE, IN_TYPE)) /*----------------------------------------------------------------------------- Static Function Prototypes -----------------------------------------------------------------------------*/ /* First includes involve no casting */ #define IN_EQ_OUT #define IN_TYPE double #define PIX_TYPE double /* FIXME: Use DBL_MIN */ #define PIX_MIN (-DBL_MAX) #define PIX_MAX DBL_MAX #include "cpl_filter_median.c" #define IN_TYPE float #define PIX_TYPE float /* FIXME: Use FLT_MIN */ #define PIX_MIN (-FLT_MAX) #define PIX_MAX FLT_MAX #include "cpl_filter_median.c" #define IN_TYPE int #define PIX_TYPE int /* FIXME: Use INT_MIN */ #define PIX_MIN (-INT_MAX) #define PIX_MAX INT_MAX #include "cpl_filter_median.c" #define IN_TYPE double #define OUT_TYPE double #define ACCU_TYPE double #define ACCU_FLOATTYPE double #include "cpl_image_filter_body.h" #define IN_TYPE float #define OUT_TYPE float #define ACCU_TYPE float #define ACCU_FLOATTYPE float #include "cpl_image_filter_body.h" #define IN_TYPE int #define OUT_TYPE int #define ACCU_TYPE int #define ACCU_TYPE_IS_INT #define ACCU_FLOATTYPE double #include "cpl_image_filter_body.h" #undef IN_EQ_OUT #define IN_TYPE double #define OUT_TYPE float #define ACCU_TYPE double #define ACCU_FLOATTYPE double #include "cpl_image_filter_body.h" #define IN_TYPE double #define OUT_TYPE int #define ACCU_TYPE double #define ACCU_FLOATTYPE double #include "cpl_image_filter_body.h" #define IN_TYPE float #define OUT_TYPE double #define ACCU_TYPE double #define ACCU_FLOATTYPE double #include "cpl_image_filter_body.h" #define IN_TYPE float #define OUT_TYPE int #define ACCU_TYPE float #define ACCU_FLOATTYPE float #include "cpl_image_filter_body.h" #define IN_TYPE int #define OUT_TYPE double #define ACCU_TYPE double #define ACCU_FLOATTYPE double #include "cpl_image_filter_body.h" #define IN_TYPE int #define OUT_TYPE float #define ACCU_TYPE float #define ACCU_FLOATTYPE float #include "cpl_image_filter_body.h" static cpl_mask * cpl_mask_new_from_matrix(const cpl_matrix *, double, double); /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Filter an image using a binary kernel @param self Pre-allocated image to hold the filtered result @param other Image to filter @param kernel Pixels to use, if set to CPL_BINARY_1 @param filter CPL_FILTER_MEDIAN, CPL_FILTER_AVERAGE and more, see below @param border CPL_BORDER_FILTER and more, see below @return CPL_ERROR_NONE or the relevant CPL error code The kernel must have an odd number of rows and an odd number of columns. The two images must have equal dimensions, except for the border mode CPL_BORDER_CROP, where the input image must have 2 * hx columns more and 2 * hy rows more than the output image, where the kernel has size (1 + 2 * hx, 1 + 2 * hy). In standard deviation filtering the kernel must have at least two elements set to CPL_BINARY_1, for others at least one element must be set to CPL_BINARY_1. Supported pixel types are: CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. In median filtering the two images must have the same pixel type. In standard deviation filtering a filtered pixel must be computed from at least two input pixels, for other filters at least one input pixel must be available. Output pixels where this is not the case are set to zero and flagged as rejected. In-place filtering is not supported, but if the two images have the same pixel type, then the input pixel buffer may overlap all but the 1+h first rows of the output pixel buffer, where 1+2*h is the number of rows in the kernel. Supported modes: CPL_FILTER_MEDIAN: CPL_BORDER_FILTER, CPL_BORDER_COPY, CPL_BORDER_NOP, CPL_BORDER_CROP. CPL_FILTER_AVERAGE: CPL_BORDER_FILTER CPL_FILTER_AVERAGE_FAST: CPL_BORDER_FILTER CPL_FILTER_STDEV: CPL_BORDER_FILTER CPL_FILTER_STDEV_FAST: CPL_BORDER_FILTER @par Example: @code cpl_image_filter_mask(filtered, raw, kernel, CPL_FILTER_MEDIAN, CPL_BORDER_FILTER); @endcode To shift an image 1 pixel up and 1 pixel right with the CPL_FILTER_MEDIAN filter and a 3 by 3 kernel, one should set to CPL_BINARY_1 the bottom leftmost kernel element - at row 3, column 1, i.e. @code cpl_mask * kernel = cpl_mask_new(3, 3); cpl_mask_set(kernel, 1, 1); @endcode The kernel required to do a 5 x 5 median filtering is created like this: @code cpl_mask * kernel = cpl_mask_new(5, 5); cpl_mask_not(kernel); @endcode Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL. - CPL_ERROR_ILLEGAL_INPUT if the kernel has a side of even length. - CPL_ERROR_DATA_NOT_FOUND If the kernel is empty, or in case of CPL_FILTER_STDEV if the kernel has only one element set to CPL_BINARY_1. - CPL_ERROR_ACCESS_OUT_OF_RANGE If the kernel has a side longer than the input image. - CPL_ERROR_INVALID_TYPE if the passed image type is not supported. - CPL_ERROR_TYPE_MISMATCH if in median filtering the input and output pixel types differ. - CPL_ERROR_INCOMPATIBLE_INPUT If the input and output images have incompatible sizes. - CPL_ERROR_UNSUPPORTED_MODE If the output pixel buffer overlaps the input one (or the kernel), or the border/filter mode is unsupported. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_filter_mask(cpl_image * self, const cpl_image * other, const cpl_mask * kernel, cpl_filter_mode filter, cpl_border_mode border) { const cpl_size nsx = cpl_image_get_size_x(self); const cpl_size nsy = cpl_image_get_size_y(self); const cpl_size nx = cpl_image_get_size_x(other); const cpl_size ny = cpl_image_get_size_y(other); const cpl_size mx = cpl_mask_get_size_x(kernel); const cpl_size my = cpl_mask_get_size_y(kernel); const cpl_size hsizex = mx >> 1; const cpl_size hsizey = my >> 1; const cpl_binary * pmask = cpl_mask_get_data_const(kernel); const void * pother = cpl_image_get_data_const(other); const void * pself = cpl_image_get_data_const(self); /* assert( sizeof(char) == 1 ) */ const void * polast = (const void*)((const char*)pother + (size_t)nx * (size_t)ny * cpl_type_get_sizeof (cpl_image_get_type(other))); const void * psrows = (const void*)((const char*)pself + (size_t)nsx * (size_t)(1+hsizey) * cpl_type_get_sizeof (cpl_image_get_type(self))); /* pmask may not overlap pself at all */ const void * pmlast = (const void*)(pmask + (size_t)mx * (size_t)my); const void * pslast = (const void*)((const char*)pself + (size_t)nsx * (size_t)nsy * cpl_type_get_sizeof (cpl_image_get_type(self))); cpl_binary * pbpmself; const cpl_binary * badmap; /* There are four different types of input: 1) No bpm, non-full kernel 2) No bpm, full kernel 3) bpm, non-full kernel 4) bpm, full kernel */ /* Input type 1: Not used (yet) */ /* Input type 2 */ void (*filter_fast)(void *, const void *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode); /* Input type 3 */ cpl_error_code (*filter_bpm)(void *, cpl_binary **, const void *, const cpl_binary *, const cpl_binary *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode); /* Input type 4 */ void (*filter_full)(void *, cpl_binary **, const void *, const cpl_binary *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_border_mode); cpl_boolean same_type = cpl_image_get_type(self) == cpl_image_get_type(other); cpl_boolean is_full; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(other != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(kernel != NULL, CPL_ERROR_NULL_INPUT); /* pself has to be above all of the other pixel buffer, or */ /* ...pother has to be above the first hsize+1 rows of pself */ /* ... unless they have different pixel types, in which case the two pixel buffers may not overlap at all */ if (!(pself >= polast || pother >= (same_type ? psrows : pslast))) { return cpl_error_set_message_(CPL_ERROR_UNSUPPORTED_MODE, "pself=%p, polast=%p, pother=%p, " "psrows=%p, pslast=%p, same_type=%d", pself, polast, pother, psrows, pslast, same_type); } /* If this check fails, the caller is doing something really weird... */ cpl_ensure_code((const void*)pmask >= pslast || pself >= (const void*)pmlast, CPL_ERROR_UNSUPPORTED_MODE); /* Only odd-sized masks allowed */ cpl_ensure_code((mx&1) == 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code((my&1) == 1, CPL_ERROR_ILLEGAL_INPUT); if (filter == CPL_FILTER_STDEV || filter == CPL_FILTER_STDEV_FAST) { /* Mask must have at least two non-zero elements */ const cpl_binary * pmask1 = memchr(pmask, CPL_BINARY_1, (size_t)mx * (size_t)my * sizeof(*pmask)); const cpl_binary * pmask2; cpl_ensure_code(pmask1 != NULL, CPL_ERROR_DATA_NOT_FOUND); /* Rely on memchr() to return NULL on zero-size */ pmask2 = memchr(pmask1 + sizeof(*pmask), CPL_BINARY_1, ((size_t)mx * (size_t)my - (1 + pmask1 - pmask)) * sizeof(*pmask)); cpl_ensure_code(pmask2 != NULL, CPL_ERROR_DATA_NOT_FOUND); } else { /* Mask may not be empty */ cpl_ensure_code(!cpl_mask_is_empty(kernel), CPL_ERROR_DATA_NOT_FOUND); } cpl_ensure_code(mx <= nx, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(my <= ny, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (border == CPL_BORDER_CROP) { cpl_ensure_code(nsx == nx - 2 * hsizex, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(nsy == ny - 2 * hsizey, CPL_ERROR_INCOMPATIBLE_INPUT); } else { cpl_ensure_code(nsx == nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(nsy == ny, CPL_ERROR_INCOMPATIBLE_INPUT); } /* Get and reset all bad pixels, if any */ pbpmself = self->bpm != NULL ? memset(cpl_mask_get_data(self->bpm), CPL_BINARY_0, (size_t)nsx * (size_t)nsy) : NULL; badmap = other->bpm == NULL || cpl_mask_is_empty(other->bpm) ? NULL : cpl_mask_get_data_const(other->bpm); is_full = memchr(pmask, CPL_BINARY_0, (size_t)mx * (size_t)my * sizeof(*pmask)) == NULL ? CPL_TRUE : CPL_FALSE; filter_fast = NULL; filter_bpm = NULL; filter_full = NULL; /* FIXME: For sufficiently large kernels and for a sufficiently small (but non-zero) number of bad pixels it may be faster to: 1) Process all pixels with the no-bpm version. 2) Dilate the (non-empty) bpm with the kernel, 3) Redo the pixels covered by the dilated bpm - The two pixel buffer passes should ideally be done block-wise. - median filter with a full kernel should be done first, since it has the highest potential for gain */ if (filter == CPL_FILTER_MEDIAN) { const cpl_boolean use_all = is_full && badmap == NULL; if (hsizex == 0 && hsizey == 0) { const cpl_error_code error = cpl_image_copy(self, other, 1, 1); cpl_ensure_code(!error, error); return CPL_ERROR_NONE; } cpl_ensure_code(same_type, CPL_ERROR_TYPE_MISMATCH); switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: if (use_all) { filter_fast = cpl_filter_median_fast_double; } else { filter_bpm = cpl_filter_median_slow_double; } break; case CPL_TYPE_FLOAT: if (use_all) { filter_fast = cpl_filter_median_fast_float; } else { filter_bpm = cpl_filter_median_slow_float; } break; case CPL_TYPE_INT: if (use_all) { filter_fast = cpl_filter_median_fast_int; } else { filter_bpm = cpl_filter_median_slow_int; } break; default: /* * Currently, it is an error in CPL to reach this point, as all * possible types for images (see cpl_image_new()) are supported. * * However, it could happen, if cpl_image_new() were extended to * support images of a new type and the new type were not supported * in this function. For that case, we keep setting the appropriate * error code in this default section. */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } else if (filter == CPL_FILTER_STDEV || (filter == CPL_FILTER_STDEV_FAST && !is_full)) { cpl_ensure_code(border == CPL_BORDER_FILTER, CPL_ERROR_UNSUPPORTED_MODE); switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_bpm = cpl_filter_stdev_slow_double_double; break; case CPL_TYPE_FLOAT: filter_bpm = cpl_filter_stdev_slow_double_float; break; case CPL_TYPE_INT: filter_bpm = cpl_filter_stdev_slow_double_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_FLOAT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_bpm = cpl_filter_stdev_slow_float_double; break; case CPL_TYPE_FLOAT: filter_bpm = cpl_filter_stdev_slow_float_float; break; case CPL_TYPE_INT: filter_bpm = cpl_filter_stdev_slow_float_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_INT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_bpm = cpl_filter_stdev_slow_int_double; break; case CPL_TYPE_FLOAT: filter_bpm = cpl_filter_stdev_slow_int_float; break; case CPL_TYPE_INT: filter_bpm = cpl_filter_stdev_slow_int_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } else if (filter == CPL_FILTER_AVERAGE || (filter == CPL_FILTER_AVERAGE_FAST && !is_full)) { cpl_ensure_code(border == CPL_BORDER_FILTER, CPL_ERROR_UNSUPPORTED_MODE); switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_bpm = cpl_filter_average_slow_double_double; break; case CPL_TYPE_FLOAT: filter_bpm = cpl_filter_average_slow_double_float; break; case CPL_TYPE_INT: filter_bpm = cpl_filter_average_slow_double_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_FLOAT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_bpm = cpl_filter_average_slow_float_double; break; case CPL_TYPE_FLOAT: filter_bpm = cpl_filter_average_slow_float_float; break; case CPL_TYPE_INT: filter_bpm = cpl_filter_average_slow_float_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_INT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_bpm = cpl_filter_average_slow_int_double; break; case CPL_TYPE_FLOAT: filter_bpm = cpl_filter_average_slow_int_float; break; case CPL_TYPE_INT: filter_bpm = cpl_filter_average_slow_int_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } else if (filter == CPL_FILTER_AVERAGE_FAST) { cpl_ensure_code(border == CPL_BORDER_FILTER, CPL_ERROR_UNSUPPORTED_MODE); if (badmap != NULL) { /* Full kernel, bad pixels */ switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_full = cpl_filter_average_bpm_double_double; break; case CPL_TYPE_FLOAT: filter_full = cpl_filter_average_bpm_double_float; break; case CPL_TYPE_INT: filter_full = cpl_filter_average_bpm_double_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_FLOAT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_full = cpl_filter_average_bpm_float_double; break; case CPL_TYPE_FLOAT: filter_full = cpl_filter_average_bpm_float_float; break; case CPL_TYPE_INT: filter_full = cpl_filter_average_bpm_float_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_INT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_full = cpl_filter_average_bpm_int_double; break; case CPL_TYPE_FLOAT: filter_full = cpl_filter_average_bpm_int_float; break; case CPL_TYPE_INT: filter_full = cpl_filter_average_bpm_int_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } else { /* Full kernel, no bad pixels */ switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_fast = cpl_filter_average_double_double; break; case CPL_TYPE_FLOAT: filter_fast = cpl_filter_average_double_float; break; case CPL_TYPE_INT: filter_fast = cpl_filter_average_double_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_FLOAT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_fast = cpl_filter_average_float_double; break; case CPL_TYPE_FLOAT: filter_fast = cpl_filter_average_float_float; break; case CPL_TYPE_INT: filter_fast = cpl_filter_average_float_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_INT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_fast = cpl_filter_average_int_double; break; case CPL_TYPE_FLOAT: filter_fast = cpl_filter_average_int_float; break; case CPL_TYPE_INT: filter_fast = cpl_filter_average_int_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } } else if (filter == CPL_FILTER_STDEV_FAST) { cpl_ensure_code(border == CPL_BORDER_FILTER, CPL_ERROR_UNSUPPORTED_MODE); if (badmap != NULL) { /* FIXME : Implement cpl_filter_stdev_bpm_* similarly to cpl_filter_average_bpm_* and replace cpl_filter_stdev_slow_* with it */ /* Full kernel, bad pixels */ switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_bpm = cpl_filter_stdev_slow_double_double; break; case CPL_TYPE_FLOAT: filter_bpm = cpl_filter_stdev_slow_double_float; break; case CPL_TYPE_INT: filter_bpm = cpl_filter_stdev_slow_double_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_FLOAT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_bpm = cpl_filter_stdev_slow_float_double; break; case CPL_TYPE_FLOAT: filter_bpm = cpl_filter_stdev_slow_float_float; break; case CPL_TYPE_INT: filter_bpm = cpl_filter_stdev_slow_float_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_INT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_bpm = cpl_filter_stdev_slow_int_double; break; case CPL_TYPE_FLOAT: filter_bpm = cpl_filter_stdev_slow_int_float; break; case CPL_TYPE_INT: filter_bpm = cpl_filter_stdev_slow_int_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } else { /* Full kernel, no bad pixels */ switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_fast = cpl_filter_stdev_double_double; break; case CPL_TYPE_FLOAT: filter_fast = cpl_filter_stdev_double_float; break; case CPL_TYPE_INT: filter_fast = cpl_filter_stdev_double_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_FLOAT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_fast = cpl_filter_stdev_float_double; break; case CPL_TYPE_FLOAT: filter_fast = cpl_filter_stdev_float_float; break; case CPL_TYPE_INT: filter_fast = cpl_filter_stdev_float_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_INT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_fast = cpl_filter_stdev_int_double; break; case CPL_TYPE_FLOAT: filter_fast = cpl_filter_stdev_int_float; break; case CPL_TYPE_INT: filter_fast = cpl_filter_stdev_int_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } } if (filter_fast != NULL) { filter_fast(cpl_image_get_data(self), cpl_image_get_data_const(other), nx, ny, hsizex, hsizey, (unsigned)border); } else if (filter_full != NULL) { filter_full(cpl_image_get_data(self), &pbpmself, cpl_image_get_data_const(other), badmap, nx, ny, hsizex, hsizey, border); } else if (filter_bpm != NULL) { if (filter_bpm(cpl_image_get_data(self), &pbpmself, cpl_image_get_data_const(other), badmap, pmask, nx, ny, hsizex, hsizey, border)) { return cpl_error_set_where_(); } } else { return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } if (self->bpm == NULL && pbpmself != NULL) { /* A new BPM was created for the output */ self->bpm = cpl_mask_wrap(nx, ny, pbpmself); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Filter an image using a floating-point kernel @param self Pre-allocated image to hold the filtered result @param other Image to filter @param kernel Pixel weigths @param filter CPL_FILTER_LINEAR, CPL_FILTER_MORPHO @param border CPL_BORDER_FILTER @return CPL_ERROR_NONE or the relevant CPL error code @see cpl_image_filter_mask The two images must have equal dimensions. The kernel must have an odd number of rows and an odd number of columns and at least one non-zero element. For scaling filters (@c CPL_FILTER_LINEAR_SCALE and @c CPL_FILTER_MORPHO_SCALE) the flux of the filtered image will be scaled with the sum of the weights of the kernel. If for a given input pixel location the kernel covers only bad pixels, the filtered pixel value is flagged as bad and set to zero. For flux-preserving filters (@c CPL_FILTER_LINEAR and @c CPL_FILTER_MORPHO) the filtered pixel must have at least one input pixel with a non-zero weight available. Output pixels where this is not the case are set to zero and flagged as bad. In-place filtering is not supported, but if the two images have the same pixel type, then the input pixel buffer may overlap all but the 1+H first rows of the output pixel buffer, where 1+2*H is the number of rows in the kernel. Supported filters: @c CPL_FILTER_LINEAR, @c CPL_FILTER_MORPHO, @c CPL_FILTER_LINEAR_SCALE, @c CPL_FILTER_MORPHO_SCALE. Supported borders modes: @c CPL_BORDER_FILTER @par Example: @code cpl_image_filter(filtered, raw, kernel, CPL_FILTER_LINEAR, CPL_BORDER_FILTER); @endcode Beware that the 1st pixel - at (1,1) - in an image is the lower left, while the 1st element in a matrix - at (0,0) - is the top left. Thus to shift an image 1 pixel up and 1 pixel right with the CPL_FILTER_LINEAR and a 3 by 3 kernel, one should set to 1.0 the bottom leftmost matrix element which is at row 3, column 1, i.e. @code cpl_matrix_set(kernel, 2, 0); @endcode Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL. - CPL_ERROR_ILLEGAL_INPUT if the kernel has a side of even length. - CPL_ERROR_DIVISION_BY_ZERO If the kernel is a zero-matrix. - CPL_ERROR_ACCESS_OUT_OF_RANGE If the kernel has a side longer than the input image. - CPL_ERROR_INVALID_TYPE if the passed image type is not supported. - CPL_ERROR_TYPE_MISMATCH if in median filtering the input and output pixel types differ. - CPL_ERROR_INCOMPATIBLE_INPUT If the input and output images have incompatible sizes. - CPL_ERROR_UNSUPPORTED_MODE If the output pixel buffer overlaps the input one (or the kernel), or the border/filter mode is unsupported. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_filter(cpl_image * self, const cpl_image * other, const cpl_matrix * kernel, cpl_filter_mode filter, cpl_border_mode border) { const cpl_size nsx = cpl_image_get_size_x(self); const cpl_size nsy = cpl_image_get_size_y(self); const cpl_size nx = cpl_image_get_size_x(other); const cpl_size ny = cpl_image_get_size_y(other); const cpl_size mx = cpl_matrix_get_ncol(kernel); const cpl_size my = cpl_matrix_get_nrow(kernel); const cpl_size hsizex = mx >> 1; const cpl_size hsizey = my >> 1; const double * pkernel = cpl_matrix_get_data_const(kernel); const void * pother = cpl_image_get_data_const(other); const void * pself = cpl_image_get_data_const(self); /* assert( sizeof(char) == 1 ) */ const void * polast = (const void*)((const char*)pother + (size_t)nx * (size_t)ny * cpl_type_get_sizeof (cpl_image_get_type(other))); const void * psrows = (const void*)((const char*)pself + (size_t)nsx * (size_t)(1+hsizey) * cpl_type_get_sizeof (cpl_image_get_type(self))); /* pkernel may not overlap pself at all */ const void * pmlast = (const void*)(pkernel + mx * my); const void * pslast = (const void*)((const char*)pself + (size_t)nsx * (size_t)nsy * cpl_type_get_sizeof (cpl_image_get_type(self))); cpl_binary * pbpmself; const cpl_binary * badmap; cpl_error_code (*filter_func)(void *, cpl_binary **, const void *, const cpl_binary *, const double *, cpl_size, cpl_size, cpl_boolean, cpl_size, cpl_size, cpl_border_mode); cpl_boolean same_type = cpl_image_get_type(self) == cpl_image_get_type(other); cpl_boolean dodiv = CPL_FALSE; cpl_size i; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(other != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(kernel != NULL, CPL_ERROR_NULL_INPUT); /* pself has to be above all of the other pixel buffer, or */ /* ...pother has to be above the first hsize+1 rows of pself */ /* ... unless they have different pixel types, in which case the two pixel buffers may not overlap at all */ cpl_ensure_code(pself >= polast || pother >= (same_type ? psrows : pslast), CPL_ERROR_UNSUPPORTED_MODE); /* If this check fails, the caller is doing something really weird... */ cpl_ensure_code((const void*)pkernel >= pslast || pself >= (const void*)pmlast, CPL_ERROR_UNSUPPORTED_MODE); /* Only odd-sized kernels allowed */ cpl_ensure_code((mx&1) == 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code((my&1) == 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(mx <= nx, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(my <= ny, CPL_ERROR_ACCESS_OUT_OF_RANGE); /* kernel may not be empty */ for (i=0 ; i < mx * my ; i++) { if (pkernel[i] != 0.0) break; } cpl_ensure_code(i < mx * my, CPL_ERROR_DIVISION_BY_ZERO); if (border == CPL_BORDER_CROP) { cpl_ensure_code(nsx == nx - 2 * hsizex, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(nsy == ny - 2 * hsizey, CPL_ERROR_INCOMPATIBLE_INPUT); } else { cpl_ensure_code(nsx == nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(nsy == ny, CPL_ERROR_INCOMPATIBLE_INPUT); } /* Get and reset all bad pixels, if any */ pbpmself = self->bpm != NULL ? memset(cpl_mask_get_data(self->bpm), CPL_BINARY_0, (size_t)nsx * (size_t)nsy) : NULL; badmap = other->bpm == NULL || cpl_mask_is_empty(other->bpm) ? NULL : cpl_mask_get_data_const(other->bpm); filter_func = NULL; if (filter == CPL_FILTER_LINEAR || filter == CPL_FILTER_LINEAR_SCALE) { cpl_ensure_code(border == CPL_BORDER_FILTER, CPL_ERROR_UNSUPPORTED_MODE); dodiv = filter == CPL_FILTER_LINEAR; switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_func = cpl_filter_linear_slow_double_double; break; case CPL_TYPE_FLOAT: filter_func = cpl_filter_linear_slow_double_float; break; case CPL_TYPE_INT: filter_func = cpl_filter_linear_slow_double_int; break; default: /* * Currently, it is an error in CPL to reach this point, as all * possible types for images (see cpl_image_new()) are supported. * * However, it could happen, if cpl_image_new() were extended to * support images of a new type and the new type were not supported * in this function. For that case, we keep setting the appropriate * error code in this default section. */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_FLOAT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_func = cpl_filter_linear_slow_float_double; break; case CPL_TYPE_FLOAT: filter_func = cpl_filter_linear_slow_float_float; break; case CPL_TYPE_INT: filter_func = cpl_filter_linear_slow_float_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_INT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_func = cpl_filter_linear_slow_int_double; break; case CPL_TYPE_FLOAT: filter_func = cpl_filter_linear_slow_int_float; break; case CPL_TYPE_INT: filter_func = cpl_filter_linear_slow_int_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } else if (filter == CPL_FILTER_MORPHO || filter == CPL_FILTER_MORPHO_SCALE) { cpl_ensure_code(border == CPL_BORDER_FILTER, CPL_ERROR_UNSUPPORTED_MODE); dodiv = filter == CPL_FILTER_MORPHO; switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_func = cpl_filter_morpho_slow_double_double; break; case CPL_TYPE_FLOAT: filter_func = cpl_filter_morpho_slow_double_float; break; case CPL_TYPE_INT: filter_func = cpl_filter_morpho_slow_double_int; break; default: /* * Currently, it is an error in CPL to reach this point, as all * possible types for images (see cpl_image_new()) are supported. * * However, it could happen, if cpl_image_new() were extended to * support images of a new type and the new type were not supported * in this function. For that case, we keep setting the appropriate * error code in this default section. */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_FLOAT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_func = cpl_filter_morpho_slow_float_double; break; case CPL_TYPE_FLOAT: filter_func = cpl_filter_morpho_slow_float_float; break; case CPL_TYPE_INT: filter_func = cpl_filter_morpho_slow_float_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_INT: { switch (cpl_image_get_type(other)) { case CPL_TYPE_DOUBLE: filter_func = cpl_filter_morpho_slow_int_double; break; case CPL_TYPE_FLOAT: filter_func = cpl_filter_morpho_slow_int_float; break; case CPL_TYPE_INT: filter_func = cpl_filter_morpho_slow_int_int; break; default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } default: /* See comment in previous switch() default: */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } } cpl_ensure_code(filter_func != NULL, CPL_ERROR_UNSUPPORTED_MODE); if (filter_func(cpl_image_get_data(self), &pbpmself, cpl_image_get_data_const(other), badmap, pkernel, nx, ny, dodiv, hsizex, hsizey, border)) { return cpl_error_set_where_(); } if (self->bpm == NULL && pbpmself != NULL) { /* A new BPM was created for the output */ self->bpm = cpl_mask_wrap(nx, ny, pbpmself); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Compute a linear filtering @param in The image to filter @param ker The kernel @return The filtered image or NULL on error @see cpl_image_filter() @deprecated Replace this call with cpl_image_filter() using CPL_FILTER_LINEAR and CPL_BORDER_FILTER. */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_filter_linear(const cpl_image * in, const cpl_matrix * ker) { cpl_image * self; cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_image_new(in->nx, in->ny, in->type); if (cpl_image_filter(self, in, ker, CPL_FILTER_LINEAR, CPL_BORDER_FILTER)) { cpl_image_delete(self); self = NULL; (void)cpl_error_set_where_(); } return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Filter an image in spatial domain with a morpho kernel. @param in Image to filter. @param ker Filter definition. @return 1 newly allocated image or NULL in error case. @see cpl_image_filter() @deprecated Replace this call with cpl_image_filter() using CPL_FILTER_MORPHO and CPL_BORDER_FILTER. */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_filter_morpho(const cpl_image * in, const cpl_matrix * ker) { cpl_image * self; cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_image_new(in->nx, in->ny, in->type); if (cpl_image_filter(self, in, ker, CPL_FILTER_MORPHO, CPL_BORDER_FILTER)) { cpl_image_delete(self); self = NULL; (void)cpl_error_set_where_(); } return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Apply a spatial median filter to an image @param in Image to filter. @param ker the kernel @return 1 newly allocated image or NULL in error case @see cpl_image_filter_mask @deprecated Replace this call with cpl_image_filter_mask() using CPL_FILTER_MEDIAN and CPL_BORDER_FILTER. */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_filter_median(const cpl_image * in, const cpl_matrix * ker) { cpl_image * self; cpl_mask * mask; cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, NULL); mask = cpl_mask_new_from_matrix(ker, 1.0, 1e-5); cpl_ensure(mask != NULL, cpl_error_get_code(), NULL); self = cpl_image_new(in->nx, in->ny, in->type); if (cpl_image_filter_mask(self, in, mask, CPL_FILTER_MEDIAN, CPL_BORDER_FILTER)) { cpl_image_delete(self); self = NULL; (void)cpl_error_set_where_(); } cpl_mask_delete(mask); return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Standard deviation filter @param in input image @param ker the kernel @return a newly allocated filtered image or NULL on error @see cpl_image_filter_mask @deprecated Replace this call with cpl_image_filter_mask() using CPL_FILTER_STDEV and CPL_BORDER_FILTER. */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_filter_stdev(const cpl_image * in, const cpl_matrix * ker) { cpl_image * self; cpl_mask * mask; cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, NULL); mask = cpl_mask_new_from_matrix(ker, 1.0, 1e-5); cpl_ensure(mask != NULL, cpl_error_get_code(), NULL); self = cpl_image_new(in->nx, in->ny, in->type); if (cpl_mask_get_size_x(mask) * cpl_mask_get_size_y(mask) > 1 && cpl_image_filter_mask(self, in, mask, CPL_FILTER_STDEV, CPL_BORDER_FILTER)) { cpl_image_delete(self); self = NULL; (void)cpl_error_set_where_(); } cpl_mask_delete(mask); return self; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Fill a mask from a matrix @param kernel The matrix @param value The value to interpret as CPL_BINARY_1 @param tol The tolerance on the value @return the mask on success, or NULL on error Example: matrix -> mask 1.0 0.0 1.0 0 0 0 0.0 0.0 0.0 0 0 0 0.0 0.0 0.0 1 0 1 Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ static cpl_mask * cpl_mask_new_from_matrix(const cpl_matrix * kernel, double value, double tol) { const cpl_size nx = cpl_matrix_get_ncol(kernel); const cpl_size ny = cpl_matrix_get_nrow(kernel); const cpl_size n = nx * ny; const double * data = cpl_matrix_get_data_const(kernel); cpl_mask * self; cpl_binary * pself; cpl_size i; cpl_ensure(kernel != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_mask_new(nx, ny); pself = cpl_mask_get_data(self); for (i=0; i < n; i++) { if (fabs(data[i] - value) < tol) pself[i] = CPL_BINARY_1; } return self; } cpl-6.4.1/cplcore/cpl_fits.c0000644000460300003120000002712512227451455012626 00000000000000/* $Id: cpl_fits.c,v 1.30 2013-10-16 08:49:49 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-10-16 08:49:49 $ * $Revision: 1.30 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_fits.h" #include "cpl_io_fits.h" #include "cpl_error_impl.h" #include "cpl_memory.h" #include "cpl_tools.h" #include #include /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_fits FITS related basic routines * * This module provides functions to get basic information on FITS files * * @par Synopsis: * @code * #include "cpl_fits.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Set the FITS I/O mode @param mode The FITS I/O mode: CPL_FITS_STOP_CACHING, CPL_FITS_START_CACHING, CPL_FITS_RESTART_CACHING @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_init() to control the FITS I/O mode when CPL is started Normally when a FITS file is processed with a CPL call the file is openened and closed during that call. However repeated calls on FITS data with many extensions causes the FITS headers to be parsed many times which can lead to a significant performance penalty. If instead this function is called with CPL_FITS_START_CACHING, CPL will use internal storage to keep the FITS files open between calls and only close them when the FITS I/O mode is changed (or cpl_end() is called). If a CPL function that creates a FITS file is called any previously opened handles to that file are closed. If a CPL function that appends to a FITS file is called any previously opened read-only handles to that file are closed. If a CPL function that reads from a FITS file is called any previously opened read/write-handle to that file is used for the read. Any additional concurrent reads causes the file to also be opened for reading. This means that there is also a performance gain when alternating between appending to and reading from the same file. This optimized I/O mode cannot be used if the CPL application accesses a FITS file without using CPL. An incomplete list of such access is: Calls to rename(), remove(), unlink(), fopen() and access via another process started with for example system() or popen(). The caching of opened FITS files may be used in a multi-threaded environment to the extent that the underlying FITS library (CFITSIO) supports it. One implication of this is that multiple threads may only call CPL FITS saving functions on the same file using proper synchronization such as the OpenMP 'ordered' construct. CPL makes no attempt to verify that a CPL based application performs thread parallel FITS I/O correctly. The mode CPL_FITS_STOP_CACHING causes all cached filed to be closed. Beware that this can cause an I/O error for a file that has otherwise not been accessed for some time. Since CPL_FITS_STOP_CACHING closes all cached FITS files, the caller must ensure that this does not interfere with the concurrent use of those same files in another thread. The mode CPL_FITS_RESTART_CACHING has the same effect as a call with CPL_FITS_STOP_CACHING followed by a call with CPL_FITS_START_CACHING. The modes CPL_FITS_RESTART_CACHING and CPL_FITS_ONE may be combined. This causes all files cached by the calling thread to be closed. The caching remains active (for all threads), so subsequently opened files will be cached. CPL_FITS_RESTART_CACHING can be used after an external modification of a FITS file also cached by CPL, thus allowing the caching to work together with the above mentioned external access to the same FITS files. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if the mode is zero - CPL_ERROR_UNSUPPORTED_MODE if the mode is not supported - CPL_ERROR_INVALID_TYPE if mode is 1, e.g. due to a logical or (||) of the allowed options. - CPL_ERROR_BAD_FILE_FORMAT if the I/O caused by CPL_FITS_STOP_CACHING failed */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_fits_set_mode(cpl_fits_mode mode) { if (mode == CPL_FITS_START_CACHING) { cpl_io_fits_init(); } else if (mode == CPL_FITS_STOP_CACHING) { if (cpl_io_fits_end()) return cpl_error_set_where_(); } else if ((mode & CPL_FITS_RESTART_CACHING) == CPL_FITS_RESTART_CACHING) { if (cpl_io_fits_close_tid((mode & CPL_FITS_ONE) ? CPL_IO_FITS_ONE : CPL_IO_FITS_ALL)) return cpl_error_set_where_(); } else if (mode == 0) { return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } else if (mode == 1) { return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } else { return cpl_error_set_message_(CPL_ERROR_UNSUPPORTED_MODE, "mode=%d", (int)mode); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Get the FITS I/O mode @return One of: CPL_FITS_STOP_CACHING, CPL_FITS_START_CACHING @see cpl_fits_set_mode() */ /*----------------------------------------------------------------------------*/ cpl_fits_mode cpl_fits_get_mode(void) { return cpl_io_fits_is_enabled() ? CPL_FITS_START_CACHING : CPL_FITS_STOP_CACHING; } /*----------------------------------------------------------------------------*/ /** @brief Get the number of extensions contained in a FITS file @param filename The file name @return The number of extensions or -1 in case of error @note For a valid fits file without extensions zero is returned Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if the input pointer is NULL - CPL_ERROR_FILE_IO If the FITS file could not be opened - CPL_ERROR_BAD_FILE_FORMAT if the input FITS file is otherwise invalid */ /*----------------------------------------------------------------------------*/ cpl_size cpl_fits_count_extensions(const char * filename) { fitsfile * fptr; int error = 0; int next = 0; /* CFITSIO supports only int */ cpl_ensure(filename != NULL, CPL_ERROR_NULL_INPUT, -1); if (cpl_io_fits_open_diskfile(&fptr, filename, READONLY, &error)) { (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_open_diskfile, "filename='%s'", filename); return -1; } if (fits_get_num_hdus(fptr, &next, &error)) { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, error, fits_get_num_hdus, "filename='%s'", filename); error = 0; /* Reset so fits_close_file works */ next = 0; } if (cpl_io_fits_close_file(fptr, &error)) { (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_close_file, "filename='%s'", filename); } /* The number of HDUs includes the primary one which is not an extension */ return (cpl_size)next - 1; } /*----------------------------------------------------------------------------*/ /** @brief Get the place of a given extension in a FITS file @param filename The file name @param extname The extension name @return The extension number, 0 if not found or -1 on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_FILE_IO if the file is not FITS */ /*----------------------------------------------------------------------------*/ cpl_size cpl_fits_find_extension(const char * filename, const char * extname) { fitsfile * fptr; int error = 0; cpl_size ext_num = 0; char c_extname[FLEN_VALUE] = ""; cpl_boolean has_card; cpl_ensure(filename != NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(extname != NULL, CPL_ERROR_NULL_INPUT, -1); if (cpl_io_fits_open_diskfile(&fptr, filename, READONLY, &error)) { (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_open_diskfile, "filename='%s', extname='%s'", filename, extname); return -1; } do { has_card = CPL_TRUE; if (!fits_movabs_hdu(fptr, 2 + ext_num, NULL, &error) && fits_read_key_str(fptr, "EXTNAME", c_extname, NULL, &error) == KEY_NO_EXIST) { /* EXTNAME card is absent, that is allowed */ has_card = CPL_FALSE; error = 0; /* Reset so subsequent calls work */ } if (!error) { ext_num++; } } while (!error && (!has_card || strncmp(extname, c_extname, FLEN_VALUE))); if (error) { ext_num = error == END_OF_FILE ? 0 : -1; error = 0; /* Reset so fits_close_file works */ } if (cpl_io_fits_close_file(fptr, &error)) { (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_close_file, "filename='%s', extname='%s'", filename, extname); ext_num = -1; } return ext_num; } /*----------------------------------------------------------------------------*/ /** @brief Get the number of extensions contained in a FITS file @param filename The file name @return the number of extensions or -1 in case of error @see cpl_fits_count_extensions() @deprecated Replace this call with cpl_fits_count_extensions(). */ /*----------------------------------------------------------------------------*/ int cpl_fits_get_nb_extensions(const char * filename) { return (int)cpl_fits_count_extensions(filename); } /*----------------------------------------------------------------------------*/ /** @brief Get the place of a given extension in a FITS file @param filename The file name @param extname The extension name @return the extension place or -1 in case of error @see cpl_fits_find_extension @deprecated Replace this call with cpl_fits_find_extension(). */ /*----------------------------------------------------------------------------*/ int cpl_fits_get_extension_nb(const char * filename, const char * extname) { return (int)cpl_fits_find_extension(filename, extname); } /**@}*/ cpl-6.4.1/cplcore/cpl_cfitsio.h0000644000460300003120000000633012242367127013320 00000000000000/* $Id: cpl_cfitsio.h,v 1.15 2012-05-11 13:26:27 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2013 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-05-11 13:26:27 $ * $Revision: 1.15 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_CFITSIO_H #define CPL_CFITSIO_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_macros.h" #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ int cpl_fits_read_subset(fitsfile *fptr, int datatype, const long *blc, const long *trc, const long *inc, const void *nulval, void *array, int *anynul, int *status) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1,3,4,5,7,9))) #endif CPL_INTERNAL; int cpl_fits_write_pix(fitsfile *fptr, int datatype, const long *firstpix, LONGLONG nelem, const void *array, int *status) CPL_ATTR_NONNULL CPL_INTERNAL; #ifdef fits_write_pixll int cpl_fits_write_pixll(fitsfile *fptr, int datatype, const LONGLONG *firstpix, LONGLONG nelem, const void *array, int *status) CPL_ATTR_NONNULL CPL_INTERNAL; #endif int cpl_fits_create_img(fitsfile *fptr, int bitpix, int naxis, const long *naxes, int *status) CPL_ATTR_NONNULL CPL_INTERNAL; #ifdef fits_create_imgll int cpl_fits_create_imgll(fitsfile *fptr, int bitpix, int naxis, const LONGLONG *naxes, int *status) CPL_ATTR_NONNULL CPL_INTERNAL; #endif int cpl_fits_read_pix(fitsfile *fptr, int datatype, const long *firstpix, LONGLONG nelem, const void *nulval, void *array, int *anynul, int *status) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1,3,6,8))) #endif CPL_INTERNAL; #ifdef fits_read_pixll int cpl_fits_read_pixll(fitsfile *fptr, int datatype, const LONGLONG *firstpix, LONGLONG nelem, const void *nulval, void *array, int *anynul, int *status) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1,3,6,8))) #endif CPL_INTERNAL; #endif CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_image_basic.c0000644000460300003120000043601312272176370014104 00000000000000/* $Id: cpl_image_basic.c,v 1.208 2013-07-24 09:45:53 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-07-24 09:45:53 $ * $Revision: 1.208 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image_basic_impl.h" #include "cpl_image_io_impl.h" #include "cpl_memory.h" #include "cpl_vector.h" #include "cpl_image_stats.h" #include "cpl_stats.h" #include "cpl_image_bpm.h" #include "cpl_image_iqe.h" #include "cpl_mask_impl.h" #include "cpl_tools.h" #include "cpl_errorstate.h" #include "cpl_error_impl.h" #include "cpl_math_const.h" #include "cpl_image_defs.h" #include #include #include #include #include #include #include #include /* for SIZE_MAX, intptr_t */ #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define CPL_IMAGE_BASIC_ASSIGN 1 #define CPL_IMAGE_BASIC_ASSIGN_LOCAL 2 #define CPL_IMAGE_BASIC_THRESHOLD 3 #define CPL_IMAGE_BASIC_ABS 4 #define CPL_IMAGE_BASIC_AVERAGE 5 #define CPL_IMAGE_BASIC_SUBMIN 6 #define CPL_IMAGE_BASIC_EXTRACT 7 #define CPL_IMAGE_BASIC_EXTRACTROW 8 #define CPL_IMAGE_BASIC_EXTRACTCOL 9 #define CPL_IMAGE_BASIC_COLLAPSE_MEDIAN 11 #define CPL_IMAGE_BASIC_ROTATE_INT_LOCAL 12 #define CPL_IMAGE_BASIC_FLIP_LOCAL 15 #define CPL_IMAGE_BASIC_MOVE_PIXELS 16 #define CPL_IMAGE_BASIC_OP_SCALAR 21 #define CPL_IMAGE_BASIC_SQRT 22 #define CPL_IMAGE_BASIC_DECLARE 23 #define CPL_IMAGE_BASIC_OPERATE 24 #define CPL_IMAGE_BASIC_DIVIDE 25 #define CPL_IMAGE_BASIC_OPERATE_LOCAL 26 #define CPL_IMAGE_BASIC_DIVIDE_LOCAL 27 #define CPL_IMAGE_BASIC_HYPOT 28 #define CPL_IMAGE_ADDITION(a,b,c) a = (b) + (c) #define CPL_IMAGE_ADDITIONASSIGN(a,b) a += (b) #define CPL_IMAGE_SUBTRACTION(a,b,c) a = (b) - (c) #define CPL_IMAGE_SUBTRACTIONASSIGN(a,b) a -= (b) #define CPL_IMAGE_MULTIPLICATION(a,b,c) a = (b) * (c) #define CPL_IMAGE_MULTIPLICATIONASSIGN(a,b) a *= (b) #define CPL_IMAGE_DIVISION(a,b,c) a = (b) / (c) #define CPL_IMAGE_DIVISIONASSIGN(a,b) a /= (b) #define CPL_IMAGE_MINABS(a,b,c) a = CPL_MATH_ABS1(b) < CPL_MATH_ABS2(c) ? (b) : (c) /*----------------------------------------------------------------------------- Private Function prototypes -----------------------------------------------------------------------------*/ static double cpl_vector_get_noise(const cpl_vector *, cpl_size); static double cpl_vector_get_fwhm(const cpl_vector *, cpl_size, double); static cpl_error_code cpl_fft(double *, double *, const unsigned *, int, int); /* Declare and define the 8 hypot functions */ #define CPL_OPERATION CPL_IMAGE_BASIC_HYPOT #define CPL_TYPE_T1 CPL_TYPE_FLOAT #define CPL_TYPE1 float #define CPL_TYPE_T2 CPL_TYPE_FLOAT #define CPL_TYPE_T3 CPL_TYPE_FLOAT #define CPL_TYPE2 float #define CPL_TYPE3 float #define CPL_HYPOT hypotf #include "cpl_image_basic_body.h" #undef CPL_TYPE_T2 #undef CPL_TYPE_T3 #undef CPL_TYPE2 #undef CPL_TYPE3 #undef CPL_HYPOT #define CPL_TYPE_T2 CPL_TYPE_FLOAT #define CPL_TYPE_T3 CPL_TYPE_DOUBLE #define CPL_TYPE2 float #define CPL_TYPE3 double #define CPL_HYPOT hypot #include "cpl_image_basic_body.h" #undef CPL_TYPE_T2 #undef CPL_TYPE_T3 #undef CPL_TYPE2 #undef CPL_TYPE3 #define CPL_TYPE_T2 CPL_TYPE_DOUBLE #define CPL_TYPE_T3 CPL_TYPE_FLOAT #define CPL_TYPE2 double #define CPL_TYPE3 float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T2 #undef CPL_TYPE_T3 #undef CPL_TYPE2 #undef CPL_TYPE3 #define CPL_TYPE_T2 CPL_TYPE_DOUBLE #define CPL_TYPE_T3 CPL_TYPE_DOUBLE #define CPL_TYPE2 double #define CPL_TYPE3 double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T2 #undef CPL_TYPE_T3 #undef CPL_TYPE2 #undef CPL_TYPE3 #undef CPL_TYPE_T1 #undef CPL_TYPE1 #define CPL_TYPE_T1 CPL_TYPE_DOUBLE #define CPL_TYPE1 double #undef CPL_HYPOT #define CPL_TYPE_T2 CPL_TYPE_FLOAT #define CPL_TYPE_T3 CPL_TYPE_FLOAT #define CPL_TYPE2 float #define CPL_TYPE3 float #define CPL_HYPOT hypotf #include "cpl_image_basic_body.h" #undef CPL_TYPE_T2 #undef CPL_TYPE_T3 #undef CPL_TYPE2 #undef CPL_TYPE3 #undef CPL_HYPOT #define CPL_TYPE_T2 CPL_TYPE_FLOAT #define CPL_TYPE_T3 CPL_TYPE_DOUBLE #define CPL_TYPE2 float #define CPL_TYPE3 double #define CPL_HYPOT hypot #include "cpl_image_basic_body.h" #undef CPL_TYPE_T2 #undef CPL_TYPE_T3 #undef CPL_TYPE2 #undef CPL_TYPE3 #define CPL_TYPE_T2 CPL_TYPE_DOUBLE #define CPL_TYPE_T3 CPL_TYPE_FLOAT #define CPL_TYPE2 double #define CPL_TYPE3 float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T2 #undef CPL_TYPE_T3 #undef CPL_TYPE2 #undef CPL_TYPE3 #define CPL_TYPE_T2 CPL_TYPE_DOUBLE #define CPL_TYPE_T3 CPL_TYPE_DOUBLE #define CPL_TYPE2 double #define CPL_TYPE3 double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T2 #undef CPL_TYPE_T3 #undef CPL_TYPE2 #undef CPL_TYPE3 #undef CPL_TYPE_T1 #undef CPL_TYPE1 #undef CPL_HYPOT #undef CPL_OPERATION /* Declare and define the C-type dependent functions */ #define CPL_OPERATION CPL_IMAGE_BASIC_DECLARE #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS #undef CPL_OPERATION #ifdef __SSE3__ #include #endif #ifdef __SSE2__ #include #endif #if defined __SSE2__ || defined __SSE3__ #if defined __SSE3__ #define CPL_MM_ADDSUB_PS(a, b) _mm_addsub_ps(a, b) #define CPL_MM_ADDSUB_PD(a, b) _mm_addsub_pd(a, b) #else /* faster than multiplying with 1,-1,1,-1 */ #define CPL_MM_ADDSUB_PS(a, b) \ _mm_add_ps(a, _mm_xor_ps(b, (__m128)_mm_set_epi32(0x0u, 0x80000000u, \ 0x0u, 0x80000000u))) #define CPL_MM_ADDSUB_PD(a, b) \ _mm_add_pd(a, _mm_xor_pd(b, (__m128d)_mm_set_epi64((__m64)0x0llu, \ (__m64)0x8000000000000000llu))) #endif static cpl_error_code cpl_image_multiply_fcomplex_sse_(cpl_image *, const cpl_image *) CPL_ATTR_NONNULL; static cpl_error_code cpl_image_multiply_dcomplex_sse_(cpl_image *, const cpl_image *) CPL_ATTR_NONNULL; #endif /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ #define CPL_OPERATION CPL_IMAGE_BASIC_ASSIGN /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Add two images. @param image1 first operand @param image2 second operand @return 1 newly allocated image or NULL on error Creates a new image, being the result of the operation, and returns it to the caller. The returned image must be deallocated using cpl_image_delete(). The function supports images with different types among CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. The returned image type is the one of the first passed image. The bad pixels map of the result is the union of the bad pixels maps of the input images. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the input images have different sizes - CPL_ERROR_TYPE_MISMATCH if the second input image has complex type while the first one does not */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_add_create( const cpl_image * image1, const cpl_image * image2) { #define CPL_OPERATOR CPL_IMAGE_ADDITION #include "cpl_image_basic_body.h" #undef CPL_OPERATOR } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Subtract two images. @param image1 first operand @param image2 second operand @return 1 newly allocated image or NULL on error @see cpl_image_add_create() */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_subtract_create( const cpl_image * image1, const cpl_image * image2) { #define CPL_OPERATOR CPL_IMAGE_SUBTRACTION #include "cpl_image_basic_body.h" #undef CPL_OPERATOR } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Multiply two images. @param image1 first operand @param image2 second operand @return 1 newly allocated image or NULL on error @see cpl_image_add_create() */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_multiply_create( const cpl_image * image1, const cpl_image * image2) { #define CPL_OPERATOR CPL_IMAGE_MULTIPLICATION #include "cpl_image_basic_body.h" #undef CPL_OPERATOR } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Create the minimum of two images. @param image1 first operand @param image2 second operand @return 1 newly allocated image or NULL on error @see cpl_image_add_create() @note For each pixel position the new value is the one with the absolute minimum */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_min_create( const cpl_image * image1, const cpl_image * image2) { #define CPL_OPERATOR CPL_IMAGE_MINABS #include "cpl_image_basic_body.h" #undef CPL_OPERATOR } #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Divide two images. @param image1 first operand @param image2 second operand @return 1 newly allocated image or NULL on error @see cpl_image_add_create() @see cpl_image_divide() The result of division with a zero-valued pixel is marked as a bad pixel. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the input images have different sizes - CPL_ERROR_TYPE_MISMATCH if the second input image has complex type while the first one does not - CPL_ERROR_DIVISION_BY_ZERO is all pixels in the divisor are zero */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_divide_create(const cpl_image * image1, const cpl_image * image2) { #define CPL_OPERATION CPL_IMAGE_BASIC_DIVIDE cpl_image * self; cpl_mask * zeros; cpl_binary * pzeros; cpl_size nzero = 0; cpl_ensure(image1 != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(image2 != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(image1->nx == image2->nx, CPL_ERROR_INCOMPATIBLE_INPUT, NULL); cpl_ensure(image1->ny == image2->ny, CPL_ERROR_INCOMPATIBLE_INPUT, NULL); /* Create the map of zero-divisors */ zeros = cpl_mask_new(image2->nx, image2->ny); pzeros = cpl_mask_get_data(zeros); /* Switch on the first passed image type */ switch (image1->type) { case CPL_TYPE_INT: { const int * p1 = (const int *)image1->pixels; int * pout = (int *)cpl_malloc(image1->nx * image1->ny * sizeof(*pout)); /* Switch on the second passed image type */ switch (image2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: cpl_free(pout); (void)cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); pout = NULL; } self = pout ? cpl_image_wrap_int(image1->nx, image1->ny, pout) : NULL; break; } case CPL_TYPE_FLOAT: { const float * p1 = (const float *)image1->pixels; float * pout = (float *)cpl_malloc(image1->nx * image1->ny * sizeof(*pout)); /* Switch on the second passed image type */ switch (image2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: cpl_free(pout); (void)cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); pout = NULL; } self = pout ? cpl_image_wrap_float(image1->nx, image1->ny, pout) : NULL; break; } case CPL_TYPE_DOUBLE: { const double * p1 = (const double *)image1->pixels; double * pout = (double *)cpl_malloc(image1->nx * image1->ny * sizeof(*pout)); /* Switch on the second passed image type */ switch (image2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: cpl_free(pout); (void)cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); pout = NULL; } self = pout ? cpl_image_wrap_double(image1->nx, image1->ny, pout) : NULL; break; } case CPL_TYPE_FLOAT_COMPLEX: { const float complex * p1 = (const float complex *)image1->pixels; float complex * pout = (float complex *)cpl_malloc(image1->nx * image1->ny * sizeof(*pout)); /* Switch on the second passed image type */ switch (image2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT_COMPLEX #define CPL_TYPE float complex #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE_COMPLEX #define CPL_TYPE double complex #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: cpl_free(pout); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); pout = NULL; } self = pout ? cpl_image_wrap_float_complex(image1->nx, image1->ny, pout) : NULL; break; } case CPL_TYPE_DOUBLE_COMPLEX: { const double complex * p1 = (const double complex *)image1->pixels; double complex * pout = (double complex *)cpl_malloc(image1->nx * image1->ny * sizeof(*pout)); /* Switch on the second passed image type */ switch (image2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT_COMPLEX #define CPL_TYPE float complex #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE_COMPLEX #define CPL_TYPE double complex #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: cpl_free(pout); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); pout = NULL; } self = pout ? cpl_image_wrap_double_complex(image1->nx, image1->ny, pout) : NULL; break; } default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); self = NULL; } if (nzero == image1->nx * image1->ny) { cpl_image_delete(self); (void)cpl_error_set_(CPL_ERROR_DIVISION_BY_ZERO); self = NULL; } if (self == NULL) { cpl_mask_delete(zeros); } else { /* Handle bad pixels map */ if (image1->bpm == NULL && image2->bpm == NULL) { self->bpm = NULL; } else if (image1->bpm == NULL) { self->bpm = cpl_mask_duplicate(image2->bpm); } else if (image2->bpm == NULL) { self->bpm = cpl_mask_duplicate(image1->bpm); } else { self->bpm = cpl_mask_duplicate(image1->bpm); cpl_mask_or(self->bpm, image2->bpm); } /* Handle division by zero in the BPM */ if (nzero != 0) { if (self->bpm == NULL) { self->bpm = zeros; } else { cpl_mask_or(self->bpm, zeros); cpl_mask_delete(zeros); } } else { cpl_mask_delete(zeros); } if (image1->type != CPL_TYPE_INT && image2->type != CPL_TYPE_INT) { cpl_tools_add_flops( image1->nx * image1->ny - nzero); } } return self; #undef CPL_OPERATION } #define CPL_OPERATION CPL_IMAGE_BASIC_ASSIGN_LOCAL /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Add two images, store the result in the first image. @param im1 first operand. @param im2 second operand. @return the #_cpl_error_code_ or CPL_ERROR_NONE The first input image is modified to contain the result of the operation. The bad pixel map of the first image becomes the union of the bad pixel maps of the input images. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the input images have different sizes - CPL_ERROR_TYPE_MISMATCH if the second input image has complex type while the first one does not */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_add( cpl_image * im1, const cpl_image * im2) { #define CPL_OPERATOR CPL_IMAGE_ADDITIONASSIGN #include "cpl_image_basic_body.h" #undef CPL_OPERATOR } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Subtract two images, store the result in the first image. @param im1 first operand. @param im2 second operand. @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_add() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_subtract( cpl_image * im1, const cpl_image * im2) { #define CPL_OPERATOR CPL_IMAGE_SUBTRACTIONASSIGN #include "cpl_image_basic_body.h" #undef CPL_OPERATOR } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Multiply two images, store the result in the first image. @param im1 first operand. @param im2 second operand. @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_add() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_multiply( cpl_image * im1, const cpl_image * im2) { /* Faster version of code generated with gcc -ffast-math */ /* (NaNs and other float specials are no longer IEEE compliant) */ #if (defined __SSE3__ || defined __SSE2__) cpl_ensure_code(im1 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(im2 != NULL, CPL_ERROR_NULL_INPUT); if (im1->type == CPL_TYPE_FLOAT_COMPLEX && im2->type == CPL_TYPE_FLOAT_COMPLEX) { cpl_ensure_code(im1->nx == im2->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(im1->ny == im2->ny, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_image_multiply_fcomplex_sse_(im1, im2); return CPL_ERROR_NONE; } else if (im1->type == CPL_TYPE_DOUBLE_COMPLEX && im2->type == CPL_TYPE_DOUBLE_COMPLEX) { cpl_ensure_code(im1->nx == im2->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(im1->ny == im2->ny, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_image_multiply_dcomplex_sse_(im1, im2); return CPL_ERROR_NONE; } else #endif { #define CPL_OPERATOR CPL_IMAGE_MULTIPLICATIONASSIGN #include "cpl_image_basic_body.h" #undef CPL_OPERATOR } } #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Divide two images, store the result in the first image. @param im1 first operand. @param im2 second operand. @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_add() @note The result of division with a zero-valued pixel is marked as a bad pixel. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the input images have different sizes - CPL_ERROR_TYPE_MISMATCH if the second input image has complex type while the first one does not - CPL_ERROR_DIVISION_BY_ZERO is all pixels in the divisor are zero */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_divide(cpl_image * im1, const cpl_image * im2) { #define CPL_OPERATION CPL_IMAGE_BASIC_DIVIDE_LOCAL cpl_mask * zeros; cpl_binary * pzeros; cpl_size nzero = 0; cpl_ensure_code(im1 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(im2 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(im1->nx == im2->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(im1->ny == im2->ny, CPL_ERROR_INCOMPATIBLE_INPUT); assert( im1->pixels ); assert( im2->pixels ); /* Create the zeros map */ /* Do not modify im1->bpm now, in case of failure below */ if (im1->bpm != NULL) { zeros = im1->bpm; } else if (im2->bpm != NULL) { zeros = cpl_mask_duplicate(im2->bpm); } else { zeros = cpl_mask_new(im1->nx, im1->ny); } pzeros = cpl_mask_get_data(zeros); /* Switch on the first passed image type */ switch (im1->type) { case CPL_TYPE_INT: { int * p1 = (int *)im1->pixels; /* Switch on the second passed image type */ switch (im2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: if (zeros != im1->bpm) cpl_mask_delete(zeros); return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } break; } case CPL_TYPE_FLOAT: { float * p1 = (float *)im1->pixels; /* Switch on the second passed image type */ switch (im2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: if (zeros != im1->bpm) cpl_mask_delete(zeros); return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } break; } case CPL_TYPE_DOUBLE: { double * p1 = (double *)im1->pixels; /* Switch on the second passed image type */ switch (im2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: if (zeros != im1->bpm) cpl_mask_delete(zeros); return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex * p1 = (float complex *)im1->pixels; /* Switch on the second passed image type */ switch (im2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT_COMPLEX #define CPL_TYPE float complex #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE_COMPLEX #define CPL_TYPE double complex #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: if (zeros != im1->bpm) cpl_mask_delete(zeros); return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex * p1 = (double complex *)im1->pixels; /* Switch on the second passed image type */ switch (im2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT_COMPLEX #define CPL_TYPE float complex #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE_COMPLEX #define CPL_TYPE double complex #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: if (zeros != im1->bpm) cpl_mask_delete(zeros); return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } break; } default: if (zeros != im1->bpm) cpl_mask_delete(zeros); return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } if (nzero == im1->nx * im1->ny) { if (zeros != im1->bpm) cpl_mask_delete(zeros); return cpl_error_set_(CPL_ERROR_DIVISION_BY_ZERO); } if (im1->type != CPL_TYPE_INT && im2->type != CPL_TYPE_INT) { cpl_tools_add_flops( im1->nx * im1->ny - nzero); } /* Handle bad pixels map */ if (im1->bpm != NULL && im2->bpm != NULL && im1->bpm != im2->bpm) { /* assert( im1->bpm == zeros ); */ cpl_mask_or(im1->bpm, im2->bpm); } else if (im1->bpm != zeros) { /* assert( im1->bpm == NULL ); assert( zeros != NULL ); */ if (im2->bpm != NULL || nzero > 0) { im1->bpm = zeros; } else { cpl_mask_delete(zeros); } } return CPL_ERROR_NONE; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_BASIC_OP_SCALAR #define CPL_OPERATOR CPL_IMAGE_ADDITIONASSIGN /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Elementwise addition of a scalar to an image @param self Image to be modified in place. @param scalar Number to add @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error Modifies the image by adding a number to each of its pixels. The operation is always performed in double precision, with a final cast of the result to the image pixel type. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_add_scalar(cpl_image * self, double scalar) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); /* Switch on image type */ switch (cpl_image_get_type(self)) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_DOUBLE_COMPLEX #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT_COMPLEX #include "cpl_image_basic_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } #undef CPL_OPERATOR #define CPL_OPERATOR CPL_IMAGE_SUBTRACTIONASSIGN /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Elementwise subtraction of a scalar from an image @param self Image to be modified in place. @param scalar Number to subtract @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @see cpl_image_add_scalar() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_subtract_scalar(cpl_image * self, double scalar) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); /* Switch on image type */ switch (cpl_image_get_type(self)) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_DOUBLE_COMPLEX #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT_COMPLEX #include "cpl_image_basic_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } #undef CPL_OPERATOR #define CPL_OPERATOR CPL_IMAGE_MULTIPLICATIONASSIGN /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Elementwise multiplication of an image with a scalar @param self Image to be modified in place. @param scalar Number to multiply with @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @see cpl_image_add_scalar() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_multiply_scalar(cpl_image * self, double scalar) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); /* Switch on image type */ switch (cpl_image_get_type(self)) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_DOUBLE_COMPLEX #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT_COMPLEX #include "cpl_image_basic_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } #undef CPL_OPERATOR #define CPL_OPERATOR CPL_IMAGE_DIVISIONASSIGN /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Elementwise division of an image with a scalar @param self Image to be modified in place. @param scalar Non-zero number to divide with @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @see cpl_image_add_scalar() Modifies the image by dividing each of its pixels with a number. If the scalar is zero the image is not modified and an error is returned. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_DIVISION_BY_ZERO a division by 0 occurs */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_divide_scalar(cpl_image * self, double scalar) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(scalar != 0.0, CPL_ERROR_DIVISION_BY_ZERO); /* Switch on image type */ switch (cpl_image_get_type(self)) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_DOUBLE_COMPLEX #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT_COMPLEX #include "cpl_image_basic_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } #undef CPL_OPERATOR #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Compute the elementwise logarithm of the image. @param self Image to be modified in place. @param base Base of the logarithm. @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error Modifies the image by computing the base-scalar logarithm of each of its pixels. Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. Pixels for which the logarithm is not defined are rejected and set to zero. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is not supported - CPL_ERROR_ILLEGAL_INPUT if base is non-positive - CPL_ERROR_DIVISION_BY_ZERO if the base equals 1 */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_logarithm(cpl_image * self, double base) { cpl_error_code error; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); /* Switch on image type */ switch (cpl_image_get_type(self)) { case CPL_TYPE_INT: error = cpl_image_logarithm_int(self, base); break; case CPL_TYPE_FLOAT: error = cpl_image_logarithm_float(self, base); break; case CPL_TYPE_DOUBLE: error = cpl_image_logarithm_double(self, base); break; default: return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "type='%s'. " "base=%g", cpl_type_get_name (cpl_image_get_type(self)), base); } return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Compute the elementwise exponential of the image. @param self Image to be modified in place. @param base Base of the exponential. @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error Modifies the image by computing the base-scalar exponential of each of its pixels. Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. Pixels for which the power of the given base is not defined are rejected and set to zero. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_exponential(cpl_image * self, double base) { cpl_error_code error; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); /* Switch on image type */ switch (cpl_image_get_type(self)) { case CPL_TYPE_INT: error = cpl_image_exponential_int(self, base); break; case CPL_TYPE_FLOAT: error = cpl_image_exponential_float(self, base); break; case CPL_TYPE_DOUBLE: error = cpl_image_exponential_double(self, base); break; default: return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "type='%s'. " "base=%g", cpl_type_get_name (cpl_image_get_type(self)), base); } return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Compute the elementwise power of the image. @param self Image to be modified in place. @param exponent Scalar exponent. @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error Modifies the image by lifting each of its pixels to exponent. Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. Pixels for which the power to the given exponent is not defined are rejected and set to zero. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_power(cpl_image * self, double exponent) { cpl_error_code error; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); /* Switch on image type */ switch (cpl_image_get_type(self)) { case CPL_TYPE_INT: error = cpl_image_power_int(self, exponent); break; case CPL_TYPE_FLOAT: error = cpl_image_power_float(self, exponent); break; case CPL_TYPE_DOUBLE: error = cpl_image_power_double(self, exponent); break; default: return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "type='%s'. " "exponent=%g", cpl_type_get_name (cpl_image_get_type(self)), exponent); } return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief The bit-wise and of two images with integer pixels @param self Pre-allocated image to hold the result @param first First operand, or NULL for an in-place operation @param second Second operand @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @note CPL_TYPE_INT is required @see cpl_mask_and() for the equivalent logical operation Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes - CPL_ERROR_INVALID_TYPE if the passed image type is as required */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_and(cpl_image * self, const cpl_image * first, const cpl_image * second) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(second != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(self->nx == second->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == second->ny, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_image_get_type(self) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "self-type='%s', not int", cpl_type_get_name (cpl_image_get_type(self))); } if (first != NULL) { cpl_ensure_code(self->nx == first->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == first->ny, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_image_get_type(first) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "first-type='%s', not int", cpl_type_get_name (cpl_image_get_type(first))); } } if (cpl_image_get_type(second) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "second-type='%s', not int", cpl_type_get_name (cpl_image_get_type(second))); } /* Cannot fail now */ /* Update the output bad pixel map */ cpl_image_or_mask(self, first, second); cpl_mask_and_((cpl_binary*)self->pixels, first ? (const cpl_binary*)first->pixels : NULL, (const cpl_binary*)second->pixels, cpl_type_get_sizeof(CPL_TYPE_INT) *(size_t)(self->nx * self->ny)); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief The bit-wise or of two images with integer pixels @param self Pre-allocated image to hold the result @param first First operand, or NULL for an in-place operation @param second Second operand @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @note CPL_TYPE_INT is required @see cpl_mask_or() for the equivalent logical operation Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes - CPL_ERROR_INVALID_TYPE if the passed image type is as required */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_or(cpl_image * self, const cpl_image * first, const cpl_image * second) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(second != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(self->nx == second->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == second->ny, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_image_get_type(self) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "self-type='%s', not int", cpl_type_get_name (cpl_image_get_type(self))); } if (first != NULL) { cpl_ensure_code(self->nx == first->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == first->ny, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_image_get_type(first) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "first-type='%s', not int", cpl_type_get_name (cpl_image_get_type(first))); } } if (cpl_image_get_type(second) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "second-type='%s', not int", cpl_type_get_name (cpl_image_get_type(second))); } /* Cannot fail now */ /* Update the output bad pixel map */ cpl_image_or_mask(self, first, second); cpl_mask_or_((cpl_binary*)self->pixels, first ? (const cpl_binary*)first->pixels : NULL, (const cpl_binary*)second->pixels, cpl_type_get_sizeof(CPL_TYPE_INT) *(size_t)(self->nx * self->ny)); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief The bit-wise xor of two images with integer pixels @param self Pre-allocated image to hold the result @param first First operand, or NULL for an in-place operation @param second Second operand @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @note CPL_TYPE_INT is required @see cpl_mask_xor() for the equivalent logical operation Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes - CPL_ERROR_INVALID_TYPE if the passed image type is as required */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_xor(cpl_image * self, const cpl_image * first, const cpl_image * second) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(second != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(self->nx == second->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == second->ny, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_image_get_type(self) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "self-type='%s', not int", cpl_type_get_name (cpl_image_get_type(self))); } if (first != NULL) { cpl_ensure_code(self->nx == first->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == first->ny, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_image_get_type(first) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "first-type='%s', not int", cpl_type_get_name (cpl_image_get_type(first))); } } if (cpl_image_get_type(second) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "second-type='%s', not int", cpl_type_get_name (cpl_image_get_type(second))); } /* Cannot fail now */ /* Update the output bad pixel map */ cpl_image_or_mask(self, first, second); cpl_mask_xor_((cpl_binary*)self->pixels, first ? (const cpl_binary*)first->pixels : NULL, (const cpl_binary*)second->pixels, cpl_type_get_sizeof(CPL_TYPE_INT) *(size_t)(self->nx * self->ny)); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief The bit-wise complement (not) of an image with integer pixels @param self Pre-allocated image to hold the result @param first First operand, or NULL for an in-place operation @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @note CPL_TYPE_INT is required @see cpl_mask_not() for the equivalent logical operation Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes - CPL_ERROR_INVALID_TYPE if the passed image type is as required */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_not(cpl_image * self, const cpl_image * first) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); if (cpl_image_get_type(self) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "self-type='%s', not int", cpl_type_get_name (cpl_image_get_type(self))); } if (first != NULL) { cpl_ensure_code(self->nx == first->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == first->ny, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_image_get_type(first) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "first-type='%s', not int", cpl_type_get_name (cpl_image_get_type(first))); } } /* Cannot fail now */ /* Update the output bad pixel map */ cpl_image_or_mask_unary(self, first); cpl_mask_xor_scalar((cpl_binary*)self->pixels, first ? (const cpl_binary*)first->pixels : NULL, (cpl_bitmask)-1, cpl_type_get_sizeof(CPL_TYPE_INT) *(size_t)(self->nx * self->ny)); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief The bit-wise and of a scalar and an image with integer pixels @param self Pre-allocated image to hold the result @param first First operand, or NULL for an in-place operation @param second Second operand (scalar) @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @note CPL_TYPE_INT is required Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes - CPL_ERROR_INVALID_TYPE if the passed image type is as required */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_and_scalar(cpl_image * self, const cpl_image * first, cpl_bitmask second) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); if (cpl_image_get_type(self) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "self-type='%s', not int", cpl_type_get_name (cpl_image_get_type(self))); } if (first != NULL) { cpl_ensure_code(self->nx == first->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == first->ny, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_image_get_type(first) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "first-type='%s', not int", cpl_type_get_name (cpl_image_get_type(first))); } } /* Cannot fail now */ /* Update the output bad pixel map */ cpl_image_or_mask_unary(self, first); cpl_mask_and_scalar((cpl_binary*)self->pixels, first ? (const cpl_binary*)first->pixels : NULL, (second & (uint32_t)-1) | (second << 32), cpl_type_get_sizeof(CPL_TYPE_INT) *(size_t)(self->nx * self->ny)); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief The bit-wise or of a scalar and an image with integer pixels @param self Pre-allocated image to hold the result @param first First operand, or NULL for an in-place operation @param second Second operand (scalar) @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @note CPL_TYPE_INT is required Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes - CPL_ERROR_INVALID_TYPE if the passed image type is as required */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_or_scalar(cpl_image * self, const cpl_image * first, cpl_bitmask second) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); if (cpl_image_get_type(self) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "self-type='%s', not int", cpl_type_get_name (cpl_image_get_type(self))); } if (first != NULL) { cpl_ensure_code(self->nx == first->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == first->ny, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_image_get_type(first) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "first-type='%s', not int", cpl_type_get_name (cpl_image_get_type(first))); } } /* Cannot fail now */ /* Update the output bad pixel map */ cpl_image_or_mask_unary(self, first); cpl_mask_or_scalar((cpl_binary*)self->pixels, first ? (const cpl_binary*)first->pixels : NULL, (second & (uint32_t)-1) | (second << 32), cpl_type_get_sizeof(CPL_TYPE_INT) *(size_t)(self->nx * self->ny)); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief The bit-wise xor of a scalar and an image with integer pixels @param self Pre-allocated image to hold the result @param first First operand, or NULL for an in-place operation @param second Second operand (scalar) @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @note CPL_TYPE_INT is required Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes - CPL_ERROR_INVALID_TYPE if the passed image type is as required */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_xor_scalar(cpl_image * self, const cpl_image * first, cpl_bitmask second) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); if (cpl_image_get_type(self) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "self-type='%s', not int", cpl_type_get_name (cpl_image_get_type(self))); } if (first != NULL) { cpl_ensure_code(self->nx == first->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == first->ny, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_image_get_type(first) != CPL_TYPE_INT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "first-type='%s', not int", cpl_type_get_name (cpl_image_get_type(first))); } } /* Cannot fail now */ /* Update the output bad pixel map */ cpl_image_or_mask_unary(self, first); cpl_mask_xor_scalar((cpl_binary*)self->pixels, first ? (const cpl_binary*)first->pixels : NULL, (second & (uint32_t)-1) | (second << 32), cpl_type_get_sizeof(CPL_TYPE_INT) *(size_t)(self->nx * self->ny)); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief The pixel-wise Euclidean distance function of the images @param self Pre-allocated image to hold the result @param first First operand, or NULL for an in-place operation @param second Second operand @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error The Euclidean distance function is useful for gaussian error propagation on addition/subtraction operations. For pixel values a and b the Euclidean distance c is defined as: $$c = sqrt{a^2 + b^2}$$ first may be NULL, in this case the distance is computed in-place on self using second as the other operand. Images can be of type CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. If both input operands are of type CPL_TYPE_FLOAT the distance is computed in single precision (using hypotf()), otherwise in double precision (using hypot()). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the images have different sizes - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_hypot(cpl_image * self, const cpl_image * first, const cpl_image * second) { cpl_error_code error; /* Only used to determine the type of the first hypot operand */ const cpl_image * myfirst = first ? first : second; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(second != NULL, CPL_ERROR_NULL_INPUT); if (cpl_image_get_type(self) != CPL_TYPE_DOUBLE && cpl_image_get_type(self) != CPL_TYPE_FLOAT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "self-type='%s'", cpl_type_get_name (cpl_image_get_type(self))); } if (first != NULL && cpl_image_get_type(first) != CPL_TYPE_DOUBLE && cpl_image_get_type(first) != CPL_TYPE_FLOAT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "first-type='%s'", cpl_type_get_name (cpl_image_get_type(first))); } if (cpl_image_get_type(second) != CPL_TYPE_DOUBLE && cpl_image_get_type(second) != CPL_TYPE_FLOAT) { return cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "second-type='%s'", cpl_type_get_name (cpl_image_get_type(second))); } if (first != NULL) { cpl_ensure_code(self->nx == first->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == first->ny, CPL_ERROR_INCOMPATIBLE_INPUT); } cpl_ensure_code(self->nx == second->nx, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(self->ny == second->ny, CPL_ERROR_INCOMPATIBLE_INPUT); /* Switch on image type */ switch ((cpl_image_get_type(self) == CPL_TYPE_FLOAT ? 4 : 0) + (cpl_image_get_type(myfirst) == CPL_TYPE_FLOAT ? 2 : 0) + (cpl_image_get_type(second) == CPL_TYPE_FLOAT ? 1 : 0)) { case 7: /* float, float, float */ error = cpl_image_hypot_float_float_float(self, first, second); break; case 6: /* float, float, double */ error = cpl_image_hypot_float_float_double(self, first, second); break; case 5: /* float, double, float */ error = cpl_image_hypot_float_double_float(self, first, second); break; case 4: /* float, double, double */ error = cpl_image_hypot_float_double_double(self, first, second); break; case 3: /* double, float, float */ error = cpl_image_hypot_double_float_float(self, first, second); break; case 2: /* double, float, double */ error = cpl_image_hypot_double_float_double(self, first, second); break; case 1: /* double, double, float */ error = cpl_image_hypot_double_double_float(self, first, second); break; default: /* double, double, double */ error = cpl_image_hypot_double_double_double(self, first, second); break; } return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Normalise pixels in an image. @param image Image operand. @param mode Normalisation mode. @return CPL_ERROR_NONE, or the relevant #_cpl_error_code_ on error. Normalises an image according to a given criterion. Possible normalisations are: - CPL_NORM_SCALE sets the pixel interval to [0,1]. - CPL_NORM_MEAN sets the mean value to 1. - CPL_NORM_FLUX sets the flux to 1. - CPL_NORM_ABSFLUX sets the absolute flux to 1. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_normalise( cpl_image * image, cpl_norm mode) { double scale; cpl_ensure_code(image, CPL_ERROR_NULL_INPUT); switch (mode) { case CPL_NORM_SCALE: { cpl_stats * stats = cpl_stats_new_from_image(image, CPL_STATS_MIN | CPL_STATS_MAX); cpl_ensure_code( stats != NULL, cpl_error_get_code()); scale = cpl_stats_get_max(stats) - cpl_stats_get_min(stats); if (scale > 0 && cpl_image_subtract_scalar(image, cpl_stats_get_min(stats))) { cpl_stats_delete(stats); return cpl_error_set_where_(); } cpl_stats_delete(stats); break; } case CPL_NORM_MEAN: { scale = cpl_image_get_mean(image); break; } case CPL_NORM_FLUX: { scale = cpl_image_get_flux(image); break; } case CPL_NORM_ABSFLUX: { scale = cpl_image_get_absflux(image); break; } default: /* This case can only be reached if cpl_norm is extended in error */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } cpl_ensure_code( !cpl_image_divide_scalar(image, scale), cpl_error_get_code()); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create a new normalised image from an existing image. @param image_in Image operand. @param mode Normalisation mode. @return 1 newly allocated image or NULL on error @see cpl_image_normalise Stores the result in a newly allocated image and returns it. The returned image must be deallocated using cpl_image_delete(). - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_normalise_create( const cpl_image * image_in, cpl_norm mode) { cpl_image * image_out; cpl_ensure(image_in, CPL_ERROR_NULL_INPUT, NULL); image_out = cpl_image_duplicate(image_in); if (cpl_image_normalise(image_out, mode)) { cpl_image_delete(image_out); image_out = NULL; (void)cpl_error_set_where_(); } return image_out; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create a new image by elementwise addition of a scalar to an image @param image Image to add @param addend Number to add @return 1 newly allocated image or NULL in case of an error @see cpl_image_add_scalar Creates a new image, being the result of the operation, and returns it to the caller. The returned image must be deallocated using cpl_image_delete(). The function supports images with different types among CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. The type of the created image is that of the passed image. */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_add_scalar_create( const cpl_image * image, double addend) { cpl_image * result = cpl_image_duplicate(image); cpl_ensure(result, cpl_error_get_code(), NULL); if (cpl_image_add_scalar(result, addend)) { cpl_image_delete(result); result = NULL; (void)cpl_error_set_where_(); } return result; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create an image by elementwise subtraction of a scalar from an image @param image Image to be subtracted from @param subtrahend Number to subtract @return 1 newly allocated image or NULL in case of an error @see cpl_image_subtract_scalar @see cpl_image_add_scalar_create */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_subtract_scalar_create( const cpl_image * image, double subtrahend) { cpl_image * result = cpl_image_duplicate(image); cpl_ensure(result, cpl_error_get_code(), NULL); if (cpl_image_subtract_scalar(result, subtrahend)) { cpl_image_delete(result); result = NULL; (void)cpl_error_set_where_(); } return result; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create a new image by multiplication of a scalar and an image @param image Image to be multiplied @param factor Number to multiply with @return 1 newly allocated image or NULL in case of an error @see cpl_image_multiply_scalar @see cpl_image_add_scalar_create */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_multiply_scalar_create( const cpl_image * image, double factor) { cpl_image * result = cpl_image_duplicate(image); cpl_ensure(result, cpl_error_get_code(), NULL); if (cpl_image_multiply_scalar(result, factor)) { cpl_image_delete(result); result = NULL; (void)cpl_error_set_where_(); } return result; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create a new image by elementwise division of an image with a scalar @param image Image to divide @param divisor Non-zero number to divide with @return 1 newly allocated image or NULL in case of an error @see cpl_image_divide_scalar @see cpl_image_add_scalar_create */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_divide_scalar_create( const cpl_image * image, double divisor) { cpl_image * result = cpl_image_duplicate(image); cpl_ensure(result, cpl_error_get_code(), NULL); if (cpl_image_divide_scalar(result, divisor)) { cpl_image_delete(result); result = NULL; (void)cpl_error_set_where_(); } return result; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create a new image by taking the elementwise logarithm of an image @param image Image to take logarithm of @param base Base of the logarithm. @return 1 newly allocated image or NULL in case of an error @see cpl_image_logarithm @see cpl_image_add_scalar_create */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_logarithm_create( const cpl_image * image, double base) { cpl_image * result = cpl_image_duplicate(image); cpl_ensure(result, cpl_error_get_code(), NULL); if (cpl_image_logarithm(result, base)) { cpl_image_delete(result); result = NULL; (void)cpl_error_set_where_(); } return result; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create a new image by elementwise exponentiation of an image @param image Image to exponentiate @param base Base of the exponential @return 1 newly allocated image or NULL in case of an error @see cpl_image_logarithm @see cpl_image_add_scalar_create */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_exponential_create( const cpl_image * image, double base) { cpl_image * result = cpl_image_duplicate(image); cpl_ensure(result, cpl_error_get_code(), NULL); if (cpl_image_exponential(result, base)) { cpl_image_delete(result); result = NULL; (void)cpl_error_set_where_(); } return result; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Create a new image by elementwise raising of an image to a power @param image Image to raise to a power @param exponent scalar exponent @return 1 newly allocated image or NULL in case of an error @see cpl_image_power @see cpl_image_add_scalar_create */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_power_create( const cpl_image * image, double exponent) { cpl_image * result = cpl_image_duplicate(image); cpl_ensure(result, cpl_error_get_code(), NULL); if (cpl_image_power(result, exponent)) { cpl_image_delete(result); result = NULL; (void)cpl_error_set_where_(); } return result; } #define CPL_OPERATION CPL_IMAGE_BASIC_THRESHOLD /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Threshold an image to a given interval. @param image_in Image to threshold. @param lo_cut Lower bound. @param hi_cut Higher bound. @param assign_lo_cut Value to assign to pixels below low bound. @param assign_hi_cut Value to assign to pixels above high bound. @return the #_cpl_error_code_ or CPL_ERROR_NONE Pixels outside of the provided interval are assigned the given values. Use FLT_MIN and FLT_MAX for floating point images and DBL_MIN and DBL_MAX for double images for the lo_cut and hi_cut to avoid any pixel replacement. Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. lo_cut must be smaller than or equal to hi_cut. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is not supported - CPL_ERROR_ILLEGAL_INPUT if lo_cut is greater than hi_cut */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_threshold( cpl_image * image_in, double lo_cut, double hi_cut, double assign_lo_cut, double assign_hi_cut) { cpl_ensure_code(image_in != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(lo_cut <= hi_cut, CPL_ERROR_ILLEGAL_INPUT); /* Switch on image type */ switch (image_in->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_BASIC_ABS /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Take the absolute value of an image. @param image Image to be modified in place @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error Set each pixel to its absolute value. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_abs(cpl_image * image) { /* Check entries */ cpl_ensure_code(image, CPL_ERROR_NULL_INPUT); /* Switch on image type */ switch (image->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Take the absolute value of an image. @param image_in Image operand. @return 1 newly allocated image or NULL on error @see cpl_image_abs For each pixel, out = abs(in). The returned image must be deallocated using cpl_image_delete(). */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_abs_create(const cpl_image * image_in) { cpl_image * result = cpl_image_duplicate(image_in); cpl_ensure(result, cpl_error_get_code(), NULL); if (cpl_image_abs(result)) { cpl_image_delete(result); result = NULL; (void)cpl_error_set_where_(); } return result; } #define CPL_OPERATION CPL_IMAGE_BASIC_AVERAGE /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Build the average of two images. @param image_1 First image operand. @param image_2 Second image operand. @return 1 newly allocated image or NULL on error Builds the average of two images and returns a newly allocated image, to be deallocated using cpl_image_delete(). The average is arithmetic, i.e. outpix=(pix1+pix2)/2 Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_average_create( const cpl_image * image_1, const cpl_image * image_2) { cpl_image * image_out; int * pii2; float * pfi2; double * pdi2; /* Check entries */ cpl_ensure(image_1 && image_2, CPL_ERROR_NULL_INPUT, NULL); /* Input data images shall have the same sizes */ cpl_ensure(image_1->nx == image_2->nx && image_1->ny == image_2->ny, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Switch on first passed image type */ switch (image_1->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } /* Handle bad pixels map */ if (image_1->bpm == NULL && image_2->bpm == NULL) { image_out->bpm = NULL; } else if (image_1->bpm == NULL) { image_out->bpm = cpl_mask_duplicate(image_2->bpm); } else if (image_2->bpm == NULL) { image_out->bpm = cpl_mask_duplicate(image_1->bpm); } else { image_out->bpm = cpl_mask_duplicate(image_1->bpm); cpl_mask_or(image_out->bpm, image_2->bpm); } return image_out; } #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Collapse an image region along its rows or columns. @param self Image to collapse. @param llx lower left x coord. @param lly lower left y coord @param urx upper right x coord @param ury upper right y coord @param direction Collapsing direction. @return a newly allocated image or NULL on error @see cpl_image_collapse_create() llx, lly, urx, ury are the image region coordinates in FITS convention. Those specified bounds are included in the collapsed region. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the specified window is not valid */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_collapse_window_create(const cpl_image * self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, int direction) { cpl_image * other; /* Switch on image type */ switch (cpl_image_get_type(self)) { case CPL_TYPE_DOUBLE: other = cpl_image_collapse_window_create_double(self, llx, lly, urx, ury, direction); break; case CPL_TYPE_FLOAT: other = cpl_image_collapse_window_create_float(self, llx, lly, urx, ury, direction); break; case CPL_TYPE_INT: other = cpl_image_collapse_window_create_int(self, llx, lly, urx, ury, direction); break; default: /* NULL input will be go here, after having set a CPL error */ other = NULL; } /* Propagate error, if any */ if (other == NULL) (void)cpl_error_set_where_(); return other; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Collapse an image along its rows or columns. @param self Input image to collapse. @param direction Collapsing direction. @return 1 newly allocated 1D image or NULL on error On success the function returns a 1D image, created by adding up all pixels on the same row or column. @verbatim Collapse along y (sum of rows): p7 p8 p9 Input image is a 3x3 image containing 9 pixels. p4 p5 p6 The output is an image containing one row with p1 p2 p3 3 pixels A, B, C, where: ---------- A B C A = p1+p4+p7 B = p2+p5+p8 C = p3+p6+p9 If p7 is a bad pixel, A = (p1+p4)*3/2. If p1, p4, p7 are bad, A is flagged as bad. @endverbatim Provide the collapsing direction as an int. Give 0 to collapse along y (sum of rows) and get an image with a single row in output, or give 1 to collapse along x (sum of columns) to get an image with a single column in output. Only the good pixels are collapsed. Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The returned image must be deallocated using cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_collapse_create(const cpl_image * self, int direction) { cpl_image * other = cpl_image_collapse_window_create(self, 1, 1, cpl_image_get_size_x(self), cpl_image_get_size_y(self), direction); /* Propagate error, if any */ cpl_ensure(other != NULL, cpl_error_get_code(), NULL); return other; } #define CPL_OPERATION CPL_IMAGE_BASIC_COLLAPSE_MEDIAN /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Collapse an image along its rows or columns, with filtering. @param self Input image to collapse. @param direction Collapsing direction. @param drop_ll Ignore this many lower rows/leftmost columns @param drop_ur Ignore this many upper rows/rightmost columns @return 1 newly allocated image having 1 row or 1 column or NULL on error @see cpl_image_collapse_create() The collapsing direction is defined as for cpl_image_collapse_create(). For each output pixel, the median of the corresponding non-ignored pixels is computed. A combination of bad pixels and drop parameters can cause a median value in the output image to be undefined. Such pixels will be flagged as bad and set to zero. If the output would contain only bad pixels an error is set. Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The returned image must be deallocated using cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if a rejection parameter is negative, or if the sum of ignored pixels is bigger than the image size in the collapsing direction - CPL_ERROR_INVALID_TYPE if the passed image type is not supported - CPL_ERROR_DATA_NOT_FOUND if the output image would have only bad pixels */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_collapse_median_create(const cpl_image * self, int direction, cpl_size drop_ll, cpl_size drop_ur) { cpl_image * other = NULL; const cpl_size ndrop = drop_ll + drop_ur; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(drop_ll >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(drop_ur >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); if (direction == 0) { cpl_ensure(ndrop < self->ny, CPL_ERROR_ILLEGAL_INPUT, NULL); } else if (direction == 1) { cpl_ensure(ndrop < self->nx, CPL_ERROR_ILLEGAL_INPUT, NULL); } else { (void)cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return NULL; } /* Switch on image type */ switch (self->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return other; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_BASIC_EXTRACT /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Extract a rectangular zone from an image into another image. @param in Input image @param llx Lower left X coordinate @param lly Lower left Y coordinate @param urx Upper right X coordinate @param ury Upper right Y coordinate @return 1 newly allocated image or NULL on error @note The returned image must be deallocated using cpl_image_delete() The input coordinates define the extracted region by giving the coordinates of the lower left and upper right corners (inclusive). Coordinates must be provided in the FITS convention: lower left corner of the image is at (1,1), x increasing from left to right, y increasing from bottom to top. Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the window coordinates are not valid - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_extract(const cpl_image * in, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { cpl_image * self = NULL; cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(llx >= 1, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(llx <= urx, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(urx <= in->nx, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(lly >= 1, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(lly <= ury, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(ury <= in->ny, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Switch on image type */ switch (in->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_DOUBLE_COMPLEX #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT_COMPLEX #include "cpl_image_basic_body.h" #undef CPL_CLASS default: /* It is an error in CPL to enter here */ (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); } if (self != NULL) { /* Bad pixels handling */ self->bpm = in->bpm == NULL ? NULL : cpl_mask_extract(in->bpm, llx, lly, urx, ury); } return self; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_BASIC_EXTRACTROW /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Extract a row from an image @param image_in Input image @param pos Position of the row (1 for the bottom one) @return 1 newly allocated cpl_vector or NULL on error Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The returned vector must be deallocated using cpl_vector_delete(). The bad pixels map is not taken into account in this function. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if pos is not valid - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_vector_new_from_image_row(const cpl_image * image_in, cpl_size pos) { cpl_vector * out; double * out_data; /* Test entries */ cpl_ensure(image_in, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(pos>=1 && pos<=image_in->ny, CPL_ERROR_ILLEGAL_INPUT,NULL); /* Allocate output vector */ out = cpl_vector_new(image_in->nx); out_data = cpl_vector_get_data(out); /* Switch on image type */ switch (image_in->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS default: cpl_vector_delete(out); out = NULL; (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return out; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_BASIC_EXTRACTCOL /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Extract a column from an image @param image_in Input image @param pos Position of the column (1 for the left one) @return 1 newly allocated cpl_vector or NULL on error Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The returned vector must be deallocated using cpl_vector_delete(). The bad pixels map is not taken into account in this function. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if pos is not valid - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_vector_new_from_image_column(const cpl_image * image_in, cpl_size pos) { cpl_vector * out; double * out_data; /* Check entries */ cpl_ensure(image_in != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(pos >= 1, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(pos <= image_in->nx, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Allocate output vector */ out = cpl_vector_new(image_in->ny); out_data = cpl_vector_get_data(out); /* Switch on image type */ switch (image_in->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS default: cpl_vector_delete(out); out = NULL; (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return out; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_BASIC_ROTATE_INT_LOCAL /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Rotate an image by a multiple of 90 degrees clockwise. @param self The image to rotate in place. @param rot The multiple: -1 is a rotation of 90 deg counterclockwise. @return CPL_ERROR_NONE on success, otherwise the relevant #_cpl_error_code_ @note The dimension of a rectangular image is changed. Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The definition of the rotation relies on the FITS convention: The lower left corner of the image is at (1,1), x increasing from left to right, y increasing from bottom to top. For rotations of +90 or -90 degrees on rectangular non-1D-images, the pixel buffer is temporarily duplicated. rot may be any integer value, its modulo 4 determines the rotation: - -3 to turn 270 degrees counterclockwise. - -2 to turn 180 degrees counterclockwise. - -1 to turn 90 degrees counterclockwise. - 0 to not turn - +1 to turn 90 degrees clockwise (same as -3) - +2 to turn 180 degrees clockwise (same as -2). - +3 to turn 270 degrees clockwise (same as -1). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_turn(cpl_image * self, int rot) { cpl_ensure_code(self, CPL_ERROR_NULL_INPUT); rot %= 4; if (rot < 0) rot += 4; /* rot is 0, 1, 2 or 3. */ /* Rotate the bad pixel map */ if (rot != 0 && self->bpm != NULL) cpl_mask_turn(self->bpm, rot); /* Switch on the image type */ switch (self->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS default: /* It is a bug in CPL to reach this point */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Shift an image by integer offsets @param self The image to shift in place @param dx The shift in X @param dy The shift in Y @return the #_cpl_error_code_ or CPL_ERROR_NONE The new zones (in the result image) where no new value is computed are set to 0 and flagged as bad pixels. The shift values have to be valid: -nx < dx < nx and -ny < dy < ny Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the requested shift is bigger than the image size */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_shift(cpl_image * self, cpl_size dx, cpl_size dy) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); if (dx != 0 || dy != 0) { /* Rejected pixels are set to a zero-bit-pattern */ if (cpl_tools_shift_window(self->pixels, cpl_type_get_sizeof(self->type), self->nx, self->ny, 0, dx, dy)) { return cpl_error_set_where_(); } /* Shift the bad pixel map */ if (self->bpm == NULL) self->bpm = cpl_mask_new(self->nx, self->ny); /* Cannot fail now */ (void)cpl_mask_shift(self->bpm, dx, dy); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Copy one image into another @param im1 the image in which im2 is inserted @param im2 the inserted image @param xpos the x pixel position in im1 where the lower left pixel of im2 should go (from 1 to the x size of im1) @param ypos the y pixel position in im1 where the lower left pixel of im2 should go (from 1 to the y size of im1) @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error. @note The two pixel buffers may not overlap (xpos, ypos) must be a valid position in im1. If im2 is bigger than the place left in im1, the part that falls outside of im1 is simply ignored, an no error is raised. The bad pixels are inherited from im2 in the concerned im1 zone. The two input images must be of the same type, namely one of CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_TYPE_MISMATCH if the input images are of different types - CPL_ERROR_INVALID_TYPE if the passed image type is not supported - CPL_ERROR_ACCESS_OUT_OF_RANGE if xpos or ypos are outside the specified range */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_copy(cpl_image * im1, const cpl_image * im2, cpl_size xpos, cpl_size ypos) { /* FIXME: Support overlapping pixel buffers ? */ /* FIXME: Need to do pointer arithmetic */ char * pim1 = (char*)cpl_image_get_data(im1); const cpl_size nx1 = cpl_image_get_size_x(im1); const cpl_size ny1 = cpl_image_get_size_y(im1); const cpl_size nx2 = cpl_image_get_size_x(im2); const cpl_size ny2 = cpl_image_get_size_y(im2); /* Define the zone to modify in im1: xpos, ypos, urx, ury */ const cpl_size urx = CX_MIN(nx1, nx2 + xpos - 1); const cpl_size ury = CX_MIN(ny1, ny2 + ypos - 1); const size_t pixsz = cpl_type_get_sizeof(cpl_image_get_type(im1)); const size_t linesz = (size_t)(urx - (xpos-1)) * pixsz; /* Check entries */ cpl_ensure_code(im1 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(im2 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(xpos >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(xpos <= nx1, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(ypos >= 1, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(ypos <= ny1, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(im1->type == im2->type, CPL_ERROR_TYPE_MISMATCH); pim1 += (ypos - 1) * nx1 * pixsz; if (xpos == 1 && urx == nx1 && nx1 == nx2) { /* The zone consists of whole lines in both in1 and in2 */ memcpy(pim1, im2->pixels, (ury - (ypos - 1)) * linesz); } else { /* FIXME: Need to do pointer arithmetic */ const char * pim2 = (const char*)im2->pixels; const size_t sz1 = (size_t)nx1 * pixsz; const size_t sz2 = (size_t)nx2 * pixsz; cpl_size j; pim1 += (size_t)(xpos - 1) * pixsz; /* Loop on the zone */ for (j = ypos - 1; j < ury; j++, pim1 += sz1, pim2 += sz2) { memcpy(pim1, pim2, linesz); } } /* Handle the bad pixels */ if (im1->bpm != NULL || im2->bpm != NULL) { cpl_mask * bpm2; if (im1->bpm == NULL) im1->bpm = cpl_mask_new(im1->nx, im1->ny); bpm2 = im2->bpm ? im2->bpm : cpl_mask_new(im2->nx, im2->ny); cpl_mask_copy(im1->bpm, bpm2, xpos, ypos); if (bpm2 != im2->bpm) cpl_mask_delete(bpm2); /* FIXME: im1->bpm may be empty... */ } return CPL_ERROR_NONE; } #define CPL_OPERATION CPL_IMAGE_BASIC_FLIP_LOCAL /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Flip an image on a given mirror line. @param im the image to flip. @param angle mirror line in polar coord. is theta = (PI/4) * angle @return the #_cpl_error_code_ or CPL_ERROR_NONE This function operates locally on the pixel buffer. angle can take one of the following values: - 0 (theta=0) to flip the image around the horizontal - 1 (theta=pi/4) to flip the image around y=x - 2 (theta=pi/2) to flip the image around the vertical - 3 (theta=3pi/4) to flip the image around y=-x Images can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the angle is different from the allowed values - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_flip( cpl_image * im, int angle) { /* Check entries */ cpl_ensure_code(im != NULL, CPL_ERROR_NULL_INPUT); /* Switch on the image type */ switch (im->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } /* Flip the bad pixel map */ if (im->bpm != NULL) cpl_mask_flip(im->bpm, angle); return CPL_ERROR_NONE; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_BASIC_MOVE_PIXELS /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Reorganize the pixels in an image @param im the image to reorganize @param nb_cut the number of cut in x and y @param new_pos array with the nb_cut^2 new positions @return the #_cpl_error_code_ or CPL_ERROR_NONE nb_cut^2 defines in how many tiles the images will be moved. Each tile will then be moved to an other place defined in new_pos. 1 will leave the image unchanged, 2 is used to move the quadrants, etc.. new_pos contains nb_cut^2 values between 1 and nb_cut^2. The zones positions are counted from the lower left part of the image. It is not allowed to move two tiles to the same position (the relation between th new tiles positions and the initial position is bijective !). The image x and y sizes have to be multiples of nb_cut. @verbatim Example: 16 17 18 6 5 4 13 14 15 3 2 1 10 11 12 ----> 12 11 10 7 8 9 9 8 7 4 5 6 18 17 16 1 2 3 15 14 13 image 3x6 cpl_image_move(image, 3, new_pos); with new_pos = {9,8,7,6,5,4,3,2,1}; @endverbatim The bad pixels are moved accordingly. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if nb_cut is not strictly positive or cannot divide one of the image sizes or if the new_pos array specifies to move two tiles to the same position. - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_move(cpl_image * im, cpl_size nb_cut, const cpl_size * new_pos) { cpl_size test_sum; cpl_size tile_sz_x, tile_sz_y; cpl_size tile_x, tile_y; cpl_size npos, opos; cpl_size i, j, k, l; /* Check entries */ cpl_ensure_code(im, CPL_ERROR_NULL_INPUT); cpl_ensure_code(new_pos, CPL_ERROR_NULL_INPUT); cpl_ensure_code(nb_cut > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(im->nx % nb_cut == 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(im->ny % nb_cut == 0, CPL_ERROR_ILLEGAL_INPUT); /* Test that new_pos takes all values between 1 and nb_cut*nb_cut */ /* The test here is not strict, but should be sufficient */ test_sum = 0; for (i=0; inx / nb_cut; tile_sz_y = im->ny / nb_cut; /* Switch on the image type */ switch (im->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_DOUBLE_COMPLEX #include "cpl_image_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT_COMPLEX #include "cpl_image_basic_body.h" #undef CPL_CLASS default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } /* Handle the bad pixels */ if (im->bpm != NULL) cpl_mask_move(im->bpm, nb_cut, new_pos); return CPL_ERROR_NONE; } #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Apply a gaussian fit on an image sub window @param im the input image @param xpos the x position of the center (1 for the first pixel) @param ypos the y position of the center (1 for the first pixel) @param size the window size in pixels, at least 4 @param norm the norm of the gaussian or NULL @param xcen the x center of the gaussian or NULL @param ycen the y center of the gaussian or NULL @param sig_x the semi-major axis of the gaussian or NULL @param sig_y the semi-minor axis of the gaussian or NULL @param fwhm_x the FHHM in x or NULL @param fwhm_y the FHHM in y or NULL @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_fit_image_gaussian() @see cpl_image_iqe() @deprecated If you need a 2D gaussian fit please use the function @em cpl_fit_image_gaussian(). Please note that on CPL versions earlier than 5.1.0 this function was wrongly documented: the parameters @em sig_x and @em sig_y were defined as "the sigma in x (or y) of the gaussian", while actually they returned the semi-major and semi-minor axes of the gaussian distribution at 1-sigma. PLEASE NOTE THAT IF YOU USED THIS FUNCTION FOR DETERMINING THE SPREAD OF A DISTRIBUTION ALONG THE X DIRECTION, THIS WAS VERY LIKELY OVERESTIMATED (because @em sig_x was always assigned the semi-major axis of the distribution ignoring the rotation), WHILE THE SPREAD ALONG THE Y DIRECTION WOULD BE UNDERESTIMATED. In addition to that, even with circular distributions this function may lead to an underestimation of @em sig_x and @em sig_y (up to 25% underestimation in the case of noiseless data with a box 4 times the sigma, 1% underestimation in the case of noiseless data with a box 7 times the sigma). This latter problem is related to the function @em cpl_image_iqe(). This function is only acceptable for determining the position of a peak. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fit_gaussian( const cpl_image * im, cpl_size xpos, cpl_size ypos, cpl_size size, double * norm, double * xcen, double * ycen, double * sig_x, double * sig_y, double * fwhm_x, double * fwhm_y) { const cpl_image * im_use; cpl_image * im_cast = NULL; cpl_size llx, lly, urx, ury; cpl_bivector * stats; double * pstats; /* Check entries */ cpl_ensure_code(im != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(xpos >= 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(ypos >= 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(xpos <= im->nx, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(ypos <= im->ny, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(size >= 1, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(size < im->nx, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(size < im->ny, CPL_ERROR_ILLEGAL_INPUT); /* Extraction zone */ llx = xpos - size / 2; lly = ypos - size / 2; urx = xpos + size / 2; ury = ypos + size / 2; if (llx < 1) llx = 1; if (lly < 1) lly = 1; if (urx > im->nx) urx = im->nx; if (ury > im->ny) ury = im->ny; /* Convert the image to FLOAT, if needed */ im_use = cpl_image_get_type(im) == CPL_TYPE_FLOAT ? im : (im_cast = cpl_image_cast(im, CPL_TYPE_FLOAT)); /* Call cpl_image_iqe */ stats = cpl_image_iqe(im_use, llx, lly, urx, ury); cpl_image_delete(im_cast); if (stats == NULL) return cpl_error_set_where_(); /* Write the results */ pstats = cpl_bivector_get_x_data(stats); if (xcen) *xcen = pstats[0]; if (ycen) *ycen = pstats[1]; if (fwhm_x) *fwhm_x = pstats[2]; if (fwhm_y) *fwhm_y = pstats[3]; if (sig_x) *sig_x = pstats[2] / CPL_MATH_FWHM_SIG; if (sig_y) *sig_y = pstats[3] / CPL_MATH_FWHM_SIG; if (norm) *norm = pstats[5] * CPL_MATH_2PI * (pstats[2]*pstats[3]) / (CPL_MATH_FWHM_SIG*CPL_MATH_FWHM_SIG); cpl_bivector_delete(stats); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Compute FWHM values in x and y for an object @param in the input image @param xpos the x position of the object (1 for the first pixel) @param ypos the y position of the object (1 for the first pixel) @param fwhm_x the computed FWHM in x or -1 on error @param fwhm_y the computed FWHM in y or -1 on error @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ This function uses a basic method: start from the center of the object and go away until the half maximum value is reached in x and y. For the FWHM in x (resp. y) to be computed, the image size in the x (resp. y) direction should be at least of 5 pixels. If for any reason, one of the FHWMs cannot be computed, its returned value is -1.0, but an error is not necessarily raised. For example, if a 4 column image is passed, the fwhm_x would be -1.0, the fwhm_y would be correctly computed, and no error would be raised. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_DATA_NOT_FOUND if (xpos, ypos) specifies a rejected pixel or a pixel with a non-positive value - CPL_ERROR_ACCESS_OUT_OF_RANGE if xpos or ypos is outside the image size range */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_get_fwhm( const cpl_image * in, cpl_size xpos, cpl_size ypos, double * fwhm_x, double * fwhm_y) { double half_max; double thres; const cpl_size minimum_size = 5; int is_rejected; /* Check entries - and initialize *fwhm_{x,y} */ if (fwhm_y != NULL) *fwhm_y = -1; cpl_ensure_code(fwhm_x, CPL_ERROR_NULL_INPUT); *fwhm_x = -1; cpl_ensure_code(fwhm_y, CPL_ERROR_NULL_INPUT); /* This call will check the validity of image, xpos and ypos */ half_max = 0.5 * cpl_image_get(in, xpos, ypos, &is_rejected); cpl_ensure_code(is_rejected >= 0, cpl_error_get_code()); cpl_ensure_code(!is_rejected, CPL_ERROR_DATA_NOT_FOUND); cpl_ensure_code(half_max > 0, CPL_ERROR_DATA_NOT_FOUND); /* FWHM in x */ if (in->nx >= minimum_size) { cpl_errorstate pstate; /* Extract the vector centered on the maximum */ cpl_vector * row = cpl_vector_new_from_image_row(in, ypos); /* If an error happened, update its location */ cpl_ensure_code(row, cpl_error_get_code()); pstate = cpl_errorstate_get(); /* Find out threshold */ thres = cpl_vector_get_noise(row, xpos); /* Compute the FWHM */ if (cpl_errorstate_is_equal(pstate)) *fwhm_x = cpl_vector_get_fwhm(row, xpos, half_max + thres * 0.5); cpl_vector_delete(row); /* Propagate the error, if any */ cpl_ensure_code(cpl_errorstate_is_equal(pstate), cpl_error_get_code()); } /* FWHM in y */ if (in->ny >= minimum_size) { cpl_errorstate pstate; /* Extract the vector centered on the maximum */ cpl_vector * col = cpl_vector_new_from_image_column(in, xpos); /* If an error happened, update its location */ cpl_ensure_code(col, cpl_error_get_code()); pstate = cpl_errorstate_get(); /* Find out threshold */ thres = cpl_vector_get_noise(col, ypos); /* Compute the FWHM */ if (cpl_errorstate_is_equal(pstate)) *fwhm_y = cpl_vector_get_fwhm(col, ypos, half_max + thres * 0.5); cpl_vector_delete(col); /* Propagate the error, if any */ cpl_ensure_code(cpl_errorstate_is_equal(pstate), cpl_error_get_code()); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Fast Fourier Transform a square, power-of-two sized image @param img_real The image real part to be transformed in place @param img_imag The image imaginary part to be transformed in place @param mode The desired FFT options (combined with bitwise or) @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error The input images must be of double type. If the second passed image is NULL, the resulting imaginary part cannot be returned. This can be useful if the input is real and the output is known to also be real. But if the output has a significant imaginary part, you might want to pass a 0-valued image as the second parameter. Any rejected pixel is used as if it were a good pixel. The image must be square with a size that is a power of two. These are the supported FFT modes: CPL_FFT_DEFAULT: Default, forward FFT transform CPL_FFT_INVERSE: Inverse FFT transform CPL_FFT_UNNORMALIZED: Do not normalize (with N*N for N-by-N image) on inverse. Has no effect on forward transform. CPL_FFT_SWAP_HALVES: Swap the four quadrants of the result image. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if the image is not square or if the image size is not a power of 2. - CPL_ERROR_INVALID_TYPE if mode is 1, e.g. due to a logical or (||) of the allowed FFT options. - CPL_ERROR_UNSUPPORTED_MODE if mode is otherwise different from the allowed FFT options. - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fft( cpl_image * img_real, cpl_image * img_imag, unsigned mode) { unsigned dim[2]; double * imag_part; /* Check entries */ cpl_ensure_code(img_real, CPL_ERROR_NULL_INPUT); cpl_ensure_code(mode != 1, CPL_ERROR_INVALID_TYPE); cpl_ensure_code( mode <= (CPL_FFT_INVERSE|CPL_FFT_UNNORMALIZED|CPL_FFT_SWAP_HALVES), CPL_ERROR_UNSUPPORTED_MODE); cpl_ensure_code(img_real->nx==img_real->ny, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(img_real->type==CPL_TYPE_DOUBLE,CPL_ERROR_INVALID_TYPE); cpl_ensure_code(cpl_tools_is_power_of_2(img_real->nx)>=0, CPL_ERROR_ILLEGAL_INPUT); if (img_imag != NULL) { cpl_ensure_code(img_real->nx==img_imag->nx,CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(img_real->ny==img_imag->ny,CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(img_imag->type==CPL_TYPE_DOUBLE, CPL_ERROR_INVALID_TYPE); } /* Initialize */ dim[0] = dim[1] = (unsigned)img_real->nx; cpl_ensure_code((cpl_size)dim[0] == img_real->nx, CPL_ERROR_ILLEGAL_INPUT); if (img_imag == NULL) { /* Create the imaginary part and set it to 0 */ imag_part = cpl_calloc(dim[0]*dim[1], sizeof(double)); } else { /* Put the input imaginary part in a local object */ imag_part = img_imag->pixels; } /* APPLY THE FFT HERE */ cpl_ensure_code(!cpl_fft(img_real->pixels, imag_part, dim, 2, (mode & CPL_FFT_INVERSE) ? -1 : 1),cpl_error_get_code()); /* Free the imaginary part result in the input image */ if (img_imag == NULL) { cpl_free(imag_part); } /* Normalize on the inverse transform */ if (!(mode & CPL_FFT_UNNORMALIZED) && (mode & CPL_FFT_INVERSE)) { cpl_ensure_code(!cpl_image_divide_scalar(img_real, dim[0]*dim[1]), cpl_error_get_code()); if (img_imag != NULL) { cpl_ensure_code(!cpl_image_divide_scalar(img_imag, dim[0]*dim[1]), cpl_error_get_code()); } } /* Swap halves in both dimensions */ if (mode & CPL_FFT_SWAP_HALVES) { const cpl_size new_pos[] = {4, 3, 2, 1}; cpl_ensure_code(!cpl_image_move(img_real, 2, new_pos), cpl_error_get_code()); if (img_imag != NULL) { cpl_ensure_code(!cpl_image_move(img_imag, 2, new_pos), cpl_error_get_code()); } } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief The bit-wise or of the input masks onto the output mask @param self Pre-allocated image to hold the result @param first First operand, or NULL for an in-place operation @param second Second operand @return void @note Error checking assumed to have been performed by the caller */ /*----------------------------------------------------------------------------*/ void cpl_image_or_mask(cpl_image * self, const cpl_image * first, const cpl_image * second) { const size_t nxy = (size_t)self->nx * (size_t)self->ny; if (self->bpm == NULL) { /* Create the bad pixel map, if an input one is non-NULL */ if (first != NULL && first->bpm != NULL && second->bpm != NULL) { self->bpm = cpl_mask_wrap(self->nx, self->ny, cpl_malloc(nxy)); cpl_mask_or_(cpl_mask_get_data(self->bpm), cpl_mask_get_data_const(first->bpm), cpl_mask_get_data_const(second->bpm), nxy); } else if (second->bpm != NULL) { self->bpm = cpl_mask_duplicate(second->bpm); } else if (first != NULL && first->bpm != NULL) { self->bpm = cpl_mask_duplicate(first->bpm); } } else { /* The self bpm is non-NULL. If first is NULL, then the operation is in-place, so self is an input parameter */ if (first != NULL && first->bpm != NULL && second->bpm != NULL) { cpl_mask_or_(cpl_mask_get_data(self->bpm), cpl_mask_get_data_const(first->bpm), cpl_mask_get_data_const(second->bpm), nxy); } else if (first != NULL && first->bpm != NULL) { assert(second->bpm == NULL); (void)memcpy(cpl_mask_get_data(self->bpm), cpl_mask_get_data_const(first->bpm), nxy); } else if (second->bpm != NULL) { if (first == NULL) { /* Self is an input parameter */ cpl_mask_or(self->bpm, second->bpm); } else { /* First is non-NULL, but happens to have a NULL bpm */ assert(first->bpm == NULL); (void)memcpy(cpl_mask_get_data(self->bpm), cpl_mask_get_data_const(second->bpm), nxy); } } else if (first != NULL) { /* First is non-NULL, but happens to have a NULL bpm, so the result is an empty bpm */ (void)memset(cpl_mask_get_data(self->bpm), 0, nxy); } } } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief The bit-wise or of the input mask(s) onto the output mask @param self Pre-allocated image to hold the result @param first First operand, or NULL for an in-place operation @return void @note Error checking assumed to have been performed by the caller @see cpl_image_or_mask */ /*----------------------------------------------------------------------------*/ void cpl_image_or_mask_unary(cpl_image * self, const cpl_image * first) { const size_t nxy = (size_t)self->nx * (size_t)self->ny; if (self->bpm == NULL) { /* Create the bad pixel map, if an input one is non-NULL */ if (first != NULL && first->bpm != NULL) { self->bpm = cpl_mask_duplicate(first->bpm); } } else { /* The self bpm is non-NULL. If first is NULL, then the operation is in-place, so self is an input parameter */ if (first != NULL && first->bpm != NULL) { (void)memcpy(cpl_mask_get_data(self->bpm), cpl_mask_get_data_const(first->bpm), nxy); } else if (first != NULL) { /* First is non-NULL, but happens to have a NULL bpm, so the result is an empty bpm */ (void)memset(cpl_mask_get_data(self->bpm), 0, nxy); } } } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief N-dimensional FFT. @param real N-dimensional data set stored in 1d (real part). @param imag N-dimensional data set stored in 1d (imaginary part). @param nn Dimensions of the set. @param ndim How many dimensions this set has. @param isign Transform direction. @return the #_cpl_error_code_ or CPL_ERROR_NONE This routine is a public domain FFT. See extract of Usenet article below. Found on http://www.tu-chemnitz.de/~arndt/joerg.html @verbatim From: alee@tybalt.caltech.edu (Andrew Lee) Newsgroups: comp.sources.misc Subject: N-dimensional, Radix 2 FFT Routine Date: 17 Jul 87 22:26:29 GMT Approved: allbery@ncoast.UUCP X-Archive: comp.sources.misc/8707/48 [..] Now for the usage (finally): real[] and imag[] are the array of complex numbers to be transformed, nn[] is the array giving the dimensions (I mean size) of the array, ndim is the number of dimensions of the array, and isign is +1 for a forward transform, and -1 for an inverse transform. real[], imag[] and nn[] are stored in the "natural" order for C: nn[0] gives the number of elements along the leftmost index, nn[ndim - 1] gives the number of elements along the rightmost index. Additional notes: The routine does NO NORMALIZATION, so if you do a forward, and then an inverse transform on an array, the result will be identical to the original array MULTIPLIED BY THE NUMBER OF ELEMENTS IN THE ARRAY. Also, of course, the dimensions of real[] and imag[] must all be powers of 2. @endverbatim Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_fft( double * real, double * imag, const unsigned * nn, int ndim, int isign) { int idim; unsigned i1, i2rev, i3rev, ibit; unsigned ip2, ifp1, ifp2, k2, n; unsigned nprev = 1, ntot = 1; register unsigned i2, i3; double theta; double w_r, w_i, wp_r, wp_i; double wtemp; double temp_r, temp_i, wt_r, wt_i; double t1, t2; /* Check entries */ cpl_ensure_code(real, CPL_ERROR_NULL_INPUT); cpl_ensure_code(imag, CPL_ERROR_NULL_INPUT); cpl_ensure_code(nn, CPL_ERROR_NULL_INPUT); for (idim = 0; idim < ndim; ++idim) cpl_ensure_code(cpl_tools_is_power_of_2(nn[idim])>=0, CPL_ERROR_ILLEGAL_INPUT); /* Compute total number of complex values */ for (idim = 0; idim < ndim; ++idim) ntot *= nn[idim]; for (idim = ndim - 1; idim >= 0; --idim) { n = nn[idim]; ip2 = nprev * n; /* Unit step for next dimension */ i2rev = 0; /* Bit reversed i2 */ /* This is the bit reversal section of the routine */ /* Loop over current dimension */ for (i2 = 0; i2 < ip2; i2 += nprev) { if (i2 < i2rev) /* Loop over lower dimensions */ for (i1 = i2; i1 < i2 + nprev; ++i1) /* Loop over higher dimensions */ for (i3 = i1; i3 < ntot; i3 += ip2) { i3rev = i3 + i2rev - i2; temp_r = real[i3]; temp_i = imag[i3]; real[i3] = real[i3rev]; imag[i3] = imag[i3rev]; real[i3rev] = temp_r; imag[i3rev] = temp_i; } ibit = ip2; /* Increment from high end of i2rev to low */ do { ibit >>= 1; i2rev ^= ibit; } while (ibit >= nprev && !(ibit & i2rev)); } /* Here begins the Danielson-Lanczos section of the routine */ /* Loop over step sizes */ for (ifp1 = nprev; ifp1 < ip2; ifp1 <<= 1) { ifp2 = ifp1 << 1; /* Initialize for the trig. recurrence */ theta = isign * CPL_MATH_2PI / (ifp2 / nprev); wp_r = sin(0.5 * theta); wp_r *= -2.0 * wp_r; wp_i = sin(theta); w_r = 1.0; w_i = 0.0; /* Loop by unit step in current dimension */ for (i3 = 0; i3 < ifp1; i3 += nprev) { /* Loop over lower dimensions */ for (i1 = i3; i1 < i3 + nprev; ++i1) /* Loop over higher dimensions */ for (i2 = i1; i2 < ntot; i2 += ifp2) { /* Danielson-Lanczos formula */ k2 = i2 + ifp1; wt_r = real[k2]; wt_i = imag[k2]; /* Complex multiply using 3 real multiplies. */ real[k2] = real[i2] - (temp_r = (t1 = w_r * wt_r) - (t2 = w_i * wt_i)); imag[k2] = imag[i2] - (temp_i = (w_r + w_i) * (wt_r + wt_i) - t1 - t2); real[i2] += temp_r; imag[i2] += temp_i; } /* Trigonometric recurrence */ wtemp = w_r; /* Complex multiply using 3 real multiplies. */ w_r += (t1 = w_r * wp_r) - (t2 = w_i * wp_i); w_i += (wtemp + w_i) * (wp_r + wp_i) - t1 - t2; } } nprev *= n; } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Compute the noise around a peak in a vector @param vec the input cpl_vector @param pos the peak position (from 1 to the vector size) @return the noise value. The passed cpl_vector object must have at least two elements. In case of error, the #_cpl_error_code_ code is set, and the returned double is undefined. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT */ /*----------------------------------------------------------------------------*/ static double cpl_vector_get_noise( const cpl_vector * vec, cpl_size pos) { cpl_size nelem; cpl_vector * smooth_vec; const double * vector_data; double noise_left, noise_right; cpl_errorstate prestate = cpl_errorstate_get(); cpl_size i; /* Check entries */ cpl_ensure(vec, CPL_ERROR_NULL_INPUT, -1.0); nelem = cpl_vector_get_size(vec); cpl_ensure(pos >= 1, CPL_ERROR_ILLEGAL_INPUT, -1.0); cpl_ensure(pos <= nelem, CPL_ERROR_ILLEGAL_INPUT, -1.0); cpl_ensure(nelem > 1, CPL_ERROR_ILLEGAL_INPUT, -1.0); /* Smooth out the array to be less sensitive to noise */ smooth_vec = cpl_vector_filter_lowpass_create(vec, CPL_LOWPASS_LINEAR, 1); if (!cpl_errorstate_is_equal(prestate)) { /* Recover and use the unsmoothed vector */ cpl_errorstate_set(prestate); cpl_vector_delete(smooth_vec); smooth_vec = NULL; } vector_data = cpl_vector_get_data_const(smooth_vec ? smooth_vec : vec); if (smooth_vec != NULL) { /* The smoothing (half-size is 1) may have moved the maximum 1 pixel */ if (pos < nelem && vector_data[pos-1] < vector_data[pos]) { pos++; } else if (pos > 1 && vector_data[pos-1] < vector_data[pos-2]) { pos--; } } /* Find noise level on the left side of the peak. */ i = pos - 1; while (i > 0) { if (vector_data[i] > vector_data[i-1]) i--; else break; } noise_left = vector_data[i]; /* Find noise level on the right side of the peak */ i = pos - 1; while (i < nelem-1) { if (vector_data[i] > vector_data[i+1]) i++; else break; } noise_right = vector_data[i]; cpl_vector_delete(smooth_vec); return 0.5 * (noise_left + noise_right); } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Compute the FWHM of an object in a cpl_vector @param vec the input cpl_vector @param pos the object position (from 1 to the vector size) @param half_max the half maximum value @return the FWHM or a negative value on error @note The return value may be -1 with no error condition Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if pos is less than 1 or greater than the vec-length */ /*----------------------------------------------------------------------------*/ static double cpl_vector_get_fwhm( const cpl_vector * vec, cpl_size pos, double half_max) { const double * vec_data; cpl_size nelem; double x_left, x_right; double y_1, y_2; cpl_size i; /* Check entries */ cpl_ensure(vec, CPL_ERROR_NULL_INPUT, -1.0); nelem = cpl_vector_get_size(vec); cpl_ensure(pos >= 1, CPL_ERROR_ILLEGAL_INPUT, -1.0); cpl_ensure(pos <= nelem, CPL_ERROR_ILLEGAL_INPUT, -1.0); vec_data = cpl_vector_get_data_const(vec); /* Object may be too noisy - or strange in some other way */ if (vec_data[pos - 1] <= half_max) return -1.0; /* Find first pair of values, y(i) <= half_max < y(i+1) on the left of the maximum */ i = pos - 1; while ((vec_data[i] > half_max) && (i > 0)) i--; if (vec_data[i] > half_max) return -1.0; /* y_1 could not be found */ y_1 = vec_data[i]; y_2 = vec_data[i+1]; /* assert ( y_1 <= half_max && half_max < y_2 ); */ /* Assume linearity between y_1 and y_2 */ x_left = (double)i + (half_max-y_1) / (y_2-y_1); /* assert( x_left >= i ); */ /* Find first pair of values, y(i-1) > half_max >= y(i) on the right of the maximum */ i = pos - 1; while ((vec_data[i] > half_max) && (i < nelem-1)) i++; if (vec_data[i] > half_max) return -1.0; /* y_2 could not be found */ y_1 = vec_data[i-1]; y_2 = vec_data[i]; /* assert( y_1 > half_max && half_max >= y_2 ); */ /* Assume linearity between y_1 and y_2 */ x_right = (double)i + (half_max-y_2) / (y_2-y_1); /* assert( x_right < i ); */ if (x_right < x_left || x_right - x_left > FLT_MAX) return -1; return x_right - x_left; } #if (defined __SSE3__ || defined __SSE2__) /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief multiply two vectors of two complex floats @param a first operand @param b second operand @param i offset @return result of the multiplication @see fcompl_mult_sse_aligned() Function not inlineable to work around code generation issue of gcc. The pointer additions must be hidden in this function or gcc will pointlessly add them to the inner loop of the complex multiplication even though they are only required in the unlikely branch. Tested with gcc <= 4.7. Up to 30% speed improvement on some machines. */ /*----------------------------------------------------------------------------*/ static void CPL_ATTR_NOINLINE fcompl_mult_scalar2(float complex * a, const float complex * b, const size_t i) { a[i] = a[i] * b[i]; a[i + 1] = a[i + 1] * b[i + 1]; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief check result for NaN and recompute correctly if so @return true if nan was fixed and stored, false if no fixup required if false no store was done @see fcompl_mult_sse_aligned() */ /*----------------------------------------------------------------------------*/ static inline cpl_boolean fcompl_fix_nan(__m128 res, float complex * a, const float complex * b, const size_t i) { #ifndef __FAST_MATH__ /* check for NaN, redo all in libc if found */ __m128 n = _mm_cmpneq_ps(res, res); if (CPL_UNLIKELY(_mm_movemask_ps(n) != 0)) { fcompl_mult_scalar2(a, b, i); return CPL_TRUE; } else #endif return CPL_FALSE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief vertical multiply two vectors of each two complex floats @param va first operand (real, imag, real, imag) @param vb second operand (real, imag, real, imag) @return result of the multiplication does not handle NaN's correctly */ /*----------------------------------------------------------------------------*/ static inline __m128 fcompl_mult_sse_fast(__m128 va, __m128 vb) { /* optimized to SSE3 _mm_move[hl]dup_ps by gcc */ __m128 reala = _mm_shuffle_ps(va, va, _MM_SHUFFLE(2, 2, 0, 0)); /* x x */ __m128 imaga = _mm_shuffle_ps(va, va, _MM_SHUFFLE(3, 3, 1, 1)); /* w w */ __m128 t1 = _mm_mul_ps(reala, vb); /* x*y x*z */ __m128 sb = _mm_shuffle_ps(vb, vb, _MM_SHUFFLE(2, 3, 0, 1)); /* z y */ __m128 t2 = _mm_mul_ps(imaga, sb); /* w*z w*y */ return CPL_MM_ADDSUB_PS(t1, t2); /* x*y-w*z x*z+w*y*/ } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief complex multiplication loop, aligned @param im1 first operand, must be 16 byte aligned @param im2 second operand, must be 16 byte aligned @param Nt number of pixels @return the #_cpl_error_code_ or CPL_ERROR_NONE */ /*----------------------------------------------------------------------------*/ static cpl_error_code fcompl_mult_sse_aligned(float complex * a, const float complex * b, const size_t Nt) { const size_t n = (Nt % 2) == 1 ? Nt - 1 : Nt; /* no overflow hint for the compiler */ cpl_ensure_code(n < SIZE_MAX-1, CPL_ERROR_ACCESS_OUT_OF_RANGE); for (size_t i = 0; i < n; i+=2) { __m128 va = _mm_load_ps((const float *)&a[i]); /* x w */ __m128 vb = _mm_load_ps((const float *)&b[i]); /* y z */ __m128 res = fcompl_mult_sse_fast(va, vb); if (CPL_LIKELY(fcompl_fix_nan(res, a, b, i) == CPL_FALSE)) _mm_store_ps((float *)&a[i], res); } if ((Nt) % 2 == 1) a[Nt - 1] = a[Nt - 1] * b[Nt - 1]; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief complex multiplication loop, unaligned @param im1 first operand @param im2 second operand. @param Nt number of pixels @return the #_cpl_error_code_ or CPL_ERROR_NONE */ /*----------------------------------------------------------------------------*/ static cpl_error_code fcompl_mult_sse_unaligned(float complex * a, const float complex * b, const size_t Nt) { const size_t n = (Nt % 2) == 1 ? Nt - 1 : Nt; /* no overflow hint for the compiler */ cpl_ensure_code(n < SIZE_MAX-1, CPL_ERROR_ACCESS_OUT_OF_RANGE); for (size_t i = 0; i < n; i+=2) { __m128 va = _mm_loadu_ps((const float *)&a[i]); /* x w */ __m128 vb = _mm_loadu_ps((const float *)&b[i]); /* y z */ __m128 res = fcompl_mult_sse_fast(va, vb); if (CPL_LIKELY(fcompl_fix_nan(res, a, b, i) == CPL_FALSE)) _mm_storeu_ps((float *)&a[i], res); } if ((Nt) % 2 == 1) a[Nt - 1] = a[Nt - 1] * b[Nt - 1]; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Multiply two float complex images using sse2 or 3 @param im1 first operand. @param im2 second operand. @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_multiply() @note No error checking performed in this static function */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_image_multiply_fcomplex_sse_(cpl_image * im1, const cpl_image * im2) { const size_t Nt = im1->nx * im1->ny; float complex * a = im1->pixels; const float complex * b = im2->pixels; cpl_error_code err = CPL_ERROR_NONE; /* FIXME: cases for a xor b unaligned? */ if (((intptr_t)a % 16) == 0 && ((intptr_t)b % 16) == 0) err = fcompl_mult_sse_aligned(a, b, Nt); else if (((intptr_t)a % 16) == 8 && ((intptr_t)b % 16) == 8) { a[0] = a[0] * b[0]; err = fcompl_mult_sse_aligned(a + 1, b + 1, Nt - 1); } else err = fcompl_mult_sse_unaligned(a, b, Nt); /* Handle bad pixels map */ if (im2->bpm != NULL) { if (im1->bpm == NULL) { im1->bpm = cpl_mask_duplicate(im2->bpm); } else { cpl_mask_or(im1->bpm, im2->bpm); } } return err; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief multiply two vectors of two complex double @param a first operand @param b second operand @param i offset @return result of the multiplication @see fcompl_mult_scalar2() */ /*----------------------------------------------------------------------------*/ static void CPL_ATTR_NOINLINE dcompl_mult_scalar(double complex * a, const double complex * b, const size_t i) { a[i] = a[i] * b[i]; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief check result for NaN and recompute correctly if so @return true if nan was fixed and stored, false if no fixup required if false no store was done @see dcompl_mult_sse_aligned() */ /*----------------------------------------------------------------------------*/ static inline cpl_boolean dcompl_fix_nan(__m128d res, double complex * a, const double complex * b, const size_t i) { #ifndef __FAST_MATH__ /* check for NaN, redo all in libc if found */ __m128d n = _mm_cmpneq_pd(res, res); if (CPL_UNLIKELY(_mm_movemask_pd(n) != 0)) { dcompl_mult_scalar(a, b, i); return CPL_TRUE; } else #endif return CPL_FALSE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief vertical multiply two vectors of each two complex double @param va first operand (real, imag, real, imag) @param vb second operand (real, imag, real, imag) @return result of the multiplication does not handle NaN's correctly */ /*----------------------------------------------------------------------------*/ static inline __m128d dcompl_mult_sse_fast(__m128d va, __m128d vb) { /* optimized to SSE3 _mm_movedup_pd by gcc */ __m128d rb = _mm_unpacklo_pd(vb, vb); /* y, y */ __m128d ib = _mm_unpackhi_pd(vb, vb); /* w, w*/ __m128d t1 = _mm_mul_pd(rb, va); /* y * x, y * z */ __m128d t2 = _mm_mul_pd(ib, va); /* w * x, w * z*/ __m128d sb = _mm_shuffle_pd(t2, t2, _MM_SHUFFLE2(0, 1)); /* w * z, w * x */ return CPL_MM_ADDSUB_PD(t1, sb); /* x * y - y * w, z*y + x * w */ } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief complex multiplication loop, aligned @param im1 first operand, must be 16 byte aligned @param im2 second operand, must be 16 byte aligned @param Nt number of pixels @return the #_cpl_error_code_ or CPL_ERROR_NONE */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_ATTR_NOINLINE dcompl_mult_sse_aligned(double complex * a, const double complex * b, const size_t n) { /* no overflow hint for the compiler */ cpl_ensure_code(n < SIZE_MAX, CPL_ERROR_ACCESS_OUT_OF_RANGE); for (size_t i = 0; i < n; i++) { __m128d va = _mm_load_pd((const double *)&a[i]); /* x w */ __m128d vb = _mm_load_pd((const double *)&b[i]); /* y z */ __m128d res = dcompl_mult_sse_fast(va, vb); if (CPL_LIKELY(dcompl_fix_nan(res, a, b, i) == CPL_FALSE)) _mm_store_pd((double *)&a[i], res); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief complex multiplication loop, unaligned @param im1 first operand @param im2 second operand. @param Nt number of pixels @return the #_cpl_error_code_ or CPL_ERROR_NONE */ /*----------------------------------------------------------------------------*/ static cpl_error_code dcompl_mult_sse_unaligned(double complex * a, const double complex * b, const size_t n) { /* no overflow hint for the compiler */ cpl_ensure_code(n < SIZE_MAX, CPL_ERROR_ACCESS_OUT_OF_RANGE); for (size_t i = 0; i < n; i++) { __m128d va = _mm_loadu_pd((const double *)&a[i]); /* x w */ __m128d vb = _mm_loadu_pd((const double *)&b[i]); /* y z */ __m128d res = dcompl_mult_sse_fast(va, vb); if (CPL_LIKELY(dcompl_fix_nan(res, a, b, i) == CPL_FALSE)) _mm_storeu_pd((double *)&a[i], res); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Multiply two double complex images using sse2 or 3 @param im1 first operand. @param im2 second operand. @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_multiply() @note No error checking performed in this static function */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_image_multiply_dcomplex_sse_(cpl_image * im1, const cpl_image * im2) { const size_t Nt = im1->nx * im1->ny; double complex * a = im1->pixels; const double complex * b = im2->pixels; cpl_error_code err = CPL_ERROR_NONE; /* FIXME: cases for a xor b unaligned? */ if (((intptr_t)a % 16) == 0 && ((intptr_t)b % 16) == 0) err = dcompl_mult_sse_aligned(a, b, Nt); else err = dcompl_mult_sse_unaligned(a, b, Nt); /* Handle bad pixels map */ if (im2->bpm != NULL) { if (im1->bpm == NULL) { im1->bpm = cpl_mask_duplicate(im2->bpm); } else { cpl_mask_or(im1->bpm, im2->bpm); } } return err; } #endif cpl-6.4.1/cplcore/cpl_vector_fit_impl.h0000644000460300003120000006764012247125625015060 00000000000000/* $Id: cpl_vector_fit_impl.h,v 1.15 2013-02-26 19:25:41 cgarcia Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: cgarcia $ * $Date: 2013-02-26 19:25:41 $ * $Revision: 1.15 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_VECTOR_FIT_IMPL_H #define CPL_VECTOR_FIT_IMPL_H /* * FIXME: The code in this file is a copy of the cpl_fit module and has to * stay here until cpl_vector_fit_gaussian() is moved to the cpl_fit * module, which can be done only before the release of the next major * version, in order not to break the library hierarchy! * * When the code in this file is finally moved to the cpl_fit module, * this file has to be removed! */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_fit.h" #include "cpl_vector.h" #include "cpl_matrix.h" #include "cpl_memory.h" #include "cpl_error_impl.h" #include "cpl_errorstate.h" #include #include /*----------------------------------------------------------------------------*/ /* @brief Get new position in parameter space (L-M algorithm) @param a Current fit parameters. @param ia Non-NULL array defining with non-zero values which parameters participate in the fit. @param M Number of fit parameters @param N Number of positions @param D Dimension of x-positions @param lambda Lambda in L-M algorithm. @param f Function that evaluates the fit function. @param dfda Function that evaluates the partial derivaties of the fit function w.r.t. fit parameters. @param x The input positions (pointer to MxD matrix buffer). @param y The N values to fit. @param sigma A vector of size N containing the uncertainties of the y-values. If NULL, a constant uncertainty equal to 1 is assumed. @param partials The partial derivatives (work space). @param alpha Alpha in L-M algorithm (work space). @param beta Beta in L-M algorithm (work space). @param a_da (output) Candidate position in parameter space. @return 0 iff okay. This function computes a potentially better set of parameters @em a + @em da, where @em da solves the equation @em alpha(@em lambda) * @em da = @em beta . Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if the fit function or its derivative could not be evaluated. - CPL_ERROR_SINGULAR_MATRIX if @em alpha is singular. */ /*----------------------------------------------------------------------------*/ inline static int get_candidate(const double *a, const int ia[], cpl_size M, cpl_size N, cpl_size D, double lambda, int (*f)(const double x[], const double a[], double *result), int (*dfda)(const double x[], const double a[], double result[]), const double *x, const double *y, const double *sigma, double *partials, cpl_matrix *alpha, cpl_matrix *beta, double *a_da) { cpl_size Mfit = 0; /* Number of non-constant fit parameters */ cpl_matrix *da; /* Solution of alpha * da = beta */ double *alpha_data; double *beta_data; double *da_data; cpl_size i, j; int imfit = 0; int jmfit = 0; int k = 0; /* For efficiency, don't check input in this static function */ Mfit = cpl_matrix_get_nrow(alpha); alpha_data = cpl_matrix_get_data(alpha); beta_data = cpl_matrix_get_data(beta); /* Build alpha, beta: * * alpha[i,j] = sum_{k=1,N} (sigma_k)^-2 * df/da_i * df/da_j * * (1 + delta_ij lambda) , * * beta[i] = sum_{k=1,N} (sigma_k)^-2 * ( y_k - f(x_k) ) * df/da_i * * where (i,j) loop over the non-constant parameters (0 to Mfit-1), * delta is Kronecker's delta, and all df/da are evaluated in x_k */ cpl_matrix_fill(alpha, 0.0); cpl_matrix_fill(beta , 0.0); for (k = 0; k < N; k++) { double sm2 = 0.0; /* (sigma_k)^-2 */ double fx_k = 0.0; /* f(x_k) */ const double *x_k = &(x[0+k*D]); /* x_k */ if (sigma == NULL) { sm2 = 1.0; } else { sm2 = 1.0 / (sigma[k] * sigma[k]); } /* Evaluate f(x_k) */ cpl_ensure( f(x_k, a, &fx_k) == 0, CPL_ERROR_ILLEGAL_INPUT, -1); /* Evaluate (all) df/da (x_k) */ cpl_ensure( dfda(x_k, a, partials) == 0, CPL_ERROR_ILLEGAL_INPUT, -1); for (i = 0, imfit = 0; i < M; i++) { if (ia[i] != 0) { /* Beta */ beta_data[imfit] += sm2 * (y[k] - fx_k) * partials[i]; /* Alpha is symmetrical, so compute only lower-left part */ for (j = 0, jmfit = 0; j < i; j++) { if (ia[j] != 0) { alpha_data[jmfit + imfit*Mfit] += sm2 * partials[i] * partials[j]; jmfit += 1; } } /* Alpha, diagonal terms */ j = i; jmfit = imfit; alpha_data[jmfit + imfit*Mfit] += sm2 * partials[i] * partials[j] * (1 + lambda); imfit += 1; } } assert( imfit == Mfit ); } /* Create upper-right part of alpha */ for (i = 0, imfit = 0; i < M; i++) { if (ia[i] != 0) { for (j = i+1, jmfit = imfit+1; j < M; j++) { if (ia[j] != 0) { alpha_data[jmfit + imfit*Mfit] = alpha_data[imfit + jmfit*Mfit]; jmfit += 1; } } assert( jmfit == Mfit ); imfit += 1; } } assert( imfit == Mfit ); da = cpl_matrix_solve(alpha, beta); cpl_ensure(da != NULL, cpl_error_get_code(), -1); /* Create a+da vector by adding a and da */ da_data = cpl_matrix_get_data(da); for (i = 0, imfit = 0; i < M; i++) { if (ia[i] != 0) { a_da[i] = a[i] + da_data[0 + imfit*1]; imfit += 1; } else { a_da[i] = a[i]; } } assert( imfit == Mfit ); cpl_matrix_delete(da); return 0; } /*----------------------------------------------------------------------------*/ /* @brief Compute chi square @param N Number of positions @param D Dimension of x-positions @param f Function that evaluates the fit function. @param a The fit parameters. @param x Where to evaluate the fit function (N x D matrix). @param y The N values to fit. @param sigma A vector of size N containing the uncertainties of the y-values. If NULL, a constant uncertainty equal to 1 is assumed. @return chi square, or a negative number on error. This function calculates chi square defined as sum_i (y_i - f(x_i, a))^2/sigma_i^2 Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if the fit function could not be evaluated */ /*----------------------------------------------------------------------------*/ inline static double get_chisq(cpl_size N, cpl_size D, int (*f)(const double x[], const double a[], double *result), const double *a, const double *x, const double *y, const double *sigma) { double chi_sq = 0.0; /* Result */ cpl_size i; /* For efficiency, don't check input in this static function */ for (i = 0; i < N; i++) { double fx_i; double residual; /* Residual in units of uncertainty */ const double *x_i = &(x[0+i*D]); /* Evaluate */ cpl_ensure( f(x_i, a, &fx_i) == 0, CPL_ERROR_ILLEGAL_INPUT, -1.0); /* Accumulate */ if (sigma == NULL) { residual = (fx_i - y[i]); } else { residual = (fx_i - y[i]) / sigma[i]; } chi_sq += residual*residual; } return chi_sq; } /*----------------------------------------------------------------------------*/ /* @brief Fit a function to a set of data @param x N x D matrix of the positions to fit. Each matrix row is a D-dimensional position. @param sigma_x Uncertainty (one sigma, gaussian errors assumed) assosiated with @em x. Taking into account the uncertainty of the independent variable is currently unsupported, and this parameter must therefore be set to NULL. @param y The N values to fit. @param sigma_y Vector of size N containing the uncertainties of the y-values. If this parameter is NULL, constant uncertainties are assumed. @param a Vector containing M fit parameters. Must contain a guess solution on input and contains the best fit parameters on output. @param ia Array of size M defining which fit parameters participate in the fit (non-zero) and which fit parameters are held constant (zero). At least one element must be non-zero. Alternatively, pass NULL to fit all parameters. @param f Function that evaluates the fit function at the position specified by the first argument (an array of size D) using the fit parameters specified by the second argument (an array of size M). The result must be output using the third parameter, and the function must return zero iff the evaluation succeded. @param dfda Function that evaluates the first order partial derivatives of the fit function with respect to the fit parameters at the position specified by the first argument (an array of size D) using the parameters specified by the second argument (an array of size M). The result must be output using the third parameter (array of size M), and the function must return zero iff the evaluation succeded. @param relative_tolerance The algorithm converges by definition if the relative decrease in chi squared is less than @em tolerance @em tolerance_count times in a row. Recommended default: CPL_FIT_LVMQ_TOLERANCE @param tolerance_count The algorithm converges by definition if the relative decrease in chi squared is less than @em tolerance @em tolerance_count times in a row. Recommended default: CPL_FIT_LVMQ_COUNT @param max_iterations If this number of iterations is reached without convergence, the algorithm diverges, by definition. Recommended default: CPL_FIT_LVMQ_MAXITER @param mse If non-NULL, the mean squared error of the best fit is computed. @param red_chisq If non-NULL, the reduced chi square of the best fit is computed. This requires @em sigma_y to be specified. @param covariance If non-NULL, the formal covariance matrix of the best fit parameters is computed (or NULL on error). On success the diagonal terms of the covariance matrix are guaranteed to be positive. However, terms that involve a constant parameter (as defined by the input array @em ia) are always set to zero. Computation of the covariacne matrix requires @em sigma_y to be specified. @return CPL_ERROR_NONE iff OK. This function makes a minimum chi squared fit of the specified function to the specified data set using a Levenberg-Marquardt algorithm. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer other than @em sigma_x, @em sigma_y, @em mse, @em red_chisq or @em covariance is NULL. - CPL_ERROR_ILLEGAL_INPUT if an input matrix/vector is empty, if @em ia contains only zero values, if any of @em relative_tolerance, @em tolerance_count or max_iterations @em is non-positive, if N <= M and @em red_chisq is non-NULL, if any element of @em sigma_x or @em sigma_y is non-positive, or if evaluation of the fit function or its derivative failed. - CPL_ERROR_INCOMPATIBLE_INPUT if the dimensions of the input vectors/matrices do not match, or if chi square or covariance computation is requested and @em sigma_y is NULL. - CPL_ERROR_ILLEGAL_OUTPUT if memory allocation failed. - CPL_ERROR_CONTINUE if the Levenberg-Marquardt algorithm failed to converge. - CPL_ERROR_SINGULAR_MATRIX if the covariance matrix could not be computed. */ /*----------------------------------------------------------------------------*/ inline static cpl_error_code cpl_fit_lvmq_(const cpl_matrix *x, const cpl_matrix *sigma_x, const cpl_vector *y, const cpl_vector *sigma_y, cpl_vector *a, const int ia[], int (*f)(const double x[], const double a[], double *result), int (*dfda)(const double x[], const double a[], double result[]), double relative_tolerance, int tolerance_count, int max_iterations, double *mse, double *red_chisq, cpl_matrix **covariance) { const double *x_data = NULL; /* Pointer to input data */ const double *y_data = NULL; /* Pointer to input data */ const double *sigma_data = NULL; /* Pointer to input data */ cpl_size N = 0; /* Number of data points */ cpl_size D = 0; /* Dimension of x-points */ cpl_size M = 0; /* Number of fit parameters */ cpl_size Mfit = 0; /* Number of non-constant fit parameters */ double lambda = 0.0; /* Lambda in L-M algorithm */ double MAXLAMBDA = 10e40; /* Parameter to control the graceful exit if steepest descent unexpectedly fails */ double chi_sq = 0.0; /* Current chi^2 */ int count = 0; /* Number of successive small improvements in chi^2 */ int iterations = 0; cpl_matrix *alpha = NULL; /* The MxM ~curvature matrix used in L-M */ cpl_matrix *beta = NULL; /* Mx1 matrix = -.5 grad(chi^2) */ double *a_data = NULL; /* Parameters, a */ double *a_da = NULL; /* Candidate position a+da */ double *part = NULL; /* The partial derivatives df/da */ int *ia_local = NULL; /* non-NULL version of ia */ /* If covariance computation is requested, then either * return the covariance matrix or return NULL. */ if (covariance != NULL) *covariance = NULL; /* Validate input */ cpl_ensure_code(x != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(sigma_x == NULL, CPL_ERROR_UNSUPPORTED_MODE); cpl_ensure_code(y != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(a != NULL, CPL_ERROR_NULL_INPUT); /* ia may be NULL */ cpl_ensure_code(f != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(dfda != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(relative_tolerance > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(tolerance_count > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(max_iterations > 0, CPL_ERROR_ILLEGAL_INPUT); /* Chi^2 and covariance computations require sigmas to be known */ cpl_ensure_code( sigma_y != NULL || (red_chisq == NULL && covariance == NULL), CPL_ERROR_INCOMPATIBLE_INPUT); D = cpl_matrix_get_ncol(x); N = cpl_matrix_get_nrow(x); M = cpl_vector_get_size(a); cpl_ensure_code(N > 0 && D > 0 && M > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code( cpl_vector_get_size(y) == N, CPL_ERROR_INCOMPATIBLE_INPUT); x_data = cpl_matrix_get_data_const(x); y_data = cpl_vector_get_data_const(y); a_data = cpl_vector_get_data(a); if (sigma_y != NULL) { cpl_ensure_code( cpl_vector_get_size(sigma_y) == N, CPL_ERROR_INCOMPATIBLE_INPUT); /* Sigmas must be positive */ cpl_ensure_code( cpl_vector_get_min (sigma_y) > 0, CPL_ERROR_ILLEGAL_INPUT); sigma_data = cpl_vector_get_data_const(sigma_y); } ia_local = cpl_malloc((size_t)M * sizeof(int)); cpl_ensure_code(ia_local != NULL, CPL_ERROR_ILLEGAL_OUTPUT); /* Count non-constant fit parameters, copy ia */ if (ia != NULL) { cpl_size i; Mfit = 0; for (i = 0; i < M; i++) { ia_local[i] = ia[i]; if (ia[i] != 0) { Mfit += 1; } } if (! (Mfit > 0)) { cpl_free(ia_local); return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } } else { /* All parameters participate */ cpl_size i; Mfit = M; for (i = 0; i < M; i++) { ia_local[i] = 1; } } /* To compute reduced chi^2, we need N > Mfit */ if (! ( red_chisq == NULL || N > Mfit ) ) { cpl_free(ia_local); return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } /* Create alpha, beta, a_da, part work space */ alpha = cpl_matrix_new(Mfit, Mfit); if (alpha == NULL) { cpl_free(ia_local); return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } beta = cpl_matrix_new(Mfit, 1); if (beta == NULL) { cpl_free(ia_local); cpl_matrix_delete(alpha); return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } a_da = cpl_malloc((size_t)M * sizeof(double)); if (a_da == NULL) { cpl_free(ia_local); cpl_matrix_delete(alpha); cpl_matrix_delete(beta); return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } part = cpl_malloc((size_t)M * sizeof(double)); if (part == NULL) { cpl_free(ia_local); cpl_matrix_delete(alpha); cpl_matrix_delete(beta); cpl_free(a_da); return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } /* Initialize loop variables */ lambda = 0.001; count = 0; iterations = 0; if( (chi_sq = get_chisq(N, D, f, a_data, x_data, y_data, sigma_data)) < 0) { cpl_free(ia_local); cpl_matrix_delete(alpha); cpl_matrix_delete(beta); cpl_free(a_da); cpl_free(part); return cpl_error_set_where_(); } /* Iterate until chi^2 didn't improve significantly many times in a row (where 'many' is defined by tolerance_count) */ while (count < tolerance_count && lambda < MAXLAMBDA && iterations < max_iterations) { /* In each iteration lambda increases, or chi^2 decreases or count increases. Because chi^2 is bounded from below (and lambda and count from above), the loop will terminate */ double chi_sq_candidate = 0.0; double chi_sq_diff; int canderror; int cont = 3; /* Try to get a candidate this many times */ /* Get candidate position in parameter space = a+da, * where alpha * da = beta . * Increase lambda until alpha is non-singular */ do { cpl_errorstate prevstate = cpl_errorstate_get(); canderror = get_candidate(a_data, ia_local, M, N, D, lambda, f, dfda, x_data, y_data, sigma_data, part, alpha, beta, a_da); cont--; if (canderror || !cpl_errorstate_is_equal(prevstate)) { if (cont > 0 && !cpl_errorstate_is_equal(prevstate) && cpl_error_get_code() == CPL_ERROR_SINGULAR_MATRIX && lambda < MAXLAMBDA) { /* Recover since lambda did not diverge */ lambda *= 9.0; cpl_errorstate_set(prevstate); canderror = 1; /* Ensure another try */ } else { cpl_free(ia_local); cpl_matrix_delete(alpha); cpl_matrix_delete(beta); cpl_free(a_da); cpl_free(part); /* Set error either if lambda diverged or if get_candidate() failed in some other way */ return cpl_error_set_message_(cpl_error_get_code() == CPL_ERROR_SINGULAR_MATRIX ? CPL_ERROR_CONTINUE : cpl_error_get_code(), "get_candidate()=%d. cont=%d. " "lambda = %g", canderror, cont, lambda); } } } while (canderror); /* Get chi^2(a+da) */ chi_sq_candidate = get_chisq(N, D, f, a_da, x_data, y_data, sigma_data); /* Check for invalid candidate, including NaN */ if (chi_sq_candidate < 0.0 || chi_sq_candidate != chi_sq_candidate) { cpl_free(ia_local); cpl_matrix_delete(alpha); cpl_matrix_delete(beta); cpl_free(a_da); cpl_free(part); return cpl_error_get_code() ? cpl_error_set_where_() : cpl_error_set_(CPL_ERROR_CONTINUE); } chi_sq_diff = chi_sq_candidate - chi_sq; if (chi_sq_diff > sqrt(DBL_EPSILON) ) { /* Move towards steepest descent */ lambda *= 9.0; } else { /* Move towards Newton's algorithm */ lambda /= 10.0; /* Count the number of successive improvements in chi^2 of less than 0.01 (default) relative */ if ( chi_sq < sqrt(DBL_EPSILON) || (chi_sq - chi_sq_candidate)/chi_sq < relative_tolerance) { count += 1; } else { /* Chi^2 improved by a significant amount, reset counter */ count = 0; } /* chi^2 improved, update a and chi^2 */ { cpl_size i; for (i = 0; i < M; i++) a_data[i] = a_da[i]; } chi_sq = chi_sq_candidate; } iterations++; } /* Set error if we didn't converge */ if ( !( lambda < MAXLAMBDA && iterations < max_iterations ) ) { cpl_free(ia_local); cpl_matrix_delete(alpha); cpl_matrix_delete(beta); cpl_free(a_da); cpl_free(part); return cpl_error_set_(CPL_ERROR_CONTINUE); } /* Compute mse if requested */ if (mse != NULL) { cpl_size i; *mse = 0.0; for(i = 0; i < N; i++) { double fx_i = 0.0; double residual = 0.0; /* Evaluate f(x_i) at the best fit parameters */ if( f(&(x_data[i*D]), a_data, &fx_i) != 0) { cpl_free(ia_local); cpl_matrix_delete(alpha); cpl_matrix_delete(beta); cpl_free(a_da); cpl_free(part); return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } residual = y_data[i] - fx_i; *mse += residual * residual; } *mse /= (double)N; } /* Compute reduced chi^2 if requested */ if (red_chisq != NULL) { /* We already know the optimal chi^2 (and that N > Mfit)*/ *red_chisq = chi_sq / (double)(N-Mfit); } /* Compute covariance matrix if requested * cov = alpha(lambda=0)^-1 */ if (covariance != NULL) { cpl_matrix *cov; if( get_candidate(a_data, ia_local, M, N, D, 0.0, f, dfda, x_data, y_data, sigma_data, part, alpha, beta, a_da) != 0) { cpl_free(ia_local); cpl_matrix_delete(alpha); cpl_matrix_delete(beta); cpl_free(a_da); cpl_free(part); return cpl_error_set_where_(); } cov = cpl_matrix_invert_create(alpha); if (cov == NULL) { cpl_free(ia_local); cpl_matrix_delete(alpha); cpl_matrix_delete(beta); cpl_free(a_da); cpl_free(part); return cpl_error_set_where_(); } /* Make sure that variances are positive */ { cpl_size i; for (i = 0; i < Mfit; i++) { if ( !(cpl_matrix_get(cov, i, i) > 0) ) { cpl_free(ia_local); cpl_matrix_delete(alpha); cpl_matrix_delete(beta); cpl_free(a_da); cpl_free(part); cpl_matrix_delete(cov); *covariance = NULL; return cpl_error_set_(CPL_ERROR_SINGULAR_MATRIX); } } } /* Expand covariance matrix from Mfit x Mfit to M x M. Set rows/columns corresponding to fixed parameters to zero */ *covariance = cpl_matrix_new(M, M); if (*covariance == NULL) { cpl_free(ia_local); cpl_matrix_delete(alpha); cpl_matrix_delete(beta); cpl_free(a_da); cpl_free(part); cpl_matrix_delete(cov); return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } { cpl_size j, jmfit; for (j = 0, jmfit = 0; j < M; j++) if (ia_local[j] != 0) { cpl_size i, imfit; for (i = 0, imfit = 0; i < M; i++) if (ia_local[i] != 0) { cpl_matrix_set(*covariance, i, j, cpl_matrix_get( cov, imfit, jmfit)); imfit += 1; } assert( imfit == Mfit ); jmfit += 1; } assert( jmfit == Mfit ); } cpl_matrix_delete(cov); } cpl_free(ia_local); cpl_matrix_delete(alpha); cpl_matrix_delete(beta); cpl_free(a_da); cpl_free(part); return CPL_ERROR_NONE; } #endif /* CPL_VECTOR_FIT_IMPL_H */ cpl-6.4.1/cplcore/cpl_memory.c0000644000460300003120000002675511713756126013203 00000000000000/* $Id: cpl_memory.c,v 1.39 2012-02-06 13:57:42 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-02-06 13:57:42 $ * $Revision: 1.39 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include "cpl_memory_impl.h" #include "cpl_error_impl.h" #include "cpl_xmemory.h" /** * @defgroup cpl_memory Memory Management Utilities * * This module provides the CPL memory management utilities. */ /**@{*/ static int cpl_memory_mode = -1; /** * @internal * @brief * Initialise the memory management subsystem. * * @param mode Mode (0: system, 1: Xmemory-count, 2: Xmemory-full) * * @return Nothing. * * The function initialises the CPL memory management subsystem, i.e. it * redirects any request for allocating or deallocating memory to either * the standard functions (free(), malloc(), etc.) or to the * @c cpl_xmemory module. * * This function is called from @c cpl_init(), and although repeated calls * have no effect, it should not be called by any other function. * * @see cpl_init() */ void cpl_memory_init(int mode) { if (cpl_memory_mode < 0) { if (mode == 0) { static const cx_memory_vtable cpl_memory_services_system = { (cxptr(*)(cxsize))malloc, (cxptr (*)(cxsize, cxsize))calloc, (cxptr (*) (cxptr, cxsize))realloc, (void (*) (cxptr))free }; cx_memory_vtable_set(&cpl_memory_services_system); cpl_memory_mode = 0; #ifndef _OPENMP /* Mode 2 is not supported with OpenMP - will default to 1 */ } else if (mode == 2) { static const cx_memory_vtable cpl_memory_services_xmemory = { (cxptr(*)(cxsize))cpl_xmemory_malloc, (cxptr (*)(cxsize, cxsize))cpl_xmemory_calloc, (cxptr (*) (cxptr, cxsize))cpl_xmemory_realloc, (void (*) (cxptr))cpl_xmemory_free }; cx_memory_vtable_set(&cpl_memory_services_xmemory); cpl_memory_mode = 2; #endif } else { static const cx_memory_vtable cpl_memory_services_count = { (cxptr(*)(cxsize))cpl_xmemory_malloc_count, (cxptr (*)(cxsize, cxsize))cpl_xmemory_calloc_count, (cxptr (*) (cxptr, cxsize))cpl_xmemory_realloc_count, (void (*) (cxptr))cpl_xmemory_free_count }; cx_memory_vtable_set(&cpl_memory_services_count); cpl_memory_mode = 1; } } return; } /** * @brief * Allocate @em nbytes bytes. * * @param nbytes Number of bytes. * * @return Pointer to the allocated memory block. * * The function allocates @em nbytes bytes of memory. The allocated memory * is not cleared. * * @note * If the memory subsytem has not been initialised before calling * this function, the program execution is stopped printing a message to * the error channel showing the current code position. * */ void * cpl_malloc(size_t nbytes) { if (cpl_memory_mode < 0) { cx_log(CX_LOG_DOMAIN, CX_LOG_LEVEL_ERROR, "%s: CPL " PACKAGE_VERSION " memory management subsystem is not initialized!", CX_CODE_POS); } return cx_malloc((cxsize)nbytes); } /** * @brief * Allocate memory for @em natoms elements of size @em size. * * @param natoms Number of atomic elements. * @param nbytes Element size in bytes. * * @return Pointer to the allocated memory block. * * The function allocates memory suitable for storage of @em natoms * elements of size @em nbytes bytes. The allocated memory is cleared, * i.e. the value 0 is written to each single byte. * * @note * If the memory subsytem has not been initialised before calling * this function, the program execution is stopped printing a message to * the error channel showing the current code position. */ void * cpl_calloc(size_t natoms, size_t nbytes) { if (cpl_memory_mode < 0) { cx_log(CX_LOG_DOMAIN, CX_LOG_LEVEL_ERROR, "%s: CPL " PACKAGE_VERSION " memory management subsystem is not initialized!", CX_CODE_POS); } return cx_calloc((cxsize)natoms, (cxsize)nbytes); } /** * @brief * Change the size of a memory block. * * @param memblk Pointer to the memory to re-allocate. * @param nbytes New memory block size in bytes. * * @return Pointer to the allocated memory block. * * The function changes the size of an already allocated memory block * @em memblk to the new size @em nbytes bytes. The contents is unchanged * to the minimum of old and new size; newly allocated memory is not * initialized. If @em memblk is @c NULL the call to @b cpl_realloc() * is equivalent to @b cpl_malloc(), and if @em nbytes is 0 the call * is equivalent to @b cpl_free(). Unless @em memblk is @c NULL, it must * have been returned by a previous call to @b cpl_malloc(), * @b cpl_calloc(), or @b cpl_realloc(). * * @note * - The returned memory block returned on successfull allocation may * not be the same as the one pointed to by @em memblk. Existing * references pointing to locations within the original memory block * might be invalidated! * - If the memory subsytem has not been initialised before calling * this function, the program execution is stopped printing a message to * the error channel showing the current code position. * * @see cpl_malloc(), cpl_calloc() */ void * cpl_realloc(void *memblk, size_t nbytes) { if (cpl_memory_mode < 0) { cx_log(CX_LOG_DOMAIN, CX_LOG_LEVEL_ERROR, "%s: CPL " PACKAGE_VERSION " memory management subsystem is not initialized!", CX_CODE_POS); } return cx_realloc(memblk, (cxsize)nbytes); } /** * @brief * Memory block deallocation. * * @return Nothing. * * Deallocates a memory block previously allocated by any of the CPL * allocator functions. * * @see cpl_malloc(), cpl_calloc() */ void cpl_free(void *memblk) { if (cpl_memory_mode < 0) { cx_log(CX_LOG_DOMAIN, CX_LOG_LEVEL_ERROR, "%s: CPL " PACKAGE_VERSION " memory management subsystem is not initialized!", CX_CODE_POS); } cx_free(memblk); return; } /** * @brief * Duplicate a string. * * @param string String to be duplicated. * * @return Newly allocated copy of the original string. * * Duplicates the input string @em string. The newly allocated copy returned * to the caller can be deallocated using @b cpl_free(). * * @see cpl_free() */ char *cpl_strdup(const char *string) { if (cpl_memory_mode < 0) { cx_log(CX_LOG_DOMAIN, CX_LOG_LEVEL_ERROR, "%s: CPL " PACKAGE_VERSION " memory management subsystem is not initialized!", CX_CODE_POS); } return cx_strdup(string); } /*----------------------------------------------------------------------------*/ /** * @brief Create a string and fill it in an vsprintf()-like manner * @param format The format string * @param arglist The argument list for the format * @return The created string or NULL on error * @note The created string must be deallocated with cpl_free() * @see vsprintf() * * The allocated memory is exactly what is needed to hold the string. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The format string is NULL. *
CPL_ERROR_ILLEGAL_INPUT * The format string has an invalid format. *
* @enderror * */ /*----------------------------------------------------------------------------*/ char * cpl_vsprintf(const char * format, va_list arglist) { char * self = NULL; int nlen; if (cpl_memory_mode < 0) { cx_log(CX_LOG_DOMAIN, CX_LOG_LEVEL_ERROR, "%s: CPL " PACKAGE_VERSION " memory management subsystem is not initialized!", CX_CODE_POS); } cpl_ensure(format != NULL, CPL_ERROR_NULL_INPUT, NULL); nlen = (int)cx_vasprintf((cxchar **)&self, (const cxchar *)format, arglist); /* The format string may be invalid */ if (nlen < 0) { cx_free(self); self = NULL; (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "cx_vasprintf() " "failed with %d on format=%s", nlen, format); } else if (self == NULL) { (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "cx_vasprintf() " "returned %d but set self=NULL on " "format=%s", nlen, format); } return self; } /*----------------------------------------------------------------------------*/ /** * @brief Create a string and fill it in an sprintf()-like manner * @param format The format string * @param ... Variable argument list for format * @return The created string or NULL on error * @note The created string must be deallocated with cpl_free() * @see cpl_vsprintf() * * The allocated memory is exactly what is needed to hold the string. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The format string is NULL. *
CPL_ERROR_ILLEGAL_INPUT * The format string has an invalid format. *
* @enderror * * * Example of usage: * @code * * int error; * * char * cp_cmd = cpl_sprintf("cp %s %s/%s", long_file, new_dir, * new_file); * assert( cp_cmd != NULL); * * error = system(cp_cmd); * * assert(!error); * * cpl_free(cp_cmd); * * @endcode * */ /*----------------------------------------------------------------------------*/ char * cpl_sprintf(const char * format, ...) { char * self; va_list arglist; cpl_ensure(format != NULL, CPL_ERROR_NULL_INPUT, NULL); va_start(arglist, format); self = cpl_vsprintf(format, arglist); va_end(arglist); cpl_ensure(self != NULL, cpl_error_get_code(), NULL); return self; } /** * @brief Tell if there is some memory allocated * @return -1 if the model is off, 1 if it is empty, 0 otherwise */ int cpl_memory_is_empty(void) { return cpl_xmemory_is_empty(cpl_memory_mode); } /** * @brief Display the memory status */ void cpl_memory_dump(void) { cpl_xmemory_status(cpl_memory_mode); return; } /**@}*/ cpl-6.4.1/cplcore/cpl_func.h.top0000644000460300003120000000177210501543627013416 00000000000000/* * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * Do not edit this file! This file was automatically generated. * All changes to this file might be lost! */ #ifndef CPL_FUNC_H #define CPL_FUNC_H #include cpl-6.4.1/cplcore/cpl_image_io_body.h0000644000460300003120000004416712127027130014445 00000000000000/* $Id: cpl_image_io_body.h,v 1.59 2013-04-03 13:27:52 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #if defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_IO_RE_IM if (preal != NULL && pimag != NULL) { const size_t nxy = (size_t)(self->nx * self->ny); size_t i; for (i = 0; i < nxy; i++) { preal[i] = CPL_CREAL(pself[i]); pimag[i] = CPL_CIMAG(pself[i]); } } else { error = CPL_ERROR_TYPE_MISMATCH; } #elif defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_IO_RE if (preal != NULL) { const size_t nxy = (size_t)(self->nx * self->ny); size_t i; for (i = 0; i < nxy; i++) { preal[i] = CPL_CREAL(pself[i]); } } else { error = CPL_ERROR_TYPE_MISMATCH; } #elif defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_IO_IM if (pimag != NULL) { const size_t nxy = (size_t)(self->nx * self->ny); size_t i; for (i = 0; i < nxy; i++) { pimag[i] = CPL_CIMAG(pself[i]); } } else { error = CPL_ERROR_TYPE_MISMATCH; } #elif defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_IO_ABS_ARG if (pabs != NULL && parg != NULL) { const size_t nxy = (size_t)(self->nx * self->ny); size_t i; for (i = 0; i < nxy; i++) { pabs[i] = CPL_CABS(pself[i]); parg[i] = CPL_CARG(pself[i]); } } else { error = CPL_ERROR_TYPE_MISMATCH; } #elif defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_IO_ABS if (pabs != NULL) { const size_t nxy = (size_t)(self->nx * self->ny); size_t i; for (i = 0; i < nxy; i++) { pabs[i] = CPL_CABS(pself[i]); } } else { error = CPL_ERROR_TYPE_MISMATCH; } #elif defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_IO_ARG if (parg != NULL) { const size_t nxy = (size_t)(self->nx * self->ny); size_t i; for (i = 0; i < nxy; i++) { parg[i] = CPL_CARG(pself[i]); } } else { error = CPL_ERROR_TYPE_MISMATCH; } #else /* Type dependent macros */ #if defined CPL_CLASS && CPL_CLASS == CPL_CLASS_DOUBLE #define CPL_TYPE double /* Cannot concatenate the reserved macro complex :-( */ #define CPL_TYPE_C double_complex #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_CONJ conj #define CPL_CREAL creal #define CPL_CIMAG cimag #define CPL_CABS cabs #define CPL_CARG carg #define CPL_CFITSIO_TYPE TDOUBLE #elif defined CPL_CLASS && CPL_CLASS == CPL_CLASS_FLOAT #define CPL_TYPE float /* Cannot concatenate the reserved macro complex :-( */ #define CPL_TYPE_C float_complex #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_CONJ conjf #define CPL_CREAL crealf #define CPL_CIMAG cimagf #define CPL_CABS cabsf #define CPL_CARG cargf #define CPL_CFITSIO_TYPE TFLOAT #elif defined CPL_CLASS && CPL_CLASS == CPL_CLASS_INT #define CPL_TYPE int #define CPL_TYPE_T CPL_TYPE_INT #define CPL_CFITSIO_TYPE TINT #elif defined CPL_CLASS && CPL_CLASS == CPL_CLASS_DOUBLE_COMPLEX #define CPL_TYPE double complex #define CPL_TYPE_T CPL_TYPE_DOUBLE_COMPLEX /* NOTE: Saving unsupported */ #elif defined CPL_CLASS && CPL_CLASS == CPL_CLASS_FLOAT_COMPLEX #define CPL_TYPE float complex #define CPL_TYPE_T CPL_TYPE_FLOAT_COMPLEX /* NOTE: Saving unsupported */ #else #undef CPL_TYPE #undef CPL_TYPE_T #undef CPL_CFITSIO_TYPE #endif #define CPL_TYPE_ADD(a) CPL_CONCAT2X(a, CPL_TYPE) #define CPL_TYPE_ADD_CONST(a) CPL_CONCAT3X(a, CPL_TYPE, const) #define CPL_TYPE_ADD_COMPLEX(a) CPL_CONCAT2X(a, CPL_TYPE_C) #define CPL_TYPE_ADD_COMPLEX_CONST(a) CPL_CONCAT3X(a, CPL_TYPE_C, const) #if defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_IO_GET case CPL_TYPE_T: { const CPL_TYPE * pi = (CPL_TYPE*)image->pixels; value = (CPL_TYPE_RETURN)pi[pos]; break; } #elif defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_IO_SET case CPL_TYPE_T: { CPL_TYPE * pi = (CPL_TYPE*)image->pixels; pi[pos] = (CPL_TYPE)value; break; } #elif defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_IO_GET_PIXELS /* Test entries */ cpl_ensure(img, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(img->type == CPL_TYPE_T, CPL_ERROR_TYPE_MISMATCH, NULL); return (CPL_CONST CPL_TYPE*)img->pixels; #elif defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_IO_SET_BADPIXEL case CPL_TYPE_T: { CPL_TYPE * pi = (CPL_TYPE*)im->pixels; const CPL_TYPE acast = (const CPL_TYPE) a; const size_t nxy = (size_t)(im->nx * im->ny); size_t i; for (i = 0; i < nxy; i++) if (pbpm[i] == CPL_BINARY_1) pi[i] = acast; break; } #elif !defined(CPL_OPERATION) static cpl_error_code CPL_TYPE_ADD(cpl_image_fill_re_im)(cpl_image *, cpl_image *, const cpl_image *); static cpl_error_code CPL_TYPE_ADD(cpl_image_fill_re)(cpl_image *, const cpl_image *); static cpl_error_code CPL_TYPE_ADD(cpl_image_fill_im)(cpl_image *, const cpl_image *); static cpl_error_code CPL_TYPE_ADD(cpl_image_fill_abs_arg)(cpl_image *, cpl_image *, const cpl_image *); static cpl_error_code CPL_TYPE_ADD(cpl_image_fill_abs)(cpl_image *, const cpl_image *); static cpl_error_code CPL_TYPE_ADD(cpl_image_fill_arg)(cpl_image *, const cpl_image *); static cpl_error_code CPL_TYPE_ADD(cpl_image_conjugate)(cpl_image *, const cpl_image *) CPL_ATTR_NONNULL; /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Split a complex image into its real and/or imaginary part(s) @param im_real Pre-allocated image to hold the real part, or @c NULL @param im_imag Pre-allocated image to hold the imaginary part, or @c NULL @param self Complex image to process @return CPL_ERROR_NONE or #_cpl_error_code_ on error @note At least one output image must be non-NULL. The images must match in size and precision @see cpl_image_fill_re_im() */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_image_fill_re_im)(cpl_image * im_real, cpl_image * im_imag, const cpl_image * self) { #define CPL_OPERATION CPL_IMAGE_IO_RE_IM const CPL_TYPE complex * pself = CPL_TYPE_ADD_COMPLEX_CONST(cpl_image_get_data)(self); cpl_error_code error = CPL_ERROR_NONE; cpl_ensure_code(im_real != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(im_imag != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pself != NULL, CPL_ERROR_INVALID_TYPE); if ((im_real->type & CPL_TYPE_COMPLEX) && (im_imag->type & CPL_TYPE_COMPLEX)) { CPL_TYPE complex * preal = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(im_real); CPL_TYPE complex * pimag = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(im_imag); #include "cpl_image_io_body.h" } else if (im_real->type & CPL_TYPE_COMPLEX) { CPL_TYPE complex * preal = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(im_real); CPL_TYPE * pimag = CPL_TYPE_ADD(cpl_image_get_data)(im_imag); #include "cpl_image_io_body.h" } else if (im_imag->type & CPL_TYPE_COMPLEX) { CPL_TYPE * preal = CPL_TYPE_ADD(cpl_image_get_data)(im_real); CPL_TYPE complex * pimag = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(im_imag); #include "cpl_image_io_body.h" } else { CPL_TYPE * preal = CPL_TYPE_ADD(cpl_image_get_data)(im_real); CPL_TYPE * pimag = CPL_TYPE_ADD(cpl_image_get_data)(im_imag); #include "cpl_image_io_body.h" } return error ? cpl_error_set_(error) : CPL_ERROR_NONE; #undef CPL_OPERATION } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Fill an image with the real part of a complex image @param im_real Pre-allocated image to hold the real part @param self Complex image to process @return CPL_ERROR_NONE or #_cpl_error_code_ on error @note The images must match in size and precision @see cpl_image_fill_re_im() */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_image_fill_re)(cpl_image * im_real, const cpl_image * self) { #define CPL_OPERATION CPL_IMAGE_IO_RE const CPL_TYPE complex * pself = CPL_TYPE_ADD_COMPLEX_CONST(cpl_image_get_data)(self); cpl_error_code error = CPL_ERROR_NONE; cpl_ensure_code(im_real != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pself != NULL, CPL_ERROR_INVALID_TYPE); if (im_real->type & CPL_TYPE_COMPLEX) { CPL_TYPE complex * preal = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(im_real); #include "cpl_image_io_body.h" } else { CPL_TYPE * preal = CPL_TYPE_ADD(cpl_image_get_data)(im_real); #include "cpl_image_io_body.h" } return error ? cpl_error_set_(error) : CPL_ERROR_NONE; #undef CPL_OPERATION } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Fill an image with the imaginary part of a complex image @param im_imag Pre-allocated image to hold the imaginary part @param self Complex image to process @return CPL_ERROR_NONE or #_cpl_error_code_ on error @note The images must match in size and precision @see cpl_image_fill_re_im() */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_image_fill_im)(cpl_image * im_imag, const cpl_image * self) { #define CPL_OPERATION CPL_IMAGE_IO_IM const CPL_TYPE complex * pself = CPL_TYPE_ADD_COMPLEX_CONST(cpl_image_get_data)(self); cpl_error_code error = CPL_ERROR_NONE; cpl_ensure_code(im_imag != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pself != NULL, CPL_ERROR_INVALID_TYPE); if (im_imag->type & CPL_TYPE_COMPLEX) { CPL_TYPE complex * pimag = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(im_imag); #include "cpl_image_io_body.h" } else { CPL_TYPE * pimag = CPL_TYPE_ADD(cpl_image_get_data)(im_imag); #include "cpl_image_io_body.h" } return error ? cpl_error_set_(error) : CPL_ERROR_NONE; #undef CPL_OPERATION } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Split a complex image into its absolute and argument part(s) @param im_abs Pre-allocated image to hold the absolute part, or @c NULL @param im_arg Pre-allocated image to hold the argument part, or @c NULL @param self Complex image to process @return CPL_ERROR_NONE or #_cpl_error_code_ on error @note At least one output image must be non-NULL. The images must match in size and precision @see cpl_image_fill_re_im() */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_image_fill_abs_arg)(cpl_image * im_abs, cpl_image * im_arg, const cpl_image * self) { #define CPL_OPERATION CPL_IMAGE_IO_ABS_ARG const CPL_TYPE complex * pself = CPL_TYPE_ADD_COMPLEX_CONST(cpl_image_get_data)(self); cpl_error_code error = CPL_ERROR_NONE; cpl_ensure_code(im_abs != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(im_arg != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pself != NULL, CPL_ERROR_INVALID_TYPE); if ((im_abs->type & CPL_TYPE_COMPLEX) && (im_arg->type & CPL_TYPE_COMPLEX)) { CPL_TYPE complex * pabs = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(im_abs); CPL_TYPE complex * parg = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(im_arg); #include "cpl_image_io_body.h" } else if (im_abs->type & CPL_TYPE_COMPLEX) { CPL_TYPE complex * pabs = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(im_abs); CPL_TYPE * parg = CPL_TYPE_ADD(cpl_image_get_data)(im_arg); #include "cpl_image_io_body.h" } else if (im_arg->type & CPL_TYPE_COMPLEX) { CPL_TYPE * pabs = CPL_TYPE_ADD(cpl_image_get_data)(im_abs); CPL_TYPE complex * parg = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(im_arg); #include "cpl_image_io_body.h" } else { CPL_TYPE * pabs = CPL_TYPE_ADD(cpl_image_get_data)(im_abs); CPL_TYPE * parg = CPL_TYPE_ADD(cpl_image_get_data)(im_arg); #include "cpl_image_io_body.h" } return error ? cpl_error_set_(error) : CPL_ERROR_NONE; #undef CPL_OPERATION } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Fill an image with the absolute part of a complex image @param im_abs Pre-allocated image to hold the absolute part @param self Complex image to process @return CPL_ERROR_NONE or #_cpl_error_code_ on error @note The images must match in size and precision @see cpl_image_fill_abs_arg() */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_image_fill_abs)(cpl_image * im_abs, const cpl_image * self) { #define CPL_OPERATION CPL_IMAGE_IO_ABS const CPL_TYPE complex * pself = CPL_TYPE_ADD_COMPLEX_CONST(cpl_image_get_data)(self); cpl_error_code error = CPL_ERROR_NONE; cpl_ensure_code(im_abs != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pself != NULL, CPL_ERROR_INVALID_TYPE); if (im_abs->type & CPL_TYPE_COMPLEX) { CPL_TYPE complex * pabs = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(im_abs); #include "cpl_image_io_body.h" } else { CPL_TYPE * pabs = CPL_TYPE_ADD(cpl_image_get_data)(im_abs); #include "cpl_image_io_body.h" } return error ? cpl_error_set_(error) : CPL_ERROR_NONE; #undef CPL_OPERATION } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Fill an image with the argument part of a complex image @param im_arg Pre-allocated image to hold the argument part, or @c NULL @param self Complex image to process @return CPL_ERROR_NONE or #_cpl_error_code_ on error @note At least one output image must be non-NULL. The images must match in size and precision @see cpl_image_fill_re_im() */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_image_fill_arg)(cpl_image * im_arg, const cpl_image * self) { #define CPL_OPERATION CPL_IMAGE_IO_ARG const CPL_TYPE complex * pself = CPL_TYPE_ADD_COMPLEX_CONST(cpl_image_get_data)(self); cpl_error_code error = CPL_ERROR_NONE; cpl_ensure_code(im_arg != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pself != NULL, CPL_ERROR_INVALID_TYPE); if (im_arg->type & CPL_TYPE_COMPLEX) { CPL_TYPE complex * parg = CPL_TYPE_ADD_COMPLEX(cpl_image_get_data)(im_arg); #include "cpl_image_io_body.h" } else { CPL_TYPE * parg = CPL_TYPE_ADD(cpl_image_get_data)(im_arg); #include "cpl_image_io_body.h" } return error ? cpl_error_set_(error) : CPL_ERROR_NONE; #undef CPL_OPERATION } /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @brief Complex conjugate the pixels in a complex image of a specific type @param self Pre-allocated complex image to hold the result @param other The complex image to conjugate, may equal self @return CPL_ERROR_NONE or #_cpl_error_code_ on error @note The two images must match in size and precision @see cpl_image_conjugate() */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_image_conjugate)(cpl_image * self, const cpl_image * other) { CPL_TYPE complex * pout = CPL_TYPE_ADD_COMPLEX (cpl_image_get_data)(self); const CPL_TYPE complex * pin = CPL_TYPE_ADD_COMPLEX_CONST (cpl_image_get_data)(other); const size_t nxy = (size_t)(self->nx * self->ny); size_t i; cpl_ensure_code(pout != NULL, CPL_ERROR_INVALID_TYPE); cpl_ensure_code(pin != NULL, CPL_ERROR_INVALID_TYPE); for (i = 0; i < nxy; i++) { pout[i] = CPL_CONJ(pin[i]); } return CPL_ERROR_NONE; } #endif #undef CPL_TYPE #undef CPL_TYPE_C #undef CPL_TYPE_T #undef CPL_CFITSIO_TYPE #undef CPL_CONJ #undef CPL_CREAL #undef CPL_CIMAG #undef CPL_CABS #undef CPL_CARG #undef CPL_TYPE_ADD #undef CPL_TYPE_ADD_CONST #undef CPL_TYPE_ADD_COMPLEX #undef CPL_TYPE_ADD_COMPLEX_CONST #endif cpl-6.4.1/cplcore/cpl_test.c0000644000460300003120000036022212307363436012636 00000000000000/* $Id: cpl_test.c,v 1.125 2013-07-11 08:21:09 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-07-11 08:21:09 $ * $Revision: 1.125 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_test.h" #include "cpl_init.h" #include "cpl_errorstate.h" #include "cpl_memory.h" #include "cpl_msg.h" #include "cpl_tools.h" #include "cpl_stats.h" #include "cpl_io_fits.h" #include "cpl_image_io_impl.h" #include "cpl_image_basic_impl.h" #include #include #include #include /* Needed for fabs() */ #include /* Needed for cabs() */ #include #undef CPL_HAVE_TIMES #ifdef HAVE_SYS_TIMES_H #include #ifdef HAVE_TIME_H #include #ifdef HAVE_UNISTD_H #include #define CPL_HAVE_TIMES #endif #endif #endif #ifdef HAVE_SYS_STAT_H #include #include #ifdef HAVE_UNISTD_H #include #endif #endif #undef CPL_HAVE_CLOCK_GETTIME #undef CPL_HAVE_GETTIMEOFDAY #ifdef HAVE_TIME_H #ifdef HAVE_CLOCK_GETTIME #include #define CPL_HAVE_CLOCK_GETTIME #endif #endif #ifndef CPL_HAVE_CLOCK_GETTIME #ifdef HAVE_SYS_TIME_H #ifdef HAVE_GETTIMEOFDAY #include #define CPL_HAVE_GETTIMEOFDAY #endif #endif #endif #ifdef HAVE_SYS_TIME_H /* Used for gettimeofday() */ #include #endif /* Needed for CFITSIO_VERSION */ #include #if defined CPL_FFTW_INSTALLED || defined CPL_FFTWF_INSTALLED /* Needed for fftw_version */ #include #endif #if defined CPL_WCS_INSTALLED && CPL_WCS_INSTALLED == 1 /* Used for WCSLIB_VERSION */ #include #endif #ifndef inline #define inline /* inline */ #endif /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_test Unit testing functions * * This module provides various functions for unit testing. * * @par Synopsis: * @code * #include "cpl_test.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Private variables -----------------------------------------------------------------------------*/ static cpl_errorstate cleanstate; static cpl_size cpl_test_count = 0; static cpl_size cpl_test_failures = 0; static const char * cpl_test_report = NULL; static double cpl_test_time_start; static double cpl_test_time_one; static cpl_flops cpl_test_flops_one = 0; /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static void cpl_test_reset(cpl_errorstate); static void cpl_errorstate_dump_debug(unsigned, unsigned, unsigned); static void cpl_errorstate_dump_info(unsigned, unsigned, unsigned); static const char * cpl_test_get_description_a(void) CPL_ATTR_CONST; static const char * cpl_test_get_description_b(void) CPL_ATTR_CONST; static char * cpl_test_get_description(void) CPL_ATTR_ALLOC; static void cpl_test_one(int, double, cpl_flops, cpl_errorstate, cpl_boolean, const char *, cpl_boolean, const char *, const char *, unsigned) CPL_ATTR_NONNULL; static void cpl_test_dump_status(void); static char * cpl_test_fits_file(const char *, const char *) CPL_ATTR_NONNULL; /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Get the process CPU time, when available (from times()) @return The process CPU time in seconds. @note Will always return 0 if times() is unavailable Example of usage: @code int my_benchmark (void) { double cputime, tstop; const double tstart = cpl_test_get_cputime(); myfunc(); tstop = cpl_test_get_cputime(); cputime = tstop - tstart; cpl_msg_info(cpl_func, "The call took %g seconds of CPU-time", cputime); } @endcode */ /*----------------------------------------------------------------------------*/ double cpl_test_get_cputime(void) { #if defined HAVE_SYS_TIMES_H && defined HAVE_SYSCONF && defined _SC_CLK_TCK struct tms buf; (void)times(&buf); return (double)buf.tms_utime / (double)sysconf(_SC_CLK_TCK); #else return 0.0; #endif } /*----------------------------------------------------------------------------*/ /** @brief Get the process wall-clock time, when available @return The process wall-clock time in seconds. @note Will always return 0 if clock_gettime() and gettimeofday() are unavailable or failing @see clock_gettime(), gettimeofday() Example of usage: @code int my_benchmark (void) { double walltime, tstop; const double tstart = cpl_test_get_walltime(); myfunc(); tstop = cpl_test_get_walltime(); walltime = tstop - tstart; cpl_msg_info(cpl_func, "The call took %g seconds of wall-clock time", walltime); } @endcode */ /*----------------------------------------------------------------------------*/ double cpl_test_get_walltime(void) { #ifdef CPL_HAVE_CLOCK_GETTIME struct timespec buf; return clock_gettime(CLOCK_REALTIME, &buf) ? 0.0 : (double)buf.tv_sec + 1.0e-9* (double)buf.tv_nsec; #elif defined CPL_HAVE_GETTIMEOFDAY struct timeval buf; return gettimeofday(&buf, 0) ? 0.0 : (double)buf.tv_sec + 1.0e-6 * (double)buf.tv_usec; #else return 0.0; #endif } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the FLOPS count. @return The FLOPS count @note This function is intended to be used only by the CPL test macros. */ /*----------------------------------------------------------------------------*/ inline cpl_flops cpl_test_get_flops(void) { return cpl_tools_get_flops(); } /*----------------------------------------------------------------------------*/ /** @brief Get the number of CPL tests performed. @return The test count @see cpl_test_get_failed() */ /*----------------------------------------------------------------------------*/ cpl_size cpl_test_get_tested(void) { return cpl_test_count; } /*----------------------------------------------------------------------------*/ /** @brief Get the number of failed CPL tests. @return The count of failed tests @see cpl_test_get_tested() Example of usage: @code void my_tester (void) { const cpl_size prefailed = cpl_test_get_failed(); cpl_test(mytest()); if (cpl_test_get_failed() > prefailed) { cpl_msg_info(cpl_func, "The function mytest() failed!"); } } @endcode */ /*----------------------------------------------------------------------------*/ cpl_size cpl_test_get_failed(void) { return cpl_test_failures; } /*----------------------------------------------------------------------------*/ /** @brief Get the amount of storage [bytes] for the CPL object @param self The CPL object @return The size in bytes @note Passing NULL is allowed and will return zero Example of usage: @code int my_benchmark (void) { const size_t storage = cpl_test_get_bytes_vector(mydata); double walltime, tstop; const double tstart = cpl_test_get_walltime(); myfunc(mydata); tstop = cpl_test_get_walltime(); walltime = tstop - tstart; if (walltime > 0.0) { cpl_msg_info(cpl_func, "Processing rate: %g", (double)storage/walltime); } } @endcode */ /*----------------------------------------------------------------------------*/ size_t cpl_test_get_bytes_vector(const cpl_vector * self) { return self == NULL ? 0 : (size_t)cpl_vector_get_size(self) * sizeof(double); } /*----------------------------------------------------------------------------*/ /** @brief Get the amount of storage [bytes] for the CPL object @param self The CPL object @return The size in bytes @note Passing NULL is allowed and will return zero @see cpl_test_get_bytes_vector */ /*----------------------------------------------------------------------------*/ size_t cpl_test_get_bytes_matrix(const cpl_matrix * self) { return self == NULL ? 0 : (size_t)cpl_matrix_get_nrow(self) * (size_t)cpl_matrix_get_ncol(self) * sizeof(double); } /*----------------------------------------------------------------------------*/ /** @brief Get the amount of storage [bytes] for the CPL object @param self The CPL object @return The size in bytes @note Passing NULL is allowed and will return zero @see cpl_test_get_bytes_vector */ /*----------------------------------------------------------------------------*/ size_t cpl_test_get_bytes_image(const cpl_image * self) { return self == NULL ? 0 : (size_t)cpl_image_get_size_x(self) * (size_t)cpl_image_get_size_y(self) * cpl_type_get_sizeof(cpl_image_get_type(self)); } /*----------------------------------------------------------------------------*/ /** @brief Get the amount of storage [bytes] for the CPL object @param self The CPL object @return The size in bytes @note Passing NULL is allowed and will return zero @see cpl_test_get_bytes_vector */ /*----------------------------------------------------------------------------*/ size_t cpl_test_get_bytes_imagelist(const cpl_imagelist * self) { return self == NULL ? 0 : (size_t)cpl_imagelist_get_size(self) * (size_t)cpl_test_get_bytes_image(cpl_imagelist_get_const(self, 0)); } /*----------------------------------------------------------------------------*/ /** @internal @brief Initialize CPL and unit-test environment @param filename __FILE__ of unit-test source code for log-file @param report The email address for the error message @param default_level Default level for messaging system @return void @see cpl_test_init() @note This function should only be called by cpl_test_init() */ /*----------------------------------------------------------------------------*/ void cpl_test_init_macro(const char * filename, const char * report, cpl_msg_severity default_level) { /* ISO/IEC 9899:1999 (E) 7.5 3: The value of errno is zero at program startup, but is never set to zero by any library function. The value of errno may be set to nonzero by a library function call whether or not there is an error, provided the use of errno is not documented in the description of the function in this International Standard. */ /* As such it is safe to read errno at this stage, but a non-zero value has no significance. */ const int errnopre = errno; int errnoini; assert(report != NULL); assert(filename != NULL); #ifdef _OPENMP #pragma omp master #endif { cpl_test_report = report; errno = 0; /* make sure we are checking for memory leaks */ if (CPL_XMEMORY_MODE == 0) { setenv("CPL_MEMORY_MODE", "1", 0); } cpl_init(CPL_INIT_DEFAULT); cpl_test_time_start = cpl_test_get_walltime(); cpl_test_time_one = cpl_test_time_start; errnoini = errno; errno = 0; /* Needed on alphaev56 */ if (signal(SIGFPE, SIG_IGN) == SIG_ERR) { cpl_msg_warning(cpl_func, "Could not install new signal handler " "(SIG_IGN) for SIGFPE"); } cleanstate = cpl_errorstate_get(); cpl_msg_set_level(default_level); cpl_msg_set_level_from_env(); if (filename != NULL) { const char * dotpos = NULL; char * logfile = NULL; /* Create a new string, where the extension is replaced with .log */ /* First trim away any directory names before the filename. Check for both POSIX and Windows directory separator characters. This means no files can have these characters in their name, which is a reasonable requirement for portable software anyway. */ const char * fslashpos = strrchr(filename, '\\'); const char * bslashpos = strrchr(filename, '/'); const char * slashpos = bslashpos > fslashpos ? bslashpos : fslashpos; if (slashpos != NULL) filename = slashpos+1; /* Check the special case of having filename = "..". In that case set filename to use "." instead, so that we end up with having ".log" as the log file name. */ if (strcmp(filename, "..") == 0) filename = "."; /* Append .log in case there is no extension. In case there is an extension shorter than three characters, the new string will also be (more than) long enough for the .log extension. Take into account possible directory separator characters. */ dotpos = strrchr(filename, '.'); logfile = cpl_sprintf("%s.log", filename); if (dotpos != NULL) { /* Need to write new extension after the last '.' */ (void)strcpy(logfile + (1 + dotpos - filename), "log"); } cpl_msg_set_log_name(logfile); if (cpl_error_get_code()) { /* The log-file name could not be set */ cpl_msg_warning(cpl_func, "Ignoring failed setting of " "log-file:"); cpl_errorstate_dump(cleanstate, CPL_FALSE, cpl_errorstate_dump_one_warning); cpl_test_reset(cleanstate); } /* Drop .log */ logfile[strlen(logfile)-strlen(".log")] = '\0'; cpl_msg_set_domain(logfile); cpl_free(logfile); } cpl_msg_set_log_level(CPL_MSG_DEBUG); if (errnopre != 0) { /* May be useful for debugging - but see the above errno comment */ /* See also DFS04285 */ cpl_msg_debug(cpl_func, "%s() was called with errno=%d: %s (Unless " "you are debugging code prior to the cpl_init() call " "you can ignore this message)", cpl_func, errnopre, strerror(errnopre)); } if (errnoini != 0) { /* May be useful for debugging - but see the above errno comment */ cpl_msg_debug(cpl_func, "cpl_init() set errno=%d: %s (Unless " "you are debugging cpl_init() you can ignore " "this message)", errnoini, strerror(errnoini)); } } #ifdef _OPENMP /* No thread can start testing before the master is ready */ #pragma omp barrier #endif if (cpl_error_get_code() != CPL_ERROR_NONE) { cpl_errorstate_dump_one(1, 1, 1); /* Dump the most recent error */ assert(cpl_error_get_code() == CPL_ERROR_NONE); abort(); } cpl_msg_debug(cpl_func, "sizeof(cpl_size): %u", (unsigned)sizeof(cpl_size)); #ifdef OFF_T cpl_msg_debug(cpl_func, "sizeof(OFF_T)=%u", (unsigned)sizeof(OFF_T)); #endif cpl_msg_debug(cpl_func, "%s", cpl_get_description(CPL_DESCRIPTION_DEFAULT)); if (errno != 0) { cpl_msg_warning(cpl_func, "%s() set errno=%d: %s", cpl_func, errno, strerror(errno)); errno = 0; } return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test a given boolean expression @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param expr The integer expression to evaluate @param fail_on_zero Fail iff the expression is zero @param expr_txt The integer expression to evaluate as a string @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test() @note This function should only be called via cpl_test() @note CPL_FALSE of the boolean is a failure, CPL_TRUE is not */ /*----------------------------------------------------------------------------*/ void cpl_test_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, cpl_size expression, cpl_boolean fail_on_zero, const char * expr_txt, const char * function, const char * file, unsigned line) { char * message = cpl_sprintf(fail_on_zero ? "(%s) = %" CPL_SIZE_FORMAT : "(%s) = %" CPL_SIZE_FORMAT " <=> 0", expr_txt, expression); const cpl_boolean bool = fail_on_zero ? (expression ? CPL_TRUE : CPL_FALSE) : (expression ? CPL_FALSE : CPL_TRUE); cpl_test_one(errnopre, twallpre, flopspre, statepre, bool, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if a pointer is NULL @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param pointer The pointer to check, side-effects are allowed @param pointer_string The pointer as a string @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_null @note This function should only be called from the macro cpl_test_null() */ /*----------------------------------------------------------------------------*/ void cpl_test_null_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const void * pointer, const char * pointer_string, const char * function, const char * file, unsigned line) { char * message = cpl_sprintf("(%s) = %p == NULL", pointer_string, pointer); cpl_test_one(errnopre, twallpre, flopspre, statepre, pointer == NULL ? CPL_TRUE : CPL_FALSE, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if a pointer is non-NULL @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param pointer The pointer to check, side-effects are allowed @param pointer_string The pointer as a string @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_nonnull @note This function should only be called from the macro cpl_test_nonnull() */ /*----------------------------------------------------------------------------*/ void cpl_test_nonnull_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const void * pointer, const char * pointer_string, const char * function, const char * file, unsigned line) { char * message = cpl_sprintf("(%s) = %p != NULL", pointer_string, pointer); cpl_test_one(errnopre, twallpre, flopspre, statepre, pointer != NULL ? CPL_TRUE : CPL_FALSE, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two integer expressions are equal @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first value in the comparison @param first_string The first value as a string @param second The second value in the comparison @param second_string The second value as a string @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_eq @note This function should only be called from the macro cpl_test_eq() */ /*----------------------------------------------------------------------------*/ void cpl_test_eq_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, cpl_size first, const char * first_string, cpl_size second, const char * second_string, const char * function, const char * file, unsigned line) { char * message = cpl_sprintf("(%s) = %" CPL_SIZE_FORMAT "; (%s) = %" CPL_SIZE_FORMAT, first_string, first, second_string, second); cpl_test_one(errnopre, twallpre, flopspre, statepre, first == second ? CPL_TRUE : CPL_FALSE, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two integer expressions are not equal @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first value in the comparison @param first_string The first value as a string @param second The second value in the comparison @param second_string The second value as a string @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_noneq @note This function should only be called from the macro cpl_test_noneq() */ /*----------------------------------------------------------------------------*/ void cpl_test_noneq_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, cpl_size first, const char * first_string, cpl_size second, const char * second_string, const char * function, const char * file, unsigned line) { char * message = cpl_sprintf("(%s) = %" CPL_SIZE_FORMAT "; (%s) = %" CPL_SIZE_FORMAT, first_string, first, second_string, second); cpl_test_one(errnopre, twallpre, flopspre, statepre, first != second ? CPL_TRUE : CPL_FALSE, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two pointer expressions are equal @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first value in the comparison @param first_string The first value as a string @param second The second value in the comparison @param second_string The second value as a string @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_eq_ptr @note This function should only be called from the macro cpl_test_eq_ptr() */ /*----------------------------------------------------------------------------*/ void cpl_test_eq_ptr_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const void * first, const char * first_string, const void * second, const char * second_string, const char * function, const char * file, unsigned line) { char * message = cpl_sprintf("(%s) = %p; (%s) = %p", first_string, first, second_string, second); cpl_test_one(errnopre, twallpre, flopspre, statepre, first == second ? CPL_TRUE : CPL_FALSE, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two pointer expressions are not equal @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first value in the comparison @param first_string The first value as a string @param second The second value in the comparison @param second_string The second value as a string @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_noneq_ptr @note This function should only be called from the macro cpl_test_noneq_ptr() */ /*----------------------------------------------------------------------------*/ void cpl_test_noneq_ptr_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const void * first, const char * first_string, const void * second, const char * second_string, const char * function, const char * file, unsigned line) { char * message = cpl_sprintf("(%s) = %p; (%s) = %p", first_string, first, second_string, second); cpl_test_one(errnopre, twallpre, flopspre, statepre, first != second ? CPL_TRUE : CPL_FALSE, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two strings are equal @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first string or NULL of the comparison @param first_string The first value as a string @param second The second string or NULL of the comparison @param second_string The second value as a string @param function function name @param file filename @param line line number @see cpl_test_eq_string() @note This function should only be called from cpl_test_eq_string() */ /*----------------------------------------------------------------------------*/ void cpl_test_eq_string_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const char * first, const char * first_string, const char * second, const char * second_string, const char * function, const char * file, unsigned line) { char * fsquote = first == NULL ? NULL : cpl_sprintf("'%s'", first); char * ssquote = second == NULL ? NULL : cpl_sprintf("'%s'", second); const char * fquote = fsquote == NULL ? "NULL" : fsquote; const char * squote = ssquote == NULL ? "NULL" : ssquote; char * message = cpl_sprintf("%s = %s; %s = %s", first_string, fquote, second_string, squote); cpl_free(fsquote); cpl_free(ssquote); cpl_test_one(errnopre, twallpre, flopspre, statepre, first != NULL && second != NULL && strcmp(first, second) == 0, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two strings are not equal @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first string or NULL of the comparison @param first_string The first value as a string @param second The second string or NULL of the comparison @param second_string The second value as a string @param function function name @param file filename @param line line number @see cpl_test_noneq_string() @note This function should only be called from cpl_test_noneq_string() */ /*----------------------------------------------------------------------------*/ void cpl_test_noneq_string_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const char * first, const char * first_string, const char * second, const char * second_string, const char * function, const char * file, unsigned line) { char * fsquote = first == NULL ? NULL : cpl_sprintf("'%s'", first); char * ssquote = second == NULL ? NULL : cpl_sprintf("'%s'", second); const char * fquote = fsquote == NULL ? "NULL" : fsquote; const char * squote = ssquote == NULL ? "NULL" : ssquote; char * message = cpl_sprintf("%s = %s; %s = %s", first_string, fquote, second_string, squote); cpl_free(fsquote); cpl_free(ssquote); cpl_test_one(errnopre, twallpre, flopspre, statepre, first != NULL && second != NULL && strcmp(first, second) != 0, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if a file is valid FITS using an external verification utility @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param filename The file to verify @param filename_string The file to verify as a string @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_fits() @note This function should only be called from cpl_test_fits() */ /*----------------------------------------------------------------------------*/ void cpl_test_fits_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const char * filename, const char * filename_string, const char * function, const char * file, unsigned line) { const char * checker = getenv(CPL_TEST_FITS); char * message; cpl_boolean expression; if (filename == NULL) { message = cpl_sprintf(CPL_TEST_FITS " unusable on NULL-file " "%s", filename_string); expression = CPL_FALSE; /* Unable to do an actual test */ } else if (checker == NULL) { message = cpl_test_fits_file(filename, filename_string); if (message != NULL) { expression = CPL_FALSE; /* File cannot be FITS */ } else { /* The previous FITS validation is so primitive that its success is not reported */ message = cpl_sprintf(CPL_TEST_FITS " undefined for file %s='%s', " "try: export " CPL_TEST_FITS "=fitsverify", filename_string, filename); expression = CPL_TRUE; /* Unable to do an actual test */ } } else { const char * redir = cpl_msg_get_level() < CPL_MSG_WARNING ? "" : (cpl_msg_get_level() < CPL_MSG_ERROR ? " > /dev/null" : " > /dev/null 2>&1"); char * cmd = cpl_sprintf("%s %s %s", checker, filename, redir); message = cpl_sprintf(CPL_TEST_FITS " on file %s: %s", filename_string, cmd); expression = system(cmd) == 0 ? CPL_TRUE : CPL_FALSE; cpl_free(cmd); } cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two CPL masks are equal @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first mask or NULL of the comparison @param first_mask The first value as a string @param second The second mask or NULL of the comparison @param second_mask The second value as a string @param function function name @param file filename @param line line number @see cpl_test_eq_mask() @note This function should only be called from cpl_test_eq_mask() */ /*----------------------------------------------------------------------------*/ void cpl_test_eq_mask_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const cpl_mask * first, const char * first_string, const cpl_mask * second, const char * second_string, const char * function, const char * file, unsigned line) { cpl_errorstate mystate = cpl_errorstate_get(); const cpl_size nx1 = cpl_mask_get_size_x(first); const cpl_size ny1 = cpl_mask_get_size_y(first); const cpl_size nx2 = cpl_mask_get_size_x(second); const cpl_size ny2 = cpl_mask_get_size_y(second); cpl_boolean expression; char * message; if (!cpl_errorstate_is_equal(mystate)) { cpl_error_set(cpl_func, cpl_error_get_code()); expression = CPL_FALSE; message = cpl_sprintf("%s <=> %s input error", first_string, second_string); } else if (nx1 != nx2 || ny1 != ny2) { expression = CPL_FALSE; message = cpl_sprintf("%s <=> %s incompatible input, nx: %" CPL_SIZE_FORMAT " <=> %" CPL_SIZE_FORMAT ", ny: %" CPL_SIZE_FORMAT " <=> %" CPL_SIZE_FORMAT, first_string, second_string, nx1, nx2, ny1, ny2); } else if (memcmp(cpl_mask_get_data_const(first), cpl_mask_get_data_const(second), (size_t)(nx1 * ny1))) { /* The test has failed, now spend extra time to report why */ cpl_size i; cpl_size k = 0; cpl_size n = 0; const cpl_binary * pbpm1 = cpl_mask_get_data_const(first); const cpl_binary * pbpm2 = cpl_mask_get_data_const(second); for (i = 0; i < nx1 * ny1; i++) { if (pbpm1[i] != pbpm2[i]) { k = i; n++; } } assert( n != 0 ); expression = CPL_FALSE; message = cpl_sprintf("%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ") = %u <=> %u = %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ") (%" CPL_SIZE_FORMAT " of %" CPL_SIZE_FORMAT " x %" CPL_SIZE_FORMAT " " "differ(s))", first_string, 1+k%nx1, 1+k/nx1, (unsigned)pbpm1[k], (unsigned)pbpm2[k], second_string, 1+k%nx2, 1+k/nx2, n, nx1, ny1); } else { expression = CPL_TRUE; message = cpl_sprintf("%s == %s", first_string, second_string); } cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); cpl_errorstate_set(mystate); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Evaluate A <= B and update an internal counter if it is not true @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param value The double-precision number to test @param tolerance The double-precision upper limit to compare against @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_leq() @note This function should only be called via cpl_test_leq_macro() */ /*----------------------------------------------------------------------------*/ void cpl_test_leq_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, double value, const char * value_string, double tolerance, const char * tolerance_string, const char * function, const char * file, unsigned line) { const cpl_boolean expression = (value <= tolerance) ? CPL_TRUE : CPL_FALSE; char * message = cpl_sprintf("%s = %g <= %g = %s", value_string, value, tolerance, tolerance_string); cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Evaluate A < B and update an internal counter if it is not true @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param value The double-precision number to test @param tolerance The double-precision upper limit to compare against @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_lt() @note This function should only be called via cpl_test_leq_macro() */ /*----------------------------------------------------------------------------*/ void cpl_test_lt_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, double value, const char * value_string, double tolerance, const char * tolerance_string, const char * function, const char * file, unsigned line) { const cpl_boolean expression = (value < tolerance) ? CPL_TRUE : CPL_FALSE; char * message = cpl_sprintf("%s = %g < %g = %s", value_string, value, tolerance, tolerance_string); cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two numerical expressions are within a given (absolute) tolerance @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first value in the comparison @param first_string The first value as a string @param second The second value in the comparison @param second_string The second value as a string @param tolerance A non-negative tolerance @param tolerance_string The tolerance as a string @param function function name @param file filename @param line line number @see cpl_test_abs() @note This function should only be called from the macro cpl_test_abs() */ /*----------------------------------------------------------------------------*/ void cpl_test_abs_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, double first, const char *first_string, double second, const char *second_string, double tolerance, const char *tolerance_string, const char *function, const char *file, unsigned line) { const cpl_boolean expression = (fabs(first - second) <= tolerance) ? CPL_TRUE : CPL_FALSE; char *message = cpl_sprintf("|%s - %s| = |%g - %g| = |%g| <= %g = %s", first_string, second_string, first, second, first - second, tolerance, tolerance_string); cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two complex expressions are within a given (absolute) tolerance @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first value in the comparison @param first_string The first value as a string @param second The second value in the comparison @param second_string The second value as a string @param tolerance A non-negative tolerance @param tolerance_string The tolerance as a string @param function function name @param file filename @param line line number @see cpl_test_abs_complex() @note This function should only be called from the macro cpl_test_abs_complex() */ /*----------------------------------------------------------------------------*/ void cpl_test_abs_complex_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, double complex first, const char *first_string, double complex second, const char *second_string, double tolerance, const char *tolerance_string, const char *function, const char *file, unsigned line) { const cpl_boolean expression = (cabs(first - second) <= tolerance) ? CPL_TRUE : CPL_FALSE; char *message = cpl_sprintf("|%s - %s| = |(%g%+gi) - (%g%+gi)| = " "|%g%+gi| = %g <= %g = %s", first_string, second_string, creal(first), cimag(first), creal(second), cimag(second), creal(first - second), cimag(first - second), cabs(first - second), tolerance, tolerance_string); cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two numerical expressions are within a given relative tolerance @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first value in the comparison @param first_string The first value as a string @param second The second value in the comparison @param second_string The second value as a string @param tolerance A non-negative tolerance @param tolerance_string The tolerance as a string @param function function name @param file filename @param line line number @see cpl_test_rel() @note This function should only be called from the macro cpl_test_rel() */ /*----------------------------------------------------------------------------*/ void cpl_test_rel_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, double first, const char *first_string, double second, const char *second_string, double tolerance, const char *tolerance_string, const char *function, const char *file, unsigned line) { char * message = NULL; /* Avoid (false) uninit warnings */ cpl_boolean expression; if (tolerance < 0.0) { expression = CPL_FALSE; message = cpl_sprintf("%s = %g; %s = %g. Negative tolerance %s = %g", first_string, first, second_string, second, tolerance_string, tolerance); } else if (first == second) { /* Not needed. Used only for prettier messaging */ expression = CPL_TRUE; message = cpl_sprintf("%s = %g = %s. (Tolerance %s = %g)", first_string, first, second_string, tolerance_string, tolerance); } else if (first == 0.0) { /* Not needed. Used only for prettier messaging */ expression = CPL_FALSE; message = cpl_sprintf("%s = zero; %s = non-zero (%g). (Tolerance " "%s = %g)", first_string, second_string, second, tolerance_string, tolerance); } else if (second == 0.0) { /* Not needed. Used only for prettier messaging */ expression = CPL_FALSE; message = cpl_sprintf("%s = non-zero (%g); %s = zero. (Tolerance " "%s = %g)", first_string, first, second_string, tolerance_string, tolerance); } else if (fabs(first) < fabs(second)) { expression = fabs(first - second) <= tolerance * fabs(first) ? CPL_TRUE : CPL_FALSE; message = cpl_sprintf("|%s - %s|/|%s| = |%g - %g|/|%g| = |%g|/|%g|" " <= %g = %s", first_string, second_string, first_string, first, second, first, first - second, first, tolerance, tolerance_string); } else { /* assert(fabs(second) < fabs(first)) */ expression = fabs(first - second) <= tolerance * fabs(second) ? CPL_TRUE : CPL_FALSE; message = cpl_sprintf("|%s - %s|/|%s| = |%g - %g|/|%g| = |%g|/|%g|" " <= %g = %s", first_string, second_string, second_string, first, second, second, first - second, second, tolerance, tolerance_string); } cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two CPL vectors are identical within a given (absolute) tolerance @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first vector in the comparison @param first_string The first vector as a string @param second The second vector of identical size in the comparison @param second_string The second vector as a string @param tolerance A non-negative tolerance @param tolerance_string The tolerance as a string @param function function name @param file filename @param line line number @see cpl_test_vector_abs() @note This function should only be called from the macro cpl_test_vector_abs() */ /*----------------------------------------------------------------------------*/ void cpl_test_vector_abs_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const cpl_vector * first, const char *first_string, const cpl_vector * second, const char *second_string, double tolerance, const char *tolerance_string, const char *function, const char *file, unsigned line) { cpl_errorstate mystate = cpl_errorstate_get(); cpl_vector * diff = cpl_vector_duplicate(first); cpl_boolean expression; char * message; (void)cpl_vector_subtract(diff, second); if (!cpl_errorstate_is_equal(mystate)) { cpl_error_set(cpl_func, cpl_error_get_code()); expression = CPL_FALSE; message = cpl_sprintf("%s <=> %s (tol=%s) input error:", first_string, second_string, tolerance_string); } else { const double * pdiff = cpl_vector_get_data_const(diff); double difval = pdiff[0]; const cpl_size n = cpl_vector_get_size(diff); cpl_size pos = 0; cpl_size i; for (i = 1; i < n; i++) { if (fabs(pdiff[i]) > fabs(difval)) { pos = i; difval = pdiff[i]; } } if (cpl_errorstate_is_equal(mystate)) { const double val1 = cpl_vector_get(first, pos); const double val2 = cpl_vector_get(second, pos); expression = (fabs(difval) <= tolerance) ? CPL_TRUE : CPL_FALSE; message = cpl_sprintf("|%s(%" CPL_SIZE_FORMAT ") - %s(%" CPL_SIZE_FORMAT ")| = " "|%g - %g| = |%g| <= %g = %s", first_string, pos, second_string, pos, val1, val2, difval, tolerance, tolerance_string); } else { cpl_error_set(cpl_func, cpl_error_get_code()); expression = CPL_FALSE; message = cpl_sprintf("%s <=> %s (tol=%s) input error:", first_string, second_string, tolerance_string); } } cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); cpl_errorstate_set(mystate); cpl_vector_delete(diff); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two CPL matrices are identical within a given (absolute) tolerance @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first matrix in the comparison @param first_string The first matrix as a string @param second The second matrix of identical size in the comparison @param second_string The second matrix as a string @param tolerance A non-negative tolerance @param tolerance_string The tolerance as a string @param function function name @param file filename @param line line number @see cpl_test_matrix_abs() @note This function should only be called from the macro cpl_test_matrix_abs() */ /*----------------------------------------------------------------------------*/ void cpl_test_matrix_abs_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const cpl_matrix * first, const char *first_string, const cpl_matrix * second, const char *second_string, double tolerance, const char *tolerance_string, const char *function, const char *file, unsigned line) { cpl_errorstate mystate = cpl_errorstate_get(); cpl_matrix * diff = cpl_matrix_duplicate(first); cpl_boolean expression; char * message; (void)cpl_matrix_subtract(diff, second); if (!cpl_errorstate_is_equal(mystate)) { cpl_error_set(cpl_func, cpl_error_get_code()); expression = CPL_FALSE; message = cpl_sprintf("%s <=> %s (tol=%s) input error:", first_string, second_string, tolerance_string); } else { const double * pdiff = cpl_matrix_get_data_const(diff); double difval = pdiff[0]; const cpl_size nrow = cpl_matrix_get_nrow(diff); const cpl_size n = nrow * cpl_matrix_get_ncol(diff); cpl_size pos = 0; cpl_size i; for (i = 1; i < n; i++) { if (fabs(pdiff[i]) > fabs(difval)) { pos = i; difval = pdiff[i]; } } if (cpl_errorstate_is_equal(mystate)) { const cpl_size irow = pos / nrow; const cpl_size icol = pos % nrow; const double val1 = cpl_matrix_get(first, irow, icol); const double val2 = cpl_matrix_get(second, irow, icol); expression = (fabs(difval) <= tolerance) ? CPL_TRUE : CPL_FALSE; message = cpl_sprintf("|%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ") - %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ")| = |%g - %g| = " "|%g| <= %g = %s", first_string, irow, icol, second_string, irow, icol, val1, val2, difval, tolerance, tolerance_string); } else { cpl_error_set(cpl_func, cpl_error_get_code()); expression = CPL_FALSE; message = cpl_sprintf("%s <=> %s (tol=%s) input error:", first_string, second_string, tolerance_string); } } cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); cpl_errorstate_set(mystate); cpl_matrix_delete(diff); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two CPL numerical arrays are identical within a given (absolute) tolerance @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first array in the comparison @param first_string The first array as a string @param second The second array of identical size in the comparison @param second_string The second array as a string @param tolerance A non-negative tolerance @param tolerance_string The tolerance as a string @param function function name @param file filename @param line line number @see cpl_test_array_abs() @note This function should only be called from the macro cpl_test_array_abs() */ /*----------------------------------------------------------------------------*/ void cpl_test_array_abs_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const cpl_array * first, const char *first_string, const cpl_array * second, const char *second_string, double tolerance, const char *tolerance_string, const char *function, const char *file, unsigned line) { /* Modified from cpl_test_image_abs_macro() */ cpl_errorstate mystate = cpl_errorstate_get(); const cpl_type type1 = cpl_array_get_type(first); const cpl_type type2 = cpl_array_get_type(second); #ifdef CPL_SIZE_FORMAT const cpl_size nbad1 = cpl_array_count_invalid(first); const cpl_size nbad2 = cpl_array_count_invalid(second); const cpl_size nx = cpl_array_get_size(first); #else const int nbad1 = cpl_array_count_invalid(first); const int nbad2 = cpl_array_count_invalid(second); const int nx = cpl_array_get_size(first); #endif cpl_array * diff = cpl_array_duplicate(first); cpl_boolean expression; char * message; (void)cpl_array_subtract(diff, second); if (tolerance < 0.0) { expression = CPL_FALSE; message = cpl_sprintf("array1=%s; array2=%s. Negative tolerance %s = " "%g", first_string, second_string, tolerance_string, tolerance); } else if (!cpl_errorstate_is_equal(mystate)) { cpl_error_set(cpl_func, cpl_error_get_code()); expression = CPL_FALSE; #ifdef CPL_SIZE_FORMAT message = cpl_sprintf("%s(%" CPL_SIZE_FORMAT ", %s) <=> %s(%" CPL_SIZE_FORMAT ", %s) (tol=%s) input error:", first_string, nx, cpl_type_get_name(type1), second_string, cpl_array_get_size(second), cpl_type_get_name(type2), tolerance_string); #else message = cpl_sprintf("%s(%d, %s) <=> %s(%d, %s) (tol=%s) input error:", first_string, nx, cpl_type_get_name(type1), second_string, cpl_array_get_size(second), cpl_type_get_name(type2), tolerance_string); #endif } else if (nbad1 == nbad2 && nbad1 == nx) { expression = CPL_TRUE; #ifdef CPL_SIZE_FORMAT message = cpl_sprintf("%s(%" CPL_SIZE_FORMAT ", %s) <=> %s(%" CPL_SIZE_FORMAT ", %s) (tol=%s) All elements " "are bad", first_string, nx, cpl_type_get_name(type1), second_string, cpl_array_get_size(second), cpl_type_get_name(type2), tolerance_string); #else message = cpl_sprintf("%s(%d, %s) <=> %s(%d, %s) (tol=%s) " "All elements are bad", first_string, nx, cpl_type_get_name(type1), second_string, cpl_array_get_size(second), cpl_type_get_name(type2), tolerance_string); #endif } else if (cpl_array_count_invalid(diff) == nx) { expression = CPL_FALSE; #ifdef CPL_SIZE_FORMAT message = cpl_sprintf("%s(%" CPL_SIZE_FORMAT ", %s) <=> %s(%" CPL_SIZE_FORMAT ", %s) (tol=%s) All elements " "are bad in the first (%" CPL_SIZE_FORMAT ") or second (%" CPL_SIZE_FORMAT "d) array", first_string, nx, cpl_type_get_name(type1), second_string, cpl_array_get_size(second), cpl_type_get_name(type2), tolerance_string, nbad1, nbad2); #else message = cpl_sprintf("%s(%d, %s) <=> %s(%d, %s) (tol=%s) All elements " "are bad in the first (%d) or second (%d) array", first_string, nx, cpl_type_get_name(type1), second_string, cpl_array_get_size(second), cpl_type_get_name(type2), tolerance_string, nbad1, nbad2); #endif } else { const double maxdif = cpl_array_get_max(diff); const double mindif = cpl_array_get_min(diff); const cpl_boolean is_pos = (maxdif >= -mindif) ? CPL_TRUE : CPL_FALSE; const double difval = is_pos ? maxdif : mindif; #ifdef CPL_SIZE_FORMAT cpl_size posx; #else int posx; #endif const cpl_error_code error = (is_pos ? cpl_array_get_maxpos : cpl_array_get_minpos) (diff, &posx); int is_bad1; int is_bad2; const double val1 = (type1 == CPL_TYPE_INT ? (double)cpl_array_get_int(first, posx, &is_bad1) : (type1 == CPL_TYPE_FLOAT ? (double)cpl_array_get_float(first, posx, &is_bad1) : cpl_array_get_double(first, posx, &is_bad1))); const double val2 = (type2 == CPL_TYPE_INT ? (double)cpl_array_get_int(second, posx, &is_bad2) : (type2 == CPL_TYPE_FLOAT ? (double)cpl_array_get_float(second, posx, &is_bad2) : cpl_array_get_double(second, posx, &is_bad2))); if (!error && cpl_errorstate_is_equal(mystate)) { const char * rejstr1 = is_bad1 ? " invalid" : " valid"; const char * rejstr2 = is_bad2 ? " invalid" : " valid"; expression = (fabs(difval) <= tolerance) ? CPL_TRUE : CPL_FALSE; message = cpl_sprintf("|%s(%" CPL_SIZE_FORMAT ",%s, %s) - %s(%" CPL_SIZE_FORMAT ",%s, %s)| = " "|%g - %g| = |%g| <= %g = %s", first_string, posx, rejstr1, cpl_type_get_name(type1), second_string, posx, rejstr2, cpl_type_get_name(type2), val1, val2, difval, tolerance, tolerance_string); } else { cpl_error_set(cpl_func, cpl_error_get_code()); expression = CPL_FALSE; message = cpl_sprintf("%s <=> %s (tol=%s) input error:", first_string, second_string, tolerance_string); } } cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); if (!expression && cpl_errorstate_is_equal(mystate) && cpl_msg_get_level() <= CPL_MSG_ERROR) { cpl_msg_warning(cpl_func, "Structure of the compared arrays:"); cpl_array_dump_structure(first, stderr); cpl_array_dump_structure(second, stderr); } cpl_errorstate_set(mystate); cpl_array_delete(diff); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two CPL images are identical within a given (absolute) tolerance @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first image in the comparison @param first_string The first image as a string @param second The second image of identical size in the comparison @param second_string The second image as a string @param tolerance A non-negative tolerance @param tolerance_string The tolerance as a string @param function function name @param file filename @param line line number @see cpl_test_image_abs() @note This function should only be called from the macro cpl_test_image_abs() */ /*----------------------------------------------------------------------------*/ void cpl_test_image_abs_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const cpl_image * first, const char *first_string, const cpl_image * second, const char *second_string, double tolerance, const char *tolerance_string, const char *function, const char *file, unsigned line) { cpl_errorstate mystate = cpl_errorstate_get(); const char * stype1 = cpl_type_get_name(cpl_image_get_type(first)); const char * stype2 = cpl_type_get_name(cpl_image_get_type(second)); const cpl_size nbad1 = cpl_image_count_rejected(first); const cpl_size nbad2 = cpl_image_count_rejected(second); const cpl_size nx = cpl_image_get_size_x(first); const cpl_size ny = cpl_image_get_size_y(first); cpl_image * cdiff = cpl_image_subtract_create(first, second); cpl_image * diff = (cpl_image_get_type(cdiff) & CPL_TYPE_COMPLEX) ? cpl_image_extract_mod(cdiff) : cdiff; cpl_boolean expression; char * message; if (tolerance < 0.0) { expression = CPL_FALSE; message = cpl_sprintf("image1=%s; image2=%s. Negative tolerance %s = " "%g", first_string, second_string, tolerance_string, tolerance); } else if (!cpl_errorstate_is_equal(mystate)) { cpl_error_set(cpl_func, cpl_error_get_code()); expression = CPL_FALSE; message = cpl_sprintf("%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) <=> %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) (tol=%s) input error:", first_string, nx, ny, stype1, second_string, cpl_image_get_size_x(second), cpl_image_get_size_y(second), stype2, tolerance_string); } else if (nbad1 == nbad2 && nbad1 == nx * ny) { expression = CPL_TRUE; message = cpl_sprintf("%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) <=> %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) (tol=%s) All pixels " "are bad", first_string, nx, ny, stype1, second_string, cpl_image_get_size_x(second), cpl_image_get_size_y(second), stype2, tolerance_string); } else if (cpl_image_count_rejected(diff) == nx * ny) { expression = CPL_FALSE; message = cpl_sprintf("%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) <=> %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) (tol=%s) All pixels " "are bad in the first (%" CPL_SIZE_FORMAT ") or second (%" CPL_SIZE_FORMAT ") image", first_string, nx, ny, stype1, second_string, cpl_image_get_size_x(second), cpl_image_get_size_y(second), stype2, tolerance_string, nbad1, nbad2); } else { cpl_stats * stats = cpl_stats_new_from_image(diff, CPL_STATS_MIN | CPL_STATS_MAX | CPL_STATS_MINPOS | CPL_STATS_MAXPOS); const double maxdif = cpl_stats_get_max(stats); const double mindif = cpl_stats_get_min(stats); const cpl_boolean is_pos = (maxdif >= -mindif) ? CPL_TRUE : CPL_FALSE; const double difval = is_pos ? maxdif : mindif; const cpl_size posx = is_pos ? cpl_stats_get_max_x(stats) : cpl_stats_get_min_x(stats); const cpl_size posy = is_pos ? cpl_stats_get_max_y(stats) : cpl_stats_get_min_y(stats); int is_bad1; int is_bad2; if (cpl_errorstate_is_equal(mystate)) { expression = (fabs(difval) <= tolerance) ? CPL_TRUE : CPL_FALSE; if (cpl_image_get_type(cdiff) & CPL_TYPE_COMPLEX) { const double complex val1 = cpl_image_get_complex(first, posx, posy, &is_bad1); const double complex val2 = (cpl_image_get_type(second) & CPL_TYPE_COMPLEX) ? cpl_image_get_complex(second, posx, posy, &is_bad2) : cpl_image_get(second, posx, posy, &is_bad2); const char * rejstr1 = is_bad1 ? " bad" : " not bad"; const char * rejstr2 = is_bad2 ? " bad" : " not bad"; message = cpl_sprintf("|%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ",%s, %s) - %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ",%s, %s)| = " "|%g - %g + I (%g - %g) | = |%g| " "<= %g = %s", first_string, posx, posy, rejstr1, stype1, second_string, posx, posy, rejstr2, stype2, creal(val1), creal(val2), cimag(val1), cimag(val2), difval, tolerance, tolerance_string); } else { const double val1 = cpl_image_get(first, posx, posy, &is_bad1); const double val2 = cpl_image_get(second, posx, posy, &is_bad2); const char * rejstr1 = is_bad1 ? " bad" : " not bad"; const char * rejstr2 = is_bad2 ? " bad" : " not bad"; message = cpl_sprintf("|%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ",%s, %s) - %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ",%s, %s)| = " "|%g - %g| = |%g| <= %g = %s", first_string, posx, posy, rejstr1, stype1, second_string, posx, posy, rejstr2, stype2, val1, val2, difval, tolerance, tolerance_string); } if (!expression && cpl_msg_get_level() <= CPL_MSG_ERROR) cpl_stats_dump(stats, CPL_STATS_MIN | CPL_STATS_MAX | CPL_STATS_MINPOS | CPL_STATS_MAXPOS, stderr); } else { cpl_error_set(cpl_func, cpl_error_get_code()); expression = CPL_FALSE; message = cpl_sprintf("%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) <=> %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) (tol=%s) input error:", first_string, nx, ny, stype1, second_string, cpl_image_get_size_x(second), cpl_image_get_size_y(second), stype2, tolerance_string); } cpl_stats_delete(stats); } cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); if (!expression && cpl_errorstate_is_equal(mystate) && cpl_msg_get_level() <= CPL_MSG_ERROR) { cpl_msg_warning(cpl_func, "Structure of the compared images:"); cpl_image_dump_structure(first, stderr); cpl_image_dump_structure(second, stderr); } cpl_errorstate_set(mystate); cpl_image_delete(cdiff); if (diff != cdiff) cpl_image_delete(diff); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two CPL images are identical within a given (relative) tolerance @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first image in the comparison @param first_string The first image as a string @param second The second image of identical size in the comparison @param second_string The second image as a string @param tolerance A non-negative tolerance @param tolerance_string The tolerance as a string @param function function name @param file filename @param line line number @see cpl_test_image_rel() @note This function should only be called from the macro cpl_test_image_rel() */ /*----------------------------------------------------------------------------*/ void cpl_test_image_rel_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const cpl_image * first, const char *first_string, const cpl_image * second, const char *second_string, double tolerance, const char *tolerance_string, const char *function, const char *file, unsigned line) { cpl_errorstate mystate = cpl_errorstate_get(); const char * stype1 = cpl_type_get_name(cpl_image_get_type(first)); const char * stype2 = cpl_type_get_name(cpl_image_get_type(second)); const cpl_size nbad1 = cpl_image_count_rejected(first); const cpl_size nbad2 = cpl_image_count_rejected(second); const cpl_size nx = cpl_image_get_size_x(first); const cpl_size ny = cpl_image_get_size_y(first); cpl_image * cdiff = cpl_image_subtract_create(first, second); cpl_image * diff = (cpl_image_get_type(cdiff) & CPL_TYPE_COMPLEX) ? cpl_image_extract_mod(cdiff) : cdiff; cpl_boolean expression; char * message; if (tolerance < 0.0) { expression = CPL_FALSE; message = cpl_sprintf("image1=%s; image2=%s. Negative tolerance %s = " "%g", first_string, second_string, tolerance_string, tolerance); } else if (!cpl_errorstate_is_equal(mystate)) { cpl_error_set(cpl_func, cpl_error_get_code()); expression = CPL_FALSE; message = cpl_sprintf("%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) <=> %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) (tol=%s) input error:", first_string, nx, ny, stype1, second_string, cpl_image_get_size_x(second), cpl_image_get_size_y(second), stype2, tolerance_string); } else if (nbad1 == nbad2 && nbad1 == nx * ny) { expression = CPL_TRUE; message = cpl_sprintf("%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) <=> %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) (tol=%s) All pixels " "are bad", first_string, nx, ny, stype1, second_string, cpl_image_get_size_x(second), cpl_image_get_size_y(second), stype2, tolerance_string); } else if (cpl_image_count_rejected(diff) == nx * ny) { expression = CPL_FALSE; message = cpl_sprintf("%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) <=> %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) (tol=%s) All pixels " "are bad in the first (%" CPL_SIZE_FORMAT ") or second (%" CPL_SIZE_FORMAT ") image", first_string, nx, ny, stype1, second_string, cpl_image_get_size_x(second), cpl_image_get_size_y(second), stype2, tolerance_string, nbad1, nbad2); } else { /* Create real-valued images with the absolute values */ cpl_image * imabs1 = (cpl_image_get_type(first) & CPL_TYPE_COMPLEX) ? cpl_image_extract_mod(first) : cpl_image_abs_create(first); cpl_image * imabs2 = (cpl_image_get_type(second) & CPL_TYPE_COMPLEX) ? cpl_image_extract_mod(second) : cpl_image_abs_create(second); cpl_image * immin = cpl_image_min_create(imabs1, imabs2); cpl_error_code error = cpl_image_multiply_scalar(immin, tolerance); cpl_image * posit = cpl_image_subtract_create(immin, diff); cpl_stats * stats = cpl_stats_new_from_image(posit, CPL_STATS_MIN | CPL_STATS_MINPOS); const double difval = cpl_stats_get_min(stats); const cpl_size posx = cpl_stats_get_min_x(stats); const cpl_size posy = cpl_stats_get_min_y(stats); int is_bad1; int is_bad2; if (!error && cpl_errorstate_is_equal(mystate)) { const double mval = cpl_image_get(immin, posx, posy, &is_bad2); expression = difval >= 0.0 ? CPL_TRUE : CPL_FALSE; if (cpl_image_get_type(cdiff) & CPL_TYPE_COMPLEX) { const double complex val1 = cpl_image_get_complex(first, posx, posy, &is_bad1); const double complex val2 = (cpl_image_get_type(second) & CPL_TYPE_COMPLEX) ? cpl_image_get_complex(second, posx, posy, &is_bad2) : cpl_image_get(second, posx, posy, &is_bad2); const char * rejstr1 = is_bad1 ? " bad" : " not bad"; const char * rejstr2 = is_bad2 ? " bad" : " not bad"; message = cpl_sprintf("|%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ",%s, %s) - %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ",%s, %s)| = " "|%g - %g + I (%g - %g) | = |%g + I %g| " "<= %g", first_string, posx, posy, rejstr1, stype1, second_string, posx, posy, rejstr2, stype2, creal(val1), creal(val2), cimag(val1), cimag(val2), creal(val1) - creal(val2), cimag(val1) - cimag(val2), mval); } else { const double val1 = cpl_image_get(first, posx, posy, &is_bad1); const double val2 = cpl_image_get(second, posx, posy, &is_bad2); const char * rejstr1 = is_bad1 ? " bad" : " not bad"; const char * rejstr2 = is_bad2 ? " bad" : " not bad"; message = cpl_sprintf("|%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ",%s, %s) - %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ",%s, %s)| = " "|%g - %g| = |%g| <= %g", first_string, posx, posy, rejstr1, stype1, second_string, posx, posy, rejstr2, stype2, val1, val2, val1 - val2, mval); } if (!expression && cpl_msg_get_level() <= CPL_MSG_ERROR) cpl_stats_dump(stats, CPL_STATS_MIN | CPL_STATS_MINPOS, stderr); } else { cpl_error_set(cpl_func, cpl_error_get_code()); expression = CPL_FALSE; message = cpl_sprintf("%s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) <=> %s(%" CPL_SIZE_FORMAT ",%" CPL_SIZE_FORMAT ", %s) (tol=%s) input error:", first_string, nx, ny, stype1, second_string, cpl_image_get_size_x(second), cpl_image_get_size_y(second), stype2, tolerance_string); } cpl_image_delete(imabs1); cpl_image_delete(imabs2); cpl_image_delete(immin); cpl_image_delete(posit); cpl_stats_delete(stats); } cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); if (!expression && cpl_errorstate_is_equal(mystate)) { cpl_msg_warning(cpl_func, "Structure of the compared images:"); if (cpl_msg_get_level() <= CPL_MSG_ERROR) { cpl_image_dump_structure(first, stderr); cpl_image_dump_structure(second, stderr); } } cpl_errorstate_set(mystate); cpl_image_delete(cdiff); if (diff != cdiff) cpl_image_delete(diff); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two CPL imagelists are identical within a given (absolute) tolerance @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first imagelist in the comparison @param first_string The first imagelist as a string @param second The second list of identical size in the comparison @param second_string The second imagelist as a string @param tolerance A non-negative tolerance @param tolerance_string The tolerance as a string @param function function name @param file filename @param line line number @see cpl_test_imagelist_abs() @note This function should only be called from cpl_test_imagelist_abs() */ /*----------------------------------------------------------------------------*/ void cpl_test_imagelist_abs_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const cpl_imagelist * first, const char *first_string, const cpl_imagelist * second, const char *second_string, double tolerance, const char *tolerance_string, const char *function, const char *file, unsigned line) { cpl_errorstate mystate = cpl_errorstate_get(); const cpl_size sz1 = cpl_imagelist_get_size(first); const cpl_size sz2 = cpl_imagelist_get_size(second); cpl_boolean expression; char * message = NULL; if (!cpl_errorstate_is_equal(mystate)) { cpl_error_set(cpl_func, cpl_error_get_code()); expression = CPL_FALSE; message = cpl_sprintf("%s <=> %s (tol=%s) input error:", first_string, second_string, tolerance_string); } else if (sz1 != sz2) { expression = CPL_FALSE; message = cpl_sprintf("%s <=> %s (tol=%s) imagelist list sizes differ: " "%" CPL_SIZE_FORMAT " <=> %" CPL_SIZE_FORMAT, first_string, second_string, tolerance_string, sz1, sz2); } else { const cpl_size failures = cpl_test_failures; cpl_size i; message = cpl_sprintf("|%s(%" CPL_SIZE_FORMAT ") - %s(%" CPL_SIZE_FORMAT ")| <= %g = %s", first_string, sz1, second_string, sz2, tolerance, tolerance_string); for (i = 0; i < sz1; i++) { const cpl_image * img1 = cpl_imagelist_get_const(first, i); const cpl_image * img2 = cpl_imagelist_get_const(second, i); char * img1string = cpl_sprintf("image %" CPL_SIZE_FORMAT " in first list", 1+i); char * img2string = cpl_sprintf("image %" CPL_SIZE_FORMAT " in second list", 1+i); cpl_test_image_abs_macro(errnopre, twallpre, flopspre, statepre, img1, img1string, img2, img2string, tolerance, tolerance_string, function, file, line); cpl_free(img1string); cpl_free(img2string); } expression = failures == cpl_test_failures ? CPL_TRUE : CPL_FALSE; cpl_test_failures = failures; /* Count as only one test ! */ } cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); if (!expression && cpl_errorstate_is_equal(mystate)) { cpl_msg_warning(cpl_func, "Structure of the compared imagelists:"); if (cpl_msg_get_level() <= CPL_MSG_ERROR) { cpl_imagelist_dump_structure(first, stderr); cpl_imagelist_dump_structure(second, stderr); } } cpl_errorstate_set(mystate); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two CPL polynomials are identical within a given (absolute) tolerance @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first polynomial in the comparison @param first_string The first polynomial as a string @param second The second polynomial in the comparison @param second_string The second polynomial as a string @param tolerance A non-negative tolerance @param tolerance_string The tolerance as a string @param function function name @param file filename @param line line number @see cpl_test_polynomial_abs() @note This function should only be called from the macro cpl_test_polynomial_abs() */ /*----------------------------------------------------------------------------*/ void cpl_test_polynomial_abs_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const cpl_polynomial * first, const char *first_string, const cpl_polynomial * second, const char *second_string, double tolerance, const char *tolerance_string, const char *function, const char *file, unsigned line) { cpl_errorstate mystate = cpl_errorstate_get(); cpl_boolean expression = cpl_polynomial_compare(first, second, tolerance) ? CPL_FALSE : CPL_TRUE; char * message; if (cpl_errorstate_is_equal(mystate)) { cpl_error_set(cpl_func, cpl_error_get_code()); message = cpl_sprintf("|%s - %s| <= %g = %s", first_string, second_string, tolerance, tolerance_string); } else { expression = CPL_FALSE; message = cpl_sprintf("%s <=> %s (tol=%s) input error:", first_string, second_string, tolerance_string); } cpl_test_one(errnopre, twallpre, flopspre, statepre, expression, message, CPL_FALSE, function, file, line); cpl_errorstate_set(mystate); cpl_free(message); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test and reset the CPL error code @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param errorstate The expected CPL error code (incl. CPL_ERROR_NONE) @param errorstate_string The CPL error code as a string @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_errorstate @note This function should only be called from the macro cpl_test_errorstate() */ /*----------------------------------------------------------------------------*/ void cpl_test_errorstate_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, cpl_errorstate errorstate, const char * errorstate_string, const char * function, const char * file, unsigned line) { /* FIXME: Improve message */ char * message = cpl_sprintf("%s <=> %d (%s)", errorstate_string, cpl_error_get_code(), cpl_error_get_message()); cpl_test_one(errnopre, twallpre, flopspre, statepre, cpl_errorstate_is_equal(errorstate) ? CPL_TRUE : CPL_FALSE, message, CPL_TRUE, function, file, line); cpl_free(message); cpl_test_reset(errorstate); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test and reset the CPL error code @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param error The expected CPL error code (incl. CPL_ERROR_NONE) @param error_string The CPL error code as a string @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_error @note This function should only be called from the macro cpl_test_error() */ /*----------------------------------------------------------------------------*/ void cpl_test_error_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, cpl_error_code error, const char * error_string, const char * function, const char * file, unsigned line) { char * message = cpl_sprintf("(%s) = %d (%s) <=> %d (%s)", error_string, error, cpl_error_get_message_default(error), cpl_error_get_code(), cpl_error_get_message()); cpl_test_one(errnopre, twallpre, flopspre, statepre, cpl_error_get_code() == error ? CPL_TRUE : CPL_FALSE, message, CPL_TRUE, function, file, line); cpl_free(message); cpl_test_reset(cleanstate); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if two CPL error expressions are equal, also to the CPL error code @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param first The first value in the comparison @param first_string The first value as a string @param second The second value in the comparison @param second_string The second value as a string @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_error @note This function should only be called from the macro cpl_test_eq_error() */ /*----------------------------------------------------------------------------*/ void cpl_test_eq_error_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, cpl_error_code first, const char * first_string, cpl_error_code second, const char * second_string, const char * function, const char * file, unsigned line) { char * message = cpl_sprintf("(%s) = %d (%s) <=> (%s) = %d (%s) " "<=> %d (%s)", first_string, first, cpl_error_get_message_default(first), second_string, second, cpl_error_get_message_default(second), cpl_error_get_code(), cpl_error_get_message_default (cpl_error_get_code())); cpl_test_one(errnopre, twallpre, flopspre, statepre, (first == second && cpl_error_get_code() == first) ? CPL_TRUE : CPL_FALSE, message, CPL_TRUE, function, file, line); cpl_free(message); cpl_test_reset(cleanstate); return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Test if the memory system is empty @param errnopre errno prior to expression evaluation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param function cpl_func @param file __FILE__ @param line __LINE__ @see cpl_test_memory_is_empty @note This function should only be called from the macro cpl_test_memory_is_empty() */ /*----------------------------------------------------------------------------*/ void cpl_test_memory_is_empty_macro(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, const char * function, const char * file, unsigned line) { const char * message; cpl_boolean ok; if (cpl_memory_is_empty() == -1) { message = "CPL memory system is empty (not testable)"; ok = CPL_TRUE; } else { message = "CPL memory system is empty"; ok = cpl_memory_is_empty() == 0 ? CPL_FALSE : CPL_TRUE; } cpl_test_one(errnopre, twallpre, flopspre, statepre, ok, message, CPL_FALSE, function, file, line); if (!ok) { cpl_msg_indent_more(); cpl_memory_dump(); cpl_msg_indent_less(); } return; } /*----------------------------------------------------------------------------*/ /** @brief Finalize CPL and unit-testing environment and report any failures @param nfail The number of failures counted apart from cpl_test() et al. @return @em EXIT_SUCCESS iff the CPL errorstate is clean @note This function should be used for the final return from a unit test @see cpl_test_init() nfail should normally be zero, but may be set to a positive number when it is necessary to ensure a failure. nfail should only be negative in the unit test of the unit-test functions themselves. Example of usage: @code int main (void) { cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); cpl_test(myfunc(&p)); cpl_test(p != NULL); return cpl_test_end(0); } @endcode */ /*----------------------------------------------------------------------------*/ int cpl_test_end(cpl_size nfail) { const int errnopre = errno; const cpl_flops nflops = cpl_tools_get_flops(); cpl_boolean ok = CPL_TRUE; const cpl_size mfail = nfail + (cpl_size)cpl_test_failures; const double cpl_test_elap = cpl_test_get_walltime() - cpl_test_time_start; #if defined HAVE_SYS_TIMES_H && defined _SC_CLK_TCK && defined HAVE_SYSCONF struct tms buf; const clock_t clocks = times(&buf); const double cputime =(double)buf.tms_utime / (double)sysconf(_SC_CLK_TCK); const double systime =(double)buf.tms_stime / (double)sysconf(_SC_CLK_TCK); const double chcputime =(double)buf.tms_cutime / (double)sysconf(_SC_CLK_TCK); const double chsystime =(double)buf.tms_cstime / (double)sysconf(_SC_CLK_TCK); errno = 0; cpl_msg_debug(cpl_func, "Sizeof(clock_t): %u", (unsigned)sizeof(clocks)); cpl_msg_debug(cpl_func, "sysconf(_SC_CLK_TCK): %u", (unsigned)sysconf(_SC_CLK_TCK)); cpl_msg_info(cpl_func, "User time to test [s]: %g", cputime); cpl_msg_info(cpl_func, "System time to test [s]: %g", systime); cpl_msg_debug(cpl_func, "Child user time to test [s]: %g", chcputime); cpl_msg_debug(cpl_func, "Child system time to test [s]: %g", chsystime); #else errno = 0; #endif /* Need to close files here, to deallocate */ cpl_test_zero(cpl_io_fits_end()); if (cpl_test_elap > 0.0) { cpl_msg_info(cpl_func, "Actual time to test [s]: %g", cpl_test_elap); cpl_msg_info(cpl_func, "The computational speed during this test " "[MFLOP/s]: %g", 1e-6*(double)nflops/cpl_test_elap); } else { cpl_msg_info(cpl_func, "Number of MFLOPs in this test: %g", 1e-6*(double)nflops); } if (errnopre != 0) { cpl_msg_warning(cpl_func, "%s() was called with errno=%d: %s", cpl_func, errnopre, strerror(errnopre)); } /* Make sure that the failure is written */ if (cpl_msg_get_level() == CPL_MSG_OFF) cpl_msg_set_level(CPL_MSG_ERROR); if (cpl_error_get_code() != CPL_ERROR_NONE) { ok = CPL_FALSE; cpl_msg_error(cpl_func, "The CPL errorstate was set by the unit " "test(s)"); cpl_msg_indent_more(); cpl_errorstate_dump(cleanstate, CPL_FALSE, NULL); cpl_msg_indent_less(); } if (mfail > 0) { ok = CPL_FALSE; cpl_msg_error(cpl_func, "%" CPL_SIZE_FORMAT " of %" CPL_SIZE_FORMAT " test(s) failed", mfail, cpl_test_count); } else if (mfail < 0) { ok = CPL_FALSE; /* This special case is only foreseen to be reached by the unit test of the CPL unit test module */ cpl_msg_error(cpl_func, "%" CPL_SIZE_FORMAT " of %" CPL_SIZE_FORMAT " test(s) failed, %" CPL_SIZE_FORMAT " less than the " "expected %" CPL_SIZE_FORMAT " failure(s)", cpl_test_failures, cpl_test_count, -mfail, -nfail); } else { cpl_msg_info(cpl_func, "All %" CPL_SIZE_FORMAT " test(s) succeeded", cpl_test_count); } if (!cpl_memory_is_empty()) { ok = CPL_FALSE; cpl_msg_error(cpl_func, "Memory leak detected:"); cpl_msg_indent_more(); cpl_memory_dump(); cpl_msg_indent_less(); } else if (cpl_msg_get_level() <= CPL_MSG_DEBUG) { cpl_memory_dump(); } if (!ok) { char * desc = cpl_test_get_description(); cpl_msg_error(cpl_func, "This failure may indicate a bug in the tested " "code"); cpl_msg_error(cpl_func, "You can contribute to the improvement of the " "software by emailing the logfile '%s' and the configure " "logfile 'config.log' to %s", cpl_msg_get_log_name(), cpl_test_report ? cpl_test_report : PACKAGE_BUGREPORT); cpl_msg_error(cpl_func, "System specifics:\n%s", desc); cpl_free(desc); } cpl_test_dump_status(); if (errno != 0) { cpl_msg_warning(cpl_func, "%s() set errno=%d: %s", cpl_func, errno, strerror(errno)); errno = 0; } cpl_end(); return ok ? EXIT_SUCCESS : EXIT_FAILURE; } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Dump the CPL errorstate and reset it @param self The errorstate to reset to @return void */ /*----------------------------------------------------------------------------*/ static void cpl_test_reset(cpl_errorstate self) { if (!cpl_errorstate_is_equal(self)) { cpl_errorstate_dump(self, CPL_FALSE, cpl_errorstate_dump_debug); cpl_errorstate_set(self); } } /*----------------------------------------------------------------------------*/ /** @internal @brief Test an expression and update an internal counter if it fails @param errnopre errno prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param flopspre FLOP count prior to expression evaluation @param twallpre Wall clock time prior to expression calculation @param statepre CPL errorstate prior to expression evaluation @param expression The expression to test (CPL_FALSE means failure) @param message The text message associated with the expression @param function function name @param file filename @param line line number The CPL FLOP count, the CPL errorstate and errno may have changed prior to or during to the expression evaluation. Success or failure, any CPL errorstate change prior to expression evaluation, any CPL errorstate change during expression evaluation, any errno change prior to expression evaluation, any errno change during expression evaluation. */ /*----------------------------------------------------------------------------*/ static void cpl_test_one(int errnopre, double twallpre, cpl_flops flopspre, cpl_errorstate statepre, cpl_boolean expression, const char *message, cpl_boolean expect_error, const char *function, const char *file, unsigned line) { const int myerrno = errno; /* Local copy, in case errno changes in here */ char * errnopre_txt = errnopre == 0 ? NULL : cpl_sprintf(" Prior to this test errno=%d: %s.", errnopre, strerror(errnopre)); char * myerrno_txt = myerrno == errnopre ? NULL : cpl_sprintf(" This test set errno=%d: %s.", myerrno, strerror(myerrno)); const char * errnopre_msg = errnopre_txt == NULL ? "" : errnopre_txt; const char * myerrno_msg = myerrno_txt == NULL ? "" : myerrno_txt; const char * error_msg = cpl_errorstate_is_equal(cleanstate) ? "" : (expect_error ? (cpl_errorstate_is_equal(statepre) ? "" : "CPL error(s) set during this test.") : (cpl_errorstate_is_equal(statepre) ? " CPL error(s) set prior to this test." : (statepre == cleanstate ? " CPL error(s) set during this test." : " CPL error(s) set prior to and during this test."))); char * flopprev_txt = NULL; char * floptest_txt = NULL; assert(message != NULL); assert(function != NULL); assert(file != NULL); errno = 0; #ifdef _OPENMP #pragma omp atomic #endif cpl_test_count++; #ifdef _OPENMP #pragma omp master #endif { /* If two cpl_tests would be permitted to enter concurrently here, then the reported FLOP rate would be meaningless */ const double cpl_test_time_now = cpl_test_get_walltime(); const double cpl_test_time_prev = cpl_test_time_one; const cpl_flops cpl_test_flops_now = cpl_tools_get_flops(); const cpl_flops cpl_test_flops_prev = cpl_test_flops_one; cpl_test_time_one = cpl_test_time_now; cpl_test_flops_one = cpl_test_flops_now; if (flopspre > cpl_test_flops_prev) { const double cpl_test_time_between = twallpre - cpl_test_time_prev; const cpl_flops cpl_test_flops_between = flopspre - cpl_test_flops_prev; if (cpl_test_time_between > 0.0) { flopprev_txt = cpl_sprintf(" (%g FLOPs after the previous " "test and prior to this one at " "[MFLOP/s]: %g).", (double)cpl_test_flops_between, 1e-6*(double)cpl_test_flops_between /cpl_test_time_between); } else { flopprev_txt = cpl_sprintf(" (%g FLOPs after the previous test " "and prior to this one).", (double)cpl_test_flops_between); } } if (cpl_test_flops_now > flopspre) { const double cpl_test_time_during = cpl_test_time_now - twallpre; const cpl_flops cpl_test_flops_during = cpl_test_flops_now - flopspre; if (cpl_test_time_during > 0.0) { floptest_txt = cpl_sprintf(" (%g FLOPs during this test at " "[MFLOP/s]: %g).", (double)cpl_test_flops_during, 1e-6*(double)cpl_test_flops_during /cpl_test_time_during); } else { floptest_txt = cpl_sprintf(" (%g FLOPs during this test).", (double)cpl_test_flops_during); } } } if (flopprev_txt == NULL) flopprev_txt = cpl_strdup(""); if (floptest_txt == NULL) floptest_txt = cpl_strdup(""); if (expression) { cpl_boolean has_error = error_msg[0] ? CPL_TRUE : CPL_FALSE; (has_error ? cpl_msg_info : cpl_msg_debug) (function, "Test %" CPL_SIZE_FORMAT " OK at %s:%u: %s.%s%s%s%s%s", cpl_test_count, file, line, message, error_msg, errnopre_msg, myerrno_msg, flopprev_txt, floptest_txt); cpl_errorstate_dump(cleanstate, CPL_FALSE, has_error ? cpl_errorstate_dump_info : cpl_errorstate_dump_debug); } else { cpl_msg_error(function, "Test %" CPL_SIZE_FORMAT " failed at %s:%u: " "%s.%s%s%s%s%s", cpl_test_count, file, line, message, error_msg, errnopre_msg, myerrno_msg, flopprev_txt, floptest_txt); cpl_errorstate_dump(cleanstate, CPL_FALSE, NULL); #ifdef _OPENMP #pragma omp atomic #endif cpl_test_failures++; } cpl_free(errnopre_txt); cpl_free(myerrno_txt); cpl_free(flopprev_txt); cpl_free(floptest_txt); if (errno != 0) { cpl_msg_debug(cpl_func, "%s() set errno=%d: %s", cpl_func, errno, strerror(errno)); errno = 0; } return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Dump a single CPL error at debug messaging level @param self The number of the current error to be dumped @param first The number of the first error to be dumped @param last The number of the last error to be dumped @return void @see cpl_errorstate_dump_one */ /*----------------------------------------------------------------------------*/ static void cpl_errorstate_dump_debug(unsigned self, unsigned first, unsigned last) { const cpl_boolean is_reverse = first > last ? CPL_TRUE : CPL_FALSE; const unsigned newest = is_reverse ? first : last; const unsigned oldest = is_reverse ? last : first; const char * revmsg = is_reverse ? " in reverse order" : ""; assert( oldest <= self ); assert( newest >= self ); if (newest == 0) { cpl_msg_debug(cpl_func, "No error(s) to dump"); assert( oldest == 0); } else { assert( oldest > 0); assert( newest >= oldest); if (self == first) { if (oldest == 1) { cpl_msg_debug(cpl_func, "Dumping all %u error(s)%s:", newest, revmsg); } else { cpl_msg_debug(cpl_func, "Dumping the %u most recent error(s) " "out of a total of %u errors%s:", newest - oldest + 1, newest, revmsg); } cpl_msg_indent_more(); } cpl_msg_debug(cpl_func, "[%u/%u] '%s' (%u) at %s", self, newest, cpl_error_get_message(), cpl_error_get_code(), cpl_error_get_where()); if (self == last) cpl_msg_indent_less(); } } /*----------------------------------------------------------------------------*/ /** @internal @brief Dump a single CPL error at debug messaging level @param self The number of the current error to be dumped @param first The number of the first error to be dumped @param last The number of the last error to be dumped @return void @see cpl_errorstate_dump_debug */ /*----------------------------------------------------------------------------*/ static void cpl_errorstate_dump_info(unsigned self, unsigned first, unsigned last) { const cpl_boolean is_reverse = first > last ? CPL_TRUE : CPL_FALSE; const unsigned newest = is_reverse ? first : last; const unsigned oldest = is_reverse ? last : first; const char * revmsg = is_reverse ? " in reverse order" : ""; assert( oldest <= self ); assert( newest >= self ); if (newest == 0) { cpl_msg_info(cpl_func, "No error(s) to dump"); assert( oldest == 0); } else { assert( oldest > 0); assert( newest >= oldest); if (self == first) { if (oldest == 1) { cpl_msg_info(cpl_func, "Dumping all %u error(s)%s:", newest, revmsg); } else { cpl_msg_info(cpl_func, "Dumping the %u most recent error(s) " "out of a total of %u errors%s:", newest - oldest + 1, newest, revmsg); } cpl_msg_indent_more(); } cpl_msg_info(cpl_func, "[%u/%u] '%s' (%u) at %s", self, newest, cpl_error_get_message(), cpl_error_get_code(), cpl_error_get_where()); if (self == last) cpl_msg_indent_less(); } } /*----------------------------------------------------------------------------*/ /** @internal @brief First half of a string useful in error-reporting @return Pointer to a string literal useful in error-reporting */ /*----------------------------------------------------------------------------*/ static const char * cpl_test_get_description_a(void) { return "CPL version: " PACKAGE_VERSION #if defined CPL_SIZE_BITS && CPL_SIZE_BITS == 32 " (32-bit cpl_size)" #else " (64-bit cpl_size)" #endif "\n" #ifdef CFITSIO_VERSION "CFITSIO version: " CPL_STRINGIFY(CFITSIO_VERSION) "\n" #elif defined _FITSIO_H "CFITSIO version is less than 3.0\n" #endif #if defined WCSLIB_VERSION "WCSLIB version: " CPL_STRINGIFY(WCSLIB_VERSION) "\n" #elif defined CPL_WCS_INSTALLED && CPL_WCS_INSTALLED == 1 "WCSLIB installation is detected\n" #else "WCSLIB installation is not detected\n" #endif ; } /*----------------------------------------------------------------------------*/ /** @internal @brief Second half of a string useful in error-reporting @return Pointer to a string literal useful in error-reporting */ /*----------------------------------------------------------------------------*/ static const char * cpl_test_get_description_b(void) { return #ifdef _OPENMP CPL_XSTRINGIFY(_OPENMP) ": " CPL_STRINGIFY(_OPENMP) "\n" #endif #ifdef OFF_T "OFF_T is defined as " CPL_STRINGIFY(OFF_T) "\n" #else "OFF_T is not defined\n" #endif #if defined WORDS_BIGENDIAN && WORDS_BIGENDIAN == 1 "This platform is big-endian\n" #else "This platform is not big-endian\n" #endif #ifdef __DATE__ "Compile date: " __DATE__ "\n" #endif #ifdef __TIME__ "Compile time: " __TIME__ "\n" #endif #ifdef __STDC__ CPL_XSTRINGIFY(__STDC__) ": " CPL_STRINGIFY(__STDC__) "\n" #endif #ifdef __STDC_VERSION__ CPL_XSTRINGIFY(__STDC_VERSION__) ": " CPL_STRINGIFY(__STDC_VERSION__) "\n" #endif #ifdef __STDC_HOSTED__ CPL_XSTRINGIFY(__STDC_HOSTED__) ": " CPL_STRINGIFY(__STDC_HOSTED__) "\n" #endif #ifdef __STDC_IEC_559__ CPL_XSTRINGIFY(__STDC_IEC_559__) ": " CPL_STRINGIFY(__STDC_IEC_559__) "\n" #endif #ifdef __STDC_IEC_559_COMPLEX__ CPL_XSTRINGIFY(__STDC_IEC_559_COMPLEX__) ": " CPL_STRINGIFY(__STDC_IEC_559_COMPLEX__) "\n" #endif #ifdef __STRICT_ANSI__ /* gcc and Sun Studio 12.1 supports this */ CPL_XSTRINGIFY(__STRICT_ANSI__) ": " CPL_STRINGIFY(__STRICT_ANSI__) "\n" #endif #ifdef __GNUC__ "gcc version (major number): " CPL_STRINGIFY(__GNUC__) "\n" #ifdef __GNUC_MINOR__ "gcc version (minor number): " CPL_STRINGIFY(__GNUC_MINOR__) "\n" #endif #ifdef __GNUC_PATCHLEVEL__ "gcc version (patch level): " CPL_STRINGIFY(__GNUC_PATCHLEVEL__) "\n" #endif #ifdef __VERSION__ "Compiler version: " __VERSION__ "\n" #endif #ifdef __LP64__ CPL_XSTRINGIFY(__LP64__) ": " CPL_STRINGIFY(__LP64__) "\n" #endif #ifdef __PIC__ CPL_XSTRINGIFY(__PIC__) ": " CPL_STRINGIFY(__PIC__) "\n" #endif #ifdef __OPTIMIZE__ CPL_XSTRINGIFY(__OPTIMIZE__) ": " CPL_STRINGIFY(__OPTIMIZE__) "\n" #endif #ifdef __TIMESTAMP__ "Last modification of " __FILE__ ": " __TIMESTAMP__ "\n" #endif #endif ; } /*----------------------------------------------------------------------------*/ /** @internal @brief A string useful in error-reporting @return Pointer to a string literal useful in error-reporting */ /*----------------------------------------------------------------------------*/ static char * cpl_test_get_description(void) { return cpl_sprintf("%s" #if defined CPL_FFTW_INSTALLED && defined CPL_FFTWF_INSTALLED "FFTW version (single and double precision): %s\n%s", cpl_test_get_description_a(), fftw_version, #elif defined CPL_FFTW_INSTALLED "FFTW version (double precision only): %s\n%s", cpl_test_get_description_a(), fftw_version, #elif defined CPL_FFTWF_INSTALLED "FFTW version (single precision only): %s\n%s", cpl_test_get_description_a(), fftwf_version, #else "FFTW installation is not detected\n%s", cpl_test_get_description_a(), #endif cpl_test_get_description_b()); } /*----------------------------------------------------------------------------*/ /** @internal @brief Dump various process information */ /*----------------------------------------------------------------------------*/ static void cpl_test_dump_status(void) { #if defined HAVE_GETPID && defined CPL_TEST_DUMP_STATUS const pid_t pid = getpid(); char * file = cpl_sprintf("/proc/%u/status", (const unsigned)pid); FILE * stream = fopen(file, "r"); if (stream != NULL) { char line[CPL_MAX_MSG_LENGTH]; while (fgets(line, CPL_MAX_MSG_LENGTH, stream) != NULL) { /* Ignore newline */ char * retpos = memchr(line, '\n', CPL_MAX_MSG_LENGTH); if (retpos != NULL) *retpos = 0; cpl_msg_debug(cpl_func, "%s", line); } fclose(stream); } cpl_free(file); #endif return; } /*----------------------------------------------------------------------------*/ /** @internal @brief Some simple FITS validation @param filename The filename @param filename_string The filename as a string @note No input validation ! */ /*----------------------------------------------------------------------------*/ static char * cpl_test_fits_file(const char * filename, const char * filename_string) { char * self = NULL; #ifdef HAVE_SYS_STAT_H struct stat buf; const int error = stat(filename, &buf); if (error) { self = cpl_sprintf("%s => %s stat() returned %d: %s", filename_string, filename, error, strerror(errno)); } else { const off_t size = buf.st_size; if (size == 0) { self = cpl_sprintf("%s => %s has zero size", filename_string, filename); } else { const off_t rem = size % 2880; if (rem != 0) { self = cpl_sprintf("%s => %s has illegal size=%luB with %uB " "in excess of the 2880B-blocks", filename_string, filename, (long unsigned)size, (unsigned)rem); } } } #endif return self; } cpl-6.4.1/cplcore/cpl_vector.c0000644000460300003120000035231512242414310013147 00000000000000/* $Id: cpl_vector.c,v 1.201 2013-06-19 14:51:16 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-06-19 14:51:16 $ * $Revision: 1.201 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_vector_impl.h" #include "cpl_error_impl.h" #include "cpl_memory.h" #include "cpl_matrix.h" #include "cpl_vector_fit_impl.h" #include "cpl_tools.h" #include "cpl_math_const.h" #include "cpl_io_fits.h" #include #include #include #include /* Needed by memcpy() */ #include #include /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_vector Vector * * This module provides functions to handle @em cpl_vector. * * A @em cpl_vector is an object containing a list of values (as doubles) * and the (always positive) number of values. The functionalities provided * here are simple ones like sorting, statistics, or simple operations. * The @em cpl_bivector object is composed of two of these vectors. * * @par Synopsis: * @code * #include "cpl_vector.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Type definition -----------------------------------------------------------------------------*/ struct _cpl_vector_ { cpl_size size; double * data; }; /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static cpl_vector * cpl_vector_gen_lowpass_kernel(cpl_lowpass, cpl_size) CPL_ATTR_ALLOC; static double cpl_tools_sinc(double) CPL_ATTR_CONST; static cpl_error_code cpl_vector_fill_tanh_kernel(cpl_vector *, double); static void cpl_vector_fill_alpha_kernel(cpl_vector *, double, double) CPL_ATTR_NONNULL; static void cpl_vector_reverse_tanh_kernel(double *, cpl_size) CPL_ATTR_NONNULL; static int cpl_fit_gaussian_1d_compare(const void *left, const void *right) CPL_ATTR_PURE CPL_ATTR_NONNULL; static int gauss(const double x[], const double a[], double *result) CPL_ATTR_NONNULL; static int gauss_derivative(const double x[], const double a[], double result[]) CPL_ATTR_NONNULL; inline static double cpl_erf_antideriv(double, double) CPL_ATTR_CONST; static cpl_error_code cpl_vector_fill_lss_profile_symmetric(cpl_vector *, double, double); /*----------------------------------------------------------------------------- Private types -----------------------------------------------------------------------------*/ typedef struct { double x; double y; } cpl_vector_fit_gaussian_input; /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Create a new cpl_vector @param n Number of element of the cpl_vector @return 1 newly allocated cpl_vector or NULL in case of an error The returned object must be deallocated using cpl_vector_delete(). There is no default values assigned to the created object, they are undefined until they are set. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if n is negative or zero */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_vector_new(cpl_size n) { cpl_vector * self = NULL; if (n <= 0) { (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "n=%" CPL_SIZE_FORMAT " < 1", n); } else { /* Allocate memory */ self = (cpl_vector*)cpl_malloc(sizeof(cpl_vector)); self->size = n; self->data = (double*)cpl_malloc((size_t)n * sizeof(double)); } return self; } /*----------------------------------------------------------------------------*/ /** @brief Create a cpl_vector from existing data @param n Number of elements in the vector @param data Pointer to array of n doubles @return 1 newly allocated cpl_vector or NULL in case of an error The returned object must be deallocated using cpl_vector_unwrap(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if n is negative or zero */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_vector_wrap(cpl_size n, double * data) { cpl_vector * self = (cpl_vector *)cpl_vector_rewrap(NULL, n, data); if (self == NULL) (void)cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @internal @brief Replace the buffer in a CPL vector with a new one @param self NULL or CPL vector to process @param n Number of elements in the new vector @param data Pointer to array of n doubles @return A pointer to the old data array or NULL if the input is NULL. @note The returned pointer must be deallocated If self is NULL a new vector is created by wrapping around the provided buffer, in that case this new cpl_vector is returned Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if n is negative or zero */ /*----------------------------------------------------------------------------*/ void * cpl_vector_rewrap(cpl_vector * self, cpl_size n, double * data) { void * ptr = NULL; if (n <= 0) { (void)cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "n=%" CPL_SIZE_FORMAT " < 1", n); } else if (data == NULL) { (void)cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "data"); } else { if (self == NULL) { ptr = cpl_malloc(sizeof(cpl_vector)); /* Return new cpl_vector */ self = (cpl_vector*)ptr; } else { ptr = (double*)self->data; /* Return old buffer */ } self->size = n; self->data = data; } return ptr; } /*----------------------------------------------------------------------------*/ /** @brief Delete a cpl_vector @param v cpl_vector to delete @return void If the vector @em v is @c NULL, nothing is done and no error is set. */ /*----------------------------------------------------------------------------*/ void cpl_vector_delete(cpl_vector * v) { if (v == NULL) return; if (v->data != NULL) cpl_free(v->data); cpl_free(v); return; } /*----------------------------------------------------------------------------*/ /** @brief Delete a cpl_vector except the data array @param v cpl_vector to delete @return A pointer to the data array or NULL if the input is NULL. @note The data array must subsequently be deallocated. Failure to do so will result in a memory leak. */ /*----------------------------------------------------------------------------*/ void * cpl_vector_unwrap(cpl_vector * v) { void * data; if (v == NULL) return NULL; data = (void *) v->data; cpl_free(v); return data; } /*----------------------------------------------------------------------------*/ /** @brief Read a list of values from an ASCII file and create a cpl_vector @param filename Name of the input ASCII file @return 1 newly allocated cpl_vector or NULL in case of an error @see cpl_vector_dump Parse an input ASCII file values and create a cpl_vector from it Lines beginning with a hash are ignored, blank lines also. In valid lines the value is preceeded by an integer, which is ignored. The returned object must be deallocated using cpl_vector_delete() In addition to normal files, FIFO (see man mknod) are also supported. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_FILE_IO if the file cannot be read - CPL_ERROR_BAD_FILE_FORMAT if the file contains no valid lines */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_vector_read(const char * filename) { FILE * in; cpl_vector * v; cpl_size np = 0; cpl_size size = 1000; /* Default size */ char line[1024]; double x; int error; cpl_ensure(filename != NULL, CPL_ERROR_NULL_INPUT, NULL); /* Open the file */ in = fopen(filename, "r"); cpl_ensure(in != NULL, CPL_ERROR_FILE_IO, NULL); /* Create and fill the vector */ v = cpl_vector_new(size); while (fgets(line, 1024, in) != NULL) { if (line[0] != '#' && sscanf(line, "%*d %lg", &x) == 1) { /* Found new element - increase vector size if necessary, - insert element at end and - increment size counter */ if (np == size) cpl_vector_set_size(v, size *= 2); cpl_vector_set(v, np++, x); } } /* Check that the loop ended due to eof and not an error */ error = ferror(in); fclose(in); if (error) { cpl_vector_delete(v); v = NULL; (void)cpl_error_set_(CPL_ERROR_FILE_IO); } else if (np == 0) { cpl_vector_delete(v); v = NULL; (void)cpl_error_set_(CPL_ERROR_BAD_FILE_FORMAT); } else if (cpl_vector_set_size(v, np)) { cpl_vector_delete(v); v = NULL; (void)cpl_error_set_where_(); } return v; } /*----------------------------------------------------------------------------*/ /** @brief Dump a cpl_vector as ASCII to a stream @param v Input cpl_vector to dump @param stream Output stream, accepts @c stdout or @c stderr @return void Each element is preceded by its index number (starting with 1!) and written on a single line. Comment lines start with the hash character. stream may be NULL in which case @c stdout is used. @note In principle a cpl_vector can be saved using cpl_vector_dump() and re-read using cpl_vector_read(). This will however introduce significant precision loss due to the limited accuracy of the ASCII representation. */ /*----------------------------------------------------------------------------*/ void cpl_vector_dump( const cpl_vector * v, FILE * stream) { cpl_size i; if (stream == NULL) stream = stdout; fprintf(stream, "#----- vector -----\n"); if (v == NULL) { fprintf(stream, "#NULL vector\n"); return; } fprintf(stream, "#Index\t\tX\n"); for (i = 0; isize; i++) fprintf(stream, "%" CPL_SIZE_FORMAT "\t\t%g\n", i+1, v->data[i]); fprintf(stream, "#------------------\n"); return; } /*----------------------------------------------------------------------------*/ /** @brief Load a list of values from a FITS file @param filename Name of the input file @param xtnum Extension number in the file (0 for primary HDU) @return 1 newly allocated cpl_vector or NULL in case of an error @see cpl_vector_save This function loads a vector from a FITS file (NAXIS=1), using cfitsio. The returned image has to be deallocated with cpl_vector_delete(). 'xtnum' specifies from which extension the vector should be loaded. This could be 0 for the main data section or any number between 1 and N, where N is the number of extensions present in the file. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the extension is not valid - CPL_ERROR_FILE_IO if the file cannot be read - CPL_ERROR_UNSUPPORTOED_MODE if the file is too large to be read */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_vector_load(const char * filename, cpl_size xtnum) { const int ixtnum = (int)xtnum; fitsfile * fptr; int error = 0; void * data; CPL_FITSIO_TYPE nx; const CPL_FITSIO_TYPE fpixel[1] = {1}; int naxis; /* Test entries */ cpl_ensure(filename != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(xtnum >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure((cpl_size)ixtnum == xtnum, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Open the file */ if (cpl_io_fits_open_diskfile(&fptr, filename, READONLY, &error)) { (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_open_diskfile, "filename='%s', xtnum=%" CPL_SIZE_FORMAT, filename, xtnum); return NULL; } /* The open call may be reusing file handle opened for previous I/O, so the file pointer needs to be moved also for xtnum = 0 */ if (fits_movabs_hdu(fptr, ixtnum + 1, NULL, &error)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_movabs_hdu, "filename='%s', xtnum=%" CPL_SIZE_FORMAT, filename, xtnum); return NULL; } /* Get the HDU dimension */ if (fits_get_img_dim(fptr, &naxis, &error)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_get_img_dim, "filename='%s', xtnum=%" CPL_SIZE_FORMAT, filename, xtnum); return NULL; } if (naxis != 1) { cpl_io_fits_close_file(fptr, &error); (void)cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "filename='%s', xtnum=%" CPL_SIZE_FORMAT ", naxis=%d", filename, xtnum, naxis); return NULL; } if (CPL_FITSIO_GET_SIZE(fptr, 1, &nx, &error)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, CPL_FITSIO_GET_SIZE, "filename='%s', xtnum=%" CPL_SIZE_FORMAT, filename, xtnum); return NULL; } if (nx < 1) { cpl_io_fits_close_file(fptr, &error); (void)cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "file" "name='%s', xtnum=%" CPL_SIZE_FORMAT ", " "nx=%lld", filename, xtnum, (long long)nx); return NULL; } /* FIXME: Change 1st (unlikely) if-clause to ifdef */ if (sizeof(nx) > sizeof(cpl_size) && nx != (cpl_size)nx) { cpl_io_fits_close_file(fptr, &error); (void)cpl_error_set_message_(CPL_ERROR_UNSUPPORTED_MODE, "file" "name='%s', xtnum=%" CPL_SIZE_FORMAT ", " "nx=%lld", filename, xtnum, (long long)nx); return NULL; } /* Create the vector */ data = cpl_malloc((size_t)nx * sizeof(double)); /* Read */ if (CPL_FITSIO_READ_PIX(fptr, TDOUBLE, fpixel, (LONGLONG)nx, NULL, data, NULL, &error)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); cpl_free(data); (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, CPL_FITSIO_READ_PIX_E, "filename='%s', xtnum=%" CPL_SIZE_FORMAT ", nx=%lld", filename, xtnum, (long long)nx); return NULL; } if (cpl_io_fits_close_file(fptr, &error)) { cpl_free(data); (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_close_file, "filename='%s', xtnum=%" CPL_SIZE_FORMAT ", nx=%lld", filename, xtnum, (long long)nx); return NULL; } return cpl_vector_wrap(nx, (double*)data); } /*----------------------------------------------------------------------------*/ /** @brief Save a vector to a FITS file @param self Vector to write to disk or NULL @param filename Name of the file to write @param type The type used to represent the data in the file @param pl Property list for the output header or NULL @param mode The desired output options (combined with bitwise or) @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error This function saves a vector to a FITS file (NAXIS=1), using cfitsio. If a property list is provided, it is written to the named file before the pixels are written. If the image is not provided, the created file will only contain the primary header. This can be useful to create multiple extension files. The type used in the file can be one of: CPL_TYPE_UCHAR (8 bit unsigned), CPL_TYPE_SHORT (16 bit signed), CPL_TYPE_USHORT (16 bit unsigned), CPL_TYPE_INT (32 bit signed), CPL_TYPE_FLOAT (32 bit floating point), or CPL_TYPE_DOUBLE (64 bit floating point). Use CPL_TYPE_DOUBLE when no loss of information is required. Supported output modes are CPL_IO_CREATE (create a new file) and CPL_IO_EXTEND (append to an existing file) If you are in append mode, make sure that the file has writing permissions. You may have problems if you create a file in your application and append something to it with the umask set to 222. In this case, the file created by your application would not be writable, and the append would fail. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the type or the mode is not supported - CPL_ERROR_FILE_NOT_CREATED if the output file cannot be created - CPL_ERROR_FILE_IO if the data cannot be written to the file - CPL_ERROR_UNSUPPORTOED_MODE if the file is too large to be saved */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_save(const cpl_vector * self, const char * filename, cpl_type type, const cpl_propertylist * pl, unsigned mode) { if (self == NULL) { return cpl_propertylist_save(pl, filename, mode) ? cpl_error_set_where_() : CPL_ERROR_NONE; } else { fitsfile * fptr; int error = 0; const char * badkeys = mode & CPL_IO_EXTEND ? CPL_FITS_BADKEYS_EXT "|" CPL_FITS_COMPRKEYS : CPL_FITS_BADKEYS_PRIM "|" CPL_FITS_COMPRKEYS; /* Create the vector in the primary unit */ const CPL_FITSIO_TYPE naxes[1] = {self->size}; const int bpp = cpl_tools_get_bpp(type); cpl_ensure_code(filename != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(bpp, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(mode == CPL_IO_CREATE || mode == CPL_IO_EXTEND, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(sizeof(CPL_FITSIO_TYPE) >= sizeof(cpl_size) || (cpl_size)naxes[0] == self->size, CPL_ERROR_UNSUPPORTED_MODE); if (mode & CPL_IO_EXTEND) { /* Open the file */ if (cpl_io_fits_open_diskfile(&fptr, filename, READWRITE, &error)) { return cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_open_diskfile, "filename='%s', " "type=%d, mode=%u", filename, type, mode); } } else { /* Create the file */ char * sval = cpl_sprintf("!%s", filename); cpl_io_fits_create_file(&fptr, sval, &error); cpl_free(sval); if (error) { return cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_create_file, "filename='%s', " "type=%d, mode=%u", filename, type, mode); } } if (CPL_FITSIO_CREATE_IMG(fptr, bpp, 1, naxes, &error)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, error, CPL_FITSIO_CREATE_IMG_E, "filename='%s', " "type=%d, mode=%u", filename, type, mode); } /* Add DATE */ if ((mode & CPL_IO_CREATE) && fits_write_date(fptr, &error)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_write_date, "filename='%s', " "type=%d, mode=%u", filename, type, mode); } /* Add the property list */ if (cpl_fits_add_properties(fptr, pl, badkeys)) { return cpl_io_fits_close_file(fptr, &error) ? cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_close_file, "filename='%s', " "type=%d, mode=%u", filename, type, mode) : cpl_error_set_where_(); } if (fits_write_img(fptr, TDOUBLE, 1, (LONGLONG)self->size, (void*)self->data, &error)) { int error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_write_img, "filename='%s', " "type=%d, mode=%u", filename, type, mode); } /* Close (and write to disk) */ return cpl_io_fits_close_file(fptr, &error) ? cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_close_file, "filename='%s', " "type=%d, mode=%u", filename, type, mode) : CPL_ERROR_NONE; } } /*----------------------------------------------------------------------------*/ /** @brief This function duplicates an existing vector and allocates memory @param v the input cpl_vector @return a newly allocated cpl_vector or NULL in case of an error The returned object must be deallocated using cpl_vector_delete() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_vector_duplicate(const cpl_vector * v) { cpl_vector * out; /* Test inputs */ cpl_ensure(v != NULL, CPL_ERROR_NULL_INPUT, NULL); /* Create a new cpl_vector */ out = cpl_vector_new(v->size); /* Copy the contents */ cpl_vector_copy(out, v); return out; } /*----------------------------------------------------------------------------*/ /** @brief This function copies contents of a vector into another vector @param destination destination cpl_vector @param source source cpl_vector @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_vector_set_size() if source and destination have different sizes. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_copy( cpl_vector * destination, const cpl_vector * source) { cpl_ensure_code(source != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(!cpl_vector_set_size(destination, source->size), cpl_error_get_code()); memcpy(destination->data, source->data, (size_t)source->size * sizeof(double)); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Get the size of the vector @param in the input vector @return The size or -1 in case of an error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_vector_get_size(const cpl_vector * in) { /* Test entries */ cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, -1); return in->size; } /*----------------------------------------------------------------------------*/ /** @brief Resize the vector @param in The vector to be resized @param newsize The new (positive) number of elements in the vector @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @note On succesful return the value of the elements of the vector is unchanged to the minimum of the old and new sizes; any newly allocated elements are undefined. The pointer to the vector data buffer may change, therefore pointers previously retrieved by calling @c cpl_vector_get_data() should be discarded. If the vector was created with cpl_vector_wrap() the argument pointer to that call should be discarded as well. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if newsize is negative or zero */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_set_size(cpl_vector * in, cpl_size newsize) { cpl_ensure_code(in != NULL, CPL_ERROR_NULL_INPUT); if (in->size != newsize) { cpl_ensure_code(newsize > 0, CPL_ERROR_ILLEGAL_INPUT); in->data = (double*)cpl_realloc(in->data, (size_t)newsize * sizeof(double)); in->size = newsize; } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Get a pointer to the data part of the vector @param in the input vector @return Pointer to the data or NULL in case of an error The returned pointer refers to already allocated data. @note Use at your own risk: direct manipulation of vector data rules out any check performed by the vector object interface, and may introduce inconsistencies between the information maintained internally, and the actual vector data and structure. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ double * cpl_vector_get_data(cpl_vector * in) { /* Test entries */ cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, NULL); assert( in->data ); return in->data; } /*----------------------------------------------------------------------------*/ /** @brief Get a pointer to the data part of the vector @param in the input vector @return Pointer to the data or NULL in case of an error @see cpl_vector_get_data */ /*----------------------------------------------------------------------------*/ const double * cpl_vector_get_data_const(const cpl_vector * in) { /* Test entries */ cpl_ensure(in != NULL, CPL_ERROR_NULL_INPUT, NULL); assert( in->data ); return in->data; } /*----------------------------------------------------------------------------*/ /** @brief Get an element of the vector @param in the input vector @param idx the index of the element (0 to nelem-1) @return The element value In case of error, the #_cpl_error_code_ code is set, and the returned double is undefined. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if idx is negative - CPL_ERROR_ACCESS_OUT_OF_RANGE if idx is out of the vector bounds */ /*----------------------------------------------------------------------------*/ double cpl_vector_get(const cpl_vector * in, cpl_size idx) { /* Test entries */ cpl_ensure(in, CPL_ERROR_NULL_INPUT, -1.0); cpl_ensure(idx >= 0, CPL_ERROR_ILLEGAL_INPUT, -2.0); cpl_ensure(idx < in->size, CPL_ERROR_ACCESS_OUT_OF_RANGE, -3.0); return in->data[idx]; } /*----------------------------------------------------------------------------*/ /** @brief Set an element of the vector @param in the input vector @param idx the index of the element (0 to nelem-1) @param value the value to set in the vector @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if idx is negative - CPL_ERROR_ACCESS_OUT_OF_RANGE if idx is out of the vector bounds */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_set( cpl_vector * in, cpl_size idx, double value) { /* Test entries */ cpl_ensure_code(in != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(idx >= 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(idx < in->size, CPL_ERROR_ACCESS_OUT_OF_RANGE); /* Assign the value */ in->data[idx] = value; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Add a cpl_vector to another @param v1 First cpl_vector (modified) @param v2 Second cpl_vector @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error The second vector is added to the first one. The input first vector is modified. The input vectors must have the same size. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if v1 and v2 have different sizes */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_add( cpl_vector * v1, const cpl_vector * v2) { cpl_size i; /* Test inputs */ cpl_ensure_code(v1 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(v2 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(v1->size == v2->size, CPL_ERROR_INCOMPATIBLE_INPUT); /* Add v2 to v1 */ for (i = 0; i < v1->size; i++) v1->data[i] += v2->data[i]; cpl_tools_add_flops(v1->size); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Subtract a cpl_vector from another @param v1 First cpl_vector (modified) @param v2 Second cpl_vector @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_vector_add() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_subtract( cpl_vector * v1, const cpl_vector * v2) { cpl_size i; /* Test inputs */ cpl_ensure_code(v1 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(v2 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(v1->size == v2->size, CPL_ERROR_INCOMPATIBLE_INPUT); /* subtract v2 from v1 */ for (i = 0; i < v1->size; i++) v1->data[i] -= v2->data[i]; cpl_tools_add_flops(v1->size); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Multiply two vectors component-wise @param v1 First cpl_vector @param v2 Second cpl_vector @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_vector_add() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_multiply( cpl_vector * v1, const cpl_vector * v2) { cpl_size i; /* Test inputs */ cpl_ensure_code(v1 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(v2 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(v1->size == v2->size, CPL_ERROR_INCOMPATIBLE_INPUT); /* Multiply the cpl_vector fields */ for (i = 0; i < v1->size; i++) v1->data[i] *= v2->data[i]; cpl_tools_add_flops(v1->size); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Divide two vectors element-wise @param v1 First cpl_vector @param v2 Second cpl_vector @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_vector_add() If an element in v2 is zero v1 is not modified and CPL_ERROR_DIVISION_BY_ZERO is returned. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if v1 and v2 have different sizes - CPL_ERROR_DIVISION_BY_ZERO if a division by 0 would occur */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_divide( cpl_vector * v1, const cpl_vector * v2) { cpl_size i; /* Test inputs */ cpl_ensure_code(v1 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(v2 != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(v1->size == v2->size, CPL_ERROR_INCOMPATIBLE_INPUT); for (i = 0; i < v2->size; i++) cpl_ensure_code(v2->data[i] != 0, CPL_ERROR_DIVISION_BY_ZERO); /* Divide the cpl_vector fields */ for (i = 0; i < v1->size; i++) v1->data[i] /= v2->data[i]; cpl_tools_add_flops(v1->size); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Compute the vector dot product. @param v1 One vector @param v2 Another vector of the same size @return The (non-negative) product or negative on error. The same vector may be passed twice, in which case the square of its 2-norm is computed. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if v1 and v2 have different sizes */ /*----------------------------------------------------------------------------*/ double cpl_vector_product(const cpl_vector * v1, const cpl_vector * v2) { const double * x = cpl_vector_get_data_const(v1); const double * y = cpl_vector_get_data_const(v2); const cpl_size n = cpl_vector_get_size(v1); double sum = 0; cpl_size i; cpl_ensure(x, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(y, CPL_ERROR_NULL_INPUT, -2); cpl_ensure(cpl_vector_get_size(v2) == n, CPL_ERROR_INCOMPATIBLE_INPUT, -3); for (i = 0; i < n; i++) sum += x[i] * y[i]; cpl_tools_add_flops(2*n); return sum; } /*----------------------------------------------------------------------------*/ /** @brief Sort a cpl_vector @param self cpl_vector to sort in place @param dir CPL_SORT_ASCENDING or CPL_SORT_DESCENDING @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error The input cpl_vector is modified to sort its values in either ascending (CPL_SORT_ASCENDING) or descending (CPL_SORT_DESCENDING) order. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if dir is neither CPL_SORT_DESCENDING nor CPL_SORT_ASCENDING */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_sort(cpl_vector * self, cpl_sort_direction dir) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); /* Sort by increasing data */ if (cpl_tools_sort_double(self->data, self->size)) { return cpl_error_set_where_(); } if (dir == CPL_SORT_DESCENDING) { /* Invert the order. FIXME: Avoid this overhead */ size_t i; for (i=0; i < (size_t)self->size/2; i++) { const double tmp = self->data[i]; self->data[i] = self->data[self->size - i - 1]; self->data[self->size - i - 1] = tmp; } } else if (dir != CPL_SORT_ASCENDING) { return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Fill a cpl_vector @param v cpl_vector to be filled with the value val @param val Value used to fill the cpl_vector @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error Input vector is modified Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_fill(cpl_vector * v, double val) { cpl_size i; cpl_ensure_code(v, CPL_ERROR_NULL_INPUT); for (i = 0; isize; i++) v->data[i] = val; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Compute the sqrt of a cpl_vector @param v cpl_vector @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error The sqrt of the data is computed. The input cpl_vector is modified If an element in v is negative v is not modified and CPL_ERROR_ILLEGAL_INPUT is returned. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if one of the vector values is negative */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_sqrt(cpl_vector * v) { cpl_size i; /* Test inputs */ cpl_ensure_code(v!=NULL, CPL_ERROR_NULL_INPUT); for (i = 0; isize; i++) cpl_ensure_code(v->data[i] >= 0, CPL_ERROR_ILLEGAL_INPUT); /* Compute the sqrt */ for (i = 0; i < v->size; i++) v->data[i] = sqrt(v->data[i]); cpl_tools_add_flops(v->size); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief In a sorted vector find the element closest to the given value @param sorted CPL vector sorted using CPL_SORT_ASCENDING @param key Value to find @return The index that minimizes fabs(sorted[index] - key) or negative on error @see cpl_vector_sort() Bisection is used to find the element. If two (neighboring) elements with different values both minimize fabs(sorted[index] - key) the index of the larger element is returned. If the vector contains identical elements that minimize fabs(sorted[index] - key) then it is undefined which element has its index returned. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if two elements are found to not be sorted */ /*----------------------------------------------------------------------------*/ cpl_size cpl_vector_find(const cpl_vector * sorted, double key) { cpl_size low, high; /* Test inputs */ cpl_ensure(sorted != NULL, CPL_ERROR_NULL_INPUT, -1); /* Initialize */ low = 0; high = sorted->size - 1; cpl_ensure(sorted->data[low] <= sorted->data[high], CPL_ERROR_ILLEGAL_INPUT, -2); if (key <= sorted->data[ low]) return low; if (key >= sorted->data[high]) return high; /* key is in the range of the vector values */ while (high - low > 1) { const cpl_size middle = low + (high - low) / 2; /* Three or four comparisons are done per iteration, however with the non-localized access pattern data reads will likely dominate the cost */ cpl_ensure(sorted->data[low] <= sorted->data[middle], CPL_ERROR_ILLEGAL_INPUT, -3); cpl_ensure(sorted->data[middle] <= sorted->data[high], CPL_ERROR_ILLEGAL_INPUT, -4); if (sorted->data[middle] > key) high = middle; else if (sorted->data[middle] < key) low = middle; else low = high = middle; } /* assert( low == high || low == high - 1); */ return key - sorted->data[low] < sorted->data[high] - key ? low : high; } /*----------------------------------------------------------------------------*/ /** @brief Extract a sub_vector from a vector @param v Input cpl_vector @param istart Start index (from 0 to number of elements - 1) @param istop Stop index (from 0 to number of elements - 1) @param istep Extract every step element @return A newly allocated cpl_vector or NULL in case of an error The returned object must be deallocated using cpl_vector_delete() FIXME: Currently istop must be greater than istart. FIXME: Currently istep must equal 1. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if istart, istop, istep are not as requested */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_vector_extract( const cpl_vector * v, cpl_size istart, cpl_size istop, cpl_size istep) { cpl_vector * out; /* Test inputs */ cpl_ensure(v, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(istart >= 0, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); cpl_ensure(istart <= istop, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(istep == 1, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(istop < v->size, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); /* Allocate and fill the output vector */ out = cpl_vector_new(istop - istart + 1); assert( out ); memcpy(out->data, &(v->data[istart]), (size_t)out->size * sizeof(double)); return out; } /*----------------------------------------------------------------------------*/ /** @brief Get the minimum of the cpl_vector @param v const cpl_vector @return The minimum value of the vector or undefined on error In case of error, the #_cpl_error_code_ code is set, and the returned double is undefined. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ double cpl_vector_get_min(const cpl_vector * v) { double min; cpl_size i; /* Test entries */ cpl_ensure(v != NULL, CPL_ERROR_NULL_INPUT, -1.0); min = v->data[0]; for (i=1; isize; i++) if (v->data[i] < min) min = v->data[i]; return min; } /*----------------------------------------------------------------------------*/ /** @brief Get the maximum of the cpl_vector @param v const cpl_vector @return the maximum value of the vector or undefined on error @see cpl_vector_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_vector_get_max(const cpl_vector * v) { double max; cpl_size i; /* Test entries */ cpl_ensure(v != NULL, CPL_ERROR_NULL_INPUT, -1.0); max = v->data[0]; for (i=1; i < v->size; i++) if (v->data[i] > max) max = v->data[i]; return max; } /*----------------------------------------------------------------------------*/ /** @brief Get the sum of the elements of the cpl_vector @param v const cpl_vector @return the sum of the elements of the vector or undefined on error @see cpl_vector_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_vector_get_sum(const cpl_vector * v) { double sum = 0.0; cpl_size i; /* Test entries */ cpl_ensure(v != NULL, CPL_ERROR_NULL_INPUT, -1.0); for (i=0; i < v->size; i++) sum += v->data[i]; return sum; } /*----------------------------------------------------------------------------*/ /** @brief Compute the mean value of vector elements. @param v Input const cpl_vector @return Mean value of vector elements or undefined on error. @see cpl_vector_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_vector_get_mean(const cpl_vector * v) { cpl_ensure(v != NULL, CPL_ERROR_NULL_INPUT, -1.0); return cpl_tools_get_mean_double(v->data, v->size); } /*----------------------------------------------------------------------------*/ /** @brief Compute the median of the elements of a vector. @param v Input cpl_vector @return Median value of the vector elements or undefined on error. @see cpl_vector_get_median_const() @note For efficiency reasons, this function modifies the order of the elements of the input vector. */ /*----------------------------------------------------------------------------*/ double cpl_vector_get_median(cpl_vector * v) { cpl_ensure(v != NULL, CPL_ERROR_NULL_INPUT, 0.0); return cpl_tools_get_median_double(v->data, v->size); } /*----------------------------------------------------------------------------*/ /** @brief Compute the median of the elements of a vector. @param v Input const cpl_vector @return Median value of the vector elements or undefined on error. @see cpl_vector_get_min() For a finite population or sample, the median is the middle value of an odd number of values (arranged in ascending order) or any value between the two middle values of an even number of values. The criteria used for an even number of values in the input array is to choose the mean between the two middle values. Note that in this case, the median might not be a value of the input array. Also, note that in the case of integer data types, the result will be converted to an integer. Consider to transform your int array to float if that is not the desired behavior. */ /*----------------------------------------------------------------------------*/ double cpl_vector_get_median_const(const cpl_vector * v) { double * darr; double med; cpl_ensure(v != NULL, CPL_ERROR_NULL_INPUT, 0.0); /* Create a separate data buffer because */ /* cpl_tools_get_median_double() modifies its input */ darr = (double*)cpl_malloc((size_t)v->size * sizeof(*darr)); memcpy(darr, v->data, (size_t)v->size * sizeof(double)); med = cpl_tools_get_median_double(darr, v->size); cpl_free(darr); return med; } /*----------------------------------------------------------------------------*/ /** @brief Compute the bias-corrected standard deviation of a vectors elements @param v Input const cpl_vector @return standard deviation of the elements or a negative number on error. @see cpl_vector_get_min() S(n-1) = sqrt((1/n-1) sum((xi-mean)^2) (i=1 -> n) The length of v must be at least 2. */ /*----------------------------------------------------------------------------*/ double cpl_vector_get_stdev(const cpl_vector * v) { double varsum; cpl_ensure(v != NULL, CPL_ERROR_NULL_INPUT,-1); cpl_ensure(v->size > 1, CPL_ERROR_ILLEGAL_INPUT,-2); varsum = cpl_tools_get_variancesum_double(v->data, v->size, NULL); /* Compute the bias-corrected standard deviation. - With the recurrence relation rounding can likely not cause the variance to become negative, but check just to be safe */ return sqrt(varsum / (double) (v->size-1)); } /*----------------------------------------------------------------------------*/ /** @brief Cross-correlation of two vectors @param vxc Odd-sized vector with the computed cross-correlations @param v1 1st vector to correlate @param v2 2nd vector to correlate @return Index of maximum cross-correlation, or negative on error vxc must have an odd number of elements, 2*half_search+1, where half_search is the half-size of the search domain. The length of v2 may not exceed that of v1. If the difference in length between v1 and v2 is less than half_search then this difference must be even (if the difference is odd resampling of v2 may be useful). The cross-correlation is computed with shifts ranging from -half_search to half_search. On succesful return element i (starting with 0) of vxc contains the cross- correlation at offset i-half_search. On error vxc is unmodified. The cross-correlation is in fact the dot-product of two unit-vectors and ranges therefore from -1 to 1. The cross-correlation is, in absence of rounding errors, commutative only for equal-sized vectors, i.e. changing the order of v1 and v2 will move element j in vxc to 2*half_search - j and thus change the return value from i to 2*half_search - i. If, in absence of rounding errors, more than one shift would give the maximum cross-correlation, rounding errors may cause any one of those shifts to be returned. If rounding errors have no effect the index corresponding to the shift with the smallest absolute value is returned (with preference given to the smaller of two indices that correspond to the same absolute shift). If v1 is longer than v2, the first element in v1 used for the resulting cross-correlation is max(0,shift + (cpl_vector_get_size(v1)-cpl_vector_get_size(v2))/2). Cross-correlation with half_search == 0 requires about 8n FLOPs, where n = cpl_vector_get_size(v2). Each increase of half_search by 1 requires about 4n FLOPs more, when all of v2's elements can be cross-correlated, otherwise the extra cost is about 4m, where m is the number of elements in v2 that can be cross-correlated, n - half_search <= m < n. In case of error, the #_cpl_error_code_ code is set, and the returned delta and cross-correlation is undefined. Example of 1D-wavelength calibration (error handling omitted for brevity): @code cpl_vector * model = my_model(dispersion); cpl_vector * vxc = cpl_vector_new(1+2*maxshift); const cpl_size shift = cpl_vector_correlate(vxc, model, observed) - maxshift; cpl_error_code error = cpl_polynomial_shift_1d(dispersion, 0, (double)shift); cpl_msg_info(cpl_func, "Shifted dispersion relation by %" CPL_SIZE_FORMAT " pixels, shift); @endcode Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if v1 and v2 have different sizes or if vxc is not as requested */ /*----------------------------------------------------------------------------*/ cpl_size cpl_vector_correlate(cpl_vector * vxc, const cpl_vector * v1, const cpl_vector * v2) { /* FIXME: The API should be extended with a boolean @param is_cyclic Use a cyclic boundary => v1 and v2 must have equal size The API should be extended with an integer @param ishift2 Expected shift of v2 relative to v1. :-((((((((((((( This would allow the caller to specify an asymmetric search range, which would be very useful for example when x-correlating two nodded images of identical size each with their spatial direction collapsed into a 1D-spatial profile. Example: Two such spatial profiles of length 1000 may each contain a bright feature, one at pixel position 600 then other at 400, each with an uncertainty of hsearch=10. Define ishift2 = 600 - 400 = 200. In order to find the correlation maximum with the current API, the length of vxc must be 1 + 2 * (hsearch + abs(ishift2)) = 421, but with ishift2 available inside cpl_vector_correlate(), the length of vxc can be kept at the optimal 1 + 2 * hsearch = 21. The missing ishift2 causes not only a large computational overhead, but also a risk of finding a false maximum. Work-around, to avoid risk of a false maximum: Set the size of vxc to s = 1 + 2 * (hsearch + abs(ishift2)), and then extract the maximum cross-correlation from the elements at vxc[s/2 - ishift2 - hsearch] to vxc[s/2 - ishift2 + hsearch], i.e. either the first or the last 1 + 2 * hsearch elements of vxc. */ double xc = 0.0; double mean1 = 0.0; double mean2 = 0.0; double var1 = 0.0; double var2 = 0.0; cpl_size half_search; cpl_size delta; cpl_size i; cpl_size i1; cpl_size size; cpl_ensure(vxc != NULL, CPL_ERROR_NULL_INPUT, -10); cpl_ensure(v1 != NULL, CPL_ERROR_NULL_INPUT, -20); cpl_ensure(v2 != NULL, CPL_ERROR_NULL_INPUT, -30); cpl_ensure(v1->size >= v2->size, CPL_ERROR_ILLEGAL_INPUT, -50); half_search = cpl_vector_get_size(vxc)-1; cpl_ensure(!(half_search & 1), CPL_ERROR_ILLEGAL_INPUT, -60); half_search >>=1; size = v2->size; /* Number of elements used in cross-correlation */ /* 1st v1 index used - non-zero iff v1 is longer than v2 */ i1 = (v1->size - v2->size)/2; cpl_ensure(half_search <= i1 || 2*i1 == v1->size - v2->size, CPL_ERROR_ILLEGAL_INPUT, -70); /* The current implementation requires O(size * half_search) FLOPs. If size and half_search are large enough it should be preferable to compute the 1+2*half_search cross-correlations as a Toeplitz matrix vector product in terms of FFTs - since this requires O(size * log(size)) FLOPs */ /* 1st v1 index not used : i1 + size == (v1->size + size)/2 */ /* Compute mean of vectors, normalization factors and cross-correlation - over those elements used in the no-shift cross-correlation */ #if 0 /* This approach requires 10n FLOPS */ for (i = 0; idata[i+i1]; mean2 += v2->data[i ]; } mean1 /= (double)size; mean2 /= (double)size; for (i = 0; idata[i+i1] - mean1) * (v1->data[i+i1] - mean1); var2 += (v2->data[i ] - mean2) * (v2->data[i ] - mean2); xc += (v1->data[i+i1] - mean1) * (v2->data[i ] - mean2); } cpl_tools_add_flops(10 * size + 2); #else /* This approach requires only 8n FLOPS. It is only faster if v1 and v2 are already in cache - or if they do not fit in the cache. The round-off can be 10 times bigger */ for (i = 0; idata[i+i1]; mean2 += v2->data[i ]; var1 += v1->data[i+i1] * v1->data[i+i1]; var2 += v2->data[i ] * v2->data[i ]; xc += v1->data[i+i1] * v2->data[i ]; } mean1 /= (double)size; mean2 /= (double)size; var1 -= mean1 * mean1 * (double)size; var2 -= mean2 * mean2 * (double)size; xc -= mean1 * mean2 * (double)size; cpl_tools_add_flops(8 * size + 11); #endif /* var can only be zero with a constant vector - in which case xc is zero */ if ( var1 > 0.0 && var2 > 0.0) { xc /= sqrt(var1 * var2); /* xc can only be outside [-1;1] due to rounding errors */ if (xc < -1.0) { #ifndef NDEBUG const double m1 = fabs(mean1) > 1.0 ? fabs(mean1) : 1.0; const double m2 = fabs(mean2) > 1.0 ? fabs(mean2) : 1.0; assert( -1.0 - xc < (double)size * DBL_EPSILON * sqrt(m1 * m2)); #endif xc = -1.0; } else if (xc > 1.0) { #ifndef NDEBUG const double m1 = fabs(mean1) > 1.0 ? fabs(mean1) : 1.0; const double m2 = fabs(mean2) > 1.0 ? fabs(mean2) : 1.0; assert( xc-1.0 < (double)size * DBL_EPSILON * sqrt(m1 * m2)); #endif xc = 1.0; } } else { /* Remove some rounding errors */ if (var1 < 0) var1 = 0.0; if (var2 < 0) var2 = 0.0; xc = 0.0; } delta = 0; (void)cpl_vector_set(vxc, half_search, xc); if (half_search > 0) { /* less than maximal precision OK here */ const double rsize = 1.0 / (double)size; const double dsize = 1.0 + rsize; double mean1_p = mean1; double mean1_n = mean1; double mean2_p = mean2; double mean2_n = mean2; /* The normalization factors: size * variance They are updated by use of the relation variance = sum of squares - square of sums / size */ double var1_p = var1; double var1_n = var1; double var2_p = var2; double var2_n = var2; /* No use to search further than i1 + size - 1 */ const cpl_size max_hs = i1 + size - 2; const cpl_size hs = half_search > max_hs ? max_hs : half_search; const cpl_size hs1 = hs > i1 ? i1 : hs; /* Skip non-drop part if var2 == 0 */ cpl_size step = var2 > 0 ? 1 : hs1 + 1; /* Number of elements in shortened cross-correlation */ cpl_size istop = i1 + size - step; for (; step<=hs1; step++, istop--) { /* Can cross-correlate over all of v2 - mean2 and var2 are unchanged */ double xc_p = 0.0; double xc_n = 0.0; /* Subtract term from normalization factors */ var1_p -= (v1->data[i1+step-1] * dsize - 2 * mean1_p) * v1->data[i1+step-1]; var1_n -= (v1->data[istop ] * dsize - 2 * mean1_n) * v1->data[istop ]; /* Update mean1 */ mean1_p += (v1->data[i1+size+step-1] - v1->data[i1+step-1 ]) * rsize; mean1_n += (v1->data[i1-step ] - v1->data[i1+size-step]) * rsize; /* Add term to normalization factors */ var1_n += (v1->data[i1-step ] * dsize - 2 * mean1_n) * v1->data[i1-step ]; var1_p += (v1->data[i1+size+step-1] * dsize - 2 * mean1_p) * v1->data[i1+size+step-1]; /* Compute xc - exploiting that the dot-product is distributive over subtraction */ for (i = 0; idata[i] * v1->data[i+i1-step]; xc_p += v2->data[i] * v1->data[i+i1+step]; } if (var1_n > 0.0) { /* Subtract the mean-term */ xc_n -= mean2 * mean1_n * (double)size; /* - and divide by the norm of the mean-corrected vectors */ xc_n /= sqrt(var1_n * var2); /* xc_n can only be outside [-1;1] due to rounding errors */ if (xc_n < -1.0) { #ifndef NDEBUG const double m1 = fabs(mean1_n) > 1.0 ? fabs(mean1_n) : 1.0; const double m2 = fabs(mean2) > 1.0 ? fabs(mean2) : 1.0; assert( -1.0 - xc_n < 4.0 * (double)size * DBL_EPSILON * sqrt(m1 * m2)); #endif xc_n = -1.0; } else if (xc_n > 1.0) { #ifndef NDEBUG const double m1 = fabs(mean1_n) > 1.0 ? fabs(mean1_n) : 1.0; const double m2 = fabs(mean2) > 1.0 ? fabs(mean2) : 1.0; assert( xc_n - 1.0 < 4.0 * (double)size * DBL_EPSILON * sqrt(m1 * m2)); #endif xc_n = 1.0; } } else xc_n = 0.0; if (xc_n > xc) { xc = xc_n; delta = -step; } (void)cpl_vector_set(vxc, half_search - step, xc_n); if (var1_p > 0.0) { /* Subtract the mean-term */ xc_p -= mean2 * mean1_p * (double)size; /* - and divide by the norm of the mean-corrected vectors */ xc_p /= sqrt(var1_p * var2); /* xc_p can only be outside [-1;1] due to rounding errors */ if (xc_p < -1.0) { #ifndef NDEBUG const double m1 = fabs(mean1_p) > 1.0 ? fabs(mean1_p) : 1.0; const double m2 = fabs(mean2) > 1.0 ? fabs(mean2) : 1.0; assert( -1.0 - xc_p < 4.0 * (double)size * DBL_EPSILON * sqrt(m1 * m2)); #endif xc_p = -1.0; } else if (xc_p > 1.0) { #ifndef NDEBUG const double m1 = fabs(mean1_p) > 1.0 ? fabs(mean1_p) : 1.0; const double m2 = fabs(mean2) > 1.0 ? fabs(mean2) : 1.0; assert( xc_p - 1.0 < 4.0 * (double)size * DBL_EPSILON * sqrt(m1 * m2)); #endif xc_p = 1.0; } } else xc_p = 0.0; if (xc_p > xc) { xc = xc_p; delta = step; } (void)cpl_vector_set(vxc, half_search + step, xc_p); } assert( step == hs1 + 1 ); if (var2 > 0) cpl_tools_add_flops( hs1 * (4*size + 26) ); for (; step < 1 + hs; step++, istop--) { /* v1 is too short - Cross-correlate on reduced number of elements - elements out of range are defined to be zero */ double xc_p = 0.0; double xc_n = 0.0; /* Subtract dropped term from normalization factors */ var1_p -= (v1->data[step+i1-1] * dsize - 2 * mean1_p) * v1->data[step+i1-1]; var1_n -= (v1->data[istop ] * dsize - 2 * mean1_n) * v1->data[istop ]; var2_p -= (v2->data[istop ] * dsize - 2 * mean2_p) * v2->data[istop ]; var2_n -= (v2->data[step-i1-1] * dsize - 2 * mean2_n) * v2->data[step-i1-1]; /* Subtract dropped elements from mean */ mean1_p -= v1->data[step+i1-1] * rsize; mean1_n -= v1->data[istop ] * rsize; mean2_p -= v2->data[istop ] * rsize; mean2_n -= v2->data[step-i1-1] * rsize; /* Compute xc */ for (i = 0; idata[i] * v2->data[i-i1+step]; xc_p += v2->data[i] * v1->data[i+i1+step]; } if (var1_n * var2_n > 0) { /* Subtract the mean-term */ xc_n -= mean1_n * mean2_n * (double)(2*size - istop); /* - and divide by the norm of the mean-corrected vectors */ xc_n /= sqrt(var1_n * var2_n); /* xc_n can only be outside [-1;1] due to rounding errors */ if (xc_n < -1.0) { #ifndef NDEBUG const double m1 = fabs(mean1_n) > 1.0 ? fabs(mean1_n) : 1.0; const double m2 = fabs(mean2) > 1.0 ? fabs(mean2) : 1.0; assert( -1.0 - xc_n < 4.0 * (double)size * DBL_EPSILON * sqrt(m1 * m2)); #endif xc_n = -1.0; } else if (xc_n > 1.0) { #ifndef NDEBUG const double m1 = fabs(mean1_n) > 1.0 ? fabs(mean1_n) : 1.0; const double m2 = fabs(mean2) > 1.0 ? fabs(mean2) : 1.0; assert( xc_n - 1.0 < 4.0 * (double)size * DBL_EPSILON * sqrt(m1 * m2)); #endif xc_n = 1.0; } } else xc_n = 0.0; if (xc_n > xc) { xc = xc_n; delta = -step; } (void)cpl_vector_set(vxc, half_search - step, xc_n); if (var1_p * var2_p > 0) { /* Subtract the mean-term */ xc_p -= mean1_p * mean2_p * (double)(2*size - istop); /* - and divide by the norm of the mean-corrected vectors */ xc_p /= sqrt(var1_p * var2_p); /* xc_p can only be outside [-1;1] due to rounding errors */ if (xc_p < -1.0) { #ifndef NDEBUG const double m1 = fabs(mean1_p) > 1.0 ? fabs(mean1_p) : 1.0; const double m2 = fabs(mean2) > 1.0 ? fabs(mean2) : 1.0; assert( -1.0 - xc_p < 4.0 * (double)size * DBL_EPSILON * sqrt(m1 * m2)); #endif xc_p = -1.0; } else if (xc_p > 1.0) { #ifndef NDEBUG const double m1 = fabs(mean1_p) > 1.0 ? fabs(mean1_p) : 1.0; const double m2 = fabs(mean2) > 1.0 ? fabs(mean2) : 1.0; assert( xc_p-1.0 < 4.0 * (double)size * DBL_EPSILON * sqrt(m1 * m2)); #endif xc_p = 1.0; } } else xc_p = 0.0; if (xc_p > xc) { xc = xc_p; delta = step; } (void)cpl_vector_set(vxc, half_search + step, xc_p); } if (hs > hs1) cpl_tools_add_flops( (hs-hs1) * ( 4*istop + 28 ) ); } return half_search + delta; } /*----------------------------------------------------------------------------*/ /** @brief Apply a low-pass filter to a cpl_vector @param v cpl_vector @param filter_type Type of filter to use @param hw Filter half-width @return Pointer to newly allocated cpl_vector or NULL in case of an error This type of low-pass filtering consists in a convolution with a given kernel. The chosen filter type determines the kind of kernel to apply for convolution. Supported kernels are CPL_LOWPASS_LINEAR and CPL_LOWPASS_GAUSSIAN. In the case of CPL_LOWPASS_GAUSSIAN, the gaussian sigma used is 1/sqrt(2). As this function is not meant to be general and cover all possible cases, this sigma is hardcoded and cannot be changed. The returned smooth cpl_vector must be deallocated using cpl_vector_delete(). The returned signal has exactly as many samples as the input signal. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if filter_type is not supported or if hw is negative or bigger than half the vector v size */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_vector_filter_lowpass_create( const cpl_vector * v, cpl_lowpass filter_type, cpl_size hw) { cpl_vector * filtered; cpl_vector * kernel; double replace; cpl_size i, j; cpl_ensure(v != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(hw >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(2*hw <= v->size, CPL_ERROR_ILLEGAL_INPUT, NULL); /* allocate output cpl_vector */ filtered = cpl_vector_new(v->size); /* generate low-pass filter kernel */ kernel = cpl_vector_gen_lowpass_kernel(filter_type, hw); /* This will catch illegal values for filter_type */ cpl_ensure(kernel != NULL, CPL_ERROR_ILLEGAL_INPUT, NULL); /* compute edge effects for the first hw elements */ for (i = 0; idata[hw+j] * v->data[0]; } else { replace += kernel->data[hw+j] * v->data[i+j]; } } filtered->data[i] = replace; } /* compute edge effects for the last hw elements */ for (i=v->size-hw; isize; i++) { replace = 0.0; for (j=-hw; j<=hw; j++) { if (i+j>v->size-1) { replace += kernel->data[hw+j] * v->data[v->size-1]; } else { replace += kernel->data[hw+j] * v->data[i+j]; } } filtered->data[i] = replace; } /* compute all other elements */ for (i=hw; isize-hw; i++) { replace = 0.0; for (j=-hw; j<=hw; j++) { replace += kernel->data[hw+j] * v->data[i+j]; } filtered->data[i] = replace; } cpl_vector_delete(kernel); cpl_tools_add_flops(4*hw*v->size); return filtered; } /*----------------------------------------------------------------------------*/ /** @brief Apply a 1d median filter of given half-width to a cpl_vector @param v cpl_vector @param hw Filter half-width @return Pointer to newly allocated cpl_vector or NULL in case of an error This function applies a median smoothing to a cpl_vector and returns a newly allocated cpl_vector containing a median-smoothed version of the input. The returned cpl_vector has exactly as many samples as the input one. It must be deallocated using cpl_vector_delete(). For half-widths of 1,2,3,4, the filtering is optimised for speed. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT - CPL_ERROR_ILLEGAL_INPUT if hw is negative or bigger than half the vector v size */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_vector_filter_median_create( const cpl_vector * v, cpl_size hw) { cpl_vector * filtered; double * row; cpl_size i, j; cpl_ensure(v != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(hw >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(2*hw <= v->size, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Create the filtered vector */ filtered = cpl_vector_new(v->size); /* simply copy first hw and last hw items */ for (i = 0; idata[i] = v->data[i]; for (i=v->size-hw; isize; i++) filtered->data[i] = v->data[i]; /* median filter on all central items */ row = cpl_malloc((size_t)(2*hw+1) * sizeof(double)); for (i=hw; isize-hw; i++) { for (j=-hw; j<=hw; j++) row[j+hw] = v->data[i+j]; filtered->data[i] = cpl_tools_get_median_double(row, 2*hw+1); } cpl_free(row); return filtered; } /*----------------------------------------------------------------------------*/ /** @brief Elementwise addition of a scalar to a vector @param v cpl_vector to modify @param addend Number to add @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error Add a number to each element of the cpl_vector. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_add_scalar( cpl_vector * v, double addend) { cpl_size i; /* Test inputs */ cpl_ensure_code(v != NULL, CPL_ERROR_NULL_INPUT); /* Perform the addition */ for (i = 0; isize; i++) v->data[i] += addend; cpl_tools_add_flops(v->size); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Elementwise subtraction of a scalar from a vector @param v cpl_vector to modify @param subtrahend Number to subtract @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error Subtract a number from each element of the cpl_vector. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_subtract_scalar( cpl_vector * v, double subtrahend) { cpl_size i; /* Test inputs */ cpl_ensure_code(v != NULL, CPL_ERROR_NULL_INPUT); /* Perform the subtraction */ for (i = 0; isize; i++) v->data[i] -= subtrahend; cpl_tools_add_flops(v->size); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Elementwise multiplication of a vector with a scalar @param v cpl_vector to modify @param factor Number to multiply with @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error Multiply each element of the cpl_vector with a number. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_multiply_scalar( cpl_vector * v, double factor) { cpl_size i; /* Test inputs */ cpl_ensure_code(v != NULL, CPL_ERROR_NULL_INPUT); /* Perform the subtraction */ for (i = 0; isize; i++) v->data[i] *= factor; cpl_tools_add_flops(v->size); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Elementwise division of a vector with a scalar @param v cpl_vector to modify @param divisor Non-zero number to divide with @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error Divide each element of the cpl_vector with a number. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_DIVISION_BY_ZERO if divisor is 0.0 */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_divide_scalar( cpl_vector * v, double divisor) { cpl_size i; /* Test inputs */ cpl_ensure_code(v != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(divisor != 0, CPL_ERROR_DIVISION_BY_ZERO); /* Perform the subtraction */ for (i = 0; isize; i++) v->data[i] /= divisor; cpl_tools_add_flops(v->size); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Compute the element-wise logarithm. @param v cpl_vector to modify. @param base Logarithm base. @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error The base and all the vector elements must be positive and the base must be different from 1, or a cpl_error_code will be returned and the vector will be left unmodified. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if base is negative or zero or if one of the vector values is negative or zero - CPL_ERROR_DIVISION_BY_ZERO if a division by zero occurs */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_logarithm( cpl_vector * v, double base) { cpl_size i; cpl_ensure_code(v != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(base > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(base != 1, CPL_ERROR_DIVISION_BY_ZERO); for (i = 0; i < v->size; i++) cpl_ensure_code(v->data[i] > 0, CPL_ERROR_ILLEGAL_INPUT); for (i = 0; i < v->size; i++) v->data[i] = log(v->data[i]) / log(base); cpl_tools_add_flops(2*v->size); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Compute the exponential of all vector elements. @param v Target cpl_vector. @param base Exponential base. @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error If the base is zero all vector elements must be positive and if the base is negative all vector elements must be integer, otherwise a cpl_error_code is returned and the vector is unmodified. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT base and v are not as requested - CPL_ERROR_DIVISION_BY_ZERO if one of the v values is negative or 0 */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_exponential( cpl_vector * v, double base) { cpl_size i; cpl_ensure_code(v != NULL, CPL_ERROR_NULL_INPUT); if (base == 0.0) { for (i = 0; i < v->size; i++) cpl_ensure_code(v->data[i] > 0.0, CPL_ERROR_DIVISION_BY_ZERO); } else if (base < 0.0) { for (i = 0; i < v->size; i++) cpl_ensure_code(v->data[i] == ceil(v->data[i]), CPL_ERROR_ILLEGAL_INPUT); } for (i = 0; i < v->size; i++) v->data[i] = pow(base, v->data[i]); cpl_tools_add_flops(v->size); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Compute the power of all vector elements. @param v Target cpl_vector. @param exponent Constant exponent. @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error If the exponent is negative all vector elements must be non-zero and if the exponent is non-integer all vector elements must be non-negative, otherwise a cpl_error_code is returned and the vector is unmodified. Following the behaviour of C99 pow() function, this function sets 0^0 = 1. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if v and exponent are not as requested - CPL_ERROR_DIVISION_BY_ZERO if one of the v values is 0 */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_power( cpl_vector * v, double exponent) { cpl_size i; cpl_ensure_code(v != NULL, CPL_ERROR_NULL_INPUT); if (exponent < 0) { for (i = 0; i < v->size; i++) cpl_ensure_code(v->data[i] != 0, CPL_ERROR_DIVISION_BY_ZERO); } else if (exponent != ceil(exponent)) { for (i = 0; i < v->size; i++) cpl_ensure_code(v->data[i] >= 0, CPL_ERROR_ILLEGAL_INPUT); } for (i = 0; i < v->size; i++) v->data[i] = pow(v->data[i], exponent); cpl_tools_add_flops(v->size); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Fill a vector with a kernel profile @param profile cpl_vector to be filled @param type Type of kernel profile @param radius Radius of the profile in pixels @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_image_get_interpolated A number of predefined kernel profiles are available: - CPL_KERNEL_DEFAULT: default kernel, currently CPL_KERNEL_TANH - CPL_KERNEL_TANH: Hyperbolic tangent - CPL_KERNEL_SINC: Sinus cardinal - CPL_KERNEL_SINC2: Square sinus cardinal - CPL_KERNEL_LANCZOS: Lanczos2 kernel - CPL_KERNEL_HAMMING: Hamming kernel - CPL_KERNEL_HANN: Hann kernel - CPL_KERNEL_NEAREST: Nearest neighbor kernel (1 when dist < 0.5, else 0) Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if radius is non-positive, or in case of the CPL_KERNEL_TANH profile if the length of the profile exceeds 32768 */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_fill_kernel_profile(cpl_vector * profile, cpl_kernel type, double radius) { const cpl_size size = cpl_vector_get_size(profile); /* TABS per pixel == 1 / dx */ /* If size is 1, the profile is flat (and hardly useful) */ const double dx = size > 1 ? radius / (double)(size-1) : 1.0; cpl_size i; cpl_ensure_code(size > 0, cpl_error_get_code()); cpl_ensure_code(radius > 0.0, CPL_ERROR_ILLEGAL_INPUT); /* Switch on the requested kernel type */ switch (type) { case CPL_KERNEL_TANH: { if (cpl_vector_fill_tanh_kernel(profile, 0.5 / dx)) return cpl_error_set_where_(); break; } case CPL_KERNEL_SINC: for (i = 0; i < size; i++) { const double x = (double)i * dx; profile->data[i] = cpl_tools_sinc(x); } cpl_tools_add_flops( 4 * size ); break; case CPL_KERNEL_SINC2: for (i = 0; i < size; i++) { const double x = (double)i * dx; profile->data[i] = cpl_tools_sinc(x); profile->data[i] *= profile->data[i]; } cpl_tools_add_flops( 5 * size ); break; case CPL_KERNEL_LANCZOS: for (i = 0; i < size; i++) { const double x = (double)i * dx; if (x >= 2) break; profile->data[i] = cpl_tools_sinc(x) * cpl_tools_sinc(x/2); } for (; i < size; i++) profile->data[i] = 0; cpl_tools_add_flops( 8 * i ); break; case CPL_KERNEL_HAMMING: cpl_vector_fill_alpha_kernel(profile, dx, 0.54); break; case CPL_KERNEL_HANN: cpl_vector_fill_alpha_kernel(profile, dx, 0.50); break; case CPL_KERNEL_NEAREST: for (i = 0; i < size; i++) { const double x = (double)i * dx; profile->data[i] = x < 0.5 ? 1.0 : 0.0; } cpl_tools_add_flops( size ); break; default: /* Only reached if cpl_kernel is extended in error */ return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Apply a 1d gaussian fit @param x Positions to fit @param sigma_x Uncertainty (one sigma, gaussian errors assumed) assosiated with @em x. Taking into account the uncertainty of the independent variable is currently unsupported, and this parameter must therefore be set to NULL. @param y Values to fit @param sigma_y Uncertainty (one sigma, gaussian errors assumed) associated with @em y. If NULL, constant uncertainties are assumed. @param fit_pars Specifies which parameters participate in the fit (any other parameters will be held constant). Possible values are CPL_FIT_CENTROID, CPL_FIT_STDEV, CPL_FIT_AREA, CPL_FIT_OFFSET and any bitwise combination of these. As a shorthand for including all four parameters in the fit, use CPL_FIT_ALL. @param x0 (output) Center of best fit gaussian. If CPL_FIT_CENTROID is not set, this is also an input parameter. @param sigma (output) Width of best fit gaussian. A positive number on success. If CPL_FIT_STDEV is not set, this is also an input parameter. @param area (output) Area of gaussian. A positive number on succes. If CPL_FIT_AREA is not set, this is also an input parameter. @param offset (output) Fitted background level. If CPL_FIT_OFFSET is not set, this is also an input parameter. @param mse (output) If non-NULL, the mean squared error of the best fit is returned. @param red_chisq (output) If non-NULL, the reduced chi square of the best fit is returned. This requires the noise vector to be specified. @param covariance (output) If non-NULL, the formal covariance matrix of the best fit is returned. This requires @em sigma_y to be specified. The order of fit parameters in the covariance matrix is defined as (@em x0, @em sigma, @em area, @em offset), for example the (3,3) element of the matrix (counting from zero) is the variance of the fitted @em offset. The matrix must be deallocated by calling @c cpl_matrix_delete() . On error, NULL is returned. @return CPL_ERROR_NONE iff okay This function fits to the input vectors a 1d gaussian function of the form f(x) = @em area / sqrt(2 pi @em sigma^2) * exp( -(@em x - @em x0)^2/(2 @em sigma^2)) + @em offset (@em area > 0) by minimizing chi^2 using a Levenberg-Marquardt algorithm. The values to fit are read from the input vector @em x. Optionally, a vector @em sigma_x (of same size as @em x) may be specified. Optionally, the mean squared error, the reduced chi square and the covariance matrix of the best fit are computed . Set corresponding parameter to NULL to ignore. If the covariance matrix is requested and successfully computed, the diagonal elements (the variances) are guaranteed to be positive. Occasionally, the Levenberg-Marquardt algorithm fails to converge to a set of sensible parameters. In this case (and only in this case), a CPL_ERROR_CONTINUE is set. To allow the caller to recover from this particular error, the parameters @em x0, @em sigma, @em area and @em offset will on output contain estimates of the best fit parameters, specifically estimated as the median position, the median of the absolute residuals multiplied by 1.4828, the minimum flux value and the maximum flux difference multiplied by sqrt(2 pi sigma^2), respectively. In this case, @em mse, @em red_chisq and @em covariance are not computed. Note that the variance of @em x0 (the (0,0) element of the covariance matrix) in this case can be estimated by @em sigma^2 / @em area . A CPL_ERROR_SINGULAR_MATRIX occurs if the covariance matrix cannot be computed. In that case all other output parameters are valid. Current limitations - Taking into account the uncertainties of the independent variable is not supported. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if @em x, @em y, @em x0, @em sigma, @em area or @em offset is NULL. - CPL_ERROR_INVALID_TYPE if the specified @em fit_pars is not a bitwise combination of the allowed values (e.g. 0 or 1). - CPL_ERROR_UNSUPPORTED_MODE @em sigma_x is non-NULL. - CPL_ERROR_INCOMPATIBLE_INPUT if the sizes of any input vectors are different, or if the computation of reduced chi square or covariance is requested, but @em sigma_y is not provided. - CPL_ERROR_ILLEGAL_INPUT if any input noise values, @em sigma or @em area is non-positive, or if chi square computation is requested and there are less than 5 data points to fit. - CPL_ERROR_ILLEGAL_OUTPUT if memory allocation failed. - CPL_ERROR_CONTINUE if the fitting algorithm failed. - CPL_ERROR_SINGULAR_MATRIX if the covariance matrix could not be calculated. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_fit_gaussian(const cpl_vector *x, const cpl_vector *sigma_x, const cpl_vector *y, const cpl_vector *sigma_y, cpl_fit_mode fit_pars, double *x0, double *sigma, double *area, double *offset, double *mse, double *red_chisq, cpl_matrix **covariance) { cpl_matrix *x_matrix = NULL; /* LM algorithm needs a matrix, not a vector */ cpl_size N; /* Number of data points */ double xlo, xhi; /* Min/max x */ /* Initial parameter values */ double x0_guess = 0; /* Avoid warnings about uninitialized variables */ double sigma_guess = 0; double area_guess; double offset_guess; /* Validate input */ cpl_ensure_code( x != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code( sigma_x == NULL, CPL_ERROR_UNSUPPORTED_MODE); cpl_ensure_code( y != NULL, CPL_ERROR_NULL_INPUT); /* sigma_y may be NULL or non-NULL */ /* Bits in 'fit_pars' must be non-empty subset of bits in 'CPL_FIT_ALL' */ cpl_ensure_code( fit_pars != 0 && (CPL_FIT_ALL | fit_pars) == CPL_FIT_ALL, CPL_ERROR_INVALID_TYPE); N = cpl_vector_get_size(x); cpl_ensure_code( N == cpl_vector_get_size(y), CPL_ERROR_INCOMPATIBLE_INPUT); if (sigma_x != NULL) { cpl_ensure_code( N == cpl_vector_get_size(sigma_x), CPL_ERROR_INCOMPATIBLE_INPUT); } if (sigma_y != NULL) { cpl_ensure_code( N == cpl_vector_get_size(sigma_y), CPL_ERROR_INCOMPATIBLE_INPUT); } cpl_ensure_code( x0 != NULL && sigma != NULL && area != NULL && offset != NULL, CPL_ERROR_NULL_INPUT); if (! (fit_pars & CPL_FIT_STDEV)) { cpl_ensure_code( *sigma > 0, CPL_ERROR_ILLEGAL_INPUT); } if (! (fit_pars & CPL_FIT_AREA)) { cpl_ensure_code( *area > 0, CPL_ERROR_ILLEGAL_INPUT); } /* mse, red_chisq may be NULL */ /* Need more than number_of_parameters points to calculate chi^2. * There are less than 5 parameters. */ cpl_ensure_code( red_chisq == NULL || N >= 5, CPL_ERROR_ILLEGAL_INPUT); if (covariance != NULL) *covariance = NULL; /* If covariance computation is requested, then * return either the covariance matrix or NULL * (don't return undefined pointer). */ /* Cannot compute chi square & covariance without sigma_y */ cpl_ensure_code( (red_chisq == NULL && covariance == NULL) || sigma_y != NULL, CPL_ERROR_INCOMPATIBLE_INPUT); /* Create (non-modified) matrix from x-data */ CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual); x_matrix = cpl_matrix_wrap(N, 1, (double*)cpl_vector_get_data_const(x)); CPL_DIAG_PRAGMA_POP; if (x_matrix == NULL) { return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } /* Check that any provided sigmas are positive. */ if (sigma_x != NULL && cpl_vector_get_min(sigma_x) <= 0) { cpl_matrix_unwrap(x_matrix); return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } if (sigma_y != NULL && cpl_vector_get_min(sigma_y) <= 0) { cpl_matrix_unwrap(x_matrix); return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } /* Compute guess parameters using robust estimation * (This step might be improved by taking into account the sigmas, * but for simplicity do not) */ { double sum = 0.0; double quartile[3]; double fraction[3] = {0.25 , 0.50 , 0.75}; const double *y_data = cpl_vector_get_data_const(y); if (fit_pars & CPL_FIT_OFFSET) { /* Estimate offset as 25% percentile of y-values. (The minimum value may be too low for noisy input, the median is too high if there is not much background in the supplied data, so use something inbetween). */ cpl_vector *y_dup = cpl_vector_duplicate(y); if (y_dup == NULL) { cpl_matrix_unwrap(x_matrix); return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } offset_guess = cpl_tools_get_kth_double( cpl_vector_get_data(y_dup), N, N/4); cpl_vector_delete(y_dup); } else { offset_guess = *offset; } /* Get quartiles of distribution (only bother if it's needed for estimation of x0 or sigma) */ if ( (fit_pars & CPL_FIT_CENTROID) || (fit_pars & CPL_FIT_STDEV ) ) { /* The algorithm requires the input to be sorted as function of x, so do that (using qsort), and work on the sorted copy. Of course, the y-vector must be re-ordered along with x. sigma_x and sigma_y are not used, so don't copy those. */ cpl_vector_fit_gaussian_input *sorted_input = cpl_malloc((size_t)N * sizeof(*sorted_input)); double *x_data = cpl_matrix_get_data(x_matrix); cpl_boolean is_sorted = CPL_TRUE; cpl_size i; if (sorted_input == NULL) { cpl_matrix_unwrap(x_matrix); return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } for (i = 0; i < N; i++) { sorted_input[i].x = x_data[i]; sorted_input[i].y = y_data[i]; is_sorted = is_sorted && (i==0 || (x_data[i-1] < x_data[i])); } /* For efficiency, sort only if necessary. This is to * keep the asymptotic time complexity at O(n) if the * input was already sorted. (Otherwise the time * complexity is dominated by the following qsort call.) */ if (!is_sorted) { qsort(sorted_input, (size_t)N, sizeof(*sorted_input), &cpl_fit_gaussian_1d_compare); } for(i = 0; i < N; i++) { double flux = sorted_input[i].y; sum += (flux - offset_guess); } /* Note that 'sum' must be calculated the same way as 'running_sum' below, Otherwise (due to round-off error) 'running_sum' might end up being different from 'sum'(!). Specifically, it will not work to calculate 'sum' as (flux1 + ... + fluxN) - N*offset_guess */ if (sum > 0.0) { double flux, x1, x2; double running_sum = 0.0; cpl_size j; i = 0; flux = sorted_input[i].y - offset_guess; for (j = 0; j < 3; j++) { double limit = fraction[j] * sum; double k; while (running_sum + flux < limit && i < N-1) { running_sum += flux; i++; flux = sorted_input[i].y - offset_guess; } /* Fraction [0;1] of current flux needed to reach the quartile */ k = (limit - running_sum)/flux; if (k <= 0.5) { /* Interpolate linearly between current and previous position */ if (0 < i) { x1 = sorted_input[i-1].x; x2 = sorted_input[i].x; quartile[j] = x1*(0.5-k) + x2*(0.5+k); /* k=0 => quartile = midpoint, k=0.5 => quartile = x2 */ } else { quartile[j] = sorted_input[i].x; } } else { /* Interpolate linearly between current and next position */ if (i < N-1) { x1 = sorted_input[i].x; x2 = sorted_input[i+1].x; quartile[j] = x1*( 1.5-k) + x2*(-0.5+k); /* k=0.5 => quartile = x1, k=1.0 => quartile = midpoint */ } else { quartile[j] = sorted_input[i].x; } } } } else { /* If there's no flux (sum = 0) then set quartiles to something that's not completely insensible. */ quartile[1] = cpl_matrix_get_mean(x_matrix); quartile[2] = quartile[1]; quartile[0] = quartile[2] - 1.0; /* Then sigma_guess = 1.0 */ } cpl_free(sorted_input); } /* x0_guess = median of distribution */ x0_guess = (fit_pars & CPL_FIT_CENTROID) ? quartile[1] : *x0; /* sigma_guess = median of absolute residuals * * (68% is within 1 sigma, and 50% is within 0.6744 * sigma, => quartile3-quartile1 = 2*0.6744 sigma) */ sigma_guess = (fit_pars & CPL_FIT_STDEV) ? (quartile[2] - quartile[0]) / (2*0.6744) : *sigma; area_guess = (fit_pars & CPL_FIT_AREA) ? (cpl_vector_get_max(y) - offset_guess) * CPL_MATH_SQRT2PI * sigma_guess : *area; /* Make sure that the area/sigma are positive number */ if (area_guess <= 0) area_guess = 1.0; if (sigma_guess <= 0) sigma_guess = 1.0; } /* Wrap parameters, fit, unwrap */ { cpl_vector *a = cpl_vector_new(4); /* There are four parameters */ int ia[4]; cpl_error_code ec; if (a == NULL) { cpl_matrix_unwrap(x_matrix); return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); } cpl_vector_set(a, 0, x0_guess); cpl_vector_set(a, 1, sigma_guess); cpl_vector_set(a, 2, area_guess); cpl_vector_set(a, 3, offset_guess); ia[0] = fit_pars & CPL_FIT_CENTROID; ia[1] = fit_pars & CPL_FIT_STDEV; ia[2] = fit_pars & CPL_FIT_AREA; ia[3] = fit_pars & CPL_FIT_OFFSET; ec = cpl_fit_lvmq_(x_matrix, NULL, y, sigma_y, a, ia, gauss, gauss_derivative, CPL_FIT_LVMQ_TOLERANCE, CPL_FIT_LVMQ_COUNT, CPL_FIT_LVMQ_MAXITER, mse, red_chisq, covariance); cpl_matrix_unwrap(x_matrix); /* Check return status of fitting routine */ if (ec == CPL_ERROR_NONE || ec == CPL_ERROR_SINGULAR_MATRIX) { /* The LM algorithm converged. The computation * of the covariance matrix might have failed. */ /* In principle, the LM algorithm might have converged * to a negative sigma (even if the guess value was * positive). Make sure that the returned sigma is positive * (by convention). */ if (CPL_FIT_CENTROID) *x0 = cpl_vector_get(a, 0); if (CPL_FIT_STDEV ) *sigma = fabs(cpl_vector_get(a, 1)); if (CPL_FIT_AREA ) *area = cpl_vector_get(a, 2); if (CPL_FIT_OFFSET ) *offset = cpl_vector_get(a, 3); } cpl_vector_delete(a); xlo = cpl_vector_get_min(x); xhi = cpl_vector_get_max(x); if (ec == CPL_ERROR_CONTINUE || !( xlo <= *x0 && *x0 <= xhi && 0 < *sigma && *sigma < (xhi - xlo + 1) && 0 < *area /* This extra check on the background level makes sense iff the input flux is assumed to be positive && *offset > - *area */ ) ) { /* The LM algorithm did not converge, or it converged to * a non-sensical result. Return the guess parameter values * in order to enable the caller to recover. */ *x0 = x0_guess; *sigma = sigma_guess; *area = area_guess; *offset = offset_guess; /* In this case the covariance matrix will not make sense (because the LM algorithm failed), so delete it */ if (covariance != NULL && *covariance != NULL) { cpl_matrix_delete(*covariance); *covariance = NULL; } /* Return CPL_ERROR_CONTINUE if the fitting routine failed */ return cpl_error_set_(CPL_ERROR_CONTINUE); } } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Create Right Half of a symmetric smoothing kernel for LSS @param slitw The slit width [pixel] @param fwhm The spectral FWHM [pixel] @return Right Half of (symmetric) smoothing vector @deprecated Unstable API, may change or disappear. Do not use in new code! */ /*----------------------------------------------------------------------------*/ cpl_vector * cpl_vector_new_lss_kernel(double slitw, double fwhm) { const double sigma = fwhm * CPL_MATH_SIG_FWHM; const cpl_size size = 1 + (cpl_size)(5.0 * sigma + 0.5*slitw); cpl_vector * kernel = cpl_vector_new(size); if (cpl_vector_fill_lss_profile_symmetric(kernel, slitw, fwhm)) { cpl_vector_delete(kernel); kernel = NULL; (void)cpl_error_set_where_(); } return kernel; } /*----------------------------------------------------------------------------*/ /** @brief Convolve a 1d-signal with a symmetric 1D-signal @param smoothed Preallocated vector to be smoothed in place @param conv_kernel Vector with symmetric convolution function @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @deprecated Unstable API, may change or disappear. Do not use in new code! */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_vector_convolve_symmetric(cpl_vector * smoothed, const cpl_vector * conv_kernel) { cpl_size nsamples; cpl_size ihwidth; cpl_vector * raw; double * psmoothe; double * praw; const double* psymm; cpl_size i, j; /* Test entries */ cpl_ensure_code(smoothed, CPL_ERROR_NULL_INPUT); cpl_ensure_code(conv_kernel, CPL_ERROR_NULL_INPUT); /* Initialise */ nsamples = cpl_vector_get_size(smoothed); ihwidth = cpl_vector_get_size(conv_kernel) - 1; cpl_ensure_code(ihwidth nsamples-1 ? nsamples - 1 : i+j; psmoothe[i] += (praw[k]+praw[i-j]) * psymm[j]; } } cpl_vector_delete(raw); return CPL_ERROR_NONE; } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief The antiderivative of erx(x/sigma/sqrt(2)) with respect to x @param x x @param sigma sigma @return The antiderivative @note This function is even. */ /*----------------------------------------------------------------------------*/ inline static double cpl_erf_antideriv(double x, double sigma) { return x * erf( x / (sigma * CPL_MATH_SQRT2)) + 2.0 * sigma/CPL_MATH_SQRT2PI * exp(-0.5 * x * x / (sigma * sigma)); } /*----------------------------------------------------------------------------*/ /** @internal @brief Fill right half of a symmetric long-slit spectroscopy line profile @param self The pre-allocated vector to be filled @param slitw The slit width [pixel] @param fwhm The spectral FWHM [pixel] @return CPL_ERROR_NONE or the relevant error code on failure The smoothing function is the right half of the convolution of a Gaussian with sigma = fwhm / (2 * sqrt(2*log(2))) and a top-hat with a width equal to the slit width, and area 1, and a tophat with unit width and area. (the convolution with a tophat with unit width and area equals integration from i-1/2 to 1+1/2). Since this function is symmetric only the central, maximum value and the right half is computed, Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if a pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the slit width or fwhm is non-positive */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_vector_fill_lss_profile_symmetric(cpl_vector * self, double slitw, double fwhm) { const double sigma = fwhm * CPL_MATH_SIG_FWHM; const cpl_size n = cpl_vector_get_size(self); cpl_size i; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(slitw > 0.0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(fwhm > 0.0, CPL_ERROR_ILLEGAL_INPUT); /* Cannot fail now */ /* Special case for i = 0 */ (void)cpl_vector_set(self, 0, (cpl_erf_antideriv(0.5*slitw + 0.5, sigma) - cpl_erf_antideriv(0.5*slitw - 0.5, sigma)) / slitw); for (i = 1; i < n; i++) { /* FIXME: Reuse two cpl_erf_antideriv() calls from previous value */ const double x1p = (double)i + 0.5*slitw + 0.5; const double x1n = (double)i - 0.5*slitw + 0.5; const double x0p = (double)i + 0.5*slitw - 0.5; const double x0n = (double)i - 0.5*slitw - 0.5; const double val = 0.5/slitw * (cpl_erf_antideriv(x1p, sigma) - cpl_erf_antideriv(x1n, sigma) - cpl_erf_antideriv(x0p, sigma) + cpl_erf_antideriv(x0n, sigma)); (void)cpl_vector_set(self, i, val); } cpl_tools_add_flops( 24 * n ); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Define order of input data @param left Left operand @param right Right operand This function uses void pointers because it is used as input for ANSI's qsort(). */ /*----------------------------------------------------------------------------*/ static int cpl_fit_gaussian_1d_compare(const void *left, const void *right) { return (((const cpl_vector_fit_gaussian_input *)left )->x < ((const cpl_vector_fit_gaussian_input *)right)->x) ? -1 : (((const cpl_vector_fit_gaussian_input *)left )->x == ((const cpl_vector_fit_gaussian_input *)right)->x) ? 0 : 1; } /*----------------------------------------------------------------------------*/ /** @brief Generate a kernel for smoothing filters (low-pass) @param filt_type Type of kernel to generate @param hw Kernel half-width. @return Pointer to newly allocated cpl_vector or NULL in case of an error @see cpl_vector_filter_lowpass_create() The kernel is returned as a cpl_vector (values of the Y field) The returned cpl_vector must be deallocated using cpl_vector_delete(). The returned cpl_vector's size is 2hw+1. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if hw is negative */ /*----------------------------------------------------------------------------*/ static cpl_vector * cpl_vector_gen_lowpass_kernel( cpl_lowpass filt_type, cpl_size hw) { cpl_vector * kernel; double norm; cpl_size i; cpl_ensure(hw >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Create the kernel */ kernel = cpl_vector_new(2*hw+1); switch(filt_type) { case CPL_LOWPASS_LINEAR: /* flat kernel */ for (i=-hw; i<=hw; i++) kernel->data[hw+i] = 1.0/(double)(2*hw+1); break; case CPL_LOWPASS_GAUSSIAN: norm = 0.00; for (i=-hw; i < 1 + hw; i++) { /* gaussian kernel */ kernel->data[hw+i] = exp(-(double)(i*i)); norm += kernel->data[hw+i]; } for (i = 0; i<2*hw+1; i++) kernel->data[i] /= norm; cpl_tools_add_flops(2*hw*4); break; default: /* Only reached if cpl_lowpass is extended in error */ kernel = NULL; (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); break; } return kernel; } /*----------------------------------------------------------------------------*/ /** @brief Cardinal sine, sin(pi*x)/(pi*x). @param x double value. @return The cardinal sine of x. */ /*----------------------------------------------------------------------------*/ static double cpl_tools_sinc(double x) { const double xpi = x * CPL_MATH_PI; /* sinc(0) == 1, sinx(x*pi) = 0, for integral x */ return x != 0.0 ? (ceil(x) != x ? sin(xpi) / xpi : 0.0) : 1.0; } /*----------------------------------------------------------------------------*/ /** @brief Fill a vector with an alpha kernel useful for resampling @param dx x increment @param alpha Use 0.5 for Hann resampling, 0.54 for Hamming resampling @return void @note The function will SIGABRT on invalid input. An alpha kernel is the product of sinc(x) and (alpha + (1-alpha) * cos(x)), for x < 1 and zero for x >= 1. */ /*----------------------------------------------------------------------------*/ static void cpl_vector_fill_alpha_kernel(cpl_vector * profile, double dx, double alpha) { cpl_size i; assert( profile ); for (i = 0; i < profile->size; i++) { const double x = (double)i * dx; if (x >= 1) break; profile->data[i] = (alpha + (1.0 - alpha) * cos (x * CPL_MATH_PI)) * cpl_tools_sinc(x); } cpl_tools_add_flops( 5 * i ); for (; i < profile->size; i++) profile->data[i] = 0; return; } /*----------------------------------------------------------------------------*/ /** @brief Fill a vector with a hyperbolic tangent kernel. @param width Half of the number of profile values per pixel @return void The following function builds up a good approximation of a box filter. It is built from a product of hyperbolic tangents. It has the following properties: \begin{itemize} \item It converges very quickly towards +/- 1. \item The converging transition is very sharp. \item It is infinitely differentiable everywhere (i.e. smooth). \item The transition sharpness is scalable. \end{itemize} The function will SIGABRT on invalid input. */ /*----------------------------------------------------------------------------*/ /* Kernel definitions */ #ifndef CPL_KERNEL_TANH_STEEPNESS #define CPL_KERNEL_TANH_STEEPNESS 5 #endif #define CPL_hk_gen(x,s) (((tanh(s*(x+0.5))+1)/2)*((tanh(s*(-x+0.5))+1)/2)) static cpl_error_code cpl_vector_fill_tanh_kernel(cpl_vector * profile, double width) { double * x; const cpl_size np = 32768; /* Hardcoded: should never be changed */ const double inv_np = 2.0 / (double)np; const double steep = CPL_KERNEL_TANH_STEEPNESS; double ind; const cpl_size samples = cpl_vector_get_size(profile); cpl_size i; cpl_ensure_code(profile != NULL, CPL_ERROR_NULL_INPUT); if (samples > np) return cpl_error_set_message_(CPL_ERROR_ILLEGAL_INPUT, "Vector-length %" CPL_SIZE_FORMAT " exceeds maximum of %" CPL_SIZE_FORMAT, samples, np); /* * Generate the kernel expression in Fourier space * with a correct frequency ordering to allow standard FT */ x = cpl_malloc((2*np+1)*sizeof(double)); for (i = 0; i < np/2; i++) { ind = (double)i * width * inv_np; x[2*i] = CPL_hk_gen(ind, steep); x[2*i+1] = 0; } for (i=np/2; idata[i] = width * x[2*i] * inv_np; } cpl_free(x); cpl_tools_add_flops( (13 * np + samples * 4)/2 ); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Bring a hyperbolic tangent kernel from Fourier to normal space. @param data Kernel samples in Fourier space. @param nn Number of samples in the input kernel. @return void Bring back a hyperbolic tangent kernel from Fourier to normal space. Do not try to understand the implementation and DO NOT MODIFY THIS FUNCTION. */ /*----------------------------------------------------------------------------*/ #define CPL_KERNEL_SW(a,b) tempr=(a);(a)=(b);(b)=tempr static void cpl_vector_reverse_tanh_kernel(double * data, cpl_size nn) { unsigned long n, mmax, m, i, j, istep; double wtemp, wr, wpr, wpi, wi, theta; double tempr, tempi; n = (unsigned long)nn << 1; j = 1; for (i=1; i i) { CPL_KERNEL_SW(data[j-1],data[i-1]); CPL_KERNEL_SW(data[j],data[i]); } m = n >> 1; while (m>=2 && j>m) { j -= m; m >>= 1; } j += m; } mmax = 2; while (n > mmax) { istep = mmax << 1; theta = CPL_MATH_2PI / mmax; wtemp = sin(0.5 * theta); wpr = -2.0 * wtemp * wtemp; wpi = sin(theta); wr = 1.0; wi = 0.0; for (m=1; m CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_image * cpl_image_wrap_(cpl_size, cpl_size, cpl_type, void *) CPL_ATTR_ALLOC; /* Special extractor functions for complex images */ cpl_image * cpl_image_extract_real(const cpl_image *) CPL_ATTR_ALLOC; cpl_image * cpl_image_extract_imag(const cpl_image *) CPL_ATTR_ALLOC; cpl_image * cpl_image_extract_mod (const cpl_image *) CPL_ATTR_ALLOC; cpl_image * cpl_image_extract_phase(const cpl_image *) CPL_ATTR_ALLOC; cpl_error_code cpl_image_fill_real (cpl_image *, const cpl_image *); cpl_error_code cpl_image_fill_imag (cpl_image *, const cpl_image *); cpl_error_code cpl_image_fill_mod (cpl_image *, const cpl_image *); cpl_error_code cpl_image_fill_phase(cpl_image *, const cpl_image *); /* FIXME: Export ? - add other types ? */ cpl_error_code cpl_image_fill_int(cpl_image *, int); cpl_image * cpl_image_load_(fitsfile *, int *, CPL_FITSIO_TYPE[], cpl_type *, const char *, cpl_size, cpl_size, cpl_boolean, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_error_code cpl_image_save_(const cpl_image * const*, cpl_size, cpl_boolean, const char *, cpl_type, const cpl_propertylist *, unsigned) CPL_INTERNAL; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_errorstate.h0000644000460300003120000000435311665451332014055 00000000000000/* $Id: cpl_errorstate.h,v 1.8 2011-11-30 15:59:22 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-11-30 15:59:22 $ * $Revision: 1.8 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_ERRORSTATE_H #define CPL_ERRORSTATE_H #include #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef CPL_ERROR_HISTORY_SIZE #define CPL_ERROR_HISTORY_SIZE 20 #endif typedef const void * cpl_errorstate; /*----------------------------------------------------------------------------- Prototypes of functions -----------------------------------------------------------------------------*/ cpl_errorstate cpl_errorstate_get(void) CPL_ATTR_PURE; void cpl_errorstate_set(cpl_errorstate); cpl_boolean cpl_errorstate_is_equal(cpl_errorstate) CPL_ATTR_PURE; void cpl_errorstate_dump(cpl_errorstate, cpl_boolean, void (*)(unsigned, unsigned, unsigned)); void cpl_errorstate_dump_one(unsigned, unsigned, unsigned); void cpl_errorstate_dump_one_warning(unsigned, unsigned, unsigned); void cpl_errorstate_dump_one_info(unsigned, unsigned, unsigned); void cpl_errorstate_dump_one_debug(unsigned, unsigned, unsigned); CPL_END_DECLS #endif /* end of cpl_errorstate.h */ cpl-6.4.1/cplcore/cpl_image_basic_body.h0000644000460300003120000016273312231463211015117 00000000000000/* $Id: cpl_image_basic_body.h,v 1.107 2013-10-22 11:50:33 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #if defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_BASIC_HYPOT /* Declaration */ static cpl_error_code CPL_CONCAT2X(cpl_image_hypot, CPL_CONCAT2X(CPL_TYPE1, CPL_CONCAT2X(CPL_TYPE2, CPL_TYPE3))) (cpl_image *, const cpl_image *, const cpl_image *) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1, 3))) #endif ; /*----------------------------------------------------------------------------*/ /** @internal @brief Type-specific version of the function @param self Pre-allocated image to hold the result @param first First operand (may be aliased to self) @param second Second operand @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @see cpl_image_hypot() */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_CONCAT2X(cpl_image_hypot, CPL_CONCAT2X(CPL_TYPE1, CPL_CONCAT2X(CPL_TYPE2, CPL_TYPE3))) (cpl_image * self, const cpl_image * first, const cpl_image * second) { CPL_TYPE1 * p1 = ( CPL_TYPE1 *)self->pixels; const CPL_TYPE3 * p3 = (const CPL_TYPE3 *)second->pixels; const size_t nxy = (size_t)(self->nx * self->ny); size_t i; if (first == NULL) { for (i = 0; i < nxy; i++) p1[i] = (CPL_TYPE1)CPL_HYPOT(p1[i], p3[i]); } else { const CPL_TYPE2 * p2 = (const CPL_TYPE2 *)first->pixels; for (i = 0; i < nxy; i++) p1[i] = (CPL_TYPE1)CPL_HYPOT(p2[i], p3[i]); } return CPL_ERROR_NONE; } #elif defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_BASIC_OPERATE case CPL_TYPE_T: { const CPL_TYPE * p2 = (const CPL_TYPE *)image2->pixels; const size_t nxy = (size_t)(image1->nx * image1->ny); size_t i; for (i = 0; i < nxy; i++) CPL_OPERATOR(pout[i], p1[i], p2[i]); break; } #elif defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_BASIC_DIVIDE case CPL_TYPE_T: { const CPL_TYPE * p2 = (const CPL_TYPE *)image2->pixels; const size_t nxy = (size_t)(image1->nx * image1->ny); size_t i; for (i = 0; i < nxy; i++) { if (p2[i] != (CPL_TYPE)0) { CPL_IMAGE_DIVISION(pout[i], p1[i], p2[i]); } else { pzeros[i] = CPL_BINARY_1; nzero++; } } break; } #elif defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_BASIC_OPERATE_LOCAL case CPL_TYPE_T: { const CPL_TYPE * p2 = (const CPL_TYPE *)im2->pixels; const size_t nxy = (size_t)(im1->nx * im1->ny); size_t i; for (i = 0; i < nxy; i++) CPL_OPERATOR(p1[i], p2[i]); break; } #elif defined(CPL_OPERATION) && CPL_OPERATION == CPL_IMAGE_BASIC_DIVIDE_LOCAL case CPL_TYPE_T: { const CPL_TYPE * p2 = (const CPL_TYPE * )im2->pixels; const size_t nxy = (size_t)(im1->nx * im1->ny); size_t i; for (i = 0; i < nxy; i++) { if (p2[i] != (CPL_TYPE)0) { CPL_IMAGE_DIVISIONASSIGN(p1[i], p2[i]); } else { pzeros[i] = CPL_BINARY_1; nzero++; } } break; } #else /* Type dependent macros */ #if defined CPL_CLASS && CPL_CLASS == CPL_CLASS_DOUBLE #define CPL_TYPE double #define CPL_TYPE_CONCAT double #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_MATH_ABS fabs #define CPL_TYPE_IS_FPOINT #elif defined CPL_CLASS && CPL_CLASS == CPL_CLASS_FLOAT #define CPL_TYPE float #define CPL_TYPE_CONCAT float #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_MATH_ABS fabsf #define CPL_TYPE_IS_FPOINT #elif defined CPL_CLASS && CPL_CLASS == CPL_CLASS_INT #define CPL_TYPE int #define CPL_TYPE_CONCAT int #define CPL_TYPE_T CPL_TYPE_INT #define CPL_MATH_ABS abs #elif defined CPL_CLASS && CPL_CLASS == CPL_CLASS_DOUBLE_COMPLEX #define CPL_TYPE double complex #define CPL_TYPE_CONCAT double_complex #define CPL_MATH_ABS cabs #define CPL_TYPE_T CPL_TYPE_DOUBLE_COMPLEX #define CPL_TYPE_IS_FPOINT #elif defined CPL_CLASS && CPL_CLASS == CPL_CLASS_FLOAT_COMPLEX #define CPL_TYPE float complex #define CPL_TYPE_CONCAT float_complex #define CPL_MATH_ABS cabsf #define CPL_TYPE_T CPL_TYPE_FLOAT_COMPLEX #define CPL_TYPE_IS_FPOINT #else #undef CPL_TYPE #undef CPL_TYPE_T #undef CPL_MATH_ABS #undef CPL_TYPE_ADD #endif #define CPL_TYPE_ADD(a) CPL_CONCAT2X(a, CPL_TYPE_CONCAT) #if CPL_OPERATION == CPL_IMAGE_BASIC_DECLARE /*----------------------------------------------------------------------------- Private Function prototypes -----------------------------------------------------------------------------*/ static cpl_image * CPL_TYPE_ADD(cpl_image_collapse_window_create)(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size, int); static cpl_error_code CPL_TYPE_ADD(cpl_image_power)(cpl_image *, double); static cpl_error_code CPL_TYPE_ADD(cpl_image_exponential)(cpl_image *, double); static cpl_error_code CPL_TYPE_ADD(cpl_image_logarithm)(cpl_image *, double); static void CPL_TYPE_ADD(cpl_image_flip)(CPL_TYPE *, size_t) CPL_ATTR_NONNULL; /*----------------------------------------------------------------------------*/ /** @internal @brief Flip (reverse the order of) the elements @param self The array @param n The (positive) array size @return void */ /*----------------------------------------------------------------------------*/ static void CPL_TYPE_ADD(cpl_image_flip)(CPL_TYPE * self, size_t n) { size_t i; for (i = 0; i < n/2; i++) { const CPL_TYPE tmp = self[i]; self[i] = self[n-1-i]; self[n-1-i] = tmp; } } /*----------------------------------------------------------------------------*/ /** @internal @brief Type-specific version of the function @param self Image of the given type to process @param base The positive base of the logarithm @return CPL_ERROR_NONE or the relevant CPL error code on error @see cpl_image_logarithm() */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_image_logarithm)(cpl_image * self, double base) { double scale; const int myerrno = errno; CPL_TYPE * data = cpl_image_get_data(self); const size_t n = cpl_image_get_size_x(self) * cpl_image_get_size_y(self); const cpl_mask * mask = cpl_image_get_bpm_const(self); const cpl_binary * cbpm = mask ? cpl_mask_get_data_const(mask) : NULL; cpl_binary * bpm = NULL; size_t i; cpl_ensure_code(data != NULL, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(base > 0.0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(base != 1.0, CPL_ERROR_DIVISION_BY_ZERO); /* In spite of checks log() may still set errno */ errno = 0; scale = 1.0 / log(base); cpl_ensure_code(!errno, CPL_ERROR_ILLEGAL_INPUT); /* Pixel value must be positive */ for (i = 0; i < n; i++) { if (!cbpm || !cbpm[i]) { /* Pixel is not bad (yet) */ if ((double)data[i] > 0.0) { data[i] = (CPL_TYPE)(log((double)data[i]) * scale); } else { errno = EDOM; /* Use errno to reuse code */ } if (errno) { errno = 0; if (!bpm) { /* Create the Bad Pixel Map if necessary */ /* If cbpm is NULL, then keep it that way to save some checking */ bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; data[i] = 0; /* Set bad pixel to zero */ } } } /* FIXME: Counts also bad pixels */ cpl_tools_add_flops( 2 * n + 2); errno = myerrno; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Type-specific version of the function @param self Image of the given type to process @param base The base @return CPL_ERROR_NONE or the relevant CPL error code on error @see cpl_image_exponential() */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_image_exponential)(cpl_image * self, double base) { const int myerrno = errno; CPL_TYPE * data = cpl_image_get_data(self); const size_t n = cpl_image_get_size_x(self) * cpl_image_get_size_y(self); const cpl_mask * mask = cpl_image_get_bpm_const(self); const cpl_binary * cbpm = mask ? cpl_mask_get_data_const(mask) : NULL; cpl_binary * bpm = NULL; size_t i; cpl_ensure_code(data != NULL, CPL_ERROR_ILLEGAL_INPUT); /* In spite of checks pow() may still overflow */ errno = 0; #ifdef CPL_TYPE_IS_FPOINT /* The branch with this check is not needed for integer pixels */ if (base < 0.0) { /* Pixel value must be integer */ for (i = 0; i < n; i++) { if (!cbpm || !cbpm[i]) { /* Pixel is not bad (yet) */ if ((double)data[i] == ceil((double)data[i])) { data[i] = (CPL_TYPE)pow(base, (double)data[i]); } else { errno = EDOM; /* Use errno to reuse code */ } if (errno) { errno = 0; if (!bpm) { /* Create the Bad Pixel Map if necessary */ /* If cbpm is NULL, then keep it that way to save some checking */ bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; data[i] = 0; /* Set bad pixel to zero */ } } } } else #endif if (base != 0.0) { /* Pixel value can be anything */ for (i = 0; i < n; i++) { if (!cbpm || !cbpm[i]) { /* Pixel is not bad (yet) */ data[i] = (CPL_TYPE)pow(base, (double)data[i]); if (errno) { errno = 0; if (!bpm) { /* Create the Bad Pixel Map if necessary */ /* If cbpm is NULL, then keep it that way to save some checking */ bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; data[i] = 0; /* Set bad pixel to zero */ } } } } else { /* Base is zero, pixel value must be non-negative */ for (i = 0; i < n; i++) { if (!cbpm || !cbpm[i]) { /* Pixel is not bad (yet) */ if ((double)data[i] >= 0.0) { data[i] = (CPL_TYPE)pow(base, (double)data[i]); } else { errno = EDOM; /* Use errno to reuse code */ } if (errno) { errno = 0; if (!bpm) { /* Create the Bad Pixel Map if necessary */ /* If cbpm is NULL, then keep it that way to save some checking */ bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; data[i] = 0; /* Set bad pixel to zero */ } } } } /* FIXME: Counts also bad pixels */ cpl_tools_add_flops( n ); errno = myerrno; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Type-specific version of the function @param self Image of the given type to process @param exponent The exponent @return CPL_ERROR_NONE or the relevant CPL error code on error @see cpl_image_power() */ /*----------------------------------------------------------------------------*/ static cpl_error_code CPL_TYPE_ADD(cpl_image_power)(cpl_image * self, double exponent) { const int myerrno = errno; CPL_TYPE * data = cpl_image_get_data(self); const size_t n = cpl_image_get_size_x(self) * cpl_image_get_size_y(self); const cpl_mask * mask = cpl_image_get_bpm_const(self); const cpl_binary * cbpm = mask ? cpl_mask_get_data_const(mask) : NULL; cpl_binary * bpm = NULL; size_t i; cpl_ensure_code(data != NULL, CPL_ERROR_ILLEGAL_INPUT); /* In spite of checks pow() may still overflow */ errno = 0; if (exponent == -0.5) { /* Pixel value must be positive */ for (i = 0; i < n; i++) { if (!cbpm || !cbpm[i]) { /* Pixel is not bad (yet) */ if ((double)data[i] > 0.0) { data[i] = (CPL_TYPE)(1.0/sqrt((double)data[i])); } else { errno = EDOM; /* Use errno to reuse code */ } if (errno) { errno = 0; if (!bpm) { /* Create the Bad Pixel Map if necessary */ /* If cbpm is NULL, then keep it that way to save some checking */ bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; data[i] = 0; /* Set bad pixel to zero */ } } } #ifdef HAVE_CBRT } else if (exponent == -1.0 / 3.0) { /* Pixel value must be positive */ for (i = 0; i < n; i++) { if (!cbpm || !cbpm[i]) { /* Pixel is not bad (yet) */ if ((double)data[i] > 0.0) { data[i] = (CPL_TYPE)(1.0/cbrt((double)data[i])); } else { errno = EDOM; /* Use errno to reuse code */ } if (errno) { errno = 0; if (!bpm) { /* Create the Bad Pixel Map if necessary */ /* If cbpm is NULL, then keep it that way to save some checking */ bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; data[i] = 0; /* Set bad pixel to zero */ } } } #endif } else if (exponent < 0.0) { if (exponent != ceil(exponent)) { /* Pixel value must be positive */ for (i = 0; i < n; i++) { if (!cbpm || !cbpm[i]) { /* Pixel is not bad (yet) */ if ((double)data[i] > 0.0) { data[i] = (CPL_TYPE)pow((double)data[i], exponent); } else { errno = EDOM; /* Use errno to reuse code */ } if (errno) { errno = 0; if (!bpm) { /* Create the Bad Pixel Map if necessary */ /* If cbpm is NULL, then keep it that way to save some checking */ bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; data[i] = 0; /* Set bad pixel to zero */ } } } } else { /* Pixel value must be non-zero */ for (i = 0; i < n; i++) { if (!cbpm || !cbpm[i]) { /* Pixel is not bad (yet) */ if ((double)data[i] != 0.0) { data[i] = (CPL_TYPE)cpl_tools_ipow((double)data[i], exponent); } else { errno = EDOM; /* Use errno to reuse code */ } if (errno) { errno = 0; if (!bpm) { /* Create the Bad Pixel Map if necessary */ /* If cbpm is NULL, then keep it that way to save some checking */ bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; data[i] = 0; /* Set bad pixel to zero */ } } } } } else if (exponent == 0.5) { /* Pixel value must be non-negative */ for (i = 0; i < n; i++) { if (!cbpm || !cbpm[i]) { /* Pixel is not bad (yet) */ if ((double)data[i] >= 0.0) { data[i] = (CPL_TYPE)sqrt((double)data[i]); } else { errno = EDOM; /* Use errno to reuse code */ } if (errno) { errno = 0; if (!bpm) { /* Create the Bad Pixel Map if necessary */ /* If cbpm is NULL, then keep it that way to save some checking */ bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; data[i] = 0; /* Set bad pixel to zero */ } } } #ifdef HAVE_CBRT } else if (exponent == 1.0 / 3.0) { if (cbpm == NULL) { /* No bad pixels */ for (i = 0; i < n; i++) { data[i] = (CPL_TYPE)cbrt((double)data[i]); } } else { for (i = 0; i < n; i++) { if (!cbpm[i]) { /* Pixel is not bad */ data[i] = (CPL_TYPE)cbrt((double)data[i]); } } } #endif } else if (exponent != ceil(exponent)) { /* Pixel value must be non-negative */ for (i = 0; i < n; i++) { if (!cbpm || !cbpm[i]) { /* Pixel is not bad (yet) */ if ((double)data[i] >= 0.0) { data[i] = (CPL_TYPE)pow((double)data[i], exponent); } else { errno = EDOM; /* Use errno to reuse code */ } if (errno) { errno = 0; if (!bpm) { /* Create the Bad Pixel Map if necessary */ /* If cbpm is NULL, then keep it that way to save some checking */ bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; data[i] = 0; /* Set bad pixel to zero */ } } } } else if (exponent != 1.0) { /* Pixel value can be anything */ for (i = 0; i < n; i++) { if (!cbpm || !cbpm[i]) { /* Pixel is not bad (yet) */ data[i] = (CPL_TYPE)cpl_tools_ipow((double)data[i], exponent); if (errno) { errno = 0; if (!bpm) { /* Create the Bad Pixel Map if necessary */ /* If cbpm is NULL, then keep it that way to save some checking */ bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; data[i] = 0; /* Set bad pixel to zero */ } } } } /* FIXME: Counts also bad pixels */ cpl_tools_add_flops( n ); errno = myerrno; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Collapse an image region along its rows or columns. @param self Image of type CPL_TYPE to collapse. @param llx lower left x coord. @param lly lower left y coord @param urx upper right x coord @param ury upper right y coord @param direction Collapsing direction. @return a newly allocated image or NULL in error case @note This static function will assert() on invalid image input @see cpl_image_collapse_window_create() llx, lly, urx, ury are the image region coordinates in FITS convention. Those specified bounds are included in the collapsed region. The returned image must be deallocated using cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_ILLEGAL_INPUT if the specified window is not valid */ /*----------------------------------------------------------------------------*/ static cpl_image * CPL_TYPE_ADD(cpl_image_collapse_window_create)(const cpl_image * self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, int direction) { cpl_image * other; const CPL_TYPE * pi = (const CPL_TYPE*)self->pixels; const cpl_binary * bpmi = self->bpm ? cpl_mask_get_data(self->bpm) : NULL; CPL_TYPE * po; cpl_binary * bpmo = NULL; const size_t n1x = 1 + urx - llx; const size_t n1y = 1 + ury - lly; size_t i, j; cpl_ensure(direction == 0 || direction == 1, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(llx >= 1, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(lly >= 1, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(urx <= self->nx, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(ury <= self->ny, CPL_ERROR_ILLEGAL_INPUT, NULL); assert( self->type == CPL_TYPE_T ); /* Let pi and bpmi point to first pixel to collapse */ pi += self->nx * (lly-1) + (llx - 1); if (bpmi != NULL) bpmi += self->nx * (lly-1) + (llx - 1); if (direction == 0) { const double r1y = (double)n1y; size_t * nok; other = cpl_image_new(n1x, 1, CPL_TYPE_T); po = (CPL_TYPE*)other->pixels; /* To obtain a stride-1 access of pi[], some temporary storage is needed - this may be a disadvantage for very small images */ nok = (size_t*)cpl_calloc(n1x, sizeof(*nok)); for (j=0; j < n1y; j++) { for (i=0; i < n1x; i++) { if (bpmi == NULL || !bpmi[i]) { po[i] += pi[i]; nok[i]++; /* Count good pixels */ } } pi += self->nx; if (bpmi != NULL) bpmi += self->nx; } if (bpmi != NULL) { for (i=0; i < n1x; i++) { if (nok[i] == 0) { /* assert(po[i] == 0.0); */ if (bpmo == NULL) bpmo = cpl_mask_get_data(cpl_image_get_bpm(other)); bpmo[i] = CPL_BINARY_1; } else if (nok[i] < n1y) { po[i] *= r1y / (double)nok[i]; } } } cpl_free(nok); } else if (direction == 1) { const double r1x = (double)n1x; double sum; size_t nok; other = cpl_image_new(1, n1y, CPL_TYPE_T); po = (CPL_TYPE*)other->pixels; for (j=0; j < n1y; j++) { sum = 0.0; nok = 0; for (i=0; i < n1x; i++) { if (bpmi == NULL || !bpmi[i]) { sum += pi[i]; nok++; } } if (nok == 0) { /* assert(po[j] == 0.0); */ if (bpmo == NULL) bpmo = cpl_mask_get_data(cpl_image_get_bpm(other)); bpmo[j] = CPL_BINARY_1; } else { po[j] = nok == n1x ? sum : sum * r1x / (double)nok; } pi += self->nx; if (bpmi != NULL) bpmi += self->nx; } } #ifdef CPL_TYPE_IS_FPOINT /* FIXME: Counts also bad pixels */ cpl_tools_add_flops(n1x * n1y); #endif return other; } #elif CPL_OPERATION == CPL_IMAGE_BASIC_ASSIGN #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_BASIC_OPERATE cpl_image * self; if (image1 == NULL) { (void)cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "First image is NULL"); return NULL; } else if (image2 == NULL) { (void)cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "Second image is NULL"); return NULL; } else if (image1->nx != image2->nx) { (void)cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "Images are %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " (%s) <=> %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " (%s)", image1->nx, image1->ny, cpl_type_get_name(image1->type), image2->nx, image2->ny, cpl_type_get_name(image2->type)); return NULL; } else if (image1->ny != image2->ny) { (void)cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "Images are %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " (%s) <=> %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " (%s)", image1->nx, image1->ny, cpl_type_get_name(image1->type), image2->nx, image2->ny, cpl_type_get_name(image2->type)); return NULL; } assert( image1->pixels ); assert( image2->pixels ); /* Switch on the first passed image type */ switch (image1->type) { #define CPL_MATH_ABS1 abs case CPL_TYPE_INT: { const int * p1 = (const int *)image1->pixels; int * pout = (int *)cpl_malloc(image1->nx * image1->ny * sizeof(*pout)); /* Switch on the second passed image type */ switch (image2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #define CPL_MATH_ABS2 abs #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #define CPL_MATH_ABS2 fabsf #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #define CPL_MATH_ABS2 fabs #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 default: cpl_free(pout); (void)cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); pout = NULL; } self = pout ? cpl_image_wrap_int(image1->nx, image1->ny, pout) : NULL; break; } #undef CPL_MATH_ABS1 #define CPL_MATH_ABS1 fabsf case CPL_TYPE_FLOAT: { const float * p1 = (const float *)image1->pixels; float * pout = (float *)cpl_malloc(image1->nx * image1->ny * sizeof(*pout)); /* Switch on the second passed image type */ switch (image2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #define CPL_MATH_ABS2 abs #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #define CPL_MATH_ABS2 fabsf #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #define CPL_MATH_ABS2 fabs #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 default: cpl_free(pout); (void)cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); pout = NULL; } self = pout ? cpl_image_wrap_float(image1->nx, image1->ny, pout) : NULL; break; } #undef CPL_MATH_ABS1 #define CPL_MATH_ABS1 fabs case CPL_TYPE_DOUBLE: { const double * p1 = (const double *)image1->pixels; double * pout = (double *)cpl_malloc(image1->nx * image1->ny * sizeof(*pout)); /* Switch on the second passed image type */ switch (image2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #define CPL_MATH_ABS2 abs #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #define CPL_MATH_ABS2 fabsf #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #define CPL_MATH_ABS2 fabs #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 default: cpl_free(pout); (void)cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); pout = NULL; } self = pout ? cpl_image_wrap_double(image1->nx, image1->ny, pout) : NULL; break; } #undef CPL_MATH_ABS1 #define CPL_MATH_ABS1 cabsf case CPL_TYPE_FLOAT_COMPLEX: { const float complex * p1 = (const float complex *)image1->pixels; float complex * pout = (float complex *)cpl_malloc(image1->nx * image1->ny * sizeof(*pout)); /* Switch on the second passed image type */ switch (image2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #define CPL_MATH_ABS2 abs #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #define CPL_MATH_ABS2 fabsf #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #define CPL_MATH_ABS2 fabs #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_FLOAT_COMPLEX #define CPL_TYPE float complex #define CPL_MATH_ABS2 cabsf #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_DOUBLE_COMPLEX #define CPL_TYPE double complex #define CPL_MATH_ABS2 cabs #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 default: cpl_free(pout); (void)cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); pout = NULL; } self = pout ? cpl_image_wrap_float_complex(image1->nx, image1->ny, pout) : NULL; break; } #undef CPL_MATH_ABS1 #define CPL_MATH_ABS1 cabs case CPL_TYPE_DOUBLE_COMPLEX: { const double complex * p1 = (const double complex *)image1->pixels; double complex * pout = (double complex *)cpl_malloc(image1->nx * image1->ny * sizeof(*pout)); /* Switch on the second passed image type */ switch (image2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #define CPL_MATH_ABS2 abs #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #define CPL_MATH_ABS2 fabsf #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #define CPL_MATH_ABS2 fabs #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_FLOAT_COMPLEX #define CPL_TYPE float complex #define CPL_MATH_ABS2 cabsf #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 #define CPL_TYPE_T CPL_TYPE_DOUBLE_COMPLEX #define CPL_TYPE double complex #define CPL_MATH_ABS2 cabs #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #undef CPL_MATH_ABS2 default: cpl_free(pout); (void)cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); pout = NULL; } self = pout ? cpl_image_wrap_double_complex(image1->nx, image1->ny, pout) : NULL; break; } #undef CPL_MATH_ABS1 default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); self = NULL; } if (self != NULL) { if (image1->type != CPL_TYPE_INT && image2->type != CPL_TYPE_INT) { cpl_tools_add_flops(image1->nx * image1->ny); } /* Handle bad pixels map */ if (image1->bpm == NULL && image2->bpm == NULL) { self->bpm = NULL; } else if (image1->bpm == NULL) { self->bpm = cpl_mask_duplicate(image2->bpm); } else if (image2->bpm == NULL) { self->bpm = cpl_mask_duplicate(image1->bpm); } else { self->bpm = cpl_mask_duplicate(image1->bpm); cpl_mask_or(self->bpm, image2->bpm); } } return self; #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_BASIC_ASSIGN #elif CPL_OPERATION == CPL_IMAGE_BASIC_ASSIGN_LOCAL #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_BASIC_OPERATE_LOCAL if (im1 == NULL) { return cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "First image is NULL"); } else if (im2 == NULL) { return cpl_error_set_message_(CPL_ERROR_NULL_INPUT, "Second image is NULL"); } else if (im1->nx != im2->nx) { return cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "Images are %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " (%s) <=> %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " (%s)", im1->nx, im1->ny, cpl_type_get_name(im1->type), im2->nx, im2->ny, cpl_type_get_name(im2->type)); } else if (im1->ny != im2->ny) { return cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "Images are %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " (%s) <=> %" CPL_SIZE_FORMAT " X %" CPL_SIZE_FORMAT " (%s)", im1->nx, im1->ny, cpl_type_get_name(im1->type), im2->nx, im2->ny, cpl_type_get_name(im2->type)); } assert( im1->pixels ); assert( im2->pixels ); /* Switch on the first passed image type */ switch (im1->type) { case CPL_TYPE_INT: { int * p1 = (int *)im1->pixels; /* Switch on the second passed image type */ switch (im2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } break; } case CPL_TYPE_FLOAT: { float * p1 = (float *)im1->pixels; /* Switch on the second passed image type */ switch (im2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } cpl_tools_add_flops( im1->nx * im1->ny ); break; } case CPL_TYPE_DOUBLE: { double * p1 = (double *)im1->pixels; /* Switch on the second passed image type */ switch (im2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } cpl_tools_add_flops( im1->nx * im1->ny ); break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex * p1 = (float complex *)im1->pixels; /* Switch on the second passed image type */ switch (im2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT_COMPLEX #define CPL_TYPE float complex #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE_COMPLEX #define CPL_TYPE double complex #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } cpl_tools_add_flops( im1->nx * im1->ny ); break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex * p1 = (double complex *)im1->pixels; /* Switch on the second passed image type */ switch (im2->type) { #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE int #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE float #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE double #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_FLOAT_COMPLEX #define CPL_TYPE float complex #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE #define CPL_TYPE_T CPL_TYPE_DOUBLE_COMPLEX #define CPL_TYPE double complex #include "cpl_image_basic_body.h" #undef CPL_TYPE_T #undef CPL_TYPE default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } cpl_tools_add_flops( im1->nx * im1->ny ); break; } default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } /* Handle bad pixels map */ if (im2->bpm != NULL) { if (im1->bpm == NULL) { im1->bpm = cpl_mask_duplicate(im2->bpm); } else { cpl_mask_or(im1->bpm, im2->bpm); } } return CPL_ERROR_NONE; #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_BASIC_ASSIGN_LOCAL #elif CPL_OPERATION == CPL_IMAGE_BASIC_OP_SCALAR case CPL_TYPE_T: { CPL_TYPE * pio = (CPL_TYPE*)self->pixels; const CPL_TYPE cscalar = (const CPL_TYPE)scalar; const size_t nxy = (size_t)(self->nx * self->ny); size_t i; assert( self->pixels ); for (i = 0; i < nxy; i++) { CPL_OPERATOR(pio[i], cscalar); } #ifdef CPL_TYPE_IS_FPOINT cpl_tools_add_flops( nxy ); #endif break; } #elif CPL_OPERATION == CPL_IMAGE_BASIC_SQRT case CPL_TYPE_T: { CPL_TYPE * pio = (CPL_TYPE*)image->pixels; const size_t nxy = (size_t)(image->nx * image->ny); size_t i; for (i=0; i < nxy; i++) pio[i] = sqrt(pio[i]); #ifdef CPL_TYPE_IS_FPOINT cpl_tools_add_flops( image->nx * image->ny ); #endif break; } #elif CPL_OPERATION == CPL_IMAGE_BASIC_THRESHOLD case CPL_TYPE_T: { CPL_TYPE * pi = (CPL_TYPE*)image_in->pixels; const size_t nxy = (size_t)(image_in->nx * image_in->ny); size_t i; for (i=0; i < nxy; i++) { if (pi[i] > hi_cut) pi[i] = (CPL_TYPE)assign_hi_cut; else if (pi[i] < lo_cut) pi[i] = (CPL_TYPE)assign_lo_cut; } break; } #elif CPL_OPERATION == CPL_IMAGE_BASIC_ABS case CPL_TYPE_T: { CPL_TYPE * pio = (CPL_TYPE*)image->pixels; const size_t nxy = (size_t)(image->nx * image->ny); size_t i; for (i = 0; i < nxy; i++) pio[i] = (CPL_TYPE)CPL_MATH_ABS(pio[i]); #ifdef CPL_TYPE_IS_FPOINT cpl_tools_add_flops( image->nx * image->ny ); #endif break; } #elif CPL_OPERATION == CPL_IMAGE_BASIC_AVERAGE case CPL_TYPE_T: { const size_t nxy = (size_t)(image_1->nx * image_1->ny); const CPL_TYPE * pi1 = (const CPL_TYPE*)image_1->pixels; CPL_TYPE * po = (CPL_TYPE *)cpl_malloc(nxy * sizeof(*po)); size_t i; /* Switch on second passed image type */ switch (image_2->type) { case CPL_TYPE_INT: pii2 = (int*)image_2->pixels; for (i = 0; i < nxy; i++) po[i] = (CPL_TYPE)(0.5 * (pi1[i] + pii2[i])); break; case CPL_TYPE_FLOAT: pfi2 = (float*)image_2->pixels; for (i = 0; i < nxy; i++) po[i] = (CPL_TYPE)(0.5 * (pi1[i] + pfi2[i])); break; case CPL_TYPE_DOUBLE: pdi2 = (double*)image_2->pixels; for (i = 0; i < nxy; i++) po[i] = (CPL_TYPE)(0.5 * (pi1[i] + pdi2[i])); break; default: cpl_free(po); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } image_out = cpl_image_wrap_(image_1->nx, image_1->ny, CPL_TYPE_T, po); #ifdef CPL_TYPE_IS_FPOINT cpl_tools_add_flops( 2 * image_out->nx * image_out->ny ); #endif break; } #elif CPL_OPERATION == CPL_IMAGE_BASIC_EXTRACT case CPL_TYPE_T: { const size_t outlx = urx - llx + 1; const size_t outly = ury - lly + 1; /* Output pixel buffer */ void * po = cpl_malloc(outlx * outly * sizeof(CPL_TYPE)); if (cpl_tools_copy_window(po, in->pixels, sizeof(CPL_TYPE), in->nx, in->ny, llx, lly, urx, ury)) { cpl_free(po); (void)cpl_error_set_where_(); } else { self = CPL_TYPE_ADD(cpl_image_wrap)(outlx, outly, (CPL_TYPE*)po); } break; } #elif CPL_OPERATION == CPL_IMAGE_BASIC_EXTRACTROW case CPL_TYPE_T: { CPL_TYPE * pi = (CPL_TYPE*)image_in->pixels; size_t i; for (i = 0; i < (size_t)image_in->nx; i++) { out_data[i] = (double)pi[i+(pos-1)*image_in->nx]; } break; } #elif CPL_OPERATION == CPL_IMAGE_BASIC_EXTRACTCOL case CPL_TYPE_T: { CPL_TYPE * pi = (CPL_TYPE*)image_in->pixels; size_t i; for (i = 0; i < (size_t)image_in->ny; i++) { out_data[i] = (double)pi[pos-1+i*image_in->nx]; } break; } #elif CPL_OPERATION == CPL_IMAGE_BASIC_COLLAPSE_MEDIAN case CPL_TYPE_T: { /* Number of output pixels */ const size_t npix = direction ? self->ny : self->nx; /* Max number of input pixels in one median computation */ const size_t nmed = (direction ? self->nx : self->ny) - ndrop; const CPL_TYPE * pi = (const CPL_TYPE*)self->pixels; CPL_TYPE * po = (CPL_TYPE*)cpl_malloc(npix * sizeof(CPL_TYPE)); CPL_TYPE * med = (CPL_TYPE*)cpl_malloc(nmed * sizeof(CPL_TYPE)); cpl_binary * bpm = NULL; const cpl_binary * bin = self->bpm ? cpl_mask_get_data_const(self->bpm) : NULL; cpl_boolean isok = bin == NULL ? CPL_TRUE : CPL_FALSE; size_t i, j; if (direction == 1) { /* Collapsing the image in the x direction */ pi += drop_ll; if (bin == NULL) { for (j = 0; j < (size_t)(self->ny); j++, pi += self->nx) { size_t k = 0; for (i = 0; i < nmed; i++) { med[k++] = pi[i]; } po[j] = CPL_TYPE_ADD(cpl_tools_get_median)(med, k); } } else { bin += drop_ll; for (j = 0; j < (size_t)(self->ny); j++, pi += self->nx, bin += self->nx) { size_t k = 0; for (i = 0; i < nmed; i++) { if (!bin[i]) med[k++] = pi[i]; } if (k == 0) { if (bpm == NULL) bpm = cpl_calloc((size_t)npix, sizeof(cpl_binary)); bpm[j] = CPL_BINARY_1; po[j] = (CPL_TYPE)0; } else { po[j] = CPL_TYPE_ADD(cpl_tools_get_median)(med, k); isok = CPL_TRUE; } } } } else { /* Collapsing the image in the y direction */ pi += drop_ll * self->nx; if (bin == NULL) { for (i = 0; i < (size_t)(self->nx); i++, pi++) { size_t k = 0; for (j = 0; j < nmed; j++) { med[k++] = pi[j * self->nx]; } po[i] = CPL_TYPE_ADD(cpl_tools_get_median)(med, k); } } else { bin += drop_ll * self->nx; for (i = 0; i < (size_t)(self->nx); i++, pi++, bin++) { size_t k = 0; for (j = 0; j < nmed; j++) { if (!bin[j * self->nx]) med[k++] = pi[j * self->nx]; } if (k == 0) { if (bpm == NULL) bpm = cpl_calloc((size_t)npix, sizeof(cpl_binary)); bpm[i] = CPL_BINARY_1; po[i] = (CPL_TYPE)0; } else { po[i] = CPL_TYPE_ADD(cpl_tools_get_median)(med, k); isok = CPL_TRUE; } } } } cpl_free(med); if (isok) { other = direction ? CPL_TYPE_ADD(cpl_image_wrap)(1, self->ny, po) : CPL_TYPE_ADD(cpl_image_wrap)(self->nx, 1, po); if (bpm != NULL) { other->bpm = direction ? cpl_mask_wrap(1, self->ny, bpm) : cpl_mask_wrap(self->nx, 1, bpm); } } else { cpl_free(po); cpl_free(bpm); (void)cpl_error_set(cpl_func, CPL_ERROR_DATA_NOT_FOUND); } break; } #elif CPL_OPERATION == CPL_IMAGE_BASIC_ROTATE_INT_LOCAL case CPL_TYPE_T: { /* rot is 0, 1, 2 or 3. */ switch(rot) { case 1: { CPL_TYPE * pi = (CPL_TYPE *)self->pixels; size_t i,j; if (self->nx == self->ny) { /* If self->nx is even, then there is a multiple of 4 pixels to move. If self->nx is odd, then there is also a multiple of 4 pixels to move, since the center pixel does not move. */ /* The first four pixels to move are the corner ones, followed by their neighbors - the last four pixels to move are the center ones. */ for (j = 0; j < (size_t)(self->ny/2); j++) { for (i = j; i < (size_t)(self->nx-1-j); i++) { const CPL_TYPE tmp = pi[i + j * self->nx]; pi[i + j * self->nx] = pi[(self->ny-1-j) + i * self->nx]; pi[(self->ny-1-j) + i * self->nx] = pi[(self->nx-1-i) + (self->ny-1-j) * self->nx]; pi[(self->nx-1-i) + (self->ny-1-j) * self->nx] = pi[j + (self->nx-1-i) * self->nx]; pi[j + (self->nx-1-i) * self->nx] = tmp; } } } else if (self->nx == 1) { /* No pixels need to move - just swap nx and ny */ self->nx = self->ny; self->ny = 1; } else if (self->ny == 1) { /* The image is a single horizontal row, the order of the pixels needs to be reversed */ /* Flip the 1D-image and swap nx and ny */ CPL_TYPE_ADD(cpl_image_flip)(pi, (size_t)self->nx); self->ny = self->nx; self->nx = 1; } else { /* Duplicate the input image :-( */ cpl_image * tmp = cpl_image_duplicate(self); const CPL_TYPE * pt = (const CPL_TYPE *)tmp->pixels; self->nx = tmp->ny; self->ny = tmp->nx; pi += ((self->ny)-1)* (self->nx); for (j=0; j < (size_t)(self->nx); j++) { for (i = 0; i < (size_t)(self->ny); i++) { *pi = *pt++; pi -= (self->nx); } pi += (self->nx)*(self->ny)+1; } cpl_image_delete(tmp); } break; } case 2: { /* A 180 degree rotation preserves the shape of the image, and reverts the order of the pixels */ CPL_TYPE_ADD(cpl_image_flip)((CPL_TYPE *)self->pixels, (size_t)self->nx * (size_t)self->ny); break; } case 3: { CPL_TYPE * pi = (CPL_TYPE *)self->pixels; size_t i,j; if (self->nx == self->ny) { /* See case 1. */ for (j = 0; j < (size_t)(self->ny/2); j++) { for (i = j; i < (size_t)(self->nx-1-j); i++) { const CPL_TYPE tmp = pi[i + j * self->nx]; pi[i + j * self->nx] = pi[j + (self->nx-1-i) * self->nx]; pi[j + (self->nx-1-i) * self->nx] = pi[(self->nx-1-i) + (self->ny-1-j) * self->nx]; pi[(self->nx-1-i) + (self->ny-1-j) * self->nx] = pi[(self->ny-1-j) + i * self->nx]; pi[(self->ny-1-j) + i * self->nx] = tmp; } } } else if (self->ny == 1) { /* No pixels need to move - just swap nx and ny */ self->ny = self->nx; self->nx = 1; } else if (self->nx == 1) { /* The image is a single vertical solumn, the order of the pixels needs to be reversed */ /* Flip the 1D-image and swap nx and ny */ CPL_TYPE_ADD(cpl_image_flip)(pi, (size_t)self->ny); self->nx = self->ny; self->ny = 1; } else { /* Duplicate the input image :-( */ cpl_image * tmp = cpl_image_duplicate(self); const CPL_TYPE * pt = (const CPL_TYPE *)tmp->pixels; self->nx = tmp->ny; self->ny = tmp->nx; pi += (self->nx)-1; for (j=0; j < (size_t)(self->nx); j++) { for (i = 0; i < (size_t)(self->ny); i++) { *pi = *pt++; pi += (self->nx); } pi -= (self->nx)*(self->ny)+1; } cpl_image_delete(tmp); } break; } default: break; } break; } #elif CPL_OPERATION == CPL_IMAGE_BASIC_FLIP_LOCAL case CPL_TYPE_T: { const size_t nx = im->nx; const size_t ny = im->ny; CPL_TYPE * pi = (CPL_TYPE *)im->pixels; size_t i, j; switch(angle) { case 0: { const size_t rowsize = (size_t)nx * sizeof(CPL_TYPE); CPL_TYPE row[nx]; CPL_TYPE * pfirst = pi; CPL_TYPE * plast = pi + (ny-1) * nx; for (j = 0; j < ny/2; j++, pfirst += nx, plast -= nx) { (void)memcpy(row, pfirst, rowsize); (void)memcpy(pfirst, plast, rowsize); (void)memcpy(plast, row, rowsize); } break; } case 2: { for (j = 0; j < ny; j++, pi += nx) { CPL_TYPE_ADD(cpl_image_flip)(pi, nx); } break; } case 1: { if (nx == ny) { CPL_TYPE * pt = pi; for (j = 0; j < nx; j++, pt += nx) { for (i = 0; i < j; i++) { const CPL_TYPE tmp = pt[i]; pt[i] = pi[j + i * nx]; pi[j + i * nx] = tmp; } } } else { /* Duplicate the input image */ cpl_image * tmp_im = cpl_image_duplicate(im); const CPL_TYPE * pt = (const CPL_TYPE *)tmp_im->pixels; im->nx = ny; im->ny = nx; for (j=0; jpixels; im->nx = ny; im->ny = nx; pt += (nx*ny-1); for (j=0; jpixels; po = (CPL_TYPE *)im->pixels; /* Move the pixels */ for (j=0; jnx*(l+j*tile_sz_y); npos=(k+tile_x*tile_sz_x) + im->nx*(l+tile_y*tile_sz_y); po[npos] = pi[opos]; } } } } cpl_image_delete(tmp_im); break; } #else #error "Undefined CPL Operation" #endif #undef CPL_TYPE #undef CPL_TYPE_CONCAT #undef CPL_TYPE_T #undef CPL_MATH_ABS #undef CPL_TYPE_ADD #undef CPL_TYPE_IS_FPOINT #endif cpl-6.4.1/cplcore/cpl_type.c0000644000460300003120000002045111654215241012627 00000000000000/* $Id: cpl_type.c,v 1.16 2011-11-02 10:25:37 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-11-02 10:25:37 $ * $Revision: 1.16 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include #include "cpl_type.h" #include "cpl_error_impl.h" /** * @defgroup cpl_type Type codes * * This module provides codes for the basic types (including @c char, @c int, * @c float, etc.) used in CPL. These type codes may be used to indicate the * type of a value stored in another object, the value of a property or the * pixel of an image for instance. In addition, a utility function is provided * to compute the size, which is required to store a value of the type indicated * by a given type code. * * * The module * @par Synopsis * @code * #include * @endcode */ /**@{*/ /** * @brief * Compute the size of a type. * * @param type Type code to be evaluated. * * @return The size of the fundamental type, or 0 in case an invalid type * code was given. * * The function computes the atomic size of the type @em type. The result * for fundamental types like @c CPL_TYPE_FLOAT is what you would expect * from the C @b sizeof() operator. For arrays, i.e. types having the * @c CPL_TYPE_FLAG_ARRAY set the returned size is not the size of a pointer * to @c CPL_TYPE_FLOAT for instance, but the size of its fundamental type, * i.e. the returned size is same as for the type @c CPL_TYPE_FLOAT. * * Especially for the type @c CPL_TYPE_STRING, which is explicitly defined for * convenience reasons, the size returned by this function is the size of * @c CPL_TYPE_CHAR! */ size_t cpl_type_get_sizeof(cpl_type type) { size_t sz; if ((type & CPL_TYPE_INVALID) || (type & CPL_TYPE_UNSPECIFIED)) return 0; /* * We just want the size of the fundamental type, therefore the * array flag is removed. This also means that an explicit case * for CPL_TYPE_STRING is not necessary in the following switch. */ type &= ~CPL_TYPE_FLAG_ARRAY; switch (type) { case CPL_TYPE_CHAR: sz = sizeof(char); break; case CPL_TYPE_UCHAR: sz = sizeof(unsigned char); break; case CPL_TYPE_BOOL: sz = sizeof(cpl_boolean); break; case CPL_TYPE_SHORT: sz = sizeof(short); break; case CPL_TYPE_USHORT: sz = sizeof(unsigned short); break; case CPL_TYPE_INT: sz = sizeof(int); break; case CPL_TYPE_UINT: sz = sizeof(unsigned int); break; case CPL_TYPE_LONG: sz = sizeof(long int); break; case CPL_TYPE_ULONG: sz = sizeof(unsigned long int); break; case CPL_TYPE_LONG_LONG: sz = sizeof(long long int); break; case CPL_TYPE_FLOAT: sz = sizeof(float); break; case CPL_TYPE_DOUBLE: sz = sizeof(double); break; case CPL_TYPE_POINTER: sz = sizeof(void*); break; case CPL_TYPE_FLOAT_COMPLEX: sz = sizeof(float complex); break; case CPL_TYPE_DOUBLE_COMPLEX: sz = sizeof(double complex); break; default: sz = 0; break; } return sz; } /** * @brief * Get a string with the name of a type, e.g. "char", "int", "float" * * @param type Type code to be evaluated. * * @return A pointer to a string literal with the name or empty string on error. * */ const char * cpl_type_get_name(cpl_type type) { const char * self = ""; if ((type & CPL_TYPE_POINTER) || (type & CPL_TYPE_FLAG_ARRAY)) { /* switch on type without POINTER and ARRAY bits */ switch (type & ~CPL_TYPE_POINTER & ~CPL_TYPE_FLAG_ARRAY) { /* Here follows all "usable" types as arrays */ case CPL_TYPE_CHAR: /* string: case CPL_TYPE_STRING | CPL_TYPE_FLAG_ARRAY: */ self = "char array"; break; case CPL_TYPE_UCHAR: self = "unsigned char array"; break; case CPL_TYPE_BOOL: self = "boolean array"; break; case CPL_TYPE_SHORT: self = "short array"; break; case CPL_TYPE_USHORT: self = "unsigned short array"; break; case CPL_TYPE_INT: self = "int array"; break; case CPL_TYPE_UINT: self = "unsigned int array"; break; case CPL_TYPE_LONG: self = "long int array"; break; case CPL_TYPE_ULONG: self = "unsigned long int array"; break; case CPL_TYPE_LONG_LONG: self = "long long int array"; break; case CPL_TYPE_FLOAT: self = "float array"; break; case CPL_TYPE_DOUBLE: self = "double array"; break; case CPL_TYPE_FLOAT_COMPLEX: self = "float complex array"; break; case CPL_TYPE_DOUBLE_COMPLEX: self = "double complex array"; break; case CPL_TYPE_STRING: /* char: case CPL_TYPE_STRING | CPL_TYPE_FLAG_ARRAY: */ self = "string array"; break; default: (void)cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "array/pointer type=0x%x", (int)type); break; } } else { switch (type) { /* FIXME: This is a valid value for the enum... */ case CPL_TYPE_FLAG_ARRAY: self = "array"; break; /* FIXME: This is a valid value for the enum... */ case CPL_TYPE_INVALID: self = "invalid"; break; case CPL_TYPE_CHAR: self = "char"; break; case CPL_TYPE_UCHAR: self = "unsigned char"; break; case CPL_TYPE_BOOL: self = "boolean"; break; case CPL_TYPE_SHORT: self = "short"; break; case CPL_TYPE_USHORT: self = "unsigned short"; break; case CPL_TYPE_INT: self = "int"; break; case CPL_TYPE_UINT: self = "unsigned int"; break; case CPL_TYPE_LONG: self = "long int"; break; case CPL_TYPE_ULONG: self = "unsigned long int"; break; case CPL_TYPE_LONG_LONG: self = "long long int"; break; case CPL_TYPE_FLOAT: self = "float"; break; case CPL_TYPE_DOUBLE: self = "double"; break; case CPL_TYPE_POINTER: self = "pointer"; break; case CPL_TYPE_FLOAT_COMPLEX: self = "float complex"; break; case CPL_TYPE_DOUBLE_COMPLEX: self = "double complex"; break; case CPL_TYPE_UNSPECIFIED: self = "unspecified"; break; case CPL_TYPE_STRING: self = "string"; break; default: (void)cpl_error_set_message_(CPL_ERROR_INVALID_TYPE, "type=0x%x", (int)type); break; } } return self; } /**@}*/ cpl-6.4.1/cplcore/cpl_test.h0000644000460300003120000014172612270505777012656 00000000000000/* $Id: cpl_test.h,v 1.63 2013-04-04 13:10:32 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-04 13:10:32 $ * $Revision: 1.63 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_TEST_H #define CPL_TEST_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef CPL_TEST_FITS #define CPL_TEST_FITS "CPL_TEST_FITS" #endif CPL_BEGIN_DECLS /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Initialize CPL + CPL messaging + unit test @param REPORT The email address for the error message e.g. PACKAGE_BUGREPORT @param LEVEL The default messaging level, e.g. CPL_MSG_WARNING @return void @see cpl_init() @note This macro should be used at the beginning of main() of a unit test instead of cpl_init() and before any other CPL function call. */ /*----------------------------------------------------------------------------*/ #define cpl_test_init(REPORT, LEVEL) \ cpl_test_init_macro(__FILE__, REPORT, LEVEL) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Evaluate an expression and increment an internal counter if zero @param bool The expression to evaluate, side-effects are allowed @note A zero value of the expression is a failure, other values are not @return void @see cpl_test_init() @note This macro should be used for unit tests Example of usage: @code cpl_test(myfunc()); // myfunc() is expected to return non-zero @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test(bool) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_macro(cpl_test_errno, cpl_test_time, cpl_test_flops, \ cpl_test_state, (bool) ? 1 : 0, CPL_TRUE, #bool, \ cpl_func, __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Evaluate an expression and increment an internal counter if non-zero @param zero The numerical expression to evaluate, side-effects are allowed @note A zero value of the expression is a success, other values are not @return void @see cpl_test() @note This macro should be used for unit tests Example of usage: @code cpl_test_zero(myfunc()); // myfunc() is expected to return zero @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_zero(zero) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_macro(cpl_test_errno, cpl_test_time, cpl_test_flops, \ cpl_test_state, (zero), CPL_FALSE, \ #zero, cpl_func, __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if a pointer is NULL and update an internal counter on failure @param pointer The NULL-pointer to check, side-effects are allowed @see cpl_test() @return void Example of usage: @code cpl_test_null(pointer); // pointer is expected to be NULL @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_null(pointer) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_null_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, pointer, \ #pointer, cpl_func, __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if a pointer is non-NULL @param pointer The pointer to check, side-effects are allowed @see cpl_test_nonnull() @return void Example of usage: @code cpl_test_nonnull(pointer); // pointer is expected to be non-NULL @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_nonnull(pointer) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_nonnull_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, \ pointer, #pointer, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test and if necessary reset the CPL errorstate @param errorstate The expected CPL errorstate @see cpl_test() @note After the test, the CPL errorstate is set to the provided state @return void This function is useful for verifying that a successful call to a function does not modify any pre-existing errors. Example of usage: @code const cpl_error_code error = cpl_error_set(cpl_func, CPL_ERROR_EOL); cpl_errorstate prestate = cpl_errorstate_get(); const cpl_error_code ok = my_func(); // Expected to succeed cpl_test_errorstate(prestate); // Verify that no additional errors occurred cpl_test_error(CPL_ERROR_EOL); // Reset error cpl_test_eq(ok, CPL_ERROR_NONE); // Verify that my_func() succeeded @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_errorstate(errorstate) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_errorstate_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, \ errorstate, #errorstate, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test and reset the CPL error code @param error The expected CPL error code (incl. CPL_ERROR_NONE) @see cpl_test() @note After the test, the CPL errorstate is reset @return void Example of usage: @code cpl_test( my_func(NULL) ); // my_func(NULL) is expected to return non-zero cpl_test_error(CPL_ERROR_NULL_INPUT); // ... and to set this error code // The errorstate has been reset. cpl_test( !my_func(p) ); // my_func(p) is expected to return zero @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_error(error) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_error_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, error, \ #error, cpl_func, __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two error expressions are equal and reset the CPL error code @param first The first value in the comparison @param second The second value in the comparison @see cpl_test_error @note If the two CPL error expressions are equal they will also be tested against the current CPL error code. After the test(s), the CPL errorstate is reset. Example of usage: @code cpl_error_code error = my_func(NULL); // my_func(NULL) is expected to return CPL_ERROR_NULL_INPUT // and to set the same error code cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); // The errorstate has been reset. error = my_func(p); // Successful call cpl_test_eq_error(error, CPL_ERROR_NONE); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_eq_error(first, second) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_eq_error_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, first, \ #first, second, #second, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two integer expressions are equal @param first The first value in the comparison, side-effects are allowed @param second The second value in the comparison, side-effects are allowed @see cpl_test() @return void Example of usage: @code cpl_test_eq(computed, expected); @endcode For comparison of floating point values, see cpl_test_abs() and cpl_test_rel(). */ /*----------------------------------------------------------------------------*/ #define cpl_test_eq(first, second) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_eq_macro(cpl_test_errno, cpl_test_time, cpl_test_flops, \ cpl_test_state, first, #first, \ second, #second, cpl_func, __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two integer expressions are not equal @param first The first value in the comparison, side-effects are allowed @param second The second value in the comparison, side-effects are allowed @see cpl_test_eq() @return void Example of usage: @code cpl_test_noneq(computed, wrong); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_noneq(first, second) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_noneq_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, first, \ #first, second, #second, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two pointer expressions are equal @param first The first value in the comparison, side-effects are allowed @param second The second value in the comparison, side-effects are allowed @see cpl_test_eq() @return void Example of usage: @code cpl_test_eq_ptr(computed, expected); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_eq_ptr(first, second) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_eq_ptr_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, first, \ #first, second, #second, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two pointer expressions are not equal @param first The first value in the comparison, side-effects are allowed @param second The second value in the comparison, side-effects are allowed @see cpl_test_eq_ptr() @return void Example of usage: @code cpl_test_noneq_ptr(computed, wrong); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_noneq_ptr(first, second) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_noneq_ptr_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, first, \ #first, second, #second, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two strings are equal @param first The first string or NULL of the comparison @param second The second string or NULL of the comparison @note One or two NULL pointer(s) is considered a failure. Example of usage: @code cpl_test_eq_string(computed, expected); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_eq_string(first, second) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_eq_string_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, first, \ #first, second, #second, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two strings are not equal @param first The first string or NULL of the comparison @param second The second string or NULL of the comparison @note One or two NULL pointer(s) is considered a failure. Example of usage: @code cpl_test_noneq_string(computed, expected); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_noneq_string(first, second) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_noneq_string_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, \ first, #first, second, #second, \ cpl_func, __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if a file is valid FITS using an external verification utility @param fitsfile The file to verify, NULL causes failure @note The external verification utility is specified with the environemt variable CPL_TEST_FITS, if is not set the test will pass on any non-NULL file. Example of usage: @code export CPL_TEST_FITS=/usr/local/bin/fitsverify @endcode @code cpl_test_fits(fitsfile); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_fits(fitsfile) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_fits_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, fitsfile, \ #fitsfile, cpl_func, __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two CPL masks are equal @param first The first mask or NULL of the comparison @param second The second mask or NULL of the comparison @note One or two NULL pointer(s) is considered a failure. Example of usage: @code cpl_test_eq_mask(computed, expected); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_eq_mask(first, second) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_eq_mask_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, first, \ #first, second, #second, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Evaluate A <= B and increment an internal counter if it is not true @param value The number to test @param tolerance The upper limit to compare against @return void @see cpl_test_init() @note This macro should be used for unit tests Example of usage: @code cpl_test_leq(fabs(myfunc(&p)), DBL_EPSILON); cpl_test_nonnull(p); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_leq(value, tolerance) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_leq_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, value, \ #value, tolerance, #tolerance, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Evaluate A < B and increment an internal counter if it is not true @param value The number to test @param tolerance The upper limit to compare against @return void @see cpl_test_init() @note This macro should be used for unit tests Example of usage: @code cpl_test_lt(0.0, myfunc()); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_lt(value, tolerance) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_lt_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, value, \ #value, tolerance, #tolerance, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two numerical expressions are within a given absolute tolerance @param first The first value in the comparison, side-effects are allowed @param second The second value in the comparison, side-effects are allowed @param tolerance A non-negative tolerance @note If the tolerance is negative, the test will always fail @see cpl_test() Example of usage: @code cpl_test_abs(computed, expected, DBL_EPSILON); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_abs(first, second, tolerance) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_abs_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, first, \ #first, second, #second, tolerance, \ #tolerance, cpl_func, __FILE__, __LINE__); \ } while (0) #ifdef _Complex_I /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two complex expressions are within a given absolute tolerance @param first The first value in the comparison, side-effects are allowed @param second The second value in the comparison, side-effects are allowed @param tolerance A non-negative tolerance @note If the tolerance is negative, the test will always fail @see cpl_test() Example of usage: @code cpl_test_abs_complex(computed, expected, DBL_EPSILON); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_abs_complex(first, second, tolerance) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_abs_complex_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, first, \ #first, second, #second, tolerance, \ #tolerance, cpl_func, __FILE__, __LINE__); \ } while (0) #endif /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two vectors are identical within a given (absolute) tolerance @param first The first vector in the comparison @param second The second vector of identical size in the comparison @param tolerance A non-negative tolerance @return void @see cpl_test_abs() @note The test will fail if one or both the vectors are NULL */ /*----------------------------------------------------------------------------*/ #define cpl_test_vector_abs(first, second, tolerance) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_vector_abs_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, \ first, #first, second, #second, \ tolerance, #tolerance, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two matrices are identical within a given (absolute) tolerance @param first The first matrix in the comparison @param second The second matrix of identical size in the comparison @param tolerance A non-negative tolerance @return void @see cpl_test_abs() @note The test will fail if one or both the matrices are NULL */ /*----------------------------------------------------------------------------*/ #define cpl_test_matrix_abs(first, second, tolerance) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_matrix_abs_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, \ first, #first, second, #second, \ tolerance, #tolerance, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two numerical arrays are identical within a given (absolute) tolerance @param first The first array in the comparison @param second The second array of identical size in the comparison @param tolerance A non-negative tolerance @return void @see cpl_test_abs() @note The test will fail if one or both the arrays are NULL or of a non-numerical type */ /*----------------------------------------------------------------------------*/ #define cpl_test_array_abs(first, second, tolerance) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_array_abs_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, first, \ #first, second, #second, tolerance, \ #tolerance, cpl_func, __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two images are identical within a given (absolute) tolerance @param first The first image in the comparison @param second The second image of identical size in the comparison @param tolerance A non-negative tolerance @return void @see cpl_test_abs() @note The test will fail if one or both the images are NULL */ /*----------------------------------------------------------------------------*/ #define cpl_test_image_abs(first, second, tolerance) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_image_abs_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, first, \ #first, second, #second, tolerance, \ #tolerance, cpl_func, __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two images are identical within a given (relative) tolerance @param first The first image in the comparison @param second The second image of identical size in the comparison @param tolerance A non-negative tolerance @return void @see cpl_test_rel() @note The test will fail if one or both the images are NULL For each pixel position the two values x, y must pass the test: |x - y| <= tol * min(|x|, |y|). This definition is chosen since it is commutative and meaningful also for zero-valued pixels. */ /*----------------------------------------------------------------------------*/ #define cpl_test_image_rel(first, second, tolerance) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_image_rel_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, first, \ #first, second, #second, tolerance, \ #tolerance, cpl_func, __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two imagelists are identical within a given (absolute) tolerance @param first The first imagelist in the comparison @param second The second imagelist of identical size in the comparison @param tolerance A non-negative tolerance @return void @see cpl_test_image_abs() @note The test will fail if one or both the imagelists are NULL */ /*----------------------------------------------------------------------------*/ #define cpl_test_imagelist_abs(first, second, tolerance) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_imagelist_abs_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, \ first, #first, second, #second, \ tolerance, #tolerance, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two polynomials are identical within a given (absolute) tolerance @param first The first polynomial in the comparison @param second The second polynomial in the comparison @param tolerance A non-negative tolerance @return void @see cpl_test_abs() @note The test will fail if one or both the polynomials are NULL */ /*----------------------------------------------------------------------------*/ #define cpl_test_polynomial_abs(first, second, tolerance) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_polynomial_abs_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, \ first, #first, second, #second, \ tolerance, #tolerance, cpl_func, \ __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if two numerical expressions are within a given relative tolerance @param first The first value in the comparison, side-effects are allowed @param second The second value in the comparison, side-effects are allowed @param tolerance A non-negative tolerance @note If the tolerance is negative or if one but not both of the two values is zero, the test will always fail. If both values are zero, the test will succeed for any non-negative tolerance. The test is commutative in the two values. @see cpl_test() The test is carried out by comparing the absolute value of the difference abs (@em first - @em second) to the product of the tolerance and the minimum of the absolute value of the two values, tolerance * min(abs(@em first), abs(@em second)) (The test is implemented like this to avoid division with a number that may be zero. Example of usage: @code cpl_test_rel(computed, expected, 0.001); @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_rel(first, second, tolerance) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_rel_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, first, \ #first, second, #second, tolerance, \ #tolerance, cpl_func, __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Test if the memory system is empty @see cpl_memory_is_empty() @deprecated Called by cpl_test_end() */ /*----------------------------------------------------------------------------*/ #define cpl_test_memory_is_empty() do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ cpl_test_memory_is_empty_macro(cpl_test_errno, cpl_test_time, \ cpl_test_flops, cpl_test_state, \ cpl_func, __FILE__, __LINE__); \ } while (0) /*----------------------------------------------------------------------------*/ /** @hideinitializer @ingroup cpl_test @brief Evaluate an expression and return if it fails @param bool The (boolean) expression to evaluate, side-effects are allowed @note A zero value of the expression is a failure, other values are not @return void @see cpl_test() @note This macro should be used for unit tests that cannot continue after a failure. Example of usage: @code int main (void) { cpl_test_init(CPL_MSG_WARNING); cpl_test(myfunc(&p)); cpl_test_assert(p != NULL); cpl_test(*p); return cpl_test_end(0); } @endcode */ /*----------------------------------------------------------------------------*/ #define cpl_test_assert(bool) do { \ const int cpl_test_errno = errno; \ const cpl_flops cpl_test_flops = cpl_test_get_flops(); \ const double cpl_test_time = cpl_test_get_walltime(); \ cpl_errorstate cpl_test_state = cpl_errorstate_get(); \ /* Evaluate bool just once */ \ const cpl_boolean cpl_test_ok = (bool) ? CPL_TRUE : CPL_FALSE; \ cpl_test_macro(cpl_test_errno, cpl_test_time, cpl_test_flops, \ cpl_test_state, cpl_test_ok, CPL_TRUE, #bool, \ cpl_func, __FILE__, __LINE__); \ if (cpl_test_ok == CPL_FALSE) return cpl_test_end(0); \ } while (0) /* Deprecated. Do not use */ #define cpl_assert cpl_test_assert #ifndef cpl_error_margin /* Deprecated. Do not use */ #define cpl_error_margin 2.0 #endif typedef unsigned long long int cpl_flops; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ void cpl_test_init_macro(const char *, const char *, cpl_msg_severity) CPL_ATTR_NONNULL; int cpl_test_end(cpl_size); void cpl_test_macro(int, double, cpl_flops, cpl_errorstate, cpl_size, cpl_boolean, const char *, const char *, const char *, unsigned) CPL_ATTR_NONNULL; void cpl_test_errorstate_macro(int, double, cpl_flops, cpl_errorstate, cpl_errorstate, const char *, const char *, const char *, unsigned) CPL_ATTR_NONNULL; void cpl_test_error_macro(int, double, cpl_flops, cpl_errorstate, cpl_error_code, const char *, const char *, const char *, unsigned) CPL_ATTR_NONNULL; void cpl_test_eq_error_macro(int, double, cpl_flops, cpl_errorstate, cpl_error_code, const char *, cpl_error_code, const char *, const char *, const char *, unsigned) CPL_ATTR_NONNULL; void cpl_test_null_macro(int, double, cpl_flops, cpl_errorstate, const void *, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 7, 8))) #endif ; void cpl_test_nonnull_macro(int, double, cpl_flops, cpl_errorstate, const void *, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 7, 8))) #endif ; void cpl_test_eq_macro(int, double, cpl_flops, cpl_errorstate, cpl_size, const char *, cpl_size, const char *, const char *, const char *, unsigned) CPL_ATTR_NONNULL; void cpl_test_noneq_macro(int, double, cpl_flops, cpl_errorstate, cpl_size, const char *, cpl_size, const char *, const char *, const char *, unsigned) CPL_ATTR_NONNULL; void cpl_test_eq_ptr_macro(int, double, cpl_flops, cpl_errorstate, const void *, const char *, const void *, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 8, 9, 10))) #endif ; void cpl_test_noneq_ptr_macro(int, double, cpl_flops, cpl_errorstate, const void *, const char *, const void *, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 8, 9, 10))) #endif ; void cpl_test_eq_string_macro(int, double, cpl_flops, cpl_errorstate, const char *, const char *, const char *, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 8, 9, 10))) #endif ; void cpl_test_noneq_string_macro(int, double, cpl_flops, cpl_errorstate, const char *, const char *, const char *, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 8, 9, 10))) #endif ; void cpl_test_fits_macro(int, double, cpl_flops, cpl_errorstate, const char *, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 7, 8))) #endif ; void cpl_test_eq_mask_macro(int, double, cpl_flops, cpl_errorstate, const cpl_mask *, const char *, const cpl_mask *, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 8, 9, 10))) #endif ; void cpl_test_leq_macro(int, double, cpl_flops, cpl_errorstate, double, const char *, double, const char *, const char *, const char *, unsigned) CPL_ATTR_NONNULL; void cpl_test_lt_macro(int, double, cpl_flops, cpl_errorstate, double, const char *, double, const char *, const char *, const char *, unsigned) CPL_ATTR_NONNULL; void cpl_test_abs_macro(int, double, cpl_flops, cpl_errorstate, double, const char *, double, const char *, double, const char *, const char *, const char *, unsigned) CPL_ATTR_NONNULL; #ifdef _Complex_I void cpl_test_abs_complex_macro(int, double, cpl_flops, cpl_errorstate, _Complex double, const char *, _Complex double, const char *, double, const char *, const char *, const char *, unsigned) CPL_ATTR_NONNULL; #endif void cpl_test_rel_macro(int, double, cpl_flops, cpl_errorstate, double, const char *, double, const char *, double, const char *, const char *, const char *, unsigned) CPL_ATTR_NONNULL; void cpl_test_vector_abs_macro(int, double, cpl_flops, cpl_errorstate, const cpl_vector *, const char *, const cpl_vector *, const char *, double, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 8, 10, 11, 12))) #endif ; void cpl_test_matrix_abs_macro(int, double, cpl_flops, cpl_errorstate, const cpl_matrix *, const char *, const cpl_matrix *, const char *, double, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 8, 10, 11, 12))) #endif ; void cpl_test_array_abs_macro(int, double, cpl_flops, cpl_errorstate, const cpl_array *, const char *, const cpl_array *, const char *, double, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 8, 10, 11, 12))) #endif ; void cpl_test_image_abs_macro(int, double, cpl_flops, cpl_errorstate, const cpl_image *, const char *, const cpl_image *, const char *, double, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 8, 10, 11, 12))) #endif ; void cpl_test_image_rel_macro(int, double, cpl_flops, cpl_errorstate, const cpl_image *, const char *, const cpl_image *, const char *, double, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 8, 10, 11, 12))) #endif ; void cpl_test_imagelist_abs_macro(int, double, cpl_flops, cpl_errorstate, const cpl_imagelist *, const char *, const cpl_imagelist *, const char *, double, const char *, const char *, const char *, unsigned ) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 8, 10, 11, 12))) #endif ; void cpl_test_polynomial_abs_macro(int, double, cpl_flops, cpl_errorstate, const cpl_polynomial *, const char *, const cpl_polynomial *, const char *, double, const char *, const char *, const char *, unsigned) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(6, 8, 10, 11, 12))) #endif ; void cpl_test_memory_is_empty_macro(int, double, cpl_flops, cpl_errorstate, const char *, const char *, unsigned) CPL_ATTR_NONNULL; double cpl_test_get_cputime(void); double cpl_test_get_walltime(void); size_t cpl_test_get_bytes_vector(const cpl_vector *) CPL_ATTR_PURE; size_t cpl_test_get_bytes_matrix(const cpl_matrix *) CPL_ATTR_PURE; size_t cpl_test_get_bytes_image(const cpl_image *) CPL_ATTR_PURE; size_t cpl_test_get_bytes_imagelist(const cpl_imagelist *) CPL_ATTR_PURE; cpl_flops cpl_test_get_flops(void) CPL_ATTR_PURE; cpl_size cpl_test_get_tested(void) CPL_ATTR_PURE; cpl_size cpl_test_get_failed(void) CPL_ATTR_PURE; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_imagelist_basic.h0000644000460300003120000001020711611563407014773 00000000000000/* $Id: cpl_imagelist_basic.h,v 1.25 2011-07-20 14:32:39 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-20 14:32:39 $ * $Revision: 1.25 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGELIST_BASIC_H #define CPL_IMAGELIST_BASIC_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_imagelist.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ enum _cpl_swap_axis_ { CPL_SWAP_AXIS_XZ, CPL_SWAP_AXIS_YZ }; typedef enum _cpl_swap_axis_ cpl_swap_axis; typedef enum { CPL_COLLAPSE_MEAN, CPL_COLLAPSE_MEDIAN, CPL_COLLAPSE_MEDIAN_MEAN } cpl_collapse_mode; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* Imagelist modifying functions */ cpl_error_code cpl_imagelist_add(cpl_imagelist *, const cpl_imagelist *); cpl_error_code cpl_imagelist_subtract(cpl_imagelist *, const cpl_imagelist *); cpl_error_code cpl_imagelist_multiply(cpl_imagelist *, const cpl_imagelist *); cpl_error_code cpl_imagelist_divide(cpl_imagelist *, const cpl_imagelist *); cpl_error_code cpl_imagelist_add_image(cpl_imagelist *, const cpl_image *); cpl_error_code cpl_imagelist_subtract_image(cpl_imagelist *, const cpl_image *); cpl_error_code cpl_imagelist_multiply_image(cpl_imagelist *, const cpl_image *); cpl_error_code cpl_imagelist_divide_image(cpl_imagelist *, const cpl_image *); cpl_error_code cpl_imagelist_add_scalar(cpl_imagelist *, double); cpl_error_code cpl_imagelist_subtract_scalar(cpl_imagelist *, double); cpl_error_code cpl_imagelist_multiply_scalar(cpl_imagelist *, double); cpl_error_code cpl_imagelist_divide_scalar(cpl_imagelist *, double); cpl_error_code cpl_imagelist_exponential(cpl_imagelist *, double); cpl_error_code cpl_imagelist_power(cpl_imagelist *, double); cpl_error_code cpl_imagelist_logarithm(cpl_imagelist *, double); cpl_error_code cpl_imagelist_normalise(cpl_imagelist *, cpl_norm); cpl_error_code cpl_imagelist_threshold(cpl_imagelist *, double, double, double, double); cpl_imagelist * cpl_imagelist_swap_axis_create(const cpl_imagelist *, cpl_swap_axis) CPL_ATTR_ALLOC; /* Imagelist to image functions */ cpl_image * cpl_image_new_from_accepted(const cpl_imagelist *) CPL_ATTR_ALLOC; cpl_image * cpl_imagelist_collapse_create(const cpl_imagelist *) CPL_ATTR_ALLOC; cpl_image * cpl_imagelist_collapse_median_create(const cpl_imagelist *) CPL_ATTR_ALLOC; cpl_image * cpl_imagelist_collapse_minmax_create(const cpl_imagelist *, cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_image * cpl_imagelist_collapse_sigclip_create(const cpl_imagelist *, double, double, double, cpl_collapse_mode, cpl_image *) CPL_ATTR_ALLOC; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_errorstate.c0000644000460300003120000005641212247314730014050 00000000000000/* $Id: cpl_errorstate.c,v 1.20 2012-04-26 11:57:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-04-26 11:57:18 $ * $Revision: 1.20 $ * $Name: not supported by cvs2svn $ */ /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_error_impl.h" #include "cpl_errorstate.h" #include "cpl_msg.h" #include #include /** * @defgroup cpl_errorstate Handling of multiple CPL errors * * This module provides functions for error detection and recovery * and for producing an error traceback. * * It is built on top of the @c cpl_error module. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ static cpl_error error_history[CPL_ERROR_HISTORY_SIZE]; /*----------------------------------------------------------------------------- Internal structures -----------------------------------------------------------------------------*/ static struct { /* This struct may only be accessed when cpl_error_is_set() is true */ size_t current; /* The number of the current CPL error in the history */ /* Numbering of errors start with 1. */ /* When a new CPL error is created, estate.current is incremented holding the number of that error */ size_t highest; /* The highest number reached in the history */ /* cpl_errorstate_set() may not increase estate.current above this value, assert( estate.current <= estate.highest ); */ /* The creation of a new CPL error will set estate.highest to estate.current. */ /* cpl_errorstate_set() may decrease estate.current (to a value less than estate.highest) */ /* NB: Extra: cpl_errorstate_set() may not at all increase estate.current. This is to prevent the number from pointing to an error that has been changed since the corresponding cpl_errorstate_get() was called. This means that estate.current can only be increased (incremented, that is) when a new CPL error is created. */ size_t lowest; /* The lowest number for which the error is preserved */ /* Only for a limited number of errors can the details be preserved. These errors are numbered from estate.lowest to estate.highest. When estate.lowest exceeds estate.highest then no errors are preserved, otherwise details of 1 + estate.highest - estate.lowest errors are preserved. When the first error is created, estate.lowest is set to 1. Is remains at this value, until the error history flows over, at which point it starts to increment (cyclically). */ size_t newest; /* The index pointing to the newest CPL error preserved in error_history[] */ /* estate.newest indexes the CPL error struct of the CPL error with the number estate.highest. */ size_t oldest; /* The index pointing to the oldest CPL error preserved in error_history[] */ /* estate.oldest == estate.newest means that one CPL error is preserved */ /* (estate.newest+1)%CPL_ERROR_HISTORY_SIZE == estate.oldest means that CPL_ERROR_HISTORY_SIZE CPL errors are preserved, and that creating a new CPL error will erase the oldest of the preserved errors */ /* If estate.current == estate.highest and a new CPL error is created, then estate.newest is incremented (cyclicly) and the new CPL error is preserved there. If this causes estate.oldest == estate.newest, then estate.oldest is incremented (cyclicly) as well - and the oldest preserved error has been lost. */ /* If estate.highest - estate.current >= CPL_ERROR_HISTORY_SIZE and a new CPL error is created, then all preserved errors have been lost. In this case estate.newest is set to estate.oldest and the new CPL error is preserved there. */ /* If diff = estate.highest - estate.current, diff > 0 and diff < CPL_ERROR_HISTORY_SIZE and a new CPL error is created, then estate.newest is decremented (cyclically) by diff-1, estate.highest is decremented by diff-1, estate.current is incremented (cyclicly), and the new error is preserved there. estate.oldest is unchanged. */ /* No binary operator should combine estate.(oldest|newest) and estate.(lowest|current|highest). */ } estate; #ifdef _OPENMP #pragma omp threadprivate(error_history, estate) #endif /*----------------------------------------------------------------------------- Private Function Declarations -----------------------------------------------------------------------------*/ static void cpl_errorstate_dump_one_level(void (*)(const char *, const char *, ...) CPL_ATTR_PRINTF(2, 3), unsigned, unsigned, unsigned); /*----------------------------------------------------------------------------- Functions code -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Get the CPL errorstate @return The CPL errorstate @note The caller should not modify the returned value nor transfer it to another function/scope. Example of usage: @code cpl_errorstate prev_state = cpl_errorstate_get(); // (Call one or more CPL functions here) if (cpl_errorstate_is_equal(prev_state)) { // No error happened } else { // One or more errors happened // Recover from the error(s) cpl_errorstate_set(prev_state); } @endcode */ /*----------------------------------------------------------------------------*/ cpl_errorstate cpl_errorstate_get(void) { /* The return value is defined as the number of errors that have happened (since the most recent reset of the error state). This definition should be changable without effects to the API. */ /* FIXME: The result is cast to a const pointer of type void, just to cause compiler warnings if the caller tries to modify the returned value. A better (opaque) typedef would be preferable. */ return (cpl_errorstate)(cpl_error_is_set() ? estate.current : 0); } /*----------------------------------------------------------------------------*/ /** @brief Set the CPL errorstate @param self The return value of a previous call to cpl_errorstate_get() @return void @see cpl_errorstate_get @note If a CPL error was created before the call to cpl_errorstate_get() that returned self and if more than CPL_ERROR_HISTORY_SIZE CPL errors was created after that, then the accessor functions of the CPL error object (cpl_error_get_code() etc.) will return wrong values. In this case cpl_error_get_code() is still guaranteed not to return CPL_ERROR_NONE. Moreover, the default value of CPL_ERROR_HISTORY_SIZE is guaranteed to be large enough to prevent this situation from arising due to a call of a CPL function. */ /*----------------------------------------------------------------------------*/ void cpl_errorstate_set(cpl_errorstate self) { const size_t myself = (const size_t)self; if (myself == 0) { cpl_error_reset(); } else if (myself < estate.current) { if (!cpl_error_is_readonly()) estate.current = myself; } } /*----------------------------------------------------------------------------*/ /** @brief Detect a change in the CPL error state @param self The return value of a previous call to cpl_errorstate_get() @return CPL_TRUE iff the current error state is equal to self. @see cpl_errorstate_get */ /*----------------------------------------------------------------------------*/ cpl_boolean cpl_errorstate_is_equal(cpl_errorstate self) { const size_t myself = (const size_t)self; if (cpl_error_is_set()) { return myself == estate.current ? CPL_TRUE : CPL_FALSE; } else { return myself == 0 ? CPL_TRUE : CPL_FALSE; } } /*----------------------------------------------------------------------------*/ /** @brief Dump the CPL error state @param self Dump errors more recent than self @param reverse Reverse the chronological order of the dump @param dump_one Function that dumps a single CPL error, or NULL @return void @note dump_one may be NULL, in that case cpl_errorstate_dump_one() is called. If there are no CPL errors to be dumped, (*dump_one)() is called once with all zeros, which allows the dump-function to report that there are no errors to dump. During calls to (*dump_one)() the CPL error system has been put into a special read-only mode that prevents any change of the CPL error state. This means that any calls from (*dump_one)() to cpl_error_reset(), cpl_error_set(), cpl_error_set_where() and cpl_errorstate_set() have no effect. Also calls from (*dump_one)() to cpl_errorstate_dump() have no effect. @see cpl_errorstate_dump_one CPL-based code with insufficient error checking can generate a large number of CPL errors. To avoid that a subsequent call to cpl_errorstate_dump() will fill up the output device, calls to the dump-function are skipped and only counted and the count reported when dump_one is NULL and the CPL error code is CPL_ERROR_HISTORY_LOST. Example of usage: @code cpl_errorstate prev_state = cpl_errorstate_get(); // Call one or more CPL functions if (cpl_errorstate_is_equal(prev_state)) { // No error happened } else { // One or more errors happened // Dump the error(s) in chronological order cpl_errorstate_dump(prev_state, CPL_FALSE, cpl_errorstate_dump_one); // Recover from the error(s) cpl_errorstate_set(prev_state); } @endcode */ /*----------------------------------------------------------------------------*/ void cpl_errorstate_dump(cpl_errorstate self, cpl_boolean reverse, void (*dump_one)(unsigned, unsigned, unsigned)) { if (!cpl_error_is_readonly()) { cpl_boolean did_call = CPL_FALSE; void (*mydump_one)(unsigned, unsigned, unsigned) = dump_one ? dump_one : cpl_errorstate_dump_one; /* Put CPL error system into read-only mode, to prevent changes by (*dump_one)() */ cpl_error_set_readonly(); if (cpl_error_is_set()) { const size_t newest = estate.current; /* Dump all errors more recent than self */ const size_t oldest = 1 + (size_t)self; if (oldest <= newest) { /* There is at least one error to dump */ const size_t first = reverse ? newest : oldest; const size_t last = reverse ? oldest : newest; size_t ilost = 0; /* The iteration through the sequence of errors is done by modifying estate.current */ if (reverse) { cx_assert(estate.current == first); } else { estate.current = first; } for (; ; reverse ? estate.current-- : estate.current++) { cx_assert( estate.current > 0 ); if (dump_one == NULL && cpl_error_get_code() == CPL_ERROR_HISTORY_LOST) { ilost++; } else { if (ilost > 0) { cpl_msg_error(cpl_func, "Lost %zu CPL error(s)", ilost); ilost = 0; } (*mydump_one)((unsigned)estate.current, (unsigned)first, (unsigned)last); } if (estate.current == last) break; } if (ilost > 0) { cpl_msg_error(cpl_func, "Lost %zu CPL error(s)", ilost); ilost = 0; } if (reverse) { /* Reestablish the CPL error state */ estate.current = newest; } else { cx_assert(estate.current == newest); } did_call = CPL_TRUE; } } if (did_call == CPL_FALSE) { /* There are no errors more recent than self. Nevertheless give the dumper the opportunity to report that the CPL error state is empty */ (*mydump_one)(0, 0, 0); } /* Put CPL error system back into normal read/write mode */ cpl_error_reset_readonly(); } } /*----------------------------------------------------------------------------*/ /** @brief Dump a single CPL error @param self The number of the current error to be dumped @param first The number of the first error to be dumped @param last The number of the last error to be dumped @return void @note This function is implemented using only exported CPL functions. @see cpl_errorstate_dump This function will dump a single CPL error, using the CPL error accessor functions. The error is numbered with the value of self. The actual output is produced by cpl_msg_error(). first and last are provided in the API to allow for special messaging in the dump of the first and last errors. Alternative functions for use with cpl_errorstate_dump() may use all accessor functions of the CPL error module and those functions of the CPL message module that produce messages. Additionally, the indentation functions of the CPL message module may be used, provided that the indentation is set back to its original state after the last error has been processed. */ /*----------------------------------------------------------------------------*/ void cpl_errorstate_dump_one(unsigned self, unsigned first, unsigned last) { cpl_errorstate_dump_one_level(cpl_msg_error, self, first, last); } /*----------------------------------------------------------------------------*/ /** @brief Dump a single CPL error using cpl_msg_warning() @param self The number of the current error to be dumped @param first The number of the first error to be dumped @param last The number of the last error to be dumped @return void @see cpl_errorstate_dump_one, cpl_msg_warning() */ /*----------------------------------------------------------------------------*/ void cpl_errorstate_dump_one_warning(unsigned self, unsigned first, unsigned last) { cpl_errorstate_dump_one_level(cpl_msg_warning, self, first, last); } /*----------------------------------------------------------------------------*/ /** @brief Dump a single CPL error using cpl_msg_info() @param self The number of the current error to be dumped @param first The number of the first error to be dumped @param last The number of the last error to be dumped @return void @see cpl_errorstate_dump_one, cpl_msg_info() */ /*----------------------------------------------------------------------------*/ void cpl_errorstate_dump_one_info(unsigned self, unsigned first, unsigned last) { cpl_errorstate_dump_one_level(cpl_msg_info, self, first, last); } /*----------------------------------------------------------------------------*/ /** @brief Dump a single CPL error using cpl_msg_debug() @param self The number of the current error to be dumped @param first The number of the first error to be dumped @param last The number of the last error to be dumped @return void @see cpl_errorstate_dump_one, cpl_msg_debug() */ /*----------------------------------------------------------------------------*/ void cpl_errorstate_dump_one_debug(unsigned self, unsigned first, unsigned last) { cpl_errorstate_dump_one_level(cpl_msg_debug, self, first, last); } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Append a CPL error to the CPL error state @return A pointer to a CPL error struct to be filled by the CPL error module @note This function may only be used by the cpl_error module. */ /*----------------------------------------------------------------------------*/ cpl_error * cpl_errorstate_append(void) { if (cpl_error_is_set()) { if (estate.lowest > estate.current) { /* The details of the current CPL error have been lost */ /* All preexisting errors are overwritten by making estate.newest and estate.oldest equal to one another */ /* (They could be set to zero, or any other value less than CPL_ERROR_HISTORY_SIZE) */ estate.newest = estate.oldest; /* When returning, estate.lowest == estate.current */ estate.lowest = estate.current+1; } else if (estate.highest == estate.current) { /* The current error is the newest */ /* Advance the index of the newest entry in the CPL error history */ if (++estate.newest == CPL_ERROR_HISTORY_SIZE) estate.newest = 0; /* If the history is full, then let the oldest be overwritten */ if (estate.newest == estate.oldest) { estate.lowest++; if (++estate.oldest == CPL_ERROR_HISTORY_SIZE) estate.oldest = 0; } } else { const size_t diff = estate.highest - estate.current; cx_assert(diff < CPL_ERROR_HISTORY_SIZE); /* The current error is preserved, but is not the newest */ /* An error was created after the current one - this error will be overwritten by the new one. */ /* If more errors were created after that one (i.e. diff > 1), then those errors are discarded as well */ if (estate.newest < diff - 1) { estate.newest += CPL_ERROR_HISTORY_SIZE - (diff - 1); } else { estate.newest -= diff - 1; } } estate.current++; } else { /* Initialize a new history of errors */ estate.lowest = estate.current = 1; estate.newest = estate.oldest = 0; /* (newest and oldest could also be set to any other value less than CPL_ERROR_HISTORY_SIZE) */ } /* The new current error is the newest */ estate.highest = estate.current; return &(error_history[estate.newest]); } /*----------------------------------------------------------------------------*/ /** @internal @brief Find the CPL error struct used by the current CPL error @return A read-only pointer to the current CPL error struct @note This function may only be used by the cpl_error module and only when a CPL error is set. If the error struct is no longer preserved, the return value will point to a valid (read-only) struct containing CPL_ERROR_HISTORY_LOST and an empty location. */ /*----------------------------------------------------------------------------*/ const cpl_error * cpl_errorstate_find(void) { const cpl_error * self; /* assert(cpl_error_is_set()); */ if (estate.lowest > estate.current) { /* The details of the current CPL error have been lost */ static const cpl_error lost = {CPL_ERROR_HISTORY_LOST, 0, "", "", ""}; self = &lost; } else { /* The current CPL error is the newest */ /* or */ /* The current CPL error is preserved, but is not the newest */ const size_t diff = estate.highest - estate.current; const size_t current = estate.newest < diff ? estate.newest + (CPL_ERROR_HISTORY_SIZE - diff) : estate.newest - diff; /* assert(diff < CPL_ERROR_HISTORY_SIZE); */ self = error_history + current; } return self; } /*----------------------------------------------------------------------------*/ /** @brief Dump a single CPL error @param Pointer to one of cpl_msg_info(), cpl_msg_warning(), ... @param self The number of the current error to be dumped @param first The number of the first error to be dumped @param last The number of the last error to be dumped @return void @see irplib_errorstate_dump_one */ /*----------------------------------------------------------------------------*/ static void cpl_errorstate_dump_one_level(void (*messenger)(const char *, const char *, ...), unsigned self, unsigned first, unsigned last) { const cpl_boolean is_reverse = first > last ? CPL_TRUE : CPL_FALSE; const unsigned newest = is_reverse ? first : last; const unsigned oldest = is_reverse ? last : first; const char * revmsg = is_reverse ? " in reverse order" : ""; cx_assert( messenger != NULL ); cx_assert( oldest <= self ); cx_assert( newest >= self ); if (newest == 0) { messenger(cpl_func, "No error(s) to dump"); cx_assert( oldest == 0); } else { cx_assert( oldest > 0); cx_assert( newest >= oldest); if (self == first) { if (oldest == 1) { messenger(cpl_func, "Dumping all %u error(s)%s:", newest, revmsg); } else { messenger(cpl_func, "Dumping the %u most recent error(s) " "out of a total of %u errors%s:", newest - oldest + 1, newest, revmsg); } cpl_msg_indent_more(); } messenger(cpl_func, "[%u/%u] '%s' (%u) at %s", self, newest, cpl_error_get_message(), cpl_error_get_code(), cpl_error_get_where()); if (self == last) cpl_msg_indent_less(); } } cpl-6.4.1/cplcore/Makefile.am0000644000460300003120000001210212242360435012672 00000000000000## Process this file with automake to produce Makefile.in ## This file is part of the ESO Common Pipeline Library ## Copyright (C) 2001-2005 European Southern Observatory ## 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 2 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 02111-1307 USA AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = cpl_version.h.in cpl_version.h cpl_func.h.in cpl_func.h *~ SUBDIRS = tests if MAINTAINER_MODE MAINTAINERCLEANFILES = $(srcdir)/Makefile.in endif ## WCS_INCLUDES to get WCSLIB version number in cpl_init() # Place optional 3rd party components last since those locations may contain # obsolete and therefore unwanted CFITSIO installations AM_CPPFLAGS = -DCX_LOG_DOMAIN=\"CplCore\" \ -I\$(top_srcdir)/cpldrs $(CX_INCLUDES) $(CFITSIO_INCLUDES) \ $(WCS_INCLUDES) $(FFTW_INCLUDES) $(FFTWF_INCLUDES) \ $(CPL_CFLAGS) EXTRA_DIST = cpl_version.h.top cpl_version.h.bot cpl_func.h.top cpl_func.h.bot \ cpl_filter_median.c BUILT_SOURCES = cpl_version.h cpl_func.h include_HEADERS = cpl_bivector.h \ cpl_error.h \ cpl_errorstate.h \ cpl_fits.h \ cpl_filter.h \ cpl_image.h \ cpl_image_basic.h \ cpl_image_iqe.h \ cpl_image_bpm.h \ cpl_image_resample.h \ cpl_image_io.h \ cpl_stats.h \ cpl_image_stats.h \ cpl_image_filter.h \ cpl_image_gen.h \ cpl_imagelist.h \ cpl_imagelist_io.h \ cpl_imagelist_basic.h \ cpl_init.h \ cpl_io.h \ cpl_macros.h \ cpl_mask.h \ cpl_matrix.h \ cpl_memory.h \ cpl_msg.h \ cpl_plot.h \ cpl_polynomial.h \ cpl_property.h \ cpl_propertylist.h \ cpl_array.h \ cpl_table.h \ cpl_type.h \ cpl_math_const.h \ cpl_test.h \ cpl_vector.h nodist_include_HEADERS = cpl_version.h cpl_func.h noinst_HEADERS = cpl_array_impl.h cpl_column.h cpl_error_impl.h \ cpl_image_basic_body.h cpl_image_defs.h cpl_image_filter_body.h \ cpl_image_gen_body.h cpl_image_io_body.h cpl_image_resample_body.h \ cpl_image_stats_body.h cpl_imagelist_basic_body.h cpl_imagelist_defs.h \ cpl_mask_defs.h \ cpl_mask_impl.h cpl_memory_impl.h cpl_propertylist_impl.h \ cpl_stats_body.h cpl_tools.h cpl_tools_body.h cpl_type_impl.h \ cpl_xmemory.h cpl_image_filter_impl.h \ cpl_mask_body.h cpl_mask_binary.h \ cpl_image_bpm_body.h cpl_io_fits.h cpl_cfitsio.h \ cpl_polynomial_impl.h cpl_vector_impl.h \ cpl_vector_fit_impl.h cpl_matrix_impl.h \ cpl_image_io_impl.h cpl_image_basic_impl.h lib_LTLIBRARIES = libcplcore.la ## The below source is listed alphabetically, except for ## cpl_column.c and cpl_image_gen.c. This allows compilation ## of the other source code to be compiled by clang 2.8 && Sun Studio 12.1 libcplcore_la_SOURCES = cpl_array.c \ cpl_bivector.c \ cpl_error.c \ cpl_errorstate.c \ cpl_fits.c \ cpl_io_fits.c \ cpl_cfitsio.c \ cpl_image_basic.c \ cpl_image_bpm.c \ cpl_image_filter.c \ cpl_image_io.c \ cpl_image_iqe.c \ cpl_image_resample.c \ cpl_image_stats.c \ cpl_imagelist_basic.c \ cpl_imagelist_io.c \ cpl_init.c \ cpl_mask.c \ cpl_matrix.c \ cpl_memory.c \ cpl_msg.c \ cpl_plot.c \ cpl_polynomial.c \ cpl_property.c \ cpl_propertylist.c \ cpl_stats.c \ cpl_table.c \ cpl_test.c \ cpl_tools.c \ cpl_type.c \ cpl_vector.c \ cpl_version.c \ cpl_xmemory.c \ cpl_image_gen.c \ cpl_column.c # Place optional 3rd party components last since those locations may contain # obsolete and therefore unwanted CFITSIO installations libcplcore_la_LDFLAGS = $(CX_LDFLAGS) $(CFITSIO_LDFLAGS) $(FFTW_LDFLAGS) $(FFTWF_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libcplcore_la_LIBADD = $(LIBCEXT) $(LIBCFITSIO) $(LIBFFTW) $(LIBFFTWF) -lm libcplcore_la_DEPENDENCIES = cpl_version.h: $(srcdir)/cpl_version.h.top cpl_version.h.in $(srcdir)/cpl_version.h.bot cat $(srcdir)/cpl_version.h.top cpl_version.h.in \ $(srcdir)/cpl_version.h.bot > cpl_version.h; cpl_func.h: $(srcdir)/cpl_func.h.top cpl_func.h.in $(srcdir)/cpl_func.h.bot cat $(srcdir)/cpl_func.h.top cpl_func.h.in \ $(srcdir)/cpl_func.h.bot > cpl_func.h; cpl-6.4.1/cplcore/cpl_image_filter_impl.h0000644000460300003120000000452711623206652015333 00000000000000/* $Id: cpl_image_filter_impl.h,v 1.1 2011-08-18 13:03:38 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-08-18 13:03:38 $ * $Revision: 1.1 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGE_FILTER_IMPL_H #define CPL_IMAGE_FILTER_IMPL_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image_filter.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ void cpl_image_filter_fill_chess_double(double *in_larger, const double *in, unsigned Nx_larger, unsigned Ny_larger, unsigned Nx, unsigned Ny, unsigned rx, unsigned ry); void cpl_image_filter_fill_chess_float(float *in_larger, const float *in, unsigned Nx_larger, unsigned Ny_larger, unsigned Nx, unsigned Ny, unsigned rx, unsigned ry); void cpl_image_filter_fill_chess_int(int *in_larger, const int *in, unsigned Nx_larger, unsigned Ny_larger, unsigned Nx, unsigned Ny, unsigned rx, unsigned ry); CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_mask_body.h0000644000460300003120000001240311706270623013624 00000000000000/* $Id: cpl_mask_body.h,v 1.7 2012-01-20 13:52:19 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /*----------------------------------------------------------------------------*/ /** @internal @brief Apply the erosion/dilation filter @param self The output binary 2D array to hold the filtered result @param other The input binary 2D array to filter @param kernel The input binary 2D kernel - rows padded with 0 to fit word @param nx The X-size of the input array @param ny The Y-size of the input array @param hx The X-half-size of the kernel @param hy The Y-half-size of the kernel @return void @note No error checking in this internal function! */ /*----------------------------------------------------------------------------*/ static void APPENDSIZE(OPERATION, HX, HY)(cpl_binary * self, const cpl_binary * other, const cpl_binary * kernel, cpl_size nx, cpl_size ny, size_t hx, size_t hy, cpl_border_mode border) { if (border == CPL_BORDER_NOP || border == CPL_BORDER_ZERO || border == CPL_BORDER_COPY) { const size_t mx = 2 * hx + 1; /* kernel rows are padded to a multiple of four bytes so each instruction can process four bytes. This will lead to either a 1 or 3 bytes out of bounds access. So process the last element(s) of the last row(s) one byte at a time. */ const size_t mxe = 1 + (mx | CPL_MASK_PAD); const size_t mxout = mxe - mx; /* 1 or 3 out-of-bounds elements */ /* Number of out-of-bounds rows */ const cpl_size myout = 1 + (cpl_size)(mxout-1)/nx; /* Last row w/o out-of-bounds rows */ const cpl_size jstop = ny - (cpl_size)hy - myout; cpl_size i, j; #ifdef GENERAL_CASE const cpl_size mxew = mxe/CPL_MASK_WORD; #else const size_t * kernelw = (const size_t *)kernel; hy = HY; /* Help compiler to optimize */ #if HX == 2 #if CPL_MASK_WORD == 4 assert( hx <= 3); assert( hx >= 2 ); #else assert( hx <= 7); assert( hx >= 4 ); #endif #else #if HX == 1 #if CPL_MASK_WORD == 4 assert( hx <= 1); #else assert( hx <= 3); #endif #endif #endif #endif /* Handle border for first hy rows and first hx elements of next row */ if (border == CPL_BORDER_ZERO) { (void)memset(self, CPL_BINARY_0, hx + hy * (size_t)nx); } else if (border == CPL_BORDER_COPY) { (void)memcpy(self, other, hx + hy * (size_t)nx); } self += hy * nx; /* self-col now indexed from -hy to hy */ other -= hx; /* other-row now indexed from hx */ for (j = (cpl_size)hy; j < ny-(cpl_size)hy; j++, self += nx, other += nx) { /* The last row(s) can only do a multiple of 4 elements */ const cpl_size istop = j < jstop ? nx - (cpl_size)hx : nx - (cpl_size)mxe - (cpl_size)hx; if (j > (cpl_size)hy) { /* Do also last hx border elements of previous row */ if (border == CPL_BORDER_ZERO) { (void)memset(self - hx, CPL_BINARY_0, 2 * hx); } else if (border == CPL_BORDER_COPY) { (void)memcpy(self - hx, other + hy * (size_t)nx, 2 * hx); } } for (i = (cpl_size)hx; i < istop; i++) { CPL_MASK_FILTER_WORD; } /* The last elements one byte at a time :-( */ for (; i < nx - (cpl_size)hx; i++) { const cpl_binary * otheri = other + i; const cpl_binary * kernelk = kernel; size_t k, l; for (k = 0; k < 1 + 2 * hy; k++, otheri += nx, kernelk += mxe) { for (l = 0; l < 1 + 2 * hx; l++) { if (OPERATE_PIXEL(otheri[l]) && kernelk[l]) break; } if (l < 1 + 2 * hx) break; } self[i] = k < 1 + 2 * hy ? VALUE_TRUE : VALUE_FALSE; } } /* Do also last hx border elements of previous row */ if (border == CPL_BORDER_ZERO) { (void)memset(self - hx, CPL_BINARY_0, hx + hy * (size_t)nx); } else if (border == CPL_BORDER_COPY) { (void)memcpy(self - hx, other + hy * (size_t)nx, hx + hy * (size_t)nx); } } } cpl-6.4.1/cplcore/cpl_propertylist.c0000644000460300003120000061351512303140537014434 00000000000000/* $Id: cpl_propertylist.c,v 1.116 2013-05-21 14:38:19 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2013-05-21 14:38:19 $ * $Revision: 1.116 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include "cpl_io_fits.h" #include "cpl_errorstate.h" #include "cpl_error_impl.h" #include "cpl_tools.h" #include "cpl_memory.h" #include "cpl_io.h" #include "cpl_propertylist_impl.h" /** * @defgroup cpl_propertylist Property Lists * * This module implements a container for @em properties (see * @ref cpl_property) which can be used to store auxiliary values related to * another data object, an image or a table for instance. The property values * can be set and retrieved by their associated name and properties can be * added and removed from the list. The property list container is an ordered * sequence of properties. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ enum { FITS_STDKEY_MAX = 8, FITS_SVALUE_MAX = 68 }; /* * The property list type. */ struct _cpl_propertylist_ { cx_deque *properties; }; /* * Regular expresion filter type */ struct _cpl_regexp_ { regex_t re; cxbool invert; }; typedef struct _cpl_regexp_ cpl_regexp; /* * Private methods */ inline static cxint _cpl_propertylist_filter_regexp(cxcptr key, cxcptr filter) { const cpl_regexp *_filter = (const cpl_regexp *)filter; if (regexec(&_filter->re, key, (size_t)0, NULL, 0) == REG_NOMATCH) return _filter->invert == TRUE ? TRUE : FALSE; return _filter->invert == TRUE ? FALSE : TRUE; } inline static cxbool _cpl_propertylist_compare(const cpl_property *property, const char *name) { const cxchar *key = cpl_property_get_name(property); return strcmp(key, name) == 0 ? TRUE : FALSE; } inline static cxbool _cpl_propertylist_compare_start(const cpl_property *property, const char *part_name) { const cxchar *key = cpl_property_get_name(property); if (strstr(key, part_name) == key) return TRUE; return FALSE; } inline static cxbool _cpl_propertylist_compare_regexp(const cpl_property *property, cpl_regexp *re) { const cxchar *key = cpl_property_get_name(property); return _cpl_propertylist_filter_regexp(key, re); } inline static cx_deque_iterator _cpl_propertylist_find(const cpl_propertylist *self, const char *name) { cx_deque_iterator first, last; cpl_property *p; first = cx_deque_begin(self->properties); last = cx_deque_end(self->properties); while (first != last) { p = cx_deque_get(self->properties, first); if (_cpl_propertylist_compare(p, name)) break; first = cx_deque_next(self->properties, first); } return first; } inline static cpl_property * _cpl_propertylist_get(const cpl_propertylist *self, const char *name) { cx_deque_iterator pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) return NULL; return cx_deque_get(self->properties, pos); } inline static int _cpl_propertylist_insert(cpl_propertylist *self, const cxchar *where, cxbool after, const cxchar *name, cpl_type type, cxcptr value) { cx_deque_iterator pos; cpl_property *property; /* * Find the position where value should be inserted. */ pos = _cpl_propertylist_find(self, where); if (pos == cx_deque_end(self->properties)) { return 1; } if (after) { pos = cx_deque_next(self->properties, pos); } /* * Create the property for value and fill it. */ property = cpl_property_new(name, type); if (!property) { return 1; } /* * Map property type to the driver function's argument type. */ switch (type) { case CPL_TYPE_CHAR: cpl_property_set_char(property, *((const cxchar *)value)); break; case CPL_TYPE_BOOL: cpl_property_set_bool(property, *((const cxint *)value)); break; case CPL_TYPE_INT: cpl_property_set_int(property, *((const cxint *)value)); break; case CPL_TYPE_LONG: cpl_property_set_long(property, *((const cxlong *)value)); break; case CPL_TYPE_LONG_LONG: cpl_property_set_long_long(property, *((const cxllong *)value)); break; case CPL_TYPE_FLOAT: cpl_property_set_float(property, *((const cxfloat *)value)); break; case CPL_TYPE_DOUBLE: cpl_property_set_double(property, *((const cxdouble *)value)); break; case CPL_TYPE_STRING: cpl_property_set_string(property, ((const cxchar *)value)); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_property_set_float_complex(property, *((const float complex *)value)); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_property_set_double_complex(property, *((const double complex *)value)); break; default: return 1; break; } /* * Insert it into the deque */ cx_deque_insert(self->properties, pos, property); return 0; } /* * @brief Insert cards from a FITS CHU into a propertylist * @param self The propertylist to insert * @param file The CFITSIO file object * @param hdumov Absolute extension number to move to first (0 for primary) * @param filter An optional compare function for filtering the properties * @param data An optional regexp w. invert flag for filtering the properties * @return CPL_ERROR_NONE, or the relevant CPL error on failure * @see cpl_propertylist_to_fitsfile * * The function converts the current FITS header referenced by the cfitsio * file pointer to a property list. If the header cannot be accessed, i.e. * the number of keywords cannot be determined, or a keyword cannot be read, * -1 is returned. If the header contains FITS keywords whose type cannot be * determined the function returns 2. If a keyword type is not supported the * return value is 3. */ static cpl_error_code _cpl_propertylist_fill_from_fits(cpl_propertylist *self, fitsfile *file, int hdumov, cx_compare_func filter, cxptr data) { int status = 0; int ncards = 0; int i; if (hdumov >= 0 && fits_movabs_hdu(file, 1+hdumov, NULL, &status)) { return cpl_error_set_fits(CPL_ERROR_DATA_NOT_FOUND, status, fits_movabs_hdu, "hdumov=%d", hdumov); } if (fits_get_hdrspace(file, &ncards, NULL, &status)) { return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_get_hdrspace, "hdumov=%d", hdumov); } for (i = 1; i <= ncards; i++) { /* * In CFITSIO the length of a FITS comment card's value is larger * than what fits into a FITS value string. The FITS comment * card's 'value' is returned as comment by CFITSIO, but needs * to be copied to the value to build a correct property. * Therefore the value character array must have at least * the size FLEN_COMMENT. */ char type = '\0'; char key[FLEN_KEYWORD] = ""; char value[FLEN_COMMENT] = ""; char comment[FLEN_COMMENT] = ""; cpl_property *property; if (fits_read_keyn(file, i, key, value, comment, &status)) { return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_read_keyn, "Card %d of %d", i, ncards); } if (filter != NULL && filter(key, data) == FALSE) { /* Card is filtered out */ continue; } if (fits_get_keytype(value, &type, &status)) { if (status != VALUE_UNDEFINED) { return cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_get_keytype, "card %d of %d " "has key='%s', value='%s', " "comment='%s'", i, ncards, key, value, comment); } /* * Card has no value */ status = 0; // FIXME: Check the following statement /* * Skip totally empty records. */ if (key[0] == '\0' && comment[0] == '\0') { continue; } /* * Make the comment of a FITS comment card the value of * a string property. */ strncpy(value, comment, FLEN_COMMENT); value[FLEN_COMMENT] = '\0'; comment[0] = '\0'; type = 'C'; } /* * Create the property from the parsed FITS card. */ switch (type) { case 'L': { property = cpl_property_new(key, CPL_TYPE_BOOL); cpl_property_set_bool(property, *value == 'T' ? 1 : 0); break; } case 'I': { int itype = 0; int isgn = 0; fits_get_inttype(value, &itype, &isgn, &status); if ((itype == TUINT) || (itype == TLONGLONG)) { long long lval = 0LL; const int nscan = sscanf(value, "%lld", &lval); if (nscan != 1) { return cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "card %d of %d has " "key='%s', " "integer value='%s', " "comment='%s. " "sscanf()=%d", i, ncards, key, value, comment, nscan); } property = cpl_property_new(key, CPL_TYPE_LONG_LONG); cpl_property_set_long_long(property, lval); } else { int ival = 0; const int nscan = sscanf(value, "%d", &ival); if (nscan != 1) { return cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "card %d of %d has " "key='%s', " "integer value='%s', " "comment='%s. " "sscanf()=%d", i, ncards, key, value, comment, nscan); } property = cpl_property_new(key, CPL_TYPE_INT); cpl_property_set_int(property, ival); } break; } case 'F': { double dval; const int nscan = sscanf(value, "%lf", &dval); if (nscan != 1) { return cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "card %d of %d has key='%s', " "floating-point value='%s', " "comment='%s. sscanf()=%d", i, ncards, key, value, comment, nscan); } property = cpl_property_new(key, CPL_TYPE_DOUBLE); cpl_property_set_double(property, dval); break; } case 'C': /* * FITS standard: blank keywords may be followed by * any ASCII text as it is for COMMENT and HISTORY. * * In order to preserve this header record it is * changed into COMMENT record, so that it can be * stored in the property list. */ property = cpl_property_new(key[0] != '\0' ? key : "COMMENT", CPL_TYPE_STRING); /* * Remove leading and trailing single quotes (string value * indicators) only it the keyword is not a comment or a history * keyword. */ if ((strncmp(key, "COMMENT", 7) != 0) && (strncmp(key, "HISTORY", 7) != 0)) { if (value[0] == '\'') { value[0] = ' '; } if (value[strlen(value) - 1] == '\'') { value[strlen(value) - 1] = ' '; } cx_strstrip(value); } cpl_property_set_string(property, value); break; case 'X': { double dreal = 0.0; double dimag = 0.0; // FIXME: Find a CFITSIO routine to parse the string value const int nscan = sscanf(value, "(%lf,%lf", &dreal, &dimag); const double complex zval = dreal + dimag * _Complex_I; if (nscan != 2) { return cpl_error_set_message_(CPL_ERROR_BAD_FILE_FORMAT, "card %d of %d has key='%s', " "complex floating-point " "value='%s', comment='%s. " "sscanf()=%d", i, ncards, key, value, comment, nscan); } property = cpl_property_new(key, CPL_TYPE_DOUBLE_COMPLEX); cpl_property_set_double_complex(property, zval); break; } default: return cpl_error_set_message_(CPL_ERROR_UNSUPPORTED_MODE, "card %d of %d has key='%s', " "value='%s', type='%c', comment='%s", i, ncards, key, value, type, comment); } cpl_property_set_comment(property, comment); cx_deque_push_back(self->properties, property); } return 0; } /* * @brief * Save the current property list to a FITS file using cfitsio. * * @param file The CFITSIO file object * @param self The propertylist to be saved * @param filter An optional compare function for filtering the properties * @param data An optional regexp w. invert flag for filtering the properties * * @return * CPL_ERROR_NONE, or the relevant CPL error on failure * * @note * It will not save keys that match a regular expression given in filter. * * @see cpl_propertylist_to_fitsfile */ static cpl_error_code _cpl_propertylist_to_fitsfile(fitsfile *file, const cpl_propertylist *self, cx_compare_func filter, cxptr data) { cx_deque_iterator first, last; const cpl_boolean do_filter = filter != NULL && data != NULL; #ifdef CPL_USE_LONGSTRN /* Used for the OGIP Long String Keyword Convention: http://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/ofwg_recomm/r13.html */ cpl_boolean has_longstr = CPL_FALSE; #endif if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } first = cx_deque_begin(self->properties); last = cx_deque_end(self->properties); while (first != last) { const cpl_property *p = cpl_propertylist_get_const(self, first); const cxchar *name = cpl_property_get_name(p); const cxchar *comment = cpl_property_get_comment(p); cxint error = 0; const cpl_type type = cpl_property_get_type(p); if (do_filter && filter(name, data) == TRUE) { first = cx_deque_next(self->properties, first); continue; } switch (type) { case CPL_TYPE_CHAR: { const cxchar c = cpl_property_get_char(p); cxchar value[2]; /* * Character properties should be represented as a single * character string, not as its numerical equivalent. */ value[0] = c; value[1] = '\0'; (void)fits_update_key(file, TSTRING, name, (cxptr)&value, (cxchar*)comment, &error); } break; case CPL_TYPE_BOOL: { const cxint b = cpl_property_get_bool(p); const cxint value = b == TRUE ? 1 : 0; (void)fits_update_key(file, TLOGICAL, name, (cxptr)&value, (cxchar*)comment, &error); } break; case CPL_TYPE_INT: { const cxint value = cpl_property_get_int(p); (void)fits_update_key(file, TINT, name, (cxptr)&value, (cxchar*)comment, &error); } break; case CPL_TYPE_LONG: { const cxlong value = cpl_property_get_long(p); (void)fits_update_key(file, TLONG, name, (cxptr)&value, (cxchar*)comment, &error); } break; case CPL_TYPE_LONG_LONG: { const long long value = cpl_property_get_long_long(p); (void)fits_update_key(file, TLONGLONG, name, (cxptr)&value, (cxchar*)comment, &error); } break; case CPL_TYPE_FLOAT: { const cxfloat value = cpl_property_get_float(p); (void)fits_update_key(file, TFLOAT, name, (cxptr)&value, (cxchar*)comment, &error); } break; case CPL_TYPE_DOUBLE: { const cxdouble value = cpl_property_get_double(p); (void)fits_update_key(file, TDOUBLE, name, (cxptr)&value, (cxchar*)comment, &error); } break; case CPL_TYPE_STRING: { const cxchar *value = cpl_property_get_string(p); if (strcmp(name, "COMMENT") == 0) { if (fits_write_comment(file, (strlen(value) < 1 ? " " : value), &error)) { return cpl_error_set_fits(CPL_ERROR_ILLEGAL_INPUT, error, fits_write_comment, "name='%s', type=%d ('%s'), " "comment='%s'", name, type, cpl_type_get_name(type), comment); } } else if (strcmp(name, "HISTORY") == 0) { if (fits_write_history(file, (strlen(value) < 1 ? " " : value), &error)) { return cpl_error_set_fits(CPL_ERROR_ILLEGAL_INPUT, error, fits_write_history, "name='%s', type=%d ('%s'), " "comment='%s'", name, type, cpl_type_get_name(type), comment); } } else { #ifdef CPL_USE_LONGSTRN /* In v. 3.24 fits_update_key_longstr() has a buffer overflow triggered by a long comment. :-(((((((((((( */ /* Try to work around this by using a truncated comment. */ cxchar shortcomment[FLEN_COMMENT]; if (comment != NULL) { (void)strncpy(shortcomment, comment, FLEN_COMMENT-1); shortcomment[FLEN_COMMENT-1] = '\0'; } if (!has_longstr) { has_longstr = CPL_TRUE; if (fits_write_key_longwarn(file, &error)) { return cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_write_key_longwarn, " "); } } if (fits_update_key_longstr(file, (cxchar*)name, (cxptr)value, comment != NULL ? (cxchar*)shortcomment : NULL, &error)) { return cpl_error_set_fits(CPL_ERROR_ILLEGAL_INPUT, error,fits_update_key_longstr, "name='%s', value='%s', " "comment='%s'", name, value, comment); } #else if (fits_update_key_str(file, name, (cxptr)value, (cxchar*)comment, &error)) { return cpl_error_set_fits(CPL_ERROR_ILLEGAL_INPUT, error, fits_update_key_str, "name='%s', value='%s', " "comment='%s'", name, value, comment); } #endif } } break; case CPL_TYPE_FLOAT_COMPLEX: { const float complex value = cpl_property_get_float_complex(p); (void)fits_update_key(file, TCOMPLEX, name, (cxptr)&value, (cxchar*)comment, &error); } break; case CPL_TYPE_DOUBLE_COMPLEX: { const double complex value = cpl_property_get_double_complex(p); (void)fits_update_key(file, TDBLCOMPLEX, name, (cxptr)&value, (cxchar*)comment, &error); } break; default: return cpl_error_set_message_(CPL_ERROR_UNSUPPORTED_MODE, "name='%s', type=%d ('%s'), " "comment='%s'", name, type, cpl_type_get_name(type), comment); } if (error) { return cpl_error_set_fits(CPL_ERROR_ILLEGAL_INPUT, error, fits_update_key, "name='%s', " "type=%d ('%s'), comment='%s'", name, type, cpl_type_get_name(type), comment); } first = cx_deque_next(self->properties, first); } return CPL_ERROR_NONE; } /* * Public methods */ /** * @brief * Create an empty property list. * * @return * The newly created property list. * * The function creates a new property list and returns a handle for it. * To destroy the returned property list object use the property list * destructor @b cpl_propertylist_delete(). * * @see cpl_propertylist_delete() */ cpl_propertylist * cpl_propertylist_new(void) { cpl_propertylist *self = cx_malloc(sizeof *self); self->properties = cx_deque_new(); return self; } /** * @brief * Create a copy of the given property list. * * @param self The property list to be copied. * * @return * The created copy or @c NULL in case an error occurred. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function creates a deep copy of the given property list @em self, * i.e the created copy and the original property list do not share any * resources. */ cpl_propertylist * cpl_propertylist_duplicate(const cpl_propertylist *self) { cx_deque_iterator first, last; cpl_propertylist *copy = NULL; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } cx_assert(self->properties != NULL); copy = cpl_propertylist_new(); first = cx_deque_begin(self->properties); last = cx_deque_end(self->properties); while (first != last) { cpl_property *tmp = cx_deque_get(self->properties, first); cx_deque_push_back(copy->properties, cpl_property_duplicate(tmp)); first = cx_deque_next(self->properties, first); } return copy; } /** * @brief * Destroy a property list. * * @param self The property list to . * * @return * Nothing. * * The function destroys the property list @em self and its whole * contents. If @em self is @c NULL, nothing is done and no error is set. */ void cpl_propertylist_delete(cpl_propertylist *self) { if (self) { cx_deque_destroy(self->properties, (cx_free_func)cpl_property_delete); cx_free(self); } return; } /** * @brief * Get the current size of a property list. * * @param self A property list. * * @return * The property list's current size, or 0 if the list is empty. If an * error occurs the function returns 0 and sets an appropriate error * code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function reports the current number of elements stored in the property * list @em self. */ cpl_size cpl_propertylist_get_size(const cpl_propertylist *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0L; } return (cpl_size) cx_deque_size(self->properties); } /** * @brief * Check whether a property list is empty. * * @param self A property list. * * @return * The function returns 1 if the list is empty, and 0 otherwise. * In case an error occurs the function returns -1 and sets an * appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function checks if @em self contains any properties. */ int cpl_propertylist_is_empty(const cpl_propertylist *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } return cx_deque_empty(self->properties); } /** * @brief * Get the the type of a property list entry. * * @param self A property list. * @param name The property name to look up. * * @return * The type of the stored value. If an error occurs the function returns * @c CPL_TYPE_INVALID and sets an appropriate error code. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function returns the type of the value stored in @em self with the * name @em name. If there is more than one property with the same @em name, * it takes the first one from the list. */ cpl_type cpl_propertylist_get_type(const cpl_propertylist *self, const char *name) { cpl_property *property; if (self == NULL || name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return CPL_TYPE_INVALID; } property = _cpl_propertylist_get(self, name); if (property == NULL) { cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); return CPL_TYPE_INVALID; } return cpl_property_get_type(property); } /** * @brief * Check whether a property is present in a property list. * * @param self A property list. * @param name The property name to look up. * * @return * The function returns 1 if the property is present, or 0 otherwise. * If an error occurs the function returns 0 and sets an appropriate * error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function searches the property list @em self for a property with * the name @em name and reports whether it was found or not. */ int cpl_propertylist_has(const cpl_propertylist *self, const char *name) { if (self == NULL || name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } return _cpl_propertylist_get(self, name) != NULL ? 1 : 0; } /** * @brief * Modify the comment field of the given property list entry. * * @param self A property list. * @param name The property name to look up. * @param comment New comment string. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its comment is replaced by * the string @em comment. The provided comment string may be @c NULL. * In this case an already existing comment is deleted. If there is more * than one property with the same @em name, it takes the first one from the * list. */ cpl_error_code cpl_propertylist_set_comment(cpl_propertylist *self, const char *name, const char *comment) { cpl_property *property; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = _cpl_propertylist_get(self, name); if (property == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); } cpl_property_set_comment(property, comment); return CPL_ERROR_NONE; } /** * @brief * Set the value of the given character property list entry. * * @param self A property list. * @param name The property name to look up. * @param value New character value. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its character value is replaced * with the character @em value. If there is more than one property with * the same @em name, it takes the first one from the list. */ cpl_error_code cpl_propertylist_set_char(cpl_propertylist *self, const char *name, char value) { cpl_property *property; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = _cpl_propertylist_get(self, name); if (property == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); } return cpl_property_set_char(property, value); } /** * @brief * Set the value of the given boolean property list entry. * * @param self A property list. * @param name The property name to look up. * @param value New boolean value. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its boolean value is replaced * with the boolean @em value. If there is more than one property with * the same @em name, it takes the first one from the list. */ cpl_error_code cpl_propertylist_set_bool(cpl_propertylist *self, const char *name, int value) { cpl_property *property; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = _cpl_propertylist_get(self, name); if (property == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); } return cpl_property_set_bool(property, value); } /** * @brief * Set the value of the given integer property list entry. * * @param self A property list. * @param name The property name to look up. * @param value New integer value. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its integer value is replaced * with the integer @em value. If there is more than one property with * the same @em name, it takes the first one from the list. */ cpl_error_code cpl_propertylist_set_int(cpl_propertylist *self, const char *name, int value) { cpl_property *property; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = _cpl_propertylist_get(self, name); if (property == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); } return cpl_property_set_int(property, value); } /** * @brief * Set the value of the given long property list entry. * * @param self A property list. * @param name The property name to look up. * @param value New long value. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its long value is replaced with * the long @em value. If there is more than one property with * the same @em name, it takes the first one from the list. */ cpl_error_code cpl_propertylist_set_long(cpl_propertylist *self, const char *name, long value) { cpl_property *property; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = _cpl_propertylist_get(self, name); if (property == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); } return cpl_property_set_long(property, value); } /** * @brief * Set the value of the given long long property list entry. * * @param self A property list. * @param name The property name to look up. * @param value New long long value. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its long long value is replaced * with @em value. If there is more than one property with the same @em name, * it takes the first one from the list. */ cpl_error_code cpl_propertylist_set_long_long(cpl_propertylist *self, const char *name, long long value) { cpl_property *property; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = _cpl_propertylist_get(self, name); if (property == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); } return cpl_property_set_long_long(property, value); } /** * @brief * Set the value of the given float property list entry. * * @param self A property list. * @param name The property name to look up. * @param value New float value. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its float value is replaced with * the float @em value. If there is more than one property with * the same @em name, it takes the first one from the list. */ cpl_error_code cpl_propertylist_set_float(cpl_propertylist *self, const char *name, float value) { cpl_property *property; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = _cpl_propertylist_get(self, name); if (property == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); } return cpl_property_set_float(property, value); } /** * @brief * Set the value of the given double property list entry. * * @param self A property list. * @param name The property name to look up. * @param value New double value. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its double value is replaced with * the double @em value. If there is more than one property with * the same @em name, it takes the first one from the list. */ cpl_error_code cpl_propertylist_set_double(cpl_propertylist *self, const char *name, double value) { cpl_property *property; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = _cpl_propertylist_get(self, name); if (property == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); } return cpl_property_set_double(property, value); } /** * @brief * Set the value of the given string property list entry. * * @param self A property list. * @param name The property name to look up. * @param value New string value. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, name or value is a * NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its string value is replaced with * the string @em value. If there is more than one property with * the same @em name, it takes the first one from the list. */ cpl_error_code cpl_propertylist_set_string(cpl_propertylist *self, const char *name, const char *value) { cpl_property *property; if (self == NULL || name == NULL || value == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = _cpl_propertylist_get(self, name); if (property == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); } return cpl_property_set_string(property, value); } /** * @brief * Set the value of the given float complex property list entry. * * @param self A property list. * @param name The property name to look up. * @param value New float complex value. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its float complex value is replaced * with the float complex @em value. If there is more than one property with * the same @em name, it takes the first one from the list. */ cpl_error_code cpl_propertylist_set_float_complex(cpl_propertylist *self, const char *name, float complex value) { cpl_property *property; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = _cpl_propertylist_get(self, name); if (property == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); } return cpl_property_set_float_complex(property, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Set the value of the given double complex property list entry. * * @param self A property list. * @param name The property name to look up. * @param value New double complex value. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error code * otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its double complex value is replaced * with the double complex @em value. If there is more than one property with * the same @em name, it takes the first one from the list. */ cpl_error_code cpl_propertylist_set_double_complex(cpl_propertylist *self, const char *name, double complex value) { cpl_property *property; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = _cpl_propertylist_get(self, name); if (property == NULL) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); } return cpl_property_set_double_complex(property, value) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Access property list elements by index. * * @param self The property list to query. * @param position Index of the element to retrieve. * * @return * The function returns the property with index @em position, or @c NULL * if @em position is out of range. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns a handle for the property list element, the property, * with the index @em position. Numbering of property list elements extends from * 0 to @b cpl_propertylist_get_size() - 1. If @em position is less than 0 or * greater equal than @b cpl_propertylist_get_size() the function returns * @c NULL. */ const cpl_property * cpl_propertylist_get_const(const cpl_propertylist *self, long position) { #ifdef CPL_PROPERTYLIST_ENABLE_LOOP_CHECK cxsize i = 0; #endif cx_deque_iterator first, last; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if (position < 0) { return NULL; } first = cx_deque_begin(self->properties); last = cx_deque_end(self->properties); #ifdef CPL_PROPERTYLIST_ENABLE_LOOP_CHECK /* FIXME: Except from never stopping in a unit test, what does this do? */ while (i < (cxsize)position && first != last) { first = cx_deque_next(self->properties, first); i++; } #endif if (first == last) { return NULL; } if ((cx_deque_const_iterator)position >= last) { return NULL; } return cx_deque_get(self->properties, (cx_deque_const_iterator)position); } /** * @brief * Access property list elements by index. * * @param self The property list to query. * @param position Index of the element to retrieve. * * @return * The function returns the property with index @em position, or @c NULL * if @em position is out of range. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns a handle for the property list element, the property, * with the index @em position. Numbering of property list elements extends from * 0 to @b cpl_propertylist_get_size() - 1. If @em position is less than 0 or * greater equal than @b cpl_propertylist_get_size() the function returns * @c NULL. */ cpl_property * cpl_propertylist_get(cpl_propertylist *self, long position) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_property *property = (cpl_property *)cpl_propertylist_get_const(self, position); if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where_(); return property; } /** * @brief * Get the comment of the given property list entry. * * @param self A property list. * @param name The property name to look up. * * @return * The comment of the property list entry, or @c NULL. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its comment string is returned. * If an entry with the name @em name is not found, or if the entry has * no comment the function returns @c NULL. If there is more than one property * with the same @em name, it takes the first one from the list. */ const char * cpl_propertylist_get_comment(const cpl_propertylist *self, const char *name) { cpl_property *property; if (self == NULL || name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } property = _cpl_propertylist_get(self, name); if (!property) { cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); return NULL; } return cpl_property_get_comment(property); } /** * @brief * Get the character value of the given property list entry. * * @param self A property list. * @param name The property name to look up. * * @return * The character value stored in the list entry. The function returns '\\0' * if an error occurs and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
CPL_ERROR_TYPE_MISMATCH * The sought-after property name is not of type * @c CPL_TYPE_CHAR. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its character value is returned. * If there is more than one property with the same @em name, it takes the * first one from the list. */ char cpl_propertylist_get_char(const cpl_propertylist *self, const char *name) { cxchar result; cpl_property *property; cpl_errorstate prevstate; if (self == NULL || name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return '\0'; } property = _cpl_propertylist_get(self, name); if (!property) { cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); return '\0'; } prevstate = cpl_errorstate_get(); result = cpl_property_get_char(property); /* * If an error occurred change any possible set location to this * function. */ if (!cpl_errorstate_is_equal(prevstate)) { cpl_error_set_where_(); return '\0'; } return result; } /** * @brief * Get the boolean value of the given property list entry. * * @param self A property list. * @param name The property name to look up. * * @return * The integer representation of the boolean value stored in * the list entry. @c TRUE is represented as non-zero value while * 0 indicates @c FALSE. The function returns 0 if an error occurs * and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
CPL_ERROR_TYPE_MISMATCH * The sought-after property name is not of type * @c CPL_TYPE_BOOL. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its boolean value is returned. * If there is more than one property with the same @em name, it takes the * first one from the list. */ int cpl_propertylist_get_bool(const cpl_propertylist *self, const char *name) { cxbool result; cpl_property *property; cpl_errorstate prevstate; if (self == NULL || name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } property = _cpl_propertylist_get(self, name); if (!property) { cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); return 0; } prevstate = cpl_errorstate_get(); result = cpl_property_get_bool(property); /* * If an error occurred change any possibly set location to this * function. */ if (!cpl_errorstate_is_equal(prevstate)) { cpl_error_set_where_(); return 0; } return result == TRUE ? 1 : 0; } /** * @brief * Get the integer value of the given property list entry. * * @param self A property list. * @param name The property name to look up. * * @return * The integer value stored in the list entry. The function returns 0 if * an error occurs and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
CPL_ERROR_TYPE_MISMATCH * The sought-after property name is not of type * @c CPL_TYPE_INT. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its integer value is returned. * If there is more than one property with the same @em name, it takes the * first one from the list. */ int cpl_propertylist_get_int(const cpl_propertylist *self, const char *name) { cxint result; cpl_property *property; cpl_errorstate prevstate; if (self == NULL || name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } property = _cpl_propertylist_get(self, name); if (!property) { cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); return 0; } prevstate = cpl_errorstate_get(); result = cpl_property_get_int(property); /* * If an error occurred change any possibly set location to this * function. */ if (!cpl_errorstate_is_equal(prevstate)) { cpl_error_set_where_(); return 0; } return result; } /** * @brief * Get the long value of the given property list entry. * * @param self A property list. * @param name The property name to look up. * * @return * The long value stored in the list entry. The function returns 0 if * an error occurs and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
CPL_ERROR_TYPE_MISMATCH * The sought-after property name is not of type * CPL_TYPE_LONG or CPL_TYPE_INT. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its long value is returned. * If there is more than one property with the same @em name, it takes the * first one from the list. * * The function may be used to access the value of all integer type properties * whose integer value has a rank less or equal to the functions return type. * If the value of a compatible property is retrieved, it is promoted to * the return type of the function. */ long cpl_propertylist_get_long(const cpl_propertylist *self, const char *name) { cxlong result; cpl_property *property; cpl_errorstate prevstate; if (self == NULL || name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } property = _cpl_propertylist_get(self, name); if (!property) { cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); return 0; } prevstate = cpl_errorstate_get(); result = cpl_property_get_long(property); /* * If an error occurred change any possibly set location to this * function. */ if (!cpl_errorstate_is_equal(prevstate)) { cpl_error_set_where_(); return 0; } return result; } /** * @brief * Get the long long value of the given property list entry. * * @param self A property list. * @param name The property name to look up. * * @return * The long value stored in the list entry. The function returns 0 if * an error occurs and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
CPL_ERROR_TYPE_MISMATCH * The sought-after property name is not of type * CPL_TYPE_LONG_LONG, CPL_TYPE_LONG, or * CPL_TYPE_INT *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its long long value is returned. * If there is more than one property with the same @em name, it takes the * first one from the list. * * The function may be used to access the value of all integer type properties * whose integer value has a rank less or equal to the functions return type. * If the value of a compatible property is retrieved, it is promoted to * the return type of the function. */ long long cpl_propertylist_get_long_long(const cpl_propertylist *self, const char *name) { cxlong result; cpl_property *property; cpl_errorstate prevstate; if (self == NULL || name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } property = _cpl_propertylist_get(self, name); if (!property) { cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); return 0; } prevstate = cpl_errorstate_get(); result = cpl_property_get_long_long(property); /* * If an error occurred change any possibly set location to this * function. */ if (!cpl_errorstate_is_equal(prevstate)) { cpl_error_set_where_(); return 0; } return result; } /** * @brief * Get the float value of the given property list entry. * * @param self A property list. * @param name The property name to look up. * * @return * The float value stored in the list entry. The function returns 0 if * an error occurs and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
CPL_ERROR_TYPE_MISMATCH * The sought-after property name is not of type * @c CPL_TYPE_FLOAT or @c CPL_TYPE_DOUBLE. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its float value is returned. * If there is more than one property with the same @em name, it takes the * first one from the list. If the value is of type double, the function * casts it to float before returning it. */ float cpl_propertylist_get_float(const cpl_propertylist *self, const char *name) { cxfloat result; cpl_property *property; cpl_errorstate prevstate; if (self == NULL || name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } property = _cpl_propertylist_get(self, name); if (!property) { cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); return 0; } prevstate = cpl_errorstate_get(); result = cpl_property_get_float(property); /* * If an error occurred change any possibly set location to this * function. */ if (!cpl_errorstate_is_equal(prevstate)) { cpl_error_set_where_(); return 0; } return result; } /** * @brief * Get the double value of the given property list entry. * * @param self A property list. * @param name The property name to look up. * * @return * The double value stored in the list entry. The function returns 0 if * an error occurs and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
CPL_ERROR_TYPE_MISMATCH * The sought-after property name is not of type * CPL_TYPE_DOUBLE or CPL_TYPE_FLOAT. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its double value is returned. * If there is more than one property with the same @em name, it takes the * first one from the list. If the value is of type float, the function * casts it to double before returning it. * * The function may be used to access the value of all floating-point type * properties whose floating-point value has a rank less or equal to the * functions return type. If the value of a compatible property is retrieved, * it is promoted to the return type of the function. */ double cpl_propertylist_get_double(const cpl_propertylist *self, const char *name) { cxdouble result; cpl_property *property; cpl_errorstate prevstate; if (self == NULL || name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } property = _cpl_propertylist_get(self, name); if (!property) { cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); return 0; } prevstate = cpl_errorstate_get(); result = cpl_property_get_double(property); /* * If an error occurred change any possibly set location to this * function. */ if (!cpl_errorstate_is_equal(prevstate)) { cpl_error_set_where_(); return 0; } return result; } /** * @brief * Get the string value of the given property list entry. * * @param self A property list. * @param name The property name to look up. * * @return * A handle to the string value stored in the list entry. The * function returns @c NULL if an error occurs and an appropriate * error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
CPL_ERROR_TYPE_MISMATCH * The sought-after property name is not of type * @c CPL_TYPE_STRING. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, a handle to its string value * is returned. If there is more than one property with the same @em name, * it takes the first one from the list. */ const char * cpl_propertylist_get_string(const cpl_propertylist *self, const char *name) { const cxchar *result; cpl_property *property; cpl_errorstate prevstate; if (self == NULL || name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } property = _cpl_propertylist_get(self, name); if (!property) { cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); return NULL; } prevstate = cpl_errorstate_get(); result = cpl_property_get_string(property); /* * If an error occurred change any possibly set location to this * function. */ if (!cpl_errorstate_is_equal(prevstate)) { cpl_error_set_where_(); return NULL; } return result; } /** * @brief * Get the float complex value of the given property list entry. * * @param self A property list. * @param name The property name to look up. * * @return * The float complex value stored in the list entry. The function returns 0 if * an error occurs and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
CPL_ERROR_TYPE_MISMATCH * The sought-after property name is not of type * @c CPL_TYPE_FLOAT_COMPLEX or @c CPL_TYPE_DOUBLE_COMPLEX. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its float complex value is returned. * If there is more than one property with the same @em name, it takes the * first one from the list. If the value is of type double, the function * casts it to float complex before returning it. */ float complex cpl_propertylist_get_float_complex(const cpl_propertylist *self, const char *name) { float complex result; cpl_property *property; cpl_errorstate prevstate; if (self == NULL || name == NULL) { (void)cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0.0; } property = _cpl_propertylist_get(self, name); if (!property) { (void)cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); return 0.0; } prevstate = cpl_errorstate_get(); result = cpl_property_get_float_complex(property); /* * If an error occurred change any possibly set location to this * function. */ if (!cpl_errorstate_is_equal(prevstate)) { (void)cpl_error_set_where_(); return 0.0; } return result; } /** * @brief * Get the double complex value of the given property list entry. * * @param self A property list. * @param name The property name to look up. * * @return * The double complex value stored in the list entry. The function returns 0 if * an error occurs and an appropriate error code is set. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list self does not contain a property with * the name name. *
CPL_ERROR_TYPE_MISMATCH * The sought-after property name is not of type * @c CPL_TYPE_DOUBLE_COMPLEX or @c CPL_TYPE_FLOAT_COMPLEX. *
* @enderror * * The function searches the property list @em self for a property named * @em name. If it is present in the list, its double complex value is returned. * If there is more than one property with the same @em name, it takes the * first one from the list. If the value is of type float, the function * casts it to double complex before returning it. * * The function may be used to access the value of all complex type * properties whose complex value has a rank less or equal to the * functions return type. If the value of a compatible property is retrieved, * it is promoted to the return type of the function. */ double complex cpl_propertylist_get_double_complex(const cpl_propertylist *self, const char *name) { double complex result; cpl_property *property; cpl_errorstate prevstate; if (self == NULL || name == NULL) { (void)cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0.0; } property = _cpl_propertylist_get(self, name); if (!property) { (void)cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); return 0.0; } prevstate = cpl_errorstate_get(); result = cpl_property_get_double_complex(property); /* * If an error occurred change any possibly set location to this * function. */ if (!cpl_errorstate_is_equal(prevstate)) { (void)cpl_error_set_where_(); return 0.0; } return result; } /** * @brief * Insert a character value into a property list at the given position. * * @param self A property list. * @param here Name indicating the position at which the value is inserted. * @param name The property name to be assigned to the value. * @param value The character value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, here or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new character property with name @em name and * value @em value. The property is inserted into the property list * @em self at the position of the property named @em here. */ cpl_error_code cpl_propertylist_insert_char(cpl_propertylist *self, const char *here, const char *name, char value) { cxint status = 0; if (self == NULL || here == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, here, FALSE, name, CPL_TYPE_CHAR, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a boolean value into a property list at the given position. * * @param self A property list. * @param here Name indicating the position at which the value is inserted. * @param name The property name to be assigned to the value. * @param value The boolean value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, here or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new boolean property with name @em name and * value @em value. The property is inserted into the property list * @em self at the position of the property named @em here. */ cpl_error_code cpl_propertylist_insert_bool(cpl_propertylist *self, const char *here, const char *name, int value) { cxint status = 0; if (self == NULL || here == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, here, FALSE, name, CPL_TYPE_BOOL, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a integer value into a property list at the given position. * * @param self A property list. * @param here Name indicating the position at which the value is inserted. * @param name The property name to be assigned to the value. * @param value The integer value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, here or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new integer property with name @em name and * value @em value. The property is inserted into the property list * @em self at the position of the property named @em here. */ cpl_error_code cpl_propertylist_insert_int(cpl_propertylist *self, const char *here, const char *name, int value) { cxint status = 0; if (self == NULL || here == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, here, FALSE, name, CPL_TYPE_INT, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a long value into a property list at the given position. * * @param self A property list. * @param here Name indicating the position at which the value is inserted. * @param name The property name to be assigned to the value. * @param value The long value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, here or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new long property with name @em name and * value @em value. The property is inserted into the property list * @em self at the position of the property named @em here. */ cpl_error_code cpl_propertylist_insert_long(cpl_propertylist *self, const char *here, const char *name, long value) { cxint status = 0; if (self == NULL || here == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, here, FALSE, name, CPL_TYPE_LONG, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a long long value into a property list at the given position. * * @param self A property list. * @param here Name indicating the position at which the value is inserted. * @param name The property name to be assigned to the value. * @param value The long long value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, here or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new long long property with name @em name and * value @em value. The property is inserted into the property list * @em self at the position of the property named @em here. */ cpl_error_code cpl_propertylist_insert_long_long(cpl_propertylist *self, const char *here, const char *name, long long value) { cxint status = 0; if (self == NULL || here == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, here, FALSE, name, CPL_TYPE_LONG_LONG, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a float value into a property list at the given position. * * @param self A property list. * @param here Name indicating the position at which the value is inserted. * @param name The property name to be assigned to the value. * @param value The float value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, here or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new float property with name @em name and * value @em value. The property is inserted into the property list * @em self at the position of the property named @em here. */ cpl_error_code cpl_propertylist_insert_float(cpl_propertylist *self, const char *here, const char *name, float value) { cxint status = 0; if (self == NULL || here == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, here, FALSE, name, CPL_TYPE_FLOAT, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a double value into a property list at the given position. * * @param self A property list. * @param here Name indicating the position at which the value is inserted. * @param name The property name to be assigned to the value. * @param value The double value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, here or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new double property with name @em name and * value @em value. The property is inserted into the property list * @em self at the position of the property named @em here. */ cpl_error_code cpl_propertylist_insert_double(cpl_propertylist *self, const char *here, const char *name, double value) { cxint status = 0; if (self == NULL || here == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, here, FALSE, name, CPL_TYPE_DOUBLE, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a string value into a property list at the given position. * * @param self A property list. * @param here Name indicating the position at which the value is inserted. * @param name The property name to be assigned to the value. * @param value The string value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, here, name or value * or name is a NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new string property with name @em name and * value @em value. The property is inserted into the property list * @em self at the position of the property named @em here. */ cpl_error_code cpl_propertylist_insert_string(cpl_propertylist *self, const char *here, const char *name, const char *value) { cxint status = 0; if (self == NULL || here == NULL || name == NULL || value == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, here, FALSE, name, CPL_TYPE_STRING, (cxcptr)value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a float complex value into a property list at the given position. * * @param self A property list. * @param here Name indicating the position at which the value is inserted. * @param name The property name to be assigned to the value. * @param value The float complex value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, here or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new float complex property with name @em name and * value @em value. The property is inserted into the property list * @em self at the position of the property named @em here. */ cpl_error_code cpl_propertylist_insert_float_complex(cpl_propertylist *self, const char *here, const char *name, float complex value) { if (self == NULL || here == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } return _cpl_propertylist_insert(self, here, FALSE, name, CPL_TYPE_FLOAT_COMPLEX, (cxcptr)&value) ? cpl_error_set_(CPL_ERROR_UNSPECIFIED) : CPL_ERROR_NONE; } /** * @brief * Insert a double complex value into a property list at the given position. * * @param self A property list. * @param here Name indicating the position at which the value is inserted. * @param name The property name to be assigned to the value. * @param value The double complex value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, here or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new double complex property with name @em name and * value @em value. The property is inserted into the property list * @em self at the position of the property named @em here. */ cpl_error_code cpl_propertylist_insert_double_complex(cpl_propertylist *self, const char *here, const char *name, double complex value) { if (self == NULL || here == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } return _cpl_propertylist_insert(self, here, FALSE, name, CPL_TYPE_DOUBLE_COMPLEX, (cxcptr)&value) ? cpl_error_set_(CPL_ERROR_UNSPECIFIED) : CPL_ERROR_NONE; } /** * @brief * Insert a character value into a property list after the given position. * * @param self A property list. * @param after Name of the property after which the value is inserted. * @param name The property name to be assigned to the value. * @param value The character value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, after or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new character property with name @em name and * value @em value. The property is inserted into the property list * @em self after the property named @em after. */ cpl_error_code cpl_propertylist_insert_after_char(cpl_propertylist *self, const char *after, const char *name, char value) { cxint status = 0; if (self == NULL || after == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, after, TRUE, name, CPL_TYPE_CHAR, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a boolean value into a property list after the given position. * * @param self A property list. * @param after Name of the property after which the value is inserted. * @param name The property name to be assigned to the value. * @param value The boolean value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, after or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new boolean property with name @em name and * value @em value. The property is inserted into the property list * @em self after the property named @em after. */ cpl_error_code cpl_propertylist_insert_after_bool(cpl_propertylist *self, const char *after, const char *name, int value) { cxint status = 0; if (self == NULL || after == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, after, TRUE, name, CPL_TYPE_BOOL, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a integer value into a property list after the given position. * * @param self A property list. * @param after Name of the property after which the value is inserted. * @param name The property name to be assigned to the value. * @param value The integer value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, after or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new integer property with name @em name and * value @em value. The property is inserted into the property list * @em self after the property named @em after. */ cpl_error_code cpl_propertylist_insert_after_int(cpl_propertylist *self, const char *after, const char *name, int value) { cxint status = 0; if (self == NULL || after == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, after, TRUE, name, CPL_TYPE_INT, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a long value into a property list after the given position. * * @param self A property list. * @param after Name of the property after which the value is inserted. * @param name The property name to be assigned to the value. * @param value The long value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, after or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new long property with name @em name and * value @em value. The property is inserted into the property list * @em self after the property named @em after. */ cpl_error_code cpl_propertylist_insert_after_long(cpl_propertylist *self, const char *after, const char *name, long value) { cxint status = 0; if (self == NULL || after == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, after, TRUE, name, CPL_TYPE_LONG, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a long long value into a property list after the given position. * * @param self A property list. * @param after Name of the property after which the value is inserted. * @param name The property name to be assigned to the value. * @param value The long long value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, after or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new long long property with name @em name and * value @em value. The property is inserted into the property list * @em self after the property named @em after. */ cpl_error_code cpl_propertylist_insert_after_long_long(cpl_propertylist *self, const char *after, const char *name, long long value) { cxint status = 0; if (self == NULL || after == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, after, TRUE, name, CPL_TYPE_LONG_LONG, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a float value into a property list after the given position. * * @param self A property list. * @param after Name of the property after which the value is inserted. * @param name The property name to be assigned to the value. * @param value The float value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, after or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new float property with name @em name and * value @em value. The property is inserted into the property list * @em self after the property named @em after. */ cpl_error_code cpl_propertylist_insert_after_float(cpl_propertylist *self, const char *after, const char *name, float value) { cxint status = 0; if (self == NULL || after == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, after, TRUE, name, CPL_TYPE_FLOAT, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a double value into a property list after the given position. * * @param self A property list. * @param after Name of the property after which the value is inserted. * @param name The property name to be assigned to the value. * @param value The double value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, after or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new double property with name @em name and * value @em value. The property is inserted into the property list * @em self after the property named @em after. */ cpl_error_code cpl_propertylist_insert_after_double(cpl_propertylist *self, const char *after, const char *name, double value) { cxint status = 0; if (self == NULL || after == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, after, TRUE, name, CPL_TYPE_DOUBLE, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a string value into a property list after the given position. * * @param self A property list. * @param after Name of the property after which the value is inserted. * @param name The property name to be assigned to the value. * @param value The string value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, after, name or value * or name is a NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new string property with name @em name and * value @em value. The property is inserted into the property list * @em self after the property named @em after. */ cpl_error_code cpl_propertylist_insert_after_string(cpl_propertylist *self, const char *after, const char *name, const char *value) { cxint status = 0; if (self == NULL || after == NULL || name == NULL || value == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = _cpl_propertylist_insert(self, after, TRUE, name, CPL_TYPE_STRING, (cxcptr)value); if (status) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } return CPL_ERROR_NONE; } /** * @brief * Insert a float complex value into a property list after the given position. * * @param self A property list. * @param after Name of the property after which the value is inserted. * @param name The property name to be assigned to the value. * @param value The float complex value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, after or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new float complex property with name @em name and * value @em value. The property is inserted into the property list * @em self after the property named @em after. */ cpl_error_code cpl_propertylist_insert_after_float_complex(cpl_propertylist *self, const char *after, const char *name, float complex value) { if (self == NULL || after == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } return _cpl_propertylist_insert(self, after, TRUE, name, CPL_TYPE_FLOAT_COMPLEX, (cxcptr)&value) ? cpl_error_set_(CPL_ERROR_UNSPECIFIED) : CPL_ERROR_NONE; } /** * @brief * Insert a double complex value into a property list after the given position. * * @param self A property list. * @param after Name of the property after which the value is inserted. * @param name The property name to be assigned to the value. * @param value The double complex value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, after or name is a * NULL pointer. *
CPL_ERROR_UNSPECIFIED * A property with the name name could not be inserted * into self. *
* @enderror * * The function creates a new double complex property with name @em name and * value @em value. The property is inserted into the property list * @em self after the property named @em after. */ cpl_error_code cpl_propertylist_insert_after_double_complex(cpl_propertylist *self, const char *after, const char *name, double complex value) { if (self == NULL || after == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } return _cpl_propertylist_insert(self, after, TRUE, name, CPL_TYPE_DOUBLE_COMPLEX, (cxcptr)&value) ? cpl_error_set_(CPL_ERROR_UNSPECIFIED) : CPL_ERROR_NONE; } /** * @brief * Prepend a character value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The character value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new character property with name @em name and * value @em value. The property is prepended to the property list @em self. */ cpl_error_code cpl_propertylist_prepend_char(cpl_propertylist *self, const char *name, char value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_CHAR); cx_assert(property != NULL); cpl_property_set_char(property, value); cx_deque_push_front(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Prepend a boolean value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The boolean value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new boolean property with name @em name and * value @em value. The property is prepended to the property list @em self. */ cpl_error_code cpl_propertylist_prepend_bool(cpl_propertylist *self, const char *name, int value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_BOOL); cx_assert(property != NULL); cpl_property_set_bool(property, value); cx_deque_push_front(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Prepend a integer value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The integer value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new integer property with name @em name and * value @em value. The property is prepended to the property list @em self. */ cpl_error_code cpl_propertylist_prepend_int(cpl_propertylist *self, const char *name, int value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_INT); cx_assert(property != NULL); cpl_property_set_int(property, value); cx_deque_push_front(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Prepend a long value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The long value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new long property with name @em name and * value @em value. The property is prepended to the property list @em self. */ cpl_error_code cpl_propertylist_prepend_long(cpl_propertylist *self, const char *name, long value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_LONG); cx_assert(property != NULL); cpl_property_set_long(property, value); cx_deque_push_front(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Prepend a long long value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The long long value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new long long property with name @em name and * value @em value. The property is prepended to the property list @em self. */ cpl_error_code cpl_propertylist_prepend_long_long(cpl_propertylist *self, const char *name, long long value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_LONG_LONG); cx_assert(property != NULL); cpl_property_set_long_long(property, value); cx_deque_push_front(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Prepend a float value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The float value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new float property with name @em name and * value @em value. The property is prepended to the property list @em self. */ cpl_error_code cpl_propertylist_prepend_float(cpl_propertylist *self, const char *name, float value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_FLOAT); cx_assert(property != NULL); cpl_property_set_float(property, value); cx_deque_push_front(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Prepend a double value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The double value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new double property with name @em name and * value @em value. The property is prepended to the property list @em self. */ cpl_error_code cpl_propertylist_prepend_double(cpl_propertylist *self, const char *name, double value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_DOUBLE); cx_assert(property != NULL); cpl_property_set_double(property, value); cx_deque_push_front(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Prepend a string value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The string value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, name or value is a * NULL pointer. *
* @enderror * * The function creates a new string property with name @em name and * value @em value. The property is prepended to the property list @em self. */ cpl_error_code cpl_propertylist_prepend_string(cpl_propertylist *self, const char *name, const char *value) { cpl_property *property = NULL; if (self == NULL || name == NULL || value == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_STRING); cx_assert(property != NULL); cpl_property_set_string(property, value); cx_deque_push_front(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Prepend a float complex value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The float complex value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new float complex property with name @em name and * value @em value. The property is prepended to the property list @em self. */ cpl_error_code cpl_propertylist_prepend_float_complex(cpl_propertylist *self, const char *name, float complex value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_FLOAT_COMPLEX); cx_assert(property != NULL); cpl_property_set_float_complex(property, value); cx_deque_push_front(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Prepend a double complex value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The double complex value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new double complex property with name @em name and * value @em value. The property is prepended to the property list @em self. */ cpl_error_code cpl_propertylist_prepend_double_complex(cpl_propertylist *self, const char *name, double complex value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_DOUBLE_COMPLEX); cx_assert(property != NULL); cpl_property_set_double_complex(property, value); cx_deque_push_front(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Append a character value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The character value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new character property with name @em name and * value @em value. The property is appended to the property list @em self. */ cpl_error_code cpl_propertylist_append_char(cpl_propertylist *self, const char *name, char value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_CHAR); cx_assert(property != NULL); cpl_property_set_char(property, value); cx_deque_push_back(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Append a boolean value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The boolean value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new boolean property with name @em name and * value @em value. The property is appended to the property list @em self. */ cpl_error_code cpl_propertylist_append_bool(cpl_propertylist *self, const char *name, int value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_BOOL); cx_assert(property != NULL); cpl_property_set_bool(property, value); cx_deque_push_back(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Append an integer value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The integer value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new integer property with name @em name and * value @em value. The property is appended to the property list @em self. */ cpl_error_code cpl_propertylist_append_int(cpl_propertylist *self, const char *name, int value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_INT); cx_assert(property != NULL); cpl_property_set_int(property, value); cx_deque_push_back(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Append a long value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The long value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new long property with name @em name and * value @em value. The property is appended to the property list @em self. */ cpl_error_code cpl_propertylist_append_long(cpl_propertylist *self, const char *name, long value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_LONG); cx_assert(property != NULL); cpl_property_set_long(property, value); cx_deque_push_back(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Append a long long value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The long long value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new long long property with name @em name and * value @em value. The property is appended to the property list @em self. */ cpl_error_code cpl_propertylist_append_long_long(cpl_propertylist *self, const char *name, long long value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_LONG_LONG); cx_assert(property != NULL); cpl_property_set_long_long(property, value); cx_deque_push_back(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Append a float value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The float value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new float property with name @em name and * value @em value. The property is appended to the property list @em self. */ cpl_error_code cpl_propertylist_append_float(cpl_propertylist *self, const char *name, float value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_FLOAT); cx_assert(property != NULL); cpl_property_set_float(property, value); cx_deque_push_back(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Append a double value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The double value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new double property with name @em name and * value @em value. The property is appended to the property list @em self. */ cpl_error_code cpl_propertylist_append_double(cpl_propertylist *self, const char *name, double value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_DOUBLE); cx_assert(property != NULL); cpl_property_set_double(property, value); cx_deque_push_back(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Append a string value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The string value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, name or value is a * NULL pointer. *
* @enderror * * The function creates a new string property with name @em name and * value @em value. The property is appended to the property list @em self. */ cpl_error_code cpl_propertylist_append_string(cpl_propertylist *self, const char *name, const char *value) { cpl_property *property = NULL; if (self == NULL || name == NULL || value == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_STRING); cx_assert(property != NULL); cpl_property_set_string(property, value); cx_deque_push_back(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Append a float complex value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The float complex value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new float complex property with name @em name and * value @em value. The property is appended to the property list @em self. */ cpl_error_code cpl_propertylist_append_float_complex(cpl_propertylist *self, const char *name, float complex value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_FLOAT_COMPLEX); cx_assert(property != NULL); cpl_property_set_float_complex(property, value); cx_deque_push_back(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Append a double complex value to a property list. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The double complex value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function creates a new double complex property with name @em name and * value @em value. The property is appended to the property list @em self. */ cpl_error_code cpl_propertylist_append_double_complex(cpl_propertylist *self, const char *name, double complex value) { cpl_property *property = NULL; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } property = cpl_property_new(name, CPL_TYPE_DOUBLE_COMPLEX); cx_assert(property != NULL); cpl_property_set_double_complex(property, value); cx_deque_push_back(self->properties, property); return CPL_ERROR_NONE; } /** * @brief * Append a property list.. * * @param self A property list. * @param other The property to append. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function appends the property list @em other to the property list * @em self. */ cpl_error_code cpl_propertylist_append(cpl_propertylist *self, const cpl_propertylist *other) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } if (other != NULL) { cx_deque_const_iterator pos = cx_deque_begin(other->properties); while (pos != cx_deque_end(other->properties)) { const cpl_property *p = cx_deque_get(other->properties, pos); cx_deque_push_back(self->properties, cpl_property_duplicate(p)); pos = cx_deque_next(other->properties, pos); } } return CPL_ERROR_NONE; } /** * @brief * Erase the given property from a property list. * * @param self A property list. * @param name Name of the property to erase. * * @return * On success the function returns the number of erased entries. If * an error occurs the function returns 0 and an appropriate error * code is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function searches the property with the name @em name in the property * list @em self and removes it. The property is destroyed. If @em self * contains multiple duplicates of a property named @em name, only the * first one is erased. */ int cpl_propertylist_erase(cpl_propertylist *self, const char *name) { cx_deque_iterator pos; if (self == NULL || name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) { return 0; } cx_deque_erase(self->properties, pos, (cx_free_func)cpl_property_delete); return 1; } /** * @brief * Erase all properties with name matching a given regular expression. * * @param self A property list. * @param regexp Regular expression. * @param invert Flag inverting the sense of matching. * * @return * On success the function returns the number of erased entries or 0 if * no entries are erase. If an error occurs the function returns -1 and an * appropriate error code is set. In CPL versions earlier than 5.0, the * return value in case of error is 0. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or regexp is a NULL * pointer. *
* @enderror * * The function searches for all the properties matching in the list * @em self and removes them. Whether a property matches or not depends on * the given regular expression @em regexp, and the flag @em invert. If * @em invert is @c 0, all properties matching @em regexp are removed from * the list. If @em invert is set to a non-zero value, all properties which * do not match @em regexp are erased. The removed properties are destroyed. * * The function expects POSIX 1003.2 compliant extended regular expressions. */ int cpl_propertylist_erase_regexp(cpl_propertylist *self, const char *regexp, int invert) { cxint status = 0; cxint count = 0; cx_deque_iterator first, last, pos; cpl_property *p; cpl_regexp filter; if (self == NULL || regexp == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } status = regcomp(&filter.re, regexp, REG_EXTENDED | REG_NOSUB); if (status) { (void)cpl_error_set_regex(CPL_ERROR_ILLEGAL_INPUT, status, &filter.re, "regexp='%s', invert=%d", regexp, invert); return -1; } filter.invert = invert == 0 ? FALSE : TRUE; first = cx_deque_begin(self->properties); last = cx_deque_end(self->properties); while (first < cx_deque_end(self->properties)) { pos = first; p = cx_deque_get(self->properties, pos); if (_cpl_propertylist_compare_regexp(p, &filter) == TRUE) { cx_deque_erase(self->properties, pos, (cx_free_func)cpl_property_delete); count++; } else { first = cx_deque_next(self->properties, first); } } regfree(&filter.re); return count; } /** * @brief * Remove all properties from a property list. * * @param self A property list. * * @return Nothing. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function removes all properties from @em self. Each property * is properly deallocated. After calling this function @em self is * empty. */ void cpl_propertylist_empty(cpl_propertylist *self) { cx_deque_iterator first; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return; } first = cx_deque_begin(self->properties); /* cx_deque_end changes its value everytime cx_deque_erase() * is called. The elements are shifted from end to begin every * time an element is erased, therefore we always erase element * first with a value of 0. */ while (first < cx_deque_end(self->properties)) { cx_deque_iterator pos = first; cx_deque_erase(self->properties, pos, (cx_free_func)cpl_property_delete); } return; } /** * @brief * Update a property list with a character value. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The character value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_TYPE_MISMATCH * The property list self contains a property with the * name name which is not of type CPL_TYPE_CHAR. *
* @enderror * * The function updates the property list @em self with the character value * @em value. This means, if a property with the name @em name exists already * its value is updated, otherwise a property with the name @em name is * created and added to @em self. The update will fail if a property with * the name @em name exists already which is not of type @c CPL_TYPE_CHAR. */ cpl_error_code cpl_propertylist_update_char(cpl_propertylist *self, const char *name, char value) { cx_deque_iterator pos; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) { cpl_property *property = cpl_property_new(name, CPL_TYPE_CHAR); cx_assert(property != NULL); cpl_property_set_char(property, value); cx_deque_push_back(self->properties, property); } else { cpl_property *property = cx_deque_get(self->properties, pos); cx_assert(property != NULL); if (cpl_property_get_type(property) != CPL_TYPE_CHAR) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } cpl_property_set_char(property, value); } return CPL_ERROR_NONE; } /** * @brief * Update a property list with a boolean value. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The boolean value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_TYPE_MISMATCH * The property list self contains a property with the * name name which is not of type CPL_TYPE_BOOL. *
* @enderror * * The function updates the property list @em self with the boolean value * @em value. This means, if a property with the name @em name exists already * its value is updated, otherwise a property with the name @em name is * created and added to @em self. The update will fail if a property with * the name @em name exists already which is not of type @c CPL_TYPE_BOOL. */ cpl_error_code cpl_propertylist_update_bool(cpl_propertylist *self, const char *name, int value) { cx_deque_iterator pos; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) { cpl_property *property = cpl_property_new(name, CPL_TYPE_BOOL); cx_assert(property != NULL); cpl_property_set_bool(property, value); cx_deque_push_back(self->properties, property); } else { cpl_property *property = cx_deque_get(self->properties, pos); cx_assert(property != NULL); if (cpl_property_get_type(property) != CPL_TYPE_BOOL) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } cpl_property_set_bool(property, value); } return CPL_ERROR_NONE; } /** * @brief * Update a property list with a integer value. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The integer value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_TYPE_MISMATCH * The property list self contains a property with the * name name which is not of type CPL_TYPE_INT. *
* @enderror * * The function updates the property list @em self with the integer value * @em value. This means, if a property with the name @em name exists already * its value is updated, otherwise a property with the name @em name is * created and added to @em self. The update will fail if a property with * the name @em name exists already which is not of type @c CPL_TYPE_INT. */ cpl_error_code cpl_propertylist_update_int(cpl_propertylist *self, const char *name, int value) { cx_deque_iterator pos; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) { cpl_property *property = cpl_property_new(name, CPL_TYPE_INT); cx_assert(property != NULL); cpl_property_set_int(property, value); cx_deque_push_back(self->properties, property); } else { cpl_property *property = cx_deque_get(self->properties, pos); cx_assert(property != NULL); if (cpl_property_get_type(property) != CPL_TYPE_INT) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } cpl_property_set_int(property, value); } return CPL_ERROR_NONE; } /** * @brief * Update a property list with a long value. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The long value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_TYPE_MISMATCH * The property list self contains a property with the * name name which is not of type CPL_TYPE_LONG. *
* @enderror * * The function updates the property list @em self with the long value * @em value. This means, if a property with the name @em name exists already * its value is updated, otherwise a property with the name @em name is * created and added to @em self. The update will fail if a property with * the name @em name exists already which is not of type @c CPL_TYPE_LONG. */ cpl_error_code cpl_propertylist_update_long(cpl_propertylist *self, const char *name, long value) { cx_deque_iterator pos; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) { cpl_property *property = cpl_property_new(name, CPL_TYPE_LONG); cx_assert(property != NULL); cpl_property_set_long(property, value); cx_deque_push_back(self->properties, property); } else { cpl_property *property = cx_deque_get(self->properties, pos); cx_assert(property != NULL); if (cpl_property_get_type(property) != CPL_TYPE_LONG) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } cpl_property_set_long(property, value); } return CPL_ERROR_NONE; } /** * @brief * Update a property list with a long long value. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The long long value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_TYPE_MISMATCH * The property list self contains a property with the * name name which is not of type CPL_TYPE_LONG_LONG. *
* @enderror * * The function updates the property list @em self with the long long value * @em value. This means, if a property with the name @em name exists already * its value is updated, otherwise a property with the name @em name is * created and added to @em self. The update will fail if a property with * the name @em name exists already which is not of type @c CPL_TYPE_LONG_LONG. */ cpl_error_code cpl_propertylist_update_long_long(cpl_propertylist *self, const char *name, long long value) { cx_deque_iterator pos; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) { cpl_property *property = cpl_property_new(name, CPL_TYPE_LONG_LONG); cx_assert(property != NULL); cpl_property_set_long_long(property, value); cx_deque_push_back(self->properties, property); } else { cpl_property *property = cx_deque_get(self->properties, pos); cx_assert(property != NULL); if (cpl_property_get_type(property) != CPL_TYPE_LONG_LONG) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } cpl_property_set_long_long(property, value); } return CPL_ERROR_NONE; } /** * @brief * Update a property list with a float value. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The float value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_TYPE_MISMATCH * The property list self contains a property with the * name name which is not of type CPL_TYPE_FLOAT. *
* @enderror * * The function updates the property list @em self with the float value * @em value. This means, if a property with the name @em name exists already * its value is updated, otherwise a property with the name @em name is * created and added to @em self. The update will fail if a property with * the name @em name exists already which is not of type @c CPL_TYPE_FLOAT. */ cpl_error_code cpl_propertylist_update_float(cpl_propertylist *self, const char *name, float value) { cx_deque_iterator pos; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) { cpl_property *property = cpl_property_new(name, CPL_TYPE_FLOAT); cx_assert(property != NULL); cpl_property_set_float(property, value); cx_deque_push_back(self->properties, property); } else { cpl_property *property = cx_deque_get(self->properties, pos); cx_assert(property != NULL); if (cpl_property_get_type(property) != CPL_TYPE_FLOAT) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } cpl_property_set_float(property, value); } return CPL_ERROR_NONE; } /** * @brief * Update a property list with a double value. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The double value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_TYPE_MISMATCH * The property list self contains a property with the * name name which is not of type CPL_TYPE_DOUBLE. *
* @enderror * * The function updates the property list @em self with the double value * @em value. This means, if a property with the name @em name exists already * its value is updated, otherwise a property with the name @em name is * created and added to @em self. The update will fail if a property with * the name @em name exists already which is not of type @c CPL_TYPE_DOUBLE. */ cpl_error_code cpl_propertylist_update_double(cpl_propertylist *self, const char *name, double value) { cx_deque_iterator pos; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) { cpl_property *property = cpl_property_new(name, CPL_TYPE_DOUBLE); cx_assert(property != NULL); cpl_property_set_double(property, value); cx_deque_push_back(self->properties, property); } else { cpl_property *property = cx_deque_get(self->properties, pos); cx_assert(property != NULL); if (cpl_property_get_type(property) != CPL_TYPE_DOUBLE) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } cpl_property_set_double(property, value); } return CPL_ERROR_NONE; } /** * @brief * Update a property list with a string value. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The string value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, name or value is a * NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property list self contains a property with the * name name which is not of type CPL_TYPE_STRING. *
* @enderror * * The function updates the property list @em self with the string value * @em value. This means, if a property with the name @em name exists already * its value is updated, otherwise a property with the name @em name is * created and added to @em self. The update will fail if a property with * the name @em name exists already which is not of type @c CPL_TYPE_STRING. */ cpl_error_code cpl_propertylist_update_string(cpl_propertylist *self, const char *name, const char *value) { cx_deque_iterator pos; if (self == NULL || name == NULL || value == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) { cpl_property *property = cpl_property_new(name, CPL_TYPE_STRING); cx_assert(property != NULL); cpl_property_set_string(property, value); cx_deque_push_back(self->properties, property); } else { cpl_property *property = cx_deque_get(self->properties, pos); cx_assert(property != NULL); if (cpl_property_get_type(property) != CPL_TYPE_STRING) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } cpl_property_set_string(property, value); } return CPL_ERROR_NONE; } /** * @brief * Update a property list with a float complex value. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The float complex value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_TYPE_MISMATCH * The property list self contains a property with the * name name which is not of type CPL_TYPE_FLOAT_COMPLEX. *
* @enderror * * The function updates the property list @em self with the float complex value * @em value. This means, if a property with the name @em name exists already * its value is updated, otherwise a property with the name @em name is * created and added to @em self. The update will fail if a property with * the name @em name exists already which is not of type * @c CPL_TYPE_FLOAT_COMPLEX. */ cpl_error_code cpl_propertylist_update_float_complex(cpl_propertylist *self, const char *name, float complex value) { cx_deque_iterator pos; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) { cpl_property *property = cpl_property_new(name, CPL_TYPE_FLOAT_COMPLEX); cx_assert(property != NULL); cpl_property_set_float_complex(property, value); cx_deque_push_back(self->properties, property); } else { cpl_property *property = cx_deque_get(self->properties, pos); cx_assert(property != NULL); if (cpl_property_set_float_complex(property, value)) { return cpl_error_set_where_(); } } return CPL_ERROR_NONE; } /** * @brief * Update a property list with a double complex value. * * @param self A property list. * @param name The property name to be assigned to the value. * @param value The double complex value to store. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
CPL_ERROR_TYPE_MISMATCH * The property list self contains a property with the * name name which is not of type * CPL_TYPE_DOUBLE_COMPLEX. *
* @enderror * * The function updates the property list @em self with the double complex value * @em value. This means, if a property with the name @em name exists already * its value is updated, otherwise a property with the name @em name is * created and added to @em self. The update will fail if a property with * the name @em name exists already which is not of type * @c CPL_TYPE_DOUBLE_COMPLEX. */ cpl_error_code cpl_propertylist_update_double_complex(cpl_propertylist *self, const char *name, double complex value) { cx_deque_iterator pos; if (self == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) { cpl_property *property = cpl_property_new(name, CPL_TYPE_DOUBLE_COMPLEX); cx_assert(property != NULL); cpl_property_set_double_complex(property, value); cx_deque_push_back(self->properties, property); } else { cpl_property *property = cx_deque_get(self->properties, pos); cx_assert(property != NULL); if (cpl_property_set_double_complex(property, value)) { cpl_error_set_where_(); } } return CPL_ERROR_NONE; } /** * @brief * Copy a property from another property list. * * @param self A property list. * @param other The property list from which a property is copied. * @param name The name of the property to copy. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, other or name is a * NULL pointer. *
CPL_ERROR_DATA_NOT_FOUND * The property list other does not contain a property with the * name name. *
CPL_ERROR_TYPE_MISMATCH * The property list self contains a property with the * name name which is not of the same type as the property * which should be copied from other. *
* @enderror * * The function copies the property @em name from the property list * @em other to the property list @em self. If the property list @em self * does not already contain a property @em name the property is appended * to @em self. If a property @em name exists already in @em self the * function overwrites the contents of this property if and only if this * property is of the same type as the property to be copied from @em other. */ cpl_error_code cpl_propertylist_copy_property(cpl_propertylist *self, const cpl_propertylist *other, const char *name) { cx_deque_iterator spos; cx_deque_iterator tpos; if (self == NULL || other == NULL || name == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } spos = _cpl_propertylist_find(other, name); if (spos == cx_deque_end(other->properties)) { return cpl_error_set_message_(CPL_ERROR_DATA_NOT_FOUND, "%s", name); } tpos = _cpl_propertylist_find(self, name); if (tpos == cx_deque_end(self->properties)) { cpl_property *p = cpl_property_duplicate(cx_deque_get(other->properties, spos)); cx_deque_push_back(self->properties, p); } else { cpl_property *p = cx_deque_get(self->properties, tpos); cpl_property *_p = cx_deque_get(other->properties, spos); if (cpl_property_get_type(p) != cpl_property_get_type(_p)) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } switch (cpl_property_get_type(_p)) { case CPL_TYPE_CHAR: cpl_property_set_char(p, cpl_property_get_char(_p)); break; case CPL_TYPE_BOOL: cpl_property_set_bool(p, cpl_property_get_bool(_p)); break; case CPL_TYPE_INT: cpl_property_set_int(p, cpl_property_get_int(_p)); break; case CPL_TYPE_LONG: cpl_property_set_long(p, cpl_property_get_long(_p)); break; case CPL_TYPE_FLOAT: cpl_property_set_float(p, cpl_property_get_float(_p)); break; case CPL_TYPE_DOUBLE: cpl_property_set_double(p, cpl_property_get_double(_p)); break; case CPL_TYPE_STRING: cpl_property_set_string(p, cpl_property_get_string(_p)); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_property_set_float_complex(p, cpl_property_get_float_complex(_p)); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_property_set_double_complex(p, cpl_property_get_double_complex(_p)); break; default: /* This point should never be reached */ return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); break; } cpl_property_set_comment(p, cpl_property_get_comment(_p)); } return CPL_ERROR_NONE; } /** * @brief * Copy matching properties from another property list. * * @param self A property list. * @param other The property list from which a property is copied. * @param regexp The regular expression used to select properties. * @param invert Flag inverting the sense of matching. * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, other or regexp is a * NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter regexp is an invalid regular expression. *
CPL_ERROR_TYPE_MISMATCH * The property list self contains a property with the * name name which is not of the same type as the property * which should be copied from other. *
* @enderror * * The function copies all properties with matching names from the property * list @em other to the property list @em self. If the flag @em invert is * zero, all properties whose names match the regular expression @em regexp * are copied. If @em invert is set to a non-zero value, all properties with * names not matching @em regexp are copied rather. The function expects * POSIX 1003.2 compliant extended regular expressions. * * If the property list @em self does not already contain one of the * properties to be copied this property is appended to @em self. If a * property to be copied exists already in @em self the function overwrites * the contents of this property. * * Before properties are copied from the property list @em other to @em self * the types of the properties are checked and if any type mismatch is * detected the function stops processing immediately. The property list * @em self is not at all modified in this case. * * @see cpl_propertylist_copy_property() */ cpl_error_code cpl_propertylist_copy_property_regexp(cpl_propertylist *self, const cpl_propertylist *other, const char *regexp, int invert) { cxint status; cxsize i; cxsize count = 0; cx_deque_const_iterator first, last; typedef struct _property_pair_ { cpl_property *s; cpl_property *t; } property_pair; property_pair *pairs = NULL; cpl_regexp filter; if (self == NULL || other == NULL || regexp == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } status = regcomp(&filter.re, regexp, REG_EXTENDED | REG_NOSUB); if (status) { (void)cpl_error_set_regex(CPL_ERROR_ILLEGAL_INPUT, status, &filter.re, "regexp='%s', invert=%d", regexp, invert); return CPL_ERROR_ILLEGAL_INPUT; } filter.invert = invert == 0 ? FALSE : TRUE; count = cx_deque_size(other->properties); if (count == 0) { regfree(&filter.re); return CPL_ERROR_NONE; } pairs = cx_malloc(count * sizeof(property_pair)); cx_assert(pairs != NULL); count = 0; first = cx_deque_begin(other->properties); last = cx_deque_end(other->properties); while (first != last) { cpl_property *p = cx_deque_get(other->properties, first); if (_cpl_propertylist_compare_regexp(p, &filter) == TRUE) { const cxchar *name = cpl_property_get_name(p); cx_deque_const_iterator pos = _cpl_propertylist_find(self, name); cpl_property *_p = NULL; if (pos != cx_deque_end(self->properties)) { _p = cx_deque_get(self->properties, pos); if (cpl_property_get_type(p) != cpl_property_get_type(_p)) { regfree(&filter.re); cx_free(pairs); pairs = NULL; cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return CPL_ERROR_TYPE_MISMATCH; } } pairs[count].s = p; pairs[count].t = _p; ++count; } first = cx_deque_next(other->properties, first); } regfree(&filter.re); for (i = 0; i < count; i++) { if (pairs[i].t == NULL) { cpl_property *p = cpl_property_duplicate(pairs[i].s); cx_deque_push_back(self->properties, p); } else { switch (cpl_property_get_type(pairs[i].s)) { case CPL_TYPE_CHAR: cpl_property_set_char(pairs[i].t, cpl_property_get_char(pairs[i].s)); break; case CPL_TYPE_BOOL: cpl_property_set_bool(pairs[i].t, cpl_property_get_bool(pairs[i].s)); break; case CPL_TYPE_INT: cpl_property_set_int(pairs[i].t, cpl_property_get_int(pairs[i].s)); break; case CPL_TYPE_LONG: cpl_property_set_long(pairs[i].t, cpl_property_get_long(pairs[i].s)); break; case CPL_TYPE_FLOAT: cpl_property_set_float(pairs[i].t, cpl_property_get_float(pairs[i].s)); break; case CPL_TYPE_DOUBLE: cpl_property_set_double(pairs[i].t, cpl_property_get_double(pairs[i].s)); break; case CPL_TYPE_STRING: cpl_property_set_string(pairs[i].t, cpl_property_get_string(pairs[i].s)); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_property_set_float_complex(pairs[i].t, cpl_property_get_float_complex(pairs[i].s)); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_property_set_double_complex(pairs[i].t, cpl_property_get_double_complex(pairs[i].s)); break; default: /* This point should never be reached */ cx_free(pairs); return cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); break; } } } cx_free(pairs); return CPL_ERROR_NONE; } /** * @brief * Sort a property list. * * @param self The property list to sort. * @param compare The function used to compare two properties. * * @return * The function returns @c CPL_ERROR_NONE on success, or a CPL error code * otherwise. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function sorts the property list @em self in place, using the function * @em compare to determine whether a property is less, equal or greater than * another one. * * The function @em compare must be of the type cpl_propertylist_compare_func. * * @see * cpl_propertylist_compare_func */ /*cpl_error_code cpl_propertylist_sort(cpl_propertylist* self, int (*compare)(const void*, const void*))*/ cpl_error_code cpl_propertylist_sort(cpl_propertylist* self, cpl_propertylist_compare_func compare) { cx_compare_func _compare = (cx_compare_func)compare; if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_deque_sort(self->properties, _compare); return CPL_ERROR_NONE; } /** * @brief * Create a property list from a file. * * @param name Name of the input file. * @param position Index of the data set to read. * * @return * The function returns the newly created property list or @c NULL if an * error occurred. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter name is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The position is less than 0 or the properties cannot be * read from the file name. *
CPL_ERROR_FILE_IO * The file name does not exist. *
CPL_ERROR_BAD_FILE_FORMAT * The file name is not a valid FITS file. *
CPL_ERROR_DATA_NOT_FOUND * The requested data set at index position does not exist. *
* @enderror * * The function reads the properties of the data set with index @em position * from the file @em name. * * Currently only the FITS file format is supported. The property list is * created by reading the FITS keywords from extension @em position. The * numbering of the data sections starts from 0. * When creating the property list from a FITS header, any keyword without * a value such as undefined keywords, are not transformed into * a property. In the case of float or double (complex) keywords, there is no * way to identify the type returned by CFITSIO, therefore this function will * always load them as double (complex). * * @see cpl_propertylist_load_regexp() */ cpl_propertylist * cpl_propertylist_load(const char *name, cpl_size position) { cxint status = 0; cpl_propertylist *self; cpl_error_code code; fitsfile *file = NULL; if (name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if ((position < 0) || (position > CX_MAXINT)) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return NULL; } if (cpl_io_fits_open_diskfile(&file, name, READONLY, &status)) { (void)cpl_error_set_fits(status == FILE_NOT_OPENED ? CPL_ERROR_FILE_IO : CPL_ERROR_BAD_FILE_FORMAT, status, fits_open_diskfile, "filename='%s', " "position=%d", name, (cxint)position); return NULL; } self = cpl_propertylist_new(); code = _cpl_propertylist_fill_from_fits(self, file, (cxint)position, NULL, NULL); if (cpl_io_fits_close_file(file, &status)) { code = cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, status, fits_close_file, "filename='%s', " "position=%d", name, (cxint)position); } else if (code) { /* * Propagate error */ cpl_error_set_where_(); } if (code) { cpl_propertylist_delete(self); self = NULL; } return self; } /** * @brief * Create a filtered property list from a file. * * @param name Name of the input file. * @param position Index of the data set to read. * @param regexp Regular expression used to filter properties. * @param invert Flag inverting the sense of matching property names. * * @return * The function returns the newly created property list or @c NULL if an * error occurred. * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter name or the parameter regexp is a * NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The position is less than 0, the properties cannot be * read from the file name, or regexp is not a valid * extended regular expression. *
CPL_ERROR_FILE_IO * The file name does not exist. *
CPL_ERROR_BAD_FILE_FORMAT * The file name is not a valid FITS file. *
CPL_ERROR_DATA_NOT_FOUND * The requested data set at index position does not exist. *
* @enderror * * The function reads all properties of the data set with index @em position * with matching names from the file @em name. If the flag @em invert is zero, * all properties whose names match the regular expression @em regexp are * read. If @em invert is set to a non-zero value, all properties with * names not matching @em regexp are read rather. The function expects * POSIX 1003.2 compliant extended regular expressions. * * Currently only the FITS file format is supported. The property list is * created by reading the FITS keywords from extension @em position. * The numbering of the data sections starts from 0. * * When creating the property list from a FITS header, any keyword without * a value such as undefined keywords, are not transformed into * a property. In the case of float or double (complex) keywords, there is no * way to identify the type returned by CFITSIO, therefore this function will * always load them as double (complex). * * FITS format specific keyword prefixes (e.g. @c HIERARCH) must * not be part of the given pattern string @em regexp, but only the actual * FITS keyword name may be given. * * @see cpl_propertylist_load() */ cpl_propertylist * cpl_propertylist_load_regexp(const char *name, cpl_size position, const char *regexp, int invert) { cxint status = 0; cpl_propertylist *self; cpl_regexp filter; cpl_error_code code; fitsfile *file = NULL; if (name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if ((position < 0) || (position > CX_MAXINT)) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return NULL; } if (regexp == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } /* * Set up the regular expression filter */ status = regcomp(&filter.re, regexp, REG_EXTENDED | REG_NOSUB); if (status) { (void)cpl_error_set_regex(CPL_ERROR_ILLEGAL_INPUT, status, &filter.re, "regexp='%s', invert=%d", regexp, invert); return NULL; } filter.invert = invert == 0 ? FALSE : TRUE; if (cpl_io_fits_open_diskfile(&file, name, READONLY, &status)) { (void)cpl_error_set_fits(status == FILE_NOT_OPENED ? CPL_ERROR_FILE_IO : CPL_ERROR_BAD_FILE_FORMAT, status, fits_open_diskfile, "filename='%s', " "position=%d, regexp='%s'", name, (cxint)position, regexp); status = 0; cpl_io_fits_close_file(file, &status); regfree(&filter.re); return NULL; } self = cpl_propertylist_new(); code = _cpl_propertylist_fill_from_fits(self, file, (cxint)position, _cpl_propertylist_filter_regexp, &filter); regfree(&filter.re); if (cpl_io_fits_close_file(file, &status)) { code = cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, status, fits_close_file, "filename='%s', position=" "%d, regexp='%s'", name, (cxint)position, regexp); } else if (code) { /* * Propagate error */ cpl_error_set_(code); } if (code) { cpl_propertylist_delete(self); self = NULL; } return self; } /** * @internal * @brief * Write a property list to a FITS file. * * @param file The FITS file to write to. * @param properties The property list to write to the file. * @param to_rm The regular expression used to filter properties * * @return * The function returns @c CPL_ERROR_NONE on success, or an appropriate * error code otherwise. * * This function takes a sorted property list and appends it to the * provided FITS file. All properties with names matching the regular expression * @c to_rm will not be copied to the output. The function expects * POSIX 1003.2 compliant extended regular expressions. */ cpl_error_code cpl_propertylist_to_fitsfile(fitsfile *file, const cpl_propertylist *self, const char *to_rm) { cpl_regexp filter; cpl_error_code error; if (file == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } if (to_rm != NULL) { /* A regular expression must be applied */ const cxint rstatus = regcomp(&filter.re, to_rm, REG_EXTENDED | REG_NOSUB); if (rstatus) { return cpl_error_set_regex(CPL_ERROR_ILLEGAL_INPUT, rstatus, &filter.re, "to_rm='%s'", to_rm); } filter.invert = 0; } error = _cpl_propertylist_to_fitsfile(file, self, _cpl_propertylist_filter_regexp, to_rm ? &filter : NULL); if (to_rm != NULL) { regfree(&filter.re); } return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @internal * @brief * Create a property list from a cfitsio FITS file. * * @param file FITS file pointing to the header to convert. * * @return The function returns the created property list, or @c NULL * in case of an error. * * The function converts the FITS keywords from the current HDU of the FITS * file @em file into properties and puts them into a property list. * * The special FITS keyword END indicating the end of a FITS header is not * transformed into a property, but simply ignored. * * In case of an error, an appropriate error code is set. If a FITS header * card cannot be parsed the error code is set to @c CPL_ERROR_ILLEGAL_INPUT * or to @c CPL_ERROR_INVALID_TYPE if a FITS keyword type is not supported. * If @em file is @c NULL the error code is set to @c CPL_ERROR_NULL_INPUT. */ cpl_propertylist * cpl_propertylist_from_fitsfile(fitsfile *file) { cpl_propertylist *self; cpl_ensure(file != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_propertylist_new(); if (_cpl_propertylist_fill_from_fits(self, file, 0, NULL, NULL)) { cpl_propertylist_delete(self); self = NULL; cpl_error_set_where_(); } return self; } /** * @brief * Access property list elements by property name. * * @param self The property list to query. * @param name The name of the property to retrieve. * * @return * The function returns the property with name @em name, or @c NULL * if it does not exist. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or the name is a NULL pointer. *
* @enderror * * The function returns a handle to the property list element, the property, * with the name @em name. If more than one property exist with the same * @em name, then the first one found will be returned. */ const cpl_property * cpl_propertylist_get_property_const(const cpl_propertylist *self, const char *name) { cx_deque_iterator pos; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if (name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } pos = _cpl_propertylist_find(self, name); if (pos == cx_deque_end(self->properties)) return NULL; return cx_deque_get(self->properties, pos); } /** * @brief * Access property list elements by property name. * * @param self The property list to query. * @param name The name of the property to retrieve. * * @return * The function returns the property with name @em name, or @c NULL * if it does not exist. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or the name is a NULL pointer. *
* @enderror * * The function returns a handle to the property list element, the property, * with the name @em name. If more than one property exist with the same * @em name, then the first one found will be returned. */ cpl_property * cpl_propertylist_get_property(cpl_propertylist *self, const char *name) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_property *property = (cpl_property *)cpl_propertylist_get_property_const(self, name); if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where_(); return property; } /** * @brief * Save a property list to a FITS file * * @param self The property list to save or NULL if empty * @param filename Name of the file to write * @param mode The desired output options (combined with bitwise or) * * @return * CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The filename is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The parameter mode is invalid. *
CPL_ERROR_FILE_IO * The file cannot be written or accessed. *
* @enderror * * This function saves a property list to a FITS file, using cfitsio. * The data unit is empty. * * Supported output modes are CPL_IO_CREATE (create a new file) and * CPL_IO_EXTEND (append to an existing file) */ cpl_error_code cpl_propertylist_save(const cpl_propertylist *self, const char *filename, unsigned mode) { const cxchar *badkeys = mode & CPL_IO_EXTEND ? CPL_FITS_BADKEYS_EXT "|" CPL_FITS_COMPRKEYS : CPL_FITS_BADKEYS_PRIM "|" CPL_FITS_COMPRKEYS; cxint error = 0; cpl_error_code code = CPL_ERROR_NONE; fitsfile *fptr; /* * Check entries */ cpl_ensure_code(filename, CPL_ERROR_NULL_INPUT); cpl_ensure_code(mode == CPL_IO_CREATE || mode == CPL_IO_EXTEND, CPL_ERROR_ILLEGAL_INPUT); /* Switch on the mode */ if (mode == CPL_IO_EXTEND) { /* Append */ /* Open the file */ if (cpl_io_fits_open_diskfile(&fptr, filename, READWRITE, &error)) { return cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_open_diskfile, "filename='%s', " "mode=%u", filename, mode); } } else { /* Main HDU */ /* Create the file */ cxchar *sval = cpl_sprintf("!%s", filename); cpl_io_fits_create_file(&fptr, sval, &error); cpl_free(sval); if (error != 0) { return cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_create_file, "filename='%s', " "mode=%u", filename, mode); } } /* Create empty header */ if (fits_create_img(fptr, BYTE_IMG, 0, NULL, &error)) { cxint error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_create_img, "filename='%s', mode=%u", filename, mode); } /* Add DATE */ if (mode != CPL_IO_EXTEND && fits_write_date(fptr, &error)) { cxint error2 = 0; cpl_io_fits_close_file(fptr, &error2); return cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_write_date, "filename='%s', mode=%u", filename, mode); } /* Add the property list */ if (cpl_fits_add_properties(fptr, self, badkeys)) { code = cpl_error_set_where_(); } /* Close (and write to disk) */ if (cpl_io_fits_close_file(fptr, &error)) { return cpl_error_set_fits(CPL_ERROR_FILE_IO, error, fits_close_file, "filename='%s', mode=%u", filename, mode); } return code; } /** * @brief * Print a property list. * * @param self Pointer to property list * @param stream The output stream * * @return Nothing. * * This function is mainly intended for debug purposes. * If the specified stream is @c NULL, it is set to @em stdout. * The function used for printing is the standard C @c fprintf(). */ void cpl_propertylist_dump(const cpl_propertylist *self, FILE *stream) { cxchar c = '\0'; cpl_size i = 0; cpl_size sz = cpl_propertylist_get_size(self); if (stream == NULL) stream = stdout; if (self == NULL) { fprintf(stream, "NULL property list\n\n"); return; } fprintf(stream, "Property list at address %p:\n", (cxcptr)self); for (i = 0; i < sz; i++) { const cpl_property *p = cpl_propertylist_get_const(self, i); const cxchar *name = cpl_property_get_name(p); const cxchar *comment = cpl_property_get_comment(p); cpl_size size = cpl_property_get_size(p); cpl_type type = cpl_property_get_type(p); const cxchar *typestr = cpl_type_get_name(type); fprintf(stream, "Property at address %p\n", (cxcptr)p); fprintf(stream, "\tname : %p '%s'\n", name, name); fprintf(stream, "\tcomment: %p '%s'\n", comment, comment); fprintf(stream, "\ttype : %#09x '%s'\n", type, typestr); fprintf(stream, "\tsize : %ld\n", size); fprintf(stream, "\tvalue : "); switch (type) { case CPL_TYPE_CHAR: c = cpl_property_get_char(p); if (!c) fprintf(stream, "''"); else fprintf(stream, "'%c'", c); break; case CPL_TYPE_BOOL: fprintf(stream, "%d", cpl_property_get_bool(p)); break; case CPL_TYPE_INT: fprintf(stream, "%d", cpl_property_get_int(p)); break; case CPL_TYPE_LONG: fprintf(stream, "%ld", cpl_property_get_long(p)); break; case CPL_TYPE_LONG_LONG: fprintf(stream, "%lld", cpl_property_get_long_long(p)); break; case CPL_TYPE_FLOAT: fprintf(stream, "%.7g", cpl_property_get_float(p)); break; case CPL_TYPE_DOUBLE: fprintf(stream, "%.15g", cpl_property_get_double(p)); break; case CPL_TYPE_STRING: fprintf(stream, "'%s'", cpl_property_get_string(p)); break; case CPL_TYPE_FLOAT_COMPLEX: { /* Print with FITS header format */ const float complex z = cpl_property_get_float_complex(p); fprintf(stream, "(%.7g,%.7g)", crealf(z), cimagf(z)); break; } case CPL_TYPE_DOUBLE_COMPLEX: { /* Print with FITS header format */ const double complex z = cpl_property_get_double_complex(p); fprintf(stream, "(%.15g,%.15g)", creal(z), cimag(z)); break; } default: fprintf(stream, "unknown."); break; } fprintf(stream, "\n"); } return; } /** * @brief * Append a property to a property list * * @param self Property list to append to * @param property The property to append * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or property is a NULL pointer. *
* @enderror * * This function creates a new property and appends it to the end of a property list. * It will not check if the property already exists. */ cpl_error_code cpl_propertylist_append_property(cpl_propertylist *self, const cpl_property *property) { if((self == NULL) || (property == NULL)){ return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_deque_push_back(self->properties, cpl_property_duplicate(property)); return CPL_ERROR_NONE; } /** * @brief * Prepend a property to a property list * * @param self Property list to prepend to * @param property The property to prepend * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or property is a NULL pointer. *
* @enderror * * This function creates a new property and prepends it to the beginning of a property list. * It will not check if the property already exists. */ cpl_error_code cpl_propertylist_prepend_property(cpl_propertylist *self, const cpl_property *property) { if((self == NULL) || (property == NULL)){ return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_deque_push_front(self->properties, cpl_property_duplicate(property)); return CPL_ERROR_NONE; } /** * @brief * Insert a property into a property list at the given position * * @param self Property list * @param here Name indicating the position where to insert the property * @param property The property to insert * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, property or here is a NULL pointer. *
* @enderror * * The function creates a new property and inserts it into the property list * @em self at the position of the property named @em here. */ cpl_error_code cpl_propertylist_insert_property(cpl_propertylist *self, const char *here, const cpl_property *property) { cx_deque_iterator pos; if (self == NULL || here == NULL || property == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } /* * Find the position where property should be inserted. */ pos = _cpl_propertylist_find(self, here); if (pos == cx_deque_end(self->properties)) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } /* * Insert it into the deque */ cx_deque_insert(self->properties, pos, cpl_property_duplicate(property)); return CPL_ERROR_NONE; } /** * @brief * Insert a property into a property list after the given position * * @param self Property list * @param after Name of the property after which to insert the property * @param property The property to insert * * @return * The function returns @c CPL_ERROR_NONE on success or a CPL error * code otherwise. * * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self, property or after is a NULL pointer. *
* @enderror * * The function creates a new property and inserts it into the property list * @em self after the position of the property named @em after. */ cpl_error_code cpl_propertylist_insert_after_property(cpl_propertylist *self, const char *after, const cpl_property *property) { cx_deque_iterator pos; if (self == NULL || after == NULL || property == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } /* * Find the position where property should be inserted. */ pos = _cpl_propertylist_find(self, after); if (pos == cx_deque_end(self->properties)) { return cpl_error_set_(CPL_ERROR_UNSPECIFIED); } /* * Get the position after it */ pos = cx_deque_next(self->properties, pos); /* * Insert it into the deque */ cx_deque_insert(self->properties, pos, cpl_property_duplicate(property)); return CPL_ERROR_NONE; } /**@}*/ cpl-6.4.1/cplcore/cpl_memory.h0000644000460300003120000000347311466733006013175 00000000000000/* $Id: cpl_memory.h,v 1.22 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.22 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_MEMORY_H #define CPL_MEMORY_H #include #include #include /*---------------------------------------------------------------------------- Function prototypes ----------------------------------------------------------------------------*/ CPL_BEGIN_DECLS void *cpl_malloc(size_t) CPL_ATTR_MALLOC; void *cpl_calloc(size_t, size_t) CPL_ATTR_CALLOC; void *cpl_realloc(void *, size_t) CPL_ATTR_REALLOC; void cpl_free(void *); char *cpl_strdup(const char *) CPL_ATTR_ALLOC; char *cpl_vsprintf(const char *, va_list) CPL_ATTR_ALLOC CPL_ATTR_PRINTF(1, 0); char *cpl_sprintf (const char *, ...) CPL_ATTR_ALLOC CPL_ATTR_PRINTF(1, 2); int cpl_memory_is_empty(void) CPL_ATTR_PURE; void cpl_memory_dump(void); CPL_END_DECLS #endif /* CPL_MEMORY_H */ cpl-6.4.1/cplcore/cpl_imagelist.h0000644000460300003120000000410111547545260013633 00000000000000/* $Id: cpl_imagelist.h,v 1.7 2011-04-08 08:43:28 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-04-08 08:43:28 $ * $Revision: 1.7 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGELIST_H #define CPL_IMAGELIST_H /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ typedef struct _cpl_imagelist_ cpl_imagelist; /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_imagelist_io.h" #include "cpl_imagelist_basic.h" /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_imagelist Imagelists * * This module provides functions to create, use, and destroy a * @em cpl_imagelist. * A @em cpl_imagelist is an ordered list of cpl_images. All images in a list * must have the same pixel-type and the same dimensions. * * @par Synopsis: * @code * #include "cpl_imagelist.h" * @endcode */ /*----------------------------------------------------------------------------*/ #endif cpl-6.4.1/cplcore/cpl_array.c0000644000460300003120000046755412136507471013014 00000000000000/* $Id: cpl_array.c,v 1.48 2013-04-26 14:29:13 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-26 14:29:13 $ * $Revision: 1.48 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include #include "cpl_memory.h" #include #include "cpl_tools.h" #include #include #include #include #include /** * @defgroup cpl_array Arrays * * This module provides functions to create, destroy and use a @em cpl_array. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * The array type (private); */ struct _cpl_array_ { cpl_column *column; }; /** * @brief * Create a new array of given type. * * @param length Number of elements in array. * @param type Type of array * * @return Pointer to the new array, or @c NULL in case of error. * * This function allocates memory for an array, its type is assigned, * and its number of elements is allocated. Only arrays of types * @c CPL_TYPE_INT, @c CPL_TYPE_FLOAT, @c CPL_TYPE_DOUBLE, * @c CPL_TYPE_FLOAT_COMPLEX, @c CPL_TYPE_DOUBLE_COMPLEX and * @c CPL_TYPE_STRING, are supported. An error @c CPL_ERROR_INVALID_TYPE * is set in case other types are specified. All array elements are * initially flagged as invalid. If a negative length is specified, * an error @c CPL_ERROR_ILLEGAL_INPUT is set. Zero length arrays are * allowed. */ cpl_array *cpl_array_new(cpl_size length, cpl_type type) { cpl_column *column; cpl_array *array; switch(type) { case CPL_TYPE_INT: column = cpl_column_new_int(length); break; case CPL_TYPE_LONG: column = cpl_column_new_long(length); break; case CPL_TYPE_LONG_LONG: column = cpl_column_new_long_long(length); break; case CPL_TYPE_SIZE: column = cpl_column_new_cplsize(length); break; case CPL_TYPE_FLOAT: column = cpl_column_new_float(length); break; case CPL_TYPE_DOUBLE: column = cpl_column_new_double(length); break; case CPL_TYPE_FLOAT_COMPLEX: column = cpl_column_new_float_complex(length); break; case CPL_TYPE_DOUBLE_COMPLEX: column = cpl_column_new_double_complex(length); break; case CPL_TYPE_STRING: column = cpl_column_new_string(length); break; default: cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if (column == NULL) { cpl_error_set_where_(); return NULL; } array = cpl_calloc(1, sizeof(cpl_array)); array->column = column; return array; } /** * @brief * Create a new @em integer array from existing data. * * @param data Existing data buffer. * @param length Number of elements in array. * * @return Pointer to the new array, or @c NULL in case of error. * * This function creates a new @em integer array that will encapsulate * the given data. Note that the size of the data buffer is not checked in * any way, and that the data values are all considered valid: invalid * values should be marked using the functions @c cpl_array_set_invalid() * The data array is not copied, so it should never be deallocated: to * deallocate it, the function @c cpl_array_delete() should be called * instead. Alternatively, the function @c cpl_array_unwrap() might be * used, and the data array deallocated afterwards. A zero or negative * length is illegal, and would cause an error @c CPL_ERROR_ILLEGAL_INPUT * to be set. An input @c NULL pointer would set an error * @c CPL_ERROR_NULL_INPUT. * * @note * Functions that handle arrays assume that an array data buffer * is dynamically allocated: with a statically allocated data buffer * any function implying memory handling (@c cpl_array_set_size(), * @c cpl_array_delete(), etc.) would crash the program. This means * that a static data buffer should never be passed to this function * if memory handling is planned. In case of a static data buffer, * only the @c cpl_array_unwrap() destructor can be used. */ cpl_array *cpl_array_wrap_int(int *data, cpl_size length) { cpl_column *column; cpl_array *array; column = cpl_column_wrap_int(data, length); if (column == NULL) { cpl_error_set_where_(); return NULL; } array = cpl_calloc(1, sizeof(cpl_array)); array->column = column; return array; } /** * @brief * Create a new @em long @em integer array from existing data. * * @param data Existing data buffer. * @param length Number of elements in array. * * @return Pointer to the new array, or @c NULL in case of error. * * This function creates a new @em long @em integer array that will encapsulate * the given data. Note that the size of the data buffer is not checked in * any way, and that the data values are all considered valid: invalid * values should be marked using the functions @c cpl_array_set_invalid() * The data array is not copied, so it should never be deallocated: to * deallocate it, the function @c cpl_array_delete() should be called * instead. Alternatively, the function @c cpl_array_unwrap() might be * used, and the data array deallocated afterwards. A zero or negative * length is illegal, and would cause an error @c CPL_ERROR_ILLEGAL_INPUT * to be set. An input @c NULL pointer would set an error * @c CPL_ERROR_NULL_INPUT. * * @note * Functions that handle arrays assume that an array data buffer * is dynamically allocated: with a statically allocated data buffer * any function implying memory handling (@c cpl_array_set_size(), * @c cpl_array_delete(), etc.) would crash the program. This means * that a static data buffer should never be passed to this function * if memory handling is planned. In case of a static data buffer, * only the @c cpl_array_unwrap() destructor can be used. */ cpl_array *cpl_array_wrap_long(long *data, cpl_size length) { cpl_column *column; cpl_array *array; column = cpl_column_wrap_long(data, length); if (column == NULL) { cpl_error_set_where_(); return NULL; } array = cpl_calloc(1, sizeof(cpl_array)); array->column = column; return array; } /** * @brief * Create a new @em long @em long @em integer array from existing data. * * @param data Existing data buffer. * @param length Number of elements in array. * * @return Pointer to the new array, or @c NULL in case of error. * * This function creates a new @em long @em long @em integer array that * will encapsulate the given data. Note that the size of the data buffer * is not checked in any way, and that the data values are all considered * valid: invalid values should be marked using the functions * @c cpl_array_set_invalid() The data array is not copied, so it should never * be deallocated: to deallocate it, the function @c cpl_array_delete() * should be called instead. Alternatively, the function @c cpl_array_unwrap() * might be used, and the data array deallocated afterwards. A zero or negative * length is illegal, and would cause an error @c CPL_ERROR_ILLEGAL_INPUT * to be set. An input @c NULL pointer would set an error * @c CPL_ERROR_NULL_INPUT. * * @note * Functions that handle arrays assume that an array data buffer * is dynamically allocated: with a statically allocated data buffer * any function implying memory handling (@c cpl_array_set_size(), * @c cpl_array_delete(), etc.) would crash the program. This means * that a static data buffer should never be passed to this function * if memory handling is planned. In case of a static data buffer, * only the @c cpl_array_unwrap() destructor can be used. */ cpl_array *cpl_array_wrap_long_long(long long *data, cpl_size length) { cpl_column *column; cpl_array *array; column = cpl_column_wrap_long_long(data, length); if (column == NULL) { cpl_error_set_where_(); return NULL; } array = cpl_calloc(1, sizeof(cpl_array)); array->column = column; return array; } /** * @brief * Create a new @em cpl_size array from existing data. * * @param data Existing data buffer. * @param length Number of elements in array. * * @return Pointer to the new array, or @c NULL in case of error. * * This function creates a new @em cpl_size array that will encapsulate * the given data. Note that the size of the data buffer is not checked * in any way, and that the data values are all considered valid: invalid * values should be marked using the functions @c cpl_array_set_invalid(). * The data array is not copied, so it should never be deallocated: to * deallocate it, the function @c cpl_array_delete() should be called * instead. Alternatively, the function @c cpl_array_unwrap() might * be used, and the data array deallocated afterwards. A zero or negative * length is illegal, and would cause an error @c CPL_ERROR_ILLEGAL_INPUT * to be set. An input @c NULL pointer would set an error * @c CPL_ERROR_NULL_INPUT. * * @note * Functions that handle arrays assume that an array data buffer * is dynamically allocated: with a statically allocated data buffer * any function implying memory handling (@c cpl_array_set_size(), * @c cpl_array_delete(), etc.) would crash the program. This means * that a static data buffer should never be passed to this function * if memory handling is planned. In case of a static data buffer, * only the @c cpl_array_unwrap() destructor can be used. */ cpl_array *cpl_array_wrap_cplsize(cpl_size *data, cpl_size length) { cpl_column *column; cpl_array *array; column = cpl_column_wrap_cplsize(data, length); if (column == NULL) { cpl_error_set_where_(); return NULL; } array = cpl_calloc(1, sizeof(cpl_array)); array->column = column; return array; } /** * @brief * Create a new @em float array from existing data. * * @param data Existing data buffer. * @param length Number of elements in array. * * @return Pointer to the new array, or @c NULL in case of error. * * See documentation of function @c cpl_array_wrap_int(). */ cpl_array *cpl_array_wrap_float(float *data, cpl_size length) { cpl_column *column; cpl_array *array; column = cpl_column_wrap_float(data, length); if (column == NULL) { cpl_error_set_where_(); return NULL; } array = cpl_calloc(1, sizeof(cpl_array)); array->column = column; return array; } /** * @brief * Create a new @em float complex array from existing data. * * @param data Existing data buffer. * @param length Number of elements in array. * * @return Pointer to the new array, or @c NULL in case of error. * * See documentation of function @c cpl_array_wrap_int(). */ cpl_array *cpl_array_wrap_float_complex(float complex *data, cpl_size length) { cpl_column *column; cpl_array *array; column = cpl_column_wrap_float_complex(data, length); if (column == NULL) { cpl_error_set_where_(); return NULL; } array = cpl_calloc(1, sizeof(cpl_array)); array->column = column; return array; } /** * @brief * Create a new @em double array from existing data. * * @param data Existing data buffer. * @param length Number of elements in array. * * @return Pointer to the new array, or @c NULL in case of error. * * See documentation of function @c cpl_array_wrap_int(). */ cpl_array *cpl_array_wrap_double(double *data, cpl_size length) { cpl_column *column; cpl_array *array; column = cpl_column_wrap_double(data, length); if (column == NULL) { cpl_error_set_where_(); return NULL; } array = cpl_calloc(1, sizeof(cpl_array)); array->column = column; return array; } /** * @brief * Create a new @em double complex array from existing data. * * @param data Existing data buffer. * @param length Number of elements in array. * * @return Pointer to the new array, or @c NULL in case of error. * * See documentation of function @c cpl_array_wrap_int(). */ cpl_array *cpl_array_wrap_double_complex(double complex *data, cpl_size length) { cpl_column *column; cpl_array *array; column = cpl_column_wrap_double_complex(data, length); if (column == NULL) { cpl_error_set_where_(); return NULL; } array = cpl_calloc(1, sizeof(cpl_array)); array->column = column; return array; } /** * @brief * Create a new character string array from existing data. * * @param data Existing data buffer. * @param length Number of elements in array. * * @return Pointer to the new array, or @c NULL in case of error. * * See documentation of function @c cpl_array_wrap_int(). */ cpl_array *cpl_array_wrap_string(char **data, cpl_size length) { cpl_column *column; cpl_array *array; column = cpl_column_wrap_string(data, length); if (column == NULL) { cpl_error_set_where_(); return NULL; } array = cpl_calloc(1, sizeof(cpl_array)); array->column = column; return array; } /** * @brief * Copy buffer of numerical data to a numerical array. * * @param array Existing array. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the array is not numerical, * a @c CPL_ERROR_INVALID_TYPE is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * The input data are copied into the specified array. If the type of the * accessed array is not @em CPL_TYPE_DOUBLE, the data values will be * truncated according to C casting rules. The size of the input data * buffer is not checked in any way, and the values are all considered * valid: invalid values should be marked using the functions * @c cpl_array_set_invalid(). If @em N is the length of the array, * the first @em N values of the input data buffer would be copied to * the column buffer. If the array had length zero, no values would * be copied. */ cpl_error_code cpl_array_copy_data(cpl_array *array, const double *data) { if (data == 0x0 || array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_copy_data(array->column, data)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Copy buffer of complex data to a complex array. * * @param array Existing array. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the array is not complex, * a @c CPL_ERROR_INVALID_TYPE is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * The input data are copied into the specified array. If the type of the * accessed array is not @em CPL_TYPE_DOUBLE, the data values will be * truncated according to C casting rules. The size of the input data * buffer is not checked in any way, and the values are all considered * valid: invalid values should be marked using the functions * @c cpl_array_set_invalid(). If @em N is the length of the array, * the first @em N values of the input data buffer would be copied to * the column buffer. If the array had length zero, no values would * be copied. */ cpl_error_code cpl_array_copy_data_complex(cpl_array *array, const double complex *data) { if (data == 0x0 || array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_copy_data_complex(array->column, data)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Copy existing data to an @em integer array. * * @param array Existing array. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the input array is not * of type @c CPL_TYPE_INT, a @c CPL_ERROR_TYPE_MISMATCH is returned. * At any @c NULL input pointer a @c CPL_ERROR_NULL_INPUT would be * returned. * * The input data are copied into the specified array. The size of the * input data buffer is not checked in any way, and the data values are all * considered valid: invalid values should be marked using the functions * @c cpl_array_set_invalid(). If @em N is the length of the array, the * first @em N values of the input data buffer would be copied to the * array buffer. If the array had length zero, no values would be copied. */ cpl_error_code cpl_array_copy_data_int(cpl_array *array, const int *data) { if (data == 0x0 || array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_copy_data_int(array->column, data)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Copy existing data to a @em long @em integer array. * * @param array Existing array. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the input array is not * of type @c CPL_TYPE_LONG, a @c CPL_ERROR_TYPE_MISMATCH is returned. * At any @c NULL input pointer a @c CPL_ERROR_NULL_INPUT would be * returned. * * The input data are copied into the specified array. The size of the * input data buffer is not checked in any way, and the data values are all * considered valid: invalid values should be marked using the functions * @c cpl_array_set_invalid(). If @em N is the length of the array, the * first @em N values of the input data buffer would be copied to the * array buffer. If the array had length zero, no values would be copied. */ cpl_error_code cpl_array_copy_data_long(cpl_array *array, const long *data) { if (data == 0x0 || array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_copy_data_long(array->column, data)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Copy existing data to a @em long @em long @em integer array. * * @param array Existing array. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the input array is not * of type @c CPL_TYPE_LONG_LONG, a @c CPL_ERROR_TYPE_MISMATCH is * returned. At any @c NULL input pointer a @c CPL_ERROR_NULL_INPUT * would be returned. * * The input data are copied into the specified array. The size of the * input data buffer is not checked in any way, and the data values are all * considered valid: invalid values should be marked using the functions * @c cpl_array_set_invalid(). If @em N is the length of the array, the * first @em N values of the input data buffer would be copied to the * array buffer. If the array had length zero, no values would be copied. */ cpl_error_code cpl_array_copy_data_long_long(cpl_array *array, const long long *data) { if (data == 0x0 || array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_copy_data_long_long(array->column, data)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Copy existing data to a @em cpl_size array. * * @param array Existing array. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the input array is not * of type @c CPL_TYPE_SIZE, a @c CPL_ERROR_TYPE_MISMATCH is * returned. At any @c NULL input pointer a @c CPL_ERROR_NULL_INPUT * would be returned. * * The input data are copied into the specified array. The size of the * input data buffer is not checked in any way, and the data values are all * considered valid: invalid values should be marked using the functions * @c cpl_array_set_invalid(). If @em N is the length of the array, the * first @em N values of the input data buffer would be copied to the * array buffer. If the array had length zero, no values would be copied. */ cpl_error_code cpl_array_copy_data_cplsize(cpl_array *array, const cpl_size *data) { if (data == 0x0 || array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_copy_data_cplsize(array->column, data)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Copy existing data to a @em float array. * * @param array Existing array. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the input array is not of * type @c CPL_TYPE_FLOAT, a @c CPL_ERROR_TYPE_MISMATCH is returned. * At any @c NULL input pointer a @c CPL_ERROR_NULL_INPUT would be * returned. * * See documentation of function @c cpl_array_copy_data_int(). */ cpl_error_code cpl_array_copy_data_float(cpl_array *array, const float *data) { if (data == 0x0 || array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_copy_data_float(array->column, data)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Copy existing data to a @em float complex array. * * @param array Existing array. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the input array is not of * type @c CPL_TYPE_FLOAT_COMPLEX, a @c CPL_ERROR_TYPE_MISMATCH is returned. * At any @c NULL input pointer a @c CPL_ERROR_NULL_INPUT would be * returned. * * See documentation of function @c cpl_array_copy_data_int(). */ cpl_error_code cpl_array_copy_data_float_complex(cpl_array *array, const float complex *data) { if (data == 0x0 || array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_copy_data_float_complex(array->column, data)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Copy existing data to a @em double array. * * @param array Existing array. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the input array is not of * type @c CPL_TYPE_DOUBLE, a @c CPL_ERROR_TYPE_MISMATCH is returned. * At any @c NULL input pointer a @c CPL_ERROR_NULL_INPUT would be * returned. * * See documentation of function @c cpl_array_copy_data_int(). */ cpl_error_code cpl_array_copy_data_double(cpl_array *array, const double *data) { if (data == 0x0 || array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_copy_data_double(array->column, data)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Copy existing data to a @em double complex array. * * @param array Existing array. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the input array is not of * type @c CPL_TYPE_DOUBLE_COMPLEX, a @c CPL_ERROR_TYPE_MISMATCH is returned. * At any @c NULL input pointer a @c CPL_ERROR_NULL_INPUT would be * returned. * * See documentation of function @c cpl_array_copy_data_int(). */ cpl_error_code cpl_array_copy_data_double_complex(cpl_array *array, const double complex *data) { if (data == 0x0 || array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_copy_data_double_complex(array->column, data)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Copy existing data to a @em string array. * * @param array Existing array. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the input array is not of * type @c CPL_TYPE_STRING, a @c CPL_ERROR_TYPE_MISMATCH is returned. * At any @c NULL input pointer a @c CPL_ERROR_NULL_INPUT would be * returned. * * See documentation of function @c cpl_array_copy_data_int(). * * The input data are copied into the specified array. The size of the * input buffer is not checked in any way. The strings pointed by the input * buffer are all duplicated, while the strings contained in the array * are released before being overwritten. */ cpl_error_code cpl_array_copy_data_string(cpl_array *array, const char **data) { if (data == 0x0 || array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_copy_data_string(array->column, data)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Delete an array. * * @param array Array to be deleted. * * @return Nothing. * * This function deletes an array. If the input array is @c NULL, * nothing is done, and no error is set. */ void cpl_array_delete(cpl_array *array) { if (array != NULL) { cpl_column_delete(array->column); cpl_free(array); } } /** * @brief * Delete an array, without losing the data buffer. * * @param array Array to be deleted. * * @return Pointer to the internal data buffer. * * This function deletes an array, but its data buffer is not destroyed. * Supposedly, the developer knows that the data are static, or the * developer holds the pointer to the data obtained with the functions * @c cpl_array_get_data_int(), @c cpl_array_get_data_float(), etc. * If the input array is @c NULL, nothing is done, and no error is set. */ void *cpl_array_unwrap(cpl_array *array) { void *d = NULL; if (array != NULL) { d = cpl_column_unwrap(array->column); cpl_free(array); } return d; } /** * @brief * Get the length of an array. * * @param array Input array. * * @return Length of array, or zero. The latter case can occur either * with an array having zero length, or if a @c NULL array is passed to * the function, but in the latter case a @c CPL_ERROR_NULL_INPUT is set. * * If the array is @em NULL, zero is returned. */ cpl_size cpl_array_get_size(const cpl_array *array) { if (array) return cpl_column_get_size(array->column); cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } /** * @brief * Resize an array. * * @param array Input array. * @param new_length New number of elements in array. * * @return @c CPL_ERROR_NONE on success. The new array size must not be * negative, or a @c CPL_ERROR_ILLEGAL_INPUT is returned. The input * array pointer should not be @c NULL, or a @c CPL_ERROR_NULL_INPUT * is returned. * * Reallocate an array to a new number of elements. The contents of the * array data buffer will be unchanged up to the lesser of the new and * old sizes. If the array size is increased, the new array elements * are flagged as invalid. The pointer to data may change, therefore * pointers previously retrieved by calling @c cpl_array_get_data_int(), * @c cpl_array_get_data_string(), etc. should be discarded). Resizing * to zero is allowed, and would produce a zero-length array. In case * of failure, the old data buffer is left intact. * * If the array is @em NULL, zero is returned. */ cpl_error_code cpl_array_set_size(cpl_array *array, cpl_size new_length) { if (array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set_size(array->column, new_length)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Get the type of an array. * * @param array Input array * * @return Type of array, or @c CPL_TYPE_INVALID if a @c NULL array is * passed to the function. * * If the array is @c NULL, @c CPL_ERROR_NULL_INPUT is set. */ cpl_type cpl_array_get_type(const cpl_array *array) { if (array) return cpl_column_get_type(array->column); cpl_error_set("cpl_array_get_type", CPL_ERROR_NULL_INPUT); return CPL_TYPE_INVALID; } /** * @brief * Check if an array contains at least one invalid element. * * @param array Array to inquire. * * @return 1 if the array contains at least one invalid element, 0 if not, * -1 in case of error. * * Check if there are invalid elements in an array. If the input array is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is set. */ int cpl_array_has_invalid(const cpl_array *array) { if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } return cpl_column_has_invalid(array->column); } /** * @brief * Check if an array contains at least one valid value. * * @param array Array to inquire. * * @return 1 if the array contains at least one valid value, 0 if not * -1 in case of error. * * Check if there are valid values in an array. If the input array is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is set. */ int cpl_array_has_valid(const cpl_array *array) { if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } return cpl_column_has_valid(array->column); } /** * @brief * Count number of invalid elements in an array. * * @param array Array to inquire. * * @return Number of invalid elements in an array. -1 is always returned * in case of error. * * Count number of invalid elements in an array. If the array itself is * a @c NULL pointer, an error @c CPL_ERROR_NULL_INPUT is set. */ cpl_size cpl_array_count_invalid(const cpl_array *array) { if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } return cpl_column_count_invalid(array->column); } /** * @brief * Check if an array element is valid. * * @param array Pointer to array. * @param indx Array element to examine. * * @return 1 if the array element is valid, 0 if invalid, -1 in case of * error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input array has zero length, or indx is * outside the array boundaries. *
* @enderror * * Check if an array element is valid. */ int cpl_array_is_valid(const cpl_array *array, cpl_size indx) { int validity; cpl_errorstate prevstate; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } prevstate = cpl_errorstate_get(); validity = cpl_column_is_invalid(array->column, indx) ? 0 : 1; if (!cpl_errorstate_is_equal(prevstate)) { cpl_error_set_where_(); return -1; } return validity; } /** * @brief * Get a pointer to @c integer array data. * * @param array Array to get the data from. * * @return Pointer to @c integer array data. If @em array contains no * data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_INT, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * @note * Use at your own risk: direct manipulation of array data rules * out any check performed by the array object interface, and may * introduce inconsistencies between the array information maintained * internally and the actual array data. */ int *cpl_array_get_data_int(cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); int *data = (int *)cpl_array_get_data_int_const(array); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @c integer array data. * * @param array Constant array to get the data from. * * @return Pointer to constant @c integer array data. If @em array contains * no data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_INT, a * @c CPL_ERROR_TYPE_MISMATCH is set. */ const int *cpl_array_get_data_int_const(const cpl_array *array) { const int *data = NULL; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } data = cpl_column_get_data_int_const(array->column); if (data == NULL) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to @c long @c integer array data. * * @param array Array to get the data from. * * @return Pointer to @c long @c integer array data. If @em array contains no * data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_LONG, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * @note * Use at your own risk: direct manipulation of array data rules * out any check performed by the array object interface, and may * introduce inconsistencies between the array information maintained * internally and the actual array data. */ long *cpl_array_get_data_long(cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); long *data = (long *)cpl_array_get_data_long_const(array); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @c long @c integer array data. * * @param array Constant array to get the data from. * * @return Pointer to constant @c long @c integer array data. If @em array * contains no data (zero length), a @c NULL is returned. If @em array is * a @c NULL, a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_LONG, a * @c CPL_ERROR_TYPE_MISMATCH is set. */ const long *cpl_array_get_data_long_const(const cpl_array *array) { const long *data = NULL; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } data = cpl_column_get_data_long_const(array->column); if (data == NULL) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to @c long @c long @c integer array data. * * @param array Array to get the data from. * * @return Pointer to @c long @c long @c integer array data. If @em array * contains no data (zero length), a @c NULL is returned. If @em array is * a @c NULL, a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_LONG_LONG, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * @note * Use at your own risk: direct manipulation of array data rules * out any check performed by the array object interface, and may * introduce inconsistencies between the array information maintained * internally and the actual array data. */ long long *cpl_array_get_data_long_long(cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); long long *data = (long long *)cpl_array_get_data_long_long_const(array); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @c long @c long @c integer array data. * * @param array Constant array to get the data from. * * @return Pointer to constant @c long @c long @c integer array data. If * @em array contains no data (zero length), a @c NULL is returned. If * @em array is a @c NULL, a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_LONG_LONG, a * @c CPL_ERROR_TYPE_MISMATCH is set. */ const long long *cpl_array_get_data_long_long_const(const cpl_array *array) { const long long *data = NULL; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } data = cpl_column_get_data_long_long_const(array->column); if (data == NULL) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to @c cpl_size array data. * * @param array Array to get the data from. * * @return Pointer to @c cpl_size array data. If @em array contains * no data (zero length), a @c NULL is returned. If @em array is * a @c NULL, a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_SIZE, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * @note * Use at your own risk: direct manipulation of array data rules * out any check performed by the array object interface, and may * introduce inconsistencies between the array information maintained * internally and the actual array data. */ cpl_size *cpl_array_get_data_cplsize(cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_size *data = (cpl_size *)cpl_array_get_data_cplsize_const(array); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @c cpl_size array data. * * @param array Constant array to get the data from. * * @return Pointer to constant @c cpl_size array data. If @em array contains * no data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_SIZE, a * @c CPL_ERROR_TYPE_MISMATCH is set. */ const cpl_size *cpl_array_get_data_cplsize_const(const cpl_array *array) { const cpl_size *data = NULL; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } data = cpl_column_get_data_cplsize_const(array->column); if (data == NULL) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to @c float array data. * * @param array Array to get the data from. * * @return Pointer to @c float array data. If @em array contains no * data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_FLOAT, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_array_get_data_int(). */ float *cpl_array_get_data_float(cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); float *data = (float *)cpl_array_get_data_float_const(array); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em float array data. * * @param array Constant array to get the data from. * * @return Pointer to constant @em float array data. If @em array contains no * data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_FLOAT, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_array_get_data_int_const(). */ const float *cpl_array_get_data_float_const(const cpl_array *array) { const float *data = NULL; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } data = cpl_column_get_data_float_const(array->column); if (data == NULL) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to @c float complex array data. * * @param array Array to get the data from. * * @return Pointer to @c float complex array data. If @em array contains no * data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_FLOAT_COMPLEX, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_array_get_data_int(). */ float complex *cpl_array_get_data_float_complex(cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); float complex *data = (float complex *)cpl_array_get_data_float_complex_const(array); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em float complex array data. * * @param array Constant array to get the data from. * * @return Pointer to constant @em float complex array data. If @em array * contains no * data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_FLOAT_COMPLEX, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_array_get_data_int_const(). */ const float complex * cpl_array_get_data_float_complex_const(const cpl_array *array) { const float complex *data = NULL; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } data = cpl_column_get_data_float_complex_const(array->column); if (data == NULL) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to @c double array data. * * @param array Array to get the data from. * * @return Pointer to @c double array data. If @em array contains no * data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_DOUBLE, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_array_get_data_int(). */ double *cpl_array_get_data_double(cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); double *data = (double *)cpl_array_get_data_double_const(array); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em double array data. * * @param array Constant array to get the data from. * * @return Pointer to constant @em double array data. If @em array contains no * data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_DOUBLE, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_array_get_data_int_const(). */ const double *cpl_array_get_data_double_const(const cpl_array *array) { const double *data = NULL; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } data = cpl_column_get_data_double_const(array->column); if (data == NULL) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to @c double complex array data. * * @param array Array to get the data from. * * @return Pointer to @c double complex array data. If @em array contains no * data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_DOUBLE_COMPLEX, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_array_get_data_int(). */ double complex *cpl_array_get_data_double_complex(cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); double complex *data = (double complex *)cpl_array_get_data_double_complex_const(array); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em double complex array data. * * @param array Constant array to get the data from. * * @return Pointer to constant @em double complex array data. If @em array * contains no * data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_DOUBLE_COMPLEX, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_array_get_data_int_const(). */ const double complex * cpl_array_get_data_double_complex_const(const cpl_array *array) { const double complex *data = NULL; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } data = cpl_column_get_data_double_complex_const(array->column); if (data == NULL) cpl_error_set_where_(); return data; } /* * This is a private function, to be used only by other CPL functions, * and listed in cpl_array_impl.h */ const cpl_column *cpl_array_get_column_const(const cpl_array *array) { if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return array->column; } cpl_column *cpl_array_get_column(cpl_array *array) { if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return array->column; } /** * @internal * @brief Insert an existing cpl_column into the array, replacing any original * @param array Array to be modified * @param column Column to insert * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL * pointer a @c CPL_ERROR_NULL_INPUT is returned. * @note This is a private function, to be used only by other CPL functions, * and listed in cpl_array_impl.h * * FIXME: May column be NULL ? */ cpl_error_code cpl_array_set_column(cpl_array *array, cpl_column *column) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (array->column) cpl_column_delete(array->column); array->column = column; return CPL_ERROR_NONE; } /** * @brief * Get a pointer to @em string array data. * * @param array Array to get the data from. * * @return Pointer to @em string array data. If @em array contains no * data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_STRING, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_array_get_data_int(). */ char **cpl_array_get_data_string(cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); char **data = (char **)cpl_array_get_data_string_const(array); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Get a pointer to constant @em string array data. * * @param array Constant array to get the data from. * * @return Pointer to constant @em string array data. If @em array contains no * data (zero length), a @c NULL is returned. If @em array is a @c NULL, * a @c NULL is returned, and an error is set. * * If the array is not of type @c CPL_TYPE_STRING, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_array_get_data_int(). */ const char **cpl_array_get_data_string_const(const cpl_array *array) { const char **data = NULL; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } data = cpl_column_get_data_string_const(array->column); if (data == NULL) cpl_error_set_where_(); return data; } /** * @brief * Read a value from a numerical array. * * @param array Array to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Value read. In case of an invalid array element, or in * case of error, 0.0 is returned. * * Read a value from a numerical array. A @c CPL_ERROR_NULL_INPUT is set in * case @em array is a @c NULL pointer. A @c CPL_ERROR_INVALID_TYPE is set * in case a non-numerical array is accessed. @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is set if the @em indx is outside the array range. Indexes are * counted starting from 0. If the input array has length zero, * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. The @em null * flag is used to indicate whether the accessed array element is * valid (0) or invalid (1). The null flag also signals an error * condition (-1). The @em null argument can be left to @c NULL. */ double cpl_array_get(const cpl_array *array, cpl_size indx, int *null) { cpl_errorstate prestate = cpl_errorstate_get(); double data; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); if (null) *null = -1; return 0.0; } data = cpl_column_get(array->column, indx, null); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Read a value from a complex array. * * @param array Array to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Value read. In case of an invalid array element, or in * case of error, 0.0 is returned. * * Read a value from a complex array. A @c CPL_ERROR_NULL_INPUT is set in * case @em array is a @c NULL pointer. A @c CPL_ERROR_INVALID_TYPE is set * in case a non-complex array is accessed. @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is set if the @em indx is outside the array range. Indexes are * counted starting from 0. If the input array has length zero, * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. The @em null * flag is used to indicate whether the accessed array element is * valid (0) or invalid (1). The null flag also signals an error * condition (-1). The @em null argument can be left to @c NULL. */ double complex cpl_array_get_complex(const cpl_array *array, cpl_size indx, int *null) { cpl_errorstate prestate = cpl_errorstate_get(); double complex data; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); if (null) *null = -1; return 0.0; } data = cpl_column_get_complex(array->column, indx, null); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Read a value from an @em integer array. * * @param array Array to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Integer value read. In case of an invalid array element, or in * case of error, 0 is returned. * * Read a value from an array of type @c CPL_TYPE_INT. If @em array is a * @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the array is not * of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input array has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the @em null * flag is a valid pointer, it is used to indicate whether the accessed * array element is valid (0) or invalid (1). The null flag also signals * an error condition (-1). */ int cpl_array_get_int(const cpl_array *array, cpl_size indx, int *null) { cpl_errorstate prestate = cpl_errorstate_get(); int data = 0; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); if (null) *null = -1; return data; } data = cpl_column_get_int(array->column, indx, null); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Read a value from a @em long @em integer array. * * @param array Array to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Long integer value read. In case of an invalid array element, or in * case of error, 0 is returned. * * Read a value from an array of type @c CPL_TYPE_LONG. If @em array is a * @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the array is not * of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input array has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the @em null * flag is a valid pointer, it is used to indicate whether the accessed * array element is valid (0) or invalid (1). The null flag also signals * an error condition (-1). */ long cpl_array_get_long(const cpl_array *array, cpl_size indx, int *null) { cpl_errorstate prestate = cpl_errorstate_get(); long data = 0; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); if (null) *null = -1; return data; } data = cpl_column_get_long(array->column, indx, null); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Read a value from a @em long @em long @em integer array. * * @param array Array to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Long long integer value read. In case of an invalid array element, * or in case of error, 0 is returned. * * Read a value from an array of type @c CPL_TYPE_LONG_LONG. If @em array is * a @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the array is not * of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input array has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the @em null * flag is a valid pointer, it is used to indicate whether the accessed * array element is valid (0) or invalid (1). The null flag also signals * an error condition (-1). */ long long cpl_array_get_long_long(const cpl_array *array, cpl_size indx, int *null) { cpl_errorstate prestate = cpl_errorstate_get(); long long data = 0; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); if (null) *null = -1; return data; } data = cpl_column_get_long_long(array->column, indx, null); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Read a value from a @em cpl_size array. * * @param array Array to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return The cpl_size value read. In case of an invalid array element, * or in case of error, 0 is returned. * * Read a value from an array of type @c CPL_TYPE_SIZE. If @em array is * a @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the array is not * of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input array has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the @em null * flag is a valid pointer, it is used to indicate whether the accessed * array element is valid (0) or invalid (1). The null flag also signals * an error condition (-1). */ cpl_size cpl_array_get_cplsize(const cpl_array *array, cpl_size indx, int *null) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_size data = 0; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); if (null) *null = -1; return data; } data = cpl_column_get_cplsize(array->column, indx, null); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Read a value from a @em float array. * * @param array Array to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Array value read. In case of an invalid array element, or in * case of error, 0.0 is returned. * * Read a value from an array of type @c CPL_TYPE_FLOAT. See the * documentation of the function cpl_array_get_int(). */ float cpl_array_get_float(const cpl_array *array, cpl_size indx, int *null) { cpl_errorstate prestate = cpl_errorstate_get(); float data; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); if (null) *null = -1; return 0.0; } data = cpl_column_get_float(array->column, indx, null); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Read a value from a @em float complex array. * * @param array Array to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Array value read. In case of an invalid array element, or in * case of error, 0.0 is returned. * * Read a value from an array of type @c CPL_TYPE_FLOAT_COMPLEX. See the * documentation of the function cpl_array_get_int(). */ float complex cpl_array_get_float_complex(const cpl_array *array, cpl_size indx, int *null) { cpl_errorstate prestate = cpl_errorstate_get(); float complex data; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); if (null) *null = -1; return 0.0; } data = cpl_column_get_float_complex(array->column, indx, null); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Read a value from a @em double array. * * @param array Array to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Array value read. In case of an invalid array element, or in * case of error, 0.0 is returned. * * Read a value from an array of type @c CPL_TYPE_DOUBLE. See the * documentation of the function cpl_array_get_int(). */ double cpl_array_get_double(const cpl_array *array, cpl_size indx, int *null) { cpl_errorstate prestate = cpl_errorstate_get(); double data; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); if (null) *null = -1; return 0.0; } data = cpl_column_get_double(array->column, indx, null); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Read a value from a @em double complex array. * * @param array Array to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Array value read. In case of an invalid array element, or in * case of error, 0.0 is returned. * * Read a value from an array of type @c CPL_TYPE_DOUBLE_COMPLEX. See the * documentation of the function cpl_array_get_int(). */ double complex cpl_array_get_double_complex(const cpl_array *array, cpl_size indx, int *null) { cpl_errorstate prestate = cpl_errorstate_get(); double complex data; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); if (null) *null = -1; return 0.0; } data = cpl_column_get_double_complex(array->column, indx, null); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /** * @brief * Read a value from a string array. * * @param array Array to be accessed. * @param indx Position of element to be read. * * @return Character string read. In case of an invalid array element, * or in case of error, a @c NULL pointer is returned. * * Read a value from an array of type @c CPL_TYPE_STRING. If @em array is a * @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the array is not * of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input array has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. * * @note * The returned string is a pointer to an array element, not its * copy. Its manipulation will directly affect that array element, * while changing that array element using @c cpl_array_set_string() * will turn it into garbage. Therefore, if a real copy of a string * array element is required, this function should be called as an * argument of the function @c strdup(). */ const char *cpl_array_get_string(const cpl_array *array, cpl_size indx) { const char *data; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } data = cpl_column_get_string_const(array->column, indx); if (data == NULL) cpl_error_set_where_(); return data; } /** * @brief * Write a value to a numerical array element. * * @param array Array to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of numerical * type, a @c CPL_ERROR_INVALID_TYPE is returned. If @em indx is outside * the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If * the input array has length zero, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a numerical array element. The value is cast to the * accessed array type. The written value is automatically flagged as * valid. To invalidate an array value use @c cpl_array_set_invalid(). * Array elements are counted starting from 0. */ cpl_error_code cpl_array_set(cpl_array *array, cpl_size indx, double value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set(array->column, indx, value)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write a value to a complex array element. * * @param array Array to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of numerical * type, a @c CPL_ERROR_INVALID_TYPE is returned. If @em indx is outside * the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If * the input array has length zero, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a numerical array element. The value is cast to the * accessed array type. The written value is automatically flagged as * valid. To invalidate an array value use @c cpl_array_set_invalid(). * Array elements are counted starting from 0. */ cpl_error_code cpl_array_set_complex(cpl_array *array, cpl_size indx, double complex value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set_complex(array->column, indx, value)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write a value to an @em integer array element. * * @param array Array to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input array has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to an @em integer array element. The written value * is automatically flagged as valid. To invalidate an array value use * @c cpl_array_set_invalid(). Array elements are counted starting * from 0. */ cpl_error_code cpl_array_set_int(cpl_array *array, cpl_size indx, int value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set_int(array->column, indx, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write a value to a @em long @em integer array element. * * @param array Array to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input array has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a @em long @em integer array element. The written value * is automatically flagged as valid. To invalidate an array value use * @c cpl_array_set_invalid(). Array elements are counted starting * from 0. */ cpl_error_code cpl_array_set_long(cpl_array *array, cpl_size indx, long value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set_long(array->column, indx, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write a value to a @em long @em long @em integer array element. * * @param array Array to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input array has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a @em long @em long @em integer array element. The written * value is automatically flagged as valid. To invalidate an array value use * @c cpl_array_set_invalid(). Array elements are counted starting from 0. */ cpl_error_code cpl_array_set_long_long(cpl_array *array, cpl_size indx, long long value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set_long_long(array->column, indx, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write a value to a @em cpl_size array element. * * @param array Array to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input array has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a @em cpl_size array element. The written value * is automatically flagged as valid. To invalidate an array value use * @c cpl_array_set_invalid(). Array elements are counted starting from 0. */ cpl_error_code cpl_array_set_cplsize(cpl_array *array, cpl_size indx, cpl_size value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set_cplsize(array->column, indx, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write a value to a @em float array element. * * @param array Array to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input array has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a @em float array element. The written value * is automatically flagged as valid. To invalidate an array value use * @c cpl_array_set_invalid(). Array elements are counted starting * from 0. */ cpl_error_code cpl_array_set_float(cpl_array *array, cpl_size indx, float value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set_float(array->column, indx, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write a value to a @em float complex array element. * * @param array Array to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input array has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a @em float complex array element. The written value * is automatically flagged as valid. To invalidate an array value use * @c cpl_array_set_invalid(). Array elements are counted starting * from 0. */ cpl_error_code cpl_array_set_float_complex(cpl_array *array, cpl_size indx, float complex value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set_float_complex(array->column, indx, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write a value to a @em double array element. * * @param array Array to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input array has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a @em double array element. The written value * is automatically flagged as valid. To invalidate an array value use * @c cpl_array_set_invalid(). Array elements are counted starting * from 0. */ cpl_error_code cpl_array_set_double(cpl_array *array, cpl_size indx, double value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set_double(array->column, indx, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write a value to a @em double complex array element. * * @param array Array to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input array has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a @em double array element. The written value * is automatically flagged as valid. To invalidate an array value use * @c cpl_array_set_invalid(). Array elements are counted starting * from 0. */ cpl_error_code cpl_array_set_double_complex(cpl_array *array, cpl_size indx, double complex value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set_double_complex(array->column, indx, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write a character string to a string array element. * * @param array Array to be accessed. * @param indx Position where to write character string. * @param string Character string to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em indx is * outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input array has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Copy a character string to a @em string array element. The written * value can also be a @c NULL pointer. Note that the input character * string is copied, therefore the original can be modified without * affecting the column content. To "plug" a character string directly * into an array element, use the function @c cpl_array_get_data_string(). * Array elements are counted starting from zero. */ cpl_error_code cpl_array_set_string(cpl_array *array, cpl_size indx, const char *string) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set_string(array->column, indx, string)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Invalidate an array element * * @param array Array to be accessed * @param indx Position of element to invalidate * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If @em indx is outside the * array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. If the input * array has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. * * In the case of a string array, the string is set free and its * pointer is set to @c NULL; for other data types, the corresponding * element of the null flags buffer is flagged. Array elements are * counted starting from zero. */ cpl_error_code cpl_array_set_invalid(cpl_array *array, cpl_size indx) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_set_invalid(array->column, indx)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write the same value within a numerical array segment. * * @param array Array to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of numerical * type, a @c CPL_ERROR_INVALID_TYPE is returned. If @em start is outside * the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If * the input array has length zero, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write the same value to a numerical array segment. The value is cast to * the accessed array type. The written values are automatically flagged as * valid. To invalidate an array interval use @c cpl_array_fill_window_invalid(). */ cpl_error_code cpl_array_fill_window(cpl_array *array, cpl_size start, cpl_size count, double value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_fill(array->column, start, count, value)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write the same value within a complex array segment. * * @param array Array to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of numerical * type, a @c CPL_ERROR_INVALID_TYPE is returned. If @em start is outside * the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If * the input array has length zero, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write the same value to a complex array segment. The value is cast to * the accessed array type. The written values are automatically flagged as * valid. To invalidate an array interval use @c cpl_array_fill_window_invalid(). */ cpl_error_code cpl_array_fill_window_complex(cpl_array *array, cpl_size start, cpl_size count, double complex value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_fill_complex(array->column, start, count, value)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write the same value within an @em integer array segment. * * @param array Array to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input array has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to an @em integer array segment. The written * values are automatically flagged as valid. To invalidate an array * interval use @c cpl_array_fill_window_invalid(). The @em count argument * can go beyond the array end, and in that case the specified @em value * will be written just up to the end of the array. If @em count is zero, * the array is not modified and no error is set. */ cpl_error_code cpl_array_fill_window_int(cpl_array *array, cpl_size start, cpl_size count, int value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_fill_int(array->column, start, count, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write the same value within a @em long @em integer array segment. * * @param array Array to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input array has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em long @em integer array segment. The written * values are automatically flagged as valid. To invalidate an array * interval use @c cpl_array_fill_window_invalid(). The @em count argument * can go beyond the array end, and in that case the specified @em value * will be written just up to the end of the array. If @em count is zero, * the array is not modified and no error is set. */ cpl_error_code cpl_array_fill_window_long(cpl_array *array, cpl_size start, cpl_size count, long value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_fill_long(array->column, start, count, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write the same value within a @em long @em long @em integer array segment. * * @param array Array to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input array has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em long @em long @em integer array segment. The * written values are automatically flagged as valid. To invalidate an array * interval use @c cpl_array_fill_window_invalid(). The @em count argument * can go beyond the array end, and in that case the specified @em value * will be written just up to the end of the array. If @em count is zero, * the array is not modified and no error is set. */ cpl_error_code cpl_array_fill_window_long_long(cpl_array *array, cpl_size start, cpl_size count, long long value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_fill_long_long(array->column, start, count, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write the same value within a @em cpl_size array segment. * * @param array Array to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input array has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em cpl_size array segment. The written values * are automatically flagged as valid. To invalidate an array interval use * @c cpl_array_fill_window_invalid(). The @em count argument can go beyond * the array end, and in that case the specified @em value will be written * just up to the end of the array. If @em count is zero, the array is not * modified and no error is set. */ cpl_error_code cpl_array_fill_window_cplsize(cpl_array *array, cpl_size start, cpl_size count, cpl_size value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_fill_cplsize(array->column, start, count, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write the same value within a @em float array segment. * * @param array Array to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input array has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em float array segment. The written * values are automatically flagged as valid. To invalidate an array * interval use @c cpl_array_fill_window_invalid(). The @em count argument * can go beyond the array end, and in that case the specified @em value * will be written just up to the end of the array. If @em count is zero, * the array is not modified and no error is set. */ cpl_error_code cpl_array_fill_window_float(cpl_array *array, cpl_size start, cpl_size count, float value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_fill_float(array->column, start, count, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write the same value within a @em float complex array segment. * * @param array Array to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input array has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em float complex array segment. The written * values are automatically flagged as valid. To invalidate an array * interval use @c cpl_array_fill_window_invalid(). The @em count argument * can go beyond the array end, and in that case the specified @em value * will be written just up to the end of the array. If @em count is zero, * the array is not modified and no error is set. */ cpl_error_code cpl_array_fill_window_float_complex(cpl_array *array, cpl_size start, cpl_size count, float complex value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_fill_float_complex(array->column, start, count, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write the same value within a @em double array segment. * * @param array Array to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input array has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em double array segment. The written * values are automatically flagged as valid. To invalidate an array * interval use @c cpl_array_fill_window_invalid(). The @em count argument * can go beyond the array end, and in that case the specified @em value * will be written just up to the end of the array. If @em count is zero, * the array is not modified and no error is set. */ cpl_error_code cpl_array_fill_window_double(cpl_array *array, cpl_size start, cpl_size count, double value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_fill_double(array->column, start, count, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write the same value within a @em double complex array segment. * * @param array Array to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input array has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em double complex array segment. The written * values are automatically flagged as valid. To invalidate an array * interval use @c cpl_array_fill_window_invalid(). The @em count argument * can go beyond the array end, and in that case the specified @em value * will be written just up to the end of the array. If @em count is zero, * the array is not modified and no error is set. */ cpl_error_code cpl_array_fill_window_double_complex(cpl_array *array, cpl_size start, cpl_size count, double complex value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_fill_double_complex(array->column, start, count, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Write a string to a string array segment. * * @param array Array to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the array is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input array has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Copy the same string to a string array segment. If the input string * is not a @c NULL pointer, it is duplicated for each accessed array * element. If the input string is @c NULL, this call is equivalent to * @c cpl_array_fill_window_invalid(). The @em count argument can go beyond * the array end, and in that case the specified @em value will be * copied just up to the end of the array. If @em count is zero, * the array is not modified and no error is set. */ cpl_error_code cpl_array_fill_window_string(cpl_array *array, cpl_size start, cpl_size count, const char *value) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_fill_string(array->column, start, count, value)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Set an array segment to NULL. * * @param array Array to be accessed. * @param start Position where to start writing NULLs. * @param count Number of column elements to set to NULL. * * @return @c CPL_ERROR_NONE on success. If @em array is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If @em start is outside the * array range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the * input array has length zero, the error @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. If @em count is negative, a @c CPL_ERROR_ILLEGAL_INPUT * is returned. * * Invalidate values contained in an array segment. The @em count argument * can go beyond the array end, and in that case the values will be * invalidated up to the end of the array. If @em count is zero, the * array is not modified and no error is set. In the case of a @em string * array, the invalidated strings are set free and their pointers are set * to @c NULL; for other data types, the corresponding elements are flagged * as invalid. */ cpl_error_code cpl_array_fill_window_invalid(cpl_array *array, cpl_size start, cpl_size count) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_fill_invalid(array->column, start, count)) cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Make a copy of an array. * * @param array Array to be duplicated. * * @return Pointer to the new array, or @c NULL in case of error. * * If the input @em array is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT * is returned. Copy is "in depth": in the case of a @em string array, * also the string elements are duplicated. */ cpl_array *cpl_array_duplicate(const cpl_array *array) { cpl_column *column = NULL; cpl_array *new_array; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if (array->column) column = cpl_column_duplicate(array->column); new_array = cpl_array_new(cpl_array_get_size(array), cpl_array_get_type(array)); cpl_column_delete(new_array->column); new_array->column = column; return new_array; } /** * @brief * Create an array from a section of another array. * * @param array Input array * @param start First element to be copied to new array. * @param count Number of elements to be copied. * * @return Pointer to the new array, or @c NULL in case or error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input array has zero length, or start is * outside the array boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
* @enderror * * A number of consecutive elements are copied from an input array to a * newly created array. If the sum of @em start and @em count goes beyond * the end of the input array, elements are copied up to the end. */ cpl_array *cpl_array_extract(const cpl_array *array, cpl_size start, cpl_size count) { cpl_size length = cpl_array_get_size(array); cpl_array *new_array = NULL; if (array == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if (count > length - start) count = length - start; new_array = cpl_array_new(count, cpl_array_get_type(array)); cpl_column_delete(new_array->column); new_array->column = cpl_column_extract(array->column, start, count); if (new_array->column == NULL) { cpl_error_set_where_(); cpl_array_delete(new_array); new_array = NULL; } return new_array; } /** * @brief * Cast a numeric array to a new numeric type array. * * @param array Pointer to array. * @param type Type of new array. * * @return New array. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified column is not numerical. *
CPL_ERROR_ILLEGAL_INPUT * The specified type is not numerical. *
* @enderror * * A new array of the specified type is created, and the content of the * input numeric array is cast to the new type. If the input array type * is identical to the specified type the array is duplicated as is done * by the function @c cpl_array_duplicate(). */ cpl_array *cpl_array_cast(cpl_array *array, cpl_type type) { cpl_array *new_array = NULL; if (array == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } new_array = cpl_calloc(1, sizeof(cpl_array)); new_array->column = NULL; // Paranoid... switch (type) { case CPL_TYPE_INT: new_array->column = cpl_column_cast_to_int(array->column); break; case CPL_TYPE_LONG: new_array->column = cpl_column_cast_to_long(array->column); break; case CPL_TYPE_LONG_LONG: new_array->column = cpl_column_cast_to_long_long(array->column); break; case CPL_TYPE_SIZE: new_array->column = cpl_column_cast_to_cplsize(array->column); break; case CPL_TYPE_FLOAT: new_array->column = cpl_column_cast_to_float(array->column); break; case CPL_TYPE_FLOAT_COMPLEX: new_array->column = cpl_column_cast_to_float_complex(array->column); break; case CPL_TYPE_DOUBLE: new_array->column = cpl_column_cast_to_double(array->column); break; case CPL_TYPE_DOUBLE_COMPLEX: new_array->column = cpl_column_cast_to_double_complex(array->column); break; default: cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); break; } if (!(new_array->column)) { cpl_error_set_where_(); cpl_free(new_array); new_array = NULL; } return new_array; } /** * @brief * Insert a segment of new elements into array. * * @param array Input array * @param start Element where to insert the segment. * @param count Length of the segment. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * array is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * start is negative. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
* @enderror * * Insert a segment of empty (invalid) elements. * Setting @em start to a number greater than the array length is legal, * and has the effect of appending extra elements at the end of the array: * this is equivalent to expanding the array using @c cpl_array_set_size(). * The input @em array may also have zero length. The pointers to array * data values may change, therefore pointers previously retrieved by * calling @c cpl_array_get_data_int(), @c cpl_array_get_data_string(), * etc., should be discarded. */ cpl_error_code cpl_array_insert_window(cpl_array *array, cpl_size start, cpl_size count) { if (array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_insert_segment(array->column, start, count)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Delete a segment of an array. * * @param array Input array * @param start First element to delete. * @param count Number of elements to delete. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * array is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The input array has length zero, or start is * outside the table range. *
CPL_ERROR_ILLEGAL_INPUT * count is negative. *
* @enderror * * A portion of the array data is physically removed. The pointers to * data may change, therefore pointers previously retrieved by calling * @c cpl_array_get_data_int(), @c cpl_array_get_data_string(), etc., * should be discarded. The specified segment can extend beyond the end * of the array, and in that case elements will be removed up to the end * of the array. */ cpl_error_code cpl_array_erase_window(cpl_array *array, cpl_size start, cpl_size count) { if (array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (count > cpl_array_get_size(array) - start) count = cpl_array_get_size(array) - start; if (cpl_column_erase_segment(array->column, start, count)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Merge two arrays. * * @param target_array Target array. * @param insert_array Array to be inserted in the target array. * @param start Element where to insert the insert array. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any input array is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * start is negative. *
CPL_ERROR_TYPE_MISMATCH * The input arrays do not have the same type. *
* @enderror * * The input arrays must have the same type. Data from the @em insert_array * are duplicated and inserted at the specified position of the * @em target_array. If the specified @em start is not less than the * target array length, the second array will be appended to the target * array. The pointers to array data in the target array may change, * therefore pointers previously retrieved by calling * @c cpl_array_get_data_int(), @c cpl_array_get_data_string(), etc., * should be discarded. */ cpl_error_code cpl_array_insert(cpl_array *target_array, const cpl_array *insert_array, cpl_size start) { if (target_array == NULL || insert_array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_merge(target_array->column, insert_array->column, start)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Add the values of two numeric or complex arrays. * * @param to_array Target array. * @param from_array Source array. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any input array is a NULL pointer. *
CPL_ERROR_INCOMPATIBLE_INPUT * The input arrays have different sizes. *
CPL_ERROR_INVALID_TYPE * Any specified array is not numerical. *
* @enderror * * The arrays are summed element by element, and the result of the sum is * stored in the target array. The arrays' types may differ, and in that * case the operation would be performed using the standard C upcasting * rules, with a final cast of the result to the target array type. * Invalid elements are propagated consistently: if either or both members * of the sum are invalid, the result will be invalid too. Underflows and * overflows are ignored. */ cpl_error_code cpl_array_add(cpl_array *to_array, const cpl_array *from_array) { if (to_array == NULL || from_array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_add(to_array->column, from_array->column)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Subtract the values of two numeric or complex arrays. * * @param to_array Target array. * @param from_array Source array. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any input array is a NULL pointer. *
CPL_ERROR_INCOMPATIBLE_INPUT * The input arrays have different sizes. *
CPL_ERROR_INVALID_TYPE * Any specified array is not numerical. *
* @enderror * * The arrays are subtracted element by element, and the result is * stored in the target array. See the documentation of the function * @c cpl_array_add() for further details. */ cpl_error_code cpl_array_subtract(cpl_array *to_array, const cpl_array *from_array) { if (to_array == NULL || from_array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_subtract(to_array->column, from_array->column)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Multiply the values of two numeric or complex arrays. * * @param to_array Target array. * @param from_array Source array. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any input array is a NULL pointer. *
CPL_ERROR_INCOMPATIBLE_INPUT * The input arrays have different sizes. *
CPL_ERROR_INVALID_TYPE * Any specified array is not numerical. *
* @enderror * * The arrays are multiplied element by element, and the result is * stored in the target array. See the documentation of the function * @c cpl_array_add() for further details. */ cpl_error_code cpl_array_multiply(cpl_array *to_array, const cpl_array *from_array) { if (to_array == NULL || from_array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_multiply(to_array->column, from_array->column)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Divide the values of two numeric or complex arrays. * * @param to_array Target array. * @param from_array Source array. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any input array is a NULL pointer. *
CPL_ERROR_INCOMPATIBLE_INPUT * The input arrays have different sizes. *
CPL_ERROR_INVALID_TYPE * Any specified array is not numerical. *
* @enderror * * The arrays are divided element by element, and the result is * stored in the target array. See the documentation of the function * @c cpl_array_add() for further details. */ cpl_error_code cpl_array_divide(cpl_array *to_array, const cpl_array *from_array) { if (to_array == NULL || from_array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_divide(to_array->column, from_array->column)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Add a constant value to a numerical array. * * @param array Target array * @param value Value to add. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The input array is not numerical. *
* @enderror * * The operation is always performed in double precision, with a final * cast of the result to the target array type. Invalid elements are * are not modified by this operation. */ cpl_error_code cpl_array_add_scalar(cpl_array *array, double value) { if (array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_add_scalar(array->column, value)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Add a constant complex value to a complex array. * * @param array Target array * @param value Value to add. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The input array is not complex. *
* @enderror * * The operation is always performed in double precision, with a final * cast of the result to the target array type. Invalid elements are * are not modified by this operation. */ cpl_error_code cpl_array_add_scalar_complex(cpl_array *array, double complex value) { if (array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_add_scalar_complex(array->column, value)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Subtract a constant value from a numerical array. * * @param array Target array * @param value Value to subtract. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The input array is not numerical. *
* @enderror * * The operation is always performed in double precision, with a final * cast of the result to the target array type. Invalid elements are * are not modified by this operation. */ cpl_error_code cpl_array_subtract_scalar(cpl_array *array, double value) { if (array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_subtract_scalar(array->column, value)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Subtract a constant complex value from a complex array. * * @param array Target array * @param value Value to subtract. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The input array is not complex. *
* @enderror * * The operation is always performed in double precision, with a final * cast of the result to the target array type. Invalid elements are * are not modified by this operation. */ cpl_error_code cpl_array_subtract_scalar_complex(cpl_array *array, double complex value) { if (array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_subtract_scalar_complex(array->column, value)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Multiply a numerical array by a constant value. * * @param array Target array * @param value Factor. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The input array is not numerical. *
* @enderror * * The operation is always performed in double precision, with a final * cast of the result to the target array type. Invalid elements are * are not modified by this operation. */ cpl_error_code cpl_array_multiply_scalar(cpl_array *array, double value) { if (array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_multiply_scalar(array->column, value)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Multiply a complex array by a constant complex value. * * @param array Target array * @param value Factor. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The input array is not complex. *
* @enderror * * The operation is always performed in double precision, with a final * cast of the result to the target array type. Invalid elements are * are not modified by this operation. */ cpl_error_code cpl_array_multiply_scalar_complex(cpl_array *array, double complex value) { if (array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_multiply_scalar_complex(array->column, value)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Divide a numerical array by a constant value. * * @param array Target array * @param value Divisor. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The input array is not numerical. *
CPL_ERROR_DIVISION_BY_ZERO * The input value is zero. *
* @enderror * * The operation is always performed in double precision, with a final * cast of the result to the target array type. Invalid elements are * not modified by this operation. */ cpl_error_code cpl_array_divide_scalar(cpl_array *array, double value) { if (array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_divide_scalar(array->column, value)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Divide a complex array by a constant complex value. * * @param array Target array * @param value Divisor. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The input array is not complex. *
CPL_ERROR_DIVISION_BY_ZERO * The input value is zero. *
* @enderror * * The operation is always performed in double precision, with a final * cast of the result to the target array type. Invalid elements are * not modified by this operation. */ cpl_error_code cpl_array_divide_scalar_complex(cpl_array *array, double complex value) { if (array == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_divide_scalar_complex(array->column, value)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Compute the power of array elements. * * @param array Pointer to array. * @param exponent Constant exponent. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is NULL. *
CPL_ERROR_INVALID_TYPE * The array is not numerical or complex. *
* @enderror * * Each array element is replaced by its power to the specified exponent. * The operation is always performed in double precision, with a final * cast of the result to the array type. Invalid elements are not * modified by this operation, but elements are invalidated at any * illegal operation: if the specified @em exponent is not negative, all * array elements must be not negative, and if the specified @em exponent * is negative, all array elements must be positive; array elements not * fulfilling this condition will be invalidated. Only in case of complex * arrays this operation becomes legal. If the exponent is 0.0, then any * (valid) array element would be assigned the value 1.0. */ cpl_error_code cpl_array_power(cpl_array *array, double exponent) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_power(array->column, exponent)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Compute the logarithm of array elements. * * @param array Pointer to array. * @param base Logarithm base. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical or complex. *
CPL_ERROR_ILLEGAL_INPUT * The input base is not positive. *
* @enderror * * Each array element is replaced by its logarithm in the specified base. * The operation is always performed in double precision, with a final * cast of the result to the array type. Invalid elements are not * modified by this operation, but zero or negative elements are * invalidated by this operation. In case of complex numbers, values * very close to the origin may cause an overflow. */ cpl_error_code cpl_array_logarithm(cpl_array *array, double base) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_logarithm(array->column, base)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Compute the exponential of array elements. * * @param array Pointer to array. * @param base Exponential base. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical or complex. *
CPL_ERROR_ILLEGAL_INPUT * The input base is not positive. *
* @enderror * * Each column element is replaced by its exponential in the specified base. * The operation is always performed in double precision, with a final * cast of the result to the array type. Invalid elements are not * modified by this operation. */ cpl_error_code cpl_array_exponential(cpl_array *array, double base) { if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_exponential(array->column, base)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Compute the absolute value of array elements. * * @param array Pointer to array. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical. *
* @enderror * * Each array element is replaced by its absolute value. * Invalid elements are not modified by this operation. * If the array is complex, its type will be turned to * real (CPL_TYPE_FLOAT_COMPLEX will be changed into CPL_TYPE_FLOAT, * and CPL_TYPE_DOUBLE_COMPLEX will be changed into CPL_TYPE_DOUBLE), * and any pointer retrieved by calling @c cpl_array_get_data_float(), * @c cpl_array_get_data_double_complex(), etc., should be discarded. */ cpl_error_code cpl_array_abs(cpl_array *array) { cpl_type type; cpl_column *column; if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); type = cpl_array_get_type(array); if (type & CPL_TYPE_COMPLEX) { column = cpl_column_absolute_complex(array->column); if (column) cpl_array_set_column(array, column); else return cpl_error_set_where_(); } else { if (cpl_column_absolute(array->column)) return cpl_error_set_where_(); } return CPL_ERROR_NONE; } /** * @brief * Compute the phase angle value of array elements. * * @param array Pointer to array. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical. *
* @enderror * * Each array element is replaced by its phase angle value. * The phase angle will be in the range of [-pi,pi]. * Invalid elements are not modified by this operation. * If the array is complex, its type will be turned to * real (CPL_TYPE_FLOAT_COMPLEX will be changed into CPL_TYPE_FLOAT, * and CPL_TYPE_DOUBLE_COMPLEX will be changed into CPL_TYPE_DOUBLE), * and any pointer retrieved by calling @c cpl_array_get_data_float(), * @c cpl_array_get_data_double_complex(), etc., should be discarded. */ cpl_error_code cpl_array_arg(cpl_array *array) { cpl_type type; cpl_column *column; if (array == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); type = cpl_array_get_type(array); if (type & CPL_TYPE_COMPLEX) { column = cpl_column_phase_complex(array->column); if (column) cpl_array_set_column(array, column); else return cpl_error_set_where_(); } else { int length = cpl_array_get_size(array); if (length) { switch (type) { case CPL_TYPE_FLOAT: { float *fdata = cpl_array_get_data_float(array); memset(fdata, 0.0, length * sizeof(float)); // keeps the NULLs break; } case CPL_TYPE_DOUBLE: { double *ddata = cpl_array_get_data_double(array); memset(ddata, 0.0, length * sizeof(double)); break; } default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); break; } } } return CPL_ERROR_NONE; } /** * @brief * Extract the real value of array elements. * * @param array Pointer to array. * * @return New array with real part of input array elements. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical. *
* @enderror * * A new array is created with the real part of all input array * elements. If the input array is complex, the output type will be * CPL_TYPE_FLOAT if input is CPL_TYPE_FLOAT_COMPLEX, and CPL_TYPE_DOUBLE * if input is CPL_TYPE_DOUBLE_COMPLEX). */ cpl_array *cpl_array_extract_real(cpl_array *array) { cpl_type type; cpl_column *column; cpl_array *new_array = NULL; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } type = cpl_array_get_type(array); if (type & CPL_TYPE_COMPLEX) { column = cpl_column_extract_real(array->column); if (column) { new_array = cpl_array_new(0, CPL_TYPE_FLOAT); // Irrelevant type cpl_array_set_column(new_array, column); } else { cpl_error_set_where_(); } } else { new_array = cpl_array_duplicate(array); if (new_array == NULL) cpl_error_set_where_(); } return new_array; } /** * @brief * Extract the imaginary value of array elements. * * @param array Pointer to array. * * @return New array with imaginary part of input array elements. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical. *
* @enderror * * A new array is created with the imaginary part of all input array * elements. If the input array is complex, the output type will be * CPL_TYPE_FLOAT if input is CPL_TYPE_FLOAT_COMPLEX, and CPL_TYPE_DOUBLE * if input is CPL_TYPE_DOUBLE_COMPLEX). */ cpl_array *cpl_array_extract_imag(cpl_array *array) { cpl_type type; cpl_column *column; cpl_array *new_array = NULL; if (array == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } type = cpl_array_get_type(array); if (type & CPL_TYPE_COMPLEX) { column = cpl_column_extract_imag(array->column); if (column) { new_array = cpl_array_new(0, CPL_TYPE_FLOAT); // Irrelevant type cpl_array_set_column(new_array, column); } else { cpl_error_set_where_(); } } else { new_array = cpl_array_duplicate(array); if (new_array == NULL) cpl_error_set_where_(); } return new_array; } /** * @brief * Compute the mean value of a numeric array. * * @param array Input array. * * @return Mean value. In case of error, this is set to 0.0. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical. *
CPL_ERROR_DATA_NOT_FOUND * The specified array has either size zero, * or all its elements are invalid. *
* @enderror * * Array elements marked as invalid are excluded from the computation. * The array must contain at least one valid value. Arrays of strings * or complex are not allowed. */ double cpl_array_get_mean(const cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); double mean; if (array == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0.0; } mean = cpl_column_get_mean(array->column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return mean; } /** * @brief * Compute the mean value of a complex array. * * @param array Input array. * * @return Mean value. In case of error, this is set to 0.0. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not complex. *
CPL_ERROR_DATA_NOT_FOUND * The specified array has either size zero, * or all its elements are invalid. *
* @enderror * * Array elements marked as invalid are excluded from the computation. * The array must contain at least one valid value. Arrays of strings * or numerical are not allowed. */ double complex cpl_array_get_mean_complex(const cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); double complex mean; if (array == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0.0; } mean = cpl_column_get_mean_complex(array->column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return mean; } /** * @brief * Compute the standard deviation of a numeric array. * * @param array Input array. * * @return Standard deviation. In case of error, this is set to 0.0. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical. *
CPL_ERROR_DATA_NOT_FOUND * The specified array has either size zero, * or all its elements are invalid. *
* @enderror * * Array elements marked as invalid are excluded from the computation. * The array must contain at least one valid value. Arrays of strings * or complex are not allowed. */ double cpl_array_get_stdev(const cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); double sigma; if (array == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0.0; } sigma = cpl_column_get_stdev(array->column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return sigma; } /** * @brief * Compute the median of a numeric array. * * @param array Input array. * * @return Median. In case of error, this is set to 0.0. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical. *
CPL_ERROR_DATA_NOT_FOUND * The specified array has either size zero, * or all its elements are invalid. *
* @enderror * * Array elements marked as invalid are excluded from the computation. * The array must contain at least one valid value. Arrays of strings * or complex are not allowed. */ double cpl_array_get_median(const cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); double median; if (array == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0.0; } median = cpl_column_get_median(array->column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return median; } /** * @brief * Get maximum value in a numerical array. * * @param array Input array. * * @return Maximum value. In case of error, this is set to 0.0. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical. *
CPL_ERROR_DATA_NOT_FOUND * The specified array has either size zero, * or all its elements are invalid. *
* @enderror * * Array elements marked as invalid are excluded from the search. * The array must contain at least one valid value. Arrays of strings * or complex are not allowed. */ double cpl_array_get_max(const cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); double max; if (array == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0.0; } max = cpl_column_get_max(array->column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return max; } /** * @brief * Get minimum value in a numerical array. * * @param array Input array. * * @return Minimum value. In case of error, this is set to 0.0. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical. *
CPL_ERROR_DATA_NOT_FOUND * The specified array has either size zero, * or all its elements are invalid. *
* @enderror * * Array elements marked as invalid are excluded from the search. * The array must contain at least one valid value. Arrays of strings * or complex are not allowed. */ double cpl_array_get_min(const cpl_array *array) { cpl_errorstate prestate = cpl_errorstate_get(); double min; if (array == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0.0; } min = cpl_column_get_min(array->column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return min; } /** * @brief * Get position of maximum in a numerical array. * * @param array Pointer to array. * @param indx Returned position of maximum value. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array or indx is NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical. *
CPL_ERROR_DATA_NOT_FOUND * The specified array has either size zero, * or all its elements are invalid. *
* @enderror * * Array values marked as invalid are excluded from the search. * The @em indx argument will be assigned the position of the maximum * value. Indexes are counted starting from 0. If more than one array * element correspond to the max value, the position with the lowest * indx is returned. In case of error, @em indx is set to zero. * Arrays of strings or complex are not allowed. */ cpl_error_code cpl_array_get_maxpos(const cpl_array *array, cpl_size *indx) { if (array == NULL || indx == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_get_maxpos(array->column, indx)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Get position of minimum in a numerical array. * * @param array Pointer to array. * @param indx Returned position of minimum value. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Input array or indx is NULL pointer. *
CPL_ERROR_INVALID_TYPE * The specified array is not numerical. *
CPL_ERROR_DATA_NOT_FOUND * The specified array has either size zero, * or all its elements are invalid. *
* @enderror * * Array values marked as invalid are excluded from the search. * The @em indx argument will be assigned the position of the minimum * value. Indexes are counted starting from 0. If more than one array * element correspond to the min value, the position with the lowest * indx is returned. In case of error, @em indx is set to zero. * Arrays of strings or complex are not allowed. */ cpl_error_code cpl_array_get_minpos(const cpl_array *array, cpl_size *indx) { if (array == NULL || indx == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_column_get_minpos(array->column, indx)) return cpl_error_set_where_(); return CPL_ERROR_NONE; } /** * @brief * Describe the structure and the contents of an array. * * @param array Pointer to array. * @param stream The output stream * * @return Nothing. * * This function is mainly intended for debug purposes. Some information * about the structure of an array and its contents is printed to terminal: * * - Data type of the array * - Number of elements * - Number of invalid elements * * If the specified stream is @c NULL, it is set to @em stdout. The function * used for printing is the standard C @c fprintf(). */ void cpl_array_dump_structure(const cpl_array *array, FILE *stream) { if (stream == 0x0) stream = stdout; if (array == 0x0) { fprintf(stream, "NULL array\n\n"); return; } fprintf(stream, "Array with %" CPL_SIZE_FORMAT, cpl_column_get_size(array->column)); switch (cpl_column_get_type(array->column)) { case CPL_TYPE_INT: fprintf(stream, "integer "); break; case CPL_TYPE_LONG: fprintf(stream, "long "); break; case CPL_TYPE_LONG_LONG: fprintf(stream, "long long"); break; case CPL_TYPE_SIZE: fprintf(stream, "size_type "); break; case CPL_TYPE_FLOAT: fprintf(stream, "float "); break; case CPL_TYPE_DOUBLE: fprintf(stream, "double "); break; case CPL_TYPE_FLOAT_COMPLEX: fprintf(stream, "float complex "); break; case CPL_TYPE_DOUBLE_COMPLEX: fprintf(stream, "double complex "); break; case CPL_TYPE_STRING: fprintf(stream, "string "); break; default: fprintf(stream, "UNDEFINED "); break; } fprintf(stream, "elements, of which %" CPL_SIZE_FORMAT " are flagged invalid.\n", cpl_column_count_invalid(array->column)); } /** * @brief * Print an array * * @param array Pointer to array * @param start First element to print * @param count Number of elements to print * @param stream The output stream * * @return Nothing. * * This function is mainly intended for debug purposes. * Array elements are counted from 0, and their sequence number is printed * at the left of each element. Invalid elements are represented * as a sequence of "-" as wide as the field occupied by the array. * Specifying a @em start beyond the array boundaries, * or a non-positive @em count, would generate a warning message, but no * error would be set. The specified number of elements to print may exceed * the array end, and in that case the array would be printed up to its * last element. If the specified stream is @c NULL, it is set to @em stdout. * The function used for printing is the standard C @c fprintf(). */ void cpl_array_dump(const cpl_array *array, cpl_size start, cpl_size count, FILE *stream) { cpl_size size; char **fields; char *row_field; int *field_size; int *label_len; int null; cpl_size nc = 1; /* recicling cpl_table_dump() */ int found; cpl_size offset; int row; cpl_size i, j, k; cpl_size end; if (stream == 0x0) stream = stdout; if (array == 0x0) { fprintf(stream, "NULL array\n\n"); return; } size = cpl_column_get_size(array->column); if (size == 0) { fprintf(stream, "Zero length array\n\n"); return; } if (start < 0 || start >= size || count < 1) { fprintf(stream, "Illegal cpl_array_dump() arguments!\n"); return; } if (count > size - start) count = size - start; end = start + count; row = cx_snprintf(NULL, 0, "% -" CPL_SIZE_FORMAT, end); row_field = cpl_malloc((row + 1) * sizeof(char)); memset(row_field, ' ', row + 1); row_field[row] = '\0'; label_len = cpl_calloc(nc, sizeof(int)); field_size = cpl_calloc(nc, sizeof(int)); fields = cpl_calloc(nc, sizeof(char *)); for (j = 0; j < nc; j++) { label_len[j] = field_size[j] = strlen("Array"); switch (cpl_column_get_type(array->column)) { case CPL_TYPE_INT: { for (i = start; i < end; i++) { int inum = cpl_column_get_int(array->column, i, &null); if (null) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(array->column), inum); if (size > field_size[j]) field_size[j] = size; } break; } case CPL_TYPE_LONG: { for (i = start; i < end; i++) { long lnum = cpl_column_get_long(array->column, i, &null); if (null) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(array->column), lnum); if (size > field_size[j]) field_size[j] = size; } break; } case CPL_TYPE_LONG_LONG: { for (i = start; i < end; i++) { long long lnum = cpl_column_get_long_long(array->column, i, &null); if (null) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(array->column), lnum); if (size > field_size[j]) field_size[j] = size; } break; } case CPL_TYPE_SIZE: { for (i = start; i < end; i++) { cpl_size snum = cpl_column_get_cplsize(array->column, i, &null); if (null) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(array->column), snum); if (size > field_size[j]) field_size[j] = size; } break; } case CPL_TYPE_FLOAT: { for (i = start; i < end; i++) { float fnum = cpl_column_get_float(array->column, i, &null); if (null) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(array->column), fnum); if (size > field_size[j]) field_size[j] = size; } break; } case CPL_TYPE_DOUBLE: { for (i = start; i < end; i++) { double dnum = cpl_column_get_double(array->column, i, &null); if (null) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(array->column), dnum); if (size > field_size[j]) field_size[j] = size; } break; } case CPL_TYPE_FLOAT_COMPLEX: { for (i = start; i < end; i++) { float complex cfnum = cpl_column_get_float_complex(array->column, i, &null); if (null) size = 4; else size = 3 + cx_snprintf(NULL, 0, cpl_column_get_format(array->column), crealf(cfnum)) + cx_snprintf(NULL, 0, cpl_column_get_format(array->column), cimagf(cfnum)); if (size > field_size[j]) field_size[j] = size; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { for (i = start; i < end; i++) { double complex cdnum = cpl_column_get_double_complex(array->column, i, &null); if (null) size = 4; else size = 3 + cx_snprintf(NULL, 0, cpl_column_get_format(array->column), creal(cdnum)) + cx_snprintf(NULL, 0, cpl_column_get_format(array->column), cimag(cdnum)); if (size > field_size[j]) field_size[j] = size; } break; } case CPL_TYPE_STRING: { for (i = start; i < end; i++) { char *string = (char *)cpl_column_get_string(array->column, i); if (string == 0x0) size = 4; else size = cx_snprintf(NULL, 0, cpl_column_get_format(array->column), string); if (size > field_size[j]) field_size[j] = size; } break; } default: field_size[j] = 4; break; } field_size[j]++; label_len[j]++; fields[j] = cpl_malloc(field_size[j] * sizeof(char)); } fprintf(stream, "%s ", row_field); for (j = 0; j < nc; j++) { offset = (field_size[j] - label_len[j]) / 2; for (i = 0; i < offset; i++) fields[j][i] = ' '; cx_snprintf(fields[j] + offset, label_len[j], "Array"); for (i = label_len[j] + offset - 1; i < field_size[j]; i++) fields[j][i] = ' '; fields[j][field_size[j] - 1] = '\0'; fprintf(stream, "%-*s ", label_len[j], fields[j]); } fprintf(stream, "\n\n"); for (i = start; i < end; i++) { fprintf(stream, "%*" CPL_SIZE_FORMAT " ", row, i); for (j = 0; j < nc; j++) { switch (cpl_column_get_type(array->column)) { case CPL_TYPE_INT: { int inum = cpl_column_get_int(array->column, i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(array->column), inum); break; } case CPL_TYPE_LONG: { long lnum = cpl_column_get_long(array->column, i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(array->column), lnum); break; } case CPL_TYPE_LONG_LONG: { long long lnum = cpl_column_get_long_long(array->column, i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(array->column), lnum); break; } case CPL_TYPE_SIZE: { cpl_size snum = cpl_column_get_cplsize(array->column, i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(array->column), snum); break; } case CPL_TYPE_FLOAT: { float fnum = cpl_column_get_float(array->column, i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(array->column), fnum); break; } case CPL_TYPE_DOUBLE: { double dnum = cpl_column_get_double(array->column, i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(array->column), dnum); break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex cfnum = cpl_column_get_float_complex(array->column, i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else { char *s = cpl_sprintf("(%s,%s)", cpl_column_get_format(array->column), cpl_column_get_format(array->column)); cx_snprintf(fields[j], field_size[j], s, crealf(cfnum), cimagf(cfnum)); cpl_free(s); } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex cdnum = cpl_column_get_double_complex(array->column, i, &null); if (null) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else { char *s = cpl_sprintf("(%s,%s)", cpl_column_get_format(array->column), cpl_column_get_format(array->column)); cx_snprintf(fields[j], field_size[j], s, creal(cdnum), cimag(cdnum)); cpl_free(s); } break; } case CPL_TYPE_STRING: { char *string = (char *)cpl_column_get_string(array->column, i); if (!string) { memset(fields[j], '-', field_size[j]); fields[j][field_size[j] - 1] = '\0'; } else cx_snprintf(fields[j], field_size[j], cpl_column_get_format(array->column), string); break; } default: { cpl_array *_array = cpl_column_get_array(array->column, i); if (!_array) { memset(fields[j], '-', field_size[j]); } else memset(fields[j], '+', field_size[j]); fields[j][field_size[j] - 1] = '\0'; break; } } found = 0; for (k = 0; k < field_size[j]; k++) { if (fields[j][k] == '\0') found = 1; if (found) fields[j][k] = ' '; } fields[j][field_size[j] - 1] = '\0'; fprintf(stream, "%-*s ", field_size[j], fields[j]); } fprintf(stream, "\n"); } for (j = 0; j < nc; j++) cpl_free(fields[j]); cpl_free(fields); cpl_free(row_field); cpl_free(label_len); cpl_free(field_size); } /**@}*/ cpl-6.4.1/cplcore/cpl_init.c0000644000460300003120000003030112136502150012576 00000000000000/* $Id: cpl_init.c,v 1.48 2013-04-26 13:43:04 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-26 13:43:04 $ * $Revision: 1.48 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_init.h" #include "cpl_memory_impl.h" #include "cpl_error_impl.h" #include "cpl_msg.h" #include "cpl_tools.h" #include "cpl_fits.h" #include #include /* getenv() */ #include /* strcmp() */ #include #ifdef CPL_WCS_INSTALLED /* If WCS is installed */ /* Get WCSLIB version number */ #include #endif /* End If WCS is installed */ #if defined CPL_FFTWF_INSTALLED || defined CPL_FFTW_INSTALLED #include #endif /** * @defgroup cpl_init Library Initialization * * The module provides the CPL library startup routine. The startup routine * initialises CPL internal data structures. For this reason, any application * using functions from the CPL libraries @b must call the startup routine * prior to calling any other CPL function. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /** * @brief * Initialise the CPL core library. * * @param self @em CPL_INIT_DEFAULT is the only supported value * @return Nothing. * @note The function must be called once before any other CPL function. * @see cpl_fits_set_mode() * * This function sets up the library internal subsystems, which other * CPL functions expect to be in a defined state. In particular, the CPL * memory management and the CPL messaging systems are initialised by * this function call. * * One of the internal subsystems of CPL handles memory allocation. * The default CPL memory mode is defined during the build procedure, * this default can be changed during the call to cpl_init() via the * environment variable @em CPL_MEMORY_MODE. The valid values are * 0: Use the default system functions for memory handling * 1: Exit if a memory-allocation fails, provide checking for memory leaks, * limited reporting of memory allocation and limited protection on * deallocation of invalid pointers. * 2: Exit if a memory-allocation fails, provide checking for memory leaks, * extended reporting of memory allocation and protection on deallocation * of invalid pointers. * Any other value (including NULL) will leave the default memory mode * unchanged. * * This function also reads the environment variable @em CPL_IO_MODE. * Iff set to 1, cpl_fits_set_mode() is called with CPL_FITS_START_CACHING. * * Possible #_cpl_error_code_ set in this function: * - CPL_ERROR_INCOMPATIBLE_INPUT if there is an inconsistency between the run- * time and compile-time versions of a library that CPL depends on internally, * e.g. CFITSIO. This error may occur with dynamic linking. If it does occur, * the use of CPL may lead to unexpected behaviour. */ void cpl_init(unsigned self) { #ifndef CPL_CFITSIO_MAX_VERSION #define CPL_CFITSIO_MAX_VERSION 4.0 #endif #define CPL_CFITSIO_THREAD_UNSAFE 3.18 #ifdef CFITSIO_VERSION #define CPL_CFITSIO_VERSION CFITSIO_VERSION #else /* This macro was introduced after version 2.510 */ /* Since CPL was only verified to work with one version of CFITSIO that did not define CFITSIO_VERSION (namely version 2.510), it is assumed at this point that the version actually is 2.510. */ #define CPL_CFITSIO_VERSION 2.51 #endif float cfitsio_version; const float cfitsio_version_diff = fits_get_version(&cfitsio_version) - (CPL_CFITSIO_VERSION); /* FIXME: CPLs internal config.h should define a macro with the supported CFITSIO version range, to ensure consistency between configure and run-time check. */ const float cfitsio_version_supported_min = 2.51; const float cfitsio_version_supported_max = CPL_CFITSIO_MAX_VERSION; int memory_mode = CPL_XMEMORY_MODE; /* Default from configure */ const char * memory_mode_string = getenv("CPL_MEMORY_MODE"); const char * io_fits_mode_string = getenv("CPL_IO_MODE"); const cpl_boolean use_io_fits = io_fits_mode_string != NULL && strcmp("1", io_fits_mode_string) == 0; char * err_msg = NULL; if (memory_mode_string != NULL) { if (strcmp("0", memory_mode_string) == 0) { memory_mode = 0; } else if (strcmp("1", memory_mode_string) == 0) { memory_mode = 1; } else if (strcmp("2", memory_mode_string) == 0) { memory_mode = 2; } /* else: Ignore the environment variable */ } cpl_memory_init(memory_mode); cpl_msg_init(); if (self != CPL_INIT_DEFAULT) { /* Avoid unused variable warning */ cpl_msg_warning(cpl_func, "Illegal input ignored"); } /* Oh, grief: The choice of float for the CFITSIO version means that for version 2.510, fits_get_version() differs from 2.51. On a Intel Xeon running Scientific Linux SL 4.0 and gcc version 4.2.1 this difference amounts to 8 multiples of FLT_EPSILON. Let us hope future versions of CFITSIO chooses version numbers that are representable by floats with an accuracy better than 100 multiples of FLT_EPSILON. :-(((((((((((((((((((((((((((((((((((((((((((((((((((( */ if (cfitsio_version_diff < -100.0 * FLT_EPSILON) { (void)cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "Run-time version %.3f of CFITSIO " "is lower than compile-time version " "%.3f", cfitsio_version, CPL_CFITSIO_VERSION); } else if (cfitsio_version_diff > 100.0 * FLT_EPSILON) { (void)cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "Run-time version %.3f of CFITSIO is " "higher than compile-time version " "%.3f", cfitsio_version, CPL_CFITSIO_VERSION); } if (cfitsio_version < cfitsio_version_supported_min - 100.0 * FLT_EPSILON) { err_msg = cpl_sprintf("The run-time version %.3f of CFITSIO is lower " "than the supported version %.3f", cfitsio_version, cfitsio_version_supported_min); } else if (cfitsio_version > cfitsio_version_supported_max + 100.0 * FLT_EPSILON) { err_msg = cpl_sprintf("The run-time version %.3f of CFITSIO is higher " "than the supported version %.3f", cfitsio_version, cfitsio_version_supported_max); } if (err_msg != NULL) { if (cpl_error_get_code()) { /* There is already an existing CPL error code, so this additional problem is communicated via the CPL error state */ (void)cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "%s", err_msg); } else { /* This condition is not in itself an error, so issue a warning */ cpl_msg_warning(cpl_func, "%s. Continue at your own risk.", err_msg); } cpl_free(err_msg); err_msg = NULL; } #ifdef _OPENMP #define CPL_OMP_NUM_THREADS "OMP_NUM_THREADS" /* FIXME: A CFITSIO build of at least v. 3.18 may still be thread-unsafe dependeing on how it was built. Detection ? */ if (cfitsio_version < CPL_CFITSIO_THREAD_UNSAFE) { const char * omp_num_threads_string = getenv(CPL_OMP_NUM_THREADS); const int npe = omp_num_threads_string ? atoi(omp_num_threads_string) : 1; char * npe_warn = npe > 1 ? cpl_sprintf(" " CPL_OMP_NUM_THREADS " is " "%d!", npe) : cpl_strdup(""); if (cpl_error_get_code()) { (void)cpl_error_set_message_(CPL_ERROR_INCOMPATIBLE_INPUT, "CPL was built with OpenMP (v. " CPL_STRINGIFY(_OPENMP) "), but with a " "non-thread-safe version of CFITSIO: " "%g < " CPL_STRINGIFY(CPL_CFITSIO_THREAD_UNSAFE) ".%s Continue at your own risk.", cfitsio_version, npe_warn); } else { cpl_msg_warning(cpl_func, "CPL was built with OpenMP (v. " CPL_STRINGIFY(_OPENMP) "), but with a non-thread-" "safe version of CFITSIO: %g < " CPL_STRINGIFY(CPL_CFITSIO_THREAD_UNSAFE) ".%s Continue at your own risk.", cfitsio_version, npe_warn); } cpl_free(npe_warn); } #endif #ifdef HAVE_LIBPTHREAD cpl_error_init_locks(); #endif if (use_io_fits) { cpl_fits_set_mode(CPL_FITS_START_CACHING); } return; } /*----------------------------------------------------------------------------*/ /** @brief Create a string of version numbers of CPL and its libraries @param self CPL_DESCRIPTION_DEFAULT @return A pointer to a constant character array */ /*----------------------------------------------------------------------------*/ const char * cpl_get_description(unsigned self) { /* At a later stage decription_mode may be used to select what version information to return, e.g. CPL only, 3rd party libraries only, or both */ #ifdef CPL_WCS_INSTALLED #ifdef WCSLIB_VERSION #define CPL_WCS_APPEND ", WCSLIB = " CPL_STRINGIFY(WCSLIB_VERSION) #else #define CPL_WCS_APPEND ", WCSLIB" #endif #else #define CPL_WCS_APPEND " (WCSLIB unavailable)" #endif #if defined CPL_FFTW_INSTALLED && defined CPL_FFTWF_INSTALLED #define CPL_FFTW_APPEND ", FFTW (double and single precision)" #elif defined CPL_FFTW_INSTALLED #define CPL_FFTW_APPEND ", FFTW (double precision)" #elif defined CPL_FFTWF_INSTALLED #define CPL_FFTW_APPEND ", FFTW (single precision)" #else #define CPL_FFTW_APPEND " (FFTW unavailable)" #endif #ifdef _OPENMP #define CPL_OPENMP_APPEND ", OPENMP = " CPL_STRINGIFY(_OPENMP) #else #define CPL_OPENMP_APPEND "" #endif #ifdef CPL_IO_FITS_MAX_OPEN #define CPL_IO_FITS_APPEND ", CPL_IO_FITS_OPEN = " \ CPL_STRINGIFY(CPL_IO_FITS_MAX_OPEN) #else #define CPL_IO_FITS_APPEND "" #endif if (self != CPL_DESCRIPTION_DEFAULT) { /* Avoid unused variable warning */ cpl_msg_warning(cpl_func, "Illegal input ignored"); } #ifdef CFITSIO_VERSION return "CPL = " VERSION ", CFITSIO = " CPL_STRINGIFY(CFITSIO_VERSION) CPL_WCS_APPEND CPL_FFTW_APPEND CPL_OPENMP_APPEND CPL_IO_FITS_APPEND; #else /* FIXME: Verify that 3.03 introduced CFITSIO_VERSION */ return "CPL = " VERSION ", CFITSIO less than 3.03" CPL_WCS_APPEND CPL_FFTW_APPEND CPL_OPENMP_APPEND CPL_IO_FITS_APPEND; #endif } /** * @brief * Stop the internal subsystems of CPL. * * @return Nothing. * @note Currently, the behaviour of any CPL function becomes * undefined after this function is called. * * This function must be called after any other CPL function * is called. * */ void cpl_end(void) { (void)cpl_fits_set_mode(CPL_FITS_STOP_CACHING); #ifdef CPL_FFTWF_INSTALLED fftwf_cleanup(); #endif #ifdef CPL_FFTW_INSTALLED fftw_cleanup(); #endif cpl_msg_stop(); return; } /**@}*/ cpl-6.4.1/cplcore/cpl_plot.h0000644000460300003120000000611311611762302012626 00000000000000/* $Id: cpl_plot.h,v 1.11 2011-07-21 08:35:14 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-21 08:35:14 $ * $Revision: 1.11 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_PLOT_H #define CPL_PLOT_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_error.h" #include "cpl_vector.h" #include "cpl_bivector.h" #include "cpl_table.h" #include "cpl_image.h" #include "cpl_mask.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_error_code cpl_plot_vector(const char *, const char *, const char *, const cpl_vector *); cpl_error_code cpl_plot_vectors(const char *, const char *, const char *, const cpl_vector **, cpl_size); cpl_error_code cpl_plot_bivector(const char *, const char *, const char *, const cpl_bivector *); cpl_error_code cpl_plot_bivectors(const char *, const char **, const char *, const cpl_bivector **, cpl_size); cpl_error_code cpl_plot_mask(const char *, const char *, const char *, const cpl_mask *); cpl_error_code cpl_plot_image(const char *, const char *, const char *, const cpl_image *); cpl_error_code cpl_plot_image_row(const char *, const char *, const char *, const cpl_image *, cpl_size, cpl_size, cpl_size); cpl_error_code cpl_plot_image_col(const char *, const char *, const char *, const cpl_image *, cpl_size, cpl_size, cpl_size); cpl_error_code cpl_plot_column(const char *, const char *, const char *, const cpl_table *, const char *, const char *); cpl_error_code cpl_plot_columns(const char *, const char *, const char *, const cpl_table *, const char **, cpl_size); CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_column.c0000644000460300003120000266126512267253205013166 00000000000000/* $Id: cpl_column.c,v 1.122 2013-04-26 14:13:58 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-26 14:13:58 $ * $Revision: 1.122 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "cpl_error_impl.h" #include "cpl_errorstate.h" #include "cpl_tools.h" #include "cpl_memory.h" #include #include #include #include #include #define INT_FORM "% 7d" #define LONG_FORM "% 7ld" #define LONG_LONG_FORM "% 7lld" #define SIZE_TYPE_FORM "% 7" CPL_SIZE_FORMAT #define FLOAT_FORM "% 1.5e" #define DOUBLE_FORM "% 1.5e" #define STRING_FORM "%s" /* * @defgroup cpl_column Columns * * This module provides functions to create, destroy and use a @em cpl_column. * All the functions should be considered private to the cpl_table object, * and not used elsewhere. * * @par Synopsis: * @code * #include * @endcode */ /* @{*/ /* * Container of column values (mirroring the legal types). Private. */ typedef union _cpl_column_values_ { int *i; /* CPL_TYPE_INT */ long *l; /* CPL_TYPE_LONG */ long long *ll; /* CPL_TYPE_LONG_LONG */ cpl_size *sz; /* CPL_TYPE_SIZE */ float *f; /* CPL_TYPE_FLOAT */ double *d; /* CPL_TYPE_DOUBLE */ float complex *cf; /* CPL_TYPE_FLOAT_COMPLEX */ double complex *cd; /* CPL_TYPE_DOUBLE_COMPLEX */ char **s; /* CPL_TYPE_STRING */ cpl_array **array; /* Array types */ } cpl_column_values; /* * The real thing: the column type (private); */ struct _cpl_column_ { char *name; char *unit; char *format; cpl_size length; cpl_size depth; cpl_type type; cpl_type savetype; cpl_column_values *values; cpl_column_flag *null; /* NULL flags buffer */ cpl_size nullcount; /* Number of NULLs in column */ cpl_array *dimensions; /* Number of dimensions in column */ }; /* * Private methods: */ /* * @brief * Get size in bytes of a given column type (private). * * @param type Column legal data type. * * @return Size in bytes of a given column type * * This private function computes the number of bytes of the data * types listed in the @em cpl_type enum, applying @c sizeof() * to the corresponding dereferenced member of the @em cpl_column_values * union. Undefined or illegal types returns 0. */ inline static size_t cpl_column_type_size(cpl_type type) { size_t sz = 0; switch (type) { case CPL_TYPE_INT: sz = sizeof(int); break; case CPL_TYPE_LONG: sz = sizeof(long); break; case CPL_TYPE_LONG_LONG: sz = sizeof(long long); break; case CPL_TYPE_SIZE: sz = sizeof(cpl_size); break; case CPL_TYPE_FLOAT: sz = sizeof(float); break; case CPL_TYPE_DOUBLE: sz = sizeof(double); break; case CPL_TYPE_FLOAT_COMPLEX: sz = sizeof(float complex); break; case CPL_TYPE_DOUBLE_COMPLEX: sz = sizeof(double complex); break; case CPL_TYPE_STRING: sz = sizeof(char *); break; case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: sz = sizeof(cpl_array *); break; default: break; } return sz; } /* * @brief * Create a column values container (private). * * @return Pointer to column values container. * * This private function allocates and initializes a container of * column values. */ static cpl_column_values *cpl_column_values_new(void) { cpl_column_values *value = cpl_calloc(1, sizeof(cpl_column_values)); value->i = NULL; return value; } /* * @brief * Returns the values container of a column (private). * * @return Pointer to column values container, or @em NULL. */ static cpl_column_values *cpl_column_get_values(cpl_column *column) { if (column) return column->values; return NULL; } /* * @brief * Destructor of the container of column values (private). * * @param values Pointer to container of column values. * @param length Column length. * @param type Column type. * * @return Nothing. * * This is a private function used to free all the column data and their * container. */ static void cpl_column_values_delete(cpl_column_values *values, cpl_size length, cpl_type type) { cpl_size i; if (values) { switch (type) { case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: for (i = 0; i < length; i++) cpl_array_delete(values->array[i]); cpl_free((void *)values->array); cpl_free(values); break; case CPL_TYPE_STRING: for (i = 0; i < length; i++) if (values->s[i]) cpl_free(values->s[i]); if (values->s) cpl_free((void *)values->s); cpl_free(values); break; default: if (values->s) cpl_free((void *)values->s); cpl_free(values); break; } } } /* * @brief * Unset a NULL flag (private). * * @param column Column to be accessed. * @param row Position where to unset the NULL. * * @return 0 on success. * * This function is private: the only way for a user to unset a * null flag, is to write to the corresponding column element a * valid value. This function cannot be used for string or array * columns. * Being this function private, all safety checks are removed to * make this function faster, assuming that all checks has been * already performed by the caller. */ static int cpl_column_unset_null(cpl_column *column, cpl_size row) { cpl_size length; if (column->nullcount == 0) /* There are no nulls to unset */ return 0; if (!column->null) /* There are just nulls */ column->null = cpl_malloc(column->length * sizeof(cpl_column_flag)); length = column->length; if (column->nullcount == length) while (length--) column->null[length] = 1; if (column->null[row] == 1) { column->null[row] = 0; column->nullcount--; } if (column->nullcount == 0) { if (column->null) cpl_free(column->null); column->null = NULL; } return 0; } /* * @brief * Unset an interval of NULL flags (private). * * @param column Column to be accessed. * @param start Position where to start unsetting NULLs. * @param count Number of column elements to unset. * * @return 0 on success. * * This function is private: the only way for a user to unset a * null flag, is to write to the corresponding column element a * valid value. This function cannot be used for string or array columns. * Being this function private, all safety checks are removed to * make this function faster, assuming that all checks has been * already performed by the caller. */ static int cpl_column_unset_null_segment(cpl_column *column, cpl_size start, cpl_size count) { cpl_size length = cpl_column_get_size(column); if (start == 0 && count == length) { if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = 0; } if (column->nullcount == 0) return 0; if (!column->null) column->null = cpl_malloc(length * sizeof(cpl_column_flag)); if (column->nullcount == length) { while (length--) column->null[length] = 1; memset(column->null + start, 0, count * sizeof(cpl_column_flag)); column->nullcount -= count; } else { while (count--) { if (column->null[start] == 1) { column->null[start] = 0; column->nullcount--; } start++; } } if (column->nullcount == 0) { if (column->null) cpl_free(column->null); column->null = NULL; } return 0; } void cpl_column_dump_structure(cpl_column *column) { cpl_errorstate prevstate = cpl_errorstate_get(); const char *name = cpl_column_get_name(column); const char *unit = cpl_column_get_unit(column); const char *format = cpl_column_get_format(column); cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); if (column) { printf("Column name : "); if (name) printf("\"%s\"\n", name); else printf("NONE\n"); printf("Column unit : "); if (unit) printf("\"%s\"\n", unit); else printf("NONE\n"); printf("Column format : "); if (format) printf("\"%s\"\n", format); else printf("NONE\n"); printf("Column type : "); switch (type) { case CPL_TYPE_INT: printf("int\n"); break; case CPL_TYPE_LONG: printf("long\n"); break; case CPL_TYPE_LONG_LONG: printf("long long\n"); break; case CPL_TYPE_SIZE: printf("size_type\n"); break; case CPL_TYPE_FLOAT: printf("float\n"); break; case CPL_TYPE_DOUBLE: printf("double\n"); break; case CPL_TYPE_STRING: printf("string\n"); break; default: printf("UNDEFINED\n"); break; } printf("Column length : %" CPL_SIZE_FORMAT "\n", length); printf("Column nulls : %" CPL_SIZE_FORMAT "\n", cpl_column_count_invalid(column)); printf(" (the NULL column %sexists)\n", column->null ? "" : "does not "); } else { printf("Column is NULL\n"); cpl_errorstate_set(prevstate); } } void cpl_column_dump(cpl_column *column, cpl_size start, cpl_size count) { cpl_errorstate prevstate = cpl_errorstate_get(); cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_size nulls = cpl_column_count_invalid(column); cpl_size i = start; if (column) { if (start < length) { if (count > length - start) count = length - start; switch (type) { case CPL_TYPE_INT: if (nulls == 0) { while (count--) { printf("%" CPL_SIZE_FORMAT " %d\n", i, column->values->i[i]); i++; } } else if (nulls == length) { while (count--) { printf("%" CPL_SIZE_FORMAT " %d NULL\n", i, column->values->i[i]); i++; } } else { while (count--) { printf("%" CPL_SIZE_FORMAT " %d %d\n", i, column->values->i[i], column->null[i]); i++; } } break; case CPL_TYPE_LONG: if (nulls == 0) { while (count--) { printf("%" CPL_SIZE_FORMAT " %ld\n", i, column->values->l[i]); i++; } } else if (nulls == length) { while (count--) { printf("%" CPL_SIZE_FORMAT " %ld NULL\n", i, column->values->l[i]); i++; } } else { while (count--) { printf("%" CPL_SIZE_FORMAT " %ld %d\n", i, column->values->l[i], column->null[i]); i++; } } break; case CPL_TYPE_LONG_LONG: if (nulls == 0) { while (count--) { printf("%" CPL_SIZE_FORMAT " %lld\n", i, column->values->ll[i]); i++; } } else if (nulls == length) { while (count--) { printf("%" CPL_SIZE_FORMAT " %lld NULL\n", i, column->values->ll[i]); i++; } } else { while (count--) { printf("%" CPL_SIZE_FORMAT " %lld %d\n", i, column->values->ll[i], column->null[i]); i++; } } break; case CPL_TYPE_SIZE: if (nulls == 0) { while (count--) { printf("%" CPL_SIZE_FORMAT " %" CPL_SIZE_FORMAT "\n", i, column->values->sz[i]); i++; } } else if (nulls == length) { while (count--) { printf("%" CPL_SIZE_FORMAT " %" CPL_SIZE_FORMAT " NULL\n", i, column->values->sz[i]); i++; } } else { while (count--) { printf("%" CPL_SIZE_FORMAT " %" CPL_SIZE_FORMAT " %d\n", i, column->values->sz[i], column->null[i]); i++; } } break; case CPL_TYPE_FLOAT: if (nulls == 0) { while (count--) { printf("%" CPL_SIZE_FORMAT " %f\n", i, column->values->f[i]); i++; } } else if (nulls == length) { while (count--) { printf("%" CPL_SIZE_FORMAT " %f NULL\n", i, column->values->f[i]); i++; } } else { while (count--) { printf("%" CPL_SIZE_FORMAT " %f %d\n", i, column->values->f[i], column->null[i]); i++; } } break; case CPL_TYPE_DOUBLE: if (nulls == 0) { while (count--) { printf("%" CPL_SIZE_FORMAT " %f\n", i, column->values->d[i]); i++; } } else if (nulls == length) { while (count--) { printf("%" CPL_SIZE_FORMAT " %f NULL\n", i, column->values->d[i]); i++; } } else { while (count--) { printf("%" CPL_SIZE_FORMAT " %f %d\n", i, column->values->d[i], column->null[i]); i++; } } break; case CPL_TYPE_STRING: while (count--) { printf("%" CPL_SIZE_FORMAT " %s\n", i, column->values->s[i] ? column->values->s[i] : "NULL"); i++; } break; default: break; } } } else { printf("Column is NULL\n"); cpl_errorstate_set(prevstate); } } /* * @brief * Create a new empty column (private). * * @param type Column type. * * @return Pointer to the new column, or @c NULL. * * This private function allocates memory for a column, its type is * assigned, and the container of column values is initialized together * with all the other column properties. */ static cpl_column *cpl_column_new(cpl_type type) { cpl_column *column = cpl_calloc(1, sizeof(cpl_column)); column->values = cpl_column_values_new(); column->name = NULL; column->unit = NULL; column->format = NULL; column->length = 0; column->depth = 0; column->type = type; column->savetype = type & (~CPL_TYPE_POINTER); column->null = NULL; column->nullcount = 0; column->dimensions = NULL; return column; } /* * @brief * Create a new @em integer column. * * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * The function allocates memory for a column, its type is assigned, * and its number of elements is allocated. All column elements are * flagged as invalid. If a negative length is specified, an error * @c CPL_ERROR_ILLEGAL_INPUT is set. Zero length columns are allowed. */ cpl_column *cpl_column_new_int(cpl_size length) { const char *fid = "cpl_column_new_int"; cpl_column *column; if (length < 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_INT); if (length) column->values->i = (int *)cpl_calloc(length, sizeof(int)); else column->values->i = NULL; column->format = cpl_strdup(INT_FORM); column->length = length; column->nullcount = length; return column; } /* * @brief * Create a new @em long integer column. * * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * The function allocates memory for a column, its type is assigned, * and its number of elements is allocated. All column elements are * flagged as invalid. If a negative length is specified, an error * @c CPL_ERROR_ILLEGAL_INPUT is set. Zero length columns are allowed. */ cpl_column *cpl_column_new_long(cpl_size length) { const char *fid = "cpl_column_new_long"; cpl_column *column; if (length < 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_LONG); if (length) column->values->l = (long *)cpl_calloc(length, sizeof(long)); else column->values->l = NULL; column->format = cpl_strdup(LONG_FORM); column->length = length; column->nullcount = length; return column; } /* * @brief * Create a new @em long long integer column. * * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * The function allocates memory for a column, its type is assigned, * and its number of elements is allocated. All column elements are * flagged as invalid. If a negative length is specified, an error * @c CPL_ERROR_ILLEGAL_INPUT is set. Zero length columns are allowed. */ cpl_column *cpl_column_new_long_long(cpl_size length) { const char *fid = "cpl_column_new_long_long"; cpl_column *column; if (length < 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_LONG_LONG); if (length) column->values->ll = (long long *)cpl_calloc(length, sizeof(long long)); else column->values->ll = NULL; column->format = cpl_strdup(LONG_LONG_FORM); column->length = length; column->nullcount = length; return column; } /* * @brief * Create a new @em cpl_size column. * * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * The function allocates memory for a column, its type is assigned, * and its number of elements is allocated. All column elements are * flagged as invalid. If a negative length is specified, an error * @c CPL_ERROR_ILLEGAL_INPUT is set. Zero length columns are allowed. */ cpl_column *cpl_column_new_cplsize(cpl_size length) { const char *fid = "cpl_column_new_cplsize"; cpl_column *column; if (length < 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_SIZE); if (length) column->values->sz = (cpl_size *)cpl_calloc(length, sizeof(cpl_size)); else column->values->sz = NULL; column->format = cpl_strdup(SIZE_TYPE_FORM); column->length = length; column->nullcount = length; return column; } /* * @brief * Create a new @em float column. * * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * See documentation of @c cpl_column_new_int(). */ cpl_column *cpl_column_new_float(cpl_size length) { const char *fid = "cpl_column_new_float"; cpl_column *column; if (length < 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_FLOAT); if (length) column->values->f = (float *)cpl_malloc(length * sizeof(float)); else column->values->f = NULL; column->format = cpl_strdup(FLOAT_FORM); column->length = length; column->nullcount = length; return column; } /* * @brief * Create a new @em float complex column. * * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * See documentation of @c cpl_column_new_int(). */ cpl_column *cpl_column_new_float_complex(cpl_size length) { const char *fid = "cpl_column_new_float_complex"; cpl_column *column; if (length < 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_FLOAT_COMPLEX); if (length) column->values->cf = (float complex *)cpl_malloc(length * sizeof(float complex)); else column->values->cf = NULL; column->format = cpl_strdup(FLOAT_FORM); column->length = length; column->nullcount = length; return column; } /* * @brief * Create a new @em double column. * * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * See documentation of @c cpl_column_new_int(). */ cpl_column *cpl_column_new_double(cpl_size length) { const char *fid = "cpl_column_new_double"; cpl_column *column; if (length < 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_DOUBLE); if (length) column->values->d = (double *)cpl_malloc(length * sizeof(double)); else column->values->d = NULL; column->format = cpl_strdup(DOUBLE_FORM); column->length = length; column->nullcount = length; return column; } /* * @brief * Create a new @em double complex column. * * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * See documentation of @c cpl_column_new_int(). */ cpl_column *cpl_column_new_double_complex(cpl_size length) { const char *fid = "cpl_column_new_double_complex"; cpl_column *column; if (length < 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_DOUBLE_COMPLEX); if (length) column->values->cd = (double complex *)cpl_malloc(length * sizeof(double complex)); else column->values->cd = NULL; column->format = cpl_strdup(DOUBLE_FORM); column->length = length; column->nullcount = length; return column; } /* * @brief * Create a new string column. * * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * The function allocates memory for a column of pointers to @em char, * all initialized to @c NULL pointers. No memory is allocated for the * single column elements. If a negative length is specified, an error * @c CPL_ERROR_ILLEGAL_INPUT is set. Zero length columns are allowed. * No memory is allocated for the single column elements. */ cpl_column *cpl_column_new_string(cpl_size length) { const char *fid = "cpl_column_new_string"; cpl_column *column; if (length < 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_STRING); if (length) column->values->s = (char **)cpl_calloc(length, sizeof (char *)); else column->values->s = NULL; column->format = cpl_strdup(STRING_FORM); column->length = length; return column; } /* * @brief * Create a new array column. * * @param type Column type * @param length Number of arrays in column. * @param depth Number of elements per array in column. * * @return Pointer to the new column, or @c NULL in case of error. * * The function allocates memory for a column, its type is assigned, * and its number of elements is allocated. All column elements are * flagged as invalid. If a negative length is specified, an error * @c CPL_ERROR_ILLEGAL_INPUT is set. Zero length columns are allowed. */ cpl_column *cpl_column_new_array(cpl_type type, cpl_size length, cpl_size depth) { const char *fid = "cpl_column_new_array"; cpl_column *column; if (length < 0 || depth < 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(type | CPL_TYPE_POINTER); if (length) column->values->array = cpl_calloc(length, sizeof (cpl_array *)); else column->values->array = NULL; switch(type) { case CPL_TYPE_INT: case CPL_TYPE_INT | CPL_TYPE_POINTER: column->format = cpl_strdup(INT_FORM); break; case CPL_TYPE_LONG: case CPL_TYPE_LONG | CPL_TYPE_POINTER: column->format = cpl_strdup(LONG_FORM); break; case CPL_TYPE_LONG_LONG: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: column->format = cpl_strdup(LONG_LONG_FORM); break; case CPL_TYPE_SIZE: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: column->format = cpl_strdup(SIZE_TYPE_FORM); break; case CPL_TYPE_FLOAT: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: column->format = cpl_strdup(FLOAT_FORM); break; case CPL_TYPE_DOUBLE: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: column->format = cpl_strdup(DOUBLE_FORM); break; case CPL_TYPE_FLOAT_COMPLEX: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: column->format = cpl_strdup(FLOAT_FORM); break; case CPL_TYPE_DOUBLE_COMPLEX: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: column->format = cpl_strdup(DOUBLE_FORM); break; case CPL_TYPE_STRING: case CPL_TYPE_STRING | CPL_TYPE_POINTER: column->format = cpl_strdup(STRING_FORM); break; default: cpl_column_delete(column); cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } column->length = length; column->depth = depth; return column; } /* * @brief * Change saving type for a given column. * * @param column Column. * @param type New saving type for this column. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any argument is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The specified column cannot be saved with the specified type. *
* @enderror * * This function indicates that the specified column should be saved * by the function @c cpl_table_save() into the specified type. * If this function is not called for a given column, that column * would be saved into the same type of the column. It is not * possible to save an integer column into a floating point type, * or the other way around: if you need to do so, use the function * @c cpl_table_cast_column() first. For each column type, the * (currently) legal saving types are listed below, together with * the FITS types they would map into: * * @code * * CPL_TYPE_INT: CPL_TYPE_INT TINT (default) * CPL_TYPE_BOOL TLOGICAL * CPL_TYPE_CHAR TSBYTE * CPL_TYPE_UCHAR TBYTE * CPL_TYPE_SHORT TSHORT * CPL_TYPE_LONG: CPL_TYPE_LONG TLONG (default) * CPL_TYPE_INT TINT * CPL_TYPE_BOOL TLOGICAL * CPL_TYPE_CHAR TSBYTE * CPL_TYPE_UCHAR TBYTE * CPL_TYPE_SHORT TSHORT * CPL_TYPE_LONG_LONG: CPL_TYPE_LONG_LONG TLONGLONG (default) * CPL_TYPE_LONG TLONG * CPL_TYPE_INT TINT * CPL_TYPE_BOOL TLOGICAL * CPL_TYPE_CHAR TSBYTE * CPL_TYPE_UCHAR TBYTE * CPL_TYPE_SHORT TSHORT * CPL_TYPE_SIZE: CPL_TYPE_SIZE TLONGLONG (default) * CPL_TYPE_LONG TLONG * CPL_TYPE_INT TINT * CPL_TYPE_BOOL TLOGICAL * CPL_TYPE_CHAR TSBYTE * CPL_TYPE_UCHAR TBYTE * CPL_TYPE_SHORT TSHORT * CPL_TYPE_FLOAT: CPL_TYPE_FLOAT TFLOAT (default) * CPL_TYPE_DOUBLE: CPL_TYPE_DOUBLE TDOUBLE (default) * CPL_TYPE_STRING: CPL_TYPE_STRING TSTRING (default) * * @endcode * * As it can be seen, only CPL_TYPE_BOOL is currently supported. */ cpl_error_code cpl_column_set_save_type(cpl_column *column, cpl_type type) { if (column == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); type &= ~CPL_TYPE_POINTER; switch (column->type & ~CPL_TYPE_POINTER) { case CPL_TYPE_INT: switch (type) { case CPL_TYPE_INT: /* List of legal types, ended by break */ case CPL_TYPE_BOOL: case CPL_TYPE_CHAR: case CPL_TYPE_UCHAR: case CPL_TYPE_SHORT: break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } break; case CPL_TYPE_LONG: switch (type) { case CPL_TYPE_LONG: /* List of legal types, ended by break */ case CPL_TYPE_INT: case CPL_TYPE_BOOL: case CPL_TYPE_CHAR: case CPL_TYPE_UCHAR: case CPL_TYPE_SHORT: break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } break; case CPL_TYPE_LONG_LONG: switch (type) { case CPL_TYPE_LONG_LONG: /* List of legal types, ended by break */ case CPL_TYPE_LONG: case CPL_TYPE_INT: case CPL_TYPE_BOOL: case CPL_TYPE_CHAR: case CPL_TYPE_UCHAR: case CPL_TYPE_SHORT: break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } break; case CPL_TYPE_SIZE: switch (type) { case CPL_TYPE_LONG_LONG: /* List of legal types, ended by break */ case CPL_TYPE_LONG: case CPL_TYPE_INT: case CPL_TYPE_BOOL: case CPL_TYPE_CHAR: case CPL_TYPE_UCHAR: case CPL_TYPE_SHORT: break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } break; case CPL_TYPE_FLOAT: switch (type) { case CPL_TYPE_FLOAT: /* List of legal types, ended by break */ break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } break; case CPL_TYPE_DOUBLE: switch (type) { case CPL_TYPE_DOUBLE: /* List of legal types, ended by break */ break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } break; case CPL_TYPE_FLOAT_COMPLEX: switch (type) { case CPL_TYPE_FLOAT_COMPLEX: /* List of legal types, ended by break */ break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } break; case CPL_TYPE_DOUBLE_COMPLEX: switch (type) { case CPL_TYPE_DOUBLE_COMPLEX: /* List of legal types, ended by break */ break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } break; case CPL_TYPE_STRING: switch (type) { case CPL_TYPE_STRING: /* List of legal types, ended by break */ break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } break; default: return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } column->savetype = type; return CPL_ERROR_NONE; } /* * @brief * Get the saving type of a column. * * @param column Column to get the saving type from. * * @return Saving type of column, or @c CPL_TYPE_INVALID if a @c NULL column is * passed to the function. * * If the column is @c NULL, @c CPL_ERROR_NULL_INPUT is set. */ cpl_type cpl_column_get_save_type(const cpl_column *column) { if (column) return column->savetype; cpl_error_set_(CPL_ERROR_NULL_INPUT); return CPL_TYPE_INVALID; } /* * @brief * Create a new @em integer column from existing data. * * @param data Existing data buffer. * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * This function creates a new @em integer column that will encapsulate * the given data. Note that the size of the data array is not checked in * any way, and that the data values are all considered valid: invalid * values should be marked using the functions @c cpl_column_set_invalid() * and @c cpl_column_fill_invalid(). The data array is not copied, * so it should never be deallocated: to deallocate it, the function * @c cpl_column_delete() should be called instead. Alternatively, the * function @c cpl_column_unwrap() might be used, and the data array * deallocated afterwards. A zero or negative length is illegal, and * would cause an error @c CPL_ERROR_ILLEGAL_INPUT to be set. An input * @c NULL pointer would set an error @c CPL_ERROR_NULL_INPUT. * * @note * Functions that handle columns assume that a column data array * is dynamically allocated: with a statically allocated array * any function implying memory handling (@c cpl_column_set_size(), * @c cpl_column_delete(), etc.) would crash the program. This means * that a static array should never be passed to this function if * memory handling is planned. In case of a static array, only the * @c cpl_column_unwrap() destructor can be used. */ cpl_column *cpl_column_wrap_int(int *data, cpl_size length) { const char *fid = "cpl_column_wrap_int"; cpl_column *column; if (data == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } if (length <= 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_INT); column->format = cpl_strdup(INT_FORM); column->length = length; column->values->i = data; return column; } /* * @brief * Create a new @em long @em integer column from existing data. * * @param data Existing data buffer. * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * This function creates a new @em long @em integer column that will * encapsulate the given data. Note that the size of the data array is * not checked in any way, and that the data values are all considered valid: * invalid values should be marked using the functions * @c cpl_column_set_invalid() and @c cpl_column_fill_invalid(). * The data array is not copied, so it should never be deallocated: to * deallocate it, the function @c cpl_column_delete() should be called * instead. Alternatively, the function @c cpl_column_unwrap() might be used, * and the data array deallocated afterwards. A zero or negative length is * illegal, and would cause an error @c CPL_ERROR_ILLEGAL_INPUT to be set. * An input @c NULL pointer would set an error @c CPL_ERROR_NULL_INPUT. * * @note * Functions that handle columns assume that a column data array * is dynamically allocated: with a statically allocated array * any function implying memory handling (@c cpl_column_set_size(), * @c cpl_column_delete(), etc.) would crash the program. This means * that a static array should never be passed to this function if * memory handling is planned. In case of a static array, only the * @c cpl_column_unwrap() destructor can be used. */ cpl_column *cpl_column_wrap_long(long *data, cpl_size length) { const char *fid = "cpl_column_wrap_long"; cpl_column *column; if (data == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } if (length <= 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_LONG); column->format = cpl_strdup(LONG_FORM); column->length = length; column->values->l = data; return column; } /* * @brief * Create a new @em long @em long @em integer column from existing data. * * @param data Existing data buffer. * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * This function creates a new @em long @em long @em integer column that * will encapsulate the given data. Note that the size of the data array is * not checked in any way, and that the data values are all considered valid: * invalid values should be marked using the functions * @c cpl_column_set_invalid() and @c cpl_column_fill_invalid(). The data * array is not copied, so it should never be deallocated: to deallocate it, * the function @c cpl_column_delete() should be called instead. * Alternatively, the function @c cpl_column_unwrap() might be used, and * the data array deallocated afterwards. A zero or negative length is * illegal, and would cause an error @c CPL_ERROR_ILLEGAL_INPUT to be set. * An input @c NULL pointer would set an error @c CPL_ERROR_NULL_INPUT. * * @note * Functions that handle columns assume that a column data array * is dynamically allocated: with a statically allocated array * any function implying memory handling (@c cpl_column_set_size(), * @c cpl_column_delete(), etc.) would crash the program. This means * that a static array should never be passed to this function if * memory handling is planned. In case of a static array, only the * @c cpl_column_unwrap() destructor can be used. */ cpl_column *cpl_column_wrap_long_long(long long *data, cpl_size length) { const char *fid = "cpl_column_wrap_long_long"; cpl_column *column; if (data == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } if (length <= 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_LONG_LONG); column->format = cpl_strdup(LONG_LONG_FORM); column->length = length; column->values->ll = data; return column; } /* * @brief * Create a new @em cpl_size column from existing data. * * @param data Existing data buffer. * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * This function creates a new @em cpl_size column that will encapsulate * the given data. Note that the size of the data array is not checked * in any way, and that the data values are all considered valid: * invalid values should be marked using the functions * @c cpl_column_set_invalid() and @c cpl_column_fill_invalid(). The data * array is not copied, so it should never be deallocated: to deallocate it, * the function @c cpl_column_delete() should be called instead. * Alternatively, the function @c cpl_column_unwrap() might be used, and * the data array deallocated afterwards. A zero or negative length is * illegal, and would cause an error @c CPL_ERROR_ILLEGAL_INPUT to be set. * An input @c NULL pointer would set an error @c CPL_ERROR_NULL_INPUT. * * @note * Functions that handle columns assume that a column data array * is dynamically allocated: with a statically allocated array * any function implying memory handling (@c cpl_column_set_size(), * @c cpl_column_delete(), etc.) would crash the program. This means * that a static array should never be passed to this function if * memory handling is planned. In case of a static array, only the * @c cpl_column_unwrap() destructor can be used. */ cpl_column *cpl_column_wrap_cplsize(cpl_size *data, cpl_size length) { const char *fid = "cpl_column_wrap_cplsize"; cpl_column *column; if (data == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } if (length <= 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_SIZE); column->format = cpl_strdup(SIZE_TYPE_FORM); column->length = length; column->values->sz = data; return column; } /* * @brief * Create a new @em float column from existing data. * * @param data Existing data buffer. * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * See documentation of function @c cpl_column_wrap_int(). */ cpl_column *cpl_column_wrap_float(float *data, cpl_size length) { const char *fid = "cpl_column_wrap_float"; cpl_column *column; if (data == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } if (length <= 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_FLOAT); column->format = cpl_strdup(FLOAT_FORM); column->length = length; column->values->f = data; return column; } /* * @brief * Create a new @em float complex column from existing data. * * @param data Existing data buffer. * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * See documentation of function @c cpl_column_wrap_int(). */ cpl_column *cpl_column_wrap_float_complex(float complex *data, cpl_size length) { const char *fid = "cpl_column_wrap_float_complex"; cpl_column *column; if (data == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } if (length <= 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_FLOAT_COMPLEX); column->format = cpl_strdup(FLOAT_FORM); column->length = length; column->values->cf = data; return column; } /* * @brief * Create a new @em double column from existing data. * * @param data Existing data buffer. * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * See documentation of function @c cpl_column_wrap_int(). */ cpl_column *cpl_column_wrap_double(double *data, cpl_size length) { const char *fid = "cpl_column_wrap_double"; cpl_column *column; if (data == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } if (length <= 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_DOUBLE); column->format = cpl_strdup(DOUBLE_FORM); column->length = length; column->values->d = data; return column; } /* * @brief * Create a new @em double complex column from existing data. * * @param data Existing data buffer. * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * See documentation of function @c cpl_column_wrap_int(). */ cpl_column *cpl_column_wrap_double_complex(double complex *data, cpl_size length) { const char *fid = "cpl_column_wrap_double_complex"; cpl_column *column; if (data == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } if (length <= 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_DOUBLE_COMPLEX); column->format = cpl_strdup(DOUBLE_FORM); column->length = length; column->values->cd = data; return column; } /* * @brief * Create a new character string column from existing data. * * @param data Existing data buffer. * @param length Number of elements in column. * * @return Pointer to the new column, or @c NULL in case of error. * * See documentation of function @c cpl_column_wrap_int(). */ cpl_column *cpl_column_wrap_string(char **data, cpl_size length) { const char *fid = "cpl_column_wrap_string"; cpl_column *column; if (data == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } if (length <= 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } column = cpl_column_new(CPL_TYPE_STRING); column->format = cpl_strdup(STRING_FORM); column->length = length; column->values->s = data; return column; } /* * @brief * Copy array of numerical data to a numerical column. * * @param column Existing column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the column is not a numerical * column, a @c CPL_ERROR_INVALID_TYPE is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * The input data are copied into the specified column. If the type of the * accessed column is not double, data values will be truncated according * to C casting rules. The size of the input array is not checked in any * way, and the data values are all considered valid: invalid values * should be marked using the functions @c cpl_column_set_invalid() and * @c cpl_column_fill_invalid(). If @em N is the length of the column, * the first @em N values of the input data buffer would be copied to * the column buffer. If the column had length zero, no values would * be copied. */ cpl_error_code cpl_column_copy_data(cpl_column *column, const double *data) { const char *fid = "cpl_column_copy_data"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (data == 0x0 || column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (length == 0) return CPL_ERROR_NONE; switch (type) { case CPL_TYPE_INT: { int *idata = cpl_column_get_data_int(column); while (length--) *idata++ = *data++; break; } case CPL_TYPE_LONG: { long *ldata = cpl_column_get_data_long(column); while (length--) *ldata++ = *data++; break; } case CPL_TYPE_LONG_LONG: { long long *lldata = cpl_column_get_data_long_long(column); while (length--) *lldata++ = *data++; break; } case CPL_TYPE_SIZE: { cpl_size *szdata = cpl_column_get_data_cplsize(column); while (length--) *szdata++ = *data++; break; } case CPL_TYPE_FLOAT: { float *fdata = cpl_column_get_data_float(column); while (length--) *fdata++ = *data++; break; } case CPL_TYPE_DOUBLE: { memcpy(column->values->d, data, column->length * sizeof(double)); break; } default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = 0; return CPL_ERROR_NONE; } /* * @brief * Copy array of complex data to a complex column. * * @param column Existing column. * @param data Existing data buffer. * * @return @c CPL_ERROR_NONE on success. If the column is not a complex * column, a @c CPL_ERROR_INVALID_TYPE is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * The input data are copied into the specified column. If the type of the * accessed column is not double, data values will be truncated according * to C casting rules. The size of the input array is not checked in any * way, and the data values are all considered valid: invalid values * should be marked using the functions @c cpl_column_set_invalid() and * @c cpl_column_fill_invalid(). If @em N is the length of the column, * the first @em N values of the input data buffer would be copied to * the column buffer. If the column had length zero, no values would * be copied. */ cpl_error_code cpl_column_copy_data_complex(cpl_column *column, const double complex *data) { const char *fid = "cpl_column_copy_data_complex"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (data == 0x0 || column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (length == 0) return CPL_ERROR_NONE; switch (type) { case CPL_TYPE_FLOAT_COMPLEX: { float complex *cfdata = cpl_column_get_data_float_complex(column); while (length--) *cfdata++ = *data++; break; } case CPL_TYPE_DOUBLE_COMPLEX: memcpy(column->values->cd, data, column->length * sizeof(double complex)); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = 0; return CPL_ERROR_NONE; } /* * @brief * Copy existing data to an @em integer column. * * @param column Existing column. * @param data Existing data buffer. * * @return 0 on success. If the input column is not integer, a * @c CPL_ERROR_TYPE_MISMATCH is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * The input data are copied into the specified column. The size of the * input array is not checked in any way, and the data values are all * considered valid: invalid values should be marked using the functions * @c cpl_column_set_invalid() and @c cpl_column_fill_invalid(). If @em N * is the length of the column, the first @em N values of the input data * buffer would be copied to the column buffer. If the column had length * zero, no values would be copied. */ cpl_error_code cpl_column_copy_data_int(cpl_column *column, const int *data) { const char *fid = "cpl_column_copy_data_int"; cpl_type type = cpl_column_get_type(column); if (data == 0x0 || column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (type != CPL_TYPE_INT) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (column->length == 0) return CPL_ERROR_NONE; memcpy(column->values->i, data, column->length * sizeof(int)); if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = 0; return CPL_ERROR_NONE; } /* * @brief * Copy existing data to a @em long @em integer column. * * @param column Existing column. * @param data Existing data buffer. * * @return 0 on success. If the input column is not long integer, a * @c CPL_ERROR_TYPE_MISMATCH is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * The input data are copied into the specified column. The size of the * input array is not checked in any way, and the data values are all * considered valid: invalid values should be marked using the functions * @c cpl_column_set_invalid() and @c cpl_column_fill_invalid(). If @em N * is the length of the column, the first @em N values of the input data * buffer would be copied to the column buffer. If the column had length * zero, no values would be copied. */ cpl_error_code cpl_column_copy_data_long(cpl_column *column, const long *data) { const char *fid = "cpl_column_copy_data_long"; cpl_type type = cpl_column_get_type(column); if (data == 0x0 || column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (type != CPL_TYPE_LONG) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (column->length == 0) return CPL_ERROR_NONE; memcpy(column->values->l, data, column->length * sizeof(long)); if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = 0; return CPL_ERROR_NONE; } /* * @brief * Copy existing data to a @em long @em long @em integer column. * * @param column Existing column. * @param data Existing data buffer. * * @return 0 on success. If the input column is not long long integer, a * @c CPL_ERROR_TYPE_MISMATCH is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * The input data are copied into the specified column. The size of the * input array is not checked in any way, and the data values are all * considered valid: invalid values should be marked using the functions * @c cpl_column_set_invalid() and @c cpl_column_fill_invalid(). If @em N * is the length of the column, the first @em N values of the input data * buffer would be copied to the column buffer. If the column had length * zero, no values would be copied. */ cpl_error_code cpl_column_copy_data_long_long(cpl_column *column, const long long *data) { const char *fid = "cpl_column_copy_data_long_long"; cpl_type type = cpl_column_get_type(column); if (data == 0x0 || column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (type != CPL_TYPE_LONG_LONG) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (column->length == 0) return CPL_ERROR_NONE; memcpy(column->values->ll, data, column->length * sizeof(long long)); if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = 0; return CPL_ERROR_NONE; } /* * @brief * Copy existing data to a @em cpl_size column. * * @param column Existing column. * @param data Existing data buffer. * * @return 0 on success. If the input column is not long long integer, a * @c CPL_ERROR_TYPE_MISMATCH is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * The input data are copied into the specified column. The size of the * input array is not checked in any way, and the data values are all * considered valid: invalid values should be marked using the functions * @c cpl_column_set_invalid() and @c cpl_column_fill_invalid(). If @em N * is the length of the column, the first @em N values of the input data * buffer would be copied to the column buffer. If the column had length * zero, no values would be copied. */ cpl_error_code cpl_column_copy_data_cplsize(cpl_column *column, const cpl_size *data) { const char *fid = "cpl_column_copy_data_cplsize"; cpl_type type = cpl_column_get_type(column); if (data == 0x0 || column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (type != CPL_TYPE_SIZE) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (column->length == 0) return CPL_ERROR_NONE; memcpy(column->values->sz, data, column->length * sizeof(cpl_size)); if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = 0; return CPL_ERROR_NONE; } /* * @brief * Copy existing data to a @em float column. * * @param column Existing column. * @param data Existing data buffer. * * @return 0 on success. If the input column is not float, a * @c CPL_ERROR_TYPE_MISMATCH is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * See documentation of function @c cpl_column_copy_data_int(). */ cpl_error_code cpl_column_copy_data_float(cpl_column *column, const float *data) { const char *fid = "cpl_column_copy_data_float"; cpl_type type = cpl_column_get_type(column); if (data == 0x0 || column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (type != CPL_TYPE_FLOAT) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (column->length == 0) return CPL_ERROR_NONE; memcpy(column->values->f, data, column->length * sizeof(float)); if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = 0; return CPL_ERROR_NONE; } /* * @brief * Copy existing data to a @em float complex column. * * @param column Existing column. * @param data Existing data buffer. * * @return 0 on success. If the input column is not float complex, a * @c CPL_ERROR_TYPE_MISMATCH is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * See documentation of function @c cpl_column_copy_data_int(). */ cpl_error_code cpl_column_copy_data_float_complex(cpl_column *column, const float complex *data) { const char *fid = "cpl_column_copy_data_float_complex"; cpl_type type = cpl_column_get_type(column); if (data == 0x0 || column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (type != CPL_TYPE_FLOAT_COMPLEX) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (column->length == 0) return CPL_ERROR_NONE; memcpy(column->values->cf, data, column->length * sizeof(float complex)); if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = 0; return CPL_ERROR_NONE; } /* * @brief * Copy existing data to a @em double column. * * @param column Existing column. * @param data Existing data buffer. * * @return 0 on success. If the input column is not double, a * @c CPL_ERROR_TYPE_MISMATCH is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * See documentation of function @c cpl_column_copy_data_int(). */ cpl_error_code cpl_column_copy_data_double(cpl_column *column, const double *data) { const char *fid = "cpl_column_copy_data_double"; cpl_type type = cpl_column_get_type(column); if (data == 0x0 || column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (type != CPL_TYPE_DOUBLE) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (column->length == 0) return CPL_ERROR_NONE; memcpy(column->values->d, data, column->length * sizeof(double)); if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = 0; return CPL_ERROR_NONE; } /* * @brief * Copy existing data to a @em double complex column. * * @param column Existing column. * @param data Existing data buffer. * * @return 0 on success. If the input column is not double complex, a * @c CPL_ERROR_TYPE_MISMATCH is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * See documentation of function @c cpl_column_copy_data_int(). */ cpl_error_code cpl_column_copy_data_double_complex(cpl_column *column, const double complex *data) { const char *fid = "cpl_column_copy_data_double_complex"; cpl_type type = cpl_column_get_type(column); if (data == 0x0 || column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (type != CPL_TYPE_DOUBLE_COMPLEX) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (column->length == 0) return CPL_ERROR_NONE; memcpy(column->values->cd, data, column->length * sizeof(double complex)); if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = 0; return CPL_ERROR_NONE; } /* * @brief * Copy existing data to a @em string column. * * @param column Existing column. * @param data Existing data buffer. * * @return 0 on success. If the input column is not of type string, a * @c CPL_ERROR_TYPE_MISMATCH is returned. At any @c NULL input * pointer a @c CPL_ERROR_NULL_INPUT would be returned. * * See documentation of function @c cpl_column_copy_data_int(). * * The input data are copied into the specified column. The size of the * input array is not checked in any way. The strings pointed by the input * buffer are all duplicated, while the strings contained in the column * are released before being overwritten. If @em N is the length of the * column, the first @em N values of the input data buffer would be copied * to the column buffer. If the column had length zero, no values would be * copied. */ cpl_error_code cpl_column_copy_data_string(cpl_column *column, const char **data) { const char *fid = "cpl_column_copy_data_string"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); if (data == 0x0 || column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (type != CPL_TYPE_STRING) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); while (length--) { if (column->values->s[length]) cpl_free(column->values->s[length]); if (data[length]) column->values->s[length] = cpl_strdup(data[length]); else column->values->s[length] = NULL; } return CPL_ERROR_NONE; } /* * @brief * Delete a column. * * @param column Column to be deleted. * * @return Nothing. * * This function deletes a column. If the input column is @c NULL, * nothing is done, and no error is set. */ void cpl_column_delete(cpl_column *column) { cpl_type type; cpl_column_values *values; cpl_size length; if (column != NULL) { type = cpl_column_get_type(column); values = cpl_column_get_values(column); length = cpl_column_get_size(column); cpl_column_values_delete(values, length, type); if (column->name) cpl_free(column->name); if (column->unit) cpl_free(column->unit); if (column->format) cpl_free(column->format); if (column->null) cpl_free(column->null); if (column->dimensions) cpl_array_delete(column->dimensions); cpl_free(column); } } /* * @brief * Delete a column, without losing the data. * * @param column Column to be deleted. * * @return Pointer to the internal data buffer. * * This function deletes a column, but the data buffer is not destroyed. * Supposedly, the developer knows that the data are static, or the * developer holds the pointer to the data obtained with the functions * @c cpl_column_get_data_int(), @c cpl_column_get_data_float(), etc. * If the input column is @c NULL, nothing is done, and no error is set. */ void *cpl_column_unwrap(cpl_column *column) { void *d = NULL; if (column != NULL) { cpl_column_values *values = cpl_column_get_values(column); d = (void *)values->i; cpl_free(values); if (column->name) cpl_free(column->name); if (column->unit) cpl_free(column->unit); if (column->format) cpl_free(column->format); if (column->null) cpl_free(column->null); if (column->dimensions) cpl_array_delete(column->dimensions); cpl_free(column); } return d; } /* * @brief * Delete a string column, without losing the single strings. * * @param column Column to be deleted. * * @return Nothing, but if the column is not of string type, a * @c CPL_ERROR_INVALID_TYPE is set. * * This function deletes a string column, but the single strings pointed * by the data buffer are not destroyed. Supposedly, the developer knows * that the strings are static, or the developer holds the pointers to the * strings somewhere else. If the input column is @c NULL, or the input * column is not a string column, nothing is done. */ void cpl_column_delete_but_strings(cpl_column *column) { cpl_type type; cpl_column_values *values; if (column == NULL) return; type = cpl_column_get_type(column); if (type == CPL_TYPE_STRING) { values = cpl_column_get_values(column); if (values) { if (values->s) cpl_free(values->s); cpl_free(values); } if (column->name) cpl_free(column->name); if (column->unit) cpl_free(column->unit); if (column->format) cpl_free(column->format); if (column->null) cpl_free(column->null); cpl_free(column); } else cpl_error_set("cpl_column_delete_but_strings", CPL_ERROR_INVALID_TYPE); } /* * @brief * Delete an array column, without losing the single arrays. * * @param column Column to be deleted. * * @return Nothing, but if the column is not of array type, a * @c CPL_ERROR_INVALID_TYPE is set. * * This function deletes an array column, but the single arrays pointed * by the data buffer are not destroyed. Supposedly, the developer knows * that the arrays are static, or the developer holds the pointers to the * arrays somewhere else. If the input column is @c NULL, or the input * column is not an array column, nothing is done. */ void cpl_column_delete_but_arrays(cpl_column *column) { cpl_type type; cpl_column_values *values; if (column == NULL) return; type = cpl_column_get_type(column); if (type & CPL_TYPE_POINTER) { values = cpl_column_get_values(column); if (values) { if (values->array) cpl_free(values->array); cpl_free(values); } if (column->name) cpl_free(column->name); if (column->unit) cpl_free(column->unit); if (column->format) cpl_free(column->format); if (column->null) cpl_free(column->null); if (column->dimensions) cpl_array_delete(column->dimensions); cpl_free(column); } else cpl_error_set("cpl_column_delete_but_arrays", CPL_ERROR_INVALID_TYPE); } /* * @brief * Give a new name to a column. * * @param column Column to be named. * @param name New column name. * * @return @c CPL_ERROR_NONE on success. If the input column is @c NULL, * a @c CPL_ERROR_NULL_INPUT is returned. * * The input name is duplicated before being used as the column name. * If the new name is a @c NULL pointer the column will be nameless. */ cpl_error_code cpl_column_set_name(cpl_column *column, const char *name) { const char *fid = "cpl_column_set_name"; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (column->name) cpl_free(column->name); if (name) column->name = cpl_strdup(name); else column->name = NULL; return CPL_ERROR_NONE; } /* * @brief * Get the name of a column. * * @param column Column to get the name from. * * @return Name of column, or @em NULL if the column is nameless, or * if the input column is a @c NULL pointer. In the latter case, a * @c CPL_ERROR_NULL_INPUT is set. * * Return the name of a column, if present. Note that the returned * string is a pointer to the column name, not its copy. Its manipulation * will directly affect the column name, while changing the column name * using @c cpl_column_set_name() will turn it into garbage. Therefore, * if a real copy of a column name is required, this function should be * called as an argument of the function @c cpl_strdup(). If the input column * has no name, a @c NULL is returned. */ const char *cpl_column_get_name(const cpl_column *column) { if (column) return column->name; cpl_error_set("cpl_column_get_name", CPL_ERROR_NULL_INPUT); return NULL; } /* * @brief * Give a new unit to a column. * * @param column Column to access. * @param unit New column unit. * * @return 0 on success. Currently this function always succeeds. * * The input unit is duplicated before being used as the column unit. * If the new unit is a @c NULL pointer the column will be unitless. * The unit string associated to a column has no effect on any operation * performed on columns, and it must be considered just an optional * description of the content of a column. */ cpl_error_code cpl_column_set_unit(cpl_column *column, const char *unit) { if (column == 0x0) return cpl_error_set("cpl_column_set_unit", CPL_ERROR_NULL_INPUT); if (column->unit) cpl_free(column->unit); if (unit) column->unit = cpl_strdup(unit); else column->unit = NULL; return CPL_ERROR_NONE; } /* * @brief * Get the unit of a column. * * @param column Column to get the unit from. * * @return Unit of column, or @c NULL if the column is unitless, or if the * input column is a @c NULL. In the latter case, a @c CPL_ERROR_NULL_INPUT is * set. * * Return the unit of a column, if present. Note that the returned * string is a pointer to the column unit, not its copy. Its manipulation * will directly affect the column unit, while changing the column unit * using @c cpl_column_set_unit() will turn it into garbage. Therefore, * if a real copy of a column unit is required, this function should be * called as an argument of the function @c cpl_strdup(). If the input column * has no unit, a @c NULL is returned. */ const char *cpl_column_get_unit(const cpl_column *column) { if (column) return column->unit; cpl_error_set("cpl_column_get_unit", CPL_ERROR_NULL_INPUT); return NULL; } /* * @brief * Give a new format to a column. * * @param column Column to access. * @param format New column format. * * @return 0 on success. Currently this function always succeeds. * * The input format is duplicated before being used as the column format. * If a @c NULL @em format is given, "%s" will be used if the column is * of type string, "% 1.5e" if the column is of type float or double, and * "% 7d" if it is of type integer, long integer, or long long integer. * The format string associated to a column has no effect on any operation * performed on columns, and it is used just while printing a column. * The given format string must conform to the legal standard C formats. */ cpl_error_code cpl_column_set_format(cpl_column *column, const char *format) { const char *fid = "cpl_column_set_format"; cpl_type type; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); type = cpl_column_get_type(column); if (column->format) cpl_free(column->format); if (format) column->format = cpl_strdup(format); else switch (type) { case CPL_TYPE_INT: case CPL_TYPE_INT | CPL_TYPE_POINTER: column->format = cpl_strdup(INT_FORM); break; case CPL_TYPE_LONG: case CPL_TYPE_LONG | CPL_TYPE_POINTER: column->format = cpl_strdup(LONG_FORM); break; case CPL_TYPE_LONG_LONG: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: column->format = cpl_strdup(LONG_LONG_FORM); break; case CPL_TYPE_SIZE: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: column->format = cpl_strdup(SIZE_TYPE_FORM); break; case CPL_TYPE_FLOAT: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: column->format = cpl_strdup(FLOAT_FORM); break; case CPL_TYPE_DOUBLE: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: column->format = cpl_strdup(DOUBLE_FORM); break; case CPL_TYPE_FLOAT_COMPLEX: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: column->format = cpl_strdup(FLOAT_FORM); break; case CPL_TYPE_DOUBLE_COMPLEX: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: column->format = cpl_strdup(DOUBLE_FORM); break; case CPL_TYPE_STRING: case CPL_TYPE_STRING | CPL_TYPE_POINTER: column->format = cpl_strdup(STRING_FORM); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /* * @brief * Get the format of a column. * * @param column Column to get the format from. * * @return Column format, or @c NULL. The latter case can occur only if a * @c NULL column is passed to the function, and a @c CPL_ERROR_NULL_INPUT * is set. * * Return the format string of a column. Note that the returned string * is a pointer to the column format, not its copy. Its manipulation * will directly affect the column format, while changing the column format * using @c cpl_column_set_format() will turn it into garbage. Therefore, * if a real copy of a column format is required, this function should be * called as an argument of the function @c cpl_strdup(). The function accepts * also a @c NULL input column. */ const char *cpl_column_get_format(const cpl_column *column) { if (column) return column->format; cpl_error_set("cpl_column_get_format", CPL_ERROR_NULL_INPUT); return NULL; } /* * @brief * Get the length of a column. * * @param column Column to get the length from. * * @return Length of column, or zero. The latter case can occur either * with a column having zero length, or if a NULL column is passed to * the function, but in the latter case a @c CPL_ERROR_NULL_INPUT is set. * * If the column is @em NULL, zero is returned. */ cpl_size cpl_column_get_size(const cpl_column *column) { if (column) return column->length; cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } /* * @brief * Get the depth of a column. * * @param column Column to get the depth from. * * @return Depth of column, or zero. The latter case can occur either * with a non-array column, or if a NULL column is passed to this * function, but in the latter case a @c CPL_ERROR_NULL_INPUT is set. * * If the column is @em NULL, zero is returned. */ cpl_size cpl_column_get_depth(const cpl_column *column) { if (column) return column->depth; cpl_error_set("cpl_column_get_depth", CPL_ERROR_NULL_INPUT); return 0; } /* * @brief * Get the number of dimensions of a column. * * @param column Column to get the number of dimensions from. * * @return Number of dimensions of column, or zero. The latter case can * occur if a NULL column is passed to this function, and in that case * @c CPL_ERROR_NULL_INPUT is also set. If a column is not an array * column, or if it has no dimensions, 1 is returned. * * If the column is @em NULL, zero is returned. */ cpl_size cpl_column_get_dimensions(const cpl_column *column) { if (column) { if (cpl_column_get_type(column) & CPL_TYPE_POINTER) if (column->dimensions) return cpl_array_get_size(column->dimensions); return 1; } cpl_error_set("cpl_column_get_dimensions", CPL_ERROR_NULL_INPUT); return 0; } /* * @brief * Set the dimensions of a column. * * @param column Column to be assigned the dimensions. * @param dimensions Integer array containing the sizes of the column * * @return The column must be of type array, or a @c CPL_ERROR_TYPE_MISMATCH * is returned. A @c CPL_ERROR_INCOMPATIBLE_INPUT is returned if the * specified sizes are incompatible with the total number of elements in * the column. The input array @em dimensions must be an integer array * and all of its elements must be valid, or a @c CPL_ERROR_ILLEGAL_INPUT * is returned. If this array has size less than 2, nothing is done and * no error is returned. If a NULL column is passed to this function, a * @c CPL_ERROR_NULL_INPUT is set. * * Set the dimensions of a column. */ cpl_error_code cpl_column_set_dimensions(cpl_column *column, const cpl_array *dimensions) { const char *fid = "cpl_column_set_dimensions"; cpl_type type; cpl_size ndim; cpl_size size = 1; if (column == NULL || dimensions == NULL) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); type = cpl_column_get_type(column); if (type & CPL_TYPE_POINTER) { type = cpl_array_get_type(dimensions); if (!(type & CPL_TYPE_INT)) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); ndim = cpl_array_get_size(dimensions); if (ndim < 2) return CPL_ERROR_NONE; if (cpl_array_has_invalid(dimensions)) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); while (ndim--) size *= cpl_array_get(dimensions, ndim, NULL); if (size != column->depth) return cpl_error_set(fid, CPL_ERROR_INCOMPATIBLE_INPUT); if (column->dimensions) cpl_array_delete(column->dimensions); column->dimensions = cpl_array_duplicate(dimensions); } else return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); return CPL_ERROR_NONE; } /* * @brief * Get size of one dimension of the column. * * @param column Column. * @param indx Indicate dimension to query (0 = x, 1 = y, 2 = z, etc.) * * @return Size of queried dimension of the column, or zero in case of error. * * If the column is not of type array, a @c CPL_ERROR_UNSUPPORTED_MODE is set. * A @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set if the specified @em indx * is not compatible with the column dimensions. If the column has no * dimensions, 1 is returned. * * Get size of one dimension of the column. */ cpl_size cpl_column_get_dimension(const cpl_column *column, cpl_size indx) { const char *fid = "cpl_column_get_dimension"; cpl_type type; cpl_size ndim; if (column == NULL) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return 0; } if (indx < 0) { cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); return 0; } type = cpl_column_get_type(column); if (type & CPL_TYPE_POINTER) { if (column->dimensions) ndim = cpl_array_get_size(column->dimensions); else ndim = 1; if (indx >= ndim) { cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); return 0; } if (ndim > 1) return cpl_array_get(column->dimensions, indx, NULL); else return column->depth; } return cpl_error_set(fid, CPL_ERROR_UNSUPPORTED_MODE); } /* * @brief * Get the type of a column. * * @param column Column to get the type from. * * @return Type of column, or @c CPL_TYPE_INVALID if a @c NULL column is * passed to the function. * * If the column is @c NULL, @c CPL_ERROR_NULL_INPUT is set. */ cpl_type cpl_column_get_type(const cpl_column *column) { if (column) return column->type; cpl_error_set("cpl_column_get_type", CPL_ERROR_NULL_INPUT); return CPL_TYPE_INVALID; } /* * @brief * Check if a column element is invalid. * * @param column Column to inquire. * @param indx Column element to inquire. * * @return 1 if the column element is invalid, 0 if not, or in case * of error. * * Check if a column element is invalid. Column elements are counted * starting from zero. An out of range index would cause an error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE to be set. If the input column * has zero length, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE would always be * set. If the input column is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT * is set. */ int cpl_column_is_invalid(cpl_column *column, cpl_size indx) { const char *fid = "cpl_column_is_invalid"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); if (column == 0x0) { cpl_error_set_where(fid); return 0; } if (indx < 0 || indx >= length) { cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); return 0; } if (type == CPL_TYPE_STRING) return (column->values->s[indx] == NULL); if (type & CPL_TYPE_POINTER) return (column->values->array[indx] == NULL); if (column->nullcount == 0) return 0; if (column->nullcount == length) return 1; return column->null[indx]; } /* * @brief * Check if a column contains at least one invalid element. * * @param column Column to inquire. * * @return 1 if the column contains at least one invalid element, 0 if not, * -1 in case of error. * * Check if there are invalid elements in a column. This function does * not report the presence of invalid elements within an array type * column, but in that case reports just if an array is allocated or * not (just like is done for strings). If the input column is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is set. */ int cpl_column_has_invalid(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); if (column == 0x0) { cpl_error_set_where("cpl_column_has_invalid"); return -1; } if (type == CPL_TYPE_STRING) { while (length--) if (column->values->s[length] == NULL) return 1; return 0; } if (type & CPL_TYPE_POINTER) { while (length--) if (column->values->array[length] == NULL) return 1; return 0; } return (column->nullcount > 0 ? 1 : 0); } /* * @brief * Check if a column contains at least one valid value. * * @param column Column to inquire. * * @return 1 if the column contains at least one valid value, 0 if not * -1 in case of error. * * Check if there are valid values in a column. If the input column is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is set. */ int cpl_column_has_valid(cpl_column *column) { const char *fid = "cpl_column_has_valid"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); if (column == 0x0) { cpl_error_set_where(fid); return -1; } if (type == CPL_TYPE_STRING) { while (length--) if (column->values->s[length]) return 1; return 0; } if (type & CPL_TYPE_POINTER) { while (length--) if (column->values->array[length]) return 1; return 0; } return (column->nullcount < length ? 1 : 0); } /* * @brief * Count number of invalid elements in a column. * * @param column Column to inquire. * * @return Number of invalid elements in a column. -1 is always returned * in case of error. * * Count number of invalid elements in a column. This function does * not report the presence of invalid elements within an array type * column, but in that case reports just if an array is allocated or * not (just like is done for strings). If the column itself is * a @c NULL pointer, an error @c CPL_ERROR_NULL_INPUT is set. */ cpl_size cpl_column_count_invalid(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); char **p; cpl_array **a; if (column == 0x0) { cpl_error_set_where("cpl_column_count_invalid"); return -1; } if (type == CPL_TYPE_STRING) { p = column->values->s; column->nullcount = 0; while (length--) if (*p++ == NULL) column->nullcount++; } if (type & CPL_TYPE_POINTER) { a = column->values->array; column->nullcount = 0; while (length--) if (*a++ == NULL) column->nullcount++; } return column->nullcount; } /* * @brief * Get a pointer to @c integer column data. * * @param column Column to get the data from. * * @return Pointer to @c integer column data. If @em column contains * no data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_INT, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * @note * Use at your own risk: direct manipulation of column data rules * out any check performed by the column object interface, and may * introduce inconsistencies between the column information maintained * internally and the actual column data. */ int *cpl_column_get_data_int(cpl_column *column) { cpl_errorstate prestate = cpl_errorstate_get(); int *data = (int *)cpl_column_get_data_int_const(column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /* * @brief * Get a pointer to constant @c integer column data. * * @param column Constant column to get the data from. * * @return Pointer to constant @c integer column data. If @em column contains * no data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_INT, a * @c CPL_ERROR_TYPE_MISMATCH is set. */ const int *cpl_column_get_data_int_const(const cpl_column *column) { cpl_type type = cpl_column_get_type(column); if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type == CPL_TYPE_INT) return column->values->i; cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; } /* * @brief * Get a pointer to @c long @c integer column data. * * @param column Column to get the data from. * * @return Pointer to @c long @c integer column data. If @em column contains * no data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_LONG, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * @note * Use at your own risk: direct manipulation of column data rules * out any check performed by the column object interface, and may * introduce inconsistencies between the column information maintained * internally and the actual column data. */ long *cpl_column_get_data_long(cpl_column *column) { cpl_errorstate prestate = cpl_errorstate_get(); long *data = (long *)cpl_column_get_data_long_const(column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /* * @brief * Get a pointer to constant @c long @c integer column data. * * @param column Constant column to get the data from. * * @return Pointer to constant @c long @c integer column data. If @em column * contains no data (zero length), a @c NULL is returned. If @em column is * a @c NULL, a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_LONG, a * @c CPL_ERROR_TYPE_MISMATCH is set. */ const long *cpl_column_get_data_long_const(const cpl_column *column) { cpl_type type = cpl_column_get_type(column); if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type == CPL_TYPE_LONG) return column->values->l; cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; } /* * @brief * Get a pointer to @c long @c long @c integer column data. * * @param column Column to get the data from. * * @return Pointer to @c long @c long @c integer column data. If @em column * contains no data (zero length), a @c NULL is returned. If @em column is * a @c NULL, a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_LONG_LONG, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * @note * Use at your own risk: direct manipulation of column data rules * out any check performed by the column object interface, and may * introduce inconsistencies between the column information maintained * internally and the actual column data. */ long long *cpl_column_get_data_long_long(cpl_column *column) { cpl_errorstate prestate = cpl_errorstate_get(); long long *data = (long long *)cpl_column_get_data_long_long_const(column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /* * @brief * Get a pointer to constant @c long @c long @c integer column data. * * @param column Constant column to get the data from. * * @return Pointer to constant @c long @c long @c integer column data. If @em * column contains no data (zero length), a @c NULL is returned. If @em * column is a @c NULL, a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_LONG_LONG, a * @c CPL_ERROR_TYPE_MISMATCH is set. */ const long long *cpl_column_get_data_long_long_const(const cpl_column *column) { cpl_type type = cpl_column_get_type(column); if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type == CPL_TYPE_LONG_LONG) return column->values->ll; cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; } /* * @brief * Get a pointer to @c cpl_size column data. * * @param column Column to get the data from. * * @return Pointer to @c long @c long @c integer column data. If @em column * contains no data (zero length), a @c NULL is returned. If @em column is * a @c NULL, a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_SIZE, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * @note * Use at your own risk: direct manipulation of column data rules * out any check performed by the column object interface, and may * introduce inconsistencies between the column information maintained * internally and the actual column data. */ cpl_size *cpl_column_get_data_cplsize(cpl_column *column) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_size *data = (cpl_size *)cpl_column_get_data_cplsize_const(column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /* * @brief * Get a pointer to constant @c cpl_size column data. * * @param column Constant column to get the data from. * * @return Pointer to constant @c long @c long @c integer column data. If @em * column contains no data (zero length), a @c NULL is returned. If @em * column is a @c NULL, a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_SIZE, a * @c CPL_ERROR_TYPE_MISMATCH is set. */ const cpl_size *cpl_column_get_data_cplsize_const(const cpl_column *column) { cpl_type type = cpl_column_get_type(column); if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type == CPL_TYPE_SIZE) return column->values->sz; cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; } /* * @brief * Get a pointer to @em float column data. * * @param column Column to get the data from. * * @return Pointer to @em float column data. If @em column contains no * data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_FLOAT, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_column_get_data_int(). */ float *cpl_column_get_data_float(cpl_column *column) { cpl_errorstate prestate = cpl_errorstate_get(); float *data = (float *)cpl_column_get_data_float_const(column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /* * @brief * Get a pointer to constant @em float column data. * * @param column Constant column to get the data from. * * @return Pointer to constant @em float column data. If @em column contains no * data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_FLOAT, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_column_get_data_int(). */ const float *cpl_column_get_data_float_const(const cpl_column *column) { cpl_type type = cpl_column_get_type(column); if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type == CPL_TYPE_FLOAT) return column->values->f; cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; } /* * @brief * Get a pointer to @em float complex column data. * * @param column Column to get the data from. * * @return Pointer to @em float complex column data. If @em column contains no * data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_FLOAT_COMPLEX, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_column_get_data_int(). */ float complex *cpl_column_get_data_float_complex(cpl_column *column) { cpl_errorstate prestate = cpl_errorstate_get(); float complex *data = (float complex *)cpl_column_get_data_float_complex_const(column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /* * @brief * Get a pointer to constant @em float complex column data. * * @param column Constant column to get the data from. * * @return Pointer to constant @em float complex column data. * If @em column contains no data (zero length), a @c NULL * is returned. If @em column is a @c NULL, a @c NULL is * returned, and an error is set. * * If the column is not of type @c CPL_TYPE_FLOAT_COMPLEX, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_column_get_data_int(). */ const float complex * cpl_column_get_data_float_complex_const(const cpl_column *column) { cpl_type type = cpl_column_get_type(column); if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type == CPL_TYPE_FLOAT_COMPLEX) return column->values->cf; cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; } /* * @brief * Get a pointer to @em double column data. * * @param column Column to get the data from. * * @return Pointer to @em double column data. If @em column contains no * data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_DOUBLE, * a @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_column_get_data_int(). */ double *cpl_column_get_data_double(cpl_column *column) { cpl_errorstate prestate = cpl_errorstate_get(); double *data = (double *)cpl_column_get_data_double_const(column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /* * @brief * Get a pointer to constant @em double column data. * * @param column Constant column to get the data from. * * @return Pointer to constant @em double column data. If @em column contains * no data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_DOUBLE, * a @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_column_get_data_int(). */ const double *cpl_column_get_data_double_const(const cpl_column *column) { cpl_type type = cpl_column_get_type(column); if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type == CPL_TYPE_DOUBLE) return column->values->d; cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; } /* * @brief * Get a pointer to @em double complex column data. * * @param column Column to get the data from. * * @return Pointer to @em double complex column data. If @em column contains no * data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_DOUBLE_COMPLEX, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_column_get_data_int(). */ double complex *cpl_column_get_data_double_complex(cpl_column *column) { cpl_errorstate prestate = cpl_errorstate_get(); double complex *data = (double complex *)cpl_column_get_data_double_complex_const(column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /* * @brief * Get a pointer to constant @em double complex column data. * * @param column Constant column to get the data from. * * @return Pointer to constant @em double complex column data. * If @em column contains no data (zero length), a @c NULL * is returned. If @em column is a @c NULL, a @c NULL is * returned, and an error is set. * * If the column is not of type @c CPL_TYPE_DOUBLE_COMPLEX, a * @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_column_get_data_int(). */ const double complex * cpl_column_get_data_double_complex_const(const cpl_column *column) { cpl_type type = cpl_column_get_type(column); if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type == CPL_TYPE_DOUBLE_COMPLEX) return column->values->cd; cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; } /* * @brief * Get a pointer to string column data. * * @param column Column to get the data from. * * @return Pointer to string column data. If @em column contains no * data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_STRING, * a @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_column_get_data_int(). */ char **cpl_column_get_data_string(cpl_column *column) { cpl_errorstate prestate = cpl_errorstate_get(); char **data = (char **)cpl_column_get_data_string_const(column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /* * @brief * Get a pointer to constant string column data. * * @param column Constant column to get the data from. * * @return Pointer to constant string column data. If @em column contains no * data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned, and an error is set. * * If the column is not of type @c CPL_TYPE_STRING, * a @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_column_get_data_int(). */ const char **cpl_column_get_data_string_const(const cpl_column *column) { cpl_type type = cpl_column_get_type(column); if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type == CPL_TYPE_STRING) return (const char **)column->values->s; cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; } /* * @brief * Get a pointer to array column data. * * @param column Column to get the data from. * * @return Pointer to array column data. If @em column contains no * data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned and an error is set. * * If the column is not an array type * a @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_column_get_data_int(). */ cpl_array **cpl_column_get_data_array(cpl_column *column) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_array **data = (cpl_array **)cpl_column_get_data_array_const(column); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /* * @brief * Get a pointer to constant array column data. * * @param column Constant column to get the data from. * * @return Pointer to constant array column data. If @em column contains no * data (zero length), a @c NULL is returned. If @em column is a @c NULL, * a @c NULL is returned and an error is set. * * If the column is not an array type a @c CPL_ERROR_TYPE_MISMATCH is set. * * See documentation of function cpl_column_get_data_int(). */ const cpl_array **cpl_column_get_data_array_const(const cpl_column *column) { cpl_type type = cpl_column_get_type(column); if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_POINTER) return (const cpl_array **)column->values->array; cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; } /* * @brief * Get a pointer to a column invalid flags buffer. * * @param column Column from where to get the data. * * @return Pointer to the column buffer containing the flagging of the * invalid elements, or @c NULL if it is missing. * * If all or no column elements are invalid, a @c NULL pointer is returned. * A @c NULL is returned also if the column is of type @c CPL_TYPE_STRING * or of type array (no buffer marking the invalid elements is present in * this case). * * @note * Use at your own risk: direct manipulation of column data rules out * any check performed by the column object interface, and may introduce * inconsistencies between the column information maintained internally * and the actual column data. */ cpl_column_flag *cpl_column_get_data_invalid(cpl_column *column) { if (column == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return column->null; } /* * @brief * Get a pointer to a constant column invalid flags buffer. * * @param column Constant column from where to get the data. * * @return Pointer to the constant column buffer containing the flagging of * the invalid elements, or @c NULL if it is missing. * * If all or no column elements are invalid, a @c NULL pointer is returned. * A @c NULL is returned also if the column is of type @c CPL_TYPE_STRING * or of type array (no buffer marking the invalid elements is present in * this case). */ const cpl_column_flag * cpl_column_get_data_invalid_const(const cpl_column *column) { if (column == 0x0) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return column->null; } /* * @brief * Plug a new invalid flag buffer into a numerical column. * * @param column Column to access. * @param nulls Array of null flags. * @param nullcount Total number of nulls. * * @return CPL_ERROR_NONE on success. If the column type is not * numerical, an invalid flag buffer is not used, and an attempt * to plug it in will cause a @c CPL_ERROR_INVALID_TYPE to be * returned. A @c CPL_ERROR_INCOMPATIBLE_INPUT is returned if * an impossible @em nullcount value is passed. If the input * @em nulls buffer does not contains just 1s or 0s, a * @c CPL_ERROR_ILLEGAL_INPUT is returned. A @c CPL_ERROR_NULL_INPUT * is returned if a @c NULL column pointer is passed. * * This function is used to assign a new set of flags marking invalid * elements within a column. If a flag buffer already exists, this is * deallocated before being replaced by the new one. If @em nullcount * is either 0 or equal to the column length, the passed flag buffer * is ignored, but the internal buffer is deallocated. If @em nullcount * is negative, it will be evaluated internally, or set to zero if no * flag buffer was passed. This function cannot be use either for array * columns or @c CPL_TYPE_STRING columns. * * @note * Use at your own risk: direct manipulation of column data rules out * any check performed by the column object interface, and may introduce * inconsistencies between the column information maintained internally * and the actual column data. */ cpl_error_code cpl_column_set_data_invalid(cpl_column *column, cpl_column_flag *nulls, cpl_size nullcount) { const char *fid = "cpl_column_set_data_invalid"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (type == CPL_TYPE_STRING) return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); if (type & CPL_TYPE_POINTER) return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); if (nullcount > length) return cpl_error_set(fid, CPL_ERROR_INCOMPATIBLE_INPUT); if (nulls) while (length--) if (nulls[length] != 0) if (nulls[length] != 1) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); length = cpl_column_get_size(column); if (nullcount < 0) { /* * The total number of NULLs must be evaluated internally. If a * null flag buffer was not passed, the total number of NULLs is * assumed to be zero. */ if (nulls) { nullcount = 0; while (length--) nullcount += nulls[length]; } else { nullcount = 0; } } /* * If no null buffer was passed, and a wrong null count was specified, * return a failure (wrong input). */ if (!nulls) if (nullcount != length && nullcount != 0) return cpl_error_set(fid, CPL_ERROR_INCOMPATIBLE_INPUT); /* * Replace the old buffer with the new one if necessary. */ if (nullcount == length || nullcount == 0) nulls = NULL; if (column->null) cpl_free(column->null); column->null = nulls; column->nullcount = nullcount; return 0; } /* * @brief * Reallocate a column of arrays to a new depth. * * @param column Column to be resized. * @param depth New depth of column. * * @return @c CPL_ERROR_NONE on success. The new column depth must not * be negative, or a @c CPL_ERROR_ILLEGAL_INPUT is returned. The input * column pointer should not be @c NULL, or a @c CPL_ERROR_NULL_INPUT * is returned. The column should be an array type, or a * @c CPL_ERROR_TYPE_MISMATCH is returned. * * Reallocate a column of arrays to a new depth. The contents of the * arrays data buffer will be unchanged up to the lesser of the new and * old sizes. If the column depth is increased, the new arrays elements * are flagged as invalid. The pointer to array data may change, therefore * pointers previously retrieved by calling @c cpl_column_get_data_array(), * @c cpl_column_get_data_string(), etc. should be discarded). Resizing * to zero is allowed, and would produce a zero-depth column. In case * of failure, the old data buffer is left intact. Changing column * depth implies removing any information about column dimensions. */ cpl_error_code cpl_column_set_depth(cpl_column *column, cpl_size depth) { const char *fid = "cpl_column_set_depth"; cpl_array *array; cpl_column *acolumn; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (depth < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (!(type & CPL_TYPE_POINTER)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); while (length--) { array = cpl_column_get_array(column, length); if (!array) continue; acolumn = cpl_array_get_column(array); if (cpl_column_set_size(acolumn, depth)) { return cpl_error_set_where(fid); } } column->depth = depth; if (column->dimensions) { cpl_array_delete(column->dimensions); column->dimensions = NULL; } return CPL_ERROR_NONE; } /* * @brief * Reallocate a column to a new number of elements. * * @param column Column to be resized. * @param new_length New number of elements in column. * * @return @c CPL_ERROR_NONE on success. The new column size must not be * negative, or a @c CPL_ERROR_ILLEGAL_INPUT is returned. The input * column pointer should not be @c NULL, or a @c CPL_ERROR_NULL_INPUT * is returned. * * Reallocate a column to a new number of elements. The contents of the * column data buffer will be unchanged up to the lesser of the new and * old sizes. If the column size is increased, the new column elements * are flagged as invalid. The pointer to data may change, therefore * pointers previously retrieved by calling @c cpl_column_get_data_int(), * @c cpl_column_get_data_string(), etc. should be discarded). Resizing * to zero is allowed, and would produce a zero-length column. In case * of failure, the old data buffer is left intact. */ cpl_error_code cpl_column_set_size(cpl_column *column, cpl_size new_length) { cpl_type type = cpl_column_get_type(column); cpl_size old_length = cpl_column_get_size(column); size_t element_size = cpl_column_type_size(type); size_t null_size = old_length * sizeof(cpl_column_flag); size_t new_size = element_size * new_length; cpl_size i = 0; cpl_column_flag *np = NULL; char **sp; cpl_array **ap; if (column == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (new_length < 0) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); if (new_length == old_length) /* Resizing is unnecessary */ return CPL_ERROR_NONE; if (new_length == 0) { /* Resizing to zero */ switch (type) { case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: for (i = 0; i < old_length; i++) if (column->values->array[i]) cpl_array_delete(column->values->array[i]); cpl_free((void *)column->values->array); break; case CPL_TYPE_STRING: for (i = 0; i < old_length; i++) if (column->values->s[i]) cpl_free(column->values->s[i]); if (column->values->s) cpl_free((void *)column->values->s); break; default: if (column->values->s) cpl_free((void *)column->values->s); break; } column->values->i = NULL; if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = 0; column->length = 0; return CPL_ERROR_NONE; } if (old_length == 0) { /* Resizing from zero */ switch (type) { case CPL_TYPE_INT: column->values->i = cpl_malloc(new_length * sizeof(int)); break; case CPL_TYPE_LONG: column->values->l = cpl_malloc(new_length * sizeof(long)); break; case CPL_TYPE_LONG_LONG: column->values->ll = cpl_malloc(new_length * sizeof(long long)); break; case CPL_TYPE_SIZE: column->values->sz = cpl_malloc(new_length * sizeof(cpl_size)); break; case CPL_TYPE_FLOAT: column->values->f = cpl_malloc(new_length * sizeof(float)); break; case CPL_TYPE_DOUBLE: column->values->d = cpl_malloc(new_length * sizeof(double)); break; case CPL_TYPE_FLOAT_COMPLEX: column->values->cf = cpl_malloc(new_length * sizeof(float complex)); break; case CPL_TYPE_DOUBLE_COMPLEX: column->values->cd = cpl_malloc(new_length * sizeof(double complex)); break; case CPL_TYPE_STRING: column->values->s = cpl_calloc(new_length, sizeof(char *)); break; case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: column->values->array = cpl_calloc(new_length, sizeof(cpl_array *)); break; default: return cpl_error_set_(CPL_ERROR_INVALID_TYPE); } column->length = new_length; if (type != CPL_TYPE_STRING && !(type & CPL_TYPE_POINTER)) column->nullcount = new_length; return CPL_ERROR_NONE; } /* * In the following the generic case is handled */ if (column->null) { /* * If the null flags buffer exists, it should be reallocated * first. */ null_size = new_length * sizeof(cpl_column_flag); column->null = cpl_realloc((void *)column->null, null_size); if (new_length < old_length) { /* * If the column was shortened, check whether some * NULLs are still present in column. If no NULL is * found, then the null flags buffer can be deallocated. */ column->nullcount = 0; np = column->null; for (i = 0; i < new_length; i++) if (*np++) column->nullcount++; if (column->nullcount == new_length || column->nullcount == 0) { if (column->null) cpl_free(column->null); column->null = NULL; } } else { /* * Pad with 1s the extra space (by definition, extra space * in the column data buffer is not initialized, therefore * it is a NULL value; the case of string columns doesn't * need to be treated, since in that case the null flags * are not used). */ np = column->null + old_length; for (i = old_length; i < new_length; i++) *np++ = 1; column->nullcount += new_length - old_length; } } else { /* * We don't need to take care of string columns here, because * they take automatically care of their own NULLs. */ if (type != CPL_TYPE_STRING) { if (new_length > old_length) { /* * If the null flags buffer doesn't exist, it is * either because there were no NULLs, or there * were just NULLs. In the latter case we do not * need to allocate any new buffer, because the * expansion just added extra NULLs. In the former * case, we have to allocate a null flags column * buffer in case the column is expanded, because * the expanded part contains NULLs: */ if (column->nullcount == 0) { column->null = cpl_calloc(new_length, sizeof(cpl_column_flag)); np = column->null + old_length; for (i = old_length; i < new_length; i++) *np++ = 1; column->nullcount = new_length - old_length; } else /* There were just nulls */ column->nullcount = new_length; } else if (column->nullcount) /* Column of nulls shortened */ column->nullcount = new_length; } } /* * If a column of character strings or of arrays is shortened, * we must explicitly free the extra strings. */ if (type == CPL_TYPE_STRING) for (i = new_length; i < old_length; i++) if (column->values->s[i]) cpl_free(column->values->s[i]); if (type & CPL_TYPE_POINTER) for (i = new_length; i < old_length; i++) if (column->values->array[i]) cpl_array_delete(column->values->array[i]); /* * Finally, we realloc the column data buffer: */ column->values->i = cpl_realloc((void *)column->values->i, new_size); column->length = new_length; /* * We don't initialize the extra memory, since it is NULL flagged, * with the exception of string and array columns: */ if (type == CPL_TYPE_STRING) { sp = column->values->s + old_length; for (i = old_length; i < new_length; i++) *sp++ = 0x0; } if (type & CPL_TYPE_POINTER) { ap = column->values->array + old_length; for (i = old_length; i < new_length; i++) *ap++ = 0x0; } return CPL_ERROR_NONE; } /* * @brief * Read a value from a numerical column. * * @param column Column to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Value read. In case of an invalid column element, or in * case of error, 0.0 is always returned. * * Read a value from a numerical column. A @c CPL_ERROR_NULL_INPUT is set in * case @em column is a @c NULL pointer. A @c CPL_ERROR_INVALID_TYPE is set * in case a non-numerical column is accessed. @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is set if the @em indx is outside the column range. Indexes are * counted starting from 0. If the input column has length zero, * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. The @em null * flag is used to indicate whether the accessed column element is * valid (0) or invalid (1). The null flag also signals an error * condition (-1). The @em null argument can be left to @c NULL. * This function cannot be used for the access of array elements in * array columns. */ double cpl_column_get(cpl_column *column, cpl_size indx, int *null) { const char *fid = "cpl_column_get"; cpl_type type = cpl_column_get_type(column); if (null) *null = -1; switch (type) { case CPL_TYPE_INT: return (double)cpl_column_get_int(column, indx, null); case CPL_TYPE_LONG: return (double)cpl_column_get_long(column, indx, null); case CPL_TYPE_LONG_LONG: return (double)cpl_column_get_long_long(column, indx, null); case CPL_TYPE_SIZE: return (double)cpl_column_get_cplsize(column, indx, null); case CPL_TYPE_FLOAT: return (double)cpl_column_get_float(column, indx, null); case CPL_TYPE_DOUBLE: return cpl_column_get_double(column, indx, null); case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: case CPL_TYPE_STRING: case CPL_TYPE_FLOAT_COMPLEX: case CPL_TYPE_DOUBLE_COMPLEX: cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); break; default: cpl_error_set(fid, CPL_ERROR_NULL_INPUT); break; } return 0.0; } /* * @brief * Read a value from a complex column. * * @param column Column to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Value read. In case of an invalid column element, or in * case of error, 0.0 is always returned. * * Read a value from a complex column. A @c CPL_ERROR_NULL_INPUT is set in * case @em column is a @c NULL pointer. A @c CPL_ERROR_INVALID_TYPE is set * in case a non-complex column is accessed. @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is set if the @em indx is outside the column range. Indexes are * counted starting from 0. If the input column has length zero, * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. The @em null * flag is used to indicate whether the accessed column element is * valid (0) or invalid (1). The null flag also signals an error * condition (-1). The @em null argument can be left to @c NULL. * This function cannot be used for the access of array elements in * array columns. */ double complex cpl_column_get_complex(cpl_column *column, cpl_size indx, int *null) { const char *fid = "cpl_column_get_complex"; cpl_type type = cpl_column_get_type(column); if (null) *null = -1; switch (type) { case CPL_TYPE_FLOAT_COMPLEX: return (double complex)cpl_column_get_float_complex(column, indx, null); case CPL_TYPE_DOUBLE_COMPLEX: return cpl_column_get_double_complex(column, indx, null); case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: case CPL_TYPE_INT: case CPL_TYPE_LONG: case CPL_TYPE_LONG_LONG: case CPL_TYPE_SIZE: case CPL_TYPE_FLOAT: case CPL_TYPE_DOUBLE: case CPL_TYPE_STRING: cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); break; default: cpl_error_set(fid, CPL_ERROR_NULL_INPUT); break; } return 0.0; } /* * @brief * Read a value from an @em integer column. * * @param column Column to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Integer value read. In case of an invalid column element, or in * case of error, 0 is always returned. * * Read a value from a column of type @c CPL_TYPE_INT. If @em column is a * @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the column is not * of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input column has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the @em null * flag is a valid pointer, it is used to indicate whether the accessed * column element is valid (0) or invalid (1). The null flag also signals * an error condition (-1). */ int cpl_column_get_int(cpl_column *column, cpl_size indx, int *null) { const char *fid = "cpl_column_get_int"; int isnull = cpl_column_is_invalid(column, indx); cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (null) *null = -1; if (column == 0x0) { cpl_error_set_where(fid); return 0; } if (indx < 0 || indx >= length) { cpl_error_set_where(fid); return 0; } if (type != CPL_TYPE_INT) { cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); return 0; } if (null) *null = isnull; if (isnull) return 0; return column->values->i[indx]; } /* * @brief * Read a value from a @em long @em integer column. * * @param column Column to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Long integer value read. In case of an invalid column element, or in * case of error, 0 is always returned. * * Read a value from a column of type @c CPL_TYPE_LONG. If @em column is a * @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the column is not * of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input column has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the @em null * flag is a valid pointer, it is used to indicate whether the accessed * column element is valid (0) or invalid (1). The null flag also signals * an error condition (-1). */ long cpl_column_get_long(cpl_column *column, cpl_size indx, int *null) { const char *fid = "cpl_column_get_long"; int isnull = cpl_column_is_invalid(column, indx); cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (null) *null = -1; if (column == 0x0) { cpl_error_set_where(fid); return 0; } if (indx < 0 || indx >= length) { cpl_error_set_where(fid); return 0; } if (type != CPL_TYPE_LONG) { cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); return 0; } if (null) *null = isnull; if (isnull) return 0; return column->values->l[indx]; } /* * @brief * Read a value from a @em long @em long @em integer column. * * @param column Column to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Long long integer value read. In case of an invalid column element, * or in case of error, 0 is always returned. * * Read a value from a column of type @c CPL_TYPE_LONG_LONG. If @em column * is a @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the column is * not of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input column has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the @em null * flag is a valid pointer, it is used to indicate whether the accessed * column element is valid (0) or invalid (1). The null flag also signals * an error condition (-1). */ long long cpl_column_get_long_long(cpl_column *column, cpl_size indx, int *null) { const char *fid = "cpl_column_get_long_long"; int isnull = cpl_column_is_invalid(column, indx); cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (null) *null = -1; if (column == 0x0) { cpl_error_set_where(fid); return 0; } if (indx < 0 || indx >= length) { cpl_error_set_where(fid); return 0; } if (type != CPL_TYPE_LONG_LONG) { cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); return 0; } if (null) *null = isnull; if (isnull) return 0; return column->values->ll[indx]; } /* * @brief * Read a value from a @em cpl_size column. * * @param column Column to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return The cpl_size value read. In case of an invalid column element, * or in case of error, 0 is always returned. * * Read a value from a column of type @c CPL_TYPE_SIZE. If @em column * is a @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the column is * not of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input column has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the @em null * flag is a valid pointer, it is used to indicate whether the accessed * column element is valid (0) or invalid (1). The null flag also signals * an error condition (-1). */ cpl_size cpl_column_get_cplsize(cpl_column *column, cpl_size indx, int *null) { const char *fid = "cpl_column_get_cplsize"; int isnull = cpl_column_is_invalid(column, indx); cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (null) *null = -1; if (column == 0x0) { cpl_error_set_where(fid); return 0; } if (indx < 0 || indx >= length) { cpl_error_set_where(fid); return 0; } if (type != CPL_TYPE_SIZE) { cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); return 0; } if (null) *null = isnull; if (isnull) return 0; return column->values->sz[indx]; } /* * @brief * Read a value from a @em float column. * * @param column Column to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Float value read. In case of an invalid column element, or in * case of error, 0.0 is always returned. * * Read a value from a column of type @c CPL_TYPE_FLOAT. See the * documentation of the function cpl_column_get_int(). */ float cpl_column_get_float(cpl_column *column, cpl_size indx, int *null) { const char *fid = "cpl_column_get_float"; int isnull = cpl_column_is_invalid(column, indx); cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (null) *null = -1; if (column == 0x0) { cpl_error_set_where(fid); return 0; } if (indx < 0 || indx >= length) { cpl_error_set_where(fid); return 0; } if (type != CPL_TYPE_FLOAT) { cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); return 0; } if (null) *null = isnull; if (isnull) return 0; return column->values->f[indx]; } /* * @brief * Read a value from a @em float complex column. * * @param column Column to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Float complex value read. In case of an invalid column element, * or in case of error, 0.0 is always returned. * * Read a value from a column of type @c CPL_TYPE_FLOAT_COMPLEX. See the * documentation of the function cpl_column_get_int(). */ float complex cpl_column_get_float_complex(cpl_column *column, cpl_size indx, int *null) { const char *fid = "cpl_column_get_float_complex"; int isnull = cpl_column_is_invalid(column, indx); cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (null) *null = -1; if (column == 0x0) { cpl_error_set_where(fid); return 0; } if (indx < 0 || indx >= length) { cpl_error_set_where(fid); return 0; } if (type != CPL_TYPE_FLOAT_COMPLEX) { cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); return 0; } if (null) *null = isnull; if (isnull) return 0; return column->values->cf[indx]; } /* * @brief * Read a value from a @em double column. * * @param column Column to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Double value read. In case of an invalid column element, or in * case of error, 0.0 is always returned. * * Read a value from a column of type @c CPL_TYPE_DOUBLE. See the * documentation of the function cpl_column_get_int(). */ double cpl_column_get_double(cpl_column *column, cpl_size indx, int *null) { const char *fid = "cpl_column_get_double"; int isnull = cpl_column_is_invalid(column, indx); cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (null) *null = -1; if (column == 0x0) { cpl_error_set_where(fid); return 0; } if (indx < 0 || indx >= length) { cpl_error_set_where(fid); return 0; } if (type != CPL_TYPE_DOUBLE) { cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); return 0; } if (null) *null = isnull; if (isnull) return 0; return column->values->d[indx]; } /* * @brief * Read a value from a @em double complex column. * * @param column Column to be accessed. * @param indx Position of element to be read. * @param null Flag indicating null values, or error condition. * * @return Double value read. In case of an invalid column element, or in * case of error, 0.0 is always returned. * * Read a value from a column of type @c CPL_TYPE_DOUBLE_COMPLEX. See the * documentation of the function cpl_column_get_int(). */ double complex cpl_column_get_double_complex(cpl_column *column, cpl_size indx, int *null) { const char *fid = "cpl_column_get_float_complex"; int isnull = cpl_column_is_invalid(column, indx); cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (null) *null = -1; if (column == 0x0) { cpl_error_set_where(fid); return 0; } if (indx < 0 || indx >= length) { cpl_error_set_where(fid); return 0; } if (type != CPL_TYPE_DOUBLE_COMPLEX) { cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); return 0; } if (null) *null = isnull; if (isnull) return 0; return column->values->cd[indx]; } /* * @brief * Read a value from a string column. * * @param column Column to be accessed. * @param indx Position of element to be read. * * @return Character string read. In case of an invalid column element, * or in case of error, a @c NULL pointer is always returned. * * Read a value from a column of type @c CPL_TYPE_STRING. If @em column is a * @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the column is not * of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input column has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. * * @note * The returned string is a pointer to a column element, not its * copy. Its manipulation will directly affect that column element, * while changing that column element using @c cpl_column_set_string() * will turn it into garbage. Therefore, if a real copy of a string * column element is required, this function should be called as an * argument of the function @c cpl_strdup(). */ char *cpl_column_get_string(cpl_column *column, cpl_size indx) { cpl_errorstate prestate = cpl_errorstate_get(); char *data = (char *)cpl_column_get_string_const(column, indx); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /* * @brief * Read a value from a constant string column. * * @param column Constant column to be accessed. * @param indx Position of element to be read. * * @return Character string read. In case of an invalid column element, * or in case of error, a @c NULL pointer is always returned. * * Read a value from a column of type @c CPL_TYPE_STRING. If @em column is a * @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the column is not * of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input column has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. */ const char *cpl_column_get_string_const(const cpl_column *column, cpl_size indx) { int length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (indx < 0 || indx >= length) { cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); return NULL; } if (type != CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; } return column->values->s[indx]; } /* * @brief * Read an array from an array column. * * @param column Column to be accessed. * @param indx Position of array to be read. * * @return CPL array read. In case of an invalid column element, * or in case of error, a @c NULL pointer is always returned. * * Read an array from a column of type array. If @em column is a * @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the column is not * of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input column has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. * * @note * The returned array is a pointer to a column element, not its * copy. Its manipulation will directly affect that column element, * while changing that column element using @c cpl_column_set_array() * will turn it into garbage. Therefore, if a real copy of an array * column element is required, this function should be called as an * argument of the function @c cpl_array_duplicate(). */ cpl_array *cpl_column_get_array(cpl_column *column, cpl_size indx) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_array *data = (cpl_array *)cpl_column_get_array_const(column, indx); if (!cpl_errorstate_is_equal(prestate)) cpl_error_set_where_(); return data; } /* * @brief * Read a constant array from an array column. * * @param column Cconstant column to be accessed. * @param indx Position of array to be read. * * @return CPL array read. In case of an invalid column element, * or in case of error, a @c NULL pointer is always returned. * * Read a constant array from a column of type array. If @em column is a * @c NULL pointer a @c CPL_ERROR_NULL_INPUT is set. If the column is not * of the expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. * Indexes are counted starting from 0. If the input column has length zero, * the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. */ const cpl_array *cpl_column_get_array_const(const cpl_column *column, cpl_size indx) { cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (indx < 0 || indx >= length) { cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); return NULL; } if (!(type & CPL_TYPE_POINTER)) { cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); return NULL; } return column->values->array[indx]; } /* * @brief * Write a value to a numerical column element. * * @param column Column to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of numerical * type, a @c CPL_ERROR_INVALID_TYPE is returned. If @em indx is outside * the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If * the input column has length zero, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a numerical column element. The value is cast to the * accessed column type. The written value is automatically flagged as * valid. To invalidate a column value use @c cpl_column_set_invalid(). * Column elements are counted starting from 0. This function cannot * be used on array columns. */ cpl_error_code cpl_column_set(cpl_column *column, cpl_size indx, double value) { const char *fid = "cpl_column_set"; cpl_type type = cpl_column_get_type(column); switch (type) { case CPL_TYPE_INT: return cpl_column_set_int(column, indx, value); case CPL_TYPE_LONG: return cpl_column_set_long(column, indx, value); case CPL_TYPE_LONG_LONG: return cpl_column_set_long_long(column, indx, value); case CPL_TYPE_SIZE: return cpl_column_set_cplsize(column, indx, value); case CPL_TYPE_FLOAT: return cpl_column_set_float(column, indx, value); case CPL_TYPE_DOUBLE: return cpl_column_set_double(column, indx, value); case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: case CPL_TYPE_STRING: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); default: return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); } } /* * @brief * Write a complex value to a complex column element. * * @param column Column to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of complex * type, a @c CPL_ERROR_INVALID_TYPE is returned. If @em indx is outside * the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If * the input column has length zero, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a complex value to a complex column element. The value is cast to the * accessed column type. The written value is automatically flagged as * valid. To invalidate a column value use @c cpl_column_set_invalid(). * Column elements are counted starting from 0. This function cannot * be used on array columns. */ cpl_error_code cpl_column_set_complex(cpl_column *column, cpl_size indx, double complex value) { const char *fid = "cpl_column_set_complex"; cpl_type type = cpl_column_get_type(column); switch (type) { case CPL_TYPE_FLOAT_COMPLEX: return cpl_column_set_float_complex(column, indx, value); case CPL_TYPE_DOUBLE_COMPLEX: return cpl_column_set_double_complex(column, indx, value); case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: case CPL_TYPE_INT: case CPL_TYPE_LONG: case CPL_TYPE_LONG_LONG: case CPL_TYPE_SIZE: case CPL_TYPE_FLOAT: case CPL_TYPE_DOUBLE: case CPL_TYPE_STRING: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); default: return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); } } /* * @brief * Write a value to an @em integer column element. * * @param column Column to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input column has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to an @em integer column element. The written value * is automatically flagged as valid. To invalidate a column value use * @c cpl_column_set_invalid(). Column elements are counted starting * from 0. */ cpl_error_code cpl_column_set_int(cpl_column *column, cpl_size indx, int value) { const char *fid = "cpl_column_set_int"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (indx < 0 || indx >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (type != CPL_TYPE_INT) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); column->values->i[indx] = value; cpl_column_unset_null(column, indx); return CPL_ERROR_NONE; } /* * @brief * Write a value to a @em long @em integer column element. * * @param column Column to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input column has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a @em long @em integer column element. The written value * is automatically flagged as valid. To invalidate a column value use * @c cpl_column_set_invalid(). Column elements are counted starting * from 0. */ cpl_error_code cpl_column_set_long(cpl_column *column, cpl_size indx, long value) { const char *fid = "cpl_column_set_long"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (indx < 0 || indx >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (type != CPL_TYPE_LONG) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); column->values->l[indx] = value; cpl_column_unset_null(column, indx); return CPL_ERROR_NONE; } /* * @brief * Write a value to a @em long @em long @em integer column element. * * @param column Column to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input column has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a @em long @em long @em integer column element. The * written value is automatically flagged as valid. To invalidate a column * value use @c cpl_column_set_invalid(). Column elements are counted starting * from 0. */ cpl_error_code cpl_column_set_long_long(cpl_column *column, cpl_size indx, long long value) { const char *fid = "cpl_column_set_long_long"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (indx < 0 || indx >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (type != CPL_TYPE_LONG_LONG) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); column->values->ll[indx] = value; cpl_column_unset_null(column, indx); return CPL_ERROR_NONE; } /* * @brief * Write a value to a @em cpl_size column element. * * @param column Column to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input column has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a @em cpl_size column element. The written value is * automatically flagged as valid. To invalidate a column value use * @c cpl_column_set_invalid(). Column elements are counted starting * from 0. */ cpl_error_code cpl_column_set_cplsize(cpl_column *column, cpl_size indx, cpl_size value) { const char *fid = "cpl_column_set_cplsize"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (indx < 0 || indx >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (type != CPL_TYPE_SIZE) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); column->values->sz[indx] = value; cpl_column_unset_null(column, indx); return CPL_ERROR_NONE; } /* * @brief * Write a value to a @em float column element. * * @param column Column to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input column has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a @em float column element. The written value * is automatically flagged as valid. To invalidate a column value use * @c cpl_column_set_invalid(). Column elements are counted starting * from 0. */ cpl_error_code cpl_column_set_float(cpl_column *column, cpl_size indx, float value) { const char *fid = "cpl_column_set_float"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (indx < 0 || indx >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (type != CPL_TYPE_FLOAT) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); column->values->f[indx] = value; cpl_column_unset_null(column, indx); return CPL_ERROR_NONE; } /* * @brief * Write a complex value to a @em float complex column element. * * @param column Column to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input column has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a complex value to a @em float complex column element. The written * value is automatically flagged as valid. To invalidate a column value use * @c cpl_column_set_invalid(). Column elements are counted starting * from 0. */ cpl_error_code cpl_column_set_float_complex(cpl_column *column, cpl_size indx, float complex value) { const char *fid = "cpl_column_set_float_complex"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (indx < 0 || indx >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (type != CPL_TYPE_FLOAT_COMPLEX) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); column->values->cf[indx] = value; cpl_column_unset_null(column, indx); return CPL_ERROR_NONE; } /* * @brief * Write a value to a @em double column element. * * @param column Column to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input column has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a value to a @em double column element. The written value * is automatically flagged as valid. To invalidate a column value use * @c cpl_column_set_invalid(). Column elements are counted starting * from 0. */ cpl_error_code cpl_column_set_double(cpl_column *column, cpl_size indx, double value) { const char *fid = "cpl_column_set_double"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (indx < 0 || indx >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (type != CPL_TYPE_DOUBLE) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); column->values->d[indx] = value; cpl_column_unset_null(column, indx); return CPL_ERROR_NONE; } /* * @brief * Write a complex value to a @em double complex column element. * * @param column Column to be accessed. * @param indx Position where to write value. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is set. If @em indx is * outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input column has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write a complex value to a @em double complex column element. The written * value is automatically flagged as valid. To invalidate a column value use * @c cpl_column_set_invalid(). Column elements are counted starting * from 0. */ cpl_error_code cpl_column_set_double_complex(cpl_column *column, cpl_size indx, double complex value) { const char *fid = "cpl_column_set_double_complex"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (indx < 0 || indx >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (type != CPL_TYPE_DOUBLE_COMPLEX) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); column->values->cd[indx] = value; cpl_column_unset_null(column, indx); return CPL_ERROR_NONE; } /* * @brief * Write a character string to a string column element. * * @param column Column to be accessed. * @param indx Position where to write character string. * @param string Character string to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em indx is * outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. * If the input column has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Copy a character string to a @em string column element. The written * value can also be a @c NULL pointer. Note that the input character * string is copied, therefore the original can be modified without * affecting the column content. To "plug" a character string directly * into a column element, use the function @c cpl_column_get_data_string(). * Column elements are counted starting from zero. */ cpl_error_code cpl_column_set_string(cpl_column *column, cpl_size indx, const char *string) { const char *fid = "cpl_column_set_string"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (indx < 0 || indx >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (type != CPL_TYPE_STRING) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (column->values->s[indx]) cpl_free(column->values->s[indx]); if (string) column->values->s[indx] = cpl_strdup(string); else column->values->s[indx] = NULL; return CPL_ERROR_NONE; } /* * @brief * Write an array to an array column element. * * @param column Column to be accessed. * @param indx Position where to write array. * @param array CPL array to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL * pointer a @c CPL_ERROR_NULL_INPUT is returned. If the column * does not match the type of the input @em array, or if the column * is not made of arrays, a @c CPL_ERROR_TYPE_MISMATCH is returned. * If the input @em array size is different from the column depth, * a @c CPL_ERROR_INCOMPATIBLE_INPUT is returned. If @em indx is * outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is * returned. * * Copy a CPL array to an array column element. The written value * can also be a @c NULL pointer. Note that the input array * is copied, therefore the original can be modified without * affecting the column content. To "plug" an array directly * into a column element, use the function @c cpl_column_get_data_array(). * Column elements are counted starting from zero. */ cpl_error_code cpl_column_set_array(cpl_column *column, cpl_size indx, const cpl_array *array) { const char *fid = "cpl_column_set_array"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); cpl_type atype; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (indx < 0 || indx >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (!(type & CPL_TYPE_POINTER)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (array) { atype = cpl_array_get_type(array); if (type != (atype | CPL_TYPE_POINTER)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (cpl_column_get_depth(column) != cpl_array_get_size(array)) return cpl_error_set(fid, CPL_ERROR_INCOMPATIBLE_INPUT); } if (column->values->array[indx]) cpl_array_delete(column->values->array[indx]); if (array) column->values->array[indx] = cpl_array_duplicate(array); else column->values->array[indx] = NULL; return CPL_ERROR_NONE; } /* * @brief * Set a column element to NULL; * * @param column Column to be accessed. * @param indx Position where to write a NULL. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If @em indx is outside the * column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is set. If the input * column has length 0, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. * * In the case of a string or array column, the string or array is set free * and its pointer is set to @c NULL; for other data types, the corresponding * element of the null flags buffer is flagged. Column elements are counted * starting from zero. */ cpl_error_code cpl_column_set_invalid(cpl_column *column, cpl_size indx) { const char *fid = "cpl_column_set_invalid"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (indx < 0 || indx >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (type == CPL_TYPE_STRING) { if (column->values->s[indx]) { cpl_free(column->values->s[indx]); column->values->s[indx] = NULL; } return CPL_ERROR_NONE; } if (type & CPL_TYPE_POINTER) { if (column->values->array[indx]) { cpl_array_delete(column->values->array[indx]); column->values->array[indx] = NULL; } return CPL_ERROR_NONE; } if (column->nullcount == column->length) return CPL_ERROR_NONE; if (!column->null) column->null = cpl_calloc(column->length, sizeof(cpl_column_flag)); if (column->null[indx] == 0) { column->null[indx] = 1; column->nullcount++; if (column->nullcount == column->length) { if (column->null) cpl_free(column->null); column->null = NULL; } } return CPL_ERROR_NONE; } /* * @brief * Write the same a value within a numerical column segment. * * @param column Column to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of numerical * type, a @c CPL_ERROR_INVALID_TYPE is returned. If @em start is outside * the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If * the input column has length zero, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write the same value to a numerical column segment. The value is cast to * the accessed column type. The written values are automatically flagged as * valid. To invalidate a column interval use @c cpl_column_fill_invalid(). */ cpl_error_code cpl_column_fill(cpl_column *column, cpl_size start, cpl_size count, double value) { const char *fid = "cpl_column_fill"; cpl_type type = cpl_column_get_type(column); switch (type) { case CPL_TYPE_INT: return cpl_column_fill_int(column, start, count, value); case CPL_TYPE_LONG: return cpl_column_fill_long(column, start, count, value); case CPL_TYPE_LONG_LONG: return cpl_column_fill_long_long(column, start, count, value); case CPL_TYPE_SIZE: return cpl_column_fill_cplsize(column, start, count, value); case CPL_TYPE_FLOAT: return cpl_column_fill_float(column, start, count, value); case CPL_TYPE_DOUBLE: return cpl_column_fill_double(column, start, count, value); case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: case CPL_TYPE_STRING: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); default: return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); } } /* * @brief * Write the same complex value within a complex column segment. * * @param column Column to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of complex * type, a @c CPL_ERROR_INVALID_TYPE is returned. If @em start is outside * the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If * the input column has length zero, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. * * Write the same complex value to a complex column segment. The value is * cast to the accessed column type. The written values are automatically * flagged as valid. To invalidate a column interval use * @c cpl_column_fill_invalid(). */ cpl_error_code cpl_column_fill_complex(cpl_column *column, cpl_size start, cpl_size count, double complex value) { const char *fid = "cpl_column_fill_complex"; cpl_type type = cpl_column_get_type(column); switch (type) { case CPL_TYPE_FLOAT_COMPLEX: return cpl_column_fill_float_complex(column, start, count, value); case CPL_TYPE_DOUBLE_COMPLEX: return cpl_column_fill_double_complex(column, start, count, value); case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: case CPL_TYPE_INT: case CPL_TYPE_LONG: case CPL_TYPE_LONG_LONG: case CPL_TYPE_SIZE: case CPL_TYPE_FLOAT: case CPL_TYPE_DOUBLE: case CPL_TYPE_STRING: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); default: return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); } } /* * @brief * Write the same value within an @em integer column segment. * * @param column Column to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to an @em integer column segment. The written * values are automatically flagged as valid. To invalidate a column * interval use @c cpl_column_fill_invalid(). The @em count argument * can go beyond the column end, and in that case the specified @em value * will be written just up to the end of the column. If @em count is zero, * the column is not modified and no error is set. */ cpl_error_code cpl_column_fill_int(cpl_column *column, cpl_size start, cpl_size count, int value) { const char *fid = "cpl_column_fill_int"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); int *ip; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_INT) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count == 0) return CPL_ERROR_NONE; if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count > length - start) count = length - start; cpl_column_unset_null_segment(column, start, count); ip = column->values->i + start; while (count--) *ip++ = value; return CPL_ERROR_NONE; } /* * @brief * Write the same value within a @em long @em integer column segment. * * @param column Column to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em long @em integer column segment. The written * values are automatically flagged as valid. To invalidate a column * interval use @c cpl_column_fill_invalid(). The @em count argument * can go beyond the column end, and in that case the specified @em value * will be written just up to the end of the column. If @em count is zero, * the column is not modified and no error is set. */ cpl_error_code cpl_column_fill_long(cpl_column *column, cpl_size start, cpl_size count, long value) { const char *fid = "cpl_column_fill_long"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); long *lp; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_LONG) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count == 0) return CPL_ERROR_NONE; if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count > length - start) count = length - start; cpl_column_unset_null_segment(column, start, count); lp = column->values->l + start; while (count--) *lp++ = value; return CPL_ERROR_NONE; } /* * @brief * Write the same value within a @em long @em long @em integer column segment. * * @param column Column to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em long @em long @em integer column segment. * The written values are automatically flagged as valid. To invalidate a * column interval use @c cpl_column_fill_invalid(). The @em count argument * can go beyond the column end, and in that case the specified @em value * will be written just up to the end of the column. If @em count is zero, * the column is not modified and no error is set. */ cpl_error_code cpl_column_fill_long_long(cpl_column *column, cpl_size start, cpl_size count, long long value) { const char *fid = "cpl_column_fill_long_long"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); long long *llp; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_LONG_LONG) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count == 0) return CPL_ERROR_NONE; if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count > length - start) count = length - start; cpl_column_unset_null_segment(column, start, count); llp = column->values->ll + start; while (count--) *llp++ = value; return CPL_ERROR_NONE; } /* * @brief * Write the same value within a @em cpl_size column segment. * * @param column Column to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em cpl_size column segment. The written values * are automatically flagged as valid. To invalidate a column interval * use @c cpl_column_fill_invalid(). The @em count argument can go beyond * the column end, and in that case the specified @em value will * be written just up to the end of the column. If @em count is zero, * the column is not modified and no error is set. */ cpl_error_code cpl_column_fill_cplsize(cpl_column *column, cpl_size start, cpl_size count, cpl_size value) { const char *fid = "cpl_column_fill_cplsize"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); cpl_size *szp; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_SIZE) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count == 0) return CPL_ERROR_NONE; if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count > length - start) count = length - start; cpl_column_unset_null_segment(column, start, count); szp = column->values->sz + start; while (count--) *szp++ = value; return CPL_ERROR_NONE; } /* * @brief * Write a value to a @em float column segment. * * @param column Column to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em float column segment. The written * values are automatically flagged as valid. To invalidate a column * interval use @c cpl_column_fill_invalid(). The @em count argument * can go beyond the column end, and in that case the specified @em value * will be written just up to the end of the column. If @em count is zero, * the column is not modified and no error is set. */ cpl_error_code cpl_column_fill_float(cpl_column *column, cpl_size start, cpl_size count, float value) { const char *fid = "cpl_column_fill_float"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); float *fp; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_FLOAT) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count == 0) return CPL_ERROR_NONE; if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count > length - start) count = length - start; cpl_column_unset_null_segment(column, start, count); fp = column->values->f + start; while (count--) *fp++ = value; return CPL_ERROR_NONE; } /* * @brief * Write a value to a @em float complex column segment. * * @param column Column to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em float complex column segment. The written * values are automatically flagged as valid. To invalidate a column * interval use @c cpl_column_fill_invalid(). The @em count argument * can go beyond the column end, and in that case the specified @em value * will be written just up to the end of the column. If @em count is zero, * the column is not modified and no error is set. */ cpl_error_code cpl_column_fill_float_complex(cpl_column *column, cpl_size start, cpl_size count, float complex value) { const char *fid = "cpl_column_fill_float_complex"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); float complex *fp; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_FLOAT_COMPLEX) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count == 0) return CPL_ERROR_NONE; if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count > length - start) count = length - start; cpl_column_unset_null_segment(column, start, count); fp = column->values->cf + start; while (count--) *fp++ = value; return CPL_ERROR_NONE; } /* * @brief * Write a value to a @em double column segment. * * @param column Column to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em double column segment. The written * values are automatically flagged as valid. To invalidate a column * interval use @c cpl_column_fill_invalid(). The @em count argument * can go beyond the column end, and in that case the specified @em value * will be written just up to the end of the column. If @em count is zero, * the column is not modified and no error is set. */ cpl_error_code cpl_column_fill_double(cpl_column *column, cpl_size start, cpl_size count, double value) { const char *fid = "cpl_column_fill_double"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); double *dp; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_DOUBLE) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count == 0) return CPL_ERROR_NONE; if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count > length - start) count = length - start; cpl_column_unset_null_segment(column, start, count); dp = column->values->d + start; while (count--) *dp++ = value; return CPL_ERROR_NONE; } /* * @brief * Write a value to a @em double complex column segment. * * @param column Column to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the same value to a @em double complex column segment. The written * values are automatically flagged as valid. To invalidate a column * interval use @c cpl_column_fill_invalid(). The @em count argument * can go beyond the column end, and in that case the specified @em value * will be written just up to the end of the column. If @em count is zero, * the column is not modified and no error is set. */ cpl_error_code cpl_column_fill_double_complex(cpl_column *column, cpl_size start, cpl_size count, double complex value) { const char *fid = "cpl_column_fill_double_complex"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); double complex *dp; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_DOUBLE_COMPLEX) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count == 0) return CPL_ERROR_NONE; if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count > length - start) count = length - start; cpl_column_unset_null_segment(column, start, count); dp = column->values->cd + start; while (count--) *dp++ = value; return CPL_ERROR_NONE; } /* * @brief * Write a string to a string column segment. * * @param column Column to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Copy the same string to a string column segment. If the input string * is not a @c NULL pointer, it is duplicated for each accessed column * element. If the input string is @c NULL, this call is equivalent to * @c cpl_column_fill_invalid(). The @em count argument can go beyond * the column end, and in that case the specified @em value will be * copied just up to the end of the column. If @em count is zero, * the column is not modified and no error is set. */ cpl_error_code cpl_column_fill_string(cpl_column *column, cpl_size start, cpl_size count, const char *value) { const char *fid = "cpl_column_fill_string"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); char **sp; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_STRING) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count == 0) return CPL_ERROR_NONE; if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count > length - start) count = length - start; if (value == NULL) return cpl_column_fill_invalid(column, start, count); sp = column->values->s + start; while (count--) { if (*sp) cpl_free(*sp); *sp++ = cpl_strdup(value); } return CPL_ERROR_NONE; } /* * @brief * Write the same array to an array column segment. * * @param column Column to be accessed. * @param start Position where to begin write value. * @param count Number of values to write. * @param array Array to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL * pointer a @c CPL_ERROR_NULL_INPUT is returned. If the column * does not match the type of the input @em array, or if the column * is not made of arrays, a @c CPL_ERROR_TYPE_MISMATCH is returned. * If the input @em array size is different from the column depth, * a @c CPL_ERROR_INCOMPATIBLE_INPUT is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the error * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Copy the same array to an array column segment. If the input array * is not a @c NULL pointer, it is duplicated for each accessed column * element. If the input array is @c NULL, this call is equivalent to * @c cpl_column_fill_invalid(). The @em count argument can go beyond * the column end, and in that case the specified @em value will be * copied just up to the end of the column. If @em count is zero, * the column is not modified and no error is set. */ cpl_error_code cpl_column_fill_array(cpl_column *column, cpl_size start, cpl_size count, const cpl_array *array) { const char *fid = "cpl_column_fill_array"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); cpl_type atype; cpl_array **ap; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (!(type & CPL_TYPE_POINTER)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (array) { atype = cpl_array_get_type(array); if (type != (atype | CPL_TYPE_POINTER)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (cpl_column_get_depth(column) != cpl_array_get_size(array)) return cpl_error_set(fid, CPL_ERROR_INCOMPATIBLE_INPUT); } if (count == 0) return CPL_ERROR_NONE; if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count > length - start) count = length - start; if (array == NULL) return cpl_column_fill_invalid(column, start, count); ap = column->values->array + start; while (count--) { if (*ap) cpl_array_delete(*ap); *ap++ = cpl_array_duplicate(array); } return CPL_ERROR_NONE; } /* * @brief * Set a column segment to NULL. * * @param column Column to be accessed. * @param start Position where to start writing NULLs. * @param count Number of column elements to set to NULL. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If @em start is outside the * column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the * input column has length zero, the error @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. If @em count is negative, a @c CPL_ERROR_ILLEGAL_INPUT * is returned. * * Invalidate values contained in a column segment. The @em count argument * can go beyond the column end, and in that case the values will be * invalidated up to the end of the column. If @em count is zero, the * column is not modified and no error is set. In the case of a @em string * or @em array column, the invalidated strings or arrays are set free and * their pointers are set to @c NULL; for other data types, the corresponding * elements are flagged as invalid. */ cpl_error_code cpl_column_fill_invalid(cpl_column *column, cpl_size start, cpl_size count) { const char *fid = "cpl_column_fill_invalid"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_size c; cpl_column_flag *np; char **sp; cpl_array **ap; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (count == 0) return CPL_ERROR_NONE; if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count > length - start) count = length - start; if (count == length) { if (type != CPL_TYPE_STRING && !(type & CPL_TYPE_POINTER)) { if (column->null) cpl_free(column->null); column->null = NULL; column->nullcount = length; return CPL_ERROR_NONE; } } c = count; if (type == CPL_TYPE_STRING) { sp = column->values->s + start; while (c--) { if (*sp) cpl_free(*sp); sp++; } memset(column->values->s + start, 0, count * sizeof(char *)); return CPL_ERROR_NONE; } if (type & CPL_TYPE_POINTER) { ap = column->values->array + start; while (c--) { if (*ap) cpl_array_delete(*ap); ap++; } memset(column->values->array + start, 0, count * sizeof(cpl_array *)); return CPL_ERROR_NONE; } if (column->nullcount == length) return CPL_ERROR_NONE; if (!column->null) column->null = cpl_calloc(length, sizeof(cpl_column_flag)); np = column->null + start; if (column->nullcount == 0) { column->nullcount = count; while (c--) *np++ = 1; } else { while (c--) { if (*np == 0) { *np = 1; column->nullcount++; } np++; } if (column->nullcount == length) { if (column->null) cpl_free(column->null); column->null = NULL; } } return CPL_ERROR_NONE; } /* * @brief * Copy an array of values to a numerical column segment. * * @param column Column to be accessed. * @param start Position where to begin write values. * @param count Number of values to write. * @param values Values to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of numerical * type, a @c CPL_ERROR_INVALID_TYPE is returned. If @em start is outside * the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If * the input column has length zero, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. If @em count is not greater than zero, a * @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the values to a numerical column segment. The values are cast to * the accessed column type. The written values are automatically flagged * as valid. The @em count argument can go beyond the column end, and in * that case values will be transferred just up to the end of the column. * This function doesn't apply to array column types. */ cpl_error_code cpl_column_copy_segment(cpl_column *column, cpl_size start, cpl_size count, double *values) { const char *fid = "cpl_column_copy_segment"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count <= 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (count > length - start) count = length - start; cpl_column_unset_null_segment(column, start, count); switch (type) { case CPL_TYPE_INT: { int *idata = cpl_column_get_data_int(column); idata += start; while (count--) *idata++ = *values++; break; } case CPL_TYPE_LONG: { long *ldata = cpl_column_get_data_long(column); ldata += start; while (count--) *ldata++ = *values++; break; } case CPL_TYPE_LONG_LONG: { long long *lldata = cpl_column_get_data_long_long(column); lldata += start; while (count--) *lldata++ = *values++; break; } case CPL_TYPE_SIZE: { cpl_size *szdata = cpl_column_get_data_cplsize(column); szdata += start; while (count--) *szdata++ = *values++; break; } case CPL_TYPE_FLOAT: { float *fdata = cpl_column_get_data_float(column); fdata += start; while (count--) *fdata++ = *values++; break; } case CPL_TYPE_DOUBLE: memcpy(column->values->d + start, values, count * sizeof(double)); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /* * @brief * Copy an array of complex values to a complex column segment. * * @param column Column to be accessed. * @param start Position where to begin write values. * @param count Number of values to write. * @param values Values to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of complex * type, a @c CPL_ERROR_INVALID_TYPE is returned. If @em start is outside * the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If * the input column has length zero, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is always returned. If @em count is not greater than zero, a * @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write the values to a complex column segment. The values are cast to * the accessed column type. The written values are automatically flagged * as valid. The @em count argument can go beyond the column end, and in * that case values will be transferred just up to the end of the column. * This function doesn't apply to array column types. */ cpl_error_code cpl_column_copy_segment_complex(cpl_column *column, cpl_size start, cpl_size count, double complex *values) { const char *fid = "cpl_column_copy_segment_complex"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); float complex *fdata; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count <= 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (count > length - start) count = length - start; cpl_column_unset_null_segment(column, start, count); switch (type) { case CPL_TYPE_FLOAT_COMPLEX: fdata = cpl_column_get_data_float_complex(column); fdata += start; while (count--) *fdata++ = *values++; break; case CPL_TYPE_DOUBLE_COMPLEX: memcpy(column->values->cd + start, values, count * sizeof(double complex)); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /* * @brief * Copy a list of integer values to an @em integer column segment. * * @param column Column to be accessed. * @param start Position where to begin write values. * @param count Number of values to write. * @param values Values to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is not greater than zero, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write a list of integer values to an @em integer column segment. * The written values are automatically flagged as valid. The @em count * argument can go beyond the column end, and in that case values will * be transferred just up to the end of the column. */ cpl_error_code cpl_column_copy_segment_int(cpl_column *column, cpl_size start, cpl_size count, int *values) { const char *fid = "cpl_column_copy_segment_int"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count <= 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_INT) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count > length - start) count = length - start; memcpy(column->values->i + start, values, count * sizeof(int)); cpl_column_unset_null_segment(column, start, count); return CPL_ERROR_NONE; } /* * @brief * Copy a list of long integer values to a @em long @em integer column * segment. * * @param column Column to be accessed. * @param start Position where to begin write values. * @param count Number of values to write. * @param values Values to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is not greater than zero, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write a list of long integer values to a @em long @em integer column * segment. The written values are automatically flagged as valid. The * @em count argument can go beyond the column end, and in that case * values will be transferred just up to the end of the column. */ cpl_error_code cpl_column_copy_segment_long(cpl_column *column, cpl_size start, cpl_size count, long *values) { const char *fid = "cpl_column_copy_segment_long"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count <= 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_LONG) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count > length - start) count = length - start; memcpy(column->values->l + start, values, count * sizeof(long)); cpl_column_unset_null_segment(column, start, count); return CPL_ERROR_NONE; } /* * @brief * Copy a list of long integer values to a @em long @em long @em integer * column segment. * * @param column Column to be accessed. * @param start Position where to begin write values. * @param count Number of values to write. * @param values Values to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is not greater than zero, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write a list of long long integer values to a @em long @em long @em integer * column segment. The written values are automatically flagged as valid. * The @em count argument can go beyond the column end, and in that case * values will be transferred just up to the end of the column. */ cpl_error_code cpl_column_copy_segment_long_long(cpl_column *column, cpl_size start, cpl_size count, long long *values) { const char *fid = "cpl_column_copy_segment_long_long"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count <= 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_LONG_LONG) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count > length - start) count = length - start; memcpy(column->values->ll + start, values, count * sizeof(long long)); cpl_column_unset_null_segment(column, start, count); return CPL_ERROR_NONE; } /* * @brief * Copy a list of cpl_size values to a @em cpl_size column segment. * * @param column Column to be accessed. * @param start Position where to begin write values. * @param count Number of values to write. * @param values Values to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is not greater than zero, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write a list of cpl_size values to a @em cpl_size column segment. * The written values are automatically flagged as valid. * The @em count argument can go beyond the column end, and in that case * values will be transferred just up to the end of the column. */ cpl_error_code cpl_column_copy_segment_cplsize(cpl_column *column, cpl_size start, cpl_size count, cpl_size *values) { const char *fid = "cpl_column_copy_segment_cplsize"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count <= 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_SIZE) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count > length - start) count = length - start; memcpy(column->values->sz + start, values, count * sizeof(cpl_size)); cpl_column_unset_null_segment(column, start, count); return CPL_ERROR_NONE; } /* * @brief * Copy a list of float values to a @em float column segment. * * @param column Column to be accessed. * @param start Position where to begin write values. * @param count Number of values to write. * @param values Values to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is not greater than zero, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write a list of float values to a @em float column segment. * The written values are automatically flagged as valid. The @em count * argument can go beyond the column end, and in that case values will * be transferred just up to the end of the column. */ cpl_error_code cpl_column_copy_segment_float(cpl_column *column, cpl_size start, cpl_size count, float *values) { const char *fid = "cpl_column_copy_segment_float"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count <= 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_FLOAT) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count > length - start) count = length - start; memcpy(column->values->f + start, values, count * sizeof(float)); cpl_column_unset_null_segment(column, start, count); return CPL_ERROR_NONE; } /* * @brief * Copy a list of float complex values to a @em float complex column segment. * * @param column Column to be accessed. * @param start Position where to begin write values. * @param count Number of values to write. * @param values Values to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is not greater than zero, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write a list of float complex values to a @em float complex column segment. * The written values are automatically flagged as valid. The @em count * argument can go beyond the column end, and in that case values will * be transferred just up to the end of the column. */ cpl_error_code cpl_column_copy_segment_float_complex(cpl_column *column, cpl_size start, cpl_size count, float complex *values) { const char *fid = "cpl_column_copy_segment_float_complex"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count <= 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_FLOAT_COMPLEX) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count > length - start) count = length - start; memcpy(column->values->cf + start, values, count * sizeof(float complex)); cpl_column_unset_null_segment(column, start, count); return CPL_ERROR_NONE; } /* * @brief * Copy list of double complex values to a @em double complex column segment. * * @param column Column to be accessed. * @param start Position where to begin write values. * @param count Number of values to write. * @param values Values to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is not greater than zero, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write a list of double complex values to a @em double complex column segment. * The written values are automatically flagged as valid. The @em count * argument can go beyond the column end, and in that case values will * be transferred just up to the end of the column. */ cpl_error_code cpl_column_copy_segment_double_complex(cpl_column *column, cpl_size start, cpl_size count, double complex *values) { const char *fid = "cpl_column_copy_segment_double_complex"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count <= 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_DOUBLE_COMPLEX) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count > length - start) count = length - start; memcpy(column->values->cd + start, values, count * sizeof(double complex)); cpl_column_unset_null_segment(column, start, count); return CPL_ERROR_NONE; } /* * @brief * Copy a list of @em double values to a @em double column segment. * * @param column Column to be accessed. * @param start Position where to begin write values. * @param count Number of values to write. * @param values Values to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is not greater than zero, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write a list of double values to a @em double column segment. * The written values are automatically flagged as valid. The @em count * argument can go beyond the column end, and in that case values will * be transferred just up to the end of the column. */ cpl_error_code cpl_column_copy_segment_double(cpl_column *column, cpl_size start, cpl_size count, double *values) { const char *fid = "cpl_column_copy_segment_double"; cpl_size length = cpl_column_get_size(column); cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count <= 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_DOUBLE) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count > length - start) count = length - start; memcpy(column->values->d + start, values, count * sizeof(double)); cpl_column_unset_null_segment(column, start, count); return CPL_ERROR_NONE; } /* * @brief * Copy a list of strings to a @em string column segment. * * @param column Column to be accessed. * @param start Position where to begin write strings. * @param count Number of strings to write. * @param strings Strings to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL pointer * a @c CPL_ERROR_NULL_INPUT is returned. If the column is not of the * expected type, a @c CPL_ERROR_TYPE_MISMATCH is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is not greater than zero, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write a list of strings to a @em string column segment. The written * values are automatically flagged as valid. The input strings are * duplicated before being assigned to the corresponding column elements. * The @em count argument can go beyond the column end, and in that case * values will be transferred just up to the end of the column. */ cpl_error_code cpl_column_copy_segment_string(cpl_column *column, cpl_size start, cpl_size count, char **strings) { const char *fid = "cpl_column_copy_segment_string"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_size i; char **sp; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count <= 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (type != CPL_TYPE_STRING) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count > length - start) count = length - start; sp = column->values->s + start; if (strings) { for (i = 0; i < count; i++) { if (*sp) cpl_free(*sp); if (*strings) *sp++ = cpl_strdup(*strings++); else *sp++ = NULL; } } else { for (i = 0; i < count; i++) { if (*sp) cpl_free(*sp); *sp++ = NULL; } } return CPL_ERROR_NONE; } /* * @brief * Copy a list of CPL arrays to an @em array column segment. * * @param column Column to be accessed. * @param start Position where to begin write strings. * @param count Number of strings to write. * @param arrays Arrays to write. * * @return @c CPL_ERROR_NONE on success. If @em column is a @c NULL * pointer a @c CPL_ERROR_NULL_INPUT is returned. If the column * does not match the type of any of the input arrays, or if the column * is not made of arrays, a @c CPL_ERROR_TYPE_MISMATCH is returned. * If the size of any of the input arrays is different from the column * depth a @c CPL_ERROR_INCOMPATIBLE_INPUT is returned. If @em start * is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. If the input column has length zero, the * @c CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If @em count * is not greater than zero, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Write a list of arrays to an @em array column segment. The written * values are automatically flagged as valid. The input arrays are * duplicated before being assigned to the corresponding column elements. * The @em count argument can go beyond the column end, and in that case * values will be transferred just up to the end of the column. */ cpl_error_code cpl_column_copy_segment_array(cpl_column *column, cpl_size start, cpl_size count, cpl_array **arrays) { const char *fid = "cpl_column_copy_segment_array"; cpl_type type = cpl_column_get_type(column); cpl_type atype; cpl_size length = cpl_column_get_size(column); cpl_size i; cpl_array **ap; cpl_array **keep; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count <= 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (!(type & CPL_TYPE_POINTER)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (count > length - start) count = length - start; ap = column->values->array + start; if (arrays) { /* * Check the compatibility of all the input arrays first */ keep = arrays; for (i = 0; i < count; i++) { if (*arrays) { atype = cpl_array_get_type(*arrays); if (type != (atype | CPL_TYPE_POINTER)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (cpl_column_get_depth(column) != cpl_array_get_size(*arrays)) return cpl_error_set(fid, CPL_ERROR_INCOMPATIBLE_INPUT); arrays++; } } arrays = keep; for (i = 0; i < count; i++) { if (*ap) cpl_array_delete(*ap); if (*arrays) *ap++ = cpl_array_duplicate(*arrays++); else *ap++ = NULL; } } else { for (i = 0; i < count; i++) { if (*ap) cpl_array_delete(*ap); *ap++ = NULL; } } return CPL_ERROR_NONE; } /*************** TODO ******************/ /* * @brief * Copy a segment of a column into another column. * * @param to_column Column to be modified. * @param to_start Position where to begin write values. * @param from_column Source column. * @param from_start Position where to begin copy values. * @param count Number of values to copy. * * @return 0 on success. * * Both columns must be of the same type. */ /*************** TODO ****************** cpl_error_code cpl_column_extract_from_column(cpl_column *to_column, size_t to_start, cpl_column *from_column, size_t from_start, size_t count) { size_t i = 0; size_t nullcount = 0; size_t to_length = cpl_column_get_size(to_column); size_t from_length = cpl_column_get_size(from_column); cpl_type to_type = cpl_column_get_type(to_column); cpl_type from_type = cpl_column_get_type(from_column); assert(to_column != 0x0); assert(from_column != 0x0); if (to_type != from_type) return 1; if (to_start > to_length || from_start > from_length) return 1; if (to_start + count > to_length || from_start + count > from_length) return 1; if (from_column->nullcount == from_length) return cpl_column_fill_invalid(to_column, to_start, count); if (from_column->nullcount) { while (i < count) { nullcount += from_column->null[from_start + i]; i++; } } if (nullcount == count) return cpl_column_fill_invalid(to_column, to_start, count); if (nullcount) { if (to_column->nullcount == to_length) { to_column->null = cpl_malloc(to_length * sizeof(cpl_column_flag)); } } switch (to_type) { case CPL_TYPE_INT: memcpy(to_column->values->i + to_start, from_column->values->i + from_start, count * sizeof(int)); case CPL_TYPE_FLOAT: case CPL_TYPE_DOUBLE: case CPL_TYPE_STRING: default: } if (start < length) { if (count > length - start) count = length - start; if (type == CPL_TYPE_INT) { memcpy(column->values->i + start, values, count * sizeof(int)); return cpl_column_unset_null_segment(column, start, count); } } } **********************************/ /* * @brief * Delete a column segment. * * @param column Column to be accessed. * @param start Position of first column element to delete. * @param count Number of column elements to delete. * * @return @c CPL_ERROR_NONE on success. If @em start is outside the * column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the * input column has length zero, the @c CPL_ERROR_ACCESS_OUT_OF_RANGE is * always returned. If @em count is negative, a @c CPL_ERROR_ILLEGAL_INPUT * is returned. * * Delete a column segment. This is different from invalidating a column * segment, as done by @c cpl_column_fill_invalid(): here a portion of * the data is physically removed, and the column data buffer shortened * proportionally. The pointer to data may change (therefore pointers * previously retrieved by calling @c cpl_column_get_data_int(), * @c cpl_column_get_data_string(), etc., should be discarded). The * specified segment can go beyond the end of the column, and even all * of the column data elements can be removed. */ cpl_error_code cpl_column_erase_segment(cpl_column *column, cpl_size start, cpl_size count) { const char *fid = "cpl_column_erase_segment"; cpl_type type = cpl_column_get_type(column); cpl_size old_length = cpl_column_get_size(column); cpl_size new_length; cpl_size end; cpl_size i; cpl_size j; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0 || start >= old_length) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (count == 0) return CPL_ERROR_NONE; if (count > old_length - start) count = old_length - start; new_length = old_length - count; end = start + count; if (end == old_length) return cpl_column_set_size(column, start); if (type == CPL_TYPE_STRING) { /* * If a column of character strings is shortened, we must * free explicitly the extra strings. */ char **sp1 = column->values->s + start; for (i = start; i < end; i++, sp1++) if (*sp1) cpl_free(*sp1); } if (type & CPL_TYPE_POINTER) { /* * If a column of arrays is shortened, we must * free explicitly the extra arrays. */ cpl_array **ap1 = column->values->array + start; for (i = start; i < end; i++, ap1++) if (*ap1) cpl_array_delete(*ap1); } /* * Cut the slice from the invalid flags buffer, if present, * counting how many invalid elements will be lost. */ if (column->null) { i = start; while (i < end) { if (column->null[i]) column->nullcount--; i++; } if (column->nullcount == 0 || column->nullcount == new_length) { /* * Since either no invalid or just invalid elements are left, * the invalid flag buffer can be released. */ if (column->null) cpl_free(column->null); column->null = NULL; } else { /* * Shift up NULL flags that are after the slice. */ i = start; j = end; while (j < old_length) { column->null[i] = column->null[j]; i++; j++; } /* * Get rid of extra memory. */ column->null = cpl_realloc(column->null, new_length * sizeof(cpl_column_flag)); } } else { /* * There is no invalid flag buffer, so either there are no * invalid elements or there are just invalid elements. If * there are no invalid elements, nullcount stays zero. If * there are just invalid elements, nullcount must be set * to the new column length. */ if (column->nullcount == old_length) column->nullcount = new_length; } /* * Now take care of data values */ if ((type == CPL_TYPE_STRING) || (type & CPL_TYPE_POINTER)) column->nullcount = 0; if (column->nullcount != new_length) { /* * Column has not just invalid elements. In this case we have to * shift also the data to fill the gap. */ switch (type) { case CPL_TYPE_INT: { int *ip1 = column->values->i + start; int *ip2 = column->values->i + end; for (j = end; j < old_length; j++) *ip1++ = *ip2++; break; } case CPL_TYPE_LONG: { long *lp1 = column->values->l + start; long *lp2 = column->values->l + end; for (j = end; j < old_length; j++) *lp1++ = *lp2++; break; } case CPL_TYPE_LONG_LONG: { long long *llp1 = column->values->ll + start; long long *llp2 = column->values->ll + end; for (j = end; j < old_length; j++) *llp1++ = *llp2++; break; } case CPL_TYPE_SIZE: { cpl_size *szp1 = column->values->sz + start; cpl_size *szp2 = column->values->sz + end; for (j = end; j < old_length; j++) *szp1++ = *szp2++; break; } case CPL_TYPE_FLOAT: { float *fp1 = column->values->f + start; float *fp2 = column->values->f + end; for (j = end; j < old_length; j++) *fp1++ = *fp2++; break; } case CPL_TYPE_DOUBLE: { double *dp1 = column->values->d + start; double *dp2 = column->values->d + end; for (j = end; j < old_length; j++) *dp1++ = *dp2++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *cfp1 = column->values->cf + start; float complex *cfp2 = column->values->cf + end; for (j = end; j < old_length; j++) *cfp1++ = *cfp2++; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *cdp1 = column->values->cd + start; double complex *cdp2 = column->values->cd + end; for (j = end; j < old_length; j++) *cdp1++ = *cdp2++; break; } case CPL_TYPE_STRING: { char **sp1 = column->values->s + start; char **sp2 = column->values->s + end; for (j = end; j < old_length; j++) *sp1++ = *sp2++; break; } default: /* Array columns */ { cpl_array **ap1 = column->values->array + start; cpl_array **ap2 = column->values->array + end; for (j = end; j < old_length; j++) *ap1++ = *ap2++; break; } } } /* * Finally, reallocate the data buffer. */ column->values->i = cpl_realloc(column->values->i, new_length * cpl_column_type_size(type)); column->length = new_length; return 0; } /* * @brief * Delete column elements * * @param column Column to be accessed. * @param pattern Array that defines which elements (non-zero values) * to be erased. The array length should equal the column * length. * @return @c CPL_ERROR_NONE on success, CPL_ERROR_NULL_INPUT if any input * pointer is NULL. If the column has length zero, nothing happens and * CPL_ERROR_NONE is returned. * * Delete column elements according to non-zero values of the * provided @em pattern. Elements are physically removed, and the column * data buffer shortened proportionally. The pointer to data may change * (therefore pointers previously retrieved by calling * @c cpl_column_get_data_int(), @c cpl_column_get_data_string(), * etc., should be discarded). * * The execution time O(n) where n is the column length. */ cpl_error_code cpl_column_erase_pattern(cpl_column *column, int *pattern) { const char *fid = "cpl_column_erase_pattern"; cpl_type type = cpl_column_get_type(column); cpl_size old_length = cpl_column_get_size(column); cpl_size new_length; cpl_size i; cpl_size j; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (pattern == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); new_length = 0; for (i = 0; i < old_length; i++) if (!pattern[i]) new_length++; if (type == CPL_TYPE_STRING) { /* * If a column of character strings is shortened, we must * free explicitly the extra strings. */ for(i = 0; i < old_length; i++) if (pattern[i]) if (column->values->s[i]) cpl_free(column->values->s[i]); } if (type & CPL_TYPE_POINTER) { /* * If a column of arrays is shortened, we must * free explicitly the extra arrays. */ for(i = 0; i < old_length; i++) if (pattern[i]) if (column->values->array[i]) cpl_array_delete(column->values->array[i]); } /* * Shorten the invalid flags buffer, if present, * counting how many invalid elements will be lost. */ if (column->null) { for (i = 0; i < old_length; i++) if (pattern[i]) if (column->null[i]) column->nullcount--; if (column->nullcount == 0 || column->nullcount == new_length) { /* * Since either no invalid or just invalid elements are left, * the invalid flag buffer can be released. */ if (column->null) cpl_free(column->null); column->null = NULL; } else { /* * Shift up NULL flags. */ i = 0; for (j = 0; j < old_length; j++) if (!pattern[j]) { column->null[i] = column->null[j]; i++; } /* * Get rid of extra memory. */ column->null = cpl_realloc(column->null, new_length * sizeof(cpl_column_flag)); } } else { /* * There is no invalid flag buffer, so either there are no * invalid elements or there are just invalid elements. If * there are no invalid elements, nullcount stays zero. If * there are just invalid elements, nullcount must be set * to the new column length. */ if (column->nullcount == old_length) column->nullcount = new_length; } /* * Now take care of data values */ if ((type == CPL_TYPE_STRING) || (type & CPL_TYPE_POINTER)) column->nullcount = 0; if (column->nullcount != new_length) { /* * Column has not just invalid elements. In this case we have to * shift also the data to fill the gaps. */ switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; i = 0; for(j = 0; j < old_length; j++) if (!pattern[j]) ip[i++] = ip[j]; break; } case CPL_TYPE_LONG: { long *lp = column->values->l; i = 0; for(j = 0; j < old_length; j++) if (!pattern[j]) lp[i++] = lp[j]; break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; i = 0; for(j = 0; j < old_length; j++) if (!pattern[j]) llp[i++] = llp[j]; break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; i = 0; for(j = 0; j < old_length; j++) if (!pattern[j]) szp[i++] = szp[j]; break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; i = 0; for(j = 0; j < old_length; j++) if (!pattern[j]) fp[i++] = fp[j]; break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; i = 0; for(j = 0; j < old_length; j++) if (!pattern[j]) dp[i++] = dp[j]; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *cfp = column->values->cf; i = 0; for(j = 0; j < old_length; j++) if (!pattern[j]) cfp[i++] = cfp[j]; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *cdp = column->values->cd; i = 0; for(j = 0; j < old_length; j++) if (!pattern[j]) cdp[i++] = cdp[j]; break; } case CPL_TYPE_STRING: { char **sp = column->values->s; i = 0; for(j = 0; j < old_length; j++) if (!pattern[j]) sp[i++] = sp[j]; break; } default: /* Array columns */ { cpl_array **ap = column->values->array; i = 0; for(j = 0; j < old_length; j++) if (!pattern[j]) ap[i++] = ap[j]; break; } } } /* * Finally, reallocate the data buffer. */ column->values->i = cpl_realloc(column->values->i, new_length * cpl_column_type_size(type)); column->length = new_length; return 0; } /* * @brief * Insert a segment into column data. * * @param column Column to be accessed. * @param start Column element where to insert the segment. * @param count Length of segment. * * @return @c CPL_ERROR_NONE on success. If @em start is negative, * a @c CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If @em count * is negative, a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * Insert a segment of new values in the column data buffer. The * new segment consists of a sequence of invalid (not initialised) * column elements. This is different from invalidating a column data * segment, as done by @c cpl_column_fill_invalid(): here a portion * of new data is physically inserted, and the column data buffer * is made proportionally longer. Setting @em start to a number * not less than the column length is legal, and has the effect of * appending at the end of the column as many invalid elements as * specified by the @em count argument (this is equivalent to expanding * a column using @c cpl_column_set_size() ). The input @em column may * also have zero length. The pointer to data may change, therefore * pointers previously retrieved by calling @c cpl_column_get_data_int(), * @c cpl_column_get_data_string(), etc., should be discarded. */ cpl_error_code cpl_column_insert_segment(cpl_column *column, cpl_size start, cpl_size count) { const char *fid = "cpl_column_insert_segment"; cpl_type type = cpl_column_get_type(column); cpl_size old_length = cpl_column_get_size(column); cpl_size new_length = old_length + count; cpl_size i; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (start < 0) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (count < 0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); if (count == 0) return CPL_ERROR_NONE; if (cpl_column_set_size(column, new_length)) { return cpl_error_set_where(fid); } if (start > old_length) return CPL_ERROR_NONE; switch (type) { case CPL_TYPE_INT: { int *ip1 = column->values->i + new_length; int *ip2 = column->values->i + old_length; for (i = old_length; i > start; i--) { *--ip1 = *--ip2; *ip2 = 0; } break; } case CPL_TYPE_LONG: { long *lp1 = column->values->l + new_length; long *lp2 = column->values->l + old_length; for (i = old_length; i > start; i--) { *--lp1 = *--lp2; *lp2 = 0; } break; } case CPL_TYPE_LONG_LONG: { long long *llp1 = column->values->ll + new_length; long long *llp2 = column->values->ll + old_length; for (i = old_length; i > start; i--) { *--llp1 = *--llp2; *llp2 = 0; } break; } case CPL_TYPE_SIZE: { cpl_size *szp1 = column->values->sz + new_length; cpl_size *szp2 = column->values->sz + old_length; for (i = old_length; i > start; i--) { *--szp1 = *--szp2; *szp2 = 0; } break; } case CPL_TYPE_FLOAT: { float *fp1 = column->values->f + new_length; float *fp2 = column->values->f + old_length; for (i = old_length; i > start; i--) { *--fp1 = *--fp2; *fp2 = 0.0; } break; } case CPL_TYPE_DOUBLE: { double *dp1 = column->values->d + new_length; double *dp2 = column->values->d + old_length; for (i = old_length; i > start; i--) { *--dp1 = *--dp2; *dp2 = 0.0; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *cfp1 = column->values->cf + new_length; float complex *cfp2 = column->values->cf + old_length; for (i = old_length; i > start; i--) { *--cfp1 = *--cfp2; *cfp2 = 0.0; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *cdp1 = column->values->cd + new_length; double complex *cdp2 = column->values->cd + old_length; for (i = old_length; i > start; i--) { *--cdp1 = *--cdp2; *cdp2 = 0.0; } break; } case CPL_TYPE_STRING: { char **sp1 = column->values->s + new_length; char **sp2 = column->values->s + old_length; for (i = old_length; i > start; i--) { *--sp1 = *--sp2; *sp2 = 0x0; } break; } default: /* Array columns */ { cpl_array **ap1 = column->values->array + new_length; cpl_array **ap2 = column->values->array + old_length; for (i = old_length; i > start; i--) { *--ap1 = *--ap2; *ap2 = 0x0; } break; } } /* * Handling the invalid flags it's simple: all the hard work * was actually done by cpl_column_set_size(). If the invalid * flags buffer exists, we have just to shift the flags to * the proper place. */ if (column->null) { int *np1 = column->null + new_length; int *np2 = column->null + old_length; for (i = old_length; i > start; i--) { *--np1 = *--np2; *np2 = 1; } } return CPL_ERROR_NONE; } /* * @brief * Make a copy of a column. * * @param column Column to be duplicated. * * @return Pointer to the new column, or @c NULL in case of error. * * If the input @em column is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT * is returned. Copy is "in depth": in the case of a @em string column, * also the string elements are duplicated. */ cpl_column *cpl_column_duplicate(cpl_column *column) { const char *fid = "cpl_column_duplicate"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_size depth = cpl_column_get_depth(column); cpl_column *new_column = NULL; if (column == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } switch (type) { case CPL_TYPE_INT: new_column = cpl_column_new_int(length); break; case CPL_TYPE_LONG: new_column = cpl_column_new_long(length); break; case CPL_TYPE_LONG_LONG: new_column = cpl_column_new_long_long(length); break; case CPL_TYPE_SIZE: new_column = cpl_column_new_cplsize(length); break; case CPL_TYPE_FLOAT: new_column = cpl_column_new_float(length); break; case CPL_TYPE_DOUBLE: new_column = cpl_column_new_double(length); break; case CPL_TYPE_FLOAT_COMPLEX: new_column = cpl_column_new_float_complex(length); break; case CPL_TYPE_DOUBLE_COMPLEX: new_column = cpl_column_new_double_complex(length); break; case CPL_TYPE_STRING: new_column = cpl_column_new_string(length); break; case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_SIZE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: new_column = cpl_column_new_array(type, length, depth); break; default: cpl_error_set(fid, CPL_ERROR_UNSPECIFIED); return NULL; } cpl_column_set_name(new_column, cpl_column_get_name(column)); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); cpl_column_set_format(new_column, cpl_column_get_format(column)); if (length == 0) return new_column; if (type == CPL_TYPE_STRING) { while (length--) { if (column->values->s[length]) { new_column->values->s[length] = cpl_strdup(column->values->s[length]); } else { new_column->values->s[length] = NULL; } } return new_column; } if (type & CPL_TYPE_POINTER) { while (length--) { if (column->values->array[length]) { new_column->values->array[length] = cpl_array_duplicate(column->values->array[length]); } else { new_column->values->array[length] = NULL; } } if (column->dimensions) new_column->dimensions = cpl_array_duplicate(column->dimensions); return new_column; } memcpy(new_column->values->i, column->values->i, length * cpl_column_type_size(type)); new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } return new_column; } /* * @brief * Cast a numerical column to a new @em integer column. * * @param column Column to be cast. * * @return Pointer to the new column, or @em NULL in case of error. * * If the accessed column is of type either string or array of strings, or * complex, a @c CPL_ERROR_INVALID_TYPE is set. If the input is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is set. The output column is nameless, * and with the default format for its type (see function * @c cpl_column_set_format() ). However, if the input column is * also @em integer, a simple copy is made and the column format * is inherited. The input column units are always preserved in the * output column. Note that a column of arrays is always cast to * another column of @em integer arrays. It is not allowed to cast * a column of arrays into a column of plain integers. */ cpl_column *cpl_column_cast_to_int(cpl_column *column) { const char *fid = "cpl_column_cast_to_int"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; int *np; int *ip; if (column == 0x0) { cpl_error_set_where(fid); return NULL; } if ((type & CPL_TYPE_STRING) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) && (type & CPL_TYPE_INT)) { new_column = cpl_column_duplicate(column); cpl_column_set_name(new_column, NULL); return new_column; } if (type & CPL_TYPE_POINTER) { new_column = cpl_column_new_array(CPL_TYPE_INT | CPL_TYPE_POINTER, length, cpl_column_get_depth(column)); if (column->dimensions) new_column->dimensions = cpl_array_duplicate(column->dimensions); } else new_column = cpl_column_new_int(length); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; if (column->nullcount == length) /* No need to copy just NULLs */ return new_column; if (type & CPL_TYPE_POINTER) { cpl_array **array = cpl_column_get_data_array(column); cpl_array **new_array = cpl_column_get_data_array(new_column); while (length--) { if (array[length]) { cpl_column *acolumn = cpl_array_get_column(array[length]); cpl_column *icolumn = cpl_column_cast_to_int(acolumn); new_array[length] = cpl_array_new(cpl_column_get_size(icolumn), cpl_column_get_type(icolumn)); cpl_array_set_column(new_array[length], icolumn); } } return new_column; } ip = cpl_column_get_data_int(new_column); np = column->null; switch (type) { case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) *ip++ = *lp++; } else { while (length--) { if (*np++ == 0) *ip = *lp; ip++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) *ip++ = *llp++; } else { while (length--) { if (*np++ == 0) *ip = *llp; ip++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) *ip++ = *szp++; } else { while (length--) { if (*np++ == 0) *ip = *szp; ip++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) *ip++ = *fp++; } else { while (length--) { if (*np++ == 0) *ip = *fp; ip++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) *ip++ = *dp++; } else { while (length--) { if (*np++ == 0) *ip = *dp; ip++; dp++; } } break; } default: cpl_error_set(fid, CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } length = cpl_column_get_size(column); new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } return new_column; } cpl_column *cpl_column_cast_to_int_array(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; int *np; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if ((type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_array(CPL_TYPE_INT | CPL_TYPE_POINTER, length, 1); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_INT); cpl_array_set_int(*array, 0, *ip); array++; ip++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_INT); cpl_array_set_int(*array, 0, *ip); } array++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_INT); cpl_array_set_int(*array, 0, *lp); array++; lp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_INT); cpl_array_set_int(*array, 0, *lp); } array++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_INT); cpl_array_set_int(*array, 0, *llp); array++; llp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_INT); cpl_array_set_int(*array, 0, *llp); } array++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_INT); cpl_array_set_int(*array, 0, *szp); array++; szp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_INT); cpl_array_set_int(*array, 0, *szp); } array++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_INT); cpl_array_set_int(*array, 0, *fp); array++; fp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_INT); cpl_array_set_int(*array, 0, *fp); } array++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_INT); cpl_array_set_int(*array, 0, *dp); array++; dp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_INT); cpl_array_set_int(*array, 0, *dp); } array++; dp++; } } break; } default: cpl_error_set_(CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } return new_column; } cpl_column *cpl_column_cast_to_int_flat(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_int(length); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(column) + length; while (length--) { array--; if (*array) { if (cpl_array_is_valid(*array, 0)) { cpl_column_set_int(new_column, length, cpl_array_get(*array, 0, NULL)); } } } return new_column; } /* * @brief * Cast a numerical column to a new @em long @em integer column. * * @param column Column to be cast. * * @return Pointer to the new column, or @em NULL in case of error. * * If the accessed column is of type either string or array of strings, or * complex, a @c CPL_ERROR_INVALID_TYPE is set. If the input is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is set. The output column is nameless, * and with the default format for its type (see function * @c cpl_column_set_format() ). However, if the input column is * also @em long @em integer, a simple copy is made and the column format * is inherited. The input column units are always preserved in the * output column. Note that a column of arrays is always cast to * another column of @em long @em integer arrays. It is not allowed to cast * a column of arrays into a column of plain long integers. */ cpl_column *cpl_column_cast_to_long(cpl_column *column) { const char *fid = "cpl_column_cast_to_long"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; int *np; long *lp; if (column == 0x0) { cpl_error_set_where(fid); return NULL; } if ((type & CPL_TYPE_STRING) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) && (type & CPL_TYPE_LONG)) { new_column = cpl_column_duplicate(column); cpl_column_set_name(new_column, NULL); return new_column; } if (type & CPL_TYPE_POINTER) { new_column = cpl_column_new_array(CPL_TYPE_LONG | CPL_TYPE_POINTER, length, cpl_column_get_depth(column)); if (column->dimensions) new_column->dimensions = cpl_array_duplicate(column->dimensions); } else new_column = cpl_column_new_long(length); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; if (column->nullcount == length) /* No need to copy just NULLs */ return new_column; if (type & CPL_TYPE_POINTER) { cpl_array **array = cpl_column_get_data_array(column); cpl_array **new_array = cpl_column_get_data_array(new_column); while (length--) { if (array[length]) { cpl_column *acolumn = cpl_array_get_column(array[length]); cpl_column *lcolumn = cpl_column_cast_to_long(acolumn); new_array[length] = cpl_array_new(cpl_column_get_size(lcolumn), cpl_column_get_type(lcolumn)); cpl_array_set_column(new_array[length], lcolumn); } } return new_column; } lp = cpl_column_get_data_long(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) *lp++ = *ip++; } else { while (length--) { if (*np++ == 0) *lp = *ip; lp++; ip++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) *lp++ = *llp++; } else { while (length--) { if (*np++ == 0) *lp = *llp; lp++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) *lp++ = *szp++; } else { while (length--) { if (*np++ == 0) *lp = *szp; lp++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) *lp++ = *fp++; } else { while (length--) { if (*np++ == 0) *lp = *fp; lp++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) *lp++ = *dp++; } else { while (length--) { if (*np++ == 0) *lp = *dp; lp++; dp++; } } break; } default: cpl_error_set(fid, CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } length = cpl_column_get_size(column); new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } return new_column; } cpl_column *cpl_column_cast_to_long_array(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; int *np; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if ((type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_array(CPL_TYPE_LONG | CPL_TYPE_POINTER, length, 1); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_LONG); cpl_array_set_long(*array, 0, *ip); array++; ip++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_LONG); cpl_array_set_long(*array, 0, *ip); } array++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_LONG); cpl_array_set_long(*array, 0, *lp); array++; lp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_LONG); cpl_array_set_long(*array, 0, *lp); } array++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_LONG); cpl_array_set_long(*array, 0, *llp); array++; llp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_LONG); cpl_array_set_long(*array, 0, *llp); } array++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_LONG); cpl_array_set_long(*array, 0, *szp); array++; szp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_LONG); cpl_array_set_long(*array, 0, *szp); } array++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_LONG); cpl_array_set_long(*array, 0, *fp); array++; fp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_LONG); cpl_array_set_long(*array, 0, *fp); } array++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_LONG); cpl_array_set_long(*array, 0, *dp); array++; dp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_LONG); cpl_array_set_long(*array, 0, *dp); } array++; dp++; } } break; } default: cpl_error_set_(CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } return new_column; } cpl_column *cpl_column_cast_to_long_flat(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_long(length); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(column) + length; while (length--) { array--; if (*array) { if (cpl_array_is_valid(*array, 0)) { cpl_column_set_long(new_column, length, cpl_array_get(*array, 0, NULL)); } } } return new_column; } /* * @brief * Cast a numerical column to a new @em long @em long @em integer column. * * @param column Column to be cast. * * @return Pointer to the new column, or @em NULL in case of error. * * If the accessed column is of type either string or array of strings, or * complex, a @c CPL_ERROR_INVALID_TYPE is set. If the input is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is set. The output column is nameless, * and with the default format for its type (see function * @c cpl_column_set_format() ). However, if the input column is * also @em long @em long @em integer, a simple copy is made and the column * format is inherited. The input column units are always preserved in the * output column. Note that a column of arrays is always cast to * another column of @em long @em long @em integer arrays. It is not allowed * to cast a column of arrays into a column of plain long long integers. */ cpl_column *cpl_column_cast_to_long_long(cpl_column *column) { const char *fid = "cpl_column_cast_to_long_long"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; int *np; long long *llp; if (column == 0x0) { cpl_error_set_where(fid); return NULL; } if ((type & CPL_TYPE_STRING) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) && (type & CPL_TYPE_LONG_LONG)) { new_column = cpl_column_duplicate(column); cpl_column_set_name(new_column, NULL); return new_column; } if (type & CPL_TYPE_POINTER) { new_column = cpl_column_new_array(CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER, length, cpl_column_get_depth(column)); if (column->dimensions) new_column->dimensions = cpl_array_duplicate(column->dimensions); } else new_column = cpl_column_new_long_long(length); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; if (column->nullcount == length) /* No need to copy just NULLs */ return new_column; if (type & CPL_TYPE_POINTER) { cpl_array **array = cpl_column_get_data_array(column); cpl_array **new_array = cpl_column_get_data_array(new_column); while (length--) { if (array[length]) { cpl_column *acolumn = cpl_array_get_column(array[length]); cpl_column *llcolumn = cpl_column_cast_to_long_long(acolumn); new_array[length] = cpl_array_new(cpl_column_get_size(llcolumn), cpl_column_get_type(llcolumn)); cpl_array_set_column(new_array[length], llcolumn); } } return new_column; } llp = cpl_column_get_data_long_long(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) *llp++ = *ip++; } else { while (length--) { if (*np++ == 0) *llp = *ip; llp++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) *llp++ = *lp++; } else { while (length--) { if (*np++ == 0) *llp = *lp; llp++; lp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) *llp++ = *szp++; } else { while (length--) { if (*np++ == 0) *llp = *szp; llp++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) *llp++ = *fp++; } else { while (length--) { if (*np++ == 0) *llp = *fp; llp++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) *llp++ = *dp++; } else { while (length--) { if (*np++ == 0) *llp = *dp; llp++; dp++; } } break; } default: cpl_error_set(fid, CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } length = cpl_column_get_size(column); new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } return new_column; } cpl_column *cpl_column_cast_to_long_long_array(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; int *np; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if ((type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_array(CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER, length, 1); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_LONG_LONG); cpl_array_set_long_long(*array, 0, *ip); array++; ip++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_LONG_LONG); cpl_array_set_long_long(*array, 0, *ip); } array++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_LONG_LONG); cpl_array_set_long_long(*array, 0, *lp); array++; lp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_LONG_LONG); cpl_array_set_long_long(*array, 0, *lp); } array++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_LONG_LONG); cpl_array_set_long_long(*array, 0, *llp); array++; llp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_LONG_LONG); cpl_array_set_long_long(*array, 0, *llp); } array++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_LONG_LONG); cpl_array_set_long_long(*array, 0, *szp); array++; szp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_LONG_LONG); cpl_array_set_long_long(*array, 0, *szp); } array++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_LONG_LONG); cpl_array_set_long_long(*array, 0, *fp); array++; fp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_LONG_LONG); cpl_array_set_long_long(*array, 0, *fp); } array++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_LONG_LONG); cpl_array_set_long_long(*array, 0, *dp); array++; dp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_LONG_LONG); cpl_array_set_long_long(*array, 0, *dp); } array++; dp++; } } break; } default: cpl_error_set_(CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } return new_column; } cpl_column *cpl_column_cast_to_long_long_flat(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_long_long(length); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(column) + length; while (length--) { array--; if (*array) { if (cpl_array_is_valid(*array, 0)) { cpl_column_set_long_long(new_column, length, cpl_array_get(*array, 0, NULL)); } } } return new_column; } /* * @brief * Cast a numerical column to a new @em cpl_size column. * * @param column Column to be cast. * * @return Pointer to the new column, or @em NULL in case of error. * * If the accessed column is of type either string or array of strings, or * complex, a @c CPL_ERROR_INVALID_TYPE is set. If the input is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is set. The output column is nameless, * and with the default format for its type (see function * @c cpl_column_set_format() ). However, if the input column is * also @em cpl_size, a simple copy is made and the column format * is inherited. The input column units are always preserved in the * output column. Note that a column of arrays is always cast to * another column of @em cpl_size arrays. It is not allowed * to cast a column of arrays into a column of plain cpl_size. */ cpl_column *cpl_column_cast_to_cplsize(cpl_column *column) { const char *fid = "cpl_column_cast_to_cplsize"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; int *np; cpl_size *szp; if (column == 0x0) { cpl_error_set_where(fid); return NULL; } if ((type & CPL_TYPE_STRING) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) && (type & CPL_TYPE_SIZE)) { new_column = cpl_column_duplicate(column); cpl_column_set_name(new_column, NULL); return new_column; } if (type & CPL_TYPE_POINTER) { new_column = cpl_column_new_array(CPL_TYPE_SIZE | CPL_TYPE_POINTER, length, cpl_column_get_depth(column)); if (column->dimensions) new_column->dimensions = cpl_array_duplicate(column->dimensions); } else new_column = cpl_column_new_cplsize(length); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; if (column->nullcount == length) /* No need to copy just NULLs */ return new_column; if (type & CPL_TYPE_POINTER) { cpl_array **array = cpl_column_get_data_array(column); cpl_array **new_array = cpl_column_get_data_array(new_column); while (length--) { if (array[length]) { cpl_column *acolumn = cpl_array_get_column(array[length]); cpl_column *szcolumn = cpl_column_cast_to_cplsize(acolumn); new_array[length] = cpl_array_new(cpl_column_get_size(szcolumn), cpl_column_get_type(szcolumn)); cpl_array_set_column(new_array[length], szcolumn); } } return new_column; } szp = cpl_column_get_data_cplsize(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) *szp++ = *ip++; } else { while (length--) { if (*np++ == 0) *szp = *ip; szp++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) *szp++ = *lp++; } else { while (length--) { if (*np++ == 0) *szp = *lp; szp++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) *szp++ = *llp++; } else { while (length--) { if (*np++ == 0) *szp = *llp; szp++; llp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) *szp++ = *fp++; } else { while (length--) { if (*np++ == 0) *szp = *fp; szp++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) *szp++ = *dp++; } else { while (length--) { if (*np++ == 0) *szp = *dp; szp++; dp++; } } break; } default: cpl_error_set(fid, CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } length = cpl_column_get_size(column); new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } return new_column; } cpl_column *cpl_column_cast_to_cplsize_array(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; int *np; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if ((type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_array(CPL_TYPE_SIZE | CPL_TYPE_POINTER, length, 1); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_SIZE); cpl_array_set_cplsize(*array, 0, *ip); array++; ip++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_SIZE); cpl_array_set_cplsize(*array, 0, *ip); } array++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_SIZE); cpl_array_set_cplsize(*array, 0, *lp); array++; lp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_SIZE); cpl_array_set_cplsize(*array, 0, *lp); } array++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_SIZE); cpl_array_set_cplsize(*array, 0, *llp); array++; llp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_SIZE); cpl_array_set_cplsize(*array, 0, *llp); } array++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_SIZE); cpl_array_set_cplsize(*array, 0, *szp); array++; szp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_SIZE); cpl_array_set_cplsize(*array, 0, *szp); } array++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_SIZE); cpl_array_set_cplsize(*array, 0, *fp); array++; fp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_SIZE); cpl_array_set_cplsize(*array, 0, *fp); } array++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_SIZE); cpl_array_set_cplsize(*array, 0, *dp); array++; dp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_SIZE); cpl_array_set_cplsize(*array, 0, *dp); } array++; dp++; } } break; } default: cpl_error_set_(CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } return new_column; } cpl_column *cpl_column_cast_to_cplsize_flat(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_cplsize(length); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(column) + length; while (length--) { array--; if (*array) { if (cpl_array_is_valid(*array, 0)) { cpl_column_set_cplsize(new_column, length, cpl_array_get(*array, 0, NULL)); } } } return new_column; } /* * @brief * Cast a numeric column to a new @em float column. * * @param column Column to be cast. * * @return Pointer to the new column, or @em NULL in case of error. * * If the accessed column is of type either string or array of strings, * a @c CPL_ERROR_INVALID_TYPE is set. If the input is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is set. The output column is * nameless, and with the default format for its type (see function * @c cpl_column_set_format() ). However, if the input column is * also @em float, a simple copy is made and the column format * is inherited. The input column units are always preserved in the * output column. Note that a column of arrays is always cast to * another column of @em float arrays. It is not allowed to cast * a column of arrays into a column of plain floats. */ cpl_column *cpl_column_cast_to_float(cpl_column *column) { const char *fid = "cpl_column_cast_to_float"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; cpl_column *acolumn = NULL; cpl_column *fcolumn = NULL; int *np; float *fp; if (column == 0x0) { cpl_error_set_where(fid); return NULL; } if ((type & CPL_TYPE_STRING) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) && (type & CPL_TYPE_FLOAT)) { new_column = cpl_column_duplicate(column); cpl_column_set_name(new_column, NULL); return new_column; } if (type & CPL_TYPE_POINTER) { new_column = cpl_column_new_array(CPL_TYPE_FLOAT | CPL_TYPE_POINTER, length, cpl_column_get_depth(column)); if (column->dimensions) new_column->dimensions = cpl_array_duplicate(column->dimensions); } else { new_column = cpl_column_new_float(length); } cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; if (column->nullcount == length) /* No need to copy just NULLs */ return new_column; if (type & CPL_TYPE_POINTER) { cpl_array **array = cpl_column_get_data_array(column); cpl_array **new_array = cpl_column_get_data_array(new_column); while(length--) { if (array[length]) { acolumn = cpl_array_get_column(array[length]); fcolumn = cpl_column_cast_to_float(acolumn); new_array[length] = cpl_array_new(cpl_column_get_size(fcolumn), cpl_column_get_type(fcolumn)); cpl_array_set_column(new_array[length], fcolumn); } } return new_column; } fp = cpl_column_get_data_float(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) *fp++ = *ip++; } else { while (length--) { if (*np++ == 0) *fp = *ip; fp++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) *fp++ = *lp++; } else { while (length--) { if (*np++ == 0) *fp = *lp; fp++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) *fp++ = *llp++; } else { while (length--) { if (*np++ == 0) *fp = *llp; fp++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) *fp++ = *szp++; } else { while (length--) { if (*np++ == 0) *fp = *szp; fp++; szp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) *fp++ = *dp++; } else { while (length--) { if (*np++ == 0) *fp = *dp; fp++; dp++; } } break; } default: cpl_error_set(fid, CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } length = cpl_column_get_size(column); new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } return new_column; } cpl_column *cpl_column_cast_to_float_array(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; int *np; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if ((type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_array(CPL_TYPE_FLOAT | CPL_TYPE_POINTER, length, 1); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT); cpl_array_set_float(*array, 0, *ip); array++; ip++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT); cpl_array_set_float(*array, 0, *ip); } array++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT); cpl_array_set_float(*array, 0, *lp); array++; lp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT); cpl_array_set_float(*array, 0, *lp); } array++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT); cpl_array_set_float(*array, 0, *llp); array++; llp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT); cpl_array_set_float(*array, 0, *llp); } array++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT); cpl_array_set_float(*array, 0, *szp); array++; szp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT); cpl_array_set_float(*array, 0, *szp); } array++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT); cpl_array_set_float(*array, 0, *fp); array++; fp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT); cpl_array_set_float(*array, 0, *fp); } array++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT); cpl_array_set_float(*array, 0, *dp); array++; dp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT); cpl_array_set_float(*array, 0, *dp); } array++; dp++; } } break; } default: cpl_error_set_(CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } return new_column; } cpl_column *cpl_column_cast_to_float_flat(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_float(length); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(column) + length; while (length--) { array--; if (array && *array) { if (cpl_array_is_valid(*array, 0)) { cpl_column_set_float(new_column, length, cpl_array_get(*array, 0, NULL)); } } } return new_column; } /* * @brief * Cast a numeric column to a new @em double column. * * @param column Column to be cast. * * @return Pointer to the new column, or @em NULL in case of error. * * If the accessed column is of type string, a @c CPL_ERROR_INVALID_TYPE * is set. If the input is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT * is set. The output column is nameless, and with the default format for * its type (see function @c cpl_column_set_format() ). However, if the * input column is also @em double, a simple copy is made and the column * format is inherited. The input column units are always preserved in * the output column. Note that a column of arrays is always cast to * another column of @em double arrays. It is not allowed to cast * a column of arrays into a column of plain doubles. */ cpl_column *cpl_column_cast_to_double(cpl_column *column) { const char *fid = "cpl_column_cast_to_double"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; cpl_column *acolumn = NULL; cpl_column *dcolumn = NULL; int *np; double *dp; if (column == 0x0) { cpl_error_set_where(fid); return NULL; } if ((type & CPL_TYPE_STRING) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) && (type & CPL_TYPE_DOUBLE)) { new_column = cpl_column_duplicate(column); cpl_column_set_name(new_column, NULL); return new_column; } if (type & CPL_TYPE_POINTER) { new_column = cpl_column_new_array(CPL_TYPE_DOUBLE | CPL_TYPE_POINTER, length, cpl_column_get_depth(column)); if (column->dimensions) new_column->dimensions = cpl_array_duplicate(column->dimensions); } else { new_column = cpl_column_new_double(length); } cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; if (column->nullcount == length) /* No need to copy just NULLs */ return new_column; if (type & CPL_TYPE_POINTER) { cpl_array **array = cpl_column_get_data_array(column); cpl_array **new_array = cpl_column_get_data_array(new_column); while(length--) { if (array[length]) { acolumn = cpl_array_get_column(array[length]); dcolumn = cpl_column_cast_to_double(acolumn); new_array[length] = cpl_array_new(cpl_column_get_size(dcolumn), cpl_column_get_type(dcolumn)); cpl_array_set_column(new_array[length], dcolumn); } } return new_column; } dp = cpl_column_get_data_double(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) *dp++ = *ip++; } else { while (length--) { if (*np++ == 0) *dp = *ip; dp++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) *dp++ = *lp++; } else { while (length--) { if (*np++ == 0) *dp = *lp; dp++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) *dp++ = *llp++; } else { while (length--) { if (*np++ == 0) *dp = *llp; dp++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) *dp++ = *szp++; } else { while (length--) { if (*np++ == 0) *dp = *szp; dp++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) *dp++ = *fp++; } else { while (length--) { if (*np++ == 0) *dp = *fp; dp++; fp++; } } break; } default: cpl_error_set(fid, CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } length = cpl_column_get_size(column); new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } return new_column; } cpl_column *cpl_column_cast_to_double_array(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; int *np; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if ((type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_array(CPL_TYPE_DOUBLE | CPL_TYPE_POINTER, length, 1); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE); cpl_array_set_double(*array, 0, *ip); array++; ip++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE); cpl_array_set_double(*array, 0, *ip); } array++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE); cpl_array_set_double(*array, 0, *lp); array++; lp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE); cpl_array_set_double(*array, 0, *lp); } array++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE); cpl_array_set_double(*array, 0, *llp); array++; llp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE); cpl_array_set_double(*array, 0, *llp); } array++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE); cpl_array_set_double(*array, 0, *szp); array++; szp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE); cpl_array_set_double(*array, 0, *szp); } array++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE); cpl_array_set_double(*array, 0, *fp); array++; fp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE); cpl_array_set_double(*array, 0, *fp); } array++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE); cpl_array_set_double(*array, 0, *dp); array++; dp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE); cpl_array_set_double(*array, 0, *dp); } array++; dp++; } } break; } default: cpl_error_set_(CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } return new_column; } cpl_column *cpl_column_cast_to_double_flat(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) || (type & CPL_TYPE_COMPLEX)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_double(length); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(column) + length; while (length--) { array--; if (array && *array) { if (cpl_array_is_valid(*array, 0)) { cpl_column_set_double(new_column, length, cpl_array_get(*array, 0, NULL)); } } } return new_column; } /* * @brief * Cast a complex column to a new @em float complex column. * * @param column Column to be cast. * * @return Pointer to the new column, or @em NULL in case of error. * * If the accessed column is of type either string or array of strings, * a @c CPL_ERROR_INVALID_TYPE is set. If the input is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is set. The output column is * nameless, and with the default format for its type (see function * @c cpl_column_set_format() ). However, if the input column is * also @em float complex, a simple copy is made and the column format * is inherited. The input column units are always preserved in the * output column. Note that a column of arrays is always cast to * another column of @em float complex arrays. It is not allowed to cast * a column of arrays into a column of plain floats. */ cpl_column *cpl_column_cast_to_float_complex(cpl_column *column) { const char *fid = "cpl_column_cast_to_float_complex"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; cpl_column *acolumn = NULL; cpl_column *icolumn = NULL; int *np; float complex *cfp; if (column == 0x0) { cpl_error_set_where(fid); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) && (type & CPL_TYPE_FLOAT) && (type & CPL_TYPE_COMPLEX)) { new_column = cpl_column_duplicate(column); cpl_column_set_name(new_column, NULL); return new_column; } if (type & CPL_TYPE_POINTER) { new_column = cpl_column_new_array(CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER, length, cpl_column_get_depth(column)); if (column->dimensions) new_column->dimensions = cpl_array_duplicate(column->dimensions); } else { new_column = cpl_column_new_float_complex(length); } cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; if (column->nullcount == length) /* No need to copy just NULLs */ return new_column; if (type & CPL_TYPE_POINTER) { cpl_array **array = cpl_column_get_data_array(column); cpl_array **new_array = cpl_column_get_data_array(new_column); while(length--) { if (array[length]) { acolumn = cpl_array_get_column(array[length]); icolumn = cpl_column_cast_to_float_complex(acolumn); new_array[length] = cpl_array_new(cpl_column_get_size(icolumn), cpl_column_get_type(icolumn)); cpl_array_set_column(new_array[length], icolumn); } } return new_column; } cfp = cpl_column_get_data_float_complex(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) *cfp++ = *ip++; } else { while (length--) { if (*np++ == 0) *cfp = *ip; cfp++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) *cfp++ = *lp++; } else { while (length--) { if (*np++ == 0) *cfp = *lp; cfp++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) *cfp++ = *llp++; } else { while (length--) { if (*np++ == 0) *cfp = *llp; cfp++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) *cfp++ = *szp++; } else { while (length--) { if (*np++ == 0) *cfp = *szp; cfp++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) *cfp++ = *fp++; } else { while (length--) { if (*np++ == 0) *cfp = *fp; cfp++; fp++; } } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *cdp = column->values->cd; if (column->nullcount == 0) { while (length--) *cfp++ = *cdp++; } else { while (length--) { if (*np++ == 0) *cfp = *cdp; cfp++; cdp++; } } break; } default: cpl_error_set(fid, CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } length = cpl_column_get_size(column); new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } return new_column; } cpl_column *cpl_column_cast_to_float_complex_array(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; int *np; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if (type & CPL_TYPE_POINTER) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_array(CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER, length, 1); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *ip); array++; ip++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *ip); } array++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *lp); array++; lp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *lp); } array++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *llp); array++; llp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *llp); } array++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *szp); array++; szp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *szp); } array++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *fp); array++; fp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *fp); } array++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *dp); array++; dp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *dp); } array++; dp++; } } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *cfp = column->values->cf; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *cfp); array++; cfp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *cfp); } array++; cfp++; } } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *cdp = column->values->cd; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *cdp); array++; cdp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_FLOAT_COMPLEX); cpl_array_set_float_complex(*array, 0, *cdp); } array++; cdp++; } } break; } default: cpl_error_set_(CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } return new_column; } cpl_column *cpl_column_cast_to_float_complex_flat(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_float_complex(length); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(column) + length; if (type & CPL_TYPE_COMPLEX) { while (length--) { array--; if (array && *array) { if (cpl_array_is_valid(*array, 0)) { cpl_column_set_float_complex(new_column, length, cpl_array_get_complex(*array, 0, NULL)); } } } } else { while (length--) { array--; if (array && *array) { if (cpl_array_is_valid(*array, 0)) { cpl_column_set_float_complex(new_column, length, cpl_array_get(*array, 0, NULL)); } } } } return new_column; } /* * @brief * Cast a numeric column to a new @em double column. * * @param column Column to be cast. * * @return Pointer to the new column, or @em NULL in case of error. * * If the accessed column is of type string, a @c CPL_ERROR_INVALID_TYPE * is set. If the input is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT * is set. The output column is nameless, and with the default format for * its type (see function @c cpl_column_set_format() ). However, if the * input column is also @em double, a simple copy is made and the column * format is inherited. The input column units are always preserved in * the output column. Note that a column of arrays is always cast to * another column of @em double arrays. It is not allowed to cast * a column of arrays into a column of plain doubles. */ cpl_column *cpl_column_cast_to_double_complex(cpl_column *column) { const char *fid = "cpl_column_cast_to_double_complex"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; cpl_column *acolumn = NULL; cpl_column *icolumn = NULL; int *np; double complex *cdp; if (column == 0x0) { cpl_error_set_where(fid); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER) && (type & CPL_TYPE_DOUBLE) && (type & CPL_TYPE_COMPLEX)) { new_column = cpl_column_duplicate(column); cpl_column_set_name(new_column, NULL); return new_column; } if (type & CPL_TYPE_POINTER) { new_column = cpl_column_new_array(CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER, length, cpl_column_get_depth(column)); if (column->dimensions) new_column->dimensions = cpl_array_duplicate(column->dimensions); } else { new_column = cpl_column_new_double_complex(length); } cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; if (column->nullcount == length) /* No need to copy just NULLs */ return new_column; if (type & CPL_TYPE_POINTER) { cpl_array **array = cpl_column_get_data_array(column); cpl_array **new_array = cpl_column_get_data_array(new_column); while(length--) { if (array[length]) { acolumn = cpl_array_get_column(array[length]); icolumn = cpl_column_cast_to_double_complex(acolumn); new_array[length] = cpl_array_new(cpl_column_get_size(icolumn), cpl_column_get_type(icolumn)); cpl_array_set_column(new_array[length], icolumn); } } return new_column; } cdp = cpl_column_get_data_double_complex(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) *cdp++ = *ip++; } else { while (length--) { if (*np++ == 0) *cdp = *ip; cdp++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) *cdp++ = *lp++; } else { while (length--) { if (*np++ == 0) *cdp = *lp; cdp++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) *cdp++ = *llp++; } else { while (length--) { if (*np++ == 0) *cdp = *llp; cdp++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) *cdp++ = *szp++; } else { while (length--) { if (*np++ == 0) *cdp = *szp; cdp++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) *cdp++ = *fp++; } else { while (length--) { if (*np++ == 0) *cdp = *fp; cdp++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) *cdp++ = *dp++; } else { while (length--) { if (*np++ == 0) *cdp = *dp; cdp++; dp++; } } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *cfp = column->values->cf; if (column->nullcount == 0) { while (length--) *cdp++ = *cfp++; } else { while (length--) { if (*np++ == 0) *cdp = *cfp; cdp++; cfp++; } } break; } default: cpl_error_set(fid, CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } length = cpl_column_get_size(column); new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } return new_column; } cpl_column *cpl_column_cast_to_double_complex_array(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; int *np; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if (type & CPL_TYPE_POINTER) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_array(CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER, length, 1); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(new_column); np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *ip); array++; ip++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *ip); } array++; ip++; } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *lp); array++; lp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *lp); } array++; lp++; } } break; } case CPL_TYPE_LONG_LONG: { long long *llp = column->values->ll; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *llp); array++; llp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *llp); } array++; llp++; } } break; } case CPL_TYPE_SIZE: { cpl_size *szp = column->values->sz; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *szp); array++; szp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *szp); } array++; szp++; } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *fp); array++; fp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *fp); } array++; fp++; } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *dp); array++; dp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *dp); } array++; dp++; } } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *cfp = column->values->cf; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *cfp); array++; cfp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *cfp); } array++; cfp++; } } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *cdp = column->values->cd; if (column->nullcount == 0) { while (length--) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *cdp); array++; cdp++; } } else { while (length--) { if (*np++ == 0) { *array = cpl_array_new(1, CPL_TYPE_DOUBLE_COMPLEX); cpl_array_set_double_complex(*array, 0, *cdp); } array++; cdp++; } } break; } default: cpl_error_set_(CPL_ERROR_UNSPECIFIED); cpl_column_delete(new_column); return NULL; } return new_column; } cpl_column *cpl_column_cast_to_double_complex_flat(cpl_column *column) { cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_column *new_column = NULL; cpl_array **array; if (column == 0x0) { cpl_error_set_where_(); return NULL; } if (type & CPL_TYPE_STRING) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if (!(type & CPL_TYPE_POINTER)) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } new_column = cpl_column_new_double(length); cpl_column_set_unit(new_column, cpl_column_get_unit(column)); if (length == 0) /* No need to cast a 0 length column */ return new_column; array = cpl_column_get_data_array(column) + length; if (type & CPL_TYPE_COMPLEX) { while (length--) { array--; if (array && *array) { if (cpl_array_is_valid(*array, 0)) { cpl_column_set_double_complex(new_column, length, cpl_array_get_complex(*array, 0, NULL)); } } } } else { while (length--) { array--; if (array && *array) { if (cpl_array_is_valid(*array, 0)) { cpl_column_set_double_complex(new_column, length, cpl_array_get(*array, 0, NULL)); } } } } return new_column; } /* * @brief * Create a column from an interval of another column. * * @param column Input column. * @param start First element to be copied to new column. * @param count Number of elements to be copied. * * @return Pointer to the new column, or @c NULL in case of error. * * If the input column is @c NULL, @c CPL_ERROR_NULL_INPUT is set. If * @em start is outside the column range, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is set. If the input column has length zero, this error is always * set. If @em count is negative, a @c CPL_ERROR_ILLEGAL_INPUT is set. * If @em count is zero, a zero-length column is created. * If @em start + @em count goes beyond the end of the input column, * elements are always copied up to the end. The new column is nameless, * but it inherits the unit and the format of the source column. Existing * invalid element flags are also transferred to the new column. */ cpl_column *cpl_column_extract(cpl_column *column, cpl_size start, cpl_size count) { const char *fid = "cpl_column_extract"; cpl_column *new_column = NULL; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_size depth = cpl_column_get_depth(column); size_t byte_count; cpl_size i; cpl_size j; if (column == 0x0) { cpl_error_set_where(fid); return NULL; } if (start < 0 || start >= length) { cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); return NULL; } if (count < 0) { cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); return NULL; } if (count > length - start) count = length - start; byte_count = (size_t)count * cpl_column_type_size(type); switch (type) { case CPL_TYPE_INT: new_column = cpl_column_new_int(count); if (count) memcpy(new_column->values->i, column->values->i + start, byte_count); break; case CPL_TYPE_LONG: new_column = cpl_column_new_long(count); if (count) memcpy(new_column->values->l, column->values->l + start, byte_count); break; case CPL_TYPE_LONG_LONG: new_column = cpl_column_new_long_long(count); if (count) memcpy(new_column->values->ll, column->values->ll + start, byte_count); break; case CPL_TYPE_SIZE: new_column = cpl_column_new_cplsize(count); if (count) memcpy(new_column->values->sz, column->values->sz + start, byte_count); break; case CPL_TYPE_FLOAT: new_column = cpl_column_new_float(count); if (count) memcpy(new_column->values->f, column->values->f + start, byte_count); break; case CPL_TYPE_DOUBLE: new_column = cpl_column_new_double(count); if (count) memcpy(new_column->values->d, column->values->d + start, byte_count); break; case CPL_TYPE_FLOAT_COMPLEX: new_column = cpl_column_new_float_complex(count); if (count) memcpy(new_column->values->cf, column->values->cf + start, byte_count); break; case CPL_TYPE_DOUBLE_COMPLEX: new_column = cpl_column_new_double_complex(count); if (count) memcpy(new_column->values->cd, column->values->cd + start, byte_count); break; case CPL_TYPE_STRING: new_column = cpl_column_new_string(count); for (i = 0, j = start; i < count; i++, j++) if (column->values->s[j]) new_column->values->s[i] = cpl_strdup(column->values->s[j]); else new_column->values->s[i] = NULL; break; case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: new_column = cpl_column_new_array(type, count, depth); for (i = 0, j = start; i < count; i++, j++) { if (column->values->array[j]) new_column->values->array[i] = cpl_array_duplicate(column->values->array[j]); else new_column->values->array[i] = NULL; } if (column->dimensions) new_column->dimensions = cpl_array_duplicate(column->dimensions); break; default: cpl_error_set(fid, CPL_ERROR_UNSPECIFIED); return NULL; } cpl_column_set_unit(new_column, cpl_column_get_unit(column)); cpl_column_set_format(new_column, cpl_column_get_format(column)); if (column->null) { /* * If an invalid flags buffer exists in the original column, * we have to take care of the (possible) duplication of * the appropriate segment. */ new_column->nullcount = 0; for (i = 0, j = start; i < count; i++, j++) if (column->null[j]) new_column->nullcount++; if (new_column->nullcount != 0 && new_column->nullcount != count) { new_column->null = cpl_calloc(count, sizeof(cpl_column_flag)); for (i = 0, j = start; i < count; i++, j++) if (column->null[j]) new_column->null[i] = 1; } } else { /* * An invalid flag buffer doesn't exist in the original column, * and this means no invalid elements, or all elements are invalid, * also for the subcolumn. */ if (column->nullcount == 0) new_column->nullcount = 0; else new_column->nullcount = cpl_column_get_size(new_column); } return new_column; } /* * @brief * Insert a column into another column of the same type. * * @param target_column Target column. * @param insert_column Column to be inserted in target column. * @param position Position of target where to insert. * * @return @c CPL_ERROR_NONE on success. If any input column is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the columns are * not of the same type, a @c CPL_ERROR_TYPE_MISMATCH is returned. * If @em position is negative, a @c CPL_ERROR_ACCESS_OUT_OF_RANGE * is returned. * * The first element of the column to be inserted will be at the * specified @em position. If the specified @em position is not * less than the target column length, the second column will be * appended to the target column. The output column is expanded * to host the values copied from the input column, that is left * untouched. In the @em target column the pointer to target data * may change, therefore pointers previously retrieved by calling * @c cpl_column_get_data_int(), @c cpl_column_get_data_string(), * etc., should be discarded). Information about columns dimensions * (in case of array columns) is ignored. */ cpl_error_code cpl_column_merge(cpl_column *target_column, cpl_column *insert_column, cpl_size position) { const char *fid = "cpl_column_merge"; cpl_size t_length = cpl_column_get_size(target_column); cpl_size i_length = cpl_column_get_size(insert_column); cpl_type t_type = cpl_column_get_type(target_column); cpl_type i_type = cpl_column_get_type(insert_column); size_t i_size = (size_t)i_length * cpl_column_type_size(i_type); cpl_size i; cpl_size j; if (target_column == 0x0 || insert_column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (position < 0) return cpl_error_set(fid, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (t_type != i_type) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (i_length == 0) return CPL_ERROR_NONE; if (position > t_length) position = t_length; /* * First of all, a segment of invalid elements is inserted at the * right position. */ cpl_column_insert_segment(target_column, position, i_length); /* * If the column to be inserted just consists of invalid elements, * the job is already completed. */ if (cpl_column_count_invalid(insert_column) == i_length) return CPL_ERROR_NONE; /* * Transferring the data from the column to be inserted, * to the expanded part of the target column: */ t_length = cpl_column_get_size(target_column); /* It got longer */ switch (i_type) { case CPL_TYPE_INT: memcpy(target_column->values->i + position, insert_column->values->i, i_size); break; case CPL_TYPE_LONG: memcpy(target_column->values->l + position, insert_column->values->l, i_size); break; case CPL_TYPE_LONG_LONG: memcpy(target_column->values->ll + position, insert_column->values->ll, i_size); break; case CPL_TYPE_SIZE: memcpy(target_column->values->sz + position, insert_column->values->sz, i_size); break; case CPL_TYPE_FLOAT: memcpy(target_column->values->f + position, insert_column->values->f, i_size); break; case CPL_TYPE_DOUBLE: memcpy(target_column->values->d + position, insert_column->values->d, i_size); break; case CPL_TYPE_FLOAT_COMPLEX: memcpy(target_column->values->cf + position, insert_column->values->cf, i_size); break; case CPL_TYPE_DOUBLE_COMPLEX: memcpy(target_column->values->cd + position, insert_column->values->cd, i_size); break; case CPL_TYPE_STRING: for (i = 0, j = position; i < i_length; i++, j++) if (insert_column->values->s[i]) target_column->values->s[j] = cpl_strdup(insert_column->values->s[i]); break; case CPL_TYPE_INT | CPL_TYPE_POINTER: case CPL_TYPE_LONG | CPL_TYPE_POINTER: case CPL_TYPE_LONG_LONG | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE | CPL_TYPE_POINTER: case CPL_TYPE_FLOAT_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_DOUBLE_COMPLEX | CPL_TYPE_POINTER: case CPL_TYPE_STRING | CPL_TYPE_POINTER: for (i = 0, j = position; i < i_length; i++, j++) if (insert_column->values->array[i]) target_column->values->array[j] = cpl_array_duplicate(insert_column->values->array[i]); break; default: return cpl_error_set(fid, CPL_ERROR_UNSPECIFIED); } if ((i_type == CPL_TYPE_STRING) || (i_type & CPL_TYPE_POINTER)) return CPL_ERROR_NONE; /* * Now also the null flags buffer must be upgraded. */ if (target_column->null) { if (insert_column->null) { /* * Both null flags buffers exist. The expanded part of * the target column already consists of invalid elements, * so just overwrite valid elements from the first column: */ for (i = 0, j = position; i < i_length; i++, j++) { if (!insert_column->null[i]) { target_column->null[j] = 0; target_column->nullcount--; } } } else { /* * Just the target column has the invalid flag buffer. This * means necessarily that the column to insert has no invalid * elements (the other possibility, that the column to insert * just consists of invalid elements, was already handled at * the beginning). Then we must turn all the invalid elements * of the target expanded interval of the null flag buffer * into valid. */ if (target_column->nullcount > i_length) { /* * Surely target_column->nullcount is at least i_length, * i.e., the number of invalid elements added by the * expansion. If target_column->nullcount is equal to * i_length, then these are the only invalid elements * existing, and they would be all unset, therefore it * would be enough to free the null flags buffer skipping * this loop. */ for (i = 0, j = position; i < i_length; i++, j++) target_column->null[j] = 0; } target_column->nullcount -= i_length; } } else { /* * The target column invalid flags buffer doesn't exist. * Excluding the case of array or string columns, this is * necessarily because it just contains invalid elements, * since to expand it means just to add extra invalid elements. * The inserted column instead has some valid elements, that * must be transferred - therefore the target column invalid * flag buffer must be allocated. */ target_column->null = cpl_malloc(t_length * sizeof(cpl_column_flag)); i = t_length; while (i--) target_column->null[i] = 1; if (insert_column->null) { /* * Some invalid elements: */ for (i = 0, j = position; i < i_length; i++, j++) { if (!insert_column->null[i]) { target_column->null[j] = 0; target_column->nullcount--; } } } else { /* * No invalid elements: */ for (i = 0, j = position; i < i_length; i++, j++) target_column->null[j] = 0; target_column->nullcount -= i_length; } } /* * If no invalid elements are left, free the invalid flags buffer */ if (target_column->nullcount == 0) { if (target_column->null) cpl_free(target_column->null); target_column->null = NULL; } return 0; } /* * @brief * Add two numerical or complex columns. * * @param to_column Target column. * @param from_column Column to be summed to target column. * * @return @c CPL_ERROR_NONE on success. If any of the input columns * is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If * any of the input columns is of type string, a @c CPL_ERROR_INVALID_TYPE * is returned. If the input columns do not have the same length, * a @c CPL_ERROR_INCOMPATIBLE_INPUT is returned. * * The result of the sum is stored in the target column. The type of the * columns may differ, and in that case the operation would be performed * according to the C upcasting rules, with a final cast of the result to * the target column type. Consistently, if at least one column is complex * the math is complex, and if the target column is not complex then only * the real part of the result will be obtained. * Invalid elements are propagated consistently: if either or both members * of the sum are invalid, the result will be invalid too. Underflows and * overflows are ignored. This function is not applicable to array columns. */ cpl_error_code cpl_column_add(cpl_column *to_column, cpl_column *from_column) { const char *fid = "cpl_column_add"; cpl_size i; cpl_size to_length = cpl_column_get_size(to_column); cpl_size from_length = cpl_column_get_size(from_column); cpl_type to_type = cpl_column_get_type(to_column); cpl_type from_type = cpl_column_get_type(from_column); int *tnp; if (to_column == 0x0 || from_column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if ((to_type == CPL_TYPE_STRING) || (from_type == CPL_TYPE_STRING) || (to_type & CPL_TYPE_POINTER) || (from_type & CPL_TYPE_POINTER)) return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); if (to_length != from_length) return cpl_error_set(fid, CPL_ERROR_INCOMPATIBLE_INPUT); if (to_length == 0) return CPL_ERROR_NONE; if (to_column->nullcount == to_length) return CPL_ERROR_NONE; if (from_column->nullcount == from_length) return cpl_column_fill_invalid(to_column, 0, to_length); if (to_column->nullcount == 0 && from_column->nullcount == 0) { /* * If there are no invalid elements in both columns, the operation * can be performed without any check: */ switch (to_type) { case CPL_TYPE_INT: { int *tip = to_column->values->i; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tip++ += *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tip++ += *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tip++ += *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tip++ += *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tip++ += *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tip++ += *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tip[to_length] = tip[to_length] + fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tip[to_length] = tip[to_length] + fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_LONG: { long *tlp = to_column->values->l; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tlp++ += *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tlp++ += *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tlp++ += *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tlp++ += *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tlp++ += *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tlp++ += *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tlp[to_length] = tlp[to_length] + fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tlp[to_length] = tlp[to_length] + fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_LONG_LONG: { long long *tlp = to_column->values->ll; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tlp++ += *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tlp++ += *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tlp++ += *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tlp++ += *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tlp++ += *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tlp++ += *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tlp[to_length] = tlp[to_length] + fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tlp[to_length] = tlp[to_length] + fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_SIZE: { cpl_size *tlp = to_column->values->sz; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tlp++ += *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tlp++ += *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tlp++ += *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tlp++ += *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tlp++ += *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tlp++ += *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tlp[to_length] = tlp[to_length] + fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tlp[to_length] = tlp[to_length] + fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_FLOAT: { float *tfp = to_column->values->f; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tfp++ += (double)*fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tfp++ += *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tfp++ += *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tfp++ += *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tfp++ += (double)*ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tfp++ += *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tfp[to_length] = tfp[to_length] + fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tfp[to_length] = tfp[to_length] + fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_DOUBLE: { double *tdp = to_column->values->d; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tdp++ += *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tdp++ += *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tdp++ += *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tdp++ += *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tdp++ += *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tdp++ += *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tdp[to_length] = tdp[to_length] + fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tdp[to_length] = tdp[to_length] + fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *tcfp = to_column->values->cf; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tcfp++ += *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tcfp++ += *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tcfp++ += *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tcfp++ += *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tcfp++ += *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tcfp++ += *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) *tcfp++ += *fcfp++; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) *tcfp++ += *fcdp++; break; } default: break; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *tcdp = to_column->values->cd; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tcdp++ += *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tcdp++ += *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tcdp++ += *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tcdp++ += *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tcdp++ += *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tcdp++ += *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) *tcdp++ += *fcfp++; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) *tcdp++ += *fcdp++; break; } default: break; } break; } default: break; } } else { /* * Here there are some invalid elements, so the operation needs to be * performed with some checks. As a first thing, take care of the * invalid elements in the target column: */ if (to_column->nullcount == 0 || from_column->nullcount == 0) { /* * Here there are some invalid elements in just one of the two * columns. If they are just in the column to add, an identical * invalid flags buffer must be created for the target column. */ if (from_column->nullcount) { to_column->null = cpl_calloc(to_length, sizeof(cpl_column_flag)); i = to_length; while (i--) if (from_column->null[i]) to_column->null[i] = 1; to_column->nullcount = from_column->nullcount; } } else { /* * Here there are some invalid elements in both columns. */ i = to_length; while (i--) { if (from_column->null[i]) { if (!to_column->null[i]) { to_column->null[i] = 1; to_column->nullcount++; } } } if (to_column->nullcount == to_length) { /* * Just invalid elements in the result: no need to perform * any further operation, and the invalid flag buffer of the * target column can be disabled. */ if (to_column->null) cpl_free(to_column->null); to_column->null = NULL; return 0; } } /* * The operation can be performed while checking the already * computed result invalid flags buffer of the target column. */ tnp = to_column->null; switch (to_type) { case CPL_TYPE_INT: { int *tip = to_column->values->i; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tip += *fip; tip++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tip += *flp; tip++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tip += *fllp; tip++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tip += *fszp; tip++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tip += *ffp; tip++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tip += *fdp; tip++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tip = *tip + *fcfp; /* Support clang */ tip++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tip = *tip + *fcdp; /* Support clang */ tip++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_LONG: { long *tlp = to_column->values->l; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tlp += *fip; tlp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tlp += *flp; tlp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tlp += *fllp; tlp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tlp += *fszp; tlp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tlp += *ffp; tlp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tlp += *fdp; tlp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp + *fcfp; /* Support clang */ tlp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp + *fcdp; /* Support clang */ tlp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_LONG_LONG: { long long *tlp = to_column->values->ll; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tlp += *fip; tlp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tlp += *flp; tlp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tlp += *fllp; tlp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tlp += *fszp; tlp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tlp += *ffp; tlp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tlp += *fdp; tlp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp + *fcfp; /* Support clang */ tlp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp + *fcdp; /* Support clang */ tlp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_SIZE: { cpl_size *tlp = to_column->values->sz; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tlp += *fip; tlp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tlp += *flp; tlp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tlp += *fllp; tlp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tlp += *fszp; tlp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tlp += *ffp; tlp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tlp += *fdp; tlp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp + *fcfp; /* Support clang */ tlp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp + *fcdp; /* Support clang */ tlp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_FLOAT: { float *tfp = to_column->values->f; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tfp += (double)*fip; tfp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tfp += *flp; tfp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tfp += *fllp; tfp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tfp += *fszp; tfp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tfp += (double)*ffp; tfp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tfp += *fdp; tfp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tfp = *tfp + *fcfp; /* Support clang */ tfp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tfp = *tfp + *fcdp; /* Support clang */ tfp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_DOUBLE: { double *tdp = to_column->values->d; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tdp += *fip; tdp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tdp += *flp; tdp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tdp += *fllp; tdp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tdp += *fszp; tdp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tdp += *ffp; tdp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tdp += *fdp; tdp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tdp = *tdp + *fcfp; /* Support clang */ tdp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tdp = *tdp + *fcdp; /* Support clang */ tdp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *tcfp = to_column->values->cf; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tcfp += *fip; tcfp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tcfp += *flp; tcfp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tcfp += *fllp; tcfp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tcfp += *fszp; tcfp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tcfp += *ffp; tcfp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tcfp += *fdp; tcfp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tcfp += *fcfp; tcfp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tcfp += *fcdp; tcfp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *tcdp = to_column->values->cd; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tcdp += *fip; tcdp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tcdp += *flp; tcdp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tcdp += *fllp; tcdp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tcdp += *fszp; tcdp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tcdp += *ffp; tcdp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tcdp += *fdp; tcdp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tcdp += *fcfp; tcdp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tcdp += *fcdp; tcdp++; fcdp++; } break; } default: break; } break; } default: break; } } return CPL_ERROR_NONE; } /* * @brief * Subtract two numeric columns. * * @param to_column Target column. * @param from_column Column to subtract from target column. * * @return @c CPL_ERROR_NONE on success. If any of the input columns * is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If * any of the input columns is of type string, a @c CPL_ERROR_INVALID_TYPE * is returned. If the input columns do not have the same length, * a @c CPL_ERROR_INCOMPATIBLE_INPUT is returned. * * The result of the subtraction is stored in the target column. The type of * the columns may differ, and in that case the operation would be performed * according to the C upcasting rules, with a final cast of the result to * the target column type. Consistently, if at least one column is complex * the math is complex, and if the target column is not complex then only * the real part of the result will be obtained. * Invalid elements are propagated consistently: * if either or both members of the subtraction are invalid, the result * will be invalid too. Underflows and overflows are ignored. This function * is not applicable to array columns. */ cpl_error_code cpl_column_subtract(cpl_column *to_column, cpl_column *from_column) { const char *fid = "cpl_column_subtract"; cpl_size i; cpl_size to_length = cpl_column_get_size(to_column); cpl_size from_length = cpl_column_get_size(from_column); cpl_type to_type = cpl_column_get_type(to_column); cpl_type from_type = cpl_column_get_type(from_column); int *tnp; if (to_column == 0x0 || from_column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if ((to_type == CPL_TYPE_STRING) || (from_type == CPL_TYPE_STRING) || (to_type & CPL_TYPE_POINTER) || (from_type & CPL_TYPE_POINTER)) return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); if (to_length != from_length) return cpl_error_set(fid, CPL_ERROR_INCOMPATIBLE_INPUT); if (to_length == 0) return CPL_ERROR_NONE; if (to_column->nullcount == to_length) return CPL_ERROR_NONE; if (from_column->nullcount == from_length) return cpl_column_fill_invalid(to_column, 0, to_length); if (to_column->nullcount == 0 && from_column->nullcount == 0) { /* * If there are no invalid elements in both columns, the operation * can be performed without any check: */ switch (to_type) { case CPL_TYPE_INT: { int *tip = to_column->values->i; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tip++ -= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tip++ -= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tip++ -= *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tip++ -= *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tip++ -= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tip++ -= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tip[to_length] = tip[to_length] - fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tip[to_length] = tip[to_length] - fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_LONG: { long *tlp = to_column->values->l; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tlp++ -= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tlp++ -= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tlp++ -= *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tlp++ -= *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tlp++ -= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tlp++ -= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tlp[to_length] = tlp[to_length] - fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tlp[to_length] = tlp[to_length] - fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_LONG_LONG: { long long *tlp = to_column->values->ll; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tlp++ -= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tlp++ -= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tlp++ -= *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tlp++ -= *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tlp++ -= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tlp++ -= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tlp[to_length] = tlp[to_length] - fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tlp[to_length] = tlp[to_length] - fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_SIZE: { cpl_size *tlp = to_column->values->sz; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tlp++ -= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tlp++ -= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tlp++ -= *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tlp++ -= *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tlp++ -= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tlp++ -= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tlp[to_length] = tlp[to_length] - fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tlp[to_length] = tlp[to_length] - fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_FLOAT: { float *tfp = to_column->values->f; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tfp++ -= (double)*fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tfp++ -= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tfp++ -= *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tfp++ -= *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tfp++ -= (double)*ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tfp++ -= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tfp[to_length] = tfp[to_length] - fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tfp[to_length] = tfp[to_length] - fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_DOUBLE: { double *tdp = to_column->values->d; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tdp++ -= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tdp++ -= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tdp++ -= *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tdp++ -= *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tdp++ -= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tdp++ -= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tdp[to_length] = tdp[to_length] - fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tdp[to_length] = tdp[to_length] - fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *tcfp = to_column->values->cf; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tcfp++ -= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tcfp++ -= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tcfp++ -= *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tcfp++ -= *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tcfp++ -= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tcfp++ -= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) *tcfp++ -= *fcfp++; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) *tcfp++ -= *fcdp++; break; } default: break; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *tcdp = to_column->values->cd; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tcdp++ -= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tcdp++ -= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) *tcdp++ -= *fllp++; break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) *tcdp++ -= *fszp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tcdp++ -= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tcdp++ -= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) *tcdp++ -= *fcfp++; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) *tcdp++ -= *fcdp++; break; } default: break; } break; } default: break; } } else { /* * Here there are some invalid elements, so the operation needs to be * performed with some checks. As a first thing, take care of the * invalid elements in the target column: */ if (to_column->nullcount == 0 || from_column->nullcount == 0) { /* * Here there are some invalids in just one of the two columns. * If they are just in the column to add, an identical invalid * flags buffer must be created for the target column. */ if (from_column->nullcount) { to_column->null = cpl_calloc(to_length, sizeof(cpl_column_flag)); i = to_length; while (i--) if (from_column->null[i]) to_column->null[i] = 1; to_column->nullcount = from_column->nullcount; } } else { /* * Here there are some invalids in both columns. */ i = to_length; while (i--) { if (from_column->null[i]) { if (!to_column->null[i]) { to_column->null[i] = 1; to_column->nullcount++; } } } if (to_column->nullcount == to_length) { /* * Just invalids in the result: no need to perform any further * operation, and the invalid buffer of the target column can * be disabled. */ if (to_column->null) cpl_free(to_column->null); to_column->null = NULL; return 0; } } /* * The operation can be performed while checking the already * computed result invalid flags buffer of the target column. */ tnp = to_column->null; switch (to_type) { case CPL_TYPE_INT: { int *tip = to_column->values->i; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tip -= *fip; tip++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tip -= *flp; tip++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tip -= *fllp; tip++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tip -= *fszp; tip++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tip -= *ffp; tip++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tip -= *fdp; tip++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tip = *tip - *fcfp; /* Support clang */ tip++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tip = *tip - *fcdp; /* Support clang */ tip++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_LONG: { long *tlp = to_column->values->l; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tlp -= *fip; tlp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tlp -= *flp; tlp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tlp -= *fllp; tlp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tlp -= *fszp; tlp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tlp -= *ffp; tlp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tlp -= *fdp; tlp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp - *fcfp; /* Support clang */ tlp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp - *fcdp; /* Support clang */ tlp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_LONG_LONG: { long long *tlp = to_column->values->ll; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tlp -= *fip; tlp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tlp -= *flp; tlp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tlp -= *fllp; tlp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tlp -= *fszp; tlp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tlp -= *ffp; tlp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tlp -= *fdp; tlp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp - *fcfp; /* Support clang */ tlp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp - *fcdp; /* Support clang */ tlp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_SIZE: { cpl_size *tlp = to_column->values->sz; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tlp -= *fip; tlp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tlp -= *flp; tlp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tlp -= *fllp; tlp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tlp -= *fszp; tlp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tlp -= *ffp; tlp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tlp -= *fdp; tlp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp - *fcfp; /* Support clang */ tlp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp - *fcdp; /* Support clang */ tlp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_FLOAT: { float *tfp = to_column->values->f; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tfp -= (double)*fip; tfp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tfp -= *flp; tfp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tfp -= *fllp; tfp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tfp -= *fszp; tfp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tfp -= (double)*ffp; tfp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tfp -= *fdp; tfp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tfp = *tfp - *fcfp; /* Support clang */ tfp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tfp = *tfp - *fcdp; /* Support clang */ tfp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_DOUBLE: { double *tdp = to_column->values->d; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tdp -= *fip; tdp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tdp -= *flp; tdp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tdp -= *fllp; tdp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tdp -= *fszp; tdp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tdp -= *ffp; tdp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tdp -= *fdp; tdp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tdp = *tdp - *fcfp; /* Support clang */ tdp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tdp = *tdp - *fcdp; /* Support clang */ tdp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *tcfp = to_column->values->cf; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tcfp -= *fip; tcfp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tcfp -= *flp; tcfp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tcfp -= *fllp; tcfp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tcfp -= *fszp; tcfp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tcfp -= *ffp; tcfp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tcfp -= *fdp; tcfp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tcfp -= *fcfp; tcfp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tcfp -= *fcdp; tcfp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *tcdp = to_column->values->cd; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tcdp -= *fip; tcdp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tcdp -= *flp; tcdp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *fllp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tcdp -= *fllp; tcdp++; fllp++; } break; } case CPL_TYPE_SIZE: { cpl_size *fszp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tcdp -= *fszp; tcdp++; fszp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tcdp -= *ffp; tcdp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tcdp -= *fdp; tcdp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tcdp -= *fcfp; tcdp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tcdp -= *fcdp; tcdp++; fcdp++; } break; } default: break; } break; } default: break; } } return CPL_ERROR_NONE; } /* * @brief * Multiply two numeric columns. * * @param to_column Target column. * @param from_column Multiplier column. * * @return @c CPL_ERROR_NONE on success. If any of the input columns * is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If * any of the input columns is of type string, a @c CPL_ERROR_INVALID_TYPE * is returned. If the input columns do not have the same length, * a @c CPL_ERROR_INCOMPATIBLE_INPUT is returned. * * The result of the multiplication is stored in the target column. The type of * the columns may differ, and in that case the operation would be performed * according to the C upcasting rules, with a final cast of the result to * the target column type. Consistently, if at least one column is complex * the math is complex, and if the target column is not complex then only * the real part of the result will be obtained. * Invalid elements are propagated consistently: * if either or both members of the multiplication are invalid, the result * will be invalid too. Underflows and overflows are ignored. This function * is not applicable to array columns. */ cpl_error_code cpl_column_multiply(cpl_column *to_column, cpl_column *from_column) { const char *fid = "cpl_column_multiply"; cpl_size i; cpl_size to_length = cpl_column_get_size(to_column); cpl_size from_length = cpl_column_get_size(from_column); cpl_type to_type = cpl_column_get_type(to_column); cpl_type from_type = cpl_column_get_type(from_column); int *tnp; if (to_column == 0x0 || from_column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if ((to_type == CPL_TYPE_STRING) || (from_type == CPL_TYPE_STRING) || (to_type & CPL_TYPE_POINTER) || (from_type & CPL_TYPE_POINTER)) return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); if (to_length != from_length) return cpl_error_set(fid, CPL_ERROR_INCOMPATIBLE_INPUT); if (to_length == 0) return CPL_ERROR_NONE; if (to_column->nullcount == to_length) return CPL_ERROR_NONE; if (from_column->nullcount == from_length) return cpl_column_fill_invalid(to_column, 0, to_length); if (to_column->nullcount == 0 && from_column->nullcount == 0) { /* * If there are no invalids in both columns, the operation can * be performed without any check: */ switch (to_type) { case CPL_TYPE_INT: { int *tip = to_column->values->i; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tip++ *= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tip++ *= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tip++ *= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tip++ *= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tip++ *= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tip++ *= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tip[to_length] = tip[to_length] * fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tip[to_length] = tip[to_length] * fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_LONG: { long *tlp = to_column->values->l; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tlp++ *= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tlp++ *= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tlp++ *= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tlp++ *= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tlp++ *= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tlp++ *= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tlp[to_length] = tlp[to_length] * fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tlp[to_length] = tlp[to_length] * fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_LONG_LONG: { long long *tlp = to_column->values->ll; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tlp++ *= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tlp++ *= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tlp++ *= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tlp++ *= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tlp++ *= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tlp++ *= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tlp[to_length] = tlp[to_length] * fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tlp[to_length] = tlp[to_length] * fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_SIZE: { cpl_size *tlp = to_column->values->sz; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tlp++ *= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tlp++ *= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tlp++ *= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tlp++ *= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tlp++ *= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tlp++ *= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tlp[to_length] = tlp[to_length] * fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tlp[to_length] = tlp[to_length] * fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_FLOAT: { float *tfp = to_column->values->f; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tfp++ *= (double)*fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tfp++ *= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tfp++ *= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tfp++ *= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tfp++ *= (double)*ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tfp++ *= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tfp[to_length] = tfp[to_length] * fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tfp[to_length] = tfp[to_length] * fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_DOUBLE: { double *tdp = to_column->values->d; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tdp++ *= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tdp++ *= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tdp++ *= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tdp++ *= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tdp++ *= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tdp++ *= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tdp[to_length] = tdp[to_length] * fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tdp[to_length] = tdp[to_length] * fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *tcfp = to_column->values->cf; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tcfp++ *= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tcfp++ *= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tcfp++ *= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tcfp++ *= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tcfp++ *= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tcfp++ *= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) *tcfp++ *= *fcfp++; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) *tcfp++ *= *fcdp++; break; } default: break; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *tcdp = to_column->values->cd; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tcdp++ *= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tcdp++ *= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tcdp++ *= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tcdp++ *= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tcdp++ *= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tcdp++ *= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) *tcdp++ *= *fcfp++; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) *tcdp++ *= *fcdp++; break; } default: break; } break; } default: break; } } else { /* * Here there are some invalids around, so the operation needs to be * performed with some checks. As a first thing, take care of the * invalids pattern in the target column: */ if (to_column->nullcount == 0 || from_column->nullcount == 0) { /* * Here there are some invalids in just one of the two columns. * If they are just in the column to add, an identical invalid * flags buffer must be created for the target column. */ if (from_column->nullcount) { to_column->null = cpl_calloc(to_length, sizeof(cpl_column_flag)); i = to_length; while (i--) if (from_column->null[i]) to_column->null[i] = 1; to_column->nullcount = from_column->nullcount; } } else { /* * Here there are some invalids in both columns. */ i = to_length; while (i--) { if (from_column->null[i]) { if (!to_column->null[i]) { to_column->null[i] = 1; to_column->nullcount++; } } } if (to_column->nullcount == to_length) { /* * Just invalids in the result: no need to perform any further * operation, and the invalid buffer of the target column can * be disabled. */ if (to_column->null) cpl_free(to_column->null); to_column->null = NULL; return 0; } } /* * The operation can be performed while checking the already * computed result invalid flags buffer of the target column. */ tnp = to_column->null; switch (to_type) { case CPL_TYPE_INT: { int *tip = to_column->values->i; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tip *= *fip; tip++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tip *= *flp; tip++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tip *= *flp; tip++; flp++; } break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tip *= *flp; tip++; flp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tip *= *ffp; tip++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tip *= *fdp; tip++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tip = *tip * *fcfp; /* Support clang */ tip++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tip = *tip * *fcdp; /* Support clang */ tip++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_LONG: { long *tlp = to_column->values->l; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tlp *= *fip; tlp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tlp *= *flp; tlp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tlp *= *flp; tlp++; flp++; } break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tlp *= *flp; tlp++; flp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tlp *= *ffp; tlp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tlp *= *fdp; tlp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp * *fcfp; /* Support clang */ tlp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp * *fcdp; /* Support clang */ tlp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_LONG_LONG: { long long *tlp = to_column->values->ll; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tlp *= *fip; tlp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tlp *= *flp; tlp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tlp *= *flp; tlp++; flp++; } break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tlp *= *flp; tlp++; flp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tlp *= *ffp; tlp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tlp *= *fdp; tlp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp * *fcfp; /* Support clang */ tlp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp * *fcdp; /* Support clang */ tlp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_SIZE: { cpl_size *tlp = to_column->values->sz; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tlp *= *fip; tlp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tlp *= *flp; tlp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tlp *= *flp; tlp++; flp++; } break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tlp *= *flp; tlp++; flp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tlp *= *ffp; tlp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tlp *= *fdp; tlp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp * *fcfp; /* Support clang */ tlp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tlp = *tlp * *fcdp; /* Support clang */ tlp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_FLOAT: { float *tfp = to_column->values->f; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tfp *= (double)*fip; tfp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tfp *= *flp; tfp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tfp *= *flp; tfp++; flp++; } break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tfp *= *flp; tfp++; flp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tfp *= (double)*ffp; tfp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tfp *= *fdp; tfp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tfp = *tfp * *fcfp; /* Support clang */ tfp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tfp = *tfp * *fcdp; /* Support clang */ tfp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_DOUBLE: { double *tdp = to_column->values->d; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tdp *= *fip; tdp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tdp *= *flp; tdp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tdp *= *flp; tdp++; flp++; } break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tdp *= *flp; tdp++; flp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tdp *= *ffp; tdp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tdp *= *fdp; tdp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tdp = *tdp * *fcfp; /* Support clang */ tdp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tdp = *tdp * *fcdp; /* Support clang */ tdp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *tcfp = to_column->values->cf; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tcfp *= *fip; tcfp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tcfp *= *flp; tcfp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tcfp *= *flp; tcfp++; flp++; } break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tcfp *= *flp; tcfp++; flp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tcfp *= *ffp; tcfp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tcfp *= *fdp; tcfp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tcfp *= *fcfp; tcfp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tcfp *= *fcdp; tcfp++; fcdp++; } break; } default: break; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *tcdp = to_column->values->cd; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) { if (*tnp++ == 0) *tcdp *= *fip; tcdp++; fip++; } break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) { if (*tnp++ == 0) *tcdp *= *flp; tcdp++; flp++; } break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) { if (*tnp++ == 0) *tcdp *= *flp; tcdp++; flp++; } break; } case CPL_TYPE_SIZE: { long long *flp = from_column->values->sz; while (to_length--) { if (*tnp++ == 0) *tcdp *= *flp; tcdp++; flp++; } break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) { if (*tnp++ == 0) *tcdp *= *ffp; tcdp++; ffp++; } break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) { if (*tnp++ == 0) *tcdp *= *fdp; tcdp++; fdp++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) { if (*tnp++ == 0) *tcdp *= *fcfp; tcdp++; fcfp++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) { if (*tnp++ == 0) *tcdp *= *fcdp; tcdp++; fcdp++; } break; } default: break; } break; } default: break; } } return CPL_ERROR_NONE; } /* * @brief * Divide two numeric columns. * * @param to_column Target column. * @param from_column Divisor column. * * @return @c CPL_ERROR_NONE on success. If any of the input columns * is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If * any of the input columns is of type string, a @c CPL_ERROR_INVALID_TYPE * is returned. If the input columns do not have the same length, * a @c CPL_ERROR_INCOMPATIBLE_INPUT is returned. * * The result of the multiplication is stored in the target column. The type of * the columns may differ, and in that case the operation would be performed * according to the C upcasting rules, with a final cast of the result to * the target column type. Consistently, if at least one column is complex * the math is complex, and if the target column is not complex then only * the real part of the result will be obtained. * Invalid elements are propagated consistently: * if either or both members of the division are invalid, the result * will be invalid too. Underflows and overflows are ignored, but a division * by zero is producing an invalid element in the target column. This function * is not applicable to array columns. */ cpl_error_code cpl_column_divide(cpl_column *to_column, cpl_column *from_column) { const char *fid = "cpl_column_divide"; cpl_size i; cpl_size to_length = cpl_column_get_size(to_column); cpl_size from_length = cpl_column_get_size(from_column); cpl_type to_type = cpl_column_get_type(to_column); cpl_type from_type = cpl_column_get_type(from_column); int *tnp; if (to_column == 0x0 || from_column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if ((to_type == CPL_TYPE_STRING) || (from_type == CPL_TYPE_STRING) || (to_type & CPL_TYPE_POINTER) || (from_type & CPL_TYPE_POINTER)) return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); if (to_length != from_length) return cpl_error_set(fid, CPL_ERROR_INCOMPATIBLE_INPUT); if (to_length == 0) return CPL_ERROR_NONE; if (from_column->nullcount == from_length) return cpl_column_fill_invalid(to_column, 0, to_length); /* * Look for zeroes in the divisor column, and mark them as * invalid in the target column in advance. */ if (from_column->nullcount == 0) { switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; for (i = 0; i < to_length; i++) if (*fip++ == 0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; for (i = 0; i < to_length; i++) if (*flp++ == 0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; for (i = 0; i < to_length; i++) if (*flp++ == 0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; for (i = 0; i < to_length; i++) if (*flp++ == 0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; for (i = 0; i < to_length; i++) if (*ffp++ == 0.0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; for (i = 0; i < to_length; i++) if (*fdp++ == 0.0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; for (i = 0; i < to_length; i++) if (*fcfp++ == 0.0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; for (i = 0; i < to_length; i++) if (*fcdp++ == 0.0) cpl_column_set_invalid(to_column, i); break; } default: break; } } else { cpl_column_flag *fnp = from_column->null; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; for (i = 0; i < to_length; i++, fip++) if (*fnp++ == 0) if (*fip == 0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; for (i = 0; i < to_length; i++, flp++) if (*fnp++ == 0) if (*flp == 0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; for (i = 0; i < to_length; i++, flp++) if (*fnp++ == 0) if (*flp == 0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; for (i = 0; i < to_length; i++, flp++) if (*fnp++ == 0) if (*flp == 0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; for (i = 0; i < to_length; i++, ffp++) if (*fnp++ == 0) if (*ffp == 0.0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; for (i = 0; i < to_length; i++, fdp++) if (*fnp++ == 0) if (*fdp == 0.0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; for (i = 0; i < to_length; i++, fcfp++) if (*fnp++ == 0) if (*fcfp == 0.0) cpl_column_set_invalid(to_column, i); break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; for (i = 0; i < to_length; i++, fcdp++) if (*fnp++ == 0) if (*fcdp == 0.0) cpl_column_set_invalid(to_column, i); break; } default: break; } } /* * If there are just NULLs in the target column, no need to * perform any further operation: */ if (to_column->nullcount == to_length) return CPL_ERROR_NONE; if (to_column->nullcount == 0 && from_column->nullcount == 0) { /* * If there are no invalids in both columns, the operation can * be performed without any check: */ switch (to_type) { case CPL_TYPE_INT: { int *tip = to_column->values->i; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tip++ /= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tip++ /= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tip++ /= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tip++ /= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tip++ /= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tip++ /= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tip[to_length] = tip[to_length] / fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tip[to_length] = tip[to_length] / fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_LONG: { long *tlp = to_column->values->l; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tlp++ /= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tlp++ /= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tlp++ /= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tlp++ /= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tlp++ /= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tlp++ /= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tlp[to_length] = tlp[to_length] / fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tlp[to_length] = tlp[to_length] / fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_LONG_LONG: { long long *tlp = to_column->values->ll; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tlp++ /= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tlp++ /= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tlp++ /= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tlp++ /= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tlp++ /= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tlp++ /= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tlp[to_length] = tlp[to_length] / fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tlp[to_length] = tlp[to_length] / fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_SIZE: { cpl_size *tlp = to_column->values->sz; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tlp++ /= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tlp++ /= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tlp++ /= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tlp++ /= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tlp++ /= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tlp++ /= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tlp[to_length] = tlp[to_length] / fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tlp[to_length] = tlp[to_length] / fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_FLOAT: { float *tfp = to_column->values->f; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tfp++ /= (double)*fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tfp++ /= (double)*flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tfp++ /= (double)*flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tfp++ /= (double)*flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tfp++ /= (double)*ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tfp++ /= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tfp[to_length] = tfp[to_length] / fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tfp[to_length] = tfp[to_length] / fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_DOUBLE: { double *tdp = to_column->values->d; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tdp++ /= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tdp++ /= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tdp++ /= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tdp++ /= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tdp++ /= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tdp++ /= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) tdp[to_length] = tdp[to_length] / fcfp[to_length]; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) tdp[to_length] = tdp[to_length] / fcdp[to_length]; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *tcfp = to_column->values->cf; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tcfp++ /= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tcfp++ /= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tcfp++ /= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tcfp++ /= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tcfp++ /= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tcfp++ /= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) *tcfp++ /= *fcfp++; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) *tcfp++ /= *fcdp++; break; } default: break; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *tcdp = to_column->values->cd; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; while (to_length--) *tcdp++ /= *fip++; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; while (to_length--) *tcdp++ /= *flp++; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; while (to_length--) *tcdp++ /= *flp++; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; while (to_length--) *tcdp++ /= *flp++; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; while (to_length--) *tcdp++ /= *ffp++; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; while (to_length--) *tcdp++ /= *fdp++; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; while (to_length--) *tcdp++ /= *fcfp++; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; while (to_length--) *tcdp++ /= *fcdp++; break; } default: break; } break; } default: break; } } else { /* * Here there are some invalids around, so the operation needs to be * performed with some checks. As a first thing, take care of the * invalids pattern in the target column: */ if (to_column->nullcount == 0 || from_column->nullcount == 0) { /* * Here there are some invalids in just one of the two columns. * If they are just in the column to subtract, an identical * invalid flags buffer must be created for the target column. */ if (from_column->nullcount) { to_column->null = cpl_calloc(to_length, sizeof(cpl_column_flag)); i = to_length; while (i--) if (from_column->null[i]) to_column->null[i] = 1; to_column->nullcount = from_column->nullcount; } } else { /* * Here there are some invalids in both columns. */ i = to_length; while (i--) { if (from_column->null[i]) { if (!to_column->null[i]) { to_column->null[i] = 1; to_column->nullcount++; } } } if (to_column->nullcount == to_length) { /* * Just invalids in the result: no need to perform any further * operation, and the invalid buffer of the target column can * be disabled. */ if (to_column->null) cpl_free(to_column->null); to_column->null = NULL; return 0; } } /* * The operation can be performed while checking the already * computed result invalid flags buffer of the target column. */ tnp = to_column->null; switch (to_type) { case CPL_TYPE_INT: { int *tip = to_column->values->i; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; for (i = 0; i < to_length; i++, tip++, fip++, tnp++) if (*tnp == 0) *tip /= *fip; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; for (i = 0; i < to_length; i++, tip++, flp++, tnp++) if (*tnp == 0) *tip /= *flp; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; for (i = 0; i < to_length; i++, tip++, flp++, tnp++) if (*tnp == 0) *tip /= *flp; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; for (i = 0; i < to_length; i++, tip++, flp++, tnp++) if (*tnp == 0) *tip /= *flp; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; for (i = 0; i < to_length; i++, tip++, ffp++, tnp++) if (*tnp == 0) *tip /= *ffp; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; for (i = 0; i < to_length; i++, tip++, fdp++, tnp++) if (*tnp == 0) *tip /= *fdp; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; for (i = 0; i < to_length; i++, tip++, fcfp++, tnp++) if (*tnp == 0) *tip = *tip / *fcfp; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; for (i = 0; i < to_length; i++, tip++, fcdp++, tnp++) if (*tnp == 0) *tip = *tip / *fcdp; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_LONG: { long *tlp = to_column->values->l; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; for (i = 0; i < to_length; i++, tlp++, fip++, tnp++) if (*tnp == 0) *tlp /= *fip; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; for (i = 0; i < to_length; i++, tlp++, flp++, tnp++) if (*tnp == 0) *tlp /= *flp; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; for (i = 0; i < to_length; i++, tlp++, flp++, tnp++) if (*tnp == 0) *tlp /= *flp; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; for (i = 0; i < to_length; i++, tlp++, flp++, tnp++) if (*tnp == 0) *tlp /= *flp; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; for (i = 0; i < to_length; i++, tlp++, ffp++, tnp++) if (*tnp == 0) *tlp /= *ffp; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; for (i = 0; i < to_length; i++, tlp++, fdp++, tnp++) if (*tnp == 0) *tlp /= *fdp; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; for (i = 0; i < to_length; i++, tlp++, fcfp++, tnp++) if (*tnp == 0) *tlp = *tlp / *fcfp; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; for (i = 0; i < to_length; i++, tlp++, fcdp++, tnp++) if (*tnp == 0) *tlp = *tlp / *fcdp; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_LONG_LONG: { long long *tlp = to_column->values->ll; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; for (i = 0; i < to_length; i++, tlp++, fip++, tnp++) if (*tnp == 0) *tlp /= *fip; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; for (i = 0; i < to_length; i++, tlp++, flp++, tnp++) if (*tnp == 0) *tlp /= *flp; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; for (i = 0; i < to_length; i++, tlp++, flp++, tnp++) if (*tnp == 0) *tlp /= *flp; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; for (i = 0; i < to_length; i++, tlp++, flp++, tnp++) if (*tnp == 0) *tlp /= *flp; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; for (i = 0; i < to_length; i++, tlp++, ffp++, tnp++) if (*tnp == 0) *tlp /= *ffp; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; for (i = 0; i < to_length; i++, tlp++, fdp++, tnp++) if (*tnp == 0) *tlp /= *fdp; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; for (i = 0; i < to_length; i++, tlp++, fcfp++, tnp++) if (*tnp == 0) *tlp = *tlp / *fcfp; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; for (i = 0; i < to_length; i++, tlp++, fcdp++, tnp++) if (*tnp == 0) *tlp = *tlp / *fcdp; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_SIZE: { cpl_size *tlp = to_column->values->sz; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; for (i = 0; i < to_length; i++, tlp++, fip++, tnp++) if (*tnp == 0) *tlp /= *fip; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; for (i = 0; i < to_length; i++, tlp++, flp++, tnp++) if (*tnp == 0) *tlp /= *flp; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; for (i = 0; i < to_length; i++, tlp++, flp++, tnp++) if (*tnp == 0) *tlp /= *flp; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; for (i = 0; i < to_length; i++, tlp++, flp++, tnp++) if (*tnp == 0) *tlp /= *flp; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; for (i = 0; i < to_length; i++, tlp++, ffp++, tnp++) if (*tnp == 0) *tlp /= *ffp; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; for (i = 0; i < to_length; i++, tlp++, fdp++, tnp++) if (*tnp == 0) *tlp /= *fdp; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; for (i = 0; i < to_length; i++, tlp++, fcfp++, tnp++) if (*tnp == 0) *tlp = *tlp / *fcfp; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; for (i = 0; i < to_length; i++, tlp++, fcdp++, tnp++) if (*tnp == 0) *tlp = *tlp / *fcdp; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_FLOAT: { float *tfp = to_column->values->f; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; for (i = 0; i < to_length; i++, tfp++, fip++, tnp++) if (*tnp == 0) *tfp /= (double)*fip; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; for (i = 0; i < to_length; i++, tfp++, flp++, tnp++) if (*tnp == 0) *tfp /= *flp; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; for (i = 0; i < to_length; i++, tfp++, flp++, tnp++) if (*tnp == 0) *tfp /= *flp; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; for (i = 0; i < to_length; i++, tfp++, flp++, tnp++) if (*tnp == 0) *tfp /= *flp; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; for (i = 0; i < to_length; i++, tfp++, ffp++, tnp++) if (*tnp == 0) *tfp /= (double)*ffp; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; for (i = 0; i < to_length; i++, tfp++, fdp++, tnp++) if (*tnp == 0) *tfp /= *fdp; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; for (i = 0; i < to_length; i++, tfp++, fcfp++, tnp++) if (*tnp == 0) *tfp /= (double)*fcfp; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; for (i = 0; i < to_length; i++, tfp++, fcdp++, tnp++) if (*tnp == 0) *tfp = *tfp / *fcdp; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_DOUBLE: { double *tdp = to_column->values->d; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; for (i = 0; i < to_length; i++, tdp++, fip++, tnp++) if (*tnp == 0) *tdp /= *fip; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; for (i = 0; i < to_length; i++, tdp++, flp++, tnp++) if (*tnp == 0) *tdp /= *flp; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; for (i = 0; i < to_length; i++, tdp++, flp++, tnp++) if (*tnp == 0) *tdp /= *flp; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; for (i = 0; i < to_length; i++, tdp++, flp++, tnp++) if (*tnp == 0) *tdp /= *flp; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; for (i = 0; i < to_length; i++, tdp++, ffp++, tnp++) if (*tnp == 0) *tdp /= *ffp; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; for (i = 0; i < to_length; i++, tdp++, fdp++, tnp++) if (*tnp == 0) *tdp /= *fdp; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; for (i = 0; i < to_length; i++, tdp++, fcfp++, tnp++) if (*tnp == 0) *tdp = *tdp / *fcfp; /* Support clang */ break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; for (i = 0; i < to_length; i++, tdp++, fcdp++, tnp++) if (*tnp == 0) *tdp = *tdp / *fcdp; /* Support clang */ break; } default: break; } break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *tcfp = to_column->values->cf; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; for (i = 0; i < to_length; i++, tcfp++, fip++, tnp++) if (*tnp == 0) *tcfp /= *fip; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; for (i = 0; i < to_length; i++, tcfp++, flp++, tnp++) if (*tnp == 0) *tcfp /= *flp; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; for (i = 0; i < to_length; i++, tcfp++, flp++, tnp++) if (*tnp == 0) *tcfp /= *flp; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; for (i = 0; i < to_length; i++, tcfp++, flp++, tnp++) if (*tnp == 0) *tcfp /= *flp; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; for (i = 0; i < to_length; i++, tcfp++, ffp++, tnp++) if (*tnp == 0) *tcfp /= *ffp; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; for (i = 0; i < to_length; i++, tcfp++, fdp++, tnp++) if (*tnp == 0) *tcfp /= *fdp; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; for (i = 0; i < to_length; i++, tcfp++, fcfp++, tnp++) if (*tnp == 0) *tcfp /= *fcfp; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; for (i = 0; i < to_length; i++, tcfp++, fcdp++, tnp++) if (*tnp == 0) *tcfp /= *fcdp; break; } default: break; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *tcdp = to_column->values->cd; switch (from_type) { case CPL_TYPE_INT: { int *fip = from_column->values->i; for (i = 0; i < to_length; i++, tcdp++, fip++, tnp++) if (*tnp == 0) *tcdp /= *fip; break; } case CPL_TYPE_LONG: { long *flp = from_column->values->l; for (i = 0; i < to_length; i++, tcdp++, flp++, tnp++) if (*tnp == 0) *tcdp /= *flp; break; } case CPL_TYPE_LONG_LONG: { long long *flp = from_column->values->ll; for (i = 0; i < to_length; i++, tcdp++, flp++, tnp++) if (*tnp == 0) *tcdp /= *flp; break; } case CPL_TYPE_SIZE: { cpl_size *flp = from_column->values->sz; for (i = 0; i < to_length; i++, tcdp++, flp++, tnp++) if (*tnp == 0) *tcdp /= *flp; break; } case CPL_TYPE_FLOAT: { float *ffp = from_column->values->f; for (i = 0; i < to_length; i++, tcdp++, ffp++, tnp++) if (*tnp == 0) *tcdp /= *ffp; break; } case CPL_TYPE_DOUBLE: { double *fdp = from_column->values->d; for (i = 0; i < to_length; i++, tcdp++, fdp++, tnp++) if (*tnp == 0) *tcdp /= *fdp; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *fcfp = from_column->values->cf; for (i = 0; i < to_length; i++, tcdp++, fcfp++, tnp++) if (*tnp == 0) *tcdp /= *fcfp; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *fcdp = from_column->values->cd; for (i = 0; i < to_length; i++, tcdp++, fcdp++, tnp++) if (*tnp == 0) *tcdp /= *fcdp; break; } default: break; } break; } default: break; } } return CPL_ERROR_NONE; } /* * @brief * Private function to make the exponential of an integer column. * * @param column Target column. * @param base Constant base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_exp_int(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); int *ip = cpl_column_get_data_int(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, ip++) *ip = cpl_tools_ipow(base, *ip); } else { for (i = 0; i < length; i++, ip++, np++) if (*np == 0) *ip = cpl_tools_ipow(base, *ip); } } /* * @brief * Private function to make the exponential of a long integer column. * * @param column Target column. * @param base Constant base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_exp_long(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); long *lp = cpl_column_get_data_long(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); cpl_size i; if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, lp++) *lp = pow(base, *lp); } else { for (i = 0; i < length; i++, lp++, np++) if (*np == 0) *lp = pow(base, *lp); } } /* * @brief * Private function to make the exponential of a long long integer column. * * @param column Target column. * @param base Constant base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_exp_long_long(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); long long *lp = cpl_column_get_data_long_long(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); cpl_size i; if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, lp++) *lp = pow(base, *lp); } else { for (i = 0; i < length; i++, lp++, np++) if (*np == 0) *lp = pow(base, *lp); } } /* * @brief * Private function to make the exponential of a cpl_size column. * * @param column Target column. * @param base Constant base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_exp_cplsize(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); cpl_size *lp = cpl_column_get_data_cplsize(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); cpl_size i; if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, lp++) *lp = pow(base, *lp); } else { for (i = 0; i < length; i++, lp++, np++) if (*np == 0) *lp = pow(base, *lp); } } /* * @brief * Private function to make the exponential of a float column. * * @param column Target column. * @param base Constant base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_exp_float(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); float *fp = cpl_column_get_data_float(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, fp++) *fp = pow(base, *fp); } else { for (i = 0; i < length; i++, fp++, np++) if (*np == 0) *fp = pow(base, *fp); } } static void cpl_column_conj_float(cpl_column *column) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); float complex *fp = cpl_column_get_data_float_complex(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, fp++) *fp = conj(*fp); } else { for (i = 0; i < length; i++, fp++, np++) if (*np == 0) *fp = conj(*fp); } } /* * @brief * Private function to make the exponential of a float complex column. * * @param column Target column. * @param base Constant base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_exp_float_complex(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); float complex *fp = cpl_column_get_data_float_complex(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, fp++) *fp = cpowf(base, *fp); } else { for (i = 0; i < length; i++, fp++, np++) if (*np == 0) *fp = cpowf(base, *fp); } } /* * @brief * Private function to make the exponential of a double column. * * @param column Target column. * @param base Constant base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_exp_double(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); double *dp = cpl_column_get_data_double(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, dp++) *dp = pow(base, *dp); } else { for (i = 0; i < length; i++, dp++, np++) if (*np == 0) *dp = pow(base, *dp); } } static void cpl_column_conj_double(cpl_column *column) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); double complex *fp = cpl_column_get_data_double_complex(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, fp++) *fp = conj(*fp); } else { for (i = 0; i < length; i++, fp++, np++) if (*np == 0) *fp = conj(*fp); } } /* * @brief * Private function to make the exponential of a double complex column. * * @param column Target column. * @param base Constant base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_exp_double_complex(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); double complex *dp = cpl_column_get_data_double_complex(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, dp++) *dp = cpow(base, *dp); } else { for (i = 0; i < length; i++, dp++, np++) if (*np == 0) *dp = cpow(base, *dp); } } /* * @brief * Private function to make the power of an integer column. * * @param column Target column. * @param exponent Constant exponent. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_pow_int(cpl_column *column, double exponent) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); int *ip = cpl_column_get_data_int(column); int *np = cpl_column_get_data_invalid(column); int negative = exponent < 0.0; cpl_size i; if (nullcount == length) return; if (exponent != 1.0) { if (nullcount == 0) { if (negative) { for (i = 0; i < length; i++, ip++) { if (*ip > 0) *ip = floor(1 / pow(*ip, -exponent) + 0.5); else cpl_column_set_invalid(column, i); } } else { for (i = 0; i < length; i++, ip++) { if (*ip >= 0) *ip = floor(pow(*ip, exponent) + 0.5); else cpl_column_set_invalid(column, i); } } } else { for (i = 0; i < length; i++, ip++, np++) { if (negative) { if (*np == 0) { if (*ip > 0) *ip = floor(1 / pow(*ip, -exponent) + 0.5); else cpl_column_set_invalid(column, i); } } else { if (*np == 0) { if (*ip >= 0) *ip = floor(pow(*ip, exponent) + 0.5); else cpl_column_set_invalid(column, i); } } } } } } /* * @brief * Private function to make the power of a long integer column. * * @param column Target column. * @param exponent Constant exponent. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_pow_long(cpl_column *column, double exponent) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); long *lp = cpl_column_get_data_long(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); int negative = exponent < 0.0; cpl_size i; if (nullcount == length) return; if (exponent != 1.0) { if (nullcount == 0) { if (negative) { for (i = 0; i < length; i++, lp++) { if (*lp > 0) *lp = floor(1 / pow(*lp, -exponent) + 0.5); else cpl_column_set_invalid(column, i); } } else { for (i = 0; i < length; i++, lp++) { if (*lp >= 0) *lp = floor(pow(*lp, exponent) + 0.5); else cpl_column_set_invalid(column, i); } } } else { for (i = 0; i < length; i++, lp++, np++) { if (negative) { if (*np == 0) { if (*lp > 0) *lp = floor(1 / pow(*lp, -exponent) + 0.5); else cpl_column_set_invalid(column, i); } } else { if (*np == 0) { if (*lp >= 0) *lp = floor(pow(*lp, exponent) + 0.5); else cpl_column_set_invalid(column, i); } } } } } } /* * @brief * Private function to make the power of a long long integer column. * * @param column Target column. * @param exponent Constant exponent. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_pow_long_long(cpl_column *column, double exponent) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); long long *lp = cpl_column_get_data_long_long(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); int negative = exponent < 0.0; cpl_size i; if (nullcount == length) return; if (exponent != 1.0) { if (nullcount == 0) { if (negative) { for (i = 0; i < length; i++, lp++) { if (*lp > 0) *lp = floor(1 / pow(*lp, -exponent) + 0.5); else cpl_column_set_invalid(column, i); } } else { for (i = 0; i < length; i++, lp++) { if (*lp >= 0) *lp = floor(pow(*lp, exponent) + 0.5); else cpl_column_set_invalid(column, i); } } } else { for (i = 0; i < length; i++, lp++, np++) { if (negative) { if (*np == 0) { if (*lp > 0) *lp = floor(1 / pow(*lp, -exponent) + 0.5); else cpl_column_set_invalid(column, i); } } else { if (*np == 0) { if (*lp >= 0) *lp = floor(pow(*lp, exponent) + 0.5); else cpl_column_set_invalid(column, i); } } } } } } /* * @brief * Private function to make the power of a cpl_size column. * * @param column Target column. * @param exponent Constant exponent. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_pow_cplsize(cpl_column *column, double exponent) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); cpl_size *lp = cpl_column_get_data_cplsize(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); int negative = exponent < 0.0; cpl_size i; if (nullcount == length) return; if (exponent != 1.0) { if (nullcount == 0) { if (negative) { for (i = 0; i < length; i++, lp++) { if (*lp > 0) *lp = floor(1 / pow(*lp, -exponent) + 0.5); else cpl_column_set_invalid(column, i); } } else { for (i = 0; i < length; i++, lp++) { if (*lp >= 0) *lp = floor(pow(*lp, exponent) + 0.5); else cpl_column_set_invalid(column, i); } } } else { for (i = 0; i < length; i++, lp++, np++) { if (negative) { if (*np == 0) { if (*lp > 0) *lp = floor(1 / pow(*lp, -exponent) + 0.5); else cpl_column_set_invalid(column, i); } } else { if (*np == 0) { if (*lp >= 0) *lp = floor(pow(*lp, exponent) + 0.5); else cpl_column_set_invalid(column, i); } } } } } } /* * @brief * Private function to make the power of a float column. * * @param column Target column. * @param exponent Constant exponent. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_pow_float(cpl_column *column, double exponent) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); float *fp = cpl_column_get_data_float(column); int *np = cpl_column_get_data_invalid(column); int negative = exponent < 0.0; cpl_size i; if (nullcount == length) return; if (exponent != 1.0) { if (nullcount == 0) { if (negative) { for (i = 0; i < length; i++, fp++) { if (*fp > 0.0) { float value = powf(*fp, -exponent); if (value > 0.0) { *fp = 1 / value; } else { cpl_column_set_invalid(column, i); } } else { cpl_column_set_invalid(column, i); } } } else { for (i = 0; i < length; i++, fp++) { if (*fp >= 0.0) *fp = powf(*fp, exponent); else cpl_column_set_invalid(column, i); } } } else { for (i = 0; i < length; i++, fp++, np++) { if (negative) { if (*np == 0) { if (*fp > 0.0) { float value = powf(*fp, -exponent); if (value > 0.0) { *fp = 1 / value; } else { cpl_column_set_invalid(column, i); } } else { cpl_column_set_invalid(column, i); } } } else { if (*np == 0) { if (*fp >= 0.0) *fp = powf(*fp, exponent); else cpl_column_set_invalid(column, i); } } } } } } /* * @brief * Private function to make the power of a float complex column. * * @param column Target column. * @param exponent Constant exponent. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_pow_float_complex(cpl_column *column, double exponent) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); float complex *fp = cpl_column_get_data_float_complex(column); int *np = cpl_column_get_data_invalid(column); int negative = exponent < 0.0; cpl_size i; if (nullcount == length) return; if (exponent != 1.0) { if (nullcount == 0) { if (negative) { for (i = 0; i < length; i++, fp++) { if (*fp != 0.0) { float complex value = cpowf(*fp, -exponent); if (value != 0.0) { *fp = 1 / value; } else { cpl_column_set_invalid(column, i); } } else { cpl_column_set_invalid(column, i); } } } else { for (i = 0; i < length; i++, fp++) { *fp = cpowf(*fp, exponent); } } } else { for (i = 0; i < length; i++, fp++, np++) { if (negative) { if (*np == 0) { if (*fp != 0.0) { float complex value = cpowf(*fp, -exponent); if (value != 0.0) { *fp = 1 / value; } else { cpl_column_set_invalid(column, i); } } else { cpl_column_set_invalid(column, i); } } } else { if (*np == 0) { *fp = cpowf(*fp, exponent); } } } } } } /* * @brief * Private function to make the power of a double column. * * @param column Target column. * @param exponent Constant exponent. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_pow_double(cpl_column *column, double exponent) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); double *dp = cpl_column_get_data_double(column); int *np = cpl_column_get_data_invalid(column); int negative = exponent < 0.0; cpl_size i; if (nullcount == length) return; if (exponent != 1.0) { if (nullcount == 0) { if (negative) { for (i = 0; i < length; i++, dp++) { if (*dp > 0.0) { double value = pow(*dp, -exponent); if (value != 0.0) { *dp = 1 / value; } else { cpl_column_set_invalid(column, i); } } else { cpl_column_set_invalid(column, i); } } } else { for (i = 0; i < length; i++, dp++) { if (*dp >= 0.0) *dp = pow(*dp, exponent); else cpl_column_set_invalid(column, i); } } } else { for (i = 0; i < length; i++, dp++, np++) { if (negative) { if (*np == 0) { if (*dp > 0.0) { double value = pow(*dp, -exponent); if (value != 0.0) { *dp = 1 / value; } else { cpl_column_set_invalid(column, i); } } else { cpl_column_set_invalid(column, i); } } } else { if (*np == 0) { if (*dp >= 0.0) *dp = pow(*dp, exponent); else cpl_column_set_invalid(column, i); } } } } } } /* * @brief * Private function to make the power of a double complex column. * * @param column Target column. * @param exponent Constant exponent. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_pow_double_complex(cpl_column *column, double exponent) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); double complex *dp = cpl_column_get_data_double_complex(column); int *np = cpl_column_get_data_invalid(column); int negative = exponent < 0.0; cpl_size i; if (nullcount == length) return; if (exponent != 1.0) { if (nullcount == 0) { if (negative) { for (i = 0; i < length; i++, dp++) { if (cabs(*dp) > 0.0) { double complex value = cpow(*dp, -exponent); if (value != 0.0) { *dp = 1 / value; } else { cpl_column_set_invalid(column, i); } } else { cpl_column_set_invalid(column, i); } } } else { for (i = 0; i < length; i++, dp++) { *dp = cpow(*dp, exponent); } } } else { for (i = 0; i < length; i++, dp++, np++) { if (negative) { if (*np == 0) { if (cabs(*dp) > 0.0) { double complex value = cpow(*dp, -exponent); if (value != 0.0) { *dp = 1 / value; } else { cpl_column_set_invalid(column, i); } } else { cpl_column_set_invalid(column, i); } } } else { if (*np == 0) { *dp = cpow(*dp, exponent); } } } } } } /* * @brief * Private function to make the log of an integer column. * * @param column Target column. * @param base Logarithm base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_log_int(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); int *ip = cpl_column_get_data_int(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; double invlog = 1 / log(base); if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, ip++) { if (*ip > 0) *ip = floor(log(*ip) * invlog + 0.5); else cpl_column_set_invalid(column, i); } } else { for (i = 0; i < length; i++, ip++, np++) { if (*np == 0) { if (*ip > 0) *ip = floor(log(*ip) * invlog + 0.5); else cpl_column_set_invalid(column, i); } } } } /* * @brief * Private function to make the log of a long integer column. * * @param column Target column. * @param base Logarithm base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_log_long(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); long *lp = cpl_column_get_data_long(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); cpl_size i; double invlog = 1 / log(base); if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, lp++) { if (*lp > 0) *lp = floor(log(*lp) * invlog + 0.5); else cpl_column_set_invalid(column, i); } } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (*lp > 0) *lp = floor(log(*lp) * invlog + 0.5); else cpl_column_set_invalid(column, i); } } } } /* * @brief * Private function to make the log of a long long integer column. * * @param column Target column. * @param base Logarithm base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_log_long_long(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); long long *lp = cpl_column_get_data_long_long(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); cpl_size i; double invlog = 1 / log(base); if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, lp++) { if (*lp > 0) *lp = floor(log(*lp) * invlog + 0.5); else cpl_column_set_invalid(column, i); } } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (*lp > 0) *lp = floor(log(*lp) * invlog + 0.5); else cpl_column_set_invalid(column, i); } } } } /* * @brief * Private function to make the log of a cpl_size column. * * @param column Target column. * @param base Logarithm base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_log_cplsize(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); cpl_size *lp = cpl_column_get_data_cplsize(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); cpl_size i; double invlog = 1 / log(base); if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, lp++) { if (*lp > 0) *lp = floor(log(*lp) * invlog + 0.5); else cpl_column_set_invalid(column, i); } } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (*lp > 0) *lp = floor(log(*lp) * invlog + 0.5); else cpl_column_set_invalid(column, i); } } } } /* * @brief * Private function to make the log of a float column. * * @param column Target column. * @param base Logarithm base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_log_float(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); float *fp = cpl_column_get_data_float(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; double invlog = 1 / log(base); if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, fp++) { if (*fp > 0.0) *fp = log(*fp) * invlog; else cpl_column_set_invalid(column, i); } } else { for (i = 0; i < length; i++, fp++, np++) { if (*np == 0) { if (*fp > 0.0) *fp = log(*fp) * invlog; else cpl_column_set_invalid(column, i); } } } } /* * @brief * Private function to make the log of a float complex column. * * @param column Target column. * @param base Logarithm base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_log_float_complex(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); float complex *fp = cpl_column_get_data_float_complex(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; double invlog = 1 / log(base); if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, fp++) { if (cabsf(*fp) > 0.0) *fp = clogf(*fp) * invlog; else cpl_column_set_invalid(column, i); } } else { for (i = 0; i < length; i++, fp++, np++) { if (*np == 0) { if (cabsf(*fp) > 0.0) *fp = clogf(*fp) * invlog; else cpl_column_set_invalid(column, i); } } } } /* * @brief * Private function to make the log of a double column. * * @param column Target column. * @param base Logarithm base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_log_double(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); double *dp = cpl_column_get_data_double(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; double invlog = 1 / log(base); if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, dp++) { if (*dp > 0.0) *dp = log(*dp) * invlog; else cpl_column_set_invalid(column, i); } } else { for (i = 0; i < length; i++, dp++, np++) { if (*np == 0) { if (*dp > 0.0) *dp = log(*dp) * invlog; else cpl_column_set_invalid(column, i); } } } } /* * @brief * Private function to make the log of a double complex column. * * @param column Target column. * @param base Logarithm base. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_log_double_complex(cpl_column *column, double base) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); double complex *dp = cpl_column_get_data_double_complex(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; double invlog = 1 / log(base); if (nullcount == length) return; if (nullcount == 0) { for (i = 0; i < length; i++, dp++) { if (cabs(*dp) > 0.0) *dp = clog(*dp) * invlog; else cpl_column_set_invalid(column, i); } } else { for (i = 0; i < length; i++, dp++, np++) { if (*np == 0) { if (cabs(*dp) > 0.0) *dp = clog(*dp) * invlog; else cpl_column_set_invalid(column, i); } } } } /* * @brief * Private function to add an @em integer constant to an @em integer column. * * @param column Target column. * @param value Value to add. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_add_to_int(cpl_column *column, int value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); int *ip = cpl_column_get_data_int(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *ip++ += value; else for (i = 0; i < length; i++, ip++, np++) if (*np == 0) *ip += value; } /* * @brief * Private function to add a @em long @em integer constant to a @em long * @em integer column. * * @param column Target column. * @param value Value to add. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_add_to_long(cpl_column *column, long value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); long *lp = cpl_column_get_data_long(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *lp++ += value; else for (i = 0; i < length; i++, lp++, np++) if (*np == 0) *lp += value; } /* * @brief * Private function to add a @em long @em long @em integer constant to a * @em long @em long @em integer column. * * @param column Target column. * @param value Value to add. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_add_to_long_long(cpl_column *column, long long value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); long long *lp = cpl_column_get_data_long_long(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *lp++ += value; else for (i = 0; i < length; i++, lp++, np++) if (*np == 0) *lp += value; } /* * @brief * Private function to add a cpl_size constant to a cpl_size column. * * @param column Target column. * @param value Value to add. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_add_to_cplsize(cpl_column *column, cpl_size value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); cpl_size *lp = cpl_column_get_data_cplsize(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *lp++ += value; else for (i = 0; i < length; i++, lp++, np++) if (*np == 0) *lp += value; } /* * @brief * Private function to add a @em float constant to a @em float column. * * @param column Target column. * @param value Value to add. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_add_to_float(cpl_column *column, double value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); float *fp = cpl_column_get_data_float(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 0.0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *fp++ += value; else for (i = 0; i < length; i++, fp++, np++) if (*np == 0) *fp += value; } /* * @brief * Private function to add a @em float complex constant to a * @em float complex column. * * @param column Target column. * @param value Value to add. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_add_to_float_complex(cpl_column *column, double complex value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); float complex *fp = cpl_column_get_data_float_complex(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 0.0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *fp++ += value; else for (i = 0; i < length; i++, fp++, np++) if (*np == 0) *fp += value; } /* * @brief * Private function to add a @em double constant to a @em double column. * * @param column Target column. * @param value Value to add. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_add_to_double(cpl_column *column, double value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); double *dp = cpl_column_get_data_double(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 0.0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *dp++ += value; else for (i = 0; i < length; i++, dp++, np++) if (*np == 0) *dp += value; } /* * @brief * Private function to add a @em double complex constant to a * @em double complex column. * * @param column Target column. * @param value Value to add. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_add_to_double_complex(cpl_column *column, double complex value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); double complex *dp = cpl_column_get_data_double_complex(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 0.0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *dp++ += value; else for (i = 0; i < length; i++, dp++, np++) if (*np == 0) *dp += value; } /* * @brief * Private function to multiply a @em integer column by a @em double constant. * * @param column Target column. * @param value Value to add. * * @return Nothing. * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_mul_double_to_int(cpl_column *column, double value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); int *ip = cpl_column_get_data_int(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 1.0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *ip++ *= value; else for (i = 0; i < length; i++, ip++, np++) if (*np == 0) *ip *= value; } /* * @brief * Private function to multiply a @em long @em integer column by a * @em double constant. * * @param column Target column. * @param value Value to add. * * @return Nothing. * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_mul_double_to_long(cpl_column *column, double value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); long *lp = cpl_column_get_data_long(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 1.0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *lp++ *= value; else for (i = 0; i < length; i++, lp++, np++) if (*np == 0) *lp *= value; } /* * @brief * Private function to multiply a @em long @em long @em integer column by a * @em double constant. * * @param column Target column. * @param value Value to add. * * @return Nothing. * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_mul_double_to_long_long(cpl_column *column, double value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); long long *lp = cpl_column_get_data_long_long(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 1.0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *lp++ *= value; else for (i = 0; i < length; i++, lp++, np++) if (*np == 0) *lp *= value; } /* * @brief * Private function to multiply a @em cpl_size column by a @em double * constant. * * @param column Target column. * @param value Value to add. * * @return Nothing. * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_mul_double_to_cplsize(cpl_column *column, double value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); cpl_size *lp = cpl_column_get_data_cplsize(column); cpl_column_flag *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 1.0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *lp++ *= value; else for (i = 0; i < length; i++, lp++, np++) if (*np == 0) *lp *= value; } /* * @brief * Private function to multiply a @em float column by a @em double constant. * * @param column Target column. * @param value Value to add. * * @return Nothing. * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_mul_double_to_float(cpl_column *column, double value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); float *fp = cpl_column_get_data_float(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 1.0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *fp++ *= value; else for (i = 0; i < length; i++, fp++, np++) if (*np == 0) *fp *= value; } static void cpl_column_mul_double_to_float_complex(cpl_column *column, double complex value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); float complex *fp = cpl_column_get_data_float_complex(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 1.0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *fp++ *= value; else for (i = 0; i < length; i++, fp++, np++) if (*np == 0) *fp *= value; } /* * @brief * Private function to multiply a @em double column by a @em double constant. * * @param column Target column. * @param value Value to add. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_mul_to_double(cpl_column *column, double value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); double *dp = cpl_column_get_data_double(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 1.0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *dp++ *= value; else for (i = 0; i < length; i++, dp++, np++) if (*np == 0) *dp *= value; } /* * @brief * Private function to multiply a @em double complex column by a * @em double complex constant. * * @param column Target column. * @param value Value to add. * * @return Nothing * * This private function is just a way to compact the code of other * higher level functions. No check is performed on input, assuming * that this was done elsewhere. */ static void cpl_column_mul_to_double_complex(cpl_column *column, double complex value) { cpl_size nullcount = cpl_column_count_invalid(column); cpl_size length = cpl_column_get_size(column); double complex *dp = cpl_column_get_data_double_complex(column); int *np = cpl_column_get_data_invalid(column); cpl_size i; if (value == 1.0) return; if (nullcount == length) return; if (nullcount == 0) for (i = 0; i < length; i++) *dp++ *= value; else for (i = 0; i < length; i++, dp++, np++) if (*np == 0) *dp *= value; } /* * @brief * Compute the logarithm of column values. * * @param column Target column. * @param base Logarithm base. * * @return @c CPL_ERROR_NONE on success. If the input column is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the accessed column * is not numerical, a @c CPL_ERROR_INVALID_TYPE is returned. If the * @em base is not greater than zero, a @c CPL_ERROR_ILLEGAL_INPUT is * returned. * * The operation is always performed in double precision, with a final * cast of the result to the target column type. Non-positive column * values will be marked as invalid. Columns of strings or arrays are * not allowed. */ cpl_error_code cpl_column_logarithm(cpl_column *column, double base) { const char *fid = "cpl_column_logarithm"; cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (base <= 0.0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); switch (type) { case CPL_TYPE_INT: cpl_column_log_int(column, base); break; case CPL_TYPE_LONG: cpl_column_log_long(column, base); break; case CPL_TYPE_LONG_LONG: cpl_column_log_long_long(column, base); break; case CPL_TYPE_SIZE: cpl_column_log_cplsize(column, base); break; case CPL_TYPE_FLOAT: cpl_column_log_float(column, base); break; case CPL_TYPE_DOUBLE: cpl_column_log_double(column, base); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_column_log_float_complex(column, base); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_column_log_double_complex(column, base); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /* * @brief * Compute the absolute value of column values. * * @param column Target column. * * @return @c CPL_ERROR_NONE on success. If the input column is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the accessed column * is not numerical, a @c CPL_ERROR_INVALID_TYPE is returned. * * Columns of strings, or arrays, or complex, are not allowed. */ cpl_error_code cpl_column_absolute(cpl_column *column) { const char *fid = "cpl_column_absolute"; cpl_type type = cpl_column_get_type(column); cpl_size length; cpl_size nullcount; cpl_size i; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); switch (type) { case CPL_TYPE_INT: break; case CPL_TYPE_LONG: break; case CPL_TYPE_LONG_LONG: break; case CPL_TYPE_FLOAT: break; case CPL_TYPE_DOUBLE: break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } length = cpl_column_get_size(column); nullcount = cpl_column_count_invalid(column); if (nullcount == length) return CPL_ERROR_NONE; switch (type) { case CPL_TYPE_INT: { int *ip = cpl_column_get_data_int(column); for (i = 0; i < length; i++, ip++) *ip = abs(*ip); break; } case CPL_TYPE_LONG: { long *lp = cpl_column_get_data_long(column); for (i = 0; i < length; i++, lp++) *lp = labs(*lp); break; } case CPL_TYPE_LONG_LONG: { long long *lp = cpl_column_get_data_long_long(column); #if defined(HAVE_LLABS) && defined(HAVE_DECL_LLABS) for (i = 0; i < length; i++, lp++) *lp = llabs(*lp); #else for (i = 0; i < length; i++, lp++) *lp = *lp < 0LL ? -(*lp) : *lp; #endif break; } case CPL_TYPE_SIZE: { cpl_size *lp = cpl_column_get_data_cplsize(column); #if defined(HAVE_LLABS) && defined(HAVE_DECL_LLABS) for (i = 0; i < length; i++, lp++) *lp = llabs(*lp); #else for (i = 0; i < length; i++, lp++) *lp = *lp < 0LL ? -(*lp) : *lp; #endif break; } case CPL_TYPE_FLOAT: { float *fp = cpl_column_get_data_float(column); for (i = 0; i < length; i++, fp++) *fp = fabsf(*fp); break; } case CPL_TYPE_DOUBLE: { double *dp = cpl_column_get_data_double(column); for (i = 0; i < length; i++, dp++) *dp = fabs(*dp); break; } default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /* * @brief * Compute the absolute value of column complex values. * * @param column Target column. * * @return New column of type CPL_TYPE_(FLOAT|DOUBLE) if input type * is CPL_TYPE_(FLOAT|DOUBLE)_COMPLEX, NULL in case of error. * * Columns of strings, of integers, or arrays, are not allowed. */ cpl_column *cpl_column_absolute_complex(cpl_column *column) { const char *fid = "cpl_column_absolute_complex"; cpl_type type = cpl_column_get_type(column); cpl_column *new_column; cpl_size length; cpl_size nullcount; cpl_size i; if (column == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } length = cpl_column_get_size(column); switch (type) { case CPL_TYPE_FLOAT_COMPLEX: new_column = cpl_column_new_float(length); break; case CPL_TYPE_DOUBLE_COMPLEX: new_column = cpl_column_new_double(length); break; default: cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } nullcount = cpl_column_count_invalid(column); if (nullcount == length) return new_column; new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } switch (type) { case CPL_TYPE_FLOAT_COMPLEX: { float complex *cfp = cpl_column_get_data_float_complex(column); float *fp = cpl_column_get_data_float(new_column); for (i = 0; i < length; i++, fp++, cfp++) *fp = cabsf(*cfp); break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *cdp = cpl_column_get_data_double_complex(column); double *dp = cpl_column_get_data_double(new_column); for (i = 0; i < length; i++, dp++, cdp++) *dp = cabs(*cdp); break; } default: { cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); cpl_column_delete(new_column); return NULL; } } return new_column; } /* * @brief * Compute the phase of column complex values. * * @param column Target column. * * @return New column of type CPL_TYPE_(FLOAT|DOUBLE) if input type * is CPL_TYPE_(FLOAT|DOUBLE)_COMPLEX, NULL in case of error. * * The computed phase angles are in the range [-pi,pi]. * Columns of strings, of integers, or arrays, are not allowed. */ cpl_column *cpl_column_phase_complex(cpl_column *column) { const char *fid = "cpl_column_phase_complex"; cpl_type type = cpl_column_get_type(column); cpl_column *new_column; cpl_size length; cpl_size nullcount; cpl_size i; if (column == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } length = cpl_column_get_size(column); switch (type) { case CPL_TYPE_FLOAT_COMPLEX: new_column = cpl_column_new_float(length); break; case CPL_TYPE_DOUBLE_COMPLEX: new_column = cpl_column_new_double(length); break; default: cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } nullcount = cpl_column_count_invalid(column); if (nullcount == length) return new_column; new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } switch (type) { case CPL_TYPE_FLOAT_COMPLEX: { float complex *cfp = cpl_column_get_data_float_complex(column); float *fp = cpl_column_get_data_float(new_column); for (i = 0; i < length; i++, fp++, cfp++) *fp = cargf(*cfp); break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *cdp = cpl_column_get_data_double_complex(column); double *dp = cpl_column_get_data_double(new_column); for (i = 0; i < length; i++, dp++, cdp++) *dp = carg(*cdp); break; } default: { cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); cpl_column_delete(new_column); return NULL; } } return new_column; } /* * @brief * Extract the real part of column complex values. * * @param column Target column. * * @return New column of type CPL_TYPE_(FLOAT|DOUBLE) if input type * is CPL_TYPE_(FLOAT|DOUBLE)_COMPLEX, NULL in case of error. * * Columns of strings, integers, or arrays, are not allowed. */ cpl_column *cpl_column_extract_real(cpl_column *column) { const char *fid = "cpl_column_extract_real"; cpl_type type = cpl_column_get_type(column); cpl_column *new_column; cpl_size length; cpl_size nullcount; cpl_size i; if (column == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } length = cpl_column_get_size(column); switch (type) { case CPL_TYPE_FLOAT_COMPLEX: new_column = cpl_column_new_float(length); break; case CPL_TYPE_DOUBLE_COMPLEX: new_column = cpl_column_new_double(length); break; default: cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } nullcount = cpl_column_count_invalid(column); if (nullcount == length) return new_column; new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } switch (type) { case CPL_TYPE_FLOAT_COMPLEX: { float complex *cfp = cpl_column_get_data_float_complex(column); float *fp = cpl_column_get_data_float(new_column); for (i = 0; i < length; i++, fp++, cfp++) *fp = crealf(*cfp); break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *cdp = cpl_column_get_data_double_complex(column); double *dp = cpl_column_get_data_double(new_column); for (i = 0; i < length; i++, dp++, cdp++) *dp = creal(*cdp); break; } default: { cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); cpl_column_delete(new_column); return NULL; } } return new_column; } /* * @brief * Extract the imaginary part of column complex values. * * @param column Target column. * * @return New column of type CPL_TYPE_(FLOAT|DOUBLE) if input type * is CPL_TYPE_(FLOAT|DOUBLE)_COMPLEX, NULL in case of error. * * Columns of strings, integers, or arrays, are not allowed. */ cpl_column *cpl_column_extract_imag(cpl_column *column) { const char *fid = "cpl_column_extract_imag"; cpl_type type = cpl_column_get_type(column); cpl_column *new_column; cpl_size length; cpl_size nullcount; cpl_size i; if (column == 0x0) { cpl_error_set(fid, CPL_ERROR_NULL_INPUT); return NULL; } length = cpl_column_get_size(column); switch (type) { case CPL_TYPE_FLOAT_COMPLEX: new_column = cpl_column_new_float(length); break; case CPL_TYPE_DOUBLE_COMPLEX: new_column = cpl_column_new_double(length); break; default: cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return NULL; } nullcount = cpl_column_count_invalid(column); if (nullcount == length) return new_column; new_column->nullcount = column->nullcount; if (column->null) { new_column->null = cpl_malloc(length * sizeof(cpl_column_flag)); memcpy(new_column->null, column->null, length * sizeof(cpl_column_flag)); } switch (type) { case CPL_TYPE_FLOAT_COMPLEX: { float complex *cfp = cpl_column_get_data_float_complex(column); float *fp = cpl_column_get_data_float(new_column); for (i = 0; i < length; i++, fp++, cfp++) *fp = cimagf(*cfp); break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *cdp = cpl_column_get_data_double_complex(column); double *dp = cpl_column_get_data_double(new_column); for (i = 0; i < length; i++, dp++, cdp++) *dp = cimag(*cdp); break; } default: { cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); cpl_column_delete(new_column); return NULL; } } return new_column; } /* * @brief * Compute the exponential of column values. * * @param column Target column. * @param base Exponential base. * * @return @c CPL_ERROR_NONE on success. If the input column is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the accessed column * is not numerical, a @c CPL_ERROR_INVALID_TYPE is returned. If the * @em base is not greater than zero, a @c CPL_ERROR_ILLEGAL_INPUT is * returned. * * The operation is always performed in double precision, with a final * cast of the result to the target column type. Columns of strings or * arrays are not allowed. */ cpl_error_code cpl_column_exponential(cpl_column *column, double base) { const char *fid = "cpl_column_exponential"; cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (base <= 0.0) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); switch (type) { case CPL_TYPE_INT: cpl_column_exp_int(column, base); break; case CPL_TYPE_LONG: cpl_column_exp_long(column, base); break; case CPL_TYPE_LONG_LONG: cpl_column_exp_long_long(column, base); break; case CPL_TYPE_SIZE: cpl_column_exp_cplsize(column, base); break; case CPL_TYPE_FLOAT: cpl_column_exp_float(column, base); break; case CPL_TYPE_DOUBLE: cpl_column_exp_double(column, base); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_column_exp_float_complex(column, base); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_column_exp_double_complex(column, base); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } cpl_error_code cpl_column_conjugate(cpl_column *column) { const char *fid = "cpl_column_conjugate"; cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); switch (type) { case CPL_TYPE_FLOAT: case CPL_TYPE_DOUBLE: break; case CPL_TYPE_FLOAT_COMPLEX: cpl_column_conj_float(column); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_column_conj_double(column); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /* * @brief * Compute a power of column values. * * @param column Target column. * @param exponent Constant exponent. * * @return @c CPL_ERROR_NONE on success. If the input column is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the accessed column * is not numerical, a @c CPL_ERROR_INVALID_TYPE is returned. * * The operation is always performed in double precision, with a final * cast of the result to the target column type. Non-positive column * values will be marked as invalid. Columns of strings or arrays are * not allowed. */ cpl_error_code cpl_column_power(cpl_column *column, double exponent) { const char *fid = "cpl_column_power"; cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); switch (type) { case CPL_TYPE_INT: cpl_column_pow_int(column, exponent); break; case CPL_TYPE_LONG: cpl_column_pow_long(column, exponent); break; case CPL_TYPE_LONG_LONG: cpl_column_pow_long_long(column, exponent); break; case CPL_TYPE_SIZE: cpl_column_pow_cplsize(column, exponent); break; case CPL_TYPE_FLOAT: cpl_column_pow_float(column, exponent); break; case CPL_TYPE_DOUBLE: cpl_column_pow_double(column, exponent); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_column_pow_float_complex(column, exponent); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_column_pow_double_complex(column, exponent); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /* * @brief * Add a constant value to a numerical column. * * @param column Target column. * @param value Value to add. * * @return @c CPL_ERROR_NONE on success. If the input column is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the accessed column * is not numerical, a @c CPL_ERROR_INVALID_TYPE is returned. * * The operation is always performed in double precision, with a final * cast of the result to the target column type. Invalid flags are not * modified by this operation. Columns of strings or arrays are not allowed. */ cpl_error_code cpl_column_add_scalar(cpl_column *column, double value) { const char *fid = "cpl_column_add_scalar"; cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); switch (type) { case CPL_TYPE_INT: cpl_column_add_to_int(column, value); break; case CPL_TYPE_LONG: cpl_column_add_to_long(column, value); break; case CPL_TYPE_LONG_LONG: cpl_column_add_to_long_long(column, value); break; case CPL_TYPE_SIZE: cpl_column_add_to_cplsize(column, value); break; case CPL_TYPE_FLOAT: cpl_column_add_to_float(column, value); break; case CPL_TYPE_DOUBLE: cpl_column_add_to_double(column, value); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_column_add_to_float_complex(column, value); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_column_add_to_double_complex(column, value); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } cpl_error_code cpl_column_add_scalar_complex(cpl_column *column, double complex value) { const char *fid = "cpl_column_add_scalar_complex"; cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); switch (type) { case CPL_TYPE_FLOAT: cpl_column_add_to_float(column, value); break; case CPL_TYPE_DOUBLE: cpl_column_add_to_double(column, value); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_column_add_to_float_complex(column, value); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_column_add_to_double_complex(column, value); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /* * @brief * Subtract a constant value from a numerical column. * * @param column Target column. * @param value Value to subtract. * * @return @c CPL_ERROR_NONE on success. If the input column is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the accessed column * is not numerical, a @c CPL_ERROR_INVALID_TYPE is returned. * * The operation is always performed in double precision, with a final * cast of the result to the target column type. Invalid flags are not * modified by this operation. Columns of strings or arrays are not allowed. */ cpl_error_code cpl_column_subtract_scalar(cpl_column *column, double value) { return cpl_column_add_scalar(column, -value); } cpl_error_code cpl_column_subtract_scalar_complex(cpl_column *column, double complex value) { return cpl_column_add_scalar_complex(column, -value); } /* * @brief * Multiply by a constant a numerical column. * * @param column Target column. * @param value Multiplier. * * @return @c CPL_ERROR_NONE on success. If the input column is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the accessed column * is not numerical, a @c CPL_ERROR_INVALID_TYPE is returned. * * The operation is always performed in double precision, with a final * cast of the result to the target column type. Invalid flags are not * modified by this operation. Columns of strings or arrays are not allowed. */ cpl_error_code cpl_column_multiply_scalar(cpl_column *column, double value) { const char *fid = "cpl_column_multiply_scalar"; cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); switch (type) { case CPL_TYPE_INT: cpl_column_mul_double_to_int(column, value); break; case CPL_TYPE_LONG: cpl_column_mul_double_to_long(column, value); break; case CPL_TYPE_LONG_LONG: cpl_column_mul_double_to_long_long(column, value); break; case CPL_TYPE_SIZE: cpl_column_mul_double_to_cplsize(column, value); break; case CPL_TYPE_FLOAT: cpl_column_mul_double_to_float(column, value); break; case CPL_TYPE_DOUBLE: cpl_column_mul_to_double(column, value); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_column_mul_double_to_float_complex(column, value); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_column_mul_to_double_complex(column, value); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } cpl_error_code cpl_column_multiply_scalar_complex(cpl_column *column, double complex value) { const char *fid = "cpl_column_multiply_scalar_complex"; cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); switch (type) { case CPL_TYPE_FLOAT: cpl_column_mul_double_to_float(column, value); break; case CPL_TYPE_DOUBLE: cpl_column_mul_to_double(column, value); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_column_mul_double_to_float_complex(column, value); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_column_mul_to_double_complex(column, value); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /* * @brief * Divide by a constant a numerical column. * * @param column Target column. * @param value Divisor. * * @return @c CPL_ERROR_NONE on success. If the input column is a @c NULL * pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the accessed column * is not numerical, a @c CPL_ERROR_INVALID_TYPE is returned. If the input * @em value is zero, a @c CPL_ERROR_DIVISION_BY_ZERO is returned. * * The operation is always performed in double precision, with a final * cast of the result to the target column type. Invalid flags are not * modified by this operation. Columns of strings or arrays are not allowed. */ cpl_error_code cpl_column_divide_scalar(cpl_column *column, double value) { const char *fid = "cpl_column_divide_scalar"; cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (value == 0.0) return cpl_error_set(fid, CPL_ERROR_DIVISION_BY_ZERO); value = 1 / value; switch (type) { case CPL_TYPE_INT: cpl_column_mul_double_to_int(column, value); break; case CPL_TYPE_LONG: cpl_column_mul_double_to_long(column, value); break; case CPL_TYPE_LONG_LONG: cpl_column_mul_double_to_long_long(column, value); break; case CPL_TYPE_SIZE: cpl_column_mul_double_to_cplsize(column, value); break; case CPL_TYPE_FLOAT: cpl_column_mul_double_to_float(column, value); break; case CPL_TYPE_DOUBLE: cpl_column_mul_to_double(column, value); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_column_mul_double_to_float_complex(column, value); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_column_mul_to_double_complex(column, value); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } cpl_error_code cpl_column_divide_scalar_complex(cpl_column *column, double complex value) { const char *fid = "cpl_column_divide_scalar_complex"; cpl_type type = cpl_column_get_type(column); if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (value == 0.0) return cpl_error_set(fid, CPL_ERROR_DIVISION_BY_ZERO); value = 1 / value; switch (type) { case CPL_TYPE_FLOAT: cpl_column_mul_double_to_float(column, value); break; case CPL_TYPE_DOUBLE: cpl_column_mul_to_double(column, value); break; case CPL_TYPE_FLOAT_COMPLEX: cpl_column_mul_double_to_float_complex(column, value); break; case CPL_TYPE_DOUBLE_COMPLEX: cpl_column_mul_to_double_complex(column, value); break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /* * @brief * Compute the mean value of a numeric column. * * @param column Input column. * * @return Mean value. In case of error, this is set to 0.0. * * If the input @em column is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is * set. If the accessed column is not numerical, a @c CPL_ERROR_INVALID_TYPE * is set. If the input column elements are all invalid, or the column has * zero length, a @c CPL_ERROR_DATA_NOT_FOUND is set. * * Column values marked as invalid are excluded from the computation. * The column must contain at least one valid value. Columns of strings or * arrays are not allowed. */ double cpl_column_get_mean(cpl_column *column) { const char *fid = "cpl_column_get_mean"; cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); cpl_type type = cpl_column_get_type(column); double mean = 0.0; cpl_size count = length - nullcount; cpl_size i; int *np; if (column == 0x0) { cpl_error_set_where(fid); return 0.0; } if (nullcount == length || length == 0) { cpl_error_set(fid, CPL_ERROR_DATA_NOT_FOUND); return 0.0; } np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (nullcount == 0) for (i = 0; i < length; i++) mean += *ip++; else for (i = 0; i < length; i++, ip++, np++) if (*np == 0) mean += *ip; break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (nullcount == 0) for (i = 0; i < length; i++) mean += *lp++; else for (i = 0; i < length; i++, lp++, np++) if (*np == 0) mean += *lp; break; } case CPL_TYPE_LONG_LONG: { long long *lp = column->values->ll; if (nullcount == 0) for (i = 0; i < length; i++) mean += *lp++; else for (i = 0; i < length; i++, lp++, np++) if (*np == 0) mean += *lp; break; } case CPL_TYPE_SIZE: { cpl_size *lp = column->values->sz; if (nullcount == 0) for (i = 0; i < length; i++) mean += *lp++; else for (i = 0; i < length; i++, lp++, np++) if (*np == 0) mean += *lp; break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (nullcount == 0) for (i = 0; i < length; i++) mean += *fp++; else for (i = 0; i < length; i++, fp++, np++) if (*np == 0) mean += *fp; break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (nullcount == 0) for (i = 0; i < length; i++) mean += *dp++; else for (i = 0; i < length; i++, dp++, np++) if (*np == 0) mean += *dp; break; } default: cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); break; } return (mean / count); } /* It works with numeric types too... */ double complex cpl_column_get_mean_complex(cpl_column *column) { const char *fid = "cpl_column_get_mean_complex"; cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); cpl_type type = cpl_column_get_type(column); double complex mean = 0.0; cpl_size count = length - nullcount; cpl_size i; int *np; if (column == 0x0) { cpl_error_set_where(fid); return 0.0; } if (nullcount == length || length == 0) { cpl_error_set(fid, CPL_ERROR_DATA_NOT_FOUND); return 0.0; } np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (nullcount == 0) for (i = 0; i < length; i++) mean += *ip++; else for (i = 0; i < length; i++, ip++, np++) if (*np == 0) mean += *ip; break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (nullcount == 0) for (i = 0; i < length; i++) mean += *lp++; else for (i = 0; i < length; i++, lp++, np++) if (*np == 0) mean += *lp; break; } case CPL_TYPE_LONG_LONG: { long long *lp = column->values->ll; if (nullcount == 0) for (i = 0; i < length; i++) mean += *lp++; else for (i = 0; i < length; i++, lp++, np++) if (*np == 0) mean += *lp; break; } case CPL_TYPE_SIZE: { cpl_size *lp = column->values->sz; if (nullcount == 0) for (i = 0; i < length; i++) mean += *lp++; else for (i = 0; i < length; i++, lp++, np++) if (*np == 0) mean += *lp; break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (nullcount == 0) for (i = 0; i < length; i++) mean += *fp++; else for (i = 0; i < length; i++, fp++, np++) if (*np == 0) mean += *fp; break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (nullcount == 0) for (i = 0; i < length; i++) mean += *dp++; else for (i = 0; i < length; i++, dp++, np++) if (*np == 0) mean += *dp; break; } case CPL_TYPE_FLOAT_COMPLEX: { float complex *cfp = column->values->cf; if (nullcount == 0) for (i = 0; i < length; i++) mean += *cfp++; else for (i = 0; i < length; i++, cfp++, np++) if (*np == 0) mean += *cfp; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *cdp = column->values->cd; if (nullcount == 0) for (i = 0; i < length; i++) mean += *cdp++; else for (i = 0; i < length; i++, cdp++, np++) if (*np == 0) mean += *cdp; break; } default: cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); break; } return (mean / count); } double cpl_column_get_stdev(cpl_column *column) { const char *fid = "cpl_column_get_stdev"; cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); cpl_type type = cpl_column_get_type(column); double stdev = 0.0; double mean; double delta; cpl_size count = length - nullcount; cpl_size i; int *np; if (column == 0x0) { cpl_error_set_where(fid); return 0.0; } if (nullcount == length || length == 0) { cpl_error_set(fid, CPL_ERROR_DATA_NOT_FOUND); return 0.0; } if (count == 1) return 0.0; np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (nullcount == 0) stdev = cpl_tools_get_variancesum_int(ip, length, NULL); else { for (mean = 0, count = 0, i = 0; i < length; i++, ip++, np++) { if (*np == 0) { delta = *ip - mean; stdev += (double)count / (count + 1) * delta * delta; count++; mean += delta / count; } } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (nullcount == 0) stdev = cpl_tools_get_variancesum_long(lp, length, NULL); else { for (mean = 0, count = 0, i = 0; i < length; i++, lp++, np++) { if (*np == 0) { delta = *lp - mean; stdev += (double)count / (count + 1) * delta * delta; count++; mean += delta / count; } } } break; } case CPL_TYPE_LONG_LONG: { long long *lp = column->values->ll; if (nullcount == 0) stdev = cpl_tools_get_variancesum_long_long(lp, length, NULL); else { for (mean = 0, count = 0, i = 0; i < length; i++, lp++, np++) { if (*np == 0) { delta = *lp - mean; stdev += (double)count / (count + 1) * delta * delta; count++; mean += delta / count; } } } break; } case CPL_TYPE_SIZE: { cpl_size *lp = column->values->sz; if (nullcount == 0) stdev = cpl_tools_get_variancesum_cplsize(lp, length, NULL); else { for (mean = 0, count = 0, i = 0; i < length; i++, lp++, np++) { if (*np == 0) { delta = *lp - mean; stdev += (double)count / (count + 1) * delta * delta; count++; mean += delta / count; } } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (nullcount == 0) stdev = cpl_tools_get_variancesum_float(fp, length, NULL); else { for (mean = 0, count = 0, i = 0; i < length; i++, fp++, np++) { if (*np == 0) { delta = *fp - mean; stdev += (double)count / (count + 1) * delta * delta; count++; mean += delta / count; } } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (nullcount == 0) stdev = cpl_tools_get_variancesum_double(dp, length, NULL); else { for (mean = 0, count = 0, i = 0; i < length; i++, dp++, np++) { if (*np == 0) { delta = *dp - mean; stdev += (double)count / (count + 1) * delta * delta; count++; mean += delta / count; } } } break; } default: cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); break; } return sqrt(stdev / (count - 1)); } /* * @brief * Get maximum value in a numerical column. * * @param column Input column. * * @return Maximum value. In case of error, this is set to 0.0. * * If the input @em column is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is * set. If the accessed column is not numerical, a @c CPL_ERROR_INVALID_TYPE * is set. If the input column elements are all invalid, or the column has * zero length, a @c CPL_ERROR_DATA_NOT_FOUND is set. * * Column values marked as invalid are excluded from the search. * The column must contain at least one valid value. Columns of strings or * arrays are not allowed. */ double cpl_column_get_max(cpl_column *column) { const char *fid = "cpl_column_get_max"; cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); cpl_type type = cpl_column_get_type(column); int first = 1; int *np; double maximum = 0; cpl_size i; if (column == 0x0) { cpl_error_set_where(fid); return 0.0; } if (nullcount == length || length == 0) { cpl_error_set(fid, CPL_ERROR_DATA_NOT_FOUND); return 0.0; } np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (length == 1) return *ip; if (nullcount == 0) { maximum = *ip++; for (i = 1; i < length; i++, ip++) if (maximum < *ip) maximum = *ip; } else { for (i = 0; i < length; i++, ip++, np++) { if (*np == 0) { if (first) { first = 0; maximum = *ip; } else if (maximum < *ip) maximum = *ip; } } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (length == 1) return *lp; if (nullcount == 0) { maximum = *lp++; for (i = 1; i < length; i++, lp++) if (maximum < *lp) maximum = *lp; } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (first) { first = 0; maximum = *lp; } else if (maximum < *lp) maximum = *lp; } } } break; } case CPL_TYPE_LONG_LONG: { long long *lp = column->values->ll; if (length == 1) return *lp; if (nullcount == 0) { maximum = *lp++; for (i = 1; i < length; i++, lp++) if (maximum < *lp) maximum = *lp; } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (first) { first = 0; maximum = *lp; } else if (maximum < *lp) maximum = *lp; } } } break; } case CPL_TYPE_SIZE: { cpl_size *lp = column->values->sz; if (length == 1) return *lp; if (nullcount == 0) { maximum = *lp++; for (i = 1; i < length; i++, lp++) if (maximum < *lp) maximum = *lp; } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (first) { first = 0; maximum = *lp; } else if (maximum < *lp) maximum = *lp; } } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (length == 1) return *fp; if (nullcount == 0) { maximum = *fp++; for (i = 1; i < length; i++, fp++) if (maximum < *fp) maximum = *fp; } else { for (i = 0; i < length; i++, fp++, np++) { if (*np == 0) { if (first) { first = 0; maximum = *fp; } else if (maximum < *fp) maximum = *fp; } } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (length == 1) return *dp; if (nullcount == 0) { maximum = *dp++; for (i = 1; i < length; i++, dp++) if (maximum < *dp) maximum = *dp; } else { for (i = 0; i < length; i++, dp++, np++) { if (*np == 0) { if (first) { first = 0; maximum = *dp; } else if (maximum < *dp) maximum = *dp; } } } break; } default: cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return 0.0; } return maximum; } /* * @brief * Get minimum value in a numerical column. * * @param column Input column. * * @return Minimum value. In case of error, this is set to 0.0. * * If the input @em column is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is * set. If the accessed column is not numerical, a @c CPL_ERROR_INVALID_TYPE * is set. If the input column elements are all invalid, or the column has * zero length, a @c CPL_ERROR_DATA_NOT_FOUND is set. * * Column values marked as invalid are excluded from the search. * The column must contain at least one valid value. Columns of strings or * arrays are not allowed. */ double cpl_column_get_min(cpl_column *column) { const char *fid = "cpl_column_get_min"; cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); cpl_type type = cpl_column_get_type(column); int first = 1; int *np; double minimum = 0; cpl_size i; if (column == 0x0) { cpl_error_set_where(fid); return 0.0; } if (nullcount == length || length == 0) { cpl_error_set(fid, CPL_ERROR_DATA_NOT_FOUND); return 0.0; } np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (length == 1) return *ip; if (nullcount == 0) { minimum = *ip++; for (i = 1; i < length; i++, ip++) if (minimum > *ip) minimum = *ip; } else { for (i = 0; i < length; i++, ip++, np++) { if (*np == 0) { if (first) { first = 0; minimum = *ip; } else if (minimum > *ip) minimum = *ip; } } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (length == 1) return *lp; if (nullcount == 0) { minimum = *lp++; for (i = 1; i < length; i++, lp++) if (minimum > *lp) minimum = *lp; } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (first) { first = 0; minimum = *lp; } else if (minimum > *lp) minimum = *lp; } } } break; } case CPL_TYPE_LONG_LONG: { long long *lp = column->values->ll; if (length == 1) return *lp; if (nullcount == 0) { minimum = *lp++; for (i = 1; i < length; i++, lp++) if (minimum > *lp) minimum = *lp; } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (first) { first = 0; minimum = *lp; } else if (minimum > *lp) minimum = *lp; } } } break; } case CPL_TYPE_SIZE: { cpl_size *lp = column->values->sz; if (length == 1) return *lp; if (nullcount == 0) { minimum = *lp++; for (i = 1; i < length; i++, lp++) if (minimum > *lp) minimum = *lp; } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (first) { first = 0; minimum = *lp; } else if (minimum > *lp) minimum = *lp; } } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (length == 1) return *fp; if (nullcount == 0) { minimum = *fp++; for (i = 1; i < length; i++, fp++) if (minimum > *fp) minimum = *fp; } else { for (i = 0; i < length; i++, fp++, np++) { if (*np == 0) { if (first) { first = 0; minimum = *fp; } else if (minimum > *fp) minimum = *fp; } } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (length == 1) return *dp; if (nullcount == 0) { minimum = *dp++; for (i = 1; i < length; i++, dp++) if (minimum > *dp) minimum = *dp; } else { for (i = 0; i < length; i++, dp++, np++) { if (*np == 0) { if (first) { first = 0; minimum = *dp; } else if (minimum > *dp) minimum = *dp; } } } break; } default: cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); return 0.0; } return minimum; } /* * @brief * Get position of maximum in a numerical column. * * @param column Input column. * @param indx Returned position of maximum value. * * @return @c CPL_ERROR_NONE on success. If any input argument is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the * accessed column is not numerical, a @c CPL_ERROR_INVALID_TYPE * is returned. If the input column elements are all invalid, or * the column has zero length, a @c CPL_ERROR_DATA_NOT_FOUND is * returned. * * Column values marked as invalid are excluded from the search. * The @em indx argument will be assigned the position of the maximum * value. Indexes are counted starting from 0. If more than one column * element correspond to the max value, the position with the lowest * indx is returned. In case of error, @em indx is set to zero. * Columns of strings or arrays are not allowed. */ cpl_error_code cpl_column_get_maxpos(cpl_column *column, cpl_size *indx) { const char *fid = "cpl_column_get_maxpos"; cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); cpl_type type = cpl_column_get_type(column); int first = 1; int *np; double maximum = 0; cpl_size i; if (column == 0x0 || indx == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (nullcount == length || length == 0) return cpl_error_set(fid, CPL_ERROR_DATA_NOT_FOUND); *indx = 0; if (length == 1) return CPL_ERROR_NONE; np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (nullcount == 0) { maximum = *ip++; for (i = 1; i < length; i++, ip++) { if (maximum < *ip) { maximum = *ip; *indx = i; } } } else { for (i = 0; i < length; i++, ip++, np++) { if (*np == 0) { if (first) { first = 0; maximum = *ip; *indx = i; } else { if (maximum < *ip) { maximum = *ip; *indx = i; } } } } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (nullcount == 0) { maximum = *lp++; for (i = 1; i < length; i++, lp++) { if (maximum < *lp) { maximum = *lp; *indx = i; } } } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (first) { first = 0; maximum = *lp; *indx = i; } else { if (maximum < *lp) { maximum = *lp; *indx = i; } } } } } break; } case CPL_TYPE_LONG_LONG: { long long *lp = column->values->ll; if (nullcount == 0) { maximum = *lp++; for (i = 1; i < length; i++, lp++) { if (maximum < *lp) { maximum = *lp; *indx = i; } } } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (first) { first = 0; maximum = *lp; *indx = i; } else { if (maximum < *lp) { maximum = *lp; *indx = i; } } } } } break; } case CPL_TYPE_SIZE: { cpl_size *lp = column->values->sz; if (nullcount == 0) { maximum = *lp++; for (i = 1; i < length; i++, lp++) { if (maximum < *lp) { maximum = *lp; *indx = i; } } } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (first) { first = 0; maximum = *lp; *indx = i; } else { if (maximum < *lp) { maximum = *lp; *indx = i; } } } } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (nullcount == 0) { maximum = *fp++; for (i = 1; i < length; i++, fp++) { if (maximum < *fp) { maximum = *fp; *indx = i; } } } else { for (i = 0; i < length; i++, fp++, np++) { if (*np == 0) { if (first) { first = 0; maximum = *fp; *indx = i; } else { if (maximum < *fp) { maximum = *fp; *indx = i; } } } } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (nullcount == 0) { maximum = *dp++; for (i = 1; i < length; i++, dp++) { if (maximum < *dp) { maximum = *dp; *indx = i; } } } else { for (i = 0; i < length; i++, dp++, np++) { if (*np == 0) { if (first) { first = 0; maximum = *dp; *indx = i; } else { if (maximum < *dp) { maximum = *dp; *indx = i; } } } } } break; } default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /* * @brief * Get position of minimum in a numerical column. * * @param column Input column. * @param indx Returned position of minimum value. * * @return @c CPL_ERROR_NONE on success. If any input argument is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the * accessed column is not numerical, a @c CPL_ERROR_INVALID_TYPE * is returned. If the input column elements are all invalid, or * the column has zero length, a @c CPL_ERROR_DATA_NOT_FOUND is * returned. * * Column values marked as invalid are excluded from the search. * The @em indx argument will be assigned the position of the minimum * value. Indexes are counted starting from 0. If more than one column * element correspond to the min value, the position with the lowest * index is returned. In case of error, @em indx is set to zero. * Columns of strings or arrays are not allowed. */ cpl_error_code cpl_column_get_minpos(cpl_column *column, cpl_size *indx) { const char *fid = "cpl_column_get_minpos"; cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); cpl_type type = cpl_column_get_type(column); int first = 1; int *np; double minimum = 0; cpl_size i; if (column == 0x0 || indx == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (nullcount == length || length == 0) return cpl_error_set(fid, CPL_ERROR_DATA_NOT_FOUND); *indx = 0; if (length == 1) return CPL_ERROR_NONE; np = column->null; switch (type) { case CPL_TYPE_INT: { int *ip = column->values->i; if (nullcount == 0) { minimum = *ip++; for (i = 1; i < length; i++, ip++) { if (minimum > *ip) { minimum = *ip; *indx = i; } } } else { for (i = 0; i < length; i++, ip++, np++) { if (*np == 0) { if (first) { first = 0; minimum = *ip; *indx = i; } else { if (minimum > *ip) { minimum = *ip; *indx = i; } } } } } break; } case CPL_TYPE_LONG: { long *lp = column->values->l; if (nullcount == 0) { minimum = *lp++; for (i = 1; i < length; i++, lp++) { if (minimum > *lp) { minimum = *lp; *indx = i; } } } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (first) { first = 0; minimum = *lp; *indx = i; } else { if (minimum > *lp) { minimum = *lp; *indx = i; } } } } } break; } case CPL_TYPE_LONG_LONG: { long long *lp = column->values->ll; if (nullcount == 0) { minimum = *lp++; for (i = 1; i < length; i++, lp++) { if (minimum > *lp) { minimum = *lp; *indx = i; } } } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (first) { first = 0; minimum = *lp; *indx = i; } else { if (minimum > *lp) { minimum = *lp; *indx = i; } } } } } break; } case CPL_TYPE_SIZE: { cpl_size *lp = column->values->sz; if (nullcount == 0) { minimum = *lp++; for (i = 1; i < length; i++, lp++) { if (minimum > *lp) { minimum = *lp; *indx = i; } } } else { for (i = 0; i < length; i++, lp++, np++) { if (*np == 0) { if (first) { first = 0; minimum = *lp; *indx = i; } else { if (minimum > *lp) { minimum = *lp; *indx = i; } } } } } break; } case CPL_TYPE_FLOAT: { float *fp = column->values->f; if (nullcount == 0) { minimum = *fp++; for (i = 1; i < length; i++, fp++) { if (minimum > *fp) { minimum = *fp; *indx = i; } } } else { for (i = 0; i < length; i++, fp++, np++) { if (*np == 0) { if (first) { first = 0; minimum = *fp; *indx = i; } else { if (minimum > *fp) { minimum = *fp; *indx = i; } } } } } break; } case CPL_TYPE_DOUBLE: { double *dp = column->values->d; if (nullcount == 0) { minimum = *dp++; for (i = 1; i < length; i++, dp++) { if (minimum > *dp) { minimum = *dp; *indx = i; } } } else { for (i = 0; i < length; i++, dp++, np++) { if (*np == 0) { if (first) { first = 0; minimum = *dp; *indx = i; } else { if (minimum > *dp) { minimum = *dp; *indx = i; } } } } } break; } default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } return CPL_ERROR_NONE; } /* * @brief * Find the median of an integer column. * * @param column Input column. * * @return Median. * * Invalid column values are excluded from the search. * The column must contain at least one valid value. * In case of failure, zero is returned. Columns of strings or * arrays are not allowed. */ static int cpl_column_median_int(cpl_column *column) { cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); int median = 0; cpl_size i, n; int *np; int *ip; int *cip; int *copybuf; n = length - nullcount; cip = copybuf = cpl_malloc(n * sizeof(int)); ip = column->values->i; np = column->null; if (nullcount) { for (i = 0; i < length; i++, np++, ip++) { if (*np == 0) { *cip = *ip; cip++; } } } else memcpy(copybuf, ip, length * sizeof(int)); median = cpl_tools_get_median_int(copybuf, n); cpl_free(copybuf); return median; } /* * @brief * Find the median of a long integer column. * * @param column Input column. * * @return Median. * * Invalid column values are excluded from the search. * The column must contain at least one valid value. * In case of failure, zero is returned. Columns of strings or * arrays are not allowed. */ static long cpl_column_median_long(cpl_column *column) { cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); long median = 0; cpl_size i, n; int *np; long *lp; long *clp; long *copybuf; n = length - nullcount; clp = copybuf = cpl_malloc(n * sizeof(long)); lp = column->values->l; np = column->null; if (nullcount) { for (i = 0; i < length; i++, np++, lp++) { if (*np == 0) { *clp = *lp; clp++; } } } else memcpy(copybuf, lp, length * sizeof(long)); median = cpl_tools_get_median_long(copybuf, n); cpl_free(copybuf); return median; } /* * @brief * Find the median of a long long integer column. * * @param column Input column. * * @return Median. * * Invalid column values are excluded from the search. * The column must contain at least one valid value. * In case of failure, zero is returned. Columns of strings or * arrays are not allowed. */ static long long cpl_column_median_long_long(cpl_column *column) { cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); long long median = 0; cpl_size i, n; int *np; long long *lp; long long *clp; long long *copybuf; n = length - nullcount; clp = copybuf = cpl_malloc(n * sizeof(long long)); lp = column->values->ll; np = column->null; if (nullcount) { for (i = 0; i < length; i++, np++, lp++) { if (*np == 0) { *clp = *lp; clp++; } } } else memcpy(copybuf, lp, length * sizeof(long long)); median = cpl_tools_get_median_long_long(copybuf, n); cpl_free(copybuf); return median; } /* * @brief * Find the median of a cpl_size column. * * @param column Input column. * * @return Median. * * Invalid column values are excluded from the search. * The column must contain at least one valid value. * In case of failure, zero is returned. Columns of strings or * arrays are not allowed. */ static cpl_size cpl_column_median_cplsize(cpl_column *column) { cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); cpl_size median = 0; cpl_size i, n; int *np; cpl_size *lp; cpl_size *clp; cpl_size *copybuf; n = length - nullcount; clp = copybuf = cpl_malloc(n * sizeof(cpl_size)); lp = column->values->sz; np = column->null; if (nullcount) { for (i = 0; i < length; i++, np++, lp++) { if (*np == 0) { *clp = *lp; clp++; } } } else memcpy(copybuf, lp, length * sizeof(cpl_size)); median = cpl_tools_get_median_cplsize(copybuf, n); cpl_free(copybuf); return median; } /* * @brief * Find the median of a float column. * * @param column Input column. * * @return Median. * * Column values flagged as NULLs are excluded from the search. * The column must contain at least one non-NULL value. * In case of failure, zero is returned. Columns of strings or * arrays are not allowed. */ static float cpl_column_median_float(cpl_column *column) { cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); float median = 0; cpl_size i, n; int *np; float *fp; float *cfp; float *copybuf; n = length - nullcount; cfp = copybuf = cpl_malloc(n * sizeof(float)); fp = column->values->f; np = column->null; if (nullcount) { for (i = 0; i < length; i++, np++, fp++) { if (*np == 0) { *cfp = *fp; cfp++; } } } else memcpy(copybuf, fp, length * sizeof(float)); median = cpl_tools_get_median_float(copybuf, n); cpl_free(copybuf); return median; } /* * @brief * Find the median of a double column. * * @param column Input column. * * @return Median. * * Column values flagged as NULLs are excluded from the search. * The column must contain at least one non-NULL value. * In case of failure, zero is returned. */ static double cpl_column_median_double(cpl_column *column) { cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); double median = 0; cpl_size i, n; int *np; double *dp; double *cdp; double *copybuf; n = length - nullcount; cdp = copybuf = cpl_malloc(n * sizeof(double)); dp = column->values->d; np = column->null; if (nullcount) { for (i = 0; i < length; i++, np++, dp++) { if (*np == 0) { *cdp = *dp; cdp++; } } } else memcpy(copybuf, dp, length * sizeof(double)); median = cpl_tools_get_median_double(copybuf, n); cpl_free(copybuf); return median; } /* * @brief * Find the median of a numerical column. * * @param column Input column. * * @return Median. In case of error, 0.0 is always returned. * * If the input column is a @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is set. * If the accessed column is not numerical, a @c CPL_ERROR_INVALID_TYPE is * set. If the input column elements are all invalid, or the column has zero * length, a @c CPL_ERROR_DATA_NOT_FOUND is returned. Invalid column elements * are excluded from the computation. The column must contain at least one * valid elements. Columns of strings or arrays are not allowed. */ double cpl_column_get_median(cpl_column *column) { const char *fid = "cpl_column_get_median"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); cpl_size nullcount = cpl_column_count_invalid(column); if (column == 0x0) { cpl_error_set_where(fid); return 0.0; } if (nullcount == length || length == 0) { cpl_error_set(fid, CPL_ERROR_DATA_NOT_FOUND); return 0.0; } switch (type) { case CPL_TYPE_INT: return (double)cpl_column_median_int(column); case CPL_TYPE_LONG: return (double)cpl_column_median_long(column); case CPL_TYPE_LONG_LONG: return (double)cpl_column_median_long_long(column); case CPL_TYPE_SIZE: return (double)cpl_column_median_cplsize(column); case CPL_TYPE_FLOAT: return (double)cpl_column_median_float(column); case CPL_TYPE_DOUBLE: return cpl_column_median_double(column); default: cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); break; } return 0.0; } /* * @brief * Shift numeric column elements. * * @param column Input column. * @param shift Shift column values by so many elements. * * @return @c CPL_ERROR_NONE on success. If the input @em column is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the * accessed column is not numerical, a @c CPL_ERROR_INVALID_TYPE * is returned. The specified shift must be in module less than * the column length, or a @c CPL_ERROR_ILLEGAL_INPUT is returned. * * All column elements are shifted by the specified amount. If @em shift * is positive, all elements will be moved toward the bottom of the column, * otherwise toward its top. The column elements that are left undefined * at either end of the column are marked as invalid. Columns of strings or * arrays are not allowed. */ cpl_error_code cpl_column_shift(cpl_column *column, cpl_size shift) { const char *fid = "cpl_column_shift"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); int status; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); /* * Allowed column types: */ switch (type) { case CPL_TYPE_INT: case CPL_TYPE_LONG: case CPL_TYPE_LONG_LONG: case CPL_TYPE_SIZE: case CPL_TYPE_FLOAT: case CPL_TYPE_DOUBLE: case CPL_TYPE_FLOAT_COMPLEX: case CPL_TYPE_DOUBLE_COMPLEX: break; default: return cpl_error_set(fid, CPL_ERROR_INVALID_TYPE); } #if defined(HAVE_LLABS) && defined(HAVE_DECL_LLABS) if (llabs(shift) >= length) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); #else if ((shift < 0 ? -shift : shift) >= length) return cpl_error_set(fid, CPL_ERROR_ILLEGAL_INPUT); #endif if (shift == 0) return CPL_ERROR_NONE; if (column->nullcount == length) return CPL_ERROR_NONE; /* * Invalid flags buffer handling first (because it may fail...) */ if (column->nullcount) { if (shift > 0) { cpl_size j = length - shift; cpl_column_flag *np1 = column->null + length; cpl_column_flag *np2 = np1 - shift; while (j--) *--np1 = *--np2; } else { cpl_size j = -shift; cpl_column_flag *np1 = column->null; cpl_column_flag *np2 = np1 - shift; while(j++ < length) *np1++ = *np2++; } } /* * Invalidate the leftovers */ if (shift > 0) status = cpl_column_fill_invalid(column, 0, shift); else status = cpl_column_fill_invalid(column, length + shift, -shift); if (status) return status; /* * Now shift the data. */ switch (type) { case CPL_TYPE_INT: { if (shift > 0) { cpl_size j = length - shift; int *ip1 = column->values->i + length; int *ip2 = ip1 - shift; while (j--) *--ip1 = *--ip2; } else { cpl_size j = -shift; int *ip1 = column->values->i; int *ip2 = ip1 - shift; while(j++ < length) *ip1++ = *ip2++; } break; } case CPL_TYPE_LONG: { if (shift > 0) { cpl_size j = length - shift; long *lp1 = column->values->l + length; long *lp2 = lp1 - shift; while (j--) *--lp1 = *--lp2; } else { cpl_size j = -shift; long *lp1 = column->values->l; long *lp2 = lp1 - shift; while(j++ < length) *lp1++ = *lp2++; } break; } case CPL_TYPE_LONG_LONG: { if (shift > 0) { cpl_size j = length - shift; long long *lp1 = column->values->ll + length; long long *lp2 = lp1 - shift; while (j--) *--lp1 = *--lp2; } else { cpl_size j = -shift; long long *lp1 = column->values->ll; long long *lp2 = lp1 - shift; while(j++ < length) *lp1++ = *lp2++; } break; } case CPL_TYPE_SIZE: { if (shift > 0) { cpl_size j = length - shift; cpl_size *lp1 = column->values->sz + length; cpl_size *lp2 = lp1 - shift; while (j--) *--lp1 = *--lp2; } else { cpl_size j = -shift; cpl_size *lp1 = column->values->sz; cpl_size *lp2 = lp1 - shift; while(j++ < length) *lp1++ = *lp2++; } break; } case CPL_TYPE_FLOAT: { if (shift > 0) { cpl_size j = length - shift; float *fp1 = column->values->f + length; float *fp2 = fp1 - shift; while (j--) *--fp1 = *--fp2; } else { cpl_size j = -shift; float *fp1 = column->values->f; float *fp2 = fp1 - shift; while(j++ < length) *fp1++ = *fp2++; } break; } case CPL_TYPE_DOUBLE: { if (shift > 0) { cpl_size j = length - shift; double *dp1 = column->values->d + length; double *dp2 = dp1 - shift; while (j--) *--dp1 = *--dp2; } else { cpl_size j = -shift; double *dp1 = column->values->d; double *dp2 = dp1 - shift; while(j++ < length) *dp1++ = *dp2++; } break; } case CPL_TYPE_FLOAT_COMPLEX: { if (shift > 0) { cpl_size j = length - shift; float complex *cfp1 = column->values->cf + length; float complex *cfp2 = cfp1 - shift; while (j--) *--cfp1 = *--cfp2; } else { cpl_size j = -shift; float complex *cfp1 = column->values->cf; float complex *cfp2 = cfp1 - shift; while(j++ < length) *cfp1++ = *cfp2++; } break; } case CPL_TYPE_DOUBLE_COMPLEX: { if (shift > 0) { cpl_size j = length - shift; double complex *cdp1 = column->values->cd + length; double complex *cdp2 = cdp1 - shift; while (j--) *--cdp1 = *--cdp2; } else { cpl_size j = -shift; double complex *cdp1 = column->values->cd; double complex *cdp2 = cdp1 - shift; while(j++ < length) *cdp1++ = *cdp2++; } break; } default: break; } return CPL_ERROR_NONE; } /* * @brief * Assign to invalid @em integer column elements a numeric code. * * @param column Input column. * @param code Code to write at invalid column elements. * * @return @c CPL_ERROR_NONE on success. If the input @em column is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the * accessed column is not @em integer or arrays of integers, * a @c CPL_ERROR_TYPE_MISMATCH is returned. * * In general the column elements that are marked as invalid * may contain any value, that should not be given any meaning * whatsoever. In order to export the column data (using a call * to @c cpl_column_get_data_int() ) to procedures that are external * to the CPL column system, it may turn out to be appropriate * assigning to all the invalid elements a special code value. * This code value will supposedly be recognized and handled * properly by the foreign method. Note that only existing invalid * elements will be coded as indicated: new invalid column elements * would still have their actual values undefined. Also, any further * processing of the column would not take care of maintaining the * assigned code to a given invalid column element: therefore the * code should be set just before it is actually needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_column_fill_invalid_int(cpl_column *column, int code) { const char *fid = "cpl_column_fill_invalid_int"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); int *np; int *ip; cpl_size i; cpl_column *acolumn; cpl_array **array; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (!(type & CPL_TYPE_INT)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (type & CPL_TYPE_POINTER) { array = cpl_column_get_data_array(column); while (length--) { if (array[length] == NULL) array[length] = cpl_array_new(column->depth, CPL_TYPE_INT); acolumn = cpl_array_get_column(array[length]); cpl_column_fill_invalid_int(acolumn, code); } return CPL_ERROR_NONE; } if (column->nullcount == 0) return CPL_ERROR_NONE; if (column->nullcount == length) { cpl_column_fill_int(column, 0, length, code); column->nullcount = length; /* Restore: they are still all NULL! */ return CPL_ERROR_NONE; } ip = cpl_column_get_data_int(column); np = cpl_column_get_data_invalid(column); for (i = 0; i < length; i++, np++, ip++) if (*np == 1) *ip = code; return CPL_ERROR_NONE; } /* * @brief * Assign to invalid @em long @em integer column elements a numeric code. * * @param column Input column. * @param code Code to write at invalid column elements. * * @return @c CPL_ERROR_NONE on success. If the input @em column is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the * accessed column is not @em long @em integer or arrays of long integers, * a @c CPL_ERROR_TYPE_MISMATCH is returned. * * In general the column elements that are marked as invalid * may contain any value, that should not be given any meaning * whatsoever. In order to export the column data (using a call * to @c cpl_column_get_data_long() ) to procedures that are external * to the CPL column system, it may turn out to be appropriate * assigning to all the invalid elements a special code value. * This code value will supposedly be recognized and handled * properly by the foreign method. Note that only existing invalid * elements will be coded as indicated: new invalid column elements * would still have their actual values undefined. Also, any further * processing of the column would not take care of maintaining the * assigned code to a given invalid column element: therefore the * code should be set just before it is actually needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_column_fill_invalid_long(cpl_column *column, long code) { const char *fid = "cpl_column_fill_invalid_long"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); int *np; long *lp; cpl_size i; cpl_column *acolumn; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (!(type & CPL_TYPE_LONG)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (type & CPL_TYPE_POINTER) { cpl_array **array = cpl_column_get_data_array(column); while (length--) { if (array[length] == NULL) array[length] = cpl_array_new(column->depth, CPL_TYPE_LONG); acolumn = cpl_array_get_column(array[length]); cpl_column_fill_invalid_long(acolumn, code); } return CPL_ERROR_NONE; } if (column->nullcount == 0) return CPL_ERROR_NONE; if (column->nullcount == length) { cpl_column_fill_long(column, 0, length, code); column->nullcount = length; /* Restore: they are still all NULL! */ return CPL_ERROR_NONE; } lp = cpl_column_get_data_long(column); np = cpl_column_get_data_invalid(column); for (i = 0; i < length; i++, np++, lp++) if (*np == 1) *lp = code; return CPL_ERROR_NONE; } /* * @brief * Assign to invalid @m long @em long @em integer column elements a * numeric code. * * @param column Input column. * @param code Code to write at invalid column elements. * * @return @c CPL_ERROR_NONE on success. If the input @em column is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the * accessed column is not @em long @em long @em integer or arrays of * long long integers, a @c CPL_ERROR_TYPE_MISMATCH is returned. * * In general the column elements that are marked as invalid * may contain any value, that should not be given any meaning * whatsoever. In order to export the column data (using a call * to @c cpl_column_get_data_long_long() ) to procedures that are * external to the CPL column system, it may turn out to be appropriate * assigning to all the invalid elements a special code value. * This code value will supposedly be recognized and handled * properly by the foreign method. Note that only existing invalid * elements will be coded as indicated: new invalid column elements * would still have their actual values undefined. Also, any further * processing of the column would not take care of maintaining the * assigned code to a given invalid column element: therefore the * code should be set just before it is actually needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_column_fill_invalid_long_long(cpl_column *column, long long code) { const char *fid = "cpl_column_fill_invalid_long_long"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); int *np; long long *lp; cpl_size i; cpl_column *acolumn; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (!(type & CPL_TYPE_LONG_LONG)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (type & CPL_TYPE_POINTER) { cpl_array **array = cpl_column_get_data_array(column); while (length--) { if (array[length] == NULL) array[length] = cpl_array_new(column->depth, CPL_TYPE_LONG_LONG); acolumn = cpl_array_get_column(array[length]); cpl_column_fill_invalid_long_long(acolumn, code); } return CPL_ERROR_NONE; } if (column->nullcount == 0) return CPL_ERROR_NONE; if (column->nullcount == length) { cpl_column_fill_long_long(column, 0, length, code); column->nullcount = length; /* Restore: they are still all NULL! */ return CPL_ERROR_NONE; } lp = cpl_column_get_data_long_long(column); np = cpl_column_get_data_invalid(column); for (i = 0; i < length; i++, np++, lp++) if (*np == 1) *lp = code; return CPL_ERROR_NONE; } /* * @brief * Assign to invalid @em cpl_size column elements a numeric code. * * @param column Input column. * @param code Code to write at invalid column elements. * * @return @c CPL_ERROR_NONE on success. If the input @em column is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the * accessed column is not @em cpl_size or arrays of cpl_size, * a @c CPL_ERROR_TYPE_MISMATCH is returned. * * In general the column elements that are marked as invalid * may contain any value, that should not be given any meaning * whatsoever. In order to export the column data (using a call * to @c cpl_column_get_data_cplsize() ) to procedures that are * external to the CPL column system, it may turn out to be appropriate * assigning to all the invalid elements a special code value. * This code value will supposedly be recognized and handled * properly by the foreign method. Note that only existing invalid * elements will be coded as indicated: new invalid column elements * would still have their actual values undefined. Also, any further * processing of the column would not take care of maintaining the * assigned code to a given invalid column element: therefore the * code should be set just before it is actually needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_column_fill_invalid_cplsize(cpl_column *column, cpl_size code) { const char *fid = "cpl_column_fill_invalid_cplsize"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); int *np; cpl_size *lp; cpl_size i; cpl_column *acolumn; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (!(type & CPL_TYPE_SIZE)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (type & CPL_TYPE_POINTER) { cpl_array **array = cpl_column_get_data_array(column); while (length--) { if (array[length] == NULL) array[length] = cpl_array_new(column->depth, CPL_TYPE_SIZE); acolumn = cpl_array_get_column(array[length]); cpl_column_fill_invalid_cplsize(acolumn, code); } return CPL_ERROR_NONE; } if (column->nullcount == 0) return CPL_ERROR_NONE; if (column->nullcount == length) { cpl_column_fill_cplsize(column, 0, length, code); column->nullcount = length; /* Restore: they are still all NULL! */ return CPL_ERROR_NONE; } lp = cpl_column_get_data_cplsize(column); np = cpl_column_get_data_invalid(column); for (i = 0; i < length; i++, np++, lp++) if (*np == 1) *lp = code; return CPL_ERROR_NONE; } /* * @brief * Assign to invalid @em float column elements a numeric code. * * @param column Input column. * @param code Code to write at invalid column elements. * * @return @c CPL_ERROR_NONE on success. If the input @em column is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the * accessed column is not @em float or array of floats, * a @c CPL_ERROR_TYPE_MISMATCH is returned. * * In general the column elements that are marked as invalid * may contain any value, that should not be given any meaning * whatsoever. In order to export the column data (using a call * to @c cpl_column_get_data_float() ) to procedures that are external * to the CPL column system, it may turn out to be appropriate * assigning to all the invalid elements a special code value. * This code value will supposedly be recognized and handled * properly by the foreign method. Note that only existing invalid * elements will be coded as indicated: new invalid column elements * would still have their actual values undefined. Also, any further * processing of the column would not take care of maintaining the * assigned code to a given invalid column element: therefore the * code should be set just before it is actually needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_column_fill_invalid_float(cpl_column *column, float code) { const char *fid = "cpl_column_fill_invalid_float"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); int *np; float *fp; cpl_size i; cpl_column *acolumn; cpl_array **array; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (!(type & CPL_TYPE_FLOAT)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (type & CPL_TYPE_POINTER) { array = cpl_column_get_data_array(column); while (length--) { if (array[length]) { acolumn = cpl_array_get_column(array[length]); cpl_column_fill_invalid_float(acolumn, code); } } return CPL_ERROR_NONE; } if (column->nullcount == 0) return 0; if (column->nullcount == length) { cpl_column_fill_float(column, 0, length, code); column->nullcount = length; /* Restore: they are still all NULL! */ return 0; } fp = cpl_column_get_data_float(column); np = cpl_column_get_data_invalid(column); for (i = 0; i < length; i++, np++, fp++) if (*np == 1) *fp = code; return CPL_ERROR_NONE; } cpl_error_code cpl_column_fill_invalid_float_complex(cpl_column *column, float complex code) { const char *fid = "cpl_column_fill_invalid_float_complex"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); int *np; float complex *fp; cpl_size i; cpl_column *acolumn; cpl_array **array; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (!(type & CPL_TYPE_FLOAT_COMPLEX)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (type & CPL_TYPE_POINTER) { array = cpl_column_get_data_array(column); while (length--) { if (array[length]) { acolumn = cpl_array_get_column(array[length]); cpl_column_fill_invalid_float_complex(acolumn, code); } } return CPL_ERROR_NONE; } if (column->nullcount == 0) return 0; if (column->nullcount == length) { cpl_column_fill_float_complex(column, 0, length, code); column->nullcount = length; /* Restore: they are still all NULL! */ return 0; } fp = cpl_column_get_data_float_complex(column); np = cpl_column_get_data_invalid(column); for (i = 0; i < length; i++, np++, fp++) if (*np == 1) *fp = code; return CPL_ERROR_NONE; } /* * @brief * Assign to invalid @em double column elements a numeric code. * * @param column Input column. * @param code Code to write at invalid column elements. * * @return @c CPL_ERROR_NONE on success. If the input @em column is a * @c NULL pointer, a @c CPL_ERROR_NULL_INPUT is returned. If the * accessed column is not @em doubleor array of doubles, * a @c CPL_ERROR_TYPE_MISMATCH is returned. * * In general the column elements that are marked as invalid * may contain any value, that should not be given any meaning * whatsoever. In order to export the column data (using a call * to @c cpl_column_get_data_double() ) to procedures that are external * to the CPL column system, it may turn out to be appropriate * assigning to all the invalid elements a special code value. * This code value will supposedly be recognized and handled * properly by the foreign method. Note that only existing invalid * elements will be coded as indicated: new invalid column elements * would still have their actual values undefined. Also, any further * processing of the column would not take care of maintaining the * assigned code to a given invalid column element: therefore the * code should be set just before it is actually needed. * * @note * Assigning a code to an invalid element doesn't make it valid. */ cpl_error_code cpl_column_fill_invalid_double(cpl_column *column, double code) { const char *fid = "cpl_column_fill_invalid_double"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); int *np; double *dp; cpl_size i; cpl_column *acolumn; cpl_array **array; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (!(type & CPL_TYPE_DOUBLE)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (type & CPL_TYPE_POINTER) { array = cpl_column_get_data_array(column); while (length--) { if (array[length]) { acolumn = cpl_array_get_column(array[length]); cpl_column_fill_invalid_double(acolumn, code); } } return CPL_ERROR_NONE; } if (column->nullcount == 0) return 0; if (column->nullcount == length) { cpl_column_fill_double(column, 0, length, code); column->nullcount = length; /* Restore: they are still all NULL! */ return 0; } dp = cpl_column_get_data_double(column); np = cpl_column_get_data_invalid(column); for (i = 0; i < length; i++, np++, dp++) if (*np == 1) *dp = code; return CPL_ERROR_NONE; } cpl_error_code cpl_column_fill_invalid_double_complex(cpl_column *column, double complex code) { const char *fid = "cpl_column_fill_invalid_double_complex"; cpl_type type = cpl_column_get_type(column); cpl_size length = cpl_column_get_size(column); int *np; double complex *dp; cpl_size i; cpl_column *acolumn; cpl_array **array; if (column == 0x0) return cpl_error_set(fid, CPL_ERROR_NULL_INPUT); if (!(type & CPL_TYPE_DOUBLE_COMPLEX)) return cpl_error_set(fid, CPL_ERROR_TYPE_MISMATCH); if (type & CPL_TYPE_POINTER) { array = cpl_column_get_data_array(column); while (length--) { if (array[length]) { acolumn = cpl_array_get_column(array[length]); cpl_column_fill_invalid_double_complex(acolumn, code); } } return CPL_ERROR_NONE; } if (column->nullcount == 0) return 0; if (column->nullcount == length) { cpl_column_fill_double_complex(column, 0, length, code); column->nullcount = length; /* Restore: they are still all NULL! */ return 0; } dp = cpl_column_get_data_double_complex(column); np = cpl_column_get_data_invalid(column); for (i = 0; i < length; i++, np++, dp++) if (*np == 1) *dp = code; return CPL_ERROR_NONE; } /* @}*/ cpl-6.4.1/cplcore/cpl_image_bpm_body.h0000644000460300003120000000627112247045646014625 00000000000000/* $Id: cpl_image_bpm_body.h,v 1.1 2012-12-10 13:19:48 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* The functions below are documented with Doxygen as usual, but the preprocessor generated function names mean that doxygen cannot actually parse it. So it is all ignored. @cond */ static cpl_error_code ADDTYPE(cpl_image_reject_value)(cpl_image *, cpl_value); /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_image @param self Input image to modify @param mode Bit field specifying which special value(s) to reject @see cpl_image_reject_value() */ /*----------------------------------------------------------------------------*/ static cpl_error_code ADDTYPE(cpl_image_reject_value)(cpl_image * self, cpl_value mode) { CPL_TYPE * data = (CPL_TYPE*)cpl_image_get_data(self); cpl_binary* bpm = NULL; const size_t npix = (size_t)cpl_image_get_size_x(self) * (size_t)cpl_image_get_size_y(self); size_t i; cpl_value check = mode; cpl_ensure_code(mode != 1, CPL_ERROR_INVALID_TYPE); cpl_ensure_code(mode != 0, CPL_ERROR_UNSUPPORTED_MODE); check &= ~ ( CPL_VALUE_NOTFINITE | CPL_VALUE_ZERO); cpl_ensure_code(check == 0, CPL_ERROR_UNSUPPORTED_MODE); #ifdef CPL_TYPE_IS_INT if (mode & CPL_VALUE_ZERO) { for (i = 0; i < npix; i++) { if (data[i] == 0) { if (bpm == NULL) { bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; } } } #else for (i = 0; i < npix; i++) { const int fptype = fpclassify(data[i]); if ((fptype == FP_ZERO && (mode & CPL_VALUE_ZERO)) || (fptype == FP_NAN && (mode & CPL_VALUE_NAN)) || (fptype == FP_INFINITE && (((mode & CPL_VALUE_PLUSINF) && ((mode & CPL_VALUE_MINUSINF) || data[i] > 0.0)) || ((mode & CPL_VALUE_MINUSINF) && data[i] < 0.0)))) { if (bpm == NULL) { bpm = cpl_mask_get_data(cpl_image_get_bpm(self)); } bpm[i] = CPL_BINARY_1; } } #endif return CPL_ERROR_NONE; } /* @endcond */ cpl-6.4.1/cplcore/cpl_image_stats_body.h0000644000460300003120000000465411466733006015204 00000000000000/* $Id: cpl_image_stats_body.h,v 1.25 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Type dependent macros */ #if CPL_CLASS == CPL_CLASS_DOUBLE #define CPL_TYPE double #define CPL_TYPE_T CPL_TYPE_DOUBLE #elif CPL_CLASS == CPL_CLASS_FLOAT #define CPL_TYPE float #define CPL_TYPE_T CPL_TYPE_FLOAT #elif CPL_CLASS == CPL_CLASS_INT #define CPL_TYPE int #define CPL_TYPE_T CPL_TYPE_INT #else #undef CPL_TYPE #undef CPL_TYPE_T #endif #define CPL_TYPE_ADD(a) CPL_CONCAT2X(a, CPL_TYPE) #if CPL_OPERATION == CPL_IMAGE_STATS_MEDIAN_STAT case CPL_TYPE_T: { const CPL_TYPE * pi = (const CPL_TYPE*)image->pixels; int npix = image->nx * image->ny; int i; *sigma = 0.0; /* Could be done in two FLOPs instead of three * - but this would lead to more complicated code... */ if (image->bpm != NULL) { /* Need to check bad pixel buffer */ const cpl_binary * badmap = cpl_mask_get_data_const(image->bpm); int nbad = 0; for (i = 0; i < npix; i++) { if (badmap[i]) { nbad++; } else { *sigma += fabs((double)pi[i]-median_val); } } /* Subtract the number of bad pixels */ npix -= nbad; /* assert( npix > 0 ); */ } else { for (i = 0; i < npix; i++) { *sigma += fabs((double)pi[i]-median_val); } } *sigma /= (double) npix; cpl_tools_add_flops( 3 * npix + 1 ); break; } #endif #undef CPL_TYPE #undef CPL_TYPE_T #undef CPL_TYPE_ADD cpl-6.4.1/cplcore/cpl_imagelist_io.c0000644000460300003120000010422312131736220014307 00000000000000/* $Id: cpl_imagelist_io.c,v 1.109 2013-04-12 07:49:36 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-12 07:49:36 $ * $Revision: 1.109 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_tools.h" #include "cpl_error_impl.h" #include "cpl_propertylist_impl.h" #include "cpl_memory.h" #include "cpl_imagelist_io.h" #include "cpl_image_io_impl.h" #include "cpl_io_fits.h" #include "cpl_imagelist_defs.h" /* Verify self-sufficiency of CPL header files by including system files last */ #include #include #include #include #include #include #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ static cpl_imagelist * cpl_imagelist_load_one(const char *, cpl_type, cpl_size, cpl_boolean, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; /**@{*/ /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Create an empty imagelist @return 1 newly allocated cpl_imagelist @see cpl_imagelist_set() The returned cpl_imagelist must be deallocated using cpl_imagelist_delete() */ /*----------------------------------------------------------------------------*/ cpl_imagelist * cpl_imagelist_new(void) { return (cpl_imagelist *) cpl_calloc(1, sizeof(cpl_imagelist)); } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Load a FITS file extension into a list of images @param filename The FITS file name @param im_type Type of the images in the created image list @param xtnum The extension number (0 for primary HDU) @return The loaded list of images or NULL on error. @see cpl_image_load() This function loads all the images of a specified extension (NAXIS=2 or 3) into an image list. Type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT. The loaded images have an empty bad pixel map. The returned cpl_imagelist must be deallocated using cpl_imagelist_delete() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if xtnum is negative - CPL_ERROR_INVALID_TYPE if the passed type is not supported - CPL_ERROR_FILE_IO If the file cannot be opened or read, or if xtnum is bigger than the number of extensions in the FITS file - CPL_ERROR_BAD_FILE_FORMAT if the file cannot be parsed - CPL_ERROR_DATA_NOT_FOUND if the data cannot be read from the file */ /*----------------------------------------------------------------------------*/ cpl_imagelist * cpl_imagelist_load(const char * filename, cpl_type im_type, cpl_size xtnum) { cpl_imagelist * self = cpl_imagelist_load_one(filename, im_type, xtnum, CPL_FALSE, 0, 0, 0, 0); if (self == NULL) cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Load images windows from a FITS file extension into an image list @param filename The FITS file name @param im_type Type of the images in the created image list @param xtnum The extension number (0 for primary HDU) @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return The loaded list of image windows or NULL on error. @see cpl_imagelist_load(), cpl_image_load_window() @note The returned cpl_imagelist must be deallocated using cpl_imagelist_delete() This function loads all the image windows of a specified extension in an image list. Type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if xtnum is negative - CPL_ERROR_INVALID_TYPE if the passed type is not supported - CPL_ERROR_ACCESS_OUT_OF_RANGE if xtnum is bigger than the number of extensions in the FITS file - CPL_ERROR_BAD_FILE_FORMAT if the file cannot be parsed - CPL_ERROR_DATA_NOT_FOUND if the data cannot be read from the file */ /*----------------------------------------------------------------------------*/ cpl_imagelist * cpl_imagelist_load_window(const char * filename, cpl_type im_type, cpl_size xtnum, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { cpl_imagelist * self = cpl_imagelist_load_one(filename, im_type, xtnum, CPL_TRUE, llx, lly, urx, ury); if (self == NULL) cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Get the number of images in the imagelist @param imlist the list of image @return The number of images or -1 on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_imagelist_get_size(const cpl_imagelist * imlist) { cpl_ensure(imlist != NULL, CPL_ERROR_NULL_INPUT, -1); assert( imlist->ni >= 0 ); return imlist->ni; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Get an image from a list of images @param imlist the image list @param inum the image id (from 0 to number of images-1) @return A pointer to the image or NULL in error case. The returned pointer refers to already allocated data. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ACCESS_OUT_OF_RANGE if inum is bigger thant the list size - CPL_ERROR_ILLEGAL_INPUT if inum is negative */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_imagelist_get(cpl_imagelist * imlist, cpl_size inum) { cpl_ensure(imlist != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(inum >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(inum < imlist->ni, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); return imlist->images[inum]; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Get an image from a list of images @param imlist the image list @param inum the image id (from 0 to number of images-1) @return A pointer to the image or NULL in error case. @see cpl_imagelist_get */ /*----------------------------------------------------------------------------*/ const cpl_image * cpl_imagelist_get_const(const cpl_imagelist * imlist, cpl_size inum) { cpl_ensure(imlist != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(inum >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(inum < imlist->ni, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); return imlist->images[inum]; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Insert an image into an imagelist @param imlist The imagelist @param im The image to insert @param pos The list position (from 0 to number of images) @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error It is allowed to specify the position equal to the number of images in the list. This will increment the size of the imagelist. No action occurs if an image is inserted more than once into the same position. It is allowed to insert the same image into two different positions in a list. The image is inserted at the position pos in the image list. If the image already there is only present in that one location in the list, then the image is deallocated. It is not allowed to insert images of different size into a list. The added image is owned by the imagelist object, which deallocates it cpl_imagelist_delete is called. Other option is to use cpl_imagelist_unset to recover ownership of the image, in which case the cpl_imagelist object is not longer responsible for deallocating it. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if pos is negative - CPL_ERROR_TYPE_MISMATCH if im and imlist are of different types - CPL_ERROR_INCOMPATIBLE_INPUT if im and imlist have different sizes - CPL_ERROR_ACCESS_OUT_OF_RANGE if pos is bigger than the number of images in imlist */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_set( cpl_imagelist * imlist, cpl_image * im, cpl_size pos) { cpl_ensure_code(imlist, CPL_ERROR_NULL_INPUT); cpl_ensure_code(im, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pos >= 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(pos <= imlist->ni, CPL_ERROR_ACCESS_OUT_OF_RANGE); /* Do nothing if the image is already there */ if (pos < imlist->ni && im == imlist->images[pos]) return CPL_ERROR_NONE; if (pos > 0 || imlist->ni > 1) { /* Require images to have the same size and type */ cpl_ensure_code(cpl_image_get_size_x(im) == cpl_image_get_size_x(imlist->images[0]), CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(cpl_image_get_size_y(im) == cpl_image_get_size_y(imlist->images[0]), CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(cpl_image_get_type(im) == cpl_image_get_type(imlist->images[0]), CPL_ERROR_TYPE_MISMATCH); } if (pos == imlist->ni) { imlist->ni++; imlist->images = cpl_realloc(imlist->images, (size_t)imlist->ni * sizeof(cpl_image*)); } else { /* Check if the image at the position to be overwritten is present in only one position */ int i; for (i = 0; i < imlist->ni; i++) { if (i != pos && imlist->images[i] == imlist->images[pos]) break; } if (i == imlist->ni) { /* The image at the position to be overwritten is present in only one position, so delete it */ cpl_image_delete(imlist->images[pos]); } } imlist->images[pos] = im; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Remove an image from an imagelist @param self The imagelist @param pos The list position (from 0 to number of images-1) @return The pointer to the removed image or NULL in error case The specified image is not deallocated, it is simply removed from the list. The pointer to the image is returned to let the user decide to deallocate it or not. Eventually, the image will have to be deallocated with cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if pos is negative - CPL_ERROR_ACCESS_OUT_OF_RANGE if pos is bigger than the number of images in self */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_imagelist_unset(cpl_imagelist * self, cpl_size pos) { cpl_image * out; cpl_size i; cpl_ensure(self, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(pos >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(pos < self->ni, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); /* Get pointer to image to be removed */ out = self->images[pos]; /* Move the following images one position towards zero */ for (i=pos + 1; i < self->ni; i++) { self->images[i-1] = self->images[i]; } /* Decrement of the size */ self->ni--; return out; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Empty an imagelist and deallocate all its images @param self The image list or NULL @return Nothing @see cpl_imagelist_empty(), cpl_imagelist_delete() @note If @em self is @c NULL nothing is done and no error is set. After the call the image list can be populated again. It must eventually be deallocted with a call to cpl_imagelist_delete(). */ /*----------------------------------------------------------------------------*/ void cpl_imagelist_empty(cpl_imagelist * self) { if (self != NULL) { while (self->ni > 0) { /* An iteration may unset more than 1 image */ cpl_size i = self->ni - 1; cpl_image * del = cpl_imagelist_unset(self, i); cpl_image_delete(del); /* If this image was inserted more than once into the list, the other insertions must be unset without a delete. */ while (--i >= 0) { if (self->images[i] == del) { /* This image was inserted more than once in the list */ (void)cpl_imagelist_unset(self, i); } } } } return; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Free memory used by a cpl_imagelist object, except the images @param self The image list or NULL @return Nothing @see cpl_imagelist_empty() @note The caller must have pointers to all images in the list and is reponsible for their deallocation. If @em self is @c NULL nothing is done and no error is set. */ /*----------------------------------------------------------------------------*/ void cpl_imagelist_unwrap(cpl_imagelist * self) { if (self != NULL) { cpl_free(self->images); cpl_free(self); } return; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Free all memory used by a cpl_imagelist object including the images @param self The image list or NULL @return Nothing @see cpl_imagelist_empty(), cpl_imagelist_unwrap() */ /*----------------------------------------------------------------------------*/ void cpl_imagelist_delete(cpl_imagelist * self) { if (self != NULL) { cpl_imagelist_empty(self); cpl_imagelist_unwrap(self); } return; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Cast an imagelist, optionally in-place @param self Destination imagelist @param other Source imagelist, or NULL to cast in-place @param type If called with empty self, cast to this pixel-type @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_image_cast() @note If called with a non-empty self in an out-of-place cast, the input images are cast to the type already present in self and appended to the output list. In this case the parameter type is ignored. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if the destination pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the same pointer is passed twice - CPL_ERROR_ILLEGAL_INPUT if the passed type is invalid - CPL_ERROR_TYPE_MISMATCH if the passed image type is complex and requested casting type is non-complex. - CPL_ERROR_INVALID_TYPE if the passed pixel type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_cast(cpl_imagelist * self, const cpl_imagelist * other, cpl_type type) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } else if (self == other) { return cpl_error_set_(CPL_ERROR_INCOMPATIBLE_INPUT); } else { const cpl_boolean inplace = other == NULL ? CPL_TRUE : CPL_FALSE; const cpl_imagelist * src = inplace ? self : other; cpl_imagelist * dest = inplace ? cpl_imagelist_new() : self; const size_t n = (size_t)cpl_imagelist_get_size(src); const size_t m = (size_t)cpl_imagelist_get_size(dest); const cpl_type ctype = inplace || m == 0 ? type : cpl_image_get_type(cpl_imagelist_get_const(dest, 0)); cpl_error_code code = CPL_ERROR_NONE; size_t i, j; for (i = j = 0; i < n; i++) { /* For in-place, empty src along the way */ const cpl_image * srcimg = cpl_imagelist_get_const(src,(cpl_size)j); cpl_image * tmpimg = cpl_image_cast(srcimg, ctype); if (tmpimg == NULL) break; if (cpl_imagelist_set(dest, tmpimg, m + (cpl_size)i)) break; if (inplace) { cpl_image_delete(cpl_imagelist_unset(self, 0)); } else { j++; } } if (i < n) { /* An error happened */ code = cpl_error_set_where_(); if (inplace) { cpl_imagelist_delete(dest); } } else if (inplace) { /* Need to move dest to self (which is empty) */ cpl_imagelist * tmp = (cpl_imagelist*)cpl_malloc(sizeof(*tmp)); (void)memcpy(tmp, self, sizeof(*tmp)); (void)memcpy(self, dest, sizeof(*tmp)); cpl_free(dest); cpl_imagelist_delete(tmp); } return code; } } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Copy an image list @param imlist Source image list. @return 1 newly allocated image list, or NULL on error. Copy an image list into a new image list object. The returned image list must be deallocated using cpl_imagelist_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_imagelist * cpl_imagelist_duplicate(const cpl_imagelist * imlist) { cpl_imagelist * out; cpl_size i; cpl_ensure(imlist != NULL, CPL_ERROR_NULL_INPUT, NULL); /* Create the new imagelist */ out = cpl_imagelist_new(); /* Duplicate the images */ for (i=0; ini; i++) { cpl_imagelist_set(out, cpl_image_duplicate(imlist->images[i]), i); } return out; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Reject one or more images in a list according to an array of flags. @param imlist Non-empty imagelist to examine for image rejection. @param valid Vector of flags (>=-0.5: valid, <-0.5: invalid) @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error This function takes an imagelist and a vector of flags. The imagelist and vector must have equal lengths. Images flagged as invalid are removed from the list. The removal of image(s) will reduce the length of the list accordingly. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if the vector size and the image list size are different */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_erase( cpl_imagelist * imlist, const cpl_vector * valid) { cpl_size nkeep = 0; cpl_size i; /* Check entries */ cpl_ensure_code(imlist, CPL_ERROR_NULL_INPUT); cpl_ensure_code(valid, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_vector_get_size(valid) == imlist->ni, CPL_ERROR_INCOMPATIBLE_INPUT); for (i=0; i < imlist->ni; i++) { if (cpl_vector_get(valid, i) >= -0.5) { /* image is to be kept, place it in the 1st free position */ imlist->images[nkeep] = imlist->images[i]; nkeep++; } else { /* image is to be erased, delete it */ cpl_image_delete(imlist->images[i]); } } /* Update the size of the altered list */ imlist->ni = nkeep; return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Save an imagelist to disk in FITS format. @param self Imagelist to save @param filename Name of the FITS file to write @param type The type used to represent the data in the file @param pl Property list for the output header or NULL @param mode The desired output options (combined with bitwise or) @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_save() This function saves an image list to a FITS file. If a property list is provided, it is written to the named file before the pixels are written. Supported image lists types are CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT. The type used in the file can be one of: CPL_TYPE_UCHAR (8 bit unsigned), CPL_TYPE_SHORT (16 bit signed), CPL_TYPE_USHORT (16 bit unsigned), CPL_TYPE_INT (32 bit signed), CPL_TYPE_FLOAT (32 bit floating point), or CPL_TYPE_DOUBLE (64 bit floating point). Additionally, the special value CPL_TYPE_UNSPECIFIED is allowed. This value means that the type used for saving is the pixel type of the input image. Using the image pixel type as saving type ensures that the saving incurs no loss of information. Supported output modes are CPL_IO_CREATE (create a new file), CPL_IO_EXTEND (extend an existing file with a new extension) and CPL_IO_APPEND (append a list of images to the last data unit, which must already contain compatible image(s)). When the data written to disk are of an integer type, the output mode CPL_IO_EXTEND can be combined (via bit-wise or) with an option for tile-compression. This compression of integer data is lossless. The options are: CPL_IO_COMPRESS_GZIP, CPL_IO_COMPRESS_RICE, CPL_IO_COMPRESS_HCOMPRESS, CPL_IO_COMPRESS_PLIO. With compression the type must be CPL_TYPE_UNSPECIFIED or CPL_TYPE_INT. In extend and append mode, make sure that the file has write permissions. You may have problems if you create a file in your application and append something to it with the umask set to 222. In this case, the file created by your application would not be writable, and the append would fail. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the type or the mode is not supported - CPL_ERROR_FILE_IO if the file cannot be written - CPL_ERROR_INVALID_TYPE if the passed image list type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_save(const cpl_imagelist * self, const char * filename, cpl_type type, const cpl_propertylist * pl, unsigned mode) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(filename != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_imagelist_is_uniform(self)==0, CPL_ERROR_ILLEGAL_INPUT); return cpl_image_save_((const cpl_image* const*)self->images, self->ni, CPL_TRUE, filename, type, pl, mode) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Determine if an imagelist contains images of equal size and type @param imlist The imagelist to check @return Zero if uniform, positive if non-uniform and negative on error. The function returns 1 if the list is empty. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ int cpl_imagelist_is_uniform(const cpl_imagelist * imlist) { cpl_type type; cpl_size nx, ny; cpl_size i; cpl_ensure(imlist != NULL, CPL_ERROR_NULL_INPUT, -1); if (imlist->ni == 0) return 1; /* Check the images */ nx = cpl_image_get_size_x(imlist->images[0]); ny = cpl_image_get_size_y(imlist->images[0]); type = cpl_image_get_type (imlist->images[0]); for (i=1; i < imlist->ni; i++) { if (cpl_image_get_size_x(imlist->images[i]) != nx) return (int)i+1; if (cpl_image_get_size_y(imlist->images[i]) != ny) return (int)i+1; if (cpl_image_get_type (imlist->images[i]) != type) return (int)i+1; } return 0; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Dump structural information of images in an imagelist @param self Imagelist to dump @param stream Output stream, accepts @c stdout or @c stderr @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_FILE_IO if a write operation fails */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_dump_structure(const cpl_imagelist * self, FILE * stream) { const char * msg = "Imagelist with %d image(s)\n"; const int msgmin = (int)strlen(msg) - 5; int i; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(stream != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code( fprintf(stream, msg, self->ni) >= msgmin, CPL_ERROR_FILE_IO ); for (i = 0; i < self -> ni; i++) { const cpl_image * image = cpl_imagelist_get_const(self, i); const char * imsg = "Image nb %d of %d in imagelist\n"; const int imsgmin = (int)strlen(imsg) - 5; cpl_ensure_code( fprintf(stream, imsg, i, self->ni) >= imsgmin, CPL_ERROR_FILE_IO ); cpl_ensure_code( !cpl_image_dump_structure(image, stream), cpl_error_get_code() ); } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Dump pixel values of images in a CPL imagelist @param self Imagelist to dump @param llx Specifies the window position @param lly Specifies the window position @param urx Specifies the window position @param ury Specifies the window position @param stream Output stream, accepts @c stdout or @c stderr @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_FILE_IO if a write operation fails - CPL_ERROR_ACCESS_OUT_OF_RANGE if the defined window is not in the image - CPL_ERROR_ILLEGAL_INPUT if the window definition is wrong (e.g llx > urx) */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_dump_window(const cpl_imagelist * self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, FILE * stream) { cpl_size i; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(stream != NULL, CPL_ERROR_NULL_INPUT); for (i = 0; i < self -> ni; i++) { const cpl_image * image = cpl_imagelist_get_const(self, i); const char * imsg = "Image nb %d of %d in imagelist\n"; const int imsgmin = (int)strlen(imsg) - 5; cpl_ensure_code( fprintf(stream, imsg, i, self->ni) >= imsgmin, CPL_ERROR_FILE_IO ); cpl_ensure_code( !cpl_image_dump_window(image, llx, lly, urx, ury, stream), cpl_error_get_code() ); } return CPL_ERROR_NONE; } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @ingroup cpl_imagelist @brief Load an imagelist from a FITS file. @param filename Name of the file to load from. @param im_type Type of the created images @param xtnum Extension number in the file (0 for primary HDU) @param do_window True for (and only for) a windowed load @param llx Lower left x position (FITS convention, 1 for leftmost) @param lly Lower left y position (FITS convention, 1 for lowest) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return 1 newly allocated imagelist or NULL on error @see cpl_imagelist_load() */ /*----------------------------------------------------------------------------*/ static cpl_imagelist * cpl_imagelist_load_one(const char * filename, cpl_type im_type, cpl_size xtnum, cpl_boolean do_window, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { /* Count number of images read - use also to indicate failure */ cpl_size selfsize; cpl_imagelist * self; cpl_image * image; fitsfile * fptr; int status = 0; /* CFITSIO status, must be set to zero */ /* Initialize to indicate that they need to be read from the file */ int naxis = 0; CPL_FITSIO_TYPE naxes[3] ={0, 0, 0}; cpl_type pix_type = im_type; /* FIXME: Version 3.2 of fits_open_diskfile() seg-faults on NULL. If fixed in CFITSIO, this check should be removed */ cpl_ensure(filename != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(xtnum >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); if (cpl_io_fits_open_diskfile(&fptr, filename, READONLY, &status)) { (void)cpl_error_set_fits(CPL_ERROR_FILE_IO, status, fits_open_diskfile, "filename='%s', im_type=%u, xtnum=%" CPL_SIZE_FORMAT, filename, im_type, xtnum); return NULL; } /* Load 1st image from the extension. This will set naxis and naxes[] (and optionally the pixel type) for use in subsequent calls */ image = cpl_image_load_(fptr, &naxis, naxes, &pix_type, filename, 0, xtnum, do_window, llx, lly, urx, ury); self = cpl_imagelist_new(); selfsize = 0; if (image == NULL || cpl_imagelist_set(self, image, selfsize)) { cpl_image_delete(image); } else { selfsize++; } if (selfsize > 0 && naxis == 3) { /* Handle other planes in this extension, if any */ int iplane; for (iplane = 1; iplane < naxes[2]; iplane++) { image = cpl_image_load_(fptr, &naxis, naxes, &pix_type, filename, iplane, xtnum, do_window, llx, lly, urx, ury); if (image == NULL) break; if (cpl_imagelist_set(self, image, selfsize)) { cpl_image_delete(image); break; } selfsize++; } if (iplane < naxes[2]) { selfsize = 0; /* Indicate failure */ } } if (cpl_io_fits_close_file(fptr, &status)) { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, status, fits_close_file, "filename='%s', " "im_type=%u, xtnum=%" CPL_SIZE_FORMAT, filename, (unsigned)im_type, xtnum); selfsize = 0; /* Indicate failure */ } else if (selfsize == 0) { (void)cpl_error_set_where_(); } if (selfsize == 0) { cpl_imagelist_delete(self); self = NULL; } return self; } cpl-6.4.1/cplcore/cpl_stats.c0000644000460300003120000010066412050706501013004 00000000000000/* $Id: cpl_stats.c,v 1.59 2012-11-14 12:23:28 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-11-14 12:23:28 $ * $Revision: 1.59 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include "cpl_memory.h" #include "cpl_stats.h" #include "cpl_image_bpm.h" #include "cpl_image_stats.h" #include "cpl_mask.h" #include "cpl_error_impl.h" #include "cpl_tools.h" #include "cpl_image_defs.h" /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define CPL_IMAGE_STATS_ALL 1 #define CPL_IMAGE_STATS_MINMAX 2 #define CPL_IMAGE_STATS_FLUX 3 #define CPL_IMAGE_STATS_VARIANCE 4 #define CPL_IMAGE_STATS_CENTROID 5 #define CPL_IMAGE_STATS_MEDIAN 6 #define CPL_IMAGE_STATS_MEDIAN_DEV 7 #define CPL_IMAGE_STATS_MAD 8 #define CONCAT(a,b) a ## _ ## b #define CONCAT2X(a,b) CONCAT(a,b) #define CPL_STATS_DUMP_ONE(OPERATOR, MEMBER, LABEL, CONVERTER) \ if (mode & OPERATOR) { \ mode ^= OPERATOR; /* Reset bit. At the end mode must be zero */ \ cpl_ensure_code(fprintf(stream, "\t\t%-13s%" CONVERTER "\n", LABEL ":", \ self->MEMBER) > 0, CPL_ERROR_FILE_IO); \ } #define CPL_STATS_DUMP_TWO(OPERATOR, MEMBER, LABEL, CONVERTER) \ if (mode & OPERATOR) { \ mode ^= OPERATOR; /* Reset bit. At the end mode must be zero */ \ cpl_ensure_code(fprintf(stream, "\t\t%-13s%" CONVERTER "\n", \ "X " LABEL ":", self->CONCAT2X(MEMBER, x)) \ > 0, CPL_ERROR_FILE_IO); \ cpl_ensure_code(fprintf(stream, "\t\t%-13s%" CONVERTER "\n", \ "Y " LABEL ":", self->CONCAT2X(MEMBER, y)) \ > 0, CPL_ERROR_FILE_IO); \ } /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_stats Statistics * * This module provides functions to handle the cpl_stats object. * This object can contain the statistics that have been computed from * different CPL objects. Currently, only the function that computes * statistics on images (or images windows) is provided. * * @par Synopsis: * @code * #include "cpl_stats.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Type definition -----------------------------------------------------------------------------*/ struct _cpl_stats_ { double min; double max; double mean; double med; double med_dev; double mad; double stdev; double flux; double absflux; double sqflux; double centroid_x; double centroid_y; cpl_size min_x; cpl_size min_y; cpl_size max_x; cpl_size max_y; cpl_size npix; cpl_stats_mode mode; }; /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Get the minimum from a cpl_stats object @param in the cpl_stats object @return the minimum value The call that created the cpl_stats object must have determined the minimum value. In case of error, the #_cpl_error_code_ code is set, and the returned double is undefined. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the requested stat has not been computed in in */ /*----------------------------------------------------------------------------*/ double cpl_stats_get_min(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(in->mode & (CPL_STATS_MIN | CPL_STATS_MINPOS), CPL_ERROR_ILLEGAL_INPUT, 0); return in->min; } /*----------------------------------------------------------------------------*/ /** @brief Get the maximum from a cpl_stats object @param in the cpl_stats object @return the maximum value @see cpl_stats_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_stats_get_max(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(in->mode & (CPL_STATS_MAX | CPL_STATS_MAXPOS), CPL_ERROR_ILLEGAL_INPUT, 0); return in->max; } /*----------------------------------------------------------------------------*/ /** @brief Get the mean from a cpl_stats object @param in the cpl_stats object @return the mean value @see cpl_stats_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_stats_get_mean(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(in->mode & CPL_STATS_MEAN, CPL_ERROR_ILLEGAL_INPUT, 0); return in->mean; } /*----------------------------------------------------------------------------*/ /** @brief Get the median from a cpl_stats object @param in the cpl_stats object @return the median value @see cpl_stats_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_stats_get_median(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(in->mode & CPL_STATS_MEDIAN, CPL_ERROR_ILLEGAL_INPUT, 0); return in->med; } /*----------------------------------------------------------------------------*/ /** @brief Get the mean of the absolute median deviation from a cpl_stats object @param in the cpl_stats object @return The mean of the absolute median deviation, or undefined on error @see cpl_stats_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_stats_get_median_dev(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(in->mode & CPL_STATS_MEDIAN_DEV, CPL_ERROR_ILLEGAL_INPUT, 0.0); return in->med_dev; } /*----------------------------------------------------------------------------*/ /** @brief Get the median of the absolute median deviation @param in the cpl_stats object @return The median of the absolute median deviation, or undefined on error @see cpl_stats_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_stats_get_mad(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(in->mode & CPL_STATS_MAD, CPL_ERROR_ILLEGAL_INPUT, 0.0); return in->mad; } /*----------------------------------------------------------------------------*/ /** @brief Get the std. dev. from a cpl_stats object @param in the cpl_stats object @return the standard deviation @see cpl_stats_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_stats_get_stdev(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(in->mode & CPL_STATS_STDEV, CPL_ERROR_ILLEGAL_INPUT, 0); return in->stdev; } /*----------------------------------------------------------------------------*/ /** @brief Get the flux from a cpl_stats object @param in the cpl_stats object @return the flux @see cpl_stats_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_stats_get_flux(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(in->mode & CPL_STATS_FLUX, CPL_ERROR_ILLEGAL_INPUT, 0); return in->flux; } /*----------------------------------------------------------------------------*/ /** @brief Get the absolute flux from a cpl_stats object @param in the cpl_stats object @return The absolute flux, or a negative number on error @see cpl_stats_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_stats_get_absflux(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(in->mode & CPL_STATS_ABSFLUX, CPL_ERROR_ILLEGAL_INPUT, -2); return in->absflux; } /*----------------------------------------------------------------------------*/ /** @brief Get the sum of the squared values from a cpl_stats object @param in the cpl_stats object @return the square flux, or a negative number on error @see cpl_stats_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_stats_get_sqflux(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(in->mode & CPL_STATS_SQFLUX, CPL_ERROR_ILLEGAL_INPUT, -2); return in->sqflux; } /*----------------------------------------------------------------------------*/ /** @brief Get the x centroid position from a cpl_stats object @param in the cpl_stats object @return the x centroid @see cpl_stats_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_stats_get_centroid_x(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(in->mode & CPL_STATS_CENTROID, CPL_ERROR_ILLEGAL_INPUT, 0); return in->centroid_x; } /*----------------------------------------------------------------------------*/ /** @brief Get the y centroid position from a cpl_stats object @param in the cpl_stats object @return the y centroid @see cpl_stats_get_min() */ /*----------------------------------------------------------------------------*/ double cpl_stats_get_centroid_y(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(in->mode & CPL_STATS_CENTROID, CPL_ERROR_ILLEGAL_INPUT, 0); return in->centroid_y; } /*----------------------------------------------------------------------------*/ /** @brief Get the minimum x position from a cpl_stats object @param in the cpl_stats object @return the x position (1 for the first pixel), non-positive on error. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_stats_get_min_x(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(in->mode & (CPL_STATS_MIN | CPL_STATS_MINPOS), CPL_ERROR_ILLEGAL_INPUT, 0); return in->min_x; } /*----------------------------------------------------------------------------*/ /** @brief Get the minimum y position from a cpl_stats object @param in the cpl_stats object @return the y position (1 for the first pixel), non-positive on error. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_stats_get_min_y(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(in->mode & (CPL_STATS_MIN | CPL_STATS_MINPOS), CPL_ERROR_ILLEGAL_INPUT, 0); return in->min_y; } /*----------------------------------------------------------------------------*/ /** @brief Get the maximum x position from a cpl_stats object @param in the cpl_stats object @return the x position (1 for the first pixel), non-positive on error. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_stats_get_max_x(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(in->mode & (CPL_STATS_MAX | CPL_STATS_MAXPOS), CPL_ERROR_ILLEGAL_INPUT, 0); return in->max_x; } /*----------------------------------------------------------------------------*/ /** @brief Get the maximum y position from a cpl_stats object @param in the cpl_stats object @return the y position (1 for the first pixel), non-positive on error. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_stats_get_max_y(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, -1); cpl_ensure(in->mode & (CPL_STATS_MAX | CPL_STATS_MAXPOS), CPL_ERROR_ILLEGAL_INPUT, 0); return in->max_y; } /*----------------------------------------------------------------------------*/ /** @brief Get the number of pixels from a cpl_stats object @param in the cpl_stats object @return the number of pixels, -1 in error case. The creation of a cpl_stats object always causes the number of pixels to be determined. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_size cpl_stats_get_npix(const cpl_stats * in) { cpl_ensure(in!=NULL, CPL_ERROR_NULL_INPUT, -1); return in->npix; } /*----------------------------------------------------------------------------*/ /** @brief Free memory associated to an cpl_stats object. @param stats the object to delete @return void Frees all memory associated to a cpl_stats object. If the object @em stats is @c NULL, nothing is done and no error is set. */ /*----------------------------------------------------------------------------*/ void cpl_stats_delete(cpl_stats * stats) { if (stats == NULL) return; cpl_free(stats); } /*----------------------------------------------------------------------------*/ /** @brief Compute various statistics of an image sub-window. @param image Input image. @param mode Bit field specifying which statistics to compute @param llx Lower left x position (FITS convention) @param lly Lower left y position (FITS convention) @param urx Upper right x position (FITS convention) @param ury Upper right y position (FITS convention) @return 1 newly allocated cpl_stats structure or NULL in error case Compute various image statistics. The specified bounds are included in the specified region. The statistics to compute is specified with a bit field, that may be set to any of these values - CPL_STATS_MIN - CPL_STATS_MAX - CPL_STATS_MEAN - CPL_STATS_MEDIAN - CPL_STATS_MEDIAN_DEV - CPL_STATS_MAD - CPL_STATS_STDEV - CPL_STATS_FLUX - CPL_STATS_ABSFLUX - CPL_STATS_SQFLUX - CPL_STATS_CENTROID - CPL_STATS_MINPOS - CPL_STATS_MAXPOS or any bitwise or (|) of these. For convenience the special value CPL_STATS_ALL may also be used, it is the conbination of all of the above values. E.g. the mode CPL_STATS_MIN | CPL_STATS_MEDIAN specifies the minimum and the median of the image. In the case of CPL_STATS_MIN and CPL_STATS_MAX where more than one set of coordinates share the extremum it is undefined which of those coordinates will be returned. On i386 platforms there can be significant differences in the round-off of the computation of single statistics and statistics computed via CPL_STATS_ALL. This is especially true for squared quantities such as the CPL_STATS_SQFLUX and CPL_STATS_STDEV. Images can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT. For the CPL_STATS_CENTROID computation, if there are negative pixels, the minimum value is added to all the pixels in order to have all pixels with positive values for computation. The returned object must be deallocated using cpl_stats_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ACCESS_OUT_OF_RANGE if the defined window is not in the image - CPL_ERROR_ILLEGAL_INPUT if the window definition is wrong (e.g llx > urx) - CPL_ERROR_DATA_NOT_FOUND if all the pixels are bad - CPL_ERROR_INVALID_TYPE if the passed image type is not supported - CPL_ERROR_INVALID_TYPE if mode is 1, e.g. due to a logical or (||) of the allowed options. - CPL_ERROR_UNSUPPORTED_MODE if mode is otherwise different from the allowed options. */ /*----------------------------------------------------------------------------*/ cpl_stats * cpl_stats_new_from_image_window( const cpl_image * image, cpl_stats_mode mode, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) { const size_t llxsz = (size_t)llx; const size_t llysz = (size_t)lly; const size_t urxsz = (size_t)urx; const size_t urysz = (size_t)ury; cpl_stats * self; double pix_sum = 0.0; double sqr_sum = 0.0; double abs_sum = 0.0; double dev_sum = 0.0; double pix_mean = 0.0; double pix_var = 0.0; /* The accumulated variance sum */ double max_pix = DBL_MAX; /* Avoid (false) uninit warning */ double min_pix = DBL_MAX; /* Avoid (false) uninit warning */ cpl_size max_pos = -1; /* Avoid (false) uninit warning */ cpl_size min_pos = -1; /* Avoid (false) uninit warning */ double ipix = 0.0; /* Counter of pixels used */ cpl_size npix; const cpl_size mpix = (urx-llx+1) * (ury-lly+1); cpl_size pos; /* Two statistics computation categories defined here */ const cpl_stats_mode minmax_cat = mode & (CPL_STATS_MIN|CPL_STATS_MAX|CPL_STATS_MINPOS| CPL_STATS_MAXPOS|CPL_STATS_CENTROID); const cpl_stats_mode flux_cat = mode & (CPL_STATS_FLUX | CPL_STATS_ABSFLUX | CPL_STATS_SQFLUX); const cpl_stats_mode variance_cat = mode & (CPL_STATS_MEAN | CPL_STATS_STDEV); /* Index of 1st good pixel - used for initialization */ cpl_size firstgoodpos; /* The number of bad pixels inside the subwindow */ cpl_size nbadpix; /* A map of the the bad pixels in the input */ const cpl_binary * badmap; size_t i, j; /* Test inputs */ cpl_ensure(image != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(llx > 0, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); cpl_ensure(lly > 0, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); cpl_ensure(urx <= image->nx, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); cpl_ensure(ury <= image->ny, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); cpl_ensure(llx <= urx, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(lly <= ury, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(mode != 1, CPL_ERROR_INVALID_TYPE, NULL); cpl_ensure(mode != 0, CPL_ERROR_UNSUPPORTED_MODE, NULL); cpl_ensure((mode & ~CPL_STATS_ALL) == 0, CPL_ERROR_UNSUPPORTED_MODE, NULL); /* Need the median for the mean and median median absolute deviation */ if (mode & (CPL_STATS_MEDIAN_DEV | CPL_STATS_MAD)) mode |= CPL_STATS_MEDIAN; /* Get the bad pixels map */ badmap = image->bpm == NULL ? NULL : cpl_mask_get_data_const(image->bpm); /* Get the first good pixel and the number of bad pixels */ nbadpix = 0; if (badmap != NULL) { const cpl_binary * bpmj1 = badmap + (lly-1) * image->nx - 1; firstgoodpos = -1; for (j = llysz; j < 1 + urysz; j++, bpmj1 += image->nx) { for (i = llxsz; i < 1 + urxsz; i++) { if (bpmj1[i] == CPL_BINARY_1) { nbadpix++; } else if (firstgoodpos < 0) { firstgoodpos = (i - 1) + (j - 1) * image->nx; } } } /* Verify that there are good pixels */ cpl_ensure(firstgoodpos >= 0, CPL_ERROR_DATA_NOT_FOUND, NULL); } else { firstgoodpos = (llx-1)+(lly-1)*image->nx; } npix = mpix - nbadpix; /* Allocate stat object */ self = cpl_malloc(sizeof(cpl_stats)); /* When a member of the struct is accessed check that it was initialized */ self->mode = mode; self->npix = npix; /* Code duplication not avoidable for performance reasons */ /* The tests should stay outside the loops */ if (mode & CPL_STATS_MEDIAN) { switch (image->type) { #define CPL_OPERATION CPL_IMAGE_STATS_MEDIAN #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_stats_body.h" #undef CPL_CLASS #undef CPL_OPERATION default: /* See comment in previous switch() default: */ cpl_stats_delete(self); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } } if (mode == CPL_STATS_ALL) { /* Switch on image type */ switch (image->type) { #define CPL_OPERATION CPL_IMAGE_STATS_ALL #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_stats_body.h" #undef CPL_CLASS #undef CPL_OPERATION default: /* * Currently, it is an error in CPL to reach this point, as all * possible types for images (see cpl_image_new()) are supported. * * However, it could happen, if cpl_image_new() were extended to * support images of a new type and the new type were not supported * in this function. For that case, we keep setting the appropriate * error code in this default section. */ cpl_stats_delete(self); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } } else { if (minmax_cat) { /* Switch on image type */ switch (image->type) { #define CPL_OPERATION CPL_IMAGE_STATS_MINMAX #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_stats_body.h" #undef CPL_CLASS #undef CPL_OPERATION default: /* See comment in previous switch() default: */ cpl_stats_delete(self); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } } if (flux_cat) { /* Switch on image type */ switch (image->type) { #define CPL_OPERATION CPL_IMAGE_STATS_FLUX #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_stats_body.h" #undef CPL_CLASS #undef CPL_OPERATION default: /* See comment in previous switch() default: */ cpl_stats_delete(self); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } } if (variance_cat) { /* Switch on image type */ switch (image->type) { #define CPL_OPERATION CPL_IMAGE_STATS_VARIANCE #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_stats_body.h" #undef CPL_CLASS #undef CPL_OPERATION default: /* See comment in previous switch() default: */ cpl_stats_delete(self); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } } if (mode & CPL_STATS_MEDIAN_DEV) { switch (image->type) { #define CPL_OPERATION CPL_IMAGE_STATS_MEDIAN_DEV #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_stats_body.h" #undef CPL_CLASS #undef CPL_OPERATION default: /* See comment in previous switch() default: */ cpl_stats_delete(self); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } } } if (mode & CPL_STATS_MAD) { switch (image->type) { #define CPL_OPERATION CPL_IMAGE_STATS_MAD #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_stats_body.h" #undef CPL_CLASS #undef CPL_OPERATION default: /* See comment in previous switch() default: */ cpl_stats_delete(self); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } } if (mode & CPL_STATS_MIN) self->min = min_pix; if (mode & CPL_STATS_MAX) self->max = max_pix; if (mode & CPL_STATS_MEAN) self->mean = pix_mean; if (mode &CPL_STATS_STDEV) { /* Compute the bias-corrected standard deviation. */ self->stdev = npix < 2 ? 0.0 : sqrt(pix_var/(double)(npix-1)); } if (mode &CPL_STATS_CENTROID) { double sum_xz = 0.0; double sum_yz = 0.0; double sum_z = 0.0; double sum_x = 0.0; double sum_y = 0.0; switch (image->type) { #define CPL_OPERATION CPL_IMAGE_STATS_CENTROID #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_stats_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_stats_body.h" #undef CPL_CLASS #undef CPL_OPERATION default: /* See comment in previous switch() default: */ cpl_stats_delete(self); (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } if (sum_z > 0.0) { self->centroid_x = sum_xz / sum_z; self->centroid_y = sum_yz / sum_z; } else { self->centroid_x = sum_x / (double)npix; self->centroid_y = sum_y / (double)npix; } /* The centroid has to be inside the provided sub-window */ /* It can only fail to be that due to round-off, for example due to compiler optimization (apparently because sum_z is made into a register variable) */ /* The round-off is especially likely to happen on a 1D-image, e.g. when lly == ury */ if (self->centroid_x < (double)llx) { assert( (double)llx - self->centroid_x < FLT_EPSILON ); self->centroid_x = (double)llx; } else if (self->centroid_x > (double)urx) { assert( self->centroid_x - (double)urx < FLT_EPSILON ); self->centroid_x = (double)urx; } if (self->centroid_y < (double)lly) { assert( (double)lly - self->centroid_y < FLT_EPSILON ); self->centroid_y = (double)lly; } else if (self->centroid_y > (double)ury) { assert( self->centroid_y - (double)ury < FLT_EPSILON ); self->centroid_y = (double)ury; } } if (mode &CPL_STATS_FLUX) self->flux = pix_sum; if (mode &CPL_STATS_ABSFLUX) self->absflux = abs_sum; if (mode &CPL_STATS_SQFLUX) self->sqflux = sqr_sum; if (mode &CPL_STATS_MINPOS) { self->min_x = 1 + min_pos % image->nx; self->min_y = 1 + min_pos / image->nx; } if (mode &CPL_STATS_MAXPOS) { self->max_x = 1 + max_pos % image->nx; self->max_y = 1 + max_pos / image->nx; } if (mode & CPL_STATS_MEDIAN_DEV) self->med_dev = dev_sum / (double) npix; return self; } /*----------------------------------------------------------------------------*/ /** @brief Compute various statistics of an image. @param image input image. @param mode Bit field specifying which statistics to compute @return 1 newly allocated cpl_stats structure or NULL in error case @see cpl_stats_new_from_image_window() */ /*----------------------------------------------------------------------------*/ cpl_stats * cpl_stats_new_from_image(const cpl_image * image, cpl_stats_mode mode) { cpl_stats * self; cpl_ensure(image != NULL, CPL_ERROR_NULL_INPUT, NULL); self = cpl_stats_new_from_image_window(image, mode, 1, 1, image->nx, image->ny); /* Propagate error, if any */ if (self == NULL) (void)cpl_error_set_where_(); return self; } /*----------------------------------------------------------------------------*/ /** @brief Dump a cpl_stats object @param self cpl_stats object to dump @param mode Bit field specifying which statistics to dump @param stream The output stream @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ @see cpl_stats_new_from_image_window() It is an error to request parameters that have not been set. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if mode specifies statistics that have not been computed - CPL_ERROR_FILE_IO if the write fails */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_stats_dump(const cpl_stats * self, cpl_stats_mode mode, FILE * stream) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(stream != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code((mode & ~self->mode) == 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code( fprintf(stream, "\t\tPixel count: %" CPL_SIZE_FORMAT "\n", self->npix) >0, CPL_ERROR_FILE_IO); CPL_STATS_DUMP_ONE(CPL_STATS_MIN, min, "Min", ".8g"); CPL_STATS_DUMP_ONE(CPL_STATS_MAX, max, "Max", ".8g"); CPL_STATS_DUMP_ONE(CPL_STATS_MEAN, mean, "Mean", ".8g"); CPL_STATS_DUMP_ONE(CPL_STATS_MEDIAN, med, "Median", ".8g"); CPL_STATS_DUMP_ONE(CPL_STATS_MEDIAN_DEV, med_dev, "Median dev", ".8g"); CPL_STATS_DUMP_ONE(CPL_STATS_MAD, mad, "MAD", ".8g"); CPL_STATS_DUMP_ONE(CPL_STATS_STDEV, stdev, "Std. dev", ".8g"); CPL_STATS_DUMP_ONE(CPL_STATS_FLUX, flux, "Flux", ".8g"); CPL_STATS_DUMP_ONE(CPL_STATS_ABSFLUX, absflux, "Abs flux", ".8g"); CPL_STATS_DUMP_ONE(CPL_STATS_SQFLUX, sqflux, "Sq. flux", ".8g"); CPL_STATS_DUMP_TWO(CPL_STATS_CENTROID, centroid, "centroid", ".8g"); CPL_STATS_DUMP_TWO(CPL_STATS_MINPOS, min, "min. pos.", CPL_SIZE_FORMAT); CPL_STATS_DUMP_TWO(CPL_STATS_MAXPOS, max, "max. pos.", CPL_SIZE_FORMAT); /* Failure here means a new member has been added, without dump support */ return mode ? cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE) : CPL_ERROR_NONE; } /**@}*/ cpl-6.4.1/cplcore/cpl_imagelist_defs.h0000644000460300003120000000366011611563407014640 00000000000000/* $Id: cpl_imagelist_defs.h,v 1.14 2011-07-20 14:32:39 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-20 14:32:39 $ * $Revision: 1.14 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGELIST_DEFS_H #define CPL_IMAGELIST_DEFS_H /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ #define CPL_CLASS_NONE 0 #define CPL_CLASS_DOUBLE 1 #define CPL_CLASS_FLOAT 2 #define CPL_CLASS_INT 3 /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_imagelist.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ struct _cpl_imagelist_ { cpl_size ni; cpl_image ** images; }; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_vector.h0000644000460300003120000001566712103730034013162 00000000000000/* $Id: cpl_vector.h,v 1.66 2013-02-04 12:57:00 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-02-04 12:57:00 $ * $Revision: 1.66 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_VECTOR_H #define CPL_VECTOR_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include "cpl_type.h" #include "cpl_error.h" #include "cpl_propertylist.h" #include "cpl_matrix.h" #include "cpl_io.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef CPL_KERNEL_DEFAULT #define CPL_KERNEL_DEFAULT CPL_KERNEL_TANH #endif /* Suggested resolution of interpolation profile */ #ifndef CPL_KERNEL_TABSPERPIX #define CPL_KERNEL_TABSPERPIX 1000 #endif /* Suggested radius of pixel interpolation */ #ifndef CPL_KERNEL_DEF_WIDTH #define CPL_KERNEL_DEF_WIDTH 2.0 #endif /* Suggested length of interpolation profile */ #define CPL_KERNEL_DEF_SAMPLES \ (1+(cpl_size)((CPL_KERNEL_TABSPERPIX) * (CPL_KERNEL_DEF_WIDTH))) /* FIXME: Will disappear. Do not use in new code! */ #define cpl_wlcalib_xc_convolve_create_kernel \ cpl_vector_new_lss_kernel #define cpl_wlcalib_xc_convolve \ cpl_vector_convolve_symmetric /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ typedef enum { CPL_LOWPASS_LINEAR, CPL_LOWPASS_GAUSSIAN } cpl_lowpass; typedef enum { CPL_KERNEL_TANH, CPL_KERNEL_SINC, CPL_KERNEL_SINC2, CPL_KERNEL_LANCZOS, CPL_KERNEL_HAMMING, CPL_KERNEL_HANN, CPL_KERNEL_NEAREST } cpl_kernel; typedef enum { CPL_FIT_CENTROID = 1 << 1, CPL_FIT_STDEV = 1 << 2, CPL_FIT_AREA = 1 << 3, CPL_FIT_OFFSET = 1 << 4, CPL_FIT_ALL = (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) } cpl_fit_mode; typedef enum { /* Must use these values for backwards compatability of cpl_vector_sort() */ CPL_SORT_DESCENDING = -1, CPL_SORT_ASCENDING = 1 } cpl_sort_direction; typedef struct _cpl_vector_ cpl_vector; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* Constructors and destructors */ cpl_vector * cpl_vector_new(cpl_size) CPL_ATTR_ALLOC; cpl_vector * cpl_vector_wrap(cpl_size, double *) CPL_ATTR_ALLOC; void cpl_vector_delete(cpl_vector *); void * cpl_vector_unwrap(cpl_vector *); cpl_vector * cpl_vector_read(const char *) CPL_ATTR_ALLOC; void cpl_vector_dump(const cpl_vector *, FILE *); cpl_vector * cpl_vector_load(const char *, cpl_size) CPL_ATTR_ALLOC; cpl_error_code cpl_vector_save(const cpl_vector *, const char *, cpl_type, const cpl_propertylist *, unsigned); cpl_vector * cpl_vector_duplicate(const cpl_vector *) CPL_ATTR_ALLOC; cpl_error_code cpl_vector_copy(cpl_vector *, const cpl_vector *); /* Accessor functions */ cpl_size cpl_vector_get_size(const cpl_vector *); double * cpl_vector_get_data(cpl_vector *); const double * cpl_vector_get_data_const(const cpl_vector *); double cpl_vector_get(const cpl_vector *, cpl_size); cpl_error_code cpl_vector_set_size(cpl_vector *, cpl_size); cpl_error_code cpl_vector_set(cpl_vector *, cpl_size, double); /* Basic operations */ cpl_error_code cpl_vector_add(cpl_vector *, const cpl_vector *); cpl_error_code cpl_vector_subtract(cpl_vector *, const cpl_vector *); cpl_error_code cpl_vector_multiply(cpl_vector *, const cpl_vector *); cpl_error_code cpl_vector_divide(cpl_vector *, const cpl_vector *); double cpl_vector_product(const cpl_vector *, const cpl_vector *); cpl_error_code cpl_vector_sort(cpl_vector *, cpl_sort_direction); cpl_error_code cpl_vector_add_scalar(cpl_vector *, double); cpl_error_code cpl_vector_subtract_scalar(cpl_vector *, double); cpl_error_code cpl_vector_multiply_scalar(cpl_vector *, double); cpl_error_code cpl_vector_divide_scalar(cpl_vector *, double); cpl_error_code cpl_vector_logarithm(cpl_vector *, double); cpl_error_code cpl_vector_exponential(cpl_vector *, double); cpl_error_code cpl_vector_power(cpl_vector *, double); cpl_error_code cpl_vector_fill(cpl_vector *, double); cpl_error_code cpl_vector_sqrt(cpl_vector *); cpl_size cpl_vector_find(const cpl_vector *, double); cpl_vector * cpl_vector_extract(const cpl_vector *, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; /* Statistics on cpl_vector */ double cpl_vector_get_min(const cpl_vector *); double cpl_vector_get_max(const cpl_vector *); double cpl_vector_get_sum(const cpl_vector *); double cpl_vector_get_mean(const cpl_vector *); double cpl_vector_get_median(cpl_vector *); double cpl_vector_get_median_const(const cpl_vector *); double cpl_vector_get_stdev(const cpl_vector *); cpl_size cpl_vector_correlate(cpl_vector *, const cpl_vector *, const cpl_vector *); /* Filtering */ cpl_vector * cpl_vector_filter_lowpass_create(const cpl_vector *, cpl_lowpass, cpl_size) CPL_ATTR_ALLOC; cpl_vector * cpl_vector_filter_median_create(const cpl_vector *, cpl_size) CPL_ATTR_ALLOC; cpl_error_code cpl_vector_fill_kernel_profile(cpl_vector *, cpl_kernel, double); /* Fitting */ cpl_error_code cpl_vector_fit_gaussian(const cpl_vector *, const cpl_vector *, const cpl_vector *, const cpl_vector *, cpl_fit_mode, double *, double *, double *, double *, double *, double *, cpl_matrix **); cpl_vector * cpl_vector_new_lss_kernel(double, double) CPL_ATTR_DEPRECATED; cpl_error_code cpl_vector_convolve_symmetric(cpl_vector *, const cpl_vector *) CPL_ATTR_DEPRECATED; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_io.h0000644000460300003120000001043312111453015012251 00000000000000/* $Id: cpl_io.h,v 1.21 2013-02-21 17:14:53 cgarcia Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: cgarcia $ * $Date: 2013-02-21 17:14:53 $ * $Revision: 1.21 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IO_H #define CPL_IO_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_io I/O * * This module provides definitions related to I/O. The actual I/O functions * are defined in the respective CPL modules. * * @par Synopsis: * @code * #include "cpl_io.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** * * @brief These are the file I/O modes. * * For the compression modes, * see http://heasarc.nasa.gov/docs/software/fitsio/compression.html */ /*----------------------------------------------------------------------------*/ enum _cpl_io_type_ { /* * More modes may be added in the future. To support future combination of * different modes (using bit-wise or) no mode has the value 1, since this * makes the (mis)use of logical or detectable. */ /** @hideinitializer */ CPL_IO_CREATE = ((unsigned)1 << 1), /**< Overwrite the file, if it already exists. */ /** @hideinitializer */ CPL_IO_EXTEND = ((unsigned)1 << 2), /**< Append a new extension to the file. */ /** @hideinitializer */ CPL_IO_APPEND = ((unsigned)1 << 3), /**< Append to the last data unit of the file. */ /** @hideinitializer */ CPL_IO_COMPRESS_GZIP = ((unsigned)1 << 4), /**< Use FITS tiled-image compression with GZIP algorithm. */ /** @hideinitializer */ CPL_IO_COMPRESS_RICE = ((unsigned)1 << 5), /**< Use FITS tiled-image compression with RICE algorithm. */ /** @hideinitializer */ CPL_IO_COMPRESS_HCOMPRESS = ((unsigned)1 << 6), /**< Use FITS tiled-image compression with HCOMPRESS algorithm. */ /** @hideinitializer */ CPL_IO_COMPRESS_PLIO = ((unsigned)1 << 7), /**< Use FITS tiled-image compression with PLIO algorithm. */ /** @hideinitializer */ CPL_IO_MAX = ((unsigned)1 << 8), /**< Reserved for internal CPL usage. */ /** @hideinitializer */ CPL_IO_DEFAULT = ((unsigned)CPL_IO_CREATE) /**< Deprecated, kept only for backwards compatibility */ }; /** * @brief * The file I/O modes. */ typedef enum _cpl_io_type_ cpl_io_type; /** @deprecated Use CPL_TYPE_UCHAR */ #define CPL_BPP_8_UNSIGNED CPL_TYPE_UCHAR /** @deprecated Use CPL_TYPE_SHORT */ #define CPL_BPP_16_SIGNED CPL_TYPE_SHORT /** @deprecated Use CPL_TYPE_USHORT */ #define CPL_BPP_16_UNSIGNED CPL_TYPE_USHORT /** @deprecated Use CPL_TYPE_INT */ #define CPL_BPP_32_SIGNED CPL_TYPE_INT /** @deprecated Use CPL_TYPE_FLOAT */ #define CPL_BPP_IEEE_FLOAT CPL_TYPE_FLOAT /** @deprecated Use CPL_TYPE_DOUBLE */ #define CPL_BPP_IEEE_DOUBLE CPL_TYPE_DOUBLE /** @deprecated Use cpl_type */ #define cpl_type_bpp cpl_type /**@}*/ CPL_END_DECLS #endif /* CPL_IO_H */ cpl-6.4.1/cplcore/cpl_imagelist_basic.c0000644000460300003120000011676512057601433015003 00000000000000/* $Id: cpl_imagelist_basic.c,v 1.58 2012-12-05 08:17:31 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-12-05 08:17:31 $ * $Revision: 1.58 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include "cpl_memory.h" #include "cpl_imagelist_basic.h" #include "cpl_imagelist_io.h" #include "cpl_image_basic.h" #include "cpl_image_io.h" #include "cpl_image_bpm.h" #include "cpl_stats.h" #include "cpl_error_impl.h" #include "cpl_tools.h" #include "cpl_mask.h" #include "cpl_imagelist_defs.h" #include "cpl_image_defs.h" /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ #define CPL_IMLIST_BASIC_OPER 0 #define CPL_IMLIST_BASIC_IMAGE_LOCAL 1 #define CPL_IMLIST_BASIC_TIME_MEDIAN 2 #define CPL_IMLIST_BASIC_TIME_MINMAX 3 #define CPL_IMLIST_BASIC_TIME_SIGCLIP 4 #define CPL_IMLIST_BASIC_SWAP_AXIS 5 /**@{*/ /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ #define CPL_OPERATION CPL_IMLIST_BASIC_OPER /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Add two image lists, the first one is replaced by the result. @param in1 first input image list (modified) @param in2 image list to add @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_add() The two input lists must have the same size, the image number n in the list in2 is added to the image number n in the list in1. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the input images have different sizes */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_add( cpl_imagelist * in1, const cpl_imagelist * in2) { #define CPL_OPERATOR cpl_image_add #include "cpl_imagelist_basic_body.h" #undef CPL_OPERATOR } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Subtract two image lists, the first one is replaced by the result. @param in1 first input image list (modified) @param in2 image list to subtract @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_subtract() @see cpl_imagelist_add() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_subtract( cpl_imagelist * in1, const cpl_imagelist * in2) { #define CPL_OPERATOR cpl_image_subtract #include "cpl_imagelist_basic_body.h" #undef CPL_OPERATOR } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Multiply two image lists, the first one is replaced by the result. @param in1 first input image list (modified) @param in2 image list to multiply @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_multiply() @see cpl_imagelist_add() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_multiply( cpl_imagelist * in1, const cpl_imagelist * in2) { #define CPL_OPERATOR cpl_image_multiply #include "cpl_imagelist_basic_body.h" #undef CPL_OPERATOR } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Divide two image lists, the first one is replaced by the result. @param in1 first input image list (modified) @param in2 image list to divide @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_divide() @see cpl_imagelist_add() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_divide( cpl_imagelist * in1, const cpl_imagelist * in2) { #define CPL_OPERATOR cpl_image_divide #include "cpl_imagelist_basic_body.h" #undef CPL_OPERATOR } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMLIST_BASIC_IMAGE_LOCAL /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Add an image to an image list. @param imlist input image list (modified) @param img image to add @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_add() The passed image is added to each image of the passed image list. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_add_image( cpl_imagelist * imlist, const cpl_image * img) { #define CPL_OPERATOR cpl_image_add #include "cpl_imagelist_basic_body.h" #undef CPL_OPERATOR } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Subtract an image from an image list. @param imlist input image list (modified) @param img image to subtract @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_subtract() @see cpl_imagelist_add_image() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_subtract_image( cpl_imagelist * imlist, const cpl_image * img) { #define CPL_OPERATOR cpl_image_subtract #include "cpl_imagelist_basic_body.h" #undef CPL_OPERATOR } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Multiply an image list by an image. @param imlist input image list (modified) @param img image to multiply @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_multiply() @see cpl_imagelist_add_image() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_multiply_image( cpl_imagelist * imlist, const cpl_image * img) { #define CPL_OPERATOR cpl_image_multiply #include "cpl_imagelist_basic_body.h" #undef CPL_OPERATOR } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Divide an image list by an image. @param imlist input image list (modified) @param img image for division @return the #_cpl_error_code_ or CPL_ERROR_NONE @see cpl_image_divide() @see cpl_imagelist_add_image() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_divide_image( cpl_imagelist * imlist, const cpl_image * img) { #define CPL_OPERATOR cpl_image_divide #include "cpl_imagelist_basic_body.h" #undef CPL_OPERATOR } #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Elementwise addition of a scalar to each image in the imlist @param imlist Imagelist to be modified in place. @param addend Number to add @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @see cpl_image_add_scalar() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_add_scalar( cpl_imagelist * imlist, double addend) { cpl_size i; /* Check inputs */ cpl_ensure_code(imlist != NULL, CPL_ERROR_NULL_INPUT); for (i=0; i < imlist->ni; i++) cpl_ensure_code( !cpl_image_add_scalar(imlist->images[i], addend), cpl_error_get_code()); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Elementwise subtraction of a scalar from each image in the imlist @param imlist Imagelist to be modified in place. @param subtrahend Number to subtract @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @see cpl_imagelist_add_scalar() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_subtract_scalar( cpl_imagelist * imlist, double subtrahend) { cpl_size i; /* Check inputs */ cpl_ensure_code(imlist != NULL, CPL_ERROR_NULL_INPUT); for (i=0; i < imlist->ni; i++) cpl_ensure_code(!cpl_image_subtract_scalar(imlist->images[i],subtrahend), cpl_error_get_code()); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Elementwise multiplication of the imlist with a scalar @param imlist Imagelist to be modified in place. @param factor Number to multiply with @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @see cpl_imagelist_add_scalar() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_multiply_scalar( cpl_imagelist * imlist, double factor) { cpl_size i; /* Check inputs */ cpl_ensure_code(imlist != NULL, CPL_ERROR_NULL_INPUT); for (i=0; i < imlist->ni; i++) cpl_ensure_code( !cpl_image_multiply_scalar(imlist->images[i], factor), cpl_error_get_code()); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Elementwise division of each image in the imlist with a scalar @param imlist Imagelist to be modified in place. @param divisor Non-zero number to divide with @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @see cpl_imagelist_add_scalar() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_divide_scalar( cpl_imagelist * imlist, double divisor) { cpl_size i; /* Check inputs */ cpl_ensure_code(imlist != NULL, CPL_ERROR_NULL_INPUT); for (i=0; i < imlist->ni; i++) cpl_ensure_code( !cpl_image_divide_scalar(imlist->images[i], divisor), cpl_error_get_code()); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Compute the elementwise logarithm of each image in the imlist @param imlist Imagelist to be modified in place. @param base Base of the logarithm. @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @see cpl_image_logarithm() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_logarithm( cpl_imagelist * imlist, double base) { cpl_size i; /* Check inputs */ cpl_ensure_code(imlist != NULL, CPL_ERROR_NULL_INPUT); for (i=0; i < imlist->ni; i++) cpl_ensure_code( !cpl_image_logarithm(imlist->images[i], base), cpl_error_get_code()); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Compute the elementwise exponential of each image in the imlist @param imlist Imagelist to be modified in place. @param base Base of the exponential. @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @see cpl_image_exponential() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_exponential( cpl_imagelist * imlist, double base) { cpl_size i; /* Check inputs */ cpl_ensure_code(imlist != NULL, CPL_ERROR_NULL_INPUT); for (i=0; i < imlist->ni; i++) cpl_ensure_code( !cpl_image_exponential(imlist->images[i], base), cpl_error_get_code()); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Compute the elementwise power of each image in the imlist @param imlist Imagelist to be modified in place. @param exponent Scalar exponent @return CPL_ERROR_NONE or the relevant the #_cpl_error_code_ on error @see cpl_image_power() Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_power( cpl_imagelist * imlist, double exponent) { cpl_size i; /* Check inputs */ cpl_ensure_code(imlist != NULL, CPL_ERROR_NULL_INPUT); for (i=0; i < imlist->ni; i++) cpl_ensure_code( !cpl_image_power(imlist->images[i], exponent), cpl_error_get_code()); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Normalize each image in the list. @param imlist Imagelist to modify. @param mode Normalization mode. @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_image_normalise() The list may be partly modified if an error occurs. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_normalise( cpl_imagelist * imlist, cpl_norm mode) { cpl_size i; /* Check inputs */ cpl_ensure_code(imlist != NULL, CPL_ERROR_NULL_INPUT); for (i=0; ini; i++) cpl_ensure_code(!cpl_image_normalise(imlist->images[i], mode), cpl_error_get_code()); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Threshold all pixel values to an interval. @param imlist Image list to threshold. @param lo_cut Lower bound. @param hi_cut Higher bound. @param assign_lo_cut Value to assign to pixels below low bound. @param assign_hi_cut Value to assign to pixels above high bound. @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_image_threshold() Threshold the images of the list using cpl_image_threshold() The input image list is modified. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_INCOMPATIBLE_INPUT if lo_cut is bigger than hi_cut */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_imagelist_threshold( cpl_imagelist * imlist, double lo_cut, double hi_cut, double assign_lo_cut, double assign_hi_cut) { cpl_size i; /* Check inputs */ cpl_ensure_code(imlist != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(lo_cut < hi_cut, CPL_ERROR_INCOMPATIBLE_INPUT); for (i=0; ini; i++) cpl_ensure_code(!cpl_image_threshold(imlist->images[i], lo_cut, hi_cut, assign_lo_cut, assign_hi_cut), cpl_error_get_code()); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Create a contribution map from the bad pixel maps of the images. @param imlist The imagelist @return The contributions map (a CPL_TYPE_INT cpl_image) or NULL on error @see cpl_imagelist_is_uniform() The returned map counts for each pixel the number of good pixels in the list. The returned map has to be deallocated with cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the input image list is not valid */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_image_new_from_accepted(const cpl_imagelist * imlist) { const cpl_image * first = cpl_imagelist_get_const(imlist, 0); const cpl_size nx = cpl_image_get_size_x(first); const cpl_size ny = cpl_image_get_size_y(first); const cpl_size nz = cpl_imagelist_get_size(imlist); cpl_image * goodsum; cpl_size i; cpl_ensure(imlist != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(cpl_imagelist_is_uniform(imlist)==0, CPL_ERROR_ILLEGAL_INPUT, NULL); goodsum = cpl_image_new(nx, ny, CPL_TYPE_INT); (void)cpl_image_add_scalar(goodsum, (double)nz); /* Assume all good */ /* Loop on the images */ for (i = 0; i < nz; i++) { const cpl_mask * bpmap = cpl_image_get_bpm_const(cpl_imagelist_get_const(imlist, i)); if (bpmap != NULL) { /* Bad pixels get value 1, good ones 0 */ cpl_image * badone = cpl_image_new_from_mask(bpmap); (void)cpl_image_subtract(goodsum, badone); /* FIXME: Reuse badone */ cpl_image_delete(badone); } } return goodsum; } /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Average an imagelist to a single image @param imlist the input images list @return the average image or NULL on error case. @see cpl_imagelist_is_uniform() The returned image has to be deallocated with cpl_image_delete(). The bad pixel maps of the images in the input list are taken into account, the result image pixels are flagged as rejected for those where there were no good pixel at the same position in the input image list. For integer pixel types, the averaging is performed using integer division. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the input image list is not valid */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_imagelist_collapse_create(const cpl_imagelist * imlist) { cpl_image * avg; cpl_image * contrib; cpl_size i; /* Check inputs */ cpl_ensure(imlist != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(cpl_imagelist_is_uniform(imlist)==0, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Should not be able to fail now */ /* Create avg with the first image */ avg = cpl_image_duplicate(imlist->images[0]); cpl_image_fill_rejected(avg, 0.0); cpl_image_accept_all(avg); /* Add all images together */ for (i=1; ini; i++) { cpl_image * tmp_im; if (cpl_image_get_bpm_const(imlist->images[i])) { tmp_im = cpl_image_duplicate(imlist->images[i]); cpl_image_fill_rejected(tmp_im, 0.0); cpl_image_accept_all(tmp_im); } else { tmp_im = imlist->images[i]; } cpl_image_add(avg, tmp_im); if (tmp_im != imlist->images[i]) cpl_image_delete(tmp_im); } /* Compute the contribution map */ contrib = cpl_image_new_from_accepted(imlist); /* Divide by the number of contributions */ /* Any zero in the contribution map will lead to a bad pixel in avg */ /* - bad pixels in avg are zero-valued due to the initial cpl_image_fill_rejected() */ if (cpl_image_divide(avg, contrib)) { cpl_image_delete(avg); avg = NULL; (void)cpl_error_set_where_(); } cpl_image_delete(contrib); return avg; } #define CPL_OPERATION CPL_IMLIST_BASIC_TIME_MINMAX /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Average with rejection an imagelist to a single image @param self The image list to average @param nlow Number of low rejected values @param nhigh Number of high rejected values @return The average image or NULL on error @note The returned image has to be deallocated with cpl_image_delete(). The input images are averaged, for each pixel position the nlow lowest pixels and the nhigh highest pixels are discarded for the average computation. The input image list can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. The created image will be of the same type. On success each pixel in the created image is the average of the non-rejected values on the pixel position in the input image list. For a given pixel position any bad pixels (i.e. values) are handled as follows: Given n bad values on a given pixel position, n/2 of those values are assumed to be low outliers and n/2 of those values are assumed to be high outliers. Any low or high rejection will first reject up to n/2 bad values and if more values need to be rejected that rejection will take place on the good values. This rationale behind this is to allow the rejection of outliers to include bad pixels without introducing a bias. If for a given pixel all values in the input image list are rejected, the resulting pixel is set to zero and flagged as rejected. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an the input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the input image list is not valid or if the sum of the rejections is not lower than the number of images or if nlow or nhigh is negative - CPL_ERROR_INVALID_TYPE if the passed image list type is not supported */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_imagelist_collapse_minmax_create(const cpl_imagelist * self, cpl_size nlow, cpl_size nhigh) { const cpl_image * imgself = cpl_imagelist_get_const(self, 0); const cpl_type type = cpl_image_get_type(imgself); const size_t ni = cpl_imagelist_get_size(self); const size_t nx = cpl_image_get_size_x(imgself); const size_t ny = cpl_image_get_size_y(imgself); const size_t nrej = (size_t)(nlow + nhigh); cpl_image * avg = NULL; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(cpl_imagelist_is_uniform(self)==0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(nlow >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(nhigh >= 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(ni > nrej, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Switch on the data type */ switch (type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_imagelist_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_imagelist_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_imagelist_basic_body.h" #undef CPL_CLASS default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return avg; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMLIST_BASIC_TIME_SIGCLIP /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Collapse an imagelist with kappa-sigma-clipping rejection @param self The input imagelist @param kappalow kappa-factor for lower clipping threshold @param kappahigh kappa-factor for upper clipping threshold @param keepfrac The fraction of values to keep (0.0 < keepfrac <= 1.0) @param mode Clipping mode, CPL_COLLAPSE_MEAN or CPL_COLLAPSE_MEDIAN @param contrib Pre-allocated integer-image for contribution map or NULL @return The collapsed image or NULL on error case. @note The returned image has to be deallocated with cpl_image_delete(). The collapsing is an iterative process which will stop when it converges (i.e. an iteration did not reject any values for a given pixel) or when the next iteration would reduce the fraction of values to keep to less than or equal to keepfrac. A call with keepfrac == 1.0 will thus perform no clipping. Supported modes: CPL_COLLAPSE_MEAN: The center value of the acceptance range will be the mean. CPL_COLLAPSE_MEDIAN: The center value of the acceptance range will be the median. CPL_COLLAPSE_MEDIAN_MEAN: The center value of the acceptance range will be the median in the first iteration and in subsequent iterations it will be the mean. For each pixel position the pixels whose value is higher than center + kappahigh * stdev or lower than center - kappalow * stdev are discarded for the subsequent center and stdev computation, where center is defined according to the clipping mode, and stdev is the standard deviation of the values at that pixel position. Since the acceptance interval must be non-empty, the sum of kappalow and kappahigh must be positive. A typical call has both kappalow and kappahigh positive. The minimum number of values that the clipping can select is 2. This is because the clipping criterion is based on the sample standard deviation, which needs at least two values to be defined. This means that all calls with (positive) values of keepfrac less than 2/n will behave the same. To ensure that the values in (at least) i planes out of n are kept, keepfrac can be set to (i - 0.5) / n, e.g. to keep at least 50 out of 100 values, keepfrac can be set to 0.495. The output pixel is set to the mean of the non-clipped values, also in the median mode. Regardless of the input pixel type, the mean is computed in double precision. The result is then cast to the output-pixel type, which is identical to the input pixel type. The input parameter contrib is optional. It must be either NULL or point to a pre-allocated image of type CPL_TYPE_INT and size equal to the images in the imagelist. On success, it will contain the contribution map, i.e. the number of kept (non-clipped) values after the iterative process on every pixel. Bad pixels are ignored from the start. This means that with a sufficient number of bad pixels, the fraction of good values will be less than keepfrac. In this case no iteration is performed at all. If there is at least one good value available, then the mean will be based on the good value(s). If for a given pixel position there are no good values, then that pixel is set to zero, rejected as bad and if available the value in the contribution map is set to zero. The input imagelist can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_DATA_NOT_FOUND if there are less than 2 images in the list - CPL_ERROR_ILLEGAL_INPUT if the sum of kappalow and kappahigh is non-positive, - CPL_ERROR_ACCESS_OUT_OF_RANGE if keepfrac is outside the required interval which is 0.0 < keepfrac <= 1.0 - CPL_ERROR_TYPE_MISMATCH if contrib is non-NULL but not of type CPL_TYPE_INT - CPL_ERROR_INCOMPATIBLE_INPUT if contrib is non-NULL but of a size incompatible with the input imagelist - CPL_ERROR_INVALID_TYPE if the type of the input imagelist is unsupported - CPL_ERROR_UNSUPPORTED_MODE if the passed mode is none of the above listed */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_imagelist_collapse_sigclip_create(const cpl_imagelist * self, double kappalow, double kappahigh, double keepfrac, cpl_collapse_mode mode, cpl_image * contrib) { const cpl_size ni = cpl_imagelist_get_size(self); const cpl_image * img = cpl_imagelist_get_const(self, 0); const cpl_size nx = cpl_image_get_size_x(img); const cpl_size ny = cpl_image_get_size_y(img); cpl_image * clipped = NULL; int * pcontrib = NULL; /* Check inputs */ cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(kappalow + kappahigh > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(keepfrac > 0.0, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); cpl_ensure(keepfrac <= 1.0, CPL_ERROR_ACCESS_OUT_OF_RANGE, NULL); cpl_ensure(ni > 1, CPL_ERROR_DATA_NOT_FOUND, NULL); cpl_ensure(cpl_imagelist_is_uniform(self) == 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(mode == CPL_COLLAPSE_MEDIAN_MEAN || mode == CPL_COLLAPSE_MEDIAN || mode == CPL_COLLAPSE_MEAN, CPL_ERROR_UNSUPPORTED_MODE, NULL); if (contrib) { cpl_ensure(cpl_image_get_size_x(contrib) == nx, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(cpl_image_get_size_y(contrib) == ny, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(cpl_image_get_type(contrib) == CPL_TYPE_INT, CPL_ERROR_ILLEGAL_INPUT, NULL); pcontrib = cpl_image_get_data_int(contrib); } /* Switch on the data type */ switch (cpl_image_get_type(img)) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_imagelist_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_imagelist_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_imagelist_basic_body.h" #undef CPL_CLASS default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return clipped; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMLIST_BASIC_TIME_MEDIAN /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Create a median image from the input imagelist @param self The input image list @return The median image of the input pixel type or NULL on error @note The created image has to be deallocated with cpl_image_delete() The input image list can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. On success each pixel in the created image is the median of the values on the same pixel position in the input image list. If for a given pixel all values in the input image list are rejected, the resulting pixel is set to zero and flagged as rejected. The median is defined here as the middle value of an odd number of sorted samples and for an even number of samples as the mean of the two central values. Note that with an even number of samples the median may not be among the input samples. Also, note that in the case of an even number of integer data, the mean value will be computed using integer arithmetic. Cast your integer data to a floating point pixel type if that is not the desired behavior. Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if the input image list is not valid - CPL_ERROR_INVALID_TYPE if the passed image list pixel type is not supported */ /*----------------------------------------------------------------------------*/ cpl_image * cpl_imagelist_collapse_median_create(const cpl_imagelist * self) { cpl_image * median = NULL; const cpl_image * imself = cpl_imagelist_get_const(self, 0); const size_t nx = (size_t)cpl_image_get_size_x(imself); const size_t ny = (size_t)cpl_image_get_size_y(imself); const cpl_type type = cpl_image_get_type(imself); cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(cpl_imagelist_is_uniform(self) == 0, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Switch on the data type */ switch (type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_imagelist_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_imagelist_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_imagelist_basic_body.h" #undef CPL_CLASS default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); } return median; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMLIST_BASIC_SWAP_AXIS /*----------------------------------------------------------------------------*/ /** @ingroup cpl_imagelist @brief Swap the axis of an image list @param ilist The image list to swap @param mode The swapping mode @return The swapped image list or NULL in error case This function is intended for users that want to use the cpl_imagelist object as a cube. Swapping the axis would give them access to the usual functions in the 3 dimensions. This has the cost that it duplicates the memory consumption, which can be a problem for big amounts of data. Image list can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The mode can be either CPL_SWAP_AXIS_XZ or CPL_SWAP_AXIS_YZ Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if an input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if mode is not equal to one of the possible values or if the image list is not valid - CPL_ERROR_INVALID_TYPE if the passed image list type is not supported */ /*----------------------------------------------------------------------------*/ cpl_imagelist * cpl_imagelist_swap_axis_create( const cpl_imagelist * ilist, cpl_swap_axis mode) { cpl_imagelist * swapped; const cpl_image * image; cpl_image * cur_ima; const cpl_image * old_ima; cpl_size ni, nx, ny; cpl_type type; int recompute_bpm, nbpm; cpl_mask * cur_mask; cpl_binary * pcur_mask; cpl_binary * pold_mask; cpl_size i, j, k; /* Check entries */ cpl_ensure(ilist != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(cpl_imagelist_is_uniform(ilist)==0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(mode==CPL_SWAP_AXIS_XZ || mode==CPL_SWAP_AXIS_YZ, CPL_ERROR_ILLEGAL_INPUT, NULL); /* Initialise */ recompute_bpm = 0; image = cpl_imagelist_get_const(ilist, 0); ni = cpl_imagelist_get_size(ilist); nx = cpl_image_get_size_x(image); ny = cpl_image_get_size_y(image); type = cpl_image_get_type(image); /* Create the new image list */ swapped = cpl_imagelist_new(); /* Switch on image type */ switch (type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_imagelist_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_imagelist_basic_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_imagelist_basic_body.h" #undef CPL_CLASS default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } /* HANDLE THE BAD PIXELS MASKS */ /* Check if there are bad pixels in the input image list */ for (i=0; ibpm != NULL) { recompute_bpm = 1; break; } } /* Need to compute the new bad pixels masks */ if (recompute_bpm == 1) { /* SWAP X <-> Z */ if (mode == CPL_SWAP_AXIS_XZ) { for (i=0; ibpm != NULL) { pold_mask = cpl_mask_get_data(image->bpm); for (k=0; k 0) { cpl_image * swap = cpl_imagelist_get(swapped, i); cpl_image_reject_from_mask(swap, cur_mask); } cpl_mask_delete(cur_mask); } } else { /* SWAP Y <-> Z */ for (i=0; ibpm != NULL) { pold_mask = cpl_mask_get_data(image->bpm); for (k=0; k 0) { cpl_image * swap = cpl_imagelist_get(swapped, i); cpl_image_reject_from_mask(swap, cur_mask); } cpl_mask_delete(cur_mask); } } } return swapped; } #undef CPL_OPERATION /**@}*/ cpl-6.4.1/cplcore/cpl_version.h.top0000644000460300003120000000200010423414307014124 00000000000000/* * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * Do not edit this file! This file was automatically generated. * All changes to this file might be lost! */ #ifndef CPL_VERSION_H #define CPL_VERSION_H #include cpl-6.4.1/cplcore/cpl_math_const.h0000644000460300003120000002632712253611520014016 00000000000000/* $Id: cpl_math_const.h,v 1.10 2012-10-01 14:50:02 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-10-01 14:50:02 $ * $Revision: 1.10 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_MATH_CONST_H #define CPL_MATH_CONST_H #include CPL_BEGIN_DECLS /** * @defgroup cpl_math Fundamental math functionality * * This module provides fundamental math constants. * * Source: On-Line Encyclopedia of Integer Sequences (OEIS) * * pi: http://www.research.att.com/~njas/sequences/A000796 * * e: http://www.research.att.com/~njas/sequences/A001113 * * ln(2): http://www.research.att.com/~njas/sequences/A002162 * * ln(10): http://www.research.att.com/~njas/sequences/A002392 * * sqrt(2): http://www.research.att.com/~njas/sequences/A002193 * * sqrt(3): http://www.research.att.com/~njas/sequences/A002194 * * The derived constants have been computed with the * GNU Multiple-Precision Library v. 4.2.2. * * The constants are listed with a precision that allows a one-line definition. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** * @brief The base of the exponential function * @see On-Line Encyclopedia of Integer Sequences (OEIS), * http://www.research.att.com/~njas/sequences/A001113 */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_E 2.7182818284590452353602874713526624977572470936999595 /*----------------------------------------------------------------------------*/ /** * @brief The ratio of a circles circumference to its diameter * @see On-Line Encyclopedia of Integer Sequences (OEIS), * http://www.research.att.com/~njas/sequences/A000796 */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_PI 3.1415926535897932384626433832795028841971693993751058 /*----------------------------------------------------------------------------*/ /** * @brief The natural logarithm of 2 * @see On-Line Encyclopedia of Integer Sequences (OEIS), * http://www.research.att.com/~njas/sequences/A002162 */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_LN2 0.6931471805599453094172321214581765680755001343602553 /*----------------------------------------------------------------------------*/ /** * @brief The natural logarithm of 10 * @see On-Line Encyclopedia of Integer Sequences (OEIS), * http://www.research.att.com/~njas/sequences/A002392 */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_LN10 2.3025850929940456840179914546843642076011014886287730 /*----------------------------------------------------------------------------*/ /** @brief 2 pi @see CPL_MATH_PI @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_2PI 6.2831853071795864769252867665590057683943387987502116 /*----------------------------------------------------------------------------*/ /** @brief pi/2 @see CPL_MATH_PI @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_PI_2 1.5707963267948966192313216916397514420985846996875529 /*----------------------------------------------------------------------------*/ /** @brief pi/4 @see CPL_MATH_PI @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_PI_4 0.7853981633974483096156608458198757210492923498437765 /*----------------------------------------------------------------------------*/ /** @brief 1/pi @see CPL_MATH_PI @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_1_PI 0.3183098861837906715377675267450287240689192914809129 /*----------------------------------------------------------------------------*/ /** @brief 2/pi @see CPL_MATH_PI @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_2_PI 0.6366197723675813430755350534900574481378385829618258 /*----------------------------------------------------------------------------*/ /** @brief 4/pi @see CPL_MATH_PI @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_4_PI 1.2732395447351626861510701069801148962756771659236516 /*----------------------------------------------------------------------------*/ /** @brief sqrt(2pi) @see CPL_MATH_PI @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_SQRT2PI 2.5066282746310005024157652848110452530069867406099383 /*----------------------------------------------------------------------------*/ /** @brief 2/sqrt(pi) @see CPL_MATH_PI @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_2_SQRTPI 1.1283791670955125738961589031215451716881012586579977 /*----------------------------------------------------------------------------*/ /** * @brief The square root of 2 * @see On-Line Encyclopedia of Integer Sequences (OEIS), * http://www.research.att.com/~njas/sequences/A002193 */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_SQRT2 1.4142135623730950488016887242096980785696718753769481 /*----------------------------------------------------------------------------*/ /** * @brief The square root of 3 * @see On-Line Encyclopedia of Integer Sequences (OEIS), * http://www.research.att.com/~njas/sequences/A002194 */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_SQRT3 1.7320508075688772935274463415058723669428052538103806 /*----------------------------------------------------------------------------*/ /** @brief sqrt(1/2) @see CPL_MATH_SQRT2 @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_SQRT1_2 0.7071067811865475244008443621048490392848359376884740 /*----------------------------------------------------------------------------*/ /** @brief log2(e) @see CPL_MATH_LN2 @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_LOG2E 1.4426950408889634073599246810018921374266459541529859 /*----------------------------------------------------------------------------*/ /** @brief log10(e) @see CPL_MATH_LN10 @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_LOG10E 0.4342944819032518276511289189166050822943970058036666 /*----------------------------------------------------------------------------*/ /** @brief 180/pi @see CPL_MATH_PI @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_DEG_RAD 57.295779513082320876798154814105170332405472466564322 /*----------------------------------------------------------------------------*/ /** @brief pi/180 @see CPL_MATH_PI @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_RAD_DEG 0.0174532925199432957692369076848861271344287188854173 /*----------------------------------------------------------------------------*/ /** @brief FWHM per Sigma, 2.0*sqrt(2.0*log(2.0)) @see CPL_MATH_LN2 @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_FWHM_SIG 2.3548200450309493820231386529193992754947713787716411 /*----------------------------------------------------------------------------*/ /** @brief Sigma per FWHM, 0.5/sqrt(2.0*log(2.0)) @see CPL_MATH_LN2 @note Derived from a fundamental constant */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_SIG_FWHM 0.4246609001440095213607514170514448098575705468921770 /*----------------------------------------------------------------------------*/ /** @brief Standard deviation per Median Absolute Deviation for Gaussian data @see cpl_image_get_mad_window() For a Gaussian distribution the Median Absolute Deviation (MAD) is a robust and consistent estimate of the Standard Deviation (STD) in the sense that the STD is approximately K * MAD, where K is a constant equal to approximately 1.4826. */ /*----------------------------------------------------------------------------*/ #define CPL_MATH_STD_MAD 1.4826 /*----------------------------------------------------------------------------*/ /** @hideinitializer @brief Return the minimum of two values @param first The first expression in the comparison @param second The second expression in the comparison @return The minimum of the two values @note If the first argument is the smallest then it is evaluated twice otherwise the second argument is evaluated twice */ /*----------------------------------------------------------------------------*/ #define CPL_MIN(first, second) \ ((first) < (second) ? (first) : (second)) /* Two evaluations of minimum */ /*----------------------------------------------------------------------------*/ /** @hideinitializer @brief Return the maximum of two values @param first The first expression in the comparison @param second The second expression in the comparison @return The maximum of the two values @see CPL_MIN() */ /*----------------------------------------------------------------------------*/ #define CPL_MAX(first, second) \ ((first) > (second) ? (first) : (second)) /* Two evaluations of maximum */ /**@}*/ CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_xmemory.h0000644000460300003120000000406111466760422013361 00000000000000/* $Id: cpl_xmemory.h,v 1.11 2010-11-11 12:26:58 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 12:26:58 $ * $Revision: 1.11 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_XMEMORY_H #define CPL_XMEMORY_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include #endif #include /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ void * cpl_xmemory_malloc_count(size_t) CPL_ATTR_MALLOC; void * cpl_xmemory_calloc_count(size_t, size_t) CPL_ATTR_CALLOC; void * cpl_xmemory_realloc_count(void *, size_t) CPL_ATTR_REALLOC; void cpl_xmemory_free_count(void *); void * cpl_xmemory_malloc(size_t) CPL_ATTR_MALLOC; void * cpl_xmemory_calloc(size_t, size_t) CPL_ATTR_CALLOC; void * cpl_xmemory_realloc(void *, size_t) CPL_ATTR_REALLOC; void cpl_xmemory_free(void *); void cpl_xmemory_status(int); int cpl_xmemory_is_empty(int) CPL_ATTR_PURE; #endif cpl-6.4.1/cplcore/cpl_column.h0000644000460300003120000003567212270505777013176 00000000000000/* $Id: cpl_column.h,v 1.50 2012-02-27 16:12:47 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2012-02-27 16:12:47 $ * $Revision: 1.50 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_COLUMN_H #define CPL_COLUMN_H #include #include #include #include #include CPL_BEGIN_DECLS /* * This is the type used for any flag used in cpl_column. */ typedef int cpl_column_flag; typedef struct _cpl_column_ cpl_column; void cpl_column_dump_structure(cpl_column *column); void cpl_column_dump(cpl_column *column, cpl_size start, cpl_size count); /* * Constructors and destructors: */ cpl_column *cpl_column_new_int(cpl_size length); cpl_column *cpl_column_new_long(cpl_size length); cpl_column *cpl_column_new_long_long(cpl_size length); cpl_column *cpl_column_new_cplsize(cpl_size length); cpl_column *cpl_column_new_float(cpl_size length); cpl_column *cpl_column_new_double(cpl_size length); cpl_column *cpl_column_new_float_complex(cpl_size length); cpl_column *cpl_column_new_double_complex(cpl_size length); cpl_column *cpl_column_new_string(cpl_size length); cpl_column *cpl_column_new_array(cpl_type, cpl_size, cpl_size); cpl_error_code cpl_column_set_save_type(cpl_column *, cpl_type); cpl_type cpl_column_get_save_type(const cpl_column *); cpl_column *cpl_column_wrap_int(int *, cpl_size length); cpl_column *cpl_column_wrap_long(long *, cpl_size length); cpl_column *cpl_column_wrap_long_long(long long *, cpl_size length); cpl_column *cpl_column_wrap_cplsize(cpl_size *, cpl_size length); cpl_column *cpl_column_wrap_float(float *, cpl_size length); cpl_column *cpl_column_wrap_double(double *, cpl_size length); cpl_column *cpl_column_wrap_float_complex(_Complex float *, cpl_size length); cpl_column *cpl_column_wrap_double_complex(_Complex double *, cpl_size length); cpl_column *cpl_column_wrap_string(char **, cpl_size length); void *cpl_column_unwrap(cpl_column *); void cpl_column_delete_but_strings(cpl_column *); void cpl_column_delete_but_arrays(cpl_column *); cpl_error_code cpl_column_copy_data(cpl_column *, const double *); cpl_error_code cpl_column_copy_data_int(cpl_column *, const int *); cpl_error_code cpl_column_copy_data_long(cpl_column *, const long *); cpl_error_code cpl_column_copy_data_long_long(cpl_column *, const long long *); cpl_error_code cpl_column_copy_data_cplsize(cpl_column *, const cpl_size *); cpl_error_code cpl_column_copy_data_float(cpl_column *, const float *); cpl_error_code cpl_column_copy_data_double(cpl_column *, const double *); cpl_error_code cpl_column_copy_data_complex(cpl_column *, const _Complex double *); cpl_error_code cpl_column_copy_data_float_complex(cpl_column *, const _Complex float *); cpl_error_code cpl_column_copy_data_double_complex(cpl_column *, const _Complex double *); cpl_error_code cpl_column_copy_data_string(cpl_column *, const char **); void cpl_column_delete(cpl_column *); /* * Methods: */ cpl_error_code cpl_column_set_name(cpl_column *, const char *); const char *cpl_column_get_name(const cpl_column *); cpl_error_code cpl_column_set_unit(cpl_column *, const char *); const char *cpl_column_get_unit(const cpl_column *); cpl_error_code cpl_column_set_format(cpl_column *, const char *); const char *cpl_column_get_format(const cpl_column *); cpl_size cpl_column_get_size(const cpl_column *); cpl_size cpl_column_get_depth(const cpl_column *); cpl_size cpl_column_get_dimensions(const cpl_column *); cpl_error_code cpl_column_set_dimensions(cpl_column *, const cpl_array *); cpl_size cpl_column_get_dimension(const cpl_column *, cpl_size); cpl_type cpl_column_get_type(const cpl_column *); int *cpl_column_get_data_int(cpl_column *); const int *cpl_column_get_data_int_const(const cpl_column *); long *cpl_column_get_data_long(cpl_column *); const long *cpl_column_get_data_long_const(const cpl_column *); long long *cpl_column_get_data_long_long(cpl_column *); const long long *cpl_column_get_data_long_long_const(const cpl_column *); cpl_size *cpl_column_get_data_cplsize(cpl_column *); const cpl_size *cpl_column_get_data_cplsize_const(const cpl_column *); float *cpl_column_get_data_float(cpl_column *); const float *cpl_column_get_data_float_const(const cpl_column *); double *cpl_column_get_data_double(cpl_column *); const double *cpl_column_get_data_double_const(const cpl_column *); _Complex float *cpl_column_get_data_float_complex(cpl_column *); const _Complex float * cpl_column_get_data_float_complex_const(const cpl_column *); _Complex double *cpl_column_get_data_double_complex(cpl_column *); const _Complex double * cpl_column_get_data_double_complex_const(const cpl_column *); char **cpl_column_get_data_string(cpl_column *); const char **cpl_column_get_data_string_const(const cpl_column *); cpl_array **cpl_column_get_data_array(cpl_column *); const cpl_array **cpl_column_get_data_array_const(const cpl_column *); cpl_column_flag *cpl_column_get_data_invalid(cpl_column *); const cpl_column_flag *cpl_column_get_data_invalid_const(const cpl_column *); cpl_error_code cpl_column_set_data_invalid(cpl_column *, cpl_column_flag *, cpl_size); cpl_error_code cpl_column_set_size(cpl_column *, cpl_size); cpl_error_code cpl_column_set_depth(cpl_column *, cpl_size); double cpl_column_get(cpl_column *, cpl_size, int *null); _Complex double cpl_column_get_complex(cpl_column *, cpl_size , int *null); int cpl_column_get_int(cpl_column *, cpl_size, int *null); long cpl_column_get_long(cpl_column *, cpl_size, int *null); long long cpl_column_get_long_long(cpl_column *, cpl_size, int *null); cpl_size cpl_column_get_cplsize(cpl_column *, cpl_size, int *null); float cpl_column_get_float(cpl_column *, cpl_size, int *null); double cpl_column_get_double(cpl_column *, cpl_size, int *null); _Complex float cpl_column_get_float_complex(cpl_column *, cpl_size, int *null); _Complex double cpl_column_get_double_complex(cpl_column *, cpl_size, int *null); char *cpl_column_get_string(cpl_column *, cpl_size); const char *cpl_column_get_string_const(const cpl_column *, cpl_size); cpl_array *cpl_column_get_array(cpl_column *, cpl_size); const cpl_array *cpl_column_get_array_const(const cpl_column *, cpl_size); cpl_error_code cpl_column_set(cpl_column *, cpl_size, double); cpl_error_code cpl_column_set_int(cpl_column *, cpl_size, int); cpl_error_code cpl_column_set_long(cpl_column *, cpl_size, long); cpl_error_code cpl_column_set_long_long(cpl_column *, cpl_size, long long); cpl_error_code cpl_column_set_cplsize(cpl_column *, cpl_size, cpl_size); cpl_error_code cpl_column_set_float(cpl_column *, cpl_size, float); cpl_error_code cpl_column_set_double(cpl_column *, cpl_size, double); cpl_error_code cpl_column_set_complex(cpl_column *, cpl_size, _Complex double); cpl_error_code cpl_column_set_float_complex(cpl_column *, cpl_size, _Complex float); cpl_error_code cpl_column_set_double_complex(cpl_column *, cpl_size, _Complex double); cpl_error_code cpl_column_set_string(cpl_column *, cpl_size, const char *); cpl_error_code cpl_column_set_array(cpl_column *, cpl_size, const cpl_array *); cpl_error_code cpl_column_fill(cpl_column *, cpl_size, cpl_size, double); cpl_error_code cpl_column_fill_int(cpl_column *, cpl_size, cpl_size, int); cpl_error_code cpl_column_fill_long(cpl_column *, cpl_size, cpl_size, long); cpl_error_code cpl_column_fill_long_long(cpl_column *, cpl_size, cpl_size, long long); cpl_error_code cpl_column_fill_cplsize(cpl_column *, cpl_size, cpl_size, cpl_size); cpl_error_code cpl_column_fill_float(cpl_column *, cpl_size, cpl_size, float); cpl_error_code cpl_column_fill_double(cpl_column *, cpl_size, cpl_size, double); cpl_error_code cpl_column_fill_complex(cpl_column *, cpl_size, cpl_size, _Complex double); cpl_error_code cpl_column_fill_float_complex(cpl_column *, cpl_size, cpl_size, _Complex float); cpl_error_code cpl_column_fill_double_complex(cpl_column *, cpl_size, cpl_size, _Complex double); cpl_error_code cpl_column_fill_string(cpl_column *, cpl_size, cpl_size, const char *); cpl_error_code cpl_column_fill_array(cpl_column *, cpl_size, cpl_size, const cpl_array *); cpl_error_code cpl_column_copy_segment(cpl_column *, cpl_size, cpl_size, double *); cpl_error_code cpl_column_copy_segment_int(cpl_column *, cpl_size, cpl_size, int *); cpl_error_code cpl_column_copy_segment_long(cpl_column *, cpl_size, cpl_size, long *); cpl_error_code cpl_column_copy_segment_long_long(cpl_column *, cpl_size, cpl_size, long long *); cpl_error_code cpl_column_copy_segment_cplsize(cpl_column *, cpl_size, cpl_size, cpl_size *); cpl_error_code cpl_column_copy_segment_float(cpl_column *, cpl_size, cpl_size, float *); cpl_error_code cpl_column_copy_segment_double(cpl_column *, cpl_size, cpl_size, double *); cpl_error_code cpl_column_copy_segment_complex(cpl_column *, cpl_size, cpl_size, _Complex double *); cpl_error_code cpl_column_copy_segment_float_complex(cpl_column *, cpl_size, cpl_size, _Complex float *); cpl_error_code cpl_column_copy_segment_double_complex(cpl_column *, cpl_size, cpl_size, _Complex double *); cpl_error_code cpl_column_copy_segment_string(cpl_column *, cpl_size, cpl_size, char **); cpl_error_code cpl_column_copy_segment_array(cpl_column *, cpl_size, cpl_size, cpl_array **); cpl_error_code cpl_column_shift(cpl_column *, cpl_size); cpl_error_code cpl_column_set_invalid(cpl_column *, cpl_size); cpl_error_code cpl_column_fill_invalid(cpl_column *, cpl_size, cpl_size); int cpl_column_is_invalid(cpl_column *, cpl_size); int cpl_column_has_invalid(cpl_column *); int cpl_column_has_valid(cpl_column *); cpl_size cpl_column_count_invalid(cpl_column *); cpl_error_code cpl_column_fill_invalid_int(cpl_column *, int); cpl_error_code cpl_column_fill_invalid_long(cpl_column *, long); cpl_error_code cpl_column_fill_invalid_long_long(cpl_column *, long long); cpl_error_code cpl_column_fill_invalid_cplsize(cpl_column *, cpl_size); cpl_error_code cpl_column_fill_invalid_float(cpl_column *, float); cpl_error_code cpl_column_fill_invalid_double(cpl_column *, double); cpl_error_code cpl_column_fill_invalid_float_complex(cpl_column *, _Complex float); cpl_error_code cpl_column_fill_invalid_double_complex(cpl_column *, _Complex double); cpl_error_code cpl_column_erase_segment(cpl_column *, cpl_size, cpl_size); cpl_error_code cpl_column_erase_pattern(cpl_column *, int *); cpl_error_code cpl_column_insert_segment(cpl_column *, cpl_size, cpl_size); cpl_column *cpl_column_duplicate(cpl_column *); cpl_column *cpl_column_extract(cpl_column *, cpl_size, cpl_size); cpl_column *cpl_column_cast_to_int(cpl_column *); cpl_column *cpl_column_cast_to_long(cpl_column *); cpl_column *cpl_column_cast_to_long_long(cpl_column *); cpl_column *cpl_column_cast_to_cplsize(cpl_column *); cpl_column *cpl_column_cast_to_float(cpl_column *); cpl_column *cpl_column_cast_to_double(cpl_column *); cpl_column *cpl_column_cast_to_float_complex(cpl_column *); cpl_column *cpl_column_cast_to_double_complex(cpl_column *); cpl_column *cpl_column_cast_to_int_array(cpl_column *); cpl_column *cpl_column_cast_to_long_array(cpl_column *); cpl_column *cpl_column_cast_to_long_long_array(cpl_column *); cpl_column *cpl_column_cast_to_cplsize_array(cpl_column *); cpl_column *cpl_column_cast_to_float_array(cpl_column *); cpl_column *cpl_column_cast_to_double_array(cpl_column *); cpl_column *cpl_column_cast_to_float_complex_array(cpl_column *); cpl_column *cpl_column_cast_to_double_complex_array(cpl_column *); cpl_column *cpl_column_cast_to_int_flat(cpl_column *); cpl_column *cpl_column_cast_to_long_flat(cpl_column *); cpl_column *cpl_column_cast_to_long_long_flat(cpl_column *); cpl_column *cpl_column_cast_to_cplsize_flat(cpl_column *); cpl_column *cpl_column_cast_to_float_flat(cpl_column *); cpl_column *cpl_column_cast_to_double_flat(cpl_column *); cpl_column *cpl_column_cast_to_float_complex_flat(cpl_column *); cpl_column *cpl_column_cast_to_double_complex_flat(cpl_column *); cpl_error_code cpl_column_merge(cpl_column *, cpl_column *, cpl_size); cpl_error_code cpl_column_add(cpl_column *, cpl_column *); cpl_error_code cpl_column_subtract(cpl_column *, cpl_column *); cpl_error_code cpl_column_multiply(cpl_column *, cpl_column *); cpl_error_code cpl_column_divide(cpl_column *, cpl_column *); cpl_error_code cpl_column_add_scalar(cpl_column *, double); cpl_error_code cpl_column_add_scalar_complex(cpl_column *, _Complex double); cpl_error_code cpl_column_subtract_scalar(cpl_column *, double); cpl_error_code cpl_column_subtract_scalar_complex(cpl_column *, _Complex double); cpl_error_code cpl_column_multiply_scalar(cpl_column *, double); cpl_error_code cpl_column_multiply_scalar_complex(cpl_column *, _Complex double); cpl_error_code cpl_column_divide_scalar(cpl_column *, double); cpl_error_code cpl_column_divide_scalar_complex(cpl_column *, _Complex double); cpl_error_code cpl_column_absolute(cpl_column *); cpl_column *cpl_column_absolute_complex(cpl_column *); cpl_column *cpl_column_phase_complex(cpl_column *); cpl_column *cpl_column_extract_real(cpl_column *); cpl_column *cpl_column_extract_imag(cpl_column *); cpl_error_code cpl_column_logarithm(cpl_column *, double); cpl_error_code cpl_column_power(cpl_column *, double); cpl_error_code cpl_column_exponential(cpl_column *, double); cpl_error_code cpl_column_conjugate(cpl_column *); double cpl_column_get_mean(cpl_column *); _Complex double cpl_column_get_mean_complex(cpl_column *); double cpl_column_get_median(cpl_column *); double cpl_column_get_stdev(cpl_column *); double cpl_column_get_max(cpl_column *); double cpl_column_get_min(cpl_column *); cpl_error_code cpl_column_get_maxpos(cpl_column *, cpl_size *); cpl_error_code cpl_column_get_minpos(cpl_column *, cpl_size *); CPL_END_DECLS #endif /* end of cpl_column.h */ cpl-6.4.1/cplcore/cpl_image_io.h0000644000460300003120000001326312270505777013442 00000000000000/* $Id: cpl_image_io.h,v 1.79 2013-10-14 13:33:06 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-10-14 13:33:06 $ * $Revision: 1.79 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGE_IO_H #define CPL_IMAGE_IO_H /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ typedef struct _cpl_image_ cpl_image; /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_io.h" #include "cpl_propertylist.h" #include "cpl_mask.h" #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* Image constructors */ cpl_image * cpl_image_new(cpl_size, cpl_size, cpl_type) CPL_ATTR_ALLOC; cpl_image * cpl_image_wrap(cpl_size, cpl_size, cpl_type, void *) CPL_ATTR_ALLOC; cpl_image * cpl_image_wrap_double(cpl_size, cpl_size, double *) CPL_ATTR_ALLOC; cpl_image * cpl_image_wrap_float(cpl_size, cpl_size, float *) CPL_ATTR_ALLOC; cpl_image * cpl_image_wrap_int(cpl_size, cpl_size, int *) CPL_ATTR_ALLOC; #ifdef _Complex_I cpl_image * cpl_image_wrap_double_complex(cpl_size, cpl_size, _Complex double *) CPL_ATTR_ALLOC; cpl_image * cpl_image_wrap_float_complex(cpl_size, cpl_size, _Complex float *) CPL_ATTR_ALLOC; #endif cpl_image * cpl_image_load(const char *, cpl_type, cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_image * cpl_image_load_window(const char *, cpl_type, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_image * cpl_image_new_from_mask(const cpl_mask *) CPL_ATTR_ALLOC; cpl_image * cpl_image_labelise_mask_create(const cpl_mask *, cpl_size *) CPL_ATTR_ALLOC; /* Get functions */ cpl_type cpl_image_get_type(const cpl_image *); cpl_size cpl_image_get_size_x(const cpl_image *); cpl_size cpl_image_get_size_y(const cpl_image *); double cpl_image_get(const cpl_image *, cpl_size, cpl_size, int *); #ifdef _Complex_I _Complex double cpl_image_get_complex(const cpl_image *, cpl_size, cpl_size, int *); cpl_error_code cpl_image_set_complex(cpl_image *, cpl_size, cpl_size, _Complex double); #endif cpl_mask * cpl_image_set_bpm(cpl_image *, cpl_mask *); cpl_mask * cpl_image_unset_bpm(cpl_image *); cpl_mask * cpl_image_get_bpm(cpl_image *); const cpl_mask * cpl_image_get_bpm_const(const cpl_image *); void * cpl_image_get_data(cpl_image *); const void * cpl_image_get_data_const(const cpl_image *); double * cpl_image_get_data_double(cpl_image *); const double * cpl_image_get_data_double_const(const cpl_image *); float * cpl_image_get_data_float(cpl_image *); const float * cpl_image_get_data_float_const(const cpl_image *); int * cpl_image_get_data_int(cpl_image *); const int * cpl_image_get_data_int_const(const cpl_image *); #ifdef _Complex_I _Complex double * cpl_image_get_data_double_complex(cpl_image *); const _Complex double * cpl_image_get_data_double_complex_const(const cpl_image *); _Complex float * cpl_image_get_data_float_complex(cpl_image *); const _Complex float * cpl_image_get_data_float_complex_const(const cpl_image *); #endif cpl_error_code cpl_image_conjugate(cpl_image *, const cpl_image *); cpl_error_code cpl_image_fill_re_im(cpl_image *, cpl_image *, const cpl_image *); cpl_error_code cpl_image_fill_abs_arg(cpl_image *, cpl_image *, const cpl_image *); /* Set functions */ cpl_error_code cpl_image_set(cpl_image *, cpl_size, cpl_size, double); cpl_error_code cpl_image_fill_rejected(cpl_image *, double); cpl_error_code cpl_image_fill_window(cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size, double); /* Image destructor */ void cpl_image_delete(cpl_image *); void * cpl_image_unwrap(cpl_image *); /* Debugging functions */ cpl_error_code cpl_image_dump_structure(const cpl_image *, FILE *); cpl_error_code cpl_image_dump_window(const cpl_image *, cpl_size, cpl_size, cpl_size, cpl_size, FILE *); /* Others */ cpl_image * cpl_image_duplicate(const cpl_image *) CPL_ATTR_ALLOC; cpl_image * cpl_image_cast(const cpl_image *, cpl_type) CPL_ATTR_ALLOC; /* Saving function */ cpl_error_code cpl_image_save(const cpl_image *, const char *, cpl_type, const cpl_propertylist *, unsigned); CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_image_resample.c0000644000460300003120000011564311766112534014635 00000000000000/* $Id: cpl_image_resample.c,v 1.57 2012-06-13 13:27:56 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-06-13 13:27:56 $ * $Revision: 1.57 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_tools.h" #include "cpl_memory.h" #include "cpl_image_resample.h" #include "cpl_mask.h" #include "cpl_error_impl.h" #include "cpl_image_defs.h" #include #include #include #include #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #define CPL_IMAGE_RESAMPLE_SUBSAMPLE 1 #define CPL_IMAGE_WARP 2 #define CPL_IMAGE_WARP_POLYNOMIAL 3 #define CPL_IMAGE_REBIN 4 #define CONCAT(a,b) a ## _ ## b #define CONCAT2X(a,b) CONCAT(a,b) /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ inline static double cpl_image_get_interpolated_double(const double *, const cpl_binary *, cpl_size, cpl_size, double, double, double, double, double *, const double *, double, const double *, double, double, double, double *); inline static double cpl_image_get_interpolated_float(const float *, const cpl_binary *, cpl_size, cpl_size, double, double, double, double, double *, const double *, double, const double *, double, double, double, double *); inline static double cpl_image_get_interpolated_int(const int *, const cpl_binary *, cpl_size, cpl_size, double, double, double, double, double *, const double *, double, const double *, double, double, double, double *); /** @addtogroup cpl_image Usage: define the following preprocessor symbols as needed, then include this file */ /**@{*/ /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ #define CPL_OPERATION CPL_IMAGE_WARP /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Warp an image @param out Pre-allocated destination image to hold the result @param in Source image to warp @param deltax The x shift of each pixel, same image size as out @param deltay The y shift of each pixel, same image size as out @param xprofile Interpolation weight as a function of the distance in X @param xradius Positive inclusion radius in the X-dimension @param yprofile Interpolation weight as a function of the distance in Y @param yradius Positive inclusion radius in the Y-dimension @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_image_get_interpolated() The pixel value at the (integer) position (u, v) in the destination image is interpolated from the (typically non-integer) pixel position (x, y) in the source image, where @verbatim x = u - deltax(u, v), y = v - deltay(u, v). @endverbatim The identity transform is thus given by deltax and deltay filled with zeros. The first pixel is (1, 1), located in the lower left. 'out' and 'in' may have different sizes, while deltax and deltay must have the same size as 'out'. deltax and deltay must have pixel type CPL_TYPE_DOUBLE. Beware that extreme transformations may lead to blank images. 'out' and 'in' may be of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. Examples of profiles and radius are: @verbatim xprofile = cpl_vector_new(CPL_KERNEL_DEF_SAMPLES); cpl_vector_fill_kernel_profile(profile, CPL_KERNEL_DEFAULT, CPL_KERNEL_DEF_WIDTH); xradius = CPL_KERNEL_DEF_WIDTH; @endverbatim In case a correction for flux conservation were required, please create a correction map using the function @c cpl_image_fill_jacobian(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if the input images sizes are incompatible or if the delta images are not of type CPL_TYPE_DOUBLE - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_warp( cpl_image * out, const cpl_image * in, const cpl_image * deltax, const cpl_image * deltay, const cpl_vector * xprofile, double xradius, const cpl_vector * yprofile, double yradius) { double x, y; cpl_mask * bad; cpl_binary * pbad; double value, confidence; int hasbad; const double sqxradius = xradius * xradius; const double sqyradius = yradius * yradius; double sqyxratio; double xtabsperpix; double ytabsperpix; const double * pxprof; const double * pyprof; double * yweight; cpl_size ixprolen; cpl_size iyprolen; cpl_size pos; const double * pdeltax; const double * pdeltay; cpl_size i, j; /* Check entries */ cpl_ensure_code(out, CPL_ERROR_NULL_INPUT); cpl_ensure_code(in, CPL_ERROR_NULL_INPUT); cpl_ensure_code(deltax, CPL_ERROR_NULL_INPUT); cpl_ensure_code(deltay, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_image_get_size_x(deltax) == cpl_image_get_size_x(out), CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(cpl_image_get_size_y(deltax) == cpl_image_get_size_y(out), CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(cpl_image_get_size_x(deltay) == cpl_image_get_size_x(out), CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(cpl_image_get_size_y(deltay) == cpl_image_get_size_y(out), CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(cpl_image_get_type(deltax) == CPL_TYPE_DOUBLE, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(cpl_image_get_type(deltay) == CPL_TYPE_DOUBLE, CPL_ERROR_ILLEGAL_INPUT); ixprolen = cpl_vector_get_size(xprofile); cpl_ensure_code(ixprolen > 0, CPL_ERROR_ILLEGAL_INPUT); iyprolen = cpl_vector_get_size(yprofile); cpl_ensure_code(iyprolen > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(xradius > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(yradius > 0, CPL_ERROR_ILLEGAL_INPUT); /* Initialise */ bad = NULL; hasbad = 0; pxprof = cpl_vector_get_data_const(xprofile); pyprof = cpl_vector_get_data_const(yprofile); sqyxratio = sqyradius / sqxradius; xtabsperpix = (double)(ixprolen-1)/xradius; ytabsperpix = (double)(iyprolen-1)/yradius; yweight = cpl_malloc((1 + (size_t)(2.0 * yradius)) * sizeof(double)); /* Access the offsets */ pdeltax = cpl_image_get_data_double_const(deltax); pdeltay = cpl_image_get_data_double_const(deltay); /* Create the bad pixels mask */ bad = cpl_mask_new(out->nx, out->ny); pbad = cpl_mask_get_data(bad); switch (in->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_resample_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_resample_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_resample_body.h" #undef CPL_CLASS default: cpl_error_set_(CPL_ERROR_INVALID_TYPE); } cpl_free(yweight); /* Handle bad pixels */ if (hasbad) cpl_image_reject_from_mask(out, bad); cpl_mask_delete(bad); return CPL_ERROR_NONE; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_WARP_POLYNOMIAL /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Warp an image according to a 2D polynomial transformation. @param out Pre-allocated image to hold the result @param in Image to warp. @param poly_x Defines source x-pos corresponding to destination (u,v). @param poly_y Defines source y-pos corresponding to destination (u,v). @param xprofile Interpolation weight as a function of the distance in X @param xradius Positive inclusion radius in the X-dimension @param yprofile Interpolation weight as a function of the distance in Y @param yradius Positive inclusion radius in the Y-dimension @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error @see cpl_image_get_interpolated() 'out' and 'in' may have different dimensions and types. The pair of 2D polynomials are used internally like this @verbatim x = cpl_polynomial_eval(poly_x, (u, v)); y = cpl_polynomial_eval(poly_y, (u, v)); @endverbatim where (u,v) are (integer) pixel positions in the destination image and (x,y) are the corresponding pixel positions (typically non-integer) in the source image. The identity transform (poly_x(u,v) = u, poly_y(u,v) = v) would thus overwrite the 'out' image with the 'in' image, starting from the lower left if the two images are of different sizes. Beware that extreme transformations may lead to blank images. The input image type may be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. In case a correction for flux conservation were required, please create a correction map using the function @c cpl_image_fill_jacobian_polynomial(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if the polynomial dimensions are not 2 - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_image_warp_polynomial( cpl_image * out, const cpl_image * in, const cpl_polynomial * poly_x, const cpl_polynomial * poly_y, const cpl_vector * xprofile, double xradius, const cpl_vector * yprofile, double yradius) { double x, y; cpl_vector * val = NULL; double * pval; cpl_mask * bad = NULL; cpl_binary * pbad; double value, confidence; cpl_size i, j; int hasbad = 0; const double sqxradius = xradius * xradius; const double sqyradius = yradius * yradius; double sqyxratio; double xtabsperpix; double ytabsperpix; const double * pxprof; const double * pyprof; double * yweight; cpl_size ixprolen; cpl_size iyprolen; /* Check entries */ cpl_ensure_code(out, CPL_ERROR_NULL_INPUT); cpl_ensure_code(in, CPL_ERROR_NULL_INPUT); cpl_ensure_code(poly_x, CPL_ERROR_NULL_INPUT); cpl_ensure_code(poly_y, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_polynomial_get_dimension(poly_x) == 2, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(cpl_polynomial_get_dimension(poly_y) == 2, CPL_ERROR_ILLEGAL_INPUT); ixprolen = cpl_vector_get_size(xprofile); cpl_ensure(ixprolen > 0, cpl_error_get_code(), -3); iyprolen = cpl_vector_get_size(yprofile); cpl_ensure(iyprolen > 0, cpl_error_get_code(), -4); cpl_ensure(xradius > 0, CPL_ERROR_ILLEGAL_INPUT, -5); cpl_ensure(yradius > 0, CPL_ERROR_ILLEGAL_INPUT, -6); pxprof = cpl_vector_get_data_const(xprofile); pyprof = cpl_vector_get_data_const(yprofile); sqyxratio = sqyradius/sqxradius; xtabsperpix = (double)(ixprolen-1) / xradius; ytabsperpix = (double)(iyprolen-1) / yradius; yweight = cpl_malloc((1 + (size_t)(2.0 * yradius)) * sizeof(double)); val = cpl_vector_new(2); pval = cpl_vector_get_data(val); bad = cpl_mask_new(out->nx, out->ny); pbad = cpl_mask_get_data(bad); switch (in->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_resample_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_resample_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_resample_body.h" #undef CPL_CLASS default: cpl_error_set_(CPL_ERROR_INVALID_TYPE); } cpl_vector_delete(val); cpl_free(yweight); if (hasbad) cpl_image_reject_from_mask(out, bad); cpl_mask_delete(bad); return CPL_ERROR_NONE; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_RESAMPLE_SUBSAMPLE /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Sub-sample an image @param image The image to subsample @param xstep Take every xstep pixel in x @param ystep Take every ystep pixel in y @return The newly allocated sub-sampled image or NULL in error case @see cpl_image_extract step represents the sampling step in x and y: both steps = 2 will create an image with a quarter of the pixels of the input image. image type can be CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. If the image has bad pixels, they will be resampled in the same way. The returned image must be deallocated using cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if the input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if xstep, ystep are not positive - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_image *cpl_image_extract_subsample(const cpl_image *image, cpl_size xstep, cpl_size ystep) { cpl_image *out_im; cpl_size new_nx, new_ny; cpl_size i, j; cpl_ensure(image != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(xstep > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(ystep > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); new_nx = (image->nx - 1)/xstep + 1; new_ny = (image->ny - 1)/ystep + 1; switch (image->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_resample_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_resample_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_resample_body.h" #undef CPL_CLASS default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } /* Sub sample the bad pixel map too */ if (image->bpm != NULL) out_im->bpm = cpl_mask_extract_subsample(image->bpm, xstep, ystep); return out_im; } #undef CPL_OPERATION #define CPL_OPERATION CPL_IMAGE_REBIN /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Rebin an image @param image The image to rebin @param xstart start x position of binning (starting from 1...) @param ystart start y position of binning (starting from 1...) @param xstep Bin size in x. @param ystep Bin size in y. @return The newly allocated rebinned image or NULL in case of error If both bin sizes in x and y are = 2, an image with (about) a quarter of the pixels of the input image will be created. Each new pixel will be the sum of the values of all contributing input pixels. If a bin is incomplete (i.e., the input image size is not a multiple of the bin sizes), it is not computed. xstep and ystep must not be greater than the sizes of the rebinned region. The input image type can be CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. If the image has bad pixels, they will be propagated to the rebinned image "pessimistically", i.e., if at least one of the contributing input pixels is bad, then the corresponding output pixel will also be flagged "bad". If you need an image of "weights" for each rebinned pixel, just cast the input image bpm into a CPL_TYPE_INT image, and apply cpl_image_rebin() to it too. The returned image must be deallocated using cpl_image_delete(). Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if the input pointer is NULL - CPL_ERROR_ILLEGAL_INPUT if xstep, ystep, xstart, ystart are not positive - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ cpl_image *cpl_image_rebin(const cpl_image *image, cpl_size xstart, cpl_size ystart, cpl_size xstep, cpl_size ystep) { cpl_image *out_im; cpl_size nx, ny; cpl_size new_nx, new_ny; const cpl_size old_nx = cpl_image_get_size_x(image); cpl_size i, j; cpl_ensure(image != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(xstart > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(ystart > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(xstep > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(ystep > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); new_nx = (image->nx - xstart + 1)/xstep; new_ny = (image->ny - ystart + 1)/ystep; cpl_ensure(new_nx > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(new_ny > 0, CPL_ERROR_ILLEGAL_INPUT, NULL); nx = new_nx * xstep + xstart - 1; ny = new_ny * ystep + ystart - 1; switch (image->type) { #define CPL_CLASS CPL_CLASS_DOUBLE #include "cpl_image_resample_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #include "cpl_image_resample_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #include "cpl_image_resample_body.h" #undef CPL_CLASS default: (void)cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } /* Propagate the bad pixel map if present */ if (image->bpm != NULL) { const cpl_binary *pin; cpl_binary *pout; cpl_size pos; out_im->bpm = cpl_mask_new(new_nx, new_ny); pin = cpl_mask_get_data_const(image->bpm); pout = cpl_mask_get_data(out_im->bpm); for (j = ystart - 1; j < ny; j++) { for (i = xstart - 1; i < nx; i++) { pos = (i-xstart+1)/xstep + ((j-ystart+1)/ystep)*new_nx; if (pout[pos] == CPL_BINARY_0) pout[pos] = pin[i + j*nx]; } } } return out_im; } #undef CPL_OPERATION /*----------------------------------------------------------------------------*/ /** @ingroup cpl_image @brief Interpolate a pixel @param source Interpolation source @param xpos Pixel x floating-point position (FITS convention) @param ypos Pixel y floating-point position (FITS convention) @param xprofile Interpolation weight as a function of the distance in X @param xradius Positive inclusion radius in the X-dimension @param yprofile Interpolation weight as a function of the distance in Y @param yradius Positive inclusion radius in the Y-dimension @param pconfid Confidence level of the interpolated value (range 0 to 1) @return The interpolated pixel value, or undefined on error @see cpl_image_get() If the X- and Y-radii are identical the area of inclusion is a circle, otherwise it is an ellipse, with the larger of the two radii as the semimajor axis and the other as the semiminor axis. The radii are only required to be positive. However, for small radii, especially radii less than 1/sqrt(2), (xpos, ypos) may be located such that no source pixels are included in the interpolation, causing the interpolated pixel value to be undefined. The X- and Y-profiles can be generated with cpl_vector_fill_kernel_profile(profile, radius). For profiles generated with cpl_vector_fill_kernel_profile() it is important to use the same radius both there and in cpl_image_get_interpolated(). A good profile length is CPL_KERNEL_DEF_SAMPLES, using radius CPL_KERNEL_DEF_WIDTH. On error *pconfid is negative (unless pconfid is NULL). Otherwise, if *pconfid is zero, the interpolated pixel-value is undefined. Otherwise, if *pconfid is less than 1, the area of inclusion is close to the image border or contains rejected pixels. The input image type can be CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. Here is an example of a simple image unwarping (with error-checking omitted for brevity): const double xyradius = CPL_KERNEL_DEF_WIDTH; cpl_vector * xyprofile = cpl_vector_new(CPL_KERNEL_DEF_SAMPLES); cpl_image * unwarped = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE); cpl_vector_fill_kernel_profile(xyprofile, CPL_KERNEL_DEFAULT, xyradius); for (iv = 1; iv <= ny; iv++) { for (iu = 1; iu <= nx; iu++) { double confidence; const double x = my_unwarped_x(); const double y = my_unwarped_y(); const double value = cpl_image_get_interpolated(warped, x, y, xyprofile, xyradius, xyprofile, xyradius, &confidence); if (confidence > 0) cpl_image_set(unwarped, iu, iv, value); else cpl_image_reject(unwarped, iu, iv); } } cpl_vector_delete(xyprofile); Possible #_cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL - CPL_ERROR_ILLEGAL_INPUT if xradius, xprofile, yprofile and yradius are not as requested - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ /*----------------------------------------------------------------------------*/ double cpl_image_get_interpolated(const cpl_image * source, double xpos, double ypos, const cpl_vector * xprofile, double xradius, const cpl_vector * yprofile, double yradius, double * pconfid) { const double * pxprof = cpl_vector_get_data_const(xprofile); const double * pyprof = cpl_vector_get_data_const(yprofile); const double sqxradius = xradius * xradius; const double sqyradius = yradius * yradius; double sqyxratio; double xtabsperpix, ytabsperpix; const cpl_size nx = cpl_image_get_size_x(source); const cpl_size ny = cpl_image_get_size_y(source); const cpl_size ixprolen = cpl_vector_get_size(xprofile); const cpl_size iyprolen = cpl_vector_get_size(yprofile); /* Use the stack except for ridiculously large radii that would use too much. A negative Y radius is cast to a very large number */ const size_t ywsize = 1 + (size_t)(2.0 * yradius); double syweight[ywsize < 200 ? ywsize : 1]; double * yweight; double value; cpl_ensure(pconfid !=NULL, CPL_ERROR_NULL_INPUT, -1); *pconfid = -1; cpl_ensure(nx > 0, cpl_error_get_code(), -2); cpl_ensure(ixprolen > 0, cpl_error_get_code(), -3); cpl_ensure(iyprolen > 0, cpl_error_get_code(), -4); cpl_ensure(xradius > 0, CPL_ERROR_ILLEGAL_INPUT, -5); cpl_ensure(yradius > 0, CPL_ERROR_ILLEGAL_INPUT, -6); xtabsperpix = (double)(ixprolen-1) / xradius; ytabsperpix = (double)(iyprolen-1) / yradius; sqyxratio = sqyradius/sqxradius; yweight = ywsize < 200 ? syweight : cpl_malloc(ywsize * sizeof(double)); switch (source->type) { case CPL_TYPE_DOUBLE: value = cpl_image_get_interpolated_double ((const double*)source->pixels, source->bpm ? cpl_mask_get_data_const(source->bpm) : NULL, nx, ny, xtabsperpix, ytabsperpix, xpos, ypos, yweight, pxprof, xradius, pyprof, yradius, sqyradius, sqyxratio, pconfid); break; case CPL_TYPE_FLOAT: value = cpl_image_get_interpolated_float ((const float*)source->pixels, source->bpm ? cpl_mask_get_data_const(source->bpm) : NULL, nx, ny, xtabsperpix, ytabsperpix, xpos, ypos, yweight, pxprof, xradius, pyprof, yradius, sqyradius, sqyxratio, pconfid); break; case CPL_TYPE_INT: value = cpl_image_get_interpolated_int ((const int*)source->pixels, source->bpm ? cpl_mask_get_data_const(source->bpm) : NULL, nx, ny, xtabsperpix, ytabsperpix, xpos, ypos, yweight, pxprof, xradius, pyprof, yradius, sqyradius, sqyxratio, pconfid); break; default: value = 0; cpl_error_set_(CPL_ERROR_INVALID_TYPE); } if (yweight != syweight) cpl_free(yweight); return value; } /** @ingroup cpl_image * @brief Compute area change ratio for a 2D polynomial transformation. * * @param out Pre-allocated image to hold the result * @param poly_x Defines source x-pos corresponding to destination (u,v). * @param poly_y Defines source y-pos corresponding to destination (u,v). * * @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error * * @see cpl_image_warp_polynomial() * * * Given an input image with pixel coordinates (x, y) which is * mapped into an output image with pixel coordinates (u, v), and * the polynomial inverse transformation (u, v) to (x, y) as in * @ref cpl_image_warp_polynomial(), this function writes the density * of the (u, v) coordinate system relative to the (x, y) coordinates * for each (u, v) pixel of image @em out. * * This is trivially obtained by computing the absolute value of the * determinant of the Jacobian of the transformation for each pixel * of the (u, v) image @em out. * * Typically this function would be used to determine a flux-conservation * factor map for the target image specified in function * @c cpl_image_warp_polynomial(). For example, * * @verbatim * cpl_image_warp_polynomial(out, in, poly_x, poly_y, xprof, xrad, yprof, yrad); * correction_map = cpl_image_new(cpl_image_get_size_x(out), * cpl_image_get_size_y(out), * cpl_image_get_type(out)); * cpl_image_fill_jacobian_polynomial(correction_map, poly_x, poly_y); * out_flux_corrected = cpl_image_multiply_create(out, correction_map); * @endverbatim * * where @em out_flux_corrected is the resampled image @em out after * correction for flux conservation. * * @note * The map produced by this function is not applicable for * flux conservation in case the transformation implies severe * undersampling of the original signal. * * Possible #_cpl_error_code_ set in this function: * - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL * - CPL_ERROR_ILLEGAL_INPUT if the polynomial dimensions are not 2 * - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ cpl_error_code cpl_image_fill_jacobian_polynomial(cpl_image *out, const cpl_polynomial *poly_x, const cpl_polynomial *poly_y) { cpl_polynomial *dxdu; cpl_polynomial *dxdv; cpl_polynomial *dydu; cpl_polynomial *dydv; cpl_vector *val; double *pval; double *ddata; float *fdata; cpl_size nx, ny; cpl_size i, j; cpl_error_code error = CPL_ERROR_NONE; if (out == NULL || poly_x == NULL || poly_y == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_polynomial_get_dimension(poly_x) != 2 || cpl_polynomial_get_dimension(poly_y) != 2) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); if (cpl_image_get_type(out) != CPL_TYPE_FLOAT && cpl_image_get_type(out) != CPL_TYPE_DOUBLE) return cpl_error_set_(CPL_ERROR_INVALID_TYPE); /* * Compute the partial derivatives of the transformation: */ dxdu = cpl_polynomial_duplicate(poly_x); dxdv = cpl_polynomial_duplicate(poly_x); dydu = cpl_polynomial_duplicate(poly_y); dydv = cpl_polynomial_duplicate(poly_y); cpl_polynomial_derivative(dxdu, 0); cpl_polynomial_derivative(dxdv, 1); cpl_polynomial_derivative(dydu, 0); cpl_polynomial_derivative(dydv, 1); /* * This section is for assigning the (local) scaling factor * to each pixel of the reference image. */ nx = cpl_image_get_size_x(out); ny = cpl_image_get_size_y(out); val = cpl_vector_new(2); pval = cpl_vector_get_data(val); switch (cpl_image_get_type(out)) { case CPL_TYPE_FLOAT: fdata = cpl_image_get_data_float(out); for (j=0; j < ny; j++) { pval[1] = (double)(j + 1); for (i=0; i < nx; i++) { pval[0] = (double)(i + 1); *fdata++ = (float)(cpl_polynomial_eval(dxdu, val) * cpl_polynomial_eval(dydv, val) - cpl_polynomial_eval(dxdv, val) * cpl_polynomial_eval(dydu, val)); } } break; case CPL_TYPE_DOUBLE: ddata = cpl_image_get_data_double(out); for (j=0; j < ny; j++) { pval[1] = (double)(j + 1); for (i=0; i < nx; i++) { pval[0] = (double)(i + 1); *ddata++ = cpl_polynomial_eval(dxdu, val) * cpl_polynomial_eval(dydv, val) - cpl_polynomial_eval(dxdv, val) * cpl_polynomial_eval(dydu, val); } } break; default: /* It is an error in CPL to reach this point */ error = CPL_ERROR_UNSPECIFIED; break; } cpl_vector_delete(val); cpl_polynomial_delete(dxdu); cpl_polynomial_delete(dxdv); cpl_polynomial_delete(dydu); cpl_polynomial_delete(dydv); /* * Ensure the scale factor is positive... */ if (!error) error = cpl_image_abs(out); /* Propagate error, if any */ return cpl_error_set_(error); } /** @ingroup cpl_image * @brief Compute area change ratio for a transformation map. * * @param out Pre-allocated image to hold the result * @param deltax The x shifts for each pixel * @param deltay The y shifts for each pixel * * @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error * * @see cpl_image_warp() * * The shifts images @em deltax and @em deltay, describing the * transformation, must be of type CPL_TYPE_DOUBLE and of the * same size as @em out. For each pixel (u, v) of the @em out * image, the deltax and deltay code the following transformation: * * @verbatim * u - deltax(u,v) = x * v - deltay(u,v) = y * @endverbatim * * This function writes the density of the (u, v) coordinate * system relative to the (x, y) coordinates for each (u, v) * pixel of image @em out. * * This is trivially obtained by computing the absolute value of the * determinant of the Jacobian of the transformation for each pixel * of the (u, v) image @em out. * * The partial derivatives are estimated at the position (u, v) * in the following way: * * @verbatim * dx/du = 1 + 1/2 ( deltax(u-1, v) - deltax(u+1, v) ) * dx/dv = 1/2 ( deltax(u, v-1) - deltax(u, v+1) ) * dy/du = 1/2 ( deltay(u-1, v) - deltay(u+1, v) ) * dy/dv = 1 + 1/2 ( deltay(u, v-1) - deltay(u, v+1) ) * @endverbatim * * Typically this function would be used to determine a flux-conservation * factor map for the target image specified in function * @c cpl_image_warp(). For example, * * @verbatim * cpl_image_warp(out, in, deltax, deltay, xprof, xrad, yprof, yrad); * correction_map = cpl_image_new(cpl_image_get_size_x(out), * cpl_image_get_size_y(out), * cpl_image_get_type(out)); * cpl_image_fill_jacobian(correction_map, deltax, deltay); * out_flux_corrected = cpl_image_multiply_create(out, correction_map); * @endverbatim * * where @em out_flux_corrected is the resampled image @em out after * correction for flux conservation. * * @note * The map produced by this function is not applicable for * flux conservation in case the transformation implies severe * undersampling of the original signal. * * Possible #_cpl_error_code_ set in this function: * - CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL * - CPL_ERROR_ILLEGAL_INPUT if the polynomial dimensions are not 2 * - CPL_ERROR_INVALID_TYPE if the passed image type is not supported */ cpl_error_code cpl_image_fill_jacobian(cpl_image *out, const cpl_image *deltax, const cpl_image *deltay) { cpl_image *dxdu; cpl_image *dxdv; cpl_image *dydu; cpl_image *dydv; double *d_dxdu; double *d_dxdv; double *d_dydu; double *d_dydv; const double *ddeltax; const double *ddeltay; double *ddata; float *fdata; cpl_size nx, ny, npix; cpl_size i, j, pos; cpl_error_code error = CPL_ERROR_NONE; if (out == NULL || deltax == NULL || deltay == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_image_get_type(out) != CPL_TYPE_FLOAT && cpl_image_get_type(out) != CPL_TYPE_DOUBLE) return cpl_error_set_(CPL_ERROR_INVALID_TYPE); if (cpl_image_get_type(deltax) != CPL_TYPE_DOUBLE || cpl_image_get_type(deltay) != CPL_TYPE_DOUBLE) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); nx = cpl_image_get_size_x(out); ny = cpl_image_get_size_y(out); if (nx != cpl_image_get_size_x(deltax) || nx != cpl_image_get_size_x(deltay) || ny != cpl_image_get_size_y(deltax) || ny != cpl_image_get_size_y(deltay)) { return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } /* * Compute the partial derivatives of the transformation: */ dxdu = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE); dxdv = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE); dydu = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE); dydv = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE); d_dxdu = cpl_image_get_data_double(dxdu); d_dxdv = cpl_image_get_data_double(dxdv); d_dydu = cpl_image_get_data_double(dydu); d_dydv = cpl_image_get_data_double(dydv); ddeltax = cpl_image_get_data_double_const(deltax); ddeltay = cpl_image_get_data_double_const(deltay); /* * Note: borders are excluded */ for (j = 1; j < ny - 1; j++) { pos = j * nx; for (i = 1; i < nx - 1; i++) { pos++; d_dxdu[pos] = (ddeltax[pos-1] - ddeltax[pos+1]) / 2 + 1; d_dxdv[pos] = (ddeltax[pos-nx] - ddeltax[pos+nx]) / 2; d_dydu[pos] = (ddeltay[pos-1] - ddeltay[pos+1]) / 2; d_dydv[pos] = (ddeltay[pos-nx] - ddeltay[pos+nx]) / 2 + 1; } } /* * This section is for assigning the (local) scaling factor * to each pixel of the reference image. */ npix = nx * ny; switch (cpl_image_get_type(out)) { case CPL_TYPE_FLOAT: fdata = cpl_image_get_data_float(out); for (i = 0; i < npix; i++) { *fdata++ = (float)((*d_dxdu++) * (*d_dydv++) - (*d_dxdv++) * (*d_dydu++)); } break; case CPL_TYPE_DOUBLE: ddata = cpl_image_get_data_double(out); for (i = 0; i < npix; i++) { *ddata++ = (*d_dxdu++) * (*d_dydv++) - (*d_dxdv++) * (*d_dydu++); } break; default: /* It is an error in CPL to reach this point */ error = CPL_ERROR_UNSPECIFIED; break; } cpl_image_delete(dxdu); cpl_image_delete(dxdv); cpl_image_delete(dydu); cpl_image_delete(dydv); /* * Ensure the scale factor is positive... */ if (!error) error = cpl_image_abs(out); /* Propagate error, if any */ return cpl_error_set_(error); } /**@}*/ #define CPL_CLASS CPL_CLASS_DOUBLE #undef CPL_OPERATION #include "cpl_image_resample_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_FLOAT #undef CPL_OPERATION #include "cpl_image_resample_body.h" #undef CPL_CLASS #define CPL_CLASS CPL_CLASS_INT #undef CPL_OPERATION #include "cpl_image_resample_body.h" #undef CPL_CLASS cpl-6.4.1/cplcore/cpl_io_fits.h0000644000460300003120000000630311753211603013305 00000000000000/* $Id: cpl_io_fits.h,v 1.15 2012-05-11 13:26:27 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-05-11 13:26:27 $ * $Revision: 1.15 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IO_FITS_H #define CPL_IO_FITS_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /* Need stat() for this to work */ #undef CPL_HAVE_STAT #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #if defined HAVE_STAT && defined HAVE_DECL_STAT #define CPL_HAVE_STAT #endif #ifdef CPL_HAVE_STAT # if !defined CPL_IO_FITS_MAX_OPEN || CPL_IO_FITS_MAX_OPEN > NMAXFILES # undef CPL_IO_FITS_MAX_OPEN /* May be defined to zero to disable the caching of file handles */ /* Default value is the maximum allowed by CFITSIO, but can be defined (to less) if needed due to a limit imposed by e.g. setrlimit() */ # define CPL_IO_FITS_MAX_OPEN NMAXFILES # endif #else /* Without stat() the caching is disabled */ # undef CPL_IO_FITS_MAX_OPEN # define CPL_IO_FITS_MAX_OPEN 0 #endif #define CPL_IO_FITS_ALL CPL_TRUE #define CPL_IO_FITS_ONE CPL_FALSE /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ void cpl_io_fits_init(void); cpl_error_code cpl_io_fits_end(void); cpl_boolean cpl_io_fits_is_enabled(void); int cpl_io_fits_create_file(fitsfile **, const char *, int *) CPL_ATTR_NONNULL; int cpl_io_fits_open_diskfile(fitsfile **, const char *, int, int *) CPL_ATTR_NONNULL; int cpl_io_fits_close_file(fitsfile *, int *) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(2))) #endif ; cpl_error_code cpl_io_fits_close_tid(cpl_boolean); int cpl_io_fits_close(const char *, int *) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(2))) #endif ; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_image_gen.h0000644000460300003120000000373711611756551013605 00000000000000/* $Id: cpl_image_gen.h,v 1.20 2011-07-21 08:03:53 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-07-21 08:03:53 $ * $Revision: 1.20 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGE_GEN_H #define CPL_IMAGE_GEN_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image.h" #include "cpl_polynomial.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_error_code cpl_image_fill_noise_uniform(cpl_image *, double, double); cpl_error_code cpl_image_fill_gaussian(cpl_image *, double, double, double, double, double); cpl_error_code cpl_image_fill_polynomial(cpl_image *, const cpl_polynomial *, double, double, double, double); cpl_image * cpl_image_fill_test_create(cpl_size, cpl_size) CPL_ATTR_ALLOC; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_filter_median.c0000644000460300003120000014225211756433771014471 00000000000000/* $Id: cpl_filter_median.c,v 1.17 2012-05-21 12:41:29 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-05-21 12:41:29 $ * $Revision: 1.17 $ * $Name: not supported by cvs2svn $ */ #include "cpl_filter.h" #include #include #include /** @addtogroup cpl_image Usage: define the following preprocessor symbols as needed, then include this file */ /**@{*/ #ifndef inline #define inline /* inline */ #endif #ifndef PIX_TYPE #error PIX_TYPE not defined #endif #ifndef PIX_MAX #error PIX_MAX not defined #endif #ifndef PIX_MIN #error PIX_MIN not defined #endif #define assure(x) assert(x) #ifdef bool #define mybool bool #else #define mybool unsigned char #endif #ifdef true #define mytrue true #else #define mytrue 1 #endif #ifdef false #define myfalse false #else #define myfalse 0 #endif /** @cond */ typedef struct ADDTYPE(dheap) { unsigned *heaps; /* Double binary heap and ADDTYPE(median) element. Values are pixel buffer indices in the current filtering window. heaps[0] ... heaps[m-1] : a maximum heap of pixels with values less than ADDTYPE(median) heaps[m] : ADDTYPE(median) heaps[m+1] ... heaps[2m] : a minimum heap of pixels with values greater than ADDTYPE(median) */ unsigned *B; /* Size Nx x Ny map from image positions to double heap positions. This is the inverse map of the heaps[] array, B[heaps[i]] = i. It allows constant time look-up of any pixel in the double heap array. Notice that only the pixels in the current window need to be simultansously stored in B, therefore B could be compressed to size (2rx+1)(2ry+1)^2. However, in that case the overall execution time would be dominated by mapping pixels to positions in B. */ unsigned *SCA; /* Array Nx*(2Ry+1) of sorted column arrays. Values are image pixel buffer indices. Each column array is sorted according to image buffer pixel values. This buffer is laid out in column major order to allow fast iteration within each column array (i.e. the x'th column array is at {S[x*(2Ry+1)], ..., S[x*(2Ry+1) + 2Ry]}) */ const PIX_TYPE *image; unsigned rx; //kernel radius unsigned ry; //kernel radius unsigned Nx; //image width unsigned Ny; //image height unsigned m; //kernel window half size, must be positive unsigned Rx; //2rx + 1 unsigned Ry; //2ry + 1 } ADDTYPE(dheap); /** @endcond */ /** @internal @brief Swap two elements in the Sorted Column Array @param SCA Sorted Column Array @param i index in SCA array @param j index in SCA array */ #define S_SWAP(SCA, i, j) \ do { \ const unsigned SCAi = SCA[i]; \ const unsigned SCAj = SCA[j]; \ SCA[i] = SCAj; \ SCA[j] = SCAi; \ } while(0) #define BITS 64 /** @internal @brief quick sort @param SCA sorted column array to be sorted @param n length of SCA @param image input image SCA is sorted in increasing order by image[SCA[i]] */ static void ADDTYPE(qsort_int)(unsigned *SCA, unsigned n, const PIX_TYPE *image) { int i, ir, j, k, l; int i_stack[BITS]; int j_stack ; int a; PIX_TYPE ia; //assure( n <= 1 << BITS ); /* generates warnings */ /* true because no-one ever wants to filter with a radius larger than 2^BITS */ ir = n ; l = 1 ; j_stack = 0 ; while (1) { if (ir-l < 7) { for (j=l+1 ; j<=ir ; j++) { a = SCA[j-1]; ia = image[a]; for (i=j-1 ; i>=1 ; i--) { if (image[SCA[i-1]] <= ia) break; SCA[i] = SCA[i-1]; } SCA[i] = a; } if (j_stack == 0) break; ir = i_stack[j_stack-- -1]; l = i_stack[j_stack-- -1]; } else { /* The following is buggy and has O(n^2) behaviour if the input array is sorted in reverse order. For maximum performance we should select the pivot randomly, (however this step is used only in the initialization of the sorted column arrays, so be it) */ k = (l+ir) >> 1; S_SWAP(SCA, k-1, l); if (image[SCA[l]] > image[SCA[ir-1]]) { S_SWAP(SCA, l, ir-1); } if (image[SCA[l-1]] > image[SCA[ir-1]]) { S_SWAP(SCA, l-1, ir-1); } if (image[SCA[l]] > image[SCA[l-1]]) { S_SWAP(SCA, l, l-1); } i = l+1; j = ir; a = SCA[l-1]; ia = image[a]; for (;;) { do i++; while (image[SCA[i-1]] < ia); do j--; while (image[SCA[j-1]] > ia); if (j < i) break; S_SWAP(SCA, i-1, j-1); } SCA[l-1] = SCA[j-1]; SCA[j-1] = a; j_stack += 2; assert( j_stack <= BITS ); if (ir-i+1 >= j-l) { i_stack[j_stack-1] = ir; i_stack[j_stack-2] = i; ir = j-1; } else { i_stack[j_stack-1] = j-1; i_stack[j_stack-2] = l; l = i; } } } return; } /** @internal @brief initialize sorted column array @param dh double heap @param x current column */ static void ADDTYPE(SCA_init)(ADDTYPE(dheap) *dh, unsigned x) { unsigned y; unsigned *SCAx = dh->SCA + (dh->Ry)*x; for (y = 0; y < dh->Ry; y++) { SCAx[y] = x + y*dh->Nx; } ADDTYPE(qsort_int)(SCAx, dh->Ry, dh->image); return; } /** @internal @brief Update sorted column array @param dh double heap @param x current column @param yold image row of previous element @param ynew image row of new element */ static void ADDTYPE(SCA_replace)(ADDTYPE(dheap) *dh, unsigned x, unsigned yold, unsigned ynew) { unsigned n = dh->Ry; unsigned *SCAx = dh->SCA + n*x; //start of current column array const PIX_TYPE *im = dh->image; unsigned i; unsigned aold = x + yold*dh->Nx; unsigned anew = x + ynew*dh->Nx; /* Do a linear search for the old pixel and replace it with the new. (Since SCAx is sorted according to pixel value, we could do a binary search here. This turns out to be no faster in practice, up to at least r = 64) */ for (i = 0; i < n; i++) { if (SCAx[i] == aold) break; } SCAx[i] = anew; /* The new pixel is not necessarily in it the right place. Bubble until SCAx is again sorted. */ if (i+1 < n && im[SCAx[i ]] > im[SCAx[i+1]]) { S_SWAP(SCAx, i , i+1); i++; while (i+1 < n && im[SCAx[i ]] > im[SCAx[i+1]]) { S_SWAP(SCAx, i , i+1); i++; } } else { while (i >= 1 && im[SCAx[i ]] < im[SCAx[i-1]]) { S_SWAP(SCAx, i , i-1); i--; } } return; } /** @internal @brief Swap elements in double heap @param i index in heaps array @param j index in heaps array @param B image to heap map @param heaps heaps array */ static void ADDTYPE(HEAP_SWAP)(unsigned i, unsigned j, unsigned int *B, unsigned int *heaps) { unsigned ai = heaps[i]; unsigned aj = heaps[j]; heaps[i] = aj; heaps[j] = ai; B[aj] = i; B[ai] = j; return; } /** @internal @brief Partion double heaps array in ADDTYPE(median) and upper/lower values @param dh double heap with elements in no particular order */ static void ADDTYPE(median)(ADDTYPE(dheap) *dh) { unsigned n = 2 * dh->m + 1; const unsigned k = (n-1)/2; PIX_TYPE pivot; unsigned i, j, lo, hi; lo = 0; hi = n - 1; while (lo < hi) { /* Buggy. We should select the pivot randomly, or there is O(n^2) behaviour for certain inputs */ pivot = dh->image[dh->heaps[k]]; i = lo; j = hi; do { while (dh->image[dh->heaps[i]] < pivot) i++; while (dh->image[dh->heaps[j]] > pivot) j--; if (i <= j) { if (i != j) ADDTYPE(HEAP_SWAP)(i, j, dh->B, dh->heaps); i++; j--; } } while (i <= j); if (j < k) lo = i; if (k < i) hi = j; } return; } /** @internal @brief bubble down (towards leaves) in upper heap @param image input image @param B inverse map @param heaps double heap array @param m heap size @param m1 m + 1 @param root double heap position @return final position */ static unsigned ADDTYPE(bubble_down_gt)(const PIX_TYPE *image, unsigned *B, unsigned *heaps, unsigned m, unsigned m1, unsigned root) { unsigned child; unsigned end = m-1; while (root * 2 + 1 <= end) { child = root*2 + 1; if (child < end && image[heaps[m1 + child]] > image[heaps[m1 + child + 1]]) { child = child + 1; } if (image[heaps[m1 + root]] > image[heaps[m1 + child]]) { ADDTYPE(HEAP_SWAP)(m1 + root, m1 + child, B, heaps); root = child; } else { return root; } } return root; } /** @internal @brief bubble up (towards root) in upper heap @param image input image @param B inverse map @param heaps double heap array @param m1 heap size + 1 @param child double heap position @return final position */ static unsigned ADDTYPE(bubble_up_gt)(const PIX_TYPE *image, unsigned *B, unsigned *heaps, unsigned m1, unsigned child) { unsigned parent; while (child > 0) { parent = (child - 1) / 2; if (image[heaps[m1 + parent]] > image[heaps[m1 + child]]) { ADDTYPE(HEAP_SWAP)(m1 + parent, m1 + child, B, heaps); child = parent; } else return child; } return child; } /** @internal @brief establish upper heap @param dh double heap */ static void ADDTYPE(heapify_gt)(ADDTYPE(dheap) *dh) { int start = dh->m/2-1; while (start >= 0) { ADDTYPE(bubble_down_gt)(dh->image, dh->B, dh->heaps, dh->m, dh->m+1, start); start = start - 1; } return; } /** @internal @brief bubble down in lower heap @param image input image @param B inverse map @param heaps double heap array @param end double heap last position @param root double heap position @return final position */ static unsigned ADDTYPE(bubble_down_lt)(const PIX_TYPE *image, unsigned *B, unsigned *heaps, unsigned end, unsigned root) { unsigned child; while (root * 2 + 1 <= end) { child = root*2 + 1; if (child < end && image[heaps[child]] < image[heaps[child + 1]]) { child = child + 1; } if (image[heaps[root]] < image[heaps[child]]) { ADDTYPE(HEAP_SWAP)(root, child, B, heaps); root = child; } else { return root; } } return root; } /** @internal @brief bubble up in lower heap @param image input image @param B inverse map @param heaps double heap array @param child double heap position @return final position */ static unsigned ADDTYPE(bubble_up_lt)(const PIX_TYPE *image, unsigned *B, unsigned *heaps, unsigned child) { unsigned parent; while (child > 0) { parent = (child - 1) / 2; if (image[heaps[parent]] < image[heaps[child]]) { ADDTYPE(HEAP_SWAP)(parent, child, B, heaps); child = parent; } else return child; } return child; } /** @internal @brief establish lower heap @param dh double heap */ static void ADDTYPE(heapify_lt)(ADDTYPE(dheap) *dh) { int start = dh->m/2-1; while (start >= 0) { ADDTYPE(bubble_down_lt)(dh->image, dh->B, dh->heaps, dh->m-1, start); start = start - 1; } return; } /** @internal @brief Initialize double heap @param dh double heap with elements in no particular order */ static void ADDTYPE(dheap_establish)(ADDTYPE(dheap) *dh) { ADDTYPE(median)(dh); ADDTYPE(heapify_lt)(dh); ADDTYPE(heapify_gt)(dh); return; } /** @internal @brief double heap constructor @param image input image @param Nx image width @param Ny image height @param rx filtering half-size in x @param ry filtering half-size in y @return newly allocated double heap which may be destroyed using ADDTYPE(dheap_delete)() The double heap, inverse map and SCA invariants are established using the first image window */ static ADDTYPE(dheap) * ADDTYPE(dheap_new)(const PIX_TYPE *image, unsigned Nx, unsigned Ny, unsigned rx, unsigned ry) { ADDTYPE(dheap) *dh = malloc(sizeof(*dh)); assure( dh != NULL ); assure( rx > 0 || ry > 0 ); dh->heaps = malloc( (2*rx+1)*(2*ry+1) * sizeof(*dh->heaps)); dh->B = malloc( Nx*Ny * sizeof(*dh->B)); dh->SCA = malloc( Nx*(2*ry+1) * sizeof(*dh->SCA)); assure( dh->heaps != NULL ); assure( dh->B != NULL ); assure( dh->SCA != NULL ); dh->image = image; dh->m = ((2*rx+1)*(2*ry+1))/2; dh->Nx = Nx; dh->Ny = Ny; dh->rx = rx; dh->ry = ry; dh->Rx = 2*rx+1; dh->Ry = 2*ry+1; { unsigned k = 0; unsigned x, y; for (y = 0; y < dh->Ry; y++) { for (x = 0; x < dh->Rx; x++) { unsigned ai = x + y * dh->Nx; dh->heaps[k] = ai; dh->B[ai] = k; k++; } } } ADDTYPE(dheap_establish)(dh); { unsigned x; for (x = 0; x < 2*dh->rx; x++) { ADDTYPE(SCA_init)(dh, x); } } return dh; } /** @internal @brief double heap destructor @param dh double heap */ static void ADDTYPE(dheap_delete)(ADDTYPE(dheap) *dh) { free(dh->SCA); free(dh->B); free(dh->heaps); free(dh); return; } /** @internal @brief get current ADDTYPE(median) @param dh double heap @return the ADDTYPE(median) element value */ static PIX_TYPE ADDTYPE(dheap_median)(const ADDTYPE(dheap) *dh) { return dh->image[dh->heaps[dh->m]]; } /** @internal @brief Insert and remove element in double heap @param image input image @param B inverse map @param heaps double heap array @param pprev_was_larger Previous element was larger @param pprev_was_smaller Previous element was smaller @param m heap size @param m1 m + 1 @param anew image index of pixel to be inserted @param aold image index of pixel to be removed Algorithm: The inverse map is used to quickly locate the old pixel, which is replaced, and the new element bubbled to a (non-unique) correct position until the double heap structure is re-established. The inverse map is maintained while swapping heap elements. The two flags remember if the previously inserted element was larger/smaller than the one it replaced. Both flags may be false, which means nothing is known. If the previous element was larger (smaller), then the current element we are inserting now is likely to be also larger (smaller). This information is used to decrease the number of comparisons needed to bubble the current element into place. */ static void ADDTYPE(dheap_replace)(const PIX_TYPE *image, unsigned *B, unsigned *heaps, mybool *pprev_was_larger, mybool *pprev_was_smaller, unsigned m, unsigned m1, unsigned anew, unsigned aold) { unsigned pos; /* Lookup position of old pixel in heaps structure, overwrite with new pixel */ unsigned ci = B[aold]; heaps[ci] = anew; B[anew] = ci; /* Move new element to a correct place. Swap heaps priority element with ADDTYPE(median) as needed */ if (ci < m) { /* Lower heap */ if (*pprev_was_smaller) { pos = ADDTYPE(bubble_down_lt)(image, B, heaps, m-1, ci); if (pos == ci) pos = ADDTYPE(bubble_up_lt)(image, B, heaps, ci); } else /* previous was larger or nothing is known */ { /* Optimistic guess optimization here: bubble_up requires only one comparison and is faster than bubble_down. Therefore, in the case where nothing is known about the previous element, we try to bubble_up before bubble_down. */ pos = ADDTYPE(bubble_up_lt)(image, B, heaps, ci); if (pos == ci) pos = ADDTYPE(bubble_down_lt)(image, B, heaps, m-1, ci); } if (pos == 0 && image[heaps[0]] > image[heaps[m]]) { ADDTYPE(HEAP_SWAP)(0, m, B, heaps); if (image[heaps[m1]] < image[heaps[m]]) { ADDTYPE(HEAP_SWAP)(m1, m, B, heaps); ADDTYPE(bubble_down_gt)(image, B, heaps, m, m1, 0); } } /* Finally prepare flags for the next call of this function. If final position and initial postions are the same, we cannot tell if this element was larger/smaller than the one it replaced (at least not without the cost of a comparison with the previous element, which may or may not pay off). */ *pprev_was_larger = (pos < ci); *pprev_was_smaller = (pos > ci); return; } else if (ci >= m1) { /* Upper heap */ if (*pprev_was_larger) { pos = ADDTYPE(bubble_down_gt)(image, B, heaps, m, m1, ci-(m1)); if (pos == ci-(m1)) pos = ADDTYPE(bubble_up_gt)(image, B, heaps, m1, ci-(m1)); } else { pos = ADDTYPE(bubble_up_gt)(image, B, heaps, m1, ci-(m1)); if (pos == ci-(m1)) pos = ADDTYPE(bubble_down_gt)(image, B, heaps, m, m1, ci-(m1)); } if (pos == 0 && image[heaps[m1]] < image[heaps[m]]) { ADDTYPE(HEAP_SWAP)(m1, m, B, heaps); if (image[heaps[0]] > image[heaps[m]]) { ADDTYPE(HEAP_SWAP)(0, m, B, heaps); ADDTYPE(bubble_down_lt)(image, B, heaps, m-1, 0); } } *pprev_was_smaller = (pos < ci-(m1)); *pprev_was_larger = (pos > ci-(m1)); return; } else { /* The ADDTYPE(median) element was replaced */ if (*pprev_was_smaller) { if (image[heaps[0]] > image[heaps[m]]) { ADDTYPE(HEAP_SWAP)(0, m, B, heaps); ADDTYPE(bubble_down_lt)(image, B, heaps, m-1, 0); *pprev_was_smaller = mytrue; *pprev_was_larger = myfalse; return; } else if (image[heaps[m1]] < image[heaps[m]]) { ADDTYPE(HEAP_SWAP)(m1, m, B, heaps); ADDTYPE(bubble_down_gt)(image, B, heaps, m, m1, 0); *pprev_was_smaller = myfalse; *pprev_was_larger = mytrue; return; } else { *pprev_was_smaller = myfalse; *pprev_was_larger = myfalse; return; } } else { if (image[heaps[m1]] < image[heaps[m]]) { ADDTYPE(HEAP_SWAP)(m1, m, B, heaps); ADDTYPE(bubble_down_gt)(image, B, heaps, m, m1, 0); *pprev_was_smaller = myfalse; *pprev_was_larger = mytrue; return; } else if (image[heaps[0]] > image[heaps[m]]) { ADDTYPE(HEAP_SWAP)(0, m, B, heaps); ADDTYPE(bubble_down_lt)(image, B, heaps, m-1, 0); *pprev_was_smaller = mytrue; *pprev_was_larger = myfalse; return; } else { *pprev_was_smaller = myfalse; *pprev_was_larger = myfalse; return; } } } } /** @internal @brief max of 3 elements @param p0 element @param p1 element @param p2 element @return maximum element Cost: 2 comparisons */ static inline PIX_TYPE ADDTYPE(max3)(PIX_TYPE p0, PIX_TYPE p1, PIX_TYPE p2) { return (p0 > p1) ? ((p0 > p2) ? p0 : p2) : ((p1 > p2) ? p1 : p2); } /** @internal @brief min of 3 elements @param p0 element @param p1 element @param p2 element @return minimum element Cost: 2 comparisons */ static inline PIX_TYPE ADDTYPE(min3)(PIX_TYPE p0, PIX_TYPE p1, PIX_TYPE p2) { return (p0 < p1) ? ((p0 < p2) ? p0 : p2) : ((p1 < p2) ? p1 : p2); } /** @internal @brief ADDTYPE(median) of 5 @param p0 element @param p1 element @param p2 element @param p3 element @param p4 element @return ADDTYPE(median) Precondition: p0 <= p1 <= p2 Cost: 2 + 0 (probability 4/7) or 2 + 2 (probability 3/7) = 20/7 = 2.86 comparisons */ static inline PIX_TYPE ADDTYPE(median5)(PIX_TYPE p0, PIX_TYPE p1, PIX_TYPE p2, PIX_TYPE p3, PIX_TYPE p4) { /* This would be a one-off ADDTYPE(median) filter (i.e. rank 4th, 5th or 6th of 9). Saves some 35% execution time. return p1; */ return (p3 < p1) ? ((p4 >= p1) ? p1 : ADDTYPE(max3)(p3, p4, p0)) : ((p4 <= p1) ? p1 : ADDTYPE(min3)(p3, p4, p2)); } /** @internal @brief ADDTYPE(median) of 9 @param p0 element @param p1 element @param p2 element @param p3 element @param p4 element @param p5 element @param p6 element @param p7 element @param p8 element @return ADDTYPE(median) Precondition: p0 <= p1 <= p2 p3 <= p4 <= p5 p6 <= p7 <= p8 p1 <= p4 Cost: 1 + 2.86 (probability 1/3) or 2 + 2.86 (probability 2/3) = 95/21 = 4.52 comparisons */ static inline PIX_TYPE ADDTYPE(median9_2)(PIX_TYPE p0, PIX_TYPE p1, PIX_TYPE p2, PIX_TYPE p3, PIX_TYPE p4, PIX_TYPE p5, PIX_TYPE p6, PIX_TYPE p7, PIX_TYPE p8) { return (p4 <= p7) ? ADDTYPE(median5)(p3, p4, p5, p2, p6) : ((p1 < p7) ? ADDTYPE(median5)(p6, p7, p8, p2, p3) : ADDTYPE(median5)(p0, p1, p2, p8, p3)); } /** @internal @brief ADDTYPE(median) of 9 @param p0 element @param p1 element @param p2 element @param p3 element @param p4 element @param p5 element @param p6 element @param p7 element @param p8 element @return ADDTYPE(median) Precondition: p0 <= p1 <= p2 p3 <= p4 <= p5 p6 <= p7 <= p8 Cost: 1 + 4.52 = 116/21 = 5.52 comparisons */ static inline PIX_TYPE ADDTYPE(median9_1)(PIX_TYPE p0, PIX_TYPE p1, PIX_TYPE p2, PIX_TYPE p3, PIX_TYPE p4, PIX_TYPE p5, PIX_TYPE p6, PIX_TYPE p7, PIX_TYPE p8) { return (p1 < p4) ? ADDTYPE(median9_2)(p0, p1, p2, p3, p4, p5, p6, p7, p8) : ADDTYPE(median9_2)(p3, p4, p5, p0, p1, p2, p6, p7, p8); } /** @internal @brief sort 3 elements @param p0 (out) rank 1 @param p1 (out) rank 2 @param p2 (out) rank 3 @param i0 (in) element @param i1 (in) element @param i2 (in) element Cost: 2 (probability 1/3) or 3 (probability 2/3) = 8/3 = 2.66 comparisons */ #define sort3(p0, p1, p2, i0, i1, i2) \ do { \ if (i0 <= i1) { \ if (i1 <= i2) { \ p0 = i0; p1 = i1; p2 = i2; \ } else if (i0 <= i2) { \ /* i0, i2, i1 */ \ p0 = i0; p1 = i2; p2 = i1; \ } else { \ /* i2, i0, i1 */ \ p0 = i2; p1 = i0; p2 = i1; \ } \ } else { \ if (i0 <= i2) { \ /* i1, i0, i2 */ \ p0 = i1; p1 = i0; p2 = i2; \ } else if (i1 < i2) { \ /* i1, i2, i0 */ \ p0 = i1; p1 = i2; p2 = i0; \ } else { \ /* i2, i1, i0 */ \ p0 = i2; p1=i1; p2 = i0; \ } \ } \ } while(0) /** @internal @brief fast 3x3 image ADDTYPE(median) filter @param in image to filter @param out pre-allocated output image, must not overlap with the input image @param Nx image width @param Ny image height @param border_mode periodic boundaries WARNING: If this function is modified (only sections regarding CPL_BORDER_FILTER), also the fill_chess function has to be modified, for consistency. Here, an alternate lower and upper median is taken, which has the same effect as the +- inf chess-like pattern. */ static void ADDTYPE(filter_median_1)(const PIX_TYPE *in, PIX_TYPE *out, unsigned Nx, unsigned Ny, unsigned border_mode) { register PIX_TYPE p0, p1, p2, p3, p4, p5; register PIX_TYPE p6 = (PIX_TYPE)0; /* Fix (false) uninit warning */ register PIX_TYPE p7 = (PIX_TYPE)0; /* Fix (false) uninit warning */ register PIX_TYPE p8 = (PIX_TYPE)0; /* Fix (false) uninit warning */ const PIX_TYPE * i0 = in; const PIX_TYPE * i1 = i0 + Nx; const PIX_TYPE * i2 = i1 + Nx; const PIX_TYPE * istop = in + Nx*Ny; /* First pixel not to be accessed */ unsigned m = 2; /* lower ADDTYPE(median) of 6 elements */ assure( Nx >= 3 ); assure( Ny >= 3 ); switch (border_mode) { case CPL_BORDER_FILTER: { PIX_TYPE buf6[6]; unsigned j = 0; buf6[0] = i0[0]; buf6[1] = i0[1]; buf6[2] = i1[0]; buf6[3] = i1[1]; /* upper median */ out[j++] = ADDTYPE(cpl_tools_get_kth)(buf6, 4, 2); for (; j < Nx-1; j++) { memcpy(buf6, i0+j-1, 3*sizeof(*buf6)); memcpy(buf6+3, i1+j-1, 3*sizeof(*buf6)); out[j] = ADDTYPE(cpl_tools_get_kth)(buf6, 6, m); m = 5-m; /* alternate between lower/upper median */ } buf6[0] = i0[Nx-2]; buf6[1] = i0[Nx-1]; buf6[2] = i1[Nx-2]; buf6[3] = i1[Nx-1]; out[j] = ADDTYPE(cpl_tools_get_kth)(buf6, 4, m-1); out += Nx; break; } case CPL_BORDER_COPY: { /* From the first row copy all but the last pixel */ (void)memcpy(out, in, (Nx-1)*sizeof(*out)); } case CPL_BORDER_NOP: out += Nx-1; break; default: case CPL_BORDER_CROP: break; } if (border_mode == CPL_BORDER_FILTER) m = 2; /* lower ADDTYPE(median) */ for (;i2 < istop; i0 += Nx, i1 += Nx, i2 += Nx, out += Nx) { unsigned char k = 2; unsigned j = 0; /* Start a new row */ switch (border_mode) { case CPL_BORDER_FILTER: { PIX_TYPE buf6[6]; buf6[0] = i0[0]; buf6[1] = i1[0]; buf6[2] = i2[0]; buf6[3] = i0[1]; buf6[4] = i1[1]; buf6[5] = i2[1]; out[0] = ADDTYPE(cpl_tools_get_kth)(buf6, 6, m); /* j must be incremented twice, but out[j] should only be incremented once */ out--; break; } case CPL_BORDER_CROP: out -= 2; /* Nx - 2 medians in each row */ break; case CPL_BORDER_COPY: { /* Copy last pixel from previous row and first pixel from current row */ out[0] = (PIX_TYPE)i0[Nx-1]; out[1] = (PIX_TYPE)i0[Nx]; break; } default: break; } sort3(p0, p1, p2, i0[j], i1[j], i2[j]); j++; sort3(p3, p4, p5, i0[j], i1[j], i2[j]); j++; for (; j < Nx; j++) { if (k == 0) { k = 1; sort3(p0, p1, p2, i0[j], i1[j], i2[j]); } else if (k == 1) { k = 2; sort3(p3, p4, p5, i0[j], i1[j], i2[j]); } else { k = 0; sort3(p6, p7, p8, i0[j], i1[j], i2[j]); } out[j] = (PIX_TYPE)ADDTYPE(median9_1)(p0, p1, p2, p3, p4, p5, p6, p7, p8); /* The cost per pixel was determined by considering the 9! possible permutations of 9 different numbers and subsequently confirmed by experiment: 2.66 + 5.52 = 172/21 = 8.19 comparisons per pixel 3 + 3 + 4 = 10 (worst case) In the case of two or more equal elements the cost is always the same or less (down to 6 for all equal elements) due to the way the comparisons are made. If sorted column arrays were used the cost would be one less 1.66 + 5.52 = 151/21 = 7.19 (worst case 9) A rank 4th-6th filter would cost 2.86 comparisons less 2.66 + 2.66 = 16/3 = 5.33 or only 4.33 comparisons per pixel if SCAs are used. */ } if (border_mode == CPL_BORDER_FILTER) { PIX_TYPE buf6[6]; buf6[0] = i0[j-2]; buf6[1] = i1[j-2]; buf6[2] = i2[j-2]; buf6[3] = i0[j-1]; buf6[4] = i1[j-1]; buf6[5] = i2[j-1]; out[j] = ADDTYPE(cpl_tools_get_kth)(buf6, 6, ((Nx & 1) == 1) ? m : 5-m); m = 5-m; /* out was decremented, increment it back */ out++; } } switch (border_mode) { case CPL_BORDER_FILTER: { PIX_TYPE buf6[6]; unsigned j = 0; buf6[0] = i0[0]; buf6[1] = i0[1]; buf6[2] = i1[0]; buf6[3] = i1[1]; out[j++] = ADDTYPE(cpl_tools_get_kth)(buf6, 4, m-1); m = 5-m; for (; j < Nx-1; j++) { memcpy(buf6, i0+j-1, 3*sizeof(*buf6)); memcpy(buf6+3, i1+j-1, 3*sizeof(*buf6)); out[j] = ADDTYPE(cpl_tools_get_kth)(buf6, 6, m); m = 5-m; } buf6[0] = i0[Nx-2]; buf6[1] = i0[Nx-1]; buf6[2] = i1[Nx-2]; buf6[3] = i1[Nx-1]; out[j] = ADDTYPE(cpl_tools_get_kth)(buf6, 4, m-1); break; } default: case CPL_BORDER_CROP: break; case CPL_BORDER_COPY: { /* From the 2nd last row copy last pixel */ /* From the last row copy all pixels */ (void)memcpy(out, istop-(Nx+1), (Nx+1)*sizeof(*out)); break; } } return; } /** @internal @brief Write values to image row @param in image to fill @param nx image width @param y row (?) to fill @param xmin first column to fill (inclusive) @param xmax last column to fill (exclusive) @param val1 value to write first position (xmin, y) @param val2 other value Every second pixel is filled with val1, other pixels with val2 WARNING: This function is duplicated from the code found in tests/cpl_filter_body.h. Do not forget to keep both in sync. */ static void ADDTYPE(fill_row)(PIX_TYPE *in, unsigned nx, unsigned y, unsigned xmin, unsigned xmax, PIX_TYPE val1, PIX_TYPE val2) { unsigned x = xmin; while (x+1 < xmax) { in[(x++) + y*nx] = val1; in[(x++) + y*nx] = val2; } if (x < xmax) { in[(x++) + y*nx] = val1; } return; } /** @internal @brief Fill image border with +- infinity @param in_larger image to fill @param in input image @param Nx_larger in_larger width @param Ny_larger in_larger height @param Nx in width @param Ny in height @param rx filter x-radius @param ry filter y-radius WARNING: This function is duplicated from the code found in tests/cpl_filter_body.h. Do not forget to keep both in sync. WARNING: If this function is modified , also the filter_median_1 function has to be modified (only sections regarding CPL_BORDER_FILTER), for consistency. Here, an +- inf chess-like pattern is used, which has the same effect as the alternate lower and upper median used in filter_median_1. */ void ADDTYPE(cpl_image_filter_fill_chess)(PIX_TYPE *in_larger, const PIX_TYPE *in, unsigned Nx_larger, unsigned Ny_larger, unsigned Nx, unsigned Ny, unsigned rx, unsigned ry) { unsigned y; /* Fill border with PIX_MAX if x+y is even and PIX_MIN if x+y is odd. Loop over images in cache-friendly order. */ for (y = 0; y < ry; y++) { ADDTYPE(fill_row)(in_larger, Nx_larger, y, 0, Nx_larger, (y & 1) == 0 ? PIX_MAX : PIX_MIN, (y & 1) == 0 ? PIX_MIN : PIX_MAX); } for (y = ry; y < ry+Ny; y++) { ADDTYPE(fill_row)(in_larger, Nx_larger, y, 0, rx, (y & 1) == 0 ? PIX_MAX : PIX_MIN, (y & 1) == 0 ? PIX_MIN : PIX_MAX); (void)memcpy(in_larger + rx + y*Nx_larger, in + (y-ry)*Nx, Nx*sizeof(*in)); ADDTYPE(fill_row)(in_larger, Nx_larger, y, rx + Nx, Nx_larger, ((y + rx + Nx) & 1) == 0 ? PIX_MAX : PIX_MIN, ((y + rx + Nx) & 1) == 0 ? PIX_MIN : PIX_MAX); } for (y = ry + Ny; y < Ny_larger; y++) { ADDTYPE(fill_row)(in_larger, Nx_larger, y, 0, Nx_larger, (y & 1) == 0 ? PIX_MAX : PIX_MIN, (y & 1) == 0 ? PIX_MIN : PIX_MAX); } } /** @internal @brief Fast, any bit-depth, image ADDTYPE(median) filter @param in image to filter @param out pre-allocated output image, may not overlap with the input image, same size as input image @param Nx image width @param Ny image height @param rx filtering half-size in x, non-negative @param ry filtering half-size in y, non-negative @param border_mode Handling of the pixels near the border (the region where part of the kernel would be outside the image) Supported border modes: CPL_BORDER_FILTER: Compute the ADDTYPE(median) of available values. CPL_BORDER_NOP: The border region in the output image is not touched. CPL_BORDER_CROP: The border region is removed. Consequently the size of the output image must be (Nx - 2rx) x (Ny - 2ry) CPL_BORDER_COPY: The border is filled by copying the input pixels. Unsupported filter modes: In-place: Possible using a pixel buffer of dimension (Nx + 2Rx) * (1 + 2Ry) Unsupported border modes: Input extrapolation: The input image is extended to (Nx+2Rx) * (Ny+2Ry) and the halo is filled using extrapolation of the input border. Mean: As any, except the arithmetic mean of the two central values is used. For each pixel in the image the ADDTYPE(median) of a (2*Rx + 1)(2*Ry + 1) window is computed. The straightforward approach is to loop over the image and build and sort the kernel array for every pixel. This leads to an O(RxRy log RxRy) algorithm, or O(RxRy) if the ADDTYPE(median) is computed by repeated partitions. The basic idea in this implementation is to maintain a double heap structure of the running window pixels: _____ \ / <-- minimum heap of elements greater than the ADDTYPE(median) \ / . <-- ADDTYPE(median) / \ <-- maximum heap of elements less than the ADDTYPE(median) / \ ----- With every 1 pixel shift of the running window (2Ry + 1) pixels have to be removed from the double heap, and another (2Ry + 1) pixels must be inserted. The worst case time for inserting/removing one element is two heap heights, O(log RxRy), so the overall time is O(Ry log RxRy). Various tricks improve the performance - The image is traversed row by row, alternating between left->right and right->left iteration. In this way the running window always moves by one pixel and the double heap structure is always reused. - A pixel is inserted into the double heap by overwriting a pixel (which is thereby removed) at an existing position, then the new pixel is bubbled up/down until the heap structure is re-established. This is fastest if the new pixel happens to be initially inserted at a position close to its final position. To increase the chance of that happening, the (2Ry + 1) pixels to be removed are sorted, as are the (2Ry + 1) pixels to be inserted. Then the minimum "new" pixel replaces the minimum "old" pixel, the 2nd smallest new pixel replaces the 2nd smallest old pixel etc. This heuristical optimization greatly reduces the number of bubble operations required. Rather than sorting every time the (2Ry + 1) new and old values (which would cost O(Ry log Ry), a sorted array of the current pixels is maintained for every column in the image. To update the sorted column arrays (SCA) only one pixel needs to be inserted/removed per iteration. When using simple linear search and insertion, the maintenance cost for the SCAs is O(Ry). A possible optimization not pursued here is to implement the SCAs as balanced binary search trees, which would reduce their maintenance cost to O(log Ry) (but the heap maintenance cost would still be O(Ry). - When inserting elements into the double heap, a memory is kept of whether the inserted element is larger/smaller. Due to the correlation between consecutive insertions this information can be used to guess that the next element will also be larger/smaller. Performance: While the theoretical time complexity is O(Ry log RxRy), the empirical behaviour (for realistic size images with random, uncorrelated pixels from the same probability distribution) is O(Ry) with small constant coefficients. Rx = Ry = 1 is handled as a separate case. */ static void ADDTYPE(filter_median)(const PIX_TYPE *in, PIX_TYPE *out, unsigned Nx, unsigned Ny, unsigned rx, unsigned ry, unsigned border_mode) { unsigned out_Nx; ADDTYPE(dheap) *dh; unsigned y; unsigned x; int dx; mybool prev_was_larger = myfalse; mybool prev_was_smaller = myfalse; assure( 2*rx + 1 <= Nx ); assure( 2*ry + 1 <= Ny ); if (rx == 1 && ry == 1) { ADDTYPE(filter_median_1)(in, out, Nx, Ny, border_mode); return; } if (rx == 0 && ry == 0) { /* The double heap structure must have non-empty heaps, so handle this (trivial) case explicitly. Works for all border modes (because there are no borders!). */ (void)memcpy(out, in, (Nx*Ny)*sizeof(*out)); return; } assure( border_mode == CPL_BORDER_NOP || border_mode == CPL_BORDER_CROP || border_mode == CPL_BORDER_COPY || border_mode == CPL_BORDER_FILTER ); if (border_mode == CPL_BORDER_FILTER) { /* Add a border of (width, height) = (rx, ry) to the input image. Fill with +-infinity in a chessboard pattern. Then filter this larger image using CPL_BORDER_CROP, and the result will come out right (because the added border region always contains the same number of +infinity and -infinity). */ const unsigned Nx_larger = Nx + 2*rx; const unsigned Ny_larger = Ny + 2*ry; PIX_TYPE *in_larger = malloc(Nx_larger*Ny_larger*sizeof(*in_larger)); assure( in_larger != NULL ); ADDTYPE(cpl_image_filter_fill_chess)(in_larger, in, Nx_larger, Ny_larger, Nx, Ny, rx, ry); ADDTYPE(filter_median)(in_larger, out, Nx_larger, Ny_larger, rx, ry, CPL_BORDER_CROP); free(in_larger); return; } assert( border_mode == CPL_BORDER_NOP || border_mode == CPL_BORDER_CROP || border_mode == CPL_BORDER_COPY); if (border_mode == CPL_BORDER_COPY) { (void)memcpy(out, in, (ry*Nx+rx)*sizeof(*out)); } if (border_mode == CPL_BORDER_CROP) { /* Subtract a bit from the out pointer, so that indexing out[x + y*out_Nx] works */ out_Nx = Nx - 2*rx; out -= rx + ry * out_Nx; } else out_Nx = Nx; dh = ADDTYPE(dheap_new)(in, Nx, Ny, rx, ry); /* Loop over image like this -->->->- -<-<-<-- -->->->- etc. so that the current window always moves by 1 pixel per iteration */ for (y = 0 + dh->ry, dx = 1; y < dh->Ny - dh->ry; y++, dx = -dx) { const unsigned xfirst = (dx == 1) ? dh->rx : dh->Nx-1 - dh->rx; const unsigned xlast = (dx == -1) ? dh->rx : dh->Nx-1 - dh->rx; if (border_mode == CPL_BORDER_COPY && dx == -1 && y != dh->Ny - dh->ry - 1) { PIX_TYPE *o = out + xfirst + 1 + y*dh->Nx; const PIX_TYPE *i = in + xfirst + 1 + y*dh->Nx; /* in- and out-types have identical sizes */ (void)memcpy(o, i, 2*rx*sizeof(*o)); } for (x = xfirst; x != xlast + dx; x += dx) { if (y == dh->ry) { ADDTYPE(SCA_init)(dh, x + dx * dh->rx); } else { /* Most frequent case. Update just 1 pixel in 1 sorted column array */ ADDTYPE(SCA_replace)(dh, x + dx * dh->rx, y - dh->ry - 1, y + dh->ry); } if (x == xfirst) { if (y != dh->ry) { /* Window just moved to next row, update pixels at window bottom row */ unsigned i; for (i = x - dx*dh->rx; i != x + dx*dh->rx; i += dx) { ADDTYPE(SCA_replace)(dh, i, y - dh->ry - 1, y + dh->ry); ADDTYPE(dheap_replace)(dh->image, dh->B, dh->heaps, &prev_was_larger, &prev_was_smaller, dh->m, dh->m+1, i + ((y + dh->ry ) * dh->Nx), i + ((y - dh->ry - 1) * dh->Nx)); } ADDTYPE(dheap_replace)(dh->image, dh->B, dh->heaps, &prev_was_larger, &prev_was_smaller, dh->m, dh->m+1, i + ((y + dh->ry ) * dh->Nx), i + ((y - dh->ry - 1) * dh->Nx)); } } else { /* Most frequent case. Replace pixels in xold column with pixels from xnew column */ const unsigned xnew = x + dx * dh->rx; const unsigned xold = x - dx * (dh->rx+1); const unsigned *SCAxnew = dh->SCA + dh->Ry*xnew; const unsigned *SCAxold = dh->SCA + dh->Ry*xold; const PIX_TYPE *image = dh->image; unsigned *B = dh->B; unsigned *heaps = dh->heaps; const unsigned m = dh->m; const unsigned m1 = m+1; unsigned anew, aold; unsigned i; /* Loop through old/new sorted column arrays and replace old pixels by new pixels of the same rank (i.e. position in sorted column array). This heuristic increases the chance that the new pixel is close to its final position when inserted into the double heap structure. */ for (i = 0; i < dh->Ry; i++) { anew = SCAxnew[i]; aold = SCAxold[i]; ADDTYPE(dheap_replace)(image, B, heaps, &prev_was_larger, &prev_was_smaller, m, m1, anew, aold); } } out[x + y*out_Nx] = (PIX_TYPE)ADDTYPE(dheap_median)(dh); } /* for x */ if (border_mode == CPL_BORDER_COPY && dx == 1 && y != dh->Ny - dh->ry - 1) { PIX_TYPE *o = out + xlast + 1 + y*dh->Nx; const PIX_TYPE *i = in + xlast + 1 + y*dh->Nx; /* in- and out- types have identical sizes */ (void)memcpy(o, i, 2*rx*sizeof(*o)); } } /* for y */ if (border_mode == CPL_BORDER_COPY) { out += (Ny-ry)*dh->Nx - rx; in += (Ny-ry)*dh->Nx - rx; /* in- and out- types have identical sizes */ (void)memcpy(out, in, (ry*Nx + rx)*sizeof(*out)); } ADDTYPE(dheap_delete)(dh); return; } static void ADDTYPE(cpl_filter_median_fast)(void * out, const void * in, cpl_size Nx, cpl_size Ny, cpl_size hsizex, cpl_size hsizey, cpl_border_mode mode) { const unsigned Nxu = (const unsigned)Nx; const unsigned Nyu = (const unsigned)Ny; const unsigned hsizexu = (const unsigned)hsizex; const unsigned hsizeyu = (const unsigned)hsizey; if ((cpl_size)Nxu == Nx && (cpl_size)Nyu == Ny && (cpl_size)hsizexu == hsizex && (cpl_size)hsizeyu == hsizey) { ADDTYPE(filter_median)(in, out, (unsigned)Nx, (unsigned)Ny, (unsigned)hsizex, (unsigned)hsizey, (unsigned)mode); } else { cpl_error_set_(CPL_ERROR_UNSUPPORTED_MODE); } return; } /**@}*/ #undef IN_TYPE #undef PIX_TYPE #undef PIX_MIN #undef PIX_MAX cpl-6.4.1/cplcore/cpl_error.c0000644000460300003120000007256611737326555013032 00000000000000/* $Id: cpl_error.c,v 1.73 2012-04-05 14:34:20 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-04-05 14:34:20 $ * $Revision: 1.73 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include #ifdef HAVE_LIBPTHREAD #include #endif #include #include #include "cpl_error_impl.h" /* Needed for cpl_sprintf() */ #include "cpl_memory.h" /* Needed for CPL_STRINGIFY() */ #include "cpl_tools.h" /* Needed for FLEN_STATUS */ #include /** * @defgroup cpl_error Error handling * * This module provides functions to maintain the @em cpl_error_code * set by any CPL function, similarly to what is done with the @em errno * variable of the standard C library. The following guidelines are * respected: * * - If no error occurs in a CPL function the @em cpl_error_code will * remain unchanged. * - If an error occurs in a CPL function, a new CPL error is set, causing * the @em cpl_error_code to be modified to the new error. * * A @em cpl_error_code equal to the enumeration constant * @c CPL_ERROR_NONE would indicate no error condition. Note, * however, that the @em cpl_error_code is only set when an error * occurs, and it is not reset by successful function calls. * For this reason it may be appropriate in some cases to reset * the @em cpl_error_code using the function @c cpl_error_reset(). * The @em cpl_error_code set by a CPL function can be obtained by * calling the function @c cpl_error_get_code(), but functions of * type @em cpl_error_code would not only return this code directly, * but would also return @c CPL_ERROR_NONE in case of success. Other * CPL functions return zero on success, or a non-zero value to indicate * a change of the @em cpl_error_code, while CPL functions returning * a pointer would flag an error by returning a @c NULL. * * To each @em cpl_error_code is associated a standard error message, * that can be obtained by calling the function @c cpl_error_get_message(). * Conventionally, no CPL function will ever display any error message, * leaving to the caller the decision of how to handle a given error * condition. A call to the function @c cpl_error_get_function() would * return the name of the function where the error occurred, and the * functions @c cpl_error_get_file() and @c cpl_error_get_line() would * also return the name of the source file containing the function * code, and the line number where the error occurred. The function * @c cpl_error_get_where() would gather all this items together, in * a colon-separated string. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ #ifndef CPL_LINESZ #ifdef FITS_LINESZ #define CPL_LINESZ FITS_LINESZ #else #define CPL_LINESZ 6 #endif #endif #define MAX_WHERE_LENGTH (2+(MAX_NAME_LENGTH)+(MAX_FILE_LENGTH)+(CPL_LINESZ)) /*----------------------------------------------------------------------------- Private variables -----------------------------------------------------------------------------*/ #ifdef HAVE_LIBPTHREAD static pthread_rwlock_t cpl_lock_error_status; static pthread_rwlock_t cpl_lock_error_read_only; #endif static cpl_boolean cpl_error_status = CPL_FALSE; static cpl_boolean cpl_error_read_only = CPL_FALSE; #ifdef _OPENMP #pragma omp threadprivate(cpl_error_status, cpl_error_read_only) #endif /*----------------------------------------------------------------------------- Private functions -----------------------------------------------------------------------------*/ static cpl_error * cpl_error_fill(const char *, cpl_error_code, const char *, unsigned); static cpl_error_code cpl_error_set_message_macro_(const char *, cpl_error_code, const char *, unsigned, const char *, va_list) CPL_ATTR_PRINTF(5,0) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(3))) #endif ; /*----------------------------------------------------------------------------- Definitions of functions -----------------------------------------------------------------------------*/ /** * @brief * Reset the @em cpl_error_code. * * @return Nothing. * * This function initialises the @em cpl_error_code to @c CPL_ERROR_NONE. */ void cpl_error_reset(void) { #ifdef HAVE_LIBPTHREAD pthread_rwlock_wrlock(&cpl_lock_error_status); pthread_rwlock_rdlock(&cpl_lock_error_read_only); #endif if (!cpl_error_read_only) cpl_error_status = CPL_FALSE; #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_status); pthread_rwlock_unlock(&cpl_lock_error_read_only); #endif } /* * @internal * @brief * Set CPL error code, function name, source file & line number where it * occurred along with a text message * * @param function Character string with function name, cpl_func * @param code Error code * @param file Character string with source file name (__FILE__) * @param line Integer with line number (__LINE__) * @param text Text to append to error message, may be printf-like * @param ... Optional, variable argument list for the printf-like text * @return The CPL error code, or CPL_ERROR_UNSPECIFIED if the code is * CPL_ERROR_HISTORY_LOST. * @note This function is only provided for cpl_error_set*() macros. * @see cpl_error_set_message() */ cpl_error_code cpl_error_set_message_macro(const char * function, cpl_error_code code, const char * file, unsigned line, const char * text, ...) { va_list arglist; cpl_error_code lcode; va_start(arglist, text); lcode = cpl_error_set_message_macro_(function, code, file, line, text, arglist); va_end(arglist); return lcode; } /*----------------------------------------------------------------------------*/ /** * @internal * @brief * Set CPL error code, function name, source file, line number where * an FITS error occurred along with a FITS specific text message * @param function Character string with function name, cpl_func * @param code CPL Error code * @param fitscode The error code of the failed (CFITSIO) I/O call * @param fitsfunction Character string with (CFITSIO) function name * @param file Character string with source file name (__FILE__) * @param line Integer with line number (__LINE__) * @param text Text to append to error message, may be printf-like * @param ... Optional, variable argument list for the printf-like text * @return The CPL error code * @see cpl_error_set_message() * @note This function should only be called from the cpl_error_set_fits() macro */ cpl_error_code cpl_error_set_fits_macro(const char * function, cpl_error_code code, int fitserror, const char * fitsfunction, const char * file, unsigned line, const char * text, ...) { char cfitsio_msg[FLEN_ERRMSG]; va_list arglist; cpl_error_code lcode; char * newformat; const cpl_boolean has_name = fitsfunction && strcmp(fitsfunction, "\"\""); fits_get_errstatus(fitserror, cfitsio_msg); cfitsio_msg[FLEN_ERRMSG-1] = '\0' ; /* Better safe than sorry */ newformat = cpl_sprintf("\"%s\" from CFITSIO " #ifdef CFITSIO_VERSION /* Used from v. 3.0 */ "(ver. " CPL_STRINGIFY(CFITSIO_VERSION) ") " #endif "%s%s=%d. %s", cfitsio_msg, has_name ? fitsfunction : "", has_name ? "()" : "error", fitserror, text); va_start(arglist, text); lcode = cpl_error_set_message_macro_(function, code, file, line, newformat, arglist); va_end(arglist); cpl_free(newformat); return lcode; } /*----------------------------------------------------------------------------*/ /** * @internal * @brief * Set CPL error code, function name, source file, line number where * a regex error occurred along with a regex specific text message * @param function Character string with function name, cpl_func * @param code CPL Error code * @param regcode The error code of the failed regcomp() call * @param preg The regex of the failed call * @param file Character string with source file name (__FILE__) * @param line Integer with line number (__LINE__) * @param text Text to append to error message, may be printf-like * @param ... Optional, variable argument list for the printf-like text * @return The CPL error code * @see cpl_error_set_message() * @note This function should only be called from cpl_error_set_regex() */ cpl_error_code cpl_error_set_regex_macro(const char * function, cpl_error_code code, int regcode, const regex_t * preg, const char * file, unsigned line, const char * text, ...) { cpl_error_code lcode; va_list arglist; char * newformat; if (preg == NULL) { /* Passing NULL to regerror() seems to fill with the information of the previous error, which we do not want here */ newformat = cpl_sprintf("regcomp(NULL)=%d. %s", regcode, text); } else { char regex_msg[CPL_ERROR_MAX_MESSAGE_LENGTH]; (void)regerror(regcode, preg, regex_msg, CPL_ERROR_MAX_MESSAGE_LENGTH); newformat = cpl_sprintf("\"%s\" from regcomp()=%d. %s", regex_msg, regcode, text); } va_start(arglist, text); lcode = cpl_error_set_message_macro_(function, code, file, line, newformat, arglist); va_end(arglist); cpl_free(newformat); return lcode; } /*----------------------------------------------------------------------------*/ /** * @internal * @brief * Set CPL error code, function name, source file, line number where * an WCSLIB error occurred along with a WCSLIB specific text message * @param function Character string with function name, cpl_func * @param code CPL Error code * @param wcscode The error code of the failed WCSLIB call * @param wcsfunction Character string with WCSLIB function name * @param wcserrmsg The WCSLIB array of error messages * @param file Character string with source file name (__FILE__) * @param line Integer with line number (__LINE__) * @param text Text to append to error message, may be printf-like * @param ... Optional, variable argument list for the printf-like text * @return The CPL error code * @see cpl_error_set_message() * @note This function should only be called from the cpl_error_set_wcs() macro * */ cpl_error_code cpl_error_set_wcs_macro(const char * function, cpl_error_code code, int wcserror, const char * wcsfunction, const char * wcserrmsg[], const char * file, unsigned line, const char * text, ...) { cpl_error_code lcode; va_list arglist; char * newformat; const cpl_boolean has_name = wcsfunction && strlen(wcsfunction); if (wcserror < 0) { newformat = cpl_sprintf("%s%s=%d < 0. %s", has_name ? wcsfunction : "", has_name ? "()" : "error", wcserror, text); } else if (wcserrmsg == NULL) { newformat = cpl_sprintf("%s%s()=%d. wcs_errmsg[] == NULL. %s", has_name ? wcsfunction : "", has_name ? "()" : "error", wcserror, text); } else if (wcserrmsg[wcserror] == NULL) { newformat = cpl_sprintf("%s%s()=%d. wcs_errmsg[%d] == NULL. %s", has_name ? wcsfunction : "", has_name ? "()" : "error", wcserror, wcserror, text); } else { newformat = cpl_sprintf("\"%s\" from %s%s()=%d. %s", wcserrmsg[wcserror], has_name ? wcsfunction : "", has_name ? "()" : "error", wcserror, text); } va_start(arglist, text); lcode = cpl_error_set_message_macro_(function, code, file, line, newformat, arglist); va_end(arglist); cpl_free(newformat); return lcode; } /** * @brief * Get the last @em cpl_error_code set. * * @return @em cpl_error_code of last occurred CPL error. * * Get @em cpl_error_code of last occurred error. */ cpl_error_code cpl_error_get_code(void) { cpl_error_code code = CPL_ERROR_NONE; #ifdef HAVE_LIBPTHREAD pthread_rwlock_rdlock(&cpl_lock_error_status); #endif if (cpl_error_status) { const cpl_error * error = cpl_errorstate_find(); code = error->code; } #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_status); #endif return code; } /** * @brief * Get the text message of the current CPL error. * * @return The text message of the current CPL error. * @see cpl_error_get_message_default(), cpl_error_set_message() * * If the @em cpl_error_code is equal to @c CPL_ERROR_NONE, * an empty string is returned. Otherwise, the message is the default * message for the current CPL error code, possibly extended with a * custom message supplied when the error was set. * */ const char * cpl_error_get_message(void) { const cpl_error * error; #ifdef HAVE_LIBPTHREAD pthread_rwlock_rdlock(&cpl_lock_error_status); #endif if (!cpl_error_status) { #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_status); #endif return cpl_error_get_message_default(CPL_ERROR_NONE); } #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_status); #endif error = cpl_errorstate_find(); /* assert(error->code != CPL_ERROR_NONE); */ return strlen(error->msg) ? error->msg : cpl_error_get_message_default(error->code); } /** * @brief * Get the function name where the last CPL error occurred. * * @return Identifier string of the function name where the last CPL error * occurred. * * Get the function name where the last CPL error occurred. */ const char *cpl_error_get_function(void) { const char * function = ""; #ifdef HAVE_LIBPTHREAD pthread_rwlock_rdlock(&cpl_lock_error_status); #endif if (cpl_error_status) { const cpl_error * error = cpl_errorstate_find(); function = error->function; } #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_status); #endif return function; } /** * @brief * Get function name, source file and line number where the last * CPL error occurred. * * @return String containing function name, source file and line number * separated by colons (:). * * Get where the last CPL error occurred in the form * @c function_name:source_file:line_number */ const char *cpl_error_get_where(void) { static char cpl_error_where_string[MAX_WHERE_LENGTH]; #ifdef _OPENMP #pragma omp threadprivate(cpl_error_where_string) #endif (void)cx_snprintf((cxchar *)cpl_error_where_string, (cxsize)MAX_WHERE_LENGTH, (const cxchar *)"%s:%s:%u", cpl_error_get_function(), cpl_error_get_file(), cpl_error_get_line()); return cpl_error_where_string; } /** * @brief * Get the source code file name where the last CPL error occurred. * * @return Name of source file name where the last CPL error occurred. * * Get the source code file name where the last CPL error occurred. */ const char *cpl_error_get_file(void) { const char * file = ""; #ifdef HAVE_LIBPTHREAD pthread_rwlock_rdlock(&cpl_lock_error_status); #endif if (cpl_error_status) { const cpl_error * error = cpl_errorstate_find(); file = error->file; } #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_status); #endif return file; } /** * @brief * Get the line number where the last CPL error occurred. * * @return Line number of the source file where the last CPL error occurred. * * Get the line number of the source file where the last CPL error occurred. */ unsigned cpl_error_get_line(void) { unsigned line = 0; #ifdef HAVE_LIBPTHREAD pthread_rwlock_rdlock(&cpl_lock_error_status); #endif if (cpl_error_status) { const cpl_error * error = cpl_errorstate_find(); line = error->line; } #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_status); #endif return line; } /*----------------------------------------------------------------------------*/ /** @brief Return the standard CPL error message of the current CPL error @param code The error code of the current CPL error @return The standard CPL error message of the current CPL error */ /*----------------------------------------------------------------------------*/ const char * cpl_error_get_message_default(cpl_error_code code) { const char * message; switch (code) { case CPL_ERROR_NONE: message = ""; break; case CPL_ERROR_UNSPECIFIED: message = "An unspecified error"; break; case CPL_ERROR_HISTORY_LOST: message = "The actual error was lost"; break; case CPL_ERROR_DUPLICATING_STREAM: message = "Cannot duplicate output stream"; break; case CPL_ERROR_ASSIGNING_STREAM: message = "Cannot associate a stream with a file descriptor"; break; case CPL_ERROR_FILE_IO: message = "File read/write error"; break; case CPL_ERROR_BAD_FILE_FORMAT: message = "Bad file format"; break; case CPL_ERROR_FILE_ALREADY_OPEN: message = "File already open"; break; case CPL_ERROR_FILE_NOT_CREATED: message = "File cannot be created"; break; case CPL_ERROR_FILE_NOT_FOUND: message = "File not found"; break; case CPL_ERROR_DATA_NOT_FOUND: message = "Data not found"; break; case CPL_ERROR_ACCESS_OUT_OF_RANGE: message = "Access beyond boundaries"; break; case CPL_ERROR_NULL_INPUT: message = "Null input data"; break; case CPL_ERROR_INCOMPATIBLE_INPUT: message = "Input data do not match"; break; case CPL_ERROR_ILLEGAL_INPUT: message = "Illegal input"; break; case CPL_ERROR_ILLEGAL_OUTPUT: message = "Illegal output"; break; case CPL_ERROR_UNSUPPORTED_MODE: message = "Unsupported mode"; break; case CPL_ERROR_SINGULAR_MATRIX: message = "Singular matrix"; break; case CPL_ERROR_DIVISION_BY_ZERO: message = "Division by zero"; break; case CPL_ERROR_TYPE_MISMATCH: message = "Type mismatch"; break; case CPL_ERROR_INVALID_TYPE: message = "Invalid type"; break; case CPL_ERROR_CONTINUE: message = "The iterative process did not converge"; break; case CPL_ERROR_NO_WCS: message = "The WCS functionalities are missing"; break; case CPL_ERROR_EOL: message = "A user-defined error"; break; default: message = "A user-defined error"; break; } return message; } #ifdef HAVE_LIBPTHREAD /*----------------------------------------------------------------------------*/ /** @brief Lock the RW locks of the global variables in this module */ /*----------------------------------------------------------------------------*/ void cpl_error_init_locks(void) { pthread_rwlock_init(&cpl_lock_error_status, NULL); pthread_rwlock_init(&cpl_lock_error_read_only, NULL); } #endif /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Get the status of the CPL error state @return True iff an error code has been set @note This function may only be used by the cpl_errorstate module. CPL_FALSE: The CPL error state is clear, no history may be read. CPL_TRUE: The CPL error state has been set, and contains at least one CPL error state (with a non-zero error code). */ /*----------------------------------------------------------------------------*/ cpl_boolean cpl_error_is_set(void) { cpl_boolean status; #ifdef HAVE_LIBPTHREAD pthread_rwlock_rdlock(&cpl_lock_error_status); #endif status = cpl_error_status; #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_status); #endif return status; } /*----------------------------------------------------------------------------*/ /** @internal @brief Get the read-only status of the CPL error system @return True iff the CPL error system is read-only @note This function may only be used by the cpl_errorstate module. */ /*----------------------------------------------------------------------------*/ cpl_boolean cpl_error_is_readonly(void) { cpl_boolean read_only; #ifdef HAVE_LIBPTHREAD pthread_rwlock_rdlock(&cpl_lock_error_read_only); #endif read_only = cpl_error_read_only; #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_read_only); #endif return read_only; } /*----------------------------------------------------------------------------*/ /** @internal @brief Set the status of the CPL error system to read-only @note This function may only be used by the cpl_errorstate module. */ /*----------------------------------------------------------------------------*/ void cpl_error_set_readonly(void) { #ifdef HAVE_LIBPTHREAD pthread_rwlock_wrlock(&cpl_lock_error_read_only); #endif cpl_error_read_only = CPL_TRUE; #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_read_only); #endif } /*----------------------------------------------------------------------------*/ /** @internal @brief Set the status of the CPL error system to read/write @note This function may only be used by the cpl_errorstate module. */ /*----------------------------------------------------------------------------*/ void cpl_error_reset_readonly(void) { #ifdef HAVE_LIBPTHREAD pthread_rwlock_wrlock(&cpl_lock_error_read_only); #endif cpl_error_read_only = CPL_FALSE; #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_read_only); #endif } /* * @internal * @brief Set the basics of a CPL error and return the struct * @param function Character string with function name, cpl_func * @param code Error code * @param file Character string with source file name (__FILE__) * @param line Integer with line number (__LINE__) * @return A pointer to the struct of the error. * @see cpl_error_set_message_macro() */ static cpl_error * cpl_error_fill(const char * function, cpl_error_code code, const char * file, unsigned line) { cpl_error * error = cpl_errorstate_append(); cx_assert(error != NULL); cx_assert(code != CPL_ERROR_NONE); #ifdef HAVE_LIBPTHREAD pthread_rwlock_rdlock(&cpl_lock_error_read_only); #endif cx_assert(!cpl_error_read_only); #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_read_only); pthread_rwlock_wrlock(&cpl_lock_error_status); #endif cpl_error_status = CPL_TRUE; #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_status); #endif error->code = code; error->line = line; if (function == NULL) { error->function[0] = '\0'; } else { (void)strncpy(error->function, function, MAX_NAME_LENGTH); error->function[MAX_NAME_LENGTH] = '\0'; } if (file == NULL) { error->file[0] = '\0'; } else { (void)strncpy(error->file, file, MAX_FILE_LENGTH); error->file[MAX_FILE_LENGTH] = '\0'; } error->msg[0] = '\0'; return error; } /* * @internal * @brief * Set CPL error code, function name, source file & line number where it * occurred along with a text message and a variable argument list * @param function Character string with function name (cpl_func) * @param code Error code * @param file Character string with source file name (__FILE__) * @param line Integer with line number (__LINE__) * @param text Text to append to error message, may be printf-like * @param arglist Optional, variable argument list for the printf-like text * @return The CPL error code, or CPL_ERROR_UNSPECIFIED if the code is * CPL_ERROR_HISTORY_LOST. * @see cpl_error_set_message_macro() */ static cpl_error_code cpl_error_set_message_macro_(const char * function, cpl_error_code code, const char * file, unsigned line, const char * text, va_list arglist) { /* Check copied from cpl_error_set_message_one_macro() */ char * message = (text != NULL && text[0] != '\0' && (text[0] != ' ' || text[1] != '\0')) ? cpl_vsprintf(text, arglist) : NULL; const char * usemsg = message ? message : text; const cpl_error_code lcode = cpl_error_set_message_one_macro(function, code, file, line, usemsg); cpl_free((void*)message); return lcode; } /* * @internal * @brief * Set CPL error code, function name, source file & line number where it * occurred along with a text message and a variable argument list * @param function Character string with function name (cpl_func) * @param code Error code * @param file Character string with source file name (__FILE__) * @param line Integer with line number (__LINE__) * @param text Text to append to error message * @return The CPL error code, or CPL_ERROR_UNSPECIFIED if the code is * CPL_ERROR_HISTORY_LOST. * @see cpl_error_set_message_macro_() */ cpl_error_code cpl_error_set_message_one_macro(const char * function, cpl_error_code code, const char * file, unsigned line, const char * text) { const cpl_error_code lcode = code == CPL_ERROR_HISTORY_LOST ? CPL_ERROR_UNSPECIFIED : code; #ifdef HAVE_LIBPTHREAD pthread_rwlock_rdlock(&cpl_lock_error_read_only); #endif if (!cpl_error_read_only && code != CPL_ERROR_NONE) { cpl_error * error = cpl_error_fill(function, lcode, file, line); if (text != NULL && text[0] != '\0' && (text[0] != ' ' || text[1] != '\0')) { /* The user supplied a message */ /* Calling this function with text NULL or empty is supported, but causes a compiler warning on some systems. To support calls that do not set a message, call with a single space causes that user message to be ignored. */ /* Concatenate the standard message and the user supplied message */ cx_assert( error != NULL ); (void)cx_snprintf((cxchar *)error->msg, (cxsize)CPL_ERROR_MAX_MESSAGE_LENGTH, (const cxchar *)"%s: %s", cpl_error_get_message_default(lcode), text); } } #ifdef HAVE_LIBPTHREAD pthread_rwlock_unlock(&cpl_lock_error_read_only); #endif return lcode; } cpl-6.4.1/cplcore/cpl_plot.c0000644000460300003120000015610012267702625012635 00000000000000/* $Id: cpl_plot.c,v 1.22 2012-05-21 12:40:05 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-05-21 12:40:05 $ * $Revision: 1.22 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_plot.h" #include "cpl_memory.h" #include "cpl_error_impl.h" #include #include #include #include #include #include #include /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ #ifndef CPL_PLOT_TMPFILE #define CPL_PLOT_TMPFILE "cpl_plot.txt" #endif /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_plot Plotting of CPL objects * * This module provides functions to plot basic CPL objects * * This module is offered to help during the development process. * The functions offered should NOT be used in any operational environment. * For that reason, the support of those remains limited, and no functionality * extension can be expected from the CPL team. * * The created plot windows can be closed by pressing the 'q' key like * you would do with a normal gnuplot window. * * The default behaviour of the plotting is to use gnuplot (with option * -persist). The user can control the actual plotting-command used to create * the plot by setting the environment variable CPL_PLOTTER. Currently, if * CPL_PLOTTER is set it must contain the string 'gnuplot'. Setting * it to 'cat > my_gnuplot_$$.txt' causes a number of ASCII-files to be * created, which each produce a plot when given as standard input to gnuplot. * * A finer control of the plotting options can be obtained by writing an * executable script, e.g. my_gnuplot, that executes gnuplot after setting * the desired gnuplot options (e.g. set terminal pslatex color) and then * setting CPL_PLOTTER to my_gnuplot. * * Images can be plotted not only with gnuplot, but also using the pnm format. * This is controlled with the environment variable CPL_IMAGER. If CPL_IMAGER * is set to a string that does not contain the word gnuplot, the recipe * will generate the plot in pnm format. E.g. setting CPL_IMAGER to * 'display - &' will produce a gray-scale image using the image viewer display. * * @code * #include "cpl_plot.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Type definition -----------------------------------------------------------------------------*/ typedef struct _cpl_plot_ cpl_plot; struct _cpl_plot_ { /* File with data to be sent to plotting command's stdin */ FILE * data; /* Name of command capable of reading the plot on stdin */ const char * exe; /* Name of temporary file for storing the plot commands */ const char * tmp; }; /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ static cpl_error_code cpl_mplot_puts(cpl_plot *, const char *); static cpl_error_code cpl_mplot_write(cpl_plot *, const char *, size_t); static cpl_plot * cpl_mplot_open(const char *); static cpl_plot * cpl_image_open(const char *); static cpl_error_code cpl_mplot_close(cpl_plot *, const char *); static const char * cpl_mplot_plotter(void); static const char * cpl_mplot_imager(void); /*----------------------------------------------------------------------------- Functions code -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** @brief Plot a vector @param pre An optional string with pre-plot commands @param options An optional string with plotting options @param post An optional string with post-plot commands @param vector The vector to plot @return CPL_ERROR_NONE or the relevant CPL_ERROR_# on error The vector must have a positive number of elements. Possible _cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO - CPL_ERROR_NULL_INPUT - CPL_ERROR_ILLEGAL_INPUT - CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_plot_vector(const char * pre, const char * options, const char * post, const cpl_vector * vector) { const double * pvec = cpl_vector_get_data_const(vector); const cpl_size n = cpl_vector_get_size(vector); cpl_error_code error = CPL_ERROR_NONE; cpl_size i; cpl_plot * plot; if (n <= 0) return cpl_error_set_where_(); plot = cpl_mplot_open(pre); if (plot == NULL) return cpl_error_set_where_(); error |= cpl_mplot_puts(plot, "plot '-' "); if (options != NULL) { error |= cpl_mplot_puts(plot, options); } else { char * myoptions = cpl_sprintf("t '%" CPL_SIZE_FORMAT"-vector (%p)", n, (const void*)vector); assert(myoptions != NULL); error |= cpl_mplot_puts(plot, myoptions); cpl_free(myoptions); } error |= cpl_mplot_puts(plot, ";\n"); for (i = 0; i < n; i++) { char * snumber = cpl_sprintf("%g\n", pvec[i]); error |= cpl_mplot_puts(plot, snumber); cpl_free(snumber); if (error) break; } error |= cpl_mplot_puts(plot, "e\n"); error |= cpl_mplot_close(plot, post); return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Plot a bivector @param pre An optional string with pre-plot commands @param options An optional string with plotting options @param post An optional string with post-plot commands @param bivector The bivector to plot @return CPL_ERROR_NONE or the relevant CPL_ERROR_# on error The bivector must have a positive number of elements. @see also @c cpl_mplot_open(). Possible _cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO - CPL_ERROR_NULL_INPUT - CPL_ERROR_ILLEGAL_INPUT - CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_plot_bivector(const char * pre, const char * options, const char * post, const cpl_bivector * bivector) { const cpl_size n = cpl_bivector_get_size(bivector); const double * pvecx = cpl_bivector_get_x_data_const(bivector); const double * pvecy = cpl_bivector_get_y_data_const(bivector); cpl_error_code error = CPL_ERROR_NONE; cpl_plot * plot; cpl_size i; if (n <= 0) return cpl_error_set_where_(); plot = cpl_mplot_open(pre); if (plot == NULL) return cpl_error_set_where_(); error |= cpl_mplot_puts(plot, "plot '-' "); if (options != NULL) { error |= cpl_mplot_puts(plot, options); } else { char * myoptions = cpl_sprintf("t '%" CPL_SIZE_FORMAT "-bivector (%p)", n, (const void*)bivector); assert(myoptions != NULL); error |= cpl_mplot_puts(plot, myoptions); cpl_free(myoptions); } error |= cpl_mplot_puts(plot, ";\n"); for (i = 0; i < n; i++) { char * snumber = cpl_sprintf("%g %g\n", pvecx[i], pvecy[i]); error |= cpl_mplot_puts(plot, snumber); cpl_free(snumber); if (error) break; } error |= cpl_mplot_puts(plot, "e\n"); error |= cpl_mplot_close(plot, post); return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Plot an array of vectors @param pre An optional string with pre-plot commands @param options An optional string with plotting options @param post An optional string with post-plot commands @param vectors The vectors array to plot @param nvec The number of vectors @return CPL_ERROR_NONE or the relevant CPL_ERROR_# on error The array should contain at least 3 vectors, the first one can be NULL. The non-NULL vectors must have the same number of elements. The first vector gives the x-axis. If NULL, the index is used. @see also @c cpl_mplot_open(). Possible _cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO - CPL_ERROR_NULL_INPUT - CPL_ERROR_ILLEGAL_INPUT - CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_plot_vectors(const char * pre, const char * options, const char * post, const cpl_vector ** vectors, cpl_size nvec) { cpl_errorstate prestate = cpl_errorstate_get(); const double * pvecx; const double * pvecy; cpl_size vec_size = 0; /* Avoid uninit warning */ char ** names; char * sval; FILE * tmpfd; cpl_plot * plot; cpl_size i, j; /* Check entries */ cpl_ensure_code(vectors != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(nvec>=3, CPL_ERROR_ILLEGAL_INPUT); for (i=1; i= 1, CPL_ERROR_DATA_NOT_FOUND); for (i=0; i myplot$$.pgm' and 'display - &'. The 'pre' and 'post' commands are ignored in PGM-plots, while the 'options' string is written as a comment in the header of the mask. See also cpl_plot_vector(). Possible _cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO - CPL_ERROR_NULL_INPUT - CPL_ERROR_ILLEGAL_INPUT - CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_plot_mask(const char * pre, const char * options, const char * post, const cpl_mask * mask) { const cpl_size nx = cpl_mask_get_size_x(mask); const cpl_size ny = cpl_mask_get_size_y(mask); cpl_plot * plot; const cpl_binary * pmask = cpl_mask_get_data_const(mask); char * dvi_options = (char *)options; char * myoptions = (char *)options; cpl_error_code error = CPL_ERROR_NONE; cpl_size i, j; if (nx <= 0) return cpl_error_set_where_(); plot = cpl_image_open(pre); if (plot == NULL) return cpl_error_set_where_(); if (options == NULL || strlen(options) < 1) { dvi_options = cpl_sprintf("%" CPL_SIZE_FORMAT "X%" CPL_SIZE_FORMAT "-mask (%p)", nx, ny, (const void*)mask); assert( dvi_options != NULL); } assert(plot->exe != NULL); if (strstr(plot->exe, "gnuplot")) { error |= cpl_mplot_puts(plot, "splot '-' matrix "); if (myoptions == NULL || strlen(myoptions) < 1) { myoptions = cpl_sprintf("t '%s';", dvi_options); assert( myoptions != NULL); } error |= cpl_mplot_puts(plot, myoptions); error |= cpl_mplot_puts(plot, ";\n"); for (j = 0; j < ny; j++) { for (i = 0; i < nx; i++) { char * snumber = cpl_sprintf("%d ", pmask[i + j * nx]); error |= cpl_mplot_puts(plot, snumber); cpl_free(snumber); if (error) break; } error |= cpl_mplot_puts(plot, "\n"); if (error) break; } error |= cpl_mplot_puts(plot, "e\n"); } else { const size_t bsize = (size_t)(ny * nx); /* Octets in raster */ unsigned char * raster = (unsigned char *)cpl_malloc(bsize); /* Create a PGM P5 header - with a maxval of 1 */ myoptions = cpl_sprintf("P5\n%" CPL_SIZE_FORMAT " %" CPL_SIZE_FORMAT "\n", nx, ny); error |= cpl_mplot_puts(plot, myoptions); cpl_free(myoptions); myoptions = cpl_sprintf("# %s\n1\n", dvi_options); error |= cpl_mplot_puts(plot, myoptions); for (j = 0; j < ny; j++) for (i = 0; i < nx; i++) raster[i + (ny-j-1) * nx] = (unsigned char) pmask[i + j * nx]; error |= cpl_mplot_write(plot, (const void *) raster, bsize); cpl_free(raster); } if (dvi_options != options) cpl_free(dvi_options); if (myoptions != options) cpl_free(myoptions); error |= cpl_mplot_close(plot, post); return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Plot an image @param pre An optional string with pre-plot commands @param options An optional string with plotting options @param post An optional string with post-plot commands @param image The image to plot @return CPL_ERROR_NONE or the relevant CPL_ERROR_# on error The image must have a positive number of pixels. @see also @c cpl_image_open(). If the specified plotting command does not contain the string 'gnuplot', the plotting command is assumed to be able to parse a pgm (P5) image from stdin. Valid examples of such a command may include 'cat > myplot$$.pgm' and 'display - &'. The 'pre' and 'post' commands are ignored in PGM-plots, while the 'options' string is written as a comment in the header of the image. See also cpl_plot_vector(). Possible _cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO - CPL_ERROR_NULL_INPUT - CPL_ERROR_ILLEGAL_INPUT - CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_plot_image(const char * pre, const char * options, const char * post, const cpl_image * image) { const cpl_size nx = cpl_image_get_size_x(image); const cpl_size ny = cpl_image_get_size_y(image); cpl_plot * plot; cpl_image * temp; const double * pimage; unsigned char * raster = NULL; char * dvi_options = (char *)options; char * myoptions = (char *)options; cpl_error_code error = CPL_ERROR_NONE; cpl_size i, j; if (nx <= 0) return cpl_error_set_where_(); plot = cpl_image_open(pre); if (plot == NULL) return cpl_error_set_where_(); if (options == NULL || strlen(options) < 1) { dvi_options = cpl_sprintf("%" CPL_SIZE_FORMAT "X%" CPL_SIZE_FORMAT "-image-(%d) (%p)", nx, ny, (int)cpl_image_get_type(image), (const void*)image); assert( dvi_options != NULL); } assert(plot->exe != NULL); if (strstr(plot->exe, "gnuplot")) { if (cpl_image_get_type(image) == CPL_TYPE_DOUBLE) { temp = NULL; pimage = cpl_image_get_data_double_const(image); } else { temp = cpl_image_cast(image, CPL_TYPE_DOUBLE); pimage = cpl_image_get_data_double(temp); } error |= cpl_mplot_puts(plot, "splot '-' matrix "); if (myoptions == NULL || strlen(myoptions) < 1) { myoptions = cpl_sprintf("t '%s';", dvi_options); assert( myoptions != NULL); } error |= cpl_mplot_puts(plot, myoptions); error |= cpl_mplot_puts(plot, ";\n"); for (j = 0; j < ny; j++) { for (i = 0; i < nx; i++) { char * snumber = cpl_sprintf("%g ", pimage[j*nx + i]); error |= cpl_mplot_puts(plot, snumber); cpl_free(snumber); if (error) break; } error |= cpl_mplot_puts(plot, "\n"); if (error) break; } error |= cpl_mplot_puts(plot, "e\n"); } else { const size_t bsize = (size_t)(ny * nx); /* Octets in raster */ const double tmin = cpl_image_get_min(image); double tmax; /* Convert the image to one in the range [0; 256[ */ if (cpl_image_get_type(image) == CPL_TYPE_DOUBLE) { temp = cpl_image_subtract_scalar_create(image, tmin); } else { temp = cpl_image_cast(image, CPL_TYPE_DOUBLE); error |= cpl_image_subtract_scalar(temp, tmin); } tmax = cpl_image_get_max(temp); if (tmax > 0.0) error |= cpl_image_multiply_scalar(temp, 256.0*(1.0-DBL_EPSILON) /tmax); pimage = cpl_image_get_data_double(temp); assert(pimage != NULL); /* Create a PGM P5 header - with a maxval of 255 */ myoptions = cpl_sprintf("P5\n%" CPL_SIZE_FORMAT " %" CPL_SIZE_FORMAT "\n", nx, ny); error |= cpl_mplot_puts(plot, myoptions); cpl_free(myoptions); myoptions = cpl_sprintf("# True Value Range: [%g;%g]\n", tmin, tmin+tmax); assert( myoptions != NULL); error |= cpl_mplot_puts(plot, myoptions); cpl_free(myoptions); myoptions = cpl_sprintf("# %s\n255\n", dvi_options); error |= cpl_mplot_puts(plot, myoptions); raster = (unsigned char *)cpl_malloc(bsize); for (j = 0; j < ny; j++) for (i = 0; i < nx; i++) raster[(ny-j-1)*nx + i] = (unsigned char) pimage[j*nx + i]; error |= cpl_mplot_write(plot, (const char *) raster, bsize); } if (dvi_options != options) cpl_free(dvi_options); if (myoptions != options) cpl_free(myoptions); cpl_free(raster); cpl_image_delete(temp); error |= cpl_mplot_close(plot, post); return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Plot a range of image rows @param pre An optional string with pre-plot commands @param options An optional string with plotting options @param post An optional string with post-plot commands @param image The image to plot @param firstrow The first row to plot (1 for first) @param lastrow The last row to plot @param rowstep The positive row stride @return CPL_ERROR_NONE or the relevant CPL_ERROR_# on error The image must have a positive number of pixels. lastrow shall be greater than or equal to firstrow. @see also @c cpl_mplot_open(). Possible _cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO - CPL_ERROR_NULL_INPUT - CPL_ERROR_ILLEGAL_INPUT - CPL_ERROR_ACCESS_OUT_OF_RANGE (firstrow or lastrow are out of range) - CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_plot_image_row(const char * pre, const char * options, const char * post, const cpl_image * image, cpl_size firstrow, cpl_size lastrow, cpl_size rowstep) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_size nx, ny; cpl_ensure_code(image != NULL, CPL_ERROR_NULL_INPUT); nx = cpl_image_get_size_x(image); ny = cpl_image_get_size_y(image); cpl_ensure_code( nx > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code( ny > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code( rowstep > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code( firstrow > 0, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code( firstrow <= lastrow, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code( lastrow <= ny, CPL_ERROR_ACCESS_OUT_OF_RANGE); do { const double * pimage; cpl_image * temp = NULL; char * myoptions = NULL; cpl_size i, j; cpl_plot * plot = cpl_mplot_open(pre); do { if (plot == NULL) break; if (cpl_mplot_puts(plot, "plot")) break; for (j = firstrow-1; j < lastrow; j += rowstep) { const char * useoptions = options; if (j > firstrow-1 && cpl_mplot_puts(plot, ",")) break; if (cpl_mplot_puts(plot, " '-' ")) break; if (useoptions == NULL || strlen(useoptions) < 1) { cpl_free(myoptions); myoptions = (j == firstrow-1) ? cpl_sprintf("t 'Row %" CPL_SIZE_FORMAT " %" CPL_SIZE_FORMAT "X%" CPL_SIZE_FORMAT "-image-(%d) (%p)'", j, nx, ny, (int)cpl_image_get_type(image), (const void*)image) : cpl_sprintf("t 'Row %" CPL_SIZE_FORMAT " of the same image'", j); assert( myoptions != NULL); useoptions = myoptions; } if (cpl_mplot_puts(plot, useoptions)) break; } if (cpl_mplot_puts(plot, ";\n ")) break; if (cpl_image_get_type(image) == CPL_TYPE_DOUBLE) { pimage = cpl_image_get_data_double_const(image); } else { temp = cpl_image_cast(image, CPL_TYPE_DOUBLE); pimage = cpl_image_get_data_double_const(temp); } assert(pimage != NULL); for (j = firstrow-1; j < lastrow; j += rowstep) { for (i = 0; i < nx; i++) { char * snumber = cpl_sprintf("%g\n", pimage[j * nx + i]); const int nstat = cpl_mplot_puts(plot, snumber); cpl_free(snumber); if (nstat) break; } if (i != nx) break; if (cpl_mplot_puts(plot, "e\n")) break; } if (j != lastrow) break; } while (0); cpl_free(myoptions); cpl_image_delete(temp); cpl_mplot_close(plot, post); } while (0); return cpl_errorstate_is_equal(prestate) ? CPL_ERROR_NONE : cpl_error_set_where_(); } /*----------------------------------------------------------------------------*/ /** @brief Plot a range of image columns @param pre An optional string with pre-plot commands @param options An optional string with plotting options @param post An optional string with post-plot commands @param image The image to plot @param firstcol The first column to plot (1 for first) @param lastcol The last column to plot @param colstep The positive column stride @return CPL_ERROR_NONE or the relevant CPL_ERROR_# on error The image must have a positive number of pixels. lastcol shall be greater than or equal to firstcol. @see also @c cpl_mplot_open(). Possible _cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO - CPL_ERROR_NULL_INPUT - CPL_ERROR_ILLEGAL_INPUT - CPL_ERROR_ACCESS_OUT_OF_RANGE (firstcol or lastcol are out of range) - CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_plot_image_col(const char * pre, const char * options, const char * post, const cpl_image * image, cpl_size firstcol, cpl_size lastcol, cpl_size colstep) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_size nx, ny; cpl_ensure_code(image != NULL, CPL_ERROR_NULL_INPUT); nx = cpl_image_get_size_x(image); ny = cpl_image_get_size_y(image); cpl_ensure_code( nx > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code( ny > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code( colstep > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code( firstcol > 0, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code( firstcol <= lastcol, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code( lastcol <= nx, CPL_ERROR_ACCESS_OUT_OF_RANGE); do { const double * pimage; cpl_image * temp = NULL; char * myoptions = NULL; cpl_size i, j; cpl_plot * plot = cpl_mplot_open(pre); do { if (cpl_error_get_code()) break; if (cpl_mplot_puts(plot, "plot")) break; for (i = firstcol-1; i < lastcol; i += colstep) { const char * useoptions = options; if (i > firstcol-1 && cpl_mplot_puts(plot, ",")) break; if (cpl_mplot_puts(plot, " '-' ")) break; if (useoptions == NULL || strlen(useoptions) < 1) { cpl_free(myoptions); myoptions = (i == firstcol-1) ? cpl_sprintf("t 'Column %" CPL_SIZE_FORMAT " of a " "%" CPL_SIZE_FORMAT "X%" CPL_SIZE_FORMAT "-image-(%d) (%p) ", i, nx, ny, (int)cpl_image_get_type(image), (const void*)image) : cpl_sprintf("t 'Column %" CPL_SIZE_FORMAT " of the " "same image'", i); assert( myoptions != NULL); useoptions = myoptions; } if (cpl_mplot_puts(plot, useoptions )) break; } if (cpl_mplot_puts(plot, ";\n ")) break; if (cpl_image_get_type(image) == CPL_TYPE_DOUBLE) { pimage = cpl_image_get_data_double_const(image); } else { temp = cpl_image_cast(image, CPL_TYPE_DOUBLE); pimage = cpl_image_get_data_double_const(temp); } for (i = firstcol-1; i < lastcol; i += colstep) { for (j = 0; j < ny; j++) { char * snumber = cpl_sprintf("%g\n", pimage[j * nx + i]); const int nstat = cpl_mplot_puts(plot, snumber); cpl_free(snumber); if (nstat) break; } if (j != ny) break; if (cpl_mplot_puts(plot, "e\n")) break; } if (i != lastcol) break; } while (0); cpl_free(myoptions); cpl_image_delete(temp); cpl_mplot_close(plot, post); } while (0); return cpl_errorstate_is_equal(prestate) ? CPL_ERROR_NONE : cpl_error_set_where_(); } /*----------------------------------------------------------------------------*/ /** @brief Plot a column of a table @param pre An optional string with pre-plot commands @param options An optional string with plotting options @param post An optional string with post-plot commands @param tab The table to plot @param xlab The label of the column used in x @param ylab The label of the column used in y @return CPL_ERROR_NONE or the relevant CPL_ERROR_# on error @see also @c cpl_mplot_open(). If xlab is NULL, the sequence number is used for X. Possible _cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO - CPL_ERROR_NULL_INPUT - CPL_ERROR_ILLEGAL_INPUT - CPL_ERROR_DATA_NOT_FOUND - CPL_ERROR_INVALID_TYPE - CPL_ERROR_UNSUPPORTED_MODE if plotting is unsupported on the specific run-time system. */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_plot_column( const char * pre, const char * options, const char * post, const cpl_table * tab, const char * xlab, const char * ylab) { cpl_errorstate prestate = cpl_errorstate_get(); cpl_size n; cpl_table * tempx; cpl_table * tempy; cpl_bivector * bivect; cpl_vector * xvec; cpl_vector * yvec; cpl_type type_x; cpl_type type_y; cpl_size invalid_x; cpl_size invalid_y; /* Check input */ cpl_ensure_code(tab, CPL_ERROR_NULL_INPUT); cpl_ensure_code(ylab, CPL_ERROR_NULL_INPUT); n = cpl_table_get_nrow(tab); cpl_ensure_code(n>0, CPL_ERROR_ILLEGAL_INPUT); if (xlab) cpl_ensure_code(cpl_table_has_column(tab, xlab), CPL_ERROR_DATA_NOT_FOUND); cpl_ensure_code(cpl_table_has_column(tab, ylab), CPL_ERROR_DATA_NOT_FOUND); if (xlab != NULL) { invalid_x = cpl_table_count_invalid(tab, xlab); type_x = cpl_table_get_column_type(tab, xlab); } else { invalid_x = 0; type_x = CPL_TYPE_DOUBLE; } invalid_y = cpl_table_count_invalid(tab, ylab); type_y = cpl_table_get_column_type(tab, ylab); cpl_ensure_code(type_x == CPL_TYPE_INT || type_x == CPL_TYPE_FLOAT || type_x == CPL_TYPE_DOUBLE, CPL_ERROR_INVALID_TYPE); cpl_ensure_code(type_y == CPL_TYPE_INT || type_y == CPL_TYPE_FLOAT || type_y == CPL_TYPE_DOUBLE, CPL_ERROR_INVALID_TYPE); cpl_ensure_code(invalid_x < n && invalid_y < n, CPL_ERROR_DATA_NOT_FOUND); /* Cast columns to CPL_TYPE_DOUBLE and remove invalid entries */ if (type_y != CPL_TYPE_DOUBLE || invalid_y > 0) { tempy = cpl_table_new(n); cpl_table_duplicate_column(tempy, "Y", tab, ylab); cpl_table_cast_column(tempy, "Y", "Ydouble", CPL_TYPE_DOUBLE); /* Remove rows with one or more invalid elements. No columns will be removed because each column contains at least one valid element. */ cpl_table_erase_invalid(tempy); yvec = cpl_vector_wrap(cpl_table_get_nrow(tempy), cpl_table_get_data_double(tempy, "Ydouble")); } else { tempy = NULL; CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual); yvec = cpl_vector_wrap(n, (double*)cpl_table_get_data_double_const(tab, ylab)); CPL_DIAG_PRAGMA_POP; } /* Cast columns to CPL_TYPE_DOUBLE and remove invalid entries */ if (type_x != CPL_TYPE_DOUBLE || invalid_x > 0) { tempx = cpl_table_new(n); cpl_table_duplicate_column(tempx, "X", tab, xlab); cpl_table_cast_column(tempx, "X", "Xdouble", CPL_TYPE_DOUBLE); /* Remove rows with one or more invalid elements. No columns will be removed because each column contains at least one valid element. */ cpl_table_erase_invalid(tempx); xvec = cpl_vector_wrap(cpl_table_get_nrow(tempx), cpl_table_get_data_double(tempx, "Xdouble")); } else { tempx = NULL; if (xlab == NULL) { cpl_size i; xvec = cpl_vector_duplicate(yvec); for (i=0; i= 3, CPL_ERROR_DATA_NOT_FOUND); for (i = 1; i < nlabels; i++) { cpl_ensure_code(labels[i] != NULL, CPL_ERROR_NULL_INPUT); } /* Initialise */ n = cpl_table_get_nrow(tab); tempx = cpl_table_new(n); tempy = cpl_table_new(n); /* Get the X axis if passed */ if (labels[0] == NULL) px = NULL; else { cpl_ensure_code(cpl_table_has_column(tab, labels[0]), CPL_ERROR_DATA_NOT_FOUND); type_x = cpl_table_get_column_type(tab, labels[0]); cpl_ensure_code(type_x == CPL_TYPE_INT || type_x == CPL_TYPE_FLOAT || type_x == CPL_TYPE_DOUBLE, CPL_ERROR_INVALID_TYPE); if (type_x != CPL_TYPE_DOUBLE) { cpl_table_duplicate_column(tempx, "X", tab, labels[0]); cpl_table_cast_column(tempx, "X", "Xdouble", CPL_TYPE_DOUBLE); px = cpl_table_get_data_double_const(tempx, "Xdouble"); } else { px = cpl_table_get_data_double_const(tab, labels[0]); } } /* Hold the files names */ names = cpl_malloc((size_t)(nlabels-1) * sizeof(char*)); for (i=1; i < nlabels; i++) names[i-1] = cpl_sprintf("cpl_plot-%" CPL_SIZE_FORMAT, i); /* Open the plot */ plot = cpl_mplot_open(pre); /* Loop on the signals to plot */ for (i=1; i myplot$$.gp' and '/usr/bin/gnuplot -persist 2> /dev/null' Consult your local documentation for the security caveats regarding the above usage of system(). gnuplot is supported as plotting device. This means that if CPL_PLOTTER contains the string gnuplot it is assumed to correctly parse gnuplot syntax from stdin. Examples: perl ./my_gnuplot.pl /usr/bin/gnuplot -persist exec /usr/bin/gnuplot -persist > /dev/null 2>&1 With a properly set CPL_PLOTTER, such a process is created and the options if any are sent to the plotter. When this function returns non-NULL cpl_mplot_close() must be called. Possible _cpl_error_code_ set in this function: - CPL_ERROR_FILE_IO - CPL_ERROR_UNSUPPORTED_MODE */ /*----------------------------------------------------------------------------*/ static cpl_plot * cpl_mplot_open(const char * options) { cpl_plot * plot; const char * exe = cpl_mplot_plotter(); const char * tmp = CPL_PLOT_TMPFILE; FILE * data; cpl_ensure(exe != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_error_ensure(strstr(exe, "gnuplot"), CPL_ERROR_UNSUPPORTED_MODE, return NULL, "%s", exe); data = fopen(tmp, "w"); cpl_error_ensure(data != NULL, CPL_ERROR_FILE_IO, return NULL, "%s", tmp); plot = cpl_malloc(sizeof(cpl_plot)); plot->exe = exe; plot->tmp = tmp; plot->data = data; if (cpl_mplot_puts(plot, options)) { (void)cpl_mplot_close(plot, ""); plot = NULL; (void)cpl_error_set_where_(); } return plot; } /*----------------------------------------------------------------------------*/ /** @brief Open an imaging device @param options An optional string to be sent to the imager @return A handle to the imager or NULL on error gnuplot is supported as imaging device. This means that if CPL_IMAGER contains the string gnuplot it is assumed to correctly parse gnuplot syntax from stdin. Examples: perl ./my_gnuplot.pl /usr/bin/gnuplot -persist exec /usr/bin/gnuplot -persist > /dev/null 2>&1 imagers that can parse a pgm (P5) image, f.ex. display are also supported. The plot is constructed by generating a file "cpl_plot.txt" which is a gnuplot script or a pgm image. This script is sent to the specified command using the call system("exec exe = exe; plot->tmp = tmp; plot->data = data; if (cpl_mplot_puts(plot, options)) { (void)cpl_mplot_close(plot, ""); plot = NULL; (void)cpl_error_set_where_(); } return plot; } /*----------------------------------------------------------------------------*/ /** @brief Close the plotting device and deallocate its resources @param plot Pointer to the plotting device @param options An optional string to be sent to the plotter @return CPL_ERROR_NONE or the relevant CPL_ERROR_# on error Possible _cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT - CPL_ERROR_FILE_IO */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_mplot_close(cpl_plot * plot, const char * options) { cpl_error_code error; cpl_ensure_code(plot != NULL, CPL_ERROR_NULL_INPUT); error = cpl_mplot_puts(plot, options); cpl_error_set_where_(); assert(plot->data != NULL); assert(plot->tmp != NULL); assert(plot->exe != NULL); if (fclose(plot->data) != 0) error = cpl_error_set_(CPL_ERROR_FILE_IO); if (!error) { /* Note: The portability of this plotting module is limited by the portability of the following command (which is likely to be valid on any kind of UNIX platform). We use 'exec' to reduce the number of child processes created. */ char * command = cpl_sprintf("exec <%s %s", plot->tmp, plot->exe); const int nstat = system(command); if (nstat != 0) error = cpl_error_set_message_(CPL_ERROR_FILE_IO, "system('%s') returned " "%d", command ? command : "", nstat); cpl_free(command); } (void) remove(plot->tmp); cpl_free(plot); return error ? error : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Send a text string to the plotting device @param plot Pointer to the plotting device @param cmd A string to be sent to the plotter @return CPL_ERROR_NONE or the relevant CPL_ERROR_# on error Possible _cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT - CPL_ERROR_FILE_IO */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_mplot_puts(cpl_plot * plot, const char * cmd) { if (cmd == NULL || strlen(cmd) == 0) return CPL_ERROR_NONE; cpl_ensure_code(plot != NULL, CPL_ERROR_NULL_INPUT); assert(plot->data != NULL); cpl_ensure_code(fputs(cmd, plot->data) >= 0, CPL_ERROR_FILE_IO); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @brief Send n octets of data to the plotting device @param plot Pointer to the plotting device @param buffer Pointer to the data to be sent to the plotter @param length Number of octets to send @return CPL_ERROR_NONE or the relevant CPL_ERROR_# on error Possible _cpl_error_code_ set in this function: - CPL_ERROR_NULL_INPUT - CPL_ERROR_FILE_IO - CPL_ERROR_ILLEGAL_INPUT */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_mplot_write(cpl_plot * plot, const char * buffer, size_t length) { cpl_ensure_code(plot != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(buffer != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(length > 0, CPL_ERROR_ILLEGAL_INPUT); assert(plot->data != NULL); cpl_ensure_code(fwrite(buffer, 1, length, plot->data) == length, CPL_ERROR_FILE_IO); return CPL_ERROR_NONE; } cpl-6.4.1/cplcore/cpl_matrix.c0000644000460300003120000044134412243405135013160 00000000000000/* $Id: cpl_matrix.c,v 1.133 2013-09-05 11:23:11 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-09-05 11:23:11 $ * $Revision: 1.133 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_matrix_impl.h" #include "cpl_memory.h" #include "cpl_error_impl.h" #include #include /** * @defgroup cpl_matrix Matrices * * This module provides functions to create, destroy and use a @em cpl_matrix. * The elements of a @em cpl_matrix with M rows and N columns are counted * from 0,0 to M-1,N-1. The matrix element 0,0 is the one at the upper left * corner of a matrix. The CPL matrix functions work properly only in the * case the matrices elements do not contain garbage (such as @c NaN or * infinity). * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ #ifndef inline #define inline /* inline */ #endif #define dtiny(x, t) ((x) < 0.0 ? (x) >= -(t) : (x) <= (t)) /* * The cpl_matrix type: */ struct _cpl_matrix_ { cpl_size nc; cpl_size nr; double *m; }; /*----------------------------------------------------------------------------- Private function prototypes -----------------------------------------------------------------------------*/ inline static void swap_rows(cpl_matrix *, cpl_size, cpl_size) CPL_ATTR_NONNULL; static void read_row(const cpl_matrix *, double *, cpl_size) CPL_ATTR_NONNULL; static void write_row(cpl_matrix *, const double *, cpl_size) CPL_ATTR_NONNULL; static void write_read_row(cpl_matrix *, double *, cpl_size) CPL_ATTR_NONNULL; static void read_column(const cpl_matrix *, double *, cpl_size) CPL_ATTR_NONNULL; static void write_column(cpl_matrix *, const double *, cpl_size) CPL_ATTR_NONNULL; static void write_read_column(cpl_matrix *, double *, cpl_size) CPL_ATTR_NONNULL; static cpl_error_code cpl_matrix_set_size_(cpl_matrix *, cpl_size, cpl_size); /*----------------------------------------------------------------------------- Function codes -----------------------------------------------------------------------------*/ /* * Private methods: */ /*----------------------------------------------------------------------------*/ /** @internal @brief Set the size of a matrix while destroying its elements @param self The matrix to modify @param nr New number of matrix rows. @param nc New number of matrix columns. @note Any pointer returned by cpl_matrix_get_data_const() may be invalidated */ /*----------------------------------------------------------------------------*/ static cpl_error_code cpl_matrix_set_size_(cpl_matrix * self, cpl_size nr, cpl_size nc) { cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); if (self->nr != nr || self->nc != nc) { cpl_ensure_code(nr > 0, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(nc > 0, CPL_ERROR_ILLEGAL_INPUT); /* Need to resize the matrix */ if (self->nr * self->nc != nr * nc) { cpl_free(self->m); self->m = (double*)cpl_malloc((size_t)nr * (size_t)nc * sizeof(double)); } self->nr = nr; self->nc = nc; } return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Swap two (different) rows @param self The matrix @param row1 One row @param row2 Another row @see cpl_matrix_swap_rows() @note No error checking done here Optimized due to repeated usage in cpl_matrix_decomp_lu(): 1) Removed redundant error checking - this allows the compiler to make 'swap' a register variable. 2) Use a single index for loop control and adressing the two rows - this redues the instruction count. This can have an effect when the swap is not memory bound. */ /*----------------------------------------------------------------------------*/ inline static void swap_rows(cpl_matrix * self, cpl_size row1, cpl_size row2) { double swap; cpl_size ncol = self->nc; double * pos1 = self->m + ncol * row1; double * pos2 = self->m + ncol * row2; while (ncol--) { swap = pos1[ncol]; pos1[ncol] = pos2[ncol]; pos2[ncol] = swap; } } /* * @internal * @brief * Just read a matrix row into the passed buffer. * * @param matrix Matrix where to read the row from. * @param pos Row number. * @param row Allocated buffer. * * @return Nothing. * * This private function reads the content of a matrix row into an allocated * buffer. No checks are performed. */ static void read_row(const cpl_matrix *matrix, double *row, cpl_size pos) { cpl_size i; for (i = 0, pos *= matrix->nc; i < matrix->nc; i++, pos++) row[i] = matrix->m[pos]; } /* * @internal * @brief * Just write into a matrix row the values in buffer. * * @param matrix Matrix where to write the buffer to. * @param pos Row number. * @param row Allocated buffer. * * @return Nothing. * * This private function writes the content of a buffer into a matrix row. * No checks are performed. */ static void write_row(cpl_matrix *matrix, const double *row, cpl_size pos) { cpl_size i; for (i = 0, pos *= matrix->nc; i < matrix->nc; i++, pos++) matrix->m[pos] = *row++; } /* * @internal * @brief * Just swap values in buffer with values in a matrix row. * * @param matrix Matrix to access. * @param pos Row to access. * @param row Allocated buffer. * * @return Nothing. * * This private function exchanges the values in buffer with the values in * a chosen matrix row. No checks are performed. */ static void write_read_row(cpl_matrix *matrix, double *row, cpl_size pos) { cpl_size i; double swap; for (i = 0, pos *= matrix->nc; i < matrix->nc; i++, pos++) { swap = matrix->m[pos]; matrix->m[pos] = row[i]; row[i] = swap; } } /* * @internal * @brief * Just read a matrix column into the passed buffer. * * @param matrix Matrix where to read the column from. * @param pos Column number. * @param column Allocated buffer. * * @return Nothing. * * This private function reads the content of a matrix column into an * allocated buffer. No checks are performed. */ static void read_column(const cpl_matrix *matrix, double *column, cpl_size pos) { cpl_size i; for (i = 0; i < matrix->nr; i++, pos += matrix->nc) column[i] = matrix->m[pos]; } /* * @internal * @brief * Just write into a matrix column the values in buffer. * * @param matrix Matrix where to write the buffer to. * @param pos Column number. * @param column Allocated buffer. * * @return Nothing. * * This private function writes the content of a buffer into a matrix column. * No checks are performed. */ static void write_column(cpl_matrix *matrix, const double *column, cpl_size pos) { cpl_size i; cpl_size size = matrix->nr * matrix->nc; for (i = pos; i < size; i += matrix->nc) matrix->m[i] = *column++; } /* * @internal * @brief * Just swap values in buffer with values in a matrix column. * * @param matrix Matrix to access. * @param pos Column to access. * @param column Allocated buffer. * * @return Nothing. * * This private function exchanges the values in buffer with the values in * a chosen matrix column. No checks are performed. */ static void write_read_column(cpl_matrix *matrix, double *column, cpl_size pos) { cpl_size i; double swap; for (i = 0; i < matrix->nr; i++, pos += matrix->nc) { swap = matrix->m[pos]; matrix->m[pos] = column[i]; column[i] = swap; } } /* * Public methods: */ /** * @brief * Print a matrix. * * @param matrix The matrix to print * @param stream The output stream * * @return Nothing. * * This function is intended just for debugging. It just prints the * elements of a matrix, ordered in rows and columns, to the specified * stream or FILE pointer. If the specified stream is NULL, it is set * to @em stdout. The function used for printing is the standard C * @c fprintf(). */ void cpl_matrix_dump(const cpl_matrix *matrix, FILE *stream) { cpl_size i, j, k; if (stream == NULL) stream = stdout; fprintf(stream, " "); if (matrix == NULL) { fprintf(stream, "NULL matrix\n\n"); return; } fprintf(stream, " "); for (j = 0; j < matrix->nc; j++) fprintf(stream, " %6" CPL_SIZE_FORMAT, j); fprintf(stream, "\n"); for (k = 0, i = 0; i < matrix->nr; i++) { fprintf(stream, " %" CPL_SIZE_FORMAT " ", i); for (j = 0; j < matrix->nc; j++, k++) fprintf(stream, " %6g", matrix->m[k]); fprintf(stream, "\n"); } fprintf(stream, "\n"); } /** * @brief * Create a zero matrix of given size. * * @param rows Number of matrix rows. * @param columns Number of matrix columns. * * @return Pointer to new matrix, or @c NULL in case of error. * * @error * * * * * *
CPL_ERROR_ILLEGAL_INPUT * rows or columns are not positive numbers. *
* @enderror * * This function allocates and initialises to zero a matrix of given size. * To destroy this matrix the function @c cpl_matrix_delete() should be used. */ cpl_matrix *cpl_matrix_new(cpl_size rows, cpl_size columns) { cpl_matrix *matrix; if (rows < 1) { (void)cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return NULL; } if (columns < 1) { (void)cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return NULL; } matrix = (cpl_matrix *)cpl_malloc(sizeof(cpl_matrix)); matrix->m = (double *)cpl_calloc((size_t)rows * (size_t)columns, sizeof(double)); matrix->nr = rows; matrix->nc = columns; return matrix; } /** * @brief * Create a new matrix from existing data. * * @param data Existing data buffer. * @param rows Number of matrix rows. * @param columns Number of matrix columns. * * @return Pointer to new matrix, or @c NULL in case of error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input data is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * rows or columns are not positive numbers. *
* @enderror * * This function creates a new matrix that will encapsulate the given * data. At any error condition, a @c NULL pointer would be returned. * Note that the size of the input data array is not checked in any way, * and it is expected to match the specified matrix sizes. The input * array is supposed to contain in sequence all the new @em cpl_matrix * rows. For instance, in the case of a 3x4 matrix, the input array * should contain 12 elements * @code * 0 1 2 3 4 5 6 7 8 9 10 11 * @endcode * that would correspond to the matrix elements * @code * 0 1 2 3 * 4 5 6 7 * 8 9 10 11 * @endcode * The data buffer is not copied, so it should not be deallocated while * the matrix is still in use: the function @c cpl_matrix_delete() would * take care of deallocating it. To avoid problems with the memory managment, * the specified data buffer should be allocated using the functions of * the @c cpl_memory module, and also statically allocated data should be * strictly avoided. If this were not the case, this matrix should not be * destroyed using @c cpl_matrix_delete(), but @c cpl_matrix_unwrap() * should be used instead; moreover, functions implying memory handling * (as @c cpl_matrix_set_size(), or @c cpl_matrix_delete_row() ) should not * be used. */ cpl_matrix *cpl_matrix_wrap(cpl_size rows, cpl_size columns, double *data) { cpl_matrix *matrix; if (rows < 1 || columns < 1) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return NULL; } if (data == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } matrix = (cpl_matrix *)cpl_malloc(sizeof(cpl_matrix)); matrix->m = data; matrix->nr = rows; matrix->nc = columns; return matrix; } /** * @brief * Delete a matrix. * * @param matrix Pointer to a matrix to be deleted. * * @return Nothing. * * This function frees all the memory associated to a matrix. * If @em matrix is @c NULL, nothing is done. */ void cpl_matrix_delete(cpl_matrix *matrix) { if (matrix) { cpl_free(matrix->m); cpl_free(matrix); } } /** * @brief * Delete a matrix, but not its data buffer. * * @param matrix Pointer to a matrix to be deleted. * * @return Pointer to the internal data buffer. * * This function deallocates all the memory associated to a matrix, * with the exception of its data buffer. This type of destructor * should be used on matrices created with the @c cpl_matrix_wrap() * constructor, if the data buffer specified then was not allocated * using the functions of the @c cpl_memory module. In such a case, the * data buffer should be deallocated separately. See the documentation * of the function @c cpl_matrix_wrap(). If @em matrix is @c NULL, * nothing is done, and a @c NULL pointer is returned. */ void *cpl_matrix_unwrap(cpl_matrix *matrix) { void *data = NULL; if (matrix) { data = matrix->m; cpl_free(matrix); } return data; } /** * @brief * Get the number of rows of a matrix. * * @param matrix Pointer to the matrix to examine. * * @return Number of matrix rows, or zero in case of failure. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * Determine the number of rows in a matrix. */ inline cpl_size cpl_matrix_get_nrow(const cpl_matrix *matrix) { if (matrix == NULL) { /* inline precludes using cpl_error_set_() due to its use of __func__ */ (void) cpl_error_set("cpl_matrix_get_nrow", CPL_ERROR_NULL_INPUT); return 0; } return matrix->nr; } /** * @brief * Get the number of columns of a matrix. * * @param matrix Pointer to the matrix to examine. * * @return Number of matrix columns, or zero in case of failure. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * Determine the number of columns in a matrix. */ inline cpl_size cpl_matrix_get_ncol(const cpl_matrix *matrix) { if (matrix == NULL) { /* inline precludes using cpl_error_set_() due to its use of __func__ */ (void) cpl_error_set("cpl_matrix_get_ncol", CPL_ERROR_NULL_INPUT); return 0; } return matrix->nc; } /** * @brief * Get the pointer to a matrix data buffer, or @c NULL in case of error. * * @param matrix Input matrix. * * @return Pointer to the matrix data buffer. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * A @em cpl_matrix object includes an array of values of type @em double. * This function returns a pointer to this internal array, whose first * element corresponds to the @em cpl_matrix element 0,0. The internal * array contains in sequence all the @em cpl_matrix rows. For instance, * in the case of a 3x4 matrix, the array elements * @code * 0 1 2 3 4 5 6 7 8 9 10 11 * @endcode * would correspond to the following matrix elements: * @code * 0 1 2 3 * 4 5 6 7 * 8 9 10 11 * @endcode * * @note * Use at your own risk: direct manipulation of matrix data rules out * any check performed by the matrix object interface, and may introduce * inconsistencies between the information maintained internally, and * the actual matrix data and structure. */ inline double *cpl_matrix_get_data(cpl_matrix *matrix) { if (matrix == NULL) { /* inline precludes using cpl_error_set_() due to its use of __func__ */ (void) cpl_error_set("cpl_matrix_get_data", CPL_ERROR_NULL_INPUT); return NULL; } return matrix->m; } /** * @brief * Get the pointer to a matrix data buffer, or @c NULL in case of error. * * @param matrix Input matrix. * * @return Pointer to the matrix data buffer. * * @see cpl_matrix_get_data */ inline const double *cpl_matrix_get_data_const(const cpl_matrix *matrix) { if (matrix == NULL) { /* inline precludes using cpl_error_set_() due to its use of __func__ */ (void) cpl_error_set("cpl_matrix_get_data_const", CPL_ERROR_NULL_INPUT); return NULL; } return matrix->m; } /** * @brief * Get the value of a matrix element. * * @param matrix Pointer to a matrix. * @param row Matrix element row. * @param column Matrix element column. * * @return Value of the specified matrix element, or 0.0 in case of error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The accessed element is beyond the matrix boundaries. *
* @enderror * * Get the value of a matrix element. The matrix rows and columns are * counted from 0,0. */ double cpl_matrix_get(const cpl_matrix *matrix, cpl_size row, cpl_size column) { if (matrix == NULL) { (void)cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0.0; } if (row < 0 || row >= matrix->nr || column < 0 || column >= matrix->nc) { (void)cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); return 0.0; } return matrix->m[column + row * matrix->nc]; } /** * @brief * Write a value to a matrix element. * * @param matrix Input matrix. * @param row Matrix element row. * @param column Matrix element column. * @param value Value to write. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The accessed element is beyond the matrix boundaries. *
* @enderror * * Write a value to a matrix element. The matrix rows and columns are * counted from 0,0. */ inline cpl_error_code cpl_matrix_set(cpl_matrix *matrix, cpl_size row, cpl_size column, double value) { if (matrix == NULL) return cpl_error_set("cpl_matrix_set", CPL_ERROR_NULL_INPUT); if (row < 0 || row >= matrix->nr || column < 0 || column >= matrix->nc) return cpl_error_set("cpl_matrix_set", CPL_ERROR_ACCESS_OUT_OF_RANGE); matrix->m[column + row * matrix->nc] = value; return CPL_ERROR_NONE; } /** * @brief * Make a copy of a matrix. * * @param matrix Matrix to be duplicated. * * @return Pointer to the new matrix, or @c NULL in case of error. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * A copy of the input matrix is created. To destroy the duplicated matrix * the function @c cpl_matrix_delete() should be used. */ cpl_matrix *cpl_matrix_duplicate(const cpl_matrix *matrix) { cpl_matrix *new_matrix = NULL; if (matrix) { const cpl_size size = matrix->nr * matrix->nc; new_matrix = (cpl_matrix *)cpl_malloc(sizeof(cpl_matrix)); new_matrix->nr = matrix->nr; new_matrix->nc = matrix->nc; new_matrix->m = (double *)cpl_malloc((size_t)size * sizeof(double)); memcpy(new_matrix->m, matrix->m, (size_t)size * sizeof(double)); } else (void)cpl_error_set_(CPL_ERROR_NULL_INPUT); return new_matrix; } /** * @brief * Extract a submatrix from a matrix. * * @param matrix Pointer to the input matrix. * @param start_row Matrix row where to begin extraction. * @param start_column Matrix column where to begin extraction. * @param step_row Step between extracted rows. * @param step_column Step between extracted columns. * @param nrows Number of rows to extract. * @param ncolumns Number of columns to extract. * * @return Pointer to the new matrix, or @c NULL in case of error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The start position is outside the matrix boundaries. *
CPL_ERROR_ILLEGAL_INPUT * While nrows and ncolumns are greater than 1, * the specified steps are not positive. *
* @enderror * * The new matrix will include the @em nrows x @em ncolumns values read * from the input matrix elements starting from position (@em start_row, * @em start_column), in a grid of steps @em step_row and @em step_column. * If the extraction parameters exceed the input matrix boundaries, just * the overlap is returned, and this matrix would have sizes smaller than * @em nrows x @em ncolumns. To destroy the new matrix the function * @c cpl_matrix_delete() should be used. */ cpl_matrix *cpl_matrix_extract(const cpl_matrix *matrix, cpl_size start_row, cpl_size start_column, cpl_size step_row, cpl_size step_column, cpl_size nrows, cpl_size ncolumns) { cpl_matrix *new_matrix = NULL; cpl_size i, r, c; cpl_size size; cpl_size row, col; if (matrix == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if (start_row < 0 || start_row >= matrix->nr || start_column < 0 || start_column >= matrix->nc || nrows < 1 || ncolumns < 1) { cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); return NULL; } if (nrows == 1) /* Step irrelevant... */ step_row = 1; if (ncolumns == 1) /* Step irrelevant... */ step_column = 1; if (step_row < 1 || step_column < 1) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return NULL; } if ((start_row + (nrows - 1) * step_row) >= matrix->nr) nrows = (matrix->nr - start_row - 1) / step_row + 1; if ((start_column + (ncolumns - 1) * step_column) >= matrix->nc) ncolumns = (matrix->nc - start_column - 1) / step_column + 1; size = nrows * ncolumns; new_matrix = (cpl_matrix *)cpl_malloc(sizeof(cpl_matrix)); new_matrix->m = (double *)cpl_malloc((size_t)size * sizeof(double)); new_matrix->nr = nrows; new_matrix->nc = ncolumns; for (i = 0, r = start_row, row = nrows; row--; r += step_row) for (c = r * matrix->nc + start_column, col = ncolumns; col--; c += step_column, i++) new_matrix->m[i] = matrix->m[c]; return new_matrix; } /** * @brief * Extract a matrix row. * * @param matrix Pointer to the matrix containing the row. * @param row Sequence number of row to copy. * * @return Pointer to new matrix, or @c NULL in case of error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The row is outside the matrix boundaries. *
* @enderror * * If a MxN matrix is given in input, the extracted row is a new 1xN matrix. * The row number is counted from 0. To destroy the new matrix the function * @c cpl_matrix_delete() should be used. */ cpl_matrix *cpl_matrix_extract_row(const cpl_matrix *matrix, cpl_size row) { cpl_matrix *vector; if (matrix == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } vector = cpl_matrix_extract(matrix, row, 0, 1, 1, 1, matrix->nc); if (vector == NULL) cpl_error_set_where("cpl_matrix_extract_row"); return vector; } /** * @brief * Copy a matrix column. * * @param matrix Pointer to matrix containing the column. * @param column Sequence number of column to copy. * * @return Pointer to new matrix, or @c NULL in case of error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The column is outside the matrix boundaries. *
* @enderror * * If a MxN matrix is given in input, the extracted row is a new Mx1 matrix. * The column number is counted from 0. To destroy the new matrix the * function @c cpl_matrix_delete() should be used. */ cpl_matrix *cpl_matrix_extract_column(const cpl_matrix *matrix, cpl_size column) { cpl_matrix *vector; if (matrix == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } vector = cpl_matrix_extract(matrix, 0, column, 1, 1, matrix->nr, 1); if (vector == NULL) cpl_error_set_where("cpl_matrix_extract_column"); return vector; } /** * @brief * Extract a matrix diagonal. * * @param matrix Pointer to the matrix containing the diagonal. * @param diagonal Sequence number of the diagonal to copy. * * @return Pointer to the new matrix, or @c NULL in case of error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The diagonal is outside the matrix boundaries * (see description below). *
* @enderror * * If a MxN matrix is given in input, the extracted diagonal is a Mx1 * matrix if N >= M, or a 1xN matrix if N < M. The diagonal number is * counted from 0, corresponding to the matrix diagonal starting at * element (0,0). A square matrix has just one diagonal; if M != N, * the number of diagonals in the matrix is |M - N| + 1. To specify * a @em diagonal sequence number outside this range would set an * error condition, and a @c NULL pointer would be returned. To destroy * the new matrix the function @c cpl_matrix_delete() should be used. */ cpl_matrix *cpl_matrix_extract_diagonal(const cpl_matrix *matrix, cpl_size diagonal) { cpl_matrix *output; cpl_size diagonal_count; cpl_size diagonal_length; cpl_size i, r, c; double *m; double *om; if (matrix == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } diagonal_count = labs(matrix->nr - matrix->nc) + 1; if (diagonal < 0 || diagonal >= diagonal_count) { cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); return NULL; } diagonal_length = matrix->nr < matrix->nc ? matrix->nr : matrix->nc; output = (cpl_matrix *)cpl_malloc(sizeof(cpl_matrix)); om = output->m = (double *)cpl_malloc((size_t)diagonal_length * sizeof(*om)); if (matrix->nc < matrix->nr) { r = diagonal; c = 0; output->nr = 1; output->nc = diagonal_length; } else { r = 0; c = diagonal; output->nr = diagonal_length; output->nc = 1; } m = matrix->m + c + r * matrix->nc; for (i = 0; i < diagonal_length; i++, m += matrix->nc + 1) *om++ = *m; return output; } /** * @brief * Write the same value to all matrix elements. * * @param matrix Pointer to the matrix to access * @param value Value to write * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * Write the same value to all matrix elements. */ cpl_error_code cpl_matrix_fill(cpl_matrix *matrix, double value) { cpl_size size; double *m; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); size = matrix->nr * matrix->nc; m = matrix->m; while (size--) *m++ = value; return CPL_ERROR_NONE; } /** * @brief * Write the same value to a matrix row. * * @param matrix Matrix to access * @param value Value to write * @param row Sequence number of row to overwrite. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The specified row is outside the matrix boundaries. *
* @enderror * * Write the same value to a matrix row. Rows are counted starting from 0. */ cpl_error_code cpl_matrix_fill_row(cpl_matrix *matrix, double value, cpl_size row) { double *m; cpl_size count; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (row < 0 || row >= matrix->nr) return cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); m = matrix->m + row * matrix->nc; count = matrix->nc; while (count--) *m++ = value; return CPL_ERROR_NONE; } /** * @brief * Write the same value to a matrix column. * * @param matrix Pointer to the matrix to access * @param value Value to write * @param column Sequence number of column to overwrite * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The specified column is outside the matrix boundaries. *
* @enderror * * Write the same value to a matrix column. Columns are counted starting * from 0. */ cpl_error_code cpl_matrix_fill_column(cpl_matrix *matrix, double value, cpl_size column) { cpl_size count; double *m; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (column < 0 || column >= matrix->nc) return cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); count = matrix->nr; m = matrix->m + column; while (count--) { *m = value; m += matrix->nc; } return CPL_ERROR_NONE; } /** * @brief * Write a given value to all elements of a given matrix diagonal. * * @param matrix Matrix to modify * @param value Value to write to diagonal * @param diagonal Number of diagonal to overwrite, 0 for main, positive for * above main, negative for below main * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The specified diagonal is outside the matrix * boundaries (see description below). *
* @enderror * * */ cpl_error_code cpl_matrix_fill_diagonal(cpl_matrix *matrix, double value, cpl_size diagonal) { cpl_size ij, nm; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (diagonal > matrix->nc) return cpl_error_set_message_(CPL_ERROR_ACCESS_OUT_OF_RANGE, "d=%" CPL_SIZE_FORMAT " > c=%" CPL_SIZE_FORMAT, diagonal, matrix->nc); if (-diagonal > matrix->nr) return cpl_error_set_message_(CPL_ERROR_ACCESS_OUT_OF_RANGE, "-d=%" CPL_SIZE_FORMAT " > c=%" CPL_SIZE_FORMAT, -diagonal, matrix->nc); nm = diagonal >= 0 ? (matrix->nr - diagonal) * matrix->nc : matrix->nr * matrix->nc; for (ij = diagonal >= 0 ? diagonal : -diagonal * matrix->nc; ij < nm; ij += matrix->nc + 1) { matrix->m[ij] = value; } return CPL_ERROR_NONE; } /** * @brief * Write the values of a matrix into another matrix. * * @param matrix Pointer to matrix to be modified. * @param submatrix Pointer to matrix to get the values from. * @param row Position of row 0 of @em submatrix in @em matrix. * @param col Position of column 0 of @em submatrix in @em matrix. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix or submatrix are NULL * pointers. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * No overlap exists between the two matrices. *
* @enderror * * The values of @em submatrix are written to @em matrix starting at the * indicated row and column. There are no restrictions on the sizes of * @em submatrix: just the parts of @em submatrix overlapping @em matrix * are copied. There are no restrictions on @em row and @em col either, * that can also be negative. If the two matrices do not overlap, nothing * is done, but an error condition is set. */ cpl_error_code cpl_matrix_copy(cpl_matrix *matrix, const cpl_matrix *submatrix, cpl_size row, cpl_size col) { cpl_size endrow; cpl_size endcol; cpl_size subrow; cpl_size subcol; cpl_size r, c, sr, sc; double *m; double *sm; if (matrix == NULL || submatrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); endrow = row + submatrix->nr; endcol = col + submatrix->nc; /* * Check whether matrices overlap. */ if (row >= matrix->nr || endrow < 1 || col >= matrix->nc || endcol < 1) return cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); /* * Define the overlap region on both matrices reference system: */ if (row < 0) { subrow = -row; row = 0; } else subrow = 0; if (col < 0) { subcol = -col; col = 0; } else subcol = 0; if (endrow > matrix->nr) endrow = matrix->nr; if (endcol > matrix->nc) endcol = matrix->nc; for (r = row, sr = subrow; r < endrow; r++, sr++) { m = matrix->m + r * matrix->nc + col; sm = submatrix->m + sr * submatrix->nc + subcol; for (c = col, sc = subcol; c < endcol; c++, sc++) *m++ = *sm++; } return CPL_ERROR_NONE; } /** * @brief * Write the same value into a submatrix of a matrix. * * @param matrix Pointer to matrix to be modified. * @param value Value to write. * @param row Start row of matrix submatrix. * @param col Start column of matrix submatrix. * @param nrow Number of rows of matrix submatrix. * @param ncol Number of columns of matrix submatrix. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The specified start position is outside the matrix * boundaries. *
CPL_ERROR_ILLEGAL_INPUT * nrow or ncol are not positive. *
* @enderror * * The specified value is written to @em matrix starting at the indicated * row and column; @em nrow and @em ncol can exceed the input matrix * boundaries, just the range overlapping the @em matrix is used in that * case. */ cpl_error_code cpl_matrix_fill_window(cpl_matrix *matrix, double value, cpl_size row, cpl_size col, cpl_size nrow, cpl_size ncol) { cpl_size endrow; cpl_size endcol; cpl_size r, c; double *m; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (row < 0 || row >= matrix->nr || col < 0 || col >= matrix->nc) return cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); if (nrow < 1 || ncol < 1) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); endrow = row + nrow; if (endrow > matrix->nr) endrow = matrix->nr; endcol = col + ncol; if (endcol > matrix->nc) endcol = matrix->nc; for (r = row; r < endrow; r++) { m = matrix->m + r * matrix->nc + col; for (c = col; c < endcol; c++) *m++ = value; } return CPL_ERROR_NONE; } /** * @brief * Shift matrix elements. * * @param matrix Pointer to matrix to be modified. * @param rshift Shift in the vertical direction. * @param cshift Shift in the horizontal direction. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The performed shift operation is cyclical (toroidal), i.e., matrix * elements shifted out of one side of the matrix get shifted in from * its opposite side. There are no restrictions on the values of the * shift. Positive shifts are always in the direction of increasing * row/column indexes. * */ cpl_error_code cpl_matrix_shift(cpl_matrix *matrix, cpl_size rshift, cpl_size cshift) { if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); /* Should not be able to fail now */ rshift = rshift % matrix->nr; cshift = cshift % matrix->nc; /* The naive approach is to duplicate the entire buffer, and then write each element into its proper place. This would require n * m extra storage and 2 * n * m read+write operations. Instead: 1) Copy up to half the elements into a temporary buffer. 2) Move - via memmove() - the remaining buffer into place 3) For a non-zero column shift, shift the smaller part of each row by one row 4) Write the copied buffer into place In the worst case, 3/4 of the elements are still read/written twice with 1/4 read/written once, while in the best (non-trivial) case all but one row or column is read/written once. Both rshift and cshift can be positive, zero or negative, for a total of 8 non-trivial cases. */ /* Maximize size of memmove() */ if (2 * rshift > matrix->nr) rshift -= matrix->nr; else if (2 * rshift < -matrix->nr) rshift += matrix->nr; if (2 * cshift > matrix->nc) cshift -= matrix->nc; else if (2 * cshift < -matrix->nc) cshift += matrix->nc; if ((rshift > 0 && cshift == 0) || (rshift == 0 && cshift > 0)) { const cpl_size szcp = cshift + rshift * matrix->nc; void * copy = cpl_malloc((size_t)szcp * sizeof(double)); double * drow = matrix->m; memcpy(copy, matrix->m + (size_t)(matrix->nr * matrix->nc - szcp), (size_t)szcp * sizeof(double)); memmove(matrix->m + (size_t)szcp, matrix->m, (size_t)(matrix->nr * matrix->nc - szcp) * sizeof(double)); if (cshift > 0) { cpl_size i; for (i = 0; i < matrix->nr - 1; i++, drow += matrix->nc) { memcpy(drow, drow + (size_t)matrix->nc, (size_t)szcp * sizeof(double)); } } memcpy(drow, copy, (size_t)szcp * sizeof(double)); cpl_free(copy); } else if ((rshift < 0 && cshift == 0) || (rshift == 0 && cshift < 0)) { const cpl_size szcp = -cshift - rshift * matrix->nc; void * copy = cpl_malloc((size_t)szcp * sizeof(double)); double * drow = matrix->m + (size_t)(matrix->nr * matrix->nc - szcp); memcpy(copy, matrix->m, (size_t)szcp * sizeof(double)); memmove(matrix->m, matrix->m + (size_t)szcp, (size_t)(matrix->nr * matrix->nc - szcp) * sizeof(double)); if (cshift < 0) { cpl_size i; for (i = matrix->nr - 1; i > 0; i--, drow -= matrix->nc) { memcpy(drow, drow - (size_t)matrix->nc, (size_t)szcp * sizeof(double)); } } memcpy(drow, copy, (size_t)szcp * sizeof(double)); cpl_free(copy); } else if (rshift > 0 && cshift > 0) { const cpl_size szcp = rshift * matrix->nc + cshift; double * copy = cpl_malloc((size_t)szcp * sizeof(double)); double * drow = matrix->m; const double * crow = copy; cpl_size i; memcpy(copy, matrix->m + (size_t)(matrix->nr * matrix->nc - szcp), (size_t)szcp * sizeof(double)); memmove(matrix->m + (size_t)szcp, matrix->m, (size_t)(matrix->nr * matrix->nc - szcp) * sizeof(double)); for (i = 0; i < rshift; i++, drow += matrix->nc, crow += matrix->nc) { memcpy(drow, crow + (size_t)matrix->nc, (size_t)cshift * sizeof(double)); memcpy(drow + (size_t)cshift, crow + (size_t)cshift, (size_t)(matrix->nc - cshift) * sizeof(double)); } for (; i < matrix->nr - 1; i++, drow += matrix->nc) { memcpy(drow, drow + (size_t)matrix->nc, (size_t)cshift * sizeof(double)); } memcpy(drow, copy, (size_t)cshift * sizeof(double)); cpl_free(copy); } else if (rshift < 0 && cshift < 0) { const cpl_size szcp = -rshift * matrix->nc - cshift; double * copy = cpl_malloc((size_t)szcp * sizeof(double)); double * drow = matrix->m + (size_t)(matrix->nr * matrix->nc + cshift); const double * crow = copy + szcp - matrix->nc + cshift; cpl_size i; memcpy(copy, matrix->m, (size_t)szcp * sizeof(double)); memmove(matrix->m, matrix->m + (size_t)szcp, (size_t)(matrix->nr * matrix->nc - szcp) * sizeof(double)); for (i = matrix->nr; i > matrix->nr + rshift; i--, drow -= matrix->nc, crow -= matrix->nc) { memcpy(drow - (size_t)(matrix->nc + cshift), crow - (size_t)cshift, (size_t)(matrix->nc + cshift) * sizeof(double)); memcpy(drow, crow, (size_t)-cshift * sizeof(double)); } for (; i > 1; i--, drow -= matrix->nc) { memcpy(drow, drow - (size_t)matrix->nc, (size_t)-cshift * sizeof(double)); } memcpy(drow, copy + (size_t)(szcp + cshift), (size_t)-cshift * sizeof(double)); cpl_free(copy); } else if (rshift > 0 && cshift < 0) { const cpl_size szcp = rshift * matrix->nc; double * copy = cpl_malloc((size_t)szcp * sizeof(double)); double * drow = matrix->m + (size_t)(matrix->nr * matrix->nc + cshift); const double * crow = copy + szcp - matrix->nc; cpl_size i; memcpy(copy, matrix->m + (size_t)(matrix->nr * matrix->nc - szcp), (size_t)szcp * sizeof(double)); memmove(matrix->m + (size_t)szcp + (size_t)cshift, matrix->m, (size_t)(matrix->nr * matrix->nc - szcp) * sizeof(double)); for (i = matrix->nr; i > rshift; i--, drow -= matrix->nc) { memcpy(drow, drow - (size_t)matrix->nc, (size_t)-cshift * sizeof(double)); } for (; i > 0; i--, drow -= matrix->nc, crow -= matrix->nc) { memcpy(drow, crow, (size_t)-cshift * sizeof(double)); memcpy(drow - (size_t)(matrix->nc + cshift), crow + (size_t)(-cshift), (size_t)(matrix->nc + cshift) * sizeof(double)); } cpl_free(copy); } else if (rshift < 0 && cshift > 0) { const cpl_size szcp = -rshift * matrix->nc; double * copy = cpl_malloc((size_t)szcp * sizeof(double)); double * drow = matrix->m; const double * crow = copy; cpl_size i; memcpy(copy, matrix->m, (size_t)szcp * sizeof(double)); memmove(matrix->m + (size_t)cshift, matrix->m + (size_t)szcp, (size_t)(matrix->nr * matrix->nc - szcp) * sizeof(double)); for (i = 0; i < matrix->nr + rshift; i++, drow += matrix->nc) { memcpy(drow, drow + (size_t)matrix->nc, (size_t)cshift * sizeof(double)); } for (; i < matrix->nr; i++, drow += matrix->nc, crow += matrix->nc) { memcpy(drow, crow + (size_t)(matrix->nc - cshift), (size_t)cshift * sizeof(double)); memcpy(drow + (size_t)cshift, crow, (size_t)(matrix->nc - cshift) * sizeof(double)); } cpl_free(copy); } return CPL_ERROR_NONE; } /** * @brief * Rounding to zero very small numbers in matrix. * * @param matrix Pointer to matrix to be chopped. * @param tolerance Max tolerated rounding to zero. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * After specific manipulations of a matrix some of its elements * may theoretically be expected to be zero (for instance, as a result * of multiplying a matrix by its inverse). However, because of * numerical noise, such elements may turn out not to be exactly * zero. With this function any very small number in the matrix is * turned to exactly zero. If the @em tolerance is zero or negative, * a default threshold of @c DBL_EPSILON is used. */ cpl_error_code cpl_matrix_threshold_small(cpl_matrix *matrix, double tolerance) { cpl_size size; double *m; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); size = matrix->nr * matrix->nc; m = matrix->m; if (tolerance <= 0.0) tolerance = DBL_EPSILON; while (size--) { if (dtiny(*m, tolerance)) *m = 0.0; m++; } return CPL_ERROR_NONE; } /** * @brief * Check for zero matrix. * * @param matrix Pointer to matrix to be checked. * @param tolerance Max tolerated rounding to zero. * * @return 1 in case of zero matrix, 0 otherwise. If a @c NULL pointer * is passed, -1 is returned. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * After specific manipulations of a matrix some of its elements * may theoretically be expected to be zero. However, because of * numerical noise, such elements may turn out not to be exactly * zero. In this specific case, if any of the matrix element is * not exactly zero, the matrix would not be classified as a null * matrix. A threshold may be specified to consider zero any number * that is close enough to zero. If the specified @em tolerance is * negative, a default of @c DBL_EPSILON is used. A zero tolerance * may also be specified. */ int cpl_matrix_is_zero(const cpl_matrix *matrix, double tolerance) { cpl_size size; double *m; if (matrix == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } size = matrix->nr * matrix->nc; m = matrix->m; if (tolerance < 0.0) tolerance = DBL_EPSILON; while (size--) { if (!dtiny(*m, tolerance)) return 0; m++; } return 1; } /** * @brief * Check if a matrix is diagonal. * * @param matrix Pointer to matrix to be checked. * @param tolerance Max tolerated rounding to zero. * * @return 1 in case of diagonal matrix, 0 otherwise. If a @c NULL pointer * is passed, or the input matrix is not square, -1 is returned. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * A threshold may be specified to consider zero any number that * is close enough to zero. If the specified @em tolerance is * negative, a default of @c DBL_EPSILON is used. A zero tolerance * may also be specified. No error is set if the input matrix is * not square. */ int cpl_matrix_is_diagonal(const cpl_matrix *matrix, double tolerance) { cpl_size size; cpl_size dist; if (matrix == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } if (matrix->nr != matrix->nc) return 0; size = matrix->nr * matrix->nr; dist = matrix->nr + 1; if (tolerance < 0.0) tolerance = DBL_EPSILON; while (size--) if (size % dist) if (!dtiny(matrix->m[size], tolerance)) return 0; return 1; } /** * @brief * Check for identity matrix. * * @param matrix Pointer to matrix to be checked. * @param tolerance Max tolerated rounding to zero, or to one. * * @return 1 in case of identity matrix, 0 otherwise. If a @c NULL pointer * is passed, or the input matrix is not square, -1 is returned. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * A threshold may be specified to consider zero any number that is * close enough to zero, and 1 any number that is close enough to 1. * If the specified @em tolerance is negative, a default of @c DBL_EPSILON * is used. A zero tolerance may also be specified. No error is set if the * input matrix is not square. */ int cpl_matrix_is_identity(const cpl_matrix *matrix, double tolerance) { double tiny; cpl_size i; cpl_size skip; if (matrix == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } if (matrix->nr != matrix->nc) return 0; if (!cpl_matrix_is_diagonal(matrix, tolerance)) return 0; if (tolerance < 0.0) tolerance = DBL_EPSILON; skip = matrix->nc + 1; for (i = 0; i < matrix->nr; i += skip) { tiny = matrix->m[i] - 1.0; if (!dtiny(tiny, tolerance)) return 0; } return 1; } /** * @brief * Swap two matrix rows. * * @param matrix Pointer to matrix to be modified. * @param row1 One matrix row. * @param row2 Another matrix row. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * Any of the specified rows is outside the matrix boundaries. *
* @enderror * * The values of two given matrix rows are exchanged. Rows are counted * starting from 0. If the same row number is given twice, nothing is * done and no error is set. */ cpl_error_code cpl_matrix_swap_rows(cpl_matrix *matrix, cpl_size row1, cpl_size row2) { cpl_ensure_code(matrix != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(row1 >= 0, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(row1 < matrix->nr, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(row2 >= 0, CPL_ERROR_ACCESS_OUT_OF_RANGE); cpl_ensure_code(row2 < matrix->nr, CPL_ERROR_ACCESS_OUT_OF_RANGE); if (row1 != row2) swap_rows(matrix, row1, row2); return CPL_ERROR_NONE; } /** * @brief * Swap two matrix columns. * * @param matrix Pointer to matrix to be modified. * @param column1 One matrix column. * @param column2 Another matrix column. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * Any of the specified columns is outside the matrix * boundaries. *
* @enderror * * The values of two given matrix columns are exchanged. Columns are * counted starting from 0. If the same column number is given twice, * nothing is done and no error is set. */ cpl_error_code cpl_matrix_swap_columns(cpl_matrix *matrix, cpl_size column1, cpl_size column2) { double swap; cpl_size nrow; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (column1 < 0 || column1 >= matrix->nc || column2 < 0 || column2 >= matrix->nc) return cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); if (column1 == column2) return CPL_ERROR_NONE; nrow = matrix->nr; while (nrow--) { swap = matrix->m[column1]; matrix->m[column1] = matrix->m[column2]; matrix->m[column2] = swap; column1 += matrix->nc; column2 += matrix->nc; } return CPL_ERROR_NONE; } /** * @brief * Swap a matrix column with a matrix row. * * @param matrix Pointer to matrix to be modified. * @param row Matrix row. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The specified row is outside the matrix boundaries. *
CPL_ERROR_ILLEGAL_INPUT * The input matrix is not square. *
* @enderror * * The values of the indicated row are exchanged with the column having * the same sequence number. Rows and columns are counted starting from 0. */ cpl_error_code cpl_matrix_swap_rowcolumn(cpl_matrix *matrix, cpl_size row) { double swap; cpl_size i; cpl_size posr, posc; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (matrix->nr != matrix->nc) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); if (row < 0 || row >= matrix->nr) return cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); posr = row; posc = row * matrix->nc; for (i = 0; i < matrix->nr; i++) { swap = matrix->m[posr]; matrix->m[posr] = matrix->m[posc]; matrix->m[posc] = swap; posr += matrix->nc; posc++; } return CPL_ERROR_NONE; } /** * @brief * Reverse order of rows in matrix. * * @param matrix Pointer to matrix to be reversed. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The order of the rows in the matrix is reversed in place. */ cpl_error_code cpl_matrix_flip_rows(cpl_matrix *matrix) { cpl_size i, j; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); for (i = 0, j = matrix->nr - 1; i < j; i++, j--) swap_rows(matrix, i, j); return CPL_ERROR_NONE; } /** * @brief * Reverse order of columns in matrix. * * @param matrix Pointer to matrix to be reversed. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The order of the columns in the matrix is reversed in place. */ cpl_error_code cpl_matrix_flip_columns(cpl_matrix *matrix) { cpl_size i, j; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); for (i = 0, j = matrix->nc - 1; i < j; i++, j--) cpl_matrix_swap_columns(matrix, i, j); return CPL_ERROR_NONE; } /** * @brief * Create transposed matrix. * * @param matrix Pointer to matrix to be transposed. * * @return Pointer to transposed matrix. If a @c NULL pointer is passed, * a @c NULL pointer is returned. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The transposed of the input matrix is created. To destroy the new matrix * the function @c cpl_matrix_delete() should be used. */ cpl_matrix *cpl_matrix_transpose_create(const cpl_matrix *matrix) { cpl_matrix *transposed = NULL; cpl_size i, j; double *m; double *tm; if (matrix == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } tm = (double *)cpl_malloc((size_t)matrix->nc * (size_t)matrix->nr * sizeof(*tm)); transposed = cpl_matrix_wrap(matrix->nc, matrix->nr, tm); m = matrix->m; for (i = 0; i < matrix->nr; i++) for (j = 0, tm = transposed->m + i; j < matrix->nc; j++, tm += matrix->nr) *tm = *m++; return transposed; } /** * @brief * Sort matrix by rows. * * @param matrix Pointer to matrix to be sorted. * @param mode Sorting mode: 0, by absolute value, otherwise by value. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The matrix elements of the leftmost column are used as reference for * the row sorting, if there are identical the values of the second * column are considered, etc. Rows with the greater values go on top. * If @em mode is equal to zero, the rows are sorted according to their * absolute values (zeroes at bottom). */ cpl_error_code cpl_matrix_sort_rows(cpl_matrix *matrix, int mode) { double *row; double value1, value2; int *done; cpl_size *sort_pattern; cpl_size *p; cpl_size i, j; cpl_size keep; cpl_size reach; int start; cpl_size count; cpl_size pos; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (matrix->nr == 1) return CPL_ERROR_NONE; /* * Allocate the arrays for computing the sort pattern (i.e., the * list of arrival positions of array values after sorting). */ sort_pattern = cpl_malloc((size_t)matrix->nr * sizeof(*sort_pattern)); p = cpl_malloc((size_t)matrix->nr * sizeof(*p)); for (i = 0; i < matrix->nr; i++) sort_pattern[i] = p[i] = i; /* * Find sorting pattern examining matrix columns. */ j = 0; i = 1; reach = 1; while (i < matrix->nr) { value1 = matrix->m[p[i] * matrix->nc + j]; value2 = matrix->m[p[i-1] * matrix->nc + j]; if (mode == 0) { value1 = fabs(value1); value2 = fabs(value2); } if (value1 < value2) { i++; if (i > reach) reach = i; } else if (value1 > value2) { keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } else { if (matrix->nc == 1) { i++; continue; } j++; if (j == matrix->nc) { j = 0; i++; if (i > reach) reach = i; } continue; } if (j) { j = 0; continue; } } /* * To obtain the sort pattern this is the trick: */ reach = 1; i = 1; while (i < matrix->nr) { if (p[sort_pattern[i]] > p[sort_pattern[i-1]]) { i++; if (i > reach) reach = i; } else { keep = sort_pattern[i-1]; sort_pattern[i-1] = sort_pattern[i]; sort_pattern[i] = keep; if (i > 1) i--; else i = reach + 1; } } cpl_free(p); /* * Finally, sort the rows. Starting from row zero, see where it * should be written, save the overwritten row and write it to * the next position, etc. When a chain returns to the starting * point, the next undone matrix row is the new starting point, * and the process continues till all rows are done. This is * just a way to avoid doubling memory usage, paying with some * more CPU. */ done = (int *)cpl_calloc((size_t)matrix->nr, sizeof(*done)); row = (double *)cpl_malloc((size_t)matrix->nc * sizeof(*row)); pos = 0; start = 1; count = matrix->nr; while (count--) { done[pos] = 1; if (pos == sort_pattern[pos]) { if (count) for (pos = 0; pos < matrix->nr; pos++) if (!done[pos]) { start = 1; break; } continue; } if (start) { start = 0; read_row(matrix, row, pos); } pos = sort_pattern[pos]; if (done[pos]) { write_row(matrix, row, pos); if (count) { for (pos = 0; pos < matrix->nr; pos++) { if (!done[pos]) { start = 1; break; } } } } else write_read_row(matrix, row, pos); } cpl_free(sort_pattern); cpl_free(done); cpl_free(row); return CPL_ERROR_NONE; } /** * @brief * Sort matrix by columns. * * @param matrix Pointer to matrix to be sorted. * @param mode Sorting mode: 0, by absolute value, otherwise by value. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The matrix elements of the top row are used as reference for * the column sorting, if there are identical the values of the second * row are considered, etc. Columns with the largest values go on the * right. If @em mode is equal to zero, the columns are sorted according * to their absolute values (zeroes at left). */ cpl_error_code cpl_matrix_sort_columns(cpl_matrix *matrix, int mode) { double *column; double value1, value2; int *done; int *sort_pattern; int *p; int i, j; int keep; int reach; int start; cpl_size count; cpl_size pos; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (matrix->nc == 1) return CPL_ERROR_NONE; /* * Allocate the arrays for computing the sort pattern (i.e., the * list of arrival positions of array values after sorting). */ sort_pattern = cpl_malloc((size_t)matrix->nc * sizeof(int)); p = cpl_malloc((size_t)matrix->nc * sizeof(int)); for (i = 0; i < matrix->nc; i++) sort_pattern[i] = p[i] = i; /* * Find sorting pattern examining matrix rows. */ j = 0; i = 1; reach = 1; while (i < matrix->nc) { value1 = matrix->m[j * matrix->nc + p[i]]; value2 = matrix->m[j * matrix->nc + p[i-1]]; if (mode == 0) { value1 = fabs(value1); value2 = fabs(value2); } if (value1 > value2) { i++; if (i > reach) reach = i; } else if (value1 < value2) { keep = p[i-1]; p[i-1] = p[i]; p[i] = keep; if (i > 1) i--; else i = reach + 1; } else { if (matrix->nr == 1) { i++; continue; } j++; if (j == matrix->nr) { j = 0; i++; if (i > reach) reach = i; } continue; } if (j) { j = 0; continue; } } /* * To obtain the sort pattern this is the trick: */ reach = 1; i = 1; while (i < matrix->nc) { if (p[sort_pattern[i]] > p[sort_pattern[i-1]]) { i++; if (i > reach) reach = i; } else { keep = sort_pattern[i-1]; sort_pattern[i-1] = sort_pattern[i]; sort_pattern[i] = keep; if (i > 1) i--; else i = reach + 1; } } cpl_free(p); /* * Finally, sort the columns. Starting from columns zero, see where * it should be written, save the overwritten column and write it * to the next position, etc. When a chain returns to the starting * point, the next undone matrix column is the new starting point, * and the process continues till all columns are done. This is * just a way to avoid doubling memory usage, paying with some * more CPU. */ done = (int *)cpl_calloc((size_t)matrix->nc, sizeof(*done)); column = (double *)cpl_malloc((size_t)matrix->nr * sizeof(*column)); pos = 0; start = 1; count = matrix->nc; while (count--) { done[pos] = 1; if (pos == sort_pattern[pos]) { if (count) for (pos = 0; pos < matrix->nc; pos++) if (!done[pos]) { start = 1; break; } continue; } if (start) { start = 0; read_column(matrix, column, pos); } pos = sort_pattern[pos]; if (done[pos]) { write_column(matrix, column, pos); if (count) { for (pos = 0; pos < matrix->nc; pos++) { if (!done[pos]) { start = 1; break; } } } } else write_read_column(matrix, column, pos); } cpl_free(sort_pattern); cpl_free(done); cpl_free(column); return CPL_ERROR_NONE; } /** * @brief * Delete rows from a matrix. * * @param matrix Pointer to matrix to be modified. * @param start First row to delete. * @param count Number of rows to delete. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The specified start is outside the matrix boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is not positive. *
CPL_ERROR_ILLEGAL_OUTPUT * Attempt to delete all the rows of matrix. *
* @enderror * * A portion of the matrix data is physically removed. The pointer * to matrix data may change, therefore pointers previously retrieved * by calling @c cpl_matrix_get_data() should be discarded. The specified * segment can extend beyond the end of the matrix, but the attempt to * remove all matrix rows is flagged as an error because zero length * matrices are illegal. Rows are counted starting from 0. */ cpl_error_code cpl_matrix_erase_rows(cpl_matrix *matrix, cpl_size start, cpl_size count) { double *m1; double *m2; cpl_size size; cpl_size i; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (count < 1) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); if (start < 0 || start >= matrix->nr) return cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); if (start + count > matrix->nr) count = matrix->nr - start; if (count == matrix->nr) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); size = matrix->nr * matrix->nc; m1 = matrix->m + start * matrix->nc; m2 = m1 + count * matrix->nc; for (i = (start + count) * matrix->nc; i < size; i++) *m1++ = *m2++; size = (matrix->nr - count) * matrix->nc; matrix->m = cpl_realloc(matrix->m, (size_t)size * sizeof(double)); matrix->nr -= count; return CPL_ERROR_NONE; } /** * @brief * Delete columns from a matrix. * * @param matrix Pointer to matrix to be modified. * @param start First column to delete. * @param count Number of columns to delete. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ACCESS_OUT_OF_RANGE * The specified start is outside the matrix boundaries. *
CPL_ERROR_ILLEGAL_INPUT * count is not positive. *
CPL_ERROR_ILLEGAL_OUTPUT * Attempt to delete all the columns of matrix. *
* @enderror * * A portion of the matrix data is physically removed. The pointer * to matrix data may change, therefore pointers previously retrieved * by calling @c cpl_matrix_get_data() should be discarded. The specified * segment can extend beyond the end of the matrix, but the attempt to * remove all matrix columns is flagged as an error because zero length * matrices are illegal. Columns are counted starting from 0. */ cpl_error_code cpl_matrix_erase_columns(cpl_matrix *matrix, cpl_size start, cpl_size count) { double *m1; double *m2; cpl_size size; cpl_size new_nc; cpl_size i, j; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (count < 1) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); if (start < 0 || start >= matrix->nc) return cpl_error_set_(CPL_ERROR_ACCESS_OUT_OF_RANGE); if (start + count > matrix->nc) count = matrix->nc - start; if (count == matrix->nc) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); new_nc = matrix->nc - count; for (j = 0; j < matrix->nr; j++) { m1 = matrix->m + j * new_nc; m2 = matrix->m + j * matrix->nc; for (i = 0; i < start; i++) *m1++ = *m2++; m2 += count; for (i += count; i < matrix->nc; i++) *m1++ = *m2++; } size = (matrix->nc - count) * matrix->nr; matrix->m = cpl_realloc(matrix->m, (size_t)size * sizeof(double)); matrix->nc -= count; return CPL_ERROR_NONE; } /** * @brief * Reframe a matrix. * * @param matrix Pointer to matrix to be modified. * @param top Extra rows on top. * @param bottom Extra rows on bottom. * @param left Extra columns on left. * @param right Extra columns on right. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ILLEGAL_OUTPUT * Attempt to shrink matrix to zero size (or less). *
* @enderror * * The input matrix is reframed according to specifications. Extra rows * and column on the sides might also be negative, as long as they are * compatible with the matrix sizes: the input matrix would be reduced * in size accordingly, but an attempt to remove all matrix columns * and/or rows is flagged as an error because zero length matrices are * illegal. The old matrix elements contained in the new shape are left * unchanged, and new matrix elements added by the reshaping are initialised * to zero. No reshaping (i.e., all the extra rows set to zero) would * not be flagged as an error. * * @note * The pointer to the matrix data buffer may change, therefore * pointers previously retrieved by calling @c cpl_matrix_get_data() * should be discarded. */ cpl_error_code cpl_matrix_resize(cpl_matrix *matrix, cpl_size top, cpl_size bottom, cpl_size left, cpl_size right) { cpl_matrix *resized; cpl_size nr, nc; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (top == 0 && bottom == 0 && left == 0 && right == 0) return CPL_ERROR_NONE; nr = matrix->nr + top + bottom; nc = matrix->nc + left + right; if (nr < 1 || nc < 1) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); resized = cpl_matrix_new(nr, nc); cpl_matrix_copy(resized, matrix, top, left); cpl_free(matrix->m); matrix->m = cpl_matrix_unwrap(resized); matrix->nr = nr; matrix->nc = nc; return CPL_ERROR_NONE; } /** * @brief * Resize a matrix. * * @param matrix Pointer to matrix to be resized. * @param rows New number of rows. * @param columns New number of columns. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ILLEGAL_OUTPUT * Attempt to shrink matrix to zero size (or less). *
* @enderror * * The input matrix is resized according to specifications. The old * matrix elements contained in the resized matrix are left unchanged, * and new matrix elements added by an increase of the matrix number of * rows and/or columns are initialised to zero. * * @note * The pointer to the matrix data buffer may change, therefore * pointers previously retrieved by calling @c cpl_matrix_get_data() * should be discarded. */ cpl_error_code cpl_matrix_set_size(cpl_matrix *matrix, cpl_size rows, cpl_size columns) { return cpl_matrix_resize(matrix, 0, rows - matrix->nr, 0, columns - matrix->nc) ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @brief * Append a matrix to another. * * @param matrix1 Pointer to first matrix. * @param matrix2 Pointer to second matrix. * @param mode Matrices connected horizontally (0) or vertically (1). * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * An input matrix is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * mode is neither 0 nor 1. *
CPL_ERROR_INCOMPATIBLE_INPUT * Matrices cannot be joined as indicated by mode. *
* @enderror * * If @em mode is set to 0, the matrices must have the same number * of rows, and are connected horizontally with the first matrix * on the left. If @em mode is set to 1, the matrices must have the * same number of columns, and are connected vertically with the * first matrix on top. The first matrix is expanded to include the * values from the second matrix, while the second matrix is left * untouched. * * @note * The pointer to the first matrix data buffer may change, therefore * pointers previously retrieved by calling @c cpl_matrix_get_data() * should be discarded. */ cpl_error_code cpl_matrix_append(cpl_matrix *matrix1, const cpl_matrix *matrix2, int mode) { cpl_size old_size; if (matrix1 == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } else if (matrix2 == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } else if (mode == 0) { if (matrix1->nr != matrix2->nr) return cpl_error_set_(CPL_ERROR_INCOMPATIBLE_INPUT); old_size = matrix1->nc; cpl_matrix_resize(matrix1, 0, 0, 0, matrix2->nc); cpl_matrix_copy(matrix1, matrix2, 0, old_size); } else if (mode == 1) { if (matrix1->nc != matrix2->nc) return cpl_error_set_(CPL_ERROR_INCOMPATIBLE_INPUT); old_size = matrix1->nr; cpl_matrix_resize(matrix1, 0, matrix2->nr, 0, 0); cpl_matrix_copy(matrix1, matrix2, old_size, 0); } else { return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); } return CPL_ERROR_NONE; } /** * @brief * Add two matrices. * * @param matrix1 Pointer to first matrix. * @param matrix2 Pointer to second matrix. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * An input matrix is a NULL pointer. *
CPL_ERROR_INCOMPATIBLE_INPUT * The specified matrices do not have the same size. *
* @enderror * * Add two matrices element by element. The two matrices must have * identical sizes. The result is written to the first matrix. */ cpl_error_code cpl_matrix_add(cpl_matrix *matrix1, const cpl_matrix *matrix2) { cpl_size size; double *m1; double *m2; if (matrix1 == NULL || matrix2 == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (matrix1->nr != matrix2->nr || matrix1->nc != matrix2->nc) return cpl_error_set_(CPL_ERROR_INCOMPATIBLE_INPUT); size = matrix1->nr * matrix1->nc; m1 = matrix1->m; m2 = matrix2->m; cpl_tools_add_flops( (cpl_flops)size ); while (size--) *m1++ += *m2++; return CPL_ERROR_NONE; } /** * @brief * Subtract a matrix from another. * * @param matrix1 Pointer to first matrix. * @param matrix2 Pointer to second matrix. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * An input matrix is a NULL pointer. *
CPL_ERROR_INCOMPATIBLE_INPUT * The specified matrices do not have the same size. *
* @enderror * * Subtract the second matrix from the first one element by element. * The two matrices must have identical sizes. The result is written * to the first matrix. */ cpl_error_code cpl_matrix_subtract(cpl_matrix *matrix1, const cpl_matrix *matrix2) { cpl_size size; double *m1; double *m2; if (matrix1 == NULL || matrix2 == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (matrix1->nr != matrix2->nr || matrix1->nc != matrix2->nc) return cpl_error_set_(CPL_ERROR_INCOMPATIBLE_INPUT); size = matrix1->nr * matrix1->nc; m1 = matrix1->m; m2 = matrix2->m; cpl_tools_add_flops( (cpl_flops)size ); while (size--) *m1++ -= *m2++; return CPL_ERROR_NONE; } /** * @brief * Multiply two matrices element by element. * * @param matrix1 Pointer to first matrix. * @param matrix2 Pointer to second matrix. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * An input matrix is a NULL pointer. *
CPL_ERROR_INCOMPATIBLE_INPUT * The specified matrices do not have the same size. *
* @enderror * * Multiply the two matrices element by element. The two matrices must * have identical sizes. The result is written to the first matrix. * * @note * To obtain the rows-by-columns product between two matrices, * @c cpl_matrix_product_create() should be used instead. */ cpl_error_code cpl_matrix_multiply(cpl_matrix *matrix1, const cpl_matrix *matrix2) { cpl_size size; double *m1; double *m2; if (matrix1 == NULL || matrix2 == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (matrix1->nr != matrix2->nr || matrix1->nc != matrix2->nc) return cpl_error_set_(CPL_ERROR_INCOMPATIBLE_INPUT); size = matrix1->nr * matrix1->nc; m1 = matrix1->m; m2 = matrix2->m; cpl_tools_add_flops( (cpl_flops)size ); while (size--) *m1++ *= *m2++; return CPL_ERROR_NONE; } /** * @brief * Divide a matrix by another element by element. * * @param matrix1 Pointer to first matrix. * @param matrix2 Pointer to second matrix. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * An input matrix is a NULL pointer. *
CPL_ERROR_INCOMPATIBLE_INPUT * The specified matrices do not have the same size. *
* @enderror * * Divide each element of the first matrix by the corresponding * element of the second one. The two matrices must have the same * number of rows and columns. The result is written to the first * matrix. No check is made against a division by zero. */ cpl_error_code cpl_matrix_divide(cpl_matrix *matrix1, const cpl_matrix *matrix2) { cpl_size size; double *m1; double *m2; if (matrix1 == NULL || matrix2 == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (matrix1->nr != matrix2->nr || matrix1->nc != matrix2->nc) return cpl_error_set_(CPL_ERROR_INCOMPATIBLE_INPUT); size = matrix1->nr * matrix1->nc; m1 = matrix1->m; m2 = matrix2->m; cpl_tools_add_flops( (cpl_flops)size ); while (size--) *m1++ /= *m2++; return CPL_ERROR_NONE; } /** * @brief * Add a scalar to a matrix. * * @param matrix Pointer to matrix. * @param value Value to add. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * Add the same value to each matrix element. */ cpl_error_code cpl_matrix_add_scalar(cpl_matrix *matrix, double value) { cpl_size size; double *m; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); size = matrix->nr * matrix->nc; m = matrix->m; cpl_tools_add_flops( (cpl_flops)size ); while (size--) *m++ += value; return CPL_ERROR_NONE; } /** * @brief * Subtract a scalar to a matrix. * * @param matrix Pointer to matrix. * @param value Value to subtract. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * Subtract the same value to each matrix element. */ cpl_error_code cpl_matrix_subtract_scalar(cpl_matrix *matrix, double value) { cpl_size size; double *m; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); size = matrix->nr * matrix->nc; m = matrix->m; cpl_tools_add_flops( (cpl_flops)size ); while (size--) *m++ -= value; return CPL_ERROR_NONE; } /** * @brief * Multiply a matrix by a scalar. * * @param matrix Pointer to matrix. * @param value Multiplication factor. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * Multiply each matrix element by the same factor. */ cpl_error_code cpl_matrix_multiply_scalar(cpl_matrix *matrix, double value) { cpl_size size; double *m; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); size = matrix->nr * matrix->nc; m = matrix->m; cpl_tools_add_flops( (cpl_flops)size ); while (size--) *m++ *= value; return CPL_ERROR_NONE; } /** * @brief * Divide a matrix by a scalar. * * @param matrix Pointer to matrix. * @param value Divisor. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_DIVISION_BY_ZERO * The input value is 0.0. *
* @enderror * * Divide each matrix element by the same value. */ cpl_error_code cpl_matrix_divide_scalar(cpl_matrix *matrix, double value) { cpl_size size; double *m; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (value == 0.0) return cpl_error_set_(CPL_ERROR_DIVISION_BY_ZERO); size = matrix->nr * matrix->nc; m = matrix->m; cpl_tools_add_flops( (cpl_flops)size ); while (size--) *m++ /= value; return CPL_ERROR_NONE; } /** * @brief * Compute the logarithm of matrix elements. * * @param matrix Pointer to matrix. * @param base Logarithm base. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The input base, or any matrix element, is * not positive. *
* @enderror * * Each matrix element is replaced by its logarithm in the specified base. * The base and all matrix elements must be positive. If this is not the * case, the matrix would not be modified. */ cpl_error_code cpl_matrix_logarithm(cpl_matrix *matrix, double base) { cpl_size size; double *m; double logbase; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (base <= 0.0) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); size = matrix->nr * matrix->nc; m = matrix->m; while (size--) { if (*m <= 0.0) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); m++; } logbase = log(base); size = matrix->nr * matrix->nc; m = matrix->m; cpl_tools_add_flops( 1 + 2 * (cpl_flops)size ); while (size--) { *m = log(*m) / logbase; m++; } return CPL_ERROR_NONE; } /** * @brief * Compute the exponential of matrix elements. * * @param matrix Target matrix. * @param base Exponential base. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The input base is not positive. *
* @enderror * * Each matrix element is replaced by its exponential in the specified base. * The base must be positive. */ cpl_error_code cpl_matrix_exponential(cpl_matrix *matrix, double base) { cpl_size size; double *m; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (base <= 0.0) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); size = matrix->nr * matrix->nc; m = matrix->m; cpl_tools_add_flops( (cpl_flops)size ); while (size--) { *m = pow(base, *m); m++; } return CPL_ERROR_NONE; } /** * @brief * Compute a power of matrix elements. * * @param matrix Pointer to matrix. * @param exponent Constant exponent. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * Any matrix element is not compatible with the * specified exponent (see description below). *
* @enderror * * Each matrix element is replaced by its power to the specified * exponent. If the specified exponent is not negative, all matrix * elements must be not negative; if the specified exponent is * negative, all matrix elements must be positive; otherwise, an * error condition is set and the matrix will be left unchanged. * If the exponent is exactly 0.5 the (faster) @c sqrt() will be * applied instead of @c pow(). If the exponent is zero, then any * (non negative) matrix element would be assigned the value 1.0. */ cpl_error_code cpl_matrix_power(cpl_matrix *matrix, double exponent) { cpl_size size; double *m; int negative = exponent < 0.0; if (matrix == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); size = matrix->nr * matrix->nc; m = matrix->m; if (negative) { while (size--) { if (*m <= 0.0) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); m++; } } else { while (size--) { if (*m < 0.0) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); m++; } } if (negative) exponent = -exponent; size = matrix->nr * matrix->nc; m = matrix->m; cpl_tools_add_flops( (cpl_flops)size ); if (negative) { while (size--) { *m = 1 / pow(*m, exponent); m++; } } else { if (exponent == 0.5) { while (size--) { *m = sqrt(*m); m++; } } else { while (size--) { *m = pow(*m, exponent); m++; } } } return CPL_ERROR_NONE; } /** * @brief * Rows-by-columns product of two matrices. * * @param matrix1 Pointer to left side matrix. * @param matrix2 Pointer to right side matrix. * * @return Pointer to product matrix, or @c NULL in case of error. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * An input matrix is a NULL pointer. *
CPL_ERROR_INCOMPATIBLE_INPUT * The number of columns of the first matrix is not equal to * the number of rows of the second matrix. *
* @enderror * * Rows-by-columns product of two matrices. The number of columns of the * first matrix must be equal to the number of rows of the second matrix. * To destroy the new matrix the function @c cpl_matrix_delete() should * be used. */ cpl_matrix *cpl_matrix_product_create(const cpl_matrix *matrix1, const cpl_matrix *matrix2) { cpl_matrix *self; cpl_ensure(matrix1 != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(matrix2 != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(matrix1->nc == matrix2->nr, CPL_ERROR_INCOMPATIBLE_INPUT, NULL); /* Create data-buffer without overhead of initializing */ self = cpl_matrix_wrap(matrix1->nr, matrix2->nc, cpl_calloc((size_t)matrix1->nr * (size_t)matrix2->nc , sizeof(*self))); (void) cpl_matrix_product(self, matrix1, matrix2); return self; } /* * @brief Replace a matrix by its LU-decomposition * @param self n X n non-singular matrix to decompose * @param perm n-integer array to be filled with the row permutations * @param psig On success set to 1/-1 for an even/odd number of permutations * @return CPL_ERROR_NONE on success, or the relevant CPL error code * @note If the matrix is singular the elements of self become undefined * @see Golub & Van Loan, Matrix Computations, Algorithms 3.2.1 (Outer Product * Gaussian Elimination) and 3.4.1 (Gauss Elimination with Partial Pivoting). * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * An input pointer is NULL. *
CPL_ERROR_ILLEGAL_INPUT * self is not an n by n matrix. *
CPL_ERROR_INCOMPATIBLE_INPUT * self and perm have incompatible sizes. *
CPL_ERROR_TYPE_MISMATCH * perm is not of type CPL_TYPE_INT. *
CPL_ERROR_SINGULAR_MATRIX * self is singular. *
* @enderror * */ cpl_error_code cpl_matrix_decomp_lu(cpl_matrix * self, cpl_array * perm, int * psig) { const cpl_size n = cpl_array_get_size(perm); int * iperm = cpl_array_get_data_int(perm); int nn; cpl_size i, j; const double * aread; double * awrite; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(perm != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(psig != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(self->nc == self->nr, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(self->nc == n, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(cpl_array_get_type(perm) == CPL_TYPE_INT, CPL_ERROR_TYPE_MISMATCH); nn = (int)n; cpl_ensure_code((cpl_size)nn == n, CPL_ERROR_ILLEGAL_INPUT); aread = awrite = self->m; /* No row permutations yet */ *psig = 1; for (i = 0; i < n; i++) { cpl_array_set_int(perm, i, (int)i); /* FIXME: Accept all faster ? */ } for (j = 0; j < n - 1; j++) { /* Find maximum in the j-th column */ double pivot = fabs(aread[j + j * n]); cpl_size ipivot = j; for (i = j + 1; i < n; i++) { const double aij = fabs(aread[j + i * n]); if (aij > pivot) { pivot = aij; ipivot = i; } } if (pivot <= 0.0) { return cpl_error_set_message_(CPL_ERROR_SINGULAR_MATRIX, "Pivot %" CPL_SIZE_FORMAT " of %" CPL_SIZE_FORMAT " is non-positive: " "%g", j, n, pivot); } if (ipivot > j) { /* The maximum is below the diagonal - swap rows */ const int iswap = iperm[j]; iperm[j] = iperm[ipivot]; iperm[ipivot] = iswap; *psig = - (*psig); swap_rows(self, j, ipivot); } pivot = aread[j + j * n]; for (i = j + 1; i < n; i++) { const double aij = aread[j + i * n] / pivot; cpl_size k; awrite[j + i * n] = aij; for (k = j + 1; k < n; k++) { const double ajk = aread[k + j * n]; const double aik = aread[k + i * n]; awrite[k + i * n] = aik - aij * ajk; } } } cpl_tools_add_flops( (cpl_flops)(2 * n * n * n) / 3); /* Check if A(n,n) is non-zero */ return fabs(aread[n * (n-1) + (n-1)]) > 0.0 ? CPL_ERROR_NONE : cpl_error_set_message_(CPL_ERROR_SINGULAR_MATRIX, "The last of %" CPL_SIZE_FORMAT " pivot(s) is zero", n); } /* * @brief Solve a LU-system * @param self n X n LU-matrix from cpl_matrix_decomp_lu() * @param rhs m right-hand-sides to be replaced by their solution * @param perm n-integer array filled with the row permutations, or NULL * @return CPL_ERROR_NONE on success, or the relevant CPL error code * @see cpl_matrix_decomp_lu() * * @error * * * * * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * An input pointer is NULL. *
CPL_ERROR_ILLEGAL_INPUT * self is not an n by n matrix. *
CPL_ERROR_INCOMPATIBLE_INPUT * The array or matrices not have the same number of rows. *
CPL_ERROR_TYPE_MISMATCH * perm is non-NULL and not of type CPL_TYPE_INT. *
CPL_ERROR_DIVISION_BY_ZERO * The main diagonal of U contains a zero. This error can only occur * if the LU-matrix does not come from a successful call to * cpl_matrix_decomp_lu(). *
* @enderror * */ cpl_error_code cpl_matrix_solve_lu(const cpl_matrix * self, cpl_matrix * rhs, const cpl_array * perm) { const int * iperm = NULL; cpl_size n, i, j, k; double * x = NULL; /* Avoid false uninit warning */ const double * aread; const double * bread; double * bwrite; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(rhs != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(self->nc == self->nr, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(rhs->nr == self->nr, CPL_ERROR_INCOMPATIBLE_INPUT); n = self->nc; aread = self->m; bread = bwrite = rhs->m; if (perm != NULL) { cpl_ensure_code(cpl_array_get_size(perm) == n, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(cpl_array_get_type(perm) == CPL_TYPE_INT, CPL_ERROR_TYPE_MISMATCH); iperm = cpl_array_get_data_int_const(perm); x = (double*) cpl_malloc((size_t)n * sizeof(*x)); } for (k=0; k < rhs->nc; k++) { if (perm != NULL) { /* Un-permute the rows in column k */ for (i = 0; i < n; i++) { x[i] = bread[rhs->nc * i + k]; } for (i = 0; i < n; i++) { bwrite[rhs->nc * i + k] = x[iperm[i]]; } } /* Forward substitution in column k */ for (i = 1; i < n; i++) { double tmp = bread[rhs->nc * i + k]; for (j = 0; j < i; j++) { const double aij = aread[n * i + j]; tmp -= aij * bread[rhs->nc * j + k]; } bwrite[rhs->nc * i + k] = tmp; } /* Back substitution in column k */ for (i = n - 1; i >= 0; i--) { double tmp = bread[rhs->nc * i + k]; for (j = i + 1; j < n; j++) { const double aij = aread[n * i + j]; tmp -= aij * bread[rhs->nc * j + k]; } /* Check for a bug in the calling function */ if (aread[n * i + i] == 0.0) break; bwrite[rhs->nc * i + k] = tmp/aread[n * i + i]; } if (i >= 0) break; } if (perm != NULL) cpl_free(x); /* Flop count may be a bit too high if the below check fails */ cpl_tools_add_flops( (cpl_flops)(k * 2 * n * n) ); return k == rhs->nc ? CPL_ERROR_NONE : cpl_error_set_(CPL_ERROR_DIVISION_BY_ZERO); } /*----------------------------------------------------------------------------*/ /** @brief Replace a matrix by its Cholesky-decomposition, L * transpose(L) = A @param self N by N symmetric positive-definite matrix to decompose @return CPL_ERROR_NONE on success, or the relevant CPL error code @note Only the upper triangle of self is read, L is written in the lower triangle @note If the matrix is singular the elements of self become undefined @see Golub & Van Loan, Matrix Computations, Algorithm 4.2.1 (Cholesky: Gaxpy Version). @error
CPL_ERROR_NULL_INPUT An input pointer is NULL.
CPL_ERROR_ILLEGAL_INPUT self is not an n by n matrix.
CPL_ERROR_SINGULAR_MATRIX self is not symmetric, positive definite.
@enderror */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_matrix_decomp_chol(cpl_matrix * self) { const cpl_size n = cpl_matrix_get_ncol(self); double * awrite = cpl_matrix_get_data(self); const double * aread = awrite; double sub = 0.0; /* Fix (false) uninit warning */ cpl_size i, j = 0; /* Fix (false) uninit warning */ cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_matrix_get_nrow(self) == n, CPL_ERROR_ILLEGAL_INPUT); for (i = 0; i < n; i++) { for (j = i; j < n; j++) { cpl_size k; sub = aread[n * i + j]; for (k = i-1; k >= 0; k--) { sub -= aread[n * i + k] * aread[n * j + k]; } if (j > i) { awrite[n * j + i] = sub/aread[n * i + i]; } else if (sub > 0.0) { awrite[n * i + i] = sqrt(sub); } else { break; } } if (j < n) break; } /* Dominant term: N^3 / 3 */ /* FIXME: Probably inexact on error */ cpl_tools_add_flops((cpl_flops)( i * ( 1 + j * ( 3 + 2 * n))) / 6); return i == n ? CPL_ERROR_NONE : cpl_error_set_message_(CPL_ERROR_SINGULAR_MATRIX, "Pivot " "%" CPL_SIZE_FORMAT " of %" CPL_SIZE_FORMAT " is non-positive: %g", i+1, n, sub); } /*----------------------------------------------------------------------------*/ /** @brief Solve a L*transpose(L)-system @param self N by N L*transpose(L)-matrix from cpl_matrix_decomp_chol() @param rhs M right-hand-sides to be replaced by their solution @return CPL_ERROR_NONE on success, or the relevant CPL error code @see cpl_matrix_decomp_chol() @note Only the lower triangle of self is accessed @error
CPL_ERROR_NULL_INPUT An input pointer is NULL.
CPL_ERROR_ILLEGAL_INPUT self is not an n by n matrix.
CPL_ERROR_INCOMPATIBLE_INPUT The specified matrices do not have the same number of rows.
CPL_ERROR_DIVISION_BY_ZERO The main diagonal of L contains a zero. This error can only occur if the L*transpose(L)-matrix does not come from a successful call to cpl_matrix_decomp_chol().
@enderror */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_matrix_solve_chol(const cpl_matrix * self, cpl_matrix * rhs) { const cpl_size n = cpl_matrix_get_ncol(self); const cpl_size nrhs = cpl_matrix_get_ncol(rhs); cpl_size i, j, k; const double * aread; const double * bread; double * bwrite; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(rhs != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_matrix_get_nrow(self) == n, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(cpl_matrix_get_nrow(rhs) == n, CPL_ERROR_INCOMPATIBLE_INPUT); aread = cpl_matrix_get_data_const(self); bread = bwrite = cpl_matrix_get_data(rhs); for (k=0; k < nrhs; k++) { /* Forward substitution in column k */ for (i = 0; i < n; i++) { double sub = bread[nrhs * i + k]; for (j = i-1; j >= 0; j--) { sub -= aread[n * i + j] * bread[nrhs * j + k]; } cpl_ensure_code(aread[n * i + i] != 0.0, CPL_ERROR_DIVISION_BY_ZERO); bwrite[nrhs * i + k] = sub/aread[n * i + i]; } /* Back substitution in column k */ for (i = n-1; i >= 0; i--) { double sub = bread[nrhs * i + k]; for (j = i+1; j < n; j++) { sub -= aread[n * j + i] * bread[nrhs * j + k]; } bwrite[nrhs * i + k] = sub/aread[n * i + i]; } } cpl_tools_add_flops( 2 * (cpl_flops)(n * n * nrhs)); return CPL_ERROR_NONE; } /** * @brief * Compute the determinant of a matrix. * * @param matrix Pointer to n by n matrix. * * @return Matrix determinant. In case of error, 0.0 is returned. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * The input matrix is not square. *
CPL_ERROR_UNSPECIFIED * The input matrix is near-singular with a determinant so * close to zero that it cannot be represented by a double. *
* @enderror * * The input matrix must be a square matrix. In case of a 1x1 matrix, * the matrix single element value is returned. */ double cpl_matrix_get_determinant(const cpl_matrix *matrix) { cpl_matrix * self; cpl_array * perm; int * iperm; double determinant; int sig; cpl_errorstate prevstate = cpl_errorstate_get(); cpl_error_code error; cpl_ensure(matrix != NULL, CPL_ERROR_NULL_INPUT, 0.0); cpl_ensure(matrix->nr == matrix->nc, CPL_ERROR_ILLEGAL_INPUT, 0.0); iperm = (int*) cpl_malloc((size_t)matrix->nr * sizeof(*iperm)); perm = cpl_array_wrap_int(iperm, matrix->nr); self = cpl_matrix_duplicate(matrix); error = cpl_matrix_decomp_lu(self, perm, &sig); cpl_array_delete(perm); if (!error) { cpl_size i; /* Use long double because the intermediate products may vary greatly */ cpl_long_double ldet = (cpl_long_double)sig; for (i = 0; i < matrix->nr; i++) { const double aii = cpl_matrix_get(self, i, i); ldet *= (cpl_long_double)aii; if (ldet == 0.0) break; } determinant = (double)ldet; if (i < matrix->nr) { (void)cpl_error_set_message_(CPL_ERROR_UNSPECIFIED, "Underflow at pivot %" CPL_SIZE_FORMAT " of %" CPL_SIZE_FORMAT, 1+i, matrix->nr); } else if (determinant == 0.0) { (void)cpl_error_set_message_(CPL_ERROR_UNSPECIFIED, "Underflow at %Lg", ldet); } } else { determinant = 0.0; if (error == CPL_ERROR_SINGULAR_MATRIX) { cpl_errorstate_set(prevstate); } else { /* Should not be able to enter here */ (void)cpl_error_set_where_(); } } cpl_matrix_delete(self); return determinant; } /** * @brief * Solution of a linear system. * * @param coeff A non-singular N by N matrix. * @param rhs A matrix containing one or more right-hand-sides. * @note rhs must have N rows and may contain more than one column, * which each represent an independent right-hand-side. * * @return A newly allocated solution matrix with the size as rhs, * or @c NULL on error. * * @error * * * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any input is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * coeff is not a square matrix. *
CPL_ERROR_INCOMPATIBLE_INPUT * coeff and rhs do not have the same number of rows. *
CPL_ERROR_SINGULAR_MATRIX * coeff is singular (to working precision). *
* @enderror * * Compute the solution of a system of N equations with N unknowns: * * coeff * X = rhs * * @em coeff must be an NxN matrix, and @em rhs a NxM matrix. * M greater than 1 means that multiple independent right-hand-sides * are solved for. * To destroy the solution matrix the function @c cpl_matrix_delete() * should be used. * */ cpl_matrix *cpl_matrix_solve(const cpl_matrix *coeff, const cpl_matrix *rhs) { cpl_matrix * lu; cpl_matrix * x; cpl_array * perm; int * iperm; cpl_size n; int sig; cpl_error_code error; cpl_ensure(coeff != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(rhs != NULL, CPL_ERROR_NULL_INPUT, NULL); n = coeff->nc; cpl_ensure(coeff->nr == n, CPL_ERROR_ILLEGAL_INPUT, NULL); cpl_ensure(rhs->nr == n, CPL_ERROR_INCOMPATIBLE_INPUT, NULL); lu = cpl_matrix_duplicate(coeff); iperm = (int*) cpl_malloc((size_t)n * sizeof(*iperm)); perm = cpl_array_wrap_int(iperm, n); if (cpl_matrix_decomp_lu(lu, perm, &sig)) { cpl_matrix_delete(lu); cpl_array_delete(perm); (void)cpl_error_set_where_(); return NULL; } x = cpl_matrix_duplicate(rhs); /* should not be able to fail at this point */ error = cpl_matrix_solve_lu(lu, x, perm); cpl_matrix_delete(lu); cpl_array_delete(perm); if (error) { cpl_matrix_delete(x); x = NULL; (void)cpl_error_set_where_(); } return x; } /** * @brief * Find a matrix inverse. * * @param matrix Pointer to matrix to invert. * * @return Inverse matrix. In case of error a @c NULL is returned. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any input is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * self is not an n by n matrix. *
CPL_ERROR_SINGULAR_MATRIX * matrix cannot be inverted. *
* @enderror * * The input must be a square matrix. To destroy the new matrix the * function @c cpl_matrix_delete() should be used. * * @note * When calling @c cpl_matrix_invert_create() with a nearly singular * matrix, it is possible to get a result containin NaN values without * any error code being set. */ cpl_matrix *cpl_matrix_invert_create(const cpl_matrix *matrix) { cpl_matrix * lu; cpl_matrix * inverse; cpl_array * perm; int * iperm; cpl_size n, i; int sig, nn; cpl_error_code error; cpl_ensure(matrix != NULL, CPL_ERROR_NULL_INPUT, NULL); n = matrix->nc; cpl_ensure(matrix->nr == n, CPL_ERROR_ILLEGAL_INPUT, NULL); nn = (int)n; cpl_ensure((cpl_size)nn == n, CPL_ERROR_ILLEGAL_INPUT, NULL); lu = cpl_matrix_duplicate(matrix); iperm = (int*) cpl_malloc((size_t)n * sizeof(*iperm)); perm = cpl_array_wrap_int(iperm, n); if (cpl_matrix_decomp_lu(lu, perm, &sig)) { cpl_matrix_delete(lu); cpl_array_delete(perm); (void)cpl_error_set_where_(); return NULL; } /* Should not be able to fail at this point */ inverse = cpl_matrix_new(n, n); /* Create an identity matrix with the rows permuted */ for (i = 0; i < n; i++) { (void)cpl_matrix_set(inverse, i, iperm[i], 1.0); } cpl_array_delete(perm); error = cpl_matrix_solve_lu(lu, inverse, NULL); cpl_matrix_delete(lu); if (error) { cpl_matrix_delete(inverse); inverse = NULL; (void)cpl_error_set_where_(); } return inverse; } /** * @brief * Solution of overdetermined linear equations in a least squares sense. * * @param coeff The N by M matrix of coefficients, where N >= M. * @param rhs An N by K matrix containing K right-hand-sides. * @note rhs may contain more than one column, * which each represent an independent right-hand-side. * * @return A newly allocated M by K solution matrix, * or @c NULL on error. * * @error * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * Any input is a NULL pointer. *
CPL_ERROR_INCOMPATIBLE_INPUT * coeff and rhs do not have the same number of rows. *
CPL_ERROR_SINGULAR_MATRIX * The matrix is (near) singular and a solution cannot be computed. *
* @enderror * * The following linear system of N equations and M unknowns * is given: * * @code * coeff * X = rhs * @endcode * * where @em coeff is the NxM matrix of the coefficients, @em X is the * MxK matrix of the unknowns, and @em rhs the NxK matrix containing * the K right hand side(s). * * The solution to the normal equations is known to be a least-squares * solution, i.e. the 2-norm of coeff * X - rhs is minimized by the * solution to * transpose(coeff) * coeff * X = transpose(coeff) * rhs. * * In the case that coeff is square (N is equal to M) it gives a faster * and more accurate result to use cpl_matrix_solve(). * * The solution matrix should be deallocated with the function * @c cpl_matrix_delete(). */ cpl_matrix *cpl_matrix_solve_normal(const cpl_matrix *coeff, const cpl_matrix *rhs) { cpl_matrix * solution; cpl_matrix * At; cpl_matrix * AtA; cpl_ensure(coeff != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(rhs != NULL, CPL_ERROR_NULL_INPUT, NULL); cpl_ensure(rhs->nr == coeff->nr, CPL_ERROR_INCOMPATIBLE_INPUT, NULL); At = cpl_matrix_transpose_create(coeff); solution = cpl_matrix_product_create(At, rhs); AtA = cpl_matrix_product_normal_create(At); cpl_matrix_delete(At); if (cpl_matrix_solve_spd(AtA, solution)) { cpl_matrix_delete(solution); solution = NULL; (void)cpl_error_set_where_(); } cpl_matrix_delete(AtA); return solution; } /** * @brief * Find the mean of all matrix elements. * * @param matrix Pointer to matrix. * * @return Mean. In case of error 0.0 is returned. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The mean value of all matrix elements is calculated. * * @note * This function works properly only in the case all the elements of * the input matrix do not contain garbage (such as @c NaN or infinity). */ double cpl_matrix_get_mean(const cpl_matrix *matrix) { if (matrix == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0.0; } else { return cpl_tools_get_mean_double(matrix->m, matrix->nr * matrix->nc); } } /** * @brief * Find the standard deviation of matrix elements. * * @param matrix Pointer to matrix. * * @return Standard deviation. In case of error, or if a matrix is * 1x1, 0.0 is returned. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The standard deviation of all matrix elements is calculated. * * @note * This function works properly only in the case all the elements of * the input matrix do not contain garbage (such as @c NaN or infinity). */ double cpl_matrix_get_stdev(const cpl_matrix *matrix) { if (matrix == NULL) { (void)cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0.0; } else if (matrix->nr == 1 && matrix->nc == 1) { return 0.0; } else { const cpl_size size = matrix->nr * matrix->nc; const double varsum = cpl_tools_get_variancesum_double(matrix->m, size, NULL); return sqrt( varsum / (double)(size - 1)); } } /** * @brief * Find the median of matrix elements. * * @param matrix Pointer to matrix. * * @return Median. In case of error 0.0 is returned. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The median value of all matrix elements is calculated. */ double cpl_matrix_get_median(const cpl_matrix *matrix) { double median = 0.0; if (matrix == NULL) { (void)cpl_error_set_(CPL_ERROR_NULL_INPUT); } else { const cpl_size size = matrix->nr * matrix->nc; double *copybuf = (double*)cpl_malloc((size_t)size * sizeof(*copybuf)); (void)memcpy(copybuf, matrix->m, (size_t)size * sizeof(double)); median = cpl_tools_get_median_double(copybuf, size); cpl_free(copybuf); } return median; } /** * @brief * Find the minimum value of matrix elements. * * @param matrix Pointer to matrix. * * @return Minimum value. In case of error, 0.0 is returned. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The minimum value of all matrix elements is found. */ double cpl_matrix_get_min(const cpl_matrix *matrix) { cpl_size i, j; if (cpl_matrix_get_minpos(matrix, &i, &j)) { (void)cpl_error_set_where_(); return 0.0; } else { return cpl_matrix_get(matrix, i, j); } } /** * @brief * Find the maximum value of matrix elements. * * @param matrix Pointer to matrix. * * @return Maximum value. In case of error, 0.0 is returned. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The maximum value of all matrix elements is found. */ double cpl_matrix_get_max(const cpl_matrix *matrix) { cpl_size i, j; if (cpl_matrix_get_maxpos(matrix, &i, &j)) { (void)cpl_error_set_where_(); return 0.0; } else { return cpl_matrix_get(matrix, i, j); } } /** * @brief * Find position of minimum value of matrix elements. * * @param matrix Input matrix. * @param row Returned row position of minimum. * @param column Returned column position of minimum. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The position of the minimum value of all matrix elements is found. * If more than one matrix element have a value corresponding to * the minimum, the lowest element row number is returned in @em row. * If more than one minimum matrix elements have the same row number, * the lowest element column number is returned in @em column. */ cpl_error_code cpl_matrix_get_minpos(const cpl_matrix *matrix, cpl_size *row, cpl_size *column) { if (matrix == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } else if (row == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } else if (column == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } else { const cpl_size size = matrix->nr * matrix->nc; cpl_size i, pos = 0; for (i = 1; i < size; i++) { if (matrix->m[i] < matrix->m[pos]) { pos = i; } } *row = pos / matrix->nc; *column = pos % matrix->nc; } return CPL_ERROR_NONE; } /** * @brief * Find position of the maximum value of matrix elements. * * @param matrix Input matrix. * @param row Returned row position of maximum. * @param column Returned column position of maximum. * * @return @c CPL_ERROR_NONE on success. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The input matrix is a NULL pointer. *
* @enderror * * The position of the maximum value of all matrix elements is found. * If more than one matrix element have a value corresponding to * the maximum, the lowest element row number is returned in @em row. * If more than one maximum matrix elements have the same row number, * the lowest element column number is returned in @em column. */ cpl_error_code cpl_matrix_get_maxpos(const cpl_matrix *matrix, cpl_size *row, cpl_size *column) { if (matrix == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } else if (row == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } else if (column == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } else { const cpl_size size = matrix->nr * matrix->nc; cpl_size i, pos = 0; for (i = 1; i < size; i++) { if (matrix->m[i] > matrix->m[pos]) { pos = i; } } *row = pos / matrix->nc; *column = pos % matrix->nc; } return CPL_ERROR_NONE; } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Solution of Symmetric, Positive Definite system of linear equations. * @param self The N by N Symmetric, Positive Definite matrix. @param rhs An N by K matrix containing K right-hand-sides. @note rhs may contain more than one column, which each represent an independent right-hand-side. The solution is written in rhs. Only the upper triangular part of self is read, while the lower triangular part is modified. @return CPL_ERROR_NONE on success, or the relevant CPL error code * @error
CPL_ERROR_NULL_INPUT self or rhs is a NULL pointer.
CPL_ERROR_INCOMPATIBLE_INPUT self and rhs do not have the same number of rows.
CPL_ERROR_ILLEGAL_INPUT self is not an N by N matrix.
CPL_ERROR_SINGULAR_MATRIX self is (near) singular and a solution cannot be computed.
@enderror */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_matrix_solve_spd(cpl_matrix *self, cpl_matrix *rhs) { cpl_ensure_code(!cpl_matrix_decomp_chol(self), cpl_error_get_code()); cpl_ensure_code(!cpl_matrix_solve_chol(self, rhs), cpl_error_get_code()); return CPL_ERROR_NONE; } /** * @internal * @brief Compute A = B * transpose(B) * * @param self Pre-allocated M x M matrix to hold the result * @param other M x N Matrix to multiply with its transpose @return CPL_ERROR_NONE or the relevant CPL error code on error * @note Only the upper triangle of A is computed, while the elements * below the main diagonal have undefined values. * @see cpl_matrix_product_create() * * @error * * * * * * * * * * * * * * * *
CPL_ERROR_NULL_INPUT * An input matrix is a NULL pointer. *
CPL_ERROR_ILLEGAL_INPUT * self is not an M by M matrix. *
CPL_ERROR_INCOMPATIBLE_INPUT * The two matrices have a different number of rows. *
* @enderror * */ cpl_error_code cpl_matrix_product_normal(cpl_matrix * self, const cpl_matrix * other) { double sum; const double * ai = cpl_matrix_get_data_const(other); const double * aj; double * bwrite = cpl_matrix_get_data(self); const cpl_size m = cpl_matrix_get_nrow(self); const cpl_size n = cpl_matrix_get_ncol(other); cpl_size i, j, k; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(other != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(cpl_matrix_get_ncol(self) == m, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(cpl_matrix_get_nrow(other) == m, CPL_ERROR_INCOMPATIBLE_INPUT); #ifdef CPL_MATRIX_PRODUCT_NORMAL_RESET /* Initialize all values to zero. This is done to avoid access of uninitilized memory in case someone passes the matrix to for example cpl_matrix_dump(). */ (void)memset(bwrite, 0, m * n * sizeof(*bwrite)); #endif /* The result at (i,j) is the dot-product of i'th and j'th row */ for (i = 0; i < m; i++, bwrite += m, ai += n) { aj = ai; /* aj points to first entry in j'th row */ for (j = i; j < m; j++, aj += n) { sum = 0.0; for (k = 0; k < n; k++) { sum += ai[k] * aj[k]; } bwrite[j] = sum; } } cpl_tools_add_flops((cpl_flops)(n * m * (m + 1))); return CPL_ERROR_NONE; } /** * @internal * @brief Create and compute A = B * transpose(B) * * @param self M x N Matrix * @return Pointer to created M x M product matrix, or @c NULL on error. * @note Only the upper triangle of A is computed, while the elements * below the main diagonal have undefined values. * @see cpl_matrix_product_create() * * @error * * * * * *
CPL_ERROR_NULL_INPUT * An input matrix is a NULL pointer. *
* @enderror * * To destroy the new matrix the function @c cpl_matrix_delete() should * be used. */ cpl_matrix * cpl_matrix_product_normal_create(const cpl_matrix * self) { const size_t m = cpl_matrix_get_nrow(self); cpl_matrix * product = cpl_matrix_wrap((cpl_size)m, (cpl_size)m, cpl_malloc(m * m * sizeof(double))); if (cpl_matrix_product_normal(product, self)) { cpl_matrix_delete(product); product = NULL; (void)cpl_error_set_where_(); } return product; } /*----------------------------------------------------------------------------*/ /** @internal @brief Fill a matrix with the product of A * B @param self The matrix to fill, is or else will be set to size M x N @param ma The matrix A, of size M x K @param mb The matrix B, of size K * N @return CPL_ERROR_NONE or the relevant CPL error code on error @note If upon entry, self has a size m *n, which differs from its size on return, then the result of preceeding calls to cpl_matrix_get_data() are invalid. @see cpl_matrix_product_create() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_matrix_product(cpl_matrix * self, const cpl_matrix * ma, const cpl_matrix * mb) { const size_t bs = 48; double * ds; const double * d1 = cpl_matrix_get_data_const(ma); const double * d2 = cpl_matrix_get_data_const(mb); const size_t nr = cpl_matrix_get_nrow(ma); const size_t nc = cpl_matrix_get_ncol(mb); const size_t nk = cpl_matrix_get_nrow(mb); size_t i, j, k, ib, jb, kb; cpl_ensure_code(ma != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(mb != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code((size_t)ma->nc == nk, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_matrix_set_size_(self, nr, nc)) return cpl_error_set_where_(); ds = cpl_matrix_get_data(self); /* simple blocking to reduce cache misses */ for (i = 0; i < nr; i += bs) { for (j = 0; j < nc; j += bs) { for (k = 0; k < nk; k += bs) { for (ib = i; ib < CX_MIN(i + bs, nr); ib++) { for (jb = j; jb < CX_MIN(j + bs, nc); jb++) { double sum = 0.; for (kb = k; kb < CX_MIN(k + bs, nk); kb++) { sum += d1[ib * nk + kb] * d2[kb * nc + jb]; } ds[ib * nc + jb] += sum; } } } } } cpl_tools_add_flops( 2 * (cpl_flops)(ma->nr * mb->nr * mb->nc) ); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Fill a matrix with the product of A * B' @param self The matrix to fill, is or else will be set to size M x N @param ma The matrix A, of size M x K @param mb The matrix B, of size N x K @return CPL_ERROR_NONE or the relevant CPL error code on error @note The use of the transpose of B causes a more efficient memory access @note Changing the order of A and B is allowed, it transposes the result @see cpl_matrix_product_create() */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_matrix_product_transpose(cpl_matrix * self, const cpl_matrix * ma, const cpl_matrix * mb) { double sum; double * ds; const double * d1 = cpl_matrix_get_data_const(ma); const double * d2 = cpl_matrix_get_data_const(mb); const double * di; const cpl_size nr = cpl_matrix_get_nrow(ma); const cpl_size nc = cpl_matrix_get_nrow(mb); const cpl_size nk = cpl_matrix_get_ncol(mb); cpl_size i, j, k; cpl_ensure_code(ma != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(mb != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(ma->nc == nk, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_matrix_set_size_(self, nr, nc)) return cpl_error_set_where_(); ds = cpl_matrix_get_data(self); for (i = 0; i < nr; i++, d1 += nk) { /* Since ma and mb are addressed in the same manner, they can use the same index, k */ di = d2; /* di points to first entry in i'th row */ for (j = 0; j < nc; j++, di += nk) { sum = 0.0; for (k = 0; k < nk; k++) { sum += d1[k] * di[k]; } ds[nc * i + j] = sum; } } cpl_tools_add_flops( 2 * (cpl_flops)(ma->nr * mb->nr * mb->nc) ); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Fill a matrix with the product of B * A * B' @param self The matrix to fill, is or else will be set to size N x N @param ma The matrix A, of size M x M @param mb The matrix B, of size N x M @return CPL_ERROR_NONE or the relevant CPL error code on error @note Requires 2 * N * M * (N + M) FLOPs and M doubles of temporary storage @see cpl_matrix_product_create() The intermediate result, C = A * B', is computed one column at a time, each column of C is then used once to compute one row of the final result. The performed sequence of floating point operations is exactly the same as in the combination of the two calls cpl_matrix_product_transpose(C, A, B); cpl_matrix_product_create(B, C); and the result is therefore also exactly identical. The difference lies in the reduced use of temporary storage and in the unit stride access, both of which lead to better performance (for large matrices). */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_matrix_product_bilinear(cpl_matrix * self, const cpl_matrix * ma, const cpl_matrix * mb) { double * ds; double * cj; /* Holds one column of A * B' */ const double * d1 = cpl_matrix_get_data_const(ma); const double * d2 = cpl_matrix_get_data_const(mb); const cpl_size nr = cpl_matrix_get_nrow(mb); const cpl_size nc = cpl_matrix_get_ncol(mb); cpl_size i, j, k; cpl_ensure_code(ma != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(mb != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(ma->nr == nc, CPL_ERROR_INCOMPATIBLE_INPUT); cpl_ensure_code(ma->nc == nc, CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_matrix_set_size_(self, nr, nr)) return cpl_error_set_where_(); ds = cpl_matrix_get_data(self); cj = cpl_malloc((size_t)nc * sizeof(*cj)); for (j = 0; j < nr; j++) { /* First compute the jth column of C = A * B', whose kth element is the dot-product of kth row of A and the jth row of B, both of which are read with unit stride. */ for (k = 0; k < nc; k++) { double sum = 0.0; for (i = 0; i < nc; i++) { sum += d1[nc * k + i] * d2[nc * j + i]; } cj[k] = sum; } /* Then compute (i, j)th element of the result, which is the dot-product of the ith row of B and the jth column of C, both of which are read with unit stride. */ for (i = 0; i < nr; i++) { double sum = 0.0; for (k = 0; k < nc; k++) { sum += d2[nc * i + k] * cj[k]; } ds[nr * i + j] = sum; } } cpl_free(cj); cpl_tools_add_flops( 2 * (cpl_flops)(nr * nc * (nc + nr)) ); return CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Solve a L*transpose(L)-system with a transposed Right Hand Side @param self N by N L*transpose(L)-matrix from cpl_matrix_decomp_chol() @param rhs M right-hand-sides to be replaced by their solution @return CPL_ERROR_NONE on success, or the relevant CPL error code @see cpl_matrix_solve_chol() @note Only the lower triangle of self is accessed @note The use of the transpose of rhs causes a more efficient memory access @error
CPL_ERROR_NULL_INPUT An input pointer is NULL.
CPL_ERROR_ILLEGAL_INPUT self is not an n by n matrix.
CPL_ERROR_INCOMPATIBLE_INPUT Selfs number of rows differs from rhs' number of columns.
CPL_ERROR_DIVISION_BY_ZERO The main diagonal of L contains a zero. This error can only occur if the L*transpose(L)-matrix does not come from a successful call to cpl_matrix_decomp_chol().
@enderror */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_matrix_solve_chol_transpose(const cpl_matrix * self, cpl_matrix * rhs) { const cpl_size n = cpl_matrix_get_ncol(self); const cpl_size nrhs = cpl_matrix_get_nrow(rhs); cpl_size i, j, k; const double * aread; const double * ai; double * bk; double sub; cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(rhs != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(self->nr == n, CPL_ERROR_ILLEGAL_INPUT); cpl_ensure_code(rhs->nc == n, CPL_ERROR_INCOMPATIBLE_INPUT); aread = self->m; /* bk points to first entry in k'th right hand side */ bk = rhs->m; for (k=0; k < nrhs; k++, bk += n) { /* Forward substitution in column k */ /* Since self and rhs are addressed in the same manner, they can use the same index, j */ ai = aread; /* ai points to first entry in i'th row */ for (i = 0; i < n; i++, ai += n) { sub = 0.0; for (j = 0; j < i; j++) { sub += ai[j] * bk[j]; } cpl_ensure_code(k > 0 || ai[j] != 0.0, CPL_ERROR_DIVISION_BY_ZERO); bk[j] = (bk[j] - sub) / ai[j]; } /* Back substitution in column k */ for (i = n-1; i >= 0; i--) { sub = bk[i]; for (j = i+1; j < n; j++) { sub -= aread[n * j + i] * bk[j]; } bk[i] = sub/aread[n * i + i]; } } cpl_tools_add_flops( 2 * (cpl_flops)(n * n * nrhs)); return CPL_ERROR_NONE; } cpl-6.4.1/cplcore/cpl_property.c0000644000460300003120000013417311654215745013552 00000000000000/* $Id: cpl_property.c,v 1.34 2011-11-02 10:31:01 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2011-11-02 10:31:01 $ * $Revision: 1.34 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include "cpl_error_impl.h" #include "cpl_property.h" /** * @defgroup cpl_property Properties * * This module implements the property type. The type @c cpl_property is * basically a variable container which consists of a name, a type identifier * and a specific value of that type. The type identifier always determines * the type of the associated value. A property is similar to an ordinary * variable and its current value can be set or retrieved through its name. In * addition a property may have a descriptive comment associated. * A property can be created for the basic types char, bool (int), int, * long, float and double. Also C strings are supported. Support for * arrays in general is currently not available. * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /* * The property value and property types */ typedef struct _cpl_property_value_ cpl_property_value; struct _cpl_property_value_ { cpl_type type; cxsize size; cxptr data; }; struct _cpl_property_ { cxchar *name; cxchar *comment; cpl_property_value *value; }; /* * Private methods */ inline static cpl_property_value * _cpl_property_value_new(cpl_type type, cxsize nelements, cxptr data) { cpl_property_value *value; cxsize size = (cxsize)cpl_type_get_sizeof(type); if (size == 0 || nelements == 0) return NULL; if (!(type & CPL_TYPE_FLAG_ARRAY)) nelements = 1; value = (cpl_property_value *) cx_malloc_clear(sizeof(cpl_property_value)); value->type = type; value->size = nelements; value->data = cx_malloc_clear(nelements * size); if (data) { memcpy(value->data, data, nelements * size); } else { memset(value->data, 0, nelements * size); } return value; } inline static void _cpl_property_value_delete(cpl_property_value *value) { cx_assert(value != NULL); if (value->data != NULL) cx_free(value->data); cx_free(value); return; } inline static cpl_property_value * _cpl_property_value_resize(cpl_property_value *value, cpl_type type, cxsize nelements) { cxsize sz = 0; cxptr tmp; cx_assert(value != NULL); cx_assert(value->type == type); cx_assert(nelements > 0); sz = (cxsize)cpl_type_get_sizeof(value->type); if (value->size != nelements) { sz *= nelements; tmp = cx_malloc_clear(sz); if (value->data != NULL) cx_free(value->data); value->data = tmp; value->size = nelements; } return value; } inline static int _cpl_property_value_set(cpl_property_value *value, cpl_type type, cxsize nelements, cxcptr data) { cxsize sz = 0; cx_assert(value != NULL); cx_assert(nelements > 0); sz = (cxsize)cpl_type_get_sizeof(value->type); if (value->type != type) { return 1; } /* * Resize the value if necessary. */ value = _cpl_property_value_resize(value, type, nelements); memcpy(value->data, data, sz * nelements); return 0; } inline static cxptr _cpl_property_value_get(cpl_property_value *value, cpl_type type, const cxchar *name) { cx_assert(value != NULL); if (value->type != type) { cx_assert(name != NULL); cpl_error_set(name, CPL_ERROR_TYPE_MISMATCH); return NULL; } return value->data; } /* * Public methods */ /** * @brief * Create an empty property of a given type. * * @param name Property name. * @param type Property type flag. * * @return * The newly created property, or @c NULL if it could not be created. In the * latter case an appropriate error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter name is a NULL pointer. *
CPL_ERROR_INVALID_TYPE * The requested property type type is not supported. *
* @enderror * * The function allocates memory for a property of type @em type and assigns * the identifier string @em name to the newly created property. * * The returned property must be destroyed using the property destructor * @b cpl_property_delete(). * * @see cpl_property_delete() */ cpl_property * cpl_property_new(const char *name, cpl_type type) { cxsize sz; cpl_property *property; if (name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } /* Type size is 0 for invalid types */ sz = (cxsize)cpl_type_get_sizeof(type); if (sz == 0) { cpl_error_set_(CPL_ERROR_INVALID_TYPE); return NULL; } property = cx_malloc(sizeof(cpl_property)); property->name = cx_strdup(name); property->value = _cpl_property_value_new(type, 1, NULL); property->comment = NULL; return property; } /** * @brief * Create an empty property of a given type and size. * * @param name Property name. * @param type Property type flag. * @param size Size of the property value. * * @return * The newly created property, or @c NULL if it could not be created. in * the latter case an appropriate error code is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter name is a NULL pointer. *
* @enderror * * The function allocates memory for a property of type @em type and assigns * the identifier string @em name to the newly created property. The * property value is created such that @em size elements of type @em type * can be stored. * * The returned property must be destroyed using the property destructor * @b cpl_property_delete(). * * @see cpl_property_delete() */ cpl_property * cpl_property_new_array(const char *name, cpl_type type, cpl_size size) { cxsize sz; cpl_property *property; if (name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } /* Type size is 0 for invalid types */ sz = (cxsize)cpl_type_get_sizeof(type); if (sz == 0) { return NULL; } property = cx_malloc(sizeof(cpl_property)); property->name = cx_strdup(name); property->value = _cpl_property_value_new(type, (cxsize)size, NULL); property->comment = NULL; return property; } /** * @brief * Create a copy of a property. * * @param other The property to copy. * * @return * The copy of the given property, or @c NULL in case of an error. * In the latter case an appropriate error code is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns a copy of the property @em self. The copy is a * deep copy, i.e. all property members are copied. */ cpl_property * cpl_property_duplicate(const cpl_property *other) { cpl_property *copy; if (other == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } copy = cx_malloc(sizeof(cpl_property)); copy->name = cx_strdup(other->name); if (other->value) { copy->value = _cpl_property_value_new(other->value->type, other->value->size, other->value->data); } if (other->comment) { copy->comment = cx_strdup(other->comment); } else { copy->comment = NULL; } return copy; } /** * @brief * Destroy a property. * * @param self The property. * * @return Nothing. * * The function destroys a property of any kind. All property members * including their values are properly deallocated. If the property @em self * is @c NULL, nothing is done and no error is set. */ void cpl_property_delete(cpl_property *self) { if (self) { if (self->comment) { cx_free(self->comment); } if (self->value) { _cpl_property_value_delete(self->value); } if (self->name) { cx_free(self->name); } cx_free(self); } return; } /** * @brief * Get the current number of elements a property contains. * * @param self The property. * * @return * The current number of elements or -1 in case of an error. If an * error occurred an appropriate error code is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns the current number of elements the property * @em self contains. This is the array size of the property's * value and in particular, for a property of the type * @c CPL_TYPE_STRING, it is the length of the string as * given by the @b strlen() function plus 1. */ cpl_size cpl_property_get_size(const cpl_property *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return -1; } return (cpl_size)self->value->size; } /** * @brief * Get the type of a property. * * @param self The property. * * @return * The type code of this property. In case of an error the returned * type code is @c CPL_TYPE_INVALID and an appropriate error code is * set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * This function returns the type of the data value stored in the * property @em self. */ cpl_type cpl_property_get_type(const cpl_property *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return CPL_TYPE_INVALID; } return self->value->type; } /** * @brief * Modify the name of a property. * * @param self The property. * @param name New name. * * @return * The function returns @c CPL_ERROR_NONE on success and an appropriate * error code if an error occurred. In the latter case the error code is * also set in the error handling system. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or name is a NULL * pointer. *
* @enderror * * The function replaces the current name of @em self with a copy * of the string @em name. The function returns an error if @em name is * @c NULL. */ cpl_error_code cpl_property_set_name(cpl_property *self, const char *name) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } if (!name) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } if (self->name) { cx_free(self->name); } self->name = cx_strdup(name); return CPL_ERROR_NONE; } /** * @brief * Modify a property's comment. * * @param self The property. * @param comment New comment. * * @return * The function returns @c CPL_ERROR_NONE on success and an appropriate * error code if an error occurred. In the latter case the error code is * also set in the error handling system. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or comment is a NULL * pointer. *
* @enderror * * The function replaces the current comment field of @em self with a * copy of the string @em comment. The new comment may be @c NULL. In this * case the function effectively deletes the current comment. */ cpl_error_code cpl_property_set_comment(cpl_property *self, const char *comment) { if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } if (self->comment) { cx_free(self->comment); } if (comment) { self->comment = cx_strdup(comment); } else { self->comment = NULL; } return CPL_ERROR_NONE; } /** * @brief * Set the value of a character property. * * @param self The property. * @param value New value. * * @return * The function returns @c CPL_ERROR_NONE on success and an appropriate * error code if an error occurred. In the latter case the error code is * also set in the error handling system. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_CHAR. *
* @enderror * * The function replaces the current character value of @em self with a * copy of the value @em value. */ cpl_error_code cpl_property_set_char(cpl_property *self, char value) { cxint status = 0; if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_assert(self->value != NULL); status = _cpl_property_value_set(self->value, CPL_TYPE_CHAR, 1, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } return CPL_ERROR_NONE; } /** * @brief * Set the value of a boolean property. * * @param self The property. * @param value New value. * * @return * The function returns @c CPL_ERROR_NONE on success and an appropriate * error code if an error occurred. In the latter case the error code is * also set in the error handling system. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_BOOL. *
* @enderror * * The function replaces the current boolean value of @em self with a * a 0, if @em value is equal to 0. If @em value is different from 0 any * previous value of @em self is replaced by a 1. */ cpl_error_code cpl_property_set_bool(cpl_property *self, int value) { cxint status = 0; if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_assert(self->value != NULL); value = value ? TRUE : FALSE; status = _cpl_property_value_set(self->value, CPL_TYPE_BOOL, 1, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } return CPL_ERROR_NONE; } /** * @brief * Set the value of an integer property. * * @param self The property. * @param value New value. * * @return * The function returns @c CPL_ERROR_NONE on success and an appropriate * error code if an error occurred. In the latter case the error code is * also set in the error handling system. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_INT. *
* @enderror * * The function replaces the current integer value of @em self with a * copy of the value @em value. */ cpl_error_code cpl_property_set_int(cpl_property *self, int value) { cxint status = 0; if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_assert(self->value != NULL); status = _cpl_property_value_set(self->value, CPL_TYPE_INT, 1, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } return CPL_ERROR_NONE; } /** * @brief * Set the value of a long property. * * @param self The property. * @param value New value. * * @return * The function returns @c CPL_ERROR_NONE on success and an appropriate * error code if an error occurred. In the latter case the error code is * also set in the error handling system. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_LONG. *
* @enderror * * The function replaces the current long value of @em self with a * copy of the value @em value. */ cpl_error_code cpl_property_set_long(cpl_property *self, long value) { cxint status = 0; if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_assert(self->value != NULL); status = _cpl_property_value_set(self->value, CPL_TYPE_LONG, 1, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } return CPL_ERROR_NONE; } /** * @brief * Set the value of a long long property. * * @param self The property. * @param value New value. * * @return * The function returns @c CPL_ERROR_NONE on success and an appropriate * error code if an error occurred. In the latter case the error code is * also set in the error handling system. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_LONG. *
* @enderror * * The function replaces the current long long value of @em self with a * copy of the value @em value. */ cpl_error_code cpl_property_set_long_long(cpl_property *self, long long value) { cxint status = 0; if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_assert(self->value != NULL); status = _cpl_property_value_set(self->value, CPL_TYPE_LONG_LONG, 1, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } return CPL_ERROR_NONE; } /** * @brief * Set the value of a float property. * * @param self The property. * @param value New value. * * @return * The function returns @c CPL_ERROR_NONE on success and an appropriate * error code if an error occurred. In the latter case the error code is * also set in the error handling system. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_FLOAT. *
* @enderror * * The function replaces the current float value of @em self with a * copy of the value @em value. */ cpl_error_code cpl_property_set_float(cpl_property *self, float value) { cxint status = 0; if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_assert(self->value != NULL); status = _cpl_property_value_set(self->value, CPL_TYPE_FLOAT, 1, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } return CPL_ERROR_NONE; } /** * @brief * Set the value of a double property. * * @param self The property. * @param value New value. * * @return * The function returns @c CPL_ERROR_NONE on success and an appropriate * error code if an error occurred. In the latter case the error code is * also set in the error handling system. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_DOUBLE. *
* @enderror * * The function replaces the current double value of @em self with a * copy of the value @em value. */ cpl_error_code cpl_property_set_double(cpl_property *self, double value) { cxint status = 0; if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_assert(self->value != NULL); status = _cpl_property_value_set(self->value, CPL_TYPE_DOUBLE, 1, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } return CPL_ERROR_NONE; } /** * @brief * Set the value of a string property. * * @param self The property. * @param value New value. * * @return * The function returns @c CPL_ERROR_NONE on success and an appropriate * error code if an error occurred. In the latter case the error code is * also set in the error handling system. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self or value is a NULL * pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_STRING. *
* @enderror * * The function replaces the current string value of @em self with a * copy of the value @em value. */ cpl_error_code cpl_property_set_string(cpl_property *self, const char *value) { cxint status = 0; cxsize len; if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } if (value == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_assert(self->value != NULL); /* * Determine the length of the string value and add 1 for the * trailing 0. */ len = (cxsize) strlen(value) + 1; status = _cpl_property_value_set(self->value, CPL_TYPE_STRING, len, (cxcptr)value); if (status) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } return CPL_ERROR_NONE; } /** * @brief * Set the value of a complex float property. * * @param self The property. * @param value New value. * * @return * The function returns @c CPL_ERROR_NONE on success and an appropriate * error code if an error occurred. In the latter case the error code is * also set in the error handling system. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type * CPL_TYPE_COMPLEX_FLOAT. *
* @enderror * * The function replaces the current complex float value of @em self with a * copy of the value @em value. */ cpl_error_code cpl_property_set_float_complex(cpl_property *self, float complex value) { cxint status = 0; if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_assert(self->value != NULL); status = _cpl_property_value_set(self->value, CPL_TYPE_FLOAT_COMPLEX, 1, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } return CPL_ERROR_NONE; } /** * @brief * Set the value of a double complex property. * * @param self The property. * @param value New value. * * @return * The function returns @c CPL_ERROR_NONE on success and an appropriate * error code if an error occurred. In the latter case the error code is * also set in the error handling system. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type * CPL_TYPE_DOUBLE_COMPLEX. *
* @enderror * * The function replaces the current double value of @em self with a * copy of the value @em value. */ cpl_error_code cpl_property_set_double_complex(cpl_property *self, double complex value) { cxint status = 0; if (self == NULL) { return cpl_error_set_(CPL_ERROR_NULL_INPUT); } cx_assert(self->value != NULL); status = _cpl_property_value_set(self->value, CPL_TYPE_DOUBLE_COMPLEX, 1, (cxcptr)&value); if (status) { return cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); } return CPL_ERROR_NONE; } /** * @brief * Get the property name. * * @param self The property. * * @return * The name of the property or @c NULL if an error occurred. In the * latter case an appropriate error code is set. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns a handle for the read-only identifier string of @em self. */ const char * cpl_property_get_name(const cpl_property *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } return self->name; } /** * @brief * Get the property comment. * * @param self The property. * * @return * The comment of the property if it is present or @c NULL. If an error * occurrs the function returns @c NULL and sets an appropriate error code. * * @error * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
* @enderror * * The function returns a handle for the read-only comment string of @em self. */ const char * cpl_property_get_comment(const cpl_property *self) { if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if (!self->comment) { return NULL; } return self->comment; } /** * @brief * Get the value of a character property. * * @param self The property. * * @return * The current property value. If an error occurs the function returns * '\\0' and an appropriate error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_CHAR. *
* @enderror * * The function retrieves the character value currently stored in the * property @em self. */ char cpl_property_get_char(const cpl_property *self) { cxptr result; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return '\0'; } cx_assert(self->value != NULL); result = _cpl_property_value_get(self->value, CPL_TYPE_CHAR, cpl_func); if (!result) { return '\0'; } return *((char *)result); } /** * @brief * Get the value of a boolean property. * * @param self The property. * * @return * The current property value. If an error occurs the function returns * 0 and an appropriate error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_BOOL. *
* @enderror * * The function retrieves the boolean value currently stored in the * property @em self. */ int cpl_property_get_bool(const cpl_property *self) { cxptr result; cxbool val; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } cx_assert(self->value != NULL); result = _cpl_property_value_get(self->value, CPL_TYPE_BOOL, cpl_func); if (!result) { return 0; } val = *((cxbool *)result); return val == TRUE ? 1 : 0; } /** * @brief * Get the value of an integer property. * * @param self The property. * * @return * The current property value. If an error occurs the function returns * 0 and an appropriate error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_INT. *
* @enderror * * The function retrieves the integer value currently stored in the * property @em self. */ int cpl_property_get_int(const cpl_property *self) { cxptr result; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return 0; } cx_assert(self->value != NULL); result = _cpl_property_value_get(self->value, CPL_TYPE_INT, cpl_func); if (!result) { return 0; } return *((int *)result); } /** * @brief * Get the value of a long property. * * @param self The property. * * @return * The current property value. If an error occurs the function returns * 0 and an appropriate error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_LONG * or CPL_TYPE_INT. *
* @enderror * * The function retrieves the value currently stored in the property @em self * as a long integer. The function accepts properties of integer type * with a rank less or equal than the function's return type. */ long cpl_property_get_long(const cpl_property *self) { cxlong value = 0; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return value; } cx_assert(self->value != NULL); /* * If the property self is of the same kind, but of a smaller rank, * promote the property's value to the target type. */ switch (self->value->type) { case CPL_TYPE_INT: { cxint *result = _cpl_property_value_get(self->value, CPL_TYPE_INT, cpl_func); value = *result; break; } case CPL_TYPE_LONG: { cxlong *result = _cpl_property_value_get(self->value, CPL_TYPE_LONG, cpl_func); value = *result; break; } default: { cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); break; } } return value; } /** * @brief * Get the value of a long long property. * * @param self The property. * * @return * The current property value. If an error occurs the function returns * 0 and an appropriate error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_LONG_LONG, * CPL_TYPE_LONG, or CPL_TYPE_INT. *
* @enderror * * The function retrieves the value currently stored in the property @em self * as a long long integer. The function accepts properties of integer type * with a rank less or equal than the function's return type. */ long long cpl_property_get_long_long(const cpl_property *self) { long long value = 0; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return value; } cx_assert(self->value != NULL); /* * If the property self is of the same kind, but of a smaller rank, * promote the property's value to the target type. */ switch (self->value->type) { case CPL_TYPE_INT: { cxint *result = _cpl_property_value_get(self->value, CPL_TYPE_INT, cpl_func); value = *result; break; } case CPL_TYPE_LONG: { cxlong *result = _cpl_property_value_get(self->value, CPL_TYPE_LONG, cpl_func); value = *result; break; } case CPL_TYPE_LONG_LONG: { long long *result = _cpl_property_value_get(self->value, CPL_TYPE_LONG_LONG, cpl_func); value = *result; break; } default: { cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); break; } } return value; } /** * @brief * Get the value of a float property. * * @param self The property. * * @return * The current property value. If an error occurs the function returns * 0. and an appropriate error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_FLOAT * or CPL_TYPE_DOUBLE. *
* @enderror * * The function retrieves the value currently stored in the property @em self * as a float. The function also accepts properties of type double and returns * the property value as float. * * @note * Calling the function for a property of type double may lead to * truncation errors! */ float cpl_property_get_float(const cpl_property *self) { cxfloat value = 0.; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return value; } cx_assert(self->value != NULL); /* * If the property self is of type double cast it to float. * This may lead to truncation errors! */ switch (self->value->type) { case CPL_TYPE_FLOAT: { cxfloat *result = _cpl_property_value_get(self->value, CPL_TYPE_FLOAT, cpl_func); value = *result; break; } case CPL_TYPE_DOUBLE: { cxdouble *result = _cpl_property_value_get(self->value, CPL_TYPE_DOUBLE, cpl_func); value = (cxfloat)(*result); break; } default: { cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); break; } } return value; } /** * @brief * Get the value of a double property. * * @param self The property. * * @return * The current property value. If an error occurs the function returns * 0. and an appropriate error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_DOUBLE * or CPL_TYPE_FLOAT. *
* @enderror * * The function retrieves the value currently stored in the property @em self * as a double. The function accepts properties of a floating-point type * with a rank less or equal than the function's return type. */ double cpl_property_get_double(const cpl_property *self) { cxdouble value = 0.; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return value; } cx_assert(self->value != NULL); /* * If the property self is of the same kind, but of a smaller rank, * promote the property's value to the target type. */ switch (self->value->type) { case CPL_TYPE_FLOAT: { cxfloat *result = _cpl_property_value_get(self->value, CPL_TYPE_FLOAT, cpl_func); value = *result; break; } case CPL_TYPE_DOUBLE: { cxdouble *result = _cpl_property_value_get(self->value, CPL_TYPE_DOUBLE, cpl_func); value = *result; break; } default: { cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); break; } } return value; } /** * @brief * Get the value of a string property. * * @param self The property. * * @return * The current property value. If an error occurs the function returns * @c NULL and an appropriate error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type CPL_TYPE_STRING. *
* @enderror * * The function retrieves the string value currently stored in the * property @em self. */ const char * cpl_property_get_string(const cpl_property *self) { cxptr result; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } cx_assert(self->value != NULL); result = _cpl_property_value_get(self->value, CPL_TYPE_STRING, cpl_func); if (!result) { return NULL; } return (const char *)result; } /** * @brief * Get the value of a float complex property. * * @param self The property. * * @return * The current property value. If an error occurs the function returns * 0. and an appropriate error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type * CPL_TYPE_FLOAT_COMPLEX or * CPL_TYPE_DOUBLE_COMPLEX. *
* @enderror * * The function retrieves the value currently stored in the property @em self * as a float complex. The function also accepts properties of type * double complex and returns the property value as float complex. * * @note * Calling the function for a property of type double complex may lead to * truncation errors! */ float complex cpl_property_get_float_complex(const cpl_property *self) { float complex value = 0.; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return value; } cx_assert(self->value != NULL); /* * If the property self is of type double cast it to float. * This may lead to truncation errors! */ switch (self->value->type) { case CPL_TYPE_FLOAT_COMPLEX: { float complex *result = _cpl_property_value_get(self->value, CPL_TYPE_FLOAT_COMPLEX, cpl_func); value = *result; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *result = _cpl_property_value_get(self->value, CPL_TYPE_DOUBLE_COMPLEX, cpl_func); value = (float complex)(*result); break; } default: { cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); break; } } return value; } /** * @brief * Get the value of a double complex property. * * @param self The property. * * @return * The current property value. If an error occurs the function returns * 0. and an appropriate error code is set. * * @error * * * * * * * * * *
CPL_ERROR_NULL_INPUT * The parameter self is a NULL pointer. *
CPL_ERROR_TYPE_MISMATCH * The property self is not of type * CPL_TYPE_DOUBLE_COMPLEX or * CPL_TYPE_FLOAT_COMPLEX. *
* @enderror * * The function retrieves the value currently stored in the property @em self * as a double complex. The function accepts properties of a complex type * with a rank less or equal than the function's return type. */ double complex cpl_property_get_double_complex(const cpl_property *self) { double complex value = 0.; if (self == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return value; } cx_assert(self->value != NULL); /* * If the property self is of the same kind, but of a smaller rank, * promote the property's value to the target type. */ switch (self->value->type) { case CPL_TYPE_FLOAT_COMPLEX: { float complex *result = _cpl_property_value_get(self->value, CPL_TYPE_FLOAT_COMPLEX, cpl_func); value = *result; break; } case CPL_TYPE_DOUBLE_COMPLEX: { double complex *result = _cpl_property_value_get(self->value, CPL_TYPE_DOUBLE_COMPLEX, cpl_func); value = *result; break; } default: { cpl_error_set_(CPL_ERROR_TYPE_MISMATCH); break; } } return value; } /**@}*/ cpl-6.4.1/cplcore/cpl_polynomial.h0000644000460300003120000001253111672113222014032 00000000000000/* $Id: cpl_polynomial.h,v 1.40 2011-12-14 12:29:06 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-12-14 12:29:06 $ * $Revision: 1.40 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_POLYNOMIAL_H #define CPL_POLYNOMIAL_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include "cpl_vector.h" #include "cpl_bivector.h" #include "cpl_error.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ typedef struct _cpl_polynomial_ cpl_polynomial; /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* cpl_polynomial handling */ cpl_polynomial * cpl_polynomial_new(cpl_size) CPL_ATTR_ALLOC; void cpl_polynomial_delete(cpl_polynomial *); cpl_error_code cpl_polynomial_dump(const cpl_polynomial *, FILE *); cpl_polynomial * cpl_polynomial_duplicate(const cpl_polynomial *) CPL_ATTR_ALLOC; cpl_error_code cpl_polynomial_copy(cpl_polynomial *, const cpl_polynomial *); /* Accessor functions */ double cpl_polynomial_get_coeff(const cpl_polynomial *, const cpl_size *); cpl_error_code cpl_polynomial_set_coeff(cpl_polynomial *, const cpl_size *, double); /* Basic operations */ int cpl_polynomial_compare(const cpl_polynomial *, const cpl_polynomial *, double tol); cpl_size cpl_polynomial_get_dimension(const cpl_polynomial *); cpl_size cpl_polynomial_get_degree(const cpl_polynomial *); double cpl_polynomial_eval(const cpl_polynomial *, const cpl_vector *); cpl_polynomial * cpl_polynomial_extract(const cpl_polynomial *, cpl_size, const cpl_polynomial *) CPL_ATTR_ALLOC; cpl_error_code cpl_polynomial_add(cpl_polynomial *, const cpl_polynomial *, const cpl_polynomial *); cpl_error_code cpl_polynomial_subtract(cpl_polynomial *, const cpl_polynomial *, const cpl_polynomial *); cpl_error_code cpl_polynomial_multiply_scalar(cpl_polynomial *, const cpl_polynomial *, double); cpl_error_code cpl_polynomial_derivative(cpl_polynomial *, cpl_size); cpl_error_code cpl_polynomial_fit(cpl_polynomial *, const cpl_matrix *, const cpl_boolean *, const cpl_vector *, const cpl_vector *, cpl_boolean , const cpl_size *, const cpl_size *); cpl_error_code cpl_vector_fill_polynomial_fit_residual(cpl_vector *, const cpl_vector *, const cpl_vector *, const cpl_polynomial *, const cpl_matrix *, double *); /* Basic operations on 1d-polynomials */ double cpl_polynomial_eval_1d(const cpl_polynomial *, double, double *); double cpl_polynomial_eval_1d_diff(const cpl_polynomial *, double, double, double *); cpl_error_code cpl_vector_fill_polynomial(cpl_vector *, const cpl_polynomial *, double, double); cpl_error_code cpl_polynomial_solve_1d(const cpl_polynomial *, double, double *, cpl_size); cpl_error_code cpl_polynomial_shift_1d(cpl_polynomial *, cpl_size, double); cpl_polynomial * cpl_polynomial_fit_1d_create(const cpl_vector *, const cpl_vector *, cpl_size, double *) CPL_ATTR_DEPRECATED; /* Basic operations on 2d-polynomials */ cpl_polynomial * cpl_polynomial_fit_2d_create(cpl_bivector *, cpl_vector *, cpl_size, double *) CPL_ATTR_DEPRECATED; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_image.h0000644000460300003120000000502511466733006012742 00000000000000/* $Id: cpl_image.h,v 1.51 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2010-11-11 09:23:18 $ * $Revision: 1.51 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_IMAGE_H #define CPL_IMAGE_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image_io.h" #include "cpl_image_basic.h" #include "cpl_image_iqe.h" #include "cpl_image_bpm.h" #include "cpl_image_resample.h" #include "cpl_image_stats.h" #include "cpl_image_filter.h" #include "cpl_image_gen.h" /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_image Images * * This module provides functions to create, use, and destroy a @em cpl_image. * A @em cpl_image is a 2-dimensional data structure with a pixel type * (one of @c CPL_TYPE_INT, @c CPL_TYPE_FLOAT, @c CPL_TYPE_DOUBLE, * @c CPL_TYPE_FLOAT_COMPLEX or @c CPL_TYPE_DOUBLE_COMPLEX) and an * optional bad pixel map. * * The pixel indexing follows the FITS convention in the sense that the * lower left pixel in a CPL image has index (1, 1). The pixel buffer is * stored row-wise so for optimum performance any pixel-wise access should * be done likewise. * * Functionality include: * FITS I/O * Image arithmetic, casting, extraction, thresholding, filtering, resampling * Bad pixel handling * Image statistics * Generation of test images * Special functions, such as the image quality estimator * * @par Synopsis: * @code * #include "cpl_image.h" * @endcode */ /*----------------------------------------------------------------------------*/ #endif cpl-6.4.1/cplcore/cpl_array_impl.h0000644000460300003120000000253012136507162014012 00000000000000/* $Id: cpl_array_impl.h,v 1.6 2013-04-26 14:25:54 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-04-26 14:25:54 $ * $Revision: 1.6 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_ARRAY_IMPL_H #define CPL_ARRAY_IMPL_H #include "cpl_column.h" #include "cpl_array.h" CPL_BEGIN_DECLS cpl_column *cpl_array_get_column(cpl_array *); const cpl_column *cpl_array_get_column_const(const cpl_array *); cpl_error_code cpl_array_set_column(cpl_array *, cpl_column *); CPL_END_DECLS #endif /* end of cpl_array_impl.h */ cpl-6.4.1/cplcore/cpl_image_resample_body.h0000644000460300003120000002147312243356112015645 00000000000000/* $Id: cpl_image_resample_body.h,v 1.25 2011-07-20 11:20:40 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Type dependent macros */ #if CPL_CLASS == CPL_CLASS_DOUBLE #define CPL_TYPE double #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE_INTERPOLATE cpl_image_get_interpolated_double #elif CPL_CLASS == CPL_CLASS_FLOAT #define CPL_TYPE float #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE_INTERPOLATE cpl_image_get_interpolated_float #elif CPL_CLASS == CPL_CLASS_INT #define CPL_TYPE int #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE_INTERPOLATE cpl_image_get_interpolated_int #else #undef CPL_TYPE #undef CPL_TYPE_T #define CPL_TYPE_INTERPOLATE #endif #if defined CPL_OPERATION && CPL_OPERATION == CPL_IMAGE_RESAMPLE_SUBSAMPLE case CPL_TYPE_T: { const CPL_TYPE *pi; CPL_TYPE *po; out_im = cpl_image_new(new_nx, new_ny, CPL_TYPE_T); pi = (CPL_TYPE*)image->pixels; po = (CPL_TYPE*)out_im->pixels; for (j = 0; j < image->ny; j += ystep, pi += ystep*image->nx) for (i = 0; i < image->nx; i += xstep) *po++ = pi[i]; } break; #elif defined CPL_OPERATION && CPL_OPERATION == CPL_IMAGE_REBIN case CPL_TYPE_T: { const CPL_TYPE *pi; CPL_TYPE *po; out_im = cpl_image_new(new_nx, new_ny, CPL_TYPE_T); pi = (CPL_TYPE*)image->pixels; po = (CPL_TYPE*)out_im->pixels; for (j = ystart - 1; j < ny; j++) { for (i = xstart - 1; i < nx; i++) { po[(i-xstart+1)/xstep + ((j-ystart+1)/ystep)*new_nx] += pi[i + j*old_nx]; } } } break; #elif defined CPL_OPERATION && CPL_OPERATION == CPL_IMAGE_WARP case CPL_TYPE_T: /* Double loop on the output image */ for (j=0; j < out->ny; j++) { for (i=0; i < out->nx; i++) { /* Compute the original source for this pixel */ pos = i + j * out->nx; x = (double)(i+1) - pdeltax[pos]; y = (double)(j+1) - pdeltay[pos]; /* Compute the new value */ value = CPL_TYPE_INTERPOLATE ((const CPL_TYPE*)in->pixels, in->bpm ? cpl_mask_get_data_const(in->bpm) : NULL, in->nx, in->ny, xtabsperpix, ytabsperpix, x, y, yweight, pxprof, xradius, pyprof, yradius, sqyradius, sqyxratio, &confidence); if (confidence > 0) cpl_image_set(out, i+1, j+1, value); else { pbad[i + j * out->nx] = CPL_BINARY_1; hasbad = 1; } } } break; #elif defined CPL_OPERATION && CPL_OPERATION == CPL_IMAGE_WARP_POLYNOMIAL case CPL_TYPE_T: /* Double loop on the output image */ for (j=0; j < out->ny; j++) { pval[1] = (double)(j+1); for (i=0; i < out->nx; i++) { pval[0] = (double)(i+1); /* The CPL-calls here cannot fail */ /* Compute the original source for this pixel */ x = cpl_polynomial_eval(poly_x, val); y = cpl_polynomial_eval(poly_y, val); value = CPL_TYPE_INTERPOLATE ((const CPL_TYPE*)in->pixels, in->bpm ? cpl_mask_get_data_const(in->bpm) : NULL, in->nx, in->ny, xtabsperpix, ytabsperpix, x, y, yweight, pxprof, xradius, pyprof, yradius, sqyradius, sqyxratio, &confidence); if (confidence > 0) cpl_image_set(out, i+1, j+1, value); else { pbad[i + j * out->nx] = CPL_BINARY_1; hasbad = 1; } } } break; #else #ifdef ADDTYPE #undef ADDTYPE #endif #define ADDTYPE(a) CONCAT2X(a,CPL_TYPE) /*----------------------------------------------------------------------------*/ /** @brief Interpolate a pixel @see cpl_image_get_interpolated() For efficiency reasons the caller must ensure that all arguments are valid. Specifically, this function must be called with an image of the correct pixel type. */ /*----------------------------------------------------------------------------*/ inline static double ADDTYPE(cpl_image_get_interpolated)(const CPL_TYPE * pixel, const cpl_binary * bpm, cpl_size nx, cpl_size ny, double xtabsperpix, double ytabsperpix, double xpos, double ypos, double * yweight, const double * pxprof, double xradius, const double * pyprof, double yradius, double sqyradius, double sqyxratio, double * pconfid) { double sum = 0; double wsum = 0; double wconf = 0; double wabs = 0; double xdel; double sqrest; double xweight; double ydel; double value, weight; /* These image positions can become negative */ const intptr_t xfirst = (intptr_t)ceil (xpos - xradius); const intptr_t xlast = (intptr_t)floor(xpos + xradius); const intptr_t yfirst = (intptr_t)ceil (ypos - yradius); const intptr_t ylast = (intptr_t)floor(ypos + yradius); cpl_flops skipped = 0; intptr_t x, y; #if 0 assert( pixel != NULL ); assert( nx > 0 ); assert( ny > 0 ); assert( xradius > 0 ); assert( yradius > 0 ); assert( yweight != NULL ); assert( pxprof != NULL ); assert( pyprof != NULL ); assert( pconfid != NULL ); #endif if (xfirst > xlast || yfirst > ylast) { /* For sufficiently small radii no pixels can be reached */ *pconfid = 0; return 0.0; } /* Generate weights for all points in the Y-direction */ for (y = yfirst; y <= ylast; y++) yweight[(size_t)(y-yfirst)] = pyprof[(size_t)(fabs((double)y - ypos) * ytabsperpix+0.5)]; /* Iterate through all the points in the X-direction */ for (x = xfirst; x <= xlast; x++) { xdel = (double)x - xpos; sqrest = sqyradius - xdel*xdel*sqyxratio; xweight = pxprof[(size_t)(fabs(xdel) * xtabsperpix+0.5)]; /* Iterate through all the points in the Y-direction */ for (y = yfirst; y <= ylast; y++) { ydel = (double)y - ypos; if (ydel*ydel > sqrest) { skipped += 8; continue; } /* (x,y) is within the ellipse with semi-major and -minor (xradius, yradius) at (xpos, ypos) */ /* The pixel weight is the product of the two 1D-profiles */ weight = xweight * yweight[(size_t)(y-yfirst)]; /* Sum of all absolute weights in the inclusion area */ wconf += fabs(weight); if (x < 1 || y < 1 || x > (intptr_t)nx || y > (intptr_t)ny) { skipped += 5; continue; } if (bpm != NULL && bpm[(size_t)((x-1) + (y-1) * nx)] != CPL_BINARY_0) { skipped += 5; continue; } value = pixel[(size_t)((x-1) + (y-1) * nx)]; /* Sum of weigths actually used */ wsum += weight; /* Sum of absolute weigths actually used */ wabs += fabs(weight); /* Weighted pixel sum */ sum += value * weight; } } /* The confidence is the ratio of the absolute weights used over the sum of all absolute weights inside the inclusion area */ *pconfid = wconf > 0 ? wabs / wconf : 0; cpl_tools_add_flops( 3 * ( ylast - yfirst + 1) + 6 * ( xlast - xfirst + 1) + 11* ( ylast - yfirst + 1) * ( xlast - xfirst + 1) - skipped ); return wsum > 0.0 ? sum / wsum : 0.0; } #endif #undef CPL_TYPE #undef CPL_TYPE_T #undef CPL_TYPE_INTERPOLATE cpl-6.4.1/cplcore/cpl_mask_binary.h0000644000460300003120000001302512272176370014157 00000000000000/* $Id: cpl_mask_binary.h,v 1.7 2012-01-20 13:52:19 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /*----------------------------------------------------------------------------*/ /** @internal @brief Perform the bitwise operation @param self Pre-allocated buffer to hold the result @param first First operand, or NULL for an in-place operation @param second Second operand @param nxy The number of elements @return void @note No error checking in this internal function! */ /*----------------------------------------------------------------------------*/ void APPENDOPER(CPL_MASK_BINARY_WOPER)(cpl_binary * self, const cpl_binary * first, const cpl_binary * second, size_t nxy) { CPL_MASK_REGISTER_TYPE * word0 = (CPL_MASK_REGISTER_TYPE*)self; const CPL_MASK_REGISTER_TYPE* word1 = first ? (const CPL_MASK_REGISTER_TYPE*)first : (const CPL_MASK_REGISTER_TYPE*)self; const CPL_MASK_REGISTER_TYPE* word2 = (const CPL_MASK_REGISTER_TYPE*)second; const size_t nword = nxy / CPL_MASK_REGISTER_SIZE; size_t i; for (i = 0; i < nword; i++) { #if CPL_MASK_REGISTER_SIZE == 16 #ifndef __SSE2__ #error "For 16-byte processing __SSE2__ must be defined" #endif /* Assume unaligned data. With load of aligned data gcc can perform the operation directly on an address operand and thus avoid one load */ const __m128i v1 = _mm_loadu_si128(word1 + i); const __m128i v2 = _mm_loadu_si128(word2 + i); const __m128i v0 = OPER2MM(CPL_MASK_BINARY_WOPER)(v1, v2); _mm_storeu_si128(word0 + i, v0); #else word0[i] = word1[i] CPL_MASK_BINARY_OPER word2[i]; #endif } i *= CPL_MASK_REGISTER_SIZE; if (first == NULL) { for (; i < nxy; i++) { self[i] = self[i] CPL_MASK_BINARY_OPER second[i]; } } else { for (; i < nxy; i++) { self[i] = first[i] CPL_MASK_BINARY_OPER second[i]; } } } /*----------------------------------------------------------------------------*/ /** @internal @brief Perform the bitwise operation @param self Pre-allocated buffer to hold the result @param first First operand, or NULL for an in-place operation @param second Second operand (scalar) @param nxy The number of elements @return void @note No error checking in this internal function! */ /*----------------------------------------------------------------------------*/ void APPENDOPERS(CPL_MASK_BINARY_WOPER)(cpl_binary * self, const cpl_binary * first, cpl_bitmask second, size_t nxy) { CPL_MASK_REGISTER_TYPE * word0 = (CPL_MASK_REGISTER_TYPE*)self; const CPL_MASK_REGISTER_TYPE* word1 = first ? (const CPL_MASK_REGISTER_TYPE*)first : (const CPL_MASK_REGISTER_TYPE*)self; const size_t nword = nxy / CPL_MASK_REGISTER_SIZE; size_t i; for (i = 0; i < nword; i++) { #if CPL_MASK_REGISTER_SIZE == 16 #ifndef __SSE2__ #error "For 16-byte processing __SSE2__ must be defined" #endif /* Process two cpl_bitmasks in each iteration */ /* Assume unaligned data. With load of aligned data gcc can perform the operation directly on an address operand and thus avoid one load */ const __m128i v1 = _mm_loadu_si128(word1 + i); const __m128i v2 = _mm_set1_epi64((__m64)second); const __m128i v0 = OPER2MM(CPL_MASK_BINARY_WOPER)(v1, v2); _mm_storeu_si128(word0 + i, v0); #else word0[i] = word1[i] CPL_MASK_BINARY_OPER (CPL_MASK_REGISTER_TYPE)second; #endif } i *= CPL_MASK_REGISTER_SIZE; #if CPL_MASK_REGISTER_SIZE > 4 #if CPL_MASK_REGISTER_SIZE > 8 if (i + 8 <= nxy) { /* Handle the remaining uint64_t */ uint64_t * self8 = (uint64_t *)self; const uint64_t * first8 = (const uint64_t *)(first ? first : self); self8[i/8] = first8[i/8] CPL_MASK_BINARY_OPER (uint64_t)second; i += 8; } #endif if (i + 4 <= nxy) { /* Handle the remaining uint32_t */ uint32_t * self4 = (uint32_t *)self; const uint32_t * first4 = (const uint32_t *)(first ? first : self); self4[i/4] = first4[i/4] CPL_MASK_BINARY_OPER (uint32_t)second; i += 4; } #endif if (first == NULL) { for (; i < nxy; i++) { self[i] = self[i] CPL_MASK_BINARY_OPER (cpl_binary)second; } } else { for (; i < nxy; i++) { self[i] = first[i] CPL_MASK_BINARY_OPER (cpl_binary)second; } } } cpl-6.4.1/cplcore/cpl_cfitsio.c0000644000460300003120000001215512242411644013307 00000000000000/* $Id: cpl_cfitsio.c,v 1.77 2012-12-10 13:20:33 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2013 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-12-10 13:20:33 $ * $Revision: 1.77 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_cfitsio.h" /* The below doxygen has been inactivated by removing the '**' comment. */ /*----------------------------------------------------------------------------*/ /* * @defgroup cpl_cfitsio Wrap around CFITSIO functions dropping const * modifiers that the functions should have. * * The purpose is to limit all the const-correctness warnings to a single file. * * @par Synopsis: * @code * #include "cpl_cfitsio.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Function definitions -----------------------------------------------------------------------------*/ CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual); /** * @internal * @brief Wrap around the CFISTIO function dropping const modifiers that the * CFITSIO function should have. * @see fits_read_subset() */ int cpl_fits_read_subset(fitsfile *fptr, int datatype, const long *blc, const long *trc, const long *inc, const void *nulval, void *array, int *anynul, int *status) { return fits_read_subset(fptr, datatype, (long*)blc, (long*)trc, (long*)inc, (void*)nulval, array, anynul,status); } /** * @internal * @brief Wrap around the CFISTIO function dropping const modifiers that the * CFITSIO function should have. * @see fits_read_subset() */ int cpl_fits_write_pix(fitsfile *fptr, int datatype, const long *firstpix, LONGLONG nelem, const void *array, int *status) { return fits_write_pix(fptr, datatype, (long*)firstpix, nelem, (void*)array, status); } #ifdef fits_write_pixll /** * @internal * @brief Wrap around the CFISTIO function dropping const modifiers that the * CFITSIO function should have. * @see fits_read_subset() */ int cpl_fits_write_pixll(fitsfile *fptr, int datatype, const LONGLONG *firstpix, LONGLONG nelem, const void *array, int *status) { return fits_write_pixll(fptr, datatype, (LONGLONG*)firstpix, nelem, (void*)array, status); } #endif /** * @internal * @brief Wrap around the CFISTIO function dropping const modifiers that the * CFITSIO function should have. * @see fits_read_subset() */ int cpl_fits_create_img(fitsfile *fptr, int bitpix, int naxis, const long *naxes, int *status) { return fits_create_img(fptr, bitpix, naxis, (long *)naxes, status); } #ifdef fits_create_imgll /** * @internal * @brief Wrap around the CFISTIO function dropping const modifiers that the * CFITSIO function should have. * @see fits_read_subset() */ int cpl_fits_create_imgll(fitsfile *fptr, int bitpix, int naxis, const LONGLONG *naxes, int *status) { return fits_create_imgll(fptr, bitpix, naxis, (LONGLONG *)naxes, status); } #endif /** * @internal * @brief Wrap around the CFISTIO function dropping const modifiers that the * CFITSIO function should have. * @see fits_read_subset() */ int cpl_fits_read_pix(fitsfile *fptr, int datatype, const long *firstpix, LONGLONG nelem, const void *nulval, void *array, int *anynul, int *status) { return fits_read_pix(fptr, datatype, (long*)firstpix, nelem, (void*)nulval, array, anynul, status); } #ifdef fits_read_pixll /** * @internal * @brief Wrap around the CFISTIO function dropping const modifiers that the * CFITSIO function should have. * @see fits_read_subset() */ int cpl_fits_read_pixll(fitsfile *fptr, int datatype, const LONGLONG *firstpix, LONGLONG nelem, const void *nulval, void *array, int *anynul, int *status) { return fits_read_pixll(fptr, datatype, (LONGLONG*)firstpix, nelem, (void*)nulval, array, anynul, status); } #endif CPL_DIAG_PRAGMA_POP; /**@}*/ cpl-6.4.1/cplcore/cpl_io_fits.c0000644000460300003120000007517112061360641013311 00000000000000/* $Id: cpl_io_fits.c,v 1.77 2012-12-10 13:20:33 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-12-10 13:20:33 $ * $Revision: 1.77 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H #include #endif #include "cpl_io_fits.h" #include #include #include #include #ifdef _OPENMP #include #else #define omp_get_thread_num() 0 #endif /* The below doxygen has been inactivated by removing the '**' comment. */ /*----------------------------------------------------------------------------*/ /* * @defgroup cpl_io_fits Optimize open and close of FITS files * * The CPL API for FITS I/O passes only the FITS file name, and per default * opens and closes each file for each I/O operation. Since the FITS standard * does not allow random access to a given extension, the open/close approach * causes the writing of a file with N extensions to have complexity O(N^2). * The same is true for reading all N extensions. * * The complexity of those operations can be reduced to the expected O(N) by * keeping the FITS files open between operations. This is done with * static (thread-shared) storage of the relevant data. * * In a multi-threaded environment it is assumed that if one thread enters * a CPL FITS save function for a given file, then there are no concurrent * threads inside a CPL FITS I/O function for the same file. Consequently, in a * multi-threaded environment it is assumed that if one thread enters a CPL FITS * load function for a given file, then there are no concurrent threads inside a * CPL FITS save function. * * This means that it is safe to let different threads take turns using the * same read/write handle (for reading and/or writing). * * A handle for read-only is only used by the creating thread, this allows * different threads to read from different parts of the same file. * * The unit tests in cplcore/tests/cpl_io_fits-test.c provide examples of this. * * @par Synopsis: * @code * #include "cpl_io_fits.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- Private types -----------------------------------------------------------------------------*/ typedef struct cpl_fitsfile_t { char * name; fitsfile * fptr; int iomode; /* CFITSIO currently defines: READONLY, READWRITE */ cpl_boolean has_stat; /* Set to true iff stat() can be & was called OK. */ /* When false, the below members are undefined */ #ifdef CPL_HAVE_STAT dev_t st_dev; /* ID of device containing file */ ino_t st_ino; /* inode number */ #endif int tid; /* Thread id. It must be matched for read-reuse. If must also be matched if a file must be closed prematurely because there are too many open files. If matched for write-reuse the thread id is therefore modified to that of the reuser. */ cpl_boolean writing; /* CPL_TRUE iff a file is used for writing. If a file opened for writing is reused for reading, then this flag is set to false, indicating that subsequent reuse for reading must match the thread id. */ } cpl_fitsfile_t; /*----------------------------------------------------------------------------- Private variables -----------------------------------------------------------------------------*/ static cpl_size cpl_nfitsfiles = 0; /* The number of open FITS-files */ static cx_list * cpl_fitslist = NULL; /* The list of open, cached FITS-files */ /*----------------------------------------------------------------------------- Private functions -----------------------------------------------------------------------------*/ #if CPL_IO_FITS_MAX_OPEN > 0 static cpl_boolean cpl_io_fits_find_fptr(cx_list_iterator *, const char *, const int *, const struct stat *) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1))) #endif ; #endif static fitsfile * cpl_io_fits_unset_fptr(const char *, const int *); static fitsfile * cpl_io_fits_reuse_fptr(const char *, int, cpl_boolean) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(1))) #endif ; static const char * cpl_io_fits_find_name(const fitsfile *, int *) CPL_ATTR_NONNULL; static void cpl_io_fits_set(fitsfile *, const char *, int, cpl_boolean) CPL_ATTR_NONNULL; static cpl_fitsfile_t * cpl_io_fits_unset_tid(int); static int cpl_io_fits_free(cpl_fitsfile_t *, int *) #ifdef CPL_HAVE_ATTR_NONNULL __attribute__((nonnull(2))) #endif ; /*----------------------------------------------------------------------------- Function definitions -----------------------------------------------------------------------------*/ /** * @internal * @brief Initialize the caching of FITS-files * @return void * @see cpl_io_fits_end() * @note If the caching is already active, nothing happens */ void cpl_io_fits_init(void) { #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, cpl_fitslist == NULL ? "Initializing, max file pointers: " CPL_STRINGIFY(CPL_IO_FITS_MAX_OPEN) : "Already initialized, max file pointers: " CPL_STRINGIFY(CPL_IO_FITS_MAX_OPEN)); #endif #if CPL_IO_FITS_MAX_OPEN > 0 #ifdef _OPENMP #pragma omp critical(cpl_io_fits) #endif { if (cpl_fitslist == NULL) { cpl_fitslist = cx_list_new(); } } #endif } /** * @internal * @brief Close all open FITS files * @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error * @see cpl_io_fits_init() * @note Must be called before program termination, after it is called * no other functions from this module may be called * */ cpl_error_code cpl_io_fits_end(void) { const cpl_error_code error = cpl_io_fits_close_tid(CPL_IO_FITS_ALL); #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "Finished: " CPL_STRINGIFY(CPL_IO_FITS_MAX_OPEN)); #endif #if CPL_IO_FITS_MAX_OPEN > 0 #ifdef _OPENMP #pragma omp critical(cpl_io_fits) #endif { if (cpl_fitslist != NULL) { cx_list_delete(cpl_fitslist); cpl_fitslist = NULL; } } #endif return error ? cpl_error_set_where_() : CPL_ERROR_NONE; } /*----------------------------------------------------------------------------*/ /** @internal @brief Close all files in use by the specified thread(s) (current or all) @param mode CPL_IO_FITS_ALL (all threads) or CPL_IO_FITS_ONE (current thread) @return Zero on success or else the CFITSIO status */ /*----------------------------------------------------------------------------*/ cpl_error_code cpl_io_fits_close_tid(cpl_boolean mode) { int status = 0; if (cpl_fitslist != NULL) { const int tid = mode == CPL_IO_FITS_ONE ? omp_get_thread_num() : -1; cpl_fitsfile_t * oldest; do { #ifdef _OPENMP #pragma omp critical(cpl_io_fits) #endif oldest = cpl_io_fits_unset_tid(tid); /* If a matching file is found, close it */ } while (oldest != NULL && !cpl_io_fits_free(oldest, &status)); } return status ? cpl_error_set_where_() : CPL_ERROR_NONE; } /** * @internal * @brief Return true iff the I/O FITS optimized mode is enabled * @return CPL_TRUE iff the I/O FITS optimized mode is enabled * @see cpl_io_fits_init() * */ cpl_boolean cpl_io_fits_is_enabled(void) { return cpl_fitslist != NULL ? CPL_TRUE : CPL_FALSE; } /** * @internal * @brief Open a fits file and destroy any preexisting file * @param pfptr CFITSIO file pointer pointer to file * @param filename Name of FITS file to open * @param status Pointer to CFITSIO error status * @return The CFITSIO error status * @see fits_create_file() * @note Since the underlying CFITSIO call supports meta-characters _all_ * currently open files are closed prior to opening this one. * */ int cpl_io_fits_create_file(fitsfile **pfptr, const char *filename, int *status) { if (*status == 0) { /* Duplicate CFITSIO behaviour */ /* The caller comes from a cpl_*_save(), so we are free to assume that no other thread is inside a cpl I/O function concerning the same file. We can therefore unset and close all file pointers open for that filename. */ while ((*pfptr = cpl_io_fits_unset_fptr(filename, NULL)) != NULL && !fits_close_file(*pfptr, status)) { #ifdef _OPENMP #pragma omp atomic #endif cpl_nfitsfiles--; #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "Closed file: %s (%p) (%d)", filename, (const void*)*pfptr, (int)cpl_nfitsfiles); #endif } if (*pfptr == NULL) { if (cpl_fitslist != NULL) { const int tid = omp_get_thread_num(); cpl_fitsfile_t * oldest = NULL; #ifdef _OPENMP /* Comparison critical with cpl_nfitsfiles increment */ #pragma omp critical(cpl_io_fits) #endif { /* Need to open a file. Incerement prior to actual open, in order to avoid the case where a number of synchronized threads first verify that the number of files is (just) below the limit and then the all try to open, thus exceeding the limit */ cpl_nfitsfiles++; if (cpl_nfitsfiles > (CPL_IO_FITS_MAX_OPEN)) { /* First need to close a file - find it first */ oldest = cpl_io_fits_unset_tid(tid); } } if (cpl_io_fits_free(oldest, status)) { #ifdef _OPENMP #pragma omp atomic #endif cpl_nfitsfiles--; /* The close failed, so no open */ return *status; } } } if (fits_create_file(pfptr, filename, status)) { #ifdef _OPENMP #pragma omp atomic #endif cpl_nfitsfiles--; /* The open failed */ } else { #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "Opened file for writing: %s (%p) (%d)", filename, (const void*)*pfptr, (int)cpl_nfitsfiles); #endif /* FIXME: Assume READWRITE */ cpl_io_fits_set(*pfptr, filename, READWRITE, CPL_TRUE); } } return *status; } /** * @internal * @brief Try to reuse an already existing CFITSIO file pointer or reopen * @param pfptr CFITSIO file pointer pointer to file * @param filename Name of FITS file to open * @param iomode The CFITSIO iomode * @param status Pointer to CFITSIO error status * @return The CFITSIO error status * @see fits_open_diskfile() * @note Since this call may not actually open the file, the caller must * use fits_movabs_hdu() and not fits_movrel_hdu(). * */ int cpl_io_fits_open_diskfile(fitsfile **pfptr, const char * filename, int iomode, int *status) { if (*status == 0) { /* Duplicate CFITSIO behaviour */ const int rmiomode = iomode == READONLY ? READWRITE : READONLY; if (iomode == READONLY) { /* If the caller comes from a cpl_*_load() then we are free to assume that no other thread is inside a cpl_*_save() concerning the same file. If a writer file pointer exists we can therefore unset and reuse it for reading. */ *pfptr = cpl_io_fits_reuse_fptr(filename, rmiomode, CPL_FALSE); if (*pfptr != NULL) { iomode = rmiomode; /* Reuse a READWRITE handle for reading */ /* A given file has at most one writer handle */ /* assert( cpl_io_fits_unset_fptr(filename, &rmiomode) == NULL); */ } } else { /* If the caller comes from a cpl_*_save() then we are free to assume that no other thread is inside a CPL I/O function concerning the same file. We can therefore unset and close all reader file pointers open for that filename. A write file pointer if present is not unset, since it can be reused. */ while ((*pfptr = cpl_io_fits_unset_fptr(filename, &rmiomode)) != NULL && !fits_close_file(*pfptr, status)) { #ifdef _OPENMP #pragma omp atomic #endif cpl_nfitsfiles--; #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "Closed file: %s (%p) (I/O-mode: %d != " "%d) (%d)", filename, (const void*)*pfptr, rmiomode, iomode, (int)cpl_nfitsfiles); #endif } if (*status) { #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "Could not close file: %s (%p) (I/O-" "mode: %d) (%d)", filename, (const void*)*pfptr, rmiomode, (int)cpl_nfitsfiles); #endif return *status; } } if (*pfptr == NULL) { /* Determine if an already open file can be reused */ /* If iomode is READONLY, then the tid must match */ /* If iomode is READWRITE, its tid will be set to the current one */ *pfptr = cpl_io_fits_reuse_fptr(filename, iomode, iomode == READWRITE); } if (*pfptr != NULL) { #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "Reusing handle (%p) for: %s (I/O-mode" ": %d%s) (%d)", (const void*)*pfptr, filename, iomode, iomode == rmiomode ? " for reading" : "", (int)cpl_nfitsfiles); #endif #ifdef CPL_IO_FITS_REWIND /* A newly opened file points to the 1st HDU so do the same here */ if (fits_movabs_hdu(*pfptr, 1, NULL, status)) { #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "Could not move to primary HDU: %s (%p) (I/O-" "mode: %d) (%d)", filename, (const void*)*pfptr, rmiomode, (int)cpl_nfitsfiles); #endif } #endif return *status; } if (cpl_fitslist != NULL) { const int tid = omp_get_thread_num(); cpl_fitsfile_t * oldest = NULL; #ifdef _OPENMP /* Comparison critical with cpl_nfitsfiles increment */ #pragma omp critical(cpl_io_fits) #endif { /* Need to open a file. Incerement prior to actual open, in order to avoid the case where a number of synchronized threads first verify that the number of files is (just) below the limit and then the all try to open, thus exceeding the limit */ cpl_nfitsfiles++; if (cpl_nfitsfiles > (CPL_IO_FITS_MAX_OPEN)) { /* First need to close a file - find it first */ oldest = cpl_io_fits_unset_tid(tid); } } if (cpl_io_fits_free(oldest, status)) { #ifdef _OPENMP #pragma omp atomic #endif cpl_nfitsfiles--; /* The close failed, so no open */ return *status; } } #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "Opening file: %s (I/O-mode: %d) (%d)", filename, iomode, (int)cpl_nfitsfiles); #endif if (fits_open_diskfile(pfptr, filename, iomode, status)) { #ifdef _OPENMP #pragma omp atomic #endif cpl_nfitsfiles--; /* The open failed */ } else { cpl_io_fits_set(*pfptr, filename, iomode, iomode == READWRITE); #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "Set file: %s (%p) (I/O-mode: %d) (%d)", filename, (const void*)*pfptr, iomode, (int)cpl_nfitsfiles); #endif } } return *status; } /** * @internal * @brief Instead of closing the file, just flush any written data * @param fptr CFITSIO file pointer to file * @param status Pointer to CFITSIO error status * @return The CFITSIO error status * @see fits_flush_file() From the 3.280 source code of fits_flush_file(): Flush all the data in the current FITS file to disk. This ensures that if the program subsequently dies, the disk FITS file will be closed correctly. */ int cpl_io_fits_close_file(fitsfile *fptr, int *status) { if (*status == 0 && fptr != NULL) { /* Duplicate CFITSIO behaviour */ int iomode; const char * name = cpl_io_fits_find_name(fptr, &iomode); if (name == NULL) { /* This branch is used when CPL_IO_MODE is inactive */ (void)fits_close_file(fptr, status); } else if (iomode != READONLY) { #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "Flushing handle (%p) for: %s (%d) (%d)", (const void*)fptr, name, iomode, (int)cpl_nfitsfiles); #endif (void)fits_flush_file(fptr, status); } } return *status; } /** * @internal * @brief Select the 1st matching pointer structure unsetting it from the list @param tid The thread ID in the pointer structure to match, or -1 for all @return The pointer structure to deallocate, or NULL on no match @note May not be called when fitslist is empty */ static cpl_fitsfile_t * cpl_io_fits_unset_tid(int tid) { #if CPL_IO_FITS_MAX_OPEN > 0 cx_list_iterator pos = cx_list_begin(cpl_fitslist); while (pos != cx_list_end(cpl_fitslist)) { const cpl_fitsfile_t * cpl_fitsfile = (const cpl_fitsfile_t *)cx_list_get(cpl_fitslist, pos); if (tid < 0 || cpl_fitsfile->tid == tid) break; pos = cx_list_next(cpl_fitslist, pos); } return pos != cx_list_end(cpl_fitslist) ? cx_list_extract(cpl_fitslist, pos) : NULL; #else return NULL; #endif } /** * @internal * @brief Deallocate one pointer structure, closing the CFITS file @param self The pointer structure to deallocate, or NULL @param status The CFITSIO status @return Zero on success or else the CFITSIO status */ static int cpl_io_fits_free(cpl_fitsfile_t * self, int * status) { if (self != NULL) { if (*status == 0) { if (fits_close_file(self->fptr, status)) { (void)cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, *status, fits_close_file, "filename='%s', " "I/O-mode: %d, Thread-ID: %d", self->name, self->iomode, self->tid); } else { #ifdef _OPENMP #pragma omp atomic #endif cpl_nfitsfiles--; #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "Closed oldest file of thread %d: %s " "(I/O-mode: %d. %p) (%d)", self->tid, self->name, self->iomode, (const void*)self->fptr, *status); #endif } } cpl_free(self->name); cpl_free(self); } return *status; } /*----------------------------------------------------------------------------*/ /** @internal @brief Close one named file, or all files @param filename The file to be closed, NULL will close all @param status The CFITSIO status @return Zero on success or else the CFITSIO status @note If no file handle exists for the file, nothing is done */ /*----------------------------------------------------------------------------*/ int cpl_io_fits_close(const char * filename, int * status) { if (*status == 0) { /* Duplicate CFITSIO behaviour */ fitsfile * fptr; while ((fptr = cpl_io_fits_unset_fptr(filename, NULL)) != NULL && !fits_close_file(fptr, status)) { #ifdef _OPENMP #pragma omp atomic #endif cpl_nfitsfiles--; #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "Closed CFITSIO-file: %p (%s) (%d)", (const void*)fptr, filename, (int)cpl_nfitsfiles); #endif } } return *status; } /**@}*/ /*----------------------------------------------------------------------------*/ /** @internal @brief Insert a CFITSIO triplet into the CPL I/O structure @param fptr The CFITSIO pointer to insert @param name The filename to insert @param iomode The I/O mode to insert @param writing CPL_TRUE iff the handle is used for writing @void @note Since this call is only done after a succesful opening of the named file name (and fptr) can safely be assumed to be non-NULL. */ /*----------------------------------------------------------------------------*/ static void cpl_io_fits_set(fitsfile * fptr, const char * name, int iomode, cpl_boolean writing) { #if CPL_IO_FITS_MAX_OPEN > 0 if (cpl_fitslist != NULL) { char * filename = cpl_strdup(*name == '!' ? name+1 : name); struct stat statbuf; const cpl_boolean has_stat = !stat(filename, &statbuf); cpl_fitsfile_t * cpl_fitsfile = cpl_malloc(sizeof(*cpl_fitsfile)); /* assert(iomode != READONLY || !writing); */ cpl_fitsfile->fptr = fptr; cpl_fitsfile->name = filename; cpl_fitsfile->iomode = iomode; cpl_fitsfile->tid = omp_get_thread_num(); cpl_fitsfile->writing = writing; cpl_fitsfile->has_stat = has_stat; if (has_stat) { cpl_fitsfile->st_dev = statbuf.st_dev; cpl_fitsfile->st_ino = statbuf.st_ino; } #ifdef _OPENMP #pragma omp critical(cpl_io_fits) #endif { cx_list_push_back(cpl_fitslist, (cxcptr)cpl_fitsfile); } } #endif } #if CPL_IO_FITS_MAX_OPEN > 0 /*----------------------------------------------------------------------------*/ /** @internal @brief Search by name for an already opened FITS file @param pkey Iff found, *pkey is the location of the entry @param filename The filename to look for, NULL will return first available @param piomode Iff non-NULL, restrict search to *piomode @param filestat Pointer to stat buffer of filename or NULL when unavailable @return CPL_TRUE, iff found @note Pointer pkey may not be NULL! */ /*----------------------------------------------------------------------------*/ static cpl_boolean cpl_io_fits_find_fptr(cx_list_iterator * pkey, const char * filename, const int * piomode, const struct stat * filestat) { const int tid = omp_get_thread_num(); const cpl_fitsfile_t * cpl_fitsfile = NULL; cpl_size i = 0; cx_list_iterator pos = cx_list_begin(cpl_fitslist); cpl_boolean found; while ((found = pos != cx_list_end(cpl_fitslist))) { cpl_fitsfile = (const cpl_fitsfile_t *)cx_list_get(cpl_fitslist, pos); if (filename == NULL) break;/* Matches any entry */ if ((piomode == NULL || *piomode == cpl_fitsfile->iomode) && (((piomode == NULL || *piomode != READONLY) && cpl_fitsfile->writing) || cpl_fitsfile->tid == tid) && (filestat != NULL && cpl_fitsfile->has_stat ? cpl_fitsfile->st_dev == filestat->st_dev && cpl_fitsfile->st_ino == filestat->st_ino : !strcmp(cpl_fitsfile->name, filename))) break; pos = cx_list_next(cpl_fitslist, pos); i++; } if (found) { *pkey = pos; #ifdef CPL_IO_FITS_DEBUG cpl_msg_debug(cpl_func, "File %s found (%d < %d): %p (I/O-mode: " "%d) (tid: %d <=> %d)", filename, (int)i, (int)cpl_nfitsfiles, (const void*)cpl_fitsfile->fptr, cpl_fitsfile->iomode, tid, cpl_fitsfile->tid); } else if (piomode != NULL) { cpl_msg_debug(cpl_func, "File %s not found (%d) (I/O-mode: %d, " "tid=%d)", filename, (int)cpl_nfitsfiles, *piomode, tid); } else { cpl_msg_debug(cpl_func, "File %s not found (%d) (tid=%d)", filename, (int)cpl_nfitsfiles, tid); #endif } return found; } #endif /*----------------------------------------------------------------------------*/ /** @internal @brief Search by name for an already opened FITS file and unset it @param name The filename to match, @em NULL will unset and return any @param piomode Iff non-@em NULL, match *piomode, otherwise match any mode @return When matched, the CFITSIO pointer structure otherwise NULL @note The file is matched when the filename: 1) is NULL, or else 2) matches (using stat() if need be) and piomode is NULL, or else 3) matches (using stat() if need be) and piomode is non-NULL and matches the mode of the entry and the mode is not READONLY, or else 4) matches (using stat() if need be) and piomode is non-NULL and matches the mode of the entry and dounset is CPL_TRUE, or else 5) matches (using stat() if need be) and piomode is non-NULL and matches the mode of the entry (which is READONLY) and the thread id matches */ /*----------------------------------------------------------------------------*/ static fitsfile * cpl_io_fits_unset_fptr(const char * name, const int * piomode) { fitsfile * fptr = NULL; #if CPL_IO_FITS_MAX_OPEN > 0 if (cpl_fitslist != NULL) { cpl_fitsfile_t * cpl_fitsfile = NULL; const char * filename = name != NULL && *name == '!' ? name+1 : name; cx_list_iterator pos; struct stat statbuf; const cpl_boolean has_stat = filename ? !stat(filename, &statbuf) : CPL_FALSE; #ifdef _OPENMP #pragma omp critical(cpl_io_fits) #endif { if (cpl_io_fits_find_fptr(&pos, filename, piomode, has_stat ? &statbuf : NULL)) { /* Found it */ cpl_fitsfile = (cpl_fitsfile_t *)cx_list_extract(cpl_fitslist, pos); } } if (cpl_fitsfile != NULL) { fptr = cpl_fitsfile->fptr; cpl_free(cpl_fitsfile->name); cpl_free(cpl_fitsfile); } } #endif return fptr; } /*----------------------------------------------------------------------------*/ /** @internal @brief Search by name for an already opened FITS file for reuse @param name The filename to match @param iomode The I/O mode to match @param writing If the file is opened for read/write, its new writing flag @return When matched, the CFITSIO pointer structure otherwise NULL @see cpl_io_fits_unset_fptr() @note Side-effect: If a write handle is matched for write-reuse (writing is CPL_TRUE), then its thread id is set to that of the current thread, so it can be unset if there are too many open files - and its writer flag is set. If a write handle is matched for read-reuse (writing is CPL_FALSE), then its thread id already matches - and its writer flag is cleared. */ /*----------------------------------------------------------------------------*/ static fitsfile * cpl_io_fits_reuse_fptr(const char * name, int iomode, cpl_boolean writing) { fitsfile * fptr = NULL; #if CPL_IO_FITS_MAX_OPEN > 0 if (cpl_fitslist != NULL) { cpl_fitsfile_t * cpl_fitsfile = NULL; const char * filename = *name == '!' ? name+1 : name; cx_list_iterator pos; struct stat statbuf; const cpl_boolean has_stat = !stat(filename, &statbuf); #ifdef _OPENMP #pragma omp critical(cpl_io_fits) #endif { if (cpl_io_fits_find_fptr(&pos, filename, &iomode, has_stat ? &statbuf : NULL)) { /* Found it */ cpl_fitsfile = (cpl_fitsfile_t *)cx_list_get(cpl_fitslist, pos); } /* Extend critical section, since it is cheap and just to be sure */ if (cpl_fitsfile != NULL) { /* If we are reading, the file pointer is used by no one else */ /* If we are writing (i.e. called from within a cpl_*save(), we may assume that no one else is currently using the file */ fptr = cpl_fitsfile->fptr; if (iomode != READONLY) { /* assert( cpl_fitsfile->iomode == READWRITE ); */ cpl_fitsfile->tid = omp_get_thread_num(); cpl_fitsfile->writing = writing; } } } } #endif return fptr; } /*----------------------------------------------------------------------------*/ /** @internal @brief Try to find by CFITSIO pointer an already opened FITS file @param fptr The CFITSIO pointer to look for @param piomode When found, the I/O mode @return When found, the name otherwise NULL */ /*----------------------------------------------------------------------------*/ static const char * cpl_io_fits_find_name(const fitsfile * fptr, int * piomode) { const char * name = NULL; #if CPL_IO_FITS_MAX_OPEN > 0 if (cpl_fitslist != NULL) { #ifdef _OPENMP #pragma omp critical(cpl_io_fits) #endif { cx_list_const_iterator pos = cx_list_begin(cpl_fitslist); while (pos != cx_list_end(cpl_fitslist)) { const cpl_fitsfile_t * cpl_fitsfile = (const cpl_fitsfile_t *) cx_list_get(cpl_fitslist, pos); if (fptr == cpl_fitsfile->fptr) { /* Found it */ name = cpl_fitsfile->name; *piomode = cpl_fitsfile->iomode; break; } pos = cx_list_next(cpl_fitslist, pos); } } } #endif return name; } cpl-6.4.1/cplcore/cpl_mask.h0000644000460300003120000001307211620734061012606 00000000000000/* $Id: cpl_mask.h,v 1.33 2011-08-11 11:08:33 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-08-11 11:08:33 $ * $Revision: 1.33 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_MASK_H #define CPL_MASK_H /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ typedef struct _cpl_mask_ cpl_mask; /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include "cpl_image.h" #include "cpl_matrix.h" #include "cpl_filter.h" CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- cpl_binary type definition -----------------------------------------------------------------------------*/ typedef unsigned char cpl_binary; /*----------------------------------------------------------------------------- Define -----------------------------------------------------------------------------*/ #define CPL_BINARY_1 (cpl_binary)1 #define CPL_BINARY_0 (cpl_binary)0 /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ /* IO operations */ cpl_mask * cpl_mask_new(cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_mask * cpl_mask_wrap(cpl_size, cpl_size, cpl_binary *) CPL_ATTR_ALLOC; cpl_mask * cpl_mask_duplicate(const cpl_mask *) CPL_ATTR_ALLOC; void cpl_mask_delete(cpl_mask *); void * cpl_mask_unwrap(cpl_mask *); cpl_error_code cpl_mask_dump_window(const cpl_mask *, cpl_size, cpl_size, cpl_size, cpl_size, FILE *); cpl_mask * cpl_mask_load(const char *, cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_mask * cpl_mask_load_window(const char *, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_error_code cpl_mask_save(const cpl_mask *, const char *, const cpl_propertylist *, unsigned); /* Accessor functions */ cpl_binary * cpl_mask_get_data(cpl_mask *); const cpl_binary * cpl_mask_get_data_const(const cpl_mask *); cpl_binary cpl_mask_get(const cpl_mask *, cpl_size, cpl_size); cpl_error_code cpl_mask_set(cpl_mask *, cpl_size, cpl_size, cpl_binary); cpl_size cpl_mask_get_size_x(const cpl_mask *); cpl_size cpl_mask_get_size_y(const cpl_mask *); /* Basic operations */ cpl_boolean cpl_mask_is_empty(const cpl_mask *); cpl_boolean cpl_mask_is_empty_window(const cpl_mask *, cpl_size, cpl_size, cpl_size, cpl_size); cpl_size cpl_mask_count(const cpl_mask *); cpl_size cpl_mask_count_window(const cpl_mask *, cpl_size, cpl_size, cpl_size, cpl_size); cpl_error_code cpl_mask_and(cpl_mask *, const cpl_mask *); cpl_error_code cpl_mask_or(cpl_mask *, const cpl_mask *); cpl_error_code cpl_mask_xor(cpl_mask *, const cpl_mask *); cpl_error_code cpl_mask_not(cpl_mask *); cpl_mask * cpl_mask_collapse_create(const cpl_mask *, int) CPL_ATTR_ALLOC; cpl_mask * cpl_mask_extract(const cpl_mask *, cpl_size, cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC; cpl_error_code cpl_mask_turn(cpl_mask *, int); cpl_error_code cpl_mask_shift(cpl_mask *, cpl_size, cpl_size); cpl_error_code cpl_mask_copy(cpl_mask *, const cpl_mask *, cpl_size, cpl_size); cpl_error_code cpl_mask_flip(cpl_mask *, int); cpl_error_code cpl_mask_move(cpl_mask *, cpl_size, const cpl_size *); cpl_mask * cpl_mask_extract_subsample(const cpl_mask *, cpl_size, cpl_size) CPL_ATTR_ALLOC; /* Morphological operations */ cpl_error_code cpl_mask_filter(cpl_mask *, const cpl_mask *, const cpl_mask *, cpl_filter_mode, cpl_border_mode); cpl_error_code cpl_mask_closing(cpl_mask *, const cpl_matrix *) CPL_ATTR_DEPRECATED; cpl_error_code cpl_mask_opening(cpl_mask *, const cpl_matrix *) CPL_ATTR_DEPRECATED; cpl_error_code cpl_mask_erosion(cpl_mask *, const cpl_matrix *) CPL_ATTR_DEPRECATED; cpl_error_code cpl_mask_dilation(cpl_mask *, const cpl_matrix *) CPL_ATTR_DEPRECATED; /* Zones selection */ cpl_error_code cpl_mask_threshold_image(cpl_mask *, const cpl_image *, double, double, cpl_binary); cpl_mask * cpl_mask_threshold_image_create(const cpl_image *, double, double) CPL_ATTR_ALLOC; CPL_END_DECLS #endif cpl-6.4.1/cplcore/cpl_macros.h0000644000460300003120000001340512242411611013131 00000000000000/* $Id: cpl_macros.h,v 1.12 2013-03-13 09:19:47 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2013-03-13 09:19:47 $ * $Revision: 1.12 $ * $Name: not supported by cvs2svn $ */ /* * This file must not include any other file than cxmacros.h */ #ifndef CPL_MACROS_H #define CPL_MACROS_H #include /* * C code guard */ #undef CPL_BEGIN_DECLS #undef CPL_END_DECLS #define CPL_BEGIN_DECLS CX_BEGIN_DECLS #define CPL_END_DECLS CX_END_DECLS /* Needed to concatenate two and three macro arguments */ #define CPL_CONCAT(a,b) a ## _ ## b #define CPL_CONCAT2X(a,b) CPL_CONCAT(a,b) #define CPL_CONCAT3X(a,b,c) CPL_CONCAT2X(CPL_CONCAT2X(a,b),c) #define CPL_XSTRINGIFY(TOSTRING) #TOSTRING #define CPL_STRINGIFY(TOSTRING) CPL_XSTRINGIFY(TOSTRING) /* (Try to) determine support for the function __attribute__ These attributes are used in CPL (from the given gcc version) 2.3 format (used only from gcc 3) 2.5 const (used only from gcc 3) 2.96 pure (used only from gcc 3) 3.0 malloc 3.1 deprecated 3.3 nonnull 3.4 warn_unused_result 4.3 alloc_size */ #if defined __GNUC__ && __GNUC__ > 2 /* gcc 3 or higher */ # define CPL_ATTR_CONST __attribute__((const)) # define CPL_ATTR_PRINTF(A,B) __attribute__((format (printf, A, B))) # define CPL_ATTR_PURE __attribute__((pure)) # if __GNUC__ > 3 || defined __GNUC_MINOR__ && __GNUC_MINOR__ > 0 /* gcc 3.1 or higher */ # define CPL_ATTR_DEPRECATED __attribute__((deprecated)) # endif # if __GNUC__ > 3 || defined __GNUC_MINOR__ && __GNUC_MINOR__ > 2 /* gcc 3.3 or higher */ # define CPL_ATTR_NONNULL __attribute__((nonnull)) # define CPL_HAVE_ATTR_NONNULL # define CPL_UNLIKELY(x) __builtin_expect((x), 0) # define CPL_LIKELY(x) __builtin_expect((x), 1) # define CPL_ATTR_NOINLINE __attribute__((noinline)) # endif # if __GNUC__ > 3 || defined __GNUC_MINOR__ && __GNUC_MINOR__ > 3 /* gcc 3.4 or higher */ # define CPL_ATTR_ALLOC __attribute__((malloc, warn_unused_result)) # if __GNUC__ > 4 || __GNUC__ == 4 && defined __GNUC_MINOR__ && __GNUC_MINOR__ > 2 /* gcc 4.3 or higher */ # define CPL_ATTR_MALLOC \ __attribute__((malloc, warn_unused_result, alloc_size(1))) # define CPL_ATTR_CALLOC \ __attribute__((malloc, warn_unused_result, alloc_size(1,2))) # define CPL_ATTR_REALLOC \ __attribute__((warn_unused_result, alloc_size(2))) # else /* gcc 3.4 to 4.2 */ # define CPL_ATTR_MALLOC __attribute__((malloc, warn_unused_result)) # define CPL_ATTR_CALLOC __attribute__((malloc, warn_unused_result)) # define CPL_ATTR_REALLOC __attribute__((warn_unused_result)) # endif # else /* gcc 3.0 to 3.3 */ # define CPL_ATTR_ALLOC __attribute__((malloc)) # define CPL_ATTR_MALLOC __attribute__((malloc)) # define CPL_ATTR_CALLOC __attribute__((malloc)) # define CPL_ATTR_REALLOC /* __attribute__ */ # endif # if __GNUC__ >= 4 # define CPL_INTERNAL __attribute__((visibility("hidden"))) # define CPL_EXPORT __attribute__((visibility("default"))) # endif #endif #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) #define CPL_DIAG_PRAGMA_PUSH_IGN(x) \ _Pragma("GCC diagnostic push") \ _Pragma(CPL_STRINGIFY(GCC diagnostic ignored #x)) #define CPL_DIAG_PRAGMA_PUSH_ERR(x) \ _Pragma("GCC diagnostic push") \ _Pragma(CPL_STRINGIFY(GCC diagnostic error #x)) #define CPL_DIAG_PRAGMA_POP \ _Pragma("GCC diagnostic pop") #else #define CPL_DIAG_PRAGMA_PUSH_IGN(x) /* pragma GCC diagnostic ignored */ #define CPL_DIAG_PRAGMA_PUSH_ERR(x) /* pragma GCC diagnostic error */ #define CPL_DIAG_PRAGMA_POP /* pragma GCC diagnostic pop */ #endif #ifndef CPL_ATTR_ALLOC # define CPL_ATTR_ALLOC /* __attribute__ */ #endif #ifndef CPL_ATTR_CALLOC # define CPL_ATTR_CALLOC /*__attribute__ */ #endif #ifndef CPL_ATTR_CONST # define CPL_ATTR_CONST /* __attribute__ */ #endif #ifndef CPL_ATTR_DEPRECATED # define CPL_ATTR_DEPRECATED /* __attribute__ */ #endif #ifndef CPL_ATTR_PURE # define CPL_ATTR_PURE /* __attribute__ */ #endif #ifndef CPL_ATTR_MALLOC # define CPL_ATTR_MALLOC /* __attribute__ */ #endif #ifndef CPL_ATTR_NONNULL # define CPL_ATTR_NONNULL /* __attribute__ */ #endif #ifndef CPL_ATTR_PRINTF # define CPL_ATTR_PRINTF(A,B) /* __attribute__ */ #endif #ifndef CPL_ATTR_REALLOC # define CPL_ATTR_REALLOC /* __attribute__ */ #endif #ifndef CPL_UNLIKELY # define CPL_UNLIKELY(x) (x) # define CPL_LIKELY(x) (x) #endif #ifndef CPL_ATTR_NOINLINE # define CPL_ATTR_NOINLINE /* __attribute__ */ #endif #ifndef CPL_INTERNAL # define CPL_INTERNAL /* __attribute__ */ # define CPL_EXPORT /* __attribute__ */ #endif #endif /* CPL_MACROS_H */ cpl-6.4.1/cplcore/cpl_vector_impl.h0000644000460300003120000000230611667673100014203 00000000000000/* $Id: cpl_vector_impl.h,v 1.1 2011-12-07 14:20:48 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2005 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2011-12-07 14:20:48 $ * $Revision: 1.1 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_VECTOR_IMPL_H #define CPL_VECTOR_IMPL_H #include "cpl_vector.h" CPL_BEGIN_DECLS void * cpl_vector_rewrap(cpl_vector * self, cpl_size, double *); #endif /* end of cpl_vector_impl.h */ cpl-6.4.1/cplcore/cpl_filter.h0000644000460300003120000002347112062627220013143 00000000000000/* $Id: cpl_filter.h,v 1.25 2012-12-14 13:50:08 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: llundin $ * $Date: 2012-12-14 13:50:08 $ * $Revision: 1.25 $ * $Name: not supported by cvs2svn $ */ #ifndef CPL_FILTER_H #define CPL_FILTER_H #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------*/ /** * @defgroup cpl_filter Filters * * This module provides definitions for filtering of a * @c cpl_image and a @c cpl_mask. The actual filtering functions are defined * in the @c cpl_image and @c cpl_mask modules. * * @par Synopsis: * @code * #include "cpl_filter.h" * @endcode */ /*----------------------------------------------------------------------------*/ /**@{*/ /*----------------------------------------------------------------------------- New types -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** * * @brief These are the supported border modes. * For a kernel of width 2n+1, the n left- and rightmost image/mask * columns do not have elements for the whole kernel. The same holds for the * top and bottom image/mask rows. The border mode defines the filtering of * such border pixels. * */ /*----------------------------------------------------------------------------*/ enum _cpl_border_mode_ { CPL_BORDER_FILTER, /**< Filter the border using the reduced number of pixels. If in median filtering the number of pixels is even choose the mean of the two central values, after the borders have been filled with a chess-like pattern of +- inf */ CPL_BORDER_ZERO, /**< Set the border of the filtered image/mask to zero. */ CPL_BORDER_CROP, /**< Crop the filtered image/mask. */ CPL_BORDER_NOP, /**< Do not modify the border of the filtered image/mask. */ CPL_BORDER_COPY /**< Copy the border of the input image/mask. */ }; /** * @brief * The border mode type. */ typedef enum _cpl_border_mode_ cpl_border_mode; /*----------------------------------------------------------------------------*/ /** * * @brief These are the supported filter modes. * */ /*----------------------------------------------------------------------------*/ enum _cpl_filter_mode_ { CPL_FILTER_EROSION, /**< The erosion filter (for a @c cpl_mask). @see cpl_mask_filter() */ CPL_FILTER_DILATION, /**< The dilation filter (for a @c cpl_mask). @see cpl_mask_filter() */ CPL_FILTER_OPENING, /**< The opening filter (for a @c cpl_mask). @see cpl_mask_filter() */ CPL_FILTER_CLOSING, /**< The closing filter (for a @c cpl_mask). @see cpl_mask_filter() */ CPL_FILTER_LINEAR, /**< A linear filter (for a @c cpl_image). The kernel elements are normalized with the sum of their absolute values. This implies that there must be at least one non-zero element in the kernel. The normalisation makes the kernel useful for filtering where flux conservation is desired. The kernel elements are thus used as weights like this: @verbatim Kernel Image ... 1 2 3 ... 1.0 2.0 3.0 ... 4 5 6 ... 4.0 5.0 6.0 ... 7 8 9 ... 7.0 8.0 9.0 ... ... @endverbatim The filtered value corresponding to the pixel whose value is 5.0 is: \f$\frac{(1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0)} {1+2+3+4+5+6+7+8+9}\f$ Filtering with @c CPL_FILTER_LINEAR and a flat kernel can be done faster with @c CPL_FILTER_AVERAGE. @see CPL_FILTER_LINEAR_SCALE, CPL_FILTER_AVERAGE, cpl_image_filter() */ CPL_FILTER_LINEAR_SCALE, /**< A linear filter (for a @c cpl_image). Unlike @c CPL_FILTER_LINEAR the kernel elements are not normalized, so the filtered image will have its flux scaled with the sum of the weights of the kernel. Examples of linear, scaling kernels are gradient operators and edge detectors. The kernel elements are thus applied like this: @verbatim Kernel Image ... 1 2 3 ... 1.0 2.0 3.0 ... 4 5 6 ... 4.0 5.0 6.0 ... 7 8 9 ... 7.0 8.0 9.0 ... ... @endverbatim The filtered value corresponding to the pixel whose value is 5.0 is: \f$1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0\f$ @see CPL_FILTER_LINEAR, cpl_image_filter() */ CPL_FILTER_AVERAGE, /**< An average filter, i.e. the output pixel is the arithmetic average of the surrounding (1 + 2 * hsizex) * (1 + 2 * hsizey) pixels. The cost per pixel is O(hsizex*hsizey). The two images may have different pixel types. When the input and output pixel types are identical, the arithmetic is done with that type, e.g. int for two integer images. When the input and output pixel types differ, the arithmetic is done in double precision when one of the two images have pixel type CPL_TYPE_DOUBLE, otherwise float is used. @see CPL_FILTER_AVERAGE_FAST, cpl_image_filter_mask() */ CPL_FILTER_AVERAGE_FAST, /**< The same as @c CPL_FILTER_AVERAGE, except that it uses a running average, which will lead to a significant loss of precision if there are large differences in the magnitudes of the input pixels. The cost per pixel is O(1) if all elements in the kernel are used, otherwise the filtering is done as for CPL_FILTER_AVERAGE. @see cpl_image_filter_mask() */ CPL_FILTER_MEDIAN, /**< A median filter (for a @c cpl_image). The pixel types of the input and output images must be identical. @see cpl_image_filter_mask() */ CPL_FILTER_STDEV, /**< The filtered value is the standard deviation of the included input pixels. @verbatim Kernel Image ... 1 0 1 ... 1.0 2.0 3.0 ... 0 1 0 ... 4.0 5.0 6.0 ... 1 0 1 ... 7.0 8.0 9.0 ... ... @endverbatim The pixel with value 5.0 will have a filtered value of: std_dev(1.0, 3.0, 5.0, 7.0, 9.0) @see CPL_FILTER_STDEV_FAST, cpl_image_filter_mask() */ CPL_FILTER_STDEV_FAST, /**< The same as @c CPL_FILTER_STDEV, except that it uses the same running method employed in @c CPL_FILTER_AVERAGE_FAST, which will lead to a significant loss of precision if there are large differences in the magnitudes of the input pixels. As for @c CPL_FILTER_AVERAGE_FAST, the cost per pixel is O(1) if all elements are used, otherwise the filtering is done as for @c CPL_FILTER_STDEV. @see cpl_image_filter_mask() */ CPL_FILTER_MORPHO, /**< A morphological filter (for a @c cpl_image). The kernel elements are normalized with the sum of their absolute values. This implies that there must be at least one non-zero element in the kernel. The normalisation makes the kernel useful for filtering where flux conservation is desired. The kernel elements are used as weights on the sorted values covered by the kernel: @verbatim Kernel Image ... 1 2 3 ... 4.0 6.0 5.0 ... 4 5 6 ... 3.0 1.0 2.0 ... 7 8 9 ... 7.0 8.0 9.0 ... ... @endverbatim The filtered value corresponding to the pixel whose value is 5.0 is: \f$\frac{(1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0)} {1+2+3+4+5+6+7+8+9}\f$ @see CPL_FILTER_MORPHO_SCALE, cpl_image_filter() */ CPL_FILTER_MORPHO_SCALE /**< A morphological filter (for a @c cpl_image). Unlike @c CPL_FILTER_MORPHO the kernel elements are not normalized, so the filtered image will have its flux scaled with the sum of the weights of the kernel. The kernel elements are thus applied to the sorted values covered by the kernel: @verbatim Kernel Image ... 1 2 3 ... 4.0 6.0 5.0 ... 4 5 6 ... 3.0 1.0 2.0 ... 7 8 9 ... 7.0 8.0 9.0 ... ... @endverbatim The filtered value corresponding to the pixel whose value is 5.0 is: \f$1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0\f$ @see CPL_FILTER_MORPHO, cpl_image_filter() */ }; /** * @brief * The filter mode type. */ typedef enum _cpl_filter_mode_ cpl_filter_mode; /**@}*/ CPL_END_DECLS #endif cpl-6.4.1/cplcore/Makefile.in0000644000460300003120000010344412310332723012710 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = cplcore DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/admin/depcomp $(include_HEADERS) \ $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/cpl.m4 $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/omp.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" \ "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = am_libcplcore_la_OBJECTS = cpl_array.lo cpl_bivector.lo cpl_error.lo \ cpl_errorstate.lo cpl_fits.lo cpl_io_fits.lo cpl_cfitsio.lo \ cpl_image_basic.lo cpl_image_bpm.lo cpl_image_filter.lo \ cpl_image_io.lo cpl_image_iqe.lo cpl_image_resample.lo \ cpl_image_stats.lo cpl_imagelist_basic.lo cpl_imagelist_io.lo \ cpl_init.lo cpl_mask.lo cpl_matrix.lo cpl_memory.lo cpl_msg.lo \ cpl_plot.lo cpl_polynomial.lo cpl_property.lo \ cpl_propertylist.lo cpl_stats.lo cpl_table.lo cpl_test.lo \ cpl_tools.lo cpl_type.lo cpl_vector.lo cpl_version.lo \ cpl_xmemory.lo cpl_image_gen.lo cpl_column.lo libcplcore_la_OBJECTS = $(am_libcplcore_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libcplcore_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libcplcore_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/admin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcplcore_la_SOURCES) DIST_SOURCES = $(libcplcore_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(include_HEADERS) $(nodist_include_HEADERS) \ $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFITSIO_INCLUDES = @CFITSIO_INCLUDES@ CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@ CFLAGS = @CFLAGS@ CPLCORE_INCLUDES = @CPLCORE_INCLUDES@ CPLDFS_INCLUDES = @CPLDFS_INCLUDES@ CPLDRS_INCLUDES = @CPLDRS_INCLUDES@ CPLUI_INCLUDES = @CPLUI_INCLUDES@ CPL_BINARY_AGE = @CPL_BINARY_AGE@ CPL_BINARY_VERSION = @CPL_BINARY_VERSION@ CPL_CFLAGS = @CPL_CFLAGS@ CPL_INTERFACE_AGE = @CPL_INTERFACE_AGE@ CPL_LDFLAGS = @CPL_LDFLAGS@ CPL_MAJOR_VERSION = @CPL_MAJOR_VERSION@ CPL_MICRO_VERSION = @CPL_MICRO_VERSION@ CPL_MINOR_VERSION = @CPL_MINOR_VERSION@ CPL_VERSION = @CPL_VERSION@ CPL_VERSION_STRING = @CPL_VERSION_STRING@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_INCLUDES = @CX_INCLUDES@ CX_LDFLAGS = @CX_LDFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FFTWF_INCLUDES = @FFTWF_INCLUDES@ FFTWF_LDFLAGS = @FFTWF_LDFLAGS@ FFTW_INCLUDES = @FFTW_INCLUDES@ FFTW_LDFLAGS = @FFTW_LDFLAGS@ FGREP = @FGREP@ GASGANO_CLASSPATH = @GASGANO_CLASSPATH@ GASGANO_SHREXT = @GASGANO_SHREXT@ GREP = @GREP@ INCLTDL = @INCLTDL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JAVA_INCLUDES = @JAVA_INCLUDES@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCEXT = @LIBCEXT@ LIBCFITSIO = @LIBCFITSIO@ LIBCPLCORE = @LIBCPLCORE@ LIBCPLDFS = @LIBCPLDFS@ LIBCPLDRS = @LIBCPLDRS@ LIBCPLUI = @LIBCPLUI@ LIBFFTW = @LIBFFTW@ LIBFFTWF = @LIBFFTWF@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBWCS = @LIBWCS@ LIPO = @LIPO@ LN_S = @LN_S@ LTDLDEPS = @LTDLDEPS@ LTDLINCL = @LTDLINCL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ WCS_INCLUDES = @WCS_INCLUDES@ WCS_LDFLAGS = @WCS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ cpl_includes = @cpl_includes@ cpl_libraries = @cpl_libraries@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libcext = @libcext@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign DISTCLEANFILES = cpl_version.h.in cpl_version.h cpl_func.h.in cpl_func.h *~ SUBDIRS = tests @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/Makefile.in # Place optional 3rd party components last since those locations may contain # obsolete and therefore unwanted CFITSIO installations AM_CPPFLAGS = -DCX_LOG_DOMAIN=\"CplCore\" \ -I\$(top_srcdir)/cpldrs $(CX_INCLUDES) $(CFITSIO_INCLUDES) \ $(WCS_INCLUDES) $(FFTW_INCLUDES) $(FFTWF_INCLUDES) \ $(CPL_CFLAGS) EXTRA_DIST = cpl_version.h.top cpl_version.h.bot cpl_func.h.top cpl_func.h.bot \ cpl_filter_median.c BUILT_SOURCES = cpl_version.h cpl_func.h include_HEADERS = cpl_bivector.h \ cpl_error.h \ cpl_errorstate.h \ cpl_fits.h \ cpl_filter.h \ cpl_image.h \ cpl_image_basic.h \ cpl_image_iqe.h \ cpl_image_bpm.h \ cpl_image_resample.h \ cpl_image_io.h \ cpl_stats.h \ cpl_image_stats.h \ cpl_image_filter.h \ cpl_image_gen.h \ cpl_imagelist.h \ cpl_imagelist_io.h \ cpl_imagelist_basic.h \ cpl_init.h \ cpl_io.h \ cpl_macros.h \ cpl_mask.h \ cpl_matrix.h \ cpl_memory.h \ cpl_msg.h \ cpl_plot.h \ cpl_polynomial.h \ cpl_property.h \ cpl_propertylist.h \ cpl_array.h \ cpl_table.h \ cpl_type.h \ cpl_math_const.h \ cpl_test.h \ cpl_vector.h nodist_include_HEADERS = cpl_version.h cpl_func.h noinst_HEADERS = cpl_array_impl.h cpl_column.h cpl_error_impl.h \ cpl_image_basic_body.h cpl_image_defs.h cpl_image_filter_body.h \ cpl_image_gen_body.h cpl_image_io_body.h cpl_image_resample_body.h \ cpl_image_stats_body.h cpl_imagelist_basic_body.h cpl_imagelist_defs.h \ cpl_mask_defs.h \ cpl_mask_impl.h cpl_memory_impl.h cpl_propertylist_impl.h \ cpl_stats_body.h cpl_tools.h cpl_tools_body.h cpl_type_impl.h \ cpl_xmemory.h cpl_image_filter_impl.h \ cpl_mask_body.h cpl_mask_binary.h \ cpl_image_bpm_body.h cpl_io_fits.h cpl_cfitsio.h \ cpl_polynomial_impl.h cpl_vector_impl.h \ cpl_vector_fit_impl.h cpl_matrix_impl.h \ cpl_image_io_impl.h cpl_image_basic_impl.h lib_LTLIBRARIES = libcplcore.la libcplcore_la_SOURCES = cpl_array.c \ cpl_bivector.c \ cpl_error.c \ cpl_errorstate.c \ cpl_fits.c \ cpl_io_fits.c \ cpl_cfitsio.c \ cpl_image_basic.c \ cpl_image_bpm.c \ cpl_image_filter.c \ cpl_image_io.c \ cpl_image_iqe.c \ cpl_image_resample.c \ cpl_image_stats.c \ cpl_imagelist_basic.c \ cpl_imagelist_io.c \ cpl_init.c \ cpl_mask.c \ cpl_matrix.c \ cpl_memory.c \ cpl_msg.c \ cpl_plot.c \ cpl_polynomial.c \ cpl_property.c \ cpl_propertylist.c \ cpl_stats.c \ cpl_table.c \ cpl_test.c \ cpl_tools.c \ cpl_type.c \ cpl_vector.c \ cpl_version.c \ cpl_xmemory.c \ cpl_image_gen.c \ cpl_column.c # Place optional 3rd party components last since those locations may contain # obsolete and therefore unwanted CFITSIO installations libcplcore_la_LDFLAGS = $(CX_LDFLAGS) $(CFITSIO_LDFLAGS) $(FFTW_LDFLAGS) $(FFTWF_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libcplcore_la_LIBADD = $(LIBCEXT) $(LIBCFITSIO) $(LIBFFTW) $(LIBFFTWF) -lm libcplcore_la_DEPENDENCIES = all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cplcore/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign cplcore/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libcplcore.la: $(libcplcore_la_OBJECTS) $(libcplcore_la_DEPENDENCIES) $(EXTRA_libcplcore_la_DEPENDENCIES) $(AM_V_CCLD)$(libcplcore_la_LINK) -rpath $(libdir) $(libcplcore_la_OBJECTS) $(libcplcore_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_array.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_bivector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_cfitsio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_column.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_errorstate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_fits.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_basic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_bpm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_filter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_gen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_iqe.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_resample.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_image_stats.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_imagelist_basic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_imagelist_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_init.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_io_fits.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_mask.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_matrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_memory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_msg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_plot.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_polynomial.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_property.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_propertylist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_stats.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_table.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_test.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_tools.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_type.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_vector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_version.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpl_xmemory.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) install-nodist_includeHEADERS: $(nodist_include_HEADERS) @$(NORMAL_INSTALL) @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-nodist_includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-includeHEADERS install-nodist_includeHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \ uninstall-nodist_includeHEADERS .MAKE: $(am__recursive_targets) all check install install-am \ install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libLTLIBRARIES \ clean-libtool cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-includeHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ install-nodist_includeHEADERS install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-includeHEADERS \ uninstall-libLTLIBRARIES uninstall-nodist_includeHEADERS cpl_version.h: $(srcdir)/cpl_version.h.top cpl_version.h.in $(srcdir)/cpl_version.h.bot cat $(srcdir)/cpl_version.h.top cpl_version.h.in \ $(srcdir)/cpl_version.h.bot > cpl_version.h; cpl_func.h: $(srcdir)/cpl_func.h.top cpl_func.h.in $(srcdir)/cpl_func.h.bot cat $(srcdir)/cpl_func.h.top cpl_func.h.in \ $(srcdir)/cpl_func.h.bot > cpl_func.h; # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/cplcore/cpl_image_gen_body.h0000644000460300003120000000755311466733006014620 00000000000000/* $Id: cpl_image_gen_body.h,v 1.22 2010-11-11 09:23:18 llundin Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2008 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Type dependent macros */ #if CPL_CLASS == CPL_CLASS_DOUBLE #define CPL_TYPE double #define CPL_TYPE_T CPL_TYPE_DOUBLE #define CPL_TYPE_IS_COMPLEX FALSE #elif CPL_CLASS == CPL_CLASS_FLOAT #define CPL_TYPE float #define CPL_TYPE_T CPL_TYPE_FLOAT #define CPL_TYPE_IS_COMPLEX FALSE #elif CPL_CLASS == CPL_CLASS_INT #define CPL_TYPE int #define CPL_TYPE_T CPL_TYPE_INT #define CPL_TYPE_IS_COMPLEX FALSE #elif CPL_CLASS == CPL_CLASS_DOUBLE_COMPLEX #define CPL_TYPE double complex #define CPL_TYPE_T CPL_TYPE_DOUBLE_COMPLEX #define CPL_TYPE_IS_COMPLEX TRUE #elif CPL_CLASS == CPL_CLASS_FLOAT_COMPLEX #define CPL_TYPE float complex #define CPL_TYPE_T CPL_TYPE_FLOAT_COMPLEX #define CPL_TYPE_IS_COMPLEX TRUE #else #undef CPL_TYPE #undef CPL_TYPE_T #undef CPL_TYPE_IS_COMPLEX #endif #if CPL_OPERATION == CPL_IMAGE_GEN_NOISE_UNIFORM && !CPL_TYPE_IS_COMPLEX case CPL_TYPE_T: { CPL_TYPE * pi; pi = (CPL_TYPE*)ima->pixels; /* Compute the pixels values */ for (j=0; jny; j++) for (i=0; inx; i++) pi[i+j*ima->nx] = (CPL_TYPE)(min_pix + cpl_drand()*(max_pix-min_pix)); break; } #elif CPL_OPERATION == CPL_IMAGE_GEN_NOISE_UNIFORM && CPL_TYPE_IS_COMPLEX case CPL_TYPE_T: { CPL_TYPE * pi; pi = (CPL_TYPE*)ima->pixels; /* Compute the pixels values */ for (j=0; jny; j++) for (i=0; inx; i++) pi[i+j*ima->nx] = (CPL_TYPE) ( #ifdef CPL_I /* The complex image will only have complex values when those are supported */ (min_pix + cpl_drand() * (max_pix - min_pix)) * CPL_I + #endif (min_pix + cpl_drand() * (max_pix - min_pix))); break; } #elif CPL_OPERATION == CPL_IMAGE_GEN_GAUSSIAN case CPL_TYPE_T: { CPL_TYPE * pi; pi = (CPL_TYPE*)ima->pixels; /* Compute the pixels values */ for (j=0; jny; j++) { for (i=0; inx; i++) { x = (double)(i+1) - (double)xcen; y = (double)(j+1) - (double)ycen; pi[i+j*ima->nx]=(CPL_TYPE)cpl_gaussian_2d(x,y,norm,sig_x,sig_y); } } break; } #elif CPL_OPERATION == CPL_IMAGE_GEN_POLYNOMIAL case CPL_TYPE_T: { CPL_TYPE * pi; pi = (CPL_TYPE*)ima->pixels; /* Compute the pixels values */ x = cpl_vector_new(2); xdata = cpl_vector_get_data(x); for (j=0; jny; j++) { for (i=0; inx; i++) { xdata[0] = (double)(startx + i * stepx); xdata[1] = (double)(starty + j * stepy); pi[i+j*ima->nx] = (CPL_TYPE)cpl_polynomial_eval(poly, x); } } cpl_vector_delete(x); break; } #endif #undef CPL_TYPE #undef CPL_TYPE_T #undef CPL_TYPE_IS_COMPLEX cpl-6.4.1/cplcore/cpl_version.c0000644000460300003120000000741010522605655013340 00000000000000/* $Id: cpl_version.c,v 1.4 2006-11-03 09:28:13 rpalsa Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2006 European Southern Observatory * * 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * $Author: rpalsa $ * $Date: 2006-11-03 09:28:13 $ * $Revision: 1.4 $ * $Name: not supported by cvs2svn $ */ #ifdef HAVE_CONFIG_H # include #endif #include "cpl_version.h" /** * @defgroup cpl_version Library Version Information * * This module provides functions to access the library's version * information. * * The library version applies to all component libraries of the Common * pipeline library, and changes if any of the component libraries changes. * * The library version is a version code made up of three components, the * major, minor and micro version number, and is usually represented by a * string of the form "major.minor.micro". * * @par Synopsis: * @code * #include * @endcode */ /**@{*/ /** * @brief * Get the library's major version number. * * @return * The function returns the library's major version number. * * The function returns the major version number of the library. */ unsigned int cpl_version_get_major(void) { return CPL_MAJOR_VERSION; } /** * @brief * Get the library's minor version number. * * @return * The function returns the library's minor version number. * * The function returns the minor version number of the library. */ unsigned int cpl_version_get_minor(void) { return CPL_MINOR_VERSION; } /** * @brief * Get the library's micro version number. * * @return * The function returns the library's micro version number. * * The function returns the micro version number of the library. */ unsigned int cpl_version_get_micro(void) { return CPL_MICRO_VERSION; } /** * @brief * Get the library's interface age. * * @return * The function returns the library's interface age. * * The function returns the interface age of the library. */ unsigned int cpl_version_get_interface_age(void) { return CPL_INTERFACE_AGE; } /** * @brief * Get the library's binary age. * * @return * The function returns the library's binary age. * * The function returns the binary age of the library. */ unsigned int cpl_version_get_binary_age(void) { return CPL_BINARY_AGE; } /** * @brief * Get the library's version string. * * @return * The function returns the library's version string. * * The function returns the package version of the library as a string. The * returned version string is composed of the major, minor and, possibly, the * micro version of the library separated by dots. The micro version may * not be there if it is @c 0. */ const char * cpl_version_get_version(void) { return PACKAGE_VERSION; } /** * @brief * Get the library's binary version number. * * @return * The function returns the library's version number. * * The function returns the version number of the library encoded as a single * integer number. */ unsigned int cpl_version_get_binary_version(void) { return CPL_BINARY_VERSION; } /**@}*/ cpl-6.4.1/configure0000744000460300003120000216347612310332721011134 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for Common Pipeline Library 6.4.1. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and cpl-help@eso.org $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" lt_ltdl_dir='libltdl' SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Common Pipeline Library' PACKAGE_TARNAME='cpl' PACKAGE_VERSION='6.4.1' PACKAGE_STRING='Common Pipeline Library 6.4.1' PACKAGE_BUGREPORT='cpl-help@eso.org' PACKAGE_URL='' ac_unique_file="cpl.h" ac_default_prefix=${CPLDIR:-/usr/local} # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" enable_option_checking=no ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS subdirs GASGANO_SHREXT GASGANO_SUPPORT_FALSE GASGANO_SUPPORT_TRUE CPL_CFLAGS LIBCPLDFS LIBCPLUI LIBCPLDRS LIBCPLCORE configdir apidocdir CPL_LDFLAGS CPLDFS_INCLUDES CPLUI_INCLUDES CPLDRS_INCLUDES CPLCORE_INCLUDES cpl_libraries cpl_includes LIBOBJS LIBFFTWF FFTWF_LDFLAGS FFTWF_INCLUDES LIBFFTW FFTW_LDFLAGS FFTW_INCLUDES LIBWCS WCS_LDFLAGS WCS_INCLUDES LIBCFITSIO CFITSIO_LDFLAGS CFITSIO_INCLUDES libcext LIBCEXT CX_LDFLAGS CX_INCLUDES OPENMP_CFLAGS LIBPTHREAD PTHREAD_CFLAGS GASGANO_CLASSPATH JAVA_INCLUDES JAVAH JAVAC JAVA LIBTOOL_DEPS CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP SED host_os host_vendor host_cpu host LIBTOOL INCLTDL LTDLINCL LTDLDEPS LIBLTDL LATEX DOXYGEN EGREP GREP ESO_DEBUG_FLAGS USE_PURIFY_FALSE USE_PURIFY_TRUE PURIFY am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC LT_AGE LT_REVISION LT_CURRENT CPL_BINARY_AGE CPL_BINARY_VERSION CPL_INTERFACE_AGE CPL_MICRO_VERSION CPL_MINOR_VERSION CPL_MAJOR_VERSION CPL_VERSION_STRING CPL_VERSION MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_dependency_tracking enable_purify enable_debug enable_strict enable_profile enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock with_java with_java_includes with_java_includes_md with_gasgano with_gasgano_classpath enable_threads with_system_cext with_cext with_cext_includes with_cext_libs enable_cext_test enable_largefile with_cfitsio with_cfitsio_includes with_cfitsio_libs enable_cfitsio_test with_wcs with_wcs_includes with_wcs_libs with_fftw with_fftw_includes with_fftw_libs with_extra_includes with_extra_libs enable_memory_mode enable_max_ptrs enable_gasgano ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS PURIFY DOXYGEN LATEX CPP JAVA JAVAC JAVAH' ac_subdirs_all='libltdl libcext' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Common Pipeline Library 6.4.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/cpl] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Common Pipeline Library 6.4.1:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --disable-purify disables the check for the Purify installation --enable-debug creates debugging code [[default=no]] --enable-strict compiles with strict compiler options (may not work!) [[default=no]] --enable-profile compiles with compiler options necessary for profiling (may not work!) [[default=no]] --enable-shared[=PKGS] build shared libraries [default=no] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-threads enables thread support [default=yes] --disable-cext-test disables checks for the libcext library and headers --disable-largefile omit support for large files --disable-cfitsio-test disables checks for the cfitsio library and headers --enable-memory-mode=M where M=0 switches off the internal memory handling (default), M=1 exits the program whenever a memory allocation fails, M=2 switches on the internal memory handling --enable-max-ptrs=MAXPTRS MAXPTRS Set MAXPTRS as the maximum number of pointers allowed when using memory-mode=2 (200003) --enable-gasgano build the gasgano support library [[default=yes]] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-java location where java is installed --with-java-includes location of the java header files --with-java-includes-md location of the machine dependent java header files --with-gasgano location where Gasgano is installed --with-gasgano-classpath location where the Gasgano jar files are installed --with-system-cext Use the system cext installation for building [default=no] --with-cext location where libcext is installed --with-cext-includes location of the libcext header files --with-cext-libs location of the libcext library --with-cfitsio location where cfitsio is installed --with-cfitsio-includes location of the cfitsio header files --with-cfitsio-libs location of the cfitsio library --with-wcs location where wcs is installed --with-wcs-includes location of the libwcs header files --with-wcs-libs location of the libwcs library --with-fftw location where fftw is installed --with-fftw-includes location of the fftw header files --with-fftw-libs location of the fftw libraries --with-extra-includes=DIR adds non standard include paths --with-extra-libs=DIR adds non standard library paths Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory PURIFY Purify command DOXYGEN doxygen command LATEX latex command CPP C preprocessor JAVA Java application launcher JAVAC Java compiler command JAVAH Java C header and stub file generator Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Common Pipeline Library configure 6.4.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ------------------------------- ## ## Report this to cpl-help@eso.org ## ## ------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 &5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Common Pipeline Library $as_me 6.4.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in admin "$srcdir"/admin; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in admin \"$srcdir\"/admin" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ac_config_headers="$ac_config_headers config.h" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac am__api_version='1.13' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='cpl' VERSION='6.4.1' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE unset CDPATH # make $CPLDIR the default for the installation if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix ac_configure_args="$ac_configure_args --prefix $prefix" fi # Immediately before every release do: #------------------------------------- # if (the interface is totally unchanged from previous release) # REVISION++; # else { # /* interfaces have been added, removed or changed */ # REVISION = 0; # CURRENT++; # if (any interfaces have been _added_ since last release) # AGE++; # if (any interfaces have been _removed_ or incompatibly changed) # AGE = 0; # } # Order of arguments: VERSION, CURRENT, REVISION, AGE cpl_version_string="$VERSION" cpl_version=`echo "$VERSION" | sed -e 's/[a-z,A-Z].*$//'` cpl_major_version=`echo "$cpl_version" | \ sed 's/\([0-9]*\).\(.*\)/\1/'` cpl_minor_version=`echo "$cpl_version" | \ sed 's/\([0-9]*\).\([0-9]*\)\(.*\)/\2/'` cpl_micro_version=`echo "$cpl_version" | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test -z "$cpl_major_version"; then cpl_major_version=0 fi if test -z "$cpl_minor_version"; then cpl_minor_version=0 fi if test -z "$cpl_micro_version"; then cpl_micro_version=0 fi CPL_VERSION="$cpl_version" CPL_VERSION_STRING="$cpl_version_string" CPL_MAJOR_VERSION=$cpl_major_version CPL_MINOR_VERSION=$cpl_minor_version CPL_MICRO_VERSION=$cpl_micro_version if test -z "4"; then CPL_INTERFACE_AGE=0 else CPL_INTERFACE_AGE="4" fi CPL_BINARY_AGE=`expr 256 '*' $CPL_MINOR_VERSION + $CPL_MICRO_VERSION` CPL_BINARY_VERSION=`expr 65536 '*' $CPL_MAJOR_VERSION + $CPL_BINARY_AGE` cat >>confdefs.h <<_ACEOF #define CPL_MAJOR_VERSION $CPL_MAJOR_VERSION _ACEOF cat >>confdefs.h <<_ACEOF #define CPL_MINOR_VERSION $CPL_MINOR_VERSION _ACEOF cat >>confdefs.h <<_ACEOF #define CPL_MICRO_VERSION $CPL_MICRO_VERSION _ACEOF cat >>confdefs.h <<_ACEOF #define CPL_INTERFACE_AGE $CPL_INTERFACE_AGE _ACEOF cat >>confdefs.h <<_ACEOF #define CPL_BINARY_VERSION $CPL_BINARY_VERSION _ACEOF cat >>confdefs.h <<_ACEOF #define CPL_BINARY_AGE $CPL_BINARY_AGE _ACEOF if test -z "24"; then LT_CURRENT=0 else LT_CURRENT="24" fi if test -z "1"; then LT_REVISION=0 else LT_REVISION="1" fi if test -z "4"; then LT_AGE=0 else LT_AGE="4" fi ac_config_commands="$ac_config_commands cplcore/cpl_version.h.in" # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi if test "x$CC" != xcc; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi # # Check for purify # # Check whether --enable-purify was given. if test "${enable_purify+set}" = set; then : enableval=$enable_purify; enable_purify=$enableval else enable_purify=yes fi if test x"$enable_purify" = xyes ; then # Extract the first word of "purify", so it can be a program name with args. set dummy purify; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PURIFY+:} false; then : $as_echo_n "(cached) " >&6 else case $PURIFY in [\\/]* | ?:[\\/]*) ac_cv_path_PURIFY="$PURIFY" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PURIFY="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PURIFY=$ac_cv_path_PURIFY if test -n "$PURIFY"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PURIFY" >&5 $as_echo "$PURIFY" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "${PURIFY}"; then enable_purify=no PURIFY=":" fi fi if test "x$enable_purify" = "xyes"; then USE_PURIFY_TRUE= USE_PURIFY_FALSE='#' else USE_PURIFY_TRUE='#' USE_PURIFY_FALSE= fi flag=`echo std=c99 | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 $as_echo_n "checking whether $CC supports -std=c99... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -std=c99 -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -std=c99 -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L" CFLAGS="$CFLAGS -std=c99" else : fi flag=`echo fno-builtin | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-builtin" >&5 $as_echo_n "checking whether $CC supports -fno-builtin... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -fno-builtin -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -fno-builtin -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -fno-builtin" else : fi flag=`echo fno-common | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-common" >&5 $as_echo_n "checking whether $CC supports -fno-common... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -fno-common -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -fno-common -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -fno-common" else : fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; eso_enable_debug=$enableval else eso_enable_debug=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether debugging code should be created" >&5 $as_echo_n "checking whether debugging code should be created... " >&6; } if ${eso_cv_enable_debug+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_enable_debug=$eso_enable_debug fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_enable_debug" >&5 $as_echo "$eso_cv_enable_debug" >&6; } if test x"$eso_cv_enable_debug" = xyes; then eso_clean_CFLAGS="`echo $CFLAGS | sed -e 's/-O[0-9]//g' \ -e 's/-g[0-9]//g' \ -e 's/-g[a-z,A-Z]* / /g' \ -e 's/-[Og]//g'`" flag=`echo g3 | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -g3" >&5 $as_echo_n "checking whether $CC supports -g3... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -g3 -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -g3 -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -g3" else : fi if test x"$eso_cv_prog_cc_g3" = xyes; then CFLAGS="-g3" else if test x"$ac_cv_prog_cc_g" = xyes; then CFLAGS="-g" else CFLAGS="" fi fi flag=`echo ggdb | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -ggdb" >&5 $as_echo_n "checking whether $CC supports -ggdb... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -ggdb -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -ggdb -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -ggdb" else : fi flag=`echo O0 | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O0" >&5 $as_echo_n "checking whether $CC supports -O0... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -O0 -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -O0 -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -O0" else : fi flag=`echo rdynamic | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -rdynamic" >&5 $as_echo_n "checking whether $CC supports -rdynamic... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -rdynamic -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -rdynamic -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -rdynamic" else : fi flag=`echo Wall | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5 $as_echo_n "checking whether $CC supports -Wall... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -Wall -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -Wall -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -Wall" else : fi flag=`echo W | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -W" >&5 $as_echo_n "checking whether $CC supports -W... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -W -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -W -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -W" else : fi CFLAGS="$CFLAGS $eso_clean_CFLAGS" ESO_DEBUG_FLAGS="-DESO_ENABLE_DEBUG" else ESO_DEBUG_FLAGS="-DNDEBUG" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" # Check whether --enable-strict was given. if test "${enable_strict+set}" = set; then : enableval=$enable_strict; eso_enable_strict=$enableval else eso_enable_strict=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strict compiler options should be used" >&5 $as_echo_n "checking whether strict compiler options should be used... " >&6; } if ${eso_cv_enable_strict+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_enable_strict=$eso_enable_strict fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_enable_strict" >&5 $as_echo "$eso_cv_enable_strict" >&6; } if test x"$eso_cv_enable_strict" = xyes; then eso_enable_strict_std_set=no if test -n "$CFLAGS"; then echo $CFLAGS | $EGREP '(\-std=|-ansi)' >/dev/null 2>&1 if test x"$?" = x0; then eso_enable_strict_std_set=yes fi fi if test x"$eso_enable_strict_std_set" = xno; then flag=`echo std=c99 | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 $as_echo_n "checking whether $CC supports -std=c99... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -std=c99 -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -std=c99 -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -std=c99" else : fi fi flag=`echo pedantic | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -pedantic" >&5 $as_echo_n "checking whether $CC supports -pedantic... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -pedantic -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -pedantic -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -pedantic" else : fi fi # Check whether --enable-profile was given. if test "${enable_profile+set}" = set; then : enableval=$enable_profile; eso_enable_profile=$enableval else eso_enable_profile=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether profiling compiler options should be used" >&5 $as_echo_n "checking whether profiling compiler options should be used... " >&6; } if ${eso_cv_enable_profile+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_enable_profile=$eso_enable_profile fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $eso_cv_enable_profile" >&5 $as_echo "$eso_cv_enable_profile" >&6; } if test x"$eso_cv_enable_profile" = xyes; then flag=`echo pg | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -pg" >&5 $as_echo_n "checking whether $CC supports -pg... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -pg -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -pg -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -pg" else : fi flag=`echo g | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -g" >&5 $as_echo_n "checking whether $CC supports -g... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -g -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -g -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -g" else : fi flag=`echo static-libgcc | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -static-libgcc" >&5 $as_echo_n "checking whether $CC supports -static-libgcc... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -static-libgcc -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -static-libgcc -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : CFLAGS="$CFLAGS -static-libgcc" else : fi # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=no fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi fi # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DOXYGEN+:} false; then : $as_echo_n "(cached) " >&6 else case $DOXYGEN in [\\/]* | ?:[\\/]*) ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DOXYGEN="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DOXYGEN=$ac_cv_path_DOXYGEN if test -n "$DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5 $as_echo "$DOXYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "latex", so it can be a program name with args. set dummy latex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LATEX+:} false; then : $as_echo_n "(cached) " >&6 else case $LATEX in [\\/]* | ?:[\\/]*) ac_cv_path_LATEX="$LATEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LATEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi LATEX=$ac_cv_path_LATEX if test -n "$LATEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LATEX" >&5 $as_echo "$LATEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "${DOXYGEN}"; then DOXYGEN=":" fi if test -z "${LATEX}"; then LATEX=":" fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi case $enable_ltdl_convenience in no) as_fn_error $? "this package needs a convenience libltdl" "$LINENO" 5 ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='${top_build_prefix}'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" LTDLDEPS=$LIBLTDL LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: cpl_java_check_java="java" cpl_java_check_javac="javac" cpl_java_check_javah="javah" cpl_java_check_header="jni.h" cpl_java_check_header_md="jni_md.h" cpl_java_path="" # Check whether --with-java was given. if test "${with_java+set}" = set; then : withval=$with_java; cpl_with_java=$withval fi # Check whether --with-java-includes was given. if test "${with_java_includes+set}" = set; then : withval=$with_java_includes; cpl_with_java_includes=$withval fi # Check whether --with-java-includes-md was given. if test "${with_java_includes_md+set}" = set; then : withval=$with_java_includes_md; cpl_with_java_includes_md=$withval fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Java Development Kit" >&5 $as_echo_n "checking for Java Development Kit... " >&6; } if ${cpl_cv_path_java+:} false; then : $as_echo_n "(cached) " >&6 else if test x"$cpl_with_java" != xno; then if test -z "$cpl_with_java"; then test -n "$JAVA_HOME" && cpl_java_dirs="$JAVA_HOME/bin $JAVA_HOME/Commands" else cpl_java_dirs="$cpl_with_java/bin $cpl_with_java/Commands" fi cpl_java_path=no for i in $cpl_java_dirs; do for j in $cpl_java_check_java; do echo "configure: 13153: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_java_path=$i break 2 fi done done else cpl_java_path="no" fi if test x"$cpl_java_path" = xno; then cpl_cv_path_java="no" JAVA=":" JAVAC=":" else JAVA="$cpl_java_path/$cpl_java_check_java" if test -x $cpl_java_path/$cpl_java_check_javac; then JAVAC="$cpl_java_path/$cpl_java_check_javac" else JAVAC=":" fi if test -x $cpl_java_path/$cpl_java_check_javah; then JAVAH="$cpl_java_path/$cpl_java_check_javah" else JAVAH=":" fi cpl_cv_path_java="`echo $cpl_java_path | sed -e 's;/bin$;;'`" if test $cpl_cv_path_java = $cpl_java_path ; then cpl_cv_path_java="`echo $cpl_java_path | sed -e 's;/Commands$;;'`" fi fi fi if ${cpl_cv_env_java_os+:} false; then : $as_echo_n "(cached) " >&6 else if test x"$cpl_cv_path_java" = xno; then cpl_cv_env_java_os="unknown" else case $build in *-*-linux*) cpl_cv_env_java_os="linux" ;; *-*-freebsd*) cpl_cv_env_java_os="bsd" ;; *-*-solaris*) cpl_cv_env_java_os="solaris" ;; *-*-hpux*) cpl_cv_env_java_os="hp-ux" ;; *-*-irix*) cpl_cv_env_java_os="irix" ;; *-*-aix*) cpl_cv_env_java_os="aix" ;; *-*-sequent*) cpl_cv_env_java_os="ptx" ;; *-*-os390*) cpl_cv_env_java_os="os390" ;; *-*-os400*) cpl_cv_env_java_os="os400" ;; *-apple-darwin*|*-apple-rhapsody*) cpl_cv_env_java_os="darwin" ;; *-*-cygwin*|*-*-mingw*) cpl_cv_env_java_os="win32" ;; *) if test -d $cpl_cv_path_java/include/genunix; then cpl_cv_env_java_os="genunix" else cpl_cv_env_java_os="unknown" fi ;; esac fi fi if ${cpl_cv_header_java+:} false; then : $as_echo_n "(cached) " >&6 else if test x"$cpl_cv_path_java" = xno; then cpl_java_includes="no" else if test -z "$cpl_with_java_includes"; then cpl_java_incdirs="$cpl_cv_path_java/include $cpl_cv_path_java/Headers" else cpl_java_incdirs="$cpl_with_java_includes" fi cpl_java_includes=no for i in $cpl_java_incdirs; do for j in $cpl_java_check_header; do echo "configure: 13269: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_java_includes=$i break 2 fi done done fi if test x"$cpl_java_includes" = xno; then cpl_cv_header_java="no" else cpl_cv_header_java="$cpl_java_includes" fi fi if ${cpl_cv_header_java_md+:} false; then : $as_echo_n "(cached) " >&6 else if test x"$cpl_cv_path_java" = xno || test x"$cpl_cv_header_java" = xno; then cpl_cv_header_java_md="no" else cpl_java_includes_md="no" if test -z "$cpl_with_java_includes_md"; then cpl_java_incdirs="$cpl_cv_header_java" if test x"$cpl_cv_env_java_os" != xunknown; then cpl_java_incdirs="$cpl_cv_header_java/$cpl_cv_env_java_os $cpl_java_incdirs" fi cpl_java_includes_md=no for i in $cpl_java_incdirs; do for j in $cpl_java_check_header_md; do echo "configure: 13314: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_java_includes_md=$i break 2 fi done done else cpl_java_incdirs="$cpl_with_java_includes_md" cpl_java_includes_md=no for i in $cpl_java_incdirs; do for j in $cpl_java_check_header_md; do echo "configure: 13332: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_java_includes_md=$i break 2 fi done done fi cpl_cv_header_java_md="$cpl_java_includes_md" fi fi if test x"$cpl_cv_path_java" = xno; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } else if test x"$cpl_cv_header_java" = xno || test x"$cpl_cv_header_java_md" = xno; then if test x"$cpl_cv_header_java" = xno; then if test x"$cpl_cv_header_java_md" = xno; then cpl_java_notfound="$cpl_java_check_header and $cpl_java_check_header_md" else cpl_java_notfound="$cpl_java_check_header" fi else cpl_java_notfound="$cpl_java_check_header_md" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_cv_path_java, headers $cpl_java_notfound not found" >&5 $as_echo "$cpl_cv_path_java, headers $cpl_java_notfound not found" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_cv_path_java, headers $cpl_cv_header_java, $cpl_cv_header_java_md" >&5 $as_echo "$cpl_cv_path_java, headers $cpl_cv_header_java, $cpl_cv_header_java_md" >&6; } fi fi # Setup the Makefile symbols if test x"$cpl_cv_path_java" != xno; then if test -f "$cpl_cv_path_java/Commands/java" ; then JAVA="$cpl_cv_path_java/Commands/java" else JAVA="$cpl_cv_path_java/bin/java" fi if test x"$cpl_cv_header_java" != xno && test x"$cpl_cv_header_java_md" != xno; then JAVA_INCLUDES="-I$cpl_cv_header_java -I$cpl_cv_header_java_md" else JAVA_INCLUDES="" fi else JAVA=":" JAVA_INCLUDES="" fi cpl_gasgano_check_prog="gasgano" cpl_gasgano_prog="no" # Check whether --with-gasgano was given. if test "${with_gasgano+set}" = set; then : withval=$with_gasgano; cpl_with_gasgano=$withval fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $cpl_gasgano_check_prog" >&5 $as_echo_n "checking for $cpl_gasgano_check_prog... " >&6; } if ${cpl_cv_path_gasgano+:} false; then : $as_echo_n "(cached) " >&6 else if test x"$cpl_with_gasgano" != xno; then if test -z "$cpl_with_gasgano"; then cpl_gasgano_dirs="$HOME/gasgano/bin /opt/gasgano/bin /usr/local/gasgano/bin" test -n "$GASGANODIR" && cpl_gasgano_dirs="$GASGANODIR/bin \ $cpl_gasgano_dirs" else cpl_gasgano_dirs="$cpl_with_gasgano/bin" fi cpl_gasgano_prog=no for i in $cpl_gasgano_dirs; do for j in $cpl_gasgano_check_prog; do echo "configure: 13440: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_gasgano_prog=$i break 2 fi done done fi if test "x$cpl_gasgano_prog" = xno; then cpl_cv_path_gasgano="no" else cpl_cv_path_gasgano="`echo $cpl_gasgano_prog | sed -e 's/\/bin$//'`" fi fi if ${cpl_cv_prog_gasgano+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$cpl_cv_path_gasgano"; then if test -x "$cpl_cv_path_gasgano/bin/$cpl_gasgano_check_prog"; then cpl_cv_prog_gasgano="$cpl_cv_path_gasgano/bin/$cpl_gasgano_check_prog" else cpl_cv_prog_gasgano="no" fi fi fi if test x"$cpl_cv_prog_gasgano" = xno; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_cv_prog_gasgano" >&5 $as_echo "$cpl_cv_prog_gasgano" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gasgano jar files" >&5 $as_echo_n "checking for gasgano jar files... " >&6; } cpl_gasgano_check_jar="gasgano.jar" cpl_gasgano_jarfiles="no" GASGANO_CLASSPATH="" # Check whether --with-gasgano-classpath was given. if test "${with_gasgano_classpath+set}" = set; then : withval=$with_gasgano_classpath; cpl_with_gasgano_jarfiles=$withval fi if ${cpl_cv_classpath_gasgano+:} false; then : $as_echo_n "(cached) " >&6 else if test x"$cpl_cv_path_gasgano" != xno; then if test -z "$cpl_with_gasgano_jarfiles"; then cpl_gasgano_jardirs="$cpl_cv_path_gasgano/share" else cpl_gasgano_jardirs="$cpl_with_gasgano_jarfiles" fi cpl_gasgano_jarfiles=no for i in $cpl_gasgano_jardirs; do for j in $cpl_gasgano_check_jar; do echo "configure: 13526: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_gasgano_jarfiles=$i break 2 fi done done if test "x$cpl_gasgano_jarfiles" = xno; then cpl_cv_path_gasgano_jarfiles="no" else cpl_cv_path_gasgano_jarfiles="$cpl_gasgano_jarfiles" fi else cpl_cv_path_gasgano_jarfiles="no" fi fi if test x"$cpl_cv_path_gasgano_jarfiles" = xno; then GASGANO_CLASSPATH="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } else GASGANO_CLASSPATH="" for f in `ls -1 $cpl_cv_path_gasgano_jarfiles/*.jar`; do if test -z "$GASGANO_CLASSPATH"; then GASGANO_CLASSPATH="$f" else GASGANO_CLASSPATH="$GASGANO_CLASSPATH:$f" fi done { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_cv_path_gasgano_jarfiles" >&5 $as_echo "$cpl_cv_path_gasgano_jarfiles" >&6; } fi flag=`echo pthread | sed 'y%.=/+-%___p_%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -pthread" >&5 $as_echo_n "checking whether $CC supports -pthread... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else eval "eso_cv_prog_cc_$flag=no" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo 'int main() { return 0; }' >conftest.$ac_ext try_compile="`$CC -pthread -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then try_link="`$CC -pthread -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" fi fi rm -f conftest* ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi eval ac_res=\$eso_cv_prog_cc_$flag { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : else : fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : eso_threads_have_libpthread=yes else eso_threads_have_libpthread=no fi ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes; then : eso_threads_have_pthread_h=yes else eso_threads_have_pthread_h=no fi if test x"$eso_threads_have_pthread_h" != xyes; then eso_threads_posix=no else if test x"$eso_threads_have_libpthread" != xyes && \ test x"$eso_cv_prog_cc_pthread" != xyes; then eso_threads_posix=no else eso_threads_posix=yes fi fi # Setup the POSIX thread symbols if test x"$eso_threads_have_pthread_h" = xyes; then $as_echo "#define HAVE_PTHREAD_H 1" >>confdefs.h fi if test x"$eso_threads_posix" = xyes; then if test x"$eso_cv_prog_cc_pthread" = xyes; then PTHREAD_CFLAGS="-pthread" else PTHREAD_CFLAGS="" fi if test x"$eso_threads_have_libpthread" = xyes; then LIBPTHREAD="-lpthread" else LIBPTHREAD="" fi fi if ${eso_cv_threads_posix_header+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_threads_posix_header=$eso_threads_have_pthread_h fi if ${eso_cv_threads_posix_lib+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_threads_posix_lib=$eso_threads_have_libpthread fi if ${eso_cv_threads_posix_flags+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_threads_posix_flags=$eso_cv_prog_cc_pthread fi if ${eso_cv_threads_posix+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_threads_posix=$eso_threads_posix fi OPENMP_CFLAGS= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the compiler option to support OpenMP" >&5 $as_echo_n "checking for the compiler option to support OpenMP... " >&6; } if ${ac_cv_prog_c_openmp+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _OPENMP choke me #endif #include int var; #pragma omp threadprivate(var) int main () { return omp_get_num_threads (); } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_prog_c_openmp='none needed' else ac_cv_prog_c_openmp='unsupported' for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \ -Popenmp --openmp; do ac_save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $ac_option" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _OPENMP choke me #endif #include int var; #pragma omp threadprivate(var) int main () { return omp_get_num_threads (); } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_prog_c_openmp=$ac_option fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$ac_save_CFLAGS if test "$ac_cv_prog_c_openmp" != unsupported; then break fi done fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_c_openmp" >&5 $as_echo "$ac_cv_prog_c_openmp" >&6; } case $ac_cv_prog_c_openmp in #( "none needed" | unsupported) ;; #( *) OPENMP_CFLAGS=$ac_cv_prog_c_openmp ;; esac # Check whether --enable-threads was given. if test "${enable_threads+set}" = set; then : enableval=$enable_threads; cpl_enable_threads=$enableval else cpl_enable_threads=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether thread support is available" >&5 $as_echo_n "checking whether thread support is available... " >&6; } if test x"$cpl_enable_threads" = xyes; then if test x"$eso_cv_threads_posix" = xno && \ test x"$ac_cv_prog_c_openmp" = xno; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "Thread support was requested, but the system does not support it!" "$LINENO" 5 else CFLAGS="-D_REENTRANT $CFLAGS" cat >>confdefs.h <<_ACEOF #define CPL_THREADS_ENABLED 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } case $ac_cv_prog_c_openmp in "none needed" | unsupported) if test x"$eso_cv_threads_posix_lib" = xyes; then echo $LIBS | grep -q -e "$LIBPTHREAD" || LIBS="$LIBPTHREAD $LIBS" else CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS" fi ;; *) # FIXME: Explicitly add the OpenMP runtime library, since libtool # removes the compiler flag when linking! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing omp_get_num_threads" >&5 $as_echo_n "checking for library containing omp_get_num_threads... " >&6; } if ${ac_cv_search_omp_get_num_threads+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char omp_get_num_threads (); int main () { return omp_get_num_threads (); ; return 0; } _ACEOF for ac_lib in '' gomp mtsk omp; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_omp_get_num_threads=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_omp_get_num_threads+:} false; then : break fi done if ${ac_cv_search_omp_get_num_threads+:} false; then : else ac_cv_search_omp_get_num_threads=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_omp_get_num_threads" >&5 $as_echo "$ac_cv_search_omp_get_num_threads" >&6; } ac_res=$ac_cv_search_omp_get_num_threads if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else as_fn_error $? "OpenMP runtime environment not found!" "$LINENO" 5 fi CFLAGS="$CFLAGS $OPENMP_CFLAGS" LDFLAGS="$LDFLAGS $OPENMP_CFLAGS" ;; esac cpl_threads_enabled=yes fi else cpl_threads_enabled=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } fi if ${cpl_cv_threads_enabled+:} false; then : $as_echo_n "(cached) " >&6 else cpl_cv_threads_enabled=$cpl_threads_enabled fi # Checks for libraries. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_socket=yes else ac_cv_lib_socket_socket=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } if test "x$ac_cv_lib_socket_socket" = xyes; then : LIBS="$LIBS -lsocket" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lnsl" >&5 $as_echo_n "checking for inet_ntoa in -lnsl... " >&6; } if ${ac_cv_lib_nsl_inet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char inet_ntoa (); int main () { return inet_ntoa (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_inet_ntoa=yes else ac_cv_lib_nsl_inet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_inet_ntoa" >&5 $as_echo "$ac_cv_lib_nsl_inet_ntoa" >&6; } if test "x$ac_cv_lib_nsl_inet_ntoa" = xyes; then : LIBS="$LIBS -lnsl" fi libcext="libcext" # Check whether --with-system-cext was given. if test "${with_system_cext+set}" = set; then : withval=$with_system_cext; cpl_with_system_cext=$withval fi if test x"$cpl_with_system_cext" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcext" >&5 $as_echo_n "checking for libcext... " >&6; } cpl_cext_check_header="cxtypes.h" cpl_cext_check_lib="libcext.a" cpl_cext_incdirs="" cpl_cext_libdirs="" cpl_cext_includes="" cpl_cext_libraries="" # Initialize directory search paths with the arguments provided if test -n ""; then cpl_cext_incdirs="" fi if test -n ""; then cpl_cext_libdirs="" fi # Check whether --with-cext was given. if test "${with_cext+set}" = set; then : withval=$with_cext; cpl_with_cext=$withval fi # Check whether --with-cext-includes was given. if test "${with_cext_includes+set}" = set; then : withval=$with_cext_includes; cpl_with_cext_includes=$withval fi # Check whether --with-cext-libs was given. if test "${with_cext_libs+set}" = set; then : withval=$with_cext_libs; cpl_with_cext_libs=$withval fi # Check whether --enable-cext-test was given. if test "${enable_cext_test+set}" = set; then : enableval=$enable_cext_test; cpl_enable_cext_test=$enableval else cpl_enable_cext_test=yes fi if test "x$cpl_enable_cext_test" = xyes; then # Check for the libcext includes if test -z "$cpl_with_cext_includes"; then if test -z "$cpl_with_cext"; then if test -z "$cpl_cext_incdirs"; then # Try some known system locations cpl_cext_incdirs="/opt/cext/include" cpl_cext_incdirs="$cpl_cext_incdirs /usr/local/include/cext" cpl_cext_incdirs="$cpl_cext_incdirs /usr/local/include" cpl_cext_incdirs="$cpl_cext_incdirs /usr/include/cext" cpl_cext_incdirs="$cpl_cext_incdirs /usr/include" test -n "$CPLDIR" && \ cpl_cext_incdirs="$CPLDIR/include/cext \ $CPLDIR/include \ $cpl_cext_incdirs" fi else cpl_cext_incdirs="$cpl_with_cext/include/cext" cpl_cext_incdirs="$cpl_cext_incdirs $cpl_with_cext/include" fi else cpl_cext_incdirs="$cpl_with_cext_includes" fi cpl_cext_includes=no for i in $cpl_cext_incdirs; do for j in $cpl_cext_check_header; do echo "configure: 14137: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_cext_includes=$i break 2 fi done done # Check for the libcext library if test -z "$cpl_with_cext_libs"; then if test -z "$cpl_with_cext"; then if test -z "$cpl_cext_libdirs"; then # Try some known system locations cpl_cext_libdirs="/opt/cext/lib" cpl_cext_libdirs="$cpl_cext_libdirs /usr/local/lib64" cpl_cext_libdirs="$cpl_cext_libdirs /usr/local/lib" cpl_cext_libdirs="$cpl_cext_libdirs /usr/local/lib32" cpl_cext_libdirs="$cpl_cext_libdirs /usr/lib64" cpl_cext_libdirs="$cpl_cext_libdirs /usr/lib" cpl_cext_libdirs="$cpl_cext_libdirs /usr/lib32" test -n "$CPLDIR" && \ cpl_cext_libdirs="$CPLDIR/lib64 \ $CPLDIR/lib \ $CPLDIR/lib32 \ $cpl_cext_libdirs" fi else cpl_cext_libdirs="$cpl_with_cext/lib64" cpl_cext_libdirs="$cpl_cext_libdirs $cpl_with_cext/lib" cpl_cext_libdirs="$cpl_cext_libdirs $cpl_with_cext/lib32" fi else cpl_cext_libdirs="$cpl_with_cext_libs" fi cpl_cext_libraries=no for i in $cpl_cext_libdirs; do for j in $cpl_cext_check_lib; do echo "configure: 14193: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_cext_libraries=$i break 2 fi done done if test x"$cpl_cext_includes" = xno || \ test x"$cpl_cext_libraries" = xno; then cpl_cext_notfound="" if test x"$cpl_cext_includes" = xno; then if test x"$cpl_cext_libraries" = xno; then cpl_cext_notfound="(headers and libraries)" else cpl_cext_notfound="(headers)" fi else cpl_cext_notfound="(libraries)" fi as_fn_error $? "libcext $cpl_cext_notfound was not found on your system. Please check!" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $cpl_cext_libraries, headers $cpl_cext_includes" >&5 $as_echo "libraries $cpl_cext_libraries, headers $cpl_cext_includes" >&6; } fi # Set up the symbols CX_INCLUDES="-I$cpl_cext_includes" CX_LDFLAGS="-L$cpl_cext_libraries" LIBCEXT="-lcext" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libcext can be used" >&5 $as_echo_n "checking whether libcext can be used... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cpl_cext_cflags_save="$CFLAGS" cpl_cext_ldflags_save="$LDFLAGS" cpl_cext_libs_save="$LIBS" CFLAGS="$CX_INCLUDES $CFLAGS" LDFLAGS="$CX_LDFLAGS $LDFLAGS" LIBS="$LIBCEXT" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { cx_program_set_name("MyProgram"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : cpl_cext_is_usable="yes" else cpl_cext_is_usable="no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_cext_is_usable" >&5 $as_echo "$cpl_cext_is_usable" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS="$cpl_cext_cflags_save" LDFLAGS="$cpl_cext_ldflags_save" LIBS="$cpl_cext_libs_save" if test x"$cpl_cext_is_usable" = xno; then as_fn_error $? "Linking with libcext failed! Please check architecture!" "$LINENO" 5 fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libcext checks have been disabled! This package may not build!" >&5 $as_echo "$as_me: WARNING: libcext checks have been disabled! This package may not build!" >&2;} CX_INCLUDES="" CX_LDFLAGS="" LIBCEXT="" fi libcext="" else if test -n ""; then libcext="" fi if test ! -d "$srcdir/$libcext"; then as_fn_error $? "libcext source tree was not found in \`$srcdir/$libcext'" "$LINENO" 5 else if ${cpl_cv_with_system_cext+:} false; then : $as_echo_n "(cached) " >&6 else cpl_cv_with_system_cext=$cpl_with_system_cext fi # Setup the symbols CX_INCLUDES="-I\$(top_builddir)/libcext/cext" CX_INCLUDES="$CX_INCLUDES -I\$(top_srcdir)/$libcext/cext" CX_LDFLAGS="" LIBCEXT="\$(top_builddir)/libcext/cext/libcext.la" fi fi # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi cpl_cfitsio_check_version="3.310" cpl_cfitsio_check_header="fitsio.h" cpl_cfitsio_check_lib="libcfitsio.a" cpl_cfitsio_incdirs="" cpl_cfitsio_libdirs="" cpl_cfitsio_includes="" cpl_cfitsio_libraries="" # Check whether --with-cfitsio was given. if test "${with_cfitsio+set}" = set; then : withval=$with_cfitsio; cpl_with_cfitsio=$withval fi # Check whether --with-cfitsio-includes was given. if test "${with_cfitsio_includes+set}" = set; then : withval=$with_cfitsio_includes; cpl_with_cfitsio_includes=$withval fi # Check whether --with-cfitsio-libs was given. if test "${with_cfitsio_libs+set}" = set; then : withval=$with_cfitsio_libs; cpl_with_cfitsio_libs=$withval fi # Check whether --enable-cfitsio-test was given. if test "${enable_cfitsio_test+set}" = set; then : enableval=$enable_cfitsio_test; cpl_enable_cfitsio_test=$enableval else cpl_enable_cfitsio_test=yes fi # We need libpthread for the folloing tests if test -z "$LIBPTHREAD"; then as_fn_error $? "POSIX thread library was not found on your system! Please check!" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cfitsio" >&5 $as_echo_n "checking for cfitsio... " >&6; } if test "x$cpl_enable_cfitsio_test" = xyes; then # Check for the cfitsio includes if test -z "$cpl_with_cfitsio_includes"; then if test -z "$cpl_with_cfitsio"; then # Try some known system locations cpl_cfitsio_incdirs="/opt/cfitsio/include" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/local/include/libcfitsio0" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/local/include/cfitsio" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/local/include" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/include/libcfitsio0" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/include/cfitsio" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs /usr/include" test -n "$CFITSIODIR" && \ cpl_cfitsio_incdirs="$CFITSIODIR/include/libcfitsio0 \ $CFITSIODIR/include/cfitsio \ $CFITSIODIR/include \ $cpl_cfitsio_incdirs" test -n "$CPLDIR" && \ cpl_cfitsio_incdirs="$CPLDIR/include/libcfitsio0 \ $CPLDIR/include/cfitsio \ $CPLDIR/include \ $cpl_cfitsio_incdirs" else cpl_cfitsio_incdirs="$cpl_with_cfitsio/include/libcfitsio0" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs $cpl_with_cfitsio/include/cfitsio" cpl_cfitsio_incdirs="$cpl_cfitsio_incdirs $cpl_with_cfitsio/include" fi else cpl_cfitsio_incdirs="$cpl_with_cfitsio_includes" fi cpl_cfitsio_includes=no for i in $cpl_cfitsio_incdirs; do for j in $cpl_cfitsio_check_header; do echo "configure: 14648: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_cfitsio_includes=$i break 2 fi done done # Check for the cfitsio library if test -z "$cpl_with_cfitsio_libs"; then if test -z "$cpl_with_cfitsio"; then # Try some known system locations cpl_cfitsio_libdirs="/opt/cfitsio/lib" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/local/lib64" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/local/lib" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/local/lib32" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/lib64" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/lib" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs /usr/lib32" test -n "$CFITSIODIR" && \ cpl_cfitsio_libdirs="$CFITSIODIR/lib64 $CFITSIODIR/lib \ $CFITSIODIR/lib32 $cpl_cfitsio_libdirs" test -n "$CPLDIR" && \ cpl_cfitsio_libdirs="$CPLDIR/lib64 $CPLDIR/lib $CPLDIR/lib32 \ $cpl_cfitsio_libdirs" else cpl_cfitsio_libdirs="$cpl_with_cfitsio/lib64" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs $cpl_with_cfitsio/lib" cpl_cfitsio_libdirs="$cpl_cfitsio_libdirs $cpl_with_cfitsio/lib32" fi else cpl_cfitsio_libdirs="$cpl_with_cfitsio_libs" fi cpl_cfitsio_libraries=no for i in $cpl_cfitsio_libdirs; do for j in $cpl_cfitsio_check_lib; do echo "configure: 14702: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_cfitsio_libraries=$i break 2 fi done done if test x"$cpl_cfitsio_includes" = xno || \ test x"$cpl_cfitsio_libraries" = xno; then cpl_cfitsio_notfound="" if test x"$cpl_cfitsio_includes" = xno; then if test x"$cpl_cfitsio_libraries" = xno; then cpl_cfitsio_notfound="(headers and libraries)" else cpl_cfitsio_notfound="(headers)" fi else cpl_cfitsio_notfound="(libraries)" fi as_fn_error $? "cfitsio $cpl_cfitsio_notfound was not found on your system. Please check!" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $cpl_cfitsio_libraries, headers $cpl_cfitsio_includes" >&5 $as_echo "libraries $cpl_cfitsio_libraries, headers $cpl_cfitsio_includes" >&6; } fi # Set up the symbols # Add '-lz' to the static library symbol, as distributors apparently # remove the libz code from the cfitsio sources. CFITSIO_INCLUDES="-I$cpl_cfitsio_includes" CFITSIO_LDFLAGS="-L$cpl_cfitsio_libraries" LIBCFITSIO="-lcfitsio" LIBCFITSIO_STATIC="$cpl_cfitsio_libraries/$cpl_cfitsio_check_lib" # Do not add redundant libraries echo $LIBS | grep -q -e '-lm' || LIBS="-lm $LIBS" # Check whether cfitsio can be used { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cfitsio can be used" >&5 $as_echo_n "checking whether cfitsio can be used... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cpl_cfitsio_cflags_save="$CFLAGS" cpl_cfitsio_ldflags_save="$LDFLAGS" cpl_cfitsio_libs_save="$LIBS" CFLAGS="$CFITSIO_INCLUDES $CFLAGS" LDFLAGS="$CFITSIO_LDFLAGS $LDFLAGS" LIBS="$LIBCFITSIO_STATIC $LIBPTHREAD -lm" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { float v; fits_get_version(&v); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : cpl_cfitsio_is_usable="yes" else cpl_cfitsio_is_usable="no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_cfitsio_is_usable" >&5 $as_echo "$cpl_cfitsio_is_usable" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS="$cpl_cfitsio_cflags_save" LDFLAGS="$cpl_cfitsio_ldflags_save" LIBS="$cpl_cfitsio_libs_save" if test x"$cpl_cfitsio_is_usable" = xno; then as_fn_error $? "Linking with cfitsio failed! Please check architecture!" "$LINENO" 5 fi # Check cfitsio version { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a cfitsio version >= $cpl_cfitsio_check_version" >&5 $as_echo_n "checking for a cfitsio version >= $cpl_cfitsio_check_version... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cpl_cfitsio_cflags_save="$CFLAGS" cpl_cfitsio_ldflags_save="$LDFLAGS" cpl_cfitsio_libs_save="$LIBS" CFLAGS="$CFITSIO_INCLUDES $CFLAGS" if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { int vlib = 0; int vmin = (int)(1000. * $cpl_cfitsio_check_version + 0.5); float v = CFITSIO_VERSION; vlib = (int)(v * 1000 + 0.5); FILE* f = fopen("conftest.out", "w"); fprintf(f, "%5.3f\n", v); fclose(f); if (vlib < vmin) { return 1; } return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : cpl_cfitsio_version="`cat conftest.out`" else cpl_cfitsio_version="no"; cpl_cfitsio_version_found="`cat conftest.out`" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_cfitsio_version" >&5 $as_echo "$cpl_cfitsio_version" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS="$cpl_cfitsio_cflags_save" LDFLAGS="$cpl_cfitsio_ldflags_save" LIBS="$cpl_cfitsio_libs_save" if test x"$cpl_cfitsio_version" = xno; then as_fn_error $? "Installed cfitsio ($cpl_cfitsio_version_found) is too old. Please update to version $cpl_cfitsio_check_version or newer." "$LINENO" 5 fi # Check whether cfitsio has large file support ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cpl_cfitsio_cflags_save="$CFLAGS" cpl_cfitsio_ldflags_save="$LDFLAGS" cpl_cfitsio_libs_save="$LIBS" CFLAGS="$CFITSIO_INCLUDES $CFLAGS" LDFLAGS="$CFITSIO_LDFLAGS $LDFLAGS" LIBS="$LIBCFITSIO_STATIC -lm $LIBPTHREAD" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cfitsio provides fits_hdu_getoff()" >&5 $as_echo_n "checking whether cfitsio provides fits_hdu_getoff()... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { fitsfile f; int sts; fits_get_hduoff(&f, NULL, NULL, NULL, &sts); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cpl_cfitsio_have_fits_get_hduoff="yes" else cpl_cfitsio_have_fits_get_hduoff="no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_cfitsio_have_fits_get_hduoff" >&5 $as_echo "$cpl_cfitsio_have_fits_get_hduoff" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cfitsio provides fits_get_hduaddrll()" >&5 $as_echo_n "checking whether cfitsio provides fits_get_hduaddrll()... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { fitsfile f; int sts; fits_get_hduaddrll(&f, NULL, NULL, NULL, &sts); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cpl_cfitsio_have_fits_get_hduaddrll="yes" else cpl_cfitsio_have_fits_get_hduaddrll="no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_cfitsio_have_fits_get_hduaddrll" >&5 $as_echo "$cpl_cfitsio_have_fits_get_hduaddrll" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS="$cpl_cfitsio_cflags_save" LDFLAGS="$cpl_cfitsio_ldflags_save" LIBS="$cpl_cfitsio_libs_save" # Check whether cfitsio is thread-safe { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cfitsio was compiled with thread support" >&5 $as_echo_n "checking whether cfitsio was compiled with thread support... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cpl_cfitsio_cflags_save="$CFLAGS" cpl_cfitsio_ldflags_save="$LDFLAGS" cpl_cfitsio_libs_save="$LIBS" CFLAGS="$CFITSIO_INCLUDES $CFLAGS" LDFLAGS="$CFITSIO_LDFLAGS $LDFLAGS" LIBS="$LIBCFITSIO_STATIC -lm" if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { if (fits_is_reentrant() == 0) { return 1; } return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : cpl_cfitsio_is_thread_safe=yes else cpl_cfitsio_is_thread_safe=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_cfitsio_is_thread_safe" >&5 $as_echo "$cpl_cfitsio_is_thread_safe" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS="$cpl_cfitsio_cflags_save" LDFLAGS="$cpl_cfitsio_ldflags_save" LIBS="$cpl_cfitsio_libs_save" # Set compiler flags and libraries if test x"$cpl_cfitsio_have_fits_get_hduoff" = xyes || \ test x"$cpl_cfitsio_have_fits_get_hduaddrll" = xyes; then if test x"$cpl_cfitsio_have_fits_get_hduoff"; then $as_echo "#define HAVE_FITS_GET_HDUOFF 1" >>confdefs.h else $as_echo "#define HAVE_FITS_GET_HDUADDRLL 1" >>confdefs.h fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cfitsio checks have been disabled! This package may not build!" >&5 $as_echo "$as_me: WARNING: cfitsio checks have been disabled! This package may not build!" >&2;} CFITSIO_INCLUDES="" CFITSIO_LDFLAGS="" LIBCFITSIO="" cpl_cfitsio_is_thread_safe="undefined" fi if ${cpl_cv_cfitsio_is_thread_safe+:} false; then : $as_echo_n "(cached) " >&6 else cpl_cv_cfitsio_is_thread_safe=$cpl_cfitsio_is_thread_safe fi if test x"$cpl_cv_threads_enabled" = xyes && \ test x"$cpl_cv_cfitsio_is_thread_safe" = xno; then as_fn_error $? "Building with thread support requires a thread-safe libcfitsio! Please update your cfitsio installation" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libwcs" >&5 $as_echo_n "checking for libwcs... " >&6; } cpl_wcs_check_version="4.16" cpl_wcs_check_header="wcslib/wcslib.h" cpl_wcs_check_lib="libwcs.a" cpl_wcs_includes="" cpl_wcs_libraries="" # Check whether --with-wcs was given. if test "${with_wcs+set}" = set; then : withval=$with_wcs; cpl_with_wcs=$withval fi # Check whether --with-wcs-includes was given. if test "${with_wcs_includes+set}" = set; then : withval=$with_wcs_includes; cpl_with_wcs_includes=$withval fi # Check whether --with-wcs-libs was given. if test "${with_wcs_libs+set}" = set; then : withval=$with_wcs_libs; cpl_with_wcs_libs=$withval fi # Check for the wcs includes if test -z "$cpl_with_wcs_includes"; then if test -z "$cpl_with_wcs"; then # Try some known system locations cpl_wcs_incdirs="/opt/wcslib/include/wcslib" cpl_wcs_incdirs="$cpl_wcs_incdirs /usr/local/include/wcslib" cpl_wcs_incdirs="$cpl_wcs_incdirs /usr/local/include" cpl_wcs_incdirs="$cpl_wcs_incdirs /usr/include/wcslib" cpl_wcs_incdirs="$cpl_wcs_incdirs /usr/include" test -n "$WCSDIR" && \ cpl_wcs_incdirs="$WCSDIR/include \ $cpl_wcs_incdirs" else cpl_wcs_incdirs="$cpl_with_wcs/include" fi else cpl_wcs_incdirs="$cpl_with_wcs_includes" fi cpl_wcs_includes=no for i in $cpl_wcs_incdirs; do for j in $cpl_wcs_check_header; do echo "configure: 15178: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_wcs_includes=$i break 2 fi done done # Check for the wcs library if test -z "$cpl_with_wcs_libs"; then if test -z "$cpl_with_wcs"; then # Try some known system locations cpl_wcs_libdirs="/opt/wcslib/lib64" cpl_wcs_libdirs="$cpl_wcs_libdirs /opt/wcslib/lib" cpl_wcs_libdirs="$cpl_wcs_libdirs /opt/wcslib/lib32" cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/local/lib64" cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/local/lib" cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/local/lib32" cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/lib64" cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/lib" cpl_wcs_libdirs="$cpl_wcs_libdirs /usr/lib32" test -n "$WCSDIR" && \ cpl_wcs_libdirs="$WCSDIR/lib64 \ $WCSDIR/lib \ $WCSDIR/lib32 \ $cpl_wcs_libdirs" else cpl_wcs_libdirs="$cpl_with_wcs/lib64" cpl_wcs_libdirs="$cpl_wcs_libdirs $cpl_with_wcs/lib" cpl_wcs_libdirs="$cpl_wcs_libdirs $cpl_with_wcs/lib32" fi else cpl_wcs_libdirs="$cpl_with_wcs_libs" fi cpl_wcs_libraries=no for i in $cpl_wcs_libdirs; do for j in $cpl_wcs_check_lib; do echo "configure: 15234: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_wcs_libraries=$i break 2 fi done done if test x"$cpl_wcs_includes" = xno || \ test x"$cpl_wcs_libraries" = xno; then cpl_wcs_notfound="" if test x"$cpl_wcs_includes" = xno; then if test x"$cpl_wcs_libraries" = xno; then cpl_wcs_notfound="(headers and libraries)" else cpl_wcs_notfound="(headers)" fi else cpl_wcs_notfound="(libraries)" fi { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libwcs $cpl_wcs_notfound was not found on your system. WCS support will be disabled!" >&5 $as_echo "$as_me: WARNING: libwcs $cpl_wcs_notfound was not found on your system. WCS support will be disabled!" >&2;} else { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $cpl_wcs_libraries, headers $cpl_wcs_includes" >&5 $as_echo "libraries $cpl_wcs_libraries, headers $cpl_wcs_includes" >&6; } # Setup the symbols WCS_INCLUDES="-I$cpl_wcs_includes/wcslib" WCS_LDFLAGS="-L$cpl_wcs_libraries" LIBWCS="-lwcs -lm" LIBWCS_STATIC="$cpl_wcs_libraries/$cpl_wcs_check_lib -lm" # Check wcs library version { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a libwcs version >= $cpl_wcs_check_version" >&5 $as_echo_n "checking for a libwcs version >= $cpl_wcs_check_version... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cpl_wcs_cflags_save="$CFLAGS" cpl_wcs_ldflags_save="$LDFLAGS" cpl_wcs_libs_save="$LIBS" CFLAGS="$WCS_INCLUDES $CFLAGS" LDFLAGS="$WCS_LDFLAGS $LDFLAGS" LIBS="$LIBWCS_STATIC" if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #define stringify(v) stringify_arg(v) #define stringify_arg(v) #v int main () { char vmin[] = "$cpl_wcs_check_version"; char vlib[] = stringify(WCSLIB_VERSION); int min_major = 0; int min_minor = 0; int min_micro = 0; int lib_major = 0; int lib_minor = 0; int lib_micro = 0; sscanf(vmin, "%d.%d.%d", &min_major, &min_minor, &min_micro); sscanf(vlib, "%d.%d.%d", &lib_major, &lib_minor, &lib_micro); FILE* f = fopen("conftest.out", "w"); fprintf(f, "%s\n", vlib); fclose(f); if (lib_major < min_major) { return 1; } else { if (lib_major == min_major) { if (lib_minor < min_minor) { return 1; } else { if (lib_minor == min_minor) { if (lib_micro < min_micro) { return 1; } } } } } return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : cpl_wcs_version="`cat conftest.out`" else cpl_wcs_version="no"; cpl_wcs_version_found="`cat conftest.out`" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_wcs_version" >&5 $as_echo "$cpl_wcs_version" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS="$cpl_wcs_cflags_save" LDFLAGS="$cpl_wcs_ldflags_save" LIBS="$cpl_wcs_libs_save" if test x"$cpl_wcs_version" = xno; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Installed libwcs ($cpl_wcs_version_found) is too old. WCS support will not be available!" >&5 $as_echo "$as_me: WARNING: Installed libwcs ($cpl_wcs_version_found) is too old. WCS support will not be available!" >&2;} WCS_INCLUDES="" WCS_LDFLAGS="" LIBWCS="" else cat >>confdefs.h <<_ACEOF #define CPL_WCS_INSTALLED 1 _ACEOF fi fi cpl_fftw_check_version="3.3.3" cpl_fftw_check_header="fftw3.h" cpl_fftw_check_lib="libfftw3.a" cpl_fftwf_check_lib="libfftw3f.a" cpl_fftw_includes="" cpl_fftw_libraries="" cpl_fftwf_libraries="" # Check whether --with-fftw was given. if test "${with_fftw+set}" = set; then : withval=$with_fftw; cpl_with_fftw=$withval fi # Check whether --with-fftw-includes was given. if test "${with_fftw_includes+set}" = set; then : withval=$with_fftw_includes; cpl_with_fftw_includes=$withval fi # Check whether --with-fftw-libs was given. if test "${with_fftw_libs+set}" = set; then : withval=$with_fftw_libs; cpl_with_fftw_libs=$withval fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fftw (normal-precision)" >&5 $as_echo_n "checking for fftw (normal-precision)... " >&6; } # Check for the fftw includes if test -z "$cpl_with_fftw_includes"; then if test -z "$cpl_with_fftw"; then # Try some known system locations cpl_fftw_incdirs="/opt/fftw/include" cpl_fftw_incdirs="$cpl_fftw_incdirs /usr/local/include" cpl_fftw_incdirs="$cpl_fftw_incdirs /usr/include" test -n "$FFTWDIR" && \ cpl_fftw_incdirs="$FFTWDIR/include \ $cpl_fftw_incdirs" else cpl_fftw_incdirs="$cpl_with_fftw/include" fi else cpl_fftw_incdirs="$cpl_with_fftw_includes" fi cpl_fftw_includes=no for i in $cpl_fftw_incdirs; do for j in $cpl_fftw_check_header; do echo "configure: 15483: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_fftw_includes=$i break 2 fi done done # Check for normal-precision fftw library if test -z "$cpl_with_fftw_libs"; then if test -z "$cpl_with_fftw"; then # Try some known system locations cpl_fftw_libdirs="/opt/fftw/lib64" cpl_fftw_libdirs="$cpl_fftw_libdirs /opt/fftw/lib" cpl_fftw_libdirs="$cpl_fftw_libdirs /opt/fftw/lib32" cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/local/lib64" cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/local/lib" cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/local/lib32" cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/lib64" cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/lib" cpl_fftw_libdirs="$cpl_fftw_libdirs /usr/lib32" test -n "$FFTWDIR" && \ cpl_fftw_libdirs="$FFTWDIR/lib64 \ $FFTWDIR/lib \ $FFTWDIR/lib32 \ $cpl_fftw_libdirs" else cpl_fftw_libdirs="$cpl_with_fftw/lib64" cpl_fftw_libdirs="$cpl_fftw_libdirs $cpl_with_fftw/lib" cpl_fftw_libdirs="$cpl_fftw_libdirs $cpl_with_fftw/lib32" fi else cpl_fftw_libdirs="$cpl_with_fftw_libs" fi cpl_fftw_libraries=no for i in $cpl_fftw_libdirs; do for j in $cpl_fftw_check_lib; do echo "configure: 15539: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_fftw_libraries=$i break 2 fi done done if test x"$cpl_fftw_includes" = xno || \ test x"$cpl_fftw_libraries" = xno; then cpl_fftw_notfound="" if test x"$cpl_fftw_includes" = xno; then if test x"$cpl_fftw_libraries" = xno; then cpl_fftw_notfound="(headers and libraries)" else cpl_fftw_notfound="(headers)" fi else cpl_fftw_notfound="(libraries)" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: fftw (normal-precision) $cpl_fftw_notfound was not found on your system." >&5 $as_echo "$as_me: WARNING: fftw (normal-precision) $cpl_fftw_notfound was not found on your system." >&2;} else { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $cpl_fftw_libraries, headers $cpl_fftw_includes" >&5 $as_echo "libraries $cpl_fftw_libraries, headers $cpl_fftw_includes" >&6; } # Set up the symbols FFTW_INCLUDES="-I$cpl_fftw_includes" FFTW_LDFLAGS="-L$cpl_fftw_libraries" LIBFFTW="-lfftw3 -lm" LIBFFTW_STATIC="$cpl_fftw_libraries/$cpl_fftw_check_lib -lm" # Check fftw (normal-precision) library version { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a fftw (normal-precision) version >= $cpl_fftw_check_version" >&5 $as_echo_n "checking for a fftw (normal-precision) version >= $cpl_fftw_check_version... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cpl_fftw_cflags_save="$CFLAGS" cpl_fftw_ldflags_save="$LDFLAGS" cpl_fftw_libs_save="$LIBS" CFLAGS="$FFTW_INCLUDES $CFLAGS" LDFLAGS="$FFTW_LDFLAGS $LDFLAGS" LIBS="$LIBFFTW_STATIC" if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { char vmin[] = "$cpl_fftw_check_version"; char *vstr = strdup(fftw_version); char *vlib = vstr; char *suffix = NULL; int min_major = 0; int min_minor = 0; int min_micro = 0; int lib_major = 0; int lib_minor = 0; int lib_micro = 0; vlib = strchr(vstr, '-') + 1; suffix = strrchr(vlib, '-'); if (suffix) { *suffix = '\0'; } sscanf(vmin, "%d.%d.%d", &min_major, &min_minor, &min_micro); sscanf(vlib, "%d.%d.%d", &lib_major, &lib_minor, &lib_micro); FILE* f = fopen("conftest.out", "w"); fprintf(f, "%s\n", vlib); fclose(f); free(vstr); if (lib_major < min_major) { return 1; } else { if (lib_major == min_major) { if (lib_minor < min_minor) { return 1; } else { if (lib_minor == min_minor) { if (lib_micro < min_micro) { return 1; } } } } } return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : cpl_fftw_version="`cat conftest.out`" else cpl_fftw_version="no"; cpl_fftw_version_found="`cat conftest.out`" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_fftw_version" >&5 $as_echo "$cpl_fftw_version" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS="$cpl_fftw_cflags_save" LDFLAGS="$cpl_fftw_ldflags_save" LIBS="$cpl_fftw_libs_save" if test x"$cpl_fftw_version" = xno; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Installed normal-precision fftw ($cpl_fftw_version_found) is too old" >&5 $as_echo "$as_me: WARNING: Installed normal-precision fftw ($cpl_fftw_version_found) is too old" >&2;} FFTW_INCLUDES="" FFTW_LDFLAGS="" LIBFFTW="" else cat >>confdefs.h <<_ACEOF #define CPL_FFTW_INSTALLED 1 _ACEOF fi fi # Check for single-precision fftw { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fftw (single-precision)" >&5 $as_echo_n "checking for fftw (single-precision)... " >&6; } cpl_fftwf_libraries=no for i in $cpl_fftw_libdirs; do for j in $cpl_fftwf_check_lib; do echo "configure: 15736: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 cpl_fftwf_libraries=$i break 2 fi done done if test x"$cpl_fftw_includes" = xno || \ test x"$cpl_fftwf_libraries" = xno; then cpl_fftw_notfound="" if test x"$cpl_fftw_includes" = xno; then if test x"$cpl_fftwf_libraries" = xno; then cpl_fftw_notfound="(headers and libraries)" else cpl_fftw_notfound="(headers)" fi else cpl_fftw_notfound="(libraries)" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: fftw (single-precision) $cpl_fftw_notfound was not found on your system." >&5 $as_echo "$as_me: WARNING: fftw (single-precision) $cpl_fftw_notfound was not found on your system." >&2;} else { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $cpl_fftwf_libraries, headers $cpl_fftw_includes" >&5 $as_echo "libraries $cpl_fftwf_libraries, headers $cpl_fftw_includes" >&6; } # Set up the symbols FFTWF_INCLUDES="-I$cpl_fftw_includes" FFTWF_LDFLAGS="-L$cpl_fftwf_libraries" LIBFFTWF="-lfftw3f -lm" LIBFFTWF_STATIC="$cpl_fftwf_libraries/$cpl_fftwf_check_lib -lm" # Check fftw (single-precision) library version { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a fftw (single-precision) version >= $cpl_fftw_check_version" >&5 $as_echo_n "checking for a fftw (single-precision) version >= $cpl_fftw_check_version... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cpl_fftw_cflags_save="$CFLAGS" cpl_fftw_ldflags_save="$LDFLAGS" cpl_fftw_libs_save="$LIBS" CFLAGS="$FFTWF_INCLUDES $CFLAGS" LDFLAGS="$FFTWF_LDFLAGS $LDFLAGS" LIBS="$LIBFFTWF" if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { char vmin[] = "$cpl_fftw_check_version"; char *vstr = strdup(fftwf_version); char *vlib = vstr; char *suffix = NULL; int min_major = 0; int min_minor = 0; int min_micro = 0; int lib_major = 0; int lib_minor = 0; int lib_micro = 0; vlib = strchr(vstr, '-') + 1; suffix = strrchr(vlib, '-'); if (suffix) { *suffix = '\0'; } sscanf(vmin, "%d.%d.%d", &min_major, &min_minor, &min_micro); sscanf(vlib, "%d.%d.%d", &lib_major, &lib_minor, &lib_micro); FILE* f = fopen("conftest.out", "w"); fprintf(f, "%s\n", vlib); fclose(f); free(vstr); if (lib_major < min_major) { return 1; } else { if (lib_major == min_major) { if (lib_minor < min_minor) { return 1; } else { if (lib_minor == min_minor) { if (lib_micro < min_micro) { return 1; } } } } } return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : cpl_fftwf_version="`cat conftest.out`" else cpl_fftwf_version="no"; cpl_fftwf_version_found="`cat conftest.out`" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpl_fftwf_version" >&5 $as_echo "$cpl_fftwf_version" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS="$cpl_fftw_cflags_save" LDFLAGS="$cpl_fftw_ldflags_save" LIBS="$cpl_fftw_libs_save" if test x"$cpl_fftwf_version" = xno; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Installed single-precision fftw ($cpl_fftw_version_found) is too old!" >&5 $as_echo "$as_me: WARNING: Installed single-precision fftw ($cpl_fftw_version_found) is too old!" >&2;} FFTWF_INCLUDES="" FFTWF_LDFLAGS="" LIBFFTWF="" else cat >>confdefs.h <<_ACEOF #define CPL_FFTWF_INSTALLED 1 _ACEOF fi fi # Checks for header files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether termios.h defines TIOCGWINSZ" >&5 $as_echo_n "checking whether termios.h defines TIOCGWINSZ... " >&6; } if ${ac_cv_sys_tiocgwinsz_in_termios_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifdef TIOCGWINSZ yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : ac_cv_sys_tiocgwinsz_in_termios_h=yes else ac_cv_sys_tiocgwinsz_in_termios_h=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_tiocgwinsz_in_termios_h" >&5 $as_echo "$ac_cv_sys_tiocgwinsz_in_termios_h" >&6; } if test $ac_cv_sys_tiocgwinsz_in_termios_h != yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/ioctl.h defines TIOCGWINSZ" >&5 $as_echo_n "checking whether sys/ioctl.h defines TIOCGWINSZ... " >&6; } if ${ac_cv_sys_tiocgwinsz_in_sys_ioctl_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifdef TIOCGWINSZ yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=yes else ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&5 $as_echo "$ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&6; } if test $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h = yes; then $as_echo "#define GWINSZ_IN_SYS_IOCTL 1" >>confdefs.h fi fi for ac_header in fcntl.h stdlib.h string.h stropts.h sys/ioctl.h \ sys/stat.h sys/times.h sys/time.h sys/types.h \ termios.h termio.h unistd.h time.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double with more range or precision than double" >&5 $as_echo_n "checking for long double with more range or precision than double... " >&6; } if ${ac_cv_type_long_double_wider+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include long double const a[] = { 0.0L, DBL_MIN, DBL_MAX, DBL_EPSILON, LDBL_MIN, LDBL_MAX, LDBL_EPSILON }; long double f (long double x) { return ((x + (unsigned long int) 10) * (-1 / x) + a[0] + (x ? f (x) : 'c')); } int main () { static int test_array [1 - 2 * !((0 < ((DBL_MAX_EXP < LDBL_MAX_EXP) + (DBL_MANT_DIG < LDBL_MANT_DIG) - (LDBL_MAX_EXP < DBL_MAX_EXP) - (LDBL_MANT_DIG < DBL_MANT_DIG))) && (int) LDBL_EPSILON == 0 )]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_long_double_wider=yes else ac_cv_type_long_double_wider=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_double_wider" >&5 $as_echo "$ac_cv_type_long_double_wider" >&6; } if test $ac_cv_type_long_double_wider = yes; then $as_echo "#define HAVE_LONG_DOUBLE_WIDER 1" >>confdefs.h fi ac_cv_c_long_double=$ac_cv_type_long_double_wider if test $ac_cv_c_long_double = yes; then $as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define cpl_check_va_args(A, ...) printf(A, __VA_ARGS__) int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define CPL_HAVE_VA_ARGS 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Variadic macros are not available" >&5 $as_echo "$as_me: WARNING: Variadic macros are not available" >&2;} fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { double complex a, b; a = 2.0 + 2.0 * I; b = cabs(a); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define CPL_HAVE_COMPLEX 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Complex primitive types are not available" >&5 $as_echo "$as_me: WARNING: Complex primitive types are not available" >&2;} fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 $as_echo_n "checking size of size_t... " >&6; } if ${ac_cv_sizeof_size_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : else if test "$ac_cv_type_size_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (size_t) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_size_t=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5 $as_echo "$ac_cv_sizeof_size_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SIZE_T $ac_cv_sizeof_size_t _ACEOF # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi # Checks for library functions. for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VPRINTF 1 _ACEOF ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" if test "x$ac_cv_func__doprnt" = xyes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then : ac_cv_func_lstat_dereferences_slashed_symlink=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail, as required by POSIX. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_lstat_dereferences_slashed_symlink=yes else ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 $as_echo_n "checking whether stat accepts an empty string... " >&6; } if ${ac_cv_func_stat_empty_string_bug+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_stat_empty_string_bug=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return stat ("", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_stat_empty_string_bug=no else ac_cv_func_stat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 $as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 _ACEOF fi # fdopen, fileno and dup allows stream duplication # Additional presence of sigaction sigemptyset allows windows resizing for ac_func in getcwd strdup strrchr fdopen fileno dup sigaction sigemptyset \ stat getpid setenv llabs cbrt clock_gettime gettimeofday do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Even with -std=c99 these non-C99 functions may be defined, # so check also if they are declared... ac_fn_c_check_decl "$LINENO" "stat" "ac_cv_have_decl_stat" "$ac_includes_default" if test "x$ac_cv_have_decl_stat" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STAT $ac_have_decl _ACEOF ac_fn_c_check_decl "$LINENO" "fdopen" "ac_cv_have_decl_fdopen" "$ac_includes_default" if test "x$ac_cv_have_decl_fdopen" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FDOPEN $ac_have_decl _ACEOF ac_fn_c_check_decl "$LINENO" "fileno" "ac_cv_have_decl_fileno" "$ac_includes_default" if test "x$ac_cv_have_decl_fileno" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FILENO $ac_have_decl _ACEOF ac_fn_c_check_decl "$LINENO" "dup" "ac_cv_have_decl_dup" "$ac_includes_default" if test "x$ac_cv_have_decl_dup" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_DUP $ac_have_decl _ACEOF ac_fn_c_check_decl "$LINENO" "llabs" "ac_cv_have_decl_llabs" "$ac_includes_default" if test "x$ac_cv_have_decl_llabs" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_LLABS $ac_have_decl _ACEOF ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_decl "$LINENO" "sysconf" "ac_cv_have_decl_sysconf" "#include " if test "x$ac_cv_have_decl_sysconf" = xyes; then : fi eso_save_CFLAGS="$CFLAGS" if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -pedantic-errors" fi ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf" if test "x$ac_cv_func_sysconf" = xyes; then : fi CFLAGS="$eso_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$ac_cv_have_decl_sysconf" = xyes && test x"$ac_cv_func_sysconf" = xyes; then $as_echo "#define HAVE_SYSCONF 1" >>confdefs.h fi # Check whether --with-extra-includes was given. if test "${with_extra_includes+set}" = set; then : withval=$with_extra_includes; eso_with_extra_includes=$withval else eso_with_extra_includes=NONE fi # Check whether --with-extra-libs was given. if test "${with_extra_libs+set}" = set; then : withval=$with_extra_libs; eso_with_extra_libs=$withval else eso_with_extra_libs=NONE fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extra includes" >&5 $as_echo_n "checking for extra includes... " >&6; } if ${eso_cv_with_extra_includes+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_with_extra_includes=$eso_with_extra_includes fi if test x"$eso_cv_with_extra_includes" != xNONE; then eso_save_IFS=$IFS IFS=':' for dir in $eso_cv_with_extra_includes; do EXTRA_INCLUDES="$EXTRA_INCLUDES -I$dir" done IFS=$eso_save_IFS { $as_echo "$as_me:${as_lineno-$LINENO}: result: added" >&5 $as_echo "added" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extra libs" >&5 $as_echo_n "checking for extra libs... " >&6; } if ${eso_cv_with_extra_libs+:} false; then : $as_echo_n "(cached) " >&6 else eso_cv_with_extra_libs=$eso_with_extra_libs fi if test x"$eso_cv_with_extra_libs" != xNONE; then eso_save_IFS=$IFS IFS=':' for dir in $eso_cv_with_extra_libs; do EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$dir" done IFS=$eso_save_IFS { $as_echo "$as_me:${as_lineno-$LINENO}: result: added" >&5 $as_echo "added" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CPL" >&5 $as_echo_n "checking for CPL... " >&6; } if test x"${prefix}" = xNONE; then cpl_prefix="$ac_default_prefix" else cpl_prefix="$prefix" fi if test x"$exec_prefix" = xNONE; then cpl_exec_prefix="$cpl_prefix" { $as_echo "$as_me:${as_lineno-$LINENO}: result: will be installed in $cpl_prefix" >&5 $as_echo "will be installed in $cpl_prefix" >&6; } else cpl_exec_prefix="$exec_prefix" { $as_echo "$as_me:${as_lineno-$LINENO}: result: will be installed in $cpl_prefix and $cpl_exec_prefix" >&5 $as_echo "will be installed in $cpl_prefix and $cpl_exec_prefix" >&6; } fi cpl_libraries="${cpl_exec_prefix}/lib" cpl_includes=${cpl_prefix}/include CPLCORE_INCLUDES='-I$(top_srcdir)/cplcore -I$(top_builddir)/cplcore' CPLDRS_INCLUDES="-I\$(top_srcdir)/cpldrs -I\$(top_builddir)/cpldrs" CPLUI_INCLUDES='-I$(top_srcdir)/cplui -I$(top_builddir)/cplui' CPLDFS_INCLUDES='-I$(top_srcdir)/cpldfs -I$(top_builddir)/cpldfs' CPL_INCLUDES="$CPLDFS_INCLUDES $CPLUI_INCLUDES $CPLDRS_INCLUDES $CPLCORE_INCLUDES" CPL_LDFLAGS="" if test -z "$apidocdir"; then apidocdir='${datadir}/doc/${PACKAGE}/html' fi if test -z "$configdir"; then configdir='${datadir}/${PACKAGE}/config' fi # Define a preprocesor symbol for the application search paths # Need to evaluate the expression 3 times to get to the full name config_dir="`eval echo $configdir`" config_dir="`eval echo $config_dir`" config_dir="`eval echo $config_dir`" cat >>confdefs.h <<_ACEOF #define CPL_CONFIG_DIR "$config_dir" _ACEOF if test -z "build"; then LIBCPLCORE='-lcplcore' LIBCPLDRS='-lcpldrs' LIBCPLUI='-lcplui' LIBCPLDFS='-lcpldfs' else LIBCPLCORE='$(top_builddir)/cplcore/libcplcore.la' LIBCPLDRS='$(top_builddir)/cpldrs/libcpldrs.la' LIBCPLUI='$(top_builddir)/cplui/libcplui.la' LIBCPLDFS='$(top_builddir)/cpldfs/libcpldfs.la' fi for d in htmldir; do eval cpl_propagate_dir="\$$d" ac_configure_args="$ac_configure_args $d='$cpl_propagate_dir'" done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extended memory mode" >&5 $as_echo_n "checking for extended memory mode... " >&6; } # Check whether --enable-memory-mode was given. if test "${enable_memory_mode+set}" = set; then : enableval=$enable_memory_mode; cpl_memory_flag=yes # $enableval=yes when no argument is given cpl_memory_mode=$enableval fi # Check whether --enable-max-ptrs was given. if test "${enable_max_ptrs+set}" = set; then : enableval=$enable_max_ptrs; cpl_max_ptrs_flag=yes cpl_max_ptrs=$enableval fi # Pending: check cpl_max_ptrs is numeric, otherwise AC_MSG_ERROR if test "x$cpl_max_ptrs_flag" = xyes ; then CPL_MAXPTRS_CFLAGS="-DCPL_XMEMORY_MAXPTRS=$cpl_max_ptrs" else CPL_MAXPTRS_CFLAGS="-DCPL_XMEMORY_MAXPTRS=200003" fi if test "x$cpl_memory_flag" = xyes ; then CPL_CFLAGS="-DCPL_XMEMORY_MODE=$cpl_memory_mode" case $cpl_memory_mode in yes) CPL_CFLAGS="-DCPL_XMEMORY_MODE=0 -DCPL_XMEMORY_MAXPTRS=1" break ;; 0|1) CPL_CFLAGS="-DCPL_XMEMORY_MODE=$cpl_memory_mode -DCPL_XMEMORY_MAXPTRS=1" break ;; 2) CPL_CFLAGS="-DCPL_XMEMORY_MODE=2 $CPL_MAXPTRS_CFLAGS" break ;; *) as_fn_error $? "Option --enable-memory-mode=$cpl_memory_mode not valid. Please check!" "$LINENO" 5 break ;; esac else CPL_CFLAGS="-DCPL_XMEMORY_MODE=0 -DCPL_XMEMORY_MAXPTRS=1" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: CPL_CFLAGS=$CPL_CFLAGS" >&5 $as_echo "CPL_CFLAGS=$CPL_CFLAGS" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking /proc/cpuinfo for the CPU cache and cores" >&5 $as_echo_n "checking /proc/cpuinfo for the CPU cache and cores... " >&6; } if test -r "/proc/cpuinfo"; then cpl_cpu_cache_string=`grep "cache size" /proc/cpuinfo | head -1 | perl -ne 's/^\D+//;s/\b\s*kB\b\D*/<<10/i || s/\b\s*MB\b\D*/<<20/i;/^\d+/ and print eval'` if test -n "$cpl_cpu_cache_string"; then cat >>confdefs.h <<_ACEOF #define CPL_CPU_CACHE $cpl_cpu_cache_string _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: CPU cache $cpl_cpu_cache_string B" >&5 $as_echo "CPU cache $cpl_cpu_cache_string B" >&6; } fi cpl_cpu_core_string=`grep "cpu cores" /proc/cpuinfo | head -1 | perl -ne 's/^\D+//g;/^\d+/ and print'` if test -n "$cpl_cpu_core_string"; then cat >>confdefs.h <<_ACEOF #define CPL_CPU_CORES $cpl_cpu_core_string _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: CPU cores $cpl_cpu_core_string" >&5 $as_echo "CPU cores $cpl_cpu_core_string" >&6; } fi fi # Check whether --enable-gasgano was given. if test "${enable_gasgano+set}" = set; then : enableval=$enable_gasgano; cpl_enable_gasgano=$enableval else cpl_enable_gasgano=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Gasgano interface library can be built" >&5 $as_echo_n "checking whether the Gasgano interface library can be built... " >&6; } if test x"$cpl_enable_gasgano" != xyes; then cpl_gasgano_support="no" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } else if test -n "$JAVA_INCLUDES" && test -n "$GASGANO_CLASSPATH"; then cpl_gasgano_support="yes" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else cpl_gasgano_support="no" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test x"$cpl_gasgano_support" = xyes; then GASGANO_SUPPORT_TRUE= GASGANO_SUPPORT_FALSE='#' else GASGANO_SUPPORT_TRUE='#' GASGANO_SUPPORT_FALSE= fi GASGANO_SHREXT="" if test x"$cpl_gasgano_support" = xyes; then case $cpl_cv_env_java_os in darwin) GASGANO_SHREXT="-shrext .jnilib" ;; *) ;; esac fi # Create body of cpl_func.h cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main(void) { return (int)__func__; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : cpl_cv_func_has_func=__func__ else cpl_cv_func_has_func='"\"\""' fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_config_commands="$ac_config_commands cplcore/cpl_func.h.in" # Configure subpackages subdirs="$subdirs libltdl" if test ! x$"cpl_cv_with_system_cext" = xyes; then subdirs="$subdirs libcext" fi ac_config_files="$ac_config_files Makefile Makefile.purify Doxyfile cplcore/Makefile cplcore/tests/Makefile cpldrs/Makefile cpldrs/tests/Makefile cplui/Makefile cplui/tests/Makefile cpldfs/Makefile cpldfs/tests/Makefile cpljava/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_PURIFY_TRUE}" && test -z "${USE_PURIFY_FALSE}"; then as_fn_error $? "conditional \"USE_PURIFY\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GASGANO_SUPPORT_TRUE}" && test -z "${GASGANO_SUPPORT_FALSE}"; then as_fn_error $? "conditional \"GASGANO_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by Common Pipeline Library $as_me 6.4.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ Common Pipeline Library config.status 6.4.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # version_code=$CPL_BINARY_VERSION version_string=$CPL_VERSION_STRING AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' cpl_func_value=$cpl_cv_func_has_func _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "cplcore/cpl_version.h.in") CONFIG_COMMANDS="$CONFIG_COMMANDS cplcore/cpl_version.h.in" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "cplcore/cpl_func.h.in") CONFIG_COMMANDS="$CONFIG_COMMANDS cplcore/cpl_func.h.in" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "Makefile.purify") CONFIG_FILES="$CONFIG_FILES Makefile.purify" ;; "Doxyfile") CONFIG_FILES="$CONFIG_FILES Doxyfile" ;; "cplcore/Makefile") CONFIG_FILES="$CONFIG_FILES cplcore/Makefile" ;; "cplcore/tests/Makefile") CONFIG_FILES="$CONFIG_FILES cplcore/tests/Makefile" ;; "cpldrs/Makefile") CONFIG_FILES="$CONFIG_FILES cpldrs/Makefile" ;; "cpldrs/tests/Makefile") CONFIG_FILES="$CONFIG_FILES cpldrs/tests/Makefile" ;; "cplui/Makefile") CONFIG_FILES="$CONFIG_FILES cplui/Makefile" ;; "cplui/tests/Makefile") CONFIG_FILES="$CONFIG_FILES cplui/tests/Makefile" ;; "cpldfs/Makefile") CONFIG_FILES="$CONFIG_FILES cpldfs/Makefile" ;; "cpldfs/tests/Makefile") CONFIG_FILES="$CONFIG_FILES cpldfs/tests/Makefile" ;; "cpljava/Makefile") CONFIG_FILES="$CONFIG_FILES cpljava/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "cplcore/cpl_version.h.in":C) cfgfile="cplcore/cpl_version.h.in" cat > $cfgfile << _CPLEOF _CPLEOF echo '#define CPL_VERSION_STRING "'$version_string'"' >> $cfgfile echo "#define CPL_VERSION_CODE $version_code" >> $cfgfile cat >> $cfgfile << _CPLEOF #define CPL_VERSION(major, minor, micro) \\ (((major) * 65536) + ((minor) * 256) + (micro)) _CPLEOF ;; "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; "cplcore/cpl_func.h.in":C) cfgfile="cplcore/cpl_func.h.in" echo "#define cpl_func $cpl_func_value" > $cfgfile ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file, --srcdir, and --disable-option-checking arguments # so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" shift for ac_arg do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ | --c=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; --disable-option-checking) ;; *) case $ac_arg in *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_sub_configure_args " '$ac_arg'" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" # Pass --silent if test "$silent" = yes; then ac_sub_configure_args="--silent $ac_sub_configure_args" fi # Always prepend --disable-option-checking to silence warnings, since # different subdirs can have different --enable and --with options. ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 $as_echo "$ac_msg" >&6 as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" # Check for guested configure; otherwise get Cygnus style configure. if test -f "$ac_srcdir/configure.gnu"; then ac_sub_configure=$ac_srcdir/configure.gnu elif test -f "$ac_srcdir/configure"; then ac_sub_configure=$ac_srcdir/configure elif test -f "$ac_srcdir/configure.in"; then # This should be Cygnus configure. ac_sub_configure=$ac_aux_dir/configure else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative name. ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 fi cd "$ac_popdir" done fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cpl-6.4.1/configure.ac0000644000460300003120000000675312303141514011505 00000000000000# Process this file with autoconf to produce a configure script. AC_INIT([Common Pipeline Library], [6.4.1], [cpl-help@eso.org], [cpl]) AC_PREREQ([2.59]) AC_CONFIG_SRCDIR([cpl.h]) AC_CONFIG_AUX_DIR([admin]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AC_CANONICAL_BUILD AM_INIT_AUTOMAKE AM_MAINTAINER_MODE CPL_SET_PREFIX # Immediately before every release do: #------------------------------------- # if (the interface is totally unchanged from previous release) # REVISION++; # else { # /* interfaces have been added, removed or changed */ # REVISION = 0; # CURRENT++; # if (any interfaces have been _added_ since last release) # AGE++; # if (any interfaces have been _removed_ or incompatibly changed) # AGE = 0; # } # Order of arguments: VERSION, CURRENT, REVISION, AGE CPL_CONFIG_VERSION([$VERSION], [24], [1], [4]) # Checks for programs. AC_PROG_CC AM_PROG_CC_C_O # # Check for purify # ESO_PROG_PURIFY ESO_PROG_CC_FLAG([std=c99], [ CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L" CFLAGS="$CFLAGS -std=c99" ]) ESO_PROG_CC_FLAG([fno-builtin], [CFLAGS="$CFLAGS -fno-builtin"]) ESO_PROG_CC_FLAG([fno-common], [CFLAGS="$CFLAGS -fno-common"]) ESO_ENABLE_DEBUG(no) ESO_ENABLE_STRICT(no) ESO_ENABLE_PROFILE(no) ESO_CHECK_DOCTOOLS AC_ENABLE_STATIC(yes) AC_ENABLE_SHARED(yes) AC_LIBLTDL_CONVENIENCE AC_PROG_LIBTOOL AC_SUBST(INCLTDL) AC_SUBST(LIBLTDL) AC_SUBST(LIBTOOL_DEPS) CPL_PATH_JAVA CPL_PATH_GASGANO CPL_CLASSPATH_GASGANO CPL_ENABLE_THREADS(yes) # Checks for libraries. AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"]) AC_CHECK_LIB(nsl, inet_ntoa, [LIBS="$LIBS -lnsl"]) CPL_CONFIG_CEXT CPL_CONFIG_CFITSIO([3.310]) CPL_CHECK_WCS([4.16]) CPL_CHECK_FFTW([3.3.3]) # Checks for header files. AC_HEADER_STDC AC_HEADER_TIOCGWINSZ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h stropts.h sys/ioctl.h \ sys/stat.h sys/times.h sys/time.h sys/types.h \ termios.h termio.h unistd.h time.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_C_BIGENDIAN AC_C_LONG_DOUBLE CPL_CHECK_VA_ARGS CPL_CHECK_COMPLEX AC_CHECK_SIZEOF(size_t) AC_SYS_LARGEFILE # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_VPRINTF AC_FUNC_STAT # fdopen, fileno and dup allows stream duplication # Additional presence of sigaction sigemptyset allows windows resizing AC_CHECK_FUNCS([getcwd strdup strrchr fdopen fileno dup sigaction sigemptyset \ stat getpid setenv llabs cbrt clock_gettime gettimeofday]) # Even with -std=c99 these non-C99 functions may be defined, # so check also if they are declared... AC_CHECK_DECLS([stat, fdopen, fileno, dup, llabs]) ESO_FUNC_SYSCONF CPL_SET_PATHS CPL_CREATE_SYMBOLS(build) CPL_EXPORT_DIRS(htmldir) CPL_CHECK_MEMORYMODE CPL_CHECK_CPU CPL_ENABLE_GASGANO # Create body of cpl_func.h CPL_CONFIG_FUNC # Configure subpackages AC_CONFIG_SUBDIRS(libltdl) if test ! x$"cpl_cv_with_system_cext" = xyes; then AC_CONFIG_SUBDIRS([libcext]) fi AC_CONFIG_FILES([Makefile Makefile.purify Doxyfile cplcore/Makefile cplcore/tests/Makefile cpldrs/Makefile cpldrs/tests/Makefile cplui/Makefile cplui/tests/Makefile cpldfs/Makefile cpldfs/tests/Makefile cpljava/Makefile]) AC_OUTPUT cpl-6.4.1/doxygen/0000755000460300003120000000000012310333010010731 500000000000000cpl-6.4.1/doxygen/cpl.css0000644000460300003120000000046212073537611012166 00000000000000TABLE.ec { width: 100%; text-align: left; background-color: #f5f5f5; margin-top: 0px; padding-top: 0px; border: none; } TD.ecl { font-family: monospace; vertical-align: top; padding-right: 20px; border: none; } TD.ecr { vertical-align: top; border: none; } cpl-6.4.1/COPYING0000644000460300003120000004311012124022226010235 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 2 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 St, Fifth Floor, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. cpl-6.4.1/aclocal.m40000644000460300003120000011536112310332720011052 00000000000000# generated automatically by aclocal 1.13 -*- Autoconf -*- # Copyright (C) 1996-2012 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.13' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.13], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.13])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of '-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/cpl.m4]) m4_include([m4/eso.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltdl.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) m4_include([m4/omp.m4]) m4_include([m4/purify.m4]) m4_include([acinclude.m4]) cpl-6.4.1/INSTALL0000644000460300003120000002200507407417341010251 00000000000000Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for variables by setting them in the environment. You can do that on the command line like this: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Environment Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it cannot guess the host type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the host platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. In this case, you should also specify the build platform with `--build=TYPE', because, in this case, it may not be possible to guess the build platform (it sometimes involves compiling and running simple test programs, and this can't be done if the compiler is a cross compiler). Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Environment Variables ===================== Variables not defined in a site shell script can be set in the environment passed to configure. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. cpl-6.4.1/Makefile.in0000644000460300003120000010004612310332723011254 00000000000000# Makefile.in generated by automake 1.13 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/admin/doxygen.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(srcdir)/config.h.in \ $(srcdir)/Makefile.purify.in $(srcdir)/Doxyfile.in \ $(include_HEADERS) AUTHORS COPYING ChangeLog INSTALL NEWS \ README TODO admin/compile admin/config.guess admin/config.sub \ admin/install-sh admin/missing admin/ltmain.sh \ $(top_srcdir)/admin/compile $(top_srcdir)/admin/config.guess \ $(top_srcdir)/admin/config.sub $(top_srcdir)/admin/install-sh \ $(top_srcdir)/admin/ltmain.sh $(top_srcdir)/admin/missing subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/cpl.m4 $(top_srcdir)/m4/eso.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/omp.m4 $(top_srcdir)/m4/purify.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = Makefile.purify Doxyfile CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(includedir)" HEADERS = $(include_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = libltdl @libcext@ cplcore cplui cpldrs cpldfs cpljava DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFITSIO_INCLUDES = @CFITSIO_INCLUDES@ CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@ CFLAGS = @CFLAGS@ CPLCORE_INCLUDES = @CPLCORE_INCLUDES@ CPLDFS_INCLUDES = @CPLDFS_INCLUDES@ CPLDRS_INCLUDES = @CPLDRS_INCLUDES@ CPLUI_INCLUDES = @CPLUI_INCLUDES@ CPL_BINARY_AGE = @CPL_BINARY_AGE@ CPL_BINARY_VERSION = @CPL_BINARY_VERSION@ CPL_CFLAGS = @CPL_CFLAGS@ CPL_INTERFACE_AGE = @CPL_INTERFACE_AGE@ CPL_LDFLAGS = @CPL_LDFLAGS@ CPL_MAJOR_VERSION = @CPL_MAJOR_VERSION@ CPL_MICRO_VERSION = @CPL_MICRO_VERSION@ CPL_MINOR_VERSION = @CPL_MINOR_VERSION@ CPL_VERSION = @CPL_VERSION@ CPL_VERSION_STRING = @CPL_VERSION_STRING@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CX_INCLUDES = @CX_INCLUDES@ CX_LDFLAGS = @CX_LDFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ESO_DEBUG_FLAGS = @ESO_DEBUG_FLAGS@ EXEEXT = @EXEEXT@ FFTWF_INCLUDES = @FFTWF_INCLUDES@ FFTWF_LDFLAGS = @FFTWF_LDFLAGS@ FFTW_INCLUDES = @FFTW_INCLUDES@ FFTW_LDFLAGS = @FFTW_LDFLAGS@ FGREP = @FGREP@ GASGANO_CLASSPATH = @GASGANO_CLASSPATH@ GASGANO_SHREXT = @GASGANO_SHREXT@ GREP = @GREP@ INCLTDL = @INCLTDL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JAVA_INCLUDES = @JAVA_INCLUDES@ LATEX = @LATEX@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCEXT = @LIBCEXT@ LIBCFITSIO = @LIBCFITSIO@ LIBCPLCORE = @LIBCPLCORE@ LIBCPLDFS = @LIBCPLDFS@ LIBCPLDRS = @LIBCPLDRS@ LIBCPLUI = @LIBCPLUI@ LIBFFTW = @LIBFFTW@ LIBFFTWF = @LIBFFTWF@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBWCS = @LIBWCS@ LIPO = @LIPO@ LN_S = @LN_S@ LTDLDEPS = @LTDLDEPS@ LTDLINCL = @LTDLINCL@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PURIFY = @PURIFY@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ WCS_INCLUDES = @WCS_INCLUDES@ WCS_LDFLAGS = @WCS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ apidocdir = @apidocdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ configdir = @configdir@ cpl_includes = @cpl_includes@ cpl_libraries = @cpl_libraries@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libcext = @libcext@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.8 foreign ACLOCAL_AMFLAGS = -I m4 DISTCLEANFILES = *~ @GASGANO_SUPPORT_TRUE@libltdl = libltdl @GASGANO_SUPPORT_TRUE@cpljava = cpljava SUBDIRS = $(libltdl) $(libcext) cplcore cplui cpldrs cpldfs $(cpljava) DOXYGEN_SUBDIRS = include_HEADERS = cpl.h EXTRA_DIST = BUGS Doxyfile.in m4/cpl.m4 m4/purify.m4 admin/doxygen.am \ doxygen/cpl.css @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(top_srcdir)/Makefile.in $(top_srcdir)/aclocal.m4 \ @MAINTAINER_MODE_TRUE@ $(top_srcdir)/config.h.in $(top_srcdir)/configure config.log \ @MAINTAINER_MODE_TRUE@ config.status DOXYGEN_BUILD_DIR = $(top_builddir) @MAINTAINER_MODE_FALSE@DOXYGEN_RECURSIVE_TARGETS = install-doxygen-recursive @MAINTAINER_MODE_TRUE@DOXYGEN_RECURSIVE_TARGETS = install-doxygen-recursive @MAINTAINER_MODE_FALSE@DOXYGEN_INSTALL_TARGETS = install-doxygen-generic @MAINTAINER_MODE_TRUE@DOXYGEN_INSTALL_TARGETS = doxygen-am install-doxygen-generic all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/admin/doxygen.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/admin/doxygen.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 Makefile.purify: $(top_builddir)/config.status $(srcdir)/Makefile.purify.in cd $(top_builddir) && $(SHELL) ./config.status $@ Doxyfile: $(top_builddir)/config.status $(srcdir)/Doxyfile.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files @MAINTAINER_MODE_FALSE@dist-hook: distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(HEADERS) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-includeHEADERS uninstall-local .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool clean-local cscope cscopelist-am ctags ctags-am \ dist dist-all dist-bzip2 dist-gzip dist-hook dist-lzip \ dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-includeHEADERS install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-includeHEADERS uninstall-local @MAINTAINER_MODE_TRUE@clean-local: clean-doxygen @MAINTAINER_MODE_TRUE@dist-hook: doxygen @MAINTAINER_MODE_TRUE@ @if test -d $(top_builddir)/html; then \ @MAINTAINER_MODE_TRUE@ echo "cp -pr $(top_builddir)/html $(distdir)"; \ @MAINTAINER_MODE_TRUE@ cp -pr $(top_builddir)/html $(distdir); \ @MAINTAINER_MODE_TRUE@ fi @MAINTAINER_MODE_TRUE@ find $(distdir) -type d ! -perm -222 -exec chmod u+w {} \; -o \ @MAINTAINER_MODE_TRUE@ -type f ! -perm -222 -exec chmod u+w {} \; || chmod -R u+w $(distdir) @MAINTAINER_MODE_FALSE@clean-local: uninstall-local: uninstall-doxygen @MAINTAINER_MODE_TRUE@doxygen: doxygen-am @MAINTAINER_MODE_TRUE@doxygen-am: @MAINTAINER_MODE_TRUE@ @if test -f $(DOXYGEN_BUILD_DIR)/Doxyfile; then \ @MAINTAINER_MODE_TRUE@ echo "cd $(DOXYGEN_BUILD_DIR) && $(DOXYGEN)"; \ @MAINTAINER_MODE_TRUE@ d=`pwd`; cd $(DOXYGEN_BUILD_DIR) && $(DOXYGEN); cd $$d; \ @MAINTAINER_MODE_TRUE@ if test -n "$(POST_DOXYGEN_CLEANFILES)"; then \ @MAINTAINER_MODE_TRUE@ cd $(DOXYGEN_BUILD_DIR)/html && rm -f $(POST_DOXYGEN_CLEANFILES); \ @MAINTAINER_MODE_TRUE@ fi; \ @MAINTAINER_MODE_TRUE@ else \ @MAINTAINER_MODE_TRUE@ echo "Nothing to be done for \`$@'."; \ @MAINTAINER_MODE_TRUE@ fi @MAINTAINER_MODE_TRUE@clean-doxygen: clean-doxygen-am @MAINTAINER_MODE_TRUE@clean-doxygen-am: @MAINTAINER_MODE_TRUE@ -rm -rf $(DOXYGEN_BUILD_DIR)/html install-doxygen: install-doxygen-recursive install-doxygen-am: $(DOXYGEN_INSTALL_TARGETS) install-doxygen-generic: @$(NORMAL_INSTALL) @if test -d $(DOXYGEN_BUILD_DIR)/html; then \ echo "$(mkinstalldirs) $(DESTDIR)$(apidocdir)"; \ $(mkinstalldirs) $(DESTDIR)$(apidocdir); \ list="`ls -1 $(DOXYGEN_BUILD_DIR)/html`"; \ for p in $$list; do \ if test -f $(DOXYGEN_BUILD_DIR)/html/$$p; then \ echo " $(INSTALL_DATA) $(DOXYGEN_BUILD_DIR)/html/$$p $(DESTDIR)$(apidocdir)/$$p"; \ $(INSTALL_DATA) $(DOXYGEN_BUILD_DIR)/html/$$p $(DESTDIR)$(apidocdir)/$$p; \ else if test -f $$p; then \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(apidocdir)/$$p"; \ $(INSTALL_DATA) $$p $(DESTDIR)$(apidocdir)/$$p; \ fi; fi; \ done; \ fi uninstall-doxygen: @$(NORMAL_UNINSTALL) @list="`ls -1 $(DESTDIR)$(apidocdir)`"; \ for p in $$list; do \ echo " rm -f $(DESTDIR)$(apidocdir)/$$p"; \ rm -f $(DESTDIR)$(apidocdir)/$$p; \ done $(DOXYGEN_RECURSIVE_TARGETS): @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(DOXYGEN_SUBDIRS)'; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/libltdl/0000755000460300003120000000000012310333010010702 500000000000000cpl-6.4.1/libltdl/config-h.in0000644000460300003120000001124012310332714012654 00000000000000/* config-h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `argz_add' function. */ #undef HAVE_ARGZ_ADD /* Define to 1 if you have the `argz_append' function. */ #undef HAVE_ARGZ_APPEND /* Define to 1 if you have the `argz_count' function. */ #undef HAVE_ARGZ_COUNT /* Define to 1 if you have the `argz_create_sep' function. */ #undef HAVE_ARGZ_CREATE_SEP /* Define to 1 if you have the header file. */ #undef HAVE_ARGZ_H /* Define to 1 if you have the `argz_insert' function. */ #undef HAVE_ARGZ_INSERT /* Define to 1 if you have the `argz_next' function. */ #undef HAVE_ARGZ_NEXT /* Define to 1 if you have the `argz_stringify' function. */ #undef HAVE_ARGZ_STRINGIFY /* Define to 1 if you have the `closedir' function. */ #undef HAVE_CLOSEDIR /* Define to 1 if you have the declaration of `cygwin_conv_path', and to 0 if you don't. */ #undef HAVE_DECL_CYGWIN_CONV_PATH /* Define to 1 if you have the header file. */ #undef HAVE_DIRENT_H /* Define if you have the GNU dld library. */ #undef HAVE_DLD /* Define to 1 if you have the header file. */ #undef HAVE_DLD_H /* Define to 1 if you have the `dlerror' function. */ #undef HAVE_DLERROR /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_DL_H /* Define if you have the _dyld_func_lookup function. */ #undef HAVE_DYLD /* Define to 1 if the system has the type `error_t'. */ #undef HAVE_ERROR_T /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if you have the libdl library or equivalent. */ #undef HAVE_LIBDL /* Define if libdlloader will be built on this platform */ #undef HAVE_LIBDLLOADER /* Define to 1 if you have the header file. */ #undef HAVE_MACH_O_DYLD_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `opendir' function. */ #undef HAVE_OPENDIR /* Define if libtool can extract symbol lists from object files. */ #undef HAVE_PRELOADED_SYMBOLS /* Define to 1 if you have the `readdir' function. */ #undef HAVE_READDIR /* Define if you have the shl_load function. */ #undef HAVE_SHL_LOAD /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strlcat' function. */ #undef HAVE_STRLCAT /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY /* Define to 1 if you have the header file. */ #undef HAVE_SYS_DL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* This value is set to 1 to indicate that the system argz facility works */ #undef HAVE_WORKING_ARGZ /* Define if the OS needs help to load dependent libraries for dlopen(). */ #undef LTDL_DLOPEN_DEPLIBS /* Define to the system default library search path. */ #undef LT_DLSEARCH_PATH /* The archive extension */ #undef LT_LIBEXT /* The archive prefix */ #undef LT_LIBPREFIX /* Define to the extension used for runtime loadable modules, say, ".so". */ #undef LT_MODULE_EXT /* Define to the name of the environment variable that determines the run-time module search path. */ #undef LT_MODULE_PATH_VAR /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to the shared library suffix, say, ".dylib". */ #undef LT_SHARED_EXT /* Define if dlsym() requires a leading underscore in symbol names. */ #undef NEED_USCORE /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define so that glibc/gnulib argp.h does not typedef error_t. */ #undef __error_t_defined /* Define to a type to use for `error_t' if it is not otherwise available. */ #undef error_t cpl-6.4.1/libltdl/lt__strl.c0000644000460300003120000000702612310332715012630 00000000000000/* lt__strl.c -- size-bounded string copying and concatenation Copyright (C) 2004 Free Software Foundation, Inc. Written by Bob Friesenhahn, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include "lt__strl.h" /* lt_strlcat appends the NULL-terminated string src to the end of dst. It will append at most dstsize - strlen(dst) - 1 bytes, NULL-terminating the result. The total length of the string which would have been created given sufficient buffer size (may be longer than dstsize) is returned. This function substitutes for strlcat() which is available under NetBSD, FreeBSD and Solaris 9. Buffer overflow can be checked as follows: if (lt_strlcat(dst, src, dstsize) >= dstsize) return -1; */ #if !defined(HAVE_STRLCAT) size_t lt_strlcat(char *dst, const char *src, const size_t dstsize) { size_t length; char *p; const char *q; assert(dst != NULL); assert(src != (const char *) NULL); assert(dstsize >= 1); length=strlen(dst); /* Copy remaining characters from src while constraining length to size - 1. */ for ( p = dst + length, q = src; (*q != 0) && (length < dstsize - 1) ; length++, p++, q++ ) *p = *q; dst[length]='\0'; /* Add remaining length of src to length. */ while (*q++) length++; return length; } #endif /* !defined(HAVE_STRLCAT) */ /* lt_strlcpy copies up to dstsize - 1 characters from the NULL-terminated string src to dst, NULL-terminating the result. The total length of the string which would have been created given sufficient buffer size (may be longer than dstsize) is returned. This function substitutes for strlcpy() which is available under OpenBSD, FreeBSD and Solaris 9. Buffer overflow can be checked as follows: if (lt_strlcpy(dst, src, dstsize) >= dstsize) return -1; */ #if !defined(HAVE_STRLCPY) size_t lt_strlcpy(char *dst, const char *src, const size_t dstsize) { size_t length=0; char *p; const char *q; assert(dst != NULL); assert(src != (const char *) NULL); assert(dstsize >= 1); /* Copy src to dst within bounds of size-1. */ for ( p=dst, q=src, length=0 ; (*q != 0) && (length < dstsize-1) ; length++, p++, q++ ) *p = *q; dst[length]='\0'; /* Add remaining length of src to length. */ while (*q++) length++; return length; } #endif /* !defined(HAVE_STRLCPY) */ cpl-6.4.1/libltdl/argz.c0000644000460300003120000001341712310332714011751 00000000000000/* argz.c -- argz implementation for non-glibc systems Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if defined(LTDL) && defined LT_CONFIG_H # include LT_CONFIG_H #else # include #endif #include #include #include #include #include #include #include #define EOS_CHAR '\0' error_t argz_append (char **pargz, size_t *pargz_len, const char *buf, size_t buf_len) { size_t argz_len; char *argz; assert (pargz); assert (pargz_len); assert ((*pargz && *pargz_len) || (!*pargz && !*pargz_len)); /* If nothing needs to be appended, no more work is required. */ if (buf_len == 0) return 0; /* Ensure there is enough room to append BUF_LEN. */ argz_len = *pargz_len + buf_len; argz = (char *) realloc (*pargz, argz_len); if (!argz) return ENOMEM; /* Copy characters from BUF after terminating '\0' in ARGZ. */ memcpy (argz + *pargz_len, buf, buf_len); /* Assign new values. */ *pargz = argz; *pargz_len = argz_len; return 0; } error_t argz_create_sep (const char *str, int delim, char **pargz, size_t *pargz_len) { size_t argz_len; char *argz = 0; assert (str); assert (pargz); assert (pargz_len); /* Make a copy of STR, but replacing each occurrence of DELIM with '\0'. */ argz_len = 1+ strlen (str); if (argz_len) { const char *p; char *q; argz = (char *) malloc (argz_len); if (!argz) return ENOMEM; for (p = str, q = argz; *p != EOS_CHAR; ++p) { if (*p == delim) { /* Ignore leading delimiters, and fold consecutive delimiters in STR into a single '\0' in ARGZ. */ if ((q > argz) && (q[-1] != EOS_CHAR)) *q++ = EOS_CHAR; else --argz_len; } else *q++ = *p; } /* Copy terminating EOS_CHAR. */ *q = *p; } /* If ARGZ_LEN has shrunk to nothing, release ARGZ's memory. */ if (!argz_len) argz = (free (argz), (char *) 0); /* Assign new values. */ *pargz = argz; *pargz_len = argz_len; return 0; } error_t argz_insert (char **pargz, size_t *pargz_len, char *before, const char *entry) { assert (pargz); assert (pargz_len); assert (entry && *entry); /* No BEFORE address indicates ENTRY should be inserted after the current last element. */ if (!before) return argz_append (pargz, pargz_len, entry, 1+ strlen (entry)); /* This probably indicates a programmer error, but to preserve semantics, scan back to the start of an entry if BEFORE points into the middle of it. */ while ((before > *pargz) && (before[-1] != EOS_CHAR)) --before; { size_t entry_len = 1+ strlen (entry); size_t argz_len = *pargz_len + entry_len; size_t offset = before - *pargz; char *argz = (char *) realloc (*pargz, argz_len); if (!argz) return ENOMEM; /* Make BEFORE point to the equivalent offset in ARGZ that it used to have in *PARGZ incase realloc() moved the block. */ before = argz + offset; /* Move the ARGZ entries starting at BEFORE up into the new space at the end -- making room to copy ENTRY into the resulting gap. */ memmove (before + entry_len, before, *pargz_len - offset); memcpy (before, entry, entry_len); /* Assign new values. */ *pargz = argz; *pargz_len = argz_len; } return 0; } char * argz_next (char *argz, size_t argz_len, const char *entry) { assert ((argz && argz_len) || (!argz && !argz_len)); if (entry) { /* Either ARGZ/ARGZ_LEN is empty, or ENTRY points into an address within the ARGZ vector. */ assert ((!argz && !argz_len) || ((argz <= entry) && (entry < (argz + argz_len)))); /* Move to the char immediately after the terminating '\0' of ENTRY. */ entry = 1+ strchr (entry, EOS_CHAR); /* Return either the new ENTRY, or else NULL if ARGZ is exhausted. */ return (entry >= argz + argz_len) ? 0 : (char *) entry; } else { /* This should probably be flagged as a programmer error, since starting an argz_next loop with the iterator set to ARGZ is safer. To preserve semantics, handle the NULL case by returning the start of ARGZ (if any). */ if (argz_len > 0) return argz; else return 0; } } void argz_stringify (char *argz, size_t argz_len, int sep) { assert ((argz && argz_len) || (!argz && !argz_len)); if (sep) { --argz_len; /* don't stringify the terminating EOS */ while (--argz_len > 0) { if (argz[argz_len] == EOS_CHAR) argz[argz_len] = sep; } } } cpl-6.4.1/libltdl/lt_dlloader.c0000644000460300003120000001367412310332715013301 00000000000000/* lt_dlloader.c -- dynamic library loader interface Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lt__private.h" #include "lt_dlloader.h" #define RETURN_SUCCESS 0 #define RETURN_FAILURE 1 static void * loader_callback (SList *item, void *userdata); /* A list of all the dlloaders we know about, each stored as a boxed SList item: */ static SList *loaders = 0; /* Return NULL, unless the loader in this ITEM has a matching name, in which case we return the matching item so that its address is passed back out (for possible freeing) by slist_remove. */ static void * loader_callback (SList *item, void *userdata) { const lt_dlvtable *vtable = (const lt_dlvtable *) item->userdata; const char * name = (const char *) userdata; assert (vtable); return streq (vtable->name, name) ? (void *) item : NULL; } /* Hook VTABLE into our global LOADERS list according to its own PRIORITY field value. */ int lt_dlloader_add (const lt_dlvtable *vtable) { SList *item; if ((vtable == 0) /* diagnose invalid vtable fields */ || (vtable->module_open == 0) || (vtable->module_close == 0) || (vtable->find_sym == 0) || ((vtable->priority != LT_DLLOADER_PREPEND) && (vtable->priority != LT_DLLOADER_APPEND))) { LT__SETERROR (INVALID_LOADER); return RETURN_FAILURE; } item = slist_box (vtable); if (!item) { (*lt__alloc_die) (); /* Let the caller know something went wrong if lt__alloc_die doesn't abort. */ return RETURN_FAILURE; } if (vtable->priority == LT_DLLOADER_PREPEND) { loaders = slist_cons (item, loaders); } else { assert (vtable->priority == LT_DLLOADER_APPEND); loaders = slist_concat (loaders, item); } return RETURN_SUCCESS; } #ifdef LT_DEBUG_LOADERS static void * loader_dump_callback (SList *item, void *userdata) { const lt_dlvtable *vtable = (const lt_dlvtable *) item->userdata; fprintf (stderr, ", %s", (vtable && vtable->name) ? vtable->name : "(null)"); return 0; } void lt_dlloader_dump (void) { fprintf (stderr, "loaders: "); if (!loaders) { fprintf (stderr, "(empty)"); } else { const lt_dlvtable *head = (const lt_dlvtable *) loaders->userdata; fprintf (stderr, "%s", (head && head->name) ? head->name : "(null)"); if (slist_tail (loaders)) slist_foreach (slist_tail (loaders), loader_dump_callback, NULL); } fprintf (stderr, "\n"); } #endif /* An iterator for the global loader list: if LOADER is NULL, then return the first element, otherwise the following element. */ lt_dlloader lt_dlloader_next (lt_dlloader loader) { SList *item = (SList *) loader; return (lt_dlloader) (item ? item->next : loaders); } /* Non-destructive unboxing of a loader. */ const lt_dlvtable * lt_dlloader_get (lt_dlloader loader) { return (const lt_dlvtable *) (loader ? ((SList *) loader)->userdata : NULL); } /* Return the contents of the first item in the global loader list with a matching NAME after removing it from that list. If there was no match, return NULL; if there is an error, return NULL and set an error for lt_dlerror; do not set an error if only resident modules need this loader; in either case, the loader list is not changed if NULL is returned. */ lt_dlvtable * lt_dlloader_remove (const char *name) { const lt_dlvtable * vtable = lt_dlloader_find (name); static const char id_string[] = "lt_dlloader_remove"; lt_dlinterface_id iface; lt_dlhandle handle = 0; int in_use = 0; int in_use_by_resident = 0; if (!vtable) { LT__SETERROR (INVALID_LOADER); return 0; } /* Fail if there are any open modules which use this loader. */ iface = lt_dlinterface_register (id_string, NULL); while ((handle = lt_dlhandle_iterate (iface, handle))) { lt_dlhandle cur = handle; if (cur->vtable == vtable) { in_use = 1; if (lt_dlisresident (handle)) in_use_by_resident = 1; } } lt_dlinterface_free (iface); if (in_use) { if (!in_use_by_resident) LT__SETERROR (REMOVE_LOADER); return 0; } /* Call the loader finalisation function. */ if (vtable && vtable->dlloader_exit) { if ((*vtable->dlloader_exit) (vtable->dlloader_data) != 0) { /* If there is an exit function, and it returns non-zero then it must set an error, and we will not remove it from the list. */ return 0; } } /* If we got this far, remove the loader from our global list. */ return (lt_dlvtable *) slist_unbox ((SList *) slist_remove (&loaders, loader_callback, (void *) name)); } const lt_dlvtable * lt_dlloader_find (const char *name) { return lt_dlloader_get (slist_find (loaders, loader_callback, (void *) name)); } cpl-6.4.1/libltdl/argz_.h0000644000460300003120000000425412310332714012114 00000000000000/* lt__argz.h -- internal argz interface for non-glibc systems Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #if !defined(LT__ARGZ_H) #define LT__ARGZ_H 1 #include #define __need_error_t #include #include #if defined(LTDL) # include "lt__glibc.h" # include "lt_system.h" #else # define LT_SCOPE #endif #if defined(__cplusplus) extern "C" { #endif LT_SCOPE error_t argz_append (char **pargz, size_t *pargz_len, const char *buf, size_t buf_len); LT_SCOPE error_t argz_create_sep(const char *str, int delim, char **pargz, size_t *pargz_len); LT_SCOPE error_t argz_insert (char **pargz, size_t *pargz_len, char *before, const char *entry); LT_SCOPE char * argz_next (char *argz, size_t argz_len, const char *entry); LT_SCOPE void argz_stringify (char *argz, size_t argz_len, int sep); #if defined(__cplusplus) } #endif #if !defined(LTDL) # undef LT_SCOPE #endif #endif /*!defined(LT__ARGZ_H)*/ cpl-6.4.1/libltdl/README0000644000460300003120000000126012310332714011513 00000000000000This is GNU libltdl, a system independent dlopen wrapper for GNU libtool. It supports the following dlopen interfaces: * dlopen (POSIX) * shl_load (HP-UX) * LoadLibrary (Win16 and Win32) * load_add_on (BeOS) * GNU DLD (emulates dynamic linking for static libraries) * dyld (darwin/Mac OS X) * libtool's dlpreopen -- Copyright (C) 1999, 2003, 2011 Free Software Foundation, Inc. Written by Thomas Tanner, 1999 This file is part of GNU Libtool. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. cpl-6.4.1/libltdl/m4/0000755000460300003120000000000012310333010011222 500000000000000cpl-6.4.1/libltdl/m4/ltversion.m40000644000460300003120000000126212310332714013444 00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) cpl-6.4.1/libltdl/m4/argz.m40000644000460300003120000000507112310332714012364 00000000000000# Portability macros for glibc argz. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. # Written by Gary V. Vaughan # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 argz.m4 AC_DEFUN([gl_FUNC_ARGZ], [gl_PREREQ_ARGZ AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT]) AC_CHECK_TYPES([error_t], [], [AC_DEFINE([error_t], [int], [Define to a type to use for `error_t' if it is not otherwise available.]) AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h does not typedef error_t.])], [#if defined(HAVE_ARGZ_H) # include #endif]) ARGZ_H= AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \ argz_next argz_stringify], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])]) dnl if have system argz functions, allow forced use of dnl libltdl-supplied implementation (and default to do so dnl on "known bad" systems). Could use a runtime check, but dnl (a) detecting malloc issues is notoriously unreliable dnl (b) only known system that declares argz functions, dnl provides them, yet they are broken, is cygwin dnl releases prior to 16-Mar-2007 (1.5.24 and earlier) dnl So, it's more straightforward simply to special case dnl this for known bad systems. AS_IF([test -z "$ARGZ_H"], [AC_CACHE_CHECK( [if argz actually works], [lt_cv_sys_argz_works], [[case $host_os in #( *cygwin*) lt_cv_sys_argz_works=no if test "$cross_compiling" != no; then lt_cv_sys_argz_works="guessing no" else lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/' save_IFS=$IFS IFS=-. set x `uname -r | sed -e "$lt_sed_extract_leading_digits"` IFS=$save_IFS lt_os_major=${2-0} lt_os_minor=${3-0} lt_os_micro=${4-0} if test "$lt_os_major" -gt 1 \ || { test "$lt_os_major" -eq 1 \ && { test "$lt_os_minor" -gt 5 \ || { test "$lt_os_minor" -eq 5 \ && test "$lt_os_micro" -gt 24; }; }; }; then lt_cv_sys_argz_works=yes fi fi ;; #( *) lt_cv_sys_argz_works=yes ;; esac]]) AS_IF([test "$lt_cv_sys_argz_works" = yes], [AC_DEFINE([HAVE_WORKING_ARGZ], 1, [This value is set to 1 to indicate that the system argz facility works])], [ARGZ_H=argz.h AC_LIBOBJ([argz])])]) AC_SUBST([ARGZ_H]) ]) # Prerequisites of lib/argz.c. AC_DEFUN([gl_PREREQ_ARGZ], [:]) cpl-6.4.1/libltdl/m4/libtool.m40000644000460300003120000105721612310332714013076 00000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS cpl-6.4.1/libltdl/m4/ltoptions.m40000644000460300003120000003007312310332714013454 00000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) cpl-6.4.1/libltdl/m4/lt~obsolete.m40000644000460300003120000001375612310332714014004 00000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) cpl-6.4.1/libltdl/m4/ltdl.m40000644000460300003120000006466312310332714012374 00000000000000# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- # # Copyright (C) 1999-2006, 2007, 2008, 2011 Free Software Foundation, Inc. # Written by Thomas Tanner, 1999 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 18 LTDL_INIT # LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) # ------------------------------------------ # DIRECTORY contains the libltdl sources. It is okay to call this # function multiple times, as long as the same DIRECTORY is always given. AC_DEFUN([LT_CONFIG_LTDL_DIR], [AC_BEFORE([$0], [LTDL_INIT]) _$0($*) ])# LT_CONFIG_LTDL_DIR # We break this out into a separate macro, so that we can call it safely # internally without being caught accidentally by the sed scan in libtoolize. m4_defun([_LT_CONFIG_LTDL_DIR], [dnl remove trailing slashes m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$])) m4_case(_LTDL_DIR, [], [dnl only set lt_ltdl_dir if _ARG_DIR is not simply `.' m4_if(_ARG_DIR, [.], [], [m4_define([_LTDL_DIR], _ARG_DIR) _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])])], [m4_if(_ARG_DIR, _LTDL_DIR, [], [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', `]_ARG_DIR['])])]) m4_popdef([_ARG_DIR]) ])# _LT_CONFIG_LTDL_DIR # Initialise: m4_define([_LTDL_DIR], []) # _LT_BUILD_PREFIX # ---------------- # If Autoconf is new enough, expand to `${top_build_prefix}', otherwise # to `${top_builddir}/'. m4_define([_LT_BUILD_PREFIX], [m4_ifdef([AC_AUTOCONF_VERSION], [m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.62]), [-1], [m4_ifdef([_AC_HAVE_TOP_BUILD_PREFIX], [${top_build_prefix}], [${top_builddir}/])], [${top_build_prefix}])], [${top_builddir}/])[]dnl ]) # LTDL_CONVENIENCE # ---------------- # sets LIBLTDL to the link flags for the libltdl convenience library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-convenience to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called here. LIBLTDL will be prefixed with # '${top_build_prefix}' if available, otherwise with '${top_builddir}/', # and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single # quotes!). If your package is not flat and you're not using automake, # define top_build_prefix, top_builddir, and top_srcdir appropriately # in your Makefiles. AC_DEFUN([LTDL_CONVENIENCE], [AC_BEFORE([$0], [LTDL_INIT])dnl dnl Although the argument is deprecated and no longer documented, dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one dnl here make sure it is the same as any other declaration of libltdl's dnl location! This also ensures lt_ltdl_dir is set when configure.ac is dnl not yet using an explicit LT_CONFIG_LTDL_DIR. m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl _$0() ])# LTDL_CONVENIENCE # AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools, # now we have LT_CONFIG_LTDL_DIR: AU_DEFUN([AC_LIBLTDL_CONVENIENCE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) _LTDL_CONVENIENCE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], []) # _LTDL_CONVENIENCE # ----------------- # Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]). m4_defun([_LTDL_CONVENIENCE], [case $enable_ltdl_convenience in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" LTDLDEPS=$LIBLTDL LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" AC_SUBST([LIBLTDL]) AC_SUBST([LTDLDEPS]) AC_SUBST([LTDLINCL]) # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" AC_SUBST([INCLTDL]) ])# _LTDL_CONVENIENCE # LTDL_INSTALLABLE # ---------------- # sets LIBLTDL to the link flags for the libltdl installable library # and LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-install to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called from here. If an installed libltdl # is not found, LIBLTDL will be prefixed with '${top_build_prefix}' if # available, otherwise with '${top_builddir}/', and LTDLINCL will be # prefixed with '${top_srcdir}/' (note the single quotes!). If your # package is not flat and you're not using automake, define top_build_prefix, # top_builddir, and top_srcdir appropriately in your Makefiles. # In the future, this macro may have to be called after LT_INIT. AC_DEFUN([LTDL_INSTALLABLE], [AC_BEFORE([$0], [LTDL_INIT])dnl dnl Although the argument is deprecated and no longer documented, dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one dnl here make sure it is the same as any other declaration of libltdl's dnl location! This also ensures lt_ltdl_dir is set when configure.ac is dnl not yet using an explicit LT_CONFIG_LTDL_DIR. m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl _$0() ])# LTDL_INSTALLABLE # AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools, # now we have LT_CONFIG_LTDL_DIR: AU_DEFUN([AC_LIBLTDL_INSTALLABLE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) _LTDL_INSTALLABLE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], []) # _LTDL_INSTALLABLE # ----------------- # Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]). m4_defun([_LTDL_INSTALLABLE], [if test -f $prefix/lib/libltdl.la; then lt_save_LDFLAGS="$LDFLAGS" LDFLAGS="-L$prefix/lib $LDFLAGS" AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes]) LDFLAGS="$lt_save_LDFLAGS" if test x"${lt_lib_ltdl-no}" = xyes; then if test x"$enable_ltdl_install" != xyes; then # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install AC_MSG_WARN([not overwriting libltdl at $prefix, force with `--enable-ltdl-install']) enable_ltdl_install=no fi elif test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) fi fi # If configure.ac declared an installable ltdl, and the user didn't override # with --disable-ltdl-install, we will install the shipped libltdl. case $enable_ltdl_install in no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" LTDLDEPS= LTDLINCL= ;; *) enable_ltdl_install=yes ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la" LTDLDEPS=$LIBLTDL LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" ;; esac AC_SUBST([LIBLTDL]) AC_SUBST([LTDLDEPS]) AC_SUBST([LTDLINCL]) # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" AC_SUBST([INCLTDL]) ])# LTDL_INSTALLABLE # _LTDL_MODE_DISPATCH # ------------------- m4_define([_LTDL_MODE_DISPATCH], [dnl If _LTDL_DIR is `.', then we are configuring libltdl itself: m4_if(_LTDL_DIR, [], [], dnl if _LTDL_MODE was not set already, the default value is `subproject': [m4_case(m4_default(_LTDL_MODE, [subproject]), [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR) _LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"])], [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"; lt_libobj_prefix="$lt_ltdl_dir/"])], [recursive], [], [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl dnl Be careful not to expand twice: m4_define([$0], []) ])# _LTDL_MODE_DISPATCH # _LT_LIBOBJ(MODULE_NAME) # ----------------------- # Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS instead # of into LIBOBJS. AC_DEFUN([_LT_LIBOBJ], [ m4_pattern_allow([^_LT_LIBOBJS$]) _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" ])# _LT_LIBOBJS # LTDL_INIT([OPTIONS]) # -------------------- # Clients of libltdl can use this macro to allow the installer to # choose between a shipped copy of the ltdl sources or a preinstalled # version of the library. If the shipped ltdl sources are not in a # subdirectory named libltdl, the directory name must be given by # LT_CONFIG_LTDL_DIR. AC_DEFUN([LTDL_INIT], [dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) dnl We need to keep our own list of libobjs separate from our parent project, dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while dnl we look for our own LIBOBJs. m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) m4_pushdef([AC_LIBSOURCES]) dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: m4_if(_LTDL_MODE, [], [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) AC_ARG_WITH([included_ltdl], [AS_HELP_STRING([--with-included-ltdl], [use the GNU ltdl sources included here])]) if test "x$with_included_ltdl" != xyes; then # We are not being forced to use the included libltdl sources, so # decide whether there is a useful installed version we can use. AC_CHECK_HEADER([ltdl.h], [AC_CHECK_DECL([lt_dlinterface_register], [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], [with_included_ltdl=no], [with_included_ltdl=yes])], [with_included_ltdl=yes], [AC_INCLUDES_DEFAULT #include ])], [with_included_ltdl=yes], [AC_INCLUDES_DEFAULT] ) fi dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE dnl was called yet, then for old times' sake, we assume libltdl is in an dnl eponymous directory: AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) AC_ARG_WITH([ltdl_include], [AS_HELP_STRING([--with-ltdl-include=DIR], [use the ltdl headers installed in DIR])]) if test -n "$with_ltdl_include"; then if test -f "$with_ltdl_include/ltdl.h"; then : else AC_MSG_ERROR([invalid ltdl include directory: `$with_ltdl_include']) fi else with_ltdl_include=no fi AC_ARG_WITH([ltdl_lib], [AS_HELP_STRING([--with-ltdl-lib=DIR], [use the libltdl.la installed in DIR])]) if test -n "$with_ltdl_lib"; then if test -f "$with_ltdl_lib/libltdl.la"; then : else AC_MSG_ERROR([invalid ltdl library directory: `$with_ltdl_lib']) fi else with_ltdl_lib=no fi case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in ,yes,no,no,) m4_case(m4_default(_LTDL_TYPE, [convenience]), [convenience], [_LTDL_CONVENIENCE], [installable], [_LTDL_INSTALLABLE], [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) ;; ,no,no,no,) # If the included ltdl is not to be used, then use the # preinstalled libltdl we found. AC_DEFINE([HAVE_LTDL], [1], [Define this if a modern libltdl is already installed]) LIBLTDL=-lltdl LTDLDEPS= LTDLINCL= ;; ,no*,no,*) AC_MSG_ERROR([`--with-ltdl-include' and `--with-ltdl-lib' options must be used together]) ;; *) with_included_ltdl=no LIBLTDL="-L$with_ltdl_lib -lltdl" LTDLDEPS= LTDLINCL="-I$with_ltdl_include" ;; esac INCLTDL="$LTDLINCL" # Report our decision... AC_MSG_CHECKING([where to find libltdl headers]) AC_MSG_RESULT([$LTDLINCL]) AC_MSG_CHECKING([where to find libltdl library]) AC_MSG_RESULT([$LIBLTDL]) _LTDL_SETUP dnl restore autoconf definition. m4_popdef([AC_LIBOBJ]) m4_popdef([AC_LIBSOURCES]) AC_CONFIG_COMMANDS_PRE([ _ltdl_libobjs= _ltdl_ltlibobjs= if test -n "$_LT_LIBOBJS"; then # Remove the extension. _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" done fi AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) ]) # Only expand once: m4_define([LTDL_INIT]) ])# LTDL_INIT # Old names: AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIB_LTDL], []) dnl AC_DEFUN([AC_WITH_LTDL], []) dnl AC_DEFUN([LT_WITH_LTDL], []) # _LTDL_SETUP # ----------- # Perform all the checks necessary for compilation of the ltdl objects # -- including compiler checks and header checks. This is a public # interface mainly for the benefit of libltdl's own configure.ac, most # other users should call LTDL_INIT instead. AC_DEFUN([_LTDL_SETUP], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_SYS_MODULE_EXT])dnl AC_REQUIRE([LT_SYS_MODULE_PATH])dnl AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl AC_REQUIRE([LT_LIB_DLLOAD])dnl AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl AC_REQUIRE([gl_FUNC_ARGZ])dnl m4_require([_LT_CHECK_OBJDIR])dnl m4_require([_LT_HEADER_DLFCN])dnl m4_require([_LT_CHECK_DLPREOPEN])dnl m4_require([_LT_DECL_SED])dnl dnl Don't require this, or it will be expanded earlier than the code dnl that sets the variables it relies on: _LT_ENABLE_INSTALL dnl _LTDL_MODE specific code must be called at least once: _LTDL_MODE_DISPATCH # In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS # the user used. This is so that ltdl.h can pick up the parent projects # config.h file, The first file in AC_CONFIG_HEADERS must contain the # definitions required by ltdl.c. # FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). AC_CONFIG_COMMANDS_PRE([dnl m4_pattern_allow([^LT_CONFIG_H$])dnl m4_ifset([AH_HEADER], [LT_CONFIG_H=AH_HEADER], [m4_ifset([AC_LIST_HEADERS], [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[ ]]*,,;s,[[ :]].*$,,'`], [])])]) AC_SUBST([LT_CONFIG_H]) AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], [], [], [AC_INCLUDES_DEFAULT]) AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) m4_pattern_allow([LT_LIBEXT])dnl AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) name= eval "lt_libprefix=\"$libname_spec\"" m4_pattern_allow([LT_LIBPREFIX])dnl AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix]) name=ltdl eval "LTDLOPEN=\"$libname_spec\"" AC_SUBST([LTDLOPEN]) ])# _LTDL_SETUP # _LT_ENABLE_INSTALL # ------------------ m4_define([_LT_ENABLE_INSTALL], [AC_ARG_ENABLE([ltdl-install], [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])]) case ,${enable_ltdl_install},${enable_ltdl_convenience} in *yes*) ;; *) enable_ltdl_convenience=yes ;; esac m4_ifdef([AM_CONDITIONAL], [AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno) AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)]) ])# _LT_ENABLE_INSTALL # LT_SYS_DLOPEN_DEPLIBS # --------------------- AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_CACHE_CHECK([whether deplibs are loaded by dlopen], [lt_cv_sys_dlopen_deplibs], [# PORTME does your system automatically load deplibs for dlopen? # or its logical equivalent (e.g. shl_load for HP-UX < 11) # For now, we just catch OSes we know something about -- in the # future, we'll try test this programmatically. lt_cv_sys_dlopen_deplibs=unknown case $host_os in aix3*|aix4.1.*|aix4.2.*) # Unknown whether this is true for these versions of AIX, but # we want this `case' here to explicitly catch those versions. lt_cv_sys_dlopen_deplibs=unknown ;; aix[[4-9]]*) lt_cv_sys_dlopen_deplibs=yes ;; amigaos*) case $host_cpu in powerpc) lt_cv_sys_dlopen_deplibs=no ;; esac ;; darwin*) # Assuming the user has installed a libdl from somewhere, this is true # If you are looking for one http://www.opendarwin.org/projects/dlcompat lt_cv_sys_dlopen_deplibs=yes ;; freebsd* | dragonfly*) lt_cv_sys_dlopen_deplibs=yes ;; gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) # GNU and its variants, using gnu ld.so (Glibc) lt_cv_sys_dlopen_deplibs=yes ;; hpux10*|hpux11*) lt_cv_sys_dlopen_deplibs=yes ;; interix*) lt_cv_sys_dlopen_deplibs=yes ;; irix[[12345]]*|irix6.[[01]]*) # Catch all versions of IRIX before 6.2, and indicate that we don't # know how it worked for any of those versions. lt_cv_sys_dlopen_deplibs=unknown ;; irix*) # The case above catches anything before 6.2, and it's known that # at 6.2 and later dlopen does load deplibs. lt_cv_sys_dlopen_deplibs=yes ;; netbsd*) lt_cv_sys_dlopen_deplibs=yes ;; openbsd*) lt_cv_sys_dlopen_deplibs=yes ;; osf[[1234]]*) # dlopen did load deplibs (at least at 4.x), but until the 5.x series, # it did *not* use an RPATH in a shared library to find objects the # library depends on, so we explicitly say `no'. lt_cv_sys_dlopen_deplibs=no ;; osf5.0|osf5.0a|osf5.1) # dlopen *does* load deplibs and with the right loader patch applied # it even uses RPATH in a shared library to search for shared objects # that the library depends on, but there's no easy way to know if that # patch is installed. Since this is the case, all we can really # say is unknown -- it depends on the patch being installed. If # it is, this changes to `yes'. Without it, it would be `no'. lt_cv_sys_dlopen_deplibs=unknown ;; osf*) # the two cases above should catch all versions of osf <= 5.1. Read # the comments above for what we know about them. # At > 5.1, deplibs are loaded *and* any RPATH in a shared library # is used to find them so we can finally say `yes'. lt_cv_sys_dlopen_deplibs=yes ;; qnx*) lt_cv_sys_dlopen_deplibs=yes ;; solaris*) lt_cv_sys_dlopen_deplibs=yes ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) libltdl_cv_sys_dlopen_deplibs=yes ;; esac ]) if test "$lt_cv_sys_dlopen_deplibs" != yes; then AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], [Define if the OS needs help to load dependent libraries for dlopen().]) fi ])# LT_SYS_DLOPEN_DEPLIBS # Old name: AU_ALIAS([AC_LTDL_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], []) # LT_SYS_MODULE_EXT # ----------------- AC_DEFUN([LT_SYS_MODULE_EXT], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([which extension is used for runtime loadable modules], [libltdl_cv_shlibext], [ module=yes eval libltdl_cv_shlibext=$shrext_cmds module=no eval libltdl_cv_shrext=$shrext_cmds ]) if test -n "$libltdl_cv_shlibext"; then m4_pattern_allow([LT_MODULE_EXT])dnl AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], [Define to the extension used for runtime loadable modules, say, ".so".]) fi if test "$libltdl_cv_shrext" != "$libltdl_cv_shlibext"; then m4_pattern_allow([LT_SHARED_EXT])dnl AC_DEFINE_UNQUOTED([LT_SHARED_EXT], ["$libltdl_cv_shrext"], [Define to the shared library suffix, say, ".dylib".]) fi ])# LT_SYS_MODULE_EXT # Old name: AU_ALIAS([AC_LTDL_SHLIBEXT], [LT_SYS_MODULE_EXT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SHLIBEXT], []) # LT_SYS_MODULE_PATH # ------------------ AC_DEFUN([LT_SYS_MODULE_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([which variable specifies run-time module search path], [lt_cv_module_path_var], [lt_cv_module_path_var="$shlibpath_var"]) if test -n "$lt_cv_module_path_var"; then m4_pattern_allow([LT_MODULE_PATH_VAR])dnl AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], [Define to the name of the environment variable that determines the run-time module search path.]) fi ])# LT_SYS_MODULE_PATH # Old name: AU_ALIAS([AC_LTDL_SHLIBPATH], [LT_SYS_MODULE_PATH]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SHLIBPATH], []) # LT_SYS_DLSEARCH_PATH # -------------------- AC_DEFUN([LT_SYS_DLSEARCH_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([for the default library search path], [lt_cv_sys_dlsearch_path], [lt_cv_sys_dlsearch_path="$sys_lib_dlsearch_path_spec"]) if test -n "$lt_cv_sys_dlsearch_path"; then sys_dlsearch_path= for dir in $lt_cv_sys_dlsearch_path; do if test -z "$sys_dlsearch_path"; then sys_dlsearch_path="$dir" else sys_dlsearch_path="$sys_dlsearch_path$PATH_SEPARATOR$dir" fi done m4_pattern_allow([LT_DLSEARCH_PATH])dnl AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], [Define to the system default library search path.]) fi ])# LT_SYS_DLSEARCH_PATH # Old name: AU_ALIAS([AC_LTDL_SYSSEARCHPATH], [LT_SYS_DLSEARCH_PATH]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SYSSEARCHPATH], []) # _LT_CHECK_DLPREOPEN # ------------------- m4_defun([_LT_CHECK_DLPREOPEN], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], [libltdl_cv_preloaded_symbols], [if test -n "$lt_cv_sys_global_symbol_pipe"; then libltdl_cv_preloaded_symbols=yes else libltdl_cv_preloaded_symbols=no fi ]) if test x"$libltdl_cv_preloaded_symbols" = xyes; then AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1], [Define if libtool can extract symbol lists from object files.]) fi ])# _LT_CHECK_DLPREOPEN # LT_LIB_DLLOAD # ------------- AC_DEFUN([LT_LIB_DLLOAD], [m4_pattern_allow([^LT_DLLOADERS$]) LT_DLLOADERS= AC_SUBST([LT_DLLOADERS]) AC_LANG_PUSH([C]) LIBADD_DLOPEN= AC_SEARCH_LIBS([dlopen], [dl], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) if test "$ac_cv_search_dlopen" != "none required" ; then LIBADD_DLOPEN="-ldl" fi libltdl_cv_lib_dl_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H # include #endif ]], [[dlopen(0, 0);]])], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) libltdl_cv_func_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], [AC_CHECK_LIB([svld], [dlopen], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes then lt_save_LIBS="$LIBS" LIBS="$LIBS $LIBADD_DLOPEN" AC_CHECK_FUNCS([dlerror]) LIBS="$lt_save_LIBS" fi AC_SUBST([LIBADD_DLOPEN]) LIBADD_SHL_LOAD= AC_CHECK_FUNC([shl_load], [AC_DEFINE([HAVE_SHL_LOAD], [1], [Define if you have the shl_load function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], [AC_CHECK_LIB([dld], [shl_load], [AC_DEFINE([HAVE_SHL_LOAD], [1], [Define if you have the shl_load function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" LIBADD_SHL_LOAD="-ldld"])]) AC_SUBST([LIBADD_SHL_LOAD]) case $host_os in darwin[[1567]].*) # We only want this for pre-Mac OS X 10.4. AC_CHECK_FUNC([_dyld_func_lookup], [AC_DEFINE([HAVE_DYLD], [1], [Define if you have the _dyld_func_lookup function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) ;; beos*) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" ;; cygwin* | mingw* | os2* | pw32*) AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" ;; esac AC_CHECK_LIB([dld], [dld_link], [AC_DEFINE([HAVE_DLD], [1], [Define if you have the GNU dld library.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) AC_SUBST([LIBADD_DLD_LINK]) m4_pattern_allow([^LT_DLPREOPEN$]) LT_DLPREOPEN= if test -n "$LT_DLLOADERS" then for lt_loader in $LT_DLLOADERS; do LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " done AC_DEFINE([HAVE_LIBDLLOADER], [1], [Define if libdlloader will be built on this platform]) fi AC_SUBST([LT_DLPREOPEN]) dnl This isn't used anymore, but set it for backwards compatibility LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" AC_SUBST([LIBADD_DL]) AC_LANG_POP ])# LT_LIB_DLLOAD # Old name: AU_ALIAS([AC_LTDL_DLLIB], [LT_LIB_DLLOAD]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_DLLIB], []) # LT_SYS_SYMBOL_USCORE # -------------------- # does the compiler prefix global symbols with an underscore? AC_DEFUN([LT_SYS_SYMBOL_USCORE], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl AC_CACHE_CHECK([for _ prefix in compiled symbols], [lt_cv_sys_symbol_underscore], [lt_cv_sys_symbol_underscore=no cat > conftest.$ac_ext <<_LT_EOF void nm_test_func(){} int main(){nm_test_func;return 0;} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. ac_nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then # See whether the symbols have a leading underscore. if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then lt_cv_sys_symbol_underscore=yes else if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then : else echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD fi fi else echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.c >&AS_MESSAGE_LOG_FD fi rm -rf conftest* ]) sys_symbol_underscore=$lt_cv_sys_symbol_underscore AC_SUBST([sys_symbol_underscore]) ])# LT_SYS_SYMBOL_USCORE # Old name: AU_ALIAS([AC_LTDL_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SYMBOL_USCORE], []) # LT_FUNC_DLSYM_USCORE # -------------------- AC_DEFUN([LT_FUNC_DLSYM_USCORE], [AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl if test x"$lt_cv_sys_symbol_underscore" = xyes; then if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then AC_CACHE_CHECK([whether we have to add an underscore for dlsym], [libltdl_cv_need_uscore], [libltdl_cv_need_uscore=unknown save_LIBS="$LIBS" LIBS="$LIBS $LIBADD_DLOPEN" _LT_TRY_DLOPEN_SELF( [libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes], [], [libltdl_cv_need_uscore=cross]) LIBS="$save_LIBS" ]) fi fi if test x"$libltdl_cv_need_uscore" = xyes; then AC_DEFINE([NEED_USCORE], [1], [Define if dlsym() requires a leading underscore in symbol names.]) fi ])# LT_FUNC_DLSYM_USCORE # Old name: AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) cpl-6.4.1/libltdl/m4/ltsugar.m40000644000460300003120000001042412310332714013100 00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) cpl-6.4.1/libltdl/lt__dirent.c0000644000460300003120000000573212310332715013133 00000000000000/* lt__dirent.c -- internal directory entry scanning interface Copyright (C) 2001, 2004 Free Software Foundation, Inc. Written by Bob Friesenhahn, 2001 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lt__private.h" #include #include #include "lt__dirent.h" #if defined(__WINDOWS__) void closedir (DIR *entry) { assert (entry != (DIR *) NULL); FindClose (entry->hSearch); free ((void *) entry); } DIR * opendir (const char *path) { char file_spec[LT_FILENAME_MAX]; DIR *entry; assert (path != (char *) 0); if (lt_strlcpy (file_spec, path, sizeof file_spec) >= sizeof file_spec || lt_strlcat (file_spec, "\\", sizeof file_spec) >= sizeof file_spec) return (DIR *) 0; entry = (DIR *) malloc (sizeof(DIR)); if (entry != (DIR *) 0) { entry->firsttime = TRUE; entry->hSearch = FindFirstFile (file_spec, &entry->Win32FindData); if (entry->hSearch == INVALID_HANDLE_VALUE) { if (lt_strlcat (file_spec, "\\*.*", sizeof file_spec) < sizeof file_spec) { entry->hSearch = FindFirstFile (file_spec, &entry->Win32FindData); } if (entry->hSearch == INVALID_HANDLE_VALUE) { entry = (free (entry), (DIR *) 0); } } } return entry; } struct dirent * readdir (DIR *entry) { int status; if (entry == (DIR *) 0) return (struct dirent *) 0; if (!entry->firsttime) { status = FindNextFile (entry->hSearch, &entry->Win32FindData); if (status == 0) return (struct dirent *) 0; } entry->firsttime = FALSE; if (lt_strlcpy (entry->file_info.d_name, entry->Win32FindData.cFileName, sizeof entry->file_info.d_name) >= sizeof entry->file_info.d_name) return (struct dirent *) 0; entry->file_info.d_namlen = strlen (entry->file_info.d_name); return &entry->file_info; } #endif /*defined(__WINDOWS__)*/ cpl-6.4.1/libltdl/lt__alloc.c0000644000460300003120000000435512310332715012740 00000000000000/* lt__alloc.c -- internal memory management interface Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lt__private.h" #include #include "lt__alloc.h" static void alloc_die_default (void); void (*lt__alloc_die) (void) = alloc_die_default; /* Unless overridden, exit on memory failure. */ static void alloc_die_default (void) { fprintf (stderr, "Out of memory.\n"); exit (EXIT_FAILURE); } void * lt__malloc (size_t n) { void *mem; if (! (mem = malloc (n))) (*lt__alloc_die) (); return mem; } void * lt__zalloc (size_t n) { void *mem; if ((mem = lt__malloc (n))) memset (mem, 0, n); return mem; } void * lt__realloc (void *mem, size_t n) { if (! (mem = realloc (mem, n))) (*lt__alloc_die) (); return mem; } void * lt__memdup (void const *mem, size_t n) { void *newmem; if ((newmem = lt__malloc (n))) return memcpy (newmem, mem, n); return 0; } char * lt__strdup (const char *string) { return (char *) lt__memdup (string, strlen (string) +1); } cpl-6.4.1/libltdl/ltdl.c0000644000460300003120000015367312310332715011757 00000000000000/* ltdl.c -- system independent dlopen wrapper Copyright (C) 1998, 1999, 2000, 2004, 2005, 2006, 2007, 2008, 2011 Free Software Foundation, Inc. Written by Thomas Tanner, 1998 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lt__private.h" #include "lt_system.h" #include "lt_dlloader.h" /* --- MANIFEST CONSTANTS --- */ /* Standard libltdl search path environment variable name */ #undef LTDL_SEARCHPATH_VAR #define LTDL_SEARCHPATH_VAR "LTDL_LIBRARY_PATH" /* Standard libtool archive file extension. */ #undef LT_ARCHIVE_EXT #define LT_ARCHIVE_EXT ".la" /* max. filename length */ #if !defined(LT_FILENAME_MAX) # define LT_FILENAME_MAX 1024 #endif #if !defined(LT_LIBEXT) # define LT_LIBEXT "a" #endif #if !defined(LT_LIBPREFIX) # define LT_LIBPREFIX "lib" #endif /* This is the maximum symbol size that won't require malloc/free */ #undef LT_SYMBOL_LENGTH #define LT_SYMBOL_LENGTH 128 /* This accounts for the _LTX_ separator */ #undef LT_SYMBOL_OVERHEAD #define LT_SYMBOL_OVERHEAD 5 /* Various boolean flags can be stored in the flags field of an lt_dlhandle... */ #define LT_DLIS_RESIDENT(handle) ((handle)->info.is_resident) #define LT_DLIS_SYMGLOBAL(handle) ((handle)->info.is_symglobal) #define LT_DLIS_SYMLOCAL(handle) ((handle)->info.is_symlocal) static const char objdir[] = LT_OBJDIR; static const char archive_ext[] = LT_ARCHIVE_EXT; static const char libext[] = LT_LIBEXT; static const char libprefix[] = LT_LIBPREFIX; #if defined(LT_MODULE_EXT) static const char shlib_ext[] = LT_MODULE_EXT; #endif /* If the loadable module suffix is not the same as the linkable * shared library suffix, this will be defined. */ #if defined(LT_SHARED_EXT) static const char shared_ext[] = LT_SHARED_EXT; #endif #if defined(LT_DLSEARCH_PATH) static const char sys_dlsearch_path[] = LT_DLSEARCH_PATH; #endif /* --- DYNAMIC MODULE LOADING --- */ /* The type of a function used at each iteration of foreach_dirinpath(). */ typedef int foreach_callback_func (char *filename, void *data1, void *data2); /* foreachfile_callback itself calls a function of this type: */ typedef int file_worker_func (const char *filename, void *data); static int foreach_dirinpath (const char *search_path, const char *base_name, foreach_callback_func *func, void *data1, void *data2); static int find_file_callback (char *filename, void *data1, void *data2); static int find_handle_callback (char *filename, void *data, void *ignored); static int foreachfile_callback (char *filename, void *data1, void *data2); static int canonicalize_path (const char *path, char **pcanonical); static int argzize_path (const char *path, char **pargz, size_t *pargz_len); static FILE *find_file (const char *search_path, const char *base_name, char **pdir); static lt_dlhandle *find_handle (const char *search_path, const char *base_name, lt_dlhandle *handle, lt_dladvise advise); static int find_module (lt_dlhandle *handle, const char *dir, const char *libdir, const char *dlname, const char *old_name, int installed, lt_dladvise advise); static int has_library_ext (const char *filename); static int load_deplibs (lt_dlhandle handle, char *deplibs); static int trim (char **dest, const char *str); static int try_dlopen (lt_dlhandle *handle, const char *filename, const char *ext, lt_dladvise advise); static int tryall_dlopen (lt_dlhandle *handle, const char *filename, lt_dladvise padvise, const lt_dlvtable *vtable); static int unload_deplibs (lt_dlhandle handle); static int lt_argz_insert (char **pargz, size_t *pargz_len, char *before, const char *entry); static int lt_argz_insertinorder (char **pargz, size_t *pargz_len, const char *entry); static int lt_argz_insertdir (char **pargz, size_t *pargz_len, const char *dirnam, struct dirent *dp); static int lt_dlpath_insertdir (char **ppath, char *before, const char *dir); static int list_files_by_dir (const char *dirnam, char **pargz, size_t *pargz_len); static int file_not_found (void); #ifdef HAVE_LIBDLLOADER static int loader_init_callback (lt_dlhandle handle); #endif /* HAVE_LIBDLLOADER */ static int loader_init (lt_get_vtable *vtable_func, lt_user_data data); static char *user_search_path= 0; static lt_dlhandle handles = 0; static int initialized = 0; /* Our memory failure callback sets the error message to be passed back up to the client, so we must be careful to return from mallocation callers if allocation fails (as this callback returns!!). */ void lt__alloc_die_callback (void) { LT__SETERROR (NO_MEMORY); } #ifdef HAVE_LIBDLLOADER /* This function is called to initialise each preloaded module loader, and hook it into the list of loaders to be used when attempting to dlopen an application module. */ static int loader_init_callback (lt_dlhandle handle) { lt_get_vtable *vtable_func = (lt_get_vtable *) lt_dlsym (handle, "get_vtable"); return loader_init (vtable_func, 0); } #endif /* HAVE_LIBDLLOADER */ static int loader_init (lt_get_vtable *vtable_func, lt_user_data data) { const lt_dlvtable *vtable = 0; int errors = 0; if (vtable_func) { vtable = (*vtable_func) (data); } /* lt_dlloader_add will LT__SETERROR if it fails. */ errors += lt_dlloader_add (vtable); assert (errors || vtable); if ((!errors) && vtable->dlloader_init) { if ((*vtable->dlloader_init) (vtable->dlloader_data)) { LT__SETERROR (INIT_LOADER); ++errors; } } return errors; } /* Bootstrap the loader loading with the preopening loader. */ #define get_vtable preopen_LTX_get_vtable #define preloaded_symbols LT_CONC3(lt_, LTDLOPEN, _LTX_preloaded_symbols) LT_BEGIN_C_DECLS LT_SCOPE const lt_dlvtable * get_vtable (lt_user_data data); LT_END_C_DECLS #ifdef HAVE_LIBDLLOADER extern LT_DLSYM_CONST lt_dlsymlist preloaded_symbols[]; #endif /* Initialize libltdl. */ int lt_dlinit (void) { int errors = 0; /* Initialize only at first call. */ if (++initialized == 1) { lt__alloc_die = lt__alloc_die_callback; handles = 0; user_search_path = 0; /* empty search path */ /* First set up the statically loaded preload module loader, so we can use it to preopen the other loaders we linked in at compile time. */ errors += loader_init (get_vtable, 0); /* Now open all the preloaded module loaders, so the application can use _them_ to lt_dlopen its own modules. */ #ifdef HAVE_LIBDLLOADER if (!errors) { errors += lt_dlpreload (preloaded_symbols); } if (!errors) { errors += lt_dlpreload_open (LT_STR(LTDLOPEN), loader_init_callback); } #endif /* HAVE_LIBDLLOADER */ } #ifdef LT_DEBUG_LOADERS lt_dlloader_dump(); #endif return errors; } int lt_dlexit (void) { /* shut down libltdl */ lt_dlloader *loader = 0; lt_dlhandle handle = handles; int errors = 0; if (!initialized) { LT__SETERROR (SHUTDOWN); ++errors; goto done; } /* shut down only at last call. */ if (--initialized == 0) { int level; while (handles && LT_DLIS_RESIDENT (handles)) { handles = handles->next; } /* close all modules */ for (level = 1; handle; ++level) { lt_dlhandle cur = handles; int saw_nonresident = 0; while (cur) { lt_dlhandle tmp = cur; cur = cur->next; if (!LT_DLIS_RESIDENT (tmp)) { saw_nonresident = 1; if (tmp->info.ref_count <= level) { if (lt_dlclose (tmp)) { ++errors; } /* Make sure that the handle pointed to by 'cur' still exists. lt_dlclose recursively closes dependent libraries which removes them from the linked list. One of these might be the one pointed to by 'cur'. */ if (cur) { for (tmp = handles; tmp; tmp = tmp->next) if (tmp == cur) break; if (! tmp) cur = handles; } } } } /* done if only resident modules are left */ if (!saw_nonresident) break; } /* When removing loaders, we can only find out failure by testing the error string, so avoid a spurious one from an earlier failed command. */ if (!errors) LT__SETERRORSTR (0); /* close all loaders */ for (loader = (lt_dlloader *) lt_dlloader_next (NULL); loader;) { lt_dlloader *next = (lt_dlloader *) lt_dlloader_next (loader); lt_dlvtable *vtable = (lt_dlvtable *) lt_dlloader_get (loader); if ((vtable = lt_dlloader_remove ((char *) vtable->name))) { FREE (vtable); } else { /* ignore errors due to resident modules */ const char *err; LT__GETERROR (err); if (err) ++errors; } loader = next; } FREE(user_search_path); } done: return errors; } /* Try VTABLE or, if VTABLE is NULL, all available loaders for FILENAME. If the library is not successfully loaded, return non-zero. Otherwise, the dlhandle is stored at the address given in PHANDLE. */ static int tryall_dlopen (lt_dlhandle *phandle, const char *filename, lt_dladvise advise, const lt_dlvtable *vtable) { lt_dlhandle handle = handles; const char * saved_error = 0; int errors = 0; #ifdef LT_DEBUG_LOADERS fprintf (stderr, "tryall_dlopen (%s, %s)\n", filename ? filename : "(null)", vtable ? vtable->name : "(ALL)"); #endif LT__GETERROR (saved_error); /* check whether the module was already opened */ for (;handle; handle = handle->next) { if ((handle->info.filename == filename) /* dlopen self: 0 == 0 */ || (handle->info.filename && filename && streq (handle->info.filename, filename))) { break; } } if (handle) { ++handle->info.ref_count; *phandle = handle; goto done; } handle = *phandle; if (filename) { /* Comment out the check of file permissions using access. This call seems to always return -1 with error EACCES. */ /* We need to catch missing file errors early so that file_not_found() can detect what happened. if (access (filename, R_OK) != 0) { LT__SETERROR (FILE_NOT_FOUND); ++errors; goto done; } */ handle->info.filename = lt__strdup (filename); if (!handle->info.filename) { ++errors; goto done; } } else { handle->info.filename = 0; } { lt_dlloader loader = lt_dlloader_next (0); const lt_dlvtable *loader_vtable; do { if (vtable) loader_vtable = vtable; else loader_vtable = lt_dlloader_get (loader); #ifdef LT_DEBUG_LOADERS fprintf (stderr, "Calling %s->module_open (%s)\n", (loader_vtable && loader_vtable->name) ? loader_vtable->name : "(null)", filename ? filename : "(null)"); #endif handle->module = (*loader_vtable->module_open) (loader_vtable->dlloader_data, filename, advise); #ifdef LT_DEBUG_LOADERS fprintf (stderr, " Result: %s\n", handle->module ? "Success" : "Failed"); #endif if (handle->module != 0) { if (advise) { handle->info.is_resident = advise->is_resident; handle->info.is_symglobal = advise->is_symglobal; handle->info.is_symlocal = advise->is_symlocal; } break; } } while (!vtable && (loader = lt_dlloader_next (loader))); /* If VTABLE was given but couldn't open the module, or VTABLE wasn't given but we exhausted all loaders without opening the module, bail out! */ if ((vtable && !handle->module) || (!vtable && !loader)) { FREE (handle->info.filename); ++errors; goto done; } handle->vtable = loader_vtable; } LT__SETERRORSTR (saved_error); done: return errors; } static int tryall_dlopen_module (lt_dlhandle *handle, const char *prefix, const char *dirname, const char *dlname, lt_dladvise advise) { int error = 0; char *filename = 0; size_t filename_len = 0; size_t dirname_len = LT_STRLEN (dirname); assert (handle); assert (dirname); assert (dlname); #if defined(LT_DIRSEP_CHAR) /* Only canonicalized names (i.e. with DIRSEP chars already converted) should make it into this function: */ assert (strchr (dirname, LT_DIRSEP_CHAR) == 0); #endif if (dirname_len > 0) if (dirname[dirname_len -1] == '/') --dirname_len; filename_len = dirname_len + 1 + LT_STRLEN (dlname); /* Allocate memory, and combine DIRNAME and MODULENAME into it. The PREFIX (if any) is handled below. */ filename = MALLOC (char, filename_len + 1); if (!filename) return 1; sprintf (filename, "%.*s/%s", (int) dirname_len, dirname, dlname); /* Now that we have combined DIRNAME and MODULENAME, if there is also a PREFIX to contend with, simply recurse with the arguments shuffled. Otherwise, attempt to open FILENAME as a module. */ if (prefix) { error += tryall_dlopen_module (handle, (const char *) 0, prefix, filename, advise); } else if (tryall_dlopen (handle, filename, advise, 0) != 0) { ++error; } FREE (filename); return error; } static int find_module (lt_dlhandle *handle, const char *dir, const char *libdir, const char *dlname, const char *old_name, int installed, lt_dladvise advise) { /* Try to open the old library first; if it was dlpreopened, we want the preopened version of it, even if a dlopenable module is available. */ if (old_name && tryall_dlopen (handle, old_name, advise, lt_dlloader_find ("lt_preopen") ) == 0) { return 0; } /* Try to open the dynamic library. */ if (dlname) { /* try to open the installed module */ if (installed && libdir) { if (tryall_dlopen_module (handle, (const char *) 0, libdir, dlname, advise) == 0) return 0; } /* try to open the not-installed module */ if (!installed) { if (tryall_dlopen_module (handle, dir, objdir, dlname, advise) == 0) return 0; } /* maybe it was moved to another directory */ { if (dir && (tryall_dlopen_module (handle, (const char *) 0, dir, dlname, advise) == 0)) return 0; } } return 1; } static int canonicalize_path (const char *path, char **pcanonical) { char *canonical = 0; assert (path && *path); assert (pcanonical); canonical = MALLOC (char, 1+ LT_STRLEN (path)); if (!canonical) return 1; { size_t dest = 0; size_t src; for (src = 0; path[src] != LT_EOS_CHAR; ++src) { /* Path separators are not copied to the beginning or end of the destination, or if another separator would follow immediately. */ if (path[src] == LT_PATHSEP_CHAR) { if ((dest == 0) || (path[1+ src] == LT_PATHSEP_CHAR) || (path[1+ src] == LT_EOS_CHAR)) continue; } /* Anything other than a directory separator is copied verbatim. */ if ((path[src] != '/') #if defined(LT_DIRSEP_CHAR) && (path[src] != LT_DIRSEP_CHAR) #endif ) { canonical[dest++] = path[src]; } /* Directory separators are converted and copied only if they are not at the end of a path -- i.e. before a path separator or NULL terminator. */ else if ((path[1+ src] != LT_PATHSEP_CHAR) && (path[1+ src] != LT_EOS_CHAR) #if defined(LT_DIRSEP_CHAR) && (path[1+ src] != LT_DIRSEP_CHAR) #endif && (path[1+ src] != '/')) { canonical[dest++] = '/'; } } /* Add an end-of-string marker at the end. */ canonical[dest] = LT_EOS_CHAR; } /* Assign new value. */ *pcanonical = canonical; return 0; } static int argzize_path (const char *path, char **pargz, size_t *pargz_len) { error_t error; assert (path); assert (pargz); assert (pargz_len); if ((error = argz_create_sep (path, LT_PATHSEP_CHAR, pargz, pargz_len))) { switch (error) { case ENOMEM: LT__SETERROR (NO_MEMORY); break; default: LT__SETERROR (UNKNOWN); break; } return 1; } return 0; } /* Repeatedly call FUNC with each LT_PATHSEP_CHAR delimited element of SEARCH_PATH and references to DATA1 and DATA2, until FUNC returns non-zero or all elements are exhausted. If BASE_NAME is non-NULL, it is appended to each SEARCH_PATH element before FUNC is called. */ static int foreach_dirinpath (const char *search_path, const char *base_name, foreach_callback_func *func, void *data1, void *data2) { int result = 0; size_t filenamesize = 0; size_t lenbase = LT_STRLEN (base_name); size_t argz_len = 0; char *argz = 0; char *filename = 0; char *canonical = 0; if (!search_path || !*search_path) { LT__SETERROR (FILE_NOT_FOUND); goto cleanup; } if (canonicalize_path (search_path, &canonical) != 0) goto cleanup; if (argzize_path (canonical, &argz, &argz_len) != 0) goto cleanup; { char *dir_name = 0; while ((dir_name = argz_next (argz, argz_len, dir_name))) { size_t lendir = LT_STRLEN (dir_name); if (1+ lendir + lenbase >= filenamesize) { FREE (filename); filenamesize = 1+ lendir + 1+ lenbase; /* "/d" + '/' + "f" + '\0' */ filename = MALLOC (char, filenamesize); if (!filename) goto cleanup; } assert (filenamesize > lendir); strcpy (filename, dir_name); if (base_name && *base_name) { if (filename[lendir -1] != '/') filename[lendir++] = '/'; strcpy (filename +lendir, base_name); } if ((result = (*func) (filename, data1, data2))) { break; } } } cleanup: FREE (argz); FREE (canonical); FREE (filename); return result; } /* If FILEPATH can be opened, store the name of the directory component in DATA1, and the opened FILE* structure address in DATA2. Otherwise DATA1 is unchanged, but DATA2 is set to a pointer to NULL. */ static int find_file_callback (char *filename, void *data1, void *data2) { char **pdir = (char **) data1; FILE **pfile = (FILE **) data2; int is_done = 0; assert (filename && *filename); assert (pdir); assert (pfile); if ((*pfile = fopen (filename, LT_READTEXT_MODE))) { char *dirend = strrchr (filename, '/'); if (dirend > filename) *dirend = LT_EOS_CHAR; FREE (*pdir); *pdir = lt__strdup (filename); is_done = (*pdir == 0) ? -1 : 1; } return is_done; } static FILE * find_file (const char *search_path, const char *base_name, char **pdir) { FILE *file = 0; foreach_dirinpath (search_path, base_name, find_file_callback, pdir, &file); return file; } static int find_handle_callback (char *filename, void *data, void *data2) { lt_dlhandle *phandle = (lt_dlhandle *) data; int notfound = access (filename, R_OK); lt_dladvise advise = (lt_dladvise) data2; /* Bail out if file cannot be read... */ if (notfound) return 0; /* Try to dlopen the file, but do not continue searching in any case. */ if (tryall_dlopen (phandle, filename, advise, 0) != 0) *phandle = 0; return 1; } /* If HANDLE was found return it, otherwise return 0. If HANDLE was found but could not be opened, *HANDLE will be set to 0. */ static lt_dlhandle * find_handle (const char *search_path, const char *base_name, lt_dlhandle *phandle, lt_dladvise advise) { if (!search_path) return 0; if (!foreach_dirinpath (search_path, base_name, find_handle_callback, phandle, advise)) return 0; return phandle; } #if !defined(LTDL_DLOPEN_DEPLIBS) static int load_deplibs (lt_dlhandle handle, char * LT__UNUSED deplibs) { handle->depcount = 0; return 0; } #else /* defined(LTDL_DLOPEN_DEPLIBS) */ static int load_deplibs (lt_dlhandle handle, char *deplibs) { char *p, *save_search_path = 0; int depcount = 0; int i; char **names = 0; int errors = 0; handle->depcount = 0; if (!deplibs) { return errors; } ++errors; if (user_search_path) { save_search_path = lt__strdup (user_search_path); if (!save_search_path) goto cleanup; } /* extract search paths and count deplibs */ p = deplibs; while (*p) { if (!isspace ((unsigned char) *p)) { char *end = p+1; while (*end && !isspace((unsigned char) *end)) { ++end; } if (strncmp(p, "-L", 2) == 0 || strncmp(p, "-R", 2) == 0) { char save = *end; *end = 0; /* set a temporary string terminator */ if (lt_dladdsearchdir(p+2)) { goto cleanup; } *end = save; } else { ++depcount; } p = end; } else { ++p; } } if (!depcount) { errors = 0; goto cleanup; } names = MALLOC (char *, depcount); if (!names) goto cleanup; /* now only extract the actual deplibs */ depcount = 0; p = deplibs; while (*p) { if (isspace ((unsigned char) *p)) { ++p; } else { char *end = p+1; while (*end && !isspace ((unsigned char) *end)) { ++end; } if (strncmp(p, "-L", 2) != 0 && strncmp(p, "-R", 2) != 0) { char *name; char save = *end; *end = 0; /* set a temporary string terminator */ if (strncmp(p, "-l", 2) == 0) { size_t name_len = 3+ /* "lib" */ LT_STRLEN (p + 2); name = MALLOC (char, 1+ name_len); if (name) sprintf (name, "lib%s", p+2); } else name = lt__strdup(p); if (!name) goto cleanup_names; names[depcount++] = name; *end = save; } p = end; } } /* load the deplibs (in reverse order) At this stage, don't worry if the deplibs do not load correctly, they may already be statically linked into the loading application for instance. There will be a more enlightening error message later on if the loaded module cannot resolve all of its symbols. */ if (depcount) { lt_dlhandle cur = handle; int j = 0; cur->deplibs = MALLOC (lt_dlhandle, depcount); if (!cur->deplibs) goto cleanup_names; for (i = 0; i < depcount; ++i) { cur->deplibs[j] = lt_dlopenext(names[depcount-1-i]); if (cur->deplibs[j]) { ++j; } } cur->depcount = j; /* Number of successfully loaded deplibs */ errors = 0; } cleanup_names: for (i = 0; i < depcount; ++i) { FREE (names[i]); } cleanup: FREE (names); /* restore the old search path */ if (save_search_path) { MEMREASSIGN (user_search_path, save_search_path); } return errors; } #endif /* defined(LTDL_DLOPEN_DEPLIBS) */ static int unload_deplibs (lt_dlhandle handle) { int i; int errors = 0; lt_dlhandle cur = handle; if (cur->depcount) { for (i = 0; i < cur->depcount; ++i) { if (!LT_DLIS_RESIDENT (cur->deplibs[i])) { errors += lt_dlclose (cur->deplibs[i]); } } FREE (cur->deplibs); } return errors; } static int trim (char **dest, const char *str) { /* remove the leading and trailing "'" from str and store the result in dest */ const char *end = strrchr (str, '\''); size_t len = LT_STRLEN (str); char *tmp; FREE (*dest); if (!end || end == str) return 1; if (len > 3 && str[0] == '\'') { tmp = MALLOC (char, end - str); if (!tmp) return 1; memcpy(tmp, &str[1], (end - str) - 1); tmp[(end - str) - 1] = LT_EOS_CHAR; *dest = tmp; } else { *dest = 0; } return 0; } /* Read the .la file FILE. */ static int parse_dotla_file(FILE *file, char **dlname, char **libdir, char **deplibs, char **old_name, int *installed) { int errors = 0; size_t line_len = LT_FILENAME_MAX; char * line = MALLOC (char, line_len); if (!line) { LT__SETERROR (FILE_NOT_FOUND); return 1; } while (!feof (file)) { line[line_len-2] = '\0'; if (!fgets (line, (int) line_len, file)) { break; } /* Handle the case where we occasionally need to read a line that is longer than the initial buffer size. Behave even if the file contains NUL bytes due to corruption. */ while (line[line_len-2] != '\0' && line[line_len-2] != '\n' && !feof (file)) { line = REALLOC (char, line, line_len *2); if (!line) { ++errors; goto cleanup; } line[line_len * 2 - 2] = '\0'; if (!fgets (&line[line_len -1], (int) line_len +1, file)) { break; } line_len *= 2; } if (line[0] == '\n' || line[0] == '#') { continue; } #undef STR_DLNAME #define STR_DLNAME "dlname=" if (strncmp (line, STR_DLNAME, sizeof (STR_DLNAME) - 1) == 0) { errors += trim (dlname, &line[sizeof (STR_DLNAME) - 1]); } #undef STR_OLD_LIBRARY #define STR_OLD_LIBRARY "old_library=" else if (strncmp (line, STR_OLD_LIBRARY, sizeof (STR_OLD_LIBRARY) - 1) == 0) { errors += trim (old_name, &line[sizeof (STR_OLD_LIBRARY) - 1]); } /* Windows native tools do not understand the POSIX paths we store in libdir. */ #undef STR_LIBDIR #define STR_LIBDIR "libdir=" else if (strncmp (line, STR_LIBDIR, sizeof (STR_LIBDIR) - 1) == 0) { errors += trim (libdir, &line[sizeof(STR_LIBDIR) - 1]); #ifdef __WINDOWS__ /* Disallow following unix-style paths on MinGW. */ if (*libdir && (**libdir == '/' || **libdir == '\\')) **libdir = '\0'; #endif } #undef STR_DL_DEPLIBS #define STR_DL_DEPLIBS "dependency_libs=" else if (strncmp (line, STR_DL_DEPLIBS, sizeof (STR_DL_DEPLIBS) - 1) == 0) { errors += trim (deplibs, &line[sizeof (STR_DL_DEPLIBS) - 1]); } else if (streq (line, "installed=yes\n")) { *installed = 1; } else if (streq (line, "installed=no\n")) { *installed = 0; } #undef STR_LIBRARY_NAMES #define STR_LIBRARY_NAMES "library_names=" else if (!*dlname && strncmp (line, STR_LIBRARY_NAMES, sizeof (STR_LIBRARY_NAMES) - 1) == 0) { char *last_libname; errors += trim (dlname, &line[sizeof (STR_LIBRARY_NAMES) - 1]); if (!errors && *dlname && (last_libname = strrchr (*dlname, ' ')) != 0) { last_libname = lt__strdup (last_libname + 1); if (!last_libname) { ++errors; goto cleanup; } MEMREASSIGN (*dlname, last_libname); } } if (errors) break; } cleanup: FREE (line); return errors; } /* Try to open FILENAME as a module. */ static int try_dlopen (lt_dlhandle *phandle, const char *filename, const char *ext, lt_dladvise advise) { const char * saved_error = 0; char * archive_name = 0; char * canonical = 0; char * base_name = 0; char * dir = 0; char * name = 0; char * attempt = 0; int errors = 0; lt_dlhandle newhandle; assert (phandle); assert (*phandle == 0); #ifdef LT_DEBUG_LOADERS fprintf (stderr, "try_dlopen (%s, %s)\n", filename ? filename : "(null)", ext ? ext : "(null)"); #endif LT__GETERROR (saved_error); /* dlopen self? */ if (!filename) { *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle)); if (*phandle == 0) return 1; newhandle = *phandle; /* lt_dlclose()ing yourself is very bad! Disallow it. */ newhandle->info.is_resident = 1; if (tryall_dlopen (&newhandle, 0, advise, 0) != 0) { FREE (*phandle); return 1; } goto register_handle; } assert (filename && *filename); if (ext) { attempt = MALLOC (char, LT_STRLEN (filename) + LT_STRLEN (ext) + 1); if (!attempt) return 1; sprintf(attempt, "%s%s", filename, ext); } else { attempt = lt__strdup (filename); if (!attempt) return 1; } /* Doing this immediately allows internal functions to safely assume only canonicalized paths are passed. */ if (canonicalize_path (attempt, &canonical) != 0) { ++errors; goto cleanup; } /* If the canonical module name is a path (relative or absolute) then split it into a directory part and a name part. */ base_name = strrchr (canonical, '/'); if (base_name) { size_t dirlen = (1+ base_name) - canonical; dir = MALLOC (char, 1+ dirlen); if (!dir) { ++errors; goto cleanup; } strncpy (dir, canonical, dirlen); dir[dirlen] = LT_EOS_CHAR; ++base_name; } else MEMREASSIGN (base_name, canonical); assert (base_name && *base_name); ext = strrchr (base_name, '.'); if (!ext) { ext = base_name + LT_STRLEN (base_name); } /* extract the module name from the file name */ name = MALLOC (char, ext - base_name + 1); if (!name) { ++errors; goto cleanup; } /* canonicalize the module name */ { int i; for (i = 0; i < ext - base_name; ++i) { if (isalnum ((unsigned char)(base_name[i]))) { name[i] = base_name[i]; } else { name[i] = '_'; } } name[ext - base_name] = LT_EOS_CHAR; } /* Before trawling through the filesystem in search of a module, check whether we are opening a preloaded module. */ if (!dir) { const lt_dlvtable *vtable = lt_dlloader_find ("lt_preopen"); if (vtable) { /* libprefix + name + "." + libext + NULL */ archive_name = MALLOC (char, strlen (libprefix) + LT_STRLEN (name) + strlen (libext) + 2); *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle)); if ((*phandle == NULL) || (archive_name == NULL)) { ++errors; goto cleanup; } newhandle = *phandle; /* Preloaded modules are always named according to their old archive name. */ if (strncmp(name, "lib", 3) == 0) { sprintf (archive_name, "%s%s.%s", libprefix, name + 3, libext); } else { sprintf (archive_name, "%s.%s", name, libext); } if (tryall_dlopen (&newhandle, archive_name, advise, vtable) == 0) { goto register_handle; } /* If we're still here, there was no matching preloaded module, so put things back as we found them, and continue searching. */ FREE (*phandle); newhandle = NULL; } } /* If we are allowing only preloaded modules, and we didn't find anything yet, give up on the search here. */ if (advise && advise->try_preload_only) { goto cleanup; } /* Check whether we are opening a libtool module (.la extension). */ if (ext && streq (ext, archive_ext)) { /* this seems to be a libtool module */ FILE * file = 0; char * dlname = 0; char * old_name = 0; char * libdir = 0; char * deplibs = 0; /* if we can't find the installed flag, it is probably an installed libtool archive, produced with an old version of libtool */ int installed = 1; /* Now try to open the .la file. If there is no directory name component, try to find it first in user_search_path and then other prescribed paths. Otherwise (or in any case if the module was not yet found) try opening just the module name as passed. */ if (!dir) { const char *search_path = user_search_path; if (search_path) file = find_file (user_search_path, base_name, &dir); if (!file) { search_path = getenv (LTDL_SEARCHPATH_VAR); if (search_path) file = find_file (search_path, base_name, &dir); } #if defined(LT_MODULE_PATH_VAR) if (!file) { search_path = getenv (LT_MODULE_PATH_VAR); if (search_path) file = find_file (search_path, base_name, &dir); } #endif #if defined(LT_DLSEARCH_PATH) if (!file && *sys_dlsearch_path) { file = find_file (sys_dlsearch_path, base_name, &dir); } #endif } else { file = fopen (attempt, LT_READTEXT_MODE); } /* If we didn't find the file by now, it really isn't there. Set the status flag, and bail out. */ if (!file) { LT__SETERROR (FILE_NOT_FOUND); ++errors; goto cleanup; } /* read the .la file */ if (parse_dotla_file(file, &dlname, &libdir, &deplibs, &old_name, &installed) != 0) ++errors; fclose (file); /* allocate the handle */ *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle)); if (*phandle == 0) ++errors; if (errors) { FREE (dlname); FREE (old_name); FREE (libdir); FREE (deplibs); FREE (*phandle); goto cleanup; } assert (*phandle); if (load_deplibs (*phandle, deplibs) == 0) { newhandle = *phandle; /* find_module may replace newhandle */ if (find_module (&newhandle, dir, libdir, dlname, old_name, installed, advise)) { unload_deplibs (*phandle); ++errors; } } else { ++errors; } FREE (dlname); FREE (old_name); FREE (libdir); FREE (deplibs); if (errors) { FREE (*phandle); goto cleanup; } if (*phandle != newhandle) { unload_deplibs (*phandle); } } else { /* not a libtool module */ *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle)); if (*phandle == 0) { ++errors; goto cleanup; } newhandle = *phandle; /* If the module has no directory name component, try to find it first in user_search_path and then other prescribed paths. Otherwise (or in any case if the module was not yet found) try opening just the module name as passed. */ if ((dir || (!find_handle (user_search_path, base_name, &newhandle, advise) && !find_handle (getenv (LTDL_SEARCHPATH_VAR), base_name, &newhandle, advise) #if defined(LT_MODULE_PATH_VAR) && !find_handle (getenv (LT_MODULE_PATH_VAR), base_name, &newhandle, advise) #endif #if defined(LT_DLSEARCH_PATH) && !find_handle (sys_dlsearch_path, base_name, &newhandle, advise) #endif ))) { if (tryall_dlopen (&newhandle, attempt, advise, 0) != 0) { newhandle = NULL; } } if (!newhandle) { FREE (*phandle); ++errors; goto cleanup; } } register_handle: MEMREASSIGN (*phandle, newhandle); if ((*phandle)->info.ref_count == 0) { (*phandle)->info.ref_count = 1; MEMREASSIGN ((*phandle)->info.name, name); (*phandle)->next = handles; handles = *phandle; } LT__SETERRORSTR (saved_error); cleanup: FREE (dir); FREE (attempt); FREE (name); if (!canonical) /* was MEMREASSIGNed */ FREE (base_name); FREE (canonical); FREE (archive_name); return errors; } /* If the last error message stored was `FILE_NOT_FOUND', then return non-zero. */ static int file_not_found (void) { const char *error = 0; LT__GETERROR (error); if (error == LT__STRERROR (FILE_NOT_FOUND)) return 1; return 0; } /* Unless FILENAME already bears a suitable library extension, then return 0. */ static int has_library_ext (const char *filename) { const char * ext = 0; assert (filename); ext = strrchr (filename, '.'); if (ext && ((streq (ext, archive_ext)) #if defined(LT_MODULE_EXT) || (streq (ext, shlib_ext)) #endif #if defined(LT_SHARED_EXT) || (streq (ext, shared_ext)) #endif )) { return 1; } return 0; } /* Initialise and configure a user lt_dladvise opaque object. */ int lt_dladvise_init (lt_dladvise *padvise) { lt_dladvise advise = (lt_dladvise) lt__zalloc (sizeof (struct lt__advise)); *padvise = advise; return (advise ? 0 : 1); } int lt_dladvise_destroy (lt_dladvise *padvise) { if (padvise) FREE(*padvise); return 0; } int lt_dladvise_ext (lt_dladvise *padvise) { assert (padvise && *padvise); (*padvise)->try_ext = 1; return 0; } int lt_dladvise_resident (lt_dladvise *padvise) { assert (padvise && *padvise); (*padvise)->is_resident = 1; return 0; } int lt_dladvise_local (lt_dladvise *padvise) { assert (padvise && *padvise); (*padvise)->is_symlocal = 1; return 0; } int lt_dladvise_global (lt_dladvise *padvise) { assert (padvise && *padvise); (*padvise)->is_symglobal = 1; return 0; } int lt_dladvise_preload (lt_dladvise *padvise) { assert (padvise && *padvise); (*padvise)->try_preload_only = 1; return 0; } /* Libtool-1.5.x interface for loading a new module named FILENAME. */ lt_dlhandle lt_dlopen (const char *filename) { return lt_dlopenadvise (filename, NULL); } /* If FILENAME has an ARCHIVE_EXT or MODULE_EXT extension, try to open the FILENAME as passed. Otherwise try appending ARCHIVE_EXT, and if a file is still not found try again with MODULE_EXT appended instead. */ lt_dlhandle lt_dlopenext (const char *filename) { lt_dlhandle handle = 0; lt_dladvise advise; if (!lt_dladvise_init (&advise) && !lt_dladvise_ext (&advise)) handle = lt_dlopenadvise (filename, advise); lt_dladvise_destroy (&advise); return handle; } lt_dlhandle lt_dlopenadvise (const char *filename, lt_dladvise advise) { lt_dlhandle handle = 0; int errors = 0; const char * saved_error = 0; LT__GETERROR (saved_error); /* Can't have symbols hidden and visible at the same time! */ if (advise && advise->is_symlocal && advise->is_symglobal) { LT__SETERROR (CONFLICTING_FLAGS); return 0; } if (!filename || !advise || !advise->try_ext || has_library_ext (filename)) { /* Just incase we missed a code path in try_dlopen() that reports an error, but forgot to reset handle... */ if (try_dlopen (&handle, filename, NULL, advise) != 0) return 0; return handle; } else if (filename && *filename) { /* First try appending ARCHIVE_EXT. */ errors += try_dlopen (&handle, filename, archive_ext, advise); /* If we found FILENAME, stop searching -- whether we were able to load the file as a module or not. If the file exists but loading failed, it is better to return an error message here than to report FILE_NOT_FOUND when the alternatives (foo.so etc) are not in the module search path. */ if (handle || ((errors > 0) && !file_not_found ())) return handle; #if defined(LT_MODULE_EXT) /* Try appending SHLIB_EXT. */ LT__SETERRORSTR (saved_error); errors = try_dlopen (&handle, filename, shlib_ext, advise); /* As before, if the file was found but loading failed, return now with the current error message. */ if (handle || ((errors > 0) && !file_not_found ())) return handle; #endif #if defined(LT_SHARED_EXT) /* Try appending SHARED_EXT. */ LT__SETERRORSTR (saved_error); errors = try_dlopen (&handle, filename, shared_ext, advise); /* As before, if the file was found but loading failed, return now with the current error message. */ if (handle || ((errors > 0) && !file_not_found ())) return handle; #endif } /* Still here? Then we really did fail to locate any of the file names we tried. */ LT__SETERROR (FILE_NOT_FOUND); return 0; } static int lt_argz_insert (char **pargz, size_t *pargz_len, char *before, const char *entry) { error_t error; /* Prior to Sep 8, 2005, newlib had a bug where argz_insert(pargz, pargz_len, NULL, entry) failed with EINVAL. */ if (before) error = argz_insert (pargz, pargz_len, before, entry); else error = argz_append (pargz, pargz_len, entry, 1 + strlen (entry)); if (error) { switch (error) { case ENOMEM: LT__SETERROR (NO_MEMORY); break; default: LT__SETERROR (UNKNOWN); break; } return 1; } return 0; } static int lt_argz_insertinorder (char **pargz, size_t *pargz_len, const char *entry) { char *before = 0; assert (pargz); assert (pargz_len); assert (entry && *entry); if (*pargz) while ((before = argz_next (*pargz, *pargz_len, before))) { int cmp = strcmp (entry, before); if (cmp < 0) break; if (cmp == 0) return 0; /* No duplicates! */ } return lt_argz_insert (pargz, pargz_len, before, entry); } static int lt_argz_insertdir (char **pargz, size_t *pargz_len, const char *dirnam, struct dirent *dp) { char *buf = 0; size_t buf_len = 0; char *end = 0; size_t end_offset = 0; size_t dir_len = 0; int errors = 0; assert (pargz); assert (pargz_len); assert (dp); dir_len = LT_STRLEN (dirnam); end = dp->d_name + D_NAMLEN(dp); /* Ignore version numbers. */ { char *p; for (p = end; p -1 > dp->d_name; --p) if (strchr (".0123456789", p[-1]) == 0) break; if (*p == '.') end = p; } /* Ignore filename extension. */ { char *p; for (p = end -1; p > dp->d_name; --p) if (*p == '.') { end = p; break; } } /* Prepend the directory name. */ end_offset = end - dp->d_name; buf_len = dir_len + 1+ end_offset; buf = MALLOC (char, 1+ buf_len); if (!buf) return ++errors; assert (buf); strcpy (buf, dirnam); strcat (buf, "/"); strncat (buf, dp->d_name, end_offset); buf[buf_len] = LT_EOS_CHAR; /* Try to insert (in order) into ARGZ/ARGZ_LEN. */ if (lt_argz_insertinorder (pargz, pargz_len, buf) != 0) ++errors; FREE (buf); return errors; } static int list_files_by_dir (const char *dirnam, char **pargz, size_t *pargz_len) { DIR *dirp = 0; int errors = 0; assert (dirnam && *dirnam); assert (pargz); assert (pargz_len); assert (dirnam[LT_STRLEN(dirnam) -1] != '/'); dirp = opendir (dirnam); if (dirp) { struct dirent *dp = 0; while ((dp = readdir (dirp))) if (dp->d_name[0] != '.') if (lt_argz_insertdir (pargz, pargz_len, dirnam, dp)) { ++errors; break; } closedir (dirp); } else ++errors; return errors; } /* If there are any files in DIRNAME, call the function passed in DATA1 (with the name of each file and DATA2 as arguments). */ static int foreachfile_callback (char *dirname, void *data1, void *data2) { file_worker_func *func = *(file_worker_func **) data1; int is_done = 0; char *argz = 0; size_t argz_len = 0; if (list_files_by_dir (dirname, &argz, &argz_len) != 0) goto cleanup; if (!argz) goto cleanup; { char *filename = 0; while ((filename = argz_next (argz, argz_len, filename))) if ((is_done = (*func) (filename, data2))) break; } cleanup: FREE (argz); return is_done; } /* Call FUNC for each unique extensionless file in SEARCH_PATH, along with DATA. The filenames passed to FUNC would be suitable for passing to lt_dlopenext. The extensions are stripped so that individual modules do not generate several entries (e.g. libfoo.la, libfoo.so, libfoo.so.1, libfoo.so.1.0.0). If SEARCH_PATH is NULL, then the same directories that lt_dlopen would search are examined. */ int lt_dlforeachfile (const char *search_path, int (*func) (const char *filename, void *data), void *data) { int is_done = 0; file_worker_func **fpptr = &func; if (search_path) { /* If a specific path was passed, search only the directories listed in it. */ is_done = foreach_dirinpath (search_path, 0, foreachfile_callback, fpptr, data); } else { /* Otherwise search the default paths. */ is_done = foreach_dirinpath (user_search_path, 0, foreachfile_callback, fpptr, data); if (!is_done) { is_done = foreach_dirinpath (getenv(LTDL_SEARCHPATH_VAR), 0, foreachfile_callback, fpptr, data); } #if defined(LT_MODULE_PATH_VAR) if (!is_done) { is_done = foreach_dirinpath (getenv(LT_MODULE_PATH_VAR), 0, foreachfile_callback, fpptr, data); } #endif #if defined(LT_DLSEARCH_PATH) if (!is_done && *sys_dlsearch_path) { is_done = foreach_dirinpath (sys_dlsearch_path, 0, foreachfile_callback, fpptr, data); } #endif } return is_done; } int lt_dlclose (lt_dlhandle handle) { lt_dlhandle cur, last; int errors = 0; /* check whether the handle is valid */ last = cur = handles; while (cur && handle != cur) { last = cur; cur = cur->next; } if (!cur) { LT__SETERROR (INVALID_HANDLE); ++errors; goto done; } cur = handle; cur->info.ref_count--; /* Note that even with resident modules, we must track the ref_count correctly incase the user decides to reset the residency flag later (even though the API makes no provision for that at the moment). */ if (cur->info.ref_count <= 0 && !LT_DLIS_RESIDENT (cur)) { lt_user_data data = cur->vtable->dlloader_data; if (cur != handles) { last->next = cur->next; } else { handles = cur->next; } errors += cur->vtable->module_close (data, cur->module); errors += unload_deplibs (handle); /* It is up to the callers to free the data itself. */ FREE (cur->interface_data); FREE (cur->info.filename); FREE (cur->info.name); FREE (cur); goto done; } if (LT_DLIS_RESIDENT (handle)) { LT__SETERROR (CLOSE_RESIDENT_MODULE); ++errors; } done: return errors; } void * lt_dlsym (lt_dlhandle place, const char *symbol) { size_t lensym; char lsym[LT_SYMBOL_LENGTH]; char *sym; void *address; lt_user_data data; lt_dlhandle handle; if (!place) { LT__SETERROR (INVALID_HANDLE); return 0; } handle = place; if (!symbol) { LT__SETERROR (SYMBOL_NOT_FOUND); return 0; } lensym = LT_STRLEN (symbol) + LT_STRLEN (handle->vtable->sym_prefix) + LT_STRLEN (handle->info.name); if (lensym + LT_SYMBOL_OVERHEAD < LT_SYMBOL_LENGTH) { sym = lsym; } else { sym = MALLOC (char, lensym + LT_SYMBOL_OVERHEAD + 1); if (!sym) { LT__SETERROR (BUFFER_OVERFLOW); return 0; } } data = handle->vtable->dlloader_data; if (handle->info.name) { const char *saved_error; LT__GETERROR (saved_error); /* this is a libtool module */ if (handle->vtable->sym_prefix) { strcpy(sym, handle->vtable->sym_prefix); strcat(sym, handle->info.name); } else { strcpy(sym, handle->info.name); } strcat(sym, "_LTX_"); strcat(sym, symbol); /* try "modulename_LTX_symbol" */ address = handle->vtable->find_sym (data, handle->module, sym); if (address) { if (sym != lsym) { FREE (sym); } return address; } LT__SETERRORSTR (saved_error); } /* otherwise try "symbol" */ if (handle->vtable->sym_prefix) { strcpy(sym, handle->vtable->sym_prefix); strcat(sym, symbol); } else { strcpy(sym, symbol); } address = handle->vtable->find_sym (data, handle->module, sym); if (sym != lsym) { FREE (sym); } return address; } const char * lt_dlerror (void) { const char *error; LT__GETERROR (error); LT__SETERRORSTR (0); return error; } static int lt_dlpath_insertdir (char **ppath, char *before, const char *dir) { int errors = 0; char *canonical = 0; char *argz = 0; size_t argz_len = 0; assert (ppath); assert (dir && *dir); if (canonicalize_path (dir, &canonical) != 0) { ++errors; goto cleanup; } assert (canonical && *canonical); /* If *PPATH is empty, set it to DIR. */ if (*ppath == 0) { assert (!before); /* BEFORE cannot be set without PPATH. */ assert (dir); /* Without DIR, don't call this function! */ *ppath = lt__strdup (dir); if (*ppath == 0) ++errors; goto cleanup; } assert (ppath && *ppath); if (argzize_path (*ppath, &argz, &argz_len) != 0) { ++errors; goto cleanup; } /* Convert BEFORE into an equivalent offset into ARGZ. This only works if *PPATH is already canonicalized, and hence does not change length with respect to ARGZ. We canonicalize each entry as it is added to the search path, and don't call this function with (uncanonicalized) user paths, so this is a fair assumption. */ if (before) { assert (*ppath <= before); assert ((int) (before - *ppath) <= (int) strlen (*ppath)); before = before - *ppath + argz; } if (lt_argz_insert (&argz, &argz_len, before, dir) != 0) { ++errors; goto cleanup; } argz_stringify (argz, argz_len, LT_PATHSEP_CHAR); MEMREASSIGN(*ppath, argz); cleanup: FREE (argz); FREE (canonical); return errors; } int lt_dladdsearchdir (const char *search_dir) { int errors = 0; if (search_dir && *search_dir) { if (lt_dlpath_insertdir (&user_search_path, 0, search_dir) != 0) ++errors; } return errors; } int lt_dlinsertsearchdir (const char *before, const char *search_dir) { int errors = 0; if (before) { if ((before < user_search_path) || (before >= user_search_path + LT_STRLEN (user_search_path))) { LT__SETERROR (INVALID_POSITION); return 1; } } if (search_dir && *search_dir) { if (lt_dlpath_insertdir (&user_search_path, (char *) before, search_dir) != 0) { ++errors; } } return errors; } int lt_dlsetsearchpath (const char *search_path) { int errors = 0; FREE (user_search_path); if (!search_path || !LT_STRLEN (search_path)) { return errors; } if (canonicalize_path (search_path, &user_search_path) != 0) ++errors; return errors; } const char * lt_dlgetsearchpath (void) { const char *saved_path; saved_path = user_search_path; return saved_path; } int lt_dlmakeresident (lt_dlhandle handle) { int errors = 0; if (!handle) { LT__SETERROR (INVALID_HANDLE); ++errors; } else { handle->info.is_resident = 1; } return errors; } int lt_dlisresident (lt_dlhandle handle) { if (!handle) { LT__SETERROR (INVALID_HANDLE); return -1; } return LT_DLIS_RESIDENT (handle); } /* --- MODULE INFORMATION --- */ typedef struct { const char *id_string; lt_dlhandle_interface *iface; } lt__interface_id; lt_dlinterface_id lt_dlinterface_register (const char *id_string, lt_dlhandle_interface *iface) { lt__interface_id *interface_id = (lt__interface_id *) lt__malloc (sizeof *interface_id); /* If lt__malloc fails, it will LT__SETERROR (NO_MEMORY), which can then be detected with lt_dlerror() if we return 0. */ if (interface_id) { interface_id->id_string = lt__strdup (id_string); if (!interface_id->id_string) FREE (interface_id); else interface_id->iface = iface; } return (lt_dlinterface_id) interface_id; } void lt_dlinterface_free (lt_dlinterface_id key) { lt__interface_id *interface_id = (lt__interface_id *)key; FREE (interface_id->id_string); FREE (interface_id); } void * lt_dlcaller_set_data (lt_dlinterface_id key, lt_dlhandle handle, void *data) { int n_elements = 0; void *stale = (void *) 0; lt_dlhandle cur = handle; int i; if (cur->interface_data) while (cur->interface_data[n_elements].key) ++n_elements; for (i = 0; i < n_elements; ++i) { if (cur->interface_data[i].key == key) { stale = cur->interface_data[i].data; break; } } /* Ensure that there is enough room in this handle's interface_data array to accept a new element (and an empty end marker). */ if (i == n_elements) { lt_interface_data *temp = REALLOC (lt_interface_data, cur->interface_data, 2+ n_elements); if (!temp) { stale = 0; goto done; } cur->interface_data = temp; /* We only need this if we needed to allocate a new interface_data. */ cur->interface_data[i].key = key; cur->interface_data[1+ i].key = 0; } cur->interface_data[i].data = data; done: return stale; } void * lt_dlcaller_get_data (lt_dlinterface_id key, lt_dlhandle handle) { void *result = (void *) 0; lt_dlhandle cur = handle; /* Locate the index of the element with a matching KEY. */ if (cur->interface_data) { int i; for (i = 0; cur->interface_data[i].key; ++i) { if (cur->interface_data[i].key == key) { result = cur->interface_data[i].data; break; } } } return result; } const lt_dlinfo * lt_dlgetinfo (lt_dlhandle handle) { if (!handle) { LT__SETERROR (INVALID_HANDLE); return 0; } return &(handle->info); } lt_dlhandle lt_dlhandle_iterate (lt_dlinterface_id iface, lt_dlhandle place) { lt_dlhandle handle = place; lt__interface_id *iterator = (lt__interface_id *) iface; assert (iface); /* iface is a required argument */ if (!handle) handle = handles; else handle = handle->next; /* advance while the interface check fails */ while (handle && iterator->iface && ((*iterator->iface) (handle, iterator->id_string) != 0)) { handle = handle->next; } return handle; } lt_dlhandle lt_dlhandle_fetch (lt_dlinterface_id iface, const char *module_name) { lt_dlhandle handle = 0; assert (iface); /* iface is a required argument */ while ((handle = lt_dlhandle_iterate (iface, handle))) { lt_dlhandle cur = handle; if (cur && cur->info.name && streq (cur->info.name, module_name)) break; } return handle; } int lt_dlhandle_map (lt_dlinterface_id iface, int (*func) (lt_dlhandle handle, void *data), void *data) { lt__interface_id *iterator = (lt__interface_id *) iface; lt_dlhandle cur = handles; assert (iface); /* iface is a required argument */ while (cur) { int errorcode = 0; /* advance while the interface check fails */ while (cur && iterator->iface && ((*iterator->iface) (cur, iterator->id_string) != 0)) { cur = cur->next; } if ((errorcode = (*func) (cur, data)) != 0) return errorcode; } return 0; } cpl-6.4.1/libltdl/COPYING.LIB0000644000460300003120000006365612310332714012314 00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. ^L Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. ^L GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. ^L Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. ^L 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. ^L 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. ^L 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. ^L 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS ^L How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! cpl-6.4.1/libltdl/ltdl.h0000644000460300003120000001312512310332715011747 00000000000000/* ltdl.h -- generic dlopen functions Copyright (C) 1998-2000, 2004, 2005, 2007, 2008 Free Software Foundation, Inc. Written by Thomas Tanner, 1998 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Only include this header file once. */ #if !defined(LTDL_H) #define LTDL_H 1 #include #include #include LT_BEGIN_C_DECLS /* LT_STRLEN can be used safely on NULL pointers. */ #define LT_STRLEN(s) (((s) && (s)[0]) ? strlen (s) : 0) /* --- DYNAMIC MODULE LOADING API --- */ typedef struct lt__handle *lt_dlhandle; /* A loaded module. */ /* Initialisation and finalisation functions for libltdl. */ LT_SCOPE int lt_dlinit (void); LT_SCOPE int lt_dlexit (void); /* Module search path manipulation. */ LT_SCOPE int lt_dladdsearchdir (const char *search_dir); LT_SCOPE int lt_dlinsertsearchdir (const char *before, const char *search_dir); LT_SCOPE int lt_dlsetsearchpath (const char *search_path); LT_SCOPE const char *lt_dlgetsearchpath (void); LT_SCOPE int lt_dlforeachfile ( const char *search_path, int (*func) (const char *filename, void *data), void *data); /* User module loading advisors. */ LT_SCOPE int lt_dladvise_init (lt_dladvise *advise); LT_SCOPE int lt_dladvise_destroy (lt_dladvise *advise); LT_SCOPE int lt_dladvise_ext (lt_dladvise *advise); LT_SCOPE int lt_dladvise_resident (lt_dladvise *advise); LT_SCOPE int lt_dladvise_local (lt_dladvise *advise); LT_SCOPE int lt_dladvise_global (lt_dladvise *advise); LT_SCOPE int lt_dladvise_preload (lt_dladvise *advise); /* Portable libltdl versions of the system dlopen() API. */ LT_SCOPE lt_dlhandle lt_dlopen (const char *filename); LT_SCOPE lt_dlhandle lt_dlopenext (const char *filename); LT_SCOPE lt_dlhandle lt_dlopenadvise (const char *filename, lt_dladvise advise); LT_SCOPE void * lt_dlsym (lt_dlhandle handle, const char *name); LT_SCOPE const char *lt_dlerror (void); LT_SCOPE int lt_dlclose (lt_dlhandle handle); /* --- PRELOADED MODULE SUPPORT --- */ /* A preopened symbol. Arrays of this type comprise the exported symbols for a dlpreopened module. */ typedef struct { const char *name; void *address; } lt_dlsymlist; typedef int lt_dlpreload_callback_func (lt_dlhandle handle); LT_SCOPE int lt_dlpreload (const lt_dlsymlist *preloaded); LT_SCOPE int lt_dlpreload_default (const lt_dlsymlist *preloaded); LT_SCOPE int lt_dlpreload_open (const char *originator, lt_dlpreload_callback_func *func); #define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols /* Ensure C linkage. */ extern LT_DLSYM_CONST lt_dlsymlist lt__PROGRAM__LTX_preloaded_symbols[]; #define LTDL_SET_PRELOADED_SYMBOLS() \ lt_dlpreload_default(lt_preloaded_symbols) /* --- MODULE INFORMATION --- */ /* Associating user data with loaded modules. */ typedef void * lt_dlinterface_id; typedef int lt_dlhandle_interface (lt_dlhandle handle, const char *id_string); LT_SCOPE lt_dlinterface_id lt_dlinterface_register (const char *id_string, lt_dlhandle_interface *iface); LT_SCOPE void lt_dlinterface_free (lt_dlinterface_id key); LT_SCOPE void * lt_dlcaller_set_data (lt_dlinterface_id key, lt_dlhandle handle, void *data); LT_SCOPE void * lt_dlcaller_get_data (lt_dlinterface_id key, lt_dlhandle handle); /* Read only information pertaining to a loaded module. */ typedef struct { char * filename; /* file name */ char * name; /* module name */ int ref_count; /* number of times lt_dlopened minus number of times lt_dlclosed. */ unsigned int is_resident:1; /* module can't be unloaded. */ unsigned int is_symglobal:1; /* module symbols can satisfy subsequently loaded modules. */ unsigned int is_symlocal:1; /* module symbols are only available locally. */ } lt_dlinfo; LT_SCOPE const lt_dlinfo *lt_dlgetinfo (lt_dlhandle handle); LT_SCOPE lt_dlhandle lt_dlhandle_iterate (lt_dlinterface_id iface, lt_dlhandle place); LT_SCOPE lt_dlhandle lt_dlhandle_fetch (lt_dlinterface_id iface, const char *module_name); LT_SCOPE int lt_dlhandle_map (lt_dlinterface_id iface, int (*func) (lt_dlhandle handle, void *data), void *data); /* Deprecated module residency management API. */ LT_SCOPE int lt_dlmakeresident (lt_dlhandle handle); LT_SCOPE int lt_dlisresident (lt_dlhandle handle); #define lt_ptr void * LT_END_C_DECLS #endif /*!defined(LTDL_H)*/ cpl-6.4.1/libltdl/Makefile.am0000644000460300003120000001210012310332714012662 00000000000000## Makefile.am -- Process this file with automake to produce Makefile.in ## ## Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc. ## Written by Gary V. Vaughan, 2003 ## ## NOTE: The canonical source of this file is maintained with the ## GNU Libtool package. Report bugs to bug-libtool@gnu.org. ## ## GNU Libltdl is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public ## License as published by the Free Software Foundation; either ## version 2 of the License, or (at your option) any later version. ## ## As a special exception to the GNU Lesser General Public License, ## if you distribute this file as part of a program or library that ## is built using GNU libtool, you may include this file under the ## same distribution terms that you use for the rest of that program. ## ## GNU Libltdl 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 Lesser General Public License for more details. ## ## You should have received a copy of the GNU LesserGeneral Public ## License along with GNU Libltdl; see the file COPYING.LIB. If not, a ## copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, ## or obtained by writing to the Free Software Foundation, Inc., ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ##### ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = foreign AM_CPPFLAGS = AM_LDFLAGS = BUILT_SOURCES = include_HEADERS = noinst_LTLIBRARIES = lib_LTLIBRARIES = EXTRA_LTLIBRARIES = EXTRA_DIST = CLEANFILES = MOSTLYCLEANFILES = # -I$(srcdir) is needed for user that built libltdl with a sub-Automake # (not as a sub-package!) using 'nostdinc': AM_CPPFLAGS += -DLT_CONFIG_H='<$(LT_CONFIG_H)>' \ -DLTDL -I. -I$(srcdir) -Ilibltdl \ -I$(srcdir)/libltdl -I$(srcdir)/libltdl AM_LDFLAGS += -no-undefined LTDL_VERSION_INFO = -version-info 10:0:3 noinst_LTLIBRARIES += $(LT_DLLOADERS) if INSTALL_LTDL ltdlincludedir = $(includedir)/libltdl ltdlinclude_HEADERS = libltdl/lt_system.h \ libltdl/lt_error.h \ libltdl/lt_dlloader.h include_HEADERS += ltdl.h lib_LTLIBRARIES += libltdl.la endif if CONVENIENCE_LTDL noinst_LTLIBRARIES += libltdlc.la endif libltdl_la_SOURCES = libltdl/lt__alloc.h \ libltdl/lt__dirent.h \ libltdl/lt__glibc.h \ libltdl/lt__private.h \ libltdl/lt__strl.h \ libltdl/lt_dlloader.h \ libltdl/lt_error.h \ libltdl/lt_system.h \ libltdl/slist.h \ loaders/preopen.c \ lt__alloc.c \ lt_dlloader.c \ lt_error.c \ ltdl.c \ ltdl.h \ slist.c EXTRA_DIST += lt__dirent.c \ lt__strl.c libltdl_la_CPPFLAGS = -DLTDLOPEN=$(LTDLOPEN) $(AM_CPPFLAGS) libltdl_la_LDFLAGS = $(AM_LDFLAGS) $(LTDL_VERSION_INFO) $(LT_DLPREOPEN) libltdl_la_LIBADD = $(LTLIBOBJS) libltdl_la_DEPENDENCIES = $(LT_DLLOADERS) $(LTLIBOBJS) libltdlc_la_SOURCES = $(libltdl_la_SOURCES) libltdlc_la_CPPFLAGS = -DLTDLOPEN=$(LTDLOPEN)c $(AM_CPPFLAGS) libltdlc_la_LDFLAGS = $(AM_LDFLAGS) $(LT_DLPREOPEN) libltdlc_la_LIBADD = $(libltdl_la_LIBADD) libltdlc_la_DEPENDENCIES= $(libltdl_la_DEPENDENCIES) ## The loaders are preopened by libltdl, itself always built from ## pic-objects (either as a shared library, or a convenience library), ## so the loaders themselves must be made from pic-objects too. We ## use convenience libraries for that purpose: EXTRA_LTLIBRARIES += dlopen.la \ dld_link.la \ dyld.la \ load_add_on.la \ loadlibrary.la \ shl_load.la dlopen_la_SOURCES = loaders/dlopen.c dlopen_la_LDFLAGS = -module -avoid-version dlopen_la_LIBADD = $(LIBADD_DLOPEN) dld_link_la_SOURCES = loaders/dld_link.c dld_link_la_LDFLAGS = -module -avoid-version dld_link_la_LIBADD = -ldld dyld_la_SOURCES = loaders/dyld.c dyld_la_LDFLAGS = -module -avoid-version load_add_on_la_SOURCES = loaders/load_add_on.c load_add_on_la_LDFLAGS = -module -avoid-version loadlibrary_la_SOURCES = loaders/loadlibrary.c loadlibrary_la_LDFLAGS = -module -avoid-version shl_load_la_SOURCES = loaders/shl_load.c shl_load_la_LDFLAGS = -module -avoid-version shl_load_la_LIBADD = $(LIBADD_SHL_LOAD) ## Make sure these will be cleaned even when they're not built by default: CLEANFILES += libltdl.la \ libltdlc.la \ libdlloader.la ## Automake-1.9.6 doesn't clean subdir AC_LIBOBJ compiled objects ## automatically: CLEANFILES += $(LIBOBJS) $(LTLIBOBJS) EXTRA_DIST += COPYING.LIB \ configure.ac \ Makefile.am \ aclocal.m4 \ Makefile.in \ configure \ config-h.in \ README ## --------------------------- ## ## Gnulib Makefile.am snippets ## ## --------------------------- ## BUILT_SOURCES += $(ARGZ_H) EXTRA_DIST += argz_.h \ argz.c # We need the following in order to create an when the system # doesn't have one that works with the given compiler. all-local $(lib_OBJECTS): $(ARGZ_H) argz.h: argz_.h $(mkinstalldirs) . cp $(srcdir)/argz_.h $@-t mv $@-t $@ MOSTLYCLEANFILES += argz.h \ argz.h-t cpl-6.4.1/libltdl/slist.c0000644000460300003120000002316412310332715012145 00000000000000/* slist.c -- generalised singly linked lists Copyright (C) 2000, 2004, 2007, 2008, 2009 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2000 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "slist.h" #include #include static SList * slist_sort_merge (SList *left, SList *right, SListCompare *compare, void *userdata); /* Call DELETE repeatedly on each element of HEAD. CAVEAT: If you call this when HEAD is the start of a list of boxed items, you must remember that each item passed back to your DELETE function will be a boxed item that must be slist_unbox()ed before operating on its contents. e.g. void boxed_delete (void *item) { item_free (slist_unbox (item)); } ... slist = slist_delete (slist, boxed_delete); ... */ SList * slist_delete (SList *head, void (*delete_fct) (void *item)) { assert (delete_fct); while (head) { SList *next = head->next; (*delete_fct) (head); head = next; } return 0; } /* Call FIND repeatedly with MATCHDATA and each item of *PHEAD, until FIND returns non-NULL, or the list is exhausted. If a match is found the matching item is destructively removed from *PHEAD, and the value returned by the matching call to FIND is returned. CAVEAT: To avoid memory leaks, unless you already have the address of the stale item, you should probably return that from FIND if it makes a successful match. Don't forget to slist_unbox() every item in a boxed list before operating on its contents. */ SList * slist_remove (SList **phead, SListCallback *find, void *matchdata) { SList *stale = 0; void *result = 0; assert (find); if (!phead || !*phead) return 0; /* Does the head of the passed list match? */ result = (*find) (*phead, matchdata); if (result) { stale = *phead; *phead = stale->next; } /* what about the rest of the elements? */ else { SList *head; for (head = *phead; head->next; head = head->next) { result = (*find) (head->next, matchdata); if (result) { stale = head->next; head->next = stale->next; break; } } } return (SList *) result; } /* Call FIND repeatedly with each element of SLIST and MATCHDATA, until FIND returns non-NULL, or the list is exhausted. If a match is found the value returned by the matching call to FIND is returned. */ void * slist_find (SList *slist, SListCallback *find, void *matchdata) { void *result = 0; assert (find); for (; slist; slist = slist->next) { result = (*find) (slist, matchdata); if (result) break; } return result; } /* Return a single list, composed by destructively concatenating the items in HEAD and TAIL. The values of HEAD and TAIL are undefined after calling this function. CAVEAT: Don't mix boxed and unboxed items in a single list. e.g. slist1 = slist_concat (slist1, slist2); */ SList * slist_concat (SList *head, SList *tail) { SList *last; if (!head) { return tail; } last = head; while (last->next) last = last->next; last->next = tail; return head; } /* Return a single list, composed by destructively appending all of the items in SLIST to ITEM. The values of ITEM and SLIST are undefined after calling this function. CAVEAT: Don't mix boxed and unboxed items in a single list. e.g. slist1 = slist_cons (slist_box (data), slist1); */ SList * slist_cons (SList *item, SList *slist) { if (!item) { return slist; } assert (!item->next); item->next = slist; return item; } /* Return a list starting at the second item of SLIST. */ SList * slist_tail (SList *slist) { return slist ? slist->next : NULL; } /* Return a list starting at the Nth item of SLIST. If SLIST is less than N items long, NULL is returned. Just to be confusing, list items are counted from 1, to get the 2nd element of slist: e.g. shared_list = slist_nth (slist, 2); */ SList * slist_nth (SList *slist, size_t n) { for (;n > 1 && slist; n--) slist = slist->next; return slist; } /* Return the number of items in SLIST. We start counting from 1, so the length of a list with no items is 0, and so on. */ size_t slist_length (SList *slist) { size_t n; for (n = 0; slist; ++n) slist = slist->next; return n; } /* Destructively reverse the order of items in SLIST. The value of SLIST is undefined after calling this function. CAVEAT: You must store the result of this function, or you might not be able to get all the items except the first one back again. e.g. slist = slist_reverse (slist); */ SList * slist_reverse (SList *slist) { SList *result = 0; SList *next; while (slist) { next = slist->next; slist->next = result; result = slist; slist = next; } return result; } /* Call FOREACH once for each item in SLIST, passing both the item and USERDATA on each call. */ void * slist_foreach (SList *slist, SListCallback *foreach, void *userdata) { void *result = 0; assert (foreach); while (slist) { SList *next = slist->next; result = (*foreach) (slist, userdata); if (result) break; slist = next; } return result; } /* Destructively merge the items of two ordered lists LEFT and RIGHT, returning a single sorted list containing the items of both -- Part of the quicksort algorithm. The values of LEFT and RIGHT are undefined after calling this function. At each iteration, add another item to the merged list by taking the lowest valued item from the head of either LEFT or RIGHT, determined by passing those items and USERDATA to COMPARE. COMPARE should return less than 0 if the head of LEFT has the lower value, greater than 0 if the head of RIGHT has the lower value, otherwise 0. */ static SList * slist_sort_merge (SList *left, SList *right, SListCompare *compare, void *userdata) { SList merged, *insert; insert = &merged; while (left && right) { if ((*compare) (left, right, userdata) <= 0) { insert = insert->next = left; left = left->next; } else { insert = insert->next = right; right = right->next; } } insert->next = left ? left : right; return merged.next; } /* Perform a destructive quicksort on the items in SLIST, by repeatedly calling COMPARE with a pair of items from SLIST along with USERDATA at every iteration. COMPARE is a function as defined above for slist_sort_merge(). The value of SLIST is undefined after calling this function. e.g. slist = slist_sort (slist, compare, 0); */ SList * slist_sort (SList *slist, SListCompare *compare, void *userdata) { SList *left, *right; if (!slist) return slist; /* Be sure that LEFT and RIGHT never contain the same item. */ left = slist; right = slist->next; if (!right) return left; /* Skip two items with RIGHT and one with SLIST, until RIGHT falls off the end. SLIST must be about half way along. */ while (right && (right = right->next)) { if (!right || !(right = right->next)) break; slist = slist->next; } right = slist->next; slist->next = 0; /* Sort LEFT and RIGHT, then merge the two. */ return slist_sort_merge (slist_sort (left, compare, userdata), slist_sort (right, compare, userdata), compare, userdata); } /* Aside from using the functions above to manage chained structures of any type that has a NEXT pointer as its first field, SLISTs can be comprised of boxed items. The boxes are chained together in that case, so there is no need for a NEXT field in the item proper. Some care must be taken to slist_box and slist_unbox each item in a boxed list at the appropriate points to avoid leaking the memory used for the boxes. It us usually a very bad idea to mix boxed and non-boxed items in a single list. */ /* Return a `boxed' freshly mallocated 1 element list containing USERDATA. */ SList * slist_box (const void *userdata) { SList *item = (SList *) malloc (sizeof *item); if (item) { item->next = 0; item->userdata = userdata; } return item; } /* Return the contents of a `boxed' ITEM, recycling the box itself. */ void * slist_unbox (SList *item) { void *userdata = 0; if (item) { /* Strip the const, because responsibility for this memory passes to the caller on return. */ userdata = (void *) item->userdata; free (item); } return userdata; } cpl-6.4.1/libltdl/config/0000755000460300003120000000000012310333010012147 500000000000000cpl-6.4.1/libltdl/config/compile0000755000460300003120000001533012310332713013460 00000000000000#! /bin/sh # Wrapper for compilers which do not understand `-c -o'. scriptversion=2010-11-15.09; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010 Free Software # Foundation, Inc. # Written by Tom Tromey . # # 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 2, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Win32 hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as `compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l*) lib=${1#-l} found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes set x "$@" "$dir/$lib.dll.lib" break fi if test -f "$dir/$lib.lib"; then found=yes set x "$@" "$dir/$lib.lib" break fi done IFS=$save_IFS test "$found" != yes && set x "$@" "$lib.lib" shift ;; -L*) func_file_conv "${1#-L}" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand `-c -o'. Remove `-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as `compile cc -o foo foo.c'. # So we strip `-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no `-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use `[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/libltdl/config/ltmain.sh0000644000460300003120000105152212310332713013726 00000000000000 # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.2 TIMESTAMP="" package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 cpl-6.4.1/libltdl/config/depcomp0000755000460300003120000004426712310332713013472 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2009-04-28.21; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free # Software Foundation, Inc. # 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 2, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u="sed s,\\\\\\\\,/,g" depmode=msvisualcpp fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/libltdl/config/config.guess0000755000460300003120000012675512310332713014440 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011 Free Software Foundation, Inc. timestamp='2011-10-01' # This file 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 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. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo hexagon-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cpl-6.4.1/libltdl/config/config.sub0000755000460300003120000010505212310332713014066 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011 Free Software Foundation, Inc. timestamp='2011-10-08' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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 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. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cpl-6.4.1/libltdl/config/install-sh0000755000460300003120000003325612310332713014115 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/libltdl/config/missing0000755000460300003120000002623312310332713013505 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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 2, 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cpl-6.4.1/libltdl/lt_error.c0000644000460300003120000000562112310332715012635 00000000000000/* lt_error.c -- error propogation interface Copyright (C) 1999, 2000, 2001, 2004, 2005, 2007 Free Software Foundation, Inc. Written by Thomas Tanner, 1999 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lt__private.h" #include "lt_error.h" static const char *last_error = 0; static const char error_strings[LT_ERROR_MAX][LT_ERROR_LEN_MAX + 1] = { #define LT_ERROR(name, diagnostic) diagnostic, lt_dlerror_table #undef LT_ERROR }; static const char **user_error_strings = 0; static int errorcount = LT_ERROR_MAX; int lt_dladderror (const char *diagnostic) { int errindex = 0; int result = -1; const char **temp = (const char **) 0; assert (diagnostic); errindex = errorcount - LT_ERROR_MAX; temp = REALLOC (const char *, user_error_strings, 1 + errindex); if (temp) { user_error_strings = temp; user_error_strings[errindex] = diagnostic; result = errorcount++; } return result; } int lt_dlseterror (int errindex) { int errors = 0; if (errindex >= errorcount || errindex < 0) { /* Ack! Error setting the error message! */ LT__SETERROR (INVALID_ERRORCODE); ++errors; } else if (errindex < LT_ERROR_MAX) { /* No error setting the error message! */ LT__SETERRORSTR (error_strings[errindex]); } else { /* No error setting the error message! */ LT__SETERRORSTR (user_error_strings[errindex - LT_ERROR_MAX]); } return errors; } const char * lt__error_string (int errorcode) { assert (errorcode >= 0); assert (errorcode < LT_ERROR_MAX); return error_strings[errorcode]; } const char * lt__get_last_error (void) { return last_error; } const char * lt__set_last_error (const char *errormsg) { return last_error = errormsg; } cpl-6.4.1/libltdl/configure0000755000460300003120000153056512310332714012562 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for libltdl 2.4.2. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: bug-libtool@gnu.org about your system, including any $0: error possibly output before this message. Then install $0: a modern shell, or manually run the script under such a $0: shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libltdl' PACKAGE_TARNAME='libltdl' PACKAGE_VERSION='2.4.2' PACKAGE_STRING='libltdl 2.4.2' PACKAGE_BUGREPORT='bug-libtool@gnu.org' PACKAGE_URL='' ac_unique_file="ltdl.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LTDLOPEN LT_CONFIG_H CONVENIENCE_LTDL_FALSE CONVENIENCE_LTDL_TRUE INSTALL_LTDL_FALSE INSTALL_LTDL_TRUE ARGZ_H LIBOBJS sys_symbol_underscore LIBADD_DL LT_DLPREOPEN LIBADD_DLD_LINK LIBADD_SHL_LOAD LIBADD_DLOPEN LT_DLLOADERS CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL OBJDUMP DLLTOOL AS am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_shared enable_static with_pic enable_fast_install enable_dependency_tracking with_gnu_ld with_sysroot enable_libtool_lock enable_ltdl_install ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures libltdl 2.4.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/libltdl] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of libltdl 2.4.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-libtool-lock avoid locking (might break parallel builds) --enable-ltdl-install install libltdl Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF libltdl configure 2.4.2 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by libltdl $as_me 2.4.2, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h:config-h.in" ac_aux_dir= for ac_dir in config "$srcdir"/config; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # I am me! ## ------------------------ ## ## Automake Initialisation. ## ## ------------------------ ## am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='libltdl' VERSION='2.4.2' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ## ------------------------------- ## ## Libtool specific configuration. ## ## ------------------------------- ## pkgdatadir='${datadir}'"/${PACKAGE}" ## ----------------------- ## ## Libtool initialisation. ## ## ----------------------- ## case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=yes enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AS="${ac_tool_prefix}as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 $as_echo "$AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AS="as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 $as_echo "$ac_ct_AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AS" = x; then AS="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS fi else AS="$ac_cv_prog_AS" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi ;; esac test -z "$AS" && AS=as test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: { $as_echo "$as_me:${as_lineno-$LINENO}: checking which extension is used for runtime loadable modules" >&5 $as_echo_n "checking which extension is used for runtime loadable modules... " >&6; } if ${libltdl_cv_shlibext+:} false; then : $as_echo_n "(cached) " >&6 else module=yes eval libltdl_cv_shlibext=$shrext_cmds module=no eval libltdl_cv_shrext=$shrext_cmds fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libltdl_cv_shlibext" >&5 $as_echo "$libltdl_cv_shlibext" >&6; } if test -n "$libltdl_cv_shlibext"; then cat >>confdefs.h <<_ACEOF #define LT_MODULE_EXT "$libltdl_cv_shlibext" _ACEOF fi if test "$libltdl_cv_shrext" != "$libltdl_cv_shlibext"; then cat >>confdefs.h <<_ACEOF #define LT_SHARED_EXT "$libltdl_cv_shrext" _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variable specifies run-time module search path" >&5 $as_echo_n "checking which variable specifies run-time module search path... " >&6; } if ${lt_cv_module_path_var+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_module_path_var="$shlibpath_var" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_module_path_var" >&5 $as_echo "$lt_cv_module_path_var" >&6; } if test -n "$lt_cv_module_path_var"; then cat >>confdefs.h <<_ACEOF #define LT_MODULE_PATH_VAR "$lt_cv_module_path_var" _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the default library search path" >&5 $as_echo_n "checking for the default library search path... " >&6; } if ${lt_cv_sys_dlsearch_path+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sys_dlsearch_path="$sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_dlsearch_path" >&5 $as_echo "$lt_cv_sys_dlsearch_path" >&6; } if test -n "$lt_cv_sys_dlsearch_path"; then sys_dlsearch_path= for dir in $lt_cv_sys_dlsearch_path; do if test -z "$sys_dlsearch_path"; then sys_dlsearch_path="$dir" else sys_dlsearch_path="$sys_dlsearch_path$PATH_SEPARATOR$dir" fi done cat >>confdefs.h <<_ACEOF #define LT_DLSEARCH_PATH "$sys_dlsearch_path" _ACEOF fi LT_DLLOADERS= ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu LIBADD_DLOPEN= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 $as_echo_n "checking for library containing dlopen... " >&6; } if ${ac_cv_search_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF for ac_lib in '' dl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_dlopen=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_dlopen+:} false; then : break fi done if ${ac_cv_search_dlopen+:} false; then : else ac_cv_search_dlopen=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 $as_echo "$ac_cv_search_dlopen" >&6; } ac_res=$ac_cv_search_dlopen if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_LIBDL 1" >>confdefs.h if test "$ac_cv_search_dlopen" != "none required" ; then LIBADD_DLOPEN="-ldl" fi libltdl_cv_lib_dl_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if HAVE_DLFCN_H # include #endif int main () { dlopen(0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_LIBDL 1" >>confdefs.h libltdl_cv_func_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : $as_echo "#define HAVE_LIBDL 1" >>confdefs.h LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la" fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes then lt_save_LIBS="$LIBS" LIBS="$LIBS $LIBADD_DLOPEN" for ac_func in dlerror do : ac_fn_c_check_func "$LINENO" "dlerror" "ac_cv_func_dlerror" if test "x$ac_cv_func_dlerror" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLERROR 1 _ACEOF fi done LIBS="$lt_save_LIBS" fi LIBADD_SHL_LOAD= ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : $as_echo "#define HAVE_SHL_LOAD 1" >>confdefs.h LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : $as_echo "#define HAVE_SHL_LOAD 1" >>confdefs.h LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" LIBADD_SHL_LOAD="-ldld" fi fi case $host_os in darwin[1567].*) # We only want this for pre-Mac OS X 10.4. ac_fn_c_check_func "$LINENO" "_dyld_func_lookup" "ac_cv_func__dyld_func_lookup" if test "x$ac_cv_func__dyld_func_lookup" = xyes; then : $as_echo "#define HAVE_DYLD 1" >>confdefs.h LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la" fi ;; beos*) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" ;; cygwin* | mingw* | os2* | pw32*) ac_fn_c_check_decl "$LINENO" "cygwin_conv_path" "ac_cv_have_decl_cygwin_conv_path" "#include " if test "x$ac_cv_have_decl_cygwin_conv_path" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_CYGWIN_CONV_PATH $ac_have_decl _ACEOF LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : $as_echo "#define HAVE_DLD 1" >>confdefs.h LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la" fi LT_DLPREOPEN= if test -n "$LT_DLLOADERS" then for lt_loader in $LT_DLLOADERS; do LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " done $as_echo "#define HAVE_LIBDLLOADER 1" >>confdefs.h fi LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _ prefix in compiled symbols" >&5 $as_echo_n "checking for _ prefix in compiled symbols... " >&6; } if ${lt_cv_sys_symbol_underscore+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sys_symbol_underscore=no cat > conftest.$ac_ext <<_LT_EOF void nm_test_func(){} int main(){nm_test_func;return 0;} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. ac_nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist\""; } >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$ac_nlist"; then # See whether the symbols have a leading underscore. if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then lt_cv_sys_symbol_underscore=yes else if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then : else echo "configure: cannot find nm_test_func in $ac_nlist" >&5 fi fi else echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "configure: failed program was:" >&5 cat conftest.c >&5 fi rm -rf conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_symbol_underscore" >&5 $as_echo "$lt_cv_sys_symbol_underscore" >&6; } sys_symbol_underscore=$lt_cv_sys_symbol_underscore if test x"$lt_cv_sys_symbol_underscore" = xyes; then if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have to add an underscore for dlsym" >&5 $as_echo_n "checking whether we have to add an underscore for dlsym... " >&6; } if ${libltdl_cv_need_uscore+:} false; then : $as_echo_n "(cached) " >&6 else libltdl_cv_need_uscore=unknown save_LIBS="$LIBS" LIBS="$LIBS $LIBADD_DLOPEN" if test "$cross_compiling" = yes; then : libltdl_cv_need_uscore=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) libltdl_cv_need_uscore=no ;; x$lt_dlneed_uscore) libltdl_cv_need_uscore=yes ;; x$lt_dlunknown|x*) ;; esac else : # compilation failed fi fi rm -fr conftest* LIBS="$save_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libltdl_cv_need_uscore" >&5 $as_echo "$libltdl_cv_need_uscore" >&6; } fi fi if test x"$libltdl_cv_need_uscore" = xyes; then $as_echo "#define NEED_USCORE 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether deplibs are loaded by dlopen" >&5 $as_echo_n "checking whether deplibs are loaded by dlopen... " >&6; } if ${lt_cv_sys_dlopen_deplibs+:} false; then : $as_echo_n "(cached) " >&6 else # PORTME does your system automatically load deplibs for dlopen? # or its logical equivalent (e.g. shl_load for HP-UX < 11) # For now, we just catch OSes we know something about -- in the # future, we'll try test this programmatically. lt_cv_sys_dlopen_deplibs=unknown case $host_os in aix3*|aix4.1.*|aix4.2.*) # Unknown whether this is true for these versions of AIX, but # we want this `case' here to explicitly catch those versions. lt_cv_sys_dlopen_deplibs=unknown ;; aix[4-9]*) lt_cv_sys_dlopen_deplibs=yes ;; amigaos*) case $host_cpu in powerpc) lt_cv_sys_dlopen_deplibs=no ;; esac ;; darwin*) # Assuming the user has installed a libdl from somewhere, this is true # If you are looking for one http://www.opendarwin.org/projects/dlcompat lt_cv_sys_dlopen_deplibs=yes ;; freebsd* | dragonfly*) lt_cv_sys_dlopen_deplibs=yes ;; gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) # GNU and its variants, using gnu ld.so (Glibc) lt_cv_sys_dlopen_deplibs=yes ;; hpux10*|hpux11*) lt_cv_sys_dlopen_deplibs=yes ;; interix*) lt_cv_sys_dlopen_deplibs=yes ;; irix[12345]*|irix6.[01]*) # Catch all versions of IRIX before 6.2, and indicate that we don't # know how it worked for any of those versions. lt_cv_sys_dlopen_deplibs=unknown ;; irix*) # The case above catches anything before 6.2, and it's known that # at 6.2 and later dlopen does load deplibs. lt_cv_sys_dlopen_deplibs=yes ;; netbsd*) lt_cv_sys_dlopen_deplibs=yes ;; openbsd*) lt_cv_sys_dlopen_deplibs=yes ;; osf[1234]*) # dlopen did load deplibs (at least at 4.x), but until the 5.x series, # it did *not* use an RPATH in a shared library to find objects the # library depends on, so we explicitly say `no'. lt_cv_sys_dlopen_deplibs=no ;; osf5.0|osf5.0a|osf5.1) # dlopen *does* load deplibs and with the right loader patch applied # it even uses RPATH in a shared library to search for shared objects # that the library depends on, but there's no easy way to know if that # patch is installed. Since this is the case, all we can really # say is unknown -- it depends on the patch being installed. If # it is, this changes to `yes'. Without it, it would be `no'. lt_cv_sys_dlopen_deplibs=unknown ;; osf*) # the two cases above should catch all versions of osf <= 5.1. Read # the comments above for what we know about them. # At > 5.1, deplibs are loaded *and* any RPATH in a shared library # is used to find them so we can finally say `yes'. lt_cv_sys_dlopen_deplibs=yes ;; qnx*) lt_cv_sys_dlopen_deplibs=yes ;; solaris*) lt_cv_sys_dlopen_deplibs=yes ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) libltdl_cv_sys_dlopen_deplibs=yes ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_dlopen_deplibs" >&5 $as_echo "$lt_cv_sys_dlopen_deplibs" >&6; } if test "$lt_cv_sys_dlopen_deplibs" != yes; then $as_echo "#define LTDL_DLOPEN_DEPLIBS 1" >>confdefs.h fi : for ac_header in argz.h do : ac_fn_c_check_header_compile "$LINENO" "argz.h" "ac_cv_header_argz_h" "$ac_includes_default " if test "x$ac_cv_header_argz_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ARGZ_H 1 _ACEOF fi done ac_fn_c_check_type "$LINENO" "error_t" "ac_cv_type_error_t" "#if defined(HAVE_ARGZ_H) # include #endif " if test "x$ac_cv_type_error_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ERROR_T 1 _ACEOF else $as_echo "#define error_t int" >>confdefs.h $as_echo "#define __error_t_defined 1" >>confdefs.h fi ARGZ_H= for ac_func in argz_add argz_append argz_count argz_create_sep argz_insert \ argz_next argz_stringify do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else ARGZ_H=argz.h; case " $LIBOBJS " in *" argz.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS argz.$ac_objext" ;; esac fi done if test -z "$ARGZ_H"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking if argz actually works" >&5 $as_echo_n "checking if argz actually works... " >&6; } if ${lt_cv_sys_argz_works+:} false; then : $as_echo_n "(cached) " >&6 else case $host_os in #( *cygwin*) lt_cv_sys_argz_works=no if test "$cross_compiling" != no; then lt_cv_sys_argz_works="guessing no" else lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/' save_IFS=$IFS IFS=-. set x `uname -r | sed -e "$lt_sed_extract_leading_digits"` IFS=$save_IFS lt_os_major=${2-0} lt_os_minor=${3-0} lt_os_micro=${4-0} if test "$lt_os_major" -gt 1 \ || { test "$lt_os_major" -eq 1 \ && { test "$lt_os_minor" -gt 5 \ || { test "$lt_os_minor" -eq 5 \ && test "$lt_os_micro" -gt 24; }; }; }; then lt_cv_sys_argz_works=yes fi fi ;; #( *) lt_cv_sys_argz_works=yes ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_argz_works" >&5 $as_echo "$lt_cv_sys_argz_works" >&6; } if test "$lt_cv_sys_argz_works" = yes; then : $as_echo "#define HAVE_WORKING_ARGZ 1" >>confdefs.h else ARGZ_H=argz.h case " $LIBOBJS " in *" argz.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS argz.$ac_objext" ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libtool supports -dlopen/-dlpreopen" >&5 $as_echo_n "checking whether libtool supports -dlopen/-dlpreopen... " >&6; } if ${libltdl_cv_preloaded_symbols+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$lt_cv_sys_global_symbol_pipe"; then libltdl_cv_preloaded_symbols=yes else libltdl_cv_preloaded_symbols=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libltdl_cv_preloaded_symbols" >&5 $as_echo "$libltdl_cv_preloaded_symbols" >&6; } if test x"$libltdl_cv_preloaded_symbols" = xyes; then $as_echo "#define HAVE_PRELOADED_SYMBOLS 1" >>confdefs.h fi # Check whether --enable-ltdl-install was given. if test "${enable_ltdl_install+set}" = set; then : enableval=$enable_ltdl_install; fi case ,${enable_ltdl_install},${enable_ltdl_convenience} in *yes*) ;; *) enable_ltdl_convenience=yes ;; esac if test x"${enable_ltdl_install-no}" != xno; then INSTALL_LTDL_TRUE= INSTALL_LTDL_FALSE='#' else INSTALL_LTDL_TRUE='#' INSTALL_LTDL_FALSE= fi if test x"${enable_ltdl_convenience-no}" != xno; then CONVENIENCE_LTDL_TRUE= CONVENIENCE_LTDL_FALSE='#' else CONVENIENCE_LTDL_TRUE='#' CONVENIENCE_LTDL_FALSE= fi # In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS # the user used. This is so that ltdl.h can pick up the parent projects # config.h file, The first file in AC_CONFIG_HEADERS must contain the # definitions required by ltdl.c. # FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). for ac_header in unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in closedir opendir readdir do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else case " $LIBOBJS " in *" lt__dirent.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lt__dirent.$ac_objext" ;; esac fi done for ac_func in strlcat strlcpy do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else case " $LIBOBJS " in *" lt__strl.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lt__strl.$ac_objext" ;; esac fi done cat >>confdefs.h <<_ACEOF #define LT_LIBEXT "$libext" _ACEOF name= eval "lt_libprefix=\"$libname_spec\"" cat >>confdefs.h <<_ACEOF #define LT_LIBPREFIX "$lt_libprefix" _ACEOF name=ltdl eval "LTDLOPEN=\"$libname_spec\"" ## -------- ## ## Outputs. ## ## -------- ## ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INSTALL_LTDL_TRUE}" && test -z "${INSTALL_LTDL_FALSE}"; then as_fn_error $? "conditional \"INSTALL_LTDL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${CONVENIENCE_LTDL_TRUE}" && test -z "${CONVENIENCE_LTDL_FALSE}"; then as_fn_error $? "conditional \"CONVENIENCE_LTDL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi LT_CONFIG_H=config.h : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by libltdl $as_me 2.4.2, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ libltdl config.status 2.4.2 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in AS \ DLLTOOL \ OBJDUMP \ SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config-h.in" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Assembler program. AS=$lt_AS # DLL creation program. DLLTOOL=$lt_DLLTOOL # Object dumper program. OBJDUMP=$lt_OBJDUMP # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cpl-6.4.1/libltdl/configure.ac0000644000460300003120000000501012310332714013116 00000000000000# Process this file with autoconf to create configure. -*- autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # NOTE: The canonical source of this file is maintained with the # GNU Libtool package. Report bugs to bug-libtool@gnu.org. # # GNU Libltdl is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # As a special exception to the GNU Lesser General Public License, # if you distribute this file as part of a program or library that # is built using GNU libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libltdl 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 Lesser General Public License for more details. # # You should have received a copy of the GNU LesserGeneral Public # License along with GNU Libltdl; see the file COPYING.LIB. If not, a # copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #### # This configure.ac is not used at all by the libtool bootstrap, but # is copied to the ltdl subdirectory if you libtoolize --ltdl your own # project. Adding LT_WITH_LTDL to your project configure.ac will then # configure this directory if your user doesn't want to use the installed # libltdl. AC_PREREQ(2.59)dnl We use AS_HELP_STRING ## ------------------------ ## ## Autoconf initialisation. ## ## ------------------------ ## AC_INIT([libltdl], [2.4.2], [bug-libtool@gnu.org]) AC_CONFIG_HEADERS([config.h:config-h.in]) AC_CONFIG_SRCDIR([ltdl.c]) AC_CONFIG_AUX_DIR([config]) AC_CONFIG_MACRO_DIR([m4]) LT_CONFIG_LTDL_DIR([.]) # I am me! ## ------------------------ ## ## Automake Initialisation. ## ## ------------------------ ## AM_INIT_AUTOMAKE([gnu]) ## ------------------------------- ## ## Libtool specific configuration. ## ## ------------------------------- ## pkgdatadir='${datadir}'"/${PACKAGE}" ## ----------------------- ## ## Libtool initialisation. ## ## ----------------------- ## LT_INIT([dlopen win32-dll]) _LTDL_SETUP ## -------- ## ## Outputs. ## ## -------- ## AC_CONFIG_FILES([Makefile]) AC_OUTPUT cpl-6.4.1/libltdl/aclocal.m40000644000460300003120000010377112310332714012505 00000000000000# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, [m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/argz.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltdl.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) cpl-6.4.1/libltdl/Makefile.in0000644000460300003120000014314512310332714012711 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ ##### VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @INSTALL_LTDL_TRUE@am__append_1 = ltdl.h @INSTALL_LTDL_TRUE@am__append_2 = libltdl.la @CONVENIENCE_LTDL_TRUE@am__append_3 = libltdlc.la subdir = . DIST_COMMON = README $(am__configure_deps) $(am__include_HEADERS_DIST) \ $(am__ltdlinclude_HEADERS_DIST) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config-h.in \ $(top_srcdir)/configure COPYING.LIB argz.c config/compile \ config/config.guess config/config.sub config/depcomp \ config/install-sh config/ltmain.sh \ config/missing lt__dirent.c lt__strl.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" \ "$(DESTDIR)$(ltdlincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) dld_link_la_DEPENDENCIES = am_dld_link_la_OBJECTS = dld_link.lo dld_link_la_OBJECTS = $(am_dld_link_la_OBJECTS) dld_link_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(dld_link_la_LDFLAGS) $(LDFLAGS) -o $@ am__DEPENDENCIES_1 = dlopen_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_dlopen_la_OBJECTS = dlopen.lo dlopen_la_OBJECTS = $(am_dlopen_la_OBJECTS) dlopen_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(dlopen_la_LDFLAGS) $(LDFLAGS) -o $@ dyld_la_LIBADD = am_dyld_la_OBJECTS = dyld.lo dyld_la_OBJECTS = $(am_dyld_la_OBJECTS) dyld_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(dyld_la_LDFLAGS) \ $(LDFLAGS) -o $@ am_libltdl_la_OBJECTS = libltdl_la-preopen.lo libltdl_la-lt__alloc.lo \ libltdl_la-lt_dlloader.lo libltdl_la-lt_error.lo \ libltdl_la-ltdl.lo libltdl_la-slist.lo libltdl_la_OBJECTS = $(am_libltdl_la_OBJECTS) libltdl_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libltdl_la_LDFLAGS) $(LDFLAGS) -o $@ @INSTALL_LTDL_TRUE@am_libltdl_la_rpath = -rpath $(libdir) am__objects_1 = libltdlc_la-preopen.lo libltdlc_la-lt__alloc.lo \ libltdlc_la-lt_dlloader.lo libltdlc_la-lt_error.lo \ libltdlc_la-ltdl.lo libltdlc_la-slist.lo am_libltdlc_la_OBJECTS = $(am__objects_1) libltdlc_la_OBJECTS = $(am_libltdlc_la_OBJECTS) libltdlc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libltdlc_la_LDFLAGS) $(LDFLAGS) -o $@ @CONVENIENCE_LTDL_TRUE@am_libltdlc_la_rpath = load_add_on_la_LIBADD = am_load_add_on_la_OBJECTS = load_add_on.lo load_add_on_la_OBJECTS = $(am_load_add_on_la_OBJECTS) load_add_on_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(load_add_on_la_LDFLAGS) $(LDFLAGS) -o $@ loadlibrary_la_LIBADD = am_loadlibrary_la_OBJECTS = loadlibrary.lo loadlibrary_la_OBJECTS = $(am_loadlibrary_la_OBJECTS) loadlibrary_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(loadlibrary_la_LDFLAGS) $(LDFLAGS) -o $@ shl_load_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_shl_load_la_OBJECTS = shl_load.lo shl_load_la_OBJECTS = $(am_shl_load_la_OBJECTS) shl_load_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(shl_load_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(dld_link_la_SOURCES) $(dlopen_la_SOURCES) \ $(dyld_la_SOURCES) $(libltdl_la_SOURCES) \ $(libltdlc_la_SOURCES) $(load_add_on_la_SOURCES) \ $(loadlibrary_la_SOURCES) $(shl_load_la_SOURCES) DIST_SOURCES = $(dld_link_la_SOURCES) $(dlopen_la_SOURCES) \ $(dyld_la_SOURCES) $(libltdl_la_SOURCES) \ $(libltdlc_la_SOURCES) $(load_add_on_la_SOURCES) \ $(loadlibrary_la_SOURCES) $(shl_load_la_SOURCES) am__include_HEADERS_DIST = ltdl.h am__ltdlinclude_HEADERS_DIST = libltdl/lt_system.h libltdl/lt_error.h \ libltdl/lt_dlloader.h HEADERS = $(include_HEADERS) $(ltdlinclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ARGZ_H = @ARGZ_H@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTDLOPEN = @LTDLOPEN@ LTLIBOBJS = @LTLIBOBJS@ LT_CONFIG_H = @LT_CONFIG_H@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = foreign # -I$(srcdir) is needed for user that built libltdl with a sub-Automake # (not as a sub-package!) using 'nostdinc': AM_CPPFLAGS = -DLT_CONFIG_H='<$(LT_CONFIG_H)>' -DLTDL -I. -I$(srcdir) \ -Ilibltdl -I$(srcdir)/libltdl -I$(srcdir)/libltdl AM_LDFLAGS = -no-undefined BUILT_SOURCES = $(ARGZ_H) include_HEADERS = $(am__append_1) noinst_LTLIBRARIES = $(LT_DLLOADERS) $(am__append_3) lib_LTLIBRARIES = $(am__append_2) EXTRA_LTLIBRARIES = dlopen.la dld_link.la dyld.la load_add_on.la \ loadlibrary.la shl_load.la EXTRA_DIST = lt__dirent.c lt__strl.c COPYING.LIB configure.ac \ Makefile.am aclocal.m4 Makefile.in configure config-h.in \ README argz_.h argz.c CLEANFILES = libltdl.la libltdlc.la libdlloader.la $(LIBOBJS) \ $(LTLIBOBJS) MOSTLYCLEANFILES = argz.h argz.h-t LTDL_VERSION_INFO = -version-info 10:0:3 @INSTALL_LTDL_TRUE@ltdlincludedir = $(includedir)/libltdl @INSTALL_LTDL_TRUE@ltdlinclude_HEADERS = libltdl/lt_system.h \ @INSTALL_LTDL_TRUE@ libltdl/lt_error.h \ @INSTALL_LTDL_TRUE@ libltdl/lt_dlloader.h libltdl_la_SOURCES = libltdl/lt__alloc.h \ libltdl/lt__dirent.h \ libltdl/lt__glibc.h \ libltdl/lt__private.h \ libltdl/lt__strl.h \ libltdl/lt_dlloader.h \ libltdl/lt_error.h \ libltdl/lt_system.h \ libltdl/slist.h \ loaders/preopen.c \ lt__alloc.c \ lt_dlloader.c \ lt_error.c \ ltdl.c \ ltdl.h \ slist.c libltdl_la_CPPFLAGS = -DLTDLOPEN=$(LTDLOPEN) $(AM_CPPFLAGS) libltdl_la_LDFLAGS = $(AM_LDFLAGS) $(LTDL_VERSION_INFO) $(LT_DLPREOPEN) libltdl_la_LIBADD = $(LTLIBOBJS) libltdl_la_DEPENDENCIES = $(LT_DLLOADERS) $(LTLIBOBJS) libltdlc_la_SOURCES = $(libltdl_la_SOURCES) libltdlc_la_CPPFLAGS = -DLTDLOPEN=$(LTDLOPEN)c $(AM_CPPFLAGS) libltdlc_la_LDFLAGS = $(AM_LDFLAGS) $(LT_DLPREOPEN) libltdlc_la_LIBADD = $(libltdl_la_LIBADD) libltdlc_la_DEPENDENCIES = $(libltdl_la_DEPENDENCIES) dlopen_la_SOURCES = loaders/dlopen.c dlopen_la_LDFLAGS = -module -avoid-version dlopen_la_LIBADD = $(LIBADD_DLOPEN) dld_link_la_SOURCES = loaders/dld_link.c dld_link_la_LDFLAGS = -module -avoid-version dld_link_la_LIBADD = -ldld dyld_la_SOURCES = loaders/dyld.c dyld_la_LDFLAGS = -module -avoid-version load_add_on_la_SOURCES = loaders/load_add_on.c load_add_on_la_LDFLAGS = -module -avoid-version loadlibrary_la_SOURCES = loaders/loadlibrary.c loadlibrary_la_LDFLAGS = -module -avoid-version shl_load_la_SOURCES = loaders/shl_load.c shl_load_la_LDFLAGS = -module -avoid-version shl_load_la_LIBADD = $(LIBADD_SHL_LOAD) all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config-h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config-h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done dld_link.la: $(dld_link_la_OBJECTS) $(dld_link_la_DEPENDENCIES) $(dld_link_la_LINK) $(dld_link_la_OBJECTS) $(dld_link_la_LIBADD) $(LIBS) dlopen.la: $(dlopen_la_OBJECTS) $(dlopen_la_DEPENDENCIES) $(dlopen_la_LINK) $(dlopen_la_OBJECTS) $(dlopen_la_LIBADD) $(LIBS) dyld.la: $(dyld_la_OBJECTS) $(dyld_la_DEPENDENCIES) $(dyld_la_LINK) $(dyld_la_OBJECTS) $(dyld_la_LIBADD) $(LIBS) libltdl.la: $(libltdl_la_OBJECTS) $(libltdl_la_DEPENDENCIES) $(libltdl_la_LINK) $(am_libltdl_la_rpath) $(libltdl_la_OBJECTS) $(libltdl_la_LIBADD) $(LIBS) libltdlc.la: $(libltdlc_la_OBJECTS) $(libltdlc_la_DEPENDENCIES) $(libltdlc_la_LINK) $(am_libltdlc_la_rpath) $(libltdlc_la_OBJECTS) $(libltdlc_la_LIBADD) $(LIBS) load_add_on.la: $(load_add_on_la_OBJECTS) $(load_add_on_la_DEPENDENCIES) $(load_add_on_la_LINK) $(load_add_on_la_OBJECTS) $(load_add_on_la_LIBADD) $(LIBS) loadlibrary.la: $(loadlibrary_la_OBJECTS) $(loadlibrary_la_DEPENDENCIES) $(loadlibrary_la_LINK) $(loadlibrary_la_OBJECTS) $(loadlibrary_la_LIBADD) $(LIBS) shl_load.la: $(shl_load_la_OBJECTS) $(shl_load_la_DEPENDENCIES) $(shl_load_la_LINK) $(shl_load_la_OBJECTS) $(shl_load_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/argz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lt__dirent.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lt__strl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dld_link.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlopen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dyld.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libltdl_la-lt__alloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libltdl_la-lt_dlloader.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libltdl_la-lt_error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libltdl_la-ltdl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libltdl_la-preopen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libltdl_la-slist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libltdlc_la-lt__alloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libltdlc_la-lt_dlloader.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libltdlc_la-lt_error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libltdlc_la-ltdl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libltdlc_la-preopen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libltdlc_la-slist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_add_on.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadlibrary.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shl_load.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< dld_link.lo: loaders/dld_link.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dld_link.lo -MD -MP -MF $(DEPDIR)/dld_link.Tpo -c -o dld_link.lo `test -f 'loaders/dld_link.c' || echo '$(srcdir)/'`loaders/dld_link.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/dld_link.Tpo $(DEPDIR)/dld_link.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loaders/dld_link.c' object='dld_link.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dld_link.lo `test -f 'loaders/dld_link.c' || echo '$(srcdir)/'`loaders/dld_link.c dlopen.lo: loaders/dlopen.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dlopen.lo -MD -MP -MF $(DEPDIR)/dlopen.Tpo -c -o dlopen.lo `test -f 'loaders/dlopen.c' || echo '$(srcdir)/'`loaders/dlopen.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/dlopen.Tpo $(DEPDIR)/dlopen.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loaders/dlopen.c' object='dlopen.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dlopen.lo `test -f 'loaders/dlopen.c' || echo '$(srcdir)/'`loaders/dlopen.c dyld.lo: loaders/dyld.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dyld.lo -MD -MP -MF $(DEPDIR)/dyld.Tpo -c -o dyld.lo `test -f 'loaders/dyld.c' || echo '$(srcdir)/'`loaders/dyld.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/dyld.Tpo $(DEPDIR)/dyld.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loaders/dyld.c' object='dyld.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dyld.lo `test -f 'loaders/dyld.c' || echo '$(srcdir)/'`loaders/dyld.c libltdl_la-preopen.lo: loaders/preopen.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libltdl_la-preopen.lo -MD -MP -MF $(DEPDIR)/libltdl_la-preopen.Tpo -c -o libltdl_la-preopen.lo `test -f 'loaders/preopen.c' || echo '$(srcdir)/'`loaders/preopen.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libltdl_la-preopen.Tpo $(DEPDIR)/libltdl_la-preopen.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loaders/preopen.c' object='libltdl_la-preopen.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libltdl_la-preopen.lo `test -f 'loaders/preopen.c' || echo '$(srcdir)/'`loaders/preopen.c libltdl_la-lt__alloc.lo: lt__alloc.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libltdl_la-lt__alloc.lo -MD -MP -MF $(DEPDIR)/libltdl_la-lt__alloc.Tpo -c -o libltdl_la-lt__alloc.lo `test -f 'lt__alloc.c' || echo '$(srcdir)/'`lt__alloc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libltdl_la-lt__alloc.Tpo $(DEPDIR)/libltdl_la-lt__alloc.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lt__alloc.c' object='libltdl_la-lt__alloc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libltdl_la-lt__alloc.lo `test -f 'lt__alloc.c' || echo '$(srcdir)/'`lt__alloc.c libltdl_la-lt_dlloader.lo: lt_dlloader.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libltdl_la-lt_dlloader.lo -MD -MP -MF $(DEPDIR)/libltdl_la-lt_dlloader.Tpo -c -o libltdl_la-lt_dlloader.lo `test -f 'lt_dlloader.c' || echo '$(srcdir)/'`lt_dlloader.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libltdl_la-lt_dlloader.Tpo $(DEPDIR)/libltdl_la-lt_dlloader.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lt_dlloader.c' object='libltdl_la-lt_dlloader.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libltdl_la-lt_dlloader.lo `test -f 'lt_dlloader.c' || echo '$(srcdir)/'`lt_dlloader.c libltdl_la-lt_error.lo: lt_error.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libltdl_la-lt_error.lo -MD -MP -MF $(DEPDIR)/libltdl_la-lt_error.Tpo -c -o libltdl_la-lt_error.lo `test -f 'lt_error.c' || echo '$(srcdir)/'`lt_error.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libltdl_la-lt_error.Tpo $(DEPDIR)/libltdl_la-lt_error.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lt_error.c' object='libltdl_la-lt_error.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libltdl_la-lt_error.lo `test -f 'lt_error.c' || echo '$(srcdir)/'`lt_error.c libltdl_la-ltdl.lo: ltdl.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libltdl_la-ltdl.lo -MD -MP -MF $(DEPDIR)/libltdl_la-ltdl.Tpo -c -o libltdl_la-ltdl.lo `test -f 'ltdl.c' || echo '$(srcdir)/'`ltdl.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libltdl_la-ltdl.Tpo $(DEPDIR)/libltdl_la-ltdl.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ltdl.c' object='libltdl_la-ltdl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libltdl_la-ltdl.lo `test -f 'ltdl.c' || echo '$(srcdir)/'`ltdl.c libltdl_la-slist.lo: slist.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libltdl_la-slist.lo -MD -MP -MF $(DEPDIR)/libltdl_la-slist.Tpo -c -o libltdl_la-slist.lo `test -f 'slist.c' || echo '$(srcdir)/'`slist.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libltdl_la-slist.Tpo $(DEPDIR)/libltdl_la-slist.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slist.c' object='libltdl_la-slist.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libltdl_la-slist.lo `test -f 'slist.c' || echo '$(srcdir)/'`slist.c libltdlc_la-preopen.lo: loaders/preopen.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdlc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libltdlc_la-preopen.lo -MD -MP -MF $(DEPDIR)/libltdlc_la-preopen.Tpo -c -o libltdlc_la-preopen.lo `test -f 'loaders/preopen.c' || echo '$(srcdir)/'`loaders/preopen.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libltdlc_la-preopen.Tpo $(DEPDIR)/libltdlc_la-preopen.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loaders/preopen.c' object='libltdlc_la-preopen.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdlc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libltdlc_la-preopen.lo `test -f 'loaders/preopen.c' || echo '$(srcdir)/'`loaders/preopen.c libltdlc_la-lt__alloc.lo: lt__alloc.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdlc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libltdlc_la-lt__alloc.lo -MD -MP -MF $(DEPDIR)/libltdlc_la-lt__alloc.Tpo -c -o libltdlc_la-lt__alloc.lo `test -f 'lt__alloc.c' || echo '$(srcdir)/'`lt__alloc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libltdlc_la-lt__alloc.Tpo $(DEPDIR)/libltdlc_la-lt__alloc.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lt__alloc.c' object='libltdlc_la-lt__alloc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdlc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libltdlc_la-lt__alloc.lo `test -f 'lt__alloc.c' || echo '$(srcdir)/'`lt__alloc.c libltdlc_la-lt_dlloader.lo: lt_dlloader.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdlc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libltdlc_la-lt_dlloader.lo -MD -MP -MF $(DEPDIR)/libltdlc_la-lt_dlloader.Tpo -c -o libltdlc_la-lt_dlloader.lo `test -f 'lt_dlloader.c' || echo '$(srcdir)/'`lt_dlloader.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libltdlc_la-lt_dlloader.Tpo $(DEPDIR)/libltdlc_la-lt_dlloader.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lt_dlloader.c' object='libltdlc_la-lt_dlloader.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdlc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libltdlc_la-lt_dlloader.lo `test -f 'lt_dlloader.c' || echo '$(srcdir)/'`lt_dlloader.c libltdlc_la-lt_error.lo: lt_error.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdlc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libltdlc_la-lt_error.lo -MD -MP -MF $(DEPDIR)/libltdlc_la-lt_error.Tpo -c -o libltdlc_la-lt_error.lo `test -f 'lt_error.c' || echo '$(srcdir)/'`lt_error.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libltdlc_la-lt_error.Tpo $(DEPDIR)/libltdlc_la-lt_error.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lt_error.c' object='libltdlc_la-lt_error.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdlc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libltdlc_la-lt_error.lo `test -f 'lt_error.c' || echo '$(srcdir)/'`lt_error.c libltdlc_la-ltdl.lo: ltdl.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdlc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libltdlc_la-ltdl.lo -MD -MP -MF $(DEPDIR)/libltdlc_la-ltdl.Tpo -c -o libltdlc_la-ltdl.lo `test -f 'ltdl.c' || echo '$(srcdir)/'`ltdl.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libltdlc_la-ltdl.Tpo $(DEPDIR)/libltdlc_la-ltdl.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ltdl.c' object='libltdlc_la-ltdl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdlc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libltdlc_la-ltdl.lo `test -f 'ltdl.c' || echo '$(srcdir)/'`ltdl.c libltdlc_la-slist.lo: slist.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdlc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libltdlc_la-slist.lo -MD -MP -MF $(DEPDIR)/libltdlc_la-slist.Tpo -c -o libltdlc_la-slist.lo `test -f 'slist.c' || echo '$(srcdir)/'`slist.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libltdlc_la-slist.Tpo $(DEPDIR)/libltdlc_la-slist.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slist.c' object='libltdlc_la-slist.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libltdlc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libltdlc_la-slist.lo `test -f 'slist.c' || echo '$(srcdir)/'`slist.c load_add_on.lo: loaders/load_add_on.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT load_add_on.lo -MD -MP -MF $(DEPDIR)/load_add_on.Tpo -c -o load_add_on.lo `test -f 'loaders/load_add_on.c' || echo '$(srcdir)/'`loaders/load_add_on.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/load_add_on.Tpo $(DEPDIR)/load_add_on.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loaders/load_add_on.c' object='load_add_on.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o load_add_on.lo `test -f 'loaders/load_add_on.c' || echo '$(srcdir)/'`loaders/load_add_on.c loadlibrary.lo: loaders/loadlibrary.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT loadlibrary.lo -MD -MP -MF $(DEPDIR)/loadlibrary.Tpo -c -o loadlibrary.lo `test -f 'loaders/loadlibrary.c' || echo '$(srcdir)/'`loaders/loadlibrary.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/loadlibrary.Tpo $(DEPDIR)/loadlibrary.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loaders/loadlibrary.c' object='loadlibrary.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o loadlibrary.lo `test -f 'loaders/loadlibrary.c' || echo '$(srcdir)/'`loaders/loadlibrary.c shl_load.lo: loaders/shl_load.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT shl_load.lo -MD -MP -MF $(DEPDIR)/shl_load.Tpo -c -o shl_load.lo `test -f 'loaders/shl_load.c' || echo '$(srcdir)/'`loaders/shl_load.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/shl_load.Tpo $(DEPDIR)/shl_load.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loaders/shl_load.c' object='shl_load.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shl_load.lo `test -f 'loaders/shl_load.c' || echo '$(srcdir)/'`loaders/shl_load.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(includedir)" && rm -f $$files install-ltdlincludeHEADERS: $(ltdlinclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(ltdlincludedir)" || $(MKDIR_P) "$(DESTDIR)$(ltdlincludedir)" @list='$(ltdlinclude_HEADERS)'; test -n "$(ltdlincludedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(ltdlincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(ltdlincludedir)" || exit $$?; \ done uninstall-ltdlincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(ltdlinclude_HEADERS)'; test -n "$(ltdlincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(ltdlincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(ltdlincludedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config-h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config-h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config-h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config-h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(ltdlincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(DEPDIR) ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-includeHEADERS install-ltdlincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf $(DEPDIR) ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \ uninstall-ltdlincludeHEADERS .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-generic clean-libLTLIBRARIES clean-libtool \ clean-noinstLTLIBRARIES ctags dist dist-all dist-bzip2 \ dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-includeHEADERS \ install-info install-info-am install-libLTLIBRARIES \ install-ltdlincludeHEADERS install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-includeHEADERS \ uninstall-libLTLIBRARIES uninstall-ltdlincludeHEADERS # We need the following in order to create an when the system # doesn't have one that works with the given compiler. all-local $(lib_OBJECTS): $(ARGZ_H) argz.h: argz_.h $(mkinstalldirs) . cp $(srcdir)/argz_.h $@-t mv $@-t $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cpl-6.4.1/libltdl/loaders/0000755000460300003120000000000012310333010012333 500000000000000cpl-6.4.1/libltdl/loaders/shl_load.c0000644000460300003120000001507612310332714014227 00000000000000/* loader-shl_load.c -- dynamic linking with shl_load (HP-UX) Copyright (C) 1998, 1999, 2000, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. Written by Thomas Tanner, 1998 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lt__private.h" #include "lt_dlloader.h" /* Use the preprocessor to rename non-static symbols to avoid namespace collisions when the loader code is statically linked into libltdl. Use the "_LTX_" prefix so that the symbol addresses can be fetched from the preloaded symbol list by lt_dlsym(): */ #define get_vtable shl_load_LTX_get_vtable LT_BEGIN_C_DECLS LT_SCOPE lt_dlvtable *get_vtable (lt_user_data loader_data); LT_END_C_DECLS /* Boilerplate code to set up the vtable for hooking this loader into libltdl's loader list: */ static int vl_exit (lt_user_data loader_data); static lt_module vm_open (lt_user_data loader_data, const char *filename, lt_dladvise advise); static int vm_close (lt_user_data loader_data, lt_module module); static void * vm_sym (lt_user_data loader_data, lt_module module, const char *symbolname); static lt_dlvtable *vtable = 0; /* Return the vtable for this loader, only the name and sym_prefix attributes (plus the virtual function implementations, obviously) change between loaders. */ lt_dlvtable * get_vtable (lt_user_data loader_data) { if (!vtable) { vtable = lt__zalloc (sizeof *vtable); } if (vtable && !vtable->name) { vtable->name = "lt_shl_load"; vtable->module_open = vm_open; vtable->module_close = vm_close; vtable->find_sym = vm_sym; vtable->dlloader_exit = vl_exit; vtable->dlloader_data = loader_data; vtable->priority = LT_DLLOADER_APPEND; } if (vtable && (vtable->dlloader_data != loader_data)) { LT__SETERROR (INIT_LOADER); return 0; } return vtable; } /* --- IMPLEMENTATION --- */ #if defined(HAVE_DL_H) # include #endif /* some flags are missing on some systems, so we provide * harmless defaults. * * Mandatory: * BIND_IMMEDIATE - Resolve symbol references when the library is loaded. * BIND_DEFERRED - Delay code symbol resolution until actual reference. * * Optionally: * BIND_FIRST - Place the library at the head of the symbol search * order. * BIND_NONFATAL - The default BIND_IMMEDIATE behavior is to treat all * unsatisfied symbols as fatal. This flag allows * binding of unsatisfied code symbols to be deferred * until use. * [Perl: For certain libraries, like DCE, deferred * binding often causes run time problems. Adding * BIND_NONFATAL to BIND_IMMEDIATE still allows * unresolved references in situations like this.] * BIND_NOSTART - Do not call the initializer for the shared library * when the library is loaded, nor on a future call to * shl_unload(). * BIND_VERBOSE - Print verbose messages concerning possible * unsatisfied symbols. * * hp9000s700/hp9000s800: * BIND_RESTRICTED - Restrict symbols visible by the library to those * present at library load time. * DYNAMIC_PATH - Allow the loader to dynamically search for the * library specified by the path argument. */ #if !defined(DYNAMIC_PATH) # define DYNAMIC_PATH 0 #endif #if !defined(BIND_RESTRICTED) # define BIND_RESTRICTED 0 #endif #define LT_BIND_FLAGS (BIND_IMMEDIATE | BIND_NONFATAL | DYNAMIC_PATH) /* A function called through the vtable when this loader is no longer needed by the application. */ static int vl_exit (lt_user_data LT__UNUSED loader_data) { vtable = NULL; return 0; } /* A function called through the vtable to open a module with this loader. Returns an opaque representation of the newly opened module for processing with this loader's other vtable functions. */ static lt_module vm_open (lt_user_data LT__UNUSED loader_data, const char *filename, lt_dladvise LT__UNUSED advise) { static shl_t self = (shl_t) 0; lt_module module = shl_load (filename, LT_BIND_FLAGS, 0L); /* Since searching for a symbol against a NULL module handle will also look in everything else that was already loaded and exported with the -E compiler flag, we always cache a handle saved before any modules are loaded. */ if (!self) { void *address; shl_findsym (&self, "main", TYPE_UNDEFINED, &address); } if (!filename) { module = self; } else { module = shl_load (filename, LT_BIND_FLAGS, 0L); if (!module) { LT__SETERROR (CANNOT_OPEN); } } return module; } /* A function called through the vtable when a particular module should be unloaded. */ static int vm_close (lt_user_data LT__UNUSED loader_data, lt_module module) { int errors = 0; if (module && (shl_unload ((shl_t) (module)) != 0)) { LT__SETERROR (CANNOT_CLOSE); ++errors; } return errors; } /* A function called through the vtable to get the address of a symbol loaded from a particular module. */ static void * vm_sym (lt_user_data LT__UNUSED loader_data, lt_module module, const char *name) { void *address = 0; /* sys_shl_open should never return a NULL module handle */ if (module == (lt_module) 0) { LT__SETERROR (INVALID_HANDLE); } else if (!shl_findsym((shl_t*) &module, name, TYPE_UNDEFINED, &address)) { if (!address) { LT__SETERROR (SYMBOL_NOT_FOUND); } } return address; } cpl-6.4.1/libltdl/loaders/loadlibrary.c0000644000460300003120000002517312310332714014745 00000000000000/* loader-loadlibrary.c -- dynamic linking for Win32 Copyright (C) 1998, 1999, 2000, 2004, 2005, 2006, 2007, 2008, 2010 Free Software Foundation, Inc. Written by Thomas Tanner, 1998 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lt__private.h" #include "lt_dlloader.h" #if defined(__CYGWIN__) # include #endif /* Use the preprocessor to rename non-static symbols to avoid namespace collisions when the loader code is statically linked into libltdl. Use the "_LTX_" prefix so that the symbol addresses can be fetched from the preloaded symbol list by lt_dlsym(): */ #define get_vtable loadlibrary_LTX_get_vtable LT_BEGIN_C_DECLS LT_SCOPE lt_dlvtable *get_vtable (lt_user_data loader_data); LT_END_C_DECLS /* Boilerplate code to set up the vtable for hooking this loader into libltdl's loader list: */ static int vl_exit (lt_user_data loader_data); static lt_module vm_open (lt_user_data loader_data, const char *filename, lt_dladvise advise); static int vm_close (lt_user_data loader_data, lt_module module); static void * vm_sym (lt_user_data loader_data, lt_module module, const char *symbolname); static lt_dlinterface_id iface_id = 0; static lt_dlvtable *vtable = 0; /* Return the vtable for this loader, only the name and sym_prefix attributes (plus the virtual function implementations, obviously) change between loaders. */ lt_dlvtable * get_vtable (lt_user_data loader_data) { if (!vtable) { vtable = (lt_dlvtable *) lt__zalloc (sizeof *vtable); iface_id = lt_dlinterface_register ("ltdl loadlibrary", NULL); } if (vtable && !vtable->name) { vtable->name = "lt_loadlibrary"; vtable->module_open = vm_open; vtable->module_close = vm_close; vtable->find_sym = vm_sym; vtable->dlloader_exit = vl_exit; vtable->dlloader_data = loader_data; vtable->priority = LT_DLLOADER_APPEND; } if (vtable && (vtable->dlloader_data != loader_data)) { LT__SETERROR (INIT_LOADER); return 0; } return vtable; } /* --- IMPLEMENTATION --- */ #include #define LOCALFREE(mem) LT_STMT_START { \ if (mem) { LocalFree ((void *)mem); mem = NULL; } } LT_STMT_END #define LOADLIB__SETERROR(errmsg) LT__SETERRORSTR (loadlibraryerror (errmsg)) #define LOADLIB_SETERROR(errcode) LOADLIB__SETERROR (LT__STRERROR (errcode)) static const char *loadlibraryerror (const char *default_errmsg); static DWORD WINAPI wrap_getthreaderrormode (void); static DWORD WINAPI fallback_getthreaderrormode (void); static BOOL WINAPI wrap_setthreaderrormode (DWORD mode, DWORD *oldmode); static BOOL WINAPI fallback_setthreaderrormode (DWORD mode, DWORD *oldmode); typedef DWORD (WINAPI getthreaderrormode_type) (void); typedef BOOL (WINAPI setthreaderrormode_type) (DWORD, DWORD *); static getthreaderrormode_type *getthreaderrormode = wrap_getthreaderrormode; static setthreaderrormode_type *setthreaderrormode = wrap_setthreaderrormode; static char *error_message = 0; /* A function called through the vtable when this loader is no longer needed by the application. */ static int vl_exit (lt_user_data LT__UNUSED loader_data) { vtable = NULL; LOCALFREE (error_message); return 0; } /* A function called through the vtable to open a module with this loader. Returns an opaque representation of the newly opened module for processing with this loader's other vtable functions. */ static lt_module vm_open (lt_user_data LT__UNUSED loader_data, const char *filename, lt_dladvise LT__UNUSED advise) { lt_module module = 0; char *ext; char wpath[MAX_PATH]; size_t len; if (!filename) { /* Get the name of main module */ *wpath = 0; GetModuleFileName (NULL, wpath, sizeof (wpath)); filename = wpath; } else { len = LT_STRLEN (filename); if (len >= MAX_PATH) { LT__SETERROR (CANNOT_OPEN); return 0; } #if HAVE_DECL_CYGWIN_CONV_PATH if (cygwin_conv_path (CCP_POSIX_TO_WIN_A, filename, wpath, MAX_PATH)) { LT__SETERROR (CANNOT_OPEN); return 0; } len = 0; #elif defined(__CYGWIN__) cygwin_conv_to_full_win32_path (filename, wpath); len = 0; #else strcpy(wpath, filename); #endif ext = strrchr (wpath, '.'); if (!ext) { /* Append a `.' to stop Windows from adding an implicit `.dll' extension. */ if (!len) len = strlen (wpath); if (len + 1 >= MAX_PATH) { LT__SETERROR (CANNOT_OPEN); return 0; } wpath[len] = '.'; wpath[len+1] = '\0'; } } { /* Silence dialog from LoadLibrary on some failures. */ DWORD errormode = getthreaderrormode (); DWORD last_error; setthreaderrormode (errormode | SEM_FAILCRITICALERRORS, NULL); module = LoadLibrary (wpath); /* Restore the error mode. */ last_error = GetLastError (); setthreaderrormode (errormode, NULL); SetLastError (last_error); } /* libltdl expects this function to fail if it is unable to physically load the library. Sadly, LoadLibrary will search the loaded libraries for a match and return one of them if the path search load fails. We check whether LoadLibrary is returning a handle to an already loaded module, and simulate failure if we find one. */ { lt_dlhandle cur = 0; while ((cur = lt_dlhandle_iterate (iface_id, cur))) { if (!cur->module) { cur = 0; break; } if (cur->module == module) { break; } } if (!module) LOADLIB_SETERROR (CANNOT_OPEN); else if (cur) { LT__SETERROR (CANNOT_OPEN); module = 0; } } return module; } /* A function called through the vtable when a particular module should be unloaded. */ static int vm_close (lt_user_data LT__UNUSED loader_data, lt_module module) { int errors = 0; if (FreeLibrary ((HMODULE) module) == 0) { LOADLIB_SETERROR (CANNOT_CLOSE); ++errors; } return errors; } /* A function called through the vtable to get the address of a symbol loaded from a particular module. */ static void * vm_sym (lt_user_data LT__UNUSED loader_data, lt_module module, const char *name) { void *address = (void *) GetProcAddress ((HMODULE) module, name); if (!address) { LOADLIB_SETERROR (SYMBOL_NOT_FOUND); } return address; } /* --- HELPER FUNCTIONS --- */ /* Return the windows error message, or the passed in error message on failure. */ static const char * loadlibraryerror (const char *default_errmsg) { size_t len; LOCALFREE (error_message); FormatMessageA (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError (), 0, (char *) &error_message, 0, NULL); /* Remove trailing CRNL */ len = LT_STRLEN (error_message); if (len && error_message[len - 1] == '\n') error_message[--len] = LT_EOS_CHAR; if (len && error_message[len - 1] == '\r') error_message[--len] = LT_EOS_CHAR; return len ? error_message : default_errmsg; } /* A function called through the getthreaderrormode variable which checks if the system supports GetThreadErrorMode (or GetErrorMode) and arranges for it or a fallback implementation to be called directly in the future. The selected version is then called. */ static DWORD WINAPI wrap_getthreaderrormode (void) { HMODULE kernel32 = GetModuleHandleA ("kernel32.dll"); getthreaderrormode = (getthreaderrormode_type *) GetProcAddress (kernel32, "GetThreadErrorMode"); if (!getthreaderrormode) getthreaderrormode = (getthreaderrormode_type *) GetProcAddress (kernel32, "GetErrorMode"); if (!getthreaderrormode) getthreaderrormode = fallback_getthreaderrormode; return getthreaderrormode (); } /* A function called through the getthreaderrormode variable for cases where the system does not support GetThreadErrorMode or GetErrorMode */ static DWORD WINAPI fallback_getthreaderrormode (void) { /* Prior to Windows Vista, the only way to get the current error mode was to set a new one. In our case, we are setting a new error mode right after "getting" it while ignoring the error mode in effect when setting the new error mode, so that's fairly ok. */ return (DWORD) SetErrorMode (SEM_FAILCRITICALERRORS); } /* A function called through the setthreaderrormode variable which checks if the system supports SetThreadErrorMode and arranges for it or a fallback implementation to be called directly in the future. The selected version is then called. */ static BOOL WINAPI wrap_setthreaderrormode (DWORD mode, DWORD *oldmode) { HMODULE kernel32 = GetModuleHandleA ("kernel32.dll"); setthreaderrormode = (setthreaderrormode_type *) GetProcAddress (kernel32, "SetThreadErrorMode"); if (!setthreaderrormode) setthreaderrormode = fallback_setthreaderrormode; return setthreaderrormode (mode, oldmode); } /* A function called through the setthreaderrormode variable for cases where the system does not support SetThreadErrorMode. */ static BOOL WINAPI fallback_setthreaderrormode (DWORD mode, DWORD *oldmode) { /* Prior to Windows 7, there was no way to set the thread local error mode, so set the process global error mode instead. */ DWORD old = (DWORD) SetErrorMode (mode); if (oldmode) *oldmode = old; return TRUE; } cpl-6.4.1/libltdl/loaders/dld_link.c0000644000460300003120000001074112310332714014214 00000000000000/* loader-dld_link.c -- dynamic linking with dld Copyright (C) 1998, 1999, 2000, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. Written by Thomas Tanner, 1998 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lt__private.h" #include "lt_dlloader.h" /* Use the preprocessor to rename non-static symbols to avoid namespace collisions when the loader code is statically linked into libltdl. Use the "_LTX_" prefix so that the symbol addresses can be fetched from the preloaded symbol list by lt_dlsym(): */ #define get_vtable dld_link_LTX_get_vtable LT_BEGIN_C_DECLS LT_SCOPE lt_dlvtable *get_vtable (lt_user_data loader_data); LT_END_C_DECLS /* Boilerplate code to set up the vtable for hooking this loader into libltdl's loader list: */ static int vl_exit (lt_user_data loader_data); static lt_module vm_open (lt_user_data loader_data, const char *filename, lt_dladvise advise); static int vm_close (lt_user_data loader_data, lt_module module); static void * vm_sym (lt_user_data loader_data, lt_module module, const char *symbolname); static lt_dlvtable *vtable = 0; /* Return the vtable for this loader, only the name and sym_prefix attributes (plus the virtual function implementations, obviously) change between loaders. */ lt_dlvtable * get_vtable (lt_user_data loader_data) { if (!vtable) { vtable = lt__zalloc (sizeof *vtable); } if (vtable && !vtable->name) { vtable->name = "lt_dld_link"; vtable->module_open = vm_open; vtable->module_close = vm_close; vtable->find_sym = vm_sym; vtable->dlloader_exit = vl_exit; vtable->dlloader_data = loader_data; vtable->priority = LT_DLLOADER_APPEND; } if (vtable && (vtable->dlloader_data != loader_data)) { LT__SETERROR (INIT_LOADER); return 0; } return vtable; } /* --- IMPLEMENTATION --- */ #if defined(HAVE_DLD_H) # include #endif /* A function called through the vtable when this loader is no longer needed by the application. */ static int vl_exit (lt_user_data LT__UNUSED loader_data) { vtable = NULL; return 0; } /* A function called through the vtable to open a module with this loader. Returns an opaque representation of the newly opened module for processing with this loader's other vtable functions. */ static lt_module vm_open (lt_user_data LT__UNUSED loader_data, const char *filename, lt_dladvise LT__UNUSED advise) { lt_module module = lt__strdup (filename); if (dld_link (filename) != 0) { LT__SETERROR (CANNOT_OPEN); FREE (module); } return module; } /* A function called through the vtable when a particular module should be unloaded. */ static int vm_close (lt_user_data LT__UNUSED loader_data, lt_module module) { int errors = 0; if (dld_unlink_by_file ((char*)(module), 1) != 0) { LT__SETERROR (CANNOT_CLOSE); ++errors; } else { FREE (module); } return errors; } /* A function called through the vtable to get the address of a symbol loaded from a particular module. */ static void * vm_sym (lt_user_data LT__UNUSED loader_data, lt_module LT__UNUSED module, const char *name) { void *address = dld_get_func (name); if (!address) { LT__SETERROR (SYMBOL_NOT_FOUND); } return address; } cpl-6.4.1/libltdl/loaders/dlopen.c0000644000460300003120000001434112310332714013715 00000000000000/* loader-dlopen.c -- dynamic linking with dlopen/dlsym Copyright (C) 1998, 1999, 2000, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. Written by Thomas Tanner, 1998 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lt__private.h" #include "lt_dlloader.h" /* Use the preprocessor to rename non-static symbols to avoid namespace collisions when the loader code is statically linked into libltdl. Use the "_LTX_" prefix so that the symbol addresses can be fetched from the preloaded symbol list by lt_dlsym(): */ #define get_vtable dlopen_LTX_get_vtable LT_BEGIN_C_DECLS LT_SCOPE lt_dlvtable *get_vtable (lt_user_data loader_data); LT_END_C_DECLS /* Boilerplate code to set up the vtable for hooking this loader into libltdl's loader list: */ static int vl_exit (lt_user_data loader_data); static lt_module vm_open (lt_user_data loader_data, const char *filename, lt_dladvise advise); static int vm_close (lt_user_data loader_data, lt_module module); static void * vm_sym (lt_user_data loader_data, lt_module module, const char *symbolname); static lt_dlvtable *vtable = 0; /* Return the vtable for this loader, only the name and sym_prefix attributes (plus the virtual function implementations, obviously) change between loaders. */ lt_dlvtable * get_vtable (lt_user_data loader_data) { if (!vtable) { vtable = (lt_dlvtable *) lt__zalloc (sizeof *vtable); } if (vtable && !vtable->name) { vtable->name = "lt_dlopen"; #if defined(DLSYM_USCORE) vtable->sym_prefix = "_"; #endif vtable->module_open = vm_open; vtable->module_close = vm_close; vtable->find_sym = vm_sym; vtable->dlloader_exit = vl_exit; vtable->dlloader_data = loader_data; vtable->priority = LT_DLLOADER_PREPEND; } if (vtable && (vtable->dlloader_data != loader_data)) { LT__SETERROR (INIT_LOADER); return 0; } return vtable; } /* --- IMPLEMENTATION --- */ #if defined(HAVE_DLFCN_H) # include #endif #if defined(HAVE_SYS_DL_H) # include #endif /* We may have to define LT_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #if !defined(LT_LAZY_OR_NOW) # if defined(RTLD_LAZY) # define LT_LAZY_OR_NOW RTLD_LAZY # else # if defined(DL_LAZY) # define LT_LAZY_OR_NOW DL_LAZY # endif # endif /* !RTLD_LAZY */ #endif #if !defined(LT_LAZY_OR_NOW) # if defined(RTLD_NOW) # define LT_LAZY_OR_NOW RTLD_NOW # else # if defined(DL_NOW) # define LT_LAZY_OR_NOW DL_NOW # endif # endif /* !RTLD_NOW */ #endif #if !defined(LT_LAZY_OR_NOW) # define LT_LAZY_OR_NOW 0 #endif /* !LT_LAZY_OR_NOW */ /* We only support local and global symbols from modules for loaders that provide such a thing, otherwise the system default is used. */ #if !defined(RTLD_GLOBAL) # if defined(DL_GLOBAL) # define RTLD_GLOBAL DL_GLOBAL # endif #endif /* !RTLD_GLOBAL */ #if !defined(RTLD_LOCAL) # if defined(DL_LOCAL) # define RTLD_LOCAL DL_LOCAL # endif #endif /* !RTLD_LOCAL */ #if defined(HAVE_DLERROR) # define DLERROR(arg) dlerror () #else # define DLERROR(arg) LT__STRERROR (arg) #endif #define DL__SETERROR(errorcode) \ LT__SETERRORSTR (DLERROR (errorcode)) /* A function called through the vtable when this loader is no longer needed by the application. */ static int vl_exit (lt_user_data LT__UNUSED loader_data) { vtable = NULL; return 0; } /* A function called through the vtable to open a module with this loader. Returns an opaque representation of the newly opened module for processing with this loader's other vtable functions. */ static lt_module vm_open (lt_user_data LT__UNUSED loader_data, const char *filename, lt_dladvise advise) { int module_flags = LT_LAZY_OR_NOW; lt_module module; if (advise) { #ifdef RTLD_GLOBAL /* If there is some means of asking for global symbol resolution, do so. */ if (advise->is_symglobal) module_flags |= RTLD_GLOBAL; #else /* Otherwise, reset that bit so the caller can tell it wasn't acted on. */ advise->is_symglobal = 0; #endif /* And similarly for local only symbol resolution. */ #ifdef RTLD_LOCAL if (advise->is_symlocal) module_flags |= RTLD_LOCAL; #else advise->is_symlocal = 0; #endif } module = dlopen (filename, module_flags); if (!module) { DL__SETERROR (CANNOT_OPEN); } return module; } /* A function called through the vtable when a particular module should be unloaded. */ static int vm_close (lt_user_data LT__UNUSED loader_data, lt_module module) { int errors = 0; if (dlclose (module) != 0) { DL__SETERROR (CANNOT_CLOSE); ++errors; } return errors; } /* A function called through the vtable to get the address of a symbol loaded from a particular module. */ static void * vm_sym (lt_user_data LT__UNUSED loader_data, lt_module module, const char *name) { void *address = dlsym (module, name); if (!address) { DL__SETERROR (SYMBOL_NOT_FOUND); } return address; } cpl-6.4.1/libltdl/loaders/load_add_on.c0000644000460300003120000001130412310332714014653 00000000000000/* loader-load_add_on.c -- dynamic linking for BeOS Copyright (C) 1998, 1999, 2000, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. Written by Thomas Tanner, 1998 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lt__private.h" #include "lt_dlloader.h" /* Use the preprocessor to rename non-static symbols to avoid namespace collisions when the loader code is statically linked into libltdl. Use the "_LTX_" prefix so that the symbol addresses can be fetched from the preloaded symbol list by lt_dlsym(): */ #define get_vtable load_add_on_LTX_get_vtable LT_BEGIN_C_DECLS LT_SCOPE lt_dlvtable *get_vtable (lt_user_data loader_data); LT_END_C_DECLS /* Boilerplate code to set up the vtable for hooking this loader into libltdl's loader list: */ static int vl_exit (lt_user_data loader_data); static lt_module vm_open (lt_user_data loader_data, const char *filename, lt_dladvise advise); static int vm_close (lt_user_data loader_data, lt_module module); static void * vm_sym (lt_user_data loader_data, lt_module module, const char *symbolname); static lt_dlvtable *vtable = 0; /* Return the vtable for this loader, only the name and sym_prefix attributes (plus the virtual function implementations, obviously) change between loaders. */ lt_dlvtable * get_vtable (lt_user_data loader_data) { if (!vtable) { vtable = lt__zalloc (sizeof *vtable); } if (vtable && !vtable->name) { vtable->name = "lt_load_add_on"; vtable->module_open = vm_open; vtable->module_close = vm_close; vtable->find_sym = vm_sym; vtable->dlloader_exit = vl_exit; vtable->dlloader_data = loader_data; vtable->priority = LT_DLLOADER_APPEND; } if (vtable && (vtable->dlloader_data != loader_data)) { LT__SETERROR (INIT_LOADER); return 0; } return vtable; } /* --- IMPLEMENTATION --- */ #include /* A function called through the vtable when this loader is no longer needed by the application. */ static int vl_exit (lt_user_data LT__UNUSED loader_data) { vtable = NULL; return 0; } /* A function called through the vtable to open a module with this loader. Returns an opaque representation of the newly opened module for processing with this loader's other vtable functions. */ static lt_module vm_open (lt_user_data LT__UNUSED loader_data, const char *filename, lt_dladvise LT__UNUSED advise) { image_id image = 0; if (filename) { image = load_add_on (filename); } else { image_info info; int32 cookie = 0; if (get_next_image_info (0, &cookie, &info) == B_OK) image = load_add_on (info.name); } if (image <= 0) { LT__SETERROR (CANNOT_OPEN); image = 0; } return (lt_module) image; } /* A function called through the vtable when a particular module should be unloaded. */ static int vm_close (lt_user_data LT__UNUSED loader_data, lt_module module) { int errors = 0; if (unload_add_on ((image_id) module) != B_OK) { LT__SETERROR (CANNOT_CLOSE); ++errors; } return errors; } /* A function called through the vtable to get the address of a symbol loaded from a particular module. */ static void * vm_sym (lt_user_data LT__UNUSED loader_data, lt_module module, const char *name) { void *address = 0; image_id image = (image_id) module; if (get_image_symbol (image, name, B_SYMBOL_TYPE_ANY, address) != B_OK) { LT__SETERROR (SYMBOL_NOT_FOUND); address = 0; } return address; } cpl-6.4.1/libltdl/loaders/preopen.c0000644000460300003120000002245512310332715014112 00000000000000/* loader-preopen.c -- emulate dynamic linking using preloaded_symbols Copyright (C) 1998, 1999, 2000, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. Written by Thomas Tanner, 1998 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lt__private.h" #include "lt_dlloader.h" /* Use the preprocessor to rename non-static symbols to avoid namespace collisions when the loader code is statically linked into libltdl. Use the "_LTX_" prefix so that the symbol addresses can be fetched from the preloaded symbol list by lt_dlsym(): */ #define get_vtable preopen_LTX_get_vtable LT_BEGIN_C_DECLS LT_SCOPE lt_dlvtable *get_vtable (lt_user_data loader_data); LT_END_C_DECLS /* Boilerplate code to set up the vtable for hooking this loader into libltdl's loader list: */ static int vl_init (lt_user_data loader_data); static int vl_exit (lt_user_data loader_data); static lt_module vm_open (lt_user_data loader_data, const char *filename, lt_dladvise advise); static int vm_close (lt_user_data loader_data, lt_module module); static void * vm_sym (lt_user_data loader_data, lt_module module, const char *symbolname); static lt_dlvtable *vtable = 0; /* Return the vtable for this loader, only the name and sym_prefix attributes (plus the virtual function implementations, obviously) change between loaders. */ lt_dlvtable * get_vtable (lt_user_data loader_data) { if (!vtable) { vtable = (lt_dlvtable *) lt__zalloc (sizeof *vtable); } if (vtable && !vtable->name) { vtable->name = "lt_preopen"; vtable->sym_prefix = 0; vtable->module_open = vm_open; vtable->module_close = vm_close; vtable->find_sym = vm_sym; vtable->dlloader_init = vl_init; vtable->dlloader_exit = vl_exit; vtable->dlloader_data = loader_data; vtable->priority = LT_DLLOADER_PREPEND; } if (vtable && (vtable->dlloader_data != loader_data)) { LT__SETERROR (INIT_LOADER); return 0; } return vtable; } /* --- IMPLEMENTATION --- */ /* Wrapper type to chain together symbol lists of various origins. */ typedef struct symlist_chain { struct symlist_chain *next; const lt_dlsymlist *symlist; } symlist_chain; static int add_symlist (const lt_dlsymlist *symlist); static int free_symlists (void); /* The start of the symbol lists chain. */ static symlist_chain *preloaded_symlists = 0; /* A symbol list preloaded before lt_init() was called. */ static const lt_dlsymlist *default_preloaded_symbols = 0; /* A function called through the vtable to initialise this loader. */ static int vl_init (lt_user_data LT__UNUSED loader_data) { int errors = 0; preloaded_symlists = 0; if (default_preloaded_symbols) { errors = lt_dlpreload (default_preloaded_symbols); } return errors; } /* A function called through the vtable when this loader is no longer needed by the application. */ static int vl_exit (lt_user_data LT__UNUSED loader_data) { vtable = NULL; free_symlists (); return 0; } /* A function called through the vtable to open a module with this loader. Returns an opaque representation of the newly opened module for processing with this loader's other vtable functions. */ static lt_module vm_open (lt_user_data LT__UNUSED loader_data, const char *filename, lt_dladvise LT__UNUSED advise) { symlist_chain *lists; lt_module module = 0; if (!preloaded_symlists) { LT__SETERROR (NO_SYMBOLS); goto done; } /* Can't use NULL as the reflective symbol header, as NULL is used to mark the end of the entire symbol list. Self-dlpreopened symbols follow this magic number, chosen to be an unlikely clash with a real module name. */ if (!filename) { filename = "@PROGRAM@"; } for (lists = preloaded_symlists; lists; lists = lists->next) { const lt_dlsymlist *symbol; for (symbol= lists->symlist; symbol->name; ++symbol) { if (!symbol->address && streq (symbol->name, filename)) { /* If the next symbol's name and address is 0, it means the module just contains the originator and no symbols. In this case we pretend that we never saw the module and hope that some other loader will be able to load the module and have access to its symbols */ const lt_dlsymlist *next_symbol = symbol +1; if (next_symbol->address && next_symbol->name) { module = (lt_module) lists->symlist; goto done; } } } } LT__SETERROR (FILE_NOT_FOUND); done: return module; } /* A function called through the vtable when a particular module should be unloaded. */ static int vm_close (lt_user_data LT__UNUSED loader_data, lt_module LT__UNUSED module) { /* Just to silence gcc -Wall */ module = 0; return 0; } /* A function called through the vtable to get the address of a symbol loaded from a particular module. */ static void * vm_sym (lt_user_data LT__UNUSED loader_data, lt_module module, const char *name) { lt_dlsymlist *symbol = (lt_dlsymlist*) module; symbol +=2; /* Skip header (originator then libname). */ while (symbol->name) { if (streq (symbol->name, name)) { return symbol->address; } ++symbol; } LT__SETERROR (SYMBOL_NOT_FOUND); return 0; } /* --- HELPER FUNCTIONS --- */ /* The symbol lists themselves are not allocated from the heap, but we can unhook them and free up the chain of links between them. */ static int free_symlists (void) { symlist_chain *lists; lists = preloaded_symlists; while (lists) { symlist_chain *next = lists->next; FREE (lists); lists = next; } preloaded_symlists = 0; return 0; } /* Add a new symbol list to the global chain. */ static int add_symlist (const lt_dlsymlist *symlist) { symlist_chain *lists; int errors = 0; /* Search for duplicate entries: */ for (lists = preloaded_symlists; lists && lists->symlist != symlist; lists = lists->next) /*NOWORK*/; /* Don't add the same list twice: */ if (!lists) { symlist_chain *tmp = (symlist_chain *) lt__zalloc (sizeof *tmp); if (tmp) { tmp->symlist = symlist; tmp->next = preloaded_symlists; preloaded_symlists = tmp; } else { ++errors; } } return errors; } /* --- PRELOADING API CALL IMPLEMENTATIONS --- */ /* Save a default symbol list for later. */ int lt_dlpreload_default (const lt_dlsymlist *preloaded) { default_preloaded_symbols = preloaded; return 0; } /* Add a symbol list to the global chain, or with a NULL argument, revert to just the default list. */ int lt_dlpreload (const lt_dlsymlist *preloaded) { int errors = 0; if (preloaded) { errors = add_symlist (preloaded); } else { free_symlists(); if (default_preloaded_symbols) { errors = lt_dlpreload (default_preloaded_symbols); } } return errors; } /* Open all the preloaded modules from the named originator, executing a callback for each one. If ORIGINATOR is NULL, then call FUNC for each preloaded module from the program itself. */ int lt_dlpreload_open (const char *originator, lt_dlpreload_callback_func *func) { symlist_chain *list; int errors = 0; int found = 0; /* For each symlist in the chain... */ for (list = preloaded_symlists; list; list = list->next) { /* ...that was preloaded by the requesting ORIGINATOR... */ if ((originator && streq (list->symlist->name, originator)) || (!originator && streq (list->symlist->name, "@PROGRAM@"))) { const lt_dlsymlist *symbol; unsigned int idx = 0; ++found; /* ...load the symbols per source compilation unit: (we preincrement the index to skip over the originator entry) */ while ((symbol = &list->symlist[++idx])->name != 0) { if ((symbol->address == 0) && (strneq (symbol->name, "@PROGRAM@"))) { lt_dlhandle handle = lt_dlopen (symbol->name); if (handle == 0) { ++errors; } else { errors += (*func) (handle); } } } } } if (!found) { LT__SETERROR(CANNOT_OPEN); ++errors; } return errors; } cpl-6.4.1/libltdl/loaders/dyld.c0000644000460300003120000003253612310332714013376 00000000000000/* loader-dyld.c -- dynamic linking on darwin and OS X Copyright (C) 1998, 1999, 2000, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. Written by Peter O'Gorman, 1998 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lt__private.h" #include "lt_dlloader.h" /* Use the preprocessor to rename non-static symbols to avoid namespace collisions when the loader code is statically linked into libltdl. Use the "_LTX_" prefix so that the symbol addresses can be fetched from the preloaded symbol list by lt_dlsym(): */ #define get_vtable dyld_LTX_get_vtable LT_BEGIN_C_DECLS LT_SCOPE lt_dlvtable *get_vtable (lt_user_data loader_data); LT_END_C_DECLS /* Boilerplate code to set up the vtable for hooking this loader into libltdl's loader list: */ static int vl_init (lt_user_data loader_data); static int vl_exit (lt_user_data loader_data); static lt_module vm_open (lt_user_data loader_data, const char *filename, lt_dladvise advise); static int vm_close (lt_user_data loader_data, lt_module module); static void * vm_sym (lt_user_data loader_data, lt_module module, const char *symbolname); static lt_dlvtable *vtable = 0; /* Return the vtable for this loader, only the name and sym_prefix attributes (plus the virtual function implementations, obviously) change between loaders. */ lt_dlvtable * get_vtable (lt_user_data loader_data) { if (!vtable) { vtable = lt__zalloc (sizeof *vtable); } if (vtable && !vtable->name) { vtable->name = "lt_dyld"; vtable->sym_prefix = "_"; vtable->dlloader_init = vl_init; vtable->module_open = vm_open; vtable->module_close = vm_close; vtable->find_sym = vm_sym; vtable->dlloader_exit = vl_exit; vtable->dlloader_data = loader_data; vtable->priority = LT_DLLOADER_APPEND; } if (vtable && (vtable->dlloader_data != loader_data)) { LT__SETERROR (INIT_LOADER); return 0; } return vtable; } /* --- IMPLEMENTATION --- */ #if defined(HAVE_MACH_O_DYLD_H) # if !defined(__APPLE_CC__) && !defined(__MWERKS__) && !defined(__private_extern__) /* Is this correct? Does it still function properly? */ # define __private_extern__ extern # endif # include #endif #include /* We have to put some stuff here that isn't in older dyld.h files */ #if !defined(ENUM_DYLD_BOOL) # define ENUM_DYLD_BOOL # undef FALSE # undef TRUE enum DYLD_BOOL { FALSE, TRUE }; #endif #if !defined(LC_REQ_DYLD) # define LC_REQ_DYLD 0x80000000 #endif #if !defined(LC_LOAD_WEAK_DYLIB) # define LC_LOAD_WEAK_DYLIB (0x18 | LC_REQ_DYLD) #endif #if !defined(NSADDIMAGE_OPTION_NONE) # define NSADDIMAGE_OPTION_NONE 0x0 #endif #if !defined(NSADDIMAGE_OPTION_RETURN_ON_ERROR) # define NSADDIMAGE_OPTION_RETURN_ON_ERROR 0x1 #endif #if !defined(NSADDIMAGE_OPTION_WITH_SEARCHING) # define NSADDIMAGE_OPTION_WITH_SEARCHING 0x2 #endif #if !defined(NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED) # define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED 0x4 #endif #if !defined(NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME) # define NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME 0x8 #endif #if !defined(NSLOOKUPSYMBOLINIMAGE_OPTION_BIND) # define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND 0x0 #endif #if !defined(NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW) # define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 0x1 #endif #if !defined(NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY) # define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY 0x2 #endif #if !defined(NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) # define NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR 0x4 #endif #define LT__SYMLOOKUP_OPTS (NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW \ | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) #if defined(__BIG_ENDIAN__) # define LT__MAGIC MH_MAGIC #else # define LT__MAGIC MH_CIGAM #endif #define DYLD__SETMYERROR(errmsg) LT__SETERRORSTR (dylderror (errmsg)) #define DYLD__SETERROR(errcode) DYLD__SETMYERROR (LT__STRERROR (errcode)) typedef struct mach_header mach_header; typedef struct dylib_command dylib_command; static const char *dylderror (const char *errmsg); static const mach_header *lt__nsmodule_get_header (NSModule module); static const char *lt__header_get_instnam (const mach_header *mh); static const mach_header *lt__match_loadedlib (const char *name); static NSSymbol lt__linkedlib_symbol (const char *symname, const mach_header *mh); static const mach_header *(*lt__addimage) (const char *image_name, unsigned long options) = 0; static NSSymbol (*lt__image_symbol) (const mach_header *image, const char *symbolName, unsigned long options) = 0; static enum DYLD_BOOL (*lt__image_symbol_p) (const mach_header *image, const char *symbolName) = 0; static enum DYLD_BOOL (*lt__module_export) (NSModule module) = 0; static int dyld_cannot_close = 0; /* A function called through the vtable when this loader is no longer needed by the application. */ static int vl_exit (lt_user_data LT__UNUSED loader_data) { vtable = NULL; return 0; } /* A function called through the vtable to initialise this loader. */ static int vl_init (lt_user_data loader_data) { int errors = 0; if (! dyld_cannot_close) { if (!_dyld_present ()) { ++errors; } else { (void) _dyld_func_lookup ("__dyld_NSAddImage", (unsigned long*) <__addimage); (void) _dyld_func_lookup ("__dyld_NSLookupSymbolInImage", (unsigned long*)<__image_symbol); (void) _dyld_func_lookup ("__dyld_NSIsSymbolNameDefinedInImage", (unsigned long*) <__image_symbol_p); (void) _dyld_func_lookup ("__dyld_NSMakePrivateModulePublic", (unsigned long*) <__module_export); dyld_cannot_close = lt_dladderror ("can't close a dylib"); } } return errors; } /* A function called through the vtable to open a module with this loader. Returns an opaque representation of the newly opened module for processing with this loader's other vtable functions. */ static lt_module vm_open (lt_user_data loader_data, const char *filename, lt_dladvise LT__UNUSED advise) { lt_module module = 0; NSObjectFileImage ofi = 0; if (!filename) { return (lt_module) -1; } switch (NSCreateObjectFileImageFromFile (filename, &ofi)) { case NSObjectFileImageSuccess: module = NSLinkModule (ofi, filename, NSLINKMODULE_OPTION_RETURN_ON_ERROR | NSLINKMODULE_OPTION_PRIVATE | NSLINKMODULE_OPTION_BINDNOW); NSDestroyObjectFileImage (ofi); if (module) { lt__module_export (module); } break; case NSObjectFileImageInappropriateFile: if (lt__image_symbol_p && lt__image_symbol) { module = (lt_module) lt__addimage(filename, NSADDIMAGE_OPTION_RETURN_ON_ERROR); } break; case NSObjectFileImageFailure: case NSObjectFileImageArch: case NSObjectFileImageFormat: case NSObjectFileImageAccess: /*NOWORK*/ break; } if (!module) { DYLD__SETERROR (CANNOT_OPEN); } return module; } /* A function called through the vtable when a particular module should be unloaded. */ static int vm_close (lt_user_data loader_data, lt_module module) { int errors = 0; if (module != (lt_module) -1) { const mach_header *mh = (const mach_header *) module; int flags = 0; if (mh->magic == LT__MAGIC) { lt_dlseterror (dyld_cannot_close); ++errors; } else { /* Currently, if a module contains c++ static destructors and it is unloaded, we get a segfault in atexit(), due to compiler and dynamic loader differences of opinion, this works around that. */ if ((const struct section *) NULL != getsectbynamefromheader (lt__nsmodule_get_header (module), "__DATA", "__mod_term_func")) { flags |= NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED; } #if defined(__ppc__) flags |= NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES; #endif if (!NSUnLinkModule (module, flags)) { DYLD__SETERROR (CANNOT_CLOSE); ++errors; } } } return errors; } /* A function called through the vtable to get the address of a symbol loaded from a particular module. */ static void * vm_sym (lt_user_data loader_data, lt_module module, const char *name) { NSSymbol *nssym = 0; const mach_header *mh = (const mach_header *) module; char saveError[256] = "Symbol not found"; if (module == (lt_module) -1) { void *address, *unused; _dyld_lookup_and_bind (name, (unsigned long*) &address, &unused); return address; } if (mh->magic == LT__MAGIC) { if (lt__image_symbol_p && lt__image_symbol) { if (lt__image_symbol_p (mh, name)) { nssym = lt__image_symbol (mh, name, LT__SYMLOOKUP_OPTS); } } } else { nssym = NSLookupSymbolInModule (module, name); } if (!nssym) { strncpy (saveError, dylderror (LT__STRERROR (SYMBOL_NOT_FOUND)), 255); saveError[255] = 0; if (!mh) { mh = (mach_header *)lt__nsmodule_get_header (module); } nssym = lt__linkedlib_symbol (name, mh); } if (!nssym) { LT__SETERRORSTR (saveError); } return nssym ? NSAddressOfSymbol (nssym) : 0; } /* --- HELPER FUNCTIONS --- */ /* Return the dyld error string, or the passed in error string if none. */ static const char * dylderror (const char *errmsg) { NSLinkEditErrors ler; int lerno; const char *file; const char *errstr; NSLinkEditError (&ler, &lerno, &file, &errstr); if (! (errstr && *errstr)) { errstr = errmsg; } return errstr; } /* There should probably be an apple dyld api for this. */ static const mach_header * lt__nsmodule_get_header (NSModule module) { int i = _dyld_image_count(); const char *modname = NSNameOfModule (module); const mach_header *mh = 0; if (!modname) return NULL; while (i > 0) { --i; if (strneq (_dyld_get_image_name (i), modname)) { mh = _dyld_get_image_header (i); break; } } return mh; } /* NSAddImage is also used to get the loaded image, but it only works if the lib is installed, for uninstalled libs we need to check the install_names against each other. Note that this is still broken if DYLD_IMAGE_SUFFIX is set and a different lib was loaded as a result. */ static const char * lt__header_get_instnam (const mach_header *mh) { unsigned long offset = sizeof(mach_header); const char* result = 0; int j; for (j = 0; j < mh->ncmds; j++) { struct load_command *lc; lc = (struct load_command*) (((unsigned long) mh) + offset); if (LC_ID_DYLIB == lc->cmd) { result=(char*)(((dylib_command*) lc)->dylib.name.offset + (unsigned long) lc); } offset += lc->cmdsize; } return result; } static const mach_header * lt__match_loadedlib (const char *name) { const mach_header *mh = 0; int i = _dyld_image_count(); while (i > 0) { const char *id; --i; id = lt__header_get_instnam (_dyld_get_image_header (i)); if (id && strneq (id, name)) { mh = _dyld_get_image_header (i); break; } } return mh; } /* Safe to assume our mh is good. */ static NSSymbol lt__linkedlib_symbol (const char *symname, const mach_header *mh) { NSSymbol symbol = 0; if (lt__image_symbol && NSIsSymbolNameDefined (symname)) { unsigned long offset = sizeof(mach_header); struct load_command *lc; int j; for (j = 0; j < mh->ncmds; j++) { lc = (struct load_command*) (((unsigned long) mh) + offset); if ((LC_LOAD_DYLIB == lc->cmd) || (LC_LOAD_WEAK_DYLIB == lc->cmd)) { unsigned long base = ((dylib_command *) lc)->dylib.name.offset; char *name = (char *) (base + (unsigned long) lc); const mach_header *mh1 = lt__match_loadedlib (name); if (!mh1) { /* Maybe NSAddImage can find it */ mh1 = lt__addimage (name, NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED | NSADDIMAGE_OPTION_WITH_SEARCHING | NSADDIMAGE_OPTION_RETURN_ON_ERROR); } if (mh1) { symbol = lt__image_symbol (mh1, symname, LT__SYMLOOKUP_OPTS); if (symbol) break; } } offset += lc->cmdsize; } } return symbol; } cpl-6.4.1/libltdl/libltdl/0000755000460300003120000000000012310333010012330 500000000000000cpl-6.4.1/libltdl/libltdl/lt_system.h0000644000460300003120000001237312310332715014465 00000000000000/* lt_system.h -- system portability abstraction layer Copyright (C) 2004, 2007, 2010 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if !defined(LT_SYSTEM_H) #define LT_SYSTEM_H 1 #include #include #include /* Some systems do not define EXIT_*, even with STDC_HEADERS. */ #if !defined(EXIT_SUCCESS) # define EXIT_SUCCESS 0 #endif #if !defined(EXIT_FAILURE) # define EXIT_FAILURE 1 #endif /* Just pick a big number... */ #define LT_FILENAME_MAX 2048 /* Saves on those hard to debug '\0' typos.... */ #define LT_EOS_CHAR '\0' /* LTDL_BEGIN_C_DECLS should be used at the beginning of your declarations, so that C++ compilers don't mangle their names. Use LTDL_END_C_DECLS at the end of C declarations. */ #if defined(__cplusplus) # define LT_BEGIN_C_DECLS extern "C" { # define LT_END_C_DECLS } #else # define LT_BEGIN_C_DECLS /* empty */ # define LT_END_C_DECLS /* empty */ #endif /* LT_STMT_START/END are used to create macros which expand to a a single compound statement in a portable way. */ #if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus) # define LT_STMT_START (void)( # define LT_STMT_END ) #else # if (defined (sun) || defined (__sun__)) # define LT_STMT_START if (1) # define LT_STMT_END else (void)0 # else # define LT_STMT_START do # define LT_STMT_END while (0) # endif #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* Canonicalise Windows and Cygwin recognition macros. To match the values set by recent Cygwin compilers, make sure that if __CYGWIN__ is defined (after canonicalisation), __WINDOWS__ is NOT! */ #if defined(__CYGWIN32__) && !defined(__CYGWIN__) # define __CYGWIN__ __CYGWIN32__ #endif #if defined(__CYGWIN__) # if defined(__WINDOWS__) # undef __WINDOWS__ # endif #elif defined(_WIN32) # define __WINDOWS__ _WIN32 #elif defined(WIN32) # define __WINDOWS__ WIN32 #endif #if defined(__CYGWIN__) && defined(__WINDOWS__) # undef __WINDOWS__ #endif /* DLL building support on win32 hosts; mostly to workaround their ridiculous implementation of data symbol exporting. */ #if !defined(LT_SCOPE) # if defined(__WINDOWS__) || defined(__CYGWIN__) # if defined(DLL_EXPORT) /* defined by libtool (if required) */ # define LT_SCOPE extern __declspec(dllexport) # endif # if defined(LIBLTDL_DLL_IMPORT) /* define if linking with this dll */ /* note: cygwin/mingw compilers can rely instead on auto-import */ # define LT_SCOPE extern __declspec(dllimport) # endif # endif # if !defined(LT_SCOPE) /* static linking or !__WINDOWS__ */ # define LT_SCOPE extern # endif #endif #if defined(__WINDOWS__) /* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory separator when it is set. */ # define LT_DIRSEP_CHAR '\\' # define LT_PATHSEP_CHAR ';' #else # define LT_PATHSEP_CHAR ':' #endif #if defined(_MSC_VER) /* Visual Studio */ # define R_OK 4 #endif /* fopen() mode flags for reading a text file */ #undef LT_READTEXT_MODE #if defined(__WINDOWS__) || defined(__CYGWIN__) # define LT_READTEXT_MODE "rt" #else # define LT_READTEXT_MODE "r" #endif /* The extra indirection to the LT__STR and LT__CONC macros is required so that if the arguments to LT_STR() (or LT_CONC()) are themselves macros, they will be expanded before being quoted. */ #ifndef LT_STR # define LT__STR(arg) #arg # define LT_STR(arg) LT__STR(arg) #endif #ifndef LT_CONC # define LT__CONC(a, b) a##b # define LT_CONC(a, b) LT__CONC(a, b) #endif #ifndef LT_CONC3 # define LT__CONC3(a, b, c) a##b##c # define LT_CONC3(a, b, c) LT__CONC3(a, b, c) #endif #endif /*!defined(LT_SYSTEM_H)*/ cpl-6.4.1/libltdl/libltdl/lt_dlloader.h0000644000460300003120000000620012310332715014717 00000000000000/* lt_dlloader.h -- dynamic library loader interface Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if !defined(LT_DLLOADER_H) #define LT_DLLOADER_H 1 #include LT_BEGIN_C_DECLS typedef void * lt_dlloader; typedef void * lt_module; typedef void * lt_user_data; typedef struct lt__advise * lt_dladvise; /* Function pointer types for module loader vtable entries: */ typedef lt_module lt_module_open (lt_user_data data, const char *filename, lt_dladvise advise); typedef int lt_module_close (lt_user_data data, lt_module module); typedef void * lt_find_sym (lt_user_data data, lt_module module, const char *symbolname); typedef int lt_dlloader_init (lt_user_data data); typedef int lt_dlloader_exit (lt_user_data data); /* Default priority is LT_DLLOADER_PREPEND if none is explicitly given. */ typedef enum { LT_DLLOADER_PREPEND = 0, LT_DLLOADER_APPEND } lt_dlloader_priority; /* This structure defines a module loader, as populated by the get_vtable entry point of each loader. */ typedef struct { const char * name; const char * sym_prefix; lt_module_open * module_open; lt_module_close * module_close; lt_find_sym * find_sym; lt_dlloader_init * dlloader_init; lt_dlloader_exit * dlloader_exit; lt_user_data dlloader_data; lt_dlloader_priority priority; } lt_dlvtable; LT_SCOPE int lt_dlloader_add (const lt_dlvtable *vtable); LT_SCOPE lt_dlloader lt_dlloader_next (const lt_dlloader loader); LT_SCOPE lt_dlvtable * lt_dlloader_remove (const char *name); LT_SCOPE const lt_dlvtable *lt_dlloader_find (const char *name); LT_SCOPE const lt_dlvtable *lt_dlloader_get (lt_dlloader loader); /* Type of a function to get a loader's vtable: */ typedef const lt_dlvtable *lt_get_vtable (lt_user_data data); #ifdef LT_DEBUG_LOADERS LT_SCOPE void lt_dlloader_dump (void); #endif LT_END_C_DECLS #endif /*!defined(LT_DLLOADER_H)*/ cpl-6.4.1/libltdl/libltdl/slist.h0000644000460300003120000000623112310332715013574 00000000000000/* slist.h -- generalised singly linked lists Copyright (C) 2000, 2004, 2009 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2000 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* A generalised list. This is deliberately transparent so that you can make the NEXT field of all your chained data structures first, and then cast them to `(SList *)' so that they can be manipulated by this API. Alternatively, you can generate raw SList elements using slist_new(), and put the element data in the USERDATA field. Either way you get to manage the memory involved by yourself. */ #if !defined(SLIST_H) #define SLIST_H 1 #if defined(LTDL) # include # include #else # define LT_SCOPE #endif #include #if defined(__cplusplus) extern "C" { #endif typedef struct slist { struct slist *next; /* chain forward pointer*/ const void *userdata; /* for boxed `SList' item */ } SList; typedef void * SListCallback (SList *item, void *userdata); typedef int SListCompare (const SList *item1, const SList *item2, void *userdata); LT_SCOPE SList *slist_concat (SList *head, SList *tail); LT_SCOPE SList *slist_cons (SList *item, SList *slist); LT_SCOPE SList *slist_delete (SList *slist, void (*delete_fct) (void *item)); LT_SCOPE SList *slist_remove (SList **phead, SListCallback *find, void *matchdata); LT_SCOPE SList *slist_reverse (SList *slist); LT_SCOPE SList *slist_sort (SList *slist, SListCompare *compare, void *userdata); LT_SCOPE SList *slist_tail (SList *slist); LT_SCOPE SList *slist_nth (SList *slist, size_t n); LT_SCOPE void * slist_find (SList *slist, SListCallback *find, void *matchdata); LT_SCOPE size_t slist_length (SList *slist); LT_SCOPE void * slist_foreach (SList *slist, SListCallback *foreach, void *userdata); LT_SCOPE SList *slist_box (const void *userdata); LT_SCOPE void * slist_unbox (SList *item); #if defined(__cplusplus) } #endif #if !defined(LTDL) # undef LT_SCOPE #endif #endif /*!defined(SLIST_H)*/ cpl-6.4.1/libltdl/libltdl/lt__glibc.h0000644000460300003120000000524012310332715014353 00000000000000/* lt__glibc.h -- support for non glibc environments Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #if !defined(LT__GLIBC_H) #define LT__GLIBC_H 1 #if defined(LT_CONFIG_H) # include LT_CONFIG_H #else # include #endif #if !defined(HAVE_ARGZ_H) || !defined(HAVE_WORKING_ARGZ) /* Redefine any glibc symbols we reimplement to import the implementations into our lt__ namespace so we don't ever clash with the system library if our clients use argz_* from there in addition to libltdl. */ # undef argz_append # define argz_append lt__argz_append # undef argz_create_sep # define argz_create_sep lt__argz_create_sep # undef argz_insert # define argz_insert lt__argz_insert # undef argz_next # define argz_next lt__argz_next # undef argz_stringify # define argz_stringify lt__argz_stringify #endif #ifdef __cplusplus extern "C" { #endif #include #ifdef __cplusplus } #endif # define slist_concat lt__slist_concat # define slist_cons lt__slist_cons # define slist_delete lt__slist_delete # define slist_remove lt__slist_remove # define slist_reverse lt__slist_reverse # define slist_sort lt__slist_sort # define slist_tail lt__slist_tail # define slist_nth lt__slist_nth # define slist_find lt__slist_find # define slist_length lt__slist_length # define slist_foreach lt__slist_foreach # define slist_box lt__slist_box # define slist_unbox lt__slist_unbox #include #endif /*!defined(LT__GLIBC_H)*/ cpl-6.4.1/libltdl/libltdl/lt_error.h0000644000460300003120000000707212310332715014272 00000000000000/* lt_error.h -- error propogation interface Copyright (C) 1999, 2000, 2001, 2004, 2007 Free Software Foundation, Inc. Written by Thomas Tanner, 1999 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Only include this header file once. */ #if !defined(LT_ERROR_H) #define LT_ERROR_H 1 #include LT_BEGIN_C_DECLS /* Defining error strings alongside their symbolic names in a macro in this way allows us to expand the macro in different contexts with confidence that the enumeration of symbolic names will map correctly onto the table of error strings. \0 is appended to the strings to expilicitely initialize the string terminator. */ #define lt_dlerror_table \ LT_ERROR(UNKNOWN, "unknown error\0") \ LT_ERROR(DLOPEN_NOT_SUPPORTED, "dlopen support not available\0") \ LT_ERROR(INVALID_LOADER, "invalid loader\0") \ LT_ERROR(INIT_LOADER, "loader initialization failed\0") \ LT_ERROR(REMOVE_LOADER, "loader removal failed\0") \ LT_ERROR(FILE_NOT_FOUND, "file not found\0") \ LT_ERROR(DEPLIB_NOT_FOUND, "dependency library not found\0") \ LT_ERROR(NO_SYMBOLS, "no symbols defined\0") \ LT_ERROR(CANNOT_OPEN, "can't open the module\0") \ LT_ERROR(CANNOT_CLOSE, "can't close the module\0") \ LT_ERROR(SYMBOL_NOT_FOUND, "symbol not found\0") \ LT_ERROR(NO_MEMORY, "not enough memory\0") \ LT_ERROR(INVALID_HANDLE, "invalid module handle\0") \ LT_ERROR(BUFFER_OVERFLOW, "internal buffer overflow\0") \ LT_ERROR(INVALID_ERRORCODE, "invalid errorcode\0") \ LT_ERROR(SHUTDOWN, "library already shutdown\0") \ LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module\0") \ LT_ERROR(INVALID_MUTEX_ARGS, "internal error (code withdrawn)\0")\ LT_ERROR(INVALID_POSITION, "invalid search path insert position\0")\ LT_ERROR(CONFLICTING_FLAGS, "symbol visibility can be global or local\0") /* Enumerate the symbolic error names. */ enum { #define LT_ERROR(name, diagnostic) LT_CONC(LT_ERROR_, name), lt_dlerror_table #undef LT_ERROR LT_ERROR_MAX }; /* Should be max of the error string lengths above (plus one for C++) */ #define LT_ERROR_LEN_MAX (41) /* These functions are only useful from inside custom module loaders. */ LT_SCOPE int lt_dladderror (const char *diagnostic); LT_SCOPE int lt_dlseterror (int errorcode); LT_END_C_DECLS #endif /*!defined(LT_ERROR_H)*/ cpl-6.4.1/libltdl/libltdl/lt__dirent.h0000644000460300003120000000472412310332715014566 00000000000000/* lt__dirent.h -- internal directory entry scanning interface Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc. Written by Bob Friesenhahn, 2001 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #if !defined(LT__DIRENT_H) #define LT__DIRENT_H 1 #if defined(LT_CONFIG_H) # include LT_CONFIG_H #else # include #endif #include "lt_system.h" #ifdef HAVE_DIRENT_H /* We have a fully operational dirent subsystem. */ # include # define D_NAMLEN(dirent) (strlen((dirent)->d_name)) #elif defined __WINDOWS__ /* Use some wrapper code to emulate dirent on windows.. */ # define WINDOWS_DIRENT_EMULATION 1 # include # define D_NAMLEN(dirent) (strlen((dirent)->d_name)) # define dirent lt__dirent # define DIR lt__DIR # define opendir lt__opendir # define readdir lt__readdir # define closedir lt__closedir LT_BEGIN_C_DECLS struct dirent { char d_name[LT_FILENAME_MAX]; int d_namlen; }; typedef struct { HANDLE hSearch; WIN32_FIND_DATA Win32FindData; BOOL firsttime; struct dirent file_info; } DIR; LT_SCOPE DIR * opendir (const char *path); LT_SCOPE struct dirent *readdir (DIR *entry); LT_SCOPE void closedir (DIR *entry); LT_END_C_DECLS #else /* !defined(__WINDOWS__)*/ ERROR - cannot find dirent #endif /*!defined(__WINDOWS__)*/ #endif /*!defined(LT__DIRENT_H)*/ cpl-6.4.1/libltdl/libltdl/lt__private.h0000644000460300003120000001065012310332715014746 00000000000000/* lt__private.h -- internal apis for libltdl Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy con be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #if !defined(LT__PRIVATE_H) #define LT__PRIVATE_H 1 #if defined(LT_CONFIG_H) # include LT_CONFIG_H #else # include #endif #include #include #include #include #include #if defined(HAVE_UNISTD_H) # include #endif /* Import internal interfaces... */ #include "lt__alloc.h" #include "lt__dirent.h" #include "lt__strl.h" #include "lt__glibc.h" /* ...and all exported interfaces. */ #include "ltdl.h" #if defined(WITH_DMALLOC) # include #endif /* DLL building support on win32 hosts; mostly to workaround their ridiculous implementation of data symbol exporting. */ #ifndef LT_GLOBAL_DATA # if defined(__WINDOWS__) || defined(__CYGWIN__) # if defined(DLL_EXPORT) /* defined by libtool (if required) */ # define LT_GLOBAL_DATA __declspec(dllexport) # endif # endif # ifndef LT_GLOBAL_DATA # define LT_GLOBAL_DATA /* static linking or !__WINDOWS__ */ # endif #endif #ifndef __attribute__ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ # define __attribute__(x) # endif #endif #ifndef LT__UNUSED # define LT__UNUSED __attribute__ ((__unused__)) #endif LT_BEGIN_C_DECLS #if !defined(errno) extern int errno; #endif LT_SCOPE void lt__alloc_die_callback (void); /* For readability: */ #define strneq(s1, s2) (strcmp((s1), (s2)) != 0) #define streq(s1, s2) (!strcmp((s1), (s2))) /* --- OPAQUE STRUCTURES DECLARED IN LTDL.H --- */ /* This type is used for the array of interface data sets in each handler. */ typedef struct { lt_dlinterface_id key; void * data; } lt_interface_data; struct lt__handle { lt_dlhandle next; const lt_dlvtable * vtable; /* dlopening interface */ lt_dlinfo info; /* user visible fields */ int depcount; /* number of dependencies */ lt_dlhandle * deplibs; /* dependencies */ lt_module module; /* system module handle */ void * system; /* system specific data */ lt_interface_data * interface_data; /* per caller associated data */ int flags; /* various boolean stats */ }; struct lt__advise { unsigned int try_ext:1; /* try system library extensions. */ unsigned int is_resident:1; /* module can't be unloaded. */ unsigned int is_symglobal:1; /* module symbols can satisfy subsequently loaded modules. */ unsigned int is_symlocal:1; /* module symbols are only available locally. */ unsigned int try_preload_only:1;/* only preloaded modules will be tried. */ }; /* --- ERROR HANDLING --- */ /* Extract the diagnostic strings from the error table macro in the same order as the enumerated indices in lt_error.h. */ #define LT__STRERROR(name) lt__error_string(LT_CONC(LT_ERROR_,name)) #define LT__GETERROR(lvalue) (lvalue) = lt__get_last_error() #define LT__SETERRORSTR(errormsg) lt__set_last_error(errormsg) #define LT__SETERROR(errorcode) LT__SETERRORSTR(LT__STRERROR(errorcode)) LT_SCOPE const char *lt__error_string (int errorcode); LT_SCOPE const char *lt__get_last_error (void); LT_SCOPE const char *lt__set_last_error (const char *errormsg); LT_END_C_DECLS #endif /*!defined(LT__PRIVATE_H)*/ cpl-6.4.1/libltdl/libltdl/lt__strl.h0000644000460300003120000000370012310332715014256 00000000000000/* lt__strl.h -- size-bounded string copying and concatenation Copyright (C) 2004, 2006 Free Software Foundation, Inc. Written by Bob Friesenhahn, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if !defined(LT__STRL_H) #define LT__STRL_H 1 #if defined(LT_CONFIG_H) # include LT_CONFIG_H #else # include #endif #include #include "lt_system.h" #if !defined(HAVE_STRLCAT) # define strlcat(dst,src,dstsize) lt_strlcat(dst,src,dstsize) LT_SCOPE size_t lt_strlcat(char *dst, const char *src, const size_t dstsize); #endif /* !defined(HAVE_STRLCAT) */ #if !defined(HAVE_STRLCPY) # define strlcpy(dst,src,dstsize) lt_strlcpy(dst,src,dstsize) LT_SCOPE size_t lt_strlcpy(char *dst, const char *src, const size_t dstsize); #endif /* !defined(HAVE_STRLCPY) */ #endif /*!defined(LT__STRL_H)*/ cpl-6.4.1/libltdl/libltdl/lt__alloc.h0000644000460300003120000000422312310332715014365 00000000000000/* lt__alloc.h -- internal memory management interface Copyright (C) 2004 Free Software Foundation, Inc. Written by Gary V. Vaughan, 2004 NOTE: The canonical source of this file is maintained with the GNU Libtool package. Report bugs to bug-libtool@gnu.org. GNU Libltdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU Lesser General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libltdl 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with GNU Libltdl; see the file COPYING.LIB. If not, a copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, or obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #if !defined(LT__ALLOC_H) #define LT__ALLOC_H 1 #include "lt_system.h" LT_BEGIN_C_DECLS #define MALLOC(tp, n) (tp*) lt__malloc((n) * sizeof(tp)) #define REALLOC(tp, mem, n) (tp*) lt__realloc((mem), (n) * sizeof(tp)) #define FREE(mem) LT_STMT_START { \ if (mem) { free ((void *)mem); mem = NULL; } } LT_STMT_END #define MEMREASSIGN(p, q) LT_STMT_START { \ if ((p) != (q)) { if (p) free (p); (p) = (q); (q) = 0; } \ } LT_STMT_END /* If set, this function is called when memory allocation has failed. */ LT_SCOPE void (*lt__alloc_die) (void); LT_SCOPE void *lt__malloc (size_t n); LT_SCOPE void *lt__zalloc (size_t n); LT_SCOPE void *lt__realloc (void *mem, size_t n); LT_SCOPE void *lt__memdup (void const *mem, size_t n); LT_SCOPE char *lt__strdup (const char *string); LT_END_C_DECLS #endif /*!defined(LT__ALLOC_H)*/